diff --git a/Makefile b/Makefile index 122b506d5..d44aac053 100755 --- a/Makefile +++ b/Makefile @@ -124,10 +124,6 @@ $(C_BUILDDIR)/agb_flash_mx.o: CC1FLAGS := -O -mthumb-interwork $(C_BUILDDIR)/m4a.o: CC1 := tools/agbcc/bin/old_agbcc -# Stack size in sub_801A9E0 is funky with an unused var -$(C_BUILDDIR)/kecleon_bros.o: CC1FLAGS := -mthumb-interwork -Wimplicit -Wparentheses -Werror -O2 -fhex-asm - - #### Main Rules #### diff --git a/asm/code_8002774.s b/asm/code_8002774.s index a9f59edfc..4478b3723 100644 --- a/asm/code_8002774.s +++ b/asm/code_8002774.s @@ -417,6 +417,9 @@ _08002A68: bx r1 thumb_func_end sub_8002984 +@ https://decomp.me/scratch/HXC9z +@ https://decomp.me/scratch/BWmWQ +@ https://decomp.me/scratch/QfX03 thumb_func_start sub_8002A70 sub_8002A70: push {r4,lr} @@ -491,6 +494,8 @@ _08002AFC: bx r1 thumb_func_end sub_8002A70 +@ https://decomp.me/scratch/oCt37 +@ https://decomp.me/scratch/ZTHtV [Probably the correct one] thumb_func_start sub_8002B04 sub_8002B04: push {lr} diff --git a/asm/code_8009804.s b/asm/code_8009804.s index 9498ccd8b..c5d1061ae 100644 --- a/asm/code_8009804.s +++ b/asm/code_8009804.s @@ -320,1760 +320,3 @@ _08009C54: .4byte gUnknown_202D2A0 _08009C58: .4byte gUnknown_202B038 thumb_func_end sub_8009BE4 - thumb_func_start FastMod3 - @ return arg % 3 - @ Has a lookup table up to 0x100 -FastMod3: - push {lr} - adds r1, r0, 0 - cmp r1, 0xFF - ble _08009C6C - movs r1, 0x3 - bl __modsi3 - b _08009C72 -_08009C6C: - ldr r0, =gFastMod3Lookup - adds r0, r1, r0 - ldrb r0, [r0] -_08009C72: - pop {r1} - bx r1 -.pool - thumb_func_end FastMod3 - - thumb_func_start sub_8009C7C -sub_8009C7C: - push {lr} - adds r2, r0, 0 - movs r3, 0xC0 - lsls r3, 4 - adds r1, r2, 0 - ands r1, r3 - movs r0, 0x80 - lsls r0, 3 - cmp r1, r0 - beq _08009CB8 - cmp r1, r0 - bgt _08009C9A - cmp r1, 0 - beq _08009CA8 - b _08009CFC -_08009C9A: - movs r0, 0x80 - lsls r0, 4 - cmp r1, r0 - beq _08009CD0 - cmp r1, r3 - beq _08009CE0 - b _08009CFC -_08009CA8: - ldr r0, _08009CB0 - ldr r1, _08009CB4 - ands r1, r2 - b _08009CBE - .align 2, 0 -_08009CB0: .4byte gUnknown_80B8AE4 -_08009CB4: .4byte 0x000003ff -_08009CB8: - ldr r0, _08009CC8 - ldr r1, _08009CCC - bics r1, r2 -_08009CBE: - lsls r1, 1 - adds r1, r0 - movs r2, 0 - ldrsh r0, [r1, r2] - b _08009CFE - .align 2, 0 -_08009CC8: .4byte gUnknown_80B8AE4 -_08009CCC: .4byte 0x000003ff -_08009CD0: - ldr r0, _08009CD8 - ldr r1, _08009CDC - ands r1, r2 - b _08009CE6 - .align 2, 0 -_08009CD8: .4byte gUnknown_80B8AE4 -_08009CDC: .4byte 0x000003ff -_08009CE0: - ldr r0, _08009CF4 - ldr r1, _08009CF8 - bics r1, r2 -_08009CE6: - lsls r1, 1 - adds r1, r0 - movs r2, 0 - ldrsh r0, [r1, r2] - negs r0, r0 - b _08009CFE - .align 2, 0 -_08009CF4: .4byte gUnknown_80B8AE4 -_08009CF8: .4byte 0x000003ff -_08009CFC: - movs r0, 0 -_08009CFE: - pop {r1} - bx r1 - thumb_func_end sub_8009C7C - - thumb_func_start sub_8009D04 -sub_8009D04: - push {lr} - adds r2, r0, 0 - movs r3, 0xC0 - lsls r3, 4 - adds r1, r2, 0 - ands r1, r3 - movs r0, 0x80 - lsls r0, 3 - cmp r1, r0 - beq _08009D40 - cmp r1, r0 - bgt _08009D22 - cmp r1, 0 - beq _08009D30 - b _08009D84 -_08009D22: - movs r0, 0x80 - lsls r0, 4 - cmp r1, r0 - beq _08009D50 - cmp r1, r3 - beq _08009D6C - b _08009D84 -_08009D30: - ldr r0, _08009D38 - ldr r1, _08009D3C - bics r1, r2 - b _08009D72 - .align 2, 0 -_08009D38: .4byte gUnknown_80B8AE4 -_08009D3C: .4byte 0x000003ff -_08009D40: - ldr r0, _08009D48 - ldr r1, _08009D4C - ands r1, r2 - b _08009D56 - .align 2, 0 -_08009D48: .4byte gUnknown_80B8AE4 -_08009D4C: .4byte 0x000003ff -_08009D50: - ldr r0, _08009D64 - ldr r1, _08009D68 - bics r1, r2 -_08009D56: - lsls r1, 1 - adds r1, r0 - movs r2, 0 - ldrsh r0, [r1, r2] - negs r0, r0 - b _08009D86 - .align 2, 0 -_08009D64: .4byte gUnknown_80B8AE4 -_08009D68: .4byte 0x000003ff -_08009D6C: - ldr r0, _08009D7C - ldr r1, _08009D80 - ands r1, r2 -_08009D72: - lsls r1, 1 - adds r1, r0 - movs r2, 0 - ldrsh r0, [r1, r2] - b _08009D86 - .align 2, 0 -_08009D7C: .4byte gUnknown_80B8AE4 -_08009D80: .4byte 0x000003ff -_08009D84: - movs r0, 0 -_08009D86: - pop {r1} - bx r1 - thumb_func_end sub_8009D04 - - thumb_func_start sub_8009D8C -sub_8009D8C: - push {lr} - cmp r0, r2 - bcc _08009D9A - cmp r0, r2 - bhi _08009D9E - cmp r1, r3 - bcs _08009D9E -_08009D9A: - movs r0, 0x1 - b _08009DA0 -_08009D9E: - movs r0, 0 -_08009DA0: - pop {r1} - bx r1 - thumb_func_end sub_8009D8C - - thumb_func_start sub_8009DA4 -sub_8009DA4: - push {r4,r5,lr} - lsrs r2, r0, 31 - adds r5, r2, 0 - lsrs r3, r1, 31 - adds r4, r3, 0 - cmp r0, 0 - beq _08009DB6 - cmp r1, 0 - bne _08009DBA -_08009DB6: - movs r0, 0 - b _08009DD0 -_08009DBA: - cmp r2, 0 - beq _08009DC0 - negs r0, r0 -_08009DC0: - cmp r3, 0 - beq _08009DC6 - negs r1, r1 -_08009DC6: - bl sub_8009E14 - cmp r5, r4 - beq _08009DD0 - negs r0, r0 -_08009DD0: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8009DA4 - - thumb_func_start sub_8009DD8 -sub_8009DD8: - push {r4,r5,lr} - lsrs r2, r0, 31 - adds r5, r2, 0 - lsrs r3, r1, 31 - adds r4, r3, 0 - cmp r1, 0 - bne _08009DF0 - ldr r0, _08009DEC - b _08009E0E - .align 2, 0 -_08009DEC: .4byte 0x7fffffff -_08009DF0: - cmp r0, 0 - bne _08009DF8 - movs r0, 0 - b _08009E0E -_08009DF8: - cmp r2, 0 - beq _08009DFE - negs r0, r0 -_08009DFE: - cmp r3, 0 - beq _08009E04 - negs r1, r1 -_08009E04: - bl sub_8009EA0 - cmp r5, r4 - beq _08009E0E - negs r0, r0 -_08009E0E: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8009DD8 - - thumb_func_start sub_8009E14 -sub_8009E14: - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - cmp r0, 0 - beq _08009E24 - cmp r1, 0 - bne _08009E28 -_08009E24: - movs r0, 0 - b _08009E94 -_08009E28: - movs r5, 0 - adds r3, r0, 0 - mov r12, r5 - movs r6, 0 - movs r4, 0 - movs r0, 0x80 - lsls r0, 24 - mov r8, r0 - movs r7, 0x3F - mov r9, r7 -_08009E3C: - adds r2, r4, 0 - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08009E50 - adds r4, r3 - adds r6, r5 - cmp r2, r4 - bls _08009E50 - adds r6, 0x1 -_08009E50: - lsrs r1, 1 - movs r2, 0x1 - mov r0, r12 - ands r0, r2 - cmp r0, 0 - beq _08009E60 - mov r0, r8 - orrs r1, r0 -_08009E60: - mov r7, r12 - lsrs r7, 1 - mov r12, r7 - lsls r5, 1 - adds r0, r3, 0 - mov r7, r8 - ands r0, r7 - cmp r0, 0 - beq _08009E74 - orrs r5, r2 -_08009E74: - lsls r3, 1 - movs r0, 0x1 - negs r0, r0 - add r9, r0 - mov r7, r9 - cmp r7, 0 - bge _08009E3C - lsrs r1, r4, 7 - ands r1, r2 - lsrs r4, 8 - lsls r0, r6, 24 - orrs r4, r0 - cmp r1, 0 - beq _08009E92 - adds r4, 0x1 -_08009E92: - adds r0, r4, 0 -_08009E94: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8009E14 - - thumb_func_start sub_8009EA0 -sub_8009EA0: - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - cmp r1, 0 - bne _08009EB8 - ldr r0, _08009EB4 - b _08009F58 - .align 2, 0 -_08009EB4: .4byte 0x7fffffff -_08009EB8: - cmp r0, 0 - bne _08009EC0 - movs r0, 0 - b _08009F58 -_08009EC0: - lsrs r7, r0, 24 - lsls r6, r0, 8 - mov r10, r1 - movs r0, 0 - mov r9, r0 - movs r5, 0 - movs r4, 0 - movs r1, 0x1 - mov r8, r1 - movs r2, 0x3F - str r2, [sp] -_08009ED6: - lsls r5, 1 - adds r0, r4, 0 - movs r1, 0x80 - lsls r1, 24 - ands r0, r1 - cmp r0, 0 - beq _08009EE8 - mov r2, r8 - orrs r5, r2 -_08009EE8: - movs r1, 0x2 - negs r1, r1 - lsls r4, 1 - adds r0, r7, 0 - movs r2, 0x80 - lsls r2, 24 - ands r0, r2 - cmp r0, 0 - beq _08009EFE - mov r0, r8 - orrs r4, r0 -_08009EFE: - lsls r7, 1 - adds r0, r6, 0 - movs r2, 0x80 - lsls r2, 24 - ands r0, r2 - cmp r0, 0 - beq _08009F10 - mov r0, r8 - orrs r7, r0 -_08009F10: - lsls r6, 1 - ands r6, r1 - adds r0, r5, 0 - adds r1, r4, 0 - movs r2, 0 - mov r3, r10 - bl sub_8009D8C - lsls r0, 24 - cmp r0, 0 - bne _08009F3A - adds r0, r4, 0 - movs r1, 0x1 - mov r2, r10 - subs r4, r2 - movs r2, 0 - subs r5, r2 - cmp r0, r4 - bcs _08009F3C - subs r5, 0x1 - b _08009F3C -_08009F3A: - movs r1, 0 -_08009F3C: - mov r0, r9 - lsls r0, 1 - mov r9, r0 - cmp r1, 0 - beq _08009F4C - mov r1, r8 - orrs r0, r1 - mov r9, r0 -_08009F4C: - ldr r2, [sp] - subs r2, 0x1 - str r2, [sp] - cmp r2, 0 - bge _08009ED6 - mov r0, r9 -_08009F58: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8009EA0 - - thumb_func_start sub_8009F68 -sub_8009F68: - push {r4-r7,lr} - adds r5, r0, 0 - adds r6, r1, 0 - adds r4, r6, 0 - cmp r6, 0 - bge _08009F76 - negs r4, r6 -_08009F76: - movs r7, 0x80 - lsls r7, 1 - cmp r4, 0 - beq _08009FA0 -_08009F7E: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _08009F90 - adds r0, r7, 0 - adds r1, r5, 0 - bl sub_8009DA4 - adds r7, r0, 0 -_08009F90: - adds r0, r5, 0 - adds r1, r5, 0 - bl sub_8009DA4 - adds r5, r0, 0 - asrs r4, 1 - cmp r4, 0 - bne _08009F7E -_08009FA0: - cmp r6, 0 - bge _08009FB0 - movs r0, 0x80 - lsls r0, 1 - adds r1, r7, 0 - bl sub_8009DD8 - b _08009FB2 -_08009FB0: - adds r0, r7, 0 -_08009FB2: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8009F68 - - thumb_func_start sub_8009FB8 -sub_8009FB8: - push {r4-r7,lr} - adds r5, r0, 0 - adds r6, r1, 0 - cmp r5, 0 - bge _08009FC4 - negs r5, r5 -_08009FC4: - cmp r6, 0 - bge _08009FCA - negs r6, r6 -_08009FCA: - cmp r5, r6 - bge _08009FD4 - adds r4, r5, 0 - adds r5, r6, 0 - adds r6, r4, 0 -_08009FD4: - cmp r6, 0 - beq _0800A016 - movs r7, 0x2 -_08009FDA: - adds r0, r6, 0 - adds r1, r5, 0 - bl sub_8009DD8 - adds r4, r0, 0 - adds r1, r4, 0 - bl sub_8009DA4 - adds r4, r0, 0 - movs r0, 0x80 - lsls r0, 3 - adds r1, r4, r0 - adds r0, r4, 0 - bl sub_8009DD8 - adds r4, r0, 0 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_8009DA4 - lsls r0, 1 - adds r5, r0 - adds r0, r6, 0 - adds r1, r4, 0 - bl sub_8009DA4 - adds r6, r0, 0 - subs r7, 0x1 - cmp r7, 0 - bge _08009FDA -_0800A016: - adds r0, r5, 0 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8009FB8 - - thumb_func_start sub_800A020 -sub_800A020: - push {r4,lr} - adds r3, r0, 0 - ldr r4, _0800A044 - lsrs r2, r1, 16 - str r2, [r3] - lsls r0, r1, 16 - str r0, [r3, 0x4] - movs r0, 0x80 - lsls r0, 8 - ands r0, r1 - cmp r0, 0 - beq _0800A03C - orrs r2, r4 - str r2, [r3] -_0800A03C: - pop {r4} - pop {r0} - bx r0 - .align 2, 0 -_0800A044: .4byte 0xffff0000 - thumb_func_end sub_800A020 - - thumb_func_start sub_800A048 -sub_800A048: - push {lr} - ldrh r1, [r0] - lsls r2, r1, 16 - ldr r0, [r0, 0x4] - lsrs r1, r0, 16 - orrs r2, r1 - movs r1, 0x80 - lsls r1, 8 - ands r0, r1 - cmp r0, 0 - beq _0800A060 - adds r2, 0x1 -_0800A060: - adds r0, r2, 0 - pop {r1} - bx r1 - thumb_func_end sub_800A048 - - thumb_func_start sub_800A068 -sub_800A068: - push {lr} - ldrb r1, [r0] - lsls r2, r1, 24 - ldr r0, [r0, 0x4] - lsrs r1, r0, 8 - orrs r2, r1 - movs r1, 0x80 - lsls r1, 8 - ands r0, r1 - cmp r0, 0 - beq _0800A080 - adds r2, 0x1 -_0800A080: - adds r0, r2, 0 - pop {r1} - bx r1 - thumb_func_end sub_800A068 - - thumb_func_start sub_800A088 -sub_800A088: - push {lr} - adds r2, r0, 0 - lsls r0, r1, 8 - str r0, [r2, 0x4] - asrs r1, 24 - str r1, [r2] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0800A0A4 - movs r0, 0x80 - negs r0, r0 - orrs r1, r0 - b _0800A0A8 -_0800A0A4: - movs r0, 0x7F - ands r1, r0 -_0800A0A8: - str r1, [r2] - pop {r0} - bx r0 - thumb_func_end sub_800A088 - - thumb_func_start sub_800A0B0 -sub_800A0B0: - push {lr} - ldr r2, [r0, 0x4] - ldr r3, [r0] - cmp r2, 0 - bne _0800A0C2 - cmp r3, 0 - bne _0800A0C2 - movs r0, 0 - b _0800A254 -_0800A0C2: - cmp r2, 0 - ble _0800A18C - cmp r3, 0 - ble _0800A124 - cmp r2, r3 - bge _0800A0F0 - asrs r1, r3, 8 - cmp r1, 0 - beq _0800A0FE - adds r0, r2, 0 - bl __divsi3 - adds r2, r0, 0 - cmp r2, 0xFF - ble _0800A0E2 - movs r2, 0xFF -_0800A0E2: - ldr r0, _0800A0EC - lsls r1, r2, 2 - adds r1, r0 - ldr r0, [r1] - b _0800A252 - .align 2, 0 -_0800A0EC: .4byte gUnknown_80B92E4 -_0800A0F0: - adds r1, r2, 0 - cmp r2, 0 - bge _0800A0F8 - adds r1, 0xFF -_0800A0F8: - asrs r1, 8 - cmp r1, 0 - bne _0800A104 -_0800A0FE: - movs r0, 0x80 - lsls r0, 2 - b _0800A254 -_0800A104: - adds r0, r3, 0 - bl __divsi3 - adds r2, r0, 0 - cmp r2, 0xFF - ble _0800A112 - movs r2, 0xFF -_0800A112: - ldr r1, _0800A120 - lsls r0, r2, 2 - adds r0, r1 - ldr r1, [r0] - movs r0, 0x40 - b _0800A250 - .align 2, 0 -_0800A120: .4byte gUnknown_80B92E4 -_0800A124: - negs r3, r3 - cmp r2, r3 - bge _0800A158 - adds r1, r3, 0 - cmp r3, 0 - bge _0800A132 - adds r1, 0xFF -_0800A132: - asrs r1, 8 - cmp r1, 0 - beq _0800A166 - adds r0, r2, 0 - bl __divsi3 - adds r2, r0, 0 - cmp r2, 0xFF - ble _0800A146 - movs r2, 0xFF -_0800A146: - ldr r1, _0800A154 - lsls r0, r2, 2 - adds r0, r1 - ldr r1, [r0] - movs r0, 0x80 - b _0800A250 - .align 2, 0 -_0800A154: .4byte gUnknown_80B92E4 -_0800A158: - adds r1, r2, 0 - cmp r2, 0 - bge _0800A160 - adds r1, 0xFF -_0800A160: - asrs r1, 8 - cmp r1, 0 - bne _0800A16C -_0800A166: - movs r0, 0xC0 - lsls r0, 3 - b _0800A254 -_0800A16C: - adds r0, r3, 0 - bl __divsi3 - adds r2, r0, 0 - cmp r2, 0xFF - ble _0800A17A - movs r2, 0xFF -_0800A17A: - ldr r0, _0800A188 - lsls r1, r2, 2 - adds r1, r0 - ldr r0, [r1] - adds r0, 0x40 - b _0800A252 - .align 2, 0 -_0800A188: .4byte gUnknown_80B92E4 -_0800A18C: - negs r2, r2 - cmp r3, 0 - ble _0800A1F0 - cmp r2, r3 - bge _0800A1BC - asrs r1, r3, 8 - cmp r1, 0 - beq _0800A1CA - adds r0, r2, 0 - bl __divsi3 - adds r2, r0, 0 - cmp r2, 0xFF - ble _0800A1AA - movs r2, 0xFF -_0800A1AA: - ldr r1, _0800A1B8 - lsls r0, r2, 2 - adds r0, r1 - ldr r1, [r0] - movs r0, 0x80 - lsls r0, 1 - b _0800A250 - .align 2, 0 -_0800A1B8: .4byte gUnknown_80B92E4 -_0800A1BC: - adds r1, r2, 0 - cmp r2, 0 - bge _0800A1C4 - adds r1, 0xFF -_0800A1C4: - asrs r1, 8 - cmp r1, 0 - bne _0800A1D0 -_0800A1CA: - movs r0, 0xE0 - lsls r0, 4 - b _0800A254 -_0800A1D0: - adds r0, r3, 0 - bl __divsi3 - adds r2, r0, 0 - cmp r2, 0xFF - ble _0800A1DE - movs r2, 0xFF -_0800A1DE: - ldr r0, _0800A1EC - lsls r1, r2, 2 - adds r1, r0 - ldr r0, [r1] - adds r0, 0xC0 - b _0800A252 - .align 2, 0 -_0800A1EC: .4byte gUnknown_80B92E4 -_0800A1F0: - negs r3, r3 - cmp r2, r3 - bge _0800A224 - adds r1, r3, 0 - cmp r3, 0 - bge _0800A1FE - adds r1, 0xFF -_0800A1FE: - asrs r1, 8 - cmp r1, 0 - beq _0800A232 - adds r0, r2, 0 - bl __divsi3 - adds r2, r0, 0 - cmp r2, 0xFF - ble _0800A212 - movs r2, 0xFF -_0800A212: - ldr r0, _0800A220 - lsls r1, r2, 2 - adds r1, r0 - ldr r0, [r1] - adds r0, 0x80 - b _0800A252 - .align 2, 0 -_0800A220: .4byte gUnknown_80B92E4 -_0800A224: - adds r0, r2, 0 - cmp r0, 0 - bge _0800A22C - adds r0, 0xFF -_0800A22C: - asrs r1, r0, 8 - cmp r1, 0 - bne _0800A238 -_0800A232: - movs r0, 0xA0 - lsls r0, 4 - b _0800A254 -_0800A238: - adds r0, r3, 0 - bl __divsi3 - adds r2, r0, 0 - cmp r2, 0xFF - ble _0800A246 - movs r2, 0xFF -_0800A246: - ldr r1, _0800A258 - lsls r0, r2, 2 - adds r0, r1 - ldr r1, [r0] - movs r0, 0xC0 -_0800A250: - subs r0, r1 -_0800A252: - lsls r0, 4 -_0800A254: - pop {r1} - bx r1 - .align 2, 0 -_0800A258: .4byte gUnknown_80B92E4 - thumb_func_end sub_800A0B0 - - thumb_func_start sub_800A25C -sub_800A25C: - push {lr} - adds r1, r0, 0 - ldr r0, [r1] - mvns r2, r0 - str r2, [r1] - ldr r0, [r1, 0x4] - mvns r0, r0 - adds r0, 0x1 - str r0, [r1, 0x4] - cmp r0, 0 - bne _0800A276 - adds r0, r2, 0x1 - str r0, [r1] -_0800A276: - pop {r0} - bx r0 - thumb_func_end sub_800A25C - - thumb_func_start sub_800A27C -sub_800A27C: - push {lr} - adds r1, r0, 0 - ldr r0, [r1] - cmp r0, 0 - bge _0800A29A - mvns r2, r0 - str r2, [r1] - ldr r0, [r1, 0x4] - mvns r0, r0 - adds r0, 0x1 - str r0, [r1, 0x4] - cmp r0, 0 - bne _0800A29A - adds r0, r2, 0x1 - str r0, [r1] -_0800A29A: - pop {r0} - bx r0 - thumb_func_end sub_800A27C - - thumb_func_start sub_800A2A0 -sub_800A2A0: - push {lr} - adds r1, r0, 0 - ldr r0, [r1] - cmp r0, 0 - bne _0800A2B4 - ldr r0, [r1, 0x4] - cmp r0, 0 - bne _0800A2B4 - movs r0, 0x1 - b _0800A2B6 -_0800A2B4: - movs r0, 0 -_0800A2B6: - pop {r1} - bx r1 - thumb_func_end sub_800A2A0 - - thumb_func_start sub_800A2BC -sub_800A2BC: - push {lr} - adds r2, r0, 0 - adds r3, r1, 0 - ldr r1, [r2] - ldr r0, [r3] - cmp r1, r0 - bne _0800A2D6 - ldr r1, [r2, 0x4] - ldr r0, [r3, 0x4] - cmp r1, r0 - bne _0800A2D6 - movs r0, 0x1 - b _0800A2D8 -_0800A2D6: - movs r0, 0 -_0800A2D8: - pop {r1} - bx r1 - thumb_func_end sub_800A2BC - - thumb_func_start sub_800A2DC -sub_800A2DC: - push {lr} - ldr r0, [r0] - cmp r0, 0 - blt _0800A2E8 - movs r0, 0 - b _0800A2EA -_0800A2E8: - movs r0, 0x1 -_0800A2EA: - pop {r1} - bx r1 - thumb_func_end sub_800A2DC - - thumb_func_start sub_800A2F0 -sub_800A2F0: - push {r4,r5,lr} - adds r3, r0, 0 - adds r2, r1, 0 - ldr r4, [r3] - lsrs r1, r4, 31 - ldr r5, [r2] - cmp r5, 0 - bge _0800A304 - movs r0, 0x2 - orrs r1, r0 -_0800A304: - cmp r1, 0x1 - beq _0800A326 - cmp r1, 0x1 - ble _0800A314 - cmp r1, 0x2 - beq _0800A32A - cmp r1, 0x3 - beq _0800A32E -_0800A314: - ldr r1, [r3, 0x4] - ldr r3, [r2, 0x4] - adds r0, r4, 0 - adds r2, r5, 0 - bl sub_8009D8C - lsls r0, 24 - lsrs r0, 24 - b _0800A346 -_0800A326: - movs r0, 0x1 - b _0800A346 -_0800A32A: - movs r0, 0 - b _0800A346 -_0800A32E: - ldr r1, [r3, 0x4] - ldr r3, [r2, 0x4] - adds r0, r4, 0 - adds r2, r5, 0 - bl sub_8009D8C - movs r1, 0 - lsls r0, 24 - cmp r0, 0 - bne _0800A344 - movs r1, 0x1 -_0800A344: - adds r0, r1, 0 -_0800A346: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_800A2F0 - - thumb_func_start sub_800A34C -sub_800A34C: - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - adds r6, r0, 0 - ldr r0, [r1] - str r0, [sp] - ldr r0, [r1, 0x4] - str r0, [sp, 0x4] - ldr r0, [r2] - str r0, [sp, 0x8] - ldr r0, [r2, 0x4] - add r5, sp, 0x8 - str r0, [r5, 0x4] - mov r0, sp - bl sub_800A2DC - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - mov r10, r8 - adds r0, r5, 0 - bl sub_800A2DC - lsls r0, 24 - lsrs r7, r0, 24 - mov r9, r7 - mov r0, sp - bl sub_800A2A0 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - beq _0800A39A - movs r0, 0 - str r0, [r6] - b _0800A3DE -_0800A39A: - adds r0, r5, 0 - bl sub_800A2A0 - lsls r0, 24 - cmp r0, 0 - beq _0800A3AC - str r4, [r6] - str r4, [r6, 0x4] - b _0800A3E0 -_0800A3AC: - mov r0, r8 - cmp r0, 0 - beq _0800A3B8 - mov r0, sp - bl sub_800A25C -_0800A3B8: - cmp r7, 0 - beq _0800A3C2 - adds r0, r5, 0 - bl sub_800A25C -_0800A3C2: - add r4, sp, 0x10 - adds r0, r4, 0 - mov r1, sp - adds r2, r5, 0 - bl sub_800A4E4 - cmp r10, r9 - beq _0800A3D8 - adds r0, r4, 0 - bl sub_800A25C -_0800A3D8: - ldr r0, [sp, 0x10] - str r0, [r6] - ldr r0, [r4, 0x4] -_0800A3DE: - str r0, [r6, 0x4] -_0800A3E0: - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_800A34C - - thumb_func_start sub_800A3F0 -sub_800A3F0: - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x18 - adds r6, r0, 0 - ldr r0, [r1] - str r0, [sp] - ldr r0, [r1, 0x4] - str r0, [sp, 0x4] - ldr r0, [r2] - str r0, [sp, 0x8] - ldr r0, [r2, 0x4] - add r5, sp, 0x8 - str r0, [r5, 0x4] - mov r0, sp - bl sub_800A2DC - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - mov r10, r8 - adds r0, r5, 0 - bl sub_800A2DC - lsls r0, 24 - lsrs r7, r0, 24 - mov r9, r7 - adds r0, r5, 0 - bl sub_800A2A0 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - beq _0800A448 - ldr r0, _0800A444 - str r0, [r6] - movs r0, 0x1 - negs r0, r0 - b _0800A48C - .align 2, 0 -_0800A444: .4byte 0x7fffffff -_0800A448: - mov r0, sp - bl sub_800A2A0 - lsls r0, 24 - cmp r0, 0 - beq _0800A45A - str r4, [r6] - str r4, [r6, 0x4] - b _0800A48E -_0800A45A: - mov r0, r8 - cmp r0, 0 - beq _0800A466 - mov r0, sp - bl sub_800A25C -_0800A466: - cmp r7, 0 - beq _0800A470 - adds r0, r5, 0 - bl sub_800A25C -_0800A470: - add r4, sp, 0x10 - adds r0, r4, 0 - mov r1, sp - adds r2, r5, 0 - bl sub_800A5A4 - cmp r10, r9 - beq _0800A486 - adds r0, r4, 0 - bl sub_800A25C -_0800A486: - ldr r0, [sp, 0x10] - str r0, [r6] - ldr r0, [r4, 0x4] -_0800A48C: - str r0, [r6, 0x4] -_0800A48E: - add sp, 0x18 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_800A3F0 - - thumb_func_start sub_800A4A0 -sub_800A4A0: - push {r4,r5,lr} - sub sp, 0x10 - adds r5, r0, 0 - ldr r0, [r5] - str r0, [sp] - ldr r0, [r5, 0x4] - str r0, [sp, 0x4] - mov r0, sp - bl sub_800A2A0 - lsls r0, 24 - cmp r0, 0 - beq _0800A4C0 - movs r0, 0 - str r0, [r5] - b _0800A4D8 -_0800A4C0: - mov r0, sp - bl sub_800A27C - add r4, sp, 0x8 - adds r0, r4, 0 - mov r1, sp - mov r2, sp - bl sub_800A4E4 - ldr r0, [sp, 0x8] - str r0, [r5] - ldr r0, [r4, 0x4] -_0800A4D8: - str r0, [r5, 0x4] - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_800A4A0 - - thumb_func_start sub_800A4E4 -sub_800A4E4: - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - mov r8, r0 - adds r5, r1, 0 - adds r6, r2, 0 - adds r0, r5, 0 - bl sub_800A2A0 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - beq _0800A50C - movs r0, 0 - mov r1, r8 - str r0, [r1] - str r0, [r1, 0x4] - b _0800A596 -_0800A50C: - adds r0, r6, 0 - bl sub_800A2A0 - lsls r0, 24 - cmp r0, 0 - beq _0800A520 - mov r7, r8 - str r4, [r7] - str r4, [r7, 0x4] - b _0800A596 -_0800A520: - ldr r1, [r5] - ldr r4, [r5, 0x4] - ldr r0, [r6] - mov r10, r0 - ldr r2, [r6, 0x4] - movs r6, 0 - movs r5, 0 - movs r7, 0x80 - lsls r7, 24 - mov r9, r7 - movs r0, 0x3F - mov r12, r0 -_0800A538: - adds r3, r5, 0 - movs r0, 0x1 - ands r0, r2 - cmp r0, 0 - beq _0800A54C - adds r5, r4 - adds r6, r1 - cmp r3, r5 - bls _0800A54C - adds r6, 0x1 -_0800A54C: - lsrs r2, 1 - movs r3, 0x1 - mov r0, r10 - ands r0, r3 - cmp r0, 0 - beq _0800A55C - mov r7, r9 - orrs r2, r7 -_0800A55C: - mov r0, r10 - lsrs r0, 1 - mov r10, r0 - lsls r1, 1 - adds r0, r4, 0 - mov r7, r9 - ands r0, r7 - cmp r0, 0 - beq _0800A570 - orrs r1, r3 -_0800A570: - lsls r4, 1 - movs r0, 0x1 - negs r0, r0 - add r12, r0 - mov r7, r12 - cmp r7, 0 - bge _0800A538 - lsrs r1, r5, 15 - ands r1, r3 - lsrs r5, 16 - lsls r0, r6, 16 - orrs r5, r0 - lsrs r6, 16 - cmp r1, 0 - beq _0800A590 - adds r5, 0x1 -_0800A590: - mov r0, r8 - str r6, [r0] - str r5, [r0, 0x4] -_0800A596: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_800A4E4 - - thumb_func_start sub_800A5A4 -sub_800A5A4: - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - str r0, [sp] - adds r5, r1, 0 - mov r8, r2 - mov r0, r8 - bl sub_800A2A0 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - beq _0800A5D8 - ldr r0, _0800A5D4 - ldr r1, [sp] - str r0, [r1] - movs r0, 0x1 - negs r0, r0 - str r0, [r1, 0x4] - b _0800A6BE - .align 2, 0 -_0800A5D4: .4byte 0x7fffffff -_0800A5D8: - adds r0, r5, 0 - bl sub_800A2A0 - lsls r0, 24 - cmp r0, 0 - beq _0800A5EC - ldr r2, [sp] - str r4, [r2] - str r4, [r2, 0x4] - b _0800A6BE -_0800A5EC: - ldr r0, [r5] - lsls r7, r0, 16 - ldr r1, [r5, 0x4] - lsrs r0, r1, 16 - orrs r7, r0 - lsls r6, r1, 16 - movs r0, 0x80 - lsls r0, 8 - orrs r6, r0 - mov r0, r8 - ldr r0, [r0] - str r0, [sp, 0x4] - mov r1, r8 - ldr r1, [r1, 0x4] - str r1, [sp, 0x8] - movs r2, 0 - str r2, [sp, 0xC] - mov r9, r2 - movs r5, 0 - movs r4, 0 - movs r0, 0x80 - lsls r0, 24 - mov r10, r0 - movs r1, 0x1 - mov r8, r1 - movs r2, 0x3F - str r2, [sp, 0x10] -_0800A622: - lsls r5, 1 - adds r0, r4, 0 - mov r1, r10 - ands r0, r1 - cmp r0, 0 - beq _0800A632 - mov r2, r8 - orrs r5, r2 -_0800A632: - movs r1, 0x2 - negs r1, r1 - lsls r4, 1 - adds r0, r7, 0 - mov r2, r10 - ands r0, r2 - cmp r0, 0 - beq _0800A646 - mov r0, r8 - orrs r4, r0 -_0800A646: - lsls r7, 1 - adds r0, r6, 0 - mov r2, r10 - ands r0, r2 - cmp r0, 0 - beq _0800A656 - mov r0, r8 - orrs r7, r0 -_0800A656: - lsls r6, 1 - ands r6, r1 - adds r0, r5, 0 - adds r1, r4, 0 - ldr r2, [sp, 0x4] - ldr r3, [sp, 0x8] - bl sub_8009D8C - lsls r0, 24 - cmp r0, 0 - bne _0800A680 - adds r0, r4, 0 - movs r1, 0x1 - ldr r2, [sp, 0x8] - subs r4, r2 - ldr r2, [sp, 0x4] - subs r5, r2 - cmp r0, r4 - bcs _0800A682 - subs r5, 0x1 - b _0800A682 -_0800A680: - movs r1, 0 -_0800A682: - ldr r0, [sp, 0xC] - lsls r0, 1 - str r0, [sp, 0xC] - mov r0, r9 - mov r2, r10 - ands r0, r2 - cmp r0, 0 - beq _0800A69A - ldr r0, [sp, 0xC] - mov r2, r8 - orrs r0, r2 - str r0, [sp, 0xC] -_0800A69A: - mov r0, r9 - lsls r0, 1 - mov r9, r0 - cmp r1, 0 - beq _0800A6AA - mov r1, r8 - orrs r0, r1 - mov r9, r0 -_0800A6AA: - ldr r2, [sp, 0x10] - subs r2, 0x1 - str r2, [sp, 0x10] - cmp r2, 0 - bge _0800A622 - ldr r0, [sp, 0xC] - ldr r1, [sp] - str r0, [r1] - mov r2, r9 - str r2, [r1, 0x4] -_0800A6BE: - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_800A5A4 - - thumb_func_start sub_800A6D0 -sub_800A6D0: - push {r4,lr} - adds r4, r0, 0 - ldr r3, [r1] - ldr r0, [r2] - adds r3, r0 - ldr r1, [r1, 0x4] - ldr r0, [r2, 0x4] - adds r0, r1, r0 - cmp r0, r1 - bcs _0800A6E6 - adds r3, 0x1 -_0800A6E6: - str r3, [r4] - str r0, [r4, 0x4] - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_800A6D0 - - thumb_func_start sub_800A6F0 -sub_800A6F0: - push {r4,lr} - adds r4, r0, 0 - ldr r3, [r1] - ldr r0, [r2] - subs r3, r0 - ldr r1, [r1, 0x4] - ldr r0, [r2, 0x4] - subs r0, r1, r0 - cmp r0, r1 - bls _0800A706 - subs r3, 0x1 -_0800A706: - str r3, [r4] - str r0, [r4, 0x4] - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_800A6F0 - - thumb_func_start sub_800A710 -sub_800A710: - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x18 - mov r8, r0 - adds r6, r2, 0 - ldr r0, [r1] - str r0, [sp] - ldr r0, [r1, 0x4] - str r0, [sp, 0x4] - adds r4, r6, 0 - cmp r6, 0 - bge _0800A72C - negs r4, r6 -_0800A72C: - movs r0, 0 - str r0, [sp, 0x8] - movs r1, 0x80 - lsls r1, 9 - add r0, sp, 0x8 - str r1, [r0, 0x4] - adds r7, r0, 0 - cmp r4, 0 - beq _0800A75E - adds r5, r7, 0 -_0800A740: - movs r0, 0x1 - ands r0, r4 - cmp r0, 0 - beq _0800A752 - adds r0, r5, 0 - adds r1, r5, 0 - mov r2, sp - bl sub_800A34C -_0800A752: - mov r0, sp - bl sub_800A4A0 - asrs r4, 1 - cmp r4, 0 - bne _0800A740 -_0800A75E: - cmp r6, 0 - bge _0800A776 - movs r0, 0 - str r0, [sp, 0x10] - movs r0, 0x80 - lsls r0, 9 - add r1, sp, 0x10 - str r0, [r1, 0x4] - adds r0, r7, 0 - adds r2, r7, 0 - bl sub_800A3F0 -_0800A776: - ldr r0, [sp, 0x8] - mov r1, r8 - str r0, [r1] - ldr r0, [r7, 0x4] - str r0, [r1, 0x4] - add sp, 0x18 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_800A710 - - thumb_func_start sub_800A78C -sub_800A78C: - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x20 - mov r10, r0 - ldr r0, [r1] - ldr r1, [r1, 0x4] - str r0, [sp] - str r1, [sp, 0x4] - ldr r0, [r2] - ldr r1, [r2, 0x4] - str r0, [sp, 0x8] - str r1, [sp, 0xC] - mov r0, sp - bl sub_800A27C - add r4, sp, 0x8 - adds r0, r4, 0 - bl sub_800A27C - mov r0, sp - adds r1, r4, 0 - bl sub_800A2F0 - lsls r0, 24 - mov r8, r4 - cmp r0, 0 - beq _0800A7DC - ldr r2, [sp] - ldr r3, [sp, 0x4] - str r2, [sp, 0x10] - str r3, [sp, 0x14] - ldr r0, [sp, 0x8] - ldr r1, [sp, 0xC] - str r0, [sp] - str r1, [sp, 0x4] - str r2, [sp, 0x8] - str r3, [sp, 0xC] -_0800A7DC: - mov r0, r8 - bl sub_800A2A0 - lsls r0, 24 - cmp r0, 0 - bne _0800A878 - movs r0, 0 - mov r9, r0 - add r7, sp, 0x10 - add r6, sp, 0x18 - b _0800A800 -_0800A7F2: - mov r0, r8 - mov r1, r8 - adds r2, r7, 0 - bl sub_800A34C - movs r2, 0x1 - add r9, r2 -_0800A800: - adds r4, r7, 0 - mov r1, r8 - adds r0, r4, 0 - mov r2, sp - bl sub_800A3F0 - adds r0, r4, 0 - bl sub_800A4A0 - ldr r0, [sp, 0x10] - str r0, [sp, 0x18] - ldr r1, [r4, 0x4] - movs r0, 0x80 - lsls r0, 11 - adds r1, r0 - adds r5, r6, 0 - str r1, [r5, 0x4] - ldr r0, [r4, 0x4] - cmp r1, r0 - bcs _0800A82E - ldr r0, [sp, 0x18] - adds r0, 0x1 - str r0, [sp, 0x18] -_0800A82E: - adds r0, r4, 0 - adds r1, r4, 0 - adds r2, r5, 0 - bl sub_800A3F0 - adds r0, r5, 0 - mov r1, sp - adds r2, r4, 0 - bl sub_800A34C - ldr r0, [sp, 0x18] - lsls r1, r0, 1 - str r1, [sp, 0x18] - ldr r0, [r5, 0x4] - cmp r0, 0 - bge _0800A854 - movs r0, 0x1 - orrs r1, r0 - str r1, [sp, 0x18] -_0800A854: - ldr r0, [r6, 0x4] - lsls r0, 1 - str r0, [r6, 0x4] - ldr r2, [sp, 0x4] - ldr r1, [sp] - ldr r0, [sp, 0x18] - adds r1, r0 - str r1, [sp] - ldr r0, [r6, 0x4] - adds r0, r2, r0 - str r0, [sp, 0x4] - cmp r2, r0 - bls _0800A872 - adds r0, r1, 0x1 - str r0, [sp] -_0800A872: - mov r2, r9 - cmp r2, 0x2 - bne _0800A7F2 -_0800A878: - ldr r0, [sp] - ldr r1, [sp, 0x4] - mov r2, r10 - str r0, [r2] - str r1, [r2, 0x4] - add sp, 0x20 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_800A78C - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/code_800DAC0.s b/asm/code_800DAC0.s index 69e5960d2..958a5a452 100644 --- a/asm/code_800DAC0.s +++ b/asm/code_800DAC0.s @@ -2923,7 +2923,7 @@ sub_800F204: thumb_func_end sub_800F204 thumb_func_start GetDungeonPokemonSprite - @ struct DungeonPokemonSprite *GetDungeonPokemonSprite(int id) + @ DungeonPokemonSprite *GetDungeonPokemonSprite(int id) GetDungeonPokemonSprite: push {r4,lr} adds r4, r0, 0 @@ -2958,7 +2958,7 @@ _0800F240: thumb_func_end GetDungeonPokemonSprite thumb_func_start NewDungeonPokemonSprite - @ struct DungeonPokemonSprite *NewDungeonPokemonSprite(void) + @ DungeonPokemonSprite *NewDungeonPokemonSprite(void) NewDungeonPokemonSprite: push {lr} movs r2, 0 @@ -3137,7 +3137,7 @@ _0800F35C: thumb_func_end sub_800F2EC thumb_func_start DrawStatusSprite - @ void DrawStatusSprite(?, int status, struct Position *pos, struct Position *pos_offset, struct Position *pos_screen, ?) + @ void DrawStatusSprite(?, int status, Position *pos, Position *pos_offset, Position *pos_screen, ?) DrawStatusSprite: push {r4-r7,lr} mov r7, r8 @@ -3807,7 +3807,7 @@ _0800F8CC: .4byte gDungeonPokemonSprites thumb_func_end sub_800F7D0 thumb_func_start AddPokemonDungeonSprite - @ void AddPokemonDungeonSprite(int id, short species, struct Position *pos, ?) + @ void AddPokemonDungeonSprite(int id, short species, Position *pos, ?) AddPokemonDungeonSprite: push {r4-r7,lr} mov r7, r8 diff --git a/asm/code_80521D0.s b/asm/code_80521D0.s index 453ebf6e0..bd1a71bc2 100644 --- a/asm/code_80521D0.s +++ b/asm/code_80521D0.s @@ -7280,7 +7280,7 @@ _080561E0: lsls r1, r2, 24 lsrs r1, 24 movs r2, 0 - bl sub_8090DC4 + bl BufferItemName adds r0, r5, 0 mov r1, r8 bl SendMessage @@ -7650,7 +7650,7 @@ _080564E4: lsls r1, r2, 24 lsrs r1, 24 movs r2, 0 - bl sub_8090DC4 + bl BufferItemName _080564F2: mov r0, r8 ldrh r1, [r0, 0x2] diff --git a/asm/code_808417C.s b/asm/code_808417C.s index fbf25c3e3..753905f7d 100644 --- a/asm/code_808417C.s +++ b/asm/code_808417C.s @@ -360,7 +360,7 @@ _080844A4: adds r1, r6 ldrb r1, [r1] movs r2, 0 - bl sub_8090DC4 + bl BufferItemName movs r3, 0 ldr r0, _0808450C adds r6, r0, 0 diff --git a/asm/code_80869E4.s b/asm/code_80869E4.s deleted file mode 100644 index 2083a2e8f..000000000 --- a/asm/code_80869E4.s +++ /dev/null @@ -1,56 +0,0 @@ - #include "asm/constants/gba_constants.inc" - #include "asm/macros.inc" - - .syntax unified - - .text - - - thumb_func_start sub_80869E4 -sub_80869E4: - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r7, r0, 0 - mov r9, r1 - lsls r2, 24 - lsrs r2, 24 - mov r8, r2 - lsls r3, 24 - asrs r6, r3, 24 - ldr r0, [r7, 0x70] - adds r0, 0x46 - movs r4, 0 - ldrsb r4, [r0, r4] - cmp r4, r6 - beq _08086A30 - adds r5, r0, 0 -_08086A08: - adds r0, r4, 0 - adds r1, r6, 0 - mov r2, r8 - bl sub_8002A70 - lsls r0, 24 - asrs r4, r0, 24 - movs r0, 0x7 - ands r0, r4 - strb r0, [r5] - ldrb r1, [r5] - adds r0, r7, 0 - bl sub_806CE68 - mov r0, r9 - movs r1, 0x46 - bl sub_803E708 - cmp r4, r6 - bne _08086A08 -_08086A30: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80869E4 - - .align 2,0 diff --git a/asm/code_8098BDC.s b/asm/code_8098BDC.s index 40a7cdf10..3085649aa 100644 --- a/asm/code_8098BDC.s +++ b/asm/code_8098BDC.s @@ -6376,7 +6376,7 @@ _0809C2CA: ldr r0, _0809C308 adds r1, r4, 0 movs r2, 0 - bl sub_8090DC4 + bl BufferItemName adds r0, r5, 0 bl ShiftItemsDownFrom ldr r0, [r6] diff --git a/asm/event_flag.s b/asm/event_flag.s index 089bbe6a4..b27cb46c0 100644 --- a/asm/event_flag.s +++ b/asm/event_flag.s @@ -279,6 +279,7 @@ _0800177A: bx r1 thumb_func_end sub_8001658 +@ https://decomp.me/scratch/xF3HH thumb_func_start sub_8001784 sub_8001784: push {r4,r5,lr} diff --git a/asm/file_system.s b/asm/file_system.s new file mode 100644 index 000000000..c8831a991 --- /dev/null +++ b/asm/file_system.s @@ -0,0 +1,1764 @@ + #include "asm/constants/gba_constants.inc" + #include "asm/macros.inc" + + .syntax unified + + .text + + thumb_func_start FastMod3 + @ return arg % 3 + @ Has a lookup table up to 0x100 +FastMod3: + push {lr} + adds r1, r0, 0 + cmp r1, 0xFF + ble _08009C6C + movs r1, 0x3 + bl __modsi3 + b _08009C72 +_08009C6C: + ldr r0, =gFastMod3Lookup + adds r0, r1, r0 + ldrb r0, [r0] +_08009C72: + pop {r1} + bx r1 +.pool + thumb_func_end FastMod3 + + thumb_func_start sub_8009C7C +sub_8009C7C: + push {lr} + adds r2, r0, 0 + movs r3, 0xC0 + lsls r3, 4 + adds r1, r2, 0 + ands r1, r3 + movs r0, 0x80 + lsls r0, 3 + cmp r1, r0 + beq _08009CB8 + cmp r1, r0 + bgt _08009C9A + cmp r1, 0 + beq _08009CA8 + b _08009CFC +_08009C9A: + movs r0, 0x80 + lsls r0, 4 + cmp r1, r0 + beq _08009CD0 + cmp r1, r3 + beq _08009CE0 + b _08009CFC +_08009CA8: + ldr r0, _08009CB0 + ldr r1, _08009CB4 + ands r1, r2 + b _08009CBE + .align 2, 0 +_08009CB0: .4byte gUnknown_80B8AE4 +_08009CB4: .4byte 0x000003ff +_08009CB8: + ldr r0, _08009CC8 + ldr r1, _08009CCC + bics r1, r2 +_08009CBE: + lsls r1, 1 + adds r1, r0 + movs r2, 0 + ldrsh r0, [r1, r2] + b _08009CFE + .align 2, 0 +_08009CC8: .4byte gUnknown_80B8AE4 +_08009CCC: .4byte 0x000003ff +_08009CD0: + ldr r0, _08009CD8 + ldr r1, _08009CDC + ands r1, r2 + b _08009CE6 + .align 2, 0 +_08009CD8: .4byte gUnknown_80B8AE4 +_08009CDC: .4byte 0x000003ff +_08009CE0: + ldr r0, _08009CF4 + ldr r1, _08009CF8 + bics r1, r2 +_08009CE6: + lsls r1, 1 + adds r1, r0 + movs r2, 0 + ldrsh r0, [r1, r2] + negs r0, r0 + b _08009CFE + .align 2, 0 +_08009CF4: .4byte gUnknown_80B8AE4 +_08009CF8: .4byte 0x000003ff +_08009CFC: + movs r0, 0 +_08009CFE: + pop {r1} + bx r1 + thumb_func_end sub_8009C7C + + thumb_func_start sub_8009D04 +sub_8009D04: + push {lr} + adds r2, r0, 0 + movs r3, 0xC0 + lsls r3, 4 + adds r1, r2, 0 + ands r1, r3 + movs r0, 0x80 + lsls r0, 3 + cmp r1, r0 + beq _08009D40 + cmp r1, r0 + bgt _08009D22 + cmp r1, 0 + beq _08009D30 + b _08009D84 +_08009D22: + movs r0, 0x80 + lsls r0, 4 + cmp r1, r0 + beq _08009D50 + cmp r1, r3 + beq _08009D6C + b _08009D84 +_08009D30: + ldr r0, _08009D38 + ldr r1, _08009D3C + bics r1, r2 + b _08009D72 + .align 2, 0 +_08009D38: .4byte gUnknown_80B8AE4 +_08009D3C: .4byte 0x000003ff +_08009D40: + ldr r0, _08009D48 + ldr r1, _08009D4C + ands r1, r2 + b _08009D56 + .align 2, 0 +_08009D48: .4byte gUnknown_80B8AE4 +_08009D4C: .4byte 0x000003ff +_08009D50: + ldr r0, _08009D64 + ldr r1, _08009D68 + bics r1, r2 +_08009D56: + lsls r1, 1 + adds r1, r0 + movs r2, 0 + ldrsh r0, [r1, r2] + negs r0, r0 + b _08009D86 + .align 2, 0 +_08009D64: .4byte gUnknown_80B8AE4 +_08009D68: .4byte 0x000003ff +_08009D6C: + ldr r0, _08009D7C + ldr r1, _08009D80 + ands r1, r2 +_08009D72: + lsls r1, 1 + adds r1, r0 + movs r2, 0 + ldrsh r0, [r1, r2] + b _08009D86 + .align 2, 0 +_08009D7C: .4byte gUnknown_80B8AE4 +_08009D80: .4byte 0x000003ff +_08009D84: + movs r0, 0 +_08009D86: + pop {r1} + bx r1 + thumb_func_end sub_8009D04 + + thumb_func_start sub_8009D8C +sub_8009D8C: + push {lr} + cmp r0, r2 + bcc _08009D9A + cmp r0, r2 + bhi _08009D9E + cmp r1, r3 + bcs _08009D9E +_08009D9A: + movs r0, 0x1 + b _08009DA0 +_08009D9E: + movs r0, 0 +_08009DA0: + pop {r1} + bx r1 + thumb_func_end sub_8009D8C + + thumb_func_start sub_8009DA4 +sub_8009DA4: + push {r4,r5,lr} + lsrs r2, r0, 31 + adds r5, r2, 0 + lsrs r3, r1, 31 + adds r4, r3, 0 + cmp r0, 0 + beq _08009DB6 + cmp r1, 0 + bne _08009DBA +_08009DB6: + movs r0, 0 + b _08009DD0 +_08009DBA: + cmp r2, 0 + beq _08009DC0 + negs r0, r0 +_08009DC0: + cmp r3, 0 + beq _08009DC6 + negs r1, r1 +_08009DC6: + bl sub_8009E14 + cmp r5, r4 + beq _08009DD0 + negs r0, r0 +_08009DD0: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_8009DA4 + + thumb_func_start sub_8009DD8 +sub_8009DD8: + push {r4,r5,lr} + lsrs r2, r0, 31 + adds r5, r2, 0 + lsrs r3, r1, 31 + adds r4, r3, 0 + cmp r1, 0 + bne _08009DF0 + ldr r0, _08009DEC + b _08009E0E + .align 2, 0 +_08009DEC: .4byte 0x7fffffff +_08009DF0: + cmp r0, 0 + bne _08009DF8 + movs r0, 0 + b _08009E0E +_08009DF8: + cmp r2, 0 + beq _08009DFE + negs r0, r0 +_08009DFE: + cmp r3, 0 + beq _08009E04 + negs r1, r1 +_08009E04: + bl sub_8009EA0 + cmp r5, r4 + beq _08009E0E + negs r0, r0 +_08009E0E: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_8009DD8 + + thumb_func_start sub_8009E14 +sub_8009E14: + push {r4-r7,lr} + mov r7, r9 + mov r6, r8 + push {r6,r7} + cmp r0, 0 + beq _08009E24 + cmp r1, 0 + bne _08009E28 +_08009E24: + movs r0, 0 + b _08009E94 +_08009E28: + movs r5, 0 + adds r3, r0, 0 + mov r12, r5 + movs r6, 0 + movs r4, 0 + movs r0, 0x80 + lsls r0, 24 + mov r8, r0 + movs r7, 0x3F + mov r9, r7 +_08009E3C: + adds r2, r4, 0 + movs r0, 0x1 + ands r0, r1 + cmp r0, 0 + beq _08009E50 + adds r4, r3 + adds r6, r5 + cmp r2, r4 + bls _08009E50 + adds r6, 0x1 +_08009E50: + lsrs r1, 1 + movs r2, 0x1 + mov r0, r12 + ands r0, r2 + cmp r0, 0 + beq _08009E60 + mov r0, r8 + orrs r1, r0 +_08009E60: + mov r7, r12 + lsrs r7, 1 + mov r12, r7 + lsls r5, 1 + adds r0, r3, 0 + mov r7, r8 + ands r0, r7 + cmp r0, 0 + beq _08009E74 + orrs r5, r2 +_08009E74: + lsls r3, 1 + movs r0, 0x1 + negs r0, r0 + add r9, r0 + mov r7, r9 + cmp r7, 0 + bge _08009E3C + lsrs r1, r4, 7 + ands r1, r2 + lsrs r4, 8 + lsls r0, r6, 24 + orrs r4, r0 + cmp r1, 0 + beq _08009E92 + adds r4, 0x1 +_08009E92: + adds r0, r4, 0 +_08009E94: + pop {r3,r4} + mov r8, r3 + mov r9, r4 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_8009E14 + + thumb_func_start sub_8009EA0 +sub_8009EA0: + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x4 + cmp r1, 0 + bne _08009EB8 + ldr r0, _08009EB4 + b _08009F58 + .align 2, 0 +_08009EB4: .4byte 0x7fffffff +_08009EB8: + cmp r0, 0 + bne _08009EC0 + movs r0, 0 + b _08009F58 +_08009EC0: + lsrs r7, r0, 24 + lsls r6, r0, 8 + mov r10, r1 + movs r0, 0 + mov r9, r0 + movs r5, 0 + movs r4, 0 + movs r1, 0x1 + mov r8, r1 + movs r2, 0x3F + str r2, [sp] +_08009ED6: + lsls r5, 1 + adds r0, r4, 0 + movs r1, 0x80 + lsls r1, 24 + ands r0, r1 + cmp r0, 0 + beq _08009EE8 + mov r2, r8 + orrs r5, r2 +_08009EE8: + movs r1, 0x2 + negs r1, r1 + lsls r4, 1 + adds r0, r7, 0 + movs r2, 0x80 + lsls r2, 24 + ands r0, r2 + cmp r0, 0 + beq _08009EFE + mov r0, r8 + orrs r4, r0 +_08009EFE: + lsls r7, 1 + adds r0, r6, 0 + movs r2, 0x80 + lsls r2, 24 + ands r0, r2 + cmp r0, 0 + beq _08009F10 + mov r0, r8 + orrs r7, r0 +_08009F10: + lsls r6, 1 + ands r6, r1 + adds r0, r5, 0 + adds r1, r4, 0 + movs r2, 0 + mov r3, r10 + bl sub_8009D8C + lsls r0, 24 + cmp r0, 0 + bne _08009F3A + adds r0, r4, 0 + movs r1, 0x1 + mov r2, r10 + subs r4, r2 + movs r2, 0 + subs r5, r2 + cmp r0, r4 + bcs _08009F3C + subs r5, 0x1 + b _08009F3C +_08009F3A: + movs r1, 0 +_08009F3C: + mov r0, r9 + lsls r0, 1 + mov r9, r0 + cmp r1, 0 + beq _08009F4C + mov r1, r8 + orrs r0, r1 + mov r9, r0 +_08009F4C: + ldr r2, [sp] + subs r2, 0x1 + str r2, [sp] + cmp r2, 0 + bge _08009ED6 + mov r0, r9 +_08009F58: + add sp, 0x4 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_8009EA0 + + thumb_func_start sub_8009F68 +sub_8009F68: + push {r4-r7,lr} + adds r5, r0, 0 + adds r6, r1, 0 + adds r4, r6, 0 + cmp r6, 0 + bge _08009F76 + negs r4, r6 +_08009F76: + movs r7, 0x80 + lsls r7, 1 + cmp r4, 0 + beq _08009FA0 +_08009F7E: + movs r0, 0x1 + ands r0, r4 + cmp r0, 0 + beq _08009F90 + adds r0, r7, 0 + adds r1, r5, 0 + bl sub_8009DA4 + adds r7, r0, 0 +_08009F90: + adds r0, r5, 0 + adds r1, r5, 0 + bl sub_8009DA4 + adds r5, r0, 0 + asrs r4, 1 + cmp r4, 0 + bne _08009F7E +_08009FA0: + cmp r6, 0 + bge _08009FB0 + movs r0, 0x80 + lsls r0, 1 + adds r1, r7, 0 + bl sub_8009DD8 + b _08009FB2 +_08009FB0: + adds r0, r7, 0 +_08009FB2: + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_8009F68 + + thumb_func_start sub_8009FB8 +sub_8009FB8: + push {r4-r7,lr} + adds r5, r0, 0 + adds r6, r1, 0 + cmp r5, 0 + bge _08009FC4 + negs r5, r5 +_08009FC4: + cmp r6, 0 + bge _08009FCA + negs r6, r6 +_08009FCA: + cmp r5, r6 + bge _08009FD4 + adds r4, r5, 0 + adds r5, r6, 0 + adds r6, r4, 0 +_08009FD4: + cmp r6, 0 + beq _0800A016 + movs r7, 0x2 +_08009FDA: + adds r0, r6, 0 + adds r1, r5, 0 + bl sub_8009DD8 + adds r4, r0, 0 + adds r1, r4, 0 + bl sub_8009DA4 + adds r4, r0, 0 + movs r0, 0x80 + lsls r0, 3 + adds r1, r4, r0 + adds r0, r4, 0 + bl sub_8009DD8 + adds r4, r0, 0 + adds r0, r5, 0 + adds r1, r4, 0 + bl sub_8009DA4 + lsls r0, 1 + adds r5, r0 + adds r0, r6, 0 + adds r1, r4, 0 + bl sub_8009DA4 + adds r6, r0, 0 + subs r7, 0x1 + cmp r7, 0 + bge _08009FDA +_0800A016: + adds r0, r5, 0 + pop {r4-r7} + pop {r1} + bx r1 + thumb_func_end sub_8009FB8 + + thumb_func_start sub_800A020 +sub_800A020: + push {r4,lr} + adds r3, r0, 0 + ldr r4, _0800A044 + lsrs r2, r1, 16 + str r2, [r3] + lsls r0, r1, 16 + str r0, [r3, 0x4] + movs r0, 0x80 + lsls r0, 8 + ands r0, r1 + cmp r0, 0 + beq _0800A03C + orrs r2, r4 + str r2, [r3] +_0800A03C: + pop {r4} + pop {r0} + bx r0 + .align 2, 0 +_0800A044: .4byte 0xffff0000 + thumb_func_end sub_800A020 + + thumb_func_start sub_800A048 +sub_800A048: + push {lr} + ldrh r1, [r0] + lsls r2, r1, 16 + ldr r0, [r0, 0x4] + lsrs r1, r0, 16 + orrs r2, r1 + movs r1, 0x80 + lsls r1, 8 + ands r0, r1 + cmp r0, 0 + beq _0800A060 + adds r2, 0x1 +_0800A060: + adds r0, r2, 0 + pop {r1} + bx r1 + thumb_func_end sub_800A048 + + thumb_func_start sub_800A068 +sub_800A068: + push {lr} + ldrb r1, [r0] + lsls r2, r1, 24 + ldr r0, [r0, 0x4] + lsrs r1, r0, 8 + orrs r2, r1 + movs r1, 0x80 + lsls r1, 8 + ands r0, r1 + cmp r0, 0 + beq _0800A080 + adds r2, 0x1 +_0800A080: + adds r0, r2, 0 + pop {r1} + bx r1 + thumb_func_end sub_800A068 + + thumb_func_start sub_800A088 +sub_800A088: + push {lr} + adds r2, r0, 0 + lsls r0, r1, 8 + str r0, [r2, 0x4] + asrs r1, 24 + str r1, [r2] + movs r0, 0x80 + ands r0, r1 + cmp r0, 0 + beq _0800A0A4 + movs r0, 0x80 + negs r0, r0 + orrs r1, r0 + b _0800A0A8 +_0800A0A4: + movs r0, 0x7F + ands r1, r0 +_0800A0A8: + str r1, [r2] + pop {r0} + bx r0 + thumb_func_end sub_800A088 + + thumb_func_start sub_800A0B0 +sub_800A0B0: + push {lr} + ldr r2, [r0, 0x4] + ldr r3, [r0] + cmp r2, 0 + bne _0800A0C2 + cmp r3, 0 + bne _0800A0C2 + movs r0, 0 + b _0800A254 +_0800A0C2: + cmp r2, 0 + ble _0800A18C + cmp r3, 0 + ble _0800A124 + cmp r2, r3 + bge _0800A0F0 + asrs r1, r3, 8 + cmp r1, 0 + beq _0800A0FE + adds r0, r2, 0 + bl __divsi3 + adds r2, r0, 0 + cmp r2, 0xFF + ble _0800A0E2 + movs r2, 0xFF +_0800A0E2: + ldr r0, _0800A0EC + lsls r1, r2, 2 + adds r1, r0 + ldr r0, [r1] + b _0800A252 + .align 2, 0 +_0800A0EC: .4byte gUnknown_80B92E4 +_0800A0F0: + adds r1, r2, 0 + cmp r2, 0 + bge _0800A0F8 + adds r1, 0xFF +_0800A0F8: + asrs r1, 8 + cmp r1, 0 + bne _0800A104 +_0800A0FE: + movs r0, 0x80 + lsls r0, 2 + b _0800A254 +_0800A104: + adds r0, r3, 0 + bl __divsi3 + adds r2, r0, 0 + cmp r2, 0xFF + ble _0800A112 + movs r2, 0xFF +_0800A112: + ldr r1, _0800A120 + lsls r0, r2, 2 + adds r0, r1 + ldr r1, [r0] + movs r0, 0x40 + b _0800A250 + .align 2, 0 +_0800A120: .4byte gUnknown_80B92E4 +_0800A124: + negs r3, r3 + cmp r2, r3 + bge _0800A158 + adds r1, r3, 0 + cmp r3, 0 + bge _0800A132 + adds r1, 0xFF +_0800A132: + asrs r1, 8 + cmp r1, 0 + beq _0800A166 + adds r0, r2, 0 + bl __divsi3 + adds r2, r0, 0 + cmp r2, 0xFF + ble _0800A146 + movs r2, 0xFF +_0800A146: + ldr r1, _0800A154 + lsls r0, r2, 2 + adds r0, r1 + ldr r1, [r0] + movs r0, 0x80 + b _0800A250 + .align 2, 0 +_0800A154: .4byte gUnknown_80B92E4 +_0800A158: + adds r1, r2, 0 + cmp r2, 0 + bge _0800A160 + adds r1, 0xFF +_0800A160: + asrs r1, 8 + cmp r1, 0 + bne _0800A16C +_0800A166: + movs r0, 0xC0 + lsls r0, 3 + b _0800A254 +_0800A16C: + adds r0, r3, 0 + bl __divsi3 + adds r2, r0, 0 + cmp r2, 0xFF + ble _0800A17A + movs r2, 0xFF +_0800A17A: + ldr r0, _0800A188 + lsls r1, r2, 2 + adds r1, r0 + ldr r0, [r1] + adds r0, 0x40 + b _0800A252 + .align 2, 0 +_0800A188: .4byte gUnknown_80B92E4 +_0800A18C: + negs r2, r2 + cmp r3, 0 + ble _0800A1F0 + cmp r2, r3 + bge _0800A1BC + asrs r1, r3, 8 + cmp r1, 0 + beq _0800A1CA + adds r0, r2, 0 + bl __divsi3 + adds r2, r0, 0 + cmp r2, 0xFF + ble _0800A1AA + movs r2, 0xFF +_0800A1AA: + ldr r1, _0800A1B8 + lsls r0, r2, 2 + adds r0, r1 + ldr r1, [r0] + movs r0, 0x80 + lsls r0, 1 + b _0800A250 + .align 2, 0 +_0800A1B8: .4byte gUnknown_80B92E4 +_0800A1BC: + adds r1, r2, 0 + cmp r2, 0 + bge _0800A1C4 + adds r1, 0xFF +_0800A1C4: + asrs r1, 8 + cmp r1, 0 + bne _0800A1D0 +_0800A1CA: + movs r0, 0xE0 + lsls r0, 4 + b _0800A254 +_0800A1D0: + adds r0, r3, 0 + bl __divsi3 + adds r2, r0, 0 + cmp r2, 0xFF + ble _0800A1DE + movs r2, 0xFF +_0800A1DE: + ldr r0, _0800A1EC + lsls r1, r2, 2 + adds r1, r0 + ldr r0, [r1] + adds r0, 0xC0 + b _0800A252 + .align 2, 0 +_0800A1EC: .4byte gUnknown_80B92E4 +_0800A1F0: + negs r3, r3 + cmp r2, r3 + bge _0800A224 + adds r1, r3, 0 + cmp r3, 0 + bge _0800A1FE + adds r1, 0xFF +_0800A1FE: + asrs r1, 8 + cmp r1, 0 + beq _0800A232 + adds r0, r2, 0 + bl __divsi3 + adds r2, r0, 0 + cmp r2, 0xFF + ble _0800A212 + movs r2, 0xFF +_0800A212: + ldr r0, _0800A220 + lsls r1, r2, 2 + adds r1, r0 + ldr r0, [r1] + adds r0, 0x80 + b _0800A252 + .align 2, 0 +_0800A220: .4byte gUnknown_80B92E4 +_0800A224: + adds r0, r2, 0 + cmp r0, 0 + bge _0800A22C + adds r0, 0xFF +_0800A22C: + asrs r1, r0, 8 + cmp r1, 0 + bne _0800A238 +_0800A232: + movs r0, 0xA0 + lsls r0, 4 + b _0800A254 +_0800A238: + adds r0, r3, 0 + bl __divsi3 + adds r2, r0, 0 + cmp r2, 0xFF + ble _0800A246 + movs r2, 0xFF +_0800A246: + ldr r1, _0800A258 + lsls r0, r2, 2 + adds r0, r1 + ldr r1, [r0] + movs r0, 0xC0 +_0800A250: + subs r0, r1 +_0800A252: + lsls r0, 4 +_0800A254: + pop {r1} + bx r1 + .align 2, 0 +_0800A258: .4byte gUnknown_80B92E4 + thumb_func_end sub_800A0B0 + + thumb_func_start sub_800A25C +sub_800A25C: + push {lr} + adds r1, r0, 0 + ldr r0, [r1] + mvns r2, r0 + str r2, [r1] + ldr r0, [r1, 0x4] + mvns r0, r0 + adds r0, 0x1 + str r0, [r1, 0x4] + cmp r0, 0 + bne _0800A276 + adds r0, r2, 0x1 + str r0, [r1] +_0800A276: + pop {r0} + bx r0 + thumb_func_end sub_800A25C + + thumb_func_start sub_800A27C +sub_800A27C: + push {lr} + adds r1, r0, 0 + ldr r0, [r1] + cmp r0, 0 + bge _0800A29A + mvns r2, r0 + str r2, [r1] + ldr r0, [r1, 0x4] + mvns r0, r0 + adds r0, 0x1 + str r0, [r1, 0x4] + cmp r0, 0 + bne _0800A29A + adds r0, r2, 0x1 + str r0, [r1] +_0800A29A: + pop {r0} + bx r0 + thumb_func_end sub_800A27C + + thumb_func_start sub_800A2A0 +sub_800A2A0: + push {lr} + adds r1, r0, 0 + ldr r0, [r1] + cmp r0, 0 + bne _0800A2B4 + ldr r0, [r1, 0x4] + cmp r0, 0 + bne _0800A2B4 + movs r0, 0x1 + b _0800A2B6 +_0800A2B4: + movs r0, 0 +_0800A2B6: + pop {r1} + bx r1 + thumb_func_end sub_800A2A0 + + thumb_func_start sub_800A2BC +sub_800A2BC: + push {lr} + adds r2, r0, 0 + adds r3, r1, 0 + ldr r1, [r2] + ldr r0, [r3] + cmp r1, r0 + bne _0800A2D6 + ldr r1, [r2, 0x4] + ldr r0, [r3, 0x4] + cmp r1, r0 + bne _0800A2D6 + movs r0, 0x1 + b _0800A2D8 +_0800A2D6: + movs r0, 0 +_0800A2D8: + pop {r1} + bx r1 + thumb_func_end sub_800A2BC + + thumb_func_start sub_800A2DC +sub_800A2DC: + push {lr} + ldr r0, [r0] + cmp r0, 0 + blt _0800A2E8 + movs r0, 0 + b _0800A2EA +_0800A2E8: + movs r0, 0x1 +_0800A2EA: + pop {r1} + bx r1 + thumb_func_end sub_800A2DC + + thumb_func_start sub_800A2F0 +sub_800A2F0: + push {r4,r5,lr} + adds r3, r0, 0 + adds r2, r1, 0 + ldr r4, [r3] + lsrs r1, r4, 31 + ldr r5, [r2] + cmp r5, 0 + bge _0800A304 + movs r0, 0x2 + orrs r1, r0 +_0800A304: + cmp r1, 0x1 + beq _0800A326 + cmp r1, 0x1 + ble _0800A314 + cmp r1, 0x2 + beq _0800A32A + cmp r1, 0x3 + beq _0800A32E +_0800A314: + ldr r1, [r3, 0x4] + ldr r3, [r2, 0x4] + adds r0, r4, 0 + adds r2, r5, 0 + bl sub_8009D8C + lsls r0, 24 + lsrs r0, 24 + b _0800A346 +_0800A326: + movs r0, 0x1 + b _0800A346 +_0800A32A: + movs r0, 0 + b _0800A346 +_0800A32E: + ldr r1, [r3, 0x4] + ldr r3, [r2, 0x4] + adds r0, r4, 0 + adds r2, r5, 0 + bl sub_8009D8C + movs r1, 0 + lsls r0, 24 + cmp r0, 0 + bne _0800A344 + movs r1, 0x1 +_0800A344: + adds r0, r1, 0 +_0800A346: + pop {r4,r5} + pop {r1} + bx r1 + thumb_func_end sub_800A2F0 + + thumb_func_start sub_800A34C +sub_800A34C: + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x18 + adds r6, r0, 0 + ldr r0, [r1] + str r0, [sp] + ldr r0, [r1, 0x4] + str r0, [sp, 0x4] + ldr r0, [r2] + str r0, [sp, 0x8] + ldr r0, [r2, 0x4] + add r5, sp, 0x8 + str r0, [r5, 0x4] + mov r0, sp + bl sub_800A2DC + lsls r0, 24 + lsrs r0, 24 + mov r8, r0 + mov r10, r8 + adds r0, r5, 0 + bl sub_800A2DC + lsls r0, 24 + lsrs r7, r0, 24 + mov r9, r7 + mov r0, sp + bl sub_800A2A0 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0 + beq _0800A39A + movs r0, 0 + str r0, [r6] + b _0800A3DE +_0800A39A: + adds r0, r5, 0 + bl sub_800A2A0 + lsls r0, 24 + cmp r0, 0 + beq _0800A3AC + str r4, [r6] + str r4, [r6, 0x4] + b _0800A3E0 +_0800A3AC: + mov r0, r8 + cmp r0, 0 + beq _0800A3B8 + mov r0, sp + bl sub_800A25C +_0800A3B8: + cmp r7, 0 + beq _0800A3C2 + adds r0, r5, 0 + bl sub_800A25C +_0800A3C2: + add r4, sp, 0x10 + adds r0, r4, 0 + mov r1, sp + adds r2, r5, 0 + bl sub_800A4E4 + cmp r10, r9 + beq _0800A3D8 + adds r0, r4, 0 + bl sub_800A25C +_0800A3D8: + ldr r0, [sp, 0x10] + str r0, [r6] + ldr r0, [r4, 0x4] +_0800A3DE: + str r0, [r6, 0x4] +_0800A3E0: + add sp, 0x18 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_800A34C + + thumb_func_start sub_800A3F0 +sub_800A3F0: + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x18 + adds r6, r0, 0 + ldr r0, [r1] + str r0, [sp] + ldr r0, [r1, 0x4] + str r0, [sp, 0x4] + ldr r0, [r2] + str r0, [sp, 0x8] + ldr r0, [r2, 0x4] + add r5, sp, 0x8 + str r0, [r5, 0x4] + mov r0, sp + bl sub_800A2DC + lsls r0, 24 + lsrs r0, 24 + mov r8, r0 + mov r10, r8 + adds r0, r5, 0 + bl sub_800A2DC + lsls r0, 24 + lsrs r7, r0, 24 + mov r9, r7 + adds r0, r5, 0 + bl sub_800A2A0 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0 + beq _0800A448 + ldr r0, _0800A444 + str r0, [r6] + movs r0, 0x1 + negs r0, r0 + b _0800A48C + .align 2, 0 +_0800A444: .4byte 0x7fffffff +_0800A448: + mov r0, sp + bl sub_800A2A0 + lsls r0, 24 + cmp r0, 0 + beq _0800A45A + str r4, [r6] + str r4, [r6, 0x4] + b _0800A48E +_0800A45A: + mov r0, r8 + cmp r0, 0 + beq _0800A466 + mov r0, sp + bl sub_800A25C +_0800A466: + cmp r7, 0 + beq _0800A470 + adds r0, r5, 0 + bl sub_800A25C +_0800A470: + add r4, sp, 0x10 + adds r0, r4, 0 + mov r1, sp + adds r2, r5, 0 + bl sub_800A5A4 + cmp r10, r9 + beq _0800A486 + adds r0, r4, 0 + bl sub_800A25C +_0800A486: + ldr r0, [sp, 0x10] + str r0, [r6] + ldr r0, [r4, 0x4] +_0800A48C: + str r0, [r6, 0x4] +_0800A48E: + add sp, 0x18 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_800A3F0 + + thumb_func_start sub_800A4A0 +sub_800A4A0: + push {r4,r5,lr} + sub sp, 0x10 + adds r5, r0, 0 + ldr r0, [r5] + str r0, [sp] + ldr r0, [r5, 0x4] + str r0, [sp, 0x4] + mov r0, sp + bl sub_800A2A0 + lsls r0, 24 + cmp r0, 0 + beq _0800A4C0 + movs r0, 0 + str r0, [r5] + b _0800A4D8 +_0800A4C0: + mov r0, sp + bl sub_800A27C + add r4, sp, 0x8 + adds r0, r4, 0 + mov r1, sp + mov r2, sp + bl sub_800A4E4 + ldr r0, [sp, 0x8] + str r0, [r5] + ldr r0, [r4, 0x4] +_0800A4D8: + str r0, [r5, 0x4] + add sp, 0x10 + pop {r4,r5} + pop {r0} + bx r0 + thumb_func_end sub_800A4A0 + + thumb_func_start sub_800A4E4 +sub_800A4E4: + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + mov r8, r0 + adds r5, r1, 0 + adds r6, r2, 0 + adds r0, r5, 0 + bl sub_800A2A0 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0 + beq _0800A50C + movs r0, 0 + mov r1, r8 + str r0, [r1] + str r0, [r1, 0x4] + b _0800A596 +_0800A50C: + adds r0, r6, 0 + bl sub_800A2A0 + lsls r0, 24 + cmp r0, 0 + beq _0800A520 + mov r7, r8 + str r4, [r7] + str r4, [r7, 0x4] + b _0800A596 +_0800A520: + ldr r1, [r5] + ldr r4, [r5, 0x4] + ldr r0, [r6] + mov r10, r0 + ldr r2, [r6, 0x4] + movs r6, 0 + movs r5, 0 + movs r7, 0x80 + lsls r7, 24 + mov r9, r7 + movs r0, 0x3F + mov r12, r0 +_0800A538: + adds r3, r5, 0 + movs r0, 0x1 + ands r0, r2 + cmp r0, 0 + beq _0800A54C + adds r5, r4 + adds r6, r1 + cmp r3, r5 + bls _0800A54C + adds r6, 0x1 +_0800A54C: + lsrs r2, 1 + movs r3, 0x1 + mov r0, r10 + ands r0, r3 + cmp r0, 0 + beq _0800A55C + mov r7, r9 + orrs r2, r7 +_0800A55C: + mov r0, r10 + lsrs r0, 1 + mov r10, r0 + lsls r1, 1 + adds r0, r4, 0 + mov r7, r9 + ands r0, r7 + cmp r0, 0 + beq _0800A570 + orrs r1, r3 +_0800A570: + lsls r4, 1 + movs r0, 0x1 + negs r0, r0 + add r12, r0 + mov r7, r12 + cmp r7, 0 + bge _0800A538 + lsrs r1, r5, 15 + ands r1, r3 + lsrs r5, 16 + lsls r0, r6, 16 + orrs r5, r0 + lsrs r6, 16 + cmp r1, 0 + beq _0800A590 + adds r5, 0x1 +_0800A590: + mov r0, r8 + str r6, [r0] + str r5, [r0, 0x4] +_0800A596: + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_800A4E4 + + thumb_func_start sub_800A5A4 +sub_800A5A4: + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x14 + str r0, [sp] + adds r5, r1, 0 + mov r8, r2 + mov r0, r8 + bl sub_800A2A0 + lsls r0, 24 + lsrs r4, r0, 24 + cmp r4, 0 + beq _0800A5D8 + ldr r0, _0800A5D4 + ldr r1, [sp] + str r0, [r1] + movs r0, 0x1 + negs r0, r0 + str r0, [r1, 0x4] + b _0800A6BE + .align 2, 0 +_0800A5D4: .4byte 0x7fffffff +_0800A5D8: + adds r0, r5, 0 + bl sub_800A2A0 + lsls r0, 24 + cmp r0, 0 + beq _0800A5EC + ldr r2, [sp] + str r4, [r2] + str r4, [r2, 0x4] + b _0800A6BE +_0800A5EC: + ldr r0, [r5] + lsls r7, r0, 16 + ldr r1, [r5, 0x4] + lsrs r0, r1, 16 + orrs r7, r0 + lsls r6, r1, 16 + movs r0, 0x80 + lsls r0, 8 + orrs r6, r0 + mov r0, r8 + ldr r0, [r0] + str r0, [sp, 0x4] + mov r1, r8 + ldr r1, [r1, 0x4] + str r1, [sp, 0x8] + movs r2, 0 + str r2, [sp, 0xC] + mov r9, r2 + movs r5, 0 + movs r4, 0 + movs r0, 0x80 + lsls r0, 24 + mov r10, r0 + movs r1, 0x1 + mov r8, r1 + movs r2, 0x3F + str r2, [sp, 0x10] +_0800A622: + lsls r5, 1 + adds r0, r4, 0 + mov r1, r10 + ands r0, r1 + cmp r0, 0 + beq _0800A632 + mov r2, r8 + orrs r5, r2 +_0800A632: + movs r1, 0x2 + negs r1, r1 + lsls r4, 1 + adds r0, r7, 0 + mov r2, r10 + ands r0, r2 + cmp r0, 0 + beq _0800A646 + mov r0, r8 + orrs r4, r0 +_0800A646: + lsls r7, 1 + adds r0, r6, 0 + mov r2, r10 + ands r0, r2 + cmp r0, 0 + beq _0800A656 + mov r0, r8 + orrs r7, r0 +_0800A656: + lsls r6, 1 + ands r6, r1 + adds r0, r5, 0 + adds r1, r4, 0 + ldr r2, [sp, 0x4] + ldr r3, [sp, 0x8] + bl sub_8009D8C + lsls r0, 24 + cmp r0, 0 + bne _0800A680 + adds r0, r4, 0 + movs r1, 0x1 + ldr r2, [sp, 0x8] + subs r4, r2 + ldr r2, [sp, 0x4] + subs r5, r2 + cmp r0, r4 + bcs _0800A682 + subs r5, 0x1 + b _0800A682 +_0800A680: + movs r1, 0 +_0800A682: + ldr r0, [sp, 0xC] + lsls r0, 1 + str r0, [sp, 0xC] + mov r0, r9 + mov r2, r10 + ands r0, r2 + cmp r0, 0 + beq _0800A69A + ldr r0, [sp, 0xC] + mov r2, r8 + orrs r0, r2 + str r0, [sp, 0xC] +_0800A69A: + mov r0, r9 + lsls r0, 1 + mov r9, r0 + cmp r1, 0 + beq _0800A6AA + mov r1, r8 + orrs r0, r1 + mov r9, r0 +_0800A6AA: + ldr r2, [sp, 0x10] + subs r2, 0x1 + str r2, [sp, 0x10] + cmp r2, 0 + bge _0800A622 + ldr r0, [sp, 0xC] + ldr r1, [sp] + str r0, [r1] + mov r2, r9 + str r2, [r1, 0x4] +_0800A6BE: + add sp, 0x14 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_800A5A4 + + thumb_func_start sub_800A6D0 +sub_800A6D0: + push {r4,lr} + adds r4, r0, 0 + ldr r3, [r1] + ldr r0, [r2] + adds r3, r0 + ldr r1, [r1, 0x4] + ldr r0, [r2, 0x4] + adds r0, r1, r0 + cmp r0, r1 + bcs _0800A6E6 + adds r3, 0x1 +_0800A6E6: + str r3, [r4] + str r0, [r4, 0x4] + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_800A6D0 + + thumb_func_start sub_800A6F0 +sub_800A6F0: + push {r4,lr} + adds r4, r0, 0 + ldr r3, [r1] + ldr r0, [r2] + subs r3, r0 + ldr r1, [r1, 0x4] + ldr r0, [r2, 0x4] + subs r0, r1, r0 + cmp r0, r1 + bls _0800A706 + subs r3, 0x1 +_0800A706: + str r3, [r4] + str r0, [r4, 0x4] + pop {r4} + pop {r0} + bx r0 + thumb_func_end sub_800A6F0 + + thumb_func_start sub_800A710 +sub_800A710: + push {r4-r7,lr} + mov r7, r8 + push {r7} + sub sp, 0x18 + mov r8, r0 + adds r6, r2, 0 + ldr r0, [r1] + str r0, [sp] + ldr r0, [r1, 0x4] + str r0, [sp, 0x4] + adds r4, r6, 0 + cmp r6, 0 + bge _0800A72C + negs r4, r6 +_0800A72C: + movs r0, 0 + str r0, [sp, 0x8] + movs r1, 0x80 + lsls r1, 9 + add r0, sp, 0x8 + str r1, [r0, 0x4] + adds r7, r0, 0 + cmp r4, 0 + beq _0800A75E + adds r5, r7, 0 +_0800A740: + movs r0, 0x1 + ands r0, r4 + cmp r0, 0 + beq _0800A752 + adds r0, r5, 0 + adds r1, r5, 0 + mov r2, sp + bl sub_800A34C +_0800A752: + mov r0, sp + bl sub_800A4A0 + asrs r4, 1 + cmp r4, 0 + bne _0800A740 +_0800A75E: + cmp r6, 0 + bge _0800A776 + movs r0, 0 + str r0, [sp, 0x10] + movs r0, 0x80 + lsls r0, 9 + add r1, sp, 0x10 + str r0, [r1, 0x4] + adds r0, r7, 0 + adds r2, r7, 0 + bl sub_800A3F0 +_0800A776: + ldr r0, [sp, 0x8] + mov r1, r8 + str r0, [r1] + ldr r0, [r7, 0x4] + str r0, [r1, 0x4] + add sp, 0x18 + pop {r3} + mov r8, r3 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_800A710 + + thumb_func_start sub_800A78C +sub_800A78C: + push {r4-r7,lr} + mov r7, r10 + mov r6, r9 + mov r5, r8 + push {r5-r7} + sub sp, 0x20 + mov r10, r0 + ldr r0, [r1] + ldr r1, [r1, 0x4] + str r0, [sp] + str r1, [sp, 0x4] + ldr r0, [r2] + ldr r1, [r2, 0x4] + str r0, [sp, 0x8] + str r1, [sp, 0xC] + mov r0, sp + bl sub_800A27C + add r4, sp, 0x8 + adds r0, r4, 0 + bl sub_800A27C + mov r0, sp + adds r1, r4, 0 + bl sub_800A2F0 + lsls r0, 24 + mov r8, r4 + cmp r0, 0 + beq _0800A7DC + ldr r2, [sp] + ldr r3, [sp, 0x4] + str r2, [sp, 0x10] + str r3, [sp, 0x14] + ldr r0, [sp, 0x8] + ldr r1, [sp, 0xC] + str r0, [sp] + str r1, [sp, 0x4] + str r2, [sp, 0x8] + str r3, [sp, 0xC] +_0800A7DC: + mov r0, r8 + bl sub_800A2A0 + lsls r0, 24 + cmp r0, 0 + bne _0800A878 + movs r0, 0 + mov r9, r0 + add r7, sp, 0x10 + add r6, sp, 0x18 + b _0800A800 +_0800A7F2: + mov r0, r8 + mov r1, r8 + adds r2, r7, 0 + bl sub_800A34C + movs r2, 0x1 + add r9, r2 +_0800A800: + adds r4, r7, 0 + mov r1, r8 + adds r0, r4, 0 + mov r2, sp + bl sub_800A3F0 + adds r0, r4, 0 + bl sub_800A4A0 + ldr r0, [sp, 0x10] + str r0, [sp, 0x18] + ldr r1, [r4, 0x4] + movs r0, 0x80 + lsls r0, 11 + adds r1, r0 + adds r5, r6, 0 + str r1, [r5, 0x4] + ldr r0, [r4, 0x4] + cmp r1, r0 + bcs _0800A82E + ldr r0, [sp, 0x18] + adds r0, 0x1 + str r0, [sp, 0x18] +_0800A82E: + adds r0, r4, 0 + adds r1, r4, 0 + adds r2, r5, 0 + bl sub_800A3F0 + adds r0, r5, 0 + mov r1, sp + adds r2, r4, 0 + bl sub_800A34C + ldr r0, [sp, 0x18] + lsls r1, r0, 1 + str r1, [sp, 0x18] + ldr r0, [r5, 0x4] + cmp r0, 0 + bge _0800A854 + movs r0, 0x1 + orrs r1, r0 + str r1, [sp, 0x18] +_0800A854: + ldr r0, [r6, 0x4] + lsls r0, 1 + str r0, [r6, 0x4] + ldr r2, [sp, 0x4] + ldr r1, [sp] + ldr r0, [sp, 0x18] + adds r1, r0 + str r1, [sp] + ldr r0, [r6, 0x4] + adds r0, r2, r0 + str r0, [sp, 0x4] + cmp r2, r0 + bls _0800A872 + adds r0, r1, 0x1 + str r0, [sp] +_0800A872: + mov r2, r9 + cmp r2, 0x2 + bne _0800A7F2 +_0800A878: + ldr r0, [sp] + ldr r1, [sp, 0x4] + mov r2, r10 + str r0, [r2] + str r1, [r2, 0x4] + add sp, 0x20 + pop {r3-r5} + mov r8, r3 + mov r9, r4 + mov r10, r5 + pop {r4-r7} + pop {r0} + bx r0 + thumb_func_end sub_800A78C + + .align 2, 0 @ Don't pad with nop. diff --git a/asm/friend_area_1.s b/asm/friend_area_1.s deleted file mode 100644 index 9feb24125..000000000 --- a/asm/friend_area_1.s +++ /dev/null @@ -1,105 +0,0 @@ - #include "asm/constants/gba_constants.inc" - #include "asm/macros.inc" - - .syntax unified - - .text - - thumb_func_start sub_80926F8 -sub_80926F8: - push {r4-r7,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r3, r0, 24 - lsls r2, 24 - lsrs r7, r2, 24 - movs r5, 0 - movs r2, 0 - ldr r0, _08092780 - mov r12, r0 - cmp r2, r3 - bge _08092724 - ldr r1, _08092784 - adds r2, r3, 0 -_08092714: - movs r6, 0 - ldrsh r0, [r1, r6] - adds r5, r0 - adds r1, 0x8 - subs r2, 0x1 - cmp r2, 0 - bne _08092714 - adds r2, r3, 0 -_08092724: - str r5, [r4, 0x8] - mov r1, r12 - ldr r0, [r1] - adds r0, r2 - ldrb r0, [r0] - strb r0, [r4, 0x4] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _0809279C - movs r0, 0 - strh r0, [r4, 0x2] - ldr r1, _08092784 - lsls r0, r2, 3 - adds r0, r1 - ldrh r0, [r0] - strh r0, [r4] - movs r6, 0 - ldrsh r0, [r4, r6] - cmp r0, 0 - ble _080927A0 - ldr r6, _08092788 - adds r2, r0, 0 -_08092752: - movs r0, 0x58 - adds r1, r5, 0 - muls r1, r0 - ldr r0, [r6] - adds r3, r0, r1 - ldrb r1, [r3] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08092792 - ldrb r0, [r3, 0x2] - cmp r0, 0 - bne _08092776 - cmp r7, 0 - bne _0809278C - ldrb r0, [r3, 0x4] - cmp r0, 0x41 - bne _0809278C -_08092776: - ldrh r0, [r4] - subs r0, 0x1 - strh r0, [r4] - b _08092792 - .align 2, 0 -_08092780: .4byte gFriendAreas -_08092784: .4byte gFriendAreaSettings -_08092788: .4byte gRecruitedPokemonRef -_0809278C: - ldrh r0, [r4, 0x2] - adds r0, 0x1 - strh r0, [r4, 0x2] -_08092792: - subs r2, 0x1 - adds r5, 0x1 - cmp r2, 0 - bne _08092752 - b _080927A0 -_0809279C: - strh r0, [r4, 0x2] - strh r0, [r4] -_080927A0: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80926F8 - - .align 2,0 @ Don't pad with nop - diff --git a/asm/text.s b/asm/text.s index 52f0074c3..d0d5503b1 100644 --- a/asm/text.s +++ b/asm/text.s @@ -3364,6 +3364,7 @@ nullsub_174: bx lr thumb_func_end nullsub_174 +@ https://decomp.me/scratch/A63Io thumb_func_start sub_80095E4 sub_80095E4: push {lr} diff --git a/charmap.txt b/charmap.txt index 108409d51..06798beb6 100644 --- a/charmap.txt +++ b/charmap.txt @@ -298,8 +298,10 @@ END_COLOR_TEXT_2 = 23 72 @ #r WHITE = 30 @ 0 BLUE = 31 @ 1 RED = 32 @ 2 +UNK_COLOR_2 = 02 BLACK = 33 @ 3 GREEN = 34 @ 4 +UNK_COLOR_4 = 04 CYAN = 35 @ 5 CYAN_2 = 05 YELLOW = 36 @ 6 diff --git a/data/data.s b/data/data.s index 363c7662d..d94856dc6 100644 --- a/data/data.s +++ b/data/data.s @@ -1,105 +1,32 @@ .section .rodata - .string "pksdir0\0" + .align 2, 0 +@ event_flag.c +.string "pksdir0\0" - .global gUnknown_80B690C -gUnknown_80B690C: @ 80B690C - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x19, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x34, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00 - .byte 0x85, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x45, 0x01, 0x00, 0x00 - .byte 0x04, 0x00, 0x00, 0x00 - .byte 0x07, 0x00, 0x00, 0x00 - .byte 0x05, 0x00, 0x00, 0x00 - .byte 0x9e, 0x00, 0x00, 0x00 - .byte 0x06, 0x00, 0x00, 0x00 - .byte 0x1b, 0x01, 0x00, 0x00 - .byte 0x07, 0x00, 0x00, 0x00 - .byte 0x36, 0x00, 0x00, 0x00 - .byte 0x08, 0x00, 0x00, 0x00 - .byte 0x04, 0x00, 0x00, 0x00 - .byte 0x09, 0x00, 0x00, 0x00 - .byte 0x18, 0x01, 0x00, 0x00 - .byte 0x0a, 0x00, 0x00, 0x00 - .byte 0x9b, 0x00, 0x00, 0x00 - .byte 0x0b, 0x00, 0x00, 0x00 - .byte 0x68, 0x00, 0x00, 0x00 - .byte 0x0c, 0x00, 0x00, 0x00 - .byte 0x42, 0x00, 0x00, 0x00 - .byte 0x0d, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x0e, 0x00, 0x00, 0x00 - .byte 0x98, 0x00, 0x00, 0x00 - .byte 0x0f, 0x00, 0x00, 0x00 - .byte 0x15, 0x01, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 + .align 2, 0 + .global gUnknown_80B6D30 +gUnknown_80B6D30: + .2byte 5, 7, 0, 0, 1, 0; .4byte gUnknown_80B6D88 + .2byte 5, 7, 2, 0, 1, 0; .4byte gUnknown_80B6D80 + .2byte 5, 7, 4, 0, 1, 0; .4byte gUnknown_80B6D78 + .2byte 5, 7, 6, 0, 1, 0; .4byte gUnknown_80B6D70 - .global gUnknown_80B6994 -gUnknown_80B6994: @ 80B6994 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x07, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00 - .byte 0x9e, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x18, 0x01, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x98, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 +gUnknown_80B6D70: + .string "LOCAL3\0" + .align 2, 0 - .global gPMDBuildVersion -gPMDBuildVersion: @ 80B69BC - .string "PKDi ver 1.0 [Apr 28 2006] 16:37:54\0" - .align 2,0 +gUnknown_80B6D78: + .string "LOCAL2\0" + .align 2, 0 - .global titlen0_text - titlen0_text: - .string "titlen0\0" - .align 2,0 +gUnknown_80B6D80: + .string "LOCAL1\0" + .align 2, 0 - .global titlen1_text - titlen1_text: - .string "titlen1\0" - .align 2,0 - - .global titlen2_text - titlen2_text: - .string "titlen2\0" - .align 2,0 - - .global gLoadScreenBackgroundFileNames -gLoadScreenBackgroundFileNames: @ 80B69F8 - .4byte titlen0_text - .4byte titlen1_text - .4byte titlen2_text - - .global titlen0p_text - titlen0p_text: - .string "titlen0p\0" - .align 2,0 - - .global titlen1p_text - titlen1p_text: - .string "titlen1p\0" - .align 2,0 - - .global titlen2p_text - titlen2p_text: - .string "titlen2p\0" - .align 2,0 - - .global gLoadScreenBackgroundPaletteFileNames -gLoadScreenBackgroundPaletteFileNames: @ 80B6A28 - .4byte titlen0p_text - .4byte titlen1p_text - .4byte titlen2p_text - - #include "text/save.inc" +gUnknown_80B6D88: + .string "LOCAL0\0" + .align 2, 0 .global gUnknown_80B6D90 gUnknown_80B6D90: @ 80B6D90 @@ -546,7 +473,7 @@ gUnknown_80B71A0: @ 80B71A0 .global gUnknown_80B71E4 gUnknown_80B71E4: @ 80B71E4 - @ struct unkEventStruct + @ [struct unkEventStruct] .2byte 105, 1 .2byte 106, 2 .2byte 107, 3 @@ -656,7 +583,9 @@ gUnknown_80B7378: @ 80B7378 .global gUnknown_80B7388 gUnknown_80B7388: @ 80B7388 .string "1-1\0" - .string "pksdir0\0" + +@ code.c +.string "pksdir0\0" .global gUnknown_80B7394 gUnknown_80B7394: @ 80B7394 @@ -1070,18 +999,26 @@ gUnknown_80B7DF8: .string "VERSION\0" .align 2, 0 - .string "pksdir0\0" - .string "pksdir0\0" +@ ??? +.string "pksdir0\0" + +@ ??? +.string "pksdir0\0" .fill 28, 1, 0 - .string "pksdir0\0" + +@ code_8002774.s +.string "pksdir0\0" .fill 8, 1, 0 .global gUnknown_80B7E3C gUnknown_80B7E3C: @ 80B7E3C .4byte 0, 1, 1, 1, 1, 0, 1, -1, 0, -1, -1, -1, -1, 0, -1, 1 - .string "pksdir0\0" - .string "pksdir0\0" +@ ??? +.string "pksdir0\0" + +@ memory.s +.string "pksdir0\0" gUnknown_80B7E8C: .string "../system/memory_locate.c\0" @@ -1134,14 +1071,30 @@ gUnknown_80B7F88: @ 80B7F88 gLocalCreateErrorMessage: @ 80B7F94 .string "Memroy LocalCreate buffer %08x size can't locate\0" @ Spelling error is intentional .align 2,0 - .string "pksdir0\0" - .string "pksdir0\0" - .string "pksdir0\0" - .string "pksdir0\0" - .string "pksdir0\0" - .string "pksdir0\0" - .string "pksdir0\0" - .string "pksdir0\0" + +@ code_80035F0 +.string "pksdir0\0" + +@ other_random +.string "pksdir0\0" + +@ util +.string "pksdir0\0" + +@ bg_palette_buffer +.string "pksdir0\0" + +@ input +.string "pksdir0\0" + +@ code_8004AA0 +.string "pksdir0\0" + +@ sprite +.string "pksdir0\0" + +@ code_800558C.c +.string "pksdir0\0" .global gUnknown_80B8008 gUnknown_80B8008: @ 80B8008 @@ -1800,8 +1753,13 @@ gUnknown_80B83EA: @ 80B83EA .2byte 0x0000 .align 2, 0 - .string "pksdir0\0" - .string "pksdir0\0" + +@ text1.c ? +.string "pksdir0\0" + +@ text1.c or text2.c (gKanjiA_file_string is used in text1.c but the rest in text2.c, and we get code changes for merging the files...) +.string "pksdir0\0" + .global gUnknown_80B853C gUnknown_80B853C: @ 80B853C .4byte 0x66666666 @@ -1955,7 +1913,9 @@ gUnknown_80B8868: @ 80B8868 .byte 0x00, 0x00, 0xf0, 0xff .byte 0x00, 0x00, 0x00, 0xff .byte 0x00, 0x00, 0x00, 0xf0 - .string "pksdir0\0" + +@ text.s +.string "pksdir0\0" .align 2,0 .global gUnknown_80B88B0 @@ -1977,8 +1937,12 @@ gUnknown_80B88C0: @ 80B88C0 gUnknown_80B88CC: @ 80B88CC .string "fontpal\0" .align 2,0 - .string "pksdir0\0" - .string "pksdir0\0" + +@ code_8009804.s +.string "pksdir0\0" + +@ file_system +.string "pksdir0\0" .global gFastMod3Lookup gFastMod3Lookup: @ 80B88E4 @@ -2162,306 +2126,4 @@ gUnknown_80B92E4: @ 80B92E4 .4byte 30, 30, 30, 30, 31, 31, 31, 31 .4byte 31, 31, 31, 31, 31, 31, 31, 31 - .global gUnknown_80B96E4 -gUnknown_80B96E4: @ 80B96E4 -@ It's an array.. - .4byte 0 - .4byte 0 - .4byte 45426 - .4byte 71998 - .4byte 90852 - .4byte 105476 - .4byte 117424 - .4byte 127527 - .4byte 136278 - .4byte 143997 - .4byte 150902 - .4byte 157148 - .4byte 162850 - .4byte 168096 - .4byte 172953 - .4byte 177474 - .4byte 181704 - .4byte 185677 - .4byte 189423 - .4byte 192966 - .4byte 196328 - .4byte 199525 - .4byte 202574 - .4byte 205487 - .4byte 208276 - .4byte 210952 - .4byte 213522 - .4byte 215995 - .4byte 218379 - .4byte 220679 - .4byte 222900 - .4byte 225049 - .4byte 227130 - .4byte 229147 - .4byte 231103 - .4byte 233003 - .4byte 234849 - .4byte 236645 - .4byte 238392 - .4byte 240095 - .4byte 241754 - .4byte 243372 - .4byte 244951 - .4byte 246494 - .4byte 248000 - .4byte 249473 - .4byte 250913 - .4byte 252323 - .4byte 253703 - .4byte 255054 - .4byte 256378 - .4byte 257676 - .4byte 258948 - .4byte 260197 - .4byte 261422 - .4byte 262624 - .4byte 263805 - .4byte 264965 - .4byte 266105 - .4byte 267225 - .4byte 268326 - .4byte 269410 - .4byte 270475 - .4byte 271524 - .4byte 272556 - .4byte 273572 - .4byte 274573 - .4byte 275558 - .4byte 276529 - .4byte 277486 - .4byte 278429 - .4byte 279358 - .4byte 280275 - .4byte 281179 - .4byte 282071 - .4byte 282950 - .4byte 283818 - .4byte 284675 - .4byte 285521 - .4byte 286356 - .4byte 287180 - .4byte 287994 - .4byte 288798 - .4byte 289593 - .4byte 290378 - .4byte 291153 - .4byte 291920 - .4byte 292677 - .4byte 293426 - .4byte 294167 - .4byte 294899 - .4byte 295623 - .4byte 296339 - .4byte 297048 - .4byte 297749 - .4byte 298442 - .4byte 299129 - .4byte 299808 - .4byte 300480 - .4byte 301145 - .4byte 301804 - .4byte 302456 - .4byte 303102 - .4byte 303741 - .4byte 304374 - .4byte 305001 - .4byte 305623 - .4byte 306238 - .4byte 306848 - .4byte 307452 - .4byte 308050 - .4byte 308643 - .4byte 309231 - .4byte 309814 - .4byte 310391 - .4byte 310963 - .4byte 311531 - .4byte 312093 - .4byte 312651 - .4byte 313204 - .4byte 313753 - .4byte 314296 - .4byte 314836 - .4byte 315371 - .4byte 315901 - .4byte 316428 - .4byte 316950 - .4byte 317468 - .4byte 317982 - .4byte 318492 - .4byte 318998 - .4byte 319500 - .4byte 319999 - .4byte 320493 - .4byte 320984 - .4byte 321472 - .4byte 321955 - .4byte 322435 - .4byte 322912 - .4byte 323385 - .4byte 323855 - .4byte 324321 - .4byte 324785 - .4byte 325244 - .4byte 325701 - .4byte 326155 - .4byte 326605 - .4byte 327052 - .4byte 327497 - .4byte 327938 - .4byte 328376 - .4byte 328812 - .4byte 329245 - .4byte 329674 - .4byte 330101 - .4byte 330525 - .4byte 330947 - .4byte 331366 - .4byte 331782 - .4byte 332195 - .4byte 332606 - .4byte 333014 - .4byte 333420 - .4byte 333824 - .4byte 334224 - .4byte 334623 - .4byte 335019 - .4byte 335412 - .4byte 335804 - .4byte 336193 - .4byte 336579 - .4byte 336964 - .4byte 337346 - .4byte 337726 - .4byte 338103 - .4byte 338479 - .4byte 338852 - .4byte 339224 - .4byte 339593 - .4byte 339960 - .4byte 340325 - .4byte 340688 - .4byte 341049 - .4byte 341408 - .4byte 341766 - .4byte 342121 - .4byte 342474 - .4byte 342825 - .4byte 343175 - .4byte 343523 - .4byte 343868 - .4byte 344212 - .4byte 344555 - .4byte 344895 - .4byte 345234 - .4byte 345571 - .4byte 345906 - .4byte 346240 - .4byte 346571 - .4byte 346902 - .4byte 347230 - .4byte 347557 - .4byte 347882 - .4byte 348206 - .4byte 348528 - .4byte 348848 - .4byte 349167 - .4byte 349485 - .4byte 349800 - .4byte 350115 - .4byte 350428 - .4byte 350739 - .4byte 351049 - .4byte 351357 - .4byte 351664 - .4byte 351970 - .4byte 352274 - .4byte 352576 - .4byte 352878 - .4byte 353178 - .4byte 353476 - .4byte 353773 - .4byte 354069 - .4byte 354364 - .4byte 354657 - .4byte 354949 - .4byte 355240 - .4byte 355529 - .4byte 355817 - .4byte 356104 - .4byte 356389 - .4byte 356674 - .4byte 356957 - .4byte 357239 - .4byte 357519 - .4byte 357799 - .4byte 358077 - .4byte 358354 - .4byte 358630 - .4byte 358905 - .4byte 359179 - .4byte 359451 - .4byte 359723 - .4byte 359993 - .4byte 360262 - .4byte 360530 - .4byte 360797 - .4byte 361063 - .4byte 361328 - .4byte 361591 - .4byte 361854 - .4byte 362116 - .4byte 362376 - .4byte 362636 - .4byte 362894 - .4byte 363152 - .4byte 363408 - .4byte 363664 - .4byte 363918 - .4byte 364172 - .4byte 364424 - .4byte 364676 - .4byte 364927 - .4byte 365176 - .4byte 365425 - .4byte 365673 - .4byte 365920 - .4byte 366165 - .4byte 366410 - .4byte 366655 - .4byte 366898 - .4byte 367140 - .4byte 367381 - .4byte 367622 - .4byte 367861 - .4byte 368100 - .4byte 368338 - .4byte 368575 - .4byte 368811 - .4byte 369047 - .4byte 369281 - .4byte 369515 - .4byte 369748 - .4byte 369980 - .4byte 370211 - .4byte 370441 - .4byte 370671 - .4byte 370899 - .4byte 371127 - .4byte 371354 - .4byte 371581 - .4byte 371806 - .4byte 372031 - .4byte 372255 - .4byte 372479 - .4byte 372701 - .4byte 372923 - .4byte 373144 - .4byte 373364 - .4byte 373584 +@ END file_system \ No newline at end of file diff --git a/data/data_80B9BB8.s b/data/data_80B9BB8.s index 2b9dfe691..eefa6628b 100644 --- a/data/data_80B9BB8.s +++ b/data/data_80B9BB8.s @@ -1,6 +1,14 @@ #define TILE_SIZE_2BPP 32 .section .rodata +@ ??? + .align 2, 0 +.string "pksdir0\0" + + .align 2,0 +@ main.c +.string "pksdir0\0" + .string "PKD ROM USER DATA 000000\0" .global gUnknown_80B9BF1 diff --git a/data/data_80D47B8.s b/data/data_80D47B8.s index e356e60fc..b38054155 100644 --- a/data/data_80D47B8.s +++ b/data/data_80D47B8.s @@ -1,5 +1,7 @@ .section .rodata +@ START code_80130A8 #1 (probably part of menu_input) + .align 2, 0 .global UnkData_80D47C4 UnkData_80D47C4: @@ -7,13 +9,11 @@ .global gUnknown_80D47C8 gUnknown_80D47C8: @ 80D47C8 -@ replacing .incbin "baserom.gba", 0x000d47c8, 0x60 .byte 0x00, 0x00, 0x00, 0x00 .byte 0x06, 0x00, 0x00, 0x00 .byte 0x02, 0x00, 0x02, 0x00 .byte 0x1a, 0x00, 0x0c, 0x00 .byte 0x0c, 0x00, 0x00, 0x00 - .4byte UnkData_80D47C4 .byte 0x00, 0x00, 0x00, 0x00 @@ -46,8 +46,11 @@ gUnknown_80D4828: @ 80D4828 gUnknown_80D4830: @ 80D4830 .byte 0x01, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x00, 0x00, 0x64, 0x00, 0x00, 0x00, 0xe8, 0x03, 0x00, 0x00, 0x10, 0x27, 0x00, 0x00, 0xa0, 0x86, 0x01, 0x00, 0x40, 0x42, 0x0f, 0x00, 0x80, 0x96, 0x98, 0x00 .byte 0x00, 0xe1, 0xf5, 0x05 - .asciz "pksdir0" +@ END code_80130A8 #1 + +@ START code_80130A8 #2 +.asciz "pksdir0" .global gUnknown_80D485C gUnknown_80D485C: @ 80D485C @@ -145,7 +148,11 @@ gUnknown_80D4908: @ 80D4908 gUnknown_80D4910: @ 80D4910 .string "$\0" .align 2,0 - .string "pksdir0\0" + +@ END code_80130A8 #2 + +@ START [some global strings] +.string "pksdir0\0" .global Yes_80D491C Yes_80D491C: @@ -547,8 +554,10 @@ gUnknown_80D53E0: .string "This is Felicity Bank.\0" .align 2, 0 +@ START_EARLY kangaskhan #1 + .global gKangaskhanStorageDialogue -gKangaskhanStorageDialogue: @ 80D5404 (Kangaskhan Storage Dialogue) +gKangaskhanStorageDialogue: @ 80D5404 .4byte gUnknown_80D5E9C .4byte gUnknown_80D5E84 .4byte gUnknown_80D5E60 @@ -860,7 +869,7 @@ gUnknown_80D5E9C: .align 2, 0 .global gKecleonShopDialogue -gKecleonShopDialogue: @ 80D5EC8 (Kecleon Wares Dialogue) +gKecleonShopDialogue: @ 80D5EC8 .4byte gUnknown_80D797C .4byte gUnknown_80D7958 .4byte gUnknown_80D7934 @@ -2764,7 +2773,10 @@ gUnknown_80DAF54: .string "Controls in Town 1\0" .align 2, 0 - .string "pksdir0\0" +@ END [some global strings] + +@ START code_80130A8 #3 +.string "pksdir0\0" .global gUnknown_80DAF70 gUnknown_80DAF70: @ 80DAF70 @@ -2793,7 +2805,12 @@ gUnknown_80DAFA0: @ 80DAFA0 .byte 0x03, 0x00, 0x00, 0x00 .byte 0x00, 0x00, 0x00, 0x00 - .string "pksdir0\0" + +@ END code_80130A8 #3 + +@ START code_80130A8 #4 +.string "pksdir0\0" + .global gUnknown_80DAFC0 gUnknown_80DAFC0: @ 80DAFC0 .2byte 3, 0xD @@ -3123,7 +3140,12 @@ gUnknown_80DB65C: @ 80DB65C gUnknown_80DB664: @ 80DB664 .string "%s\0" .align 2,0 - .string "pksdir0\0" + +@ END code_80130A8 #4 + +@ START code_8012A18_1 +.string "pksdir0\0" + .align 2,0 .byte 0x00, 0x00, 0x00, 0x00 .byte 0x03, 0x00, 0x00, 0x00 @@ -3146,7 +3168,10 @@ gUnknown_80DB6A4: @ 80DB6A4 gUnknown_80DB6BC: @ 80DB6BC .string "Please enter a name.\0" .align 2,0 - .string "pksdir0\0" +@ END code_8012A18_1 + +@ START felicity_bank +.string "pksdir0\0" .align 2,0 .global gUnknown_80DB6DC @@ -3189,1426 +3214,5 @@ gFelicitySavings: @ 80DB72C .global gUnknown_80DB738 gUnknown_80DB738: @ 80DB738 .string "Money\0" - .align 2,0 - .string "pksdir0\0" - - .global gUnknown_80DB748 -gUnknown_80DB748: @ 80DB748 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DB760 -gUnknown_80DB760: @ 80DB760 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x04, 0x00 - .byte 0x06, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DB778 -gUnknown_80DB778: @ 80DB778 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x09, 0x00 - .byte 0x06, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DB790 -gUnknown_80DB790: @ 80DB790 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x0e, 0x00 - .byte 0x06, 0x00, 0x04, 0x00 - .byte 0x04, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DB7A8 -gUnknown_80DB7A8: @ 80DB7A8 - .string "Number?\0" - .align 2,0 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DB7B8 -gUnknown_80DB7B8: @ 80DB7B8 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DB7D0 -gUnknown_80DB7D0: @ 80DB7D0 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x03, 0x00 - .byte 0x06, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DB7E8 -gUnknown_80DB7E8: @ 80DB7E8 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x04, 0x00 - .byte 0x06, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DB800 -gUnknown_80DB800: @ 80DB800 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x09, 0x00 - .byte 0x06, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DB818 -gUnknown_80DB818: @ 80DB818 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x0e, 0x00 - .byte 0x06, 0x00, 0x04, 0x00 - .byte 0x04, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DB830 -gUnknown_80DB830: @ 80DB830 - .string "Number?\0" - .align 2,0 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DB840 -gUnknown_80DB840: @ 80DB840 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DB858 -gUnknown_80DB858: @ 80DB858 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x04, 0x00 - .byte 0x06, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DB870 -gUnknown_80DB870: @ 80DB870 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x09, 0x00 - .byte 0x06, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DB888 -gUnknown_80DB888: @ 80DB888 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x0e, 0x00 - .byte 0x06, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DB8A0 -gUnknown_80DB8A0: @ 80DB8A0 - .string "Sell All\0" - .align 2,0 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DB8B4 -gUnknown_80DB8B4: @ 80DB8B4 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DB8CC -gUnknown_80DB8CC: @ 80DB8CC - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x06, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x02, 0x00 - .byte 0x10, 0x00, 0x04, 0x00 - .byte 0x06, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DB8E4 -gUnknown_80DB8E4: @ 80DB8E4 - .string "Goods\0" - .align 2,0 - - .global gUnknown_80DB8EC -gUnknown_80DB8EC: @ 80DB8EC - .string "{COLOR_1 RED}%s{END_COLOR_TEXT_1}\0" - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DB8FC -gUnknown_80DB8FC: @ 80DB8FC - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DB914 -gUnknown_80DB914: @ 80DB914 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x06, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x02, 0x00 - .byte 0x10, 0x00, 0x04, 0x00 - .byte 0x06, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DB92C -gUnknown_80DB92C: @ 80DB92C - .string "Goods\0" - .align 2,0 - - .global gUnknown_80DB934 -gUnknown_80DB934: @ 80DB934 - .string "{COLOR_1 RED}%s{END_COLOR_TEXT_1}\0" - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DB944 -gUnknown_80DB944: @ 80DB944 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - - .global gUnknown_80DB95C -gUnknown_80DB95C: @ 80DB95C - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x06, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x02, 0x00 - .byte 0x10, 0x00, 0x11, 0x00 - .byte 0x13, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - - .global gTeamToolboxA -gTeamToolboxA: @ 80DB974 - .string "Team Toolbox A\0" - .align 2,0 - - .global gTeamToolboxB -gTeamToolboxB: @ 80DB984 - .string "Team Toolbox B\0" - .align 2,0 - - .global gUnknown_80DB994 -gUnknown_80DB994: @ 80DB994 - .string "{COLOR_1}" - .byte 0x02 - .string "{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1}\0" - .align 2,0 - - .global gUnknown_80DB9A0 -gUnknown_80DB9A0: @ 80DB9A0 - .string "{COLOR_1 RED}%s{END_COLOR_TEXT_1}\0" - .align 2,0 - - .global gUnknown_80DB9A8 -gUnknown_80DB9A8: @ 80DB9A8 - .string "Items\0" - .align 2,0 - - .global gUnknown_80DB9B0 -gUnknown_80DB9B0: @ 80DB9B0 - .string "/\0" - .align 2,0 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DB9BC -gUnknown_80DB9BC: @ 80DB9BC - .string "{CENTER_ALIGN}Who will learn the move\n" - .string "{CENTER_ALIGN}{COLOR_1 CYAN}{ARG_POKEMON_7}{END_COLOR_TEXT_1}?\0" - .align 2,0 - - .global gUnknown_80DB9E4 -gUnknown_80DB9E4: @ 80DB9E4 - .string "{CENTER_ALIGN}{COLOR_1 CYAN_3}{ARG_POKEMON_8}{END_COLOR_TEXT_1} learned\n" - .string "{CENTER_ALIGN}the move {COLOR_1 CYAN}{ARG_POKEMON_7}{END_COLOR_TEXT_1}!\0" - .align 2,0 - - .global gUnknown_80DBA0C -gUnknown_80DBA0C: @ 80DBA0C - .string "{CENTER_ALIGN}No one in the current team\n" - .string "{CENTER_ALIGN}can learn this move. \0" - .align 2,0 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DBA4C -gUnknown_80DBA4C: @ 80DBA4C - .string "{ARG_POKEMON_0}\0" - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DBA58 -gUnknown_80DBA58: @ 80DBA58 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DBA70 -gUnknown_80DBA70: @ 80DBA70 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x04, 0x00 - .byte 0x06, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DBA88 -gUnknown_80DBA88: @ 80DBA88 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x0E, 0x00 - .byte 0x06, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DBAA0 -gUnknown_80DBAA0: @ 80DBAA0 - .string "{CENTER_ALIGN}{COLOR_1 YELLOW_5}{ARG_POKEMON_0}{END_COLOR_TEXT_1} received\n" - .string "{CENTER_ALIGN}the promised {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1}. \0" - .align 2,0 - - .global gUnknown_80DBAD0 -gUnknown_80DBAD0: @ 80DBAD0 - .string "{CENTER_ALIGN}{COLOR_1 YELLOW_5}{ARG_POKEMON_0}{END_COLOR_TEXT_1}{APOSTROPHE}s team received\n" - .string "{CENTER_ALIGN}the promised {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1}.\0" - .align 2,0 - - .global gUnknown_80DBB08 -gUnknown_80DBB08: @ 80DBB08 - .string "{CENTER_ALIGN}The team also received\n" - .string "{CENTER_ALIGN}the item {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1}.\0" - .align 2,0 - - .global gUnknown_80DBB38 -gUnknown_80DBB38: @ 80DBB38 - .string "{CENTER_ALIGN}Received the {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1}!{EXTRA_MSG}{CENTER_ALIGN}A very rare statue. It has been placed\n" - .string "{CENTER_ALIGN}outside your rescue team base.\0" - .align 2,0 - - .global gUnknown_80DBB9C -gUnknown_80DBB9C: @ 80DBB9C - .string "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1}...\n" - .string "{CENTER_ALIGN}You{APOSTROPHE}ve already acquired it.{EXTRA_MSG}{CENTER_ALIGN}Sorry to see that...{EXTRA_MSG}{CENTER_ALIGN}In its place{COMMA} {COLOR_1 YELLOW_5}{ARG_POKEMON_0}{END_COLOR_TEXT_1}{COMMA}\n" - .string "{CENTER_ALIGN}you can have {COLOR_1 LIGHT_BLUE}1{COMMA}000{END_COLOR_TEXT_1} {POKE}." - .align 2,0 - - .global gUnknown_80DBC28 -gUnknown_80DBC28: @ 80DBC28 - .string "{CENTER_ALIGN}Your Toolbox is full.\n" - .string "{CENTER_ALIGN}The item was sent to storage.\0" - .align 2,0 - - .global gUnknown_80DBC60 -gUnknown_80DBC60: @ 80DBC60 - .string "{CENTER_ALIGN}Your Toolbox is full.\n" - .string "{CENTER_ALIGN}What would you like to do?\0" - .align 2,0 - - .global gUnknown_80DBC98 -gUnknown_80DBC98: @ 80DBC98 - .string "{CENTER_ALIGN}Is it OK to throw away\n" - .string "{CENTER_ALIGN}this {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1}?\0" - .align 2,0 - - .global gUnknown_80DBCC4 -gUnknown_80DBCC4: @ 80DBCC4 - .string "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1}\n" - .string "{CENTER_ALIGN}was thrown away.\0" - .align 2,0 - - .global gUnknown_80DBCE8 -gUnknown_80DBCE8: @ 80DBCE8 - .string "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_1}{END_COLOR_TEXT_1} was put in\n" - .string "{CENTER_ALIGN}storage to get the {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1}.\0" - .align 2,0 - - .global gUnknown_80DBD24 -gUnknown_80DBD24: @ 80DBD24 - .string "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_1}{END_COLOR_TEXT_1} was discarded\n" - .string "{CENTER_ALIGN}to get the {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1}.\0" - .align 2,0 - - .global gKangaskhanTrashToolboxItem -gKangaskhanTrashToolboxItem: @ 80DBD58 - .string "Trash Toolbox Item\0" - .align 2,0 - - .global gKangaskhanTrashReceivedItem -gKangaskhanTrashReceivedItem: @ 80DBD6C - .string "Trash Received Item\0" - .align 2,0 - - .global gKangaskhanStorage -gKangaskhanStorage: @ 80DBD80 - .string "Storage\0" - .align 2,0 - - .global gKangaskhanTrash -gKangaskhanTrash: @ 80DBD88 - .string "Trash\0" - .align 2,0 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DBD98 -gUnknown_80DBD98: @ 80DBD98 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - - .global gUnknown_80DBDB0 -gUnknown_80DBDB0: @ 80DBDB0 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x04, 0x00 - .byte 0x06, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DBDC8 -gUnknown_80DBDC8: @ 80DBDC8 - .string "Switch\0" - .align 2,0 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DBDD8 -gUnknown_80DBDD8: @ 80DBDD8 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DBDF0 -gUnknown_80DBDF0: @ 80DBDF0 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x06, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x02, 0x00 - .byte 0x10, 0x00, 0x11, 0x00 - .byte 0x13, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DBE08 -gUnknown_80DBE08: @ 80DBE08 - .string "IQ Skills\0" - .align 2,0 - - .global gUnknown_80DBE14 -gUnknown_80DBE14: @ 80DBE14 - .byte 0x87, 0x42, 0x00, 0x00 - - .global gUnknown_80DBE18 -gUnknown_80DBE18: @ 80DBE18 - .byte 0x87, 0x40, 0x00, 0x00 - - .global gUnknown_80DBE1C -gUnknown_80DBE1C: @ 80DBE1C - .string "{ARG_MOVE_ITEM_0}{ARG_MOVE_ITEM_1}\0" - .align 2,0 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DBE2C -gUnknown_80DBE2C: @ 80DBE2C - .string "{ARG_MOVE_ITEM_0}\0" - .align 2,0 - - .global gUnknown_80DBE30 -gUnknown_80DBE30: @ 80DBE30 - .string "{ARG_POKEMON_0}\0" - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DBE3C -gUnknown_80DBE3C: @ 80DBE3C - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DBE54 -gUnknown_80DBE54: @ 80DBE54 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x06, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x02, 0x00 - .byte 0x10, 0x00, 0x0E, 0x00 - .byte 0x10, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DBE6C -gUnknown_80DBE6C: @ 80DBE6C - .string "Storage\0" - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DBE7C -gUnknown_80DBE7C: @ 80DBE7C - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global UnkData_80DBE94 - UnkData_80DBE94: - .byte 0x01, 0x00, 0x07, 0x00 - - .global gUnknown_80DBE98 -gUnknown_80DBE98: @ 80DBE98 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x06, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x02, 0x00 - .byte 0x09, 0x00, 0x06, 0x00 - .byte 0x06, 0x00, 0x00, 0x00 - - .4byte UnkData_80DBE94 - - .global gUnknown_80DBEB0 -gUnknown_80DBEB0: @ 80DBEB0 - .byte 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x08, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00 - .byte 0x0c, 0x00, 0x04, 0x00, 0x10, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0e, 0x00, 0x1a, 0x00, 0x04, 0x00 - .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - - .global gMenuItems -gMenuItems: @ 80DBF10 - .string "Items\0" - .align 2,0 - - .global gMenuTeam -gMenuTeam: @ 80DBF18 - .string "Team\0" - .align 2,0 - - .global gMenuJobList -gMenuJobList: @ 80DBF20 - .string "Job List\0" - .align 2,0 - - .global gMenuOthers -gMenuOthers: @ 80DBF2C - .string "Others\0" - .align 2,0 - - .global gUnknown_80DBF34 -gUnknown_80DBF34: @ 80DBF34 - .byte 0x81, 0x48 - .byte 0x81, 0x48 - .byte 0x81, 0x48 - .byte 0x00, 0x00 - - .global gUnknown_80DBF3C -gUnknown_80DBF3C: @ 80DBF3C - .string "%s {COLOR_1 CYAN}%d{END_COLOR_TEXT_1} Pts.\0" - .align 2,0 - - .global gUnknown_80DBF4C -gUnknown_80DBF4C: @ 80DBF4C - .string "Money: {COLOR_1 CYAN}%d{END_COLOR_TEXT_1} {POKE}" - .align 2,0 - - .global gTeamRankBadgeFileName -gTeamRankBadgeFileName: @ 80DBF60 - .string "tmrkpat\0" - .align 2,0 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DBF70 -gUnknown_80DBF70: @ 80DBF70 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DBF88 -gUnknown_80DBF88: @ 80DBF88 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x06, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x02, 0x00 - .byte 0x18, 0x00, 0x11, 0x00 - .byte 0x11, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DBFA0 -gUnknown_80DBFA0: @ 80DBFA0 - .string "Field\0" - .align 2,0 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DBFB0 -gUnknown_80DBFB0: @ 80DBFB0 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global UnkData_80DBFC8 - UnkData_80DBFC8: - .byte 0x01, 0x00, 0x07, 0x00 - - .global gUnknown_80DBFCC -gUnknown_80DBFCC: @ 80DBFCC - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x06, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x02, 0x00 - .byte 0x0A, 0x00, 0x06, 0x00 - .byte 0x06, 0x00, 0x00, 0x00 - - .4byte UnkData_80DBFC8 - - .global gOthers_MenuOption -gOthers_MenuOption: @ 80DBFE4 - .string "Others\0" - .align 2,0 - - .global gUnknown_80DBFEC -gUnknown_80DBFEC: @ 80DBFEC - .string "Change settings?\0" - .align 2,0 - - .global gOthers_GameOptions -gOthers_GameOptions: @ 80DC000 - .string "Game Options\0" - .align 2,0 - - .global gOthers_Hints -gOthers_Hints: @ 80DC010 - .string "Hints\0" - .align 2,0 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DC020 -gUnknown_80DC020: @ 80DC020 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global UnkData_80DC038 - UnkData_80DC038: - .byte 0x01, 0x00, 0x0a, 0x00 - - .global gUnknown_80DC03C -gUnknown_80DC03C: @ 80DC03C - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x06, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x02, 0x00 - .byte 0x18, 0x00, 0x10, 0x00 - .byte 0x12, 0x00, 0x00, 0x00 - - .4byte UnkData_80DC038 - -@ Window Settings - - .global gWindowBGTitle -gWindowBGTitle: @ 80DC054 - .string "Game Options\0" - .align 2,0 - - .global gUnknown_80DC064 -gUnknown_80DC064: @ 80DC064 - .string "Windows#=P.Blue#=x.Red#=" - .byte 0xA0 - .string ".Green\0" - .align 2,0 - - .global gWindowBGBlueString -gWindowBGBlueString: @ 80DC084 - .string "Blue\0" - .align 2,0 - - .global gWindowBGRedString -gWindowBGRedString: @ 80DC08C - .string "Red\0" - .align 2,0 - - .global gWindowBGGreenString -gWindowBGGreenString: @ 80DC090 - .string "Green\0" - .align 2,0 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DC0A0 -gUnknown_80DC0A0: @ 80DC0A0 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global Data_80DC0B8 - Data_80DC0B8: - .byte 0x01, 0x00, 0x08, 0x00 - - .global gUnknown_80DC0BC -gUnknown_80DC0BC: @ 80DC0BC - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x06, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x02, 0x00 - .byte 0x18, 0x00, 0x0E, 0x00 - .byte 0x0E, 0x00, 0x00, 0x00 - - .4byte Data_80DC0B8 - - .global gUnknown_80DC0D4 -gUnknown_80DC0D4: @ 80DC0D4 - .string "Hints\0" - .align 2,0 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DC0E4 -gUnknown_80DC0E4: @ 80DC0E4 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC0FC -gUnknown_80DC0FC: @ 80DC0FC - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x06, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x02, 0x00 - .byte 0x1a, 0x00, 0x10, 0x00 - .byte 0x10, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DC11C -gUnknown_80DC11C: @ 80DC11C - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC134 -gUnknown_80DC134: @ 80DC134 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x16, 0x00, 0x04, 0x00 - .byte 0x06, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x16, 0x00, 0x0e, 0x00 - .byte 0x06, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC164 -gUnknown_80DC164: @ 80DC164 - .string "Only four moves may be learned!\n" - .string "Will a move be forgotten?\0" - .align 2,0 - - .global gUnknown_80DC1A0 -gUnknown_80DC1A0: @ 80DC1A0 - .string "{CENTER_ALIGN}Forget the move {COLOR_1 GREEN}{ARG_POKEMON_1}{END_COLOR_TEXT_1} and\n" - .string "{CENTER_ALIGN}any moves linked to it{COMMA} and learn the move\n" - .string "{CENTER_ALIGN}{COLOR_1 CYAN}{ARG_POKEMON_0}{END_COLOR_TEXT_1}?\0" - .align 2,0 - - .global gUnknown_80DC1FC -gUnknown_80DC1FC: @ 80DC1FC - .string "{CENTER_ALIGN}Forget the move {COLOR_1 GREEN}{ARG_POKEMON_1}{END_COLOR_TEXT_1}\n" - .string "{CENTER_ALIGN}and learn {COLOR_1 CYAN}{ARG_POKEMON_0}{END_COLOR_TEXT_1}?\0" - .align 2,0 - - .global gUnknown_80DC230 -gUnknown_80DC230: @ 80DC230 - .string "Forget\0" - .align 2,0 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DC240 -gUnknown_80DC240: @ 80DC240 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global Data_80DC258 - Data_80DC258: - .byte 0x01, 0x00, 0x0f, 0x00 - - .global gUnknown_80DC25C -gUnknown_80DC25C: @ 80DC25C - .byte 0x00, 0x00 - .byte 0x00, 0x00 - .byte 0x06, 0x00 - .byte 0x00, 0x00 - .byte 0x02, 0x00 - .byte 0x02, 0x00 - .byte 0x12, 0x00 - .byte 0x08, 0x00 - .byte 0x08, 0x00 - .byte 0x00, 0x00 - - .4byte Data_80DC258 - - .global gUnknown_80DC274 -gUnknown_80DC274: @ 80DC274 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x0f, 0x00 - .byte 0x1a, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC28C -gUnknown_80DC28C: @ 80DC28C - .string "Moves: {COLOR_1 YELLOW}{ARG_POKEMON_0}{END_COLOR_TEXT_1} \0" - .align 2,0 - - .global gUnknown_80DC2A0 -gUnknown_80DC2A0: @ 80DC2A0 - .string "{ARG_MOVE_ITEM_0}\0" - .align 2,0 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DC2AC -gUnknown_80DC2AC: @ 80DC2AC - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC2C4 -gUnknown_80DC2C4: @ 80DC2C4 - .byte 0x00, 0x00 - .byte 0x00, 0x00 - .byte 0x06, 0x00 - .byte 0x00, 0x00 - .byte 0x02, 0x00 - .byte 0x02, 0x00 - .byte 0x0f, 0x00 - .byte 0x04, 0x00 - .byte 0x06, 0x00 - .byte 0x00, 0x00 - .byte 0x00, 0x00 - .byte 0x00, 0x00 - - .global gUnknown_80DC2DC -gUnknown_80DC2DC: @ 80DC2DC - .string "Moves Page: %d/%d \0" - .align 2,0 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DC2F8 -gUnknown_80DC2F8: @ 80DC2F8 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC310 -gUnknown_80DC310: @ 80DC310 - .string "{ARG_POKEMON_0}\0" - .align 2,0 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DC31C -gUnknown_80DC31C: @ 80DC31C - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC334 -gUnknown_80DC334: @ 80DC334 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x13, 0x00, 0x04, 0x00 - .byte 0x08, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC34C -gUnknown_80DC34C: @ 80DC34C - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x16, 0x00, 0x04, 0x00 - .byte 0x06, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x16, 0x00, 0x0e, 0x00 - .byte 0x06, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC37C -gUnknown_80DC37C: @ 80DC37C - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x16, 0x00, 0x03, 0x00 - .byte 0x06, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC394 -gUnknown_80DC394: @ 80DC394 - .string "{R_BUTTON}+{DPAD}: Shift moves\n" - .string "{R_BUTTON}+{A_BUTTON}: Switch link {SELECT_BUTTON} Set\0" - - .global gGulpinProceed -gGulpinProceed: @ 80DC3C4 - .string "Proceed\0" - .align 2,0 - - .global gGulpinInfo -gGulpinInfo: @ 80DC3CC - .string "{COLOR_1 YELLOW}Info{END_COLOR_TEXT_1} \0" - .align 2,0 - - .global gUnknown_80DC3D8 -gUnknown_80DC3D8: @ 80DC3D8 - .string "Moves\0" - .align 2,0 - - .global gUnknown_80DC3E0 -gUnknown_80DC3E0: @ 80DC3E0 - .string "Summary\0" - .align 2,0 - - .global gUnknown_80DC3E8 -gUnknown_80DC3E8: @ 80DC3E8 - .string "Check IQ\0" - .align 2,0 - - .global gUnknown_80DC3F4 -gUnknown_80DC3F4: @ 80DC3F4 - .string "Remember\0" - .align 2,0 - - .global gGulpinDeselect -gGulpinDeselect: @ 80DC400 - .string "Deselect\0" - .align 2,0 - - .global gGulpinSet -gGulpinSet: @ 80DC40C - .string "Set\0" - .align 2,0 - - .global gGulpinLink -gGulpinLink: @ 80DC410 - .string "Link\0" - .align 2,0 - - .global gGulpinDelink -gGulpinDelink: @ 80DC418 - .string "Delink\0" - .align 2,0 - - .global gGulpinForget -gGulpinForget: @ 80DC420 - .string "Forget\0" - .align 2,0 - - .global gUnknown_80DC428 -gUnknown_80DC428: @ 80DC428 - .string "Setting moves\0" - .align 2,0 - - .global gUnknown_80DC438 -gUnknown_80DC438: @ 80DC438 - .string "Linking moves\0" - .align 2,0 - - .global gUnknown_80DC448 -gUnknown_80DC448: @ 80DC448 - .string "Remembering moves\0" - .align 2,0 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DC464 -gUnknown_80DC464: @ 80DC464 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC47C -gUnknown_80DC47C: @ 80DC47C - .byte 0x00, 0x00 - .byte 0x00, 0x00 - .byte 0x06, 0x00 - .byte 0x00, 0x00 - .byte 0x02, 0x00 - .byte 0x02, 0x00 - .byte 0x11, 0x00 - .byte 0x11, 0x00 - .byte 0x11, 0x00 - .byte 0x00, 0x00 - .byte 0x00, 0x00 - .byte 0x00, 0x00 - - .global gUnknown_80DC494 -gUnknown_80DC494: @ 80DC494 - .string "Friend Areas\0" - .align 2,0 - - .global gUnknown_80DC4A4 -gUnknown_80DC4A4: @ 80DC4A4 - .string "{COLOR_1 RED}%s{END_COLOR_TEXT_1}\0" - .align 2,0 - - .global gUnknown_80DC4AC -gUnknown_80DC4AC: @ 80DC4AC - .string "{COLOR_1 GREEN}%s{END_COLOR_TEXT_1}\0" - .align 2,0 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DC4BC -gUnknown_80DC4BC: @ 80DC4BC - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC4D4 -gUnknown_80DC4D4: @ 80DC4D4 - .byte 0x01, 0x00, 0x12, 0x00 - - .global gUnknown_80DC4D8 -gUnknown_80DC4D8: @ 80DC4D8 - .byte 0x00, 0x00 - .byte 0x00, 0x00 - .byte 0x06, 0x00 - .byte 0x00, 0x00 - .byte 0x02, 0x00 - .byte 0x02, 0x00 - .byte 0x1a, 0x00 - .byte 0x11, 0x00 - .byte 0x11, 0x00 - .byte 0x00, 0x00 - - .4byte gUnknown_80DC4D4 - - .global gUnknown_80DC4F0 -gUnknown_80DC4F0: @ 80DC4F0 - .string "Inhabitants (Friends: {COLOR_2 CYAN}Light blue{END_COLOR_TEXT_2})\0" - .align 2,0 - - .global gUnknown_80DC518 -gUnknown_80DC518: @ 80DC518 - .string "Inhabitants\0" - .align 2,0 - - .global gUnknown_80DC524 -gUnknown_80DC524: @ 80DC524 - .string "{COLOR_2 CYAN}%s{END_COLOR_TEXT_2}\0" - .align 2,0 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DC534 -gUnknown_80DC534: @ 80DC534 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC54C -gUnknown_80DC54C: @ 80DC54C - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x15, 0x00, 0x04, 0x00 - .byte 0x06, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC564 -gUnknown_80DC564: @ 80DC564 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x15, 0x00, 0x0e, 0x00 - .byte 0x06, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DC584 -gUnknown_80DC584: @ 80DC584 - .4byte Yes_80DC5A0 - .byte 0x02, 0x00, 0x00, 0x00 - .4byte No_80DC59C - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x01, 0x00, 0x00, 0x00 - - .global No_80DC59C - No_80DC59C: - .string "No\0" - .align 2,0 - .global Yes_80DC5A0 - Yes_80DC5A0: - .string "Yes\0" - .align 2,0 - - .global gUnknown_80DC5A4 -gUnknown_80DC5A4: @ 80DC5A4 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC5BC -gUnknown_80DC5BC: @ 80DC5BC - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x04, 0x00 - .byte 0x06, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC5D4 -gUnknown_80DC5D4: @ 80DC5D4 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x0b, 0x00 - .byte 0x06, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC5EC -gUnknown_80DC5EC: @ 80DC5EC - .byte 0x81, 0x48 - .byte 0x81, 0x48 - .byte 0x81, 0x48 - .byte 0x00, 0x00 - - .global gUnknown_80DC5F4 -gUnknown_80DC5F4: @ 80DC5F4 - .string "It doesn{APOSTROPHE}t appear to be hungry.\0" - .align 2,0 - - .global gUnknown_80DC618 -gUnknown_80DC618: @ 80DC618 - .string "{ARG_POKEMON_1} took the Gummi and ate it.\n" - .string "This Gummi looks like a big favorite!\n" - .string "{ARG_POKEMON_1}{APOSTROPHE}s IQ went up!\0" - .align 2,0 - - .global gUnknown_80DC674 -gUnknown_80DC674: @ 80DC674 - .string "{ARG_POKEMON_1} took the Gummi and ate it.\n" - .string "This Gummi looks like a favorite!\n" - .string "{ARG_POKEMON_1}{APOSTROPHE}s IQ went up!\0" - .align 2,0 - - .global gUnknown_80DC6CC -gUnknown_80DC6CC: @ 80DC6CC - .string "{ARG_POKEMON_1} took the Gummi and ate it.\n" - .string "It doesn{APOSTROPHE}t seem to dislike this Gummi.\n" - .string "{ARG_POKEMON_1}{APOSTROPHE}s IQ went up!\0" - .align 2,0 - - .global gUnknown_80DC728 -gUnknown_80DC728: @ 80DC728 - .string "{ARG_POKEMON_1} took the Gummi and ate it.\n" - .string "It appears to be just a little satisfied.\n" - .string "{ARG_POKEMON_1}{APOSTROPHE}s IQ went up!\0" - .align 2,0 - - .global gUnknown_80DC788 -gUnknown_80DC788: @ 80DC788 - .string "{ARG_POKEMON_1}{APOSTROPHE}s IQ helped it learn how to\n" - .string "use {ARG_MOVE_ITEM_1}!\0" - .align 2,0 - - .global gUnknown_80DC7B4 -gUnknown_80DC7B4: @ 80DC7B4 - .string "Yes! {ARG_POKEMON_1} grew explosively!\n" - .string "Attack{COMMA} Defense{COMMA} and so on rose by 1!\0" - .align 2,0 - - .global gUnknown_80DC7FC -gUnknown_80DC7FC: @ 80DC7FC -@ replacing .incbin "baserom.gba", 0x000dc7fc, 0x20 - .string "Yes!\n" - .string "{ARG_POKEMON_1}{APOSTROPHE}s Attack rose by 1!\0" - .align 2,0 - - .global gUnknown_80DC81C -gUnknown_80DC81C: @ 80DC81C -@ replacing .incbin "baserom.gba", 0x000dc81c, 0x28 - .string "Yes!\n" - .string "{ARG_POKEMON_1}{APOSTROPHE}s Special Attack rose by 1!\0" - .align 2,0 - - .global gUnknown_80DC844 -gUnknown_80DC844: @ 80DC844 -@ replacing .incbin "baserom.gba", 0x000dc844, 0x20 - .string "Yes!\n" - .string "{ARG_POKEMON_1}{APOSTROPHE}s Defense rose by 1!\0" - .align 2,0 - - - .global gUnknown_80DC864 -gUnknown_80DC864: @ 80DC864 -@ replacing .incbin "baserom.gba", 0x000dc864, 0x28 - .string "Yes!\n" - .string "{ARG_POKEMON_1}{APOSTROPHE}s Special Defense rose by 1!\0" - .align 2,0 - - .global gUnknown_80DC88C -gUnknown_80DC88C: @ 80DC88C -@ replacing .incbin "baserom.gba", 0x000dc88c, 0x20 - .string "You don{APOSTROPHE}t have any Gummis.\0" - .align 2,0 - - .global gUnknown_80DC8AC -gUnknown_80DC8AC: @ 80DC8AC -@ replacing .incbin "baserom.gba", 0x000dc8ac, 0x1c - .string "You don{APOSTROPHE}t have an item.\0" - .align 2,0 - - .global gUnknown_80DC8C8 -gUnknown_80DC8C8: @ 80DC8C8 -@ replacing .incbin "baserom.gba", 0x000dc8c8, 0x14 - .string "The Gummi is gone!\0" - .align 2,0 - - .global gUnknown_80DC8DC -gUnknown_80DC8DC: @ 80DC8DC - .string "The item is gone!\0" - .align 2,0 - - .global gUnknown_80DC8F0 -gUnknown_80DC8F0: @ 80DC8F0 - .string "Give\0" - .align 2,0 - - .global gUnknown_80DC8F8 -gUnknown_80DC8F8: @ 80DC8F8 -@ replacing .incbin "baserom.gba", 0x000dc8f8, 0xc - .string "Use\0" - .align 2,0 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DC904 -gUnknown_80DC904: @ 80DC904 -@ replacing .incbin "baserom.gba", 0x000dc904, 0x18 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC91C -gUnknown_80DC91C: @ 80DC91C -@ replacing .incbin "baserom.gba", 0x000dc91c, 0x18 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x06, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x02, 0x00 - .byte 0x0f, 0x00, 0x0e, 0x00 - .byte 0x0e, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC934 -gUnknown_80DC934: @ 80DC934 -@ replacing .incbin "baserom.gba", 0x000dc934, 0x8 - .string "Pokémon\0" - .align 2,0 - - .global gUnknown_80DC93C -gUnknown_80DC93C: @ 80DC93C -@ replacing .incbin "baserom.gba", 0x000dc93c, 0x14 - .string "{COLOR_2}%c%s{END_COLOR_TEXT_2}\0" - .align 2,0 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DC950 -gUnknown_80DC950: @ 80DC950 -@ replacing .incbin "baserom.gba", 0x000dc950, 0x18 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC968 -gUnknown_80DC968: @ 80DC968 -@ replacing .incbin "baserom.gba", 0x000dc968, 0x18 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x06, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x02, 0x00 - .byte 0x0f, 0x00, 0x0e, 0x00 - .byte 0x0e, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC980 -gUnknown_80DC980: @ 80DC980 -@ replacing .incbin "baserom.gba", 0x000dc980, 0x8 - .string "Friends\0" - - .global gUnknown_80DC988 -gUnknown_80DC988: @ 80DC988 -@ replacing .incbin "baserom.gba", 0x000dc988, 0x10 - .string "Pokémon Friends\0" - - .global gUnknown_80DC998 -gUnknown_80DC998: @ 80DC998 -@ replacing .incbin "baserom.gba", 0x000dc998, 0xc - .string "{COLOR_2}%c%s{END_COLOR_TEXT_2}\0" - .align 2,0 - - .global gUnknown_80DC9A4 -gUnknown_80DC9A4: @ 80DC9A4 -@ replacing .incbin "baserom.gba", 0x000dc9a4, 0xc - .string "%s\0" - .align 2,0 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DC9B0 -gUnknown_80DC9B0: @ 80DC9B0 -@ replacing .incbin "baserom.gba", 0x000dc9b0, 0x18 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DC9C8 -gUnknown_80DC9C8: @ 80DC9C8 -@ replacing .incbin "baserom.gba", 0x000dc9c8, 0x20 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x06, 0x00, 0x00, 0x00 - .byte 0x02, 0x00, 0x02, 0x00 - .byte 0x12, 0x00, 0x0e, 0x00 - .byte 0x12, 0x00, 0x02, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .string "pksdir0\0" - .align 2,0 - - .global gUnknown_80DC9E8 -gUnknown_80DC9E8: @ 80DC9E8 -@ replacing .incbin "baserom.gba", 0x000dc9e8, 0x18 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DCA00 -gUnknown_80DCA00: @ 80DCA00 -@ replacing .incbin "baserom.gba", 0x000dca00, 0x18 - .byte 0x00, 0x00, 0x00, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x14, 0x00, 0x04, 0x00 - .byte 0x06, 0x00, 0x03, 0x00 - .byte 0x03, 0x00, 0x00, 0x00 - .byte 0x00, 0x00, 0x00, 0x00 - - .global gUnknown_80DCA18 -gUnknown_80DCA18: @ 80DCA18 - .string "Evolve\0" - .align 2,0 - .4byte gUnknown_80DCA18 - - .global gUnknown_80DCA24 -gUnknown_80DCA24: @ 80DCA24 - .string "No\0" - .align 2,0 - .4byte gUnknown_80DCA24 - - .global gUnknown_80DCA2C -gUnknown_80DCA2C: @ 80DCA2C -@ replacing .incbin "baserom.gba", 0x000dca2c, 0x8 - .string "Yes\0" - .align 2,0 - .4byte gUnknown_80DCA2C +@ END FELICITY BANK \ No newline at end of file diff --git a/data/data_80DBD98.s b/data/data_80DBD98.s new file mode 100644 index 000000000..2d93e98d4 --- /dev/null +++ b/data/data_80DBD98.s @@ -0,0 +1,365 @@ + .section .rodata + +@ code_801C620 #1 + .align 2,0 +.string "pksdir0\0" + + .global gUnknown_80DBD98 +gUnknown_80DBD98: @ 80DBD98 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + + .global gUnknown_80DBDB0 +gUnknown_80DBDB0: @ 80DBDB0 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x14, 0x00, 0x04, 0x00 + .byte 0x06, 0x00, 0x03, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DBDC8 +gUnknown_80DBDC8: @ 80DBDC8 + .string "Switch\0" + +@ code_801C620 #2 + .align 2,0 +.string "pksdir0\0" + .align 2,0 + + .global gUnknown_80DBDD8 +gUnknown_80DBDD8: @ 80DBDD8 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DBDF0 +gUnknown_80DBDF0: @ 80DBDF0 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x06, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x02, 0x00 + .byte 0x10, 0x00, 0x11, 0x00 + .byte 0x13, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DBE08 +gUnknown_80DBE08: @ 80DBE08 + .string "IQ Skills\0" + .align 2,0 + + .global gUnknown_80DBE14 +gUnknown_80DBE14: @ 80DBE14 + .byte 0x87, 0x42, 0x00, 0x00 + + .global gUnknown_80DBE18 +gUnknown_80DBE18: @ 80DBE18 + .byte 0x87, 0x40, 0x00, 0x00 + + .global gUnknown_80DBE1C +gUnknown_80DBE1C: @ 80DBE1C + .string "{ARG_MOVE_ITEM_0}{ARG_MOVE_ITEM_1}\0" + +@ code_801C620 #3 + .align 2,0 +.string "pksdir0\0" + .align 2,0 + + .global gUnknown_80DBE2C +gUnknown_80DBE2C: @ 80DBE2C + .string "{ARG_MOVE_ITEM_0}\0" + .align 2,0 + + .global gUnknown_80DBE30 +gUnknown_80DBE30: @ 80DBE30 + .string "{ARG_POKEMON_0}\0" + +@ code_801C620 #4 +.string "pksdir0\0" + .align 2,0 + + .global gUnknown_80DBE3C +gUnknown_80DBE3C: @ 80DBE3C + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DBE54 +gUnknown_80DBE54: @ 80DBE54 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x06, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x02, 0x00 + .byte 0x10, 0x00, 0x0E, 0x00 + .byte 0x10, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DBE6C +gUnknown_80DBE6C: @ 80DBE6C + +@ code_801C620 #5 + .string "Storage\0" +.string "pksdir0\0" + .align 2,0 + + .global gUnknown_80DBE7C +gUnknown_80DBE7C: @ 80DBE7C + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global UnkData_80DBE94 + UnkData_80DBE94: + .byte 0x01, 0x00, 0x07, 0x00 + + .global gUnknown_80DBE98 +gUnknown_80DBE98: @ 80DBE98 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x06, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x02, 0x00 + .byte 0x09, 0x00, 0x06, 0x00 + .byte 0x06, 0x00, 0x00, 0x00 + + .4byte UnkData_80DBE94 + + .global gUnknown_80DBEB0 +gUnknown_80DBEB0: @ 80DBEB0 + .byte 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03, 0x00, 0x08, 0x00, 0x06, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00 + .byte 0x0c, 0x00, 0x04, 0x00, 0x10, 0x00, 0x02, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x0e, 0x00, 0x1a, 0x00, 0x04, 0x00 + .byte 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 + + .global gMenuItems +gMenuItems: @ 80DBF10 + .string "Items\0" + .align 2,0 + + .global gMenuTeam +gMenuTeam: @ 80DBF18 + .string "Team\0" + .align 2,0 + + .global gMenuJobList +gMenuJobList: @ 80DBF20 + .string "Job List\0" + .align 2,0 + + .global gMenuOthers +gMenuOthers: @ 80DBF2C + .string "Others\0" + .align 2,0 + + .global gUnknown_80DBF34 +gUnknown_80DBF34: @ 80DBF34 + .byte 0x81, 0x48 + .byte 0x81, 0x48 + .byte 0x81, 0x48 + .byte 0x00, 0x00 + + .global gUnknown_80DBF3C +gUnknown_80DBF3C: @ 80DBF3C + .string "%s {COLOR_1 CYAN}%d{END_COLOR_TEXT_1} Pts.\0" + .align 2,0 + + .global gUnknown_80DBF4C +gUnknown_80DBF4C: @ 80DBF4C + .string "Money: {COLOR_1 CYAN}%d{END_COLOR_TEXT_1} {POKE}" + .align 2,0 + + .global gTeamRankBadgeFileName +gTeamRankBadgeFileName: @ 80DBF60 + .string "tmrkpat\0" + +@ code_801D760 + .align 2,0 +.string "pksdir0\0" + .align 2,0 + + .global gUnknown_80DBF70 +gUnknown_80DBF70: @ 80DBF70 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DBF88 +gUnknown_80DBF88: @ 80DBF88 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x06, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x02, 0x00 + .byte 0x18, 0x00, 0x11, 0x00 + .byte 0x11, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DBFA0 +gUnknown_80DBFA0: @ 80DBFA0 + .string "Field\0" + +@ options_menu #1 + .align 2,0 +.string "pksdir0\0" + .align 2,0 + + .global gUnknown_80DBFB0 +gUnknown_80DBFB0: @ 80DBFB0 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global UnkData_80DBFC8 + UnkData_80DBFC8: + .byte 0x01, 0x00, 0x07, 0x00 + + .global gUnknown_80DBFCC +gUnknown_80DBFCC: @ 80DBFCC + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x06, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x02, 0x00 + .byte 0x0A, 0x00, 0x06, 0x00 + .byte 0x06, 0x00, 0x00, 0x00 + + .4byte UnkData_80DBFC8 + + .global gOthers_MenuOption +gOthers_MenuOption: @ 80DBFE4 + .string "Others\0" + .align 2,0 + + .global gUnknown_80DBFEC +gUnknown_80DBFEC: @ 80DBFEC + .string "Change settings?\0" + .align 2,0 + + .global gOthers_GameOptions +gOthers_GameOptions: @ 80DC000 + .string "Game Options\0" + .align 2,0 + + .global gOthers_Hints +gOthers_Hints: @ 80DC010 + .string "Hints\0" + +@ options_menu #2 + .align 2,0 +.string "pksdir0\0" + .align 2,0 + + .global gUnknown_80DC020 +gUnknown_80DC020: @ 80DC020 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global UnkData_80DC038 + UnkData_80DC038: + .byte 0x01, 0x00, 0x0a, 0x00 + + .global gUnknown_80DC03C +gUnknown_80DC03C: @ 80DC03C + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x06, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x02, 0x00 + .byte 0x18, 0x00, 0x10, 0x00 + .byte 0x12, 0x00, 0x00, 0x00 + + .4byte UnkData_80DC038 + + .global gWindowBGTitle +gWindowBGTitle: @ 80DC054 + .string "Game Options\0" + .align 2,0 + + .global gUnknown_80DC064 +gUnknown_80DC064: @ 80DC064 + .string "Windows#=P.Blue#=x.Red#=" + .byte 0xA0 + .string ".Green\0" + .align 2,0 + + .global gWindowBGBlueString +gWindowBGBlueString: @ 80DC084 + .string "Blue\0" + .align 2,0 + + .global gWindowBGRedString +gWindowBGRedString: @ 80DC08C + .string "Red\0" + .align 2,0 + + .global gWindowBGGreenString +gWindowBGGreenString: @ 80DC090 + .string "Green\0" + +@ hints_menu #1 + .align 2,0 +.string "pksdir0\0" + .align 2,0 + + .global gUnknown_80DC0A0 +gUnknown_80DC0A0: @ 80DC0A0 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global Data_80DC0B8 + Data_80DC0B8: + .byte 0x01, 0x00, 0x08, 0x00 + + .global gUnknown_80DC0BC +gUnknown_80DC0BC: @ 80DC0BC + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x06, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x02, 0x00 + .byte 0x18, 0x00, 0x0E, 0x00 + .byte 0x0E, 0x00, 0x00, 0x00 + + .4byte Data_80DC0B8 + + .global gUnknown_80DC0D4 +gUnknown_80DC0D4: @ 80DC0D4 + .string "Hints\0" + +@ hints_menu #2 + .align 2,0 +.string "pksdir0\0" + .align 2,0 + + .global gUnknown_80DC0E4 +gUnknown_80DC0E4: @ 80DC0E4 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DC0FC +gUnknown_80DC0FC: @ 80DC0FC + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x06, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x02, 0x00 + .byte 0x1a, 0x00, 0x10, 0x00 + .byte 0x10, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 \ No newline at end of file diff --git a/data/data_80DC240.s b/data/data_80DC240.s new file mode 100644 index 000000000..c04f02f30 --- /dev/null +++ b/data/data_80DC240.s @@ -0,0 +1,103 @@ + .section .rodata + +@ code_801EE10 + .align 2,0 +.string "pksdir0\0" + .align 2,0 + + .global gUnknown_80DC240 +gUnknown_80DC240: @ 80DC240 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global Data_80DC258 + Data_80DC258: + .byte 0x01, 0x00, 0x0f, 0x00 + + .global gUnknown_80DC25C +gUnknown_80DC25C: @ 80DC25C + .byte 0x00, 0x00 + .byte 0x00, 0x00 + .byte 0x06, 0x00 + .byte 0x00, 0x00 + .byte 0x02, 0x00 + .byte 0x02, 0x00 + .byte 0x12, 0x00 + .byte 0x08, 0x00 + .byte 0x08, 0x00 + .byte 0x00, 0x00 + + .4byte Data_80DC258 + + .global gUnknown_80DC274 +gUnknown_80DC274: @ 80DC274 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x0f, 0x00 + .byte 0x1a, 0x00, 0x03, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DC28C +gUnknown_80DC28C: @ 80DC28C + .string "Moves: {COLOR_1 YELLOW}{ARG_POKEMON_0}{END_COLOR_TEXT_1} \0" + .align 2,0 + + .global gUnknown_80DC2A0 +gUnknown_80DC2A0: @ 80DC2A0 + .string "{ARG_MOVE_ITEM_0}\0" + +@ code_801EE10_mid #1 + .align 2,0 +.string "pksdir0\0" + .align 2,0 + + .global gUnknown_80DC2AC +gUnknown_80DC2AC: @ 80DC2AC + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DC2C4 +gUnknown_80DC2C4: @ 80DC2C4 + .byte 0x00, 0x00 + .byte 0x00, 0x00 + .byte 0x06, 0x00 + .byte 0x00, 0x00 + .byte 0x02, 0x00 + .byte 0x02, 0x00 + .byte 0x0f, 0x00 + .byte 0x04, 0x00 + .byte 0x06, 0x00 + .byte 0x00, 0x00 + .byte 0x00, 0x00 + .byte 0x00, 0x00 + + .global gUnknown_80DC2DC +gUnknown_80DC2DC: @ 80DC2DC + .string "Moves Page: %d/%d \0" + + .align 2,0 +@ code_801EE10_mid #2 +.string "pksdir0\0" + .align 2,0 + + .global gUnknown_80DC2F8 +gUnknown_80DC2F8: @ 80DC2F8 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DC310 +gUnknown_80DC310: @ 80DC310 + .string "{ARG_POKEMON_0}\0" \ No newline at end of file diff --git a/data/data_80DC464.s b/data/data_80DC464.s new file mode 100644 index 000000000..a9815c5aa --- /dev/null +++ b/data/data_80DC464.s @@ -0,0 +1,413 @@ + .section .rodata + +@ wigglytuff_shop1 + .align 2,0 +.string "pksdir0\0" + .align 2,0 + + .global gUnknown_80DC464 +gUnknown_80DC464: @ 80DC464 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DC47C +gUnknown_80DC47C: @ 80DC47C + .byte 0x00, 0x00 + .byte 0x00, 0x00 + .byte 0x06, 0x00 + .byte 0x00, 0x00 + .byte 0x02, 0x00 + .byte 0x02, 0x00 + .byte 0x11, 0x00 + .byte 0x11, 0x00 + .byte 0x11, 0x00 + .byte 0x00, 0x00 + .byte 0x00, 0x00 + .byte 0x00, 0x00 + + .global gUnknown_80DC494 +gUnknown_80DC494: @ 80DC494 + .string "Friend Areas\0" + .align 2,0 + + .global gUnknown_80DC4A4 +gUnknown_80DC4A4: @ 80DC4A4 + .string "{COLOR_1 RED}%s{END_COLOR_TEXT_1}\0" + .align 2,0 + + .global gUnknown_80DC4AC +gUnknown_80DC4AC: @ 80DC4AC + .string "{COLOR_1 GREEN}%s{END_COLOR_TEXT_1}\0" + .align 2,0 + +@ wigglytuff_shop2 +.string "pksdir0\0" + .align 2,0 + + .global gUnknown_80DC4BC +gUnknown_80DC4BC: @ 80DC4BC + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DC4D4 +gUnknown_80DC4D4: @ 80DC4D4 + .byte 0x01, 0x00, 0x12, 0x00 + + .global gUnknown_80DC4D8 +gUnknown_80DC4D8: @ 80DC4D8 + .byte 0x00, 0x00 + .byte 0x00, 0x00 + .byte 0x06, 0x00 + .byte 0x00, 0x00 + .byte 0x02, 0x00 + .byte 0x02, 0x00 + .byte 0x1a, 0x00 + .byte 0x11, 0x00 + .byte 0x11, 0x00 + .byte 0x00, 0x00 + + .4byte gUnknown_80DC4D4 + + .global gUnknown_80DC4F0 +gUnknown_80DC4F0: @ 80DC4F0 + .string "Inhabitants (Friends: {COLOR_2 CYAN}Light blue{END_COLOR_TEXT_2})\0" + .align 2,0 + + .global gUnknown_80DC518 +gUnknown_80DC518: @ 80DC518 + .string "Inhabitants\0" + .align 2,0 + + .global gUnknown_80DC524 +gUnknown_80DC524: @ 80DC524 + .string "{COLOR_2 CYAN}%s{END_COLOR_TEXT_2}\0" + .align 2,0 + +@ wigglytuff_shop3 +.string "pksdir0\0" + .align 2,0 + + .global gUnknown_80DC534 +gUnknown_80DC534: @ 80DC534 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DC54C +gUnknown_80DC54C: @ 80DC54C + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x15, 0x00, 0x04, 0x00 + .byte 0x06, 0x00, 0x03, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DC564 +gUnknown_80DC564: @ 80DC564 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x15, 0x00, 0x0e, 0x00 + .byte 0x06, 0x00, 0x03, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + +@ code_8023144 +.string "pksdir0\0" + .align 2,0 + + .global gUnknown_80DC584 +gUnknown_80DC584: @ 80DC584 + .4byte Yes_80DC5A0 + .byte 0x02, 0x00, 0x00, 0x00 + .4byte No_80DC59C + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x01, 0x00, 0x00, 0x00 + + .global No_80DC59C + No_80DC59C: + .string "No\0" + .align 2,0 + .global Yes_80DC5A0 + Yes_80DC5A0: + .string "Yes\0" + .align 2,0 + + .global gUnknown_80DC5A4 +gUnknown_80DC5A4: @ 80DC5A4 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DC5BC +gUnknown_80DC5BC: @ 80DC5BC + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x14, 0x00, 0x04, 0x00 + .byte 0x06, 0x00, 0x03, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DC5D4 +gUnknown_80DC5D4: @ 80DC5D4 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x14, 0x00, 0x0b, 0x00 + .byte 0x06, 0x00, 0x03, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DC5EC +gUnknown_80DC5EC: @ 80DC5EC + .byte 0x81, 0x48 + .byte 0x81, 0x48 + .byte 0x81, 0x48 + .byte 0x00, 0x00 + + .global gUnknown_80DC5F4 +gUnknown_80DC5F4: @ 80DC5F4 + .string "It doesn{APOSTROPHE}t appear to be hungry.\0" + .align 2,0 + + .global gUnknown_80DC618 +gUnknown_80DC618: @ 80DC618 + .string "{ARG_POKEMON_1} took the Gummi and ate it.\n" + .string "This Gummi looks like a big favorite!\n" + .string "{ARG_POKEMON_1}{APOSTROPHE}s IQ went up!\0" + .align 2,0 + + .global gUnknown_80DC674 +gUnknown_80DC674: @ 80DC674 + .string "{ARG_POKEMON_1} took the Gummi and ate it.\n" + .string "This Gummi looks like a favorite!\n" + .string "{ARG_POKEMON_1}{APOSTROPHE}s IQ went up!\0" + .align 2,0 + + .global gUnknown_80DC6CC +gUnknown_80DC6CC: @ 80DC6CC + .string "{ARG_POKEMON_1} took the Gummi and ate it.\n" + .string "It doesn{APOSTROPHE}t seem to dislike this Gummi.\n" + .string "{ARG_POKEMON_1}{APOSTROPHE}s IQ went up!\0" + .align 2,0 + + .global gUnknown_80DC728 +gUnknown_80DC728: @ 80DC728 + .string "{ARG_POKEMON_1} took the Gummi and ate it.\n" + .string "It appears to be just a little satisfied.\n" + .string "{ARG_POKEMON_1}{APOSTROPHE}s IQ went up!\0" + .align 2,0 + + .global gUnknown_80DC788 +gUnknown_80DC788: @ 80DC788 + .string "{ARG_POKEMON_1}{APOSTROPHE}s IQ helped it learn how to\n" + .string "use {ARG_MOVE_ITEM_1}!\0" + .align 2,0 + + .global gUnknown_80DC7B4 +gUnknown_80DC7B4: @ 80DC7B4 + .string "Yes! {ARG_POKEMON_1} grew explosively!\n" + .string "Attack{COMMA} Defense{COMMA} and so on rose by 1!\0" + .align 2,0 + + .global gUnknown_80DC7FC +gUnknown_80DC7FC: @ 80DC7FC + .string "Yes!\n" + .string "{ARG_POKEMON_1}{APOSTROPHE}s Attack rose by 1!\0" + .align 2,0 + + .global gUnknown_80DC81C +gUnknown_80DC81C: @ 80DC81C + .string "Yes!\n" + .string "{ARG_POKEMON_1}{APOSTROPHE}s Special Attack rose by 1!\0" + .align 2,0 + + .global gUnknown_80DC844 +gUnknown_80DC844: @ 80DC844 + .string "Yes!\n" + .string "{ARG_POKEMON_1}{APOSTROPHE}s Defense rose by 1!\0" + .align 2,0 + + + .global gUnknown_80DC864 +gUnknown_80DC864: @ 80DC864 + .string "Yes!\n" + .string "{ARG_POKEMON_1}{APOSTROPHE}s Special Defense rose by 1!\0" + .align 2,0 + + .global gUnknown_80DC88C +gUnknown_80DC88C: @ 80DC88C + .string "You don{APOSTROPHE}t have any Gummis.\0" + .align 2,0 + + .global gUnknown_80DC8AC +gUnknown_80DC8AC: @ 80DC8AC + .string "You don{APOSTROPHE}t have an item.\0" + .align 2,0 + + .global gUnknown_80DC8C8 +gUnknown_80DC8C8: @ 80DC8C8 + .string "The Gummi is gone!\0" + .align 2,0 + + .global gUnknown_80DC8DC +gUnknown_80DC8DC: @ 80DC8DC + .string "The item is gone!\0" + .align 2,0 + + .global gUnknown_80DC8F0 +gUnknown_80DC8F0: @ 80DC8F0 + .string "Give\0" + .align 2,0 + + .global gUnknown_80DC8F8 +gUnknown_80DC8F8: @ 80DC8F8 + .string "Use\0" + .align 2,0 + +@ code_8023144 #2 +.string "pksdir0\0" + .align 2,0 + + .global gUnknown_80DC904 +gUnknown_80DC904: @ 80DC904 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DC91C +gUnknown_80DC91C: @ 80DC91C + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x06, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x02, 0x00 + .byte 0x0f, 0x00, 0x0e, 0x00 + .byte 0x0e, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DC934 +gUnknown_80DC934: @ 80DC934 + .string "Pokémon\0" + .align 2,0 + + .global gUnknown_80DC93C +gUnknown_80DC93C: @ 80DC93C + .string "{COLOR_2}%c%s{END_COLOR_TEXT_2}\0" + .align 2,0 + +@ code_801EE10_1 +.string "pksdir0\0" + .align 2,0 + + .global gUnknown_80DC950 +gUnknown_80DC950: @ 80DC950 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DC968 +gUnknown_80DC968: @ 80DC968 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x06, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x02, 0x00 + .byte 0x0f, 0x00, 0x0e, 0x00 + .byte 0x0e, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DC980 +gUnknown_80DC980: @ 80DC980 + .string "Friends\0" + + .global gUnknown_80DC988 +gUnknown_80DC988: @ 80DC988 + .string "Pokémon Friends\0" + + .global gUnknown_80DC998 +gUnknown_80DC998: @ 80DC998 + .string "{COLOR_2}%c%s{END_COLOR_TEXT_2}\0" + .align 2,0 + + .global gUnknown_80DC9A4 +gUnknown_80DC9A4: @ 80DC9A4 + .string "%s\0" + .align 2,0 + +@ code_801EE10_1 #2 +.string "pksdir0\0" + .align 2,0 + + .global gUnknown_80DC9B0 +gUnknown_80DC9B0: @ 80DC9B0 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DC9C8 +gUnknown_80DC9C8: @ 80DC9C8 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x06, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x02, 0x00 + .byte 0x12, 0x00, 0x0e, 0x00 + .byte 0x12, 0x00, 0x02, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + +@ luminous_cave +.string "pksdir0\0" + .align 2,0 + + .global gUnknown_80DC9E8 +gUnknown_80DC9E8: @ 80DC9E8 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DCA00 +gUnknown_80DCA00: @ 80DCA00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x14, 0x00, 0x04, 0x00 + .byte 0x06, 0x00, 0x03, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80DCA18 +gUnknown_80DCA18: @ 80DCA18 + .string "Evolve\0" + .align 2,0 + .4byte gUnknown_80DCA18 + + .global gUnknown_80DCA24 +gUnknown_80DCA24: @ 80DCA24 + .string "No\0" + .align 2,0 + .4byte gUnknown_80DCA24 + + .global gUnknown_80DCA2C +gUnknown_80DCA2C: @ 80DCA2C + .string "Yes\0" + .align 2,0 + .4byte gUnknown_80DCA2C \ No newline at end of file diff --git a/data/data_80F4278.s b/data/data_80F4278.s index 926f0122f..c43d09a2e 100644 --- a/data/data_80F4278.s +++ b/data/data_80F4278.s @@ -1,30 +1,13 @@ .section .rodata - .global gUnknown_80F42D0 -gUnknown_80F42D0: @ 80F42D0 - @ replacing .incbin "baserom.gba", 0x000f42d0, 0x20 - .byte 0x3f, 0x36, 0x37, 0x4e, 0x50, 0x52, 0x38, 0x39, 0x46, 0x30, 0x2b, 0x85, 0x53, 0x54, 0x58, 0x59, 0x34, 0x35, 0x4d, 0x43, 0x48, 0x4a, 0x2d, 0x4b, 0x31, 0x32, 0x21, 0xbe, 0x33, 0x51, 0xbd, 0x57 - - .global gUnknown_80F42F0 -gUnknown_80F42F0: @ 80F42F0 - @ replacing .incbin "baserom.gba", 0x000f42f0, 0x100 - .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff - .byte 0xff, 0x1a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0a, 0xff, 0x16, 0xff, 0xff, 0x09, 0x18, 0x19, 0x1c, 0x10, 0x11, 0x01, 0x02, 0x06, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00 - .byte 0xff, 0xff, 0xff, 0x13, 0xff, 0xff, 0x08, 0xff, 0x14, 0xff, 0x15, 0x17, 0xff, 0x12, 0x03, 0xff, 0x04, 0x1d, 0x05, 0x0c, 0x0d, 0xff, 0xff, 0x1f, 0x0e, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff - .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff - .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0x0b, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff - .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1e, 0x1b, 0xff - .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff - .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff - + .align 2,0 +@ code_803D110.s (probably part of code_803D0D8) .global gUnknown_80F43F0 gUnknown_80F43F0: @ 80F43F0 -@ replacing .incbin "baserom.gba", 0x000f43f0, 0x36 .byte 0x0d, 0x07, 0x19, 0x0f, 0x04, 0x1d, 0x2a, 0x31, 0x08, 0x13, 0x2d, 0x18, 0x0e, 0x1a, 0x1b, 0x29, 0x01, 0x20, 0x21, 0x22, 0x11, 0x33, 0x26, 0x00, 0x35, 0x0a, 0x2b, 0x1f, 0x12, 0x23, 0x2c, 0x17 .byte 0x27, 0x10, 0x1c, 0x30, 0x0b, 0x02, 0x24, 0x09, 0x32, 0x05, 0x28, 0x34, 0x2e, 0x03, 0x1e, 0x0c, 0x25, 0x14, 0x2f, 0x16, 0x06, 0x15 .global gUnknown_80F4426 gUnknown_80F4426: @ 80F4426 - @ replacing .incbin "baserom.gba", 0x000f4426, 0x22 .byte 0x0c, 0x06, 0x13, 0x08, 0x04, 0x0d, 0x0f, 0x09, 0x10, 0x02, 0x14, 0x12, 0x00, 0x15, 0x0b, 0x05, 0x17, 0x03, 0x11, 0x0a, 0x01, 0x0e, 0x16, 0x07, 0x00, 0x00 .byte 0x70, 0x6b, 0x73, 0x64, 0x69, 0x72, 0x30, 0x00 diff --git a/data/data_8107010.s b/data/data_8107010.s index 0cd739de9..47678d6a8 100644 --- a/data/data_8107010.s +++ b/data/data_8107010.s @@ -1,55 +1,88 @@ .section .rodata .string "pksdir0\0" + .string "pksdir0\0" +@ START code_80718D8 + .global gUnknown_8107010 gUnknown_8107010: @ 8107010 .byte 0, 1, 1, 2, 1, 1, 0, 0 .global gUnknown_8107018 gUnknown_8107018: @ 8107018 -@ replacing .incbin "baserom.gba", 0x107018, 0x160 .4byte gUnknown_810702C .4byte gUnknown_8107028 .4byte gUnknown_8107024 + .global gUnknown_8107024 gUnknown_8107024: .byte 0x0a, 0x00, 0x00, 0x00 + .global gUnknown_8107028 gUnknown_8107028: .byte 0x23, 0x57, 0x0a, 0x00 + .global gUnknown_810702C gUnknown_810702C: .byte 0x00, 0x00, 0x00, 0x00 .string "pksdir0\0" + +@ END code_80718D8 + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + +@ START code_807CD9C + .global gUnknown_81070E8 gUnknown_81070E8: .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0x00 .byte 0x01, 0x00, 0xff, 0xff, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00 .byte 0xff, 0xff, 0x01, 0x00, 0x63, 0x00, 0x63, 0x00 + .global gUnknown_8107110 gUnknown_8107110: .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00 @@ -62,36 +95,52 @@ gUnknown_8107110: .global gUnknown_8107178 gUnknown_8107178: @ 8107178 -@ replacing .incbin "baserom.gba", 0x107178, 0x5C .4byte gUnknown_81070E8 .4byte gUnknown_81070E8 .4byte gUnknown_8107110 .string "pksdir0\0" + +@ END code_807CD9C + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" .global gUnknown_81071D4 gUnknown_81071D4: @ 81071D4 -@ replacing .incbin "baserom.gba", 0x1071D4, 0xC .byte 0x82, 0xe2, 0x82, 0xe6, 0x82, 0xa2, 0x97, 0x6c, 0x00, 0x00, 0x00, 0x00 .global gUnknown_81071E0 gUnknown_81071E0: @ 81071E0 -@ replacing .incbin "baserom.gba", 0x1071E0, 0x44 .byte 0x82, 0xdd, 0x82, 0xb3, 0x82, 0xab, 0x97, 0x6c, 0x00, 0x00, 0x00, 0x00 .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + .string "pksdir0\0" + +@ START code_808417C #1 + .byte 0x70, 0x6b, 0x73, 0x64 .byte 0x69, 0x72, 0x30, 0x00 @@ -101,9 +150,10 @@ gUnknown_8107224: @ 8107224 .byte 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x3f, 0x00, 0x00 .string "pksdir0\0" +@ END code_808417C #1 + .global gUnknown_8107234 gUnknown_8107234: @ 8107234 -@ replacing .incbin "baserom.gba", 0x107234, 0xE0 .byte 0x01, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00, 0x00, 0x02, 0x04, 0x02, 0x05, 0x03, 0x06, 0x00, 0x00 .byte 0x03, 0x07, 0x04, 0x08, 0x05, 0x09, 0x00, 0x00, 0x04, 0x0a, 0x06, 0x0b, 0x07, 0x0c, 0x00, 0x00 .byte 0x05, 0x0d, 0x08, 0x0e, 0x09, 0x0f, 0x00, 0x00, 0x06, 0x10, 0x0a, 0x11, 0x0a, 0x11, 0x00, 0x00 @@ -121,7 +171,6 @@ gUnknown_8107234: @ 8107234 .global gUnknown_8107314 gUnknown_8107314: @ 8107314 -@ replacing .incbin "baserom.gba", 0x107314, 0x44 .byte 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff .byte 0x02, 0x00, 0x00, 0x00, 0xfd, 0xff, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff .byte 0x04, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x04, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0xff @@ -130,20 +179,18 @@ gUnknown_8107314: @ 8107314 .global gUnknown_8107358 gUnknown_8107358: @ 8107358 -@ replacing .incbin "baserom.gba", 0x107358, 0x1C .byte 0x04, 0x03, 0x02, 0x03, 0x04, 0x05, 0x06, 0x05, 0x04, 0x03, 0x02, 0x03, 0x04, 0x05, 0x06, 0x05 .byte 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x05, 0x06, 0x00, 0x00, 0x00, 0x00 .global gUnknown_8107374 gUnknown_8107374: @ 8107374 -@ replacing .incbin "baserom.gba", 0x107374, 0xC .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 .global gUnknown_8107380 gUnknown_8107380: @ 8107380 -@ replacing .incbin "baserom.gba", 0x107380, 0x1C .byte 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 .string "pksdir0\0" + .string "pksdir0\0" .global gUnknown_810739C @@ -1327,20 +1374,17 @@ gUnknown_81097C4: @ 81097C4 .global gUnknown_81097C5 gUnknown_81097C5: @ 81097C5 - @ replacing .incbin "baserom.gba", 0x001097c5, 0x1b .byte 0x9f, 0x83, 0xa0, 0x83, 0xa1, 0x83, 0xa2, 0x83, 0xa3, 0x83, 0xa4, 0x83, 0xa5, 0x83, 0xa6, 0x83, 0xa7, 0x83, 0xa8, 0x00, 0x00, 0x00, 0x00, 0xc4, 0x97, 0x10, 0x08 .global gGummiStatBoostLUT gGummiStatBoostLUT: @ 81097E0 - @ replacing .incbin "baserom.gba", 0x001097e0, 0x8 - .2byte 0x0001 - .2byte 0x0002 - .2byte 0x0004 - .2byte 0x0008 + .2byte 1 + .2byte 2 + .2byte 4 + .2byte 8 .global gUnknown_81097E8 gUnknown_81097E8: @ 81097E8 - @ replacing .incbin "baserom.gba", 0x001097e8, 0x10 .byte 0x10, 0x00, 0x00, 0x00 .byte 0x12, 0x00, 0x00, 0x00 .byte 0x14, 0x00, 0x00, 0x00 @@ -1348,14 +1392,13 @@ gUnknown_81097E8: @ 81097E8 .global gUnknown_81097F8 gUnknown_81097F8: @ 81097F8 - @ replacing .incbin "baserom.gba", 0x001097f8, 0x18 .byte 0x11, 0x00, 0x00, 0x00 .byte 0x13, 0x00, 0x00, 0x00 .byte 0x15, 0x00, 0x00, 0x00 .byte 0x17, 0x00, 0x00, 0x00 - .string "pksdir0\0" - +.string "pksdir0\0" +@ START rescue_team_info.c .global gRescueRankMaxPoints gRescueRankMaxPoints: @ 8109810 .4byte 50 @@ -1369,11 +1412,11 @@ gRescueRankMaxPoints: @ 8109810 .global gTeamNamePlaceholder gTeamNamePlaceholder: @ 810982C .string "Pokémon\0" - .string "pksdir0\0" +.string "pksdir0\0" +@ END rescue_team_info.c .global gUnknown_810983C gUnknown_810983C: @ 810983C -@ replacing .incbin "baserom.gba", 0x10983C, 0x68 .4byte gUnknown_8109888 .4byte gUnknown_8109884 .4byte gUnknown_8109880 @@ -1415,25 +1458,27 @@ gUnknown_8109884: gUnknown_8109888: .byte 0x82, 0x4f, 0x00, 0x00 .string "pksdir0\0" -.string "pksdir0\0" + .string "pksdir0\0" - .global gUnknown_81098A4 -gUnknown_81098A4: @ 81098A4 - .string "{COLOR_2}" - .byte 0x4 - .string "%s{END_COLOR_TEXT_2}\0" +.string "pksdir0\0" + +@ START friend_area.c + + .global sUnknown_81098A4 +sUnknown_81098A4: @ 81098A4 + .string "{COLOR_2 UNK_COLOR_4}%s{END_COLOR_TEXT_2}\0" .align 2,0 - .global gUnknown_81098AC -gUnknown_81098AC: @ 81098AC - .string "%s#=%c{COLOR_1}" - .byte 0x4 - .string "%s{END_COLOR_TEXT_1}\0" - .align 2,0 - .string "pksdir0" + .global sUnknown_81098AC +sUnknown_81098AC: @ 81098AC + .string "%s#=%c{COLOR_1 UNK_COLOR_4}%s{END_COLOR_TEXT_1}\0" .align 2,0 +.string "pksdir0" +@ END friend_area.c + + .align 2,0 .global gUnknown_81098C4 gUnknown_81098C4: @ 81098C4 .byte 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 diff --git a/data/data_810AE24.s b/data/data_810AE24.s index 82ea536f9..6a13016e6 100644 --- a/data/data_810AE24.s +++ b/data/data_810AE24.s @@ -5239,8 +5239,8 @@ gUnknown_81139B8: @ 81139B8 gUnknown_81139CC: @ 81139CC .4byte Item_81139BC - .global gFriendAreaNames -gFriendAreaNames: @ 81139D0 + .global sFriendAreaNames +sFriendAreaNames: @ 81139D0 .4byte gNoneText .4byte gUnknown_8113E20 .4byte gUnknown_8113E10 @@ -5533,8 +5533,8 @@ gUnknown_8113E20: .string "Bountiful Sea\0" .align 2,0 - .global gFriendAreaDescriptions -gFriendAreaDescriptions: @ 8113E30 + .global sFriendAreaDescriptions +sFriendAreaDescriptions: @ 8113E30 @ replacing .incbin "baserom.gba", 0x113E30, 0x18E8 .4byte gNoneText .4byte gUnknown_81156A8 diff --git a/data/data_code_2.s b/data/data_code_2.s new file mode 100644 index 000000000..2ee1800b3 --- /dev/null +++ b/data/data_code_2.s @@ -0,0 +1,144 @@ + .section .rodata + + .string "pksdir0\0" + + .global gUnknown_80B690C +gUnknown_80B690C: @ 80B690C + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x19, 0x00, 0x00, 0x00 + .byte 0x01, 0x00, 0x00, 0x00 + .byte 0x34, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x00, 0x00 + .byte 0x85, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x45, 0x01, 0x00, 0x00 + .byte 0x04, 0x00, 0x00, 0x00 + .byte 0x07, 0x00, 0x00, 0x00 + .byte 0x05, 0x00, 0x00, 0x00 + .byte 0x9e, 0x00, 0x00, 0x00 + .byte 0x06, 0x00, 0x00, 0x00 + .byte 0x1b, 0x01, 0x00, 0x00 + .byte 0x07, 0x00, 0x00, 0x00 + .byte 0x36, 0x00, 0x00, 0x00 + .byte 0x08, 0x00, 0x00, 0x00 + .byte 0x04, 0x00, 0x00, 0x00 + .byte 0x09, 0x00, 0x00, 0x00 + .byte 0x18, 0x01, 0x00, 0x00 + .byte 0x0a, 0x00, 0x00, 0x00 + .byte 0x9b, 0x00, 0x00, 0x00 + .byte 0x0b, 0x00, 0x00, 0x00 + .byte 0x68, 0x00, 0x00, 0x00 + .byte 0x0c, 0x00, 0x00, 0x00 + .byte 0x42, 0x00, 0x00, 0x00 + .byte 0x0d, 0x00, 0x00, 0x00 + .byte 0x01, 0x00, 0x00, 0x00 + .byte 0x0e, 0x00, 0x00, 0x00 + .byte 0x98, 0x00, 0x00, 0x00 + .byte 0x0f, 0x00, 0x00, 0x00 + .byte 0x15, 0x01, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gUnknown_80B6994 +gUnknown_80B6994: @ 80B6994 + .byte 0x01, 0x00, 0x00, 0x00 + .byte 0x07, 0x00, 0x00, 0x00 + .byte 0x01, 0x00, 0x00, 0x00 + .byte 0x9e, 0x00, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x18, 0x01, 0x00, 0x00 + .byte 0x03, 0x00, 0x00, 0x00 + .byte 0x98, 0x00, 0x00, 0x00 + .byte 0x02, 0x00, 0x00, 0x00 + .byte 0x00, 0x00, 0x00, 0x00 + + .global gPMDBuildVersion +gPMDBuildVersion: @ 80B69BC + .string "PKDi ver 1.0 [Apr 28 2006] 16:37:54\0" + .align 2,0 + + .global titlen0_text + titlen0_text: + .string "titlen0\0" + .align 2,0 + + .global titlen1_text + titlen1_text: + .string "titlen1\0" + .align 2,0 + + .global titlen2_text + titlen2_text: + .string "titlen2\0" + .align 2,0 + + .global gLoadScreenBackgroundFileNames +gLoadScreenBackgroundFileNames: @ 80B69F8 + .4byte titlen0_text + .4byte titlen1_text + .4byte titlen2_text + + .global titlen0p_text + titlen0p_text: + .string "titlen0p\0" + .align 2,0 + + .global titlen1p_text + titlen1p_text: + .string "titlen1p\0" + .align 2,0 + + .global titlen2p_text + titlen2p_text: + .string "titlen2p\0" + .align 2,0 + + .global gLoadScreenBackgroundPaletteFileNames +gLoadScreenBackgroundPaletteFileNames: @ 80B6A28 + .4byte titlen0p_text + .4byte titlen1p_text + .4byte titlen2p_text + +gSaveTextQuicksaving:: @ 80B6A34 + .string "{CENTER_ALIGN}Quicksaving your adventure...\n" + .string "{CENTER_ALIGN}Please don{APOSTROPHE}t turn off the power.\0" + .align 2, 0 + +gSaveTextYourAdventureHasBeenSaved:: @ 80B6A7C + .string "{CENTER_ALIGN}Your adventure has been saved.\0" + .align 2, 0 + +gSaveTextYourAdventureHasBeenSavedLong:: @ 80B6AA0 + .string "{CENTER_ALIGN}Your adventure has been saved.\n" + .string "{CENTER_ALIGN}When you are in a dungeon{COMMA} quicksave\n" + .string "{CENTER_ALIGN}your progress before ending the game.\0" + .align 2, 0 + +gSaveTextTheDataCouldNotBeWritten:: @ 80B6B14 + .string "{CENTER_ALIGN}The data could not be written.\n" + .string "{CENTER_ALIGN}Please turn off the power and remove\n" + .string "{CENTER_ALIGN}and reinsert the DS Card.\0" + .align 2, 0 + +gSaveTextFailed:: @ 80B6B78 + .string "{CENTER_ALIGN}Save failed.\0" + .align 2, 0 + +gSaveTextError:: @ 80B6B88 + .string "{CENTER_ALIGN}Error reading data.\n" + .string "{CENTER_ALIGN}Please turn off the power and reinsert\n" + .string "{CENTER_ALIGN}the DS Game Card.\0" + .align 2, 0 + +gSaveTextCantResume:: @ 80B6BDC + .string "{CENTER_ALIGN}Your data was not properly saved{COMMA}\n" + .string "{CENTER_ALIGN}so your game cannot be resumed\n" + .string "{CENTER_ALIGN}from your last spot.{EXTRA_MSG}{CENTER_ALIGN}Your last outing is considered a defeat.\n" + .string "{CENTER_ALIGN}Before shutting down{COMMA} save in your\n" + .string "{CENTER_ALIGN}team base{COMMA} or quicksave in a dungeon.\0" + .align 2, 0 + +gSaveTextMayNotResume:: @ 80B6CB8 + .string "{CENTER_ALIGN}You may not resume your dungeon\n" + .string "{CENTER_ALIGN}adventure using this saved data.\n" + .string "{CENTER_ALIGN}Your last outing is considered a defeat.\0" \ No newline at end of file diff --git a/data/text/save.inc b/data/text/save.inc deleted file mode 100644 index c0c17aad6..000000000 --- a/data/text/save.inc +++ /dev/null @@ -1,70 +0,0 @@ -gSaveTextQuicksaving:: @ 80B6A34 - .string "{CENTER_ALIGN}Quicksaving your adventure...\n" - .string "{CENTER_ALIGN}Please don{APOSTROPHE}t turn off the power.\0" - .align 2, 0 - -gSaveTextYourAdventureHasBeenSaved:: @ 80B6A7C - .string "{CENTER_ALIGN}Your adventure has been saved.\0" - .align 2, 0 - -gSaveTextYourAdventureHasBeenSavedLong:: @ 80B6AA0 - .string "{CENTER_ALIGN}Your adventure has been saved.\n" - .string "{CENTER_ALIGN}When you are in a dungeon{COMMA} quicksave\n" - .string "{CENTER_ALIGN}your progress before ending the game.\0" - .align 2, 0 - -gSaveTextTheDataCouldNotBeWritten:: @ 80B6B14 - .string "{CENTER_ALIGN}The data could not be written.\n" - .string "{CENTER_ALIGN}Please turn off the power and remove\n" - .string "{CENTER_ALIGN}and reinsert the DS Card.\0" - .align 2, 0 - -gSaveTextFailed:: @ 80B6B78 - .string "{CENTER_ALIGN}Save failed.\0" - .align 2, 0 - -gSaveTextError:: @ 80B6B88 - .string "{CENTER_ALIGN}Error reading data.\n" - .string "{CENTER_ALIGN}Please turn off the power and reinsert\n" - .string "{CENTER_ALIGN}the DS Game Card.\0" - .align 2, 0 - -gSaveTextCantResume:: @ 80B6BDC - .string "{CENTER_ALIGN}Your data was not properly saved{COMMA}\n" - .string "{CENTER_ALIGN}so your game cannot be resumed\n" - .string "{CENTER_ALIGN}from your last spot.{EXTRA_MSG}{CENTER_ALIGN}Your last outing is considered a defeat.\n" - .string "{CENTER_ALIGN}Before shutting down{COMMA} save in your\n" - .string "{CENTER_ALIGN}team base{COMMA} or quicksave in a dungeon.\0" - .align 2, 0 - -gSaveTextMayNotResume:: @ 80B6CB8 - .string "{CENTER_ALIGN}You may not resume your dungeon\n" - .string "{CENTER_ALIGN}adventure using this saved data.\n" - .string "{CENTER_ALIGN}Your last outing is considered a defeat.\0" - .align 2, 0 - - .string "pksdir0\0" - .align 2, 0 - - .global gUnknown_80B6D30 -gUnknown_80B6D30: - .2byte 5, 7, 0, 0, 1, 0; .4byte gUnknown_80B6D88 - .2byte 5, 7, 2, 0, 1, 0; .4byte gUnknown_80B6D80 - .2byte 5, 7, 4, 0, 1, 0; .4byte gUnknown_80B6D78 - .2byte 5, 7, 6, 0, 1, 0; .4byte gUnknown_80B6D70 - -gUnknown_80B6D70: - .string "LOCAL3\0" - .align 2, 0 - -gUnknown_80B6D78: - .string "LOCAL2\0" - .align 2, 0 - -gUnknown_80B6D80: - .string "LOCAL1\0" - .align 2, 0 - -gUnknown_80B6D88: - .string "LOCAL0\0" - .align 2, 0 diff --git a/include/adventure_log.h b/include/adventure_log.h index bdf31965e..adc46347b 100644 --- a/include/adventure_log.h +++ b/include/adventure_log.h @@ -1,8 +1,21 @@ #ifndef GUARD_ADVENTURE_LOG_H #define GUARD_ADVENTURE_LOG_H -void CreateAdventureLogMenu(void); -void CleanAdventureLogMenu(void); -u32 UpdateAdventureLogMenu(void); +#include "input.h" +#include "text.h" -#endif +// size: 0xA0 +typedef struct AdventureLog +{ + MenuInputStruct input; + u32 unk34; + UnkTextStruct2 *unk38; + UnkTextStruct2 unk3C[4]; + u8 unk9C[4]; +} AdventureLog; + +void CleanAdventureLogScreen(void); +bool8 CreateAdventureLogScreen(u32 kind); +u32 HandleAdventureLogInput(u8); + +#endif // GUARD_ADVENTURE_LOG_H \ No newline at end of file diff --git a/include/adventure_log_menu.h b/include/adventure_log_menu.h new file mode 100644 index 000000000..2fe5afab6 --- /dev/null +++ b/include/adventure_log_menu.h @@ -0,0 +1,8 @@ +#ifndef GUARD_ADVENTURE_LOG_MENU_H +#define GUARD_ADVENTURE_LOG_MENU_H + +void CreateAdventureLogMenu(void); +void CleanAdventureLogMenu(void); +u32 UpdateAdventureLogMenu(void); + +#endif // GUARD_ADVENTURE_LOG_MENU_H \ No newline at end of file diff --git a/include/axdata.h b/include/axdata.h index 34fedd240..f7b0309f8 100644 --- a/include/axdata.h +++ b/include/axdata.h @@ -4,14 +4,14 @@ #include "file_system.h" // size: 0x8 -struct UnkSpriteMem +typedef struct UnkSpriteMem { /* 0x0 */ void *src; /* 0x4 */ s32 byteCount; -}; +} UnkSpriteMem; // size: 0x20 -struct axdata1 +typedef struct axdata1 { /* 0x0 */ s16 xPos; /* 0x2 */ s16 yPos; @@ -27,20 +27,20 @@ struct axdata1 /* 0x1A */ s16 lastPoseId; u8 fill1C[0x1E - 0x1C]; u8 paletteNum; -}; +} axdata1; // size: 0xA -struct __attribute__ ((packed, aligned(2))) ax_pose +typedef struct __attribute__((packed, aligned(2))) ax_pose { /* 0x0 */ s16 sprite; u16 unk2; // Always 0 in red (except for end markers which are 0xFFFF) /* 0x4 */ u16 flags1; /* 0x6 */ u16 flags2; /* 0x8 */ u16 flags3; -}; +} ax_pose; // size: 0xC -struct ax_anim +typedef struct ax_anim { /* 0x0 */ u8 frames; /* 0x1 */ u8 unkFlags; @@ -49,38 +49,38 @@ struct ax_anim /* 0x6 */ s16 yOffset; /* 0x8 */ s16 xShadow; /* 0xA */ s16 yShadow; -}; +} ax_anim; // size: 0x3C -struct axdata +typedef struct axdata { /* 0x0 */ u16 flags; // 0x8000 - animating, 0x2000 finished? 0x1000 continue /* 0x2 */ s16 animFrames; // frames left in the current animation frame /* 0x4 */ s16 animWaitFrames; // frames to not update the animation for /* 0x6 */ s16 totalFrames; // max 30000 - /* 0x8 */ struct axdata1 sub1; - /* 0x28 */ struct ax_anim *nextAnimData; // next animation data (if flags&0x1000) - /* 0x2C */ struct ax_anim *activeAnimData; // current animation data + /* 0x8 */ axdata1 sub1; + /* 0x28 */ ax_anim *nextAnimData; // next animation data (if flags&0x1000) + /* 0x2C */ ax_anim *activeAnimData; // current animation data /* 0x30 */ void *paletteData; // ? - /* 0x34 */ struct ax_pose **poseData; - /* 0x38 */ struct UnkSpriteMem **spriteData; -}; + /* 0x34 */ ax_pose **poseData; + /* 0x38 */ UnkSpriteMem **spriteData; +} axdata; // size: 0x14 -struct axmain +typedef struct axmain { - /* 0x0 */ struct ax_pose **poses; - /* 0x4 */ struct ax_anim ****animations; + /* 0x0 */ ax_pose **poses; + /* 0x4 */ ax_anim ****animations; /* 0x8 */ u32 animCount; /* 0xC */ void *spriteData; // ? /* 0x10 */ void *palettes; // ? -}; +} axmain; // size: ? struct axPokemon { - /* 0x0 */ struct axdata axdata; - /* 0x3C */ struct OpenedFile *spriteFile; + /* 0x0 */ axdata axdata; + /* 0x3C */ OpenedFile *spriteFile; u16 unk40_maybeAnimTimer; u8 unk42_animId1; u8 unk43_animId2; @@ -90,7 +90,7 @@ struct axPokemon u8 unk47; u8 unk48; u8 fill49[0x4C - 0x49]; - /* 0x4C */ struct axmain *axmain; + /* 0x4C */ axmain *axmain; u8 flags_0x50; u8 fill51; s16 unk52; diff --git a/include/bg_control.h b/include/bg_control.h index 122d5e4b1..ec7c08be3 100644 --- a/include/bg_control.h +++ b/include/bg_control.h @@ -10,18 +10,18 @@ enum NUM_BGS }; -struct BGControlStruct +typedef struct BGControlStruct { u16 padding; u16 unk2; s16 hofs; s16 vofs; -}; +} BGControlStruct; -extern struct BGControlStruct gBG0Control; -extern struct BGControlStruct gBG1Control; -extern struct BGControlStruct gBG2Control; -extern struct BGControlStruct gBG3Control; +extern BGControlStruct gBG0Control; +extern BGControlStruct gBG1Control; +extern BGControlStruct gBG2Control; +extern BGControlStruct gBG3Control; extern u16 gBldAlpha; extern u16 gBldCnt; extern bool8 gUnknown_202D7FE; diff --git a/include/bg_palette_buffer.h b/include/bg_palette_buffer.h index b4b67d46a..2173fdcab 100644 --- a/include/bg_palette_buffer.h +++ b/include/bg_palette_buffer.h @@ -2,7 +2,8 @@ #define GUARD_BG_PALETTE_BUFFER_H void InitBGPaletteBuffer(void); -void nullsub_4(s32 index, u8 *RGBArray, s32 a1, u8 *a2); -void SetBGPaletteBufferColorRGB(s32 index, u8 *RGBArray, s32 a1, u8 *a2); +void nullsub_4(s32 index, u8 *colorArray, s32, u8 *); +void SetBGPaletteBufferColorArray(s32 index, u8 *colorArray); +void SetBGPaletteBufferColorRGB(s32 index, u8 *colorArray, s32, u8 *); #endif // GUARD_BG_PALETTE_BUFFER_H \ No newline at end of file diff --git a/include/charge_move.h b/include/charge_move.h index 317e67876..6f745c7b4 100644 --- a/include/charge_move.h +++ b/include/charge_move.h @@ -3,8 +3,8 @@ #include "dungeon_entity.h" -bool8 MoveMatchesChargingStatus(struct Entity *pokemon, struct Move *move); +bool8 MoveMatchesChargingStatus(Entity *pokemon, Move *move); // checkCharge = Check for the move named Charge. -bool8 IsCharging(struct Entity *pokemon, bool8 checkCharge); +bool8 IsCharging(Entity *pokemon, bool8 checkCharge); #endif diff --git a/include/code_8004AA0.h b/include/code_8004AA0.h index 2c2b496e3..faba2f827 100644 --- a/include/code_8004AA0.h +++ b/include/code_8004AA0.h @@ -4,38 +4,38 @@ #include "file_system.h" // size: 0x4 -struct RGB +typedef struct RGB { // IDK which is R G B u8 unk0; u8 unk1; u8 unk2; -}; +} RGB; // size: 0x18 -struct unkStruct_202EE8C +typedef struct unkStruct_202EE8C { u32 unk0; u16 unk4; s16 unk6; - struct RGB *unk8; - struct RGB *unkC; - struct RGB *unk10; - struct RGB unk14; -}; + RGB *unk8; + RGB *unkC; + RGB *unk10; + RGB unk14; +} unkStruct_202EE8C; // size: Variable -struct unkDataFor8004AA4 +typedef struct unkDataFor8004AA4 { /* 0x0 */ s16 colorCount; s16 unk2; - /* 0x4 */ struct RGB colors[0]; -}; + /* 0x4 */ RGB colors[0]; +} unkDataFor8004AA4; void nullsub_6(void); -void sub_8004AA4(struct unkStruct_202EE8C *, struct OpenedFile *, s32); -bool8 sub_8004AF0(bool8, struct unkStruct_202EE8C *, s32, s32, s32, u8 *); -bool8 sub_8004D14(struct unkStruct_202EE8C *, s32); -bool8 sub_8004D40(struct unkStruct_202EE8C *, s32); +void sub_8004AA4(unkStruct_202EE8C *, OpenedFile *, s32); +bool8 sub_8004AF0(bool8, unkStruct_202EE8C *, s32, s32, s32, u8 *); +bool8 sub_8004D14(unkStruct_202EE8C *, s32); +bool8 sub_8004D40(unkStruct_202EE8C *, s32); #endif // GUARD_CODE_8004AA0_H \ No newline at end of file diff --git a/include/code_800558C.h b/include/code_800558C.h index 19ca43e4d..e10e7a450 100644 --- a/include/code_800558C.h +++ b/include/code_800558C.h @@ -20,9 +20,10 @@ void nullsub_10(bool8); void nullsub_12(void); void nullsub_13(void); void nullsub_14(void); -void sub_8005610(struct OpenedFile *, s32, s32, u8 *); -void sub_8005770(s32, u8 *, s32, u8 *); +void sub_8005610(OpenedFile *, s32, s32, u8 *); +void sub_8005770(s32, u8 *colorArray, s32, u8 *); void sub_80057E8(void); +void sub_8005838(s32 *, u8 kind); void sub_80060EC(void); #endif // GUARD_CODE_800558C_H \ No newline at end of file diff --git a/include/code_8009804.h b/include/code_8009804.h new file mode 100644 index 000000000..c149b64fb --- /dev/null +++ b/include/code_8009804.h @@ -0,0 +1,28 @@ +#ifndef GUARD_CODE_8009804_H +#define GUARD_CODE_8009804_H + +// size: 0xC +struct unkStruct_202D240 +{ + u32 *unk0; + u32 *unk4; + u32 size; +}; + +// size: 0x40 +struct unkStruct_202D038 +{ + u32 unk0[0x10]; +}; + +void vram_related_8009804(void); + +void sub_80097B0(void); +void sub_80098A0(void); +void sub_80098BC(u32 *, u32 *, u32); +void sub_80098F8(u32); +void sub_8009908(void); +void sub_80099C0(void); +void sub_80099F0(u32); + +#endif // GUARD_CODE_8009804_H \ No newline at end of file diff --git a/include/code_800C9CC.h b/include/code_800C9CC.h new file mode 100644 index 000000000..db62d4d8d --- /dev/null +++ b/include/code_800C9CC.h @@ -0,0 +1,9 @@ +#ifndef GUARD_CODE_800D090_H +#define GUARD_CODE_800D090_H + +#include "input.h" + +void ReadKeyInput(Inputs *); +void sub_800CB20(void); + +#endif // GUARD_CODE_800D090_H \ No newline at end of file diff --git a/include/code_80130A8.h b/include/code_80130A8.h index 26c0a2cfe..c87d41430 100644 --- a/include/code_80130A8.h +++ b/include/code_80130A8.h @@ -3,13 +3,18 @@ #include "file_system.h" #include "menu.h" +#include "text.h" // code_80130A8.s extern void sub_8013AA0(u32 *); extern u32 sub_8013BBC(u32 *); extern void sub_8013C68(u32 *); -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_8013F84(void); +extern void sub_80140B4(UnkTextStruct2 *); +extern void sub_80140DC(void); +extern void sub_8014114(void); +extern void sub_80141B4(const u8 *, u32, OpenedFile **, u32); +extern void sub_8014248(const u8 *, u32, u32, const MenuItem *, void *, u32, u32, OpenedFile **, u32); extern s32 sub_80144A4(s32 *); extern void xxx_format_and_draw(u32, u32, const u8 *, u32, u32); diff --git a/include/code_801AFA4.h b/include/code_801AFA4.h new file mode 100644 index 000000000..91ae271db --- /dev/null +++ b/include/code_801AFA4.h @@ -0,0 +1,29 @@ +#ifndef GUARD_CODE_801AFA4_H +#define GUARD_CODE_801AFA4_H + +#include "global.h" +#include "constants/move.h" +#include "menu.h" +#include "pokemon.h" + +// size: 0xA4 +typedef struct unkStruct_203B22C +{ + /* 0x0 */ s32 state; + /* 0x4 */ u32 teamItemIndex; + /* 0x8 */ u8 id; // item index + /* 0xA */ u16 moveID; // item move?? + /* 0xC */ Move moves[MAX_MON_MOVES * 2]; + /* 0x4C */ s32 monsAbleToLearnMove; // number of party members able to learn move + /* 0x50 */ s16 unk50[MAX_TEAM_MEMBERS]; // species IDs of each member able to learn move + /* 0x58 */ s16 chosenPokemon; // species of pokemon that will learn move + /* 0x5C */ PokemonStruct1 *pokeStruct; // PokemonStruct of said pokemon + u32 unk60; + /* 0x64 */ MenuItem menuItems[8]; +} unkStruct_203B22C; + +bool8 sub_801AFA4(u32 index); +u32 sub_801B00C(void); +void sub_801B048(void); + +#endif // GUARD_CODE_801AFA4_H \ No newline at end of file diff --git a/include/code_801B3C0.h b/include/code_801B3C0.h index 7c2d58bbd..ca7410c06 100644 --- a/include/code_801B3C0.h +++ b/include/code_801B3C0.h @@ -2,26 +2,26 @@ #define GUARD_CODE_801B3C0_H #include "input.h" -#include "item.h" +#include "items.h" #include "subStruct_203B240.h" #include "text.h" // size: 0x94 -struct unkStruct_203B230 +typedef struct unkStruct_203B230 { s32 state; - struct Item item; + /* 0x4 */ Item item; s32 unk8; s32 unkC; struct subStruct_203B240 *unk10[2]; u8 fill18[0x20 - 0x18]; u32 unk20; u32 unk24; - struct UnkTextStruct2 unk28[4]; - struct MenuInputStructSub unk88; -}; + UnkTextStruct2 unk28[4]; + MenuInputStructSub unk88; +} unkStruct_203B230; -u32 sub_801B3C0(struct Item *); +bool8 sub_801B3C0(Item *item); u32 sub_801B410(void); void sub_801B450(void); diff --git a/include/code_801B60C.h b/include/code_801B60C.h new file mode 100644 index 000000000..78920cea8 --- /dev/null +++ b/include/code_801B60C.h @@ -0,0 +1,30 @@ +#ifndef GUARD_CODE_801B60C_H +#define GUARD_CODE_801B60C_H + +#include "items.h" +#include "menu.h" +#include "text.h" + +// size: 0x154 +typedef struct unkStruct_203B234 +{ + u32 unk0; + /* 0x4 */ u32 state; + /* 0x8 */ u32 fallbackState; + u8 unkC; + Item unk10; + struct unkStruct_8090F58 unk14; + Item unk20; + u32 unk24; + MenuStruct unk28; + MenuStruct unk78; + /* 0xC8 */ u32 menuAction; + MenuItem unkCC[5]; + UnkTextStruct2 unkF4[4]; +} unkStruct_203B234; + +bool8 sub_801B60C(u32, u8 id, u8 quantity); +u32 sub_801B6AC(void); +void sub_801B72C(void); + +#endif // GUARD_CODE_801B60C_H \ No newline at end of file diff --git a/include/code_801C620.h b/include/code_801C620.h index 0be8b9656..99060bddd 100644 --- a/include/code_801C620.h +++ b/include/code_801C620.h @@ -3,8 +3,11 @@ #include "text.h" -bool8 sub_801C8C4(s32, s32, struct UnkTextStruct2_sub *, u32); -extern u32 sub_801CA08(bool8); +bool8 sub_801BEEC(s16 species); +u32 sub_801BF48(void); +void sub_801BF98(void); +bool8 sub_801C8C4(s32, s32, UnkTextStruct2_sub *, u32); +u32 sub_801CA08(bool8); u8 sub_801CB24(void); void sub_801CB5C(bool8); void sub_801CBB8(void); @@ -13,6 +16,6 @@ bool8 sub_801CF14(s32); bool8 sub_801CF50(s32); void sub_801CF94(void); s32 sub_801CFB8(void); -u32 sub_801CFE0(u8); +u32 sub_801CFE0(u8 index); #endif // GUARD_CODE_801C620_H \ No newline at end of file diff --git a/include/code_801EE10.h b/include/code_801EE10.h index 9c8173a15..ec613bf49 100644 --- a/include/code_801EE10.h +++ b/include/code_801EE10.h @@ -1,27 +1,39 @@ #ifndef CODE_801EE10_H #define CODE_801EE10_H +#include "constants/move.h" + #include "input.h" #include "pokemon.h" #include "text.h" -struct unkStruct_203B270 +// size 0xBC +typedef struct unkStruct_203B270 { - // size 0xBC u32 unk0; u8 unk4; u8 unk5; u8 unk6; u8 unk7; - /* 0x8 */ struct PokemonStruct *pokeStruct; + /* 0x8 */ PokemonStruct1 *pokeStruct; /* 0xC */ u8 isTeamLeader; - /* 0x10 */ struct Move *moves; + /* 0x10 */ Move *moves; u8 fill14[0x1C - 0x14]; - struct MenuInputStruct input; + MenuInputStruct input; u32 unk50; u32 unk54; - struct UnkTextStruct2 unk58[4]; - u8 *text; -}; + UnkTextStruct2 unk58[4]; + const u8 *text; +} unkStruct_203B270; -#endif +u8 sub_801EE10(u32, s16 species, Move *moves, u32, const u8 *text, u32); + +// code_801EE10.s +extern u32 sub_801EF38(u32); +extern u32 sub_801F194(void); +extern bool8 sub_801F1A4(void); +extern void sub_801F1B0(bool8, bool8); +extern void sub_801F214(void); +extern void sub_801F280(u32); // Probably bool + +#endif // CODE_801EE10_H \ No newline at end of file diff --git a/include/code_801EE10_1.h b/include/code_801EE10_1.h index 9e2c798a5..3aee11c67 100644 --- a/include/code_801EE10_1.h +++ b/include/code_801EE10_1.h @@ -1,6 +1,9 @@ #ifndef GUARD_CODE_801EE10_1_H #define GUARD_CODE_801EE10_1_H +bool8 sub_8024458(s16 speciesNum, s32); +void sub_802453C(void); + // code_801EE10_1.s extern void sub_8023868(u32, u32, u32, u32); extern u32 sub_8023A94(bool8); diff --git a/include/code_801EE10_mid.h b/include/code_801EE10_mid.h index 0d18ee354..ef3d3eb6e 100644 --- a/include/code_801EE10_mid.h +++ b/include/code_801EE10_mid.h @@ -1,6 +1,16 @@ #ifndef GUARD_CODE_801EE10_MID_H #define GUARD_CODE_801EE10_MID_H +bool8 sub_801F428(s16 index, s32); +u32 sub_801F520(u8); +u16 sub_801F5B4(void); +void sub_801F5F0(bool8); +void sub_801F63C(void); +void sub_801F700(void); +bool8 sub_801F808(u16 *moveIDs); +u32 sub_801F890(void); +void sub_801F8D0(void); + // code_801EE10_mid.s extern void sub_8021494(void); diff --git a/include/code_8023144.h b/include/code_8023144.h index 750255bb9..3cbf484e1 100644 --- a/include/code_8023144.h +++ b/include/code_8023144.h @@ -1,9 +1,16 @@ #ifndef GUARD_CODE_8023144_H #define GUARD_CODE_8023144_H -struct unkStruct_203B294 -{ - // size: 0x1A8 +#include "constants/iq_skill.h" +#include "input.h" +#include "items.h" +#include "menu.h" +#include "pokemon.h" +#include "text.h" + +// size: 0x1A8 +typedef struct unkStruct_203B294 +{ /* 0x0 */ s32 state; /* 0x4 */ s32 fallbackState; u8 iqSkillPreGummi[NUM_IQ_SKILLS]; @@ -11,17 +18,34 @@ struct unkStruct_203B294 u32 availIQSkillPreGummi; u32 availIQSkillPostGummi; u32 unk40; // Gummi eaten flag? - struct Gummi gummi; - /* 0x48 */ struct PokemonStruct *pokeStruct; + Gummi gummi; + /* 0x48 */ PokemonStruct1 *pokeStruct; u32 itemIndex; - struct Item item; - struct MenuStruct unk54; - struct MenuStruct unkA4; + Item item; + MenuStruct unk54; + MenuStruct unkA4; u32 menuAction; - struct MenuItem unkF8[0x8]; + MenuItem unkF8[0x8]; u16 unk138[0x8]; - struct UnkTextStruct2 unk148[4]; -}; + UnkTextStruct2 unk148[4]; +} unkStruct_203B294; +// size: 0x3FC +typedef struct unkStruct_3001B5C +{ + u8 unk0; + u32 unk4; + u32 unk8; + s16 unkC[2]; + u32 unk10; + u8 fill14[0x354 - 0x14]; + u8 unk354; + u8 fill355[0x35C - 0x355]; + MenuInputStruct input; + u32 unk390; + UnkTextStruct2 *unk394; + UnkTextStruct2 unk398[4]; + u8 unk3F8[4]; +} unkStruct_3001B5C; -#endif // GUARD_CODE_8023144_H +#endif // GUARD_CODE_8023144_H \ No newline at end of file diff --git a/include/code_802C39C.h b/include/code_802C39C.h index 30e3df042..0dc2053f1 100644 --- a/include/code_802C39C.h +++ b/include/code_802C39C.h @@ -1,7 +1,14 @@ -struct unkStruct_802C39C +#ifndef GUARD_CODE_802C39C_H +#define GUARD_CODE_802C39C_H + +#include "code_8094F88.h" +#include "wonder_mail.h" + +// size: 0x58 +typedef struct unkStruct_802C39C { /* 0x0 */ u32 unk0[2]; - /* 0x8 */ struct WonderMailSub *unk8; + /* 0x8 */ WonderMailSub *unk8; /* 0xC */ u8 *playerName; /* 0x10 */ s16 clientSpecies; /* 0x12 */ s16 targetSpecies; @@ -20,5 +27,7 @@ struct unkStruct_802C39C /* 0x48 */ u32 y; /* 0x4C */ u8 *unk4C; u8 *unk50; - /* 0x54 */ struct WonderMail *mail; -}; + /* 0x54 */ WonderMail *mail; +} unkStruct_802C39C; + +#endif // GUARD_CODE_802C39C_H \ No newline at end of file diff --git a/include/code_803B050.h b/include/code_803B050.h new file mode 100644 index 000000000..be065c35f --- /dev/null +++ b/include/code_803B050.h @@ -0,0 +1,23 @@ +#ifndef GUARD_CODE_803B050_H +#define GUARD_CODE_803B050_H + +// size: 0x8 +typedef struct unkStruct_80E9920 +{ + /* 0x0 */ s16 unkA; + /* 0x2 */ s16 unkB; + /* 0x4 */ u8 *text; +} unkStruct_80E9920; + +// size: 0xC +typedef struct unkStruct_80E9F8C +{ + /* 0x0 */ s16 unkA; + /* 0x2 */ s16 unkB; + /* 0x4 */ u8 *text1; + /* 0x8 */ u8 *text2; +} unkStruct_80E9F8C; + +void sub_803B6B0(s32 x, s32 y, u8 index, u32); + +#endif // GUARD_CODE_803B050_H \ No newline at end of file diff --git a/include/code_803D0D8.h b/include/code_803D0D8.h new file mode 100644 index 000000000..ae279de62 --- /dev/null +++ b/include/code_803D0D8.h @@ -0,0 +1,8 @@ +#ifndef GUARD_CODE_803D0D8_H +#define GUARD_CODE_803D0D8_H + +u8 sub_803D0D8(void); +u8 sub_803D0F0(u8); +u8 sub_803D100(u8); + +#endif // GUARD_CODE_803D0D8_H \ No newline at end of file diff --git a/include/code_80521D0.h b/include/code_80521D0.h index bfeb281ce..008c54f13 100644 --- a/include/code_80521D0.h +++ b/include/code_80521D0.h @@ -3,6 +3,6 @@ #include "dungeon_entity.h" -void SendMessage(struct Entity *pokemon, const char message[]); +void SendMessage(Entity *pokemon, const char message[]); -#endif +#endif // GUARD_CODE_80521D0_H \ No newline at end of file diff --git a/include/code_805D8C8.h b/include/code_805D8C8.h index 075b7ea08..7a4d93f87 100644 --- a/include/code_805D8C8.h +++ b/include/code_805D8C8.h @@ -1,13 +1,13 @@ #ifndef GUARD_CODE_805D8C8_H #define GUARD_CODE_805D8C8_H -#include "sprite.h" +#include "file_system.h" -extern struct OpenedFile *sub_80687D0(s16); -/*struct OpenedFile *sub_80687D0(s16 species) -{ - s32 species32 = species; - return gDungeon->sprites[species32]; -}*/ +void CloseAllSpriteFiles(void); + +void sub_8068768(void); +void sub_80687AC(void); +OpenedFile *sub_80687D0(s16 species); +void sub_8068838(s16 id, bool32); #endif // GUARD_CODE_805D8C8_H \ No newline at end of file diff --git a/include/code_806CD90.h b/include/code_806CD90.h new file mode 100644 index 000000000..3a172ea7b --- /dev/null +++ b/include/code_806CD90.h @@ -0,0 +1,22 @@ +#ifndef GUARD_CODE_806CD90_H +#define GUARD_CODE_806CD90_H + +#include "dungeon_entity.h" + +void sub_806CC10(void); +void sub_806CC70(void); +void sub_806CCB4(Entity *entity, u8); +void sub_806CD90(void); +void sub_806CDD4(Entity *entity, u8, u32); +void sub_806CDFC(Entity *entity, u8, u32); +void sub_806CE34(Entity *entity, u32 newDir); +void sub_806CE68(Entity *entity, u32 newDir); +void sub_806CE94(Entity *entity, u32 newDir); +u8 sub_806CEBC(Entity *entity); +void sub_806CEFC(Entity *entity, u32 newDir); +void sub_806CF18(Entity *entity); +u8 sub_806CF54(Entity *entity); +void sub_806CF60(void); +u32 sub_806CF98(Entity *entity); + +#endif // GUARD_CODE_806CD90_H \ No newline at end of file diff --git a/include/code_8077274_1.h b/include/code_8077274_1.h index fd8d3c2eb..6f9a92ca3 100644 --- a/include/code_8077274_1.h +++ b/include/code_8077274_1.h @@ -1,52 +1,52 @@ #ifndef GUARD_CODE_8077274_1_H #define GUARD_CODE_8077274_1_H -void MuzzleTarget(struct Entity *pokemon, struct Entity *target); -void TransformStatusTarget(struct Entity * pokemon, struct Entity * target); -void MobileStatusTarget(struct Entity * pokemon, struct Entity * target); -void ExposeStatusTarget(struct Entity * pokemon, struct Entity * target, s16 param_3); -void IdentityItemHolders(struct Entity *pokemon, struct Entity *target); -void BlindTarget(struct Entity *pokemon, struct Entity *target); -void CrossEyeVisionTarget(struct Entity *pokemon, struct Entity *target); -void RestoreVisionTarget(struct Entity *pokemon, struct Entity *target); -void RestorePPTarget(struct Entity * pokemon,struct Entity * target, s32 param_3); -void RaiseAtkStatTarget(struct Entity * pokemon,struct Entity * target, s32 increment); -void RaiseSpAtkStatTarget(struct Entity * pokemon,struct Entity * target, s32 increment); -void RaiseDefStatTarget(struct Entity * pokemon,struct Entity * target, s32 increment); -void RaiseSpDefStatTarget(struct Entity * pokemon,struct Entity * target, s32 increment); -void LongTossStatusTarget(struct Entity * pokemon,struct Entity * target); -void PierceStatusTarget(struct Entity * pokemon,struct Entity * target); -void SetChargeStatusTarget(struct Entity *pokemon, struct Entity *target, u8 newStatus, struct Move *move, u8 *message); -void sub_8079764(struct Entity * pokemon); -void CounterStatusTarget(struct Entity * pokemon, struct Entity * target, u8 newStatus); -void SafeguardStatusTarget(struct Entity * pokemon, struct Entity * target); -void MistStatusTarget(struct Entity * pokemon, struct Entity * target); -void WishStatusTarget(struct Entity * pokemon, struct Entity * target); -void MagicCoatStatusTarget(struct Entity * pokemon, struct Entity * target); -void LightScreenStatusTarget(struct Entity * pokemon, struct Entity * target); -void ReflectStatusTarget(struct Entity * pokemon, struct Entity * target); -void ProtectStatusTarget(struct Entity * pokemon, struct Entity * target); -void MirrorCoatStatusTarget(struct Entity * pokemon, struct Entity * target); -void EndureStatusTarget(struct Entity * pokemon, struct Entity * target); -void MirrorMoveStatusTarget(struct Entity * pokemon, struct Entity * target); -void Conversion2StatusTarget(struct Entity * pokemon, struct Entity * target); -void VitalThrowStatusTarget(struct Entity * pokemon, struct Entity * target); -void sub_8079F20(struct Entity * pokemon, struct Entity * target, u8 param_3, u8 param_4); -void sub_807A0CC(struct Entity * pokemon, struct Entity * target); -void SendSleepEndMessage(struct Entity * pokemon, struct Entity * target, bool8 param_3, bool8 param_4); -void SendNonVolatileEndMessage(struct Entity * pokemon, struct Entity * target); -void SendImmobilizeEndMessage(struct Entity * pokemon, struct Entity *target); -void SendVolatileEndMessage(struct Entity * pokemon, struct Entity *target); -void SendProtectionEndMessage(struct Entity * pokemon, struct Entity *target); -void SendWaitingEndMessage(struct Entity * pokemon, struct Entity * target, u8 waitingStatus); -void SendLinkedEndMessage(struct Entity * pokemon, struct Entity * target); -void SendMoveEndMessage(struct Entity * pokemon, struct Entity * target); -void SendTransformEndMessage(struct Entity * pokemon, struct Entity *target); -void SendEyesightEndMessage(struct Entity * pokemon,struct Entity * target); -void SendMuzzledEndMessage(struct Entity * pokemon, struct Entity * target); -void sub_807A96C(struct Entity *pokemon, struct Entity *target); -void WakeUpPokemon(struct Entity * pokemon); -void SendThawedMessage(struct Entity *pokemon, struct Entity *target); +void MuzzleTarget(Entity *pokemon, Entity *target); +void TransformStatusTarget(Entity * pokemon, Entity * target); +void MobileStatusTarget(Entity * pokemon, Entity * target); +void ExposeStatusTarget(Entity * pokemon, Entity * target, s16 param_3); +void IdentityItemHolders(Entity *pokemon, Entity *target); +void BlindTarget(Entity *pokemon, Entity *target); +void CrossEyeVisionTarget(Entity *pokemon, Entity *target); +void RestoreVisionTarget(Entity *pokemon, Entity *target); +void RestorePPTarget(Entity * pokemon,Entity * target, s32 param_3); +void RaiseAtkStatTarget(Entity * pokemon,Entity * target, s32 increment); +void RaiseSpAtkStatTarget(Entity * pokemon,Entity * target, s32 increment); +void RaiseDefStatTarget(Entity * pokemon,Entity * target, s32 increment); +void RaiseSpDefStatTarget(Entity * pokemon,Entity * target, s32 increment); +void LongTossStatusTarget(Entity * pokemon,Entity * target); +void PierceStatusTarget(Entity * pokemon,Entity * target); +void SetChargeStatusTarget(Entity *pokemon, Entity *target, u8 newStatus, Move *move, u8 *message); +void sub_8079764(Entity * pokemon); +void CounterStatusTarget(Entity * pokemon, Entity * target, u8 newStatus); +void SafeguardStatusTarget(Entity * pokemon, Entity * target); +void MistStatusTarget(Entity * pokemon, Entity * target); +void WishStatusTarget(Entity * pokemon, Entity * target); +void MagicCoatStatusTarget(Entity * pokemon, Entity * target); +void LightScreenStatusTarget(Entity * pokemon, Entity * target); +void ReflectStatusTarget(Entity * pokemon, Entity * target); +void ProtectStatusTarget(Entity * pokemon, Entity * target); +void MirrorCoatStatusTarget(Entity * pokemon, Entity * target); +void EndureStatusTarget(Entity * pokemon, Entity * target); +void MirrorMoveStatusTarget(Entity * pokemon, Entity * target); +void Conversion2StatusTarget(Entity * pokemon, Entity * target); +void VitalThrowStatusTarget(Entity * pokemon, Entity * target); +void sub_8079F20(Entity * pokemon, Entity * target, u8 param_3, u8 param_4); +void sub_807A0CC(Entity * pokemon, Entity * target); +void SendSleepEndMessage(Entity * pokemon, Entity * target, bool8 param_3, bool8 param_4); +void SendNonVolatileEndMessage(Entity * pokemon, Entity * target); +void SendImmobilizeEndMessage(Entity * pokemon, Entity *target); +void SendVolatileEndMessage(Entity * pokemon, Entity *target); +void SendProtectionEndMessage(Entity * pokemon, Entity *target); +void SendWaitingEndMessage(Entity * pokemon, Entity * target, u8 waitingStatus); +void SendLinkedEndMessage(Entity * pokemon, Entity * target); +void SendMoveEndMessage(Entity * pokemon, Entity * target); +void SendTransformEndMessage(Entity * pokemon, Entity *target); +void SendEyesightEndMessage(Entity * pokemon,Entity * target); +void SendMuzzledEndMessage(Entity * pokemon, Entity * target); +void sub_807A96C(Entity *pokemon, Entity *target); +void WakeUpPokemon(Entity * pokemon); +void SendThawedMessage(Entity *pokemon, Entity *target); void sub_807AA30(void); #endif // !GUARD_CODE_8077274_1_H diff --git a/include/code_808417C.h b/include/code_808417C.h index 5f0c2ea79..669aaf198 100644 --- a/include/code_808417C.h +++ b/include/code_808417C.h @@ -1,6 +1,6 @@ #ifndef GUARD_808417C_H #define GUARD_808417C_H -s32 CalculateStatusTurns(struct Entity *target, s16 *turnRange, bool8 factorCurerSkills); +s32 CalculateStatusTurns(Entity *target, s16 *turnRange, bool8 factorCurerSkills); #endif // GUARD_808417C_H diff --git a/include/code_80869E4.h b/include/code_80869E4.h new file mode 100644 index 000000000..3aad7eed3 --- /dev/null +++ b/include/code_80869E4.h @@ -0,0 +1,42 @@ +#ifndef GUARD_CODE_80869E4_H +#define GUARD_CODE_80869E4_H + +#include "dungeon_entity.h" + +// size: 0x8 +typedef struct unkStruct_202F3D0 +{ + u8 unk0; + u8 unk1; + u8 unk2; + u8 unk3; + u8 unk4; + u8 unk5; +} unkStruct_202F3D0; + +void SpriteLookAroundEffect(Entity *entity); +void SpriteShockEffect(Entity *entity); + +void sub_8086448(void); +void sub_8086500(void); +void sub_808654C(void); +void sub_8086598(void); +void sub_80865E8(void); +void sub_808663C(void); +void sub_8086690(void); +void sub_80866C4(const u8 *dialogue); +void sub_8086738(void); +void sub_8086764(void); +void sub_8086794(void); +void sub_80867F4(void); +void sub_808680C(void); +void sub_808682C(void); +void sub_8086838(u8 entity, u8, u8); +void sub_8086848(u8 entity, u8); +void sub_8086854(void); +void sub_80868F4(Entity *entity); +void sub_8086910(Entity *entity); +void sub_808692C(void); +void sub_80869E4(Entity *, s32, u8, s8); + +#endif // GUARD_CODE_80869E4_H \ No newline at end of file diff --git a/include/code_8092334.h b/include/code_8092334.h index 0548659fa..b07336fbb 100644 --- a/include/code_8092334.h +++ b/include/code_8092334.h @@ -1,21 +1,21 @@ #ifndef GUARD_CODE_8092334_H #define GUARD_CODE_8092334_H - -struct unkStruct_8094924 +// size: 0x10? +typedef struct unkStruct_8094924 { - // size: 0x10? u8 *unk0; // head? u8 *unk4; // tail? u32 unk8; u32 unkC; -}; +} unkStruct_8094924; -void xxx_init_struct_8094924_save_809486C(struct unkStruct_8094924 *r0, u8 *r1, s32 size); -void nullsub_102(struct unkStruct_8094924 *r0); -void SaveIntegerBits(struct unkStruct_8094924 *r0, void *r1, s32 size); -void xxx_init_struct_8094924_restore_809485C(struct unkStruct_8094924 *r0, u8 *r1, s32 size); -void sub_80948E4(struct unkStruct_8094924 *r0, u8 *r1, s32 size); -void RestoreIntegerBits(struct unkStruct_8094924 *r0, void *r1, s32 size); +void nullsub_102(unkStruct_8094924 *); +void RestoreIntegerBits(unkStruct_8094924 *, void *, s32 size); +void SaveIntegerBits(unkStruct_8094924 *, void *, s32 size); +void xxx_init_struct_8094924_restore_809485C(unkStruct_8094924 *, u8 *, s32 size); +void xxx_init_struct_8094924_save_809486C(unkStruct_8094924 *, u8 *, s32 size); -#endif \ No newline at end of file +void sub_80948E4(unkStruct_8094924 *, u8 *, s32 size); + +#endif // GUARD_CODE_8092334_H \ No newline at end of file diff --git a/include/code_809447C.h b/include/code_809447C.h index 81e572368..08cbc077c 100644 --- a/include/code_809447C.h +++ b/include/code_809447C.h @@ -1,12 +1,13 @@ #ifndef GUARD_CODE_809447C_H #define GUARD_CODE_809447C_H -struct unkStruct_80928C0 +// size: 0xC +typedef struct unkStruct_80928C0 { u32 unk0; s32 unk4; u8 unk8; u8 unk9; -}; +} unkStruct_80928C0; -#endif \ No newline at end of file +#endif // GUARD_CODE_809447C_H \ No newline at end of file diff --git a/include/code_8094F88.h b/include/code_8094F88.h index beadbb71b..726599afc 100644 --- a/include/code_8094F88.h +++ b/include/code_8094F88.h @@ -1,20 +1,24 @@ #ifndef GUARD_CODE_8094F88_H #define GUARD_CODE_8094F88_H -#include "item.h" +#include "code_8092334.h" +#include "dungeon_global_data.h" +#include "items.h" +#include "pokemon.h" -struct WonderMailSub +// size: 0x8 +typedef struct WonderMailSub { - /* 0x4 */ struct DungeonLocation dungeon; - u32 seed; -}; + /* 0x0 */ DungeonLocation dungeon; + /* 0x4 */ u32 seed; +} WonderMailSub; // size: 0x30 -struct unkStruct_203B480 +typedef struct unkStruct_203B480 { /* 0x0 */ u8 mailType; /* 0x1 */ u8 missionType; - struct WonderMailSub unk4; + WonderMailSub unk4; /* 0xC */ s16 clientSpecies; /* 0xE */ s16 targetSpecies; union unk10_temp @@ -23,53 +27,53 @@ struct unkStruct_203B480 u16 unk10_u16; } unk10; /* 0x14 */ u8 playerName[0x20 - 0x14]; - struct Item item; + Item item; u32 unk24; u32 unk28; /* 0x2C */ s8 rescuesAllowed; u8 unk2D; -}; +} unkStruct_203B480; // size: 0x5C -struct unkStruct_203B484 +typedef struct unkStruct_203B484 { /* 0x0 */ u32 unk0; - /* 0x4 */ struct PokemonStruct unk4; -}; + /* 0x4 */ PokemonStruct1 unk4; +} unkStruct_203B484; // size: 0x84 -struct unkStruct_203B48C +typedef struct unkStruct_203B48C { /* 0x0 */ s32 unk0; /* 0x4 */ s32 unk4[0x20]; -}; +} unkStruct_203B48C; -extern struct unkStruct_203B480 *gUnknown_203B480; -extern struct unkStruct_203B484 *gUnknown_203B484; +extern unkStruct_203B480 *gUnknown_203B480; +extern unkStruct_203B484 *gUnknown_203B484; extern u32 *gUnknown_203B488; -extern struct unkStruct_203B48C *gUnknown_203B48C; +extern unkStruct_203B48C *gUnknown_203B48C; void sub_80950BC(void); -struct unkStruct_203B480 *sub_80950F8(void); -struct unkStruct_203B484 *sub_8095100(void); +unkStruct_203B480 *sub_80950F8(void); +unkStruct_203B484 *sub_8095100(void); u32 *sub_8095108(void); -struct unkStruct_203B48C *sub_8095110(void); +unkStruct_203B48C *sub_8095110(void); void sub_8095118(void); s32 FindOpenMailSlot(void); -bool8 sub_80951BC(struct unkStruct_203B480 *mail); -bool8 sub_80951FC(struct unkStruct_203B480 *param_1); -struct unkStruct_203B480 * GetMailatIndex(u8 index); +bool8 sub_80951BC(unkStruct_203B480 *mail); +bool8 sub_80951FC(unkStruct_203B480 *); +unkStruct_203B480 * GetMailatIndex(u8 index); void DeleteMailAtIndex(u8 index); -void sub_8095274(u32 param_1); -bool8 sub_8095298(s32 param_1); +void sub_8095274(u32); +bool8 sub_8095298(s32); void sub_80952C4(void); -bool8 HasMail(u8 mailType, u32 param_2); +bool8 HasMail(u8 mailType, u32); s32 CountMailType(u8 mailType); u32 CountAllMail(void); s32 sub_8095374(void); -s32 GetMailIndex(u8 mailType, u32 param_2); +s32 GetMailIndex(u8 mailType, u32); s32 GetFirstIndexofMailType(u8 mailType); -void sub_8095824(struct unkStruct_8094924 * a, struct unkStruct_203B480 *b); -void sub_8095774(struct unkStruct_8094924 * a, struct unkStruct_203B480 *b); +void sub_8095824(struct unkStruct_8094924 *a, unkStruct_203B480 *b); +void sub_8095774(struct unkStruct_8094924 *a, unkStruct_203B480 *b); -#endif +#endif // GUARD_CODE_8094F88_H \ No newline at end of file diff --git a/include/code_80958E8.h b/include/code_80958E8.h index 345e562a3..965c9b7f0 100644 --- a/include/code_80958E8.h +++ b/include/code_80958E8.h @@ -1,26 +1,30 @@ +#ifndef GUARD_CODE_80958E8_H +#define GUARD_CODE_80958E8_H + #include "wonder_mail.h" #include "constants/mailbox.h" -struct subStruct_203B490 +// size: 0xC +typedef struct subStruct_203B490 { - // size: 0xC - struct DungeonLocation dungeon; - u32 seed; + /* 0x0 */ DungeonLocation dungeon; + /* 0x4 */ u32 seed; u32 unk8; -}; - +} subStruct_203B490; -struct unkStruct_203B490 +// size: 0x32C? +typedef struct unkStruct_203B490 { - // size: 0x330? - /* 0x0 */ struct WonderMail mailboxSlots[NUM_MAILBOX_SLOTS]; - /* 0x50 */ struct WonderMail pelipperBoardJobs[MAX_ACCEPTED_JOBS]; - /* 0xF0 */ struct WonderMail jobSlots[MAX_ACCEPTED_JOBS]; + /* 0x0 */ WonderMail mailboxSlots[NUM_MAILBOX_SLOTS]; + /* 0x50 */ WonderMail pelipperBoardJobs[MAX_ACCEPTED_JOBS]; + /* 0xF0 */ WonderMail jobSlots[MAX_ACCEPTED_JOBS]; u8 unk190[0x28]; u8 unk1B8[0x78]; - struct subStruct_203B490 unk230[16]; - u8 PKMNNewsReceived[NUM_POKEMON_NEWS]; + subStruct_203B490 unk230[16]; + /* 0x2F0 */ u8 PKMNNewsReceived[NUM_POKEMON_NEWS]; bool8 unk328; -}; +} unkStruct_203B490; -extern struct unkStruct_203B490 *gUnknown_203B490; +extern unkStruct_203B490 *gUnknown_203B490; + +#endif // GUARD_CODE_80958E8_H \ No newline at end of file diff --git a/include/code_80958E8_1.h b/include/code_80958E8_1.h new file mode 100644 index 000000000..144bd84dc --- /dev/null +++ b/include/code_80958E8_1.h @@ -0,0 +1,9 @@ +#ifndef GUARD_CODE_80958E8_1_H +#define GUARD_CODE_80958E8_1_H + +#include "wonder_mail.h" + +s32 CountJobsinDungeon(u8 dungeon); +WonderMail *GetJobSlotInfo(u8 index); + +#endif // GUARD_CODE_80958E8_1_H \ No newline at end of file diff --git a/include/code_80972F4.h b/include/code_80972F4.h new file mode 100644 index 000000000..0df6cbe31 --- /dev/null +++ b/include/code_80972F4.h @@ -0,0 +1,25 @@ +#ifndef GUARD_CODE_80972F4_H +#define GUARD_CODE_80972F4_H + +// size: 0x8 +typedef struct MissionText +{ + /* 0x0 */ u8 *text; + u8 unk4; + u8 unk5; + u8 unk6; + u8 unk7; +} MissionText; + +const u8 *GetCurrentMissionText(s16 index); +// TODO: this should probably be bool8 but can't get a match just yet +bool32 IsMazeCompleted(s16 mazeIndex); + +bool8 sub_8097504(s16 mazeIndex); +const u8 *sub_80975DC(u32); + +// These two are definitely bool8 but can't get them to match with it yet +//bool8 sub_8097384(s16); +//bool8 sub_80973F4(s16); + +#endif // GUARD_CODE_80972F4_H \ No newline at end of file diff --git a/include/code_8097670.h b/include/code_8097670.h index 2d8d118cd..887bedd59 100644 --- a/include/code_8097670.h +++ b/include/code_8097670.h @@ -10,7 +10,7 @@ struct unkStruct_203B494 /* 0x4 */ s32 numAdventures; s32 unk8; s32 unkC; - /* 0x10 */ struct DungeonLocation dungeonLocation; + /* 0x10 */ DungeonLocation dungeonLocation; s16 unk14; s16 unk16; s16 unk18; @@ -20,6 +20,26 @@ struct unkStruct_203B494 s32 unkC0; }; +extern struct unkStruct_203B494 *gUnknown_203B494; + +const u8 *GetAdventureLogLine(u8 index); +DungeonLocation *GetDungeonLocationInfo(void); +s32 GetNumAdventures(void); +void ResetNumAdventures(void); + +void sub_8097670(void); +struct unkStruct_203B494 *sub_8097680(void); +void sub_80976A8(void); void sub_80976F8(u8); +bool8 sub_8097710(u8); +void sub_8097790(void); +s32 sub_80977B8(void); +void sub_80977D0(void); +s32 sub_80977F8(void); +s16 sub_8097838(void); +void sub_8097848(void); +s16 sub_8097870(void); +s16 sub_8097880(void); +s16 sub_80978B8(void); #endif // GUARD_CODE_8097670_H \ No newline at end of file diff --git a/include/code_8098BDC.h b/include/code_8098BDC.h new file mode 100644 index 000000000..1567849af --- /dev/null +++ b/include/code_8098BDC.h @@ -0,0 +1,9 @@ +#ifndef GUARD_CODE_8098BDC_H +#define GUARD_CODE_8098BDC_H + +// code_8098DBC.s +extern void sub_80993D8(void); +extern void sub_80993E4(void); +extern void sub_8099690(u32); + +#endif // GUARD_CODE_8098BDC_H \ No newline at end of file diff --git a/include/code_80A26CC.h b/include/code_80A26CC.h index e7f07852b..6ece6742b 100644 --- a/include/code_80A26CC.h +++ b/include/code_80A26CC.h @@ -1,4 +1,8 @@ -struct unkStruct_80A2608 +#ifndef GUARD_CODE_80A26CC_H +#define GUARD_CODE_80A26CC_H + +// size: 0x14 +typedef struct unkStruct_80A2608 { /* 0x0 */ s16 unk0; /* 0x2 */ s16 unk2; @@ -11,7 +15,29 @@ struct unkStruct_80A2608 /* 0xE */ s16 unkE; /* 0x10 */ u8 unk10; /* 0x11 */ u8 unk11; -}; +} unkStruct_80A2608; -struct unkStruct_80A2608 *sub_80A2608(s16 r0); -struct unkStruct_80A2608 *sub_80A2620(s16 r0); +void sub_80A2500(s32, s16 *); +void sub_80A252C(s32, s16 *); +void sub_80A2558(s32, s16 *); +void sub_80A2584(s16, s16); +void sub_80A2598(s16, s16); +u32 sub_80A25AC(u16); +const unkStruct_80A2608 *sub_80A2608(s16 index); +const unkStruct_80A2608 *sub_80A2620(s16 index); +s16 sub_80A2654(s16 index); +s16 sub_80A2668(u32); +s16 sub_80A2688(u8); +s16 sub_80A26B8(s16); +s16 sub_80A26CC(s16); +u8 sub_80A270C(s16 index); +u8 sub_80A2728(s16 index); +u8 sub_80A2740(s32 index); +s16 sub_80A2750(s16); +bool8 sub_80A27CC(s16); +bool8 sub_80A2824(u8 index); +bool8 sub_80A28F0(u8 index); +s32 sub_80A29B0(u8 *); +const u8 *sub_80A2B18(s16); + +#endif // GUARD_CODE_80A26CC_H \ No newline at end of file diff --git a/include/constants/item.h b/include/constants/item.h index 3893bfa20..54712661a 100644 --- a/include/constants/item.h +++ b/include/constants/item.h @@ -1,7 +1,11 @@ #ifndef GUARD_CONSTANTS_ITEM_H #define GUARD_CONSTANTS_ITEM_H -#define NUMBER_OF_ITEM_IDS 0xF0 +#define MAX_KECLEON_ITEM_SHOP_ITEMS 8 +#define MAX_KECLEON_WARE_SHOP_ITEMS 4 + +#define MAX_TEAM_MONEY 99999 +#define MAX_TEAM_SAVINGS 9999999 #define CATEGORY_THROWN_LINE 0 #define CATEGORY_THROWN_ARC 1 @@ -272,4 +276,13 @@ #define ITEM_G_MACHINE_7 0xEE #define ITEM_G_MACHINE_8 0xEF -#endif +#define NUMBER_OF_ITEM_IDS (ITEM_G_MACHINE_8 + 1) + +#define NUMBER_OF_GUMMIS 18 +#define INVENTORY_SIZE 20 +#define STORAGE_SIZE NUMBER_OF_ITEM_IDS + +#define MIN_SPAWN_AMOUNT 0 +#define MAX_SPAWN_AMOUNT 1 + +#endif // GUARD_CONSTANTS_ITEM_H \ No newline at end of file diff --git a/include/constants/move.h b/include/constants/move.h index 4f6a15eb5..62fba6d03 100644 --- a/include/constants/move.h +++ b/include/constants/move.h @@ -34,7 +34,8 @@ enum AccuracyType NUM_ACCURACY_TYPES }; -struct MoveDataEntry +// size: 0x24 +typedef struct MoveDataEntry { /* 0x0 */ u8 *name; /* 0x4 */ s16 basePower; @@ -57,16 +58,17 @@ struct MoveDataEntry /* 0x19 */ u8 rangeID; /* 0x1C */ u8 *description; /* 0x20 */ u8 *useText; // The text displayed when this move is used. -}; +} MoveDataEntry; -struct Move +// size: 0x8 +typedef struct Move { u8 moveFlags; u8 moveFlags2; u16 id; u8 PP; u8 ginseng; // How much the move is boosted by Ginsengs. -}; +} Move; enum TargetingFlag { @@ -94,4 +96,4 @@ enum TargetingFlag TARGETING_FLAG_EXPOSE = 0x600, }; -#endif +#endif // GUARD_CONSTANTS_MOVE_H \ No newline at end of file diff --git a/include/debug.h b/include/debug.h index 71a42dce6..3e71b7fa7 100644 --- a/include/debug.h +++ b/include/debug.h @@ -1,16 +1,17 @@ #ifndef GUARD_DEBUG_H #define GUARD_DEBUG_H + #include "gba/gba.h" - -struct DebugLocation +// size: 0xC +typedef struct DebugLocation { - char *file; - u32 line; - char *func; -}; + /* 0x0 */ u8 *file; + /* 0x4 */ u32 line; + /* 0x8 */ u8 *func; +} DebugLocation; -void Log(u8 num, const char *text, ...); +void Log(u8 num, const u8 *text, ...); void NDS_DebugInit(void); void nullsub_25(void); void nullsub_26(void); @@ -22,17 +23,17 @@ void nullsub_31(void); void nullsub_32(void); void nullsub_137(void); void nullsub_199(void); -void PrintFuncFileLineOrNotEntry(char * buf, struct DebugLocation *debug); -void PrintFuncFileLine(char *buf, struct DebugLocation *loc, const char* prefix); -void PrintMessageWithFuncFileLine(u8 *buffer, struct DebugLocation *debug, const char *text, ...); +void PrintFuncFileLine(u8 *buf, DebugLocation *loc, const u8 *prefix); +void PrintMessageWithFuncFileLine(u8 *buffer, DebugLocation *debug, const u8 *text, ...); void sub_8011B08(void); -void sub_8011B88(const char *text, ...); +void sub_8011B88(const u8 *text, ...); u32 sub_8011BA4(void); u32 sub_8011BA8(void); -const char *sub_8011BAC(void); +const u8 *sub_8011BAC(void); void sub_8011B14(void); u8 sub_8011B20(void); u8 sub_8011B3C(void); -void sub_8011BC8(u32 r0, u32 r1, u32 r2, ...); +void sub_8011BC8(u32, u32, u32, ...); void UnusedHang(void); -#endif + +#endif // GUARD_DEBUG_H \ No newline at end of file diff --git a/include/debug_menu1.h b/include/debug_menu1.h index f23ed3f59..c570f1e30 100644 --- a/include/debug_menu1.h +++ b/include/debug_menu1.h @@ -7,8 +7,8 @@ // size: 0x1A4 struct DebugMenu { - struct MenuStruct unk0[4]; - struct UnkTextStruct2 unk140[4]; + MenuStruct unk0[4]; + UnkTextStruct2 unk140[4]; u32 fill1A0; }; diff --git a/include/debug_menu2.h b/include/debug_menu2.h index c2ef67d85..91e215896 100644 --- a/include/debug_menu2.h +++ b/include/debug_menu2.h @@ -10,19 +10,19 @@ struct unkStruct_203B3F0 /* 0x0 */ u32 state; /* 0x4 */ u8 id; /* 0x8 */ u32 menuAction; - /* 0xC */ struct MenuItem menuItems[8]; - struct MenuStruct unk4C; + /* 0xC */ MenuItem menuItems[8]; + MenuStruct unk4C; u32 unk9C; u32 unkA0; u32 unkA4; u32 unkA8; u32 unkAC; u32 unkB0; - struct UnkTextStruct2 *unkB4; + UnkTextStruct2 *unkB4; u32 unkB8; u32 unkBC; u8 fill4[0xD8 - 0xC0]; - struct UnkTextStruct2 unkD8[4]; + UnkTextStruct2 unkD8[4]; }; #endif // GUARD_DEBUG_MENU2_H \ No newline at end of file diff --git a/include/debug_menu3.h b/include/debug_menu3.h index 2a822e36a..232271bbe 100644 --- a/include/debug_menu3.h +++ b/include/debug_menu3.h @@ -5,14 +5,14 @@ #include "text.h" // size: 0xFC -struct unkStruct_203B3F4 +typedef struct unkStruct_203B3F4 { /* 0x0 */ u32 state; /* 0x4 */ u8 friendArea; /* 0x8 */ u32 menuAction; - /* 0xC */ struct MenuItem menuItems[8]; - struct MenuStruct unk4C; - struct UnkTextStruct2 unk9C[4]; -}; + /* 0xC */ MenuItem menuItems[8]; + MenuStruct unk4C; + UnkTextStruct2 unk9C[4]; +} unkStruct_203B3F4; #endif // GUARD_DEBUG_MENU3_H \ No newline at end of file diff --git a/include/debug_menu4.h b/include/debug_menu4.h index 2fe92244f..ae42117c4 100644 --- a/include/debug_menu4.h +++ b/include/debug_menu4.h @@ -6,27 +6,27 @@ #include "text.h" // size: 0x140 -struct unkStruct_203B3F8 +typedef struct unkStruct_203B3F8 { /* 0x0 */ u32 state; s16 unk4; u16 unk6; - /* 0x8 */ struct PokemonStruct *pokemon; + /* 0x8 */ PokemonStruct1 *pokemon; /* 0xC */ u32 menuAction; - struct MenuStruct unk10; + MenuStruct unk10; u32 unk60; u32 unk64; u32 unk68; u32 unk6C; u32 unk70; u32 unk74; - struct UnkTextStruct2 *unk78; + UnkTextStruct2 *unk78; u32 unk7C; u32 unk80; u8 fill84[0x90 - 0x84]; - struct MenuItem unk90[8]; + MenuItem unk90[8]; u16 unkD0[8]; - struct UnkTextStruct2 unkE0[4]; -}; + UnkTextStruct2 unkE0[4]; +} unkStruct_203B3F8; #endif // GUARD_DEBUG_MENU4_H \ No newline at end of file diff --git a/include/decompress.h b/include/decompress.h new file mode 100644 index 000000000..4a1956111 --- /dev/null +++ b/include/decompress.h @@ -0,0 +1,14 @@ +#ifndef GUARD_DECOMPRESS_H +#define GUARD_DECOMPRESS_H + +#include "file_system.h" + +u32 DecompressAT(u8 *result, s32 resultLength, const u8 *compressedData); +u32 DecompressATFile(u8 *result, s32 resultLength, OpenedFile *file); +u32 DecompressATGlobalFile(u32 *result, s32 resultLength, OpenedFile *file); +u8 *GetSiroPtr(OpenedFile *openedFile); +void nullsub_16(void); + +bool8 sub_800B2D4(char *, char *, s32 length); + +#endif // GUARD_DECOMPRESS_H \ No newline at end of file diff --git a/include/dungeon.h b/include/dungeon.h index c5af3f4d7..f1ed51a9b 100644 --- a/include/dungeon.h +++ b/include/dungeon.h @@ -4,14 +4,14 @@ #include "dungeon_global_data.h" // size: 0x8 -struct DungeonName +typedef struct DungeonName { const u8 *name1; const u8 *name2; -}; +} DungeonName; // size: 0x10 -struct DungeonDataEntry +typedef struct DungeonDataEntry { /* 0x0 */ bool8 stairDirectionUp; // If enabled, enemies will evolve when a team member is KOed (and doesn't revive) if their evolution spawns on the floor. @@ -31,17 +31,20 @@ struct DungeonDataEntry // The chance that a wild Pokémon's moveRandomly flag will be set when spawning, // causing them to move randomly inside a room instead of exploring rooms. /* 0xE */ s16 randomMovementChance; -}; +} DungeonDataEntry; -extern struct DungeonDataEntry gDungeons[]; -extern struct DungeonName gDungeonNames[]; +extern DungeonDataEntry gDungeons[]; +extern DungeonName gDungeonNames[]; + +s32 GetDungeonFloorCount(u8 dungeon); const u8 *GetDungeonName1(u8 dungeon); -u32 sub_80908D8(struct DungeonLocation *dungeon); -u8 sub_8090910(struct DungeonLocation *dungeon, u32 param_2); -bool8 sub_809095C(u8 dungeon); u32 GetMaxItemsAllowed(u8 dungeon); s8 GetRescuesAllowed(u8 dungeon); bool8 HasCheckpoint(u8 dungeon); -s32 GetDungeonFloorCount(u8 dungeon); +void PrintYellowDungeonNametoBuffer(u8 *buffer, DungeonLocation *dungeonLocation); -#endif //GUARD_DUNGEON_H +u32 sub_80908D8(DungeonLocation *dungeon); +u8 sub_8090910(DungeonLocation *dungeon, u32 param_2); +bool8 sub_809095C(u8 dungeon); + +#endif // GUARD_DUNGEON_H \ No newline at end of file diff --git a/include/dungeon_action.h b/include/dungeon_action.h index bb95fe087..2e606d346 100644 --- a/include/dungeon_action.h +++ b/include/dungeon_action.h @@ -3,8 +3,8 @@ #include "dungeon_entity.h" -void ClearMonsterActionFields(struct ActionContainer *actionPointer); -void SetMonsterActionFields(struct ActionContainer *actionPointer, u16 action); -void SetActionPassTurnOrWalk(struct ActionContainer *actionPointer, s16 species); +void ClearMonsterActionFields(ActionContainer *actionPointer); +void SetMonsterActionFields(ActionContainer *actionPointer, u16 action); +void SetActionPassTurnOrWalk(ActionContainer *actionPointer, s16 species); #endif diff --git a/include/dungeon_ai.h b/include/dungeon_ai.h index edff1a17a..bf2597573 100644 --- a/include/dungeon_ai.h +++ b/include/dungeon_ai.h @@ -3,8 +3,8 @@ #include "dungeon_entity.h" -u32 sub_8075818(struct Entity *entity); -void sub_8075900(struct Entity *pokemon, u8 r1); -void RunMonsterAI(struct Entity *pokemon, u32 unused); +u32 sub_8075818(Entity *entity); +void sub_8075900(Entity *pokemon, u8 r1); +void RunMonsterAI(Entity *pokemon, u32 unused); #endif diff --git a/include/dungeon_ai_attack.h b/include/dungeon_ai_attack.h index 4f9795ce2..00f3eae60 100644 --- a/include/dungeon_ai_attack.h +++ b/include/dungeon_ai_attack.h @@ -13,13 +13,13 @@ struct AIPossibleMove s32 weight; }; -void DecideAttack(struct Entity *pokemon); -s32 AIConsiderMove(struct AIPossibleMove *aiPossibleMove, struct Entity *pokemon, struct Move *move); -bool8 IsTargetInLineRange(struct Entity *user, struct Entity *target, s32 range); -s32 TryAddTargetToAITargetList(s32 numPotentialTargets, s32 targetingFlags, struct Entity *user, struct Entity *target, struct Move *move, u32 hasStatusChecker); -bool8 IsAITargetEligible(s32 targetingFlags, struct Entity *user, struct Entity *target, struct Move *move, bool32 hasStatusChecker); -s32 WeightMove(struct Entity *user, s32 targetingFlags, struct Entity *target, u32 moveType); -bool8 TargetRegularAttack(struct Entity *pokemon, u32 *targetDir, bool8 checkPetrified); -bool8 IsTargetInRange(struct Entity *pokemon, struct Entity *targetPokemon, s32 direction, s32 maxRange); +void DecideAttack(Entity *pokemon); +s32 AIConsiderMove(struct AIPossibleMove *aiPossibleMove, Entity *pokemon, Move *move); +bool8 IsTargetInLineRange(Entity *user, Entity *target, s32 range); +s32 TryAddTargetToAITargetList(s32 numPotentialTargets, s32 targetingFlags, Entity *user, Entity *target, Move *move, u32 hasStatusChecker); +bool8 IsAITargetEligible(s32 targetingFlags, Entity *user, Entity *target, Move *move, bool32 hasStatusChecker); +s32 WeightMove(Entity *user, s32 targetingFlags, Entity *target, u32 moveType); +bool8 TargetRegularAttack(Entity *pokemon, u32 *targetDir, bool8 checkPetrified); +bool8 IsTargetInRange(Entity *pokemon, Entity *targetPokemon, s32 direction, s32 maxRange); #endif diff --git a/include/dungeon_ai_item_weight.h b/include/dungeon_ai_item_weight.h index 4e6fddac3..a612a98d5 100644 --- a/include/dungeon_ai_item_weight.h +++ b/include/dungeon_ai_item_weight.h @@ -3,7 +3,7 @@ #include "dungeon_entity.h" -u32 EvaluateItem(struct Entity *targetPokemon, struct Item *item, u32 itemTargetFlags); -bool8 CanTargetAdjacentPokemon(struct Entity *pokemon); +u32 EvaluateItem(Entity *targetPokemon, Item *item, u32 itemTargetFlags); +bool8 CanTargetAdjacentPokemon(Entity *pokemon); #endif diff --git a/include/dungeon_ai_items.h b/include/dungeon_ai_items.h index 01461cf25..10f9a0e17 100644 --- a/include/dungeon_ai_items.h +++ b/include/dungeon_ai_items.h @@ -4,9 +4,9 @@ #include "dungeon_entity.h" #include "position.h" -void DecideUseItem(struct Entity *pokemon); -void FindStraightThrowableTargets(struct Entity *pokemon, s32 thrownAIFlag, struct Item *item, bool8 ignoreRollChance); -void FindRockItemTargets(struct Entity *pokemon, struct Item *item, struct Position potentialTargets[], bool8 ignoreRollChance); -void TargetThrownItem(struct Entity *pokemon, struct Entity *targetPokemon, struct Item *item, s32 targetingFlags, bool8 ignoreRollChance); +void DecideUseItem(Entity *pokemon); +void FindStraightThrowableTargets(Entity *pokemon, s32 thrownAIFlag, Item *item, bool8 ignoreRollChance); +void FindRockItemTargets(Entity *pokemon, Item *item, Position potentialTargets[], bool8 ignoreRollChance); +void TargetThrownItem(Entity *pokemon, Entity *targetPokemon, Item *item, s32 targetingFlags, bool8 ignoreRollChance); #endif diff --git a/include/dungeon_ai_leader.h b/include/dungeon_ai_leader.h index b069b54bd..a62688e4d 100644 --- a/include/dungeon_ai_leader.h +++ b/include/dungeon_ai_leader.h @@ -3,7 +3,7 @@ #include "dungeon_entity.h" -bool8 TargetLeader(struct Entity *pokemon); -struct Entity* GetLeaderIfVisible(struct Entity *pokemon); +bool8 TargetLeader(Entity *pokemon); +Entity* GetLeaderIfVisible(Entity *pokemon); #endif diff --git a/include/dungeon_ai_movement.h b/include/dungeon_ai_movement.h index 7d5698768..dd8e877fd 100644 --- a/include/dungeon_ai_movement.h +++ b/include/dungeon_ai_movement.h @@ -3,11 +3,11 @@ #include "dungeon_entity.h" -void MoveIfPossible(struct Entity *pokemon, bool8 showRunAwayEffect); -bool8 CanTakeItem(struct Entity *pokemon); -bool8 ChooseTargetPosition(struct Entity *pokemon); -void DecideMovement(struct Entity *pokemon, bool8 showRunAwayEffect); -bool8 AvoidEnemies(struct Entity *pokemon); -bool8 Wander(struct Entity *pokemon); +void MoveIfPossible(Entity *pokemon, bool8 showRunAwayEffect); +bool8 CanTakeItem(Entity *pokemon); +bool8 ChooseTargetPosition(Entity *pokemon); +void DecideMovement(Entity *pokemon, bool8 showRunAwayEffect); +bool8 AvoidEnemies(Entity *pokemon); +bool8 Wander(Entity *pokemon); #endif diff --git a/include/dungeon_ai_targeting.h b/include/dungeon_ai_targeting.h index d2b105e96..f0509ea61 100644 --- a/include/dungeon_ai_targeting.h +++ b/include/dungeon_ai_targeting.h @@ -3,14 +3,14 @@ #include "dungeon_entity.h" -bool8 CanAttackInDirection(struct Entity *pokemon, s32 direction); -bool8 CanAIMonsterMoveInDirection(struct Entity *pokemon, s32 direction, bool8 *pokemonInFront); -bool8 IsAtJunction(struct Entity *pokemon); -bool8 ShouldAvoidFirstHit(struct Entity *pokemon, bool8 forceAvoid); -bool8 ShouldMonsterRunAway(struct Entity *pokemon); -bool8 ShouldMonsterRunAwayAndShowEffect(struct Entity *pokemon, bool8 showRunAwayEffect); -void CheckRunAwayVisualFlag(struct Entity *pokemon, bool8 showRunAwayEffect); -u8 CanTarget(struct Entity *pokemon, struct Entity *targetPokemon, bool8 ignoreInvisible, bool8 checkPetrified); -u8 sub_807167C(struct Entity * pokemon, struct Entity * target); +bool8 CanAttackInDirection(Entity *pokemon, s32 direction); +bool8 CanAIMonsterMoveInDirection(Entity *pokemon, s32 direction, bool8 *pokemonInFront); +bool8 IsAtJunction(Entity *pokemon); +bool8 ShouldAvoidFirstHit(Entity *pokemon, bool8 forceAvoid); +bool8 ShouldMonsterRunAway(Entity *pokemon); +bool8 ShouldMonsterRunAwayAndShowEffect(Entity *pokemon, bool8 showRunAwayEffect); +void CheckRunAwayVisualFlag(Entity *pokemon, bool8 showRunAwayEffect); +u8 CanTarget(Entity *pokemon, Entity *targetPokemon, bool8 ignoreInvisible, bool8 checkPetrified); +u8 sub_807167C(Entity * pokemon, Entity * target); #endif diff --git a/include/dungeon_capabilities.h b/include/dungeon_capabilities.h index 27aa7089a..fa0ee214d 100644 --- a/include/dungeon_capabilities.h +++ b/include/dungeon_capabilities.h @@ -3,11 +3,11 @@ #include "dungeon_entity.h" -bool8 CannotMove(struct Entity *pokemon, bool8 checkBlinker); -bool8 sub_8070BC0(struct Entity* entity); -bool8 CannotUseItems(struct Entity *pokemon); -bool8 HasStatusThatPreventsActing(struct Entity *pokemon); -bool8 CannotAttack(struct Entity *pokemon, bool8 skipSleep); -bool8 CanMoveInDirection(struct Entity *pokemon, u32 direction); +bool8 CannotMove(Entity *pokemon, bool8 checkBlinker); +bool8 sub_8070BC0(Entity* entity); +bool8 CannotUseItems(Entity *pokemon); +bool8 HasStatusThatPreventsActing(Entity *pokemon); +bool8 CannotAttack(Entity *pokemon, bool8 skipSleep); +bool8 CanMoveInDirection(Entity *pokemon, u32 direction); #endif diff --git a/include/dungeon_entity.h b/include/dungeon_entity.h index 0df119344..76f7ff7e7 100644 --- a/include/dungeon_entity.h +++ b/include/dungeon_entity.h @@ -3,7 +3,7 @@ #include "constants/global.h" #include "constants/move.h" -#include "item.h" +#include "items.h" #include "position.h" #include "sprite.h" @@ -24,7 +24,7 @@ #define STAT_STAGE_EVASION 1 // size: 0x18 -struct ActionContainer +typedef struct ActionContainer { /* 0x0 */ u16 action; /* 0x2 */ u8 direction; @@ -32,16 +32,16 @@ struct ActionContainer // Additional parameter alongside actionIndex. Used for things like indicating which move a Pokémon should use from its moveset. /* 0x4 */ u8 actionUseIndex; // Position of the Pokémon the last time it threw an item. - /* 0x8 */ struct Position lastItemThrowPosition; + /* 0x8 */ Position lastItemThrowPosition; u8 unkC; u8 fillD[3]; u8 fill10[4]; // Position of the target that the Pokémon wants throw an item at. - /* 0x14 */ struct Position itemTargetPosition; -}; + /* 0x14 */ Position itemTargetPosition; +} ActionContainer; // size: 0x208 -struct EntityInfo +typedef struct EntityInfo { // This has different purposes for Pokémon, items, and traps. // Pokemon: MovementFlag @@ -85,12 +85,12 @@ struct EntityInfo /* 0x3E */ u8 hiddenPowerType; u8 fill3F; /* 0x40 */ u8 joinedAt; // Uses the dungeon index in dungeon.h. - /* 0x44 */ struct ActionContainer action; + /* 0x44 */ ActionContainer action; /* 0x5C */ u8 types[2]; /* 0x5E */ u8 abilities[2]; - /* 0x60 */ struct Item heldItem; + /* 0x60 */ Item heldItem; u8 fill64[0x68 - 0x64]; - /* 0x68 */ struct Position prevPos[NUM_PREV_POS]; + /* 0x68 */ Position prevPos[NUM_PREV_POS]; /* 0x78 */ u8 aiObjective; /* 0x79 */ bool8 aiNotNextToTarget; /* 0x7A */ bool8 aiTargetingEnemy; @@ -98,7 +98,7 @@ struct EntityInfo /* 0x7C */ u16 aiTargetSpawnGenID; /* 0x80 */ struct Entity *aiTarget; u8 fill84[0x88 - 0x84]; - /* 0x88 */ struct Position aiTargetPos; + /* 0x88 */ Position aiTargetPos; // Bitwise flags corresponding to selected IQ skills. /* 0x8C */ u8 IQSkillMenuFlags[4]; // IQ skills selected in the IQ skills menu. /* 0x90 */ u8 IQSkillFlags[4]; @@ -191,7 +191,7 @@ struct EntityInfo // When non-zero, an AI Pokémon will move in a random direction every turn when it is a room. // There is a chance of this flag being set when a wild Pokémon spawns. The chance depends on the dungeon's randomMovementChance. /* 0x114 */ u32 moveRandomly; - /* 0x118 */ struct Move moves[MAX_MON_MOVES]; + /* 0x118 */ Move moves[MAX_MON_MOVES]; /* 0x138 */ u8 struggleMoveFlags; /* 0x13C */ u32 belly; /* 0x140 */ u32 maxBelly; @@ -228,17 +228,17 @@ struct EntityInfo /* 0x167 */ u8 unk167; /* 0x168 */ u8 unk168; /* 0x169 */ u8 turnsSinceWarpScarfActivation; - /* 0x16C */ struct Position targetPos; - /* 0x170 */ struct Position pixelPos; + /* 0x16C */ Position targetPos; + /* 0x170 */ Position pixelPos; u32 unk174; u16 unk178; /* 0x17A */ u16 mimicMoveIDs[MAX_MON_MOVES]; // All moves that Mimic has copied (not sure on size...) // Previous value of targetPosition for movement, 1 and 2 moves ago. - /* 0x184 */ struct Position previousTargetMovePosition1; - /* 0x188 */ struct Position32 previousTargetMovePosition2; + /* 0x184 */ Position previousTargetMovePosition1; + /* 0x188 */ Position32 previousTargetMovePosition2; /* 0x190 */ u8 lastMoveDirection; // The last direction that the Pokémon moved in. // Number of tiles that the Pokémon moved last, multiplied by 0x100. - /* 0x194 */ struct Position32 lastMoveIncrement; + /* 0x194 */ Position32 lastMoveIncrement; /* 0x19C */ u8 walkAnimFramesLeft; // Set when the Pokémon starts moving, and counts down until the Pokémon's walk animation stops. u8 fill19D[0x1F4 - 0x19D]; /* 0x1F4 */ u8 numMoveTiles; // Number of tiles to move in a turn. Can be greater than 1 if the user's movement speed is boosted. @@ -249,18 +249,18 @@ struct EntityInfo /* 0x1FC */ u16 expGainedInTurn; // Used to accumulate experience when multiple enemies are defeated in one turn. /* 0x200 */ u32 statusIcons; u8 unk204; -}; +} EntityInfo; // size: 0x74 | Used for Pokémon, items, and traps. -struct Entity +typedef struct Entity { /* 0x0 */ u32 type; - /* 0x4 */ struct Position pos; - /* 0x8 */ struct Position prevPos; + /* 0x4 */ Position pos; + /* 0x8 */ Position prevPos; // The center of the entity acccording to pixel-space coordinates, using the same origin as posWorld. // X = (posWorld * 24 + 16) * 256, while Y = (posWorld * 24 + 12) * 256. - /* 0xC */ struct Position32 pixelPos; - /* 0x14 */ struct Position32 prevPixelPos; + /* 0xC */ Position32 pixelPos; + /* 0x14 */ Position32 prevPixelPos; s32 unk1C; /* 0x20 */ bool8 isVisible; // Turned off when a Pokémon faints. u8 fill21; @@ -271,8 +271,8 @@ struct Entity // The global spawn index counter starts at 10. Each Pokémon that spawns increments the counter and // gets assigned the current counter value as its spawn index. /* 0x26 */ u16 spawnGenID; - /* 0x28*/ struct EntitySpriteInfo spriteInfo; - struct OpenedFile *sprite; + /* 0x28*/ EntitySpriteInfo spriteInfo; + OpenedFile *sprite; s16 unk68; u8 unk6A; u8 unk6B; @@ -280,8 +280,8 @@ struct Entity /* 0x6D */ u8 direction2; // Duplicate of 0x6C? u8 unk6E; u8 unk6F; - /* 0x70 */ struct EntityInfo *info; -}; + /* 0x70 */ EntityInfo *info; +} Entity; enum EntityType { diff --git a/include/dungeon_global_data.h b/include/dungeon_global_data.h index 174685e37..d41e27026 100644 --- a/include/dungeon_global_data.h +++ b/include/dungeon_global_data.h @@ -14,32 +14,30 @@ #define DUNGEON_MAX_WILD_POKEMON 16 #define DUNGEON_MAX_POKEMON MAX_TEAM_MEMBERS + DUNGEON_MAX_WILD_POKEMON -extern struct Dungeon *gDungeon; - // size: 0x4 -struct DungeonLocation +typedef struct DungeonLocation { /* 0x0 */ u8 id; /* 0x1 */ u8 floor; -}; +} DungeonLocation; // size: 0x4 -struct Dungeon_sub +typedef struct Dungeon_sub { u8 unk0; u8 unk1; u8 unk2; -}; +} Dungeon_sub; // size: 0x30 -struct unkDungeonGlobal_unk1CE98_sub +typedef struct unkDungeonGlobal_unk1CE98_sub { /* 0x0 */ u8 buffer1[10]; /* 0xA */ u8 buffer2[10]; /* 0x14 */ s16 moveID; /* 0x16 */ u8 fill16[0x2]; - /* 0x18 */ struct DungeonLocation dungeonLocation; - /* 0x1C */ struct Item heldItem; + /* 0x18 */ DungeonLocation dungeonLocation; + /* 0x1C */ Item heldItem; /* 0x20 */ u32 exp; /* 0x24 */ s16 maxHPStat; /* 0x26 */ u8 atk; @@ -52,10 +50,10 @@ struct unkDungeonGlobal_unk1CE98_sub /* 0x2D */ u8 defBoost; /* 0x2E */ u8 spDefBoost; u8 unk2F; // speedBoost? -}; +} unkDungeonGlobal_unk1CE98_sub; // size: 0x10 -struct DungeonMusicPlayer +typedef struct DungeonMusicPlayer { /* 0x0 */ u32 state; /* 0x4 */ u32 fadeOutSpeed; @@ -63,10 +61,10 @@ struct DungeonMusicPlayer /* 0xA */ u16 songIndex; /* 0xC */ u16 pastSongIndex; /* 0xE */ u16 queuedSongIndex; -}; +} DungeonMusicPlayer; // size: 0x1CEDC -struct Dungeon +typedef struct Dungeon { u8 unk0; u8 unk1; @@ -85,16 +83,16 @@ struct Dungeon u8 unk11; s16 unk12; u8 fill14[0xB8 - 0x14]; - struct Entity *unkB8; - struct Entity *unkBC; + Entity *unkB8; + Entity *unkBC; u8 fillC0[0x16D - 0xC0]; u8 unk16D; u8 fill16E[0x179 - 0x16E]; /* 0x179 */ bool8 pokemonExposed; // True if a Pokémon on the floor has the Exposed status. u8 fill17A[0x17C - 0x17A]; - struct Dungeon_sub unk17C[0x100]; + Dungeon_sub unk17C[0x100]; /* 0x57C */ u8 fill57C[0x644 - 0x57c]; - /* 0x644 */ struct DungeonLocation dungeonLocation; + /* 0x644 */ DungeonLocation dungeonLocation; u8 fill646[0x654 - 0x648]; u8 unk654; u8 fill655[0x65C - 0x655]; @@ -126,7 +124,7 @@ struct Dungeon u8 fill68B[0x699 - 0x68B]; u8 unk699; u8 fill69A[0x69C - 0x69A]; - /* 0x69C */ struct EntityInfo unk69C[4]; + /* 0x69C */ EntityInfo unk69C[4]; u8 fillEBC[0x363C - 0xEBC]; /* 0x363C */ u8 expYieldRankings[NUM_MONSTERS]; u8 fill37D9[0x37F0 - 0x37D9]; @@ -147,9 +145,9 @@ struct Dungeon /* 0x3A10 */ u16 unk3A10; u8 fill3A10[0x3A14 - 0x3A12]; /* 0x3A14 */ s16 bossBattleIndex; - /* 0x3A18 */ struct Tile tiles[DUNGEON_MAX_SIZE_Y][DUNGEON_MAX_SIZE_X]; + /* 0x3A18 */ Tile tiles[DUNGEON_MAX_SIZE_Y][DUNGEON_MAX_SIZE_X]; u8 fillE218[0xE220 - 0xE218]; - struct Position unkE220[4]; + Position unkE220[4]; u8 unkE230[0xE23C - 0xE230]; s16 unkE23C; // x coord of some kind s16 unkE23E; // y coord of some kind @@ -168,13 +166,13 @@ struct Dungeon /* 0xE278 */ u8 waterSportTurns; /* 0xE279 */ bool8 nullifyWeather; // Air Lock and Cloud Nine toggle this to disable weather effects u8 fillE27A[0xE8C0 - 0xE27A]; - /* 0xE8C0 */ struct Tile* tilePointers[DUNGEON_MAX_SIZE_Y][DUNGEON_MAX_SIZE_X]; + /* 0xE8C0 */ Tile *tilePointers[DUNGEON_MAX_SIZE_Y][DUNGEON_MAX_SIZE_X]; u8 unk104C0; - /* 0x104C4 */ struct RoomData roomData[MAX_ROOM_COUNT]; + /* 0x104C4 */ RoomData roomData[MAX_ROOM_COUNT]; u8 fill10764[0x10844 - 0x10764]; /* 0x10844 */ s16 naturalJunctionListCounts[MAX_ROOM_COUNT]; u8 fill10874[0x10884 - 0x10874]; - /* 0x10884 */ struct Position naturalJunctionList[MAX_ROOM_COUNT][32]; // Arrays of room exits for each room. + /* 0x10884 */ Position naturalJunctionList[MAX_ROOM_COUNT][32]; // Arrays of room exits for each room. u8 fill11444[0x11884 - 0x11484]; u8 unk11884[0x1194]; u8 fill12A18[0x12C24 - 0x12A18]; @@ -189,28 +187,28 @@ struct Dungeon /* 0x13578 */ u8 unk13578; /* 0x13579 */ u8 unk13579; u8 fill1357A[0x1357C - 0x1357A]; - /* 0x1357C */ struct Entity *teamPokemon[MAX_TEAM_MEMBERS]; - /* 0x1358C */ struct Entity *wildPokemon[DUNGEON_MAX_WILD_POKEMON]; - /* 0x135CC */ struct Entity *allPokemon[DUNGEON_MAX_POKEMON]; // Contains both team and wild Pokémon - /* 0x1361C */ struct Entity *clientPokemon[0x40]; - /* 0x1371C */ struct Entity *unk1371C[0x40]; - /* 0x1381C */ struct Entity teamPokemonEntities[MAX_TEAM_MEMBERS]; - /* 0x139EC */ struct Entity wildPokemonEntities[DUNGEON_MAX_WILD_POKEMON]; - /* 0x1412C */ struct Entity clientPokemonEntities[0x40]; - /* 0x15E2C */ struct Entity unk15E2C[0x40]; - /* 0x17B2C */ struct Entity *lightningRodPokemon; - /* 0x17B30 */ struct Entity *snatchPokemon; + /* 0x1357C */ Entity *teamPokemon[MAX_TEAM_MEMBERS]; + /* 0x1358C */ Entity *wildPokemon[DUNGEON_MAX_WILD_POKEMON]; + /* 0x135CC */ Entity *allPokemon[DUNGEON_MAX_POKEMON]; // Contains both team and wild Pokémon + /* 0x1361C */ Entity *clientPokemon[0x40]; + /* 0x1371C */ Entity *unk1371C[0x40]; + /* 0x1381C */ Entity teamPokemonEntities[MAX_TEAM_MEMBERS]; + /* 0x139EC */ Entity wildPokemonEntities[DUNGEON_MAX_WILD_POKEMON]; + /* 0x1412C */ Entity clientPokemonEntities[0x40]; + /* 0x15E2C */ Entity unk15E2C[0x40]; + /* 0x17B2C */ Entity *lightningRodPokemon; + /* 0x17B30 */ Entity *snatchPokemon; /* 0x17B34 */ u8 fillunk1734[0x17B38 - 0x17B34]; /* 0x17B38 */ u32 unk17B38; /* 0x17B3C */ u32 unk17B3C; u8 fill17B40[0x17B44 - 0x17B40]; - /* 0x17B44 */ struct OpenedFile *sprites[MONSTER_MAX + 1]; - /* 0x181E4 */ struct OpenedFile *paletFile; - /* 0x181E8 */ struct Position cameraPos; - /* 0x181EC */ struct Position cameraPosMirror; - /* 0x181F0 */ struct Position cameraPixelPos; - /* 0x181F4 */ struct Position cameraPixelPosMirror; - /* 0x181F8 */ struct Entity *cameraTarget; + /* 0x17B44 */ OpenedFile *sprites[MONSTER_MAX + 1]; + /* 0x181E4 */ OpenedFile *paletFile; + /* 0x181E8 */ Position cameraPos; + /* 0x181EC */ Position cameraPosMirror; + /* 0x181F0 */ Position cameraPixelPos; + /* 0x181F4 */ Position cameraPixelPosMirror; + /* 0x181F8 */ Entity *cameraTarget; u32 unk181FC; u32 unk18200; u32 unk18204; @@ -231,9 +229,11 @@ struct Dungeon u8 fill1C57F[0x1C58B - 0x1C57F]; u8 unk1C58B; u8 fill1C58C[0x1CE98 - 0x1C58C]; - struct unkDungeonGlobal_unk1CE98_sub unk1CE98; // TODO: not sure how large this is + unkDungeonGlobal_unk1CE98_sub unk1CE98; // TODO: not sure how large this is u32 unk1CEC8; - /* 0x1CECC */ struct DungeonMusicPlayer musPlayer; -}; + /* 0x1CECC */ DungeonMusicPlayer musPlayer; +} Dungeon; + +extern Dungeon *gDungeon; #endif diff --git a/include/dungeon_items.h b/include/dungeon_items.h index 2d2d2d91a..3931919d2 100644 --- a/include/dungeon_items.h +++ b/include/dungeon_items.h @@ -3,6 +3,6 @@ #include "dungeon_entity.h" -bool8 HasHeldItem(struct Entity *pokemon, u8 id); +bool8 HasHeldItem(Entity *pokemon, u8 id); #endif diff --git a/include/dungeon_leader.h b/include/dungeon_leader.h index b30766dd1..a7cdf8598 100644 --- a/include/dungeon_leader.h +++ b/include/dungeon_leader.h @@ -1,7 +1,9 @@ #ifndef GUARD_DUNGEON_LEADER_H #define GUARD_DUNGEON_LEADER_H -struct Entity* GetLeader(); -struct EntityInfo* GetLeaderInfo(void); +#include "dungeon_entity.h" -#endif +Entity* GetLeader(void); +EntityInfo* GetLeaderInfo(void); + +#endif // GUARD_DUNGEON_LEADER_H \ No newline at end of file diff --git a/include/dungeon_map_access.h b/include/dungeon_map_access.h index 7d32f264e..c57be0e4b 100644 --- a/include/dungeon_map_access.h +++ b/include/dungeon_map_access.h @@ -3,12 +3,12 @@ #include "map.h" -struct unkStruct_202F190 +typedef struct unkStruct_202F190 { - struct Tile* unk0[6]; -}; + Tile *unk0[6]; +} unkStruct_202F190; -struct Tile* GetTile(s32 x, s32 y); -struct Tile* GetTileSafe(s32 x, s32 y); +Tile *GetTile(s32 x, s32 y); +Tile *GetTileSafe(s32 x, s32 y); #endif diff --git a/include/dungeon_movement.h b/include/dungeon_movement.h index 4e05707be..89052c951 100644 --- a/include/dungeon_movement.h +++ b/include/dungeon_movement.h @@ -5,12 +5,12 @@ u8 GetCrossableTerrain(s16 species); u8 sub_807034C(s16 id, struct Tile *tile); -u8 sub_80703A0(struct Entity *pokemon, struct Position *pos); -bool8 CanCrossWalls(struct Entity *pokemon); -bool8 sub_807049C(struct Entity *pokemon, struct Position *pos); -bool8 sub_8070564(struct Entity *pokemon, struct Position *pos); -bool8 sub_80705F0(struct Entity *pokemon, struct Position *pos); -bool8 sub_80706A4(struct Entity *pokemon, struct Position *pos); -s32 CalcSpeedStage(struct Entity *pokemon); +u8 sub_80703A0(Entity *pokemon, Position *pos); +bool8 CanCrossWalls(Entity *pokemon); +bool8 sub_807049C(Entity *pokemon, Position *pos); +bool8 sub_8070564(Entity *pokemon, Position *pos); +bool8 sub_80705F0(Entity *pokemon, Position *pos); +bool8 sub_80706A4(Entity *pokemon, Position *pos); +s32 CalcSpeedStage(Entity *pokemon); #endif diff --git a/include/dungeon_pokemon_attributes.h b/include/dungeon_pokemon_attributes.h index 04e28c41f..47d70b072 100644 --- a/include/dungeon_pokemon_attributes.h +++ b/include/dungeon_pokemon_attributes.h @@ -3,18 +3,18 @@ #include "dungeon_entity.h" -bool8 HasSafeguardStatus(struct Entity * param_1, struct Entity * param_2, bool8 displayMessage); -bool8 sub_80717A4(struct Entity *pokemon, u16 moveID); -bool8 HasAbility(struct Entity *pokemon, u8 ability); -bool8 MonsterIsType(struct Entity *pokemon, u8 type); -bool8 CanSeeInvisibleMonsters(struct Entity *pokemon); -bool8 HasTactic(struct Entity *pokemon, u8 tactic); -bool8 IQSkillIsEnabled(struct Entity *pokemon, u8 IQSkill); -void LoadIQSkills(struct Entity *pokemon); -bool8 CanSeeTeammate(struct Entity * pokemon); -u8 GetMoveTypeForMonster(struct Entity *pokemon, struct Move *pokeMove); -s32 GetMovePower(struct Entity *pokemon, struct Move *pokeMove); -bool8 ToolboxEnabled(struct EntityInfo *pokemon); -bool8 SetVisualFlags(struct EntityInfo *entityInfo, u16 newFlag, bool8 param_3); +bool8 HasSafeguardStatus(Entity * param_1, Entity * param_2, bool8 displayMessage); +bool8 sub_80717A4(Entity *pokemon, u16 moveID); +bool8 HasAbility(Entity *pokemon, u8 ability); +bool8 MonsterIsType(Entity *pokemon, u8 type); +bool8 CanSeeInvisibleMonsters(Entity *pokemon); +bool8 HasTactic(Entity *pokemon, u8 tactic); +bool8 IQSkillIsEnabled(Entity *pokemon, u8 IQSkill); +void LoadIQSkills(Entity *pokemon); +bool8 CanSeeTeammate(Entity * pokemon); +u8 GetMoveTypeForMonster(Entity *pokemon, Move *pokeMove); +s32 GetMovePower(Entity *pokemon, Move *pokeMove); +bool8 ToolboxEnabled(EntityInfo *pokemon); +bool8 SetVisualFlags(EntityInfo *entityInfo, u16 newFlag, bool8 param_3); #endif diff --git a/include/dungeon_pokemon_sprites.h b/include/dungeon_pokemon_sprites.h index fe934e282..62da2adfe 100644 --- a/include/dungeon_pokemon_sprites.h +++ b/include/dungeon_pokemon_sprites.h @@ -3,37 +3,40 @@ #include "position.h" -struct DungeonPokemonStatusSprite +// size: 0x8 +typedef struct DungeonPokemonStatusSprite { - u32 status; - u32 frame; -}; + /* 0x0 */ u32 status; + /* 0x4 */ u32 frame; +} DungeonPokemonStatusSprite; -struct DungeonPokemonSprite +// size: 0x40 +typedef struct DungeonPokemonSprite { - /* 0x0000 */ u8 exists; - /* 0x0004 */ u32 id; - /* 0x0008 */ u16 species; // Or sprite ID? - /* 0x000A */ u16 unkA; - /* 0x000C */ u32 status; - /* 0x0010 */ u8 visible; - /* 0x0011 */ u8 unk11; - /* 0x0014 */ struct Position pos; - /* 0x0018 */ struct Position statusOffsets[2]; - /* 0x0020 */ u32 unk20; - /* 0x0024 */ u32 unk24; - /* 0x0028 */ struct DungeonPokemonStatusSprite statusSprites[2]; - /* 0x0038 */ u8 unk38; - /* 0x003C */ u16 unk3C; - /* 0x003E */ u16 unk3E; -} + /* 0x0 */ u8 exists; + /* 0x4 */ u32 id; + /* 0x8 */ u16 species; // Or sprite ID? + /* 0xA */ u16 unkA; + /* 0xC */ u32 status; + /* 0x10 */ u8 visible; + /* 0x11 */ u8 unk11; + /* 0x14 */ Position pos; + /* 0x18 */ Position statusOffsets[2]; + /* 0x20 */ u32 unk20; + /* 0x24 */ u32 unk24; + /* 0x28 */ DungeonPokemonStatusSprite statusSprites[2]; + /* 0x38 */ u8 unk38; + /* 0x3C */ u16 unk3C; + /* 0x3E */ u16 unk3E; +} DungeonPokemonSprite; -struct DungeonPokemonSprites +// size: 0x584 +typedef struct DungeonPokemonSprites { - u32 frame; - struct DungeonPokemonSprites sprites[22]; -}; + /* 0x0 */ u32 frame; + /* 0x4 */ struct DungeonPokemonSprites sprites[22]; +} DungeonPokemonSprites; -extern struct DungeonPokemonSprites *gDungeonPokemonSprites; +extern DungeonPokemonSprites *gDungeonPokemonSprites; -#endif +#endif // GUARD_DUNGEON_POKEMON_SPRITES_H \ No newline at end of file diff --git a/include/dungeon_range.h b/include/dungeon_range.h index 9f3961009..7cb1b1cc6 100644 --- a/include/dungeon_range.h +++ b/include/dungeon_range.h @@ -3,8 +3,8 @@ #include "position.h" -bool8 IsPositionActuallyInSight(struct Position *pos1, struct Position *pos2); -bool8 IsPositionInSight(struct Position *pos1, struct Position *pos2); -bool8 IsTargetTwoTilesAway(struct Position *pos1, struct Position *pos2); +bool8 IsPositionActuallyInSight(Position *pos1, Position *pos2); +bool8 IsPositionInSight(Position *pos1, Position *pos2); +bool8 IsTargetTwoTilesAway(Position *pos1, Position *pos2); #endif diff --git a/include/dungeon_util.h b/include/dungeon_util.h index d744cef25..73e01a0aa 100644 --- a/include/dungeon_util.h +++ b/include/dungeon_util.h @@ -5,14 +5,14 @@ #include "dungeon_entity.h" #include "position.h" -extern const struct Position gAdjacentTileOffsets[NUM_DIRECTIONS]; +extern const Position gAdjacentTileOffsets[NUM_DIRECTIONS]; -bool8 EntityExists(struct Entity *pokemon); -u32 GetEntityType(struct Entity *entity); -u8 GetEntityRoom(struct Entity *entity); -struct EntityInfo *GetTrapData(struct Entity *entity); -struct Item *GetItemData(struct Entity *entity); -struct Tile *GetTileAtEntitySafe(struct Entity *entity); -struct Item *GetItemData_1(struct Entity *entity); +bool8 EntityExists(Entity *pokemon); +u32 GetEntityType(Entity *entity); +u8 GetEntityRoom(Entity *entity); +EntityInfo *GetTrapData(Entity *entity); +Item *GetItemData(Entity *entity); +struct Tile *GetTileAtEntitySafe(Entity *entity); +Item *GetItemData_1(Entity *entity); #endif diff --git a/include/dungeon_util_1.h b/include/dungeon_util_1.h index 22c39c81a..61d791807 100644 --- a/include/dungeon_util_1.h +++ b/include/dungeon_util_1.h @@ -3,20 +3,20 @@ #include "dungeon_entity.h" -struct Entity *xxx_call_GetLeader(void); -struct Entity *GetPartnerEntity(void); +Entity *xxx_call_GetLeader(void); +Entity *GetPartnerEntity(void); void sub_80854D4(void); -struct Entity *GetEntityFromClientType(u8 entityType); -void sub_80856C8(struct Entity * pokemon, s32 x, s32 y); -void sub_80856E0(struct Entity * pokemon, s32 direction); +Entity *GetEntityFromClientType(u8 entityType); +void sub_80856C8(Entity * pokemon, s32 x, s32 y); +void sub_80856E0(Entity * pokemon, s32 direction); void sub_8085764(void); void sub_8085860(s32 x, s32 y); void sub_8085890(s32 x, s32 y); -void ShiftCameraToPosition(struct Position32 *posStruct, s32 cameraSteps); -void SetFacingDirection(struct Entity *pokemon, s32 direction); +void ShiftCameraToPosition(Position32 *posStruct, s32 cameraSteps); +void SetFacingDirection(Entity *pokemon, s32 direction); void sub_8085930(s32 direction); void sub_80859F0(s32 direction); -bool8 IsMovingClient(struct Entity *entity); -void sub_8085B0C(struct Entity *pokemon); +bool8 IsMovingClient(Entity *entity); +void sub_8085B0C(Entity *pokemon); #endif diff --git a/include/dungeon_visibility.h b/include/dungeon_visibility.h index 9864a87b5..15bd0df65 100644 --- a/include/dungeon_visibility.h +++ b/include/dungeon_visibility.h @@ -3,10 +3,10 @@ #include "dungeon_entity.h" -bool8 CanSeeTarget(struct Entity *entity, struct Entity *targetEntity); -bool8 CanTargetEntity(struct Entity *entity, struct Entity *targetEntity); -bool8 sub_8045A70(struct Entity *entity, struct Entity *targetEntity); -bool8 sub_8045AAC(struct Entity *entity, struct Position *pos); -bool8 CanTargetPosition(struct Entity *entity, struct Position *pos); +bool8 CanSeeTarget(Entity *entity, Entity *targetEntity); +bool8 CanTargetEntity(Entity *entity, Entity *targetEntity); +bool8 sub_8045A70(Entity *entity, Entity *targetEntity); +bool8 sub_8045AAC(Entity *entity, Position *pos); +bool8 CanTargetPosition(Entity *entity, Position *pos); #endif diff --git a/include/event_flag.h b/include/event_flag.h index 0fd643364..8bda1139d 100644 --- a/include/event_flag.h +++ b/include/event_flag.h @@ -1,13 +1,13 @@ #ifndef GUARD_EVENT_FLAG_H #define GUARD_EVENT_FLAG_H +// size: 0x8 struct UnkEventStruct { /* 0x0 */ s16 *unk0; /* 0x4 */ u8 *unk4; }; - void sub_8001B88(s32 param_1,u32 *param_2,u32 *param_3); void ScenarioCalc(s16 param_1, s32 param_2, s32 param_3); bool8 sub_8001CC4(s16 param_1, u32 param_2, s32 param_3); @@ -32,4 +32,7 @@ bool8 sub_8002718(u8 *r0); void sub_8002758(s32 r0); u8 sub_800276C(void); +// event_flag.s +extern u32 sub_8001658(u32, u32); + #endif // GUARD_EVENT_FLAG_H diff --git a/include/felicity_bank.h b/include/felicity_bank.h index 9241bf7d9..94286b2d1 100644 --- a/include/felicity_bank.h +++ b/include/felicity_bank.h @@ -13,7 +13,7 @@ struct FelicityBankWork /* 0x8 */ u32 fallbackState; /* 0xC */ u32 chosenAmount; /* 0x10 */ u32 menuAction; - struct MenuItem unk14[8]; + MenuItem unk14[8]; u16 unk54[8]; u32 unk64; s32 unk68; @@ -21,11 +21,11 @@ struct FelicityBankWork /* 0x70 */ s32 maximumDepositWithdraw; s32 unk74; u32 unk78; - struct UnkTextStruct2 *unk7C; + UnkTextStruct2 *unk7C; s32 unk80; s32 unk84; u8 fill88[0x94 - 0x88]; - /* 0x94 */ struct OpenedFile *faceFile; + /* 0x94 */ OpenedFile *faceFile; /* 0x98 */ u8 *faceData; u16 unk9C; u16 unk9E; @@ -33,8 +33,8 @@ struct FelicityBankWork u8 unkA1; u8 unkA2; u8 unkA3; - struct OpenedFile **unkA4; - struct UnkTextStruct2 unkA8[4]; + OpenedFile **unkA4; + UnkTextStruct2 unkA8[4]; }; extern struct FelicityBankWork *gFelicityBankWork; diff --git a/include/file_system.h b/include/file_system.h index 8ce24a15e..2f41b630c 100644 --- a/include/file_system.h +++ b/include/file_system.h @@ -2,48 +2,48 @@ #define GUARD_FILE_SYSTEM_H // size: 0x8 -struct File +typedef struct File { /* 0x0 */ char *name; /* 0x4 */ u8 *data; -}; +} File; // size: 0x8 -struct OpenedFile +typedef struct OpenedFile { - /* 0x0 */ struct File *file; + /* 0x0 */ File *file; /* 0x4 */ u8 *data; -}; +} OpenedFile; // size: 0x10 -struct FileArchive +typedef struct FileArchive { /* 0x0 */ char magic[8]; /* 0x8 */ s32 count; - /* 0xC */ struct File *entries; -}; + /* 0xC */ File *entries; +} FileArchive; // size: 0x8 -struct SiroArchive +typedef struct SiroArchive { /* 0x0 */ u32 magic; /* 0x4 */ u8 *data; -}; +} SiroArchive; // size: 0x8 -struct UnkFileStruct1 +typedef struct UnkFileStruct { - u32 unk0; - u32 unk4; -}; + /* 0x0 */ u32 unk0; + /* 0x4 */ u32 unk4; +} UnkFileStruct; +OpenedFile *Call_OpenFileAndGetFileDataPtr(const u8 *filename, const FileArchive *arc); +void CloseFile(OpenedFile *openedFile); +u8 *GetFileDataPtr(OpenedFile *openedFile, s32 unused); void InitFileSystem(void); -struct OpenedFile *OpenFile(const char *filename, const struct FileArchive *arc); -u8 *GetFileDataPtr(struct OpenedFile *openedFile, int unused); -struct OpenedFile *OpenFileAndGetFileDataPtr(const char *filename, const struct FileArchive *arc); -struct OpenedFile *Call_OpenFileAndGetFileDataPtr(const char *filename, const struct FileArchive *arc); -u32 DecompressATFile(char *result, s32 resultLength, struct OpenedFile *file); -void CloseFile(struct OpenedFile *openedFile); -u32 DecompressATGlobalFile(u32 *result, s32 resultLength, struct OpenedFile *file); +OpenedFile *OpenFile(const u8 *filename, const FileArchive *arc); +OpenedFile *OpenFileAndGetFileDataPtr(const u8 *filename, const FileArchive *arc); + +u32 sub_800A8F8(u32 value); #endif //GUARD_FILE_SYSTEM_H diff --git a/include/friend_area.h b/include/friend_area.h index 6d9c8b1e7..ffc3d7d7a 100644 --- a/include/friend_area.h +++ b/include/friend_area.h @@ -1,41 +1,44 @@ #ifndef GUARD_FRIEND_AREA_H #define GUARD_FRIEND_AREA_H -struct FriendAreaSettings +// size: 0x8 +typedef struct FriendAreaSettings { - s16 num_pokemon; - u16 unlock_condition; - u32 price; -}; + /* 0x0 */ s16 num_pokemon; + /* 0x2 */ u16 unlock_condition; + /* 0x4 */ u32 price; +} FriendAreaSettings; -struct unkStruct_8092638 +// size: 0xC +typedef struct unkStruct_8092638 { /* 0x0 */ s16 numPokemon; s16 unk2; /* 0x4 */ bool8 hasFriendArea; - u8 fill5[3]; s32 unk8; -}; +} unkStruct_8092638; extern bool8 *gFriendAreas; -void LoadFriendAreas(void); bool8 *GetBoughtFriendAreas(void); -void InitializeFriendAreas(void); -u8 sub_80923D4(s32 target); -void sub_809249C(u8 friendArea, bool8 clear); -bool8 HasAllFriendAreas(void); -bool8 GetFriendAreaStatus(u8 index); -void UnlockFriendArea(u8 index); -u8 *GetFriendAreaDescription(u8 index); -u8 GetFriendAreaUnlockCondition(u8 index); +const u8 *GetFriendAreaDescription(u8 index); +const u8 *GetFriendAreaName(u8 index); s32 GetFriendAreaPrice(u8 index); +bool8 GetFriendAreaStatus(u8 index); +u8 GetFriendAreaUnlockCondition(u8 index); +bool8 HasAllFriendAreas(void); +void InitializeFriendAreas(void); +void LoadFriendAreas(void); +u32 ReadSavedFriendAreas(u8 *, s32 size); +u32 SaveFriendAreas(u8 *, u32 size); +void UnlockFriendArea(u8 index); + +u8 sub_80923D4(s32 target); +void sub_8092404(u8, u16 *, bool8, bool8); +void sub_809249C(u8 friendArea, bool8 clear); +void sub_8092558(u8 *buffer, u8 index); void sub_8092578(u8 *buffer, u8 index, bool8 printPrice); -const char *GetFriendAreaName(u8 index); -void sub_809249C(u8 friendArea, u8 clear); -void sub_8092638(u8 friendArea, struct unkStruct_8092638 *param_2, bool8 checkLeader, bool8 checkDungeon); +void sub_8092638(u8 friendArea, unkStruct_8092638 *, bool8 checkLeader, bool8 checkDungeon); +void sub_80926F8(u8, unkStruct_8092638 *, u8); -u32 SaveFriendAreas(u8 *r0, u32 r1); -u32 ReadSavedFriendAreas(u8 *r0, s32 r1); - -#endif +#endif // GUARD_FRIEND_AREA_H \ No newline at end of file diff --git a/include/friend_area_action_menu.h b/include/friend_area_action_menu.h index 742ef6cfe..7eb18c0b4 100644 --- a/include/friend_area_action_menu.h +++ b/include/friend_area_action_menu.h @@ -10,25 +10,25 @@ struct unkStruct_203B2BC s16 targetPoke; u16 unkA; u32 id; - struct BulkItem itemToGive; - struct BulkItem item2; - struct PokemonStruct *pokeStruct; + BulkItem itemToGive; + BulkItem item2; + PokemonStruct1 *pokeStruct; bool8 isTeamLeader; u32 moveIndex; // some sort of move index u16 moveID; - struct Move moves[8]; + Move moves[8]; u16 moveIDs[MAX_MON_MOVES]; // some list of move IDs u32 menuAction1; u32 menuAction2; u32 menuAction3; - struct MenuStruct unk7C; + MenuStruct unk7C; u8 fill80[0xFD - 0xCC]; u32 unkFD; u8 fill101[0x11C - 0x104]; - struct MenuItem menuItems[4]; + MenuItem menuItems[4]; u8 fill120[0x16C - 0x13C]; u16 unk16C[10]; - struct UnkTextStruct2 unk180[4]; + UnkTextStruct2 unk180[4]; }; enum FriendAreaActionMenuStates { diff --git a/include/friend_rescue.h b/include/friend_rescue.h index af2e5620d..a2201a8e0 100644 --- a/include/friend_rescue.h +++ b/include/friend_rescue.h @@ -2,30 +2,30 @@ #define GUARD_FRIEND_RESCUE_H #include "code_8094F88.h" -#include "item.h" +#include "items.h" #include "pokemon.h" #include "wonder_mail.h" #include "menu.h" // size: 0x568 -struct WonderMailStruct_203B33C +typedef struct WonderMailStruct_203B33C { /* 0x0 */ u32 state; /* 0x4 */ u32 fallbackState; /* 0x8 */ u8 passwordBuffer[0x36]; u32 unk40; /* 0x44 */ u32 status; - struct unkStruct_203B480 unk48; - struct unkStruct_203B480 unk78; - struct WonderMailStruct_203B2C0_sub unkA8; - struct WonderMailStruct_203B2C0_sub unk130; - struct unkStruct_203B480 unk1B8; - struct unkStruct_203B480 unk1E8; + unkStruct_203B480 unk48; + unkStruct_203B480 unk78; + WonderMailStruct_203B2C0_sub unkA8; + WonderMailStruct_203B2C0_sub unk130; + unkStruct_203B480 unk1B8; + unkStruct_203B480 unk1E8; u8 unk218; - struct MenuStruct unk21C[4]; - struct UnkTextStruct2 unk35C[4]; - struct UnkTextStruct2 unk3BC[4]; - /* 0x41C */ struct Item item; + MenuStruct unk21C[4]; + UnkTextStruct2 unk35C[4]; + UnkTextStruct2 unk3BC[4]; + /* 0x41C */ Item item; u32 unk420; // Is this supposed to be a File like 203B2C4? u8 unk424[0x100]; s32 unk524; @@ -36,9 +36,9 @@ struct WonderMailStruct_203B33C u32 unk530; u32 unk534; /* 0x538 */ s16 speciesNum; // A7 << 3 - struct unkStruct_802F204 unk53C; + unkStruct_802F204 unk53C; s32 unk564; -}; +} WonderMailStruct_203B33C; u32 CreateFriendRescueMenu(void); u32 UpdateFriendRescueMenu(void); diff --git a/include/game_options.h b/include/game_options.h index 3ad088855..cae7a7638 100644 --- a/include/game_options.h +++ b/include/game_options.h @@ -1,24 +1,7 @@ #ifndef GUARD_GAME_OPTIONS_H #define GUARD_GAME_OPTIONS_H -struct GameOptions -{ - // TODO: find where Controls/Touch Screen are in this structure in PMD Blue - - /* 0x0 */ u8 dungeonSpeed; - /* 0x1 */ u8 FarOffPals; - /* 0x2 */ bool8 damageTurn; - /* 0x3 */ bool8 gridEnable; - /* 0x4 */ u8 mapOption; - /* 0x5 */ u8 fill5[3]; - /* 0x8 */ u8 windowColor; - /* 0x9 */ u8 unk9; // maybe Controls? - /* 0xA */ u8 unkA; // maybe Touch Screen? - /* 0xB */ u8 playerGender; - /* 0xC */ u8 unkC; -}; - -enum DungeonSpeed +enum DungeonSpeed { DUNGEON_SPEED_SLOW, DUNGEON_SPEED_FAST, @@ -30,7 +13,6 @@ enum FarOffPals FAROFFPALS_LOCK, }; - // GBA has 3 options while DS has 7 enum MapOption { @@ -60,10 +42,26 @@ enum windowColor NUM_WINDOW_COLORS, }; +typedef struct GameOptions +{ + // TODO: find where Controls/Touch Screen are in this structure in PMD Blue + + /* 0x0 */ u8 dungeonSpeed; + /* 0x1 */ u8 FarOffPals; + /* 0x2 */ bool8 damageTurn; + /* 0x3 */ bool8 gridEnable; + /* 0x4 */ u8 mapOption; + /* 0x5 */ u8 fill5[3]; + /* 0x8 */ u8 windowColor; + /* 0x9 */ u8 unk9; // maybe Controls? + /* 0xA */ u8 unkA; // maybe Touch Screen? + /* 0xB */ u8 playerGender; + /* 0xC */ u8 unkC; +} GameOptions; + void LoadGameOptions(void); -struct GameOptions * GetGameOptions(void); +GameOptions * GetGameOptions(void); void InitializeGameOptions(bool8 initializeGender); -bool8 GameOptionsNotChange(struct GameOptions *r0); +bool8 GameOptionsNotChange(GameOptions *); - -#endif +#endif // GUARD_GAME_OPTIONS_H \ No newline at end of file diff --git a/include/ground_main.h b/include/ground_main.h new file mode 100644 index 000000000..d73b4da62 --- /dev/null +++ b/include/ground_main.h @@ -0,0 +1,16 @@ +#ifndef GUARD_GROUND_MAIN_H +#define GUARD_GROUND_MAIN_H + +// size: 0xC +typedef struct unkStruct_811BAF4 +{ + s16 unk0; + s16 unk2; + s16 unk4; + s16 unk6; + /* 0x8 */ u8 *text; +} unkStruct_811BAF4; + +bool8 sub_8098F88(void); + +#endif // GUARD_GROUND_MAIN_H \ No newline at end of file diff --git a/include/ground_map.h b/include/ground_map.h new file mode 100644 index 000000000..2ac30fd40 --- /dev/null +++ b/include/ground_map.h @@ -0,0 +1,19 @@ +#ifndef GUARD_GROUND_MAP_H +#define GUARD_GROUND_MAP_H + +// size: 0x55C +typedef struct unkStruct_3001B70 +{ + u8 fill0[0x55C - 0x0]; +} unkStruct_3001B70; + +extern unkStruct_3001B70 *gUnknown_3001B70; + +void GroundMap_Reset(void); + +void sub_80A4A7C(void); +void sub_80A4AC4(void); +void sub_80A4B38(void); +void sub_80A4B54(void); + +#endif // GUARD_GROUND_MAP_H \ No newline at end of file diff --git a/include/ground_map_1.h b/include/ground_map_1.h index e504d5538..47ca59213 100644 --- a/include/ground_map_1.h +++ b/include/ground_map_1.h @@ -1,6 +1,11 @@ #ifndef GUARD_GROUND_MAP_1_H #define GUARD_GROUND_MAP_1_H -bool8 sub_80A4D48(s16); +void GroundMap_ExecuteEnter(s16); +void GroundMap_ExecuteEvent(s16 scriptIndex, u32); +void GroundMap_ExecuteStation(s16, s16, s8, u32); + +bool8 sub_80A4D2C(s16); +bool8 sub_80A4D48(s16 index); #endif // GUARD_GROUND_MAP_1_H \ No newline at end of file diff --git a/include/ground_map_2.h b/include/ground_map_2.h new file mode 100644 index 000000000..1ba920a46 --- /dev/null +++ b/include/ground_map_2.h @@ -0,0 +1,30 @@ +#ifndef GUARD_GROUND_MAP_2_H +#define GUARD_GROUND_MAP_2_H + +// size: 0x24 +typedef struct unkStruct_3001B74 +{ + s16 unk0; + u8 unk2; + u32 unk4; + u32 unk8; + s32 unkC; + u32 unk10; + u32 unk14; + u32 unk18; + u32 unk1C; + u32 unk20; +} unkStruct_3001B74; + +void GroundWeather_Select(s16); +void nullsub_121(void); +void nullsub_122(void); +void nullsub_123(void); + +void sub_80A5E70(void); +void sub_80A5E8C(u8); +void sub_80A5EBC(void); +void sub_80A5EDC(u8); +void sub_80A60D8(void); + +#endif // GUARD_GROUND_MAP_2_H \ No newline at end of file diff --git a/include/ground_script.h b/include/ground_script.h index 5c0308e2b..f3090ad09 100644 --- a/include/ground_script.h +++ b/include/ground_script.h @@ -1,13 +1,16 @@ -struct GroundScript_ExecutePP_3 +#ifndef GUARD_GROUND_SCRIPT_H +#define GUARD_GROUND_SCRIPT_H + +typedef struct GroundScript_ExecutePP_3 { // size: 0xC u8 *scriptPointer; s16 scriptType; s16 unk6; u8 unk8; -}; +} GroundScript_ExecutePP_3; -struct GroundScript_ExecutePP_1_sub +typedef struct __attribute__((packed)) GroundScript_ExecutePP_1_sub { // size: 0x60 /* 0x0 */ s16 scriptType; @@ -24,25 +27,30 @@ struct GroundScript_ExecutePP_1_sub /* 0x24 */ u16 unk24; /* 0x26 */ u32 unk26; u8 fill50[0x60 - 0x2A]; -} __attribute__((packed)); +} GroundScript_ExecutePP_1_sub; typedef void (*Callback)(u32, void *); -struct GroundScript_ExecutePP_1_sub2 +typedef struct GroundScript_ExecutePP_1_sub2 { Callback callbacks[10]; // IDK the size.. -}; +} GroundScript_ExecutePP_1_sub2; // size: 0x110 -struct GroundScript_ExecutePP_1 +typedef struct GroundScript_ExecutePP_1 { - struct GroundScript_ExecutePP_1_sub2 *unk0; + GroundScript_ExecutePP_1_sub2 *unk0; u32 unk4; u32 fill8; u32 unkC; u16 unk10; u8 unk12; u8 *unk14[4]; - struct GroundScript_ExecutePP_1_sub unk24; - struct GroundScript_ExecutePP_1_sub unk84; + GroundScript_ExecutePP_1_sub unk24; + GroundScript_ExecutePP_1_sub unk84; u16 unkE4; -}; + u8 fillE8[0x110 - 0xE8]; +} GroundScript_ExecutePP_1; + +bool8 GroundScript_ExecutePP(GroundScript_ExecutePP_1 *, s32 *, GroundScript_ExecutePP_3 *, const DebugLocation *unused); + +#endif // GUARD_GROUND_SCRIPT_H \ No newline at end of file diff --git a/include/ground_sprite.h b/include/ground_sprite.h index 306be99a5..56ed89169 100644 --- a/include/ground_sprite.h +++ b/include/ground_sprite.h @@ -2,7 +2,7 @@ #define GUARD_GROUND_SPRITE_H // size: 0xC -struct unkStruct_2039DB0 +typedef struct unkStruct_2039DB0 { u16 unk0; s16 unk2; @@ -10,27 +10,29 @@ struct unkStruct_2039DB0 u16 unk6; u16 unk8; u16 unkA; -}; +} unkStruct_2039DB0; // size: 0xC -struct unkStruct_3001B7C_sub0 +typedef struct unkStruct_3001B7C_sub0 { u32 unk0; s32 unk4; u32 unk8; -}; +} unkStruct_3001B7C_sub0; + // size: 0x4 -struct unkStruct_3001B7C_sub108 +typedef struct unkStruct_3001B7C_sub108 { u16 unk0; s16 unk2; -}; +} unkStruct_3001B7C_sub108; + // size: 0x110 -struct unkStruct_3001B7C +typedef struct unkStruct_3001B7C { - struct unkStruct_3001B7C_sub0 unk0[22]; - struct unkStruct_3001B7C_sub108 unk108[2]; -}; + unkStruct_3001B7C_sub0 unk0[22]; + unkStruct_3001B7C_sub108 unk108[2]; +} unkStruct_3001B7C; void GroundSprite_Reset(s16); diff --git a/include/gulpin_shop.h b/include/gulpin_shop.h index 6bf6c5a60..c108eab7c 100644 --- a/include/gulpin_shop.h +++ b/include/gulpin_shop.h @@ -7,24 +7,24 @@ #include "text.h" // size: 0x18C -struct GulpinShopWork +typedef struct GulpinShopWork { /* 0x0 */ u32 isAsleep; /* 0x4 */ s32 state; u32 unk8; /* 0xC */ s16 speciesNum; // species of chosen Pokemon /* 0xE */ bool8 isNextMoveLinked; - /* 0x10 */ struct Move * moves; + /* 0x10 */ Move *moves; u16 unk14[4]; u16 unk1C; u16 unk1E; u32 unk20; u32 unk24; - struct MenuItem unk28[8]; + MenuItem unk28[8]; u16 unk68[8]; - struct MenuStruct unk78; + MenuStruct unk78; u8 fillC8[0x118 - 0xC8]; - /* 0x118 */ struct OpenedFile *faceFile; + /* 0x118 */ OpenedFile *faceFile; /* 0x11C */ u8 *faceData; u16 unk120; u16 unk122; @@ -32,12 +32,14 @@ struct GulpinShopWork u8 unk125; u8 unk126; u8 unk127; - struct OpenedFile **unk128; - struct UnkTextStruct2 unk12C[4]; -}; + OpenedFile **unk128; + UnkTextStruct2 unk12C[4]; +} GulpinShopWork; -u32 CreateGulpinShop(s32 isAsleep, s16 pokeSpecies, struct Move *moves); +bool8 CreateGulpinShop(s32 isAsleep, s16 pokeSpecies, Move *moves); void DestroyGulpinShop(void); bool8 GulpinIsNextMoveLinked(void); -#endif +u32 sub_801E8C0(void); + +#endif // GUARD_GULPIN_SHOP_H \ No newline at end of file diff --git a/include/gulpin_shop_801FB50.h b/include/gulpin_shop_801FB50.h new file mode 100644 index 000000000..68bc30ff6 --- /dev/null +++ b/include/gulpin_shop_801FB50.h @@ -0,0 +1,51 @@ +#ifndef GUARD_GULPIN_SHOP_801FB50_H +#define GUARD_GULPIN_SHOP_801FB50_H + +#include "constants/move.h" +#include "file_system.h" +#include "menu.h" +#include "pokemon.h" +#include "text.h" + +// size: 0x1E0 +typedef struct unkStruct_203B27C +{ + /* 0x0 */ bool32 isAsleep; + /* 0x4 */ s32 state; + /* 0x8 */ u32 fallbackState; + /* 0xC */ s16 speciesNum; + /* 0x10 */ PokemonStruct1 *pokeStruct; + /* 0x14 */ bool8 isNextMoveLinked; + bool8 unk15; + /* 0x16 */ bool8 isTeamLeader; + /* 0x18 */ u32 moveIndex; + // Group of move ids but not sure purpose just yet... + u16 unk1C; + u16 unk1E; + u16 unk20; + /* 0x24 */ Move moves[MAX_MON_MOVES * 2]; + /* 0x64 */ u16 sequenceMoveIDs[MAX_MON_MOVES]; + /* 0x6C */ u32 menuAction1; + /* 0x70 */ u32 menuAction2; + /* 0x74 */ u32 menuAction3; + /* 0x78 */ u32 menuAction4; + MenuItem unk7C[8]; + u16 unkBC[8]; + MenuStruct unkCC; + u8 fill11C[0x16C - 0x11C]; + /* 0x16C */ OpenedFile *faceFile; + /* 0x170 */ u8 *faceData; + u16 unk174; + u16 unk176; + u8 unk178; + u8 unk179; + u8 unk17A; + OpenedFile **unk17C; + UnkTextStruct2 unk180[4]; +} unkStruct_203B27C; + +bool8 sub_801FB50(u32 mode); +u32 sub_801FC40(void); +void sub_801FD7C(void); + +#endif // GUARD_GULPIN_SHOP_801FB50_H \ No newline at end of file diff --git a/include/input.h b/include/input.h index 27d932649..cc55909a0 100644 --- a/include/input.h +++ b/include/input.h @@ -2,7 +2,7 @@ #define GUARD_INPUT_H // size: 0x10 -struct Inputs +typedef struct Inputs { /* 0x0 */ u16 held; /* 0x2 */ u16 pressed; @@ -10,21 +10,19 @@ struct Inputs /* 0x6 */ u16 shortPress; /* 0x8 */ u16 heldDpad; /* 0xC */ s32 repeatTimerDpad; -}; - -extern struct Inputs gRealInputs; +} Inputs; // size: 0x8 -struct InputTimers +typedef struct InputTimers { /* 0x0 */ s16 holdTimerB; /* 0x2 */ s16 holdTimerR; u16 unk4; u16 unk6; -}; +} InputTimers; // size: 0x2C -struct UnusedInputStruct +typedef struct UnusedInputStruct { u16 unk0; u16 unk2; @@ -47,10 +45,10 @@ struct UnusedInputStruct u16 unk26; u8 unk28; u8 unk29; -}; +} UnusedInputStruct; // size: 0xC -struct MenuInputStructSub +typedef struct MenuInputStructSub { u8 unk0; /* 0x1 */ u8 a_button; @@ -60,20 +58,20 @@ struct MenuInputStructSub u8 fill5[3]; u16 unk8; s16 unkA; -}; +} MenuInputStructSub; // size: 0x34 -struct MenuInputStruct +typedef struct MenuInputStruct { s32 unk0; u16 unk4; s16 unk6; - s16 unk8; // Maybe struct Position + s16 unk8; // Maybe Position s16 unkA; - s16 unkC; // Maybe struct Position + s16 unkC; // Maybe Position s16 unkE; u32 unk10; - s16 unk14; // Maybe struct Position + s16 unk14; // Maybe Position s16 unk16; /* 0x18 */ s16 menuIndex; s16 unk1A; @@ -83,21 +81,19 @@ struct MenuInputStruct s16 unk22; u16 unk24; u16 unk26; - struct MenuInputStructSub unk28; -}; + MenuInputStructSub unk28; +} MenuInputStruct; +extern Inputs gRealInputs; void InitInput(void); void LoadBufferedInputs(void); -u8 sub_80048B8(void); -u8 sub_80048BC(void); -u8 sub_80048C0(void); -u8 sub_80048C4(void); -u8 sub_80048C8(void); -u8 sub_80048CC(void); void ResetRepeatTimers(void); -void UnpressButtons(void); void ResetUnusedInputStruct(void); +void UnpressButtons(void); void UpdateInput(void); -#endif // GUARD_INPUT_H +bool8 sub_80048BC(void); +bool8 sub_80048C8(void); + +#endif // GUARD_INPUT_H \ No newline at end of file diff --git a/include/item.h b/include/items.h similarity index 60% rename from include/item.h rename to include/items.h index bca04270b..764025f98 100644 --- a/include/item.h +++ b/include/items.h @@ -3,9 +3,10 @@ #include "constants/item.h" #include "code_8092334.h" +#include "subStruct_203B240.h" // size: 0x20 -struct ItemDataEntry +typedef struct ItemDataEntry { /* 0x0 */ u8 *name; /* 0x4 */ u32 buyPrice; @@ -23,39 +24,50 @@ struct ItemDataEntry /* 0x1B */ u8 spawnAmountRange[2]; /* 0x1D */ u8 palette; /* 0x1E */ u8 actionType; -}; +} ItemDataEntry; // size: 0x4 -struct Item +typedef struct Item { /* 0x0 */ u8 flags; /* 0x1 */ u8 quantity; /* 0x2 */ u8 id; -}; +} Item; // size: 0x4 -struct BulkItem +typedef struct BulkItem { /* 0x0 */ u8 id; /* 0x1 */ u8 quantity; -}; +} BulkItem; // size: 0x4 -struct Gummi +typedef struct Gummi { /* 0x0 */ s16 boostAmount; /* 0x2 */ u16 flags; -}; +} Gummi; // size: 0xC -struct unkStruct_8090F58 +typedef struct unkStruct_8090F58 { u32 unk0; u8 unk4; u8 unk5; s16 unk6; u8 unk8; -}; +} unkStruct_8090F58; + +// size: 0x268 +typedef struct TeamInventory +{ + /* 0x0 */ Item teamItems[INVENTORY_SIZE]; + /* 0x50 */ u16 teamStorage[STORAGE_SIZE]; + /* 0x230 */ BulkItem kecleonShopItems[MAX_KECLEON_ITEM_SHOP_ITEMS]; + /* 0x250 */ BulkItem kecleonWareItems[MAX_KECLEON_WARE_SHOP_ITEMS]; + /* 0x260 */ s32 teamMoney; + /* 0x264 */ s32 teamSavings; +} TeamInventory; enum ItemFlag { @@ -73,27 +85,22 @@ enum ItemAIFlag ITEM_AI_FLAG_TARGET_ENEMY }; -#define NUMBER_OF_GUMMIS 18 -#define INVENTORY_SIZE 20 -#define STORAGE_SIZE NUMBER_OF_ITEM_IDS - -#define MIN_SPAWN_AMOUNT 0 -#define MAX_SPAWN_AMOUNT 1 +extern TeamInventory *gTeamInventoryRef; void LoadItemParameters(void); -struct TeamInventory *GetMoneyItemsInfo(void); +TeamInventory *GetMoneyItemsInfo(void); void InitializeMoneyItems(void); s32 GetNumberOfFilledInventorySlots(void); bool8 IsThrowableItem(u8 id); -void xxx_init_itemslot_8090A8C(struct Item *param_1,u8 id,u8 param_3); -void xxx_init_helditem_8090B08(struct BulkItem *param_1,u8 id); -void HeldItemToSlot(struct Item *param_1, struct BulkItem *param_2); -void SlotToHeldItem(struct BulkItem *held,struct Item *slot); +void xxx_init_itemslot_8090A8C(Item *param_1,u8 id,u8 param_3); +void xxx_init_helditem_8090B08(BulkItem *param_1,u8 id); +void HeldItemToSlot(Item *param_1, BulkItem *param_2); +void SlotToHeldItem(BulkItem *held, Item *slot); u8 GetItemCategory(u8 index); -s32 GetStackBuyValue(struct Item *param_1); -s32 GetStackSellValue(struct Item *param_1); -s32 GetStackBuyPrice(struct Item *param_1); -s32 GetStackSellPrice(struct Item *param_1); +s32 GetStackBuyValue(Item *param_1); +s32 GetStackSellValue(Item *param_1); +s32 GetStackBuyPrice(Item *param_1); +s32 GetStackSellPrice(Item *param_1); s32 GetItemBuyPrice(u8 id); s32 GetItemSellPrice(u8 id); s32 GetItemOrder(u8 id); @@ -102,35 +109,34 @@ u32 GetItemActionType(u8 id); u32 GetSpawnAmountRange(u8 id, u32 r1); u8 *GetItemDescription(u8 id); bool8 GetItemAIFlag(u8 id, u32 r1); -void sub_8090DC4(void* param_1,u8 id, struct unkStruct_8090F58* param_3); -void sub_8090E14(u8* ext_buffer, struct Item* slot, struct unkStruct_8090F58* a3); -bool8 AddItemToInventory(const struct Item* slot); +void BufferItemName(u8 *, u8 id, unkStruct_8090F58 *); +void sub_8090E14(u8 *ext_buffer, Item *slot, unkStruct_8090F58 *); +bool8 AddItemToInventory(const Item* slot); void ConvertMoneyItemToMoney(); void AddToTeamMoney(s32 amount); -u32 GetMoneyValue(struct Item* slot); +u32 GetMoneyValue(Item* slot); u16 GetItemMoveID(u8 index); bool8 CanSellItem(u32 id); bool8 IsGummiItem(u8); -void sub_8090F58(void*, u8 *, struct Item *, struct unkStruct_8090F58*); void ShiftItemsDownFrom(s32 start); void ClearItemSlotAt(u32 index); -void MoveToStorage(struct Item* slot); +void MoveToStorage(Item *slot); s32 CountKecleonShopItems(void); void InitKecleonShopItem(u8 index); -struct BulkItem *GetKecleonShopItem(u8 index); +BulkItem *GetKecleonShopItem(u8 index); void FillKecleonShopGaps(void); void SortKecleonShopInventory(void); void ChooseKecleonShopInventory(u8 index); bool8 AddKecleonShopItem(u8 itemIndex); u32 CountKecleonWareItems(void); void InitKecleonWareItem(u8 index); -struct BulkItem* GetKecleonWareItem(u8 index); +BulkItem* GetKecleonWareItem(u8 index); void FillKecleonWareGaps(void); void SortKecleonWareInventory(void); void ChooseKecleonWareInventory(u8 index); bool8 AddKecleonWareItem(u8 itemIndex); void FillInventoryGaps(); -bool8 AddHeldItemToInventory(struct BulkItem* slot); +bool8 AddHeldItemToInventory(BulkItem* slot); bool8 IsNotMoneyOrUsedTMItem(u8 id); s32 FindItemInInventory(u8 id); bool8 IsHMItem(u8 id); @@ -138,11 +144,19 @@ bool8 IsEdibleItem(u8 id); u8 xxx_bit_lut_lookup_8091E50(u8 i0, u8 i1); bool8 IsInvalidItemReward(u8 itemID); -void RestoreHeldItem(struct unkStruct_8094924*, struct BulkItem*); -void SaveHeldItem(struct unkStruct_8094924*, struct BulkItem*); -void RestoreItemSlot(struct unkStruct_8094924 *a1, struct Item *a2); -void SaveItemSlot(struct unkStruct_8094924 *a1, struct Item *a2); -s32 RestoreTeamInventory(u8 *unk0, u32 size); -s32 SaveTeamInventory(u8 *unk0, u32 size); +void RestoreHeldItem(unkStruct_8094924 *, BulkItem *); +void SaveHeldItem(unkStruct_8094924 *, BulkItem *); +void RestoreItemSlot(unkStruct_8094924 *, Item *); +void SaveItemSlot(unkStruct_8094924 *, Item *); +s32 RestoreTeamInventory(u8 *, u32 size); +s32 SaveTeamInventory(u8 *, u32 size); -#endif + + + + + +s32 sub_8090FEC(s32, u8 *strbuf, u8); +u32 sub_80913E0(Item *slot, u32, struct subStruct_203B240 **); + +#endif // GUARD_ITEMS_H \ No newline at end of file diff --git a/include/kangaskhan_storage.h b/include/kangaskhan_storage1.h similarity index 51% rename from include/kangaskhan_storage.h rename to include/kangaskhan_storage1.h index d075879e2..4b2e9310e 100644 --- a/include/kangaskhan_storage.h +++ b/include/kangaskhan_storage1.h @@ -1,76 +1,11 @@ -#ifndef GUARD_KANGASKHAN_STORAGE_H -#define GUARD_KANGASKHAN_STORAGE_H +#ifndef GUARD_KANGASKHAN_STORAGE1_H +#define GUARD_KANGASKHAN_STORAGE1_H #include "file_system.h" -#include "item.h" +#include "items.h" #include "menu.h" #include "text.h" -// size: 0x14C -struct KangaskhanStorageWork -{ - /* 0x0 */ bool32 isAsleep; - /* 0x4 */ u32 currState; - /* 0x8 */ u32 fallbackState; - /* 0xC */ struct Item storedItem; - /* 0x10 */ u32 itemIndex; - /* 0x14 */ u8 id; // another id? - /* 0x18 */ u32 menuAction1; - /* 0x1C */ u32 menuAction2; - /* 0x20 */ u32 menuAction3; - struct MenuItem unk24[5]; - u16 unk4C[5]; - struct MenuStruct unk58; - u32 unkA8; - u32 unkAC; - u32 unkB0; - u32 unkB4; - u32 unkB8; - u32 unkBC; - struct UnkTextStruct2 *unkC0; - u32 unkC4; - u32 unkC8; - u8 unkCC[0xD4 - 0xCC]; - u32 unkD4; - /* 0xD8 */ struct OpenedFile *faceFile; - /* 0xDC */ u8 *faceData; - u16 unkE0; - u16 unkE2; - u8 unkE4; - u8 unkE5; - u8 unkE6; - u8 unkE7; - struct OpenedFile **unkE8; - struct UnkTextStruct2 unkEC[4]; -}; - -// size: 0x150 -struct unkStruct_203B20C -{ - /* 0x0 */ u32 state; - u8 unk4[4]; - /* 0x8 */ struct Item item; - /* 0xC */ u32 itemIndex; - /* 0x10 */ u8 id; - /* 0x14 */ u32 menuAction1; - /* 0x18 */ u32 menuAction2; - /* 0x1C */ u32 menuAction3; - struct MenuItem unk20[8]; - u16 unk60[8]; - struct MenuStruct unk70; - u32 unkC0; - u32 unkC4; - u32 unkC8; - u32 unkCC; - u32 unkD0; - u32 unkD4; - struct UnkTextStruct2 *unkD8; - u32 unkDC; - u32 unkE0; - u8 fillE4[0xF0 - 0xE4]; - struct UnkTextStruct2 unkF0[4]; -}; - enum KangaskhanStorageStates { KANGASKHAN_STORAGE_INIT = 0, @@ -81,8 +16,46 @@ enum KangaskhanStorageStates KANGASKHAN_STORAGE_IS_MONEY_USED_TM = 9, }; -u32 CreateKangaskhanStorage(bool32 isAsleep); +// size: 0x14C +struct KangaskhanStorageWork +{ + /* 0x0 */ bool32 isAsleep; + /* 0x4 */ u32 currState; + /* 0x8 */ u32 fallbackState; + /* 0xC */ Item storedItem; + /* 0x10 */ u32 itemIndex; + /* 0x14 */ u8 id; // another id? + /* 0x18 */ u32 menuAction1; + /* 0x1C */ u32 menuAction2; + /* 0x20 */ u32 menuAction3; + MenuItem unk24[5]; + u16 unk4C[5]; + MenuStruct unk58; + u32 unkA8; + u32 unkAC; + u32 unkB0; + u32 unkB4; + u32 unkB8; + u32 unkBC; + UnkTextStruct2 *unkC0; + u32 unkC4; + u32 unkC8; + u8 unkCC[0xD4 - 0xCC]; + u32 unkD4; + /* 0xD8 */ OpenedFile *faceFile; + /* 0xDC */ u8 *faceData; + u16 unkE0; + u16 unkE2; + u8 unkE4; + u8 unkE5; + u8 unkE6; + u8 unkE7; + OpenedFile **unkE8; + UnkTextStruct2 unkEC[4]; +}; + +bool8 CreateKangaskhanStorage(u32 mode); void DeleteKangaskhanStorage(void); u32 KangaskhanStorageCallback(void); -#endif +#endif // GUARD_KANGASKHAN_STORAGE1_H \ No newline at end of file diff --git a/include/kangaskhan_storage2.h b/include/kangaskhan_storage2.h new file mode 100644 index 000000000..84c6ab0b1 --- /dev/null +++ b/include/kangaskhan_storage2.h @@ -0,0 +1,39 @@ +#ifndef GUARD_KANGASKHAN_STORAGE2_H +#define GUARD_KANGASKHAN_STORAGE2_H + +#include "items.h" +#include "menu.h" +#include "text.h" + +// size: 0x150 +typedef struct unkStruct_203B20C +{ + /* 0x0 */ u32 state; + u8 unk4[4]; + /* 0x8 */ Item item; + /* 0xC */ u32 itemIndex; + /* 0x10 */ u8 id; + /* 0x14 */ u32 menuAction1; + /* 0x18 */ u32 menuAction2; + /* 0x1C */ u32 menuAction3; + MenuItem unk20[8]; + u16 unk60[8]; + MenuStruct unk70; + u32 unkC0; + u32 unkC4; + u32 unkC8; + u32 unkCC; + u32 unkD0; + u32 unkD4; + UnkTextStruct2 *unkD8; + u32 unkDC; + u32 unkE0; + u8 fillE4[0xF0 - 0xE4]; + UnkTextStruct2 unkF0[4]; +} unkStruct_203B20C; + +bool8 sub_8017E1C(void); +u32 sub_8017E54(void); +void sub_8017EF4(void); + +#endif // GUARD_KANGASKHAN_STORAGE2_H \ No newline at end of file diff --git a/include/kecleon_bros.h b/include/kecleon_bros1.h similarity index 55% rename from include/kecleon_bros.h rename to include/kecleon_bros1.h index bb27ebcb7..90917ca4d 100644 --- a/include/kecleon_bros.h +++ b/include/kecleon_bros1.h @@ -1,65 +1,11 @@ -#ifndef GUARD_KECLEON_BROS_H -#define GUARD_KECLEON_BROS_H +#ifndef GUARD_KECLEON_BROS1_H +#define GUARD_KECLEON_BROS1_H #include "file_system.h" -#include "item.h" +#include "items.h" #include "menu.h" #include "text.h" -// size: 0x148 -struct KecleonBrosWork -{ - /* 0x0 */ u32 mode; // Corresponds to the enum: KecleonBrosMode - /* 0x4 */ bool8 isKecleonItemShop; // FALSE indicates it is Kecleon TM Shop - /* 0x8 */ u32 currState; - /* 0xC */ u32 fallbackState; - /* 0x10 */ s32 itemSellPrice; - /* 0x14 */ u32 numInventoryItemToSell; - /* 0x18 */ s32 inventoryItemSellPrice; - /* 0x1C */ struct Item soldItem; - /* 0x20 */ u8 itemShopItemIndex; - /* 0x21 */ u8 wareShopItemIndex; - /* 0x24 */ u32 soldItemInventoryIndex; - /* 0x28 */ u32 menuAction1; - /* 0x2C */ u32 menuAction2; - /* 0x30 */ u32 menuAction3; - /* 0x34 */ struct MenuItem menuItems[8]; - u16 unk74[8]; - /* 0x84 */ struct MenuStruct menu; - /* 0xD4 */ struct OpenedFile *faceFile; - /* 0xD8 */ u8 *faceData; - u16 unkDC; - u16 unkDE; - u8 unkE0; - u8 unkE1; - u8 unkE2; - u8 unkE3; - struct OpenedFile **unkE4; - struct UnkTextStruct2 unkE8[4]; -}; - -// size: 0xA0 -struct unkStruct_203B214 -{ - /* 0x0 */ struct MenuInputStruct input; - u32 unk34; - struct UnkTextStruct2 *unk38; - struct UnkTextStruct2 unk3C[4]; - u8 unk9C[4]; -}; - -// size: 0xF4 -struct unkStruct_203B224 -{ - u32 unk0; - u32 unk4[INVENTORY_SIZE]; - /* 0x54 */ struct MenuInputStruct input; - u32 unk88; - struct UnkTextStruct2 *unk8C; - struct UnkTextStruct2 unk90[4]; - u8 unkF0[4]; -}; - enum KecleonBrosMode { KECLEON_BROS_MODE_ITEMS_AWAKE, @@ -82,21 +28,41 @@ enum KecleonStoreStates KECLEON_STORE_CANT_SELL_ITEM = 13, }; +// size: 0x148 +typedef struct KecleonBrosWork1 +{ + /* 0x0 */ u32 mode; // Corresponds to the enum: KecleonBrosMode + /* 0x4 */ bool8 isKecleonItemShop; // FALSE indicates it is Kecleon TM Shop + /* 0x8 */ u32 currState; + /* 0xC */ u32 fallbackState; + /* 0x10 */ s32 itemSellPrice; + /* 0x14 */ u32 numInventoryItemToSell; + /* 0x18 */ s32 inventoryItemSellPrice; + /* 0x1C */ Item soldItem; + /* 0x20 */ u8 itemShopItemIndex; + /* 0x21 */ u8 wareShopItemIndex; + /* 0x24 */ u32 soldItemInventoryIndex; + /* 0x28 */ u32 menuAction1; + /* 0x2C */ u32 menuAction2; + /* 0x30 */ u32 menuAction3; + /* 0x34 */ MenuItem menuItems[8]; + u16 unk74[8]; + /* 0x84 */ MenuStruct menu; + /* 0xD4 */ OpenedFile *faceFile; + /* 0xD8 */ u8 *faceData; + u16 unkDC; + u16 unkDE; + u8 unkE0; + u8 unkE1; + u8 unkE2; + u8 unkE3; + OpenedFile **unkE4; + UnkTextStruct2 unkE8[4]; +} KecleonBrosWork1; + // mode corresponds to the enum: KecleonBrosMode -u32 CreateKecleonBros(u32 mode); +bool8 CreateKecleonBros(u32 mode); void DeleteKecleonBros(void); u32 KecleonBrosCallback(void); -bool32 sub_801A5D8(u32, s32, struct UnkTextStruct2_sub *, u32); -u32 sub_801A6E8(bool8); -s32 sub_801A8AC(void); -void sub_801A8D0(u8); -void sub_801A928(void); -void sub_801A9E0(void); -void sub_801AD34(u32); -bool8 sub_801ADA0(s32); -void sub_801AE84(void); -s32 sub_801AED0(s32); -s32 sub_801AEA8(void); - -#endif // GUARD_KECLEON_BROS_H +#endif // GUARD_KECLEON_BROS1_H \ No newline at end of file diff --git a/include/kecleon_bros2.h b/include/kecleon_bros2.h new file mode 100644 index 000000000..ac806b8c8 --- /dev/null +++ b/include/kecleon_bros2.h @@ -0,0 +1,24 @@ +#ifndef GUARD_KECLEON_BROS2_H +#define GUARD_KECLEON_BROS2_H + +#include "input.h" +#include "text.h" + +// size: 0xA0 +typedef struct unkStruct_203B214 +{ + /* 0x0 */ MenuInputStruct input; + u32 unk34; + UnkTextStruct2 *unk38; + UnkTextStruct2 unk3C[4]; + u8 unk9C[4]; +} unkStruct_203B214; + +bool8 sub_8019E40(u32); +u32 sub_8019EDC(bool8); +u8 sub_8019FB0(void); +void sub_8019FCC(bool8); +void sub_801A010(void); +void sub_801A0D8(void); + +#endif // GUARD_KECLEON_BROS2_H \ No newline at end of file diff --git a/include/kecleon_bros3.h b/include/kecleon_bros3.h new file mode 100644 index 000000000..8bfaf7218 --- /dev/null +++ b/include/kecleon_bros3.h @@ -0,0 +1,24 @@ +#ifndef GUARD_KECLEON_BROS3_H +#define GUARD_KECLEON_BROS3_H + +#include "input.h" +#include "text.h" + +// size: 0xA0 +typedef struct unkStruct_203B21C +{ + /* 0x0 */ MenuInputStruct input; + u32 unk34; + UnkTextStruct2 *unk38; + UnkTextStruct2 unk3C[4]; + u8 unk9C[4]; +} unkStruct_203B21C; + +u8 sub_801A20C(u32); +u32 sub_801A2A8(bool8); +u8 sub_801A37C(void); +void sub_801A398(bool8); +void sub_801A3DC(void); +void sub_801A4A4(void); + +#endif // GUARD_KECLEON_BROS3_H \ No newline at end of file diff --git a/include/kecleon_bros4.h b/include/kecleon_bros4.h new file mode 100644 index 000000000..473169fac --- /dev/null +++ b/include/kecleon_bros4.h @@ -0,0 +1,33 @@ +#ifndef GUARD_KECLEON_BROS4_H +#define GUARD_KECLEON_BROS4_H + +#include "constants/item.h" +#include "input.h" +#include "text.h" + +// size: 0xF4 +typedef struct unkStruct_203B224 +{ + u32 unk0; + u32 unk4[INVENTORY_SIZE]; + /* 0x54 */ MenuInputStruct input; + u32 unk88; + UnkTextStruct2 *unk8C; + UnkTextStruct2 unk90[4]; + u8 unkF0[4]; +} unkStruct_203B224; + +bool8 sub_801A5D8(u32, s32, UnkTextStruct2_sub *, u32); +u32 sub_801A6E8(bool8); +s32 sub_801A8AC(void); +void sub_801A8D0(bool8); +void sub_801A928(void); +void sub_801A9E0(void); +void sub_801AD34(u32); +bool8 sub_801ADA0(s32); +void sub_801AE84(void); +s32 sub_801AEA8(void); +s32 sub_801AED0(s32 index); +void sub_801AEE4(s32 index, s32 value); + +#endif // GUARD_KECLEON_BROS4_H \ No newline at end of file diff --git a/include/luminous_cave.h b/include/luminous_cave.h index 7e3a5a7ee..3d695cca4 100644 --- a/include/luminous_cave.h +++ b/include/luminous_cave.h @@ -1,36 +1,45 @@ #ifndef GUARD_LUMINOUS_CAVE_H #define GUARD_LUMINOUS_CAVE_H +#include "file_system.h" +#include "items.h" #include "menu.h" +#include "pokemon_3.h" #include "text.h" struct unkStruct_203B2B0 { // size: 0x174 bool8 evolutionComplete; - struct EvolveStatus evolveStatus; - struct PokemonStruct *pokeStruct; + EvolveStatus evolveStatus; + PokemonStruct1 *pokeStruct; /* 0x10 */ bool8 pokeRenamed; /* 0x14 */ u32 evoItem1_InvIndex; // inventory index of item /* 0x18 */ u32 evoItem2_InvIndex; // inventory index of item - struct Item chosenItem; + Item chosenItem; u32 state; u32 fallbackState; u32 menuAction1; u32 menuAction2; u32 menuAction3; - struct MenuItem unk34[8]; + MenuItem unk34[8]; u16 unk74[0x8]; - struct MenuStruct unk84; + MenuStruct unk84; u8 fillD4[0x104 - 0xD4]; - struct OpenedFile *unk104; + OpenedFile *unk104; u8 *unk108; u16 unk10C; u16 unk10E; u8 unk110; u8 unk111; u8 unk112; - struct UnkTextStruct2 unk114[4]; + UnkTextStruct2 unk114[4]; }; +void CleanLuminousCave(void); +bool8 HasEvolutionCompleted(void); + +u32 sub_802465C(void); +u32 sub_80246F0(void); + #endif // GUARD_LUMINOUS_CAVE_H diff --git a/include/mailbox.h b/include/mailbox.h index a79913dc9..6b7d83086 100644 --- a/include/mailbox.h +++ b/include/mailbox.h @@ -13,13 +13,13 @@ struct unkStruct_203B304 u32 fallbackState; u8 mailboxIndex; u8 mailIndex; - struct unkStruct_802C39C unkC; + unkStruct_802C39C unkC; u32 menuAction1; u32 menuAction2; - struct MenuStruct unk6C; - struct MenuItem menuItems[8]; + MenuStruct unk6C; + MenuItem menuItems[8]; u16 unkFC[8]; - struct UnkTextStruct2 unk10C[4]; + UnkTextStruct2 unk10C[4]; }; extern void SetMailboxState(u32); diff --git a/include/main_menu.h b/include/main_menu.h index 7167e81db..9edd9140d 100644 --- a/include/main_menu.h +++ b/include/main_menu.h @@ -73,10 +73,10 @@ void CleanUpMenu(void); void DeleteMainMenu(void); struct MainMenu *GetMainMenu(void); void InitMainMenu(void); -void SetMenuItems(struct MenuStruct *, struct UnkTextStruct2 *, s32, const struct UnkTextStruct2 *, const struct MenuItem *, u8, u32, u32); +void SetMenuItems(MenuStruct *, UnkTextStruct2 *, s32, const UnkTextStruct2 *, const MenuItem *, u8, u32, u32); void SetUpMenu(void); -void sub_8035CC0(struct UnkTextStruct2 *, u32); -void sub_8035CF4(struct MenuStruct*, u32, bool8); +void sub_8035CC0(UnkTextStruct2 *, u32); +void sub_8035CF4(MenuStruct*, u32, bool8); struct unkStruct_8035D94 *sub_8035D94(void); void sub_8035DA0(void); bool8 sub_80363E0(void); diff --git a/include/makuhita_dojo.h b/include/makuhita_dojo1.h similarity index 53% rename from include/makuhita_dojo.h rename to include/makuhita_dojo1.h index 455680759..ea9495d1c 100644 --- a/include/makuhita_dojo.h +++ b/include/makuhita_dojo1.h @@ -1,57 +1,10 @@ -#ifndef GUARD_MAKUHITA_DOJO_H -#define GUARD_MAKUHITA_DOJO_H +#ifndef GUARD_MAKUHITA_DOJO1_H +#define GUARD_MAKUHITA_DOJO1_H -#include "constants/dungeon.h" #include "file_system.h" -#include "input.h" #include "menu.h" #include "text.h" -// size: 0xCC -struct unkStruct_203B318 -{ - /* 0x0 */ u32 mode; // Corresponds to the enum: MakuhitaDojoMode - /* 0x4 */ bool32 isAsleep; - /* 0x8 */ s32 state; - /* 0xC */ s32 fallbackState; - s16 unk10; - /* 0x14 */ s32 menuAction; - struct MenuItem unk18[4]; - u8 fill38[0x58 - 0x38]; - /* 0x58 */ struct OpenedFile *faceFile; - /* 0x5C */ u8 *faceData; - u16 unk60; - u16 unk62; - u8 unk64; - u8 unk65; - u8 unk66; - u8 unk67; - struct OpenedFile** unk68; - struct UnkTextStruct2 unk6C[4]; -}; - -// size: 0xD0 -struct unkStruct_203B31C -{ - s16 unk0[NUM_DUNGEON_MAZE]; - /* 0x30 */ struct MenuInputStruct input; - u32 unk64; - struct UnkTextStruct2 *unk68; - struct UnkTextStruct2 unk6C[4]; - u8 unkCC[4]; -}; - -// mode corresponds to the enum: MakuhitaDojoMode -u32 MakuhitaDojo_New(u32 mode); -void MakuhitaDojo_Delete(void); - -u32 sub_802FE58(void); -s16 sub_802FED0(void); -bool8 sub_80302E8(s32, struct UnkTextStruct2_sub *, u32); -u32 sub_80303AC(bool8); -s16 sub_8030418(void); -void sub_8030480(void); - enum MakuhitaDojoMode { MAKUHITA_DOJO_MODE_UNK0_AWAKE = 0, @@ -64,4 +17,33 @@ enum MakuhitaDojoMode MAKUHITA_DOJO_MODE_UNK7_ASLEEP = 7, }; -#endif // GUARD_MAKUHITA_DOJO_H \ No newline at end of file +// size: 0xCC +typedef struct MakuhitaDojoWork1 +{ + /* 0x0 */ u32 mode; // Corresponds to the enum: MakuhitaDojoMode + /* 0x4 */ bool32 isAsleep; + /* 0x8 */ s32 state; + /* 0xC */ s32 fallbackState; + s16 unk10; + /* 0x14 */ s32 menuAction; + MenuItem unk18[4]; + u8 fill38[0x58 - 0x38]; + /* 0x58 */ OpenedFile *faceFile; + /* 0x5C */ u8 *faceData; + u16 unk60; + u16 unk62; + u8 unk64; + u8 unk65; + u8 unk66; + u8 unk67; + OpenedFile** unk68; + UnkTextStruct2 unk6C[4]; +} MakuhitaDojoWork1; + +void MakuhitaDojo_Delete(void); +bool8 MakuhitaDojo_New(u32 mode); + +u32 sub_802FE58(void); +s16 sub_802FED0(void); + +#endif // GUARD_MAKUHITA_DOJO1_H \ No newline at end of file diff --git a/include/makuhita_dojo2.h b/include/makuhita_dojo2.h new file mode 100644 index 000000000..ad3d11b56 --- /dev/null +++ b/include/makuhita_dojo2.h @@ -0,0 +1,26 @@ +#ifndef GUARD_MAKUHITA_DOJO2_H +#define GUARD_MAKUHITA_DOJO2_H + +#include "constants/dungeon.h" +#include "input.h" +#include "text.h" + +// size: 0xD0 +typedef struct MakuhitaDojoWork2 +{ + s16 unk0[NUM_DUNGEON_MAZE]; + /* 0x30 */ MenuInputStruct input; + u32 unk64; + UnkTextStruct2 *unk68; + UnkTextStruct2 unk6C[4]; + u8 unkCC[4]; +} MakuhitaDojoWork2; + +bool8 MakuhitaDojo_ReturnFalse(void); + +bool8 sub_80302E8(s32, UnkTextStruct2_sub *, u32); +u32 sub_80303AC(bool8); +s16 sub_8030418(void); +void sub_8030480(void); + +#endif // GUARD_MAKUHITA_DOJO2_H \ No newline at end of file diff --git a/include/map.h b/include/map.h index 4ad7ba63f..2ce5f1397 100644 --- a/include/map.h +++ b/include/map.h @@ -17,7 +17,7 @@ enum TerrainType TERRAIN_TYPE_SHOP = 1 << 5, TERRAIN_TYPE_IN_MONSTER_HOUSE = 1 << 6, TERRAIN_TYPE_UNK_8 = 1 << 8, - TERRAIN_TYPE_STAIRS = 1 << 9 + TERRAIN_TYPE_STAIRS = 1 << 9, }; enum CrossableTerrain @@ -30,7 +30,7 @@ enum CrossableTerrain }; // size: 0x18 -struct Tile +typedef struct Tile { // Uses the TerrainType bit flags. /* 0x0 */ u16 terrainType; @@ -43,12 +43,12 @@ struct Tile // Different sets of flags are used for Pokémon that can cross special terrain, corresponding to the CrossableTerrain enum. /* 0xA */ u8 walkableNeighborFlags[NUM_CROSSABLE_TERRAIN]; u8 fillE[0x10 - 0xE]; - /* 0x10 */ struct Entity *monster; // Pokémon on the tile. - /* 0x14 */ struct Entity *object; // Item or trap on the tile. -}; + /* 0x10 */ Entity *monster; // Pokémon on the tile. + /* 0x14 */ Entity *object; // Item or trap on the tile. +} Tile; // size: 0x1C -struct RoomData +typedef struct RoomData { u8 unk0; u8 unk1; @@ -63,6 +63,6 @@ struct RoomData u32 unk10; // bottom right y u32 unk14; // top left x u32 unk18; // top left y -}; +} RoomData; -#endif +#endif // GUARD_MAP_H \ No newline at end of file diff --git a/include/menu.h b/include/menu.h index c2e01ee07..34b545e5a 100644 --- a/include/menu.h +++ b/include/menu.h @@ -4,25 +4,25 @@ #include "input.h" // size: 0x8 -struct MenuItem +typedef struct MenuItem { const u8 *text; s32 menuAction; // action?? -}; +} MenuItem; // size: 0x50 -struct MenuStruct +typedef struct MenuStruct { const u8 *unk0; // header text? - /* 0x4 */ const struct MenuItem *menuItems; + /* 0x4 */ const MenuItem *menuItems; const u32 *menuTextColorArray; u16 *unkC; /* 0x10 */ s32 index; - /* 0x14 */ struct MenuInputStruct input; + /* 0x14 */ MenuInputStruct input; /* 0x48 */ s32 menuAction; bool8 unk4C; bool8 unk4D; bool8 unk4E; -}; +} MenuStruct; #endif // GUARD_MENU_H diff --git a/include/menu_input.h b/include/menu_input.h index 0dad9894a..5b4f3383e 100644 --- a/include/menu_input.h +++ b/include/menu_input.h @@ -4,43 +4,43 @@ #include "menu.h" #include "text.h" -u32 sub_8012A64(struct MenuInputStructSub *r0, s32 r1); -s32 GetKeyPress(struct MenuInputStruct *r0); +u32 sub_8012A64(MenuInputStructSub *r0, s32 r1); +s32 GetKeyPress(MenuInputStruct *r0); s32 sub_8012AE8(void); void sub_8012BC4(u32 x, u32 y, s32 n, s32 len, u32 color, u32 param_6); void sub_8012C60(u32 x, u32 y, u32 param_3, u32 color, u32 param_5); -void sub_8012CAC(struct UnkTextStruct2 *param_1, const struct MenuItem *param_2); -void sub_8012D08(struct UnkTextStruct2 *param_1, s32 param_2); -void sub_8012D34(struct UnkTextStruct2 *param_1, s32 param_2); -void sub_8012D60(struct MenuStruct *param_1, const struct MenuItem *menuItems, u32 *colorArray, u16 *param_4, s32 menuAction, s32 index); -void sub_8012E04(struct MenuStruct *param_1, const struct MenuItem *menuItems, u32 *colorArray, u16 *param_4, s32 menuAction, s32 index); -void sub_8012EA4(struct MenuStruct *param_1, bool8 r1); -void sub_8012EBC(struct MenuStruct *param_1); -bool8 sub_8012FD8(struct MenuStruct *param_1); -bool8 sub_80130A8(struct MenuStruct *param_1); -bool8 sub_8013114(struct MenuStruct *param_1, s32 *menuAction); -void sub_801317C(struct MenuInputStructSub *param_1); -void AddMenuCursorSprite(struct MenuInputStruct *param_1); -void sub_8013660(struct MenuInputStruct *param_1); -void UpdateMenuCursorSpriteCoords(struct MenuInputStruct *param_1); -void MoveMenuCursorDown(struct MenuInputStruct *param_1); -void sub_80136E0(struct MenuInputStruct *param_1, u8 param_2); -void MoveMenuCursorUp(struct MenuInputStruct *param_1); -void sub_8013744(struct MenuInputStruct *param_1, u8 param_2); -void sub_8013780(struct MenuInputStruct *param_1, s32 param_2); -s32 sub_80137A8(struct MenuInputStruct *param_1); -void sub_80137B0(struct MenuInputStruct *param_1, s32 param_2); -void sub_80137F8(struct MenuInputStruct *param_1, u32 param_2); -s32 sub_8013800(struct MenuInputStruct *param_1, s32 param_2); -void sub_8013818(struct MenuInputStruct *param_1, s32 param_2, u32 param_3, s32 param_4); -void sub_8013848(struct MenuInputStruct *param_1, s32 param_2, u32 param_3, s32 param_4); -void sub_8013878(struct MenuInputStruct *param_1, s32 param_2); -bool8 sub_80138B8(struct MenuInputStruct *param_1, bool8 param_2); -bool8 sub_8013938(struct MenuInputStruct *param_1); -void sub_8013984(struct MenuInputStruct * param_1); -void sub_8013A54(struct MenuInputStruct *param_1); -void sub_8013A7C(struct MenuInputStruct *param_1); -void AddMenuCursorSprite_(struct MenuInputStruct *, u32); -void nullsub_34(struct MenuInputStructSub *); +void sub_8012CAC(UnkTextStruct2 *param_1, const MenuItem *param_2); +void sub_8012D08(UnkTextStruct2 *param_1, s32 param_2); +void sub_8012D34(UnkTextStruct2 *param_1, s32 param_2); +void sub_8012D60(MenuStruct *param_1, const MenuItem *menuItems, u32 *colorArray, u16 *param_4, s32 menuAction, s32 index); +void sub_8012E04(MenuStruct *param_1, const MenuItem *menuItems, u32 *colorArray, u16 *param_4, s32 menuAction, s32 index); +void sub_8012EA4(MenuStruct *param_1, bool8 r1); +void sub_8012EBC(MenuStruct *param_1); +bool8 sub_8012FD8(MenuStruct *param_1); +bool8 sub_80130A8(MenuStruct *param_1); +bool8 sub_8013114(MenuStruct *param_1, s32 *menuAction); +void sub_801317C(MenuInputStructSub *param_1); +void AddMenuCursorSprite(MenuInputStruct *param_1); +void sub_8013660(MenuInputStruct *param_1); +void UpdateMenuCursorSpriteCoords(MenuInputStruct *param_1); +void MoveMenuCursorDown(MenuInputStruct *param_1); +void sub_80136E0(MenuInputStruct *param_1, u8 param_2); +void MoveMenuCursorUp(MenuInputStruct *param_1); +void sub_8013744(MenuInputStruct *param_1, u8 param_2); +void sub_8013780(MenuInputStruct *param_1, s32 param_2); +s32 sub_80137A8(MenuInputStruct *param_1); +void sub_80137B0(MenuInputStruct *param_1, s32 param_2); +void sub_80137F8(MenuInputStruct *param_1, u32 param_2); +s32 sub_8013800(MenuInputStruct *param_1, s32 param_2); +void sub_8013818(MenuInputStruct *param_1, s32 param_2, u32 param_3, s32 param_4); +void sub_8013848(MenuInputStruct *param_1, s32 param_2, u32 param_3, s32 param_4); +void sub_8013878(MenuInputStruct *param_1, s32 param_2); +bool8 sub_80138B8(MenuInputStruct *param_1, bool8 param_2); +bool8 sub_8013938(MenuInputStruct *param_1); +void sub_8013984(MenuInputStruct * param_1); +void sub_8013A54(MenuInputStruct *param_1); +void sub_8013A7C(MenuInputStruct *param_1); +void AddMenuCursorSprite_(MenuInputStruct *, u32); +void nullsub_34(MenuInputStructSub *); #endif // GUARD_MENU_INPUT_H \ No newline at end of file diff --git a/include/move_checks.h b/include/move_checks.h index e6cc878f7..78bbec95b 100644 --- a/include/move_checks.h +++ b/include/move_checks.h @@ -1,10 +1,10 @@ #ifndef GUARD_MOVE_CHECKS_H #define GUARD_MOVE_CHECKS_H -bool8 CanUseOnSelfWithStatusChecker(struct Entity *pokemon, struct Move *move); -bool8 CanUseOnTargetWithStatusChecker(struct Entity *user, struct Entity *target, struct Move *move); -bool8 HasDisabledMove(struct Move *moves); -bool8 LastUsedMoveOutOfPP(struct Move *moves); -bool8 HasLastUsedMove(struct Move *moves); +bool8 CanUseOnSelfWithStatusChecker(Entity *pokemon, Move *move); +bool8 CanUseOnTargetWithStatusChecker(Entity *user, Entity *target, Move *move); +bool8 HasDisabledMove(Move *moves); +bool8 LastUsedMoveOutOfPP(Move *moves); +bool8 HasLastUsedMove(Move *moves); #endif diff --git a/include/move_effects_target.h b/include/move_effects_target.h index ebe4b41cd..731c2d106 100644 --- a/include/move_effects_target.h +++ b/include/move_effects_target.h @@ -1,28 +1,28 @@ #ifndef GUARD_MOVE_EFFECTS_TARGET_H #define GUARD_MOVE_EFFECTS_TARGET_H -u8 sub_8075BF4(struct Entity * pokemon, s32 sleepTurns); -void sub_8075C58(struct Entity * pokemon, struct Entity * target, s32 turns, bool8 displayMessage); -bool8 CannotSleep(struct Entity * pokemon, struct Entity * target, u8 param_3, bool8 displayMessage); -void NightmareStatusTarget(struct Entity * pokemon, struct Entity * target, s32 turns); -void NappingStatusTarget(struct Entity * pokemon, struct Entity * target, s32 turns); -void YawnedStatusTarget(struct Entity * pokemon, struct Entity * target, s32 turns); -void SleeplessStatusTarget(struct Entity * pokemon, struct Entity * target); -void PausedStatusTarget(struct Entity * pokemon, struct Entity * target, u8 param_3, s32 turns, bool8 displayMessage); -void InfatuateStatusTarget(struct Entity * pokemon, struct Entity * target, bool8 displayMessage); -void BurnedStatusTarget(struct Entity * pokemon, struct Entity * target, u8 param_3, bool8 displayMessage); -void PoisonedStatusTarget(struct Entity * pokemon, struct Entity * target, bool8 displayMessage); -void BadlyPoisonedStatusTarget(struct Entity * pokemon, struct Entity * target, bool8 displayMessage); -void FrozenStatusTarget(struct Entity * pokemon, struct Entity * target, bool8 displayMessage); -void SqueezedStatusTarget(struct Entity * pokemon, struct Entity * target, s16 param_3, bool32 displayMessage); -void ImmobilizedStatusTarget(struct Entity * pokemon, struct Entity * target); -void IngrainedStatusTarget(struct Entity * pokemon, struct Entity * target); -void WrapTarget(struct Entity * pokemon, struct Entity * target); +u8 sub_8075BF4(Entity * pokemon, s32 sleepTurns); +void sub_8075C58(Entity * pokemon, Entity * target, s32 turns, bool8 displayMessage); +bool8 CannotSleep(Entity * pokemon, Entity * target, u8 param_3, bool8 displayMessage); +void NightmareStatusTarget(Entity * pokemon, Entity * target, s32 turns); +void NappingStatusTarget(Entity * pokemon, Entity * target, s32 turns); +void YawnedStatusTarget(Entity * pokemon, Entity * target, s32 turns); +void SleeplessStatusTarget(Entity * pokemon, Entity * target); +void PausedStatusTarget(Entity * pokemon, Entity * target, u8 param_3, s32 turns, bool8 displayMessage); +void InfatuateStatusTarget(Entity * pokemon, Entity * target, bool8 displayMessage); +void BurnedStatusTarget(Entity * pokemon, Entity * target, u8 param_3, bool8 displayMessage); +void PoisonedStatusTarget(Entity * pokemon, Entity * target, bool8 displayMessage); +void BadlyPoisonedStatusTarget(Entity * pokemon, Entity * target, bool8 displayMessage); +void FrozenStatusTarget(Entity * pokemon, Entity * target, bool8 displayMessage); +void SqueezedStatusTarget(Entity * pokemon, Entity * target, s16 param_3, bool32 displayMessage); +void ImmobilizedStatusTarget(Entity * pokemon, Entity * target); +void IngrainedStatusTarget(Entity * pokemon, Entity * target); +void WrapTarget(Entity * pokemon, Entity * target); void sub_8076CB4(s32 param_1); -void PetrifiedStatusTarget(struct Entity * pokemon, struct Entity * target); -void LowerAttackStageTarget(struct Entity * pokemon, struct Entity * target, s32 index, s32 decrement, u8 param_5, bool8 displayMessage); -void LowerDefenseStageTarget(struct Entity * pokemon, struct Entity * target, s32 index, s32 decrement, u8 param_5, bool8 displayMessage); -void RaiseAttackStageTarget(struct Entity * pokemon, struct Entity * target, s32 index, s32 increment); -void RaiseDefenseStageTarget(struct Entity * pokemon, struct Entity * target, s32 index, s32 increment); +void PetrifiedStatusTarget(Entity * pokemon, Entity * target); +void LowerAttackStageTarget(Entity * pokemon, Entity * target, s32 index, s32 decrement, u8 param_5, bool8 displayMessage); +void LowerDefenseStageTarget(Entity * pokemon, Entity * target, s32 index, s32 decrement, u8 param_5, bool8 displayMessage); +void RaiseAttackStageTarget(Entity * pokemon, Entity * target, s32 index, s32 increment); +void RaiseDefenseStageTarget(Entity * pokemon, Entity * target, s32 index, s32 increment); #endif diff --git a/include/move_util.h b/include/move_util.h index 0f0491315..e72ae901c 100644 --- a/include/move_util.h +++ b/include/move_util.h @@ -3,11 +3,11 @@ #include "dungeon_entity.h" -u32 sub_8057144(struct Entity * pokemon); -bool8 sub_80571F0(struct Entity * pokemon, struct Move *move); -bool8 sub_805727C(struct Entity * pokemon, struct Entity * target, s32 chance); -bool8 sub_8057308(struct Entity *pokemon, s32 chance); -bool8 CanAIUseMove(struct Entity *pokemon, s32 moveIndex, bool8 hasPPChecker); -bool8 CanMonsterUseMove(struct Entity *pokemon, struct Move *move, bool8 hasPPChecker); +u32 sub_8057144(Entity * pokemon); +bool8 sub_80571F0(Entity * pokemon, Move *move); +bool8 sub_805727C(Entity * pokemon, Entity * target, s32 chance); +bool8 sub_8057308(Entity *pokemon, s32 chance); +bool8 CanAIUseMove(Entity *pokemon, s32 moveIndex, bool8 hasPPChecker); +bool8 CanMonsterUseMove(Entity *pokemon, Move *move, bool8 hasPPChecker); #endif diff --git a/include/moves.h b/include/moves.h index 5aed2b35d..9301f937b 100644 --- a/include/moves.h +++ b/include/moves.h @@ -1,70 +1,92 @@ #ifndef GUARD_MOVES_H #define GUARD_MOVES_H +#include "code_809447C.h" #include "constants/move.h" #include "constants/move_id.h" +#include "pokemon.h" +#include "subStruct_203B240.h" + +// size: 0x8 +typedef struct MoveLearnset +{ + const u8 *levelUpMoves; + const u8 *HMTMMoves; +} MoveLearnset; + +// size: 0x8 +typedef struct MoveDataFile +{ + MoveDataEntry *moveData; + MoveLearnset *moveLearnsets; +} MoveDataFile; -void LoadWazaParameters(void); -u8 sub_809287C(struct Move *move); -void InitPokemonMove(struct Move *move, u16 moveID); -void sub_8092AA8(struct Move *move, u16 moveID); -void InitZeroedPPPokemonMove(struct Move *move, u16 moveID); -s16 GetMoveTargetAndRange(struct Move *move, u32 isAI); -u8 GetMoveType(struct Move *move); -u8* GetLevelUpMoves(s16 species); -u8* GetHMTMMoves(s16 species); -u8 GetMoveAIWeight(struct Move *move); -u32 GetMoveNumberOfChainedHits(struct Move *move); -s32 GetMoveBasePower(struct Move *move); -s32 GetMoveAccuracyOrAIChance(struct Move *move, u32 accuracyType); -u32 GetMoveBasePP(struct Move *move); -u32 GetMoveMaxUpgradeLevel(struct Move *move); -u32 GetMoveCritChance(struct Move *move); -bool8 MoveCannotHitFrozen(struct Move *move); -bool8 MovesIgnoresTaunted(struct Move *move); -u32 GetMoveRangeID(struct Move *move); -void sub_8092C84(u8 *buffer, u16 moveID); -u8 *GetMoveUseText(u16 moveID); -bool8 IsReflectedByMagicCoat(u16 moveID); bool8 CanBeSnatched(u16 moveID); -bool8 FailsWhileMuzzled(u16 moveID); -bool8 IsSoundMove(struct Move *move); +void CopyAndResetMoves(Move *destMoves, Move *srcMoves); +void CopyBareMoveData(Move *destMoves, Move *srcMoves); bool8 DoesMoveCharge(u16 move); +bool8 FailsWhileMuzzled(u16 moveID); +const u8 *GetHMTMMoves(s16 species); +const u8 *GetLevelUpMoves(s16 species); +s32 GetLinkedSequence(s32 index, Move *moves, u16 *sequenceMoveIDs); +s32 GetMoveAccuracyOrAIChance(Move *move, u32 accuracyType); +u8 GetMoveAIWeight(Move *move); +s32 GetMoveBasePower(Move *move); +u32 GetMoveBasePP(Move *move); +u32 GetMoveCritChance(Move *move); +u32 GetMoveMaxUpgradeLevel(Move *move); +u32 GetMoveNumberOfChainedHits(Move *move); +s16 GetMoveTargetAndRange(Move *move, bool32 isAI); +u8 *GetMoveUseText(u16 moveID); +u8 GetMoveType(Move *move); +void InitPokemonMove(Move *move, u16 moveID); +void InitZeroedPPPokemonMove(Move *move, u16 moveID); +bool8 IsAnyMoveLinked(s32 unused, Move *moves); +bool8 IsMoveEnabled(s32 index, Move *moves); +bool8 IsMoveSet(s32 index, Move *moves); +bool8 IsNextMoveLinked(s32 index, Move *moves); +bool8 IsReflectedByMagicCoat(u16 moveID); +bool8 IsSoundMove(Move *move); +void LoadWazaParameters(void); +bool8 MoveCannotHitFrozen(Move *move); +bool8 MoveIgnoresTaunted(Move *move); +void RemoveLinkSequenceFromMoves8(Move *moves, s32 index); +void RestorePokemonMoves(struct unkStruct_8094924 *, Move *moveSet); +void SavePokemonMoves(struct unkStruct_8094924 *, Move *moveSet); +bool8 ToggleMoveEnabled(s32 index, Move *moves); +bool8 ToggleSetMove(s32 index, Move *moves); +bool8 TryLinkMovesAfter(s32 index, Move *moves); +void unk_CopyMoves4To8(Move *destMoves, Move *srcMoves); +void unk_CopyMoves4To8AndClearFlag2Unk4(Move *destMoves, Move *srcMoves); +s32 unk_FindMoveEnabledForAIAfter4(Move *moves, s32 index); +s32 unk_FindMoveEnabledForAIAfter8(Move *moves, s32 index); +s32 unk_FindMoveEnabledForAIAfter8_v2(Move *moves, s32 index); +s32 unk_FindMoveEnabledForAIBefore8(Move *moves, s32 index); +s32 unk_FindMoveEnabledForAIBefore8_v2(Move *moves, s32 index); +void unk_FixLinkedMovesSetEnabled4(Move *moves); +void unk_FixLinkedMovesSetEnabled8(Move *moves); +void unk_FixLinkedMovesSetEnabled8_v2(Move *moves); +s32 unk_MoveIDPrintMoveDescription(s32, u16 moveID, s32, struct subStruct_203B240 **); +s32 unk_PrintMoveDescription(s32 x, Move *move, s32, struct subStruct_203B240 **); +s32 unk_SetMoveToFirstInLinkedSequence4(Move *moves, s32 index); +s32 unk_SetMoveToFirstInLinkedSequence8_v2(Move *moves, s32 index); +s32 unk_SetMoveToLastInLinkedSequence4(Move *moves, s32 index); +s32 unk_SetMoveToLastInLinkedSequence8_v2(Move *moves, s32 index); +bool8 UnlinkMovesAfter(s32 index, Move *moves); +void UnSetMove(s32 index, Move *moves); -bool8 IsAnyMoveLinked(int unused, struct Move* moves); -bool8 IsNextMoveLinked(int index, struct Move* moves); -void RemoveLinkSequenceFromMoves8(struct Move* moves, int index); -int GetLinkedSequence(int index, struct Move* moves, u16* sequenceMoveIDs); -void unk_CopyMoves4To8(struct Move* destMoves, struct Move* srcMoves); -void sub_8094060(struct Move* srcMoves, struct Move* destMoves); +u8 sub_809287C(Move *move); +void sub_80928A0(u8 *buffer, Move *move, const unkStruct_80928C0 *); +void sub_80928C0(u8 *buffer, Move *move, const unkStruct_80928C0 *); +void sub_8092AA8(Move *move, u16 moveID); +void sub_8092C84(u8 *buffer, u16 moveID); +s32 sub_8092DB8(Move *moves, s32 index); +s32 sub_8092F4C(Move *moves, s32 index); +bool8 sub_8093318(s32, Move *moves); +bool8 sub_809333C(s32, Move *moves); +s32 sub_80935B8(Move *moves, s32 index); +void sub_8094060(Move *srcMoves, Move *destMoves); +void sub_8094184(struct unkStruct_8094924 *, struct unkStruct_8094184 *); +void sub_80941FC(struct unkStruct_8094924 *, struct unkStruct_8094184 *); -void unk_FixLinkedMovesSetEnabled8_v2(struct Move* move); - -void sub_8092D54(u8 *buffer, struct Move *move); -extern void CopyAndResetMove(struct Move *, struct Move *); - -void unk_GetLinkedSequences4(struct Move* moves, struct Move linkedSequences[4][4]); -void unk_LinkedSequencesToMoves4(struct Move* moves, struct Move linkedSequences[4][4]); -void unk_GetLinkedSequences8(struct Move* moves, struct Move linkedSequences[8][8]); -void unk_LinkedSequencesToMoves8(struct Move* moves, struct Move linkedSequences[8][8]); -void unk_GetLinkedSequences8_v2(struct Move* moves, struct Move linkedSequences[8][8]); -void unk_LinkedSequencesToMoves8_v2(struct Move* moves, struct Move linkedSequences[8][8]); - -int unk_FindMarkedMoveInLinkedSequences44(struct Move linkedSequences[4][4]); -void unk_LinkedSequencesToMoves4(struct Move* moves, struct Move linkedSequences[4][4]); -int unk_FindMarkedMoveInLinkedSequences88(struct Move linkedSequences[8][8]); -void unk_LinkedSequencesToMoves8(struct Move* moves, struct Move linkedSequences[8][8]); -int unk_FindMarkedMoveInLinkedSequences88_v2(struct Move linkedSequences[8][8]); -void unk_LinkedSequencesToMoves8_v2(struct Move* moves, struct Move linkedSequences[8][8]); - -bool8 IsMoveSet(int index, struct Move* struct_ptr); -bool8 IsMoveEnabled(int index, struct Move* struct_ptr); -bool8 TryLinkMovesAfter(int index, struct Move* moves); -bool8 UnlinkMovesAfter(int index, struct Move* moves); -bool8 ToggleSetMove(int index, struct Move* moves); -void UnSetMove(int index, struct Move* moves); -bool8 ToggleMoveEnabled(int index, struct Move* moves); -bool8 sub_8093318(int param_1, void* src_struct); -bool8 sub_809333C(int param_1, void* src_struct); - -#endif // GUARD_MOVES_H +#endif // GUARD_MOVES_H \ No newline at end of file diff --git a/include/music.h b/include/music.h index dab7729d2..6298927e1 100644 --- a/include/music.h +++ b/include/music.h @@ -1,43 +1,6 @@ #ifndef GUARD_MUSIC_H #define GUARD_MUSIC_H -// PMD keeps it's own copy of music players for some reason -struct PMDMusicPlayer -{ - u16 unk0; - u16 songIndex; - u16 volume; - bool8 isNotMaxVolume; -}; - -void StopBGMusicVSync(void); -void StartBGMusicVSync(void); -bool8 IsValidSong(u32 songIndex); -void StartNewBGM(u16 songIndex); -bool8 IsBGSong(u32 songIndex); -bool8 IsSoundEffect(u32 songIndex); -bool8 IsFanfare(u32 songIndex); -u16 GetMusicPlayerIndex(u16 songIndex); -bool8 IsMusicPlayerPlaying(u16 songIndex); -void StartNewBGM(u16 songIndex); -void FadeInNewBGM(u16 songIndex, u16 speed); -u16 GetCurrentBGSong(void); -void QueueBGM(u16 songIndex); -void StopBGM(void); // stops all BGM, fanfares and SE's -void FadeOutBGM(u16 speed); -void PlayFanfareSE(u16 songIndex, u16 volume); -void StopFanfareSE(u16 songIndex); -void FadeOutFanfareSE(u16 songIndex, u16 speed); -bool8 IsFanfareSEPlaying(u16 songIndex); -void SoundBiasReset(void); -void SoundBiasSet(void); -void UpdateSound(void); -void SoundVSync(void); -void nullsub_18(void); - -void nullsub_19(void); -void nullsub_20(u16 songIndex); - #define NUM_FANFARES 19 #define FANFARE_START_INDEX 200 @@ -78,4 +41,34 @@ enum Fanfare_Player_State FANFARE_PLAYER_STATE_PLAYING = 3, }; -#endif //GUARD_MUSIC_H +// size: 0x8. PMD keeps its own copy of music players for some reason +typedef struct PMDMusicPlayer +{ + u16 unk0; + u16 songIndex; + u16 volume; + bool8 isNotMaxVolume; +} PMDMusicPlayer; + +void FadeInNewBGM(u16 songIndex, u16 speed); +void FadeOutBGM(u16 speed); +void FadeOutFanfareSE(u16 songIndex, u16 speed); +u16 GetCurrentBGSong(void); +void InitMusic(void); +bool8 IsFanfareSEPlaying(u16 songIndex); +void nullsub_18(void); +void PlayFanfareSE(u16 songIndex, u16 volume); +void QueueBGM(u16 songIndex); +void SoundVSync(void); +void StartBGMusicVSync(void); +void StartNewBGM(u16 songIndex); +void StopBGM(void); // Stops all BGM, fanfares and SE's +void StopBGMusicVSync(void); +void StopFanfareSE(u16 songIndex); +void UpdateSound(void); + +// libagbsyscall +extern void SoundBiasReset(void); +extern void SoundBiasSet(void); + +#endif //GUARD_MUSIC_H \ No newline at end of file diff --git a/include/pelipper_board.h b/include/pelipper_board.h index 72b5c0387..bc063ac22 100644 --- a/include/pelipper_board.h +++ b/include/pelipper_board.h @@ -6,13 +6,13 @@ struct unkStruct_203B308 u32 state; u32 unk4; u8 jobIndex; - struct unkStruct_802C39C unkC; + unkStruct_802C39C unkC; u32 menuAction1; u32 menuAction2; - struct MenuStruct unk6C; - struct MenuItem menuItems[8]; + MenuStruct unk6C; + MenuItem menuItems[8]; u16 unkFC[8]; - struct UnkTextStruct2 unk10C[4]; + UnkTextStruct2 unk10C[4]; }; extern struct unkStruct_203B308 *gPelipperBoard; diff --git a/include/personality_test.h b/include/personality_test.h index 2c0e39f6b..339595cce 100644 --- a/include/personality_test.h +++ b/include/personality_test.h @@ -39,7 +39,7 @@ struct PersonalityTestTracker /* 0x44 */ s32 NatureTotals[NUM_PERSONALITIES]; /* 0x78 */ u8 QuestionTracker[NUM_QUIZ_QUESTIONS]; /* 0xB0 */ u32 playerGender; // 1 = Female, 0 = Male - /* 0xB4 */ struct MenuInputStructSub input; + /* 0xB4 */ MenuInputStructSub input; }; struct PersonalityStruct_203B404 @@ -48,10 +48,10 @@ struct PersonalityStruct_203B404 /* 0x0 */ s16 StarterID; /* 0x2 */ s16 PartnerArray[NUM_PARTNERS]; u8 unk16; - /* 0x18 */ struct MenuInputStruct input; + /* 0x18 */ MenuInputStruct input; u32 unk4C; - /* 0x50 */ struct UnkTextStruct2 *unk50; - /* 0x54 */ struct UnkTextStruct2 unk54[4]; + /* 0x50 */ UnkTextStruct2 *unk50; + /* 0x54 */ UnkTextStruct2 unk54[4]; /* 0xB4 */ u8 unkb4[4]; }; diff --git a/include/pokemon.h b/include/pokemon.h index 2ed0a6f1c..dfa51fe6c 100644 --- a/include/pokemon.h +++ b/include/pokemon.h @@ -3,7 +3,7 @@ #include "dungeon_global_data.h" #include "file_system.h" -#include "item.h" +#include "items.h" #include "constants/move.h" @@ -11,120 +11,120 @@ #define OFFENSE_SP 1 // size: 0x4 -struct Offense +typedef struct Offense { /* 0x0 */ u8 att[2]; // Atk, SpAtk /* 0x2 */ u8 def[2]; // Def, SpDef -}; +} Offense; // size: 0x4 -struct unkPokeSubStruct_C +typedef struct unkPokeSubStruct_C { u8 level; u8 fill1[3]; -}; +} unkPokeSubStruct_C; enum PokemonUnk0Flags { FLAG_ON_TEAM = 2, }; // size: 0x58 -struct PokemonStruct +typedef struct PokemonStruct1 { - u16 unk0; // recruited?? + u16 unk0; // Probably a union: Sometimes ldrh and sometimes ldrb. Recruited?? /* 0x2 */ bool8 isTeamLeader; /* 0x3 */ u8 level; - /* 0x4 */ struct DungeonLocation dungeonLocation; - /* 0x8 */ s16 speciesNum; // species # - struct unkPokeSubStruct_C unkC[2]; + /* 0x4 */ DungeonLocation dungeonLocation; + /* 0x8 */ s16 speciesNum; + unkPokeSubStruct_C unkC[2]; /* 0x14 */ s16 IQ; /* 0x16 */ u16 pokeHP; - /* 0x18 */ struct Offense offense; + /* 0x18 */ Offense offense; /* 0x1C */ u32 currExp; /* 0x20 */ u32 IQSkills; /* 0x24 */ u8 tacticIndex; - /* 0x28 */ struct BulkItem heldItem; - /* 0x2C */ struct Move moves[MAX_MON_MOVES]; + /* 0x28 */ BulkItem heldItem; + /* 0x2C */ Move moves[MAX_MON_MOVES]; /* 0x4C */ u8 name[POKEMON_NAME_LENGTH]; -}; +} PokemonStruct1; // size: 0x4 -struct unkStruct_808E6F4 +typedef struct unkStruct_808E6F4 { s16 unk0; u8 unk2; -}; +} unkStruct_808E6F4; // size: 0x4 -struct EvolveStage +typedef struct EvolveStage { /* 0x0 */ s16 speciesNum; /* 0x2 */ u8 level; -}; +} EvolveStage; // size: 0x24 -struct unkStruct_8094184 +typedef struct unkStruct_8094184 { - /* 0x0 */ struct Move moves[MAX_MON_MOVES]; + /* 0x0 */ Move moves[MAX_MON_MOVES]; u8 unk20; -}; +} unkStruct_8094184; // size: 0x64 -struct PokemonStruct2 +typedef struct PokemonStruct2 { - u16 unk0; // corresponds to unk0 in PokemonStruct + u16 unk0; // corresponds to unk0 in PokemonStruct /* 0x2 */ bool8 isTeamLeader; /* 0x3 */ u8 level; - /* 0x4 */ struct DungeonLocation dungeonLocation; + /* 0x4 */ DungeonLocation dungeonLocation; /* 0x8 */ u16 IQ; s16 unkA; u16 unkC; /* 0xE */ s16 speciesNum; - u16 unk10; // pokeHP - u16 unk12; // pokeHP - /* 0x14 */ struct Offense offense; // offense (other offset) + u16 unk10; // pokeHP + u16 unk12; // pokeHP + /* 0x14 */ Offense offense; // offense (other offset) /* 0x18 */ u32 currExp; - /* 0x1C */ struct unkStruct_8094184 moves; - /* 0x40 */ struct Item itemSlot; // heldItem - u32 unk44; // some struct - u32 unk48; // some struct (same type as 44) - /* 0x4C */ u32 IQSkills; // unk20 + /* 0x1C */ unkStruct_8094184 moves; + /* 0x40 */ Item itemSlot; // heldItem + u32 unk44; // some struct + u32 unk48; // some struct (same type as 44) + /* 0x4C */ u32 IQSkills; // unk20 /* 0x50 */ u8 tacticIndex; - struct unkStruct_808E6F4 unk54; - /* 0x58 */ u8 name[POKEMON_NAME_LENGTH]; // name (other offset) -}; + unkStruct_808E6F4 unk54; + /* 0x58 */ u8 name[POKEMON_NAME_LENGTH]; // name (other offset) +} PokemonStruct2; // size: 0x90E8 -struct unkStruct_203B45C +typedef struct unkStruct_203B45C { - /* 0x0 */ struct PokemonStruct pokemon[NUM_MONSTERS]; - /* 0x8DF8 */ struct PokemonStruct2 pokemon2[4]; - /* 0x8F88 */ struct PokemonStruct team[MAX_TEAM_MEMBERS]; -}; + /* 0x0 */ PokemonStruct1 pokemon[NUM_MONSTERS]; + /* 0x8DF8 */ PokemonStruct2 pokemon2[4]; + /* 0x8F88 */ PokemonStruct1 team[MAX_TEAM_MEMBERS]; +} unkStruct_203B45C; // size: 0x4 -struct PreEvolution +typedef struct PreEvolution { /* 0x0 */ s16 evolveFrom; /* 0x2 */ u16 evolveType; -}; +} PreEvolution; // size: 0x4 -struct EvolutionRequirements +typedef struct EvolutionRequirements { /* 0x0 */ s16 mainRequirement; /* 0x2 */ u16 additionalRequirement; -}; +} EvolutionRequirements; // size: 0x8 -struct unkEvolve +typedef struct unkEvolve { - /* 0x0 */ struct PreEvolution preEvolution; - /* 0x4 */ struct EvolutionRequirements evolutionRequirements; -}; + /* 0x0 */ PreEvolution preEvolution; + /* 0x4 */ EvolutionRequirements evolutionRequirements; +} unkEvolve; // size: 0x48 -struct MonsterDataEntry +typedef struct MonsterDataEntry { /* 0x0 */ u8* species; /* 0x4 */ u8* category; @@ -152,16 +152,15 @@ struct MonsterDataEntry u8 unk31; // 10 for all Pokémon. u8 unk32; // 24 for all Pokémon. /* 0x33 */ bool8 toolboxEnabled; // If false, the AI can't use items. Doesn't seem to be used, as it's true for all Pokémon. - /* 0x34 */ struct PreEvolution preEvolution; - /* 0x38 */ struct EvolutionRequirements evolutionRequirements; + /* 0x34 */ PreEvolution preEvolution; + /* 0x38 */ EvolutionRequirements evolutionRequirements; /* 0x3C */ s16 dexInternal[2]; // dexNo and internalNo /* 0x40 */ s16 recruitRate; /* 0x42 */ s16 alphabetParent[2]; // alphabetNo and parentNo -}; - +} MonsterDataEntry; // size: 0xC | https://www.pokecommunity.com/showthread.php?t=407371 -struct LevelData +typedef struct LevelData { /* 0x0 */ s32 expRequired; /* 0x4 */ u8 gainHP; @@ -171,43 +170,46 @@ struct LevelData /* 0x8 */ u8 gainDef; /* 0x9 */ u8 gainSPDef; u16 fillA; -}; +} LevelData; // size: 0x1A4 -struct unkStruct_808E218_arg +typedef struct unkStruct_808E218_arg { u16 unk0[NUM_MONSTERS]; /* 0x1A0 */ u32 count; -}; +} unkStruct_808E218_arg; // size: 0xC -struct unkStruct_808E218 +typedef struct unkStruct_808E218 { // leveldata? (same size) - struct unkStruct_808E6F4 unk0[3]; -}; + unkStruct_808E6F4 unk0[3]; +} unkStruct_808E218; -extern struct unkStruct_203B45C *gRecruitedPokemonRef; +extern unkStruct_203B45C *gRecruitedPokemonRef; void LoadMonsterParameters(void); -struct unkStruct_203B45C *GetRecruitedPokemon(void); +unkStruct_203B45C *GetRecruitedPokemon(void); void InitializeRecruitedPokemon(void); +// These two need to be overridden in status_actions.c +// Uncomment when fixed +//void CopyCyanMonsterNametoBuffer(u8 *buffer, s16 index); +//u8 GetBodySize(s16 index); + void CopyMonsterNametoBuffer(u8 * buffer, s16 index); void CopyYellowMonsterNametoBuffer(u8 *buffer, s16 index); -void CopyCyanMonsterNametoBuffer(u8 *buffer, s16 index); -void PrintColoredPokeNameToBuffer(u8 *buffer, struct PokemonStruct *pokemon, s32 colorNum); +void PrintColoredPokeNameToBuffer(u8 *buffer, PokemonStruct1 *pokemon, s32 colorNum); void sub_808D930(u8 *buffer, s32 index); -void sub_808D9DC(u8 *buffer, struct PokemonStruct2 *param_2, s32 colorNum); -void sub_808DA0C(u8 *buffer, struct PokemonStruct2 *param_2); -void PeekPokemonItem(s16 index_, struct BulkItem* item); -void GivePokemonItem(s16 index_, struct BulkItem* item); -bool8 IsPokemonRenamed(struct PokemonStruct* pokemon); +void sub_808D9DC(u8 *buffer, PokemonStruct2 *, s32 colorNum); +void sub_808DA0C(u8 *buffer, PokemonStruct2 *); +void PeekPokemonItem(s16 index_, BulkItem* item); +void GivePokemonItem(s16 index_, BulkItem* item); +bool8 IsPokemonRenamed(PokemonStruct1* pokemon); bool8 CanMonLearnMove(u16 moveID, s16 _species); u8 *GetCategoryString(s16 index); -u8 GetBodySize(s16 index); u8 GetShadowSize(s16 index); char * GetMonSpecies(s16 index); s32 GetMovementSpeed(s16 index); @@ -231,21 +233,24 @@ s16 GetRecruitRate(s16 index); s16 GetAlphabetParentNo(s16 index, s32 r1); s16 GetInternalNo(s16 index); s32 CalculateEXPGain(s16 index, s32 level); -s16 GetPokemonEvolveConditons(s16 index, struct unkEvolve *r1); +s16 GetPokemonEvolveConditons(s16 index, unkEvolve *); u8 GetPokemonOverworldPalette(s16 index, u32 r1); bool8 IsPokemonDialogueSpriteAvail(s16 index, s32 r1); -struct OpenedFile *OpenPokemonDialogueSpriteFile(s16 index); -struct OpenedFile *GetDialogueSpriteDataPtr(s16 index); +OpenedFile *OpenPokemonDialogueSpriteFile(s16 index); +OpenedFile *GetDialogueSpriteDataPtr(s16 index); s32 GetUnownIndex(s16 index); -void sub_808E6F4(struct unkStruct_808E6F4* a1); -s32 GetEvolutionSequence(struct PokemonStruct* pokemon, struct EvolveStage* a2); -void xxx_pokemonstruct_to_pokemon2_808DE50(struct PokemonStruct2* r0, struct PokemonStruct *r1, s32 r2); -void SavePokemonStruct(struct unkStruct_8094924* a1, struct PokemonStruct* pokemon); -void RestorePokemonStruct(struct unkStruct_8094924*, struct PokemonStruct*); -s32 sub_808E218(struct unkStruct_808E218_arg* a1, struct PokemonStruct* pokemon); +void sub_808E6F4(unkStruct_808E6F4 *); +s32 GetEvolutionSequence(PokemonStruct1 *pokemon, EvolveStage *); +void xxx_pokemonstruct_to_pokemon2_808DE50(PokemonStruct2 *, PokemonStruct1 *, s32); +void SavePokemonStruct(unkStruct_8094924 *, PokemonStruct1 *pokemon); +void RestorePokemonStruct(unkStruct_8094924 *, PokemonStruct1 *); +s32 sub_808E218(unkStruct_808E218_arg *, PokemonStruct1 *pokemon); // pokemon.s +extern PokemonStruct1 *GetPlayerPokemonStruct(void); extern void sub_808CFD0(u8 *, s16, u8 *, u8, u32 *, u16 *); extern u32 sub_808D1DC(u8 *); +extern s32 sub_808D544(u32); +extern s32 sub_808D580(s32 *); #endif // GUARD_POKEMON_H diff --git a/include/pokemon_3.h b/include/pokemon_3.h index eb62866e4..6e79a87d5 100644 --- a/include/pokemon_3.h +++ b/include/pokemon_3.h @@ -1,14 +1,16 @@ #ifndef GUARD_POKEMON_3_H #define GUARD_POKEMON_3_H -struct EvolveStatus +#include "pokemon.h" + +typedef struct EvolveStatus { u8 evoItem1; u8 evoItem2; u8 unk6; u16 evolutionConditionStatus; s16 targetEvolveSpecies; -}; +} EvolveStatus; bool8 HasRecruitedMon(s16 species); s16 GetBaseSpecies(s16 index); @@ -24,7 +26,7 @@ void ToggleIQSkill(u8 *param_1, u32 skillIndex); void SetIQSkill(u8 *param_1, u32 skillIndex); bool8 IsIQSkillSet(u8 *IQSkillFlags, u32 IQSkill); void SetDefaultIQSkills(u8 *param_1, bool8 enableSelfCurer); -void sub_808F468(struct PokemonStruct *param_1, struct EvolveStatus *evolveStatus, u8 param_3); -u32 sub_808F734(struct PokemonStruct *pokemon, s16 _species); +void sub_808F468(PokemonStruct1 *param_1, EvolveStatus *evolveStatus, u8 param_3); +u32 sub_808F734(PokemonStruct1 *pokemon, s16 _species); #endif diff --git a/include/pokemon_mid.h b/include/pokemon_mid.h new file mode 100644 index 000000000..2e638ea81 --- /dev/null +++ b/include/pokemon_mid.h @@ -0,0 +1,10 @@ +#ifndef GUARD_POKEMON_MID_H +#define GUARD_POKEMON_MID_H + +#include "pokemon.h" + +void PrintPokeNameToBuffer(u8 *buffer, PokemonStruct1 *pokemon); + +bool8 sub_808DA44(s32, u32); + +#endif // GUARD_POKEMON_MID_H \ No newline at end of file diff --git a/include/position.h b/include/position.h index 39caa4220..f2be31c70 100644 --- a/include/position.h +++ b/include/position.h @@ -2,17 +2,17 @@ #define GUARD_POSITION_H // size: 0x4 -struct Position +typedef struct Position { - s16 x; - s16 y; -}; + /* 0x0 */ s16 x; + /* 0x2 */ s16 y; +} Position; // size: 0x8 -struct Position32 +typedef struct Position32 { - s32 x; - s32 y; -}; + /* 0x0 */ s32 x; + /* 0x4 */ s32 y; +} Position32; -#endif +#endif // GUARD_POSITION_H \ No newline at end of file diff --git a/include/position_util.h b/include/position_util.h index e607092bc..eeb6cf82e 100644 --- a/include/position_util.h +++ b/include/position_util.h @@ -3,7 +3,7 @@ #include "position.h" -s32 GetDirectionTowardsPosition(struct Position *originPos, struct Position *targetPos); -s32 GetDistance(struct Position *pos1, struct Position *pos2); +s32 GetDirectionTowardsPosition(Position *originPos, Position *targetPos); +s32 GetDistance(Position *pos1, Position *pos2); #endif diff --git a/include/post_office_guide1.h b/include/post_office_guide1.h new file mode 100644 index 000000000..b80e89dbb --- /dev/null +++ b/include/post_office_guide1.h @@ -0,0 +1,24 @@ +#ifndef GUARD_POST_OFFICE_GUIDE1_H +#define GUARD_POST_OFFICE_GUIDE1_H + +#include "file_system.h" + +// size: 0x18 +typedef struct PostOfficeWork +{ + /* 0x0 */ u8 state; + /* 0x4 */ s32 currMenuChoice; + /* 0x8 */ OpenedFile *faceFile; + /* 0xC */ u8 *faceData; + u16 unk10; + u16 unk12; + u8 unk14; + u8 unk15; + u8 unk16; +} PostOfficeWork; + +void CleanHelperPelipper(void); +bool8 CreateHelperPelipperMenu(s16 speciesID); +u32 HelperPelipperCallback(void); + +#endif // GUARD_POST_OFFICE_GUIDE1_H \ No newline at end of file diff --git a/include/post_office_guide2.h b/include/post_office_guide2.h new file mode 100644 index 000000000..06b1a6f46 --- /dev/null +++ b/include/post_office_guide2.h @@ -0,0 +1,22 @@ +#ifndef GUARD_POST_OFFICE_GUIDE2_H +#define GUARD_POST_OFFICE_GUIDE2_H + +#include "input.h" +#include "text.h" + +// size: 0x78 +typedef struct unkStruct_203B330 +{ + /* 0x0 */ MenuInputStructSub input; + u8 unkC; + /* 0xD */ u8 dungeonIndex; + u32 unk10; + UnkTextStruct2 *unk14; + UnkTextStruct2 unk18[4]; +} unkStruct_203B330; + +bool8 sub_80319A4(u8, u8 dungeon, s32); +u32 sub_80319F8(void); +void sub_8031A3C(void); + +#endif // GUARD_POST_OFFICE_GUIDE2_H \ No newline at end of file diff --git a/include/quick_save_read.h b/include/quick_save_read.h new file mode 100644 index 000000000..5d6c2bd7f --- /dev/null +++ b/include/quick_save_read.h @@ -0,0 +1,18 @@ +#ifndef GUARD_QUICK_SAVE_READ_H +#define GUARD_QUICK_SAVE_READ_H + +// size: 0x10 +typedef struct QuickSaveRead +{ + /* 0x0 */ s32 state; + /* 0x4 */ u8 *dest; + /* 0x8 */ u32 size; + /* 0xC */ bool8 saveValid; +} QuickSaveRead; + +void FinishQuickSaveRead(void); +bool8 IsQuickSaveValid(void); +void PrepareQuickSaveRead(u8 *dest, u32 size); +bool8 ReadQuickSave(void); + +#endif // GUARD_QUICK_SAVE_READ_H \ No newline at end of file diff --git a/include/quick_save_write.h b/include/quick_save_write.h new file mode 100644 index 000000000..f164c9a63 --- /dev/null +++ b/include/quick_save_write.h @@ -0,0 +1,18 @@ +#ifndef GUARD_QUICK_SAVE_WRITE_H +#define GUARD_QUICK_SAVE_WRITE_H + +// size: 0x14 +typedef struct QuickSaveWrite +{ + /* 0x0 */ s32 state; + u8 *unk4; + u32 unk8; + u8 unkC; + /* 0x10 */ u32 quickSaveStatus; +} QuickSaveWrite; + +void FinishQuickSaveWrite(void); +void PrepareQuickSaveWrite(u8 *, u32, u8); +u32 WriteQuickSave(void); + +#endif // GUARD_QUICK_SAVE_WRITE_H \ No newline at end of file diff --git a/include/reg_control.h b/include/reg_control.h index b351e792b..d9f7a1669 100644 --- a/include/reg_control.h +++ b/include/reg_control.h @@ -4,12 +4,12 @@ #include "main.h" // size: 0x8 -struct unkStruct_202D648 +typedef struct unkStruct_202D648 { s16 unk0; s16 unk2; // Vcount?? IntrCallback unk4; // some function... just making it IntrCallback for now -}; +} unkStruct_202D648; extern s16 gUnknown_203B0A8; extern s16 gUnknown_203B0AA; @@ -18,6 +18,7 @@ extern s16 gUnknown_203B0AE; void nullsub_17(void); void xxx_update_bg_sound_input(void); + void sub_800BA5C(void); #endif // GUARD_CODE_800B5F0_H \ No newline at end of file diff --git a/include/rescue_password_menu.h b/include/rescue_password_menu.h index d2f84f9a6..5883102fa 100644 --- a/include/rescue_password_menu.h +++ b/include/rescue_password_menu.h @@ -11,10 +11,10 @@ struct RescuePasswordMenu // size: 0x214 u32 currMenu; u32 state; - struct MenuStruct unk8[4]; - struct UnkTextStruct2 unk148[4]; - struct UnkTextStruct2 unk1A8[4]; - struct SpriteOAM unk208; + MenuStruct unk8[4]; + UnkTextStruct2 unk148[4]; + UnkTextStruct2 unk1A8[4]; + SpriteOAM unk208; u32 unk210; }; diff --git a/include/save.h b/include/save.h index c86e57ad4..f351fccfe 100644 --- a/include/save.h +++ b/include/save.h @@ -6,7 +6,7 @@ #include "exclusive_pokemon.h" #include "rescue_team_info.h" #include "pokemon.h" -#include "item.h" +#include "items.h" #include "code_80958E8.h" enum @@ -47,18 +47,18 @@ struct UnkStruct_sub_8011DAC { struct UnkStruct_203B184 { - /* 0x0 */ struct TeamInventory *MoneyItems; - /* 0x4 */ struct unkStruct_203B45C *recruitedPokemon; - /* 0x8 */ struct unkStruct_203B480 *unk8; - /* 0xC */ struct unkStruct_203B484 *unkC; + /* 0x0 */ TeamInventory *MoneyItems; + /* 0x4 */ unkStruct_203B45C *recruitedPokemon; + /* 0x8 */ unkStruct_203B480 *unk8; + /* 0xC */ unkStruct_203B484 *unkC; /* 0x10 */ u32 *unk10; - /* 0x14 */ struct unkStruct_203B48C *unk14; - /* 0x18 */ struct unkStruct_203B490 *mailInfo; + /* 0x14 */ unkStruct_203B48C *unk14; + /* 0x18 */ unkStruct_203B490 *mailInfo; /* 0x1C */ struct RescueTeamData *RescueTeamInfo; - /* 0x20 */ u32 unk20; + /* 0x20 */ struct unkStruct_203B494 *unk20; /* 0x24 */ struct ExclusivePokemonData *ExclusivePokemon; /* 0x28 */ bool8 *BoughtFriendAreas; - /* 0x2C */ struct GameOptions *gameOptions; + /* 0x2C */ GameOptions *gameOptions; /* 0x30 */ struct PlayTimeStruct *playTime; u32 unk34; u32 unk38; @@ -86,19 +86,6 @@ bool8 IsSaveCorrupted(void); void sub_8012284(void); void sub_8012298(void); void sub_80122A8(void); -void PrepareSavePakRead(void); -bool8 ReadSavePak(void); -void FinishReadSavePak(void); -void PrepareSavePakWrite(s16 PokemonID); -bool8 WriteSavePak(void); -u32 GetSavePakStatus(void); -void FinishWriteSavePak(void); -bool8 ReadQuickSave(void); -bool8 IsQuickSaveValid(void); -void FinishQuickSaveRead(void); -void PrepareQuickSaveWrite(u8 *r0, u32 r1, u8 r2); -u32 WriteQuickSave(void); -void FinishQuickSaveWrite(void); void sub_8012298(); void sub_80122D0(); @@ -111,4 +98,7 @@ u32 WriteSaveSector(s32 *a, u8 *src, s32 size); void CalculateChecksum(u8 *out, u32 size); bool8 ValidateChecksum(u8 *in, u32 size); -#endif // GUARD_SAVE_H +s32 sub_80121D4(s32 *a, u8 *src, s32 size); +u32 sub_80121E0(u32); + +#endif // GUARD_SAVE_H \ No newline at end of file diff --git a/include/save_read.h b/include/save_read.h new file mode 100644 index 000000000..f32d454a1 --- /dev/null +++ b/include/save_read.h @@ -0,0 +1,15 @@ +#ifndef GUARD_SAVE_READ_H +#define GUARD_SAVE_READ_H + +// size: 0x8 +typedef struct SavePakRead +{ + /* 0x0 */ u32 state; + /* 0x4 */ u32 readStatus; +} SavePakRead; + +void PrepareSavePakRead(void); +bool8 ReadSavePak(void); +void FinishReadSavePak(void); + +#endif // GUARD_SAVE_READ_H \ No newline at end of file diff --git a/include/save_write.h b/include/save_write.h new file mode 100644 index 000000000..8fa8be3ef --- /dev/null +++ b/include/save_write.h @@ -0,0 +1,28 @@ +#ifndef GUARD_SAVE_WRITE_H +#define GUARD_SAVE_WRITE_H + +#include "file_system.h" + +// size: 0x20 +typedef struct SavePakWrite +{ + /* 0x0 */ u32 state; + s32 unk4; + /* 0x8 */ u32 saveStatus; + /* 0xC */ OpenedFile *faceFile; + /* 0x10 */ u8 *faceData; + u16 unk14; + u16 unk16; + u8 unk18; + u8 unk19; + u8 unk1A; + u8 unk1B; + /* 0x1C */ u16 pokeID; +} SavePakWrite; + +void FinishWriteSavePak(void); +u32 GetSavePakStatus(void); +void PrepareSavePakWrite(s16 pokemonID); +bool8 WriteSavePak(void); + +#endif // GUARD_SAVE_WRITE_H \ No newline at end of file diff --git a/include/sprite.h b/include/sprite.h index f4e4ce738..1bf4e163a 100644 --- a/include/sprite.h +++ b/include/sprite.h @@ -7,30 +7,30 @@ #include "sprite_oam.h" // size: 0x8 -struct UnkSpriteLink +typedef struct UnkSpriteLink { struct UnkSpriteLink *unk0; - struct SpriteOAM *unk4; -}; + SpriteOAM *unk4; +} UnkSpriteLink; // size: 0x808 -struct SpriteList +typedef struct SpriteList { - struct UnkSpriteLink sprites[256]; + UnkSpriteLink sprites[256]; u32 unk800; u32 unk804; -}; +} SpriteList; // size: 0xC -struct unkStruct_20266B0 +typedef struct unkStruct_20266B0 { /* 0x0 */ s32 byteCount; /* 0x4 */ void *src; /* 0x8 */ void *dest; -}; +} unkStruct_20266B0; // size: ? 0x3C for now -struct EntitySpriteInfo +typedef struct EntitySpriteInfo { u16 unk0; // 0x2 and 0x6 seem to be related to the sprite animation, though not sure how they're related. @@ -42,9 +42,9 @@ struct EntitySpriteInfo /* 0x4 */ u16 spriteAnimationIndex; /* 0x6 */ u16 spriteAnimationCounter2; // The position of the sprite within the tile. The animation may change the position slightly. - /* 0x8 */ struct Position spritePos; + /* 0x8 */ Position spritePos; // Offset of the sprite from its position at the start of the animation. Changes alongside spritePos. - /* 0xC */ struct Position spritePosOffset; + /* 0xC */ Position spritePosOffset; u8 fill10[0x14 - 0x10]; u32 unk14; u32 unk18; @@ -62,31 +62,31 @@ struct EntitySpriteInfo u32 unk30; u32 unk34; u32 unk38; -}; +} EntitySpriteInfo; // size: ? -struct Dungeon_ax +typedef struct Dungeon_ax { u32 unk0; u32 **unk4; u8 fill8[0xC - 0x8]; u32 unkC; u32 unk10; -}; +} Dungeon_ax; -void AddSprite(struct SpriteOAM *, s32, struct UnkSpriteMem *, struct unkStruct_2039DB0 *); +void AddSprite(SpriteOAM *, s32, UnkSpriteMem *, unkStruct_2039DB0 *); void BlinkSavingIcon(void); void CopySpritesToOam(void); void InitSprites(void); void ResetSprites(bool8); -void SetSavingIconCoords(struct Position *); -void sub_8004E8C(struct unkStruct_2039DB0 *); +void SetSavingIconCoords(Position *); +void sub_8004E8C(unkStruct_2039DB0 *); void sub_8005180(void); void sub_8005304(void); -void sub_800533C(struct ax_pose **, struct UnkSpriteMem **, struct axdata1 *, u16 *, bool8); -void sub_80053AC(struct EntitySpriteInfo *, struct OpenedFile *, u32, u32, u32, u32, bool8); -void sub_80053D0(struct EntitySpriteInfo *, struct Dungeon_ax *, u32, u32, u32, u32, bool8); -void sub_800543C(struct EntitySpriteInfo *, struct OpenedFile *, u32, u32, u32, bool8); +void sub_800533C(ax_pose **, UnkSpriteMem **, axdata1 *, u16 *, bool8); +void sub_80053AC(EntitySpriteInfo *, OpenedFile *, u32, u32, u32, u32, bool8); +void sub_80053D0(EntitySpriteInfo *, Dungeon_ax *, u32, u32, u32, u32, bool8); +void sub_800543C(EntitySpriteInfo *, OpenedFile *, u32, u32, u32, bool8); void sub_80054BC(struct axPokemon *); #endif // GUARD_SPRITE_H \ No newline at end of file diff --git a/include/sprite_oam.h b/include/sprite_oam.h index 2464d5bd4..424c44c98 100644 --- a/include/sprite_oam.h +++ b/include/sprite_oam.h @@ -2,7 +2,7 @@ #define GUARD_SPRITE_OAM_H // size: 0x8. Similar to struct OamData but unk6 is not copied to OAM -struct SpriteOAM +typedef struct SpriteOAM { // y:8 affineMode1:1 affineMode2:1 objMode:2 mosaic:1 bpp:1 shape:2 /* 0x0 */ u16 attrib1; @@ -12,7 +12,7 @@ struct SpriteOAM /* 0x4 */ u16 attrib3; // unk6_0:1 unk6_1:1 unk6_2:2? unk6_4:12 u16 unk6; -}; +} SpriteOAM; // The SpriteOAM struct is handled with macros most likely. // Most funcs that deal with it look the same and do some weird bit manipulations one by one on the attributes. diff --git a/include/status.h b/include/status.h index c72583aeb..011a987f3 100644 --- a/include/status.h +++ b/include/status.h @@ -7,34 +7,34 @@ #define FLASH_FIRE_STATUS_MAXED 1 #define FLASH_FIRE_STATUS_NOT_MAXED 2 -u8 GetFlashFireStatus(struct Entity *pokemon); -void UpdateFlashFireBoost(struct Entity * pokemon, struct Entity *target); -void ChangeAttackMultiplierTarget(struct Entity *pokemon, struct Entity *target, u32 statStage, s32 param_4, bool8 displayMessage); -void ChangeDefenseMultiplierTarget(struct Entity *pokemon, struct Entity *target, u32 statStage, s32 param_4, bool8 displayMessage); -void RaiseAccuracyStageTarget(struct Entity * pokemon, struct Entity * target, s32 statStage); -void LowerAccuracyStageTarget(struct Entity * pokemon, struct Entity * target, s32 statStage, bool8 displayMessage); -void CringeStatusTarget(struct Entity * pokemon,struct Entity * target, bool8 displayMessage); -void ParalyzeStatusTarget(struct Entity * pokemon, struct Entity * target, bool8 displayMessage); -void RaiseMovementSpeedTarget(struct Entity * pokemon, struct Entity * target, s32 turns, bool8 diplayMessage); -void LowerMovementSpeedTarget(struct Entity * pokemon, struct Entity * target, s32 levels, bool8 displayMessage); -void ConfuseStatusTarget(struct Entity * pokemon, struct Entity * target, bool8 displayMessage); -void CowerStatusTarget(struct Entity * pokemon, struct Entity * target, bool8 displayMessage); -void HealTargetHP(struct Entity *pokemon, struct Entity *target, s32 param_3, s32 param_4, bool32 displayMessage); -void HandleScannerOrb(struct Entity* pokemon, struct Entity* target); -void HandleStairsOrb(struct Entity* pokemon, struct Entity* target); -void HandleRadarOrb(struct Entity* pokemon, struct Entity* target); -void HandleLeechSeed(struct Entity * pokemon, struct Entity * target, bool8 displayMessage); -void DestinyBondStatusTarget(struct Entity * pokemon, struct Entity * target); -void SureShotStatusTarget(struct Entity *pokemon, struct Entity * target, s32 turns); -void WhifferStatusTarget(struct Entity *pokemon, struct Entity * target, s32 turns); -void FixedDamageStatusTarget(struct Entity *pokemon, struct Entity * target); -void FocusEnergyStatusTarget(struct Entity *pokemon, struct Entity * target); -void CurseStatusTarget(struct Entity *pokemon, struct Entity * target); -void SnatchStatusTarget(struct Entity * pokemon, struct Entity * target); -void TauntStatusTarget(struct Entity * pokemon, struct Entity * target); -void HandleStockpile(struct Entity * pokemon, struct Entity * target); -void InvisibleStatusTarget(struct Entity * pokemon, struct Entity * target); -void PerishSongTarget(struct Entity * pokemon, struct Entity * target); -void EncoreStatusTarget(struct Entity * pokemon, struct Entity * target); +u8 GetFlashFireStatus(Entity *pokemon); +void UpdateFlashFireBoost(Entity * pokemon, Entity *target); +void ChangeAttackMultiplierTarget(Entity *pokemon, Entity *target, u32 statStage, s32 param_4, bool8 displayMessage); +void ChangeDefenseMultiplierTarget(Entity *pokemon, Entity *target, u32 statStage, s32 param_4, bool8 displayMessage); +void RaiseAccuracyStageTarget(Entity * pokemon, Entity * target, s32 statStage); +void LowerAccuracyStageTarget(Entity * pokemon, Entity * target, s32 statStage, bool8 displayMessage); +void CringeStatusTarget(Entity * pokemon,Entity * target, bool8 displayMessage); +void ParalyzeStatusTarget(Entity * pokemon, Entity * target, bool8 displayMessage); +void RaiseMovementSpeedTarget(Entity * pokemon, Entity * target, s32 turns, bool8 diplayMessage); +void LowerMovementSpeedTarget(Entity * pokemon, Entity * target, s32 levels, bool8 displayMessage); +void ConfuseStatusTarget(Entity * pokemon, Entity * target, bool8 displayMessage); +void CowerStatusTarget(Entity * pokemon, Entity * target, bool8 displayMessage); +void HealTargetHP(Entity *pokemon, Entity *target, s32 param_3, s32 param_4, bool32 displayMessage); +void HandleScannerOrb(Entity* pokemon, Entity* target); +void HandleStairsOrb(Entity* pokemon, Entity* target); +void HandleRadarOrb(Entity* pokemon, Entity* target); +void HandleLeechSeed(Entity * pokemon, Entity * target, bool8 displayMessage); +void DestinyBondStatusTarget(Entity * pokemon, Entity * target); +void SureShotStatusTarget(Entity *pokemon, Entity * target, s32 turns); +void WhifferStatusTarget(Entity *pokemon, Entity * target, s32 turns); +void FixedDamageStatusTarget(Entity *pokemon, Entity * target); +void FocusEnergyStatusTarget(Entity *pokemon, Entity * target); +void CurseStatusTarget(Entity *pokemon, Entity * target); +void SnatchStatusTarget(Entity * pokemon, Entity * target); +void TauntStatusTarget(Entity * pokemon, Entity * target); +void HandleStockpile(Entity * pokemon, Entity * target); +void InvisibleStatusTarget(Entity * pokemon, Entity * target); +void PerishSongTarget(Entity * pokemon, Entity * target); +void EncoreStatusTarget(Entity * pokemon, Entity * target); #endif diff --git a/include/status_actions.h b/include/status_actions.h index 55246277e..953bf93c8 100644 --- a/include/status_actions.h +++ b/include/status_actions.h @@ -4,53 +4,53 @@ #include "constants/move.h" #include "dungeon_entity.h" -bool8 sub_805B668(struct Entity *pokemon, struct Entity *target, struct Move *move, s32 param_4); -bool8 sub_805B734(struct Entity *pokemon, struct Entity *target); -bool8 RecycleMoveAction(struct Entity *pokemon, struct Entity *target); -bool8 ReflectMoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move, s32 param_4); -bool8 sub_805B808(struct Entity *pokemon, struct Entity *target, struct Move *move, s32 param_4); -bool8 sub_805B884(struct Entity *pokemon, struct Entity *target); -bool8 SkullBashMoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move, s32 param_4); -bool8 sub_805B910(struct Entity *pokemon, struct Entity *target, struct Move *move, s32 param_4); -bool8 sub_805B968(struct Entity *pokemon, struct Entity *target, struct Move *move, s32 param_4); -bool8 RockSmashMoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move, s32 param_4); -bool8 sub_805BA44(struct Entity *pokemon, struct Entity *target); -bool8 sub_805BA50(struct Entity *pokemon, struct Entity *target, struct Move *move, s32 param_4); -bool8 sub_805BB64(struct Entity *pokemon, struct Entity *target); -bool8 sub_805BB74(struct Entity *pokemon, struct Entity *target); -bool8 sub_805BB98(struct Entity *pokemon, struct Entity *target); -bool8 CleanseOrbAction(struct Entity *pokemon,struct Entity *target); -bool8 sub_805BC70(struct Entity *pokemon, struct Entity *target); -bool8 sub_805BC98(struct Entity *pokemon, struct Entity *target, struct Move *move, s32 param_4); -bool8 SilenceOrbAction(struct Entity *pokemon,struct Entity *target); -bool8 ScannerOrbAction(struct Entity *pokemon, struct Entity *target); -bool8 RadarOrbAction(struct Entity *pokemon, struct Entity *target); -bool8 TransferOrbAction(struct Entity *pokemon,struct Entity *target); -bool8 sub_805BE90(struct Entity *pokemon, struct Entity *target); -bool8 LuminousOrbAction(struct Entity *pokemon,struct Entity *target); -bool8 sub_805BEAC(struct Entity *pokemon, struct Entity *target); -bool8 sub_805BEB8(struct Entity *pokemon, struct Entity *target); -bool8 sub_805BEC8(struct Entity *pokemon, struct Entity *target); -bool8 EscapeOrbAction(struct Entity *pokemon,struct Entity *target); -bool8 sub_805BF34(struct Entity *pokemon, struct Entity *target); -bool8 TrapbustOrbAction(struct Entity *pokemon,struct Entity *target); -bool8 sub_805C080(struct Entity *pokemon, struct Entity *target); -bool8 sub_805C128(struct Entity *pokemon, struct Entity *target); -bool8 sub_805C138(struct Entity *pokemon, struct Entity *target, struct Move *move, s32 param_4); -bool8 IdentifyOrbAction(struct Entity *pokemon, struct Entity *target); -bool8 sub_805C1BC(struct Entity *pokemon, struct Entity *target, struct Move *move, s32 param_4); -bool8 sub_805C1E4(struct Entity *pokemon, struct Entity *target); -bool8 ShockerOrbAction(struct Entity *pokemon, struct Entity *target); -bool8 sub_805C208(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4); -bool8 sub_805C288(struct Entity *pokemon, struct Entity *target); -bool8 sub_805C2A0(struct Entity *pokemon, struct Entity *target); -bool8 FillInOrbAction(struct Entity *pokemon,struct Entity *target); -bool8 sub_805C3DC(struct Entity *pokemon, struct Entity *target); -bool8 sub_805C3F8(struct Entity *pokemon, struct Entity *target); -bool8 sub_805C45C(struct Entity *pokemon, struct Entity *target); -bool8 MobileOrbAction(struct Entity *pokemon, struct Entity *target); -bool8 StairsOrbAction(struct Entity *pokemon, struct Entity *target); -bool8 LongtossOrbAction(struct Entity *pokemon, struct Entity *target); -bool8 PierceOrbAction(struct Entity *pokemon, struct Entity *target); +bool8 sub_805B668(Entity *pokemon, Entity *target, Move *move, s32 param_4); +bool8 sub_805B734(Entity *pokemon, Entity *target); +bool8 RecycleMoveAction(Entity *pokemon, Entity *target); +bool8 ReflectMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); +bool8 sub_805B808(Entity *pokemon, Entity *target, Move *move, s32 param_4); +bool8 sub_805B884(Entity *pokemon, Entity *target); +bool8 SkullBashMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); +bool8 sub_805B910(Entity *pokemon, Entity *target, Move *move, s32 param_4); +bool8 sub_805B968(Entity *pokemon, Entity *target, Move *move, s32 param_4); +bool8 RockSmashMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4); +bool8 sub_805BA44(Entity *pokemon, Entity *target); +bool8 sub_805BA50(Entity *pokemon, Entity *target, Move *move, s32 param_4); +bool8 sub_805BB64(Entity *pokemon, Entity *target); +bool8 sub_805BB74(Entity *pokemon, Entity *target); +bool8 sub_805BB98(Entity *pokemon, Entity *target); +bool8 CleanseOrbAction(Entity *pokemon,Entity *target); +bool8 sub_805BC70(Entity *pokemon, Entity *target); +bool8 sub_805BC98(Entity *pokemon, Entity *target, Move *move, s32 param_4); +bool8 SilenceOrbAction(Entity *pokemon,Entity *target); +bool8 ScannerOrbAction(Entity *pokemon, Entity *target); +bool8 RadarOrbAction(Entity *pokemon, Entity *target); +bool8 TransferOrbAction(Entity *pokemon,Entity *target); +bool8 sub_805BE90(Entity *pokemon, Entity *target); +bool8 LuminousOrbAction(Entity *pokemon,Entity *target); +bool8 sub_805BEAC(Entity *pokemon, Entity *target); +bool8 sub_805BEB8(Entity *pokemon, Entity *target); +bool8 sub_805BEC8(Entity *pokemon, Entity *target); +bool8 EscapeOrbAction(Entity *pokemon,Entity *target); +bool8 sub_805BF34(Entity *pokemon, Entity *target); +bool8 TrapbustOrbAction(Entity *pokemon,Entity *target); +bool8 sub_805C080(Entity *pokemon, Entity *target); +bool8 sub_805C128(Entity *pokemon, Entity *target); +bool8 sub_805C138(Entity *pokemon, Entity *target, Move *move, s32 param_4); +bool8 IdentifyOrbAction(Entity *pokemon, Entity *target); +bool8 sub_805C1BC(Entity *pokemon, Entity *target, Move *move, s32 param_4); +bool8 sub_805C1E4(Entity *pokemon, Entity *target); +bool8 ShockerOrbAction(Entity *pokemon, Entity *target); +bool8 sub_805C208(Entity *pokemon, Entity *target, Move *move, u32 param_4); +bool8 sub_805C288(Entity *pokemon, Entity *target); +bool8 sub_805C2A0(Entity *pokemon, Entity *target); +bool8 FillInOrbAction(Entity *pokemon,Entity *target); +bool8 sub_805C3DC(Entity *pokemon, Entity *target); +bool8 sub_805C3F8(Entity *pokemon, Entity *target); +bool8 sub_805C45C(Entity *pokemon, Entity *target); +bool8 MobileOrbAction(Entity *pokemon, Entity *target); +bool8 StairsOrbAction(Entity *pokemon, Entity *target); +bool8 LongtossOrbAction(Entity *pokemon, Entity *target); +bool8 PierceOrbAction(Entity *pokemon, Entity *target); #endif diff --git a/include/status_checks.h b/include/status_checks.h index 403945579..9de47e033 100644 --- a/include/status_checks.h +++ b/include/status_checks.h @@ -5,6 +5,6 @@ extern const s16 gConfusedAttackChance; -bool8 HasStatusAffectingActions(struct Entity *pokemon); +bool8 HasStatusAffectingActions(Entity *pokemon); #endif diff --git a/include/status_checks_1.h b/include/status_checks_1.h index e469c6988..68b94027d 100644 --- a/include/status_checks_1.h +++ b/include/status_checks_1.h @@ -3,9 +3,9 @@ #include "dungeon_entity.h" -bool8 HasNegativeStatus(struct Entity *pokemon); -bool8 IsSleeping(struct Entity *pokemon); -bool8 HasLowHealth(struct Entity *pokemon); -s32 sub_8070828(struct Entity *pokemon, bool8 displayMessage); +bool8 HasNegativeStatus(Entity *pokemon); +bool8 IsSleeping(Entity *pokemon); +bool8 HasLowHealth(Entity *pokemon); +s32 sub_8070828(Entity *pokemon, bool8 displayMessage); #endif diff --git a/include/targeting.h b/include/targeting.h index 7bb51e4ff..647e7291a 100644 --- a/include/targeting.h +++ b/include/targeting.h @@ -3,6 +3,6 @@ #include "dungeon_entity.h" -void TargetTileInFront(struct Entity *pokemon); +void TargetTileInFront(Entity *pokemon); #endif diff --git a/include/targeting_flags.h b/include/targeting_flags.h index bf33eb000..eddbe8d71 100644 --- a/include/targeting_flags.h +++ b/include/targeting_flags.h @@ -4,6 +4,6 @@ #include "constants/move.h" #include "dungeon_entity.h" -s16 GetMoveTargetAndRangeForPokemon(struct Entity *pokemon, struct Move *move, bool32 isAI); +s16 GetMoveTargetAndRangeForPokemon(Entity *pokemon, Move *move, bool32 isAI); #endif diff --git a/include/team_inventory.h b/include/team_inventory.h deleted file mode 100644 index d213d1fd6..000000000 --- a/include/team_inventory.h +++ /dev/null @@ -1,26 +0,0 @@ -#ifndef GUARD_TEAM_INVENTORY_H -#define GUARD_TEAM_INVENTORY_H - -#define MAX_KECLEON_ITEM_SHOP_ITEMS 8 -#define MAX_KECLEON_WARE_SHOP_ITEMS 4 - -#include "item.h" - -// size: 0x268 -struct TeamInventory -{ - /* 0x0 */ struct Item teamItems[INVENTORY_SIZE]; - /* 0x50 */ u16 teamStorage[STORAGE_SIZE]; - /* 0x230 */ struct BulkItem kecleonShopItems[MAX_KECLEON_ITEM_SHOP_ITEMS]; - /* 0x250 */ struct BulkItem kecleonWareItems[MAX_KECLEON_WARE_SHOP_ITEMS]; - /* 0x260 */ s32 teamMoney; - /* 0x264 */ s32 teamSavings; -}; - -// Declared in items.c -extern struct TeamInventory *gTeamInventoryRef; - -#define MAX_TEAM_MONEY 99999 -#define MAX_TEAM_SAVINGS 9999999 - -#endif diff --git a/include/text.h b/include/text.h index 71203121e..c1fdee4a9 100644 --- a/include/text.h +++ b/include/text.h @@ -2,7 +2,7 @@ #define GUARD_TEXT_H // size: 0x48 -struct UnkTextStruct1 +typedef struct UnkTextStruct1 { s16 unk0; s16 unk2; @@ -26,14 +26,14 @@ struct UnkTextStruct1 u8 unk44; bool8 unk45; u8 unk46; -}; +} UnkTextStruct1; // size: 0x4 -struct UnkTextStruct2_sub +typedef struct UnkTextStruct2_sub { // I haven't found a func that reads these separately yet, but simply making an arr[2] will cause assignments to break. // Some funcs only match with this union for some reason even though they don't access the variables separately... - // The first func to break is currently sub_801A5D8 in kecleon_bros.c + // The first func to break is currently sub_801A5D8 in kecleon_bros4.c // The first func I matched that uses the array is sub_8006554 in text2.c (using the separated fields doesn't match or get even close) union { struct { @@ -42,20 +42,20 @@ struct UnkTextStruct2_sub } separate; s16 arr[2]; } unk0; -}; +} UnkTextStruct2_sub; // size: 0x18 -struct UnkTextStruct2 +typedef struct UnkTextStruct2 { u8 unk0; u8 fill1[0x4 - 0x1]; s32 unk4; - struct UnkTextStruct2_sub unk8; + UnkTextStruct2_sub unk8; s16 unkC; s16 unkE; s16 unk10; s16 unk12; const u8 *unk14; -}; +} UnkTextStruct2; -#endif \ No newline at end of file +#endif // GUARD_TEXT_H \ No newline at end of file diff --git a/include/text1.h b/include/text1.h index f6c5f8333..4b7acb1f8 100644 --- a/include/text1.h +++ b/include/text1.h @@ -3,15 +3,16 @@ #include "text.h" -extern struct UnkTextStruct1 gUnknown_2027370[4]; -extern struct UnkTextStruct2 gUnknown_202AFC0[4]; +extern UnkTextStruct1 gUnknown_2027370[4]; +extern UnkTextStruct2 gUnknown_202AFC0[4]; extern u32 gUnknown_202B030; -extern u16 gUnknown_202B038[4][32][32]; +extern u16 gUnknown_202B038[4][32][32]; // dimensions unknown... but usage points to these dimensions void LoadCharmaps(void); void SelectCharmap(u32); u32 xxx_update_some_bg_tiles(u32 a0); -void sub_800641C(struct UnkTextStruct2 *a0, u8 a1, u8 a2); +u32 sub_80063B0(void); +void sub_800641C(UnkTextStruct2 *a0, bool8 a1, bool8 a2); #endif // GUARD_TEXT1_H \ No newline at end of file diff --git a/include/text2.h b/include/text2.h index e499efaa0..a9d980ed3 100644 --- a/include/text2.h +++ b/include/text2.h @@ -31,8 +31,8 @@ struct unkStruct_80B8848 u32 xxx_call_draw_char(s32, s32, u32, u32, u32); -void sub_8006518(struct UnkTextStruct2 *); -void sub_8006554(struct UnkTextStruct1 *, u32 *, u32 *, u16 *, u32, const struct UnkTextStruct2 *, u8, u32, struct UnkTextStruct2_sub *, u8); +void sub_8006518(UnkTextStruct2 *); +void sub_8006554(UnkTextStruct1 *, u32 *, u32 *, u16 *, u32, const UnkTextStruct2 *, u8, u32, UnkTextStruct2_sub *, u8); void sub_80073B8(s32); void sub_80073E0(s32); void sub_80078A4(u32, s32, s32, s32, u32); @@ -45,7 +45,7 @@ void sub_8007E20(u32, u32, u32, u32, u32, u8 *, u32); extern struct unkChar *GetCharacter(u32); extern void InitGraphics(void); extern void sub_800898C(void); -extern void sub_80089AC(const struct UnkTextStruct2 *, struct UnkTextStruct2_sub *); +extern void sub_80089AC(const UnkTextStruct2 *, UnkTextStruct2_sub *); extern void sub_8008C54(u32); extern void sub_8009388(void); extern void xxx_call_draw_string(s32 x, u32 y, const u8 *str, u32 , u32); diff --git a/include/tile_types.h b/include/tile_types.h index 06c2fa25b..e83466f19 100644 --- a/include/tile_types.h +++ b/include/tile_types.h @@ -9,7 +9,7 @@ extern const u8 gDungeonWaterType[]; -bool8 IsTileGround(struct Tile* tile); +bool8 IsTileGround(Tile *tile); bool8 IsWaterTileset(); #endif diff --git a/include/trade_items_menu.h b/include/trade_items_menu.h index 9e13e26d8..b94480222 100644 --- a/include/trade_items_menu.h +++ b/include/trade_items_menu.h @@ -2,7 +2,7 @@ #define GUARD_TRADE_ITEMS_MENU_H #include "text.h" -#include "item.h" +#include "items.h" #include "menu.h" struct TradeSubStruct @@ -29,13 +29,13 @@ struct TradeItemsMenu u32 unk20; u32 unk24; u32 unk28; - struct UnkTextStruct2 *unk2C; + UnkTextStruct2 *unk2C; u32 unk30; u32 unk34; u8 fill38[0x44 - 0x38]; - struct MenuStruct unk44[4]; - struct UnkTextStruct2 unk184[4]; - struct UnkTextStruct2 unk1E4[4]; + MenuStruct unk44[4]; + UnkTextStruct2 unk184[4]; + UnkTextStruct2 unk1E4[4]; // TODO These might be structs... struct TradeSubStruct unk244; @@ -44,7 +44,7 @@ struct TradeItemsMenu /* 0x254 */ struct TradeSubStruct sentItem; - /* 0x25C */ struct Item itemToSend; + /* 0x25C */ Item itemToSend; u8 fill25F[0x3A0 - 0x260]; }; diff --git a/include/trap.h b/include/trap.h index fb6855e04..67db9287d 100644 --- a/include/trap.h +++ b/include/trap.h @@ -3,6 +3,6 @@ #include "position.h" -bool8 CanLayTrap(struct Position *pos); +bool8 CanLayTrap(Position *pos); #endif diff --git a/include/type_effectiveness.h b/include/type_effectiveness.h index 2f3ff7c47..61d7975a7 100644 --- a/include/type_effectiveness.h +++ b/include/type_effectiveness.h @@ -3,6 +3,6 @@ #include "dungeon_entity.h" -s32 WeightWeakTypePicker(struct Entity *user, struct Entity *target, u8 moveType); +s32 WeightWeakTypePicker(Entity *user, Entity *target, u8 moveType); #endif diff --git a/include/weather.h b/include/weather.h index ce534522a..9b45f9883 100644 --- a/include/weather.h +++ b/include/weather.h @@ -3,6 +3,6 @@ #include "dungeon_entity.h" -u8 GetApparentWeather(struct Entity *pokemon); +u8 GetApparentWeather(Entity *pokemon); #endif diff --git a/include/wigglytuff_shop.h b/include/wigglytuff_shop.h index 76559bcc1..39f6372b0 100644 --- a/include/wigglytuff_shop.h +++ b/include/wigglytuff_shop.h @@ -5,34 +5,6 @@ #include "menu.h" #include "text.h" -// size: 0x138 -struct WigglytuffShop -{ - bool32 isAsleep; - s32 state; - s32 fallbackState; - s32 friendAreaPrice; - u8 chosenFriendArea; - s16 chosenSpecies; - u32 menuAction1; - u32 menuAction2; - struct MenuItem unk1C[8]; - u16 unk5C[0x8]; - struct MenuStruct unk6C; - /* 0xBC */ struct OpenedFile *faceFile; - /* 0xC0 */ u8 *faceData; - u16 unkC4; - u16 unkC6; - u8 unkC8; - u8 unkC9; - u8 unkCA; - u8 fillCB; - struct OpenedFile **unkCC; - struct UnkTextStruct2 unkD0[4]; - u32 unk130; - u32 unk134; -}; - enum WigglytuffStates { WIGGLYTUFF_INIT = 0, @@ -45,35 +17,63 @@ enum WigglytuffStates FRIEND_AREA_SELECT_BUY = 7, FRIEND_AREA_SELECT_BUY_AGAIN = 8, WIGGLYTUFF_UNK9 = 9, - WIGGLYTUFF_UNKA = 0xA, - WIGGLYTUFF_UNKB = 0xB, - CONFIRM_BUY_FRIEND_AREA = 0xC, - WIGGLYTUFF_UNKD = 0xD, - WIGGLYTUFF_UNKE = 0xE, - FRIEND_AREA_UNLOCKED = 0xF, - FRIEND_AREA_INFO = 0x10, - BUY_FRIEND_AREA = 0x11, - NO_FRIEND_AREAS = 0x12, - NOT_ENOUGH_MONEY = 0x13, - WIGGLYTUFF_CHECK = 0x14, - WIGGLYTUFF_CHECK_AGAIN = 0x15, - WIGGLYTUFF_UNK16 = 0x16, - WIGGLYTUFF_UNK17 = 0x17, - DISPLAY_POKEMON_FRIEND_AREA_INFO = 0x18, - WIGGLYTUFF_CHECK_HAS_FRIEND_AREA = 0x19, - WIGGLYTUFF_CHECK_POST_GAME = 0x1A, - WIGGLYTUFF_CHECK_WONDER_MAIL = 0x1B, - WIGGLYTUFF_CHECK_LEGENDARY = 0x1C, + WIGGLYTUFF_UNKA = 10, + WIGGLYTUFF_UNKB = 11, + CONFIRM_BUY_FRIEND_AREA = 12, + WIGGLYTUFF_UNKD = 13, + WIGGLYTUFF_UNKE = 14, + FRIEND_AREA_UNLOCKED = 15, + FRIEND_AREA_INFO = 16, + BUY_FRIEND_AREA = 17, + NO_FRIEND_AREAS = 18, + NOT_ENOUGH_MONEY = 19, + WIGGLYTUFF_CHECK = 20, + WIGGLYTUFF_CHECK_AGAIN = 21, + WIGGLYTUFF_UNK16 = 22, + WIGGLYTUFF_UNK17 = 23, + DISPLAY_POKEMON_FRIEND_AREA_INFO = 24, + WIGGLYTUFF_CHECK_HAS_FRIEND_AREA = 25, + WIGGLYTUFF_CHECK_POST_GAME = 26, + WIGGLYTUFF_CHECK_WONDER_MAIL = 27, + WIGGLYTUFF_CHECK_LEGENDARY = 28, }; -bool8 sub_80211AC(u32 mode, u32 param_2); -bool8 sub_8021774(u8 friendArea, bool8 param_2, s32 param_3); -u32 sub_8021274(bool8 param_1); +// size: 0x138 +typedef struct WigglytuffShop +{ + bool32 isAsleep; + s32 state; + s32 fallbackState; + s32 friendAreaPrice; + u8 chosenFriendArea; + s16 chosenSpecies; + u32 menuAction1; + u32 menuAction2; + MenuItem unk1C[8]; + u16 unk5C[0x8]; + MenuStruct unk6C; + /* 0xBC */ OpenedFile *faceFile; + /* 0xC0 */ u8 *faceData; + u16 unkC4; + u16 unkC6; + u8 unkC8; + u8 unkC9; + u8 unkCA; + u8 fillCB; + OpenedFile **unkCC; + UnkTextStruct2 unkD0[4]; + u32 unk130; + u32 unk134; +} WigglytuffShop; + +bool8 sub_80211AC(u32 mode, u32); +bool8 sub_8021774(u8 friendArea, bool8, s32); +u32 sub_8021274(bool8); u8 sub_802132C(void); -void sub_8021354(bool8 param_1); +void sub_8021354(bool8); void sub_80213A0(void); void sub_8021494(void); u32 sub_80217EC(void); void sub_8021830(void); -#endif // GUARD_WIGGLYTUFF_SHOP_H +#endif // GUARD_WIGGLYTUFF_SHOP_H \ No newline at end of file diff --git a/include/wonder_mail.h b/include/wonder_mail.h index 2bd15648b..8794f94f5 100644 --- a/include/wonder_mail.h +++ b/include/wonder_mail.h @@ -1,17 +1,16 @@ #ifndef GUARD_WONDER_MAIL_H #define GUARD_WONDER_MAIL_H +#include "code_8094F88.h" +#include "constants/wonder_mail.h" #include "file_system.h" -#include "text.h" -#include "item.h" +#include "items.h" #include "menu.h" #include "pokemon.h" -#include "code_8094F88.h" - -#include "constants/wonder_mail.h" +#include "text.h" // size: 0x28 -struct unkStruct_802F204 +typedef struct unkStruct_802F204 { /* 0x0 */ u8 clientName[POKEMON_NAME_LENGTH]; /* 0xA */ u8 name2[POKEMON_NAME_LENGTH]; // target name? @@ -22,34 +21,32 @@ struct unkStruct_802F204 /* 0x1F */ u8 quantity; /* 0x20 */ u8 friendAreaReward; /* 0x24 */ u32 teamRankPtsReward; -}; +} unkStruct_802F204; // size: 0x14 - -struct WonderMail +typedef struct WonderMail { /* 0x0 */ u8 mailType; // mail type /* 0x1 */ u8 missionType; // mission type u8 unk2; - /* 0x4 */ struct WonderMailSub unk4; + /* 0x4 */ WonderMailSub unk4; /* 0xC */ s16 clientSpecies; // client pokemon /* 0xE */ s16 targetSpecies; // target /* 0x10 */ u8 targetItem; // item to find/deliver /* 0x11 */ u8 rewardType; // reward type /* 0x12 */ u8 itemReward; // item reward /* 0x13 */ u8 friendAreaReward; // friend area -}; - +} WonderMail; // size: 0x88 -struct WonderMailStruct_203B2C0_sub +typedef struct WonderMailStruct_203B2C0_sub { - /* 0x0 */ struct unkStruct_203B480 mail; - /* 0x30 */ struct PokemonStruct pokemon; -}; + /* 0x0 */ unkStruct_203B480 mail; + /* 0x30 */ PokemonStruct1 pokemon; +} WonderMailStruct_203B2C0_sub; // size: 0x548 -struct WonderMailStruct_203B2C0 +typedef struct WonderMailStruct_203B2C0 { /* 0x0 */ u32 fallbackState; /* 0x4 */ u32 state; @@ -57,17 +54,17 @@ struct WonderMailStruct_203B2C0 u8 unk3E; u32 unk40; /* 0x44 */ u32 linkError; - struct unkStruct_203B480 unk48; - struct unkStruct_203B480 unk78; - struct WonderMailStruct_203B2C0_sub unkA8; - struct WonderMailStruct_203B2C0_sub unk130; + unkStruct_203B480 unk48; + unkStruct_203B480 unk78; + WonderMailStruct_203B2C0_sub unkA8; + WonderMailStruct_203B2C0_sub unk130; u8 fill16A[0x218 - 0x1B8]; /* 0x218 */ u8 mailIndex; - struct MenuStruct unk21C[4]; - struct UnkTextStruct2 unk35C[4]; - struct UnkTextStruct2 unk3BC[4]; + MenuStruct unk21C[4]; + UnkTextStruct2 unk35C[4]; + UnkTextStruct2 unk3BC[4]; /* 0x41C */ u32 unkfill; // ItemSlot? - /* 0x420 */ struct OpenedFile *faceFile; + /* 0x420 */ OpenedFile *faceFile; /* 0x424 */ u8 *faceData; u16 unk428; u16 unk42A; @@ -80,10 +77,10 @@ struct WonderMailStruct_203B2C0 u32 unk53C; /* 0x540 */ u32 mailCount; // A8 << 4 /* 0x544 */ s16 speciesNum; -}; +} WonderMailStruct_203B2C0; // size: 0x564 -struct WonderMailStruct_203B2C4 +typedef struct WonderMailStruct_203B2C4 { /* 0x0 */ u8 state; /* 0x4 */ u32 fallbackState; // wonder mail link status?? @@ -92,14 +89,14 @@ struct WonderMailStruct_203B2C4 u32 unk40; /* 0x44 */ u32 linkError; // another link status u8 filler48[0x1B8 - 0x48]; - struct unkStruct_203B480 unk1B8; - struct unkStruct_203B480 unk1E8; + unkStruct_203B480 unk1B8; + unkStruct_203B480 unk1E8; /* 0x218 */ s8 mailIndex; - struct MenuStruct unk21C[4]; - struct UnkTextStruct2 unk35C[4]; - struct UnkTextStruct2 unk3BC[4]; - struct Item unk41C; - /* 0x420 */ struct OpenedFile *faceFile; + MenuStruct unk21C[4]; + UnkTextStruct2 unk35C[4]; + UnkTextStruct2 unk3BC[4]; + Item unk41C; + /* 0x420 */ OpenedFile *faceFile; /* 0x424 */ u8 *faceData; u16 unk428; u16 unk42A; @@ -110,9 +107,9 @@ struct WonderMailStruct_203B2C4 /* 0x434 */ u8 formattedString[0x100]; /* 0x534 */ s32 wonderMailMethod; /* 0x538 */ u32 wonderMailMode; - struct unkStruct_802F204 unk53C; -}; + unkStruct_802F204 unk53C; +} WonderMailStruct_203B2C4; void SetFriendRescueCounterState(u32 r0); -#endif +#endif // GUARD_WONDER_MAIL_H \ No newline at end of file diff --git a/include/wonder_mail_2_1.h b/include/wonder_mail_2_1.h index 6914f1ded..a6d10144e 100644 --- a/include/wonder_mail_2_1.h +++ b/include/wonder_mail_2_1.h @@ -2,10 +2,10 @@ struct unkStruct_203B2E8 { // size: 0xA8 u8 pelipperBoardSlots[MAX_ACCEPTED_JOBS]; - struct MenuInputStruct input; + MenuInputStruct input; u32 unk3C; - struct UnkTextStruct2 *unk40; - struct UnkTextStruct2 unk44[4]; + UnkTextStruct2 *unk40; + UnkTextStruct2 unk44[4]; u8 unkA4[4]; }; @@ -16,12 +16,12 @@ struct unkStruct_203B2F0 u32 state; u8 unk8[0xC - 0x8]; u8 unkC; - struct unkStruct_802C39C unk10; + unkStruct_802C39C unk10; u32 menuAction; - struct MenuStruct unk6C; - struct MenuStruct unkBC; - struct MenuItem unk10C[8]; - struct MenuItem unk14C[8]; + MenuStruct unk6C; + MenuStruct unkBC; + MenuItem unk10C[8]; + MenuItem unk14C[8]; u8 fill18C[0x19C - 0x18C]; - struct UnkTextStruct2 unk19C[4]; + UnkTextStruct2 unk19C[4]; }; diff --git a/include/wonder_mail_3.h b/include/wonder_mail_3.h index f31f88cc7..9bc3bc55c 100644 --- a/include/wonder_mail_3.h +++ b/include/wonder_mail_3.h @@ -1,73 +1,87 @@ +#ifndef GUARD_WONDER_MAIL_3_H +#define GUARD_WONDER_MAIL_3_H + +#include "code_802C39C.h" +#include "input.h" #include "menu.h" -struct unkStruct_203B2F4 -{ - struct MenuInputStruct input; - u32 unk34; - struct UnkTextStruct2 *unk38; - struct UnkTextStruct2 unk3C[4]; - u8 unk9C[4]; -}; -extern struct unkStruct_203B2F4 *gUnknown_203B2F4; +#include "text.h" +#include "wonder_mail.h" -struct unkStruct_803B344 +// size: 0xB4 +typedef struct unkStruct_803B344 { - // size: 0xB4 - struct WonderMail mail; - u8* unk14; - u8* unk18; - u8 fill1C[0x3C - 0x1C]; - u8 unk3C[0x78]; -}; - -struct unkSubStruct_203B2F8 -{ - struct WonderMail wonderMail; + /* 0x0 */ WonderMail mail; u8 *unk14; u8 *unk18; -}; + u8 fill1C[0x3C - 0x1C]; + u8 unk3C[0xB4 - 0x3C]; +} unkStruct_803B344; -struct unkStruct_203B2F8 +// size: 0xA0 +typedef struct unkStruct_203B2F4 { - // size: 0x208 - s32 state; // state - s32 fallbackState; - u8 wonderMailAccepted; - bool8 unk9; - u8 dungeonID; + MenuInputStruct input; + u32 unk34; + UnkTextStruct2 *unk38; + UnkTextStruct2 unk3C[4]; + u8 unk9C[4]; +} unkStruct_203B2F4; + +// size: 0x1C +typedef struct unkSubStruct_203B2F8 +{ + /* 0x0 */ WonderMail wonderMail; + /* 0x14 */ u8 *unk14; + /* 0x18 */ u8 *unk18; +} unkSubStruct_203B2F8; + +// size: 0x208 +typedef struct unkStruct_203B2F8 +{ + /* 0x0 */ s32 state; + /* 0x4 */ s32 fallbackState; + /* 0x8 */ u8 wonderMailAccepted; + /* 0x9 */ bool8 unk9; + /* 0xA */ u8 dungeonID; u8 unkB; - struct unkSubStruct_203B2F8 *mail; - u8 jobSlotIndex; - struct unkStruct_802C39C unk14; - u32 menuAction1; - u32 menuAction2; - u32 menuAction3; - struct MenuStruct unk78; - struct MenuStruct unkC8; - struct MenuItem unk118[8]; - struct MenuItem unk158[8]; + /* 0xC */ unkSubStruct_203B2F8 *mail; + /* 0x10 */ u8 jobSlotIndex; + unkStruct_802C39C unk14; + /* 0x6C */ u32 menuAction1; + /* 0x70 */ u32 menuAction2; + /* 0x74 */ u32 menuAction3; + /* 0x78 */ MenuStruct unk78; + /* 0xC8 */ MenuStruct unkC8; + MenuItem unk118[8]; + MenuItem unk158[8]; u16 unk198[8]; - struct UnkTextStruct2 unk1A8[4]; - u32 unk1E4; -}; -extern struct unkStruct_203B2F8 *gUnknown_203B2F8; + UnkTextStruct2 unk1A8[4]; +} unkStruct_203B2F8; enum WonderMailRescueStates { - INITIAL_WONDER_MAIL_CHECK, + INITIAL_WONDER_MAIL_CHECK = 0, // 1 is ?? WONDER_MAIL_EXIT = 2, DUPLICATE_WONDER_MAIL = 3, - DUPLICATE_WONDER_MAIL_1, + DUPLICATE_WONDER_MAIL_1 = 4, // 5 is ?? // 6 is ?? // 7 is ?? RECEIVE_WONDER_MAIL = 8, // 9 is ?? - JOB_LIST_FULL = 0xA, - DRAW_JOB_LIST = 0xB, - DRAW_JOB_LIST_1 = 0xC, - // 0xD is ?? - // 0xE is ?? - // 0xF is ?? - // 0x10 is ?? + JOB_LIST_FULL = 10, + DRAW_JOB_LIST = 11, + DRAW_JOB_LIST_1 = 12, + // 13 is ?? + // 14 is ?? + // 15 is ?? + // 16 is ?? }; + +extern unkStruct_203B2F4 *gUnknown_203B2F4; +extern unkStruct_203B2F8 *gUnknown_203B2F8; + +u32 sub_802D098(unkSubStruct_203B2F8 *mail); + +#endif // GUARD_WONDER_MAIL_3_H \ No newline at end of file diff --git a/ld_script.txt b/ld_script.txt index 26656e082..96decf675 100755 --- a/ld_script.txt +++ b/ld_script.txt @@ -21,7 +21,7 @@ SECTIONS { *libc.a:impure.o(.data); *libc.a:locale.o(.data); *libc.a:mallocr.o(.data); - gUnknown_203BC04 = .; + ewram2_end = .; . = 0x40000; } @@ -68,7 +68,9 @@ SECTIONS { asm/text.o(.text); src/code_8009804.o(.text); asm/code_8009804.o(.text); + asm/file_system.o(.text); src/file_system.o(.text); + src/decompress.o(.text); src/main.o(.text); src/unused_vblank.o(.text); src/reg_control.o(.text); @@ -85,15 +87,24 @@ SECTIONS { src/code_80118A4.o(.text); src/debug.o(.text); src/save.o(.text); + src/save_read.o(.text); + src/save_write.o(.text); + src/quick_save_read.o(.text); + src/quick_save_write.o(.text); src/code_8012A18.o(.text); src/menu_input.o(.text); asm/code_80130A8.o(.text); src/code_8012A18_1.o(.text); src/felicity_bank.o(.text); - src/kangaskhan_storage.o(.text); - src/kecleon_bros.o(.text); + src/kangaskhan_storage1.o(.text); + src/kangaskhan_storage2.o(.text); + src/kecleon_bros1.o(.text); + src/kecleon_bros2.o(.text); + src/kecleon_bros3.o(.text); + src/kecleon_bros4.o(.text); src/code_801AFA4.o(.text); src/code_801B3C0.o(.text); + src/code_801B60C.o(.text); src/code_801C620.o(.text); src/code_801D760.o(.text); src/options_menu.o(.text); @@ -102,7 +113,7 @@ SECTIONS { src/code_801EE10.o(.text); asm/code_801EE10.o(.text); src/code_801EE10_mid.o(.text); - src/gulpin_shop_1.o(.text); + src/gulpin_shop_801FB50.o(.text); src/wigglytuff_shop.o(.text); src/code_8023144_pre.o(.text); asm/code_8023144.o(.text); @@ -126,11 +137,13 @@ SECTIONS { src/wonder_mail_3_mid.o(.text); asm/wonder_mail_3_mid.o(.text); src/wonder_mail_3_1.o(.text); - src/makuhita_dojo.o(.text); + src/makuhita_dojo1.o(.text); + src/makuhita_dojo2.o(.text); src/wonder_mail_4.o(.text); src/wonder_mail_5.o(.text); src/wonder_mail_6.o(.text); - src/post_office_guide.o(.text); + src/post_office_guide1.o(.text); + src/post_office_guide2.o(.text); src/code_8031D70.o(.text); src/adventure_log.o(.text); src/friend_rescue.o(.text); @@ -245,7 +258,6 @@ SECTIONS { src/dungeon_util_1.o(.text); asm/code_8085B0C.o(.text); src/code_80869E4.o(.text); - asm/code_80869E4.o(.text); src/code_8086A3C.o(.text); asm/code_8086A3C.o(.text); src/code_8057824_1.o(.text); @@ -262,8 +274,6 @@ SECTIONS { src/rescue_team_info.o(.text); src/text_util.o(.text); src/friend_area.o(.text); - asm/friend_area_1.o(.text); - src/friend_area_1.o(.text); src/moves.o(.text); asm/code_8094148.o(.text); src/number_util.o(.text); @@ -377,13 +387,33 @@ SECTIONS { .rodata : ALIGN(4) { + data/data_code_2.o(.rodata); data/data.o(.rodata); src/file_system.o(.rodata); + src/decompress.o(.rodata); data/data_80B9BB8.o(.rodata); src/debug.o(.rodata); src/save.o(.rodata); + src/save_read.o(.rodata); + src/save_write.o(.rodata); + src/quick_save_read.o(.rodata); + src/quick_save_write.o(.rodata); src/menu_input.o(.rodata); data/data_80D47B8.o(.rodata); + src/kangaskhan_storage1.o(.rodata); + src/kangaskhan_storage2.o(.rodata); + src/kecleon_bros1.o(.rodata); + src/kecleon_bros2.o(.rodata); + src/kecleon_bros3.o(.rodata); + src/kecleon_bros4.o(.rodata); + src/code_801AFA4.o(.rodata); + src/code_801B3C0.o(.rodata); + src/code_801B60C.o(.rodata); + data/data_80DBD98.o(.rodata); + src/gulpin_shop.o(.rodata); + data/data_80DC240.o(.rodata); + src/gulpin_shop_801FB50.o(.rodata); + data/data_80DC464.o(.rodata); src/luminous_cave.o(.rodata); src/friend_list_menu.o(.rodata); src/party_list_menu.o(.rodata); @@ -398,11 +428,13 @@ SECTIONS { src/mailbox.o(.rodata); src/pelipper_board.o(.rodata); src/wonder_mail_3_mid.o(.rodata); - src/makuhita_dojo.o(.rodata); + src/makuhita_dojo1.o(.rodata); + src/makuhita_dojo2.o(.rodata); src/wonder_mail_4.o(.rodata); src/wonder_mail_5.o(.rodata); src/wonder_mail_6.o(.rodata); - src/post_office_guide.o(.rodata); + src/post_office_guide1.o(.rodata); + src/post_office_guide2.o(.rodata); src/code_8031D70.o(.rodata); src/adventure_log.o(.rodata); data/data_80E2068.o(.rodata); @@ -422,6 +454,7 @@ SECTIONS { src/pokemon_mail.o(.rodata); data/personality_test.o(.rodata); src/personality_test.o(.rodata); + src/code_803D0D8.o(.rodata); data/data_80F4278.o(.rodata); src/dungeon_util.o(.rodata); data/data_80F4468.o(.rodata); diff --git a/src/adventure_log.c b/src/adventure_log.c index 741cfcd49..52cc608b4 100644 --- a/src/adventure_log.c +++ b/src/adventure_log.c @@ -1,25 +1,17 @@ #include "global.h" +#include "adventure_log.h" #include "code_80118A4.h" #include "code_80130A8.h" +#include "code_8097670.h" #include "constants/input.h" #include "memory.h" #include "menu_input.h" #include "text1.h" #include "text2.h" -struct AdventureLog -{ - // size: 0xA0 - struct MenuInputStruct input; - u32 unk34; - struct UnkTextStruct2 *unk38; - struct UnkTextStruct2 unk3C[4]; - u8 unk9C[4]; -}; +static EWRAM_DATA_2 AdventureLog *sAdventureLog = {0}; -EWRAM_DATA_2 struct AdventureLog *gAdventureLog = {0}; - -const struct UnkTextStruct2 gUnknown_80E1FF0 = { +static const UnkTextStruct2 sUnknown_80E1FF0 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, @@ -27,7 +19,7 @@ const struct UnkTextStruct2 gUnknown_80E1FF0 = { 0x00, 0x00, NULL }; -const struct UnkTextStruct2 gUnknown_80E2008 = { +static const UnkTextStruct2 sUnknown_80E2008 = { 0x00, 0x00, 0x00, 0x00, 0x06, 0x02, 0x02, @@ -36,50 +28,41 @@ const struct UnkTextStruct2 gUnknown_80E2008 = { NULL }; -// Adventure Log Text -const u8 gAdventureLogHeaderText[] = "Adventure Log"; -const u8 gAdventureLogTextPlaceholder[] = "~95~95~95~95~95~95~95~95~95~95~95~95~95~95~95 "; // string of ??????? -const u8 fill_adven[] = "pksdir0"; +static const u8 sAdventureLogHeaderText[] = "Adventure Log"; +static const u8 sAdventureLogTextPlaceholder[] = "~95~95~95~95~95~95~95~95~95~95~95~95~95~95~95 "; // string of ??????? +static const u8 sFill1[] = "pksdir0"; -void sub_8032084(); -void DisplayAdventureLog(); -extern bool8 sub_8097710(u8); - -extern s16 sub_80978B8(); -extern s16 sub_8097880(); -extern s16 sub_8097838(); -extern s16 sub_8097870(); -extern s32 sub_80977B8(); -extern s32 sub_80977F8(); -const u8 *GetAdventureLogLine(u8 index); +// ??? extern u32 gUnknown_202DE30; -u32 CreateAdventureLogScreen(u32 param_1) -{ - gAdventureLog = MemoryAlloc(sizeof(struct AdventureLog),8); - gAdventureLog->unk34 = param_1; - gAdventureLog->unk38 = &gAdventureLog->unk3C[param_1]; - sub_8006518(gAdventureLog->unk3C); - gAdventureLog->unk3C[gAdventureLog->unk34] = gUnknown_80E2008; - gAdventureLog->unk38->unk14 = gAdventureLog->unk9C; +static void DisplayAdventureLog(); +static void sub_8032084(); - ResetUnusedInputStruct(); - sub_800641C(gAdventureLog->unk3C,1,1); - sub_8013818(&gAdventureLog->input,0x20,8,param_1); - sub_8032084(); - DisplayAdventureLog(); - return 1; +bool8 CreateAdventureLogScreen(u32 kind) +{ + sAdventureLog = MemoryAlloc(sizeof(AdventureLog), 8); + sAdventureLog->unk34 = kind; + sAdventureLog->unk38 = &sAdventureLog->unk3C[kind]; + sub_8006518(sAdventureLog->unk3C); + sAdventureLog->unk3C[sAdventureLog->unk34] = sUnknown_80E2008; + sAdventureLog->unk38->unk14 = sAdventureLog->unk9C; + + ResetUnusedInputStruct(); + sub_800641C(sAdventureLog->unk3C, TRUE, TRUE); + sub_8013818(&sAdventureLog->input, 0x20, 8, kind); + sub_8032084(); + DisplayAdventureLog(); + return TRUE; } u32 HandleAdventureLogInput(u8 param_1) { - if (param_1 == 0) { - sub_8013660(&gAdventureLog->input); - return 0; - } - else { - switch(GetKeyPress(&gAdventureLog->input)) - { + if (param_1 == 0) { + sub_8013660(&sAdventureLog->input); + return 0; + } + + switch (GetKeyPress(&sAdventureLog->input)) { case INPUT_B_BUTTON: PlayMenuSoundEffect(1); return 2; @@ -87,52 +70,48 @@ u32 HandleAdventureLogInput(u8 param_1) PlayMenuSoundEffect(0); return 3; default: - if (sub_8013938(&gAdventureLog->input)) { + if (sub_8013938(&sAdventureLog->input)) { sub_8032084(); DisplayAdventureLog(); return 1; } - else { - return 0; - } + return 0; } - } } void CleanAdventureLogScreen(void) { - if (gAdventureLog != NULL) { - gAdventureLog->unk3C[gAdventureLog->unk34] = gUnknown_80E1FF0; - ResetUnusedInputStruct(); - sub_800641C(gAdventureLog->unk3C,1,1); - MemoryFree(gAdventureLog); - gAdventureLog = 0; - } + if (sAdventureLog != NULL) { + sAdventureLog->unk3C[sAdventureLog->unk34] = sUnknown_80E1FF0; + ResetUnusedInputStruct(); + sub_800641C(sAdventureLog->unk3C, TRUE, TRUE); + MemoryFree(sAdventureLog); + sAdventureLog = NULL; + } } - -#ifdef NONMATCHING -void sub_8032084(void) +#ifdef NONMATCHING // sub_80095E4 memes +static void sub_8032084(void) { - u32 sVar2; - - gAdventureLog->unk9C[0] = gAdventureLog->unk20; - gAdventureLog->unk9C[1]= gAdventureLog->unk0.unk1E; - gAdventureLog->unk9C[2]= 0xb; - gAdventureLog->unk9C[3]= 0; - // So a sign extend.. - sVar2 = sub_80095E4(gAdventureLog->unk0.unk1A,0xc) + 2 << 0x10; - // TODO needs asr r3, r0, r16 - // and lsr r0, r0, r16 - gAdventureLog->unk3C[gAdventureLog->unk34].unkE = sVar2; - // Good past here except regs for this store - gAdventureLog->unk3C[gAdventureLog->unk34].unk10 = sVar2 + 2; - ResetUnusedInputStruct(); - sub_800641C(gAdventureLog->unk3C,1,1); + u32 sVar2; + + sAdventureLog->unk9C[0] = sAdventureLog->unk20; + sAdventureLog->unk9C[1] = sAdventureLog->unk0.unk1E; + sAdventureLog->unk9C[2] = 11; + sAdventureLog->unk9C[3] = 0; + // So a sign extend.. + sVar2 = sub_80095E4(sAdventureLog->unk0.unk1A, 12) + 2 << 0x10; + // TODO needs asr r3, r0, r16 + // and lsr r0, r0, r16 + sAdventureLog->unk3C[sAdventureLog->unk34].unkE = sVar2; + // Good past here except regs for this store + sAdventureLog->unk3C[sAdventureLog->unk34].unk10 = sVar2 + 2; + ResetUnusedInputStruct(); + sub_800641C(sAdventureLog->unk3C, TRUE, TRUE); } #else NAKED -void sub_8032084(void) +static void sub_8032084(void) { asm_unified("\tpush {r4,lr}\n" "\tldr r4, _080320F4\n" @@ -187,74 +166,74 @@ void sub_8032084(void) "\tpop {r0}\n" "\tbx r0\n" "\t.align 2, 0\n" -"_080320F4: .4byte gAdventureLog"); +"_080320F4: .4byte sAdventureLog"); } #endif -void DisplayAdventureLog(void) +static void DisplayAdventureLog(void) { - s32 counter; - s32 r4; // r4 - s32 r6; // r6 - u8 temp; - s32 v1, v2, v3, v4, v5, v6; - - sub_8008C54(gAdventureLog->unk34); - sub_80073B8(gAdventureLog->unk34); - r4 = gAdventureLog->input.unk1E * 8; - r6 = r4; - r6 += 10; - // Draw Header - xxx_call_draw_string(r6, 0, gAdventureLogHeaderText, gAdventureLog->unk34, 0); - r4 += 4; - r6 = r4 + gAdventureLog->unk9C[2] * 8; - // Draw Page # - sub_8012BC4(r6, 0, gAdventureLog->input.unk1E + 1, 1, 7, gAdventureLog->unk34); + s32 counter; + s32 r4; // r4 + s32 r6; // r6 + u8 temp; + s32 v1, v2, v3, v4, v5, v6; - for(counter = 0; counter < gAdventureLog->input.unk1A; counter++) - { - temp = gAdventureLog->input.unk1E * gAdventureLog->input.unk1C + counter; - if(sub_8097710(temp)){ - switch(temp) { - case 0xc: - v1 = sub_80978B8(); - gUnknown_202DE30 = (s16)v1; - xxx_format_and_draw(8, sub_8013800(&gAdventureLog->input, counter), GetAdventureLogLine(temp), gAdventureLog->unk34, 0); - break; - case 7: - v2 = sub_8097880(); - gUnknown_202DE30 = (s16)v2; - xxx_format_and_draw(8, sub_8013800(&gAdventureLog->input, counter), GetAdventureLogLine(temp), gAdventureLog->unk34, 0); - break; - case 0xb: - v3 = sub_8097838(); - gUnknown_202DE30 = (s16)v3; - xxx_format_and_draw(8, sub_8013800(&gAdventureLog->input, counter), GetAdventureLogLine(temp), gAdventureLog->unk34, 0); - break; - case 8: - v4 = sub_80977B8(); - gUnknown_202DE30 = v4; - xxx_format_and_draw(8, sub_8013800(&gAdventureLog->input, counter), GetAdventureLogLine(temp), gAdventureLog->unk34, 0); - break; - case 9: - v5 = sub_80977F8(); - gUnknown_202DE30 = v5; - xxx_format_and_draw(8, sub_8013800(&gAdventureLog->input, counter), GetAdventureLogLine(temp), gAdventureLog->unk34, 0); - break; - case 10: - v6 = sub_8097870(); - gUnknown_202DE30 = (s16)v6; - // fallthrough - default: - xxx_format_and_draw(8, sub_8013800(&gAdventureLog->input, counter), GetAdventureLogLine(temp), gAdventureLog->unk34, 0); - break; + sub_8008C54(sAdventureLog->unk34); + sub_80073B8(sAdventureLog->unk34); + r4 = sAdventureLog->input.unk1E * 8; + r6 = r4; + r6 += 10; + // Draw Header + xxx_call_draw_string(r6, 0, sAdventureLogHeaderText, sAdventureLog->unk34, 0); + r4 += 4; + r6 = r4 + sAdventureLog->unk9C[2] * 8; + // Draw Page # + sub_8012BC4(r6, 0, sAdventureLog->input.unk1E + 1, 1, 7, sAdventureLog->unk34); + + for (counter = 0; counter < sAdventureLog->input.unk1A; counter++) { + temp = sAdventureLog->input.unk1E * sAdventureLog->input.unk1C + counter; + + if (sub_8097710(temp)) { + switch (temp) { + case 12: + v1 = sub_80978B8(); + gUnknown_202DE30 = (s16)v1; + xxx_format_and_draw(8, sub_8013800(&sAdventureLog->input, counter), GetAdventureLogLine(temp), sAdventureLog->unk34, 0); + break; + case 7: + v2 = sub_8097880(); + gUnknown_202DE30 = (s16)v2; + xxx_format_and_draw(8, sub_8013800(&sAdventureLog->input, counter), GetAdventureLogLine(temp), sAdventureLog->unk34, 0); + break; + case 11: + v3 = sub_8097838(); + gUnknown_202DE30 = (s16)v3; + xxx_format_and_draw(8, sub_8013800(&sAdventureLog->input, counter), GetAdventureLogLine(temp), sAdventureLog->unk34, 0); + break; + case 8: + v4 = sub_80977B8(); + gUnknown_202DE30 = v4; + xxx_format_and_draw(8, sub_8013800(&sAdventureLog->input, counter), GetAdventureLogLine(temp), sAdventureLog->unk34, 0); + break; + case 9: + v5 = sub_80977F8(); + gUnknown_202DE30 = v5; + xxx_format_and_draw(8, sub_8013800(&sAdventureLog->input, counter), GetAdventureLogLine(temp), sAdventureLog->unk34, 0); + break; + case 10: + v6 = sub_8097870(); + gUnknown_202DE30 = (s16)v6; + // fallthrough + default: + xxx_format_and_draw(8, sub_8013800(&sAdventureLog->input, counter), GetAdventureLogLine(temp), sAdventureLog->unk34, 0); + break; + } + } + else { + // Draw the ?????????? across the row + xxx_call_draw_string(8, sub_8013800(&sAdventureLog->input, counter), sAdventureLogTextPlaceholder, sAdventureLog->unk34, 0); } } - else - { - // Draw the ?????????? across the row - xxx_call_draw_string(8, sub_8013800(&gAdventureLog->input, counter), gAdventureLogTextPlaceholder, gAdventureLog->unk34, 0); - } - } - sub_80073E0(gAdventureLog->unk34); + + sub_80073E0(sAdventureLog->unk34); } diff --git a/src/adventure_log_menu.c b/src/adventure_log_menu.c index ea0b921e3..69684af72 100644 --- a/src/adventure_log_menu.c +++ b/src/adventure_log_menu.c @@ -1,13 +1,10 @@ #include "global.h" #include "adventure_log.h" +#include "adventure_log_menu.h" #include "input.h" #include "main_menu.h" #include "text1.h" -extern void CreateAdventureLogScreen(u32); -extern u32 HandleAdventureLogInput(u32); -extern void CleanAdventureLogScreen(void); - void CreateAdventureLogMenu(void) { CreateAdventureLogScreen(0); @@ -16,7 +13,7 @@ void CreateAdventureLogMenu(void) void CleanAdventureLogMenu(void) { ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); } u32 UpdateAdventureLogMenu(void) diff --git a/src/bg_control.c b/src/bg_control.c index a262e34b0..be665382d 100644 --- a/src/bg_control.c +++ b/src/bg_control.c @@ -2,10 +2,10 @@ #include "bg_control.h" #include "input.h" -EWRAM_DATA struct BGControlStruct gBG0Control = {0}; -EWRAM_DATA struct BGControlStruct gBG1Control = {0}; -EWRAM_DATA struct BGControlStruct gBG2Control = {0}; -EWRAM_DATA struct BGControlStruct gBG3Control = {0}; +EWRAM_DATA BGControlStruct gBG0Control = {0}; +EWRAM_DATA BGControlStruct gBG1Control = {0}; +EWRAM_DATA BGControlStruct gBG2Control = {0}; +EWRAM_DATA BGControlStruct gBG3Control = {0}; static EWRAM_DATA u8 sBldAlpha_CoeffA = {0}; static EWRAM_DATA u8 sBldAlpha_CoeffB = {0}; EWRAM_DATA u16 gBldAlpha; diff --git a/src/bg_palette_buffer.c b/src/bg_palette_buffer.c index 78f6941d9..6cdc3c333 100644 --- a/src/bg_palette_buffer.c +++ b/src/bg_palette_buffer.c @@ -70,7 +70,7 @@ void InitBGPaletteBuffer(void) #ifndef NONMATCHING NAKED #endif -void SetBGPaletteBufferColorRGB(s32 index, u8 *RGBArray, s32 a1, u8 *a2) +void SetBGPaletteBufferColorRGB(s32 index, u8 *colorArray, s32 a1, u8 *a2) { #ifdef NONMATCHING if (a1 < 0) { @@ -81,11 +81,11 @@ void SetBGPaletteBufferColorRGB(s32 index, u8 *RGBArray, s32 a1, u8 *a2) } gBGPaletteUsed[index / 16] = 1; if (!a2) { - gBGPaletteBuffer[index] = ((RGBArray[2] * a1 / 256 & 0x1F) << 10) | ((RGBArray[1] * a1 / 256 & 0x1F) << 5) | (RGBArray[0] * a1 / 256 & 0x1F); + gBGPaletteBuffer[index] = ((colorArray[2] * a1 / 256 & 0x1F) << 10) | ((colorArray[1] * a1 / 256 & 0x1F) << 5) | (colorArray[0] * a1 / 256 & 0x1F); } else { - gBGPaletteBuffer[index] = ((a2[4 * RGBArray[2] + 2] * a1 / 256 & 0x1F) << 10) | ((a2[4 * RGBArray[1] + 1] * a1 / 256 & 0x1F) << 5) | (a2[4 * RGBArray[0]] * a1 / 256 & 0x1F); + gBGPaletteBuffer[index] = ((a2[4 * colorArray[2] + 2] * a1 / 256 & 0x1F) << 10) | ((a2[4 * colorArray[1] + 1] * a1 / 256 & 0x1F) << 5) | (a2[4 * colorArray[0]] * a1 / 256 & 0x1F); } #else asm_unified("\tpush {r4-r7,lr}\n" @@ -211,7 +211,7 @@ void SetBGPaletteBufferColor(s32 index, u16 *color) gBGPaletteBuffer[index] = *color; } -void nullsub_4(s32 index, u8 *RGBArray, s32 a1, u8 *a2) +void nullsub_4(s32 index, u8 *colorArray, s32 a1, u8 *a2) { } void nullsub_5(void) diff --git a/src/charge_move.c b/src/charge_move.c index 64c3a9ff1..b765a6a28 100644 --- a/src/charge_move.c +++ b/src/charge_move.c @@ -41,7 +41,7 @@ const u32 gMultiTurnChargingStatuses[10] = { ALIGNED(4) const char chargingStatusFill[] = "pksdir0"; -u32 sub_8057070(struct Move *move) +u32 sub_8057070(Move *move) { u32 numberOfChainedHits; numberOfChainedHits = GetMoveNumberOfChainedHits(move); @@ -51,7 +51,7 @@ u32 sub_8057070(struct Move *move) return numberOfChainedHits; } -bool8 MoveCausesPaused(struct Move *move) +bool8 MoveCausesPaused(Move *move) { if(move->id == MOVE_FRENZY_PLANT) return TRUE; if(move->id == MOVE_HYDRO_CANNON) return TRUE; @@ -61,7 +61,7 @@ bool8 MoveCausesPaused(struct Move *move) return FALSE; } -bool8 MoveMatchesChargingStatus(struct Entity *pokemon, struct Move *move) +bool8 MoveMatchesChargingStatus(Entity *pokemon, Move *move) { if (!EntityExists(pokemon)) { @@ -69,7 +69,7 @@ bool8 MoveMatchesChargingStatus(struct Entity *pokemon, struct Move *move) } else { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; s32 i; for (i = 0; i < 100; i++) { @@ -87,7 +87,7 @@ bool8 MoveMatchesChargingStatus(struct Entity *pokemon, struct Move *move) } } -bool8 IsCharging(struct Entity *pokemon, bool8 checkCharge) +bool8 IsCharging(Entity *pokemon, bool8 checkCharge) { if (!EntityExists(pokemon)) { @@ -95,7 +95,7 @@ bool8 IsCharging(struct Entity *pokemon, bool8 checkCharge) } else { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; int i = 0; u8 *chargingStatusPointer = &pokemonInfo->chargingStatus; u8 *chargingStatusPointer2; diff --git a/src/code_2.c b/src/code_2.c index 4a5e6a291..9056d616f 100644 --- a/src/code_2.c +++ b/src/code_2.c @@ -1,31 +1,36 @@ #include "global.h" #include "bg_control.h" +#include "bg_palette_buffer.h" +#include "code_800558C.h" +#include "code_8009804.h" +#include "code_800C9CC.h" +#include "code_80118A4.h" +#include "code_8094F88.h" +#include "code_8097670.h" #include "constants/bg_music.h" +#include "cpu.h" #include "debug.h" +#include "event_flag.h" +#include "exclusive_pokemon.h" #include "file_system.h" #include "friend_area.h" +#include "game_options.h" #include "input.h" -#include "memory.h" #include "main_menu.h" +#include "memory.h" #include "moves.h" #include "music.h" #include "play_time.h" -#include "save.h" -#include "game_options.h" -#include "text1.h" -#include "text2.h" -#include "exclusive_pokemon.h" #include "pokemon.h" #include "rescue_team_info.h" -#include "cpu.h" -#include "code_8094F88.h" +#include "save.h" +#include "save_read.h" #include "sprite.h" -#include "code_80118A4.h" -#include "bg_palette_buffer.h" +#include "text1.h" +#include "text2.h" extern void NDS_LoadOverlay_GroundMain(void); extern void sub_8014144(void); -extern void sub_8097670(void); extern void LoadGameOptions(void); extern void SetWindowBGColor(void); extern void LoadItemParameters(void); @@ -34,9 +39,6 @@ extern void sub_800DAAC(void); extern void sub_800135C(void); extern void xxx_script_related_8001334(u32); extern void sub_80015C0(u32, u32); -extern u32 sub_8001658(u32, u32); -extern void sub_800A8F8(u32); -extern void sub_80097B0(void); extern void LoadTitleScreen(void); extern void sub_80095CC(u32, u32); extern s32 GetFirstIndexofMailType(u8); @@ -44,20 +46,17 @@ extern void nullsub_33(void); extern u32 sub_80009D0(u32); extern void xxx_draw_string_80144C4(void); -extern void sub_8005838(u32, u32); extern void nullsub_8(u32); extern void sub_80060EC(void); -extern void sub_800CB20(void); extern void TransferBGPaletteBuffer(void); extern void xxx_call_update_bg_vram(void); -extern void sub_8009908(void); extern void xxx_call_update_bg_sound_input(void); extern u32 gUnknown_203B03C; extern u16 gUnknown_2026E4E; extern s32 gUnknown_2000A80; -extern struct OpenedFile *gTitlePaletteFile; -extern struct GameOptions *gGameOptionsRef; +extern OpenedFile *gTitlePaletteFile; +extern GameOptions *gGameOptionsRef; extern char gPMDBuildVersion[]; @@ -110,7 +109,7 @@ void GameLoop(void) xxx_update_some_bg_tiles(0); sub_80097B0(); sub_800CDA8(2); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); gUnknown_2026E4E = 0x1000; LoadTitleScreen(); SetBG2RegOffsets(0, 0); @@ -192,7 +191,7 @@ void GameLoop(void) void xxx_update_stuff(u32 r0) { xxx_draw_string_80144C4(); - sub_8005838(0, 0); + sub_8005838(NULL, 0); nullsub_8(gGameOptionsRef->unkA); sub_8005180(); sub_80060EC(); diff --git a/src/code_8004AA0.c b/src/code_8004AA0.c index e3967ebd7..8e9a701f0 100644 --- a/src/code_8004AA0.c +++ b/src/code_8004AA0.c @@ -5,13 +5,13 @@ void nullsub_6(void) {} -void sub_8004AA4(struct unkStruct_202EE8C *a0, struct OpenedFile *a1, s32 a2) +void sub_8004AA4(unkStruct_202EE8C *a0, OpenedFile *a1, s32 a2) { - struct unkDataFor8004AA4 **data; - struct unkDataFor8004AA4 *ptr; + unkDataFor8004AA4 **data; + unkDataFor8004AA4 *ptr; s32 i; - data = (struct unkDataFor8004AA4 **)a1->data; + data = (unkDataFor8004AA4 **)a1->data; for (i = 0; i < a2; i++) { ptr = *data++; @@ -31,7 +31,7 @@ void sub_8004AA4(struct unkStruct_202EE8C *a0, struct OpenedFile *a1, s32 a2) } } -bool8 sub_8004AF0(bool8 a0, struct unkStruct_202EE8C *a1, s32 a2, s32 a3, s32 a4, u8 *a5) +bool8 sub_8004AF0(bool8 a0, unkStruct_202EE8C *a1, s32 a2, s32 a3, s32 a4, u8 *a5) { bool8 bVar3; bool8 ret; @@ -63,7 +63,7 @@ bool8 sub_8004AF0(bool8 a0, struct unkStruct_202EE8C *a1, s32 a2, s32 a3, s32 a4 return ret; } -UNUSED static bool8 sub_8004B78(bool8 a0, struct unkStruct_202EE8C *a1, s32 a2, s32 a3, s32 a4, u8 *a5) +UNUSED static bool8 sub_8004B78(bool8 a0, unkStruct_202EE8C *a1, s32 a2, s32 a3, s32 a4, u8 *a5) { bool8 bVar3; bool8 ret; @@ -95,7 +95,7 @@ UNUSED static bool8 sub_8004B78(bool8 a0, struct unkStruct_202EE8C *a1, s32 a2, return ret; } -bool8 sub_8004C00(struct unkStruct_202EE8C *a0, s32 a1, s32 a2, s32 a3, u8 *a4, s16 *a5) +bool8 sub_8004C00(unkStruct_202EE8C *a0, s32 a1, s32 a2, s32 a3, u8 *a4, s16 *a5) { bool8 ret; s32 i; @@ -159,7 +159,7 @@ bool8 sub_8004C00(struct unkStruct_202EE8C *a0, s32 a1, s32 a2, s32 a3, u8 *a4, return ret; } -UNUSED static void sub_8004CFC(struct unkStruct_202EE8C *a0, s32 a1) +UNUSED static void sub_8004CFC(unkStruct_202EE8C *a0, s32 a1) { s32 i; @@ -168,7 +168,7 @@ UNUSED static void sub_8004CFC(struct unkStruct_202EE8C *a0, s32 a1) } } -bool8 sub_8004D14(struct unkStruct_202EE8C *a0, s32 a1) +bool8 sub_8004D14(unkStruct_202EE8C *a0, s32 a1) { s32 i; @@ -180,7 +180,7 @@ bool8 sub_8004D14(struct unkStruct_202EE8C *a0, s32 a1) return FALSE; } -bool8 sub_8004D40(struct unkStruct_202EE8C *a0, s32 a1) +bool8 sub_8004D40(unkStruct_202EE8C *a0, s32 a1) { s32 i; diff --git a/src/code_800558C.c b/src/code_800558C.c index e81b8e0fc..922a8b21d 100644 --- a/src/code_800558C.c +++ b/src/code_800558C.c @@ -21,7 +21,7 @@ extern s16 gUnknown_20270E8[]; extern s16 *gUnknown_203B078; // data.s -extern const u16 gUnknown_80B8008[17]; +extern const s16 gUnknown_80B8008[17]; extern const s16 gUnknown_80B802A[16 * 10]; extern const s16 gUnknown_80B816A[16 * 10]; extern const s16 gUnknown_80B82AA[16 * 10]; @@ -56,7 +56,7 @@ void DoAxFrame_800558C(struct axPokemon *a0, s32 spriteX, s32 spriteY, u32 a3, u a0->axdata.flags &= 0xF7FF; } -void sub_8005610(struct OpenedFile *a0, s32 a1, s32 a2, u8 *a3) +void sub_8005610(OpenedFile *a0, s32 a1, s32 a2, u8 *a3) { sub_800561C((struct unkStructFor800561C *)a0->data, a1, a2, a3); } @@ -74,7 +74,7 @@ static void sub_800561C(struct unkStructFor800561C *a0, s32 a1, s32 a2, u8 *a3) } } -UNUSED static s32 *sub_8005668(struct OpenedFile *a0, s32 a1) +UNUSED static s32 *sub_8005668(OpenedFile *a0, s32 a1) { return sub_8005674((struct unkStructFor800561C *)a0->data, a1); } @@ -153,20 +153,20 @@ void sub_8005700(s16 *a0, struct axPokemon *a1) } } -UNUSED static void sub_8005764(s32 a0, struct OpenedFile *file, s32 a2, u8 *a3) +UNUSED static void sub_8005764(s32 a0, OpenedFile *file, s32 a2, u8 *a3) { sub_8005770(a0, file->data, a2, a3); } -void sub_8005770(s32 param_1, u8 *RGBArray, s32 a1, u8 *a2) +void sub_8005770(s32 param_1, u8 *colorArray, s32 a1, u8 *a2) { s32 i; for (i = 0; i < 16; i++) - SetBGPaletteBufferColorRGB((param_1 + 0x10) * 0x10 + i, &RGBArray[i * 4], a1, a2); + SetBGPaletteBufferColorRGB((param_1 + 0x10) * 0x10 + i, &colorArray[i * 4], a1, a2); } -// Maybe struct Position +// Maybe Position void nullsub_7(s16 *a0) {} @@ -237,19 +237,14 @@ void sub_80057E8(void) gUnknown_203B078 = NULL; } -#ifdef NONMATCHING // Not enough dopamine reward for this one. 86.61% https://decomp.me/scratch/Hj8Tn -void sub_8005838(s32 *a0, u8 a1) +#ifdef NONMATCHING // 98.13% https://decomp.me/scratch/sflGg +void sub_8005838(s32 *a0, u8 kind) { - u8 kind; s16 *r1; s16 *r2; s16 *r3; s32 i; -s32 *case5r4; -s32 *iStack00000004; -s32 *iStack00000008; - kind = a1; if (!gUnknown_2026E4C) kind = 0; @@ -415,30 +410,31 @@ s32 *iStack00000008; else { s32 iVar5; s32 r4; - s32 ip; - for (i = 0, ip = 256, r1 = &gUnknown_80B8008[-a0[1]]; i < 160; r1++, i++) { + for (i = 0; i < 160; i++) { if (a0[1] > i) { *r3++ = *r2++; - *r3++ = ip; + *r3++ = 256; } else { if (a0[3] <= i) { *r3++ = *r2++; - *r3++ = ip; + *r3++ = 256; } else { if (i - a0[1] < 16) { - iVar5 = a0[2] - *r1; - r4 = a0[0] + *r1; + iVar5 = gUnknown_80B8008[i - a0[1]]; + r4 = a0[0] + gUnknown_80B8008[i - a0[1]]; + iVar5 -= a0[2]; } else { if (a0[3] - i < 16) { - iVar5 = a0[2] - gUnknown_80B8008[r4]; + iVar5 = gUnknown_80B8008[r4]; r4 = a0[0] + gUnknown_80B8008[r4]; + iVar5 -= a0[2]; } else { - iVar5 = a0[2]; r4 = a0[0]; + iVar5 = a0[2]; } } @@ -497,10 +493,6 @@ s32 *iStack00000008; } break; case 5: - case5r4 = &gUnknown_2026E40; - iStack00000004 = &gUnknown_2026E44; - iStack00000008 = &gUnknown_2026E48; - r1 = gUnknown_80B82AA; for (i = 0; i < 15; i++) { *r3++ = *r2++; *r3++ = 256; @@ -536,63 +528,45 @@ s32 *iStack00000008; *r3++ = 256; } { -s32 spC; -s32 r8; -s32 iVar3; -s32 sp14; -s32 iVar5; -s32 uVar7; // r2 -s32 sp10; -s32 iVar10; -s32 iVar11; // r4 -s32 iVar12; // r9 -s32 iVar13; -s32 temp1; - temp1 = gUnknown_2026E48; - if (temp1 < 0) - temp1 = gUnknown_2026E48 + 0xFF; - spC = 0x400 / ((temp1 >> 8) + 1); + s32 r8; + s32 iVar3; + s32 sp14; + s32 iVar5; + s32 uVar7; // r2 + s32 sp10; + s32 iVar10; + s32 iVar11; // r4 - iVar11 = *iStack00000004; - if (iVar11 < 0) - iVar11 = *iStack00000004 + 0xFF; - iVar11 >>= 8; + s32 tmp1; + s32 tmp2; + s32 val1; + s32 val2; + s32 val3; + s32 spC; - sp10 = 0; - iVar12 = iVar11 * 4 + 2; - iVar10 = iVar11; - iVar13 = iVar11 * 4 + 2; - do { - temp1 = sub_8009C7C(sp10); - temp1 = *iStack00000008 * temp1; - if (temp1 < 0) - temp1 += 0xFF; + s32 j; + s32 k; - sp14 = *iStack00000004 + (temp1 >> 8); - if (sp14 < 0) - sp14 += 0xFF; - sp14 >>= 8; + val1 = gUnknown_2026E40; + val2 = gUnknown_2026E44; + val3 = gUnknown_2026E48; + + spC = 0x400 / (val3 / 256 + 1); + iVar11 = val2 / 256; - r8 = *iStack00000004 - (temp1 >> 8); - if (r8 < 0) - r8 += 0xFF; - r8 >>= 8; + j = iVar11; + k = iVar11; + for (sp10 = 0; sp10 < 0x400; sp10 += spC) { + tmp1 = val3 * sub_8009C7C(sp10) / 256; - if (iVar10 < sp14 || iVar11 > r8) { - temp1 = sub_8009D04(sp10); - temp1 = *iStack00000008 * temp1; - if (temp1 < 0) - temp1 += 0xFF; + sp14 = (val2 + tmp1) / 256; + r8 = (val2 - tmp1) / 256; - iVar5 = *case5r4 - (temp1 >> 8); - if (iVar5 < 0) - iVar5 += 0xFF; - iVar5 = iVar5 >> 8; + if (j < sp14 || k > r8) { + tmp2 = val3 * sub_8009D04(sp10) / 256; - iVar3 = *case5r4 + (temp1 >> 8); - if (iVar3 < 0) - iVar3 += 0xFF; - iVar3 >>= 8; + iVar5 = (val1 - tmp2) / 256; + iVar3 = (val1 + tmp2) / 256; if (iVar5 < 0) iVar5 = 0; @@ -603,45 +577,42 @@ s32 temp1; if (iVar3 > 240 - 1) iVar3 = 160 - 1; - if (iVar3 > iVar5) - uVar7 = (iVar3 << 8) | iVar5; - else + if (iVar5 > iVar3) uVar7 = (iVar5 << 8) | iVar3; + else + uVar7 = (iVar3 << 8) | iVar5; - while (iVar10 < sp14) { - if (iVar10 >= 0) { // Cannot merge ifs for matching - if (iVar10 < 160) { + while (j < sp14) { + if (j >= 0) { // Cannot merge ifs for matching + if (j < 160) { if (gUnknown_2026E54 == 0) - gUnknown_2026E60[iVar13] = uVar7; + gUnknown_2026E60[iVar11 * 2 + j * 2] = uVar7; else - gUnknown_20270E8[iVar13] = uVar7; + gUnknown_20270E8[iVar11 * 2 + j * 2] = uVar7; } } - iVar13 += 2; - iVar10++; + j++; } - while (iVar11 > r8) { - if (iVar11 >= 0) { // Cannot merge ifs for matching - if (iVar11 < 160) { + while (k > r8) { + if (k >= 0) { // Cannot merge ifs for matching + if (k < 160) { if (gUnknown_2026E54 == 0) - gUnknown_2026E60[iVar12] = uVar7; + gUnknown_2026E60[iVar11 * 2 + k * 2] = uVar7; else - gUnknown_20270E8[iVar12] = uVar7; + gUnknown_20270E8[iVar11 * 2 + k * 2] = uVar7; } } - iVar12 -= 2; - iVar11--; + k--; } } - sp10 += spC; - } while (sp10 < 0x400); + } } break; } } #else -NAKED void sub_8005838(s32 *a0, u8 a1) +NAKED void sub_8005838(s32 *a0, u8 kind) { asm_unified( "push {r4-r7,lr}\n" diff --git a/src/code_8009804.c b/src/code_8009804.c index 393f13588..a65e08a36 100644 --- a/src/code_8009804.c +++ b/src/code_8009804.c @@ -1,95 +1,73 @@ #include "global.h" +#include "bg_palette_buffer.h" +#include "code_8009804.h" #include "cpu.h" #include "file_system.h" #include "text1.h" -extern u8 gUnknown_202D238[4]; -extern s32 gUnknown_202D23C; -extern u8 gUnknown_80B88CC[]; -extern struct FileArchive gSystemFileArchive; - -struct unkStruct_202D240 -{ - u32 *unk0; - u32 *unk4; - u32 size; -}; -extern struct unkStruct_202D240 gUnknown_202D240[8]; - -struct unkStruct_202D038 -{ - // size: 0x40 - u32 unk0[0x10]; -}; +extern const u8 gUnknown_80B88CC[]; +extern const struct FileArchive gSystemFileArchive; // 8300500 extern struct unkStruct_202D038 gUnknown_202D038[8]; +extern u8 gUnknown_202D238[4]; +extern s32 gUnknown_202D23C; +extern struct unkStruct_202D240 gUnknown_202D240[8]; -extern void SetBGPaletteBufferColorArray(s32 index, void *colorArray); +// code_8009804.s extern void sub_8009A1C(u32); -u32 sub_80063B0(void); void sub_80097B0(void) { - struct OpenedFile *fontpalFile; - s32 index; + OpenedFile *fontpalFile; + s32 i; u32 *ptr; - fontpalFile = OpenFileAndGetFileDataPtr(gUnknown_80B88CC,&gSystemFileArchive); // fontpal + fontpalFile = OpenFileAndGetFileDataPtr(gUnknown_80B88CC, &gSystemFileArchive); // fontpal CpuCopy(gUnknown_202D038, fontpalFile->data, sizeof(gUnknown_202D038)); - if (sub_80063B0() == 1) { + + if (sub_80063B0() == 1) ptr = &gUnknown_202D038[0].unk0[0]; - } else - { ptr = &gUnknown_202D038[1].unk0[0]; - } - for(index = 0; index < 0x10; ptr++, index++) - { - SetBGPaletteBufferColorArray(index + 0xf0, ptr); - } + + for (i = 0; i < 16; ptr++, i++) + SetBGPaletteBufferColorArray(i + 240, (u8 *)ptr); + CloseFile(fontpalFile); } void vram_related_8009804(void) { - u32 counter; - u32 *r1; + u32 i; + u32 *dest; - r1 = (u32 *) VRAM; - for(counter = 0; counter < 0x13C0; counter++) - { - *r1++ = 0; - } - r1 = (u32 *) 0x06007000; - for(counter = 0; counter < 0x400; counter++) - { - *r1++ = 0; - } - r1 = (u32 *) 0x06008000; - for(counter = 0; counter < 0x2000; counter++) - { - *r1++ = 0; - } - r1 = (u32 *) OBJ_VRAM0; - for(counter = 0; counter < 0x1f80; counter++) - { - *r1++ = 0; - } - r1 = (u32 *) PLTT; - for(counter = 0; counter < 120; counter++) - { - *r1++ = 0; - } - r1 = (u32 *) OBJ_PLTT; - for(counter = 0; counter < 120; counter++) - { - *r1++ = 0; - } - r1 = (u32 *) OAM; - for(counter = 0; counter < 256; counter++) - { - *r1++ = 0xa000a0; - } + dest = (u32 *)VRAM; + for (i = 0; i < 0x13C0; i++) + *dest++ = 0; + + dest = (u32 *)0x06007000; + for (i = 0; i < 0x400; i++) + *dest++ = 0; + + dest = (u32 *)0x06008000; + for (i = 0; i < 0x2000; i++) + *dest++ = 0; + + dest = (u32 *)OBJ_VRAM0; + for (i = 0; i < 0x1F80; i++) + *dest++ = 0; + + dest = (u32 *)PLTT; + for (i = 0; i < 120; i++) + *dest++ = 0; + + dest = (u32 *)OBJ_PLTT; + for (i = 0; i < 120; i++) + *dest++ = 0; + + dest = (u32 *)OAM; + for (i = 0; i < 256; i++) + *dest++ = 0xA000A0; // TODO: Macro or explanation } void sub_80098A0(void) @@ -103,7 +81,7 @@ void sub_80098A0(void) void sub_80098BC(u32 *r0, u32 *r1, u32 r2) { - if(gUnknown_202D23C < 8){ + if (gUnknown_202D23C < 8) { gUnknown_202D240[gUnknown_202D23C].unk0 = r0; gUnknown_202D240[gUnknown_202D23C].unk4 = r1; gUnknown_202D240[gUnknown_202D23C].size = r2; @@ -118,29 +96,28 @@ void sub_80098F8(u32 r0) void sub_8009908(void) { - s32 index; - - for(index = 0; index < gUnknown_202D23C; index++) - { - CpuCopy(gUnknown_202D240[index].unk0, gUnknown_202D240[index].unk4, gUnknown_202D240[index].size); - } - gUnknown_202D23C = 0; - if (gUnknown_202D238[0] != 0) { - gUnknown_202D238[0] = 0; - CpuCopy(BG_SCREEN_ADDR(12), gUnknown_202B038[0], BG_SCREEN_SIZE); - } - if (gUnknown_202D238[1] != 0) { - gUnknown_202D238[1] = 0; - CpuCopy(BG_SCREEN_ADDR(13), gUnknown_202B038[1], BG_SCREEN_SIZE); - } - if (gUnknown_202D238[2] != 0) { - gUnknown_202D238[2] = 0; - CpuCopy(BG_SCREEN_ADDR(14), gUnknown_202B038[2], BG_SCREEN_SIZE); - } - if (gUnknown_202D238[3] != 0) { - gUnknown_202D238[3] = 0; - CpuCopy(BG_SCREEN_ADDR(15), gUnknown_202B038[3], BG_SCREEN_SIZE); - } + s32 i; + + for (i = 0; i < gUnknown_202D23C; i++) + CpuCopy(gUnknown_202D240[i].unk0, gUnknown_202D240[i].unk4, gUnknown_202D240[i].size); + + gUnknown_202D23C = 0; + if (gUnknown_202D238[0] != 0) { + gUnknown_202D238[0] = 0; + CpuCopy(BG_SCREEN_ADDR(12), gUnknown_202B038[0], BG_SCREEN_SIZE); + } + if (gUnknown_202D238[1] != 0) { + gUnknown_202D238[1] = 0; + CpuCopy(BG_SCREEN_ADDR(13), gUnknown_202B038[1], BG_SCREEN_SIZE); + } + if (gUnknown_202D238[2] != 0) { + gUnknown_202D238[2] = 0; + CpuCopy(BG_SCREEN_ADDR(14), gUnknown_202B038[2], BG_SCREEN_SIZE); + } + if (gUnknown_202D238[3] != 0) { + gUnknown_202D238[3] = 0; + CpuCopy(BG_SCREEN_ADDR(15), gUnknown_202B038[3], BG_SCREEN_SIZE); + } } void sub_80099C0(void) @@ -149,16 +126,15 @@ void sub_80099C0(void) CpuCopy(BG_SCREEN_ADDR(13), gUnknown_202B038[1], BG_SCREEN_SIZE); } -void sub_80099F0(u32 r0) +void sub_80099F0(u32 a0) { - s32 iVar2; - for(iVar2 = 0; iVar2 < 8; iVar2++) - { - gUnknown_202D038[iVar2].unk0[1] = r0; - } + s32 i; + + for (i = 0; i < 8; i++) + gUnknown_202D038[i].unk0[1] = a0; } -void sub_8009A10(u32 *r0) +UNUSED static void sub_8009A10(u32 *a0) { - sub_8009A1C(r0[1]); -} + sub_8009A1C(a0[1]); +} \ No newline at end of file diff --git a/src/code_800C9CC.c b/src/code_800C9CC.c index 78183a5b6..562c0080a 100644 --- a/src/code_800C9CC.c +++ b/src/code_800C9CC.c @@ -1,4 +1,5 @@ #include "global.h" +#include "code_800C9CC.h" #include "input.h" #include "random.h" #include "reg_control.h" @@ -10,20 +11,19 @@ void sub_800CB20(void) { sub_800BA5C(); gUnknown_203B0B8++; - if((gRawKeyInput & (A_BUTTON | SELECT_BUTTON)) != 0) - { + + if (gRawKeyInput & (A_BUTTON | SELECT_BUTTON)) Rand32Bit(); - } + Rand32Bit(); } -// Unused -u32 sub_800CB50(void) +UNUSED static u32 sub_800CB50(void) { return gUnknown_203B0B8; } -void nullsub_180(void) +UNUSED static void nullsub_180(void) { } @@ -32,48 +32,48 @@ void xxx_call_update_bg_sound_input(void) xxx_update_bg_sound_input(); } -void nullsub_181(void) +UNUSED static void nullsub_181(void) { } -u32 sub_800CB70(void) +UNUSED static bool8 sub_800CB70(void) { - return 0; + return FALSE; } -void ReadKeyInput(struct Inputs *r0) +void ReadKeyInput(Inputs *r0) { u16 keyInput = REG_KEYINPUT ^ KEYS_MASK; r0->held = 0; - if((keyInput & DPAD_UP) != 0) + if (keyInput & DPAD_UP) r0->held = DPAD_UP; - if((keyInput & DPAD_DOWN) != 0) + if (keyInput & DPAD_DOWN) r0->held |= DPAD_DOWN; - if((keyInput & DPAD_LEFT) != 0) + if (keyInput & DPAD_LEFT) r0->held |= DPAD_LEFT; - if((keyInput & DPAD_RIGHT) != 0) + if (keyInput & DPAD_RIGHT) r0->held |= DPAD_RIGHT; - if((keyInput & A_BUTTON) != 0) + if (keyInput & A_BUTTON) r0->held |= A_BUTTON; - if((keyInput & B_BUTTON) != 0) + if (keyInput & B_BUTTON) r0->held |= B_BUTTON; - if((keyInput & START_BUTTON) != 0) + if (keyInput & START_BUTTON) r0->held |= START_BUTTON; - if((keyInput & SELECT_BUTTON) != 0) + if (keyInput & SELECT_BUTTON) r0->held |= SELECT_BUTTON; - if((keyInput & R_BUTTON) != 0) + if (keyInput & R_BUTTON) r0->held |= R_BUTTON; - if((keyInput & L_BUTTON) != 0) + if (keyInput & L_BUTTON) r0->held |= L_BUTTON; gRawKeyInput = keyInput; diff --git a/src/code_800DAC0.c b/src/code_800DAC0.c index 0ba45e6da..e33f29784 100644 --- a/src/code_800DAC0.c +++ b/src/code_800DAC0.c @@ -68,7 +68,7 @@ extern void sub_800F094(); void sub_800DAC0(u32 fileSelection) { s32 index; - struct OpenedFile *filePtr; + OpenedFile *filePtr; struct unkStruct_203B0CC_sub *preload; if (gUnknown_203B0CC != NULL) { diff --git a/src/code_80118A4.c b/src/code_80118A4.c index 21fd175a2..a179bd6e4 100644 --- a/src/code_80118A4.c +++ b/src/code_80118A4.c @@ -3,6 +3,8 @@ #include "global.h" #include "code_8004AA0.h" #include "code_800558C.h" +#include "code_8009804.h" +#include "code_800C9CC.h" #include "code_80118A4.h" #include "music.h" #include "constants/bg_music.h" @@ -14,13 +16,13 @@ #include "sprite.h" #include "event_flag.h" -extern struct GameOptions *gGameOptionsRef; +extern GameOptions *gGameOptionsRef; // size: 0x4DD8 struct UnkBgStruct { u8 padding[0x4c4b]; - /* 0x4C4C */ struct unkStruct_202EE8C unk4C4C[16]; + /* 0x4C4C */ unkStruct_202EE8C unk4C4C[16]; u32 unk4DCC; u32 unk4DD0; /* 0x4DD4 */ s16 xoffset; @@ -36,12 +38,9 @@ EWRAM_DATA s16 gUnknown_202DE22; EWRAM_DATA s16 gUnknown_202DE24; void nullsub_8(u32); -void sub_8005838(u32, u32); extern void TransferBGPaletteBuffer(void); extern void xxx_call_update_bg_vram(void); -extern void sub_8009908(void); extern void xxx_call_update_bg_sound_input(void); -extern void sub_800CB20(void); extern bool8 sub_80111C4(); extern void sub_8010F28(); @@ -51,7 +50,7 @@ void sub_801169C(void) SetBG3RegOffsets(gUnknown_203B0E4->xoffset, gUnknown_203B0E4->yoffset); sub_8010F28(); sub_8004AF0(sub_80111C4(), gUnknown_203B0E4->unk4C4C, 0xB0, 16, gUnknown_203B0E4->unk4DCC, NULL); - sub_8005838(0, 0); + sub_8005838(NULL, 0); nullsub_8(gGameOptionsRef->unkA); sub_8005180(); sub_80060EC(); diff --git a/src/code_8012A18.c b/src/code_8012A18.c index c98cbd46d..7856b74ca 100644 --- a/src/code_8012A18.c +++ b/src/code_8012A18.c @@ -1,5 +1,7 @@ #include "global.h" #include "code_800558C.h" +#include "code_8009804.h" +#include "code_800C9CC.h" #include "code_80118A4.h" #include "game_options.h" #include "input.h" @@ -7,14 +9,11 @@ extern void xxx_draw_string_80144C4(); extern void nullsub_8(u8); -extern void sub_800CB20(); extern void TransferBGPaletteBuffer(); extern void xxx_call_update_bg_vram(); -extern void sub_8009908(); extern void xxx_call_update_bg_sound_input(); -extern struct GameOptions *gGameOptionsRef; - +extern GameOptions *gGameOptionsRef; void sub_8012A18() { @@ -32,5 +31,4 @@ void sub_8012A18() sub_8009908(); xxx_call_update_bg_sound_input(); ResetSprites(FALSE); -} - +} \ No newline at end of file diff --git a/src/code_8012A18_1.c b/src/code_8012A18_1.c index 3fadc67cd..74bde6a63 100644 --- a/src/code_8012A18_1.c +++ b/src/code_8012A18_1.c @@ -14,7 +14,7 @@ struct unkStruct_203B200 u32 unk4; u8 *pokeName; s32 state; - /* 0x10 */ struct MenuItem menus[3]; + /* 0x10 */ MenuItem menus[3]; u8 fill[0x50 - 0x28]; }; extern struct unkStruct_203B200 *gUnknown_203B200; @@ -79,7 +79,7 @@ s32 sub_8016028(void) u32 sub_801602C(u32 r0, u8 *name) { ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); gUnknown_203B200 = MemoryAlloc(sizeof(struct unkStruct_203B200), 8); gUnknown_203B200->unk0 = r0; gUnknown_203B200->pokeName = name; diff --git a/src/code_801AFA4.c b/src/code_801AFA4.c index 9cf65cf05..594475d5e 100644 --- a/src/code_801AFA4.c +++ b/src/code_801AFA4.c @@ -1,86 +1,52 @@ #include "global.h" -#include "memory.h" -#include "text.h" -#include "item.h" -#include "team_inventory.h" -#include "menu.h" -#include "pokemon.h" -#include "gulpin_shop.h" -#include "code_80130A8.h" #include "code_80118A4.h" +#include "code_80130A8.h" +#include "code_801AFA4.h" +#include "code_8098BDC.h" +#include "gulpin_shop.h" +#include "memory.h" +#include "moves.h" +#include "pokemon_mid.h" -extern void sub_8092C84(u8 *, u16); -extern void sub_8099690(u32); -extern s32 GetNumMonsAbleToLearnItemMove(void); -extern void sub_801B064(s32); +extern u8 gAvailablePokemonNames[]; // 202DF98 +extern u8 gUnknown_202E1C8[]; +extern u8 gUnknown_202E218[160]; +static EWRAM_DATA_2 unkStruct_203B22C *sUnknown_203B22C = {0}; -extern void sub_801B200(void); -extern void sub_801B2AC(void); -extern void sub_801B2D8(void); -extern void nullsub_37(); -extern void sub_801B080(); +#include "data/code_801AFA4.h" -extern const u8 gUnknown_80DB9BC[]; -extern const u8 gUnknown_80DB9E4[]; -extern const u8 gUnknown_80DBA0C[]; +static s32 GetNumMonsAbleToLearnItemMove(void); +static void nullsub_37(void); -extern u8 gUnknown_202E1C8[0x50]; -extern u8 gAvailablePokemonNames[0x50]; -extern u8 gUnknown_202E218[0x50]; +static void sub_801B064(s32); +static void sub_801B080(void); +static void sub_801B178(void); +static void sub_801B200(void); +static void sub_801B2AC(void); +static void sub_801B2D8(void); -extern void InitZeroedPPPokemonMove(struct Move*, u16); -extern void unk_CopyMoves4To8(struct Move *, struct Move *); -extern bool8 IsHMItem(u8); -extern void sub_801B178(void); -extern void sub_8094060(void *, struct Move *); -extern void PrintPokeNameToBuffer(u8 *buffer, struct PokemonStruct *pokemon); -extern u32 sub_801E8C0(void); - -extern bool8 CanMonLearnMove(u16 moveID, s16 _species); -extern s32 sub_808D580(s32*); - -struct unkStruct_203B22C +bool8 sub_801AFA4(u32 index) { - // size: 0xa4 - /* 0x0 */ s32 state; - /* 0x4 */ u32 teamItemIndex; - /* 0x8 */ u8 id; // item index - /* 0xA */ u16 moveID; // item move?? - /* 0xC */ struct Move moves[MAX_MON_MOVES * 2]; - /* 0x4C */ s32 monsAbleToLearnMove; // number of party members able to learn move - /* 0x50 */ s16 unk50[MAX_TEAM_MEMBERS]; // species IDs of each member able to learn move - /* 0x58 */ s16 chosenPokemon; // species of pokemon that will learn move - /* 0x5C */ struct PokemonStruct *pokeStruct; // PokemonStruct of said pokemon - u32 unk60; - /* 0x64 */ struct MenuItem menuItems[8]; -}; -extern struct unkStruct_203B22C *gUnknown_203B22C; - -u32 sub_801AFA4(u32 index) -{ - gUnknown_203B22C = MemoryAlloc(sizeof(struct unkStruct_203B22C), 8); - gUnknown_203B22C->teamItemIndex = index; - gUnknown_203B22C->id = gTeamInventoryRef->teamItems[index].id; - gUnknown_203B22C->moveID = GetItemMoveID(gUnknown_203B22C->id); - sub_8092C84(gUnknown_202E1C8, gUnknown_203B22C->moveID); + sUnknown_203B22C = MemoryAlloc(sizeof(unkStruct_203B22C), 8); + sUnknown_203B22C->teamItemIndex = index; + sUnknown_203B22C->id = gTeamInventoryRef->teamItems[index].id; + sUnknown_203B22C->moveID = GetItemMoveID(sUnknown_203B22C->id); + sub_8092C84(gUnknown_202E1C8, sUnknown_203B22C->moveID); sub_8099690(0); - if(GetNumMonsAbleToLearnItemMove() == 0) - { + + if (GetNumMonsAbleToLearnItemMove() == 0) sub_801B064(3); - } - else - { - gUnknown_203B22C->unk60 = 4; + else { + sUnknown_203B22C->unk60 = 4; sub_801B064(0); } - return 1; + return TRUE; } u32 sub_801B00C(void) { - switch(gUnknown_203B22C->state) - { + switch (sUnknown_203B22C->state) { case 4: return 3; case 0: @@ -98,53 +64,44 @@ u32 sub_801B00C(void) void sub_801B048(void) { - if(gUnknown_203B22C != NULL) - { - MemoryFree(gUnknown_203B22C); - gUnknown_203B22C = NULL; + if (sUnknown_203B22C != NULL) { + MemoryFree(sUnknown_203B22C); + sUnknown_203B22C = NULL; } } -void sub_801B064(s32 newState) +static void sub_801B064(s32 newState) { - gUnknown_203B22C->state = newState; + sUnknown_203B22C->state = newState; nullsub_37(); sub_801B080(); } -void nullsub_37(void) +static void nullsub_37(void) { } -void sub_801B080(void) +static void sub_801B080(void) { - switch(gUnknown_203B22C->state) - { + switch (sUnknown_203B22C->state) { case 0: sub_801B178(); - // {CENTER_ALIGN}Who will learn the move - // {CENTER_ALIGN}{COLOR_1 CYAN}{ARG_POKEMON_7}{END_COLOR_TEXT_1}? - sub_8014248(gUnknown_80DB9BC, 0, gUnknown_203B22C->unk60, gUnknown_203B22C->menuItems, 0, 4, 0, 0, 0x20); + sub_8014248(sFmtWhoWillLearnTheMove, 0, sUnknown_203B22C->unk60, sUnknown_203B22C->menuItems, 0, 4, 0, NULL, 32); break; case 1: - CreateGulpinShop(2, gUnknown_203B22C->chosenPokemon, gUnknown_203B22C->moves); + CreateGulpinShop(2, sUnknown_203B22C->chosenPokemon, sUnknown_203B22C->moves); break; case 2: - sub_8094060(gUnknown_203B22C->moves, gUnknown_203B22C->pokeStruct->moves); - if(!IsHMItem(gUnknown_203B22C->id)) - { - gTeamInventoryRef->teamItems[gUnknown_203B22C->teamItemIndex].quantity = gUnknown_203B22C->id - 0x7D; - gTeamInventoryRef->teamItems[gUnknown_203B22C->teamItemIndex].id = ITEM_TM_USED_TM; + sub_8094060(sUnknown_203B22C->moves, sUnknown_203B22C->pokeStruct->moves); + if (!IsHMItem(sUnknown_203B22C->id)) { + gTeamInventoryRef->teamItems[sUnknown_203B22C->teamItemIndex].quantity = sUnknown_203B22C->id - 125; + gTeamInventoryRef->teamItems[sUnknown_203B22C->teamItemIndex].id = ITEM_TM_USED_TM; } - PlaySound(0x9C << 1); - // {CENTER_ALIGN}CM{ARG_POKEMON_8}{END_COLOR_TEXT_1} learned - // {CENTER_ALIGN}the move {COLOR_1 CYAN}{ARG_POKEMON_7}{END_COLOR_TEXT_1}! - sub_80141B4(gUnknown_80DB9E4, 0, 0, 0x121); + PlaySound(312); + sub_80141B4(sFmtLearnedTheMove, 0, 0, 0x121); break; case 3: - // {CENTER_ALIGN}No one in the current team - // {CENTER_ALIGN}can learn this move. - sub_80141B4(gUnknown_80DBA0C, 0, 0, 0x121); + sub_80141B4(sFmtNoOneCanLearnThisMove, 0, 0, 0x121); break; default: case 4: @@ -152,65 +109,64 @@ void sub_801B080(void) } } -void sub_801B178(void) +static void sub_801B178(void) { - int monIndex; + s32 monIndex; u8 *bufferPtr; - for(monIndex = 0; monIndex < gUnknown_203B22C->monsAbleToLearnMove; monIndex++) - { - bufferPtr = gAvailablePokemonNames + (0x50 * monIndex); - PrintPokeNameToBuffer(bufferPtr, &gRecruitedPokemonRef->pokemon[gUnknown_203B22C->unk50[monIndex]]); - gUnknown_203B22C->menuItems[monIndex].text = bufferPtr; - gUnknown_203B22C->menuItems[monIndex].menuAction = monIndex + 4; + for (monIndex = 0; monIndex < sUnknown_203B22C->monsAbleToLearnMove; monIndex++) { + bufferPtr = gAvailablePokemonNames + (80 * monIndex); + PrintPokeNameToBuffer(bufferPtr, &gRecruitedPokemonRef->pokemon[sUnknown_203B22C->unk50[monIndex]]); + sUnknown_203B22C->menuItems[monIndex].text = bufferPtr; + sUnknown_203B22C->menuItems[monIndex].menuAction = monIndex + 4; } - gUnknown_203B22C->menuItems[monIndex].text = NULL; - gUnknown_203B22C->menuItems[monIndex].menuAction = 1; + + sUnknown_203B22C->menuItems[monIndex].text = NULL; + sUnknown_203B22C->menuItems[monIndex].menuAction = 1; } -void sub_801B200(void) +static void sub_801B200(void) { s32 temp; s32 moveIndex; - struct Move *pokeMove; + Move *pokeMove; - if(sub_80144A4(&temp) == 0) - { - gUnknown_203B22C->unk60 = temp; - switch(temp) - { - case 1: - sub_801B064(4); - break; - default: - gUnknown_203B22C->chosenPokemon = gUnknown_203B22C->unk50[temp - 4]; - gUnknown_203B22C->pokeStruct = &gRecruitedPokemonRef->pokemon[gUnknown_203B22C->chosenPokemon]; - PrintPokeNameToBuffer(gUnknown_202E218, gUnknown_203B22C->pokeStruct); - unk_CopyMoves4To8(gUnknown_203B22C->moves, gUnknown_203B22C->pokeStruct->moves); - for(moveIndex = 0; moveIndex < MAX_MON_MOVES * 2; moveIndex++) - { - pokeMove = &gUnknown_203B22C->moves[moveIndex]; - if((pokeMove->moveFlags & MOVE_FLAG_EXISTS) == 0) - { - InitZeroedPPPokemonMove(pokeMove, gUnknown_203B22C->moveID); - break; - } + if (sub_80144A4(&temp)) + return; + + sUnknown_203B22C->unk60 = temp; + switch (temp) { + case 1: + sub_801B064(4); + break; + default: + sUnknown_203B22C->chosenPokemon = sUnknown_203B22C->unk50[temp - 4]; + sUnknown_203B22C->pokeStruct = &gRecruitedPokemonRef->pokemon[sUnknown_203B22C->chosenPokemon]; + PrintPokeNameToBuffer(gUnknown_202E218, sUnknown_203B22C->pokeStruct); + unk_CopyMoves4To8(sUnknown_203B22C->moves, sUnknown_203B22C->pokeStruct->moves); + + for (moveIndex = 0; moveIndex < MAX_MON_MOVES * 2; moveIndex++) { + pokeMove = &sUnknown_203B22C->moves[moveIndex]; + + if ((pokeMove->moveFlags & MOVE_FLAG_EXISTS) == 0) { + InitZeroedPPPokemonMove(pokeMove, sUnknown_203B22C->moveID); + break; } - if(moveIndex >= MAX_MON_MOVES) - sub_801B064(1); - else - sub_801B064(2); - break; - case 0: - break; - } + } + + if (moveIndex >= MAX_MON_MOVES) + sub_801B064(1); + else + sub_801B064(2); + break; + case 0: + break; } } -void sub_801B2AC(void) +static void sub_801B2AC(void) { - switch(sub_801E8C0()) - { + switch (sub_801E8C0()) { case 3: DestroyGulpinShop(); sub_801B064(2); @@ -225,56 +181,52 @@ void sub_801B2AC(void) } } - -void sub_801B2D8(void) +static void sub_801B2D8(void) { s32 temp; - if(sub_80144A4(&temp) == 0) - { + if (sub_80144A4(&temp) == 0) sub_801B064(4); - } } -s32 GetNumMonsAbleToLearnItemMove(void) +static s32 GetNumMonsAbleToLearnItemMove(void) { s32 length; s32 numMons; - s32 index; - s32 team [MAX_TEAM_MEMBERS]; - struct PokemonStruct *preload; + s32 i; + s32 team[MAX_TEAM_MEMBERS]; + PokemonStruct1 *preload; length = sub_808D580(team); - gUnknown_203B22C->monsAbleToLearnMove = 0; + sUnknown_203B22C->monsAbleToLearnMove = 0; - for(index = 0; index < length; index++) - { - preload = &gRecruitedPokemonRef->pokemon[team[index]]; - if (CanMonLearnMove(gUnknown_203B22C->moveID, preload->speciesNum)) { - gUnknown_203B22C->unk50[gUnknown_203B22C->monsAbleToLearnMove] = team[index]; - numMons = gUnknown_203B22C->monsAbleToLearnMove; - if (numMons >= MAX_TEAM_MEMBERS) break; - gUnknown_203B22C->monsAbleToLearnMove = numMons + 1; + for (i = 0; i < length; i++) { + preload = &gRecruitedPokemonRef->pokemon[team[i]]; + + if (CanMonLearnMove(sUnknown_203B22C->moveID, preload->speciesNum)) { + sUnknown_203B22C->unk50[sUnknown_203B22C->monsAbleToLearnMove] = team[i]; + numMons = sUnknown_203B22C->monsAbleToLearnMove; + if (numMons >= MAX_TEAM_MEMBERS) + break; + sUnknown_203B22C->monsAbleToLearnMove = numMons + 1; } } - return gUnknown_203B22C->monsAbleToLearnMove; + return sUnknown_203B22C->monsAbleToLearnMove; } -// Unused -bool8 sub_801B374(u8 id) +UNUSED static bool8 sub_801B374(u8 id) { - u16 moveID; - struct PokemonStruct *pokeStruct; - s32 index; + u16 moveID; + PokemonStruct1 *pokeStruct; + s32 i; - pokeStruct = &gRecruitedPokemonRef->pokemon[0]; - moveID = GetItemMoveID(id); + pokeStruct = &gRecruitedPokemonRef->pokemon[0]; + moveID = GetItemMoveID(id); - for(index = 0; index < NUM_MONSTERS; index++, pokeStruct++) - { - if((pokeStruct->unk0 >> 1 & 1) != 0) - if(CanMonLearnMove(moveID, pokeStruct->speciesNum)) - return FALSE; - } - return TRUE; -} + for (i = 0; i < NUM_MONSTERS; i++, pokeStruct++) { + if ((pokeStruct->unk0 >> 1) & 1) + if (CanMonLearnMove(moveID, pokeStruct->speciesNum)) + return FALSE; + } + return TRUE; +} \ No newline at end of file diff --git a/src/code_801B3C0.c b/src/code_801B3C0.c index ec900ce93..878db80b4 100644 --- a/src/code_801B3C0.c +++ b/src/code_801B3C0.c @@ -1,115 +1,42 @@ #include "global.h" #include "code_80118A4.h" +#include "code_80130A8.h" #include "code_801B3C0.h" -#include "constants/colors.h" +#include "items.h" +#include "memory.h" +#include "menu_input.h" +#include "sprite.h" #include "text1.h" #include "text2.h" -#include "item.h" -#include "memory.h" -#include "pokemon.h" -#include "team_inventory.h" -#include "menu_input.h" -#include "kecleon_bros.h" -#include "sprite.h" -#include "code_80130A8.h" -extern struct unkStruct_203B230 *gUnknown_203B230; +extern u8 gAvailablePokemonNames[]; // 202DF98 -struct unkStruct_203B234 +static EWRAM_DATA_2 unkStruct_203B230 *sUnknown_203B230 = {0}; + +#include "data/code_801B3C0.h" // 80DBA4C + +static void sub_801B46C(u32); +static void sub_801B480(void); +static void sub_801B51C(void); +static void sub_801B590(void); + +bool8 sub_801B3C0(Item *item) { - // size: 0x154 - u32 unk0; - u32 state; - u32 fallbackState; - u8 unkC; - struct Item unk10; - struct unkStruct_8090F58 unk14; - struct Item unk20; - u32 unk24; - struct MenuStruct unk28; - struct MenuStruct unk78; - u32 menuAction; - struct MenuItem unkCC[5]; - struct UnkTextStruct2 unkF4[4]; -}; - -extern struct unkStruct_203B234 *gUnknown_203B234; - -extern u8 gUnknown_202DE58[]; -extern u8 gAvailablePokemonNames[0x58]; -extern u8 gUnknown_80DBA4C[]; -extern u8 gUnknown_80DBB9C[]; -extern u8 gUnknown_80DBD24[]; -extern u8 gUnknown_80DBCE8[]; -extern u8 gUnknown_80DBCC4[]; -extern u8 gUnknown_80DBC98[]; -extern u8 gUnknown_80DBC60[]; -extern u8 gUnknown_80DBC28[]; -extern u8 gUnknown_80DBB9C[]; -extern u8 gUnknown_80DBAA0[]; -extern u8 gUnknown_80DBAD0[]; -extern u8 gUnknown_80DBB08[]; -extern u8 gUnknown_80DBB38[]; -extern u8 gKangaskhanTrashToolboxItem[]; -extern u8 gKangaskhanTrashReceivedItem[]; -extern u8 gKangaskhanStorage[]; -extern u8 gKangaskhanTrash[]; -extern u8 *gUnknown_80D4970[]; -extern u8 gUnknown_202DEA8[]; -extern u8 *gUnknown_80D4920[]; -extern u8 *gUnknown_80D4928[]; - -extern void sub_8099690(u32); - -extern struct UnkTextStruct2 gUnknown_80DBA58; -extern struct UnkTextStruct2 gUnknown_80DBA88; -extern struct UnkTextStruct2 gUnknown_80DBA70; - -extern void sub_801BB5C(void); -extern struct PokemonStruct *GetPlayerPokemonStruct(void); -extern void sub_801B748(u32); -extern void sub_8013F84(void); -extern s32 sub_80913E0(struct Item *, u32, struct subStruct_203B240 **); -extern void sub_80140B4(struct UnkTextStruct2 *); -extern void sub_801B46C(u32); -extern void sub_801BC64(void); -extern void sub_801BC94(void); -extern void sub_801BCCC(void); -extern void sub_801BD80(void); -extern void sub_801BEAC(void); -extern void sub_801BE30(void); -extern void sub_801BEC8(void); -extern void sub_801B760(void); -extern void sub_801B874(void); -extern u32 sub_8001784(u32, u32, u16); -extern void sub_800199C(u32, u32, u32, u32); -extern s32 sub_808D544(u32); - -void sub_801B480(void); -void sub_801B51C(void); -void sub_801B590(void); -void sub_801BB20(void); -void sub_801BC24(void); - - -u32 sub_801B3C0(struct Item *item) -{ - ResetSprites(TRUE); - gUnknown_203B230 = MemoryAlloc(sizeof(struct unkStruct_203B230),8); - gUnknown_203B230->item = *item; - sub_801317C(&gUnknown_203B230->unk88); - gUnknown_203B230->unk24 = 0; - sub_80140B4(gUnknown_203B230->unk28); - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B230->unk28,1,1); - sub_801B46C(0); - return 1; + ResetSprites(TRUE); + sUnknown_203B230 = MemoryAlloc(sizeof(unkStruct_203B230),8); + sUnknown_203B230->item = *item; + sub_801317C(&sUnknown_203B230->unk88); + sUnknown_203B230->unk24 = 0; + sub_80140B4(sUnknown_203B230->unk28); + ResetUnusedInputStruct(); + sub_800641C(sUnknown_203B230->unk28, TRUE, TRUE); + sub_801B46C(0); + return TRUE; } u32 sub_801B410(void) { - switch(gUnknown_203B230->state) - { + switch (sUnknown_203B230->state) { case 0: sub_801B51C(); break; @@ -122,42 +49,42 @@ u32 sub_801B410(void) default: return 2; } + return 0; } void sub_801B450(void) { - if(gUnknown_203B230 != NULL) - { - MemoryFree(gUnknown_203B230); - gUnknown_203B230 = NULL; + if (sUnknown_203B230 != NULL) { + MemoryFree(sUnknown_203B230); + sUnknown_203B230 = NULL; } } -void sub_801B46C(u32 newState) +static void sub_801B46C(u32 newState) { - gUnknown_203B230->state = newState; + sUnknown_203B230->state = newState; sub_801B480(); } -void sub_801B480(void) +static void sub_801B480(void) { struct subStruct_203B240 *preload; - switch(gUnknown_203B230->state) - { + + switch (sUnknown_203B230->state) { case 0: - sub_8008C54(gUnknown_203B230->unk24); - gUnknown_203B230->unkC = sub_80913E0(&gUnknown_203B230->item, gUnknown_203B230->unk24, gUnknown_203B230->unk10); - gUnknown_203B230->unk20 = 0; + sub_8008C54(sUnknown_203B230->unk24); + sUnknown_203B230->unkC = sub_80913E0(&sUnknown_203B230->item, sUnknown_203B230->unk24, sUnknown_203B230->unk10); + sUnknown_203B230->unk20 = 0; break; case 1: - sub_8008C54(gUnknown_203B230->unk24); - sub_80073B8(gUnknown_203B230->unk24); - preload = gUnknown_203B230->unk10[gUnknown_203B230->unk8]; + sub_8008C54(sUnknown_203B230->unk24); + sub_80073B8(sUnknown_203B230->unk24); + preload = sUnknown_203B230->unk10[sUnknown_203B230->unk8]; strcpy(gAvailablePokemonNames, preload->pokeName); - xxx_format_and_draw(16, 0, gUnknown_80DBA4C, gUnknown_203B230->unk24, 0); // {ARG_POKEMON_0} - xxx_format_and_draw(4, 16, gUnknown_203B230->unk10[gUnknown_203B230->unk8]->unk4, gUnknown_203B230->unk24, 0); - sub_80073E0(gUnknown_203B230->unk24); + xxx_format_and_draw(16, 0, sFmtPkmn0, sUnknown_203B230->unk24, 0); // {ARG_POKEMON_0} + xxx_format_and_draw(4, 16, sUnknown_203B230->unk10[sUnknown_203B230->unk8]->unk4, sUnknown_203B230->unk24, 0); + sub_80073E0(sUnknown_203B230->unk24); break; case 2: default: @@ -165,21 +92,21 @@ void sub_801B480(void) } } -void sub_801B51C(void) +static void sub_801B51C(void) { - if(gUnknown_203B230->unkC != 0) - { - if(gUnknown_203B230->unk20 & 8) + if (sUnknown_203B230->unkC != 0) { + if (sUnknown_203B230->unk20 & 8) sub_8013F84(); - gUnknown_203B230->unk20++; + + sUnknown_203B230->unk20++; } - switch(sub_8012A64(&gUnknown_203B230->unk88, gUnknown_203B230->unk24)) - { + + switch (sub_8012A64(&sUnknown_203B230->unk88, sUnknown_203B230->unk24)) { case 1: PlayMenuSoundEffect(0); - if(gUnknown_203B230->unkC != 0) - { - gUnknown_203B230->unk8 = 0; + + if (sUnknown_203B230->unkC != 0) { + sUnknown_203B230->unk8 = 0; sub_801B46C(1); } else @@ -194,501 +121,28 @@ void sub_801B51C(void) } } -void sub_801B590(void) +static void sub_801B590(void) { + if (sUnknown_203B230->unk8 < (sUnknown_203B230->unkC - 1)) { + if (sUnknown_203B230->unk20 & 8) + sub_8013F84(); - if (gUnknown_203B230->unk8 < (gUnknown_203B230->unkC - 1)) { - if ((gUnknown_203B230->unk20 & 8)) { - sub_8013F84(); + sUnknown_203B230->unk20++; } - gUnknown_203B230->unk20++; - } - switch(sub_8012A64(&gUnknown_203B230->unk88,gUnknown_203B230->unk24)) - { - case 1: - PlayMenuSoundEffect(0); - gUnknown_203B230->unk8++; - if (gUnknown_203B230->unk8 < gUnknown_203B230->unkC) { - sub_801B46C(1); - } - else { - sub_801B46C(0); - } - break; - case 2: - PlayMenuSoundEffect(1); - sub_801B46C(2); - break; - } -} -u32 sub_801B60C(u32 r0, u8 id, u8 quantity) -{ - gUnknown_203B234 = MemoryAlloc(sizeof(struct unkStruct_203B234), 8); - gUnknown_203B234->menuAction = 0; - gUnknown_203B234->unk0 = r0; - gUnknown_203B234->unk10.id = id; - if(IsThrowableItem(gUnknown_203B234->unk10.id)) - { - gUnknown_203B234->unk10.quantity = quantity; - gUnknown_203B234->unkC = quantity; - } - else - { - gUnknown_203B234->unk10.quantity = 0; - gUnknown_203B234->unkC = 1; - } - gUnknown_203B234->unk10.flags = ITEM_FLAG_EXISTS; - gUnknown_203B234->unk14.unk0 = 0; - gUnknown_203B234->unk14.unk4 = 0; - gUnknown_203B234->unk14.unk8 = 1; - PrintColoredPokeNameToBuffer(gAvailablePokemonNames, GetPlayerPokemonStruct(), COLOR_YELLOW); - sub_8090E14(gUnknown_202DE58, &gUnknown_203B234->unk10, &gUnknown_203B234->unk14); - sub_801B748(0); - return 1; -} + switch (sub_8012A64(&sUnknown_203B230->unk88,sUnknown_203B230->unk24)) { + case 1: + PlayMenuSoundEffect(0); -u32 sub_801B6AC(void) -{ - switch(gUnknown_203B234->state) - { - case 16: - return 3; - case 6: - sub_801BC64(); - break; - case 7: - sub_801BC94(); - break; - case 8: - case 9: - sub_801BCCC(); - break; - case 10: - sub_801BD80(); - break; - case 11: - sub_801BEAC(); - break; - case 12: - sub_801BE30(); - break; - case 13: - case 14: - case 15: - default: - sub_801BEC8(); - break; - - } - return 0; -} - -void sub_801B72C(void) -{ - if(gUnknown_203B234 != NULL) - { - MemoryFree(gUnknown_203B234); - gUnknown_203B234 = NULL; - } -} - -void sub_801B748(u32 newState) -{ - gUnknown_203B234->state = newState; - sub_801B760(); - sub_801B874(); -} - -void sub_801B760(void) -{ - s32 index; - switch(gUnknown_203B234->state) - { - case 1: - case 6: - case 7: - case 8: - case 9: - case 11: - case 13: - case 14: - case 15: - sub_8006518(gUnknown_203B234->unkF4); - for(index = 0; index < 4; index++) - { - gUnknown_203B234->unkF4[index] = gUnknown_80DBA58; - } - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B234->unkF4, 1, 1); - break; - case 10: - sub_8006518(gUnknown_203B234->unkF4); - sub_801BB5C(); - gUnknown_203B234->unkF4[2] = gUnknown_80DBA70; - sub_8012CAC(&gUnknown_203B234->unkF4[2], gUnknown_203B234->unkCC); - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B234->unkF4, 1, 1); - break; - case 12: - sub_8006518(gUnknown_203B234->unkF4); - gUnknown_203B234->unkF4[1] = gUnknown_80DBA88; - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B234->unkF4, 1, 1); - break; - } -} - -void sub_801B874(void) -{ - - switch(gUnknown_203B234->state) - { - case 0: - if (gUnknown_203B234->unk10.id == ITEM_WEAVILE_FIG) { - gUnknown_203B234->fallbackState = 0x10; - if(sub_8001784(0,0x47,1) != 0) - { - AddToTeamMoney(1000); - sub_801B748(4); - } - else - { - sub_800199C(0, 0x47, 1, 1); - sub_801B748(3); - } - } - else if (gUnknown_203B234->unk10.id == ITEM_MIME_JR_FIG) - { - gUnknown_203B234->fallbackState = 0x10; - if(sub_8001784(0, 0x47, 0) != 0) - { - AddToTeamMoney(1000); - sub_801B748(4); - } - else - { - sub_800199C(0, 0x47, 0, 1); - sub_801B748(3); - } - } + sUnknown_203B230->unk8++; + if (sUnknown_203B230->unk8 < sUnknown_203B230->unkC) + sub_801B46C(1); else - { - if(GetNumberOfFilledInventorySlots() >= INVENTORY_SIZE) - { - if(IsNotMoneyOrUsedTMItem(gUnknown_203B234->unk10.id)) - { - if((gTeamInventoryRef->teamStorage[gUnknown_203B234->unk10.id] + gUnknown_203B234->unkC) > 0x3e7) - { - store: - gUnknown_203B234->fallbackState = 6; - } - else - { - gTeamInventoryRef->teamStorage[gUnknown_203B234->unk10.id] += gUnknown_203B234->unkC; - PlaySound(0xCB); - gUnknown_203B234->fallbackState = 5; - } - } - else - { - goto store; - } - } - else - { - AddItemToInventory(&gUnknown_203B234->unk10); - FillInventoryGaps(); - PlaySound(0xCB); - gUnknown_203B234->fallbackState = 0x10; - } - if(gUnknown_203B234->unk0 == 1) - sub_801B748(2); - else - sub_801B748(1); - } - break; - case 1: - if (sub_808D544(0) < 2) { - sub_80141B4(gUnknown_80DBAA0,0,0,0x101); - } - else { - sub_80141B4(gUnknown_80DBAD0,0,0,0x101); - } + sub_801B46C(0); break; case 2: - sub_80141B4(gUnknown_80DBB08,0,0,0x101); - break; - case 3: - PlaySound(0xd4); - sub_80141B4(gUnknown_80DBB38,0,0,0x101); - break; - case 4: - sub_80141B4(gUnknown_80DBB9C,0,0,0x101); - break; - case 5: - gUnknown_203B234->fallbackState = 0x10; - sub_80141B4(gUnknown_80DBC28,0,0,0x101); - break; - case 6: - sub_801BB20(); - sub_8014248(gUnknown_80DBC60,0,4,gUnknown_203B234->unkCC, - 0,4,0,0,0); - break; - case 7: - sub_801BC24(); - sub_8014248(gUnknown_80DBC98,0,3,gUnknown_203B234->unkCC,0,4,0,0,0); - break; - case 8: - sub_801A5D8(1,3,0,10); - break; - case 9: - sub_801A8D0(1); - break; - case 10: - sub_801A9E0(); - sub_8012D60(&gUnknown_203B234->unk28,gUnknown_203B234->unkCC,0,0,gUnknown_203B234->menuAction,2); - break; - case 0xb: - sub_801B3C0(&gUnknown_203B234->unk20); - break; - case 0xc: - sub_801A9E0(); - sub_8012EA4(&gUnknown_203B234->unk28,0); - sub_801BC24(); - sub_8012D60(&gUnknown_203B234->unk78,gUnknown_203B234->unkCC,0,0,3,1); - break; - case 0xd: - gUnknown_203B234->fallbackState = 0x10; - sub_80141B4(gUnknown_80DBCC4,0,0,0x101); - break; - case 0xe: - gUnknown_203B234->fallbackState = 0x10; - sub_80141B4(gUnknown_80DBCE8,0,0,0x101); - break; - case 0xf: - gUnknown_203B234->fallbackState = 0x10; - sub_80141B4(gUnknown_80DBD24,0,0,0x101); - break; - case 0x10: + PlayMenuSoundEffect(1); + sub_801B46C(2); break; } -} - -void sub_801BB20(void) -{ - s32 loopMax; - - loopMax = 0; - gUnknown_203B234->unkCC[loopMax].text = gKangaskhanTrashToolboxItem; - gUnknown_203B234->unkCC[loopMax].menuAction = 4; - loopMax += 1; - gUnknown_203B234->unkCC[loopMax].text = gKangaskhanTrashReceivedItem; - gUnknown_203B234->unkCC[loopMax].menuAction = 5; - loopMax += 1; - gUnknown_203B234->unkCC[loopMax].text = NULL; - gUnknown_203B234->unkCC[loopMax].menuAction = -1; -} - -void sub_801BB5C(void) -{ - int index; - s32 loopMax = 0; - - gUnknown_203B234->unkCC[loopMax].text = gKangaskhanStorage; - gUnknown_203B234->unkCC[loopMax].menuAction = 6; - if (!sub_801ADA0(gUnknown_203B234->unk24)) { - gUnknown_203B234->unkCC[loopMax].menuAction = -1; - } - - loopMax++; - gUnknown_203B234->unkCC[loopMax].text = gKangaskhanTrash; - gUnknown_203B234->unkCC[loopMax].menuAction = 7; - - loopMax++; - gUnknown_203B234->unkCC[loopMax].text = *gUnknown_80D4970; - gUnknown_203B234->unkCC[loopMax].menuAction = 8; - - loopMax++; - gUnknown_203B234->unkCC[loopMax].text = 0; - gUnknown_203B234->unkCC[loopMax].menuAction = 1; - - - for(index = 0; index < loopMax; index++) - { - if(gUnknown_203B234->unkCC[index].menuAction != -1) - if(gUnknown_203B234->unkCC[index].menuAction == gUnknown_203B234->menuAction) - return; - } - - for(index = 0; index < loopMax; index++) - { - if(gUnknown_203B234->unkCC[index].menuAction != -1) - { - gUnknown_203B234->menuAction = gUnknown_203B234->unkCC[index].menuAction; - break; - } - } -} - -void sub_801BC24(void) -{ - s32 loopMax; - loopMax = 0; - gUnknown_203B234->unkCC[loopMax].text = *gUnknown_80D4920; - gUnknown_203B234->unkCC[loopMax].menuAction = 2; - loopMax += 1; - gUnknown_203B234->unkCC[loopMax].text = *gUnknown_80D4928; - gUnknown_203B234->unkCC[loopMax].menuAction = 3; - loopMax += 1; - gUnknown_203B234->unkCC[loopMax].text = NULL; - gUnknown_203B234->unkCC[loopMax].menuAction = 1; -} - -void sub_801BC64(void) -{ - s32 temp; - if(sub_80144A4(&temp)== 0) - { - switch(temp) - { - case 4: - sub_801B748(0x8); - break; - case 5: - sub_801B748(0x7); - break; - } - } -} - -void sub_801BC94(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - switch(temp) - { - case 2: - sub_801B748(0xD); - break; - case 1: - case 3: - sub_801B748(0x6); - break; - } - } -} - -void sub_801BCCC(void) -{ - switch(sub_801A6E8(TRUE)) - { - case 0: - case 1: - break; - case 3: - gUnknown_203B234->unk24 = sub_801A8AC(); - gUnknown_203B234->unk20 = gTeamInventoryRef->teamItems[gUnknown_203B234->unk24]; - sub_8090E14(gUnknown_202DEA8, &gUnknown_203B234->unk20, &gUnknown_203B234->unk14); - sub_801B748(0xA); - break; - case 4: - gUnknown_203B234->unk24 = sub_801A8AC(); - gUnknown_203B234->unk20 = gTeamInventoryRef->teamItems[gUnknown_203B234->unk24]; - sub_8090E14(gUnknown_202DEA8, &gUnknown_203B234->unk20, &gUnknown_203B234->unk14); - sub_8099690(0); - sub_801B748(0xB); - break; - case 2: - sub_801A928(); - sub_801B748(6); - break; - } -} - -void sub_801BD80(void) -{ - s32 menuAction; - - menuAction = 0; - sub_801A6E8(FALSE); - if (!sub_8012FD8(&gUnknown_203B234->unk28)) { - sub_8013114(&gUnknown_203B234->unk28,&menuAction); - if (menuAction != 1) gUnknown_203B234->menuAction = menuAction; - } - switch(menuAction) - { - case 6: - MoveToStorage(&gUnknown_203B234->unk20); - ShiftItemsDownFrom(gUnknown_203B234->unk24); - AddItemToInventory(&gUnknown_203B234->unk10); - FillInventoryGaps(); - PlaySound(0xcb); - sub_8099690(0); - sub_801A928(); - sub_801B748(0xE); - break; - case 7: - sub_801B748(0xC); - break; - case 8: - sub_8099690(0); - sub_801B748(0xB); - break; - case 1: - sub_801B748(0x9); - break; - } -} - -void sub_801BE30(void) -{ - s32 menuAction; - - menuAction = 0; - sub_801A6E8(FALSE); - sub_8012FD8(&gUnknown_203B234->unk28); - if (!sub_8012FD8(&gUnknown_203B234->unk78)) { - sub_8013114(&gUnknown_203B234->unk78,&menuAction); - } - switch(menuAction) - { - case 1: - case 3: - sub_801B748(9); - break; - case 2: - ShiftItemsDownFrom(gUnknown_203B234->unk24); - AddItemToInventory(&gUnknown_203B234->unk10); - FillInventoryGaps(); - PlaySound(0xcb); - sub_801A928(); - sub_801B748(0xf); - break; - } -} - -void sub_801BEAC(void) -{ - switch(sub_801B410()) - { - case 2: - case 3: - sub_801B450(); - sub_801B748(9); - case 0: - case 1: - break; - } -} - -void sub_801BEC8(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - sub_801B748(gUnknown_203B234->fallbackState); - } -} - +} \ No newline at end of file diff --git a/src/code_801B60C.c b/src/code_801B60C.c new file mode 100644 index 000000000..0a1da9448 --- /dev/null +++ b/src/code_801B60C.c @@ -0,0 +1,496 @@ +#include "global.h" +#include "code_80118A4.h" +#include "code_80130A8.h" +#include "code_801B3C0.h" +#include "code_801B60C.h" +#include "code_8098BDC.h" +#include "constants/colors.h" +#include "items.h" +#include "kecleon_bros4.h" +#include "memory.h" +#include "menu_input.h" +#include "pokemon.h" +#include "text1.h" +#include "text2.h" + +extern u8 gUnknown_202DE58[]; +extern u8 gUnknown_202DEA8[]; +extern u8 gAvailablePokemonNames[]; // 202DF98 + +static EWRAM_DATA_2 unkStruct_203B234 *sUnknown_203B234 = {0}; + +extern const u8 *gUnknown_80D4920[]; +extern const u8 *gUnknown_80D4928[]; +extern const u8 *gUnknown_80D4970[]; + +#include "data/code_801B60C.h" // 80DBA58 + +// event_flag.s +extern u32 sub_8001784(u32, u32, u16); +extern void sub_800199C(u32, u32, u32, u32); + +static void sub_801B748(u32); +static void sub_801B760(void); +static void sub_801B874(void); +static void sub_801BB20(void); +static void sub_801BB5C(void); +static void sub_801BC24(void); +static void sub_801BC64(void); +static void sub_801BC94(void); +static void sub_801BCCC(void); +static void sub_801BD80(void); +static void sub_801BE30(void); +static void sub_801BEAC(void); +static void sub_801BEC8(void); + +bool8 sub_801B60C(u32 r0, u8 id, u8 quantity) +{ + sUnknown_203B234 = MemoryAlloc(sizeof(unkStruct_203B234), 8); + sUnknown_203B234->menuAction = 0; + sUnknown_203B234->unk0 = r0; + sUnknown_203B234->unk10.id = id; + + if (IsThrowableItem(sUnknown_203B234->unk10.id)) { + sUnknown_203B234->unk10.quantity = quantity; + sUnknown_203B234->unkC = quantity; + } + else { + sUnknown_203B234->unk10.quantity = 0; + sUnknown_203B234->unkC = 1; + } + + sUnknown_203B234->unk10.flags = ITEM_FLAG_EXISTS; + sUnknown_203B234->unk14.unk0 = 0; + sUnknown_203B234->unk14.unk4 = 0; + sUnknown_203B234->unk14.unk8 = 1; + PrintColoredPokeNameToBuffer(gAvailablePokemonNames, GetPlayerPokemonStruct(), COLOR_YELLOW); + sub_8090E14(gUnknown_202DE58, &sUnknown_203B234->unk10, &sUnknown_203B234->unk14); + sub_801B748(0); + return TRUE; +} + +u32 sub_801B6AC(void) +{ + switch (sUnknown_203B234->state) { + case 16: + return 3; + case 6: + sub_801BC64(); + break; + case 7: + sub_801BC94(); + break; + case 8: + case 9: + sub_801BCCC(); + break; + case 10: + sub_801BD80(); + break; + case 11: + sub_801BEAC(); + break; + case 12: + sub_801BE30(); + break; + case 13: + case 14: + case 15: + default: + sub_801BEC8(); + break; + } + + return 0; +} + +void sub_801B72C(void) +{ + if (sUnknown_203B234 != NULL) { + MemoryFree(sUnknown_203B234); + sUnknown_203B234 = NULL; + } +} + +static void sub_801B748(u32 newState) +{ + sUnknown_203B234->state = newState; + sub_801B760(); + sub_801B874(); +} + +static void sub_801B760(void) +{ + s32 i; + + switch (sUnknown_203B234->state) { + case 1: + case 6: + case 7: + case 8: + case 9: + case 11: + case 13: + case 14: + case 15: + sub_8006518(sUnknown_203B234->unkF4); + for (i = 0; i < 4; i++) + sUnknown_203B234->unkF4[i] = sUnknown_80DBA58; + + ResetUnusedInputStruct(); + sub_800641C(sUnknown_203B234->unkF4, TRUE, TRUE); + break; + case 10: + sub_8006518(sUnknown_203B234->unkF4); + sub_801BB5C(); + sUnknown_203B234->unkF4[2] = sUnknown_80DBA70; + sub_8012CAC(&sUnknown_203B234->unkF4[2], sUnknown_203B234->unkCC); + ResetUnusedInputStruct(); + sub_800641C(sUnknown_203B234->unkF4, TRUE, TRUE); + break; + case 12: + sub_8006518(sUnknown_203B234->unkF4); + sUnknown_203B234->unkF4[1] = sUnknown_80DBA88; + ResetUnusedInputStruct(); + sub_800641C(sUnknown_203B234->unkF4, TRUE, TRUE); + break; + } +} + +static void sub_801B874(void) +{ + switch (sUnknown_203B234->state) { + case 0: + if (sUnknown_203B234->unk10.id == ITEM_WEAVILE_FIG) { + sUnknown_203B234->fallbackState = 16; + + if (sub_8001784(0, 71, 1)) { + AddToTeamMoney(1000); + sub_801B748(4); + } + else { + sub_800199C(0, 71, 1, 1); + sub_801B748(3); + } + } + else if (sUnknown_203B234->unk10.id == ITEM_MIME_JR_FIG) { + sUnknown_203B234->fallbackState = 16; + + if (sub_8001784(0, 71, 0)) { + AddToTeamMoney(1000); + sub_801B748(4); + } + else { + sub_800199C(0, 71, 0, 1); + sub_801B748(3); + } + } + else { + if (GetNumberOfFilledInventorySlots() >= INVENTORY_SIZE) { + if (IsNotMoneyOrUsedTMItem(sUnknown_203B234->unk10.id)) { + if (gTeamInventoryRef->teamStorage[sUnknown_203B234->unk10.id] + sUnknown_203B234->unkC > 999) { +store: + sUnknown_203B234->fallbackState = 6; + } + else { + gTeamInventoryRef->teamStorage[sUnknown_203B234->unk10.id] += sUnknown_203B234->unkC; + PlaySound(203); + sUnknown_203B234->fallbackState = 5; + } + } + else + goto store; + } + else { + AddItemToInventory(&sUnknown_203B234->unk10); + FillInventoryGaps(); + PlaySound(203); + sUnknown_203B234->fallbackState = 16; + } + + if (sUnknown_203B234->unk0 == 1) + sub_801B748(2); + else + sub_801B748(1); + } + break; + case 1: + if (sub_808D544(0) < 2) + sub_80141B4(sFmtReceivedThePromised, 0, 0, 0x101); + else + sub_80141B4(sFmtTeamReceivedThePromised, 0, 0, 0x101); + break; + case 2: + sub_80141B4(sFmtTeamAlsoReceived, 0, 0, 0x101); + break; + case 3: + PlaySound(212); + sub_80141B4(sFmtReceivedStatue, 0, 0, 0x101); + break; + case 4: + sub_80141B4(sFmtReceive1000Instead, 0, 0, 0x101); + break; + case 5: + sUnknown_203B234->fallbackState = 16; + sub_80141B4(sFmtFullSoSentToStorage, 0, 0, 0x101); + break; + case 6: + sub_801BB20(); + sub_8014248(sFmtFullSoPrompt, 0, 4, sUnknown_203B234->unkCC, 0, 4, 0, 0, 0); + break; + case 7: + sub_801BC24(); + sub_8014248(sFmtConfirmThrowAway, 0, 3, sUnknown_203B234->unkCC, 0, 4, 0, 0, 0); + break; + case 8: + sub_801A5D8(1, 3, NULL, 10); + break; + case 9: + sub_801A8D0(TRUE); + break; + case 10: + sub_801A9E0(); + sub_8012D60(&sUnknown_203B234->unk28, sUnknown_203B234->unkCC, 0, 0, sUnknown_203B234->menuAction, 2); + break; + case 11: + sub_801B3C0(&sUnknown_203B234->unk20); + break; + case 12: + sub_801A9E0(); + sub_8012EA4(&sUnknown_203B234->unk28, 0); + sub_801BC24(); + sub_8012D60(&sUnknown_203B234->unk78, sUnknown_203B234->unkCC, 0, 0, 3, 1); + break; + case 13: + sUnknown_203B234->fallbackState = 16; + sub_80141B4(sFmtThrownAway, 0, 0, 0x101); + break; + case 14: + sUnknown_203B234->fallbackState = 16; + sub_80141B4(sFmtPutInStorageForReceive, 0, 0, 0x101); + break; + case 15: + sUnknown_203B234->fallbackState = 16; + sub_80141B4(sFmtDiscardedForReceive, 0, 0, 0x101); + break; + case 16: + break; + } +} + +static void sub_801BB20(void) +{ + s32 loopMax; + + loopMax = 0; + sUnknown_203B234->unkCC[loopMax].text = sTrashToolboxItem; + sUnknown_203B234->unkCC[loopMax].menuAction = 4; + + loopMax++; + sUnknown_203B234->unkCC[loopMax].text = sTrashReceivedItem; + sUnknown_203B234->unkCC[loopMax].menuAction = 5; + + loopMax++; + sUnknown_203B234->unkCC[loopMax].text = NULL; + sUnknown_203B234->unkCC[loopMax].menuAction = -1; +} + +static void sub_801BB5C(void) +{ + s32 i; + s32 loopMax = 0; + + sUnknown_203B234->unkCC[loopMax].text = sStorage; + sUnknown_203B234->unkCC[loopMax].menuAction = 6; + if (!sub_801ADA0(sUnknown_203B234->unk24)) + sUnknown_203B234->unkCC[loopMax].menuAction = -1; + + + loopMax++; + sUnknown_203B234->unkCC[loopMax].text = sTrash; + sUnknown_203B234->unkCC[loopMax].menuAction = 7; + + loopMax++; + sUnknown_203B234->unkCC[loopMax].text = *gUnknown_80D4970; + sUnknown_203B234->unkCC[loopMax].menuAction = 8; + + loopMax++; + sUnknown_203B234->unkCC[loopMax].text = 0; + sUnknown_203B234->unkCC[loopMax].menuAction = 1; + + for (i = 0; i < loopMax; i++) { + if (sUnknown_203B234->unkCC[i].menuAction != -1) + if (sUnknown_203B234->unkCC[i].menuAction == sUnknown_203B234->menuAction) + return; + } + + for (i = 0; i < loopMax; i++) { + if (sUnknown_203B234->unkCC[i].menuAction != -1) { + sUnknown_203B234->menuAction = sUnknown_203B234->unkCC[i].menuAction; + break; + } + } +} + +static void sub_801BC24(void) +{ + s32 loopMax; + + loopMax = 0; + sUnknown_203B234->unkCC[loopMax].text = *gUnknown_80D4920; + sUnknown_203B234->unkCC[loopMax].menuAction = 2; + + loopMax++; + sUnknown_203B234->unkCC[loopMax].text = *gUnknown_80D4928; + sUnknown_203B234->unkCC[loopMax].menuAction = 3; + + loopMax++; + sUnknown_203B234->unkCC[loopMax].text = NULL; + sUnknown_203B234->unkCC[loopMax].menuAction = 1; +} + +static void sub_801BC64(void) +{ + s32 temp; + + if (sub_80144A4(&temp)) + return; + + switch (temp) { + case 4: + sub_801B748(8); + break; + case 5: + sub_801B748(7); + break; + } +} + +static void sub_801BC94(void) +{ + s32 temp; + + if (sub_80144A4(&temp)) + return; + + switch (temp) { + case 2: + sub_801B748(13); + break; + case 1: + case 3: + sub_801B748(6); + break; + } +} + +static void sub_801BCCC(void) +{ + switch (sub_801A6E8(TRUE)) { + case 0: + case 1: + break; + case 3: + sUnknown_203B234->unk24 = sub_801A8AC(); + sUnknown_203B234->unk20 = gTeamInventoryRef->teamItems[sUnknown_203B234->unk24]; + sub_8090E14(gUnknown_202DEA8, &sUnknown_203B234->unk20, &sUnknown_203B234->unk14); + sub_801B748(10); + break; + case 4: + sUnknown_203B234->unk24 = sub_801A8AC(); + sUnknown_203B234->unk20 = gTeamInventoryRef->teamItems[sUnknown_203B234->unk24]; + sub_8090E14(gUnknown_202DEA8, &sUnknown_203B234->unk20, &sUnknown_203B234->unk14); + sub_8099690(0); + sub_801B748(11); + break; + case 2: + sub_801A928(); + sub_801B748(6); + break; + } +} + +static void sub_801BD80(void) +{ + s32 menuAction; + + menuAction = 0; + sub_801A6E8(FALSE); + if (!sub_8012FD8(&sUnknown_203B234->unk28)) { + sub_8013114(&sUnknown_203B234->unk28, &menuAction); + + if (menuAction != 1) + sUnknown_203B234->menuAction = menuAction; + } + + switch (menuAction) { + case 6: + MoveToStorage(&sUnknown_203B234->unk20); + ShiftItemsDownFrom(sUnknown_203B234->unk24); + AddItemToInventory(&sUnknown_203B234->unk10); + FillInventoryGaps(); + PlaySound(203); + sub_8099690(0); + sub_801A928(); + sub_801B748(14); + break; + case 7: + sub_801B748(12); + break; + case 8: + sub_8099690(0); + sub_801B748(11); + break; + case 1: + sub_801B748(9); + break; + } +} + +static void sub_801BE30(void) +{ + s32 menuAction; + + menuAction = 0; + sub_801A6E8(FALSE); + sub_8012FD8(&sUnknown_203B234->unk28); + + if (!sub_8012FD8(&sUnknown_203B234->unk78)) + sub_8013114(&sUnknown_203B234->unk78,&menuAction); + + switch (menuAction) { + case 1: + case 3: + sub_801B748(9); + break; + case 2: + ShiftItemsDownFrom(sUnknown_203B234->unk24); + AddItemToInventory(&sUnknown_203B234->unk10); + FillInventoryGaps(); + PlaySound(203); + sub_801A928(); + sub_801B748(15); + break; + } +} + +static void sub_801BEAC(void) +{ + switch (sub_801B410()) { + case 2: + case 3: + sub_801B450(); + sub_801B748(9); + case 0: + case 1: + break; + } +} + +static void sub_801BEC8(void) +{ + s32 temp; + + if (!sub_80144A4(&temp)) + sub_801B748(sUnknown_203B234->fallbackState); +} \ No newline at end of file diff --git a/src/code_801C620.c b/src/code_801C620.c index b9cfd70fc..af9208153 100644 --- a/src/code_801C620.c +++ b/src/code_801C620.c @@ -3,11 +3,10 @@ #include "code_801C620.h" #include "constants/item.h" #include "constants/iq_skill.h" -#include "item.h" +#include "items.h" #include "memory.h" #include "pokemon.h" #include "pokemon_3.h" -#include "team_inventory.h" #include "text1.h" #include "text2.h" #include "subStruct_203B240.h" @@ -15,33 +14,35 @@ #include "sprite.h" #include "code_80130A8.h" +// TODO: This 1 file was originally 5 files. Split properly + +// size: 0x124 struct unkStruct_203B238 { - // size: 0x124 u32 state; s16 species; - struct PokemonStruct *pokeStruct; + PokemonStruct1 *pokeStruct; u8 iqSkills[NUM_IQ_SKILLS]; u32 unk24; u8 iqSkillIndex; u32 numIQSkills; s32 menuAction; - struct MenuItem unk34[8]; - struct MenuStruct unk74; - struct UnkTextStruct2 unkC4[4]; + MenuItem unk34[8]; + MenuStruct unk74; + UnkTextStruct2 unkC4[4]; }; // size: 0xC4 struct unkStruct_203B23C { /* 0x0 */ s16 species; - /* 0x4 */ struct PokemonStruct *pokeStruct; + /* 0x4 */ PokemonStruct1 *pokeStruct; /* 0x8 */ u8 iqSkills[NUM_IQ_SKILLS]; /* 0x20 */ s32 numIQSkills; - /* 0x24 */ struct MenuInputStruct input; + /* 0x24 */ MenuInputStruct input; u32 unk58; - struct UnkTextStruct2 *unk5C; - struct UnkTextStruct2 unk60[4]; + UnkTextStruct2 *unk5C; + UnkTextStruct2 unk60[4]; u8 unkC0; u8 unkC1; u8 unkC2; @@ -59,8 +60,8 @@ struct unkStruct_203B240 u8 fill14[0x20 - 0x18]; u32 unk20; u32 unk24; - struct UnkTextStruct2 unk28[4]; - struct MenuInputStructSub unk88; + UnkTextStruct2 unk28[4]; + MenuInputStructSub unk88; }; // size: 0x554 @@ -69,35 +70,34 @@ struct unkStruct_203B244 u32 unk0; /* 0x4 */ u8 itemIDs[NUMBER_OF_ITEM_IDS]; u32 unkF4[NUMBER_OF_ITEM_IDS]; - /* 0x4B4 */ struct MenuInputStruct input; + /* 0x4B4 */ MenuInputStruct input; u32 unk4E8; - struct UnkTextStruct2 * unk4EC; - struct UnkTextStruct2 unk4F0[4]; + UnkTextStruct2 * unk4EC; + UnkTextStruct2 unk4F0[4]; u8 unk550[4]; }; -// size: 118 +// size: 0x118 struct unk_203B250 { - /* 0x0 */ struct PokemonStruct *pokeStruct; + /* 0x0 */ PokemonStruct1 *pokeStruct; /* 0x4 */ s16 index; /* 0x6 */ u8 currFriendAreaLocation; // 0 when not in a friend area u8 unk7; u8 unk8; u8 unk9; - struct PokemonStruct *unkC; + PokemonStruct1 *unkC; /* 0x10 */ u32 state; /* 0x14 */ u32 menuAction; - struct MenuStruct unk18; - struct MenuItem unk68[8]; + MenuStruct unk18; + MenuItem unk68[8]; u16 unkA8[8]; - struct UnkTextStruct2 unkB8[4]; + UnkTextStruct2 unkB8[4]; }; extern struct unk_203B250 *gUnknown_203B250; extern u32 gUnknown_203B254; -extern struct PokemonStruct *GetPlayerPokemonStruct(void); extern u8 sub_8002658(s16); extern s16 sub_80A5728(void); extern void sub_801D208(u32); @@ -113,17 +113,17 @@ extern void sub_801D840(void); extern void sub_801D85C(void); extern void sub_801D878(void); s16 sub_80A7AE8(s32); -extern struct PokemonStruct *sub_808D3F8(void); +extern PokemonStruct1 *sub_808D3F8(void); -extern const struct UnkTextStruct2 gUnknown_80DBE54; -extern const struct UnkTextStruct2 gUnknown_80DBDD8; -extern const struct UnkTextStruct2 gUnknown_80DBDF0; -extern const struct UnkTextStruct2 gUnknown_80DBDB0; -extern const struct UnkTextStruct2 gUnknown_80DBD98; -extern const struct UnkTextStruct2 gUnknown_80DBE3C; -extern const struct UnkTextStruct2 gUnknown_80DBE7C; -extern const struct UnkTextStruct2 gUnknown_80DBE98; -extern const struct UnkTextStruct2 gUnknown_80DBEB0[4]; +extern const UnkTextStruct2 gUnknown_80DBE54; +extern const UnkTextStruct2 gUnknown_80DBDD8; +extern const UnkTextStruct2 gUnknown_80DBDF0; +extern const UnkTextStruct2 gUnknown_80DBDB0; +extern const UnkTextStruct2 gUnknown_80DBD98; +extern const UnkTextStruct2 gUnknown_80DBE3C; +extern const UnkTextStruct2 gUnknown_80DBE7C; +extern const UnkTextStruct2 gUnknown_80DBE98; +extern const UnkTextStruct2 gUnknown_80DBEB0[4]; extern struct unkStruct_203B238 *gUnknown_203B238; extern struct unkStruct_203B23C *gUnknown_203B23C; @@ -133,7 +133,6 @@ extern struct unkStruct_203B244 *gUnknown_203B244; extern u32 gUnknown_203B248; extern u16 gUnknown_203B24C; extern u16 gUnknown_203B24E; -extern u8 gUnknown_202DE58[0x58]; extern u8 gAvailablePokemonNames[0x58]; extern u8 gUnknown_80DBE6C[]; @@ -150,9 +149,7 @@ extern u8 *gUnknown_80D4970[]; extern u32 sub_801CE58(void); extern void sub_801CC38(void); -extern void sub_80140B4(struct UnkTextStruct2 *); extern u32 sub_8097DF0(char *, struct subStruct_203B240 **); -extern void sub_8013F84(void); extern void PlayMenuSoundEffect(u32); extern void sub_8013C68(u32 *); extern void xxx_format_and_draw(u32, u32, const u8 *, u32, u32); @@ -259,7 +256,7 @@ void sub_801BFCC(void) } ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B238->unkC4, 1, 1); + sub_800641C(gUnknown_203B238->unkC4, TRUE, TRUE); } void sub_801C03C(void) @@ -403,7 +400,7 @@ bool8 sub_801C244(s16 species, u32 index, u32 param_3) gUnknown_203B23C->unk5C->unk14 = &gUnknown_203B23C->unkC0; sub_8012D08(gUnknown_203B23C->unk5C,param_3); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B23C->unk60,1,1); + sub_800641C(gUnknown_203B23C->unk60, TRUE, TRUE); sub_8013818(&gUnknown_203B23C->input,gUnknown_203B23C->numIQSkills,param_3,index); sub_801C440(); sub_801C4C8(); @@ -449,7 +446,7 @@ s32 sub_801C390(void) void sub_801C3B0(u8 r0) { ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B23C->unk60, 0, 0); + sub_800641C(gUnknown_203B23C->unk60, FALSE, FALSE); gUnknown_203B23C->input.unk22 = gUnknown_203B23C->numIQSkills; sub_8013984(&gUnknown_203B23C->input); sub_801C440(); @@ -464,13 +461,13 @@ void sub_801C3F8(void) { gUnknown_203B23C->unk60[gUnknown_203B23C->unk58] = gUnknown_80DBDD8; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B23C->unk60, 1, 1); + sub_800641C(gUnknown_203B23C->unk60, TRUE, TRUE); MemoryFree(gUnknown_203B23C); gUnknown_203B23C = NULL; } } -#ifdef NONMATCHING +#ifdef NONMATCHING // sub_80095E4 memes // https://decomp.me/scratch/NdDP3 (98.06% matching) - Seth void sub_801C440(void) { @@ -481,12 +478,12 @@ void sub_801C440(void) gUnknown_203B23C->unkC2 = 0xA; gUnknown_203B23C->unkC3 = 0; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B23C->unk60, 1, 1); + sub_800641C(gUnknown_203B23C->unk60, TRUE, TRUE); sVar2 = sub_80095E4(gUnknown_203B23C->unk24.unk1A, 0xc) + 2; gUnknown_203B23C->unk60[gUnknown_203B23C->unk58].unkE = sVar2; gUnknown_203B23C->unk60[gUnknown_203B23C->unk58].unk10 = sVar2; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B23C->unk60, 1, 1); + sub_800641C(gUnknown_203B23C->unk60, TRUE, TRUE); } #else NAKED @@ -598,7 +595,7 @@ bool8 HasNoAvailIQSkills(s16 species) { s32 species_s32; u8 iqSkillBuffer[NUM_IQ_SKILLS]; - struct PokemonStruct *pokeStruct; + PokemonStruct1 *pokeStruct; species_s32 = species; @@ -618,7 +615,7 @@ u32 sub_801C620(u8 iqSkill) gUnknown_203B240->unk24 = 0; sub_80140B4(gUnknown_203B240->unk28); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B240->unk28,1,1); + sub_800641C(gUnknown_203B240->unk28, TRUE, TRUE); sub_801C6D0(0); return 1; } @@ -745,7 +742,7 @@ void sub_801C848(void) } } -bool8 sub_801C8C4(s32 param_1, s32 param_2, struct UnkTextStruct2_sub *param_3, u32 param_4) +bool8 sub_801C8C4(s32 param_1, s32 param_2, UnkTextStruct2_sub *param_3, u32 param_4) { if (sub_801CF14(param_1)) { return FALSE; @@ -768,7 +765,7 @@ bool8 sub_801C8C4(s32 param_1, s32 param_2, struct UnkTextStruct2_sub *param_3, sub_8012D08(gUnknown_203B244->unk4EC, param_4); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B244->unk4F0,1,1); + sub_800641C(gUnknown_203B244->unk4F0, TRUE, TRUE); sub_8013818(&gUnknown_203B244->input, sub_801CE58(), param_4, param_2); if (gUnknown_203B248 == gUnknown_203B244->unk0) { gUnknown_203B244->input.menuIndex = gUnknown_203B24C; @@ -838,7 +835,7 @@ u8 sub_801CB24(void) { void sub_801CB5C(bool8 r0) { ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B244->unk4F0, 0, 0); + sub_800641C(gUnknown_203B244->unk4F0, FALSE, FALSE); gUnknown_203B244->input.unk22 = sub_801CE58(); sub_8013984(&gUnknown_203B244->input); sub_801CC38(); @@ -857,7 +854,7 @@ void sub_801CBB8(void) { gUnknown_203B24E = gUnknown_203B244->input.unk1E; gUnknown_203B244->unk4F0[gUnknown_203B244->unk4E8] = gUnknown_80DBE3C; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B244->unk4F0, 1, 1); + sub_800641C(gUnknown_203B244->unk4F0, TRUE, TRUE); MemoryFree(gUnknown_203B244); gUnknown_203B244 = NULL; } @@ -956,7 +953,7 @@ void sub_801CCD8(void) gUnknown_203B244->input.unk1E + 1,2,7,gUnknown_203B244->unk4E8); for(index = 0; index < gUnknown_203B244->input.unk1A; index++) { uVar3 = gUnknown_203B244->itemIDs[(gUnknown_203B244->input.unk1E * gUnknown_203B244->input.unk1C) + index]; - sub_8090DC4(buffer,uVar3,0); + BufferItemName(buffer,uVar3,NULL); y = sub_8013800(&gUnknown_203B244->input,index); xxx_call_draw_string(8,y,buffer,gUnknown_203B244->unk4E8,0); y2 = sub_8013800(&gUnknown_203B244->input,index); @@ -1072,14 +1069,14 @@ struct unkStruct_203B244 *sub_801D008(void) return gUnknown_203B244; } -bool8 sub_801D014(struct PokemonStruct *param_1) +bool8 sub_801D014(PokemonStruct1 *param_1) { s32 index; - struct PokemonStruct *pokemon; + PokemonStruct1 *pokemon; struct unk_203B250 *preload; ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); gUnknown_203B250 = MemoryAlloc(sizeof(struct unk_203B250), 8); gUnknown_203B250->menuAction = gUnknown_203B254; gUnknown_203B250->pokeStruct = param_1; @@ -1157,7 +1154,7 @@ u32 sub_801D0DC(void) u32 sub_801D178(void) { - struct PokemonStruct *pokeStruct; + PokemonStruct1 *pokeStruct; if (gUnknown_203B250->unk9 != 0) { @@ -1264,5 +1261,5 @@ void sub_801D220(void) } ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B250->unkB8, 1, 1); -} + sub_800641C(gUnknown_203B250->unkB8, TRUE, TRUE); +} \ No newline at end of file diff --git a/src/code_801D760.c b/src/code_801D760.c index b1047f1e8..3283f9bfc 100644 --- a/src/code_801D760.c +++ b/src/code_801D760.c @@ -1,13 +1,14 @@ #include "global.h" +#include "bg_palette_buffer.h" +#include "code_801EE10_1.h" #include "friend_area.h" #include "constants/friend_area.h" #include "constants/input.h" #include "file_system.h" #include "friend_list_menu.h" -#include "item.h" +#include "items.h" #include "menu.h" #include "pokemon.h" -#include "team_inventory.h" #include "memory.h" #include "input.h" #include "text1.h" @@ -19,31 +20,24 @@ #include "code_80118A4.h" #include "wigglytuff_shop.h" #include "event_flag.h" +#include "ground_main.h" +#include "code_801C620.h" struct unkStruct_203B258 { // size: 0xA0 - struct MenuInputStruct input; + MenuInputStruct input; u32 unk34; - struct UnkTextStruct2 *unk38; - struct UnkTextStruct2 unk3C[4]; + UnkTextStruct2 *unk38; + UnkTextStruct2 unk3C[4]; u8 unk9C[4]; }; extern struct unkStruct_203B258 *gUnknown_203B258; -extern struct UnkTextStruct2 gUnknown_80DBF88; -extern struct UnkTextStruct2 gUnknown_80DBF70; +extern UnkTextStruct2 gUnknown_80DBF88; +extern UnkTextStruct2 gUnknown_80DBF70; -struct unkStruct_811BAF4 -{ - s16 unk0; - s16 unk2; - s16 unk4; - s16 unk6; - u8 *text; -}; - -extern struct unkStruct_811BAF4 gUnknown_811BAF4[10]; +extern unkStruct_811BAF4 gUnknown_811BAF4[10]; struct unkStruct_81188F0 { @@ -63,15 +57,12 @@ extern u8 gUnknown_80DBFA0[]; // Field extern void sub_801DB54(); extern void sub_801DBD4(); -extern u32 sub_801BF48(void); -extern void sub_801BF98(void); extern void sub_801D208(u8); extern u32 sub_801DCE8(void); extern void sub_801DD50(void); extern u32 sub_8022860(); extern void sub_8022908(); extern u32 sub_80244E4(void); -extern void sub_802453C(void); extern u32 sub_8025F68(); extern u8 sub_802604C(); extern void sub_8026058(); @@ -85,7 +76,6 @@ extern const char *sub_8098FB4(); extern void xxx_format_string(const char *, u8 *, u32 **, u32); extern s32 sub_8008ED0(u8 *); void LoadTeamRankBadge(u32, u32, u32); -extern void SetBGPaletteBufferColorArray(s32 index, u8 *colorArray); extern struct FileArchive gTitleMenuFileArchive; extern const char gTeamRankBadgeFileName; @@ -111,19 +101,19 @@ struct TeamBadgeData struct unk_203B250 { - struct PokemonStruct *pokeStruct; + PokemonStruct1 *pokeStruct; s16 index; /* 0x6 */ u8 currFriendAreaLocation; // 0 when not in a friend area u8 unk7; u8 unk8; u8 unk9; - struct PokemonStruct *unkC; + PokemonStruct1 *unkC; u32 state; u32 menuAction; - struct MenuStruct unk18; - struct MenuItem unk68[8]; + MenuStruct unk18; + MenuItem unk68[8]; u16 unkA8[8]; - struct UnkTextStruct2 unkB8[4]; + UnkTextStruct2 unkB8[4]; }; struct unk_203B250 *gUnknown_203B250; @@ -133,11 +123,9 @@ extern bool8 sub_8024108(u32); extern bool8 sub_8096E2C(void); extern u32 sub_801DCC4(void); extern u32 sub_8027074(void); -extern void sub_80227B8(struct PokemonStruct *); -extern bool8 sub_8024458(s16, u32); -extern bool8 sub_801BEEC(s16); +extern void sub_80227B8(PokemonStruct1 *); void sub_801D894(void); -u32 sub_8025EF4(struct PokemonStruct *); +u32 sub_8025EF4(PokemonStruct1 *); void sub_801D3A8(void) { @@ -510,7 +498,7 @@ void sub_801D894(void) void LoadTeamRankBadge(u32 param_1, u32 param_2, u32 param_3) { - struct OpenedFile *teamBadgeFile; + OpenedFile *teamBadgeFile; s32 palleteIndex; u8 rank; u8 *colorArray; @@ -538,7 +526,7 @@ u32 sub_801D9E4(void) gUnknown_203B258->unk3C[gUnknown_203B258->unk34] = gUnknown_80DBF88; gUnknown_203B258->unk38->unk14 = gUnknown_203B258->unk9C; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B258->unk3C,1,1); + sub_800641C(gUnknown_203B258->unk3C, TRUE, TRUE); sub_8013818(&gUnknown_203B258->input,0xe5,10,gUnknown_203B258->unk34); sub_801DB54(); sub_801DBD4(); @@ -597,13 +585,13 @@ void sub_801DB0C(void) { gUnknown_203B258->unk3C[gUnknown_203B258->unk34] = gUnknown_80DBF70; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B258->unk3C, 1, 1); + sub_800641C(gUnknown_203B258->unk3C, TRUE, TRUE); MemoryFree(gUnknown_203B258); gUnknown_203B258 = NULL; } } -NAKED +NAKED // sub_80095E4 memes void sub_801DB54(void) { asm_unified( @@ -670,7 +658,7 @@ void sub_801DB54(void) void sub_801DBD4(void) { - struct unkStruct_811BAF4 *temp; + unkStruct_811BAF4 *temp; struct unkStruct_81188F0 *temp2; s32 y; #ifndef NONMATCHING diff --git a/src/code_801EE10.c b/src/code_801EE10.c index 82b4b6ca8..00f8881da 100644 --- a/src/code_801EE10.c +++ b/src/code_801EE10.c @@ -5,15 +5,14 @@ #include "code_801EE10.h" #include "menu_input.h" -extern struct unkStruct_203B270 *gUnknown_203B270; -extern struct UnkTextStruct2 gUnknown_80DC25C; -extern struct UnkTextStruct2 gUnknown_80DC274; +extern unkStruct_203B270 *gUnknown_203B270; +extern UnkTextStruct2 gUnknown_80DC25C; +extern UnkTextStruct2 gUnknown_80DC274; u32 sub_8006544(u32 index); s32 sub_801F3F8(void); -void sub_801F280(u32); -u8 sub_801EE10(u32 param_1, s16 species, struct Move *moves, u32 param_4, u8 *text, u32 param_6) +u8 sub_801EE10(u32 param_1, s16 species, Move *moves, u32 param_4, const u8 *text, u32 param_6) { s32 iVar5; s32 iVar8; @@ -23,7 +22,7 @@ u8 sub_801EE10(u32 param_1, s16 species, struct Move *moves, u32 param_4, u8 *te species_s32 = species; param_4_u8 = param_4; - gUnknown_203B270 = MemoryAlloc(sizeof(struct unkStruct_203B270), 8); + gUnknown_203B270 = MemoryAlloc(sizeof(unkStruct_203B270), 8); gUnknown_203B270->unk4 = param_4_u8; gUnknown_203B270->unk5 = 1; gUnknown_203B270->unk6 = 1; @@ -59,7 +58,7 @@ u8 sub_801EE10(u32 param_1, s16 species, struct Move *moves, u32 param_4, u8 *te } sub_8012D08(&gUnknown_203B270->unk58[gUnknown_203B270->unk50],iVar8); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B270->unk58,1,1); + sub_800641C(gUnknown_203B270->unk58, TRUE, TRUE); sub_8013818(&gUnknown_203B270->input,iVar5,iVar5,param_6); sub_8013780(&gUnknown_203B270->input,0); sub_801F280(1); diff --git a/src/code_801EE10_1.c b/src/code_801EE10_1.c index 8a2873eda..5ba23f460 100644 --- a/src/code_801EE10_1.c +++ b/src/code_801EE10_1.c @@ -1,4 +1,5 @@ #include "global.h" +#include "code_801EE10_1.h" #include "constants/input.h" #include "code_800D090.h" #include "pokemon.h" @@ -13,7 +14,7 @@ struct unkStruct_203B2AC { - struct MenuInputStruct input; + MenuInputStruct input; u32 unk34[3]; u8 unk40[0x48 - 0x40]; s16 speciesNum; @@ -22,8 +23,8 @@ struct unkStruct_203B2AC u32 unkB0; u8 fillB4[0xE0 - 0xB4]; u32 unkE0; - struct UnkTextStruct2 *unkE4; - struct UnkTextStruct2 unkE8[4]; + UnkTextStruct2 *unkE4; + UnkTextStruct2 unkE8[4]; u8 unk148[4]; }; extern struct unkStruct_203B2AC *gUnknown_203B2AC; @@ -47,10 +48,10 @@ struct unkStruct_3001B60 extern struct unkStruct_3001B60 *gUnknown_3001B60; -extern struct UnkTextStruct2 gUnknown_80DC9B0; -extern struct UnkTextStruct2 gUnknown_80DC9C8; +extern UnkTextStruct2 gUnknown_80DC9B0; +extern UnkTextStruct2 gUnknown_80DC9C8; -extern void sub_808FF20(u32 *, struct PokemonStruct *, bool8); +extern void sub_808FF20(u32 *, PokemonStruct1 *, bool8); extern void CreatePokemonInfoTabScreen(u32, s16, u32 *, u32 *, u32); extern void sub_802452C(void); bool8 ComparePokemonNames(s16 a1, s16 a2); @@ -65,7 +66,7 @@ void SortbyInternalNo(s32 param_1, s32 param_2); void SortbyAlphabetNo(s32 param_1,s32 param_2); void SortbyName(s32 param_1,s32 param_2); -bool8 sub_8024184(struct PokemonStruct *pokemon, u8 area) +bool8 sub_8024184(PokemonStruct1 *pokemon, u8 area) { if(area == GetFriendArea(pokemon->speciesNum)) return TRUE; @@ -208,11 +209,11 @@ void SortbyName(s32 param_1,s32 param_2) } } -struct PokemonStruct *sub_80243E8(void) +PokemonStruct1 *sub_80243E8(void) { u8 buffer [40]; u8 nameBuffer [20]; - struct PokemonStruct *pokeStruct = &gRecruitedPokemonRef->pokemon[gUnknown_3001B60->unk1A[gUnknown_3001B60->unk376 * gUnknown_3001B60->unk374 + gUnknown_3001B60->unk370]]; + PokemonStruct1 *pokeStruct = &gRecruitedPokemonRef->pokemon[gUnknown_3001B60->unk1A[gUnknown_3001B60->unk376 * gUnknown_3001B60->unk374 + gUnknown_3001B60->unk370]]; sub_80922B4(nameBuffer, pokeStruct->name, POKEMON_NAME_LENGTH); sprintfStatic(buffer, gUnknown_80DC9A4,nameBuffer); // %s @@ -269,7 +270,7 @@ void sub_802453C(void) { gUnknown_203B2AC->unkE8[gUnknown_203B2AC->unkE0] = gUnknown_80DC9B0; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2AC->unkE8, 1, 1); + sub_800641C(gUnknown_203B2AC->unkE8, TRUE, TRUE); MemoryFree(gUnknown_203B2AC); gUnknown_203B2AC = NULL; } @@ -281,7 +282,7 @@ void sub_8024588(void) gUnknown_203B2AC->unk148[1] = gUnknown_203B2AC->input.unk1E; gUnknown_203B2AC->unk148[3] = 0; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2AC->unkE8,1,1); + sub_800641C(gUnknown_203B2AC->unkE8, TRUE, TRUE); } void sub_80245D0(void) @@ -294,7 +295,7 @@ void sub_80245D0(void) void sub_8024604(void) { - struct PokemonStruct *pokeStruct; + PokemonStruct1 *pokeStruct; u32 *iVar3; gUnknown_203B2AC->unk34[0] = 2; diff --git a/src/code_801EE10_mid.c b/src/code_801EE10_mid.c index 4e7dfdaf4..6ff2742a7 100644 --- a/src/code_801EE10_mid.c +++ b/src/code_801EE10_mid.c @@ -13,18 +13,18 @@ #include "code_801EE10_mid.h" #include "code_80118A4.h" -extern struct unkStruct_203B270 *gUnknown_203B270; +extern unkStruct_203B270 *gUnknown_203B270; struct unkStruct_203B274 { // size: 0x3e8 - struct PokemonStruct *pokeStruct; - struct unkStruct_808E218_arg *unk4; - struct unkStruct_808E218_arg unk8; - struct MenuInputStruct input; + PokemonStruct1 *pokeStruct; + unkStruct_808E218_arg *unk4; + unkStruct_808E218_arg unk8; + MenuInputStruct input; s32 unk37C; - struct UnkTextStruct2 *unk380; - struct UnkTextStruct2 unk384[4]; + UnkTextStruct2 *unk380; + UnkTextStruct2 unk384[4]; u8 unk3E4[4]; }; extern struct unkStruct_203B274 *gUnknown_203B274; @@ -39,41 +39,36 @@ struct unkStruct_203B278 s32 unk10; struct subStruct_203B240 *unk14[4]; u32 unk24; - struct MenuInputStruct unk28; + MenuInputStruct unk28; u32 unk5C; - struct UnkTextStruct2 *unk60; - struct UnkTextStruct2 unk64[4]; + UnkTextStruct2 *unk60; + UnkTextStruct2 unk64[4]; u8 unkC4[4]; - struct MenuInputStructSub unkC8; + MenuInputStructSub unkC8; }; extern struct unkStruct_203B278 *gUnknown_203B278; -extern struct UnkTextStruct2 gUnknown_80DC2C4; -extern struct UnkTextStruct2 gUnknown_80DC2AC; -extern struct UnkTextStruct2 gUnknown_80DC2F8; +extern UnkTextStruct2 gUnknown_80DC2C4; +extern UnkTextStruct2 gUnknown_80DC2AC; +extern UnkTextStruct2 gUnknown_80DC2F8; extern u8 gAvailablePokemonNames[]; extern u8 gUnknown_80DC310[]; extern u8 gUnknown_80DC2DC[]; -extern void sub_80140B4(struct UnkTextStruct2 *); extern void sub_801F918(s32); extern void sub_801FA58(void); extern void sub_801FAD4(void); extern void sub_801F930(void); extern void sub_801F9A4(void); -int unk_MoveIDPrintMoveDescription(int a1, u16 moveID, int a3, struct subStruct_203B240** a4); -void sub_8013F84(void); - u32 sub_801F7E4(void); void sub_801F690(void); -void sub_801F700(void); s32 sub_801F3F8(void) { - struct Move *move; + Move *move; int index; s32 counter; @@ -88,8 +83,8 @@ s32 sub_801F3F8(void) return counter; } -bool8 sub_801F428(s16 index, s32 param_2) { - +bool8 sub_801F428(s16 index, s32 param_2) +{ s32 index_s32 = index; gUnknown_203B274 = MemoryAlloc(sizeof(struct unkStruct_203B274), 0x8); gUnknown_203B274->pokeStruct = &gRecruitedPokemonRef->pokemon[index_s32]; @@ -104,7 +99,7 @@ bool8 sub_801F428(s16 index, s32 param_2) { gUnknown_203B274->unk3E4[2] = 0xC; gUnknown_203B274->unk3E4[3] = 0; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B274->unk384, 1, 1); + sub_800641C(gUnknown_203B274->unk384, TRUE, TRUE); sub_8013818(&gUnknown_203B274->input, sub_801F7E4(), 4, param_2); sub_801F690(); sub_801F700(); @@ -148,10 +143,10 @@ u16 sub_801F5B4(void) return gUnknown_203B274->unk4->unk0[gUnknown_203B274->input.unk1E * gUnknown_203B274->input.unk1C + gUnknown_203B274->input.menuIndex]; } -void sub_801F5F0(u8 r0) +void sub_801F5F0(bool8 r0) { ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B274->unk384, 0, 0); + sub_800641C(gUnknown_203B274->unk384, FALSE, FALSE); sub_8013984(&gUnknown_203B274->input); sub_801F690(); sub_801F700(); @@ -165,13 +160,13 @@ void sub_801F63C(void) { gUnknown_203B274->unk384[gUnknown_203B274->unk37C] = gUnknown_80DC2AC; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B274->unk384, 1, 1); + sub_800641C(gUnknown_203B274->unk384, TRUE, TRUE); MemoryFree(gUnknown_203B274); gUnknown_203B274 = NULL; } } -NAKED +NAKED // sub_80095E4 memes void sub_801F690(void) { asm_unified( @@ -263,7 +258,7 @@ bool8 sub_801F808(u16 *moveIDs) gUnknown_203B278->unk60 = gUnknown_203B278->unk64; sub_80140B4(gUnknown_203B278->unk64); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B278->unk64,1,1); + sub_800641C(gUnknown_203B278->unk64, TRUE, TRUE); gUnknown_203B278->moveIDs = moveIDs; for(index = 4; index > 1; index--) @@ -276,10 +271,9 @@ bool8 sub_801F808(u16 *moveIDs) return 1; } -s32 sub_801F890(void) +u32 sub_801F890(void) { - switch(gUnknown_203B278->state) - { + switch (gUnknown_203B278->state) { case 0: sub_801FA58(); break; @@ -301,7 +295,7 @@ void sub_801F8D0(void) { gUnknown_203B278->unk64[gUnknown_203B278->unk5C] = gUnknown_80DC2F8; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B278->unk64, 1, 1); + sub_800641C(gUnknown_203B278->unk64, TRUE, TRUE); MemoryFree(gUnknown_203B278); gUnknown_203B278 = NULL; } @@ -326,11 +320,11 @@ void sub_801F930(void) gUnknown_203B278->unkC4[2] = 0x10; gUnknown_203B278->unkC4[3] = 0; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B278->unk64, 1, 1); + sub_800641C(gUnknown_203B278->unk64, TRUE, TRUE); break; case 1: ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B278->unk64, 1, 1); + sub_800641C(gUnknown_203B278->unk64, TRUE, TRUE); break; default: break; diff --git a/src/code_8023144.c b/src/code_8023144.c index ea793b150..5d5987e19 100644 --- a/src/code_8023144.c +++ b/src/code_8023144.c @@ -1,50 +1,33 @@ #include "global.h" +#include "code_800D090.h" +#include "code_80118A4.h" +#include "code_80130A8.h" +#include "code_801AFA4.h" +#include "code_801B3C0.h" +#include "code_8023144.h" +#include "code_8098BDC.h" #include "constants/colors.h" #include "constants/input.h" #include "constants/iq_skill.h" +#include "exclusive_pokemon.h" +#include "friend_area.h" +#include "items.h" +#include "kecleon_bros4.h" #include "memory.h" +#include "menu_input.h" #include "pokemon.h" #include "pokemon_3.h" -#include "team_inventory.h" #include "text1.h" #include "text2.h" -#include "item.h" -#include "menu_input.h" -#include "code_8023144.h" -#include "code_800D090.h" -#include "friend_area.h" -#include "kecleon_bros.h" -#include "code_80130A8.h" -#include "code_801B3C0.h" -#include "code_80118A4.h" -#include "exclusive_pokemon.h" -struct unkStruct_3001B5C -{ - // size: 0x3fC - u8 unk0; - u32 unk4; - u32 unk8; - s16 unkC[2]; - u32 unk10; - u8 fill14[0x354 - 0x14]; - u8 unk354; - u8 fill355[0x35C - 0x355]; - struct MenuInputStruct input; - u32 unk390; - struct UnkTextStruct2 *unk394; - struct UnkTextStruct2 unk398[4]; - u8 unk3F8[4]; -}; - -IWRAM_DATA struct unkStruct_3001B5C *gUnknown_3001B5C; -struct unkStruct_203B294 *gUnknown_203B294; +IWRAM_DATA unkStruct_3001B5C *gUnknown_3001B5C; +unkStruct_203B294 *gUnknown_203B294; extern u32 gUnknown_203B298; extern u16 gUnknown_203B29C; extern u16 gUnknown_203B29E; -extern struct UnkTextStruct2 gUnknown_80DC91C; -extern struct UnkTextStruct2 gUnknown_80DC904; +extern UnkTextStruct2 gUnknown_80DC91C; +extern UnkTextStruct2 gUnknown_80DC904; void sub_8023758(void); void sub_80237E0(void); @@ -62,12 +45,9 @@ extern u8 gUnknown_80DC8F8[]; extern u8 *gUnknown_80D4940[]; extern u8 *gUnknown_80D4970[]; extern void sub_8022924(s32); -extern u32 sub_801B00C(void); -extern void sub_801B048(void); -void GetGummiItemStatBoost(struct PokemonStruct* pokemon, u8 id, bool8 checkBoostFlags, struct Gummi* gummi); +void GetGummiItemStatBoost(PokemonStruct1* pokemon, u8 id, bool8 checkBoostFlags, Gummi *gummi); -extern void sub_8099690(u32); extern void sub_801A928(void); void sub_8022D2C(void) { @@ -278,7 +258,7 @@ void sub_8023120(void) } } -bool8 sub_8023144(s32 param_1, s32 index, struct UnkTextStruct2_sub *sub, u32 param_4) +bool8 sub_8023144(s32 param_1, s32 index, UnkTextStruct2_sub *sub, u32 param_4) { u8 param_1_u8 = param_1; @@ -286,7 +266,7 @@ bool8 sub_8023144(s32 param_1, s32 index, struct UnkTextStruct2_sub *sub, u32 pa return 0; if (gUnknown_3001B5C == NULL) - gUnknown_3001B5C = MemoryAlloc(sizeof(struct unkStruct_3001B5C), 8); + gUnknown_3001B5C = MemoryAlloc(sizeof(unkStruct_3001B5C), 8); gUnknown_3001B5C->unk0 = param_1_u8; gUnknown_3001B5C->unk4 = gUnknown_203B298; @@ -303,7 +283,7 @@ bool8 sub_8023144(s32 param_1, s32 index, struct UnkTextStruct2_sub *sub, u32 pa sub_8012D08(gUnknown_3001B5C->unk394,param_4); ResetUnusedInputStruct(); - sub_800641C(gUnknown_3001B5C->unk398,1,1); + sub_800641C(gUnknown_3001B5C->unk398, TRUE, TRUE); sub_8013818(&gUnknown_3001B5C->input,sub_80236A4(),param_4,index); gUnknown_3001B5C->input.menuIndex = gUnknown_203B29C; gUnknown_3001B5C->input.unk1E = gUnknown_203B29E; @@ -358,7 +338,7 @@ s16 sub_802331C(void) void sub_8023354(u8 param_1) { ResetUnusedInputStruct(); - sub_800641C(gUnknown_3001B5C->unk398,0,0); + sub_800641C(gUnknown_3001B5C->unk398, FALSE, FALSE); sub_8013984(&gUnknown_3001B5C->input); sub_8023420(); sub_80234BC(); @@ -376,13 +356,13 @@ void sub_80233A0(void) gUnknown_203B29E = gUnknown_3001B5C->input.unk1E; gUnknown_3001B5C->unk398[gUnknown_3001B5C->unk390] = gUnknown_80DC904; ResetUnusedInputStruct(); - sub_800641C(gUnknown_3001B5C->unk398,1,1); + sub_800641C(gUnknown_3001B5C->unk398, TRUE, TRUE); MemoryFree(gUnknown_3001B5C); gUnknown_3001B5C = NULL; } } -NAKED +NAKED // sub_80095E4 memes void sub_8023420(void) { asm_unified( @@ -474,7 +454,7 @@ void sub_80234BC(void) s32 index; u8 buffer2 [256]; u8 buffer1 [100]; - struct unkStruct_8092638 auStack_2c; + unkStruct_8092638 auStack_2c; sub_8008C54(gUnknown_3001B5C->unk390); sub_80073B8(gUnknown_3001B5C->unk390); diff --git a/src/code_8023144_pre.c b/src/code_8023144_pre.c index 459abe448..ac9526c71 100644 --- a/src/code_8023144_pre.c +++ b/src/code_8023144_pre.c @@ -6,15 +6,15 @@ #include "menu.h" #include "pokemon.h" #include "pokemon_3.h" -#include "team_inventory.h" + #include "text1.h" #include "input.h" -#include "item.h" +#include "items.h" #include "menu_input.h" #include "code_8023144.h" #include "text2.h" -struct unkStruct_203B294 *gUnknown_203B294; +unkStruct_203B294 *gUnknown_203B294; extern u8 gAvailablePokemonNames[]; extern u8 gUnknown_80DC5EC[]; extern u8 HasGummiItem(void); @@ -29,15 +29,15 @@ extern void sub_802293C(void); extern void sub_8022A10(void); extern void sub_8022D2C(void); -extern struct UnkTextStruct2 gUnknown_80DC5A4; -extern struct UnkTextStruct2 gUnknown_80DC5D4; -extern struct UnkTextStruct2 gUnknown_80DC5BC; +extern UnkTextStruct2 gUnknown_80DC5A4; +extern UnkTextStruct2 gUnknown_80DC5D4; +extern UnkTextStruct2 gUnknown_80DC5BC; -bool8 sub_80227B8(struct PokemonStruct *pokeStruct) +bool8 sub_80227B8(PokemonStruct1 *pokeStruct) { ResetUnusedInputStruct(); - sub_800641C(NULL, 1, 1); - gUnknown_203B294 = MemoryAlloc(sizeof(struct unkStruct_203B294), 8); + sub_800641C(NULL, TRUE, TRUE); + gUnknown_203B294 = MemoryAlloc(sizeof(unkStruct_203B294), 8); gUnknown_203B294->menuAction = 0; gUnknown_203B294->pokeStruct = pokeStruct; if(pokeStruct != NULL) @@ -136,6 +136,6 @@ void sub_802293C(void) { break; } ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B294->unk148, 1, 1); + sub_800641C(gUnknown_203B294->unk148, TRUE, TRUE); } diff --git a/src/code_8031D70.c b/src/code_8031D70.c index 4f963fbc8..0ee4fd371 100644 --- a/src/code_8031D70.c +++ b/src/code_8031D70.c @@ -15,17 +15,17 @@ struct unkStruct_203B334 { // size: 0x7C u32 mailIndex; - struct MenuInputStructSub unk4; + MenuInputStructSub unk4; u32 unk10; - struct UnkTextStruct2 *unk14; - struct UnkTextStruct2 unk18[4]; + UnkTextStruct2 *unk14; + UnkTextStruct2 unk18[4]; u8 unk78[4]; }; EWRAM_DATA_2 struct unkStruct_203B334 *gUnknown_203B334 = {0}; -extern struct unkStruct_203B480 *gUnknown_203B480; +extern unkStruct_203B480 *gUnknown_203B480; -const struct UnkTextStruct2 gUnknown_80E1FA8 = { +const UnkTextStruct2 gUnknown_80E1FA8 = { 0, 0, 0, 0, 3, 0x0, 0x0, @@ -36,7 +36,7 @@ const struct UnkTextStruct2 gUnknown_80E1FA8 = { const u8 gUnkData_80E1FC0[4] = {0x01, 0x00, 0x0A, 0x00}; -const struct UnkTextStruct2 gUnknown_80E1FC4 = { +const UnkTextStruct2 gUnknown_80E1FC4 = { 0, 0, 0, 0, 6, 0x2, 0x2, @@ -48,7 +48,7 @@ const struct UnkTextStruct2 gUnknown_80E1FC4 = { ALIGNED(4) const u8 gUnknown_80E1FDC[] = "Password"; ALIGNED(4) static const u8 fill0[] = "pksdir0"; -extern void sub_803D2C0(u8 *, struct unkStruct_203B480 *); +extern void sub_803D2C0(u8 *, unkStruct_203B480 *); void sub_8031E00(void); void sub_8031E58(void); @@ -94,7 +94,7 @@ void sub_8031E10(void) { gUnknown_203B334->unk18[gUnknown_203B334->unk10] = gUnknown_80E1FA8; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B334->unk18, 1, 1); + sub_800641C(gUnknown_203B334->unk18, TRUE, TRUE); MemoryFree(gUnknown_203B334); gUnknown_203B334 = NULL; } @@ -103,7 +103,7 @@ void sub_8031E10(void) void sub_8031E58(void) { ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B334->unk18, 1, 1); + sub_800641C(gUnknown_203B334->unk18, TRUE, TRUE); } void DrawSOSPasswordScreen(void) @@ -114,7 +114,7 @@ void DrawSOSPasswordScreen(void) u32 color; s32 index; u8 buffer [PASSWORD_BUFFER_SIZE + 2]; - struct unkStruct_203B480 *mail; + unkStruct_203B480 *mail; mail = &gUnknown_203B480[gUnknown_203B334->mailIndex]; sub_80073B8(gUnknown_203B334->unk10); diff --git a/src/code_803B050.c b/src/code_803B050.c index 080689574..bff021daa 100644 --- a/src/code_803B050.c +++ b/src/code_803B050.c @@ -1,4 +1,5 @@ #include "global.h" +#include "code_803B050.h" #include "constants/colors.h" #include "constants/wonder_mail.h" #include "pokemon.h" @@ -12,21 +13,7 @@ #include "code_800D090.h" #include "menu_input.h" #include "wonder_mail.h" - -struct unkStruct_80E9920 -{ - s16 unkA; - s16 unkB; - u8 *text; -}; - -struct unkStruct_80E9F8C -{ - s16 unkA; - s16 unkB; - u8 *text1; - u8 *text2; -}; +#include "dungeon.h" extern s16 gUnknown_80E80E0[]; extern s16 gUnknown_80E8126[]; @@ -79,30 +66,28 @@ extern u8 *gUnknown_80E910C[]; extern u8 *gUnknown_80E8C98[]; extern u8 gUnknown_80E886C[]; extern u8 *gUnknown_80EAE5C[]; -extern struct unkStruct_80E9F8C gUnknown_80E9F8C[10]; -extern struct unkStruct_80E9920 gUnknown_80E9920[10]; +extern unkStruct_80E9F8C gUnknown_80E9F8C[10]; +extern unkStruct_80E9920 gUnknown_80E9920[10]; extern u8 *gUnknown_80E8B94[]; -extern struct PokemonStruct *GetPlayerPokemonStruct(void); -extern struct PokemonStruct *sub_808D378(void); +extern PokemonStruct1 *sub_808D378(void); s32 sub_8016028(void); extern void PrintDungeonLocationtoBuffer(u8 *, void *); -extern void PrintYellowDungeonNametoBuffer(u8 *, void *); -extern u8 sub_803C1D0(struct WonderMailSub *, u8); +extern u8 sub_803C1D0(WonderMailSub *, u8); extern u8 *sub_803C1F0(u8); -void sub_803D414(u8 *, struct WonderMail *); +void sub_803D414(u8 *, WonderMail *); void sub_803B6B0(s32 x, s32 y, u8 index, u32 param_4) { xxx_call_draw_string(x,y,gUnknown_80E8B94[index],param_4,0); } -void CreateRescueTitle(struct unkStruct_802C39C *param_1) +void CreateRescueTitle(unkStruct_802C39C *param_1) { - char buf_1 [200]; - char buf_2 [20]; - char buf_3 [100]; + u8 buf_1[200]; + u8 buf_2[20]; + u8 buf_3[100]; u8 *monName; u8 uVar1; @@ -121,16 +106,16 @@ void CreateRescueTitle(struct unkStruct_802C39C *param_1) xxx_call_draw_string(0x15,param_1->y,gMedichamMission,param_1->unk0[0],0); break; case 7: - PrintYellowDungeonNametoBuffer(buf_1, param_1->unk8); + PrintYellowDungeonNametoBuffer(buf_1, ¶m_1->unk8->dungeon); xxx_call_draw_string(0x15,param_1->y,buf_1,param_1->unk0[0],0); break; case 12: - sub_8090DC4(gUnknown_202DE58,param_1->targetItem,0); + BufferItemName(gUnknown_202DE58,param_1->targetItem,NULL); sprintfStatic(buf_1,gUnknown_80E8830,gUnknown_202DE58); xxx_call_draw_string(0x15,param_1->y,buf_1,param_1->unk0[0],0); break; case 11: - sub_8090DC4(gUnknown_202DE58,param_1->targetItem,0); + BufferItemName(gUnknown_202DE58,param_1->targetItem,NULL); sprintfStatic(buf_1,gUnknown_80E8848,gUnknown_202DE58); xxx_call_draw_string(0x15,param_1->y,buf_1,param_1->unk0[0],0); break; @@ -197,7 +182,7 @@ void CreateRescueTitle(struct unkStruct_802C39C *param_1) xxx_call_draw_string(0xb4,param_1->y,sub_803C1F0(uVar1),param_1->unk0[0],0); } -void CreateRescueDescription(struct unkStruct_802C39C *param_1) +void CreateRescueDescription(unkStruct_802C39C *param_1) { u8 uVar3; int x; @@ -231,12 +216,12 @@ void CreateRescueDescription(struct unkStruct_802C39C *param_1) xxx_call_draw_string(10,y,gMedichamMissionDescription,param_1->unk0[0],0); break; case 4: - sub_8090DC4(gUnknown_202DE58,param_1->targetItem,0); + BufferItemName(gUnknown_202DE58,param_1->targetItem,NULL); sprintfStatic(buf_1,gUnknown_80E8968,gUnknown_202DE58); xxx_call_draw_string(10,y,buf_1,param_1->unk0[0],0); break; case 5: - sub_8090DC4(gUnknown_202DE58,param_1->targetItem,0); + BufferItemName(gUnknown_202DE58,param_1->targetItem,NULL); sprintfStatic(buf_1,gUnknown_80E89B0,gUnknown_202DE58); xxx_call_draw_string(10,y,buf_1,param_1->unk0[0],0); break; @@ -262,7 +247,7 @@ void CreateRescueDescription(struct unkStruct_802C39C *param_1) case 16: { u8 bVar2 = param_1->unk8->seed + param_1->unk8->dungeon.id; u8 bVar3 = param_1->unk8->seed + param_1->unk8->dungeon.floor; - sub_8090DC4(gUnknown_202DE58,param_1->targetItem,0); + BufferItemName(gUnknown_202DE58,param_1->targetItem,NULL); sprintfStatic(buf_1,gUnknown_80EB3F8[(bVar2 % 0x16)],gUnknown_202DE58); xxx_call_draw_string(10,y,buf_1,param_1->unk0[0],0); y += 0xC; @@ -343,12 +328,12 @@ void CreateRescueDescription(struct unkStruct_802C39C *param_1) xxx_call_draw_string(0x44,y,gUnknown_80E8AEC,param_1->unk0[0],0); // Friend Rescue break; case MISSION_TYPE_DELIVER_ITEM: - sub_8090DC4(gUnknown_202DE58,param_1->targetItem,0); + BufferItemName(gUnknown_202DE58,param_1->targetItem,NULL); sprintfStatic(buf_1,gUnknown_80E8AFC,gUnknown_202DE58); // Deliver #C4%s#R. xxx_call_draw_string(0x44,y,buf_1,param_1->unk0[0],0); break; case MISSION_TYPE_FIND_ITEM: - sub_8090DC4(gUnknown_202DE58,param_1->targetItem,0); + BufferItemName(gUnknown_202DE58,param_1->targetItem,NULL); sprintfStatic(buf_1,gUnknown_80E8B10,gUnknown_202DE58); // Find #C4%s#R. xxx_call_draw_string(0x44,y,buf_1,param_1->unk0[0],0); break; @@ -408,7 +393,7 @@ void CreateRescueDescription(struct unkStruct_802C39C *param_1) break; case 2: // Item case 3: // Item + ? - sub_8090DC4(gUnknown_202DE58,param_1->rewardItem,0); + BufferItemName(gUnknown_202DE58,param_1->rewardItem,NULL); sprintfStatic(buf_1,gMissionRewardText[param_1->rewardType],gUnknown_202DE58); xxx_call_draw_string(0x44,y,buf_1,param_1->unk0[0],0); break; @@ -470,7 +455,7 @@ bool8 sub_803C0DC(s16 species) bool8 sub_803C110(s16 index) { - struct PokemonStruct *pokeStruct; + PokemonStruct1 *pokeStruct; s16 *psVar5; s16 *psVar6; s32 species_s32; diff --git a/src/code_803C1B4.c b/src/code_803C1B4.c index 0d84866a8..9a2c89a9a 100644 --- a/src/code_803C1B4.c +++ b/src/code_803C1B4.c @@ -1,7 +1,7 @@ #include "global.h" #include "dungeon.h" -u32 sub_803C1B4(struct DungeonLocation *dungeon, u8 r1) +u32 sub_803C1B4(DungeonLocation *dungeon, u8 r1) { s32 temp; temp = sub_80908D8(dungeon); diff --git a/src/code_803D0D8.c b/src/code_803D0D8.c index 082f86c03..e8d3804ec 100644 --- a/src/code_803D0D8.c +++ b/src/code_803D0D8.c @@ -1,25 +1,28 @@ #include "global.h" +#include "code_803D0D8.h" -extern u8 gUnknown_203B408; -extern u8 gUnknown_80F42D0[]; -extern u8 gUnknown_80F42F0[]; +static EWRAM_DATA_2 u8 sUnknown_203B408 = {0}; + +#include "data/code_803D0D8.h" u8 sub_803D0D8() { - return gUnknown_203B408; + return sUnknown_203B408; } -void sub_803D0E4(u8 r0) +UNUSED static void sub_803D0E4(u8 r0) { - gUnknown_203B408 = r0; + sUnknown_203B408 = r0; } u8 sub_803D0F0(u8 r0) { - return gUnknown_80F42F0[r0]; + return sUnknown_80F42F0[r0]; } u8 sub_803D100(u8 r0) { - return gUnknown_80F42D0[r0]; + return sUnknown_80F42D0[r0]; } + +// Probably continues in code_803D110.s \ No newline at end of file diff --git a/src/code_8040094.c b/src/code_8040094.c index 36d070e5f..6fcf9e214 100644 --- a/src/code_8040094.c +++ b/src/code_8040094.c @@ -1,5 +1,6 @@ #include "global.h" #include "code_800558C.h" +#include "code_800C9CC.h" #include "code_80118A4.h" #include "code_80521D0.h" #include "dungeon_entity.h" @@ -7,17 +8,16 @@ #include "dungeon_map_access.h" #include "dungeon_music.h" #include "file_system.h" +#include "input.h" #include "play_time.h" extern s32 gUnknown_80F6568[]; extern u8 gUnknown_202EE01; extern const char gUnknown_80F6604; // "zmappat" extern struct FileArchive gDungeonFileArchive; -extern struct OpenedFile *gUnknown_202EE04; +extern OpenedFile *gUnknown_202EE04; extern void sub_803F7BC(void); -extern void sub_800CB20(void); -extern void LoadBufferedInputs(void); extern void xxx_call_update_bg_sound_input(void); extern void sub_803F580(u32); @@ -27,7 +27,7 @@ extern void sub_8040A84(); extern const char *gUnknown_80FD040; // It became brighter on the floor // Luminous Orb??? -void HandleLuminousOrbAction(struct Entity *pokemon) +void HandleLuminousOrbAction(Entity *pokemon) { struct Tile *mapTile; int XCoord; diff --git a/src/code_8041AD0.c b/src/code_8041AD0.c index 2132ea564..a8e53af12 100644 --- a/src/code_8041AD0.c +++ b/src/code_8041AD0.c @@ -1,4 +1,5 @@ #include "global.h" +#include "code_806CD90.h" #include "constants/direction.h" #include "constants/status.h" #include "constants/type.h" @@ -6,7 +7,7 @@ #include "dungeon_global_data.h" #include "dungeon_pokemon_attributes.h" #include "dungeon_util.h" -#include "item.h" +#include "items.h" struct unkStruct_80420E8 { @@ -30,19 +31,18 @@ extern u32 gStatusSpriteMasks_EyesightStatus[]; extern u32 gStatusSpriteMasks_MuzzledStatus[]; -extern void sub_803ED30(u8, struct Entity *pokemon, u8, u8); -extern void sub_804151C(struct Entity *pokemon, u32 r1, u8 r2); -extern void sub_80416E0(struct Entity *pokemon, u32, u32); -extern u8 sub_8042768(struct Entity *pokemon); -extern void sub_806CDD4(struct Entity *pokemon, u8, u32); +extern void sub_803ED30(u8, Entity *pokemon, u8, u8); +extern void sub_804151C(Entity *pokemon, u32 r1, u8 r2); +extern void sub_80416E0(Entity *pokemon, u32, u32); +extern u8 sub_8042768(Entity *pokemon); extern u32 sub_806F62C(u32); extern void PlaySoundEffect(u32); -extern u8 sub_803F428(struct Position *pos); -extern void sub_8041550(struct Entity *pokemon, u32, u32, u32, u32, u32); +extern u8 sub_803F428(Position *pos); +extern void sub_8041550(Entity *pokemon, u32, u32, u32, u32, u32); -void sub_80421C0(struct Entity *pokemon, u16 r1); -void EntityUpdateStatusSprites(struct Entity *entity); +void sub_80421C0(Entity *pokemon, u16 r1); +void EntityUpdateStatusSprites(Entity *entity); extern s32 gUnknown_202EDC8; @@ -109,7 +109,7 @@ void sub_804178C(u8 param_1) sub_8042E98(); } -u32 EntityGetStatusSprites(struct Entity *entity) +u32 EntityGetStatusSprites(Entity *entity) { return entity->info->statusIcons; } @@ -117,8 +117,8 @@ u32 EntityGetStatusSprites(struct Entity *entity) void sub_8041888(u8 param_1) { s32 index; - struct Entity *entity; - struct EntityInfo *entityInfo; + Entity *entity; + EntityInfo *entityInfo; for(index = 0; index < DUNGEON_MAX_POKEMON; index++) { entity = gDungeon->allPokemon[index]; @@ -134,11 +134,11 @@ void sub_8041888(u8 param_1) } } -void EntityUpdateStatusSprites(struct Entity *entity) +void EntityUpdateStatusSprites(Entity *entity) { bool32 flag; s32 HP; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; u32 spriteStatus; u8 temp; @@ -206,17 +206,17 @@ void EntityUpdateStatusSprites(struct Entity *entity) } } -void sub_8041AD0(struct Entity *pokemon) +void sub_8041AD0(Entity *pokemon) { sub_804151C(pokemon, 0xA2 << 1, 1); } -void sub_8041AE0(struct Entity *pokemon) +void sub_8041AE0(Entity *pokemon) { sub_804151C(pokemon, 0x143, 1); } -void sub_8041AF4(struct Entity *pokemon) +void sub_8041AF4(Entity *pokemon) { sub_804151C(pokemon, 0x25, 1); sub_80421C0(pokemon, 0x197); @@ -226,7 +226,7 @@ void nullsub_57(void) { } -void sub_8041B18(struct Entity *pokemon) +void sub_8041B18(Entity *pokemon) { sub_804151C(pokemon, 0x141, 1); } @@ -239,7 +239,7 @@ void nullsub_59(void) { } -void sub_8041B34(struct Entity *pokemon) +void sub_8041B34(Entity *pokemon) { sub_804151C(pokemon, 7, 1); } @@ -248,7 +248,7 @@ void nullsub_60(void) { } -void sub_8041B48(struct Entity *pokemon) +void sub_8041B48(Entity *pokemon) { sub_804151C(pokemon, 4, 0); } @@ -257,16 +257,16 @@ void nullsub_61(void) { } -void sub_8041B5C(struct Entity *pokemon) +void sub_8041B5C(Entity *pokemon) { sub_804151C(pokemon, 0x171, 1); } -void nullsub_62(struct Entity *pokemon) +void nullsub_62(Entity *pokemon) { } -void sub_8041B74(struct Entity *pokemon) +void sub_8041B74(Entity *pokemon) { sub_804151C(pokemon, 0x171, 0); } @@ -279,7 +279,7 @@ void nullsub_64(void) { } -void sub_8041B90(struct Entity *pokemon) +void sub_8041B90(Entity *pokemon) { sub_804151C(pokemon, 0xD6 << 1, 0); } @@ -292,7 +292,7 @@ void nullsub_66(void) { } -void sub_8041BA8(struct Entity *pokemon) +void sub_8041BA8(Entity *pokemon) { sub_804151C(pokemon, 4, 1); } @@ -301,7 +301,7 @@ void nullsub_67(void) { } -void sub_8041BBC(struct Entity *pokemon) +void sub_8041BBC(Entity *pokemon) { sub_804151C(pokemon, 0xD4 << 1, 1); } @@ -310,7 +310,7 @@ void nullsub_68(void) { } -void sub_8041BD0(struct Entity *pokemon, u8 r1) +void sub_8041BD0(Entity *pokemon, u8 r1) { if(r1 == 0) { @@ -319,22 +319,22 @@ void sub_8041BD0(struct Entity *pokemon, u8 r1) sub_80421C0(pokemon, 0x1a5); } -void sub_8041BE8(struct Entity *pokemon) +void sub_8041BE8(Entity *pokemon) { sub_80421C0(pokemon, 0xCB << 1); } -void sub_8041BF8(struct Entity *pokemon) +void sub_8041BF8(Entity *pokemon) { sub_806CDD4(pokemon, 0xA, NUM_DIRECTIONS); } -void sub_8041C08(struct Entity *pokemon) +void sub_8041C08(Entity *pokemon) { sub_804151C(pokemon, 0x1a7, 1); } -void sub_8041C1C(struct Entity *pokemon) +void sub_8041C1C(Entity *pokemon) { sub_804151C(pokemon, 0x1a7, 1); } @@ -343,7 +343,7 @@ void nullsub_69(void) { } -void sub_8041C34(struct Entity *pokemon) +void sub_8041C34(Entity *pokemon) { sub_804151C(pokemon, 0x4C, 1); } @@ -356,22 +356,22 @@ void nullsub_71(void) { } -void sub_8041C4C(struct Entity *pokemon, u32 r1) +void sub_8041C4C(Entity *pokemon, u32 r1) { sub_804151C(pokemon, r1, 1); } -void sub_8041C58(struct Entity *pokemon) +void sub_8041C58(Entity *pokemon) { sub_804151C(pokemon, 0x1a9, 1); } -void sub_8041C6C(struct Entity *pokemon) +void sub_8041C6C(Entity *pokemon) { sub_804151C(pokemon, 0x9D << 1, 1); } -void sub_8041C7C(struct Entity *pokemon) +void sub_8041C7C(Entity *pokemon) { sub_804151C(pokemon, 0x9D << 1, 1); } @@ -384,32 +384,32 @@ void nullsub_73(void) { } -void sub_8041C94(struct Entity *pokemon) +void sub_8041C94(Entity *pokemon) { sub_804151C(pokemon, 0x171, 1); } -void sub_8041CA8(struct Entity *pokemon) +void sub_8041CA8(Entity *pokemon) { sub_804151C(pokemon, 7, 1); } -void sub_8041CB8(struct Entity *pokemon) +void sub_8041CB8(Entity *pokemon) { sub_804151C(pokemon, 0x18b, 1); } -void sub_8041CCC(struct Entity *pokemon) +void sub_8041CCC(Entity *pokemon) { sub_804151C(pokemon, 0xC5 << 1, 1); } -void sub_8041CDC(struct Entity *pokemon) +void sub_8041CDC(Entity *pokemon) { sub_804151C(pokemon, 5, 1); } -void sub_8041CEC(struct Entity *pokemon) +void sub_8041CEC(Entity *pokemon) { sub_80421C0(pokemon, 0x19d); } @@ -418,42 +418,42 @@ void nullsub_74(void) { } -void sub_8041D00(struct Entity *pokemon, struct Entity *target) +void sub_8041D00(Entity *pokemon, Entity *target) { sub_804151C(target, 0x2F, 1); sub_804151C(pokemon, 0x30, 1); } -void nullsub_75(struct Entity *pokemon) +void nullsub_75(Entity *pokemon) { } -void nullsub_76(struct Entity *pokemon) +void nullsub_76(Entity *pokemon) { } -void nullsub_77(struct Entity *pokemon) +void nullsub_77(Entity *pokemon) { } -void nullsub_78(struct Entity *pokemon) +void nullsub_78(Entity *pokemon) { } -void nullsub_79(struct Entity *pokemon) +void nullsub_79(Entity *pokemon) { } -void nullsub_80(struct Entity *pokemon) +void nullsub_80(Entity *pokemon) { } -void sub_8041D38(struct Entity * pokemon) +void sub_8041D38(Entity * pokemon) { sub_804151C(pokemon, 0x21, 1); } -void sub_8041D48(struct Entity * pokemon) +void sub_8041D48(Entity * pokemon) { sub_80421C0(pokemon, 0x191); } @@ -462,7 +462,7 @@ void nullsub_81(void) { } -void sub_8041D5C(struct Entity *pokemon) +void sub_8041D5C(Entity *pokemon) { if(sub_8042768(pokemon) == 0) { @@ -471,7 +471,7 @@ void sub_8041D5C(struct Entity *pokemon) sub_803ED30(pokemon->info->stockpileStage, pokemon, 1, 0xB); } -void sub_8041D84(struct Entity *pokemon) +void sub_8041D84(Entity *pokemon) { sub_80421C0(pokemon, 0x19f); } @@ -484,12 +484,12 @@ void nullsub_83(void) { } -void sub_8041D9C(struct Entity *pokemon) +void sub_8041D9C(Entity *pokemon) { sub_804151C(pokemon, 0x131, 1); } -void sub_8041DB0(struct Entity *pokemon) +void sub_8041DB0(Entity *pokemon) { sub_804151C(pokemon, 0x30, 1); } @@ -518,7 +518,7 @@ void nullsub_88(void) { } -void sub_8041DD8(struct Entity *pokemon, s16 r1) +void sub_8041DD8(Entity *pokemon, s16 r1) { u32 temp; temp = r1; @@ -533,78 +533,78 @@ void nullsub_89(void) { } -void sub_8041E0C(struct Entity *pokemon) +void sub_8041E0C(Entity *pokemon) { sub_804151C(pokemon, 0x41, 1); } -void sub_8041E1C(struct Entity *pokemon) +void sub_8041E1C(Entity *pokemon) { sub_804151C(pokemon, 0x8F << 1, 1); sub_80421C0(pokemon, 0xCE << 1); } -void sub_8041E3C(struct Entity *pokemon) +void sub_8041E3C(Entity *pokemon) { sub_804151C(pokemon, 0xD7 << 1, 1); } -void sub_8041E4C(struct Entity *pokemon) +void sub_8041E4C(Entity *pokemon) { sub_804151C(pokemon, 0x1b1, 1); } -void sub_8041E60(struct Entity *pokemon) +void sub_8041E60(Entity *pokemon) { sub_804151C(pokemon, 0x1a9, 1); } -void sub_8041E74(struct Entity *pokemon) +void sub_8041E74(Entity *pokemon) { sub_804151C(pokemon, 0xC9 << 1, 1); } -void sub_8041E84(struct Entity *pokemon) +void sub_8041E84(Entity *pokemon) { sub_804151C(pokemon, 0xC7 << 1, 1); } -void sub_8041E94(struct Entity *pokemon) +void sub_8041E94(Entity *pokemon) { sub_804151C(pokemon, 0xC8 << 1, 1); } -void sub_8041EA4(struct Entity *pokemon) +void sub_8041EA4(Entity *pokemon) { sub_804151C(pokemon, 0x15, 1); } -void sub_8041EB4(struct Entity *pokemon) +void sub_8041EB4(Entity *pokemon) { sub_804151C(pokemon, 0x171, 1); } -void sub_8041EC8(struct Entity *pokemon) +void sub_8041EC8(Entity *pokemon) { sub_80421C0(pokemon, 0x197); } -void sub_8041ED8(struct Entity *pokemon) +void sub_8041ED8(Entity *pokemon) { sub_80421C0(pokemon, 0x197); } -void sub_8041EE8(struct Entity *pokemon) +void sub_8041EE8(Entity *pokemon) { sub_804151C(pokemon, 0x15, 1); } -void sub_8041EF8(struct Entity *pokemon) +void sub_8041EF8(Entity *pokemon) { sub_804151C(pokemon, 0xF, 1); } -void sub_8041F08(struct Entity *pokemon) +void sub_8041F08(Entity *pokemon) { sub_8041550(pokemon, 0x15, 1, 3, 2, 0); } @@ -613,7 +613,7 @@ void nullsub_90(void) { } -void sub_8041F28(struct Entity *pokemon, u32 r1) +void sub_8041F28(Entity *pokemon, u32 r1) { if(r1 == 0) { @@ -625,7 +625,7 @@ void sub_8041F28(struct Entity *pokemon, u32 r1) } } -void sub_8041F4C(struct Entity *pokemon, u32 r1) +void sub_8041F4C(Entity *pokemon, u32 r1) { if(r1 == 0) { @@ -637,7 +637,7 @@ void sub_8041F4C(struct Entity *pokemon, u32 r1) } } -void sub_8041F70(struct Entity *pokemon, u32 r1) +void sub_8041F70(Entity *pokemon, u32 r1) { if(r1 == 0) { @@ -649,7 +649,7 @@ void sub_8041F70(struct Entity *pokemon, u32 r1) } } -void sub_8041F94(struct Entity *pokemon, u32 r1) +void sub_8041F94(Entity *pokemon, u32 r1) { if(r1 == 0) { @@ -661,7 +661,7 @@ void sub_8041F94(struct Entity *pokemon, u32 r1) } } -void sub_8041FB4(struct Entity *pokemon, u32 r1) +void sub_8041FB4(Entity *pokemon, u32 r1) { if(r1 == 0) { @@ -673,7 +673,7 @@ void sub_8041FB4(struct Entity *pokemon, u32 r1) } } -void sub_8041FD8(struct Entity *pokemon, u32 r1) +void sub_8041FD8(Entity *pokemon, u32 r1) { if(r1 == 0) { @@ -685,7 +685,7 @@ void sub_8041FD8(struct Entity *pokemon, u32 r1) } } -void sub_8041FFC(struct Entity *pokemon, u32 r1) +void sub_8041FFC(Entity *pokemon, u32 r1) { if(r1 == 0) { @@ -697,7 +697,7 @@ void sub_8041FFC(struct Entity *pokemon, u32 r1) } } -void sub_804201C(struct Entity *pokemon, u32 r1) +void sub_804201C(Entity *pokemon, u32 r1) { if(r1 == 0) { @@ -709,7 +709,7 @@ void sub_804201C(struct Entity *pokemon, u32 r1) } } -void sub_8042040(struct Entity *pokemon, u32 r1) +void sub_8042040(Entity *pokemon, u32 r1) { if(r1 == 0) { @@ -721,7 +721,7 @@ void sub_8042040(struct Entity *pokemon, u32 r1) } } -void sub_8042060(struct Entity *pokemon, u32 r1) +void sub_8042060(Entity *pokemon, u32 r1) { if(r1 == 0) { @@ -733,7 +733,7 @@ void sub_8042060(struct Entity *pokemon, u32 r1) } } -void sub_8042080(struct Entity *pokemon, u32 r1) +void sub_8042080(Entity *pokemon, u32 r1) { if(r1 == 0) { @@ -745,7 +745,7 @@ void sub_8042080(struct Entity *pokemon, u32 r1) } } -void sub_80420A0(struct Entity *pokemon, u32 r1) +void sub_80420A0(Entity *pokemon, u32 r1) { sub_804151C(pokemon, 0x143, 1); } @@ -754,21 +754,21 @@ void nullsub_91(void) { } -void sub_80420B8(struct Entity *pokemon, u32 r1) +void sub_80420B8(Entity *pokemon, u32 r1) { sub_804151C(pokemon, 0x19, 1); } -void sub_80420C8(struct Entity *pokemon) +void sub_80420C8(Entity *pokemon) { sub_8041550(pokemon, 0x15, 1, 3, 2, 0); } -void nullsub_92(struct Entity *pokemon) +void nullsub_92(Entity *pokemon) { } -void sub_80420E8(struct Entity *pokemon, struct unkStruct_80420E8 *r1) +void sub_80420E8(Entity *pokemon, struct unkStruct_80420E8 *r1) { u32 temp; u32 arg; @@ -794,7 +794,7 @@ void sub_80420E8(struct Entity *pokemon, struct unkStruct_80420E8 *r1) sub_8041550(pokemon, arg, 1, 3, 0, 1); } -void sub_8042148(struct Entity *pokemon) +void sub_8042148(Entity *pokemon) { sub_80421C0(pokemon, 0x1a7); sub_804151C(pokemon, 0x9F << 1, 1); @@ -804,7 +804,7 @@ void nullsub_93() { } -void sub_804216C(struct Entity *pokemon, struct Entity *target, u32 r2) +void sub_804216C(Entity *pokemon, Entity *target, u32 r2) { if(r2 == 1) sub_804151C(target, 0xF8, 1); @@ -812,22 +812,22 @@ void sub_804216C(struct Entity *pokemon, struct Entity *target, u32 r2) sub_804151C(target, 0xF9, 1); } -void sub_804218C(struct Entity *pokemon, struct Entity *target) +void sub_804218C(Entity *pokemon, Entity *target) { sub_804151C(target, 0x2A, 1); } -void sub_804219C(struct Entity *pokemon) +void sub_804219C(Entity *pokemon) { sub_80416E0(pokemon, 0x90, 1); } -void sub_80421AC(struct Entity *pokemon, struct Entity * target) +void sub_80421AC(Entity *pokemon, Entity * target) { sub_804151C(target, 0x167, 1); } -void sub_80421C0(struct Entity *pokemon, u16 r1) +void sub_80421C0(Entity *pokemon, u16 r1) { if(pokemon == NULL) PlaySoundEffect(r1); @@ -836,13 +836,13 @@ void sub_80421C0(struct Entity *pokemon, u16 r1) PlaySoundEffect(r1); } -void sub_80421EC(struct Position *pos, u16 r1) +void sub_80421EC(Position *pos, u16 r1) { if(sub_803F428(pos) != 0) PlaySoundEffect(r1); } -void sub_8042208(struct Entity *pokemon, u8 r1) +void sub_8042208(Entity *pokemon, u8 r1) { if(r1 == 0) PlaySoundEffect(0x152); @@ -852,7 +852,7 @@ void sub_8042208(struct Entity *pokemon, u8 r1) PlaySoundEffect(0x150); } -void sub_8042238(struct Entity *pokemon, struct Entity *target) +void sub_8042238(Entity *pokemon, Entity *target) { if(target->info->isNotTeamMember) PlaySoundEffect(0x157); diff --git a/src/code_80428A0.c b/src/code_80428A0.c index db97b0e44..4b4e88b71 100644 --- a/src/code_80428A0.c +++ b/src/code_80428A0.c @@ -2,155 +2,155 @@ #include "dungeon_entity.h" #include "dungeon_global_data.h" -extern void sub_804151C(struct Entity *r0, u32 r1, u8 r2); +extern void sub_804151C(Entity *r0, u32 r1, u8 r2); extern void sub_803E708(u32 r0, u32 r1); -extern void sub_80416A4(struct Position *r0, u32 r1, u32 r2); -extern void sub_80421C0(struct Entity *r0, u16 r1); -extern u8 sub_8042768(struct Entity *pokemon); +extern void sub_80416A4(Position *r0, u32 r1, u32 r2); +extern void sub_80421C0(Entity *r0, u16 r1); +extern u8 sub_8042768(Entity *pokemon); extern void sub_804178C(u32); -extern void sub_804151C(struct Entity *pokemon, u32 r1, u8 r2); +extern void sub_804151C(Entity *pokemon, u32 r1, u8 r2); extern void sub_803E46C(u32); -void sub_80428A0(struct Entity *r0) +void sub_80428A0(Entity *r0) { sub_804151C(r0, 0x29, 1); } -void sub_80428B0(struct Entity *r0) +void sub_80428B0(Entity *r0) { sub_804151C(r0, 0x1a9, 0); } -void sub_80428C4(struct Entity *r0) +void sub_80428C4(Entity *r0) { sub_804151C(r0, 0x1a9, 0); } -void sub_80428D8(struct Entity *r0) +void sub_80428D8(Entity *r0) { sub_804151C(r0, 0x1a9, 0); } -void sub_80428EC(struct Entity *r0) +void sub_80428EC(Entity *r0) { sub_804151C(r0, 0x1a9, 0); } -void sub_8042900(struct Entity *r0) +void sub_8042900(Entity *r0) { sub_804151C(r0, 0xD4 << 1, 0); } -void ShowVisualFlags(struct Entity *r0) +void ShowVisualFlags(Entity *r0) { sub_804151C(r0, 0x29, 0); } -void sub_8042920(struct Entity *r0) +void sub_8042920(Entity *r0) { sub_804151C(r0, 0x48, 0); } -void sub_8042930(struct Entity *r0) +void sub_8042930(Entity *r0) { sub_804151C(r0, 0xD3 << 1, 1); } -void sub_8042940(struct Entity *r0) +void sub_8042940(Entity *r0) { sub_804151C(r0, 0xC7 << 1, 0); } -void sub_8042950(struct Entity *r0) +void sub_8042950(Entity *r0) { sub_804151C(r0, 0xD8 << 1, 1); sub_803E708(0xA, 0x42); } -void sub_8042968(struct Entity *r0) +void sub_8042968(Entity *r0) { sub_804151C(r0, 0xD4 << 1, 0); } -void sub_8042978(struct Entity *r0) +void sub_8042978(Entity *r0) { sub_804151C(r0, 0x1a9, 0); } -void sub_804298C(struct Entity *r0) +void sub_804298C(Entity *r0) { sub_804151C(r0, 0x1a9, 0); } -void sub_80429A0(struct Entity *r0) +void sub_80429A0(Entity *r0) { sub_804151C(r0, 0x199, 0); } -void sub_80429B4(struct Entity *r0) +void sub_80429B4(Entity *r0) { sub_804151C(r0, 0x1ab, 0); } -void sub_80429C8(struct Entity *r0) +void sub_80429C8(Entity *r0) { sub_804151C(r0, 0x4, 1); } -void sub_80429D8(struct Entity *r0) +void sub_80429D8(Entity *r0) { sub_804151C(r0, 0x8F << 1, 1); } -void sub_80429E8(struct Entity *r0) +void sub_80429E8(Entity *r0) { sub_804151C(r0, 0x11d, 1); } -void sub_80429FC(struct Position *r0) +void sub_80429FC(Position *r0) { sub_80416A4(r0, 0xCF << 1, 1); sub_80421C0(NULL, 0xD4); } -void sub_8042A14(struct Position *r0) +void sub_8042A14(Position *r0) { sub_80416A4(r0, 0x36, 1); } -void sub_8042A24(struct Entity *r0) +void sub_8042A24(Entity *r0) { sub_804151C(r0, 0x15, 1); } -void sub_8042A34(struct Position *r0) +void sub_8042A34(Position *r0) { sub_80416A4(r0, 0x9F << 1, 0); } -void sub_8042A44(struct Entity *r0) +void sub_8042A44(Entity *r0) { sub_804151C(r0, 0xDA << 1, 1); } -void sub_8042A54(struct Position *r0) +void sub_8042A54(Position *r0) { sub_80416A4(r0, 0x37, 1); } -void sub_8042A64(struct Position *r0) +void sub_8042A64(Position *r0) { sub_80416A4(r0, 0x29, 1); } -void sub_8042A74(struct Entity *r0) +void sub_8042A74(Entity *r0) { sub_804151C(r0, 0x18, 1); } -void sub_8042A84(s16 param_1, struct Entity *entity, u32 param_3) +void sub_8042A84(s16 param_1, Entity *entity, u32 param_3) { s32 iVar2; s32 iVar3; @@ -179,12 +179,12 @@ void sub_8042A84(s16 param_1, struct Entity *entity, u32 param_3) } } -void sub_8042B0C(struct Entity *entity) +void sub_8042B0C(Entity *entity) { sub_8042A84(0x13e, entity, 5); } -void sub_8042B20(struct Entity *entity) +void sub_8042B20(Entity *entity) { sub_8042A84(0x1BC, entity, 0xE); } diff --git a/src/code_8045A00.c b/src/code_8045A00.c index 87b0933f8..9d35d8626 100644 --- a/src/code_8045A00.c +++ b/src/code_8045A00.c @@ -4,7 +4,7 @@ #include "dungeon_map_access.h" #include "dungeon_util.h" #include "dungeon_random.h" -#include "item.h" +#include "items.h" #include "map.h" extern u8 *gUnknown_80FE6F4[]; @@ -12,18 +12,18 @@ extern struct unkStruct_8090F58 gUnknown_80F699C; extern struct unkStruct_8090F58 gUnknown_80F69A8; extern struct unkStruct_8090F58 gUnknown_80F6990; -extern struct EntityInfo* GetTrapData_1(struct Entity *entity); -extern void SetMessageArgument_2(u8 *, struct EntityInfo *, u32); +extern EntityInfo* GetTrapData_1(Entity *entity); +extern void SetMessageArgument_2(u8 *, EntityInfo *, u32); extern void GetTrapName(u8 *, u8); extern bool8 IsNotSpecialItem(u8 id); -void sub_8045BF8(u8 *, struct Item *); +void sub_8045BF8(u8 *, Item *); void sub_8046CE4(void *param_1,u32 param_2); extern u32 sub_803D73C(u32); -void sub_80460F8(struct Position *, struct Item *, u32); +void sub_80460F8(Position *, Item *, u32); void sub_8045ACC(void) { - struct Entity *entity; + Entity *entity; s32 index; s32 pokeCount; @@ -51,9 +51,9 @@ void sub_8045ACC(void) } } -s32 GetTeamMemberEntityIndex(struct Entity *pokemon) +s32 GetTeamMemberEntityIndex(Entity *pokemon) { - struct Entity *entity; + Entity *entity; s32 index; for(index = 0; index < MAX_TEAM_MEMBERS; index++) @@ -65,7 +65,7 @@ s32 GetTeamMemberEntityIndex(struct Entity *pokemon) return -1; } -void SetMessageArgument(char *buffer, struct Entity *entity, u32 param_3) +void SetMessageArgument(char *buffer, Entity *entity, u32 param_3) { switch(GetEntityType(entity)) { @@ -84,22 +84,22 @@ void SetMessageArgument(char *buffer, struct Entity *entity, u32 param_3) } } -void sub_8045BF8(u8 *buffer, struct Item *item) +void sub_8045BF8(u8 *buffer, Item *item) { sub_8090E14(buffer, item, &gUnknown_80F699C); } -void sub_8045C08(u8 *buffer, struct Item *item) +void sub_8045C08(u8 *buffer, Item *item) { sub_8090E14(buffer, item, &gUnknown_80F69A8); } -void sub_8045C18(u8 *buffer, struct Item *item) +void sub_8045C18(u8 *buffer, Item *item) { sub_8090E14(buffer, item, &gUnknown_80F6990); } -void sub_8045C28(struct Item *Item, u8 itemID, u32 param_3) +void sub_8045C28(Item *Item, u8 itemID, u32 param_3) { bool8 stickyFlag; u32 total; @@ -143,8 +143,8 @@ void sub_8045CB0(void) struct Tile *tile; u32 uVar5; int xCounter; - struct Item item; - struct Position pos; + Item item; + Position pos; u32 flag; x = DungeonRandInt(DUNGEON_MAX_SIZE_X); diff --git a/src/code_8048480.c b/src/code_8048480.c index 0790cf543..c5013179e 100644 --- a/src/code_8048480.c +++ b/src/code_8048480.c @@ -66,91 +66,91 @@ extern u8 *gUnknown_80FECA0[]; extern u8 *gUnknown_80FE3E8[]; extern u8 *gUnknown_80F9BD8[]; -extern void sub_80421C0(struct Entity *r0, u16 r1); -extern void sub_8078B5C(struct Entity *, struct Entity *, u32, u32, u32); +extern void sub_80421C0(Entity *r0, u16 r1); +extern void sub_8078B5C(Entity *, Entity *, u32, u32, u32); extern u8 sub_806A538(s32); -extern void sub_8051E7C(struct Entity *pokemon); -extern void sub_8045BF8(u8 *, struct Item *); -extern void sub_8063B54(struct ActionContainer *); -extern void sub_80637E8(struct ActionContainer *); -extern void sub_8063BB4(struct ActionContainer *); -extern void sub_8063CF0(struct ActionContainer *, u32); -extern void sub_8063A70(struct ActionContainer *, u32); -extern u8 sub_8062F90(struct Entity *, u32, u32, u32, u32); -extern void sub_8044DF0(struct Entity *, u32, u32); +extern void sub_8051E7C(Entity *pokemon); +extern void sub_8045BF8(u8 *, Item *); +extern void sub_8063B54(ActionContainer *); +extern void sub_80637E8(ActionContainer *); +extern void sub_8063BB4(ActionContainer *); +extern void sub_8063CF0(ActionContainer *, u32); +extern void sub_8063A70(ActionContainer *, u32); +extern u8 sub_8062F90(Entity *, u32, u32, u32, u32); +extern void sub_8044DF0(Entity *, u32, u32); extern s32 sub_8052B8C(u32, u8 *, u32); extern void sub_803EAF0(u32, u32); extern void sub_8044C10(bool8); -struct Entity *DrawFieldGiveItemMenu(u32, u32); +Entity *DrawFieldGiveItemMenu(u32, u32); extern void PrintFieldMessage(u32, u8 *, u32); extern void sub_8044E24(u32, u32, u32); -extern void sub_804245C(u32, struct Item *); -extern u8 sub_8072938(struct Entity *, u16); -extern void sub_807D148(struct Entity *pokemon, struct Entity *r1, u32 r2, struct Position *r3); -extern void sub_8072008(struct Entity *pokemon, struct Entity *r1, u32 r2, u8 r3, u32); -extern void LevelDownTarget(struct Entity *pokemon, struct Entity *r1, u32 r2); -extern void SetMessageArgument(u8 *buffer, struct Entity *r1, u32); -extern void sub_80522F4(struct Entity *pokemon, struct Entity *r1, const char[]); -extern void sub_806F370(struct Entity *pokemon, struct Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32); -extern void sub_8078A58(struct Entity *, struct Entity *, s16, u32); -extern s32 sub_8042520(struct Entity *); -struct Entity *sub_80696FC(struct Entity *); +extern void sub_804245C(u32, Item *); +extern u8 sub_8072938(Entity *, u16); +extern void sub_807D148(Entity *pokemon, Entity *r1, u32 r2, Position *r3); +extern void sub_8072008(Entity *pokemon, Entity *r1, u32 r2, u8 r3, u32); +extern void LevelDownTarget(Entity *pokemon, Entity *r1, u32 r2); +extern void SetMessageArgument(u8 *buffer, Entity *r1, u32); +extern void sub_80522F4(Entity *pokemon, Entity *r1, const u8[]); +extern void sub_806F370(Entity *pokemon, Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32); +extern void sub_8078A58(Entity *, Entity *, s16, u32); +extern s32 sub_8042520(Entity *); +Entity *sub_80696FC(Entity *); extern void sub_80943A0(void*, s32); extern void sub_803E708(u32 r0, u32 r1); -extern void sub_806A7E8(struct EntityInfo *, s32); +extern void sub_806A7E8(EntityInfo *, s32); -void sub_8048340(struct Entity *pokemon, struct Entity *target, u32 r2) +void sub_8048340(Entity *pokemon, Entity *target, u32 r2) { sub_806F370(pokemon, target, r2, 1, 0, 0, 528, 0, 0, 0); } -void sub_8048364(struct Entity *pokemon, struct Entity *target, u8 r2) +void sub_8048364(Entity *pokemon, Entity *target, u8 r2) { sub_8079F20(pokemon, target, 1, r2); } -void sub_8048374(struct Entity *pokemon, struct Entity *target) +void sub_8048374(Entity *pokemon, Entity *target) { HealTargetHP(pokemon, target, gUnknown_80F4FB6, gUnknown_80F4FB8, TRUE); } -void sub_804839C(struct Entity *pokemon, struct Entity *target) +void sub_804839C(Entity *pokemon, Entity *target) { HealTargetHP(pokemon, target, gUnknown_80F4FBA, gUnknown_80F4FBC, TRUE); } -void sub_80483C4(struct Entity *pokemon, struct Entity *target) +void sub_80483C4(Entity *pokemon, Entity *target) { RestorePPTarget(pokemon, target, 999); } -void sub_80483D4(struct Entity *pokemon, struct Entity *target) +void sub_80483D4(Entity *pokemon, Entity *target) { HealTargetHP(pokemon, target, 0, gUnknown_80F4FBE, TRUE); } -void sub_80483F4(struct Entity *pokemon, struct Entity *target) +void sub_80483F4(Entity *pokemon, Entity *target) { BlindTarget(pokemon, target); } -void XEyeSeedAction(struct Entity *pokemon, struct Entity *target) +void XEyeSeedAction(Entity *pokemon, Entity *target) { CrossEyeVisionTarget(pokemon, target); } -void sub_804840C(struct Entity *pokemon, struct Entity *target) +void sub_804840C(Entity *pokemon, Entity *target) { RaiseMovementSpeedTarget(pokemon, target, 0, TRUE); } -void sub_804841C(struct Entity *pokemon, struct Entity *target) +void sub_804841C(Entity *pokemon, Entity *target) { RestoreVisionTarget(pokemon, target); } -void sub_8048428(struct Entity *pokemon, struct Entity *target) +void sub_8048428(Entity *pokemon, Entity *target) { if(target->info->nonVolatileStatus == STATUS_PARALYSIS) SendNonVolatileEndMessage(pokemon, target); @@ -159,7 +159,7 @@ void sub_8048428(struct Entity *pokemon, struct Entity *target) sub_80522F4(pokemon, target, *gUnknown_80F89F4); } -void sub_8048450(struct Entity *pokemon, struct Entity *target) +void sub_8048450(Entity *pokemon, Entity *target) { if((u8)(target->info->nonVolatileStatus - 2) <= 1) SendNonVolatileEndMessage(pokemon, target); @@ -168,43 +168,43 @@ void sub_8048450(struct Entity *pokemon, struct Entity *target) sub_80522F4(pokemon, target, *gUnknown_80F89F4); } -void sub_8048480(struct Entity *pokemon, struct Entity *target) +void sub_8048480(Entity *pokemon, Entity *target) { sub_807D148(pokemon, target, 0, NULL); } -void sub_8048490(struct Entity *pokemon, struct Entity *target) +void sub_8048490(Entity *pokemon, Entity *target) { SleeplessStatusTarget(pokemon, target); } -void sub_804849C(struct Entity *pokemon, struct Entity *target) +void sub_804849C(Entity *pokemon, Entity *target) { ConfuseStatusTarget(pokemon, target, TRUE); } -void sub_80484A8(struct Entity *pokemon, struct Entity *target) +void sub_80484A8(Entity *pokemon, Entity *target) { sub_8072008(pokemon, target, 1, 1, 1); } -void sub_80484BC(struct Entity *pokemon, struct Entity *target) +void sub_80484BC(Entity *pokemon, Entity *target) { PetrifiedStatusTarget(pokemon, target); } -void sub_80484C8(struct Entity *pokemon, struct Entity *target) +void sub_80484C8(Entity *pokemon, Entity *target) { // Pointer to "But nothing happened!" sub_80522F4(pokemon, target, *gUnknown_80F89F4); } -void sub_80484DC(struct Entity *pokemon, struct Entity *target) +void sub_80484DC(Entity *pokemon, Entity *target) { LevelDownTarget(pokemon, target, 1); } -void sub_80484E8(struct Entity *pokemon, struct Entity *target) +void sub_80484E8(Entity *pokemon, Entity *target) { if(target->info->nonVolatileStatus == STATUS_BURN) SendNonVolatileEndMessage(pokemon, target); @@ -216,10 +216,10 @@ void sub_80484E8(struct Entity *pokemon, struct Entity *target) } } -void sub_8048524(struct Entity *pokemon, struct Entity * target) +void sub_8048524(Entity *pokemon, Entity * target) { - struct EntityInfo *entityInfo; - struct EntityInfo *entityInfo_1; + EntityInfo *entityInfo; + EntityInfo *entityInfo_1; u32 *belly; u32 newBelly; @@ -246,17 +246,17 @@ void sub_8048524(struct Entity *pokemon, struct Entity * target) } } -void sub_80485B0(struct Entity *pokemon, struct Entity * target) +void sub_80485B0(Entity *pokemon, Entity * target) { bool8 isMoveBoosted; s32 moveIndex; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; #ifndef NONMATCHING - register struct Move *movePtr1 asm("r4"); // r4 - register struct Move *movePtr2 asm("r5"); // r5 + register Move *movePtr1 asm("r4"); // r4 + register Move *movePtr2 asm("r5"); // r5 #else - struct Move *movePtr1; // r4 - struct Move *movePtr2; // r5 + Move *movePtr1; // r4 + Move *movePtr2; // r5 #endif u8 moveBoost; s32 movePowerBoost; @@ -297,12 +297,12 @@ void sub_80485B0(struct Entity *pokemon, struct Entity * target) sub_80522F4(pokemon,target,*gUnknown_80FE40C); } -void sub_804869C(struct Entity *pokemon, struct Entity * target, u8 param_3) +void sub_804869C(Entity *pokemon, Entity * target, u8 param_3) { s32 uVar1; - struct EntityInfo *entityInfo; - struct EntityInfo *entityInfo_1; - struct Entity *entity; + EntityInfo *entityInfo; + EntityInfo *entityInfo_1; + Entity *entity; u8 auStack28 [4]; if (param_3 != 0) { @@ -346,28 +346,26 @@ void sub_804869C(struct Entity *pokemon, struct Entity * target, u8 param_3) } } -void sub_80487CC(struct Entity *pokemon, struct Entity * target, u32 param_3, u32 param_4) +void sub_80487CC(Entity *pokemon, Entity * target, u32 param_3, u32 param_4) { sub_8078B5C(pokemon, target, param_3, param_4, 1); } -static inline bool8 JoinLocationCannotUseItems_1(struct EntityInfo *pokemonInfo) +static inline bool8 JoinLocationCannotUseItems_1(EntityInfo *pokemonInfo) { if (pokemonInfo->joinedAt == DUNGEON_JOIN_LOCATION_CLIENT_POKEMON) - { return TRUE; - } + if (pokemonInfo->joinedAt == DUNGEON_RESCUE_TEAM_BASE) - { return TRUE; - } + return FALSE; } -void sub_80487E0(struct Entity *pokemon, struct Entity *target, u8 gummiIndex) +void sub_80487E0(Entity *pokemon, Entity *target, u8 gummiIndex) { s32 iVar3; - struct EntityInfo *targetInfo; + EntityInfo *targetInfo; s32 gummiBoost; s32 baseIQ; s32 iVar4; @@ -414,22 +412,22 @@ void sub_80487E0(struct Entity *pokemon, struct Entity *target, u8 gummiIndex) } } -void sub_804891C(struct Entity *pokemon, struct Entity *target) +void sub_804891C(Entity *pokemon, Entity *target) { RaiseAtkStatTarget(pokemon, target, 3); } -void sub_8048928(struct Entity *pokemon, struct Entity *target) +void sub_8048928(Entity *pokemon, Entity *target) { RaiseSpAtkStatTarget(pokemon, target, 3); } -void sub_8048934(struct Entity *pokemon, struct Entity *target) +void sub_8048934(Entity *pokemon, Entity *target) { RaiseDefStatTarget(pokemon, target, 3); } -void sub_8048940(struct Entity *pokemon, struct Entity *target) +void sub_8048940(Entity *pokemon, Entity *target) { RaiseSpDefStatTarget(pokemon, target, 3); } @@ -437,7 +435,7 @@ void sub_8048940(struct Entity *pokemon, struct Entity *target) void nullsub_94(void) {} -static inline bool8 JoinLocationCannotUseItems_2(struct EntityInfo *pokemonInfo) +static inline bool8 JoinLocationCannotUseItems_2(EntityInfo *pokemonInfo) { if (pokemonInfo->joinedAt == DUNGEON_JOIN_LOCATION_CLIENT_POKEMON) { @@ -450,13 +448,13 @@ static inline bool8 JoinLocationCannotUseItems_2(struct EntityInfo *pokemonInfo) return FALSE; } -bool8 sub_8048950(u32 param_1,struct Item *item) +bool8 sub_8048950(u32 param_1,Item *item) { u8 flag; u16 moveID; - struct Entity *entity2; - struct Entity *entity; - struct EntityInfo *entityInfo; + Entity *entity2; + Entity *entity; + EntityInfo *entityInfo; int index; moveID = GetItemMoveID(item->id); @@ -502,7 +500,7 @@ bool8 sub_8048950(u32 param_1,struct Item *item) return FALSE; } -static inline bool8 JoinLocationCannotUseItems_3(struct EntityInfo *pokemonInfo) +static inline bool8 JoinLocationCannotUseItems_3(EntityInfo *pokemonInfo) { if (pokemonInfo->joinedAt == DUNGEON_JOIN_LOCATION_CLIENT_POKEMON) { @@ -515,14 +513,14 @@ static inline bool8 JoinLocationCannotUseItems_3(struct EntityInfo *pokemonInfo) return FALSE; } -bool8 sub_8048A68(u32 param_1,struct Item *item) +bool8 sub_8048A68(u32 param_1,Item *item) { u8 flag; - struct Entity *entity2; - struct Entity *entity; - struct EntityInfo *pEVar6; + Entity *entity2; + Entity *entity; + EntityInfo *pEVar6; s32 index; - struct PokemonStruct2 *pokemon; + PokemonStruct2 *pokemon; if ((item->flags & ITEM_FLAG_STICKY)) { PrintFieldMessage(0,*gUnknown_80FE3E8,1); @@ -579,7 +577,7 @@ bool8 sub_8048A68(u32 param_1,struct Item *item) return FALSE; } -static inline bool8 JoinLocationCannotUseItems_4(struct EntityInfo *pokemonInfo) +static inline bool8 JoinLocationCannotUseItems_4(EntityInfo *pokemonInfo) { if (pokemonInfo->joinedAt == DUNGEON_JOIN_LOCATION_CLIENT_POKEMON) { @@ -593,7 +591,7 @@ static inline bool8 JoinLocationCannotUseItems_4(struct EntityInfo *pokemonInfo) } // TODO: should be bool8 -bool32 sub_8048B9C(struct Entity *entity,struct Item *param_2) +bool32 sub_8048B9C(Entity *entity,Item *param_2) { #ifndef NONMATCHING register bool32 bVar2 asm("r8"); @@ -601,13 +599,13 @@ bool32 sub_8048B9C(struct Entity *entity,struct Item *param_2) bool32 bVar2; #endif bool8 flag; - struct EntityInfo *entityInfo; - struct Entity * entity2; + EntityInfo *entityInfo; + Entity * entity2; int index; - struct Entity *entity1; - struct EntityInfo *entity1Info; - struct ActionContainer *actionPointer; - struct ActionContainer actionContainer; + Entity *entity1; + EntityInfo *entity1Info; + ActionContainer *actionPointer; + ActionContainer actionContainer; u16 action; bVar2 = FALSE; @@ -699,9 +697,9 @@ _clear: return bVar2; } -bool8 sub_8048D50(struct Entity * pokemon, struct Item *item) +bool8 sub_8048D50(Entity * pokemon, Item *item) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; entityInfo = pokemon->info; @@ -721,7 +719,7 @@ bool8 sub_8048D50(struct Entity * pokemon, struct Item *item) return TRUE; } -void sub_8048DB8(struct Entity *pokemon, struct Entity *target, u8 r2) +void sub_8048DB8(Entity *pokemon, Entity *target, u8 r2) { u8 temp; if(r2 != 0) @@ -730,7 +728,7 @@ void sub_8048DB8(struct Entity *pokemon, struct Entity *target, u8 r2) sub_8051E7C(pokemon); } -void sub_8048E04(struct Entity *pokemon, struct Entity * target) +void sub_8048E04(Entity *pokemon, Entity * target) { sub_8078B5C(pokemon, target, 0x1E, 0, 1); switch(DungeonRandInt(5)) @@ -754,27 +752,27 @@ void sub_8048E04(struct Entity *pokemon, struct Entity * target) } } -void sub_8048EB0(struct Entity *pokemon) +void sub_8048EB0(Entity *pokemon) { SendMessage(pokemon, *gPtrIcePartCrumbledMessage); } -void sub_8048EC4(struct Entity *pokemon) +void sub_8048EC4(Entity *pokemon) { SendMessage(pokemon, *gPtrRockPartCrumbledMessage); } -void sub_8048ED8(struct Entity *pokemon) +void sub_8048ED8(Entity *pokemon) { SendMessage(pokemon, *gPtrSteelPartCrumbledMessage); } -void sub_8048EEC(struct Entity *pokemon) +void sub_8048EEC(Entity *pokemon) { SendMessage(pokemon, *gPtrWishStoneCrumbledMessage); } -void sub_8048F00(struct Entity *pokemon) +void sub_8048F00(Entity *pokemon) { sub_80421C0(pokemon, 0xD6); SendMessage(pokemon, *gPtrMusicBoxPlayedCrumbledMessage); diff --git a/src/code_80521D0.c b/src/code_80521D0.c index caae46f9a..62a0eb5e8 100644 --- a/src/code_80521D0.c +++ b/src/code_80521D0.c @@ -2,9 +2,9 @@ #include "code_80521D0.h" extern void sub_80526D0(u8 r0); -extern u8 sub_8045888(struct Entity *r0); -extern void sub_80523A8(struct Entity *r0, const char r1[], u8 r2); -extern u8 sub_8052DC0(struct Entity *); +extern u8 sub_8045888(Entity *r0); +extern void sub_80523A8(Entity *r0, const char r1[], u8 r2); +extern u8 sub_8052DC0(Entity *); extern u8 sub_803F428(u32); void sub_805229C(void) @@ -12,26 +12,26 @@ void sub_805229C(void) return sub_80526D0(0x50); } -void SendMessage(struct Entity *pokemon, const char message[]) +void SendMessage(Entity *pokemon, const char message[]) { if (sub_8045888(pokemon) != 0){ sub_80523A8(pokemon, message, 1); } } -void sub_80522C8(struct Entity *r0, const char r1[]) +void sub_80522C8(Entity *r0, const char r1[]) { if (sub_8045888(r0) != 0){ sub_80523A8(r0, r1, 0); } } -void sub_80522E8(struct Entity *r0, const char r1[]) +void sub_80522E8(Entity *r0, const char r1[]) { sub_80523A8(r0, r1, 0); } -void sub_80522F4(struct Entity *r0, struct Entity *r1, const char r2[]) +void sub_80522F4(Entity *r0, Entity *r1, const char r2[]) { u8 temp; u32 temp_reg; @@ -49,7 +49,7 @@ void sub_80522F4(struct Entity *r0, struct Entity *r1, const char r2[]) } } -void sub_805232C(struct Entity *r0, struct Entity *r1, const char r2[]) +void sub_805232C(Entity *r0, Entity *r1, const char r2[]) { u8 temp; u32 temp_reg; @@ -67,7 +67,7 @@ void sub_805232C(struct Entity *r0, struct Entity *r1, const char r2[]) } } -void sub_8052364(struct Entity *r0, u32 r1, const char r2[]) +void sub_8052364(Entity *r0, u32 r1, const char r2[]) { u8 temp; u32 temp_reg; @@ -85,7 +85,7 @@ void sub_8052364(struct Entity *r0, u32 r1, const char r2[]) } } -void sub_805239C(struct Entity *r0, const char r1[]) +void sub_805239C(Entity *r0, const char r1[]) { sub_80523A8(r0, r1, 1); } diff --git a/src/code_8057824.c b/src/code_8057824.c index 3db250129..27703acdd 100644 --- a/src/code_8057824.c +++ b/src/code_8057824.c @@ -19,7 +19,7 @@ #include "tile_types.h" #include "weather.h" -typedef bool8 (*MoveCallback)(struct Entity *pokemon, struct Entity *target, struct Move *move, s32 param_4); +typedef bool8 (*MoveCallback)(Entity *pokemon, Entity *target, Move *move, s32 param_4); struct NaturePowerMove { u16 moveID; @@ -105,33 +105,23 @@ extern u32 gUnknown_202F21C; extern bool8 gUnknown_202F220; extern u32 gUnknown_8106A54[]; -struct unkStruct_80928C0 -{ - u32 unk0; - s32 unk4; - u8 unk8; - u8 unk9; -}; - -void sub_80928C0(u8 *buffer, struct Move *move, struct unkStruct_80928C0 *param_3); - -extern void sub_806ABAC(struct Entity *, struct Entity *); -extern u8 sub_806F4A4(struct Entity *, u32); -extern void sub_807DF38(struct Entity *pokemon, struct Entity *target, struct Position *pos, u32, u8 moveType, s16); -extern void nullsub_92(struct Entity *); -extern u32 sub_8055864(struct Entity *pokemon, struct Entity *target, struct Move *param_3, s32 param_4, s32 param_5); -void sub_8079E34(struct Entity * pokemon, struct Entity * target, bool8 param_3); +extern void sub_806ABAC(Entity *, Entity *); +extern u8 sub_806F4A4(Entity *, u32); +extern void sub_807DF38(Entity *pokemon, Entity *target, Position *pos, u32, u8 moveType, s16); +extern void nullsub_92(Entity *); +extern u32 sub_8055864(Entity *pokemon, Entity *target, Move *param_3, s32 param_4, s32 param_5); +void sub_8079E34(Entity * pokemon, Entity * target, bool8 param_3); extern u8 sub_807EAA0(u32, u32); -extern void sub_80522F4(struct Entity *r1, struct Entity *r2, const char[]); -extern s32 sub_80556BC(struct Entity *, struct Entity *, u8, struct Move *, u32, u32); -extern bool8 sub_805727C(struct Entity *, struct Entity *, s16); -extern void sub_806F370(struct Entity *r0, struct Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32); -extern void SetMessageArgument(char[], struct Entity*, u32); -extern u32 sub_8055640(struct Entity *, struct Entity *, struct Move *, u32, u32); +extern void sub_80522F4(Entity *r1, Entity *r2, const char[]); +extern s32 sub_80556BC(Entity *, Entity *, u8, Move *, u32, u32); +extern bool8 sub_805727C(Entity *, Entity *, s16); +extern void sub_806F370(Entity *r0, Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32); +extern void SetMessageArgument(char[], Entity*, u32); +extern u32 sub_8055640(Entity *, Entity *, Move *, u32, u32); u8 sub_8057620(u32 param_1); extern s16 sub_8094828(u16, u8); -extern bool8 sub_8057308(struct Entity *, u32); -extern void sub_806F324(struct Entity *, s32, u32, u32); +extern bool8 sub_8057308(Entity *, u32); +extern void sub_806F324(Entity *, s32, u32, u32); extern s16 gUnknown_80F4DB4; extern u32 gUnknown_8106A4C; @@ -195,7 +185,7 @@ break2: } } -bool8 sub_805755C(struct Entity* pokemon, u16 moveID) +bool8 sub_805755C(Entity* pokemon, u16 moveID) { if ((moveID == MOVE_SOLARBEAM) && (GetApparentWeather(pokemon) == WEATHER_SUNNY)) { return FALSE; @@ -205,13 +195,13 @@ bool8 sub_805755C(struct Entity* pokemon, u16 moveID) } } -void sub_8057588(struct Entity * pokemon, u8 param_2) +void sub_8057588(Entity * pokemon, u8 param_2) { - struct Move *move; + Move *move; s32 index; s32 PPtoRemove; s32 PPCounter; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(pokemon)) { entityInfo = pokemon->info; @@ -241,7 +231,7 @@ void sub_8057588(struct Entity * pokemon, u8 param_2) } } -s16 sub_8057600(struct Move *move, s32 itemID) +s16 sub_8057600(Move *move, s32 itemID) { return sub_8094828(move->id, sub_8057620(itemID)); } @@ -254,7 +244,7 @@ u8 sub_8057620(u32 itemID) return itemID; } -bool8 sub_8057634(struct Entity *pokemon, struct Entity *target, struct Move *move, s32 param_4) +bool8 sub_8057634(Entity *pokemon, Entity *target, Move *move, s32 param_4) { bool8 flag; @@ -268,7 +258,7 @@ bool8 sub_8057634(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_805768C(struct Entity *pokemon, struct Entity *target, struct Move *move, s32 param_4) +bool8 sub_805768C(Entity *pokemon, Entity *target, Move *move, s32 param_4) { bool8 flag; @@ -282,37 +272,37 @@ bool8 sub_805768C(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 YawnMoveAction(struct Entity * pokemon, struct Entity *target) +bool8 YawnMoveAction(Entity * pokemon, Entity *target) { YawnedStatusTarget(pokemon, target, CalculateStatusTurns(target,gUnknown_80F4F28,TRUE) + 1); return TRUE; } -bool8 sub_80576F8(struct Entity * pokemon, struct Entity *target) +bool8 sub_80576F8(Entity * pokemon, Entity *target) { sub_8075C58(pokemon, target, CalculateStatusTurns(target, gUnknown_80F4E74, TRUE), TRUE); return TRUE; } -bool8 NightmareMoveAction(struct Entity * pokemon, struct Entity *target) +bool8 NightmareMoveAction(Entity * pokemon, Entity *target) { NightmareStatusTarget(pokemon, target, CalculateStatusTurns(target,gUnknown_80F4E78,TRUE)); return TRUE; } -bool8 sub_8057748(struct Entity * pokemon,struct Entity * target) +bool8 sub_8057748(Entity * pokemon,Entity * target) { HealTargetHP(pokemon, target, gUnknown_80F502A[GetApparentWeather(pokemon)], 0, TRUE); return TRUE; } -bool8 VitalThrowMoveAction(struct Entity * pokemon, struct Entity * target) +bool8 VitalThrowMoveAction(Entity * pokemon, Entity * target) { VitalThrowStatusTarget(pokemon, target); return TRUE; } -bool8 DigMoveAction(struct Entity * pokemon, struct Entity * target, struct Move *move, s32 param_4) +bool8 DigMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) { struct Tile *tile; bool8 flag; @@ -335,19 +325,19 @@ bool8 DigMoveAction(struct Entity * pokemon, struct Entity * target, struct Move return flag; } -bool32 sub_8057824(struct Entity *pokemon, struct Entity *target) +bool32 sub_8057824(Entity *pokemon, Entity *target) { LowerAccuracyStageTarget(pokemon,target,gUnknown_8106A50,TRUE); return TRUE; } -bool32 sub_805783C(struct Entity *pokemon, struct Entity *target) +bool32 sub_805783C(Entity *pokemon, Entity *target) { ChangeAttackMultiplierTarget(pokemon,target,gUnknown_8106A4C,0x80,TRUE); return TRUE; } -bool32 sub_805785C(struct Entity *pokemon, struct Entity *target) +bool32 sub_805785C(Entity *pokemon, Entity *target) { gDungeon->unkE26B = gUnknown_80F4F42; if (sub_807EAA0(1,0) == 0) { @@ -357,7 +347,7 @@ bool32 sub_805785C(struct Entity *pokemon, struct Entity *target) return TRUE; } -bool32 sub_80578A4(struct Entity *pokemon, struct Entity *target) +bool32 sub_80578A4(Entity *pokemon, Entity *target) { gDungeon->weatherTurns = gUnknown_80F4F42; if (sub_807EAA0(1,0) == 0) { @@ -367,13 +357,13 @@ bool32 sub_80578A4(struct Entity *pokemon, struct Entity *target) return TRUE; } -bool32 sub_80578EC(struct Entity *pokemon, struct Entity *target) +bool32 sub_80578EC(Entity *pokemon, Entity *target) { sub_8079F20(pokemon, target, 1, 0); return TRUE; } -bool32 sub_80578FC(struct Entity *pokemon, struct Entity *target, struct Move * move, u32 param_4) +bool32 sub_80578FC(Entity *pokemon, Entity *target, Move * move, u32 param_4) { bool32 flag; @@ -387,20 +377,20 @@ bool32 sub_80578FC(struct Entity *pokemon, struct Entity *target, struct Move * return flag; } -bool32 EncoreMoveAction(struct Entity *pokemon, struct Entity *target) +bool32 EncoreMoveAction(Entity *pokemon, Entity *target) { EncoreStatusTarget(pokemon, target); return TRUE; } -bool32 RageMoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move) +bool32 RageMoveAction(Entity *pokemon, Entity *target, Move *move) { // {ARG_POKEMON_0} is enraged SetChargeStatusTarget(pokemon,target,STATUS_ENRAGED,move,gUnknown_80FAC88); return TRUE; } -bool32 sub_8057974(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool32 sub_8057974(Entity *pokemon, Entity *target, Move *move, u32 param_4) { s32 newHP; bool8 local_24; @@ -419,13 +409,13 @@ bool32 sub_8057974(struct Entity *pokemon, struct Entity *target, struct Move *m return local_24; } -bool8 PainSplitMoveAction(struct Entity *pokemon, struct Entity *target) +bool8 PainSplitMoveAction(Entity *pokemon, Entity *target) { s32 newHP; - struct EntityInfo *iVar2; - struct EntityInfo *iVar3; - struct EntityInfo *iVar4; - struct EntityInfo *iVar5; + EntityInfo *iVar2; + EntityInfo *iVar3; + EntityInfo *iVar4; + EntityInfo *iVar5; // Need copies for some reason to match.. iVar3 = (pokemon->info); @@ -452,12 +442,12 @@ bool8 PainSplitMoveAction(struct Entity *pokemon, struct Entity *target) return TRUE; } -bool8 TormentMoveAction(struct Entity *pokemon, struct Entity *target) +bool8 TormentMoveAction(Entity *pokemon, Entity *target) { - struct Move *movePtr; + Move *movePtr; s32 iVar4; - struct Move struggleMove; - struct EntityInfo *entityInfo; + Move struggleMove; + EntityInfo *entityInfo; bool8 isTormented; entityInfo = target->info; @@ -509,20 +499,20 @@ bool8 TormentMoveAction(struct Entity *pokemon, struct Entity *target) return isTormented; } -bool8 sub_8057BB4(struct Entity *pokemon, struct Entity *target) +bool8 sub_8057BB4(Entity *pokemon, Entity *target) { LowerMovementSpeedTarget(pokemon, target, 1, TRUE); return TRUE; } -bool8 sub_8057BC4(struct Entity *pokemon, struct Entity *target) +bool8 sub_8057BC4(Entity *pokemon, Entity *target) { ConfuseStatusTarget(pokemon, target, TRUE); RaiseAttackStageTarget(pokemon, target, gUnknown_8106A4C, 2); return TRUE; } -bool8 SnoreMoveAction(struct Entity *pokemon, struct Entity *target, struct Move * move, u32 param_4) +bool8 SnoreMoveAction(Entity *pokemon, Entity *target, Move * move, u32 param_4) { bool8 flag; @@ -541,13 +531,13 @@ bool8 SnoreMoveAction(struct Entity *pokemon, struct Entity *target, struct Move return flag; } -bool8 sub_8057C68(struct Entity *pokemon, struct Entity *target) +bool8 sub_8057C68(Entity *pokemon, Entity *target) { ChangeDefenseMultiplierTarget(pokemon, target, gUnknown_8106A4C, 0x40, 1); return TRUE; } -bool8 sub_8057C88(struct Entity *pokemon, struct Entity *target, struct Move * move, u32 param_4) +bool8 sub_8057C88(Entity *pokemon, Entity *target, Move * move, u32 param_4) { bool8 flag; @@ -561,7 +551,7 @@ bool8 sub_8057C88(struct Entity *pokemon, struct Entity *target, struct Move * m return flag; } -bool32 sub_8057CD0(struct Entity * pokemon, struct Entity * target, struct Move * move, u32 param_4) +bool32 sub_8057CD0(Entity * pokemon, Entity * target, Move * move, u32 param_4) { u32 weather; s32 flag; @@ -575,7 +565,7 @@ bool32 sub_8057CD0(struct Entity * pokemon, struct Entity * target, struct Move return flag; } -bool8 WhirlpoolMoveAction(struct Entity * pokemon, struct Entity * target, struct Move * move, u32 param_4) +bool8 WhirlpoolMoveAction(Entity * pokemon, Entity * target, Move * move, u32 param_4) { u32 uVar3; bool8 flag; @@ -596,13 +586,13 @@ bool8 WhirlpoolMoveAction(struct Entity * pokemon, struct Entity * target, struc return flag; } -bool8 sub_8057D7C(struct Entity * pokemon, struct Entity * target) +bool8 sub_8057D7C(Entity * pokemon, Entity * target) { LowerDefenseStageTarget(pokemon, target, gUnknown_8106A50, 2, 1, TRUE); return TRUE; } -NAKED bool8 sub_8057D9C(struct Entity * pokemon, struct Entity * target) +NAKED bool8 sub_8057D9C(Entity * pokemon, Entity * target) { asm_unified( "\tpush {r4-r7,lr}\n" @@ -671,28 +661,28 @@ NAKED bool8 sub_8057D9C(struct Entity * pokemon, struct Entity * target) "_08057E18: .4byte gUnknown_80FD370"); } -bool8 FocusEnergyMoveAction(struct Entity * pokemon, struct Entity * target) +bool8 FocusEnergyMoveAction(Entity * pokemon, Entity * target) { FocusEnergyStatusTarget(pokemon, target); return TRUE; } -bool8 SmokescreenMoveAction(struct Entity *pokemon, struct Entity *target) +bool8 SmokescreenMoveAction(Entity *pokemon, Entity *target) { WhifferStatusTarget(pokemon, target, CalculateStatusTurns(target, gUnknown_80F4EDC, TRUE)); return TRUE; } -bool8 sub_8057E50(struct Entity *pokemon, struct Entity *target) +bool8 sub_8057E50(Entity *pokemon, Entity *target) { SendThawedMessage(pokemon, target); MirrorMoveStatusTarget(pokemon, target); return TRUE; } -bool8 sub_8057E6C(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8057E6C(Entity *pokemon, Entity *target, Move *move, u32 param_4) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; bool8 flag; flag = FALSE; @@ -707,7 +697,7 @@ bool8 sub_8057E6C(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_8057ED0(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8057ED0(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -722,9 +712,9 @@ bool8 sub_8057ED0(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_8057F24(struct Entity *pokemon, struct Entity *target) +bool8 sub_8057F24(Entity *pokemon, Entity *target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; entityInfo = pokemon->info; entityInfo->HP = 1; @@ -734,7 +724,7 @@ bool8 sub_8057F24(struct Entity *pokemon, struct Entity *target) return TRUE; } -bool8 sub_8057F7C(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8057F7C(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -749,14 +739,14 @@ bool8 sub_8057F7C(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_8057FCC(struct Entity *pokemon, struct Entity *target) +bool8 sub_8057FCC(Entity *pokemon, Entity *target) { ConfuseStatusTarget(pokemon, target, TRUE); RaiseAttackStageTarget(pokemon, target, gUnknown_8106A50, 1); return TRUE; } -bool8 sub_8057FF4(struct Entity *pokemon, struct Entity *target) +bool8 sub_8057FF4(Entity *pokemon, Entity *target) { u8 flashFireStatus; @@ -779,13 +769,13 @@ bool8 sub_8057FF4(struct Entity *pokemon, struct Entity *target) return TRUE; } -bool8 sub_805805C(struct Entity * pokemon,struct Entity * target,struct Move * move,s32 param_4) +bool8 sub_805805C(Entity * pokemon,Entity * target,Move * move,s32 param_4) { s16 *psVar3; s32 index; s32 r6; bool8 local_24; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; s32 IQ; entityInfo = pokemon->info; @@ -809,9 +799,9 @@ _080580B0: return local_24; } -bool8 GrudgeMoveAction(struct Entity *pokemon, struct Entity * target) +bool8 GrudgeMoveAction(Entity *pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; bool8 hasGrudge; hasGrudge = FALSE; @@ -828,13 +818,13 @@ bool8 GrudgeMoveAction(struct Entity *pokemon, struct Entity * target) return hasGrudge; } -bool8 sub_805815C(struct Entity *pokemon, struct Entity *target) +bool8 sub_805815C(Entity *pokemon, Entity *target) { CounterStatusTarget(pokemon, target, STATUS_COUNTER); return TRUE; } -bool8 sub_805816C(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_805816C(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -850,7 +840,7 @@ bool8 sub_805816C(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_80581D0(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_80581D0(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -866,7 +856,7 @@ bool8 sub_80581D0(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_8058234(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8058234(Entity *pokemon, Entity *target, Move *move, u32 param_4) { u16 uVar1; uVar1 = (move->id == MOVE_FORESIGHT) ? 0x7A : 0x51; @@ -874,13 +864,13 @@ bool8 sub_8058234(struct Entity *pokemon, struct Entity *target, struct Move *mo return TRUE; } -bool8 sub_805825C(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_805825C(Entity *pokemon, Entity *target, Move *move, u32 param_4) { RaiseAccuracyStageTarget(pokemon, target, gUnknown_8106A50); return TRUE; } -bool8 sub_8058270(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8058270(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; u32 r3; @@ -892,25 +882,25 @@ bool8 sub_8058270(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_80582AC(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_80582AC(Entity *pokemon, Entity *target, Move *move, u32 param_4) { RaiseDefenseStageTarget(pokemon, target, gUnknown_8106A4C, 1); return TRUE; } -bool8 sub_80582C4(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_80582C4(Entity *pokemon, Entity *target, Move *move, u32 param_4) { ParalyzeStatusTarget(pokemon, target, TRUE); return TRUE; } -bool8 sub_80582D4(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_80582D4(Entity *pokemon, Entity *target, Move *move, u32 param_4) { RaiseAttackStageTarget(pokemon, target, gUnknown_8106A4C, 1); return TRUE; } -bool8 RazorWindMoveAction(struct Entity * pokemon, struct Entity * target, struct Move * move, u32 param_4) +bool8 RazorWindMoveAction(Entity * pokemon, Entity * target, Move * move, u32 param_4) { bool8 flag; @@ -925,13 +915,13 @@ bool8 RazorWindMoveAction(struct Entity * pokemon, struct Entity * target, struc return flag; } -bool8 BideMoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 BideMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { SetChargeStatusTarget(pokemon, target, STATUS_BIDE, move, *gUnknown_80FAC74); return TRUE; } -bool8 sub_805836C(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_805836C(Entity *pokemon, Entity *target, Move *move, u32 param_4) { s32 iVar2; bool8 local_18; @@ -947,7 +937,7 @@ bool8 sub_805836C(struct Entity *pokemon, struct Entity *target, struct Move *mo return local_18; } -bool8 sub_80583D8(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_80583D8(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -962,7 +952,7 @@ bool8 sub_80583D8(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_8058430(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8058430(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -977,7 +967,7 @@ bool8 sub_8058430(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_8058478(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8058478(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -992,12 +982,12 @@ bool8 sub_8058478(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_80584C0(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_80584C0(Entity *pokemon, Entity *target, Move *move, u32 param_4) { s32 diffHP; bool8 local_24; - struct EntityInfo *entityInfo; - struct EntityInfo *entityInfo1; + EntityInfo *entityInfo; + EntityInfo *entityInfo1; local_24 = 0; @@ -1013,7 +1003,7 @@ bool8 sub_80584C0(struct Entity *pokemon, struct Entity *target, struct Move *mo return local_24; } -bool8 sub_8058548(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8058548(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; u32 r5; @@ -1025,7 +1015,7 @@ bool8 sub_8058548(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_8058580(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8058580(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -1040,7 +1030,7 @@ bool8 sub_8058580(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_80585CC(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_80585CC(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -1055,7 +1045,7 @@ bool8 sub_80585CC(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_8058638(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8058638(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -1070,7 +1060,7 @@ bool8 sub_8058638(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 FocusPunchMoveAction(struct Entity * pokemon, struct Entity * target, struct Move * move, u32 param_4) +bool8 FocusPunchMoveAction(Entity * pokemon, Entity * target, Move * move, u32 param_4) { bool8 flag; @@ -1085,13 +1075,13 @@ bool8 FocusPunchMoveAction(struct Entity * pokemon, struct Entity * target, stru return flag; } -bool8 sub_80586DC(struct Entity * pokemon, struct Entity * target, struct Move * move, u32 param_4) +bool8 sub_80586DC(Entity * pokemon, Entity * target, Move * move, u32 param_4) { bool8 hasLiquidOoze; s32 uVar3; s32 newHP; bool8 flag; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; hasLiquidOoze = HasAbility(target, ABILITY_LIQUID_OOZE); uVar3 = sub_8055640(pokemon,target,move,0x100,param_4); @@ -1118,7 +1108,7 @@ bool8 sub_80586DC(struct Entity * pokemon, struct Entity * target, struct Move * // NOTE: copy of sub_805AFA4 in status_checker.c except for different reg for entityInfo -bool8 sub_8058770(struct Entity * pokemon, struct Entity * target, struct Move * move, u32 param_4) +bool8 sub_8058770(Entity * pokemon, Entity * target, Move * move, u32 param_4) { s32 r0; s32 r2; @@ -1126,9 +1116,9 @@ bool8 sub_8058770(struct Entity * pokemon, struct Entity * target, struct Move * bool8 flag; #ifndef NONMATCHING - register struct EntityInfo *entityInfo asm("r2"); + register EntityInfo *entityInfo asm("r2"); #else - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; #endif entityInfo = pokemon->info; @@ -1157,7 +1147,7 @@ bool8 sub_8058770(struct Entity * pokemon, struct Entity * target, struct Move * return flag; } -bool8 sub_80587E8(struct Entity * pokemon, struct Entity * target, struct Move * move, u32 param_4) +bool8 sub_80587E8(Entity * pokemon, Entity * target, Move * move, u32 param_4) { bool8 flag; @@ -1171,13 +1161,13 @@ bool8 sub_80587E8(struct Entity * pokemon, struct Entity * target, struct Move * return flag; } -bool8 sub_8058838(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8058838(Entity *pokemon, Entity *target, Move *move, u32 param_4) { LowerDefenseStageTarget(pokemon, target, gUnknown_8106A50, 3, 1, TRUE); return TRUE; } -bool8 sub_8058858(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8058858(Entity *pokemon, Entity *target, Move *move, u32 param_4) { s32 index = gUnknown_8106A4C; LowerAttackStageTarget(pokemon, target, index, 1, 1, TRUE); @@ -1185,19 +1175,19 @@ bool8 sub_8058858(struct Entity *pokemon, struct Entity *target, struct Move *mo return TRUE; } -bool8 sub_805889C(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_805889C(Entity *pokemon, Entity *target, Move *move, u32 param_4) { ImmobilizedStatusTarget(pokemon, target); return TRUE; } -bool8 sub_80588A8(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_80588A8(Entity *pokemon, Entity *target, Move *move, u32 param_4) { sub_8079E34(pokemon, target, TRUE); return TRUE; } -bool8 sub_80588B8(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_80588B8(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag = FALSE; if(sub_8055640(pokemon, target, move, 0x80 << 1, param_4) != 0) @@ -1211,20 +1201,20 @@ bool8 sub_80588B8(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_80588F4(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_80588F4(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; - struct EntityInfo *entityInfo = target->info; + EntityInfo *entityInfo = target->info; flag = sub_8055640(pokemon, target, move, GetWeight(entityInfo->apparentID), param_4) != 0 ? TRUE: FALSE; return flag; } -bool8 sub_8058930(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8058930(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag = FALSE; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; s32 index1; s32 index2; if(sub_8055640(pokemon, target, move, 0x80 << 1, param_4) != 0) @@ -1249,19 +1239,19 @@ bool8 sub_8058930(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_80589D4(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_80589D4(Entity *pokemon, Entity *target, Move *move, u32 param_4) { HealTargetHP(pokemon, target, gUnknown_80F500A[GetApparentWeather(pokemon)], 0, TRUE); return TRUE; } -bool8 sub_8058A08(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8058A08(Entity *pokemon, Entity *target, Move *move, u32 param_4) { RaiseMovementSpeedTarget(pokemon, target, 0, TRUE); return TRUE; } -bool8 sub_8058A18(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8058A18(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag = FALSE; if(sub_8055640(pokemon, target, move, 0x80 << 1, param_4) != 0) @@ -1275,20 +1265,20 @@ bool8 sub_8058A18(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_8058A54(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8058A54(Entity *pokemon, Entity *target, Move *move, u32 param_4) { SureShotStatusTarget(pokemon, target, CalculateStatusTurns(target, gUnknown_80F4EB8, FALSE)); return TRUE; } -bool8 sub_8058A7C(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8058A7C(Entity *pokemon, Entity *target, Move *move, u32 param_4) { RaiseDefenseStageTarget(pokemon, target, gUnknown_8106A4C, 1); RaiseDefenseStageTarget(pokemon, target, gUnknown_8106A50, 1); return TRUE; } -bool8 SkyAttackMoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 SkyAttackMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag = FALSE; @@ -1308,7 +1298,7 @@ bool8 SkyAttackMoveAction(struct Entity *pokemon, struct Entity *target, struct return flag; } -bool8 sub_8058B3C(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8058B3C(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -1323,10 +1313,10 @@ bool8 sub_8058B3C(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_8058B84(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8058B84(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; flag = FALSE; if (sub_8055640(pokemon,target,move,0x100,param_4) != 0) { @@ -1342,19 +1332,19 @@ bool8 sub_8058B84(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 EndureMoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 EndureMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { EndureStatusTarget(pokemon, pokemon); return TRUE; } -bool8 sub_8058BF0(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8058BF0(Entity *pokemon, Entity *target, Move *move, u32 param_4) { LowerMovementSpeedTarget(pokemon, target, 1, TRUE); return TRUE; } -bool8 sub_8058C00(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8058C00(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -1369,7 +1359,7 @@ bool8 sub_8058C00(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_8058C48(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8058C48(Entity *pokemon, Entity *target, Move *move, u32 param_4) { s32 rand; s32 iVar2; @@ -1392,7 +1382,7 @@ bool8 sub_8058C48(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_8058C98(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4, u32 param_5) +bool8 sub_8058C98(Entity *pokemon, Entity *target, Move *move, u32 param_4, u32 param_5) { bool8 flag; @@ -1407,7 +1397,7 @@ bool8 sub_8058C98(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_8058CEC(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8058CEC(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag = FALSE; if(sub_8055640(pokemon, target, move, 0x80 << 1, param_4) != 0) @@ -1421,7 +1411,7 @@ bool8 sub_8058CEC(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_8058D38(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8058D38(Entity *pokemon, Entity *target, Move *move, u32 param_4) { SleeplessStatusTarget(pokemon, target); return TRUE; @@ -1429,7 +1419,7 @@ bool8 sub_8058D38(struct Entity *pokemon, struct Entity *target, struct Move *mo // NOTE: same as sub_8058770 -bool8 sub_8058D44(struct Entity * pokemon, struct Entity * target, struct Move * move, u32 param_4) +bool8 sub_8058D44(Entity * pokemon, Entity * target, Move * move, u32 param_4) { s32 r0; s32 r2; @@ -1437,9 +1427,9 @@ bool8 sub_8058D44(struct Entity * pokemon, struct Entity * target, struct Move * bool8 flag; #ifndef NONMATCHING - register struct EntityInfo *entityInfo asm("r2"); + register EntityInfo *entityInfo asm("r2"); #else - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; #endif entityInfo = pokemon->info; @@ -1469,11 +1459,11 @@ bool8 sub_8058D44(struct Entity * pokemon, struct Entity * target, struct Move * } -bool8 PsychUpMoveAction(struct Entity * pokemon, struct Entity * target, struct Move * move, u32 param_4) +bool8 PsychUpMoveAction(Entity * pokemon, Entity * target, Move * move, u32 param_4) { s32 index; - struct EntityInfo *iVar3; - struct EntityInfo *iVar4; + EntityInfo *iVar3; + EntityInfo *iVar4; iVar4 = pokemon->info; iVar3 = target->info; @@ -1495,7 +1485,7 @@ bool8 PsychUpMoveAction(struct Entity * pokemon, struct Entity * target, struct return TRUE; } -bool8 sub_8058E5C(struct Entity *pokemon, struct Entity *target, struct Move *move, s32 param_4) +bool8 sub_8058E5C(Entity *pokemon, Entity *target, Move *move, s32 param_4) { int iVar2; int iVar3; @@ -1519,16 +1509,16 @@ bool8 sub_8058E5C(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_8058EE0(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8058EE0(Entity *pokemon, Entity *target, Move *move, u32 param_4) { HealTargetHP(pokemon, target, target->info->maxHPStat / 2, 0, TRUE); return TRUE; } -bool32 sub_8058F04(struct Entity *pokemon, struct Entity *target, struct Move *move, s32 param_4) +bool32 sub_8058F04(Entity *pokemon, Entity *target, Move *move, s32 param_4) { bool32 flag; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; s32 iVar3; entityInfo = target->info; @@ -1545,11 +1535,11 @@ bool32 sub_8058F04(struct Entity *pokemon, struct Entity *target, struct Move *m return flag; } -bool8 NaturePowerMoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move, s32 param_4) +bool8 NaturePowerMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { bool8 flag; s32 tileset; - struct Move natureMove; + Move natureMove; tileset = gDungeon->tileset; if (tileset < 0) { @@ -1563,7 +1553,7 @@ bool8 NaturePowerMoveAction(struct Entity *pokemon, struct Entity *target, struc return flag; } -bool8 sub_8058FBC(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8058FBC(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -1578,25 +1568,25 @@ bool8 sub_8058FBC(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_8059004(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8059004(Entity *pokemon, Entity *target, Move *move, u32 param_4) { sub_807DF38(pokemon, target, &target->pos, 1, GetMoveType(move), sub_8057600(move, param_4)); return TRUE; } -bool8 sub_8059050(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8059050(Entity *pokemon, Entity *target, Move *move, u32 param_4) { ParalyzeStatusTarget(pokemon, target, TRUE); return TRUE; } -bool8 ChargeMoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 ChargeMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { SetChargeStatusTarget(pokemon, target, STATUS_CHARGING, move, *gUnknown_80FAD6C); return TRUE; } -bool8 sub_8059080(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8059080(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -1611,13 +1601,13 @@ bool8 sub_8059080(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 MistMoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 MistMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { MistStatusTarget(pokemon, target); return TRUE; } -bool8 sub_80590D4(struct Entity *pokemon, struct Entity *target, struct Move *move, s32 param_4) +bool8 sub_80590D4(Entity *pokemon, Entity *target, Move *move, s32 param_4) { u8 moveType; bool8 uVar5; @@ -1641,7 +1631,7 @@ bool8 sub_80590D4(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_8059190(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8059190(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -1656,19 +1646,19 @@ bool8 sub_8059190(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 SafeguardMoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 SafeguardMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { SafeguardStatusTarget(pokemon, target); return TRUE; } -bool8 sub_80591E4(struct Entity *pokemon, struct Entity *target, struct Move *move, s32 param_4) +bool8 sub_80591E4(Entity *pokemon, Entity *target, Move *move, s32 param_4) { bool8 hasLiquidOoze; s32 iVar3; s32 iVar4; bool8 flag; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; flag = FALSE; hasLiquidOoze = HasAbility(target, ABILITY_LIQUID_OOZE); @@ -1697,15 +1687,15 @@ bool8 sub_80591E4(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 SkillSwapMoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move, s32 param_4) +bool8 SkillSwapMoveAction(Entity *pokemon, Entity *target, Move *move, s32 param_4) { u8 ability_1; u8 ability_2; bool8 flag; u8 *puVar5; u8 *puVar6; - struct EntityInfo * targetEntityInfo; - struct EntityInfo * pokeEntityData; + EntityInfo * targetEntityInfo; + EntityInfo * pokeEntityData; pokeEntityData = pokemon->info; targetEntityInfo = target->info; diff --git a/src/code_8057824_1.c b/src/code_8057824_1.c index 401b1067b..b449246f4 100644 --- a/src/code_8057824_1.c +++ b/src/code_8057824_1.c @@ -1,17 +1,20 @@ #include "global.h" +#include "code_806CD90.h" +#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" #include "constants/friend_area.h" #include "constants/weather.h" #include "dungeon_global_data.h" #include "dungeon_entity.h" +#include "dungeon_leader.h" #include "dungeon_map_access.h" #include "dungeon_music.h" #include "dungeon_random.h" #include "dungeon_util.h" #include "dungeon_util_1.h" #include "friend_area.h" -#include "item.h" +#include "items.h" #include "pokemon.h" #include "pokemon_3.h" #include "position_util.h" @@ -22,341 +25,333 @@ extern u8 gUnknown_202E038[0x50]; extern u8 gAvailablePokemonNames[0x58]; extern u8 gUnknown_202DE58[]; -extern s16 gUnknown_80F57CA; -extern s16 gUnknown_80F57D2; -extern s16 gUnknown_80F57D0; -extern s16 gUnknown_80F57CE; +extern const s16 gUnknown_80F57CA; +extern const s16 gUnknown_80F57D2; +extern const s16 gUnknown_80F57D0; +extern const s16 gUnknown_80F57CE; -extern u32 gUnknown_8103D8C; -extern u32 gUnknown_8103D98; -extern u32 gUnknown_8103DD8; -extern u32 gUnknown_8103E28; -extern u32 gUnknown_8103BD8; -extern u32 gUnknown_8103C00; -extern u32 gUnknown_8103C3C; -extern u32 gUnknown_8103C74; -extern u32 gUnknown_8103CC4; -extern u32 gUnknown_8103D0C; -extern u32 gUnknown_8103D50; -extern u32 gRayquazaPostStoryPreFightDialogue_6; -extern u32 gRayquazaPostStoryPreFightDialogue_1; -extern u32 gRayquazaPostStoryPreFightDialogue_2; -extern u32 gRayquazaPostStoryPreFightDialogue_3; -extern u32 gRayquazaPostStoryPreFightDialogue_4; -extern u32 gRayquazaPostStoryPreFightDialogue_5; -extern u32 gRayquazaPreFightDialogue_7; -extern u32 gRayquazaReFightDialogue_1; -extern u32 gRayquazaReFightDialogue_2; -extern u32 gRayquazaReFightDialogue_3; -extern u32 gRayquazaReFightDialogue_4; -extern u32 gRayquazaPreFightDialogue_1; -extern u32 gRayquazaPreFightDialogue_2; -extern u32 gRayquazaPreFightDialogue_3; -extern u32 gRayquazaPreFightDialogue_4; -extern u32 gRayquazaPreFightDialogue_5; -extern u32 gRayquazaPreFightDialogue_6; -extern u32 gRayquazaPreFightDialogue_7; -extern u32 gRayquazaPreFightDialogue_8; -extern u32 gRayquazaPreFightDialogue_9; -extern u32 gRayquazaPreFightDialogue_10; -extern u32 gRayquazaPreFightDialogue_11; -extern u32 MagmaCavernMidDialogue_5; -extern u32 MagmaCavernMidDialogue_6; -extern u32 MagmaCavernMidDialogue_7; -extern u32 MagmaCavernMidDialogue_8; -extern u32 MagmaCavernMidDialogue_9; -extern u32 MagmaCavernMidDialogue_10; -extern u32 MagmaCavernMidDialogue_11; -extern u32 MagmaCavernMidDialogue_12; -extern u32 MagmaCavernMidDialogue_13; -extern u32 MagmaCavernMidDialogue_14; -extern u32 MagmaCavernMidDialogue_15; -extern u32 MagmaCavernMidDialogue_4; -extern u32 MagmaCavernMidDialogue_3; -extern u32 MagmaCavernMidDialogue_2; -extern u32 MagmaCavernMidDialogue_1; -extern u32 gUnknown_8103488; -extern u32 gGroudonPostStoryPreFightDialogue_1; -extern u32 gGroudonPostStoryPreFightDialogue_2; -extern u32 gGroudonPostStoryPreFightDialogue_3; -extern u32 gGroudonPostStoryPreFightDialogue_4; -extern u32 gGroudonReFightDialogue_1; -extern u32 gGroudonReFightDialogue_2; -extern u32 gGroudonReFightDialogue_3; -extern u32 gGroudonReFightDialogue_4; -extern u32 GroudonPreFightDialogue_1; -extern u32 GroudonPreFightDialogue_2; -extern u32 GroudonPreFightDialogue_3; -extern u32 GroudonPreFightDialogue_4; -extern u32 GroudonPreFightDialogue_5; -extern u32 GroudonPreFightDialogue_6; -extern u32 GroudonPreFightDialogue_7; -extern u32 GroudonPreFightDialogue_8; -extern u32 GroudonPreFightDialogue_9; -extern u32 GroudonPreFightDialogue_10; -extern u32 GroudonPreFightDialogue_11; -extern u32 GroudonPreFightDialogue_12; -extern u32 GroudonPreFightDialogue_13; -extern u32 GroudonPreFightDialogue_14; -extern u32 gUnknown_8102B10; -extern u32 gRegisteelPostFightDialogue_2; -extern u32 gRegicePostFightDialogue_2; -extern u32 gRegirockPostFightDialogue_2; -extern u32 gRegisteelPostFightDialogue_1; -extern u32 gRegicePostFightDialogue_1; -extern u32 gRegirockPostFightDialogue_1; -extern u32 gUnknown_810554C; -extern u32 gUnknown_8105558; -extern u32 gUnknown_81055F4; -extern u32 gRegicePreFightDialogue_1; -extern u32 gRegirockPreFightDialogue_1; -extern u32 gSuicuneReFightDialogue_1; -extern u32 gSuicuneReFightDialogue_2; -extern u32 gSuicuneReFightDialogue_3; -extern u32 gRegisteelPreFightDialogue_1; -extern u32 gJirachiPreFightDialogue_1; -extern u32 gJirachiPreFightDialogue_2; -extern u32 gJirachiPreFightDialogue_3; -extern u32 gJirachiPreFightDialogue_4; -extern u32 gLatiosReFightDialogue_1; -extern u32 gLatiosPreFightDialogue_2; -extern u32 gLatiosPreFightDialogue_3; -extern u32 gLatiosPreFightDialogue_1; -extern u32 HoOhReFightDialogue_1; -extern u32 HoOhReFightDialogue_2; -extern u32 HoOhReFightDialogue_3; -extern u32 HoOhReFightDialogue_4; -extern u32 HoOhReFightDialogue_5; -extern u32 gHoOhPreFightDialogue_1; -extern u32 gHoOhPreFightDialogue_2; -extern u32 gHoOhPreFightDialogue_3; -extern u32 gHoOhPreFightDialogue_4; -extern u32 gHoOhPreFightDialogue_5; -extern u32 gHoOhPreFightDialogue_6; -extern u32 gSuicunePostStoryPreFightDialogue_4; -extern u32 gSuicunePostStoryPreFightDialogue_1; -extern u32 gSuicunePostStoryPreFightDialogue_2; -extern u32 gSuicunePostStoryPreFightDialogue_3; -extern u32 gSuicunePreFightDialogue_1; -extern u32 gSuicunePreFightDialogue_2; -extern u32 gSuicunePreFightDialogue_3; -extern u32 gSuicunePreFightDialogue_4; -extern u32 gSuicunePreFightDialogue_5; -extern u32 gSuicunePreFightDialogue_6; -extern u32 gSuicunePreFightDialogue_7; -extern u32 gRaikouPostStoryPreFightDialogue_3; -extern u32 gRaikouPostStoryPreFightDialogue_4; -extern u32 gRaikouPostStoryPreFightDialogue_1; -extern u32 gRaikouPostStoryPreFightDialogue_2; -extern u32 gRaikouReFightDialogue_1; -extern u32 gRaikouReFightDialogue_2; -extern u32 gRaikouReFightDialogue_3; -extern u32 gRaikouPreFightDialogue_1; -extern u32 gRaikouPreFightDialogue_2; -extern u32 gRaikouPreFightDialogue_3; -extern u32 gRaikouPreFightDialogue_4; -extern u32 gRaikouPreFightDialogue_5; -extern u32 gRaikouPreFightDialogue_6; -extern u32 gEnteiPostStoryPreFightDialogue_4; -extern u32 gEnteiPostStoryPreFightDialogue_1; -extern u32 gEnteiPostStoryPreFightDialogue_2; -extern u32 gEnteiPostStoryPreFightDialogue_3; -extern u32 gEnteiReFightDialogue_1; -extern u32 gEnteiReFightDialogue_2; -extern u32 gEnteiReFightDialogue_3; -extern u32 gUnknown_8104FC8; -extern u32 gEnteiPreFightDialogue_1; -extern u32 gEnteiPreFightDialogue_2; -extern u32 gEnteiPreFightDialogue_3; -extern u32 gMewtwoReFightDialogue_5; -extern u32 gMewtwoReFightDialogue_4; -extern u32 gMewtwoReFightDialogue_3; -extern u32 gMewtwoReFightDialogue_2; -extern u32 gMewtwoReFightDialogue_1; -extern u32 gMewtwoPreFightDialogue_5; -extern u32 gMewtwoPreFightDialogue_1; -extern u32 gMewtwoPreFightDialogue_2; -extern u32 gMewtwoPreFightDialogue_3; -extern u32 gMewtwoPreFightDialogue_4; -extern u32 gUnknown_8103E34; -extern u32 gUnknown_8102A9C; -extern u32 gArticunoPostStoryPreFightDialogue_1; -extern u32 gArticunoPostStoryPreFightDialogue_2; -extern u32 gArticunoPostStoryPreFightDialogue_3; -extern u32 gArticunoPostStoryPreFightDialogue_4; -extern u32 gArticunoPostStoryPreFightDialogue_5; -extern u32 gArticunoReFightDialogue_1; -extern u32 gArticunoReFightDialogue_2; -extern u32 gArticunoReFightDialogue_3; -extern u32 gArticunoPreFightDialogue_1; -extern u32 gArticunoPreFightDialogue_2; -extern u32 gArticunoPreFightDialogue_3; -extern u32 gArticunoPreFightDialogue_4; -extern u32 gArticunoPreFightDialogue_5; -extern u32 gArticunoPreFightDialogue_6; -extern u32 gArticunoPreFightDialogue_7; -extern u32 gArticunoPreFightDialogue_8; -extern u32 gArticunoPreFightDialogue_9; -extern u32 gArticunoPreFightDialogue_10; -extern u32 gArticunoPreFightDialogue_11; -extern u32 gArticunoPreFightDialogue_12; -extern u32 gMoltresPostStoryPreFightDialogue_1; -extern u32 gMoltresPostStoryPreFightDialogue_2; -extern u32 gMoltresPostStoryPreFightDialogue_3; -extern u32 gMoltresPostStoryPreFightDialogue_4; -extern u32 gMoltresPostStoryPreFightDialogue_5; -extern u32 gUnknown_8100D3C; -extern u32 gMoltresReFightDialogue_1; -extern u32 gMoltresReFightDialogue_2; -extern u32 gMoltresReFightDialogue_3; -extern u32 gMoltresReFightDialogue_4; -extern u32 gMoltresReFightDialogue_5; -extern u32 gMoltresPreFightDialogue_1; -extern u32 gMoltresPreFightDialogue_2; -extern u32 gMoltresPreFightDialogue_3; -extern u32 gMoltresPreFightDialogue_4; -extern u32 gMoltresPreFightDialogue_5; -extern u32 gMoltresPreFightDialogue_6; -extern u32 gMoltresPreFightDialogue_7; -extern u32 gMoltresPreFightDialogue_8; -extern u32 gMoltresPreFightDialogue_9; -extern u32 gMoltresPreFightDialogue_10; -extern u32 gMoltresPreFightDialogue_11; -extern u32 gMoltresPreFightDialogue_12; -extern u32 gZapdosPostStoryPreFightDialogue_1; -extern u32 gZapdosPostStoryPreFightDialogue_2; -extern u32 gZapdosPostStoryPreFightDialogue_3; -extern u32 gZapdosPostStoryPreFightDialogue_4; -extern u32 gZapdosPostStoryPreFightDialogue_5; -extern u32 gZapdosPostStoryPreFightDialogue_6; -extern u32 gUnknown_8105668; -extern u32 gUnknown_8105674; -extern u32 gUnknown_81056B8; -extern u32 gUnknown_81056DC; -extern u32 gUnknown_810579C; -extern u32 gUnknown_8105974; -extern u32 gUnknown_810581C; +extern const u8 gUnknown_8103D8C[]; +extern const u8 gUnknown_8103D98[]; +extern const u8 gUnknown_8103DD8[]; +extern const u8 gUnknown_8103E28[]; +extern const u8 gUnknown_8103BD8[]; +extern const u8 gUnknown_8103C00[]; +extern const u8 gUnknown_8103C3C[]; +extern const u8 gUnknown_8103C74[]; +extern const u8 gUnknown_8103CC4[]; +extern const u8 gUnknown_8103D0C[]; +extern const u8 gUnknown_8103D50[]; +extern const u8 gRayquazaPostStoryPreFightDialogue_6[]; +extern const u8 gRayquazaPostStoryPreFightDialogue_1[]; +extern const u8 gRayquazaPostStoryPreFightDialogue_2[]; +extern const u8 gRayquazaPostStoryPreFightDialogue_3[]; +extern const u8 gRayquazaPostStoryPreFightDialogue_4[]; +extern const u8 gRayquazaPostStoryPreFightDialogue_5[]; +extern const u8 gRayquazaPreFightDialogue_7[]; +extern const u8 gRayquazaReFightDialogue_1[]; +extern const u8 gRayquazaReFightDialogue_2[]; +extern const u8 gRayquazaReFightDialogue_3[]; +extern const u8 gRayquazaReFightDialogue_4[]; +extern const u8 gRayquazaPreFightDialogue_1[]; +extern const u8 gRayquazaPreFightDialogue_2[]; +extern const u8 gRayquazaPreFightDialogue_3[]; +extern const u8 gRayquazaPreFightDialogue_4[]; +extern const u8 gRayquazaPreFightDialogue_5[]; +extern const u8 gRayquazaPreFightDialogue_6[]; +extern const u8 gRayquazaPreFightDialogue_7[]; +extern const u8 gRayquazaPreFightDialogue_8[]; +extern const u8 gRayquazaPreFightDialogue_9[]; +extern const u8 gRayquazaPreFightDialogue_10[]; +extern const u8 gRayquazaPreFightDialogue_11[]; +extern const u8 MagmaCavernMidDialogue_5[]; +extern const u8 MagmaCavernMidDialogue_6[]; +extern const u8 MagmaCavernMidDialogue_7[]; +extern const u8 MagmaCavernMidDialogue_8[]; +extern const u8 MagmaCavernMidDialogue_9[]; +extern const u8 MagmaCavernMidDialogue_10[]; +extern const u8 MagmaCavernMidDialogue_11[]; +extern const u8 MagmaCavernMidDialogue_12[]; +extern const u8 MagmaCavernMidDialogue_13[]; +extern const u8 MagmaCavernMidDialogue_14[]; +extern const u8 MagmaCavernMidDialogue_15[]; +extern const u8 MagmaCavernMidDialogue_4[]; +extern const u8 MagmaCavernMidDialogue_3[]; +extern const u8 MagmaCavernMidDialogue_2[]; +extern const u8 MagmaCavernMidDialogue_1[]; +extern const u8 gUnknown_8103488[]; +extern const u8 gGroudonPostStoryPreFightDialogue_1[]; +extern const u8 gGroudonPostStoryPreFightDialogue_2[]; +extern const u8 gGroudonPostStoryPreFightDialogue_3[]; +extern const u8 gGroudonPostStoryPreFightDialogue_4[]; +extern const u8 gGroudonReFightDialogue_1[]; +extern const u8 gGroudonReFightDialogue_2[]; +extern const u8 gGroudonReFightDialogue_3[]; +extern const u8 gGroudonReFightDialogue_4[]; +extern const u8 GroudonPreFightDialogue_1[]; +extern const u8 GroudonPreFightDialogue_2[]; +extern const u8 GroudonPreFightDialogue_3[]; +extern const u8 GroudonPreFightDialogue_4[]; +extern const u8 GroudonPreFightDialogue_5[]; +extern const u8 GroudonPreFightDialogue_6[]; +extern const u8 GroudonPreFightDialogue_7[]; +extern const u8 GroudonPreFightDialogue_8[]; +extern const u8 GroudonPreFightDialogue_9[]; +extern const u8 GroudonPreFightDialogue_10[]; +extern const u8 GroudonPreFightDialogue_11[]; +extern const u8 GroudonPreFightDialogue_12[]; +extern const u8 GroudonPreFightDialogue_13[]; +extern const u8 GroudonPreFightDialogue_14[]; +extern const u8 gUnknown_8102B10[]; +extern const u8 gRegisteelPostFightDialogue_2[]; +extern const u8 gRegicePostFightDialogue_2[]; +extern const u8 gRegirockPostFightDialogue_2[]; +extern const u8 gRegisteelPostFightDialogue_1[]; +extern const u8 gRegicePostFightDialogue_1[]; +extern const u8 gRegirockPostFightDialogue_1[]; +extern const u8 gUnknown_810554C[]; +extern const u8 gUnknown_8105558[]; +extern const u8 gUnknown_81055F4[]; +extern const u8 gRegicePreFightDialogue_1[]; +extern const u8 gRegirockPreFightDialogue_1[]; +extern const u8 gSuicuneReFightDialogue_1[]; +extern const u8 gSuicuneReFightDialogue_2[]; +extern const u8 gSuicuneReFightDialogue_3[]; +extern const u8 gRegisteelPreFightDialogue_1[]; +extern const u8 gJirachiPreFightDialogue_1[]; +extern const u8 gJirachiPreFightDialogue_2[]; +extern const u8 gJirachiPreFightDialogue_3[]; +extern const u8 gJirachiPreFightDialogue_4[]; +extern const u8 gLatiosReFightDialogue_1[]; +extern const u8 gLatiosPreFightDialogue_2[]; +extern const u8 gLatiosPreFightDialogue_3[]; +extern const u8 gLatiosPreFightDialogue_1[]; +extern const u8 HoOhReFightDialogue_1[]; +extern const u8 HoOhReFightDialogue_2[]; +extern const u8 HoOhReFightDialogue_3[]; +extern const u8 HoOhReFightDialogue_4[]; +extern const u8 HoOhReFightDialogue_5[]; +extern const u8 gHoOhPreFightDialogue_1[]; +extern const u8 gHoOhPreFightDialogue_2[]; +extern const u8 gHoOhPreFightDialogue_3[]; +extern const u8 gHoOhPreFightDialogue_4[]; +extern const u8 gHoOhPreFightDialogue_5[]; +extern const u8 gHoOhPreFightDialogue_6[]; +extern const u8 gSuicunePostStoryPreFightDialogue_4[]; +extern const u8 gSuicunePostStoryPreFightDialogue_1[]; +extern const u8 gSuicunePostStoryPreFightDialogue_2[]; +extern const u8 gSuicunePostStoryPreFightDialogue_3[]; +extern const u8 gSuicunePreFightDialogue_1[]; +extern const u8 gSuicunePreFightDialogue_2[]; +extern const u8 gSuicunePreFightDialogue_3[]; +extern const u8 gSuicunePreFightDialogue_4[]; +extern const u8 gSuicunePreFightDialogue_5[]; +extern const u8 gSuicunePreFightDialogue_6[]; +extern const u8 gSuicunePreFightDialogue_7[]; +extern const u8 gRaikouPostStoryPreFightDialogue_3[]; +extern const u8 gRaikouPostStoryPreFightDialogue_4[]; +extern const u8 gRaikouPostStoryPreFightDialogue_1[]; +extern const u8 gRaikouPostStoryPreFightDialogue_2[]; +extern const u8 gRaikouReFightDialogue_1[]; +extern const u8 gRaikouReFightDialogue_2[]; +extern const u8 gRaikouReFightDialogue_3[]; +extern const u8 gRaikouPreFightDialogue_1[]; +extern const u8 gRaikouPreFightDialogue_2[]; +extern const u8 gRaikouPreFightDialogue_3[]; +extern const u8 gRaikouPreFightDialogue_4[]; +extern const u8 gRaikouPreFightDialogue_5[]; +extern const u8 gRaikouPreFightDialogue_6[]; +extern const u8 gEnteiPostStoryPreFightDialogue_4[]; +extern const u8 gEnteiPostStoryPreFightDialogue_1[]; +extern const u8 gEnteiPostStoryPreFightDialogue_2[]; +extern const u8 gEnteiPostStoryPreFightDialogue_3[]; +extern const u8 gEnteiReFightDialogue_1[]; +extern const u8 gEnteiReFightDialogue_2[]; +extern const u8 gEnteiReFightDialogue_3[]; +extern const u8 gUnknown_8104FC8[]; +extern const u8 gEnteiPreFightDialogue_1[]; +extern const u8 gEnteiPreFightDialogue_2[]; +extern const u8 gEnteiPreFightDialogue_3[]; +extern const u8 gMewtwoReFightDialogue_5[]; +extern const u8 gMewtwoReFightDialogue_4[]; +extern const u8 gMewtwoReFightDialogue_3[]; +extern const u8 gMewtwoReFightDialogue_2[]; +extern const u8 gMewtwoReFightDialogue_1[]; +extern const u8 gMewtwoPreFightDialogue_5[]; +extern const u8 gMewtwoPreFightDialogue_1[]; +extern const u8 gMewtwoPreFightDialogue_2[]; +extern const u8 gMewtwoPreFightDialogue_3[]; +extern const u8 gMewtwoPreFightDialogue_4[]; +extern const u8 gUnknown_8103E34[]; +extern const u8 gUnknown_8102A9C[]; +extern const u8 gArticunoPostStoryPreFightDialogue_1[]; +extern const u8 gArticunoPostStoryPreFightDialogue_2[]; +extern const u8 gArticunoPostStoryPreFightDialogue_3[]; +extern const u8 gArticunoPostStoryPreFightDialogue_4[]; +extern const u8 gArticunoPostStoryPreFightDialogue_5[]; +extern const u8 gArticunoReFightDialogue_1[]; +extern const u8 gArticunoReFightDialogue_2[]; +extern const u8 gArticunoReFightDialogue_3[]; +extern const u8 gArticunoPreFightDialogue_1[]; +extern const u8 gArticunoPreFightDialogue_2[]; +extern const u8 gArticunoPreFightDialogue_3[]; +extern const u8 gArticunoPreFightDialogue_4[]; +extern const u8 gArticunoPreFightDialogue_5[]; +extern const u8 gArticunoPreFightDialogue_6[]; +extern const u8 gArticunoPreFightDialogue_7[]; +extern const u8 gArticunoPreFightDialogue_8[]; +extern const u8 gArticunoPreFightDialogue_9[]; +extern const u8 gArticunoPreFightDialogue_10[]; +extern const u8 gArticunoPreFightDialogue_11[]; +extern const u8 gArticunoPreFightDialogue_12[]; +extern const u8 gMoltresPostStoryPreFightDialogue_1[]; +extern const u8 gMoltresPostStoryPreFightDialogue_2[]; +extern const u8 gMoltresPostStoryPreFightDialogue_3[]; +extern const u8 gMoltresPostStoryPreFightDialogue_4[]; +extern const u8 gMoltresPostStoryPreFightDialogue_5[]; +extern const u8 gUnknown_8100D3C[]; +extern const u8 gMoltresReFightDialogue_1[]; +extern const u8 gMoltresReFightDialogue_2[]; +extern const u8 gMoltresReFightDialogue_3[]; +extern const u8 gMoltresReFightDialogue_4[]; +extern const u8 gMoltresReFightDialogue_5[]; +extern const u8 gMoltresPreFightDialogue_1[]; +extern const u8 gMoltresPreFightDialogue_2[]; +extern const u8 gMoltresPreFightDialogue_3[]; +extern const u8 gMoltresPreFightDialogue_4[]; +extern const u8 gMoltresPreFightDialogue_5[]; +extern const u8 gMoltresPreFightDialogue_6[]; +extern const u8 gMoltresPreFightDialogue_7[]; +extern const u8 gMoltresPreFightDialogue_8[]; +extern const u8 gMoltresPreFightDialogue_9[]; +extern const u8 gMoltresPreFightDialogue_10[]; +extern const u8 gMoltresPreFightDialogue_11[]; +extern const u8 gMoltresPreFightDialogue_12[]; +extern const u8 gZapdosPostStoryPreFightDialogue_1[]; +extern const u8 gZapdosPostStoryPreFightDialogue_2[]; +extern const u8 gZapdosPostStoryPreFightDialogue_3[]; +extern const u8 gZapdosPostStoryPreFightDialogue_4[]; +extern const u8 gZapdosPostStoryPreFightDialogue_5[]; +extern const u8 gZapdosPostStoryPreFightDialogue_6[]; +extern const u8 gUnknown_8105668[]; +extern const u8 gUnknown_8105674[]; +extern const u8 gUnknown_81056B8[]; +extern const u8 gUnknown_81056DC[]; +extern const u8 gUnknown_810579C[]; +extern const u8 gUnknown_8105974[]; +extern const u8 gUnknown_810581C[]; -extern u32 gUnknown_8105BF4; -extern u32 gUnknown_8105D2C; -extern u32 gUnknown_8105D80; -extern u32 gUnknown_8105D9C; -extern u32 gUnknown_81058E0; -extern u32 gUnknown_810593C; -extern u32 gUnknown_8105A08; -extern u32 gUnknown_8105AD4; -extern u32 gUnknown_8105B20; -extern u32 gUnknown_8105B68; -extern u32 gUnknown_8105BA8; -extern u8 *gUnknown_8105798[]; -extern u32 gJirachiReFightDialogue_1; -extern u32 gUnknown_202EDC8; +extern const u8 gUnknown_8105BF4[]; +extern const u8 gUnknown_8105D2C[]; +extern const u8 gUnknown_8105D80[]; +extern const u8 gUnknown_8105D9C[]; +extern const u8 gUnknown_81058E0[]; +extern const u8 gUnknown_810593C[]; +extern const u8 gUnknown_8105A08[]; +extern const u8 gUnknown_8105AD4[]; +extern const u8 gUnknown_8105B20[]; +extern const u8 gUnknown_8105B68[]; +extern const u8 gUnknown_8105BA8[]; +extern const u8 *gUnknown_8105798[]; +extern const u8 gJirachiReFightDialogue_1[]; -extern u32 gKyogrePreFightDialogue_8; -extern u32 gKyogrePreFightDialogue_1; -extern u32 gKyogrePreFightDialogue_2; -extern u32 gKyogrePreFightDialogue_3; -extern u32 gKyogrePreFightDialogue_4; -extern u32 gKyogrePreFightDialogue_5; -extern u32 gKyogrePreFightDialogue_6; -extern u32 gKyogrePreFightDialogue_7; -extern u32 gUnknown_810697C; -extern u64 gUnknown_8107544[]; -extern u32 gMedichamRescueDialogue_1; -extern u32 gMedichamRescueDialogue_2; -extern u32 gMedichamRescueDialogue_3; -extern u32 gMedichamRescueDialogue_4; -extern u32 gSmeargleRescueDialogue_1; -extern u32 gSmeargleRescueDialogue_2; -extern u32 gSmeargleRescueDialogue_3; -extern u32 gSmeargleRescueDialogue_4; -extern u32 gUnknown_8106720; +extern const u8 gKyogrePreFightDialogue_8[]; +extern const u8 gKyogrePreFightDialogue_1[]; +extern const u8 gKyogrePreFightDialogue_2[]; +extern const u8 gKyogrePreFightDialogue_3[]; +extern const u8 gKyogrePreFightDialogue_4[]; +extern const u8 gKyogrePreFightDialogue_5[]; +extern const u8 gKyogrePreFightDialogue_6[]; +extern const u8 gKyogrePreFightDialogue_7[]; +extern const u8 gUnknown_810697C[]; +extern const u64 gUnknown_8107544[]; +extern const u8 gMedichamRescueDialogue_1[]; +extern const u8 gMedichamRescueDialogue_2[]; +extern const u8 gMedichamRescueDialogue_3[]; +extern const u8 gMedichamRescueDialogue_4[]; +extern const u8 gSmeargleRescueDialogue_1[]; +extern const u8 gSmeargleRescueDialogue_2[]; +extern const u8 gSmeargleRescueDialogue_3[]; +extern const u8 gSmeargleRescueDialogue_4[]; +extern const u8 gUnknown_8106720[]; -extern u32 gCelebiJoinDialogue_10; -extern u32 gCelebiJoinDialogue_1; -extern u32 gCelebiJoinDialogue_2; -extern u32 gCelebiJoinDialogue_3; -extern u32 gCelebiJoinDialogue_4; -extern u32 gCelebiJoinDialogue_5; -extern u32 gCelebiJoinDialogue_6; -extern u32 gCelebiJoinDialogue_7; -extern u32 gCelebiJoinDialogue_8; -extern u32 gCelebiJoinDialogue_9; -extern u32 *gPtrPurityForestAllowCelebiToJoinText; -extern u32 gPurityForestAllowCelebiToJoinPrompt; -extern u32 *gPtrPurityForestRefuseCelebiConfirmText; -extern u32 gPurityForestRefuseCelebiConfirmPrompt; -extern u32 gDeoxysPreFightDialogue_1; -extern u32 gDeoxysPreFightDialogue_2; -extern u32 gDeoxysPreFightDialogue_3; -extern u32 gDeoxysPreFightDialogue_4; -extern u32 gDeoxysPreFightDialogue_5; -extern u32 gLugiaPreFightDialogue_8; -extern u32 gLugiaPreFightDialogue_1; -extern u32 gLugiaPreFightDialogue_2; -extern u32 gLugiaPreFightDialogue_3; -extern u32 gLugiaPreFightDialogue_4; -extern u32 gLugiaPreFightDialogue_5; -extern u32 gLugiaPreFightDialogue_6; -extern u32 gLugiaPreFightDialogue_7; -extern u32 gZapdosReFightDialogue_1; -extern u32 gUnknown_81015A0; -extern u32 gZapdosReFightDialogue_2; -extern u32 gZapdosReFightDialogue_3; -extern u32 gZapdosReFightDialogue_4; +extern const u8 gCelebiJoinDialogue_10[]; +extern const u8 gCelebiJoinDialogue_1[]; +extern const u8 gCelebiJoinDialogue_2[]; +extern const u8 gCelebiJoinDialogue_3[]; +extern const u8 gCelebiJoinDialogue_4[]; +extern const u8 gCelebiJoinDialogue_5[]; +extern const u8 gCelebiJoinDialogue_6[]; +extern const u8 gCelebiJoinDialogue_7[]; +extern const u8 gCelebiJoinDialogue_8[]; +extern const u8 gCelebiJoinDialogue_9[]; +extern const u32 *gPtrPurityForestAllowCelebiToJoinText; +extern const u32 gPurityForestAllowCelebiToJoinPrompt; +extern const u32 *gPtrPurityForestRefuseCelebiConfirmText; +extern const u32 gPurityForestRefuseCelebiConfirmPrompt; +extern const u8 gDeoxysPreFightDialogue_1[]; +extern const u8 gDeoxysPreFightDialogue_2[]; +extern const u8 gDeoxysPreFightDialogue_3[]; +extern const u8 gDeoxysPreFightDialogue_4[]; +extern const u8 gDeoxysPreFightDialogue_5[]; +extern const u8 gLugiaPreFightDialogue_8[]; +extern const u8 gLugiaPreFightDialogue_1[]; +extern const u8 gLugiaPreFightDialogue_2[]; +extern const u8 gLugiaPreFightDialogue_3[]; +extern const u8 gLugiaPreFightDialogue_4[]; +extern const u8 gLugiaPreFightDialogue_5[]; +extern const u8 gLugiaPreFightDialogue_6[]; +extern const u8 gLugiaPreFightDialogue_7[]; +extern const u8 gZapdosReFightDialogue_1[]; +extern const u8 gUnknown_81015A0[]; +extern const u8 gZapdosReFightDialogue_2[]; +extern const u8 gZapdosReFightDialogue_3[]; +extern const u8 gZapdosReFightDialogue_4[]; -extern u32 gUnknown_81058C4; -extern u32 gUnknown_81058A8; +extern const u8 gUnknown_81058C4[]; +extern const u8 gUnknown_81058A8[]; -extern u8 gUnknown_81074FC[]; +extern const u8 gUnknown_81074FC[]; extern u8 sub_800E9A8(u32); extern void sub_800DC14(u32); -extern void sub_8086A3C(struct Entity *r0); +extern void sub_8086A3C(Entity *r0); extern void sub_80854D4(void); extern void sub_80855E4(void *); -extern void sub_8068FE0(struct Entity *, u32, u32); +extern void sub_8068FE0(Entity *, u32, u32); extern void sub_803E708(u32, u32); extern void sub_8086448(void); -extern void sub_8086598(void); -extern void SpriteLookAroundEffect(struct Entity *); -extern void SpriteShockEffect(struct Entity *); extern void PlaySoundEffect(u32); -extern void sub_806CDD4(struct Entity *, u32, u32); -extern void sub_80869E4(struct Entity *, u32, u32, u32); -extern void sub_806CE68(struct Entity *, u32); -extern void IncreaseEntityPixelPos(struct Entity *, u32, u32); -extern void sub_8042B0C(struct Entity *); -extern void DisplayDungeonDialogue(u32 *); +extern void IncreaseEntityPixelPos(Entity *, u32, u32); +extern void sub_8042B0C(Entity *); extern void sub_803E708(u32, u32); -extern u8 sub_806FD18(struct Entity *); -extern void sub_80861D4(struct Entity *, u32, s32 direction); -extern void sub_806FDF4(struct Entity *, struct Entity *, struct Entity **); -extern u32 sub_80861F8(u32, struct Entity *, u32); +extern u8 sub_806FD18(Entity *); +extern void sub_80861D4(Entity *, u32, s32 direction); +extern void sub_806FDF4(Entity *, Entity *, Entity **); +extern u32 sub_80861F8(u32, Entity *, u32); extern s32 GetCameraXPos(); extern s32 GetCameraYPos(); extern void sub_803F878(u32, s32); -extern void SetupBossFightHP(struct Entity *, u32, u32); +extern void SetupBossFightHP(Entity *, u32, u32); extern void sub_803E9D0(void); extern void DeoxysScreenFlash(void); extern void sub_8085EB0(); extern void sub_808563C(void *); -void SetupDeoxysFightHP(struct Entity *r0); +void SetupDeoxysFightHP(Entity *r0); void sub_808C550(void); -void sub_808C590(struct Entity *r0); -void SetupDeoxysFacingDirection(struct Entity *r0); +void sub_808C590(Entity *r0); +void SetupDeoxysFacingDirection(Entity *r0); void sub_808C9B0(); -void sub_808C8E0(struct Entity *param_1); +void sub_808C8E0(Entity *param_1); void sub_808C360(void); void KyogreScreenFlash(); void sub_808C0CC(); void LugiaScreenFlash(); void LugiaScreenFlash2(); -extern void sub_80861B8(struct Entity *, u32, u32); +extern void sub_80861B8(Entity *, u32, u32); void nullsub_99(); @@ -364,75 +359,63 @@ extern void sub_8049884(); extern void sub_8049B8C(); extern void sub_8049ED4(); extern void sub_8040A84(); -extern void sub_8086A54(struct Entity *); +extern void sub_8086A54(Entity *); -extern void sub_806BFC0(struct EntityInfo *, u32); +extern void sub_806BFC0(EntityInfo *, u32); -extern struct Entity *xxx_call_GetLeader(void); -extern void sub_808BBA8(struct Entity * ); +extern Entity *xxx_call_GetLeader(void); +extern void sub_808BBA8(Entity * ); extern void sub_80855E4(void *); extern void sub_8041888(u32); -extern void sub_80861B8(struct Entity *, u32, u32); +extern void sub_80861B8(Entity *, u32, u32); extern void sub_803E708(u32, u32); -extern void DisplayDungeonDialogue(u32 *r0); +extern void DisplayDungeonDialogue(const u8 *r0); -extern void SpriteShockEffect(struct Entity *); -extern u32 sub_80861F8(u32, struct Entity *, u32); +extern u32 sub_80861F8(u32, Entity *, u32); extern void JirachiWish(); -extern void JirachiSpinEffect(struct Entity *); -extern void JirachiWishGrantDialogue(struct Entity *jirachiEntity); +extern void JirachiSpinEffect(Entity *); +extern void JirachiWishGrantDialogue(Entity *jirachiEntity); extern void JirachiWishGrantFlash(); -extern void JirachiDropInEffect(struct Entity *param_1); +extern void JirachiDropInEffect(Entity *param_1); extern u8 JirachiFriendAreaSearch(void); extern u8 sub_80860A8(u32); extern void sub_8049ED4(); -extern void sub_8052D44(s16 *, struct Entity *, struct Entity *); -extern void SetMessageArgument(u8 *, struct Entity *, u32); -extern struct Entity *GetLeader(); -extern void sub_80421C0(struct Entity *, u32); +extern void sub_8052D44(s16 *, Entity *, Entity *); +extern void SetMessageArgument(u8 *, Entity *, u32); +extern void sub_80421C0(Entity *, u32); extern void sub_8046D20(); extern void sub_808B1CC(u8); -extern void sub_80464C8(struct Entity *, u32 *, struct Item *); +extern void sub_80464C8(Entity *, u32 *, Item *); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern void sub_803E46C(u32); -extern void sub_80866C4(u32 *); -extern void sub_808692C(); -extern void sub_80868F4(); -extern void sub_8086910(); -extern u32 sub_8085EC8(u32, u32, u32, struct Position *, u32); -extern void sub_808680C(); -extern void sub_808682C(); -extern void sub_8086854(); -extern void sub_80867F4(); -extern void sub_8086838(u32, u32, u32); +extern u32 sub_8085EC8(u32, u32, u32, Position *, u32); extern void sub_80426C8(u32, u32); extern void sub_807EAA0(u32, u32); extern void CreateJirachiWishWarpTile(void); -extern void sub_8086794(); void EnteiScreenFlash(void); void RaikouScreenFlash(void); -void sub_808A528(struct Entity * param_1); +void sub_808A528(Entity * param_1); void SuicuneScreenFlash(); -void HoOhDropInEffect(struct Entity * param_1); +void HoOhDropInEffect(Entity * param_1); void HoOhScreenFlash(void); void LatiosScreenFlash(void); -void SetupRegiFacingDirection(struct Entity *r0); -void SetupRegirockFightHP(struct Entity *r0); -void SetupRegiceFightHP(struct Entity *r0); -void SetupRegisteelFightHP(struct Entity *r0); +void SetupRegiFacingDirection(Entity *r0); +void SetupRegirockFightHP(Entity *r0); +void SetupRegiceFightHP(Entity *r0); +void SetupRegisteelFightHP(Entity *r0); void sub_808B50C(void); -void MewtwoDropInEffect(struct Entity *param_1); +void MewtwoDropInEffect(Entity *param_1); void MewtwoScreenFlash(void); -void sub_80898F8(struct Entity *r0); -void sub_8089908(struct Entity *r0); -void RayquazaDropInEffect(struct Entity *param_1); +void sub_80898F8(Entity *r0); +void sub_8089908(Entity *r0); +void RayquazaDropInEffect(Entity *param_1); void RayquazaScreenFlash(void); void sub_80891F0(void); void sub_8089294(void); @@ -441,98 +424,86 @@ void GroudonScreenFlash2(void); extern u8 sub_8086AE4(u32); -extern void sub_8072008(struct Entity *, struct Entity *, s16, u32, u32); -extern void sub_80869E4(struct Entity *, u32, u32, u32); -extern void sub_806CDD4(struct Entity *, u32, u32); +extern void sub_8072008(Entity *, Entity *, s16, u32, u32); extern void sub_8085374(); -extern void sub_8086848(u32 ,u32); -extern void sub_80856C8(struct Entity *, s32, s32); -extern void sub_8086738(); -extern void sub_8086A54(struct Entity *); -extern void sub_8086764(); +extern void sub_80856C8(Entity *, s32, s32); +extern void sub_8086A54(Entity *); extern void sub_803F878(u32,s32); -void SceneGroudonMovement(struct Entity * param_1); +void SceneGroudonMovement(Entity * param_1); void GroudonScreenFlash(void); void ArticunoScreenFlash(void); -void sub_8088484(struct Entity *param_1); +void sub_8088484(Entity *param_1); void sub_8088574(void); -void MoltresDropInEffect(struct Entity * param_1); +void MoltresDropInEffect(Entity * param_1); void MoltresScreenFlash1(s32 r0, s32 r1); void MoltresScreenFlash2(s32 r0, s32 r1); void MoltresScreenFlash3(void); -void sub_808654C(void); - -extern void sub_8086598(); -extern void sub_80865E8(); -extern void sub_8086500(void); -extern void sub_8086690(void); void MoltresScreenDarken(void); -extern void sub_808663C(void); -void ZapdosDropInEffect(struct Entity *param_1); +void ZapdosDropInEffect(Entity *param_1); void ZapdosScreenFlash(int param_1); -extern s32 sub_8052C68(u32, u8 *, u32 *, u32); +extern s32 sub_8052C68(u32, const u8 *, const u8 *, u32); extern void sub_80861A8(void); -extern void sub_8045C28(struct Item *, u8 , u8 *); +extern void sub_8045C28(Item *, u8 , u8 *); extern void EnableJirachiWishWarpTile(void); -extern void sub_808BB3C(struct Position *); -extern void sub_8046860(struct Entity *, struct Position *, struct Item *, u32); +extern void sub_808BB3C(Position *); +extern void sub_8046860(Entity *, Position *, Item *, u32); extern u32 sub_803D73C(u32); void ZapdosReFightDialogue(void) { - struct Entity *LeaderEntity; - struct Entity *ZapdosEntity; + Entity *LeaderEntity; + Entity *ZapdosEntity; LeaderEntity = xxx_call_GetLeader(); ZapdosEntity = GetEntityFromClientType(8); sub_8086448(); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gZapdosReFightDialogue_1); + DisplayDungeonDialogue(gZapdosReFightDialogue_1); sub_803E708(10,0x46); PlaySoundEffect(0x1da); - DisplayDungeonDialogue(&gUnknown_81015A0); + DisplayDungeonDialogue(gUnknown_81015A0); sub_803E708(10,0x46); ZapdosDropInEffect(ZapdosEntity); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gZapdosReFightDialogue_2); + DisplayDungeonDialogue(gZapdosReFightDialogue_2); ZapdosScreenFlash(1); - DisplayDungeonDialogue(&gZapdosReFightDialogue_3); + DisplayDungeonDialogue(gZapdosReFightDialogue_3); ZapdosScreenFlash(2); - DisplayDungeonDialogue(&gZapdosReFightDialogue_4); + DisplayDungeonDialogue(gZapdosReFightDialogue_4); SetupBossFightHP(ZapdosEntity,300,MUS_BOSS_BATTLE); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); } void ZapdosPostStoryPreFightDialogue(void) { - struct Entity * LeaderEntity; - struct Entity * ZapdosEntity; + Entity * LeaderEntity; + Entity * ZapdosEntity; LeaderEntity = xxx_call_GetLeader(); ZapdosEntity = GetEntityFromClientType(8); sub_8086448(); if (sub_8086AE4(MONSTER_ZAPDOS)) { - sub_80866C4(&gZapdosPostStoryPreFightDialogue_6); + sub_80866C4(gZapdosPostStoryPreFightDialogue_6); } else { ZapdosScreenFlash(1); PlaySoundEffect(0x1da); - DisplayDungeonDialogue(&gZapdosPostStoryPreFightDialogue_1); + DisplayDungeonDialogue(gZapdosPostStoryPreFightDialogue_1); ZapdosDropInEffect(ZapdosEntity); - DisplayDungeonDialogue(&gZapdosPostStoryPreFightDialogue_2); + DisplayDungeonDialogue(gZapdosPostStoryPreFightDialogue_2); ZapdosScreenFlash(1); - DisplayDungeonDialogue(&gZapdosPostStoryPreFightDialogue_3); + DisplayDungeonDialogue(gZapdosPostStoryPreFightDialogue_3); ZapdosScreenFlash(2); - DisplayDungeonDialogue(&gZapdosPostStoryPreFightDialogue_4); + DisplayDungeonDialogue(gZapdosPostStoryPreFightDialogue_4); ZapdosScreenFlash(2); - DisplayDungeonDialogue(&gZapdosPostStoryPreFightDialogue_5); + DisplayDungeonDialogue(gZapdosPostStoryPreFightDialogue_5); sub_803E708(10,0x46); SetupBossFightHP(ZapdosEntity,300,MUS_BOSS_BATTLE); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); @@ -540,7 +511,7 @@ void ZapdosPostStoryPreFightDialogue(void) } -void ZapdosDropInEffect(struct Entity *zapdosEntity) +void ZapdosDropInEffect(Entity *zapdosEntity) { int iVar1; @@ -590,8 +561,8 @@ void ZapdosScreenFlash(s32 numFlashes) void sub_80877E8(void) { - struct Entity * LeaderEntity; - struct Entity * MoltresEntity; + Entity * LeaderEntity; + Entity * MoltresEntity; LeaderEntity = xxx_call_GetLeader(); MoltresEntity = GetEntityFromClientType(9); @@ -608,8 +579,8 @@ void sub_80877E8(void) void sub_8087848(void) { - struct Entity *LeaderEntity; - struct Entity *MoltresEntity; + Entity *LeaderEntity; + Entity *MoltresEntity; u32 XPos; s32 YPos; @@ -645,9 +616,9 @@ void sub_80878F4(u8 param_1, u8 param_2) void MoltresPreFightDialogue(void) { - struct Entity *LeaderEntity; - struct Entity *PartnerEntity; - struct Entity *MoltresEntity; + Entity *LeaderEntity; + Entity *PartnerEntity; + Entity *MoltresEntity; LeaderEntity = xxx_call_GetLeader(); PartnerEntity = GetPartnerEntity(); @@ -655,25 +626,25 @@ void MoltresPreFightDialogue(void) MoltresScreenFlash1(0xc,5); sub_8086500(); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gMoltresPreFightDialogue_1); + DisplayDungeonDialogue(gMoltresPreFightDialogue_1); sub_803E708(10,0x46); sub_80869E4(PartnerEntity,4,1,5); sub_803E708(4,0x46); SpriteLookAroundEffect(PartnerEntity); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gMoltresPreFightDialogue_2); + DisplayDungeonDialogue(gMoltresPreFightDialogue_2); sub_803E708(10,0x46); MoltresScreenFlash1(0xc,5); MoltresScreenFlash2(9,5); - DisplayDungeonDialogue(&gMoltresPreFightDialogue_3); + DisplayDungeonDialogue(gMoltresPreFightDialogue_3); sub_803E708(10,0x46); sub_80869E4(PartnerEntity,4,1,2); sub_80869E4(LeaderEntity,4,2,6); - DisplayDungeonDialogue(&gMoltresPreFightDialogue_4); + DisplayDungeonDialogue(gMoltresPreFightDialogue_4); sub_803E708(10,0x46); sub_80869E4(PartnerEntity,4,2,6); sub_8086690(); - DisplayDungeonDialogue(&gMoltresPreFightDialogue_5); + DisplayDungeonDialogue(gMoltresPreFightDialogue_5); sub_803E708(10,0x46); sub_8085930(DIRECTION_NORTHWEST); sub_803E708(4,0x46); @@ -681,32 +652,32 @@ void MoltresPreFightDialogue(void) PlaySoundEffect(0x2f2); DungeonStopBGM(); MoltresScreenDarken(); - DisplayDungeonDialogue(&gMoltresPreFightDialogue_6); + DisplayDungeonDialogue(gMoltresPreFightDialogue_6); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gMoltresPreFightDialogue_7); + DisplayDungeonDialogue(gMoltresPreFightDialogue_7); sub_803E708(10,0x46); PlaySoundEffect(0x1cf); sub_80856E0(PartnerEntity, DIRECTION_NORTH); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gMoltresPreFightDialogue_8); + DisplayDungeonDialogue(gMoltresPreFightDialogue_8); sub_803E708(10,0x46); MoltresScreenFlash3(); PlaySoundEffect(0x1da); - DisplayDungeonDialogue(&gMoltresPreFightDialogue_9); + DisplayDungeonDialogue(gMoltresPreFightDialogue_9); sub_803E708(10,0x46); MoltresScreenFlash1(9,5); MoltresScreenFlash2(0xb,5); - DisplayDungeonDialogue(&gMoltresPreFightDialogue_10); + DisplayDungeonDialogue(gMoltresPreFightDialogue_10); sub_803E708(10,0x46); MoltresScreenFlash1(0xc,5); MoltresScreenFlash2(9,5); MoltresDropInEffect(MoltresEntity); sub_808663C(); MoltresScreenFlash3(); - DisplayDungeonDialogue(&gMoltresPreFightDialogue_11); + DisplayDungeonDialogue(gMoltresPreFightDialogue_11); sub_803E708(10,0x46); MoltresScreenFlash2(0xb,6); - DisplayDungeonDialogue(&gMoltresPreFightDialogue_12); + DisplayDungeonDialogue(gMoltresPreFightDialogue_12); sub_803E708(10,0x46); SetupBossFightHP(MoltresEntity,400,MUS_BOSS_BATTLE); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); @@ -715,9 +686,9 @@ void MoltresPreFightDialogue(void) void MoltresReFightDialogue(void) { - struct Entity *LeaderEntity; - struct Entity *PartnerEntity; - struct Entity *MoltresEntity; + Entity *LeaderEntity; + Entity *PartnerEntity; + Entity *MoltresEntity; LeaderEntity = xxx_call_GetLeader(); PartnerEntity = GetPartnerEntity(); @@ -727,11 +698,11 @@ void MoltresReFightDialogue(void) sub_803E708(10,0x46); SpriteLookAroundEffect(PartnerEntity); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gMoltresReFightDialogue_1); + DisplayDungeonDialogue(gMoltresReFightDialogue_1); sub_803E708(10,0x46); sub_80869E4(PartnerEntity,4,1,2); sub_80869E4(LeaderEntity,4,2,6); - DisplayDungeonDialogue(&gMoltresReFightDialogue_2); + DisplayDungeonDialogue(gMoltresReFightDialogue_2); sub_803E708(10,0x46); sub_80869E4(PartnerEntity,4,2,6); sub_80869E4(LeaderEntity,4,2,6); @@ -744,12 +715,12 @@ void MoltresReFightDialogue(void) MoltresDropInEffect(MoltresEntity); sub_808663C(); MoltresScreenFlash3(); - DisplayDungeonDialogue(&gMoltresReFightDialogue_3); + DisplayDungeonDialogue(gMoltresReFightDialogue_3); sub_803E708(10,0x46); MoltresScreenFlash2(0xb,6); - DisplayDungeonDialogue(&gMoltresReFightDialogue_4); + DisplayDungeonDialogue(gMoltresReFightDialogue_4); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gMoltresReFightDialogue_5); + DisplayDungeonDialogue(gMoltresReFightDialogue_5); sub_803E708(10,0x46); SetupBossFightHP(MoltresEntity,400,MUS_BOSS_BATTLE); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); @@ -757,8 +728,8 @@ void MoltresReFightDialogue(void) void MoltresPostStoryPreFightDialogue(void) { - struct Entity * LeaderEntity; - struct Entity * MoltresEntity; + Entity * LeaderEntity; + Entity * MoltresEntity; LeaderEntity = xxx_call_GetLeader(); MoltresEntity = GetEntityFromClientType(9); @@ -770,31 +741,31 @@ void MoltresPostStoryPreFightDialogue(void) sub_8085930(DIRECTION_NORTH); sub_803E708(4,0x46); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gUnknown_8100D3C); + DisplayDungeonDialogue(gUnknown_8100D3C); sub_803E708(10,0x46); gDungeon->unk2 = 1; } else { - DisplayDungeonDialogue(&gMoltresPostStoryPreFightDialogue_1); + DisplayDungeonDialogue(gMoltresPostStoryPreFightDialogue_1); sub_8085930(DIRECTION_NORTHWEST); sub_803E708(4,0x46); sub_8085930(DIRECTION_NORTH); MoltresDropInEffect(MoltresEntity); - DisplayDungeonDialogue(&gMoltresPostStoryPreFightDialogue_2); + DisplayDungeonDialogue(gMoltresPostStoryPreFightDialogue_2); MoltresScreenFlash1(0xc,5); MoltresScreenFlash2(9,5); - DisplayDungeonDialogue(&gMoltresPostStoryPreFightDialogue_3); + DisplayDungeonDialogue(gMoltresPostStoryPreFightDialogue_3); MoltresScreenFlash3(); - DisplayDungeonDialogue(&gMoltresPostStoryPreFightDialogue_4); + DisplayDungeonDialogue(gMoltresPostStoryPreFightDialogue_4); MoltresScreenFlash2(0xb,6); - DisplayDungeonDialogue(&gMoltresPostStoryPreFightDialogue_5); + DisplayDungeonDialogue(gMoltresPostStoryPreFightDialogue_5); sub_803E708(10,0x46); SetupBossFightHP(MoltresEntity,400,MUS_BOSS_BATTLE); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); } } -void MoltresDropInEffect(struct Entity * moltresEntity) +void MoltresDropInEffect(Entity * moltresEntity) { s32 iVar1; @@ -999,8 +970,8 @@ void MoltresScreenDarken(void) void sub_8087F54(void) { - struct Entity *LeaderEntity; - struct Entity *ArticunoEntity; + Entity *LeaderEntity; + Entity *ArticunoEntity; LeaderEntity = xxx_call_GetLeader(); ArticunoEntity = GetEntityFromClientType(0xd); @@ -1017,7 +988,7 @@ void sub_8087F54(void) void sub_8087FB4(void) { - struct Entity *ArticunoEntity; + Entity *ArticunoEntity; ArticunoEntity = GetEntityFromClientType(0xd); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); @@ -1031,8 +1002,8 @@ void sub_8087FB4(void) void sub_8087FF8(void) { - struct Entity *LeaderEntity; - struct Entity *ArticunoEntity; + Entity *LeaderEntity; + Entity *ArticunoEntity; LeaderEntity = xxx_call_GetLeader(); ArticunoEntity = GetEntityFromClientType(0xd); @@ -1062,24 +1033,24 @@ void sub_8088088(u8 param_1, u8 param_2) void ArticunoPreFightDialogue(void) { - struct Entity *LeaderEntity; - struct Entity *PartnerEntity; - struct Entity *ArticunoEntity; + Entity *LeaderEntity; + Entity *PartnerEntity; + Entity *ArticunoEntity; LeaderEntity = xxx_call_GetLeader(); PartnerEntity = GetPartnerEntity(); ArticunoEntity = GetEntityFromClientType(0xd); sub_8086448(); SpriteLookAroundEffect(PartnerEntity); - DisplayDungeonDialogue(&gArticunoPreFightDialogue_1); + DisplayDungeonDialogue(gArticunoPreFightDialogue_1); sub_803E708(10,0x46); sub_8086598(); DungeonStopBGM(); - DisplayDungeonDialogue(&gArticunoPreFightDialogue_2); + DisplayDungeonDialogue(gArticunoPreFightDialogue_2); sub_803E708(10,0x46); sub_80869E4(PartnerEntity,4,1,2); sub_80869E4(LeaderEntity,4,2,6); - DisplayDungeonDialogue(&gArticunoPreFightDialogue_3); + DisplayDungeonDialogue(gArticunoPreFightDialogue_3); sub_803E708(10,0x46); SetFacingDirection(LeaderEntity, DIRECTION_WEST); sub_803E708(4,0x46); @@ -1095,9 +1066,9 @@ void ArticunoPreFightDialogue(void) sub_803E708(4,0x46); SetFacingDirection(LeaderEntity, DIRECTION_WEST); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gArticunoPreFightDialogue_4); + DisplayDungeonDialogue(gArticunoPreFightDialogue_4); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gArticunoPreFightDialogue_5); + DisplayDungeonDialogue(gArticunoPreFightDialogue_5); sub_803E708(10,0x46); sub_80869E4(LeaderEntity,4,1,4); sub_80869E4(PartnerEntity,4,2,4); @@ -1105,33 +1076,33 @@ void ArticunoPreFightDialogue(void) SpriteLookAroundEffect(PartnerEntity); PlaySoundEffect(0x1d5); SpriteLookAroundEffect(LeaderEntity); - DisplayDungeonDialogue(&gArticunoPreFightDialogue_6); + DisplayDungeonDialogue(gArticunoPreFightDialogue_6); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gArticunoPreFightDialogue_7); + DisplayDungeonDialogue(gArticunoPreFightDialogue_7); sub_803E708(10,0x46); PlaySoundEffect(0); // snow flurry gDungeon->unkE265 = WEATHER_SNOW; sub_807EAA0(0,1); PlaySoundEffect(0x1ee); // flash effect? sub_8088574(); - DisplayDungeonDialogue(&gArticunoPreFightDialogue_8); + DisplayDungeonDialogue(gArticunoPreFightDialogue_8); sub_803E708(10,0x46); ArticunoScreenFlash(); sub_8086738(); PlaySoundEffect(0x1da); - DisplayDungeonDialogue(&gArticunoPreFightDialogue_9); + DisplayDungeonDialogue(gArticunoPreFightDialogue_9); sub_803E708(10,0x46); PlaySoundEffect(0x1ea); sub_8088484(ArticunoEntity); sub_80865E8(); ArticunoScreenFlash(); - DisplayDungeonDialogue(&gArticunoPreFightDialogue_10); + DisplayDungeonDialogue(gArticunoPreFightDialogue_10); sub_806CDD4(ArticunoEntity,0xf,DIRECTION_SOUTH); ArticunoScreenFlash(); - DisplayDungeonDialogue(&gArticunoPreFightDialogue_11); + DisplayDungeonDialogue(gArticunoPreFightDialogue_11); sub_806CDD4(ArticunoEntity,0x10,DIRECTION_SOUTH); ArticunoScreenFlash(); - DisplayDungeonDialogue(&gArticunoPreFightDialogue_12); + DisplayDungeonDialogue(gArticunoPreFightDialogue_12); sub_806CDD4(ArticunoEntity,0xf,DIRECTION_SOUTH); sub_803E708(0x10,0x46); SetupBossFightHP(ArticunoEntity,0x1c2,MUS_BOSS_BATTLE); @@ -1140,20 +1111,20 @@ void ArticunoPreFightDialogue(void) void ArticunoReFightDialogue(void) { - struct Entity *LeaderEntity; - struct Entity *ArticunoEntity; + Entity *LeaderEntity; + Entity *ArticunoEntity; LeaderEntity = xxx_call_GetLeader(); ArticunoEntity = GetEntityFromClientType(0xd); gDungeon->unkE265 = WEATHER_SNOW; sub_807EAA0(0,1); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gArticunoReFightDialogue_1); + DisplayDungeonDialogue(gArticunoReFightDialogue_1); sub_806CDD4(ArticunoEntity,0x10,DIRECTION_SOUTH); ArticunoScreenFlash(); - DisplayDungeonDialogue(&gArticunoReFightDialogue_2); + DisplayDungeonDialogue(gArticunoReFightDialogue_2); ArticunoScreenFlash(); - DisplayDungeonDialogue(&gArticunoReFightDialogue_3); + DisplayDungeonDialogue(gArticunoReFightDialogue_3); sub_806CDD4(ArticunoEntity,0xf,DIRECTION_SOUTH); sub_803E708(0x28,0x46); SetupBossFightHP(ArticunoEntity,0x1c2,MUS_BOSS_BATTLE); @@ -1162,14 +1133,14 @@ void ArticunoReFightDialogue(void) void ArticunoPostStoryPreFightDialogue(void) { - struct Entity *LeaderEntity; - struct Entity *ArticunoEntity; + Entity *LeaderEntity; + Entity *ArticunoEntity; LeaderEntity = xxx_call_GetLeader(); ArticunoEntity = GetEntityFromClientType(0xd); sub_8086448(); if (sub_8086AE4(MONSTER_ARTICUNO)) { - sub_80866C4(&gUnknown_8102A9C); + sub_80866C4(gUnknown_8102A9C); } else { gDungeon->unkE265 = WEATHER_SNOW; @@ -1177,19 +1148,19 @@ void ArticunoPostStoryPreFightDialogue(void) ArticunoScreenFlash(); sub_8086738(); PlaySoundEffect(0x1da); - DisplayDungeonDialogue(&gArticunoPostStoryPreFightDialogue_1); + DisplayDungeonDialogue(gArticunoPostStoryPreFightDialogue_1); sub_803E708(10,0x46); sub_8088484(ArticunoEntity); ArticunoScreenFlash(); - DisplayDungeonDialogue(&gArticunoPostStoryPreFightDialogue_2); + DisplayDungeonDialogue(gArticunoPostStoryPreFightDialogue_2); sub_806CDD4(ArticunoEntity,0xf,DIRECTION_SOUTH); ArticunoScreenFlash(); - DisplayDungeonDialogue(&gArticunoPostStoryPreFightDialogue_3); + DisplayDungeonDialogue(gArticunoPostStoryPreFightDialogue_3); sub_806CDD4(ArticunoEntity,0x10,DIRECTION_SOUTH); ArticunoScreenFlash(); - DisplayDungeonDialogue(&gArticunoPostStoryPreFightDialogue_4); + DisplayDungeonDialogue(gArticunoPostStoryPreFightDialogue_4); ArticunoScreenFlash(); - DisplayDungeonDialogue(&gArticunoPostStoryPreFightDialogue_5); + DisplayDungeonDialogue(gArticunoPostStoryPreFightDialogue_5); sub_806CDD4(ArticunoEntity,0xf,DIRECTION_SOUTH); sub_803E708(0x28,0x46); SetupBossFightHP(ArticunoEntity,0x1c2,MUS_BOSS_BATTLE); @@ -1197,7 +1168,7 @@ void ArticunoPostStoryPreFightDialogue(void) } } -void sub_8088484(struct Entity *param_1) +void sub_8088484(Entity *param_1) { int iVar1; @@ -1259,7 +1230,7 @@ void sub_80885A0(void) void sub_80885C4(void) { - struct Entity * LeaderEntity; + Entity * LeaderEntity; LeaderEntity = xxx_call_GetLeader(); DungeonFadeOutBGM(0x3c); @@ -1282,14 +1253,14 @@ void sub_8088618(void) // The mountain's summit... // But there is no one here // It's time to go back - sub_80866C4(&gUnknown_8102B10); + sub_80866C4(gUnknown_8102B10); } void sub_808862C(void) { - struct Entity * LeaderEntity; - struct Entity * AlakazamEntity; - struct Entity * GroudonEntity; + Entity * LeaderEntity; + Entity * AlakazamEntity; + Entity * GroudonEntity; LeaderEntity = xxx_call_GetLeader(); AlakazamEntity = GetEntityFromClientType(10); @@ -1311,9 +1282,9 @@ void sub_808862C(void) void sub_80886C4(void) { - struct Entity * LeaderEntity; - struct Entity * AlakazamEntity; - struct Entity * GroudonEntity; + Entity * LeaderEntity; + Entity * AlakazamEntity; + Entity * GroudonEntity; u32 XPos; s32 YPos; @@ -1339,9 +1310,9 @@ void sub_80886C4(void) void sub_808875C(void) { - struct Entity * LeaderEntity; - struct Entity * AlakazamEntity; - struct Entity * GroudonEntity; + Entity * LeaderEntity; + Entity * AlakazamEntity; + Entity * GroudonEntity; LeaderEntity = xxx_call_GetLeader(); AlakazamEntity = GetEntityFromClientType(10); @@ -1379,41 +1350,41 @@ void sub_8088848(void) void GroudonPreFightDialogue(void) { - struct Entity * LeaderEntity; - struct Entity * PartnerEntity; - struct Entity * AlakazamEntity; - struct Entity * GroudonEntity; + Entity * LeaderEntity; + Entity * PartnerEntity; + Entity * AlakazamEntity; + Entity * GroudonEntity; LeaderEntity = xxx_call_GetLeader(); PartnerEntity = GetPartnerEntity(); AlakazamEntity = GetEntityFromClientType(10); GroudonEntity = GetEntityFromClientType(0xe); sub_8086448(); - DisplayDungeonDialogue(&GroudonPreFightDialogue_1); + DisplayDungeonDialogue(GroudonPreFightDialogue_1); sub_803E708(10,0x46); sub_803E708(0x3c,0x46); - DisplayDungeonDialogue(&GroudonPreFightDialogue_2); + DisplayDungeonDialogue(GroudonPreFightDialogue_2); sub_803E708(10,0x46); sub_8086838(1,1,1); sub_808680C(); sub_803E708(0x3c,0x46); sub_808682C(); sub_803E708(0x1e,0x46); - DisplayDungeonDialogue(&GroudonPreFightDialogue_3); + DisplayDungeonDialogue(GroudonPreFightDialogue_3); sub_803E708(10,0x46); sub_8086838(1,1,1); sub_808680C(); sub_803E708(0x3c,0x46); - DisplayDungeonDialogue(&GroudonPreFightDialogue_4); + DisplayDungeonDialogue(GroudonPreFightDialogue_4); sub_803E708(10,0x46); GroudonScreenFlash(); - DisplayDungeonDialogue(&GroudonPreFightDialogue_5); + DisplayDungeonDialogue(GroudonPreFightDialogue_5); sub_803E708(10,0x46); - DisplayDungeonDialogue(&GroudonPreFightDialogue_6); + DisplayDungeonDialogue(GroudonPreFightDialogue_6); sub_803E708(10,0x46); PlaySoundEffect(0x1d5); SpriteLookAroundEffect(PartnerEntity); - DisplayDungeonDialogue(&GroudonPreFightDialogue_7); + DisplayDungeonDialogue(GroudonPreFightDialogue_7); sub_803E708(10,0x46); sub_808682C(); sub_803E708(0x3c,0x46); @@ -1421,28 +1392,28 @@ void GroudonPreFightDialogue(void) PlaySoundEffect(0x205); sub_8086738(); sub_8068FE0(AlakazamEntity,0x21c,0); - DisplayDungeonDialogue(&GroudonPreFightDialogue_8); + DisplayDungeonDialogue(GroudonPreFightDialogue_8); sub_803E708(10,0x46); - DisplayDungeonDialogue(&GroudonPreFightDialogue_9); + DisplayDungeonDialogue(GroudonPreFightDialogue_9); sub_803E708(10,0x46); sub_8085930(DIRECTION_NORTH); sub_8086764(); sub_803E708(0x28,0x46); PlaySoundEffect(0x1d5); SpriteLookAroundEffect(PartnerEntity); - DisplayDungeonDialogue(&GroudonPreFightDialogue_10); + DisplayDungeonDialogue(GroudonPreFightDialogue_10); sub_803E708(10,0x46); sub_8086838(1,1,1); sub_808680C(); sub_803E708(0x3c,0x46); - DisplayDungeonDialogue(&GroudonPreFightDialogue_11); + DisplayDungeonDialogue(GroudonPreFightDialogue_11); sub_803E708(10,0x46); DungeonStopBGM(); GroudonScreenFlash2(); sub_803E708(0x1e,0x46); - DisplayDungeonDialogue(&GroudonPreFightDialogue_12); + DisplayDungeonDialogue(GroudonPreFightDialogue_12); sub_803E708(10,0x46); - DisplayDungeonDialogue(&GroudonPreFightDialogue_13); + DisplayDungeonDialogue(GroudonPreFightDialogue_13); sub_803E708(10,0x46); sub_803E708(0x1e,0x46); sub_808682C(); @@ -1450,7 +1421,7 @@ void GroudonPreFightDialogue(void) PlaySoundEffect(0x1fa); sub_8086738(); sub_8085930(DIRECTION_NORTH); - DisplayDungeonDialogue(&GroudonPreFightDialogue_14); + DisplayDungeonDialogue(GroudonPreFightDialogue_14); sub_803E708(10,0x46); sub_8086A54(GroudonEntity); sub_8085930(DIRECTION_NORTH); @@ -1461,28 +1432,28 @@ void GroudonPreFightDialogue(void) void GroudonReFightDialogue(void) { - struct Entity * LeaderEntity; - struct Entity * GroudonEntity; + Entity * LeaderEntity; + Entity * GroudonEntity; LeaderEntity = xxx_call_GetLeader(); GroudonEntity = GetEntityFromClientType(0xe); sub_8086838(1,1,1); sub_808680C(); sub_803E708(0x3c,0x46); - DisplayDungeonDialogue(&gGroudonReFightDialogue_1); + DisplayDungeonDialogue(gGroudonReFightDialogue_1); sub_803E708(10,0x46); GroudonScreenFlash(); sub_803E708(0x1e,0x46); - DisplayDungeonDialogue(&gGroudonReFightDialogue_2); + DisplayDungeonDialogue(gGroudonReFightDialogue_2); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gGroudonReFightDialogue_3); + DisplayDungeonDialogue(gGroudonReFightDialogue_3); sub_803E708(10,0x46); sub_808682C(); sub_803E708(0x3c,0x46); DungeonStopBGM(); PlaySoundEffect(0x1fa); sub_8086738(); - DisplayDungeonDialogue(&gGroudonReFightDialogue_4); + DisplayDungeonDialogue(gGroudonReFightDialogue_4); sub_803E708(10,0x46); sub_8086A54(GroudonEntity); sub_8085930(DIRECTION_NORTH); @@ -1493,27 +1464,27 @@ void GroudonReFightDialogue(void) void GroudonPostStoryPreFightDialogue(void) { - struct Entity * LeaderEntity; - struct Entity * GroudonEntity; + Entity * LeaderEntity; + Entity * GroudonEntity; LeaderEntity = xxx_call_GetLeader(); GroudonEntity = GetEntityFromClientType(0xe); sub_8086448(); if (sub_8086AE4(MONSTER_GROUDON)) { - sub_80866C4(&gUnknown_8103488); + sub_80866C4(gUnknown_8103488); } else{ - DisplayDungeonDialogue(&gGroudonPostStoryPreFightDialogue_1); + DisplayDungeonDialogue(gGroudonPostStoryPreFightDialogue_1); sub_803E708(10,0x46); SceneGroudonMovement(GroudonEntity); SceneGroudonMovement(GroudonEntity); - DisplayDungeonDialogue(&gGroudonPostStoryPreFightDialogue_2); + DisplayDungeonDialogue(gGroudonPostStoryPreFightDialogue_2); PlaySoundEffect(0x1f6); GroudonScreenFlash(); - DisplayDungeonDialogue(&gGroudonPostStoryPreFightDialogue_3); + DisplayDungeonDialogue(gGroudonPostStoryPreFightDialogue_3); PlaySoundEffect(0x1f6); GroudonScreenFlash(); - DisplayDungeonDialogue(&gGroudonPostStoryPreFightDialogue_4); + DisplayDungeonDialogue(gGroudonPostStoryPreFightDialogue_4); sub_803E708(10,0x46); SetupBossFightHP(GroudonEntity,500,MUS_BOSS_BATTLE); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); @@ -1521,7 +1492,7 @@ void GroudonPostStoryPreFightDialogue(void) } // Moves Groudon down in a walking fashion -void SceneGroudonMovement(struct Entity * GroudonEntity) +void SceneGroudonMovement(Entity * GroudonEntity) { int iVar1; @@ -1604,9 +1575,9 @@ void GroudonScreenFlash2(void) void sub_8088DC0(void) { - struct Entity * LeaderEntity; - struct Entity * uVar2; - struct Entity * uVar3; + Entity * LeaderEntity; + Entity * uVar2; + Entity * uVar3; LeaderEntity = xxx_call_GetLeader(); uVar2 = GetEntityFromClientType(0xb); @@ -1628,9 +1599,9 @@ void sub_8088DC0(void) void sub_8088E5C(void) { - struct Entity * LeaderEntity; - struct Entity * uVar2; - struct Entity * uVar3; + Entity * LeaderEntity; + Entity * uVar2; + Entity * uVar3; LeaderEntity = xxx_call_GetLeader(); uVar2 = GetEntityFromClientType(0xb); @@ -1655,12 +1626,12 @@ void sub_8088EE8(void) void MagmaCavernMidDialogue(void) { - struct Entity * LeaderEntity; - struct Entity * PartnerEntity; - struct Entity * iVar3; - struct Entity * iVar4; + Entity * LeaderEntity; + Entity * PartnerEntity; + Entity * iVar3; + Entity * iVar4; s16 IDStack [2]; - struct Position32 local_20; + Position32 local_20; LeaderEntity = xxx_call_GetLeader(); PartnerEntity = GetPartnerEntity(); @@ -1671,7 +1642,7 @@ void MagmaCavernMidDialogue(void) SpriteLookAroundEffect(PartnerEntity); // Let's see.. // I wonder where we are? - DisplayDungeonDialogue(&MagmaCavernMidDialogue_1); + DisplayDungeonDialogue(MagmaCavernMidDialogue_1); sub_803E708(10,0x46); sub_80869E4(PartnerEntity,4,1,2); sub_80869E4(LeaderEntity,4,2,6); @@ -1680,7 +1651,7 @@ void MagmaCavernMidDialogue(void) // // I'm certain we've come quite // far already.. - DisplayDungeonDialogue(&MagmaCavernMidDialogue_2); + DisplayDungeonDialogue(MagmaCavernMidDialogue_2); sub_803E708(10,0x46); DungeonStopBGM(); sub_80855E4(sub_80868F4); @@ -1689,7 +1660,7 @@ void MagmaCavernMidDialogue(void) sub_803E708(0x28,0x46); // Waaah! // Qu-quake! - DisplayDungeonDialogue(&MagmaCavernMidDialogue_3); + DisplayDungeonDialogue(MagmaCavernMidDialogue_3); sub_803E708(0x78,0x46); StopSoundEffect(0x1c5); sub_808682C(); @@ -1702,7 +1673,7 @@ void MagmaCavernMidDialogue(void) // // Whew // It's over. - DisplayDungeonDialogue(&MagmaCavernMidDialogue_4); + DisplayDungeonDialogue(MagmaCavernMidDialogue_4); sub_803E708(10,0x46); PlaySoundEffect(0x1d5); SpriteLookAroundEffect(PartnerEntity); @@ -1710,7 +1681,7 @@ void MagmaCavernMidDialogue(void) sub_80856E0(PartnerEntity, DIRECTION_NORTH); // Hey! {ARG_POKEMON_0}! // Over there! - DisplayDungeonDialogue(&MagmaCavernMidDialogue_5); + DisplayDungeonDialogue(MagmaCavernMidDialogue_5); iVar3->info->unk15E = 0; iVar4->info->unk15E =0; local_20.x = (iVar3->pixelPos.x + iVar4->pixelPos.x) / 2; @@ -1723,29 +1694,29 @@ void MagmaCavernMidDialogue(void) // // Hey! // Snap out of it! - DisplayDungeonDialogue(&MagmaCavernMidDialogue_6); + DisplayDungeonDialogue(MagmaCavernMidDialogue_6); sub_803E708(10,0x46); // Urrrrgh... - DisplayDungeonDialogue(&MagmaCavernMidDialogue_7); + DisplayDungeonDialogue(MagmaCavernMidDialogue_7); sub_803E708(10,0x46); sub_80869E4(LeaderEntity,4,2,5); // What happened to you? // // What happened here? - DisplayDungeonDialogue(&MagmaCavernMidDialogue_8); + DisplayDungeonDialogue(MagmaCavernMidDialogue_8); sub_803E708(10,0x46); // We challenged.. // {ARG_POKEMON_2}... // And wiped out.. - DisplayDungeonDialogue(&MagmaCavernMidDialogue_9); + DisplayDungeonDialogue(MagmaCavernMidDialogue_9); sub_803E708(10,0x46); - DisplayDungeonDialogue(&MagmaCavernMidDialogue_10); + DisplayDungeonDialogue(MagmaCavernMidDialogue_10); sub_803E708(10,0x46); sub_80869E4(LeaderEntity,4,1,3); sub_80869E4(PartnerEntity,4,1,3); // Grrgh.. // We... It crushed us - DisplayDungeonDialogue(&MagmaCavernMidDialogue_11); + DisplayDungeonDialogue(MagmaCavernMidDialogue_11); sub_803E708(10,0x46); PlaySoundEffect(0x1d5); SpriteLookAroundEffect(PartnerEntity); @@ -1756,27 +1727,27 @@ void MagmaCavernMidDialogue(void) // Wait... // What about {ARG_POKEMON_3}? // Where did {ARG_POKEMON_3} go? - DisplayDungeonDialogue(&MagmaCavernMidDialogue_12); + DisplayDungeonDialogue(MagmaCavernMidDialogue_12); sub_803E708(0x1e,0x46); // {ARG_POKEMON_3} is... // Still battling {ARG_POKEMON_2}... - DisplayDungeonDialogue(&MagmaCavernMidDialogue_13); + DisplayDungeonDialogue(MagmaCavernMidDialogue_13); sub_803E708(10,0x46); sub_80869E4(PartnerEntity,4,1,2); sub_80869E4(LeaderEntity,4,2,6); // {ARG_POKEMON_0}! // We've got to hurry! - DisplayDungeonDialogue(&MagmaCavernMidDialogue_14); + DisplayDungeonDialogue(MagmaCavernMidDialogue_14); sub_8089294(); // Be careful! - DisplayDungeonDialogue(&MagmaCavernMidDialogue_15); + DisplayDungeonDialogue(MagmaCavernMidDialogue_15); sub_803E708(10,0x46); gDungeon->unk2 = 1; } void sub_8089168(void) { - struct Entity *LeaderEntity; + Entity *LeaderEntity; LeaderEntity = xxx_call_GetLeader(); sub_8086448(); @@ -1786,19 +1757,19 @@ void sub_8089168(void) ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); } -void sub_808919C(struct Entity *r0) +void sub_808919C(Entity *r0) { IncreaseEntityPixelPos(r0, 0, 0xfffffe00); } -void sub_80891B0(struct Entity *r0) +void sub_80891B0(Entity *r0) { sub_806CDD4(r0, 0, DIRECTION_NORTH); r0->info->unk15F = 1; } -void sub_80891D0(struct Entity *r0) +void sub_80891D0(Entity *r0) { sub_806CDD4(r0, 7, DIRECTION_NORTH); r0->info->unk15F = 0; @@ -1817,7 +1788,7 @@ void sub_80891F0(void) sub_80855E4(sub_80891D0); } -void sub_8089224(struct Entity * entity) +void sub_8089224(Entity * entity) { s32 xPixelPos; @@ -1874,8 +1845,8 @@ void sub_8089294(void) void sub_80892C8(void) { - struct Entity * LeaderEntity; - struct Entity * RayquazaEntity; + Entity * LeaderEntity; + Entity * RayquazaEntity; LeaderEntity = xxx_call_GetLeader(); RayquazaEntity = GetEntityFromClientType(0xf); @@ -1892,8 +1863,8 @@ void sub_80892C8(void) void sub_8089328(void) { - struct Entity * LeaderEntity; - struct Entity * RayquazaEntity; + Entity * LeaderEntity; + Entity * RayquazaEntity; LeaderEntity = xxx_call_GetLeader(); RayquazaEntity = GetEntityFromClientType(0xf); @@ -1922,97 +1893,97 @@ void sub_80893B4(u8 param_1, u8 param_2) void RayquazaPreFightDialogue(void) { - struct Entity *LeaderEntity; - struct Entity *PartnerEntity; - struct Entity *RayquazaEntity; + Entity *LeaderEntity; + Entity *PartnerEntity; + Entity *RayquazaEntity; LeaderEntity = xxx_call_GetLeader(); PartnerEntity = GetPartnerEntity(); RayquazaEntity = GetEntityFromClientType(0xf); sub_8086448(); - DisplayDungeonDialogue(&gRayquazaPreFightDialogue_1); + DisplayDungeonDialogue(gRayquazaPreFightDialogue_1); RayquazaScreenFlash(); - DisplayDungeonDialogue(&gRayquazaPreFightDialogue_2); + DisplayDungeonDialogue(gRayquazaPreFightDialogue_2); sub_80856E0(PartnerEntity, DIRECTION_NORTH); SpriteLookAroundEffect(PartnerEntity); sub_803E708(10,0x46); sub_80869E4(PartnerEntity,4,1,2); sub_80869E4(LeaderEntity,4,2,6); - DisplayDungeonDialogue(&gRayquazaPreFightDialogue_3); + DisplayDungeonDialogue(gRayquazaPreFightDialogue_3); sub_80869E4(PartnerEntity,4,2,4); sub_80869E4(LeaderEntity,4,1,4); - DisplayDungeonDialogue(&gRayquazaPreFightDialogue_4); + DisplayDungeonDialogue(gRayquazaPreFightDialogue_4); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gRayquazaPreFightDialogue_5); + DisplayDungeonDialogue(gRayquazaPreFightDialogue_5); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gRayquazaPreFightDialogue_6); + DisplayDungeonDialogue(gRayquazaPreFightDialogue_6); RayquazaScreenFlash(); PlaySoundEffect(0x1da); // Rayquaza Cry - DisplayDungeonDialogue(&gRayquazaPreFightDialogue_7); + DisplayDungeonDialogue(gRayquazaPreFightDialogue_7); RayquazaDropInEffect(RayquazaEntity); - DisplayDungeonDialogue(&gRayquazaPreFightDialogue_8); + DisplayDungeonDialogue(gRayquazaPreFightDialogue_8); RayquazaScreenFlash(); - DisplayDungeonDialogue(&gRayquazaPreFightDialogue_9); + DisplayDungeonDialogue(gRayquazaPreFightDialogue_9); RayquazaScreenFlash(); - DisplayDungeonDialogue(&gRayquazaPreFightDialogue_10); + DisplayDungeonDialogue(gRayquazaPreFightDialogue_10); RayquazaScreenFlash(); - DisplayDungeonDialogue(&gRayquazaPreFightDialogue_11); + DisplayDungeonDialogue(gRayquazaPreFightDialogue_11); SetupBossFightHP(RayquazaEntity,600,MUS_BATTLE_WITH_RAYQUAZA); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); } void RayquazaReFightDialogue(void) { - struct Entity *LeaderEntity; - struct Entity *RayquazaEntity; + Entity *LeaderEntity; + Entity *RayquazaEntity; LeaderEntity = xxx_call_GetLeader(); RayquazaEntity = GetEntityFromClientType(0xf); sub_8086448(); RayquazaScreenFlash(); PlaySoundEffect(0x1da); // Rayquaza Cry - DisplayDungeonDialogue(&gRayquazaPreFightDialogue_7); + DisplayDungeonDialogue(gRayquazaPreFightDialogue_7); sub_803E708(10,0x46); RayquazaDropInEffect(RayquazaEntity); - DisplayDungeonDialogue(&gRayquazaReFightDialogue_1); + DisplayDungeonDialogue(gRayquazaReFightDialogue_1); RayquazaScreenFlash(); - DisplayDungeonDialogue(&gRayquazaReFightDialogue_2); + DisplayDungeonDialogue(gRayquazaReFightDialogue_2); RayquazaScreenFlash(); - DisplayDungeonDialogue(&gRayquazaReFightDialogue_3); + DisplayDungeonDialogue(gRayquazaReFightDialogue_3); RayquazaScreenFlash(); - DisplayDungeonDialogue(&gRayquazaReFightDialogue_4); + DisplayDungeonDialogue(gRayquazaReFightDialogue_4); SetupBossFightHP(RayquazaEntity,600,MUS_BATTLE_WITH_RAYQUAZA); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); } void RayquazaPostStoryPreFightDialogue(void) { - struct Entity *LeaderEntity; - struct Entity *RayquazaEntity; + Entity *LeaderEntity; + Entity *RayquazaEntity; LeaderEntity = xxx_call_GetLeader(); RayquazaEntity = GetEntityFromClientType(0xf); sub_8086448(); if (sub_8086AE4(MONSTER_RAYQUAZA)) { - sub_80866C4(&gRayquazaPostStoryPreFightDialogue_6); + sub_80866C4(gRayquazaPostStoryPreFightDialogue_6); } else { PlaySoundEffect(0x1da); // Rayquaza Cry - DisplayDungeonDialogue(&gRayquazaPostStoryPreFightDialogue_1); + DisplayDungeonDialogue(gRayquazaPostStoryPreFightDialogue_1); RayquazaDropInEffect(RayquazaEntity); - DisplayDungeonDialogue(&gRayquazaPostStoryPreFightDialogue_2); + DisplayDungeonDialogue(gRayquazaPostStoryPreFightDialogue_2); RayquazaScreenFlash(); - DisplayDungeonDialogue(&gRayquazaPostStoryPreFightDialogue_3); + DisplayDungeonDialogue(gRayquazaPostStoryPreFightDialogue_3); RayquazaScreenFlash(); - DisplayDungeonDialogue(&gRayquazaPostStoryPreFightDialogue_4); + DisplayDungeonDialogue(gRayquazaPostStoryPreFightDialogue_4); RayquazaScreenFlash(); - DisplayDungeonDialogue(&gRayquazaPostStoryPreFightDialogue_5); + DisplayDungeonDialogue(gRayquazaPostStoryPreFightDialogue_5); SetupBossFightHP(RayquazaEntity,600,MUS_BOSS_BATTLE); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); } } -void RayquazaDropInEffect(struct Entity *rayquazaEntity) +void RayquazaDropInEffect(Entity *rayquazaEntity) { s32 iVar1; s32 iVar2; @@ -2063,7 +2034,7 @@ void RayquazaScreenFlash(void) void sub_808970C(void) { - struct Entity *LeaderEntity; + Entity *LeaderEntity; LeaderEntity = xxx_call_GetLeader(); DungeonStartNewBGM(MUS_TINY_WOODS); @@ -2076,7 +2047,7 @@ void sub_808970C(void) void sub_808974C(void) { - struct Entity *LeaderEntity; + Entity *LeaderEntity; LeaderEntity = xxx_call_GetLeader(); sub_80854D4(); @@ -2086,9 +2057,9 @@ void sub_808974C(void) sub_8085860(LeaderEntity->pos.x,LeaderEntity->pos.y + -3); } -void sub_8089788(struct Entity *entity, u8 param_2, u8 param_3) +void sub_8089788(Entity *entity, u8 param_2, u8 param_3) { - struct Entity *monEntity; + Entity *monEntity; s32 index; u32 unk1; @@ -2112,7 +2083,7 @@ void sub_8089788(struct Entity *entity, u8 param_2, u8 param_3) void sub_80897F0(void) { - struct Entity *LeaderEntity; + Entity *LeaderEntity; LeaderEntity = xxx_call_GetLeader(); sub_8086448(); @@ -2120,27 +2091,27 @@ void sub_80897F0(void) sub_808563C(SpriteShockEffect); sub_803E708(0x20,0x46); sub_808692C(); - DisplayDungeonDialogue(&gUnknown_8103BD8); + DisplayDungeonDialogue(gUnknown_8103BD8); // We don't like to brag or // nothing, but - DisplayDungeonDialogue(&gUnknown_8103C00); + DisplayDungeonDialogue(gUnknown_8103C00); // We get furious real easy // You know that?! - DisplayDungeonDialogue(&gUnknown_8103C3C); + DisplayDungeonDialogue(gUnknown_8103C3C); // What really irritates us is // when we see some dim witted face - DisplayDungeonDialogue(&gUnknown_8103C74); + DisplayDungeonDialogue(gUnknown_8103C74); // ......... // Wrooooooar! // That vacant expression - DisplayDungeonDialogue(&gUnknown_8103CC4); + DisplayDungeonDialogue(gUnknown_8103CC4); // Gwoooh // It's ticking me off! // I'm seeing red! - DisplayDungeonDialogue(&gUnknown_8103D0C); + DisplayDungeonDialogue(gUnknown_8103D0C); // Mukkkeeeeeh // Get 'em! It's frenzy time! - DisplayDungeonDialogue(&gUnknown_8103D50); + DisplayDungeonDialogue(gUnknown_8103D50); sub_803E708(10,0x46); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); } @@ -2149,7 +2120,7 @@ void sub_80897F0(void) void sub_8089878(void) { - struct Entity *LeaderEntity; + Entity *LeaderEntity; LeaderEntity = xxx_call_GetLeader(); sub_8086448(); @@ -2157,10 +2128,10 @@ void sub_8089878(void) sub_808563C(SpriteShockEffect); sub_803E708(0x20,0x46); sub_808692C(); - DisplayDungeonDialogue(&gUnknown_8103D8C); - DisplayDungeonDialogue(&gUnknown_8103D98); - DisplayDungeonDialogue(&gUnknown_8103DD8); - DisplayDungeonDialogue(&gUnknown_8103E28); + DisplayDungeonDialogue(gUnknown_8103D8C); + DisplayDungeonDialogue(gUnknown_8103D98); + DisplayDungeonDialogue(gUnknown_8103DD8); + DisplayDungeonDialogue(gUnknown_8103E28); sub_803E708(10,0x46); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); } @@ -2168,23 +2139,23 @@ void sub_8089878(void) void sub_80898E4(void) { sub_8086448(); - sub_80866C4(&gUnknown_8103E34); + sub_80866C4(gUnknown_8103E34); } -void sub_80898F8(struct Entity *r0) +void sub_80898F8(Entity *r0) { sub_8068FE0(r0, 0x21C, 0); } -void sub_8089908(struct Entity *r0) +void sub_8089908(Entity *r0) { SetFacingDirection(r0, DIRECTION_NORTH); } void sub_8089914(void) { - struct Entity *LeaderEntity; - struct Entity *MewtwoEntity; + Entity *LeaderEntity; + Entity *MewtwoEntity; LeaderEntity = xxx_call_GetLeader(); MewtwoEntity = GetEntityFromClientType(0x11); @@ -2201,8 +2172,8 @@ void sub_8089914(void) void sub_8089978(void) { - struct Entity *LeaderEntity; - struct Entity *MewtwoEntity; + Entity *LeaderEntity; + Entity *MewtwoEntity; LeaderEntity = xxx_call_GetLeader(); MewtwoEntity = GetEntityFromClientType(0x11); @@ -2233,26 +2204,26 @@ void sub_8089A00(u8 param_1, u8 param_2) void MewtwoPreFightDialogue(void) { - struct Entity *LeaderEntity; - struct Entity *MewtwoEntity; + Entity *LeaderEntity; + Entity *MewtwoEntity; LeaderEntity = xxx_call_GetLeader(); MewtwoEntity = GetEntityFromClientType(0x11); sub_8086448(); - DisplayDungeonDialogue(&gMewtwoPreFightDialogue_1); + DisplayDungeonDialogue(gMewtwoPreFightDialogue_1); sub_803E708(10,0x46); DungeonStartNewBGM(MUS_FRIEND_AREA_CRYPTIC_CAVE); sub_8086794(); sub_803E708(0x1e,0x46); MewtwoDropInEffect(MewtwoEntity); sub_803E708(0x3c,0x46); - DisplayDungeonDialogue(&gMewtwoPreFightDialogue_2); - DisplayDungeonDialogue(&gMewtwoPreFightDialogue_3); + DisplayDungeonDialogue(gMewtwoPreFightDialogue_2); + DisplayDungeonDialogue(gMewtwoPreFightDialogue_3); sub_803E708(10,0x46); MewtwoScreenFlash(); - DisplayDungeonDialogue(&gMewtwoPreFightDialogue_4); + DisplayDungeonDialogue(gMewtwoPreFightDialogue_4); MewtwoScreenFlash(); - DisplayDungeonDialogue(&gMewtwoPreFightDialogue_5); + DisplayDungeonDialogue(gMewtwoPreFightDialogue_5); sub_803E708(10,0x46); SetupBossFightHP(MewtwoEntity,900,MUS_BATTLE_WITH_RAYQUAZA); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); @@ -2260,32 +2231,32 @@ void MewtwoPreFightDialogue(void) void MewtwoReFightDialogue(void) { - struct Entity *LeaderEntity; - struct Entity *MewtwoEntity; + Entity *LeaderEntity; + Entity *MewtwoEntity; LeaderEntity = xxx_call_GetLeader(); MewtwoEntity = GetEntityFromClientType(0x11); sub_8086448(); if(HasRecruitedMon(MONSTER_MEWTWO)) { - sub_80866C4(&gMewtwoReFightDialogue_5); + sub_80866C4(gMewtwoReFightDialogue_5); } else { - DisplayDungeonDialogue(&gMewtwoReFightDialogue_1); + DisplayDungeonDialogue(gMewtwoReFightDialogue_1); DungeonStartNewBGM(MUS_FRIEND_AREA_CRYPTIC_CAVE); sub_8086794(); MewtwoDropInEffect(MewtwoEntity); sub_803E708(0x3c,0x46); - DisplayDungeonDialogue(&gMewtwoReFightDialogue_2); + DisplayDungeonDialogue(gMewtwoReFightDialogue_2); MewtwoScreenFlash(); - DisplayDungeonDialogue(&gMewtwoReFightDialogue_3); + DisplayDungeonDialogue(gMewtwoReFightDialogue_3); MewtwoScreenFlash(); - DisplayDungeonDialogue(&gMewtwoReFightDialogue_4); + DisplayDungeonDialogue(gMewtwoReFightDialogue_4); SetupBossFightHP(MewtwoEntity,900,MUS_BATTLE_WITH_RAYQUAZA); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); } } -void MewtwoDropInEffect(struct Entity *mewtwoEntity) +void MewtwoDropInEffect(Entity *mewtwoEntity) { s32 iVar1; s32 iVar2; @@ -2335,8 +2306,8 @@ void MewtwoScreenFlash(void) void sub_8089C44(void) { - struct Entity * LeaderEntity; - struct Entity * EnteiEntity; + Entity * LeaderEntity; + Entity * EnteiEntity; LeaderEntity = xxx_call_GetLeader(); EnteiEntity = GetEntityFromClientType(0x12); @@ -2351,8 +2322,8 @@ void sub_8089C44(void) void sub_8089C90(void) { - struct Entity * LeaderEntity; - struct Entity * EnteiEntity; + Entity * LeaderEntity; + Entity * EnteiEntity; LeaderEntity = xxx_call_GetLeader(); EnteiEntity = GetEntityFromClientType(0x12); @@ -2379,17 +2350,17 @@ void sub_8089CFC(u8 param_1, u8 param_2) void EnteiPreFightDialogue(void) { - struct Entity * LeaderEntity; - struct Entity * EnteiEntity; + Entity * LeaderEntity; + Entity * EnteiEntity; LeaderEntity = xxx_call_GetLeader(); EnteiEntity = GetEntityFromClientType(0x12); EnteiScreenFlash(); - DisplayDungeonDialogue(&gEnteiPreFightDialogue_1); + DisplayDungeonDialogue(gEnteiPreFightDialogue_1); EnteiScreenFlash(); - DisplayDungeonDialogue(&gEnteiPreFightDialogue_2); + DisplayDungeonDialogue(gEnteiPreFightDialogue_2); EnteiScreenFlash(); - DisplayDungeonDialogue(&gEnteiPreFightDialogue_3); + DisplayDungeonDialogue(gEnteiPreFightDialogue_3); sub_803E708(10,70); SetupBossFightHP(EnteiEntity,600,MUS_BOSS_BATTLE); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); @@ -2397,17 +2368,17 @@ void EnteiPreFightDialogue(void) void EnteiReFightDialogue(void) { - struct Entity * LeaderEntity; - struct Entity * EnteiEntity; + Entity * LeaderEntity; + Entity * EnteiEntity; LeaderEntity = xxx_call_GetLeader(); EnteiEntity = GetEntityFromClientType(0x12); EnteiScreenFlash(); - DisplayDungeonDialogue(&gEnteiReFightDialogue_1); + DisplayDungeonDialogue(gEnteiReFightDialogue_1); EnteiScreenFlash(); - DisplayDungeonDialogue(&gEnteiReFightDialogue_2); + DisplayDungeonDialogue(gEnteiReFightDialogue_2); EnteiScreenFlash(); - DisplayDungeonDialogue(&gEnteiReFightDialogue_3); + DisplayDungeonDialogue(gEnteiReFightDialogue_3); sub_803E708(10,70); SetupBossFightHP(EnteiEntity,600,MUS_BOSS_BATTLE); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); @@ -2415,21 +2386,21 @@ void EnteiReFightDialogue(void) void EnteiPostStoryPreFightDialogue(void) { - struct Entity * LeaderEntity; - struct Entity * EnteiEntity; + Entity * LeaderEntity; + Entity * EnteiEntity; LeaderEntity = xxx_call_GetLeader(); EnteiEntity = GetEntityFromClientType(0x12); if (HasRecruitedMon(MONSTER_ENTEI)) { - sub_80866C4(&gEnteiPostStoryPreFightDialogue_4); + sub_80866C4(gEnteiPostStoryPreFightDialogue_4); } else { EnteiScreenFlash(); - DisplayDungeonDialogue(&gEnteiPostStoryPreFightDialogue_1); + DisplayDungeonDialogue(gEnteiPostStoryPreFightDialogue_1); EnteiScreenFlash(); - DisplayDungeonDialogue(&gEnteiPostStoryPreFightDialogue_2); + DisplayDungeonDialogue(gEnteiPostStoryPreFightDialogue_2); EnteiScreenFlash(); - DisplayDungeonDialogue(&gEnteiPostStoryPreFightDialogue_3); + DisplayDungeonDialogue(gEnteiPostStoryPreFightDialogue_3); sub_803E708(10,70); SetupBossFightHP(EnteiEntity,600,MUS_BOSS_BATTLE); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); @@ -2464,8 +2435,8 @@ void EnteiScreenFlash(void) void sub_8089EFC(void) { - struct Entity * LeaderEntity; - struct Entity * RaikouEntity; + Entity * LeaderEntity; + Entity * RaikouEntity; LeaderEntity = xxx_call_GetLeader(); RaikouEntity = GetEntityFromClientType(0x13); @@ -2480,8 +2451,8 @@ void sub_8089EFC(void) void sub_8089F44(void) { - struct Entity * LeaderEntity; - struct Entity * RaikouEntity; + Entity * LeaderEntity; + Entity * RaikouEntity; LeaderEntity = xxx_call_GetLeader(); RaikouEntity = GetEntityFromClientType(0x13); @@ -2496,8 +2467,8 @@ void sub_8089F44(void) void sub_8089F8C(void) { - struct Entity * LeaderEntity; - struct Entity * RaikouEntity; + Entity * LeaderEntity; + Entity * RaikouEntity; LeaderEntity = xxx_call_GetLeader(); RaikouEntity = GetEntityFromClientType(0x13); @@ -2524,24 +2495,24 @@ void sub_8089FF0(u8 param_1, u8 param_2) void RaikouPreFightDialogue(void) { - struct Entity * LeaderEntity; - struct Entity * RaikouEntity; + Entity * LeaderEntity; + Entity * RaikouEntity; LeaderEntity = xxx_call_GetLeader(); RaikouEntity = GetEntityFromClientType(0x13); - DisplayDungeonDialogue(&gRaikouPreFightDialogue_1); + DisplayDungeonDialogue(gRaikouPreFightDialogue_1); RaikouScreenFlash(); - DisplayDungeonDialogue(&gRaikouPreFightDialogue_2); + DisplayDungeonDialogue(gRaikouPreFightDialogue_2); gDungeon->unkE265 = WEATHER_RAIN; sub_807EAA0(0,1); sub_803E708(10,70); - DisplayDungeonDialogue(&gRaikouPreFightDialogue_3); + DisplayDungeonDialogue(gRaikouPreFightDialogue_3); RaikouScreenFlash(); - DisplayDungeonDialogue(&gRaikouPreFightDialogue_4); + DisplayDungeonDialogue(gRaikouPreFightDialogue_4); RaikouScreenFlash(); - DisplayDungeonDialogue(&gRaikouPreFightDialogue_5); + DisplayDungeonDialogue(gRaikouPreFightDialogue_5); RaikouScreenFlash(); - DisplayDungeonDialogue(&gRaikouPreFightDialogue_6); + DisplayDungeonDialogue(gRaikouPreFightDialogue_6); sub_803E708(10,70); SetupBossFightHP(RaikouEntity,0x28a,MUS_BOSS_BATTLE); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); @@ -2549,19 +2520,19 @@ void RaikouPreFightDialogue(void) void RaikouReFightDialogue(void) { - struct Entity * LeaderEntity; - struct Entity * RaikouEntity; + Entity * LeaderEntity; + Entity * RaikouEntity; LeaderEntity = xxx_call_GetLeader(); RaikouEntity = GetEntityFromClientType(0x13); gDungeon->unkE265 = WEATHER_RAIN; sub_807EAA0(0,1); RaikouScreenFlash(); - DisplayDungeonDialogue(&gRaikouReFightDialogue_1); + DisplayDungeonDialogue(gRaikouReFightDialogue_1); RaikouScreenFlash(); - DisplayDungeonDialogue(&gRaikouReFightDialogue_2); + DisplayDungeonDialogue(gRaikouReFightDialogue_2); RaikouScreenFlash(); - DisplayDungeonDialogue(&gRaikouReFightDialogue_3); + DisplayDungeonDialogue(gRaikouReFightDialogue_3); sub_803E708(10,70); SetupBossFightHP(RaikouEntity,0x28a,MUS_BOSS_BATTLE); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); @@ -2569,22 +2540,22 @@ void RaikouReFightDialogue(void) void RaikouPostStoryPreFightDialogue(void) { - struct Entity * LeaderEntity; - struct Entity * RaikouEntity; + Entity * LeaderEntity; + Entity * RaikouEntity; LeaderEntity = xxx_call_GetLeader(); RaikouEntity = GetEntityFromClientType(0x13); if (HasRecruitedMon(MONSTER_RAIKOU)) { - sub_80866C4(&gRaikouPostStoryPreFightDialogue_4); + sub_80866C4(gRaikouPostStoryPreFightDialogue_4); } else { gDungeon->unkE265 = WEATHER_RAIN; sub_807EAA0(0,1); - DisplayDungeonDialogue(&gRaikouPostStoryPreFightDialogue_1); + DisplayDungeonDialogue(gRaikouPostStoryPreFightDialogue_1); RaikouScreenFlash(); - DisplayDungeonDialogue(&gRaikouPostStoryPreFightDialogue_2); + DisplayDungeonDialogue(gRaikouPostStoryPreFightDialogue_2); RaikouScreenFlash(); - DisplayDungeonDialogue(&gRaikouPostStoryPreFightDialogue_3); + DisplayDungeonDialogue(gRaikouPostStoryPreFightDialogue_3); sub_803E708(10,70); SetupBossFightHP(RaikouEntity,0x28a,MUS_BOSS_BATTLE); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); @@ -2619,8 +2590,8 @@ void RaikouScreenFlash(void) void sub_808A264(void) { - struct Entity * LeaderEntity; - struct Entity * SuicuneEntity; + Entity * LeaderEntity; + Entity * SuicuneEntity; LeaderEntity = xxx_call_GetLeader(); SuicuneEntity = GetEntityFromClientType(0x14); @@ -2636,8 +2607,8 @@ void sub_808A264(void) void sub_808A2C0(void) { - struct Entity * LeaderEntity; - struct Entity * SuicuneEntity; + Entity * LeaderEntity; + Entity * SuicuneEntity; LeaderEntity = xxx_call_GetLeader(); SuicuneEntity = GetEntityFromClientType(0x14); @@ -2651,8 +2622,8 @@ void sub_808A2C0(void) void sub_808A308(void) { - struct Entity * LeaderEntity; - struct Entity * SuicuneEntity; + Entity * LeaderEntity; + Entity * SuicuneEntity; LeaderEntity = xxx_call_GetLeader(); SuicuneEntity = GetEntityFromClientType(0x14); @@ -2679,27 +2650,27 @@ void sub_808A36C(u8 param_1, u8 param_2) void SuicunePreFightDialogue(void) { - struct Entity * LeaderEntity; - struct Entity * SuicuneEntity; + Entity * LeaderEntity; + Entity * SuicuneEntity; LeaderEntity = xxx_call_GetLeader(); SuicuneEntity = GetEntityFromClientType(0x14); sub_8086448(); - DisplayDungeonDialogue(&gSuicunePreFightDialogue_1); + DisplayDungeonDialogue(gSuicunePreFightDialogue_1); sub_803E708(10,70); - DisplayDungeonDialogue(&gSuicunePreFightDialogue_2); + DisplayDungeonDialogue(gSuicunePreFightDialogue_2); sub_803E708(10,70); sub_80426C8(1,2); sub_803E708(0x3c,70); - DisplayDungeonDialogue(&gSuicunePreFightDialogue_3); + DisplayDungeonDialogue(gSuicunePreFightDialogue_3); sub_803E708(10,70); sub_808A528(SuicuneEntity); - DisplayDungeonDialogue(&gSuicunePreFightDialogue_4); - DisplayDungeonDialogue(&gSuicunePreFightDialogue_5); + DisplayDungeonDialogue(gSuicunePreFightDialogue_4); + DisplayDungeonDialogue(gSuicunePreFightDialogue_5); SuicuneScreenFlash(); - DisplayDungeonDialogue(&gSuicunePreFightDialogue_6); + DisplayDungeonDialogue(gSuicunePreFightDialogue_6); SuicuneScreenFlash(); - DisplayDungeonDialogue(&gSuicunePreFightDialogue_7); + DisplayDungeonDialogue(gSuicunePreFightDialogue_7); sub_803E708(10,70); SetupBossFightHP(SuicuneEntity,0x28a,MUS_BOSS_BATTLE); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); @@ -2707,16 +2678,16 @@ void SuicunePreFightDialogue(void) void SuicuneReFightDialogue(void) { - struct Entity * LeaderEntity; - struct Entity * SuicuneEntity; + Entity * LeaderEntity; + Entity * SuicuneEntity; LeaderEntity = xxx_call_GetLeader(); SuicuneEntity = GetEntityFromClientType(0x14); - DisplayDungeonDialogue(&gSuicuneReFightDialogue_1); + DisplayDungeonDialogue(gSuicuneReFightDialogue_1); SuicuneScreenFlash(); - DisplayDungeonDialogue(&gSuicuneReFightDialogue_2); + DisplayDungeonDialogue(gSuicuneReFightDialogue_2); SuicuneScreenFlash(); - DisplayDungeonDialogue(&gSuicuneReFightDialogue_3); + DisplayDungeonDialogue(gSuicuneReFightDialogue_3); sub_803E708(10,70); SetupBossFightHP(SuicuneEntity,0x28a,MUS_BOSS_BATTLE); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); @@ -2724,27 +2695,27 @@ void SuicuneReFightDialogue(void) void SuicunePostStoryPreFightDialogue(void) { - struct Entity * LeaderEntity; - struct Entity * SuicuneEntity; + Entity * LeaderEntity; + Entity * SuicuneEntity; LeaderEntity = xxx_call_GetLeader(); SuicuneEntity = GetEntityFromClientType(0x14); if (HasRecruitedMon(MONSTER_SUICUNE)) { - sub_80866C4(&gSuicunePostStoryPreFightDialogue_4); + sub_80866C4(gSuicunePostStoryPreFightDialogue_4); } else { - DisplayDungeonDialogue(&gSuicunePostStoryPreFightDialogue_1); + DisplayDungeonDialogue(gSuicunePostStoryPreFightDialogue_1); SuicuneScreenFlash(); - DisplayDungeonDialogue(&gSuicunePostStoryPreFightDialogue_2); + DisplayDungeonDialogue(gSuicunePostStoryPreFightDialogue_2); SuicuneScreenFlash(); - DisplayDungeonDialogue(&gSuicunePostStoryPreFightDialogue_3); + DisplayDungeonDialogue(gSuicunePostStoryPreFightDialogue_3); sub_803E708(10,70); SetupBossFightHP(SuicuneEntity,0x28a,MUS_BOSS_BATTLE); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); } } -void sub_808A528(struct Entity * param_1) +void sub_808A528(Entity * param_1) { s32 iVar1; s32 iVar2; @@ -2794,8 +2765,8 @@ void SuicuneScreenFlash(void) void sub_808A608(void) { - struct Entity * LeaderEntity; - struct Entity * HoOhEntity; + Entity * LeaderEntity; + Entity * HoOhEntity; LeaderEntity = xxx_call_GetLeader(); HoOhEntity = GetEntityFromClientType(0x15); @@ -2812,8 +2783,8 @@ void sub_808A608(void) void sub_808A668(void) { - struct Entity * LeaderEntity; - struct Entity * HoOhEntity; + Entity * LeaderEntity; + Entity * HoOhEntity; LeaderEntity = xxx_call_GetLeader(); HoOhEntity = GetEntityFromClientType(0x15); @@ -2848,9 +2819,9 @@ void sub_808A718(void) void HoOhPreFightDialogue(void) { - struct Entity * LeaderEntity; - struct Entity * HoOhEntity; - struct Position32 local_14; + Entity * LeaderEntity; + Entity * HoOhEntity; + Position32 local_14; LeaderEntity = xxx_call_GetLeader(); HoOhEntity = GetEntityFromClientType(0x15); @@ -2858,10 +2829,10 @@ void HoOhPreFightDialogue(void) local_14.y = LeaderEntity->pixelPos.y + -0x1000; ShiftCameraToPosition(&local_14,0x88); sub_803E708(0x40,70); - DisplayDungeonDialogue(&gHoOhPreFightDialogue_1); + DisplayDungeonDialogue(gHoOhPreFightDialogue_1); sub_803E708(10,70); HoOhScreenFlash(); - DisplayDungeonDialogue(&gHoOhPreFightDialogue_2); + DisplayDungeonDialogue(gHoOhPreFightDialogue_2); sub_803E708(10,70); sub_80855E4(sub_80868F4); sub_808680C(); @@ -2872,14 +2843,14 @@ void HoOhPreFightDialogue(void) sub_808682C(); sub_80855E4(sub_8086910); sub_8085930(DIRECTION_NORTH); - DisplayDungeonDialogue(&gHoOhPreFightDialogue_3); - DisplayDungeonDialogue(&gHoOhPreFightDialogue_4); + DisplayDungeonDialogue(gHoOhPreFightDialogue_3); + DisplayDungeonDialogue(gHoOhPreFightDialogue_4); sub_803E708(0x1e,70); sub_803E708(0x1e,70); HoOhScreenFlash(); - DisplayDungeonDialogue(&gHoOhPreFightDialogue_5); + DisplayDungeonDialogue(gHoOhPreFightDialogue_5); HoOhScreenFlash(); - DisplayDungeonDialogue(&gHoOhPreFightDialogue_6); + DisplayDungeonDialogue(gHoOhPreFightDialogue_6); sub_803E708(10,70); SetupBossFightHP(HoOhEntity,800,MUS_BATTLE_WITH_RAYQUAZA); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); @@ -2887,9 +2858,9 @@ void HoOhPreFightDialogue(void) void HoOhReFightDialogue(void) { - struct Entity * LeaderEntity; - struct Entity * HoOhEntity; - struct Position32 local_14; + Entity * LeaderEntity; + Entity * HoOhEntity; + Position32 local_14; LeaderEntity = xxx_call_GetLeader(); HoOhEntity = GetEntityFromClientType(0x15); @@ -2899,10 +2870,10 @@ void HoOhReFightDialogue(void) ShiftCameraToPosition(&local_14,0x88); sub_803E708(0x40,70); if (HasRecruitedMon(MONSTER_HO_OH)) { - sub_80866C4(&HoOhReFightDialogue_5); + sub_80866C4(HoOhReFightDialogue_5); } else { - DisplayDungeonDialogue(&HoOhReFightDialogue_1); + DisplayDungeonDialogue(HoOhReFightDialogue_1); HoOhScreenFlash(); sub_80855E4(sub_80868F4); sub_808680C(); @@ -2911,18 +2882,18 @@ void HoOhReFightDialogue(void) sub_808682C(); sub_80855E4(sub_8086910); sub_8085930(DIRECTION_NORTH); - DisplayDungeonDialogue(&HoOhReFightDialogue_2); + DisplayDungeonDialogue(HoOhReFightDialogue_2); HoOhScreenFlash(); - DisplayDungeonDialogue(&HoOhReFightDialogue_3); + DisplayDungeonDialogue(HoOhReFightDialogue_3); HoOhScreenFlash(); - DisplayDungeonDialogue(&HoOhReFightDialogue_4); + DisplayDungeonDialogue(HoOhReFightDialogue_4); sub_803E708(10,70); SetupBossFightHP(HoOhEntity,800,MUS_BATTLE_WITH_RAYQUAZA); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); } } -void HoOhDropInEffect(struct Entity * param_1) +void HoOhDropInEffect(Entity * param_1) { s32 iVar1; s32 iVar2; @@ -2972,8 +2943,8 @@ void HoOhScreenFlash(void) void sub_808A9E4(void) { - struct Entity * LeaderEntity; - struct Entity * LatiosEntity; + Entity * LeaderEntity; + Entity * LatiosEntity; LeaderEntity = xxx_call_GetLeader(); LatiosEntity = GetEntityFromClientType(0x16); @@ -2988,8 +2959,8 @@ void sub_808A9E4(void) void sub_808AA3C(void) { - struct Entity * LeaderEntity; - struct Entity * LatiosEntity; + Entity * LeaderEntity; + Entity * LatiosEntity; LeaderEntity = xxx_call_GetLeader(); LatiosEntity = GetEntityFromClientType(0x16); @@ -3004,8 +2975,8 @@ void sub_808AA3C(void) void sub_808AA94(void) { - struct Entity * LeaderEntity; - struct Entity * LatiosEntity; + Entity * LeaderEntity; + Entity * LatiosEntity; LeaderEntity = xxx_call_GetLeader(); LatiosEntity = GetEntityFromClientType(0x16); @@ -3028,10 +2999,10 @@ void sub_808AAF0(u8 param_1, u8 param_2) void LatiosPreFightDialogue(void) { - struct Entity * LeaderEntity; - struct Entity * LatiosEntity; - struct Position32 local_18; - struct Position local_19; + Entity * LeaderEntity; + Entity * LatiosEntity; + Position32 local_18; + Position local_19; LeaderEntity = xxx_call_GetLeader(); LatiosEntity = GetEntityFromClientType(0x16); @@ -3049,11 +3020,11 @@ void LatiosPreFightDialogue(void) SpriteShockEffect(LatiosEntity); sub_803E708(0x20,70); sub_808692C(); - DisplayDungeonDialogue(&gLatiosPreFightDialogue_1); + DisplayDungeonDialogue(gLatiosPreFightDialogue_1); LatiosScreenFlash(); - DisplayDungeonDialogue(&gLatiosPreFightDialogue_2); + DisplayDungeonDialogue(gLatiosPreFightDialogue_2); LatiosScreenFlash(); - DisplayDungeonDialogue(&gLatiosPreFightDialogue_3); + DisplayDungeonDialogue(gLatiosPreFightDialogue_3); sub_803E708(10,70); SetupBossFightHP(LatiosEntity,600,MUS_BOSS_BATTLE); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); @@ -3061,18 +3032,18 @@ void LatiosPreFightDialogue(void) void LatiosReFightDialogue(void) { - struct Entity * LeaderEntity; - struct Entity * LatiosEntity; + Entity * LeaderEntity; + Entity * LatiosEntity; LeaderEntity = xxx_call_GetLeader(); LatiosEntity = GetEntityFromClientType(0x16); sub_8086448(); sub_808692C(); - DisplayDungeonDialogue(&gLatiosReFightDialogue_1); + DisplayDungeonDialogue(gLatiosReFightDialogue_1); LatiosScreenFlash(); - DisplayDungeonDialogue(&gLatiosPreFightDialogue_2); + DisplayDungeonDialogue(gLatiosPreFightDialogue_2); LatiosScreenFlash(); - DisplayDungeonDialogue(&gLatiosPreFightDialogue_3); + DisplayDungeonDialogue(gLatiosPreFightDialogue_3); sub_803E708(10,70); SetupBossFightHP(LatiosEntity,600,MUS_BOSS_BATTLE); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); @@ -3082,7 +3053,7 @@ void sub_808AC3C(void) { sub_8086448(); // There appears to be no one here - sub_80866C4(&gUnknown_8104FC8); + sub_80866C4(gUnknown_8104FC8); } void LatiosScreenFlash(void) @@ -3108,7 +3079,7 @@ void LatiosScreenFlash(void) void sub_808ACC0(void) { - struct Entity * uVar2; + Entity * uVar2; if (HasRecruitedMon(MONSTER_REGIROCK)) { uVar2 = GetEntityFromClientType(0x17); @@ -3135,7 +3106,7 @@ void sub_808ACC0(void) void sub_808AD48(void) { - struct Entity * uVar2; + Entity * uVar2; if (HasRecruitedMon(MONSTER_REGICE)) { uVar2 = GetEntityFromClientType(0x18); @@ -3163,7 +3134,7 @@ void sub_808AD48(void) void sub_808ADCC(void) { - struct Entity * uVar2; + Entity * uVar2; if (HasRecruitedMon(MONSTER_REGISTEEL)) { uVar2 = GetEntityFromClientType(0x19); @@ -3190,9 +3161,9 @@ void sub_808ADCC(void) void sub_808AE54(char param_1,char param_2,u32 *param_3) { - struct Entity * LeaderEntity; + Entity * LeaderEntity; s16 IDStack[2]; - struct Item item; + Item item; LeaderEntity = xxx_call_GetLeader(); @@ -3205,7 +3176,7 @@ void sub_808AE54(char param_1,char param_2,u32 *param_3) DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); // Something fell from Regirock's body // Regirock was apparently guarding this item - DisplayDungeonDialogue(&gRegirockPostFightDialogue_1); + DisplayDungeonDialogue(gRegirockPostFightDialogue_1); } } } @@ -3213,9 +3184,9 @@ void sub_808AE54(char param_1,char param_2,u32 *param_3) void sub_808AEC8(char param_1,char param_2,u32 *param_3) { - struct Entity * LeaderEntity; + Entity * LeaderEntity; s16 IDStack[2]; - struct Item item; + Item item; LeaderEntity = xxx_call_GetLeader(); @@ -3228,16 +3199,16 @@ void sub_808AEC8(char param_1,char param_2,u32 *param_3) DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); // Something fell from Regice's body // Regice was apparently guarding this item - DisplayDungeonDialogue(&gRegicePostFightDialogue_1); + DisplayDungeonDialogue(gRegicePostFightDialogue_1); } } } void sub_808AF3C(char param_1,char param_2,u32 *param_3) { - struct Entity * LeaderEntity; + Entity * LeaderEntity; s16 IDStack[2]; - struct Item item; + Item item; LeaderEntity = xxx_call_GetLeader(); @@ -3250,14 +3221,14 @@ void sub_808AF3C(char param_1,char param_2,u32 *param_3) DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); // Something fell from Registeel's body // Registeel was apparently guarding this item - DisplayDungeonDialogue(&gRegisteelPostFightDialogue_1); + DisplayDungeonDialogue(gRegisteelPostFightDialogue_1); } } } void sub_808AFB0(char param_1) { - struct Entity * LeaderEntity; + Entity * LeaderEntity; s16 IDStack [2]; LeaderEntity = xxx_call_GetLeader(); @@ -3266,7 +3237,7 @@ void sub_808AFB0(char param_1) sub_8097FD0(0x1d); SetMessageArgument(gAvailablePokemonNames,GetLeader(),0); // {ARG_POKEMON_0} obtained the Rock Part that Regirock was guarding - DisplayDungeonDialogue(&gRegirockPostFightDialogue_2); + DisplayDungeonDialogue(gRegirockPostFightDialogue_2); sub_80421C0(0,0xd4); sub_803E708(10,70); sub_8046D20(); @@ -3275,7 +3246,7 @@ void sub_808AFB0(char param_1) void sub_808B030(char param_1) { - struct Entity * LeaderEntity; + Entity * LeaderEntity; s16 IDStack [2]; LeaderEntity = xxx_call_GetLeader(); @@ -3284,7 +3255,7 @@ void sub_808B030(char param_1) sub_8097FD0(0x1d); SetMessageArgument(gAvailablePokemonNames,GetLeader(),0); // {ARG_POKEMON_0} obtained the Ice Part that Regice was guarding - DisplayDungeonDialogue(&gRegicePostFightDialogue_2); + DisplayDungeonDialogue(gRegicePostFightDialogue_2); sub_80421C0(0,0xd4); sub_803E708(10,70); sub_8046D20(); @@ -3293,7 +3264,7 @@ void sub_808B030(char param_1) void sub_808B0B0(char param_1) { - struct Entity * LeaderEntity; + Entity * LeaderEntity; s16 IDStack [2]; LeaderEntity = xxx_call_GetLeader(); @@ -3302,7 +3273,7 @@ void sub_808B0B0(char param_1) sub_8097FD0(0x1d); SetMessageArgument(gAvailablePokemonNames, GetLeader(), 0); // {ARG_POKEMON_0} obtained the Steel Part that Registeel was guarding - DisplayDungeonDialogue(&gRegisteelPostFightDialogue_2); + DisplayDungeonDialogue(gRegisteelPostFightDialogue_2); sub_80421C0(0,0xd4); sub_803E708(10,70); sub_8046D20(); @@ -3315,7 +3286,7 @@ void RegirockPreFightDialogue(void) sub_8085930(DIRECTION_NORTH); // INTRUDER ALERT // EXTERMINATE - DisplayDungeonDialogue(&gRegirockPreFightDialogue_1); + DisplayDungeonDialogue(gRegirockPreFightDialogue_1); sub_803E708(10,70); sub_808563C(SetupRegirockFightHP); } @@ -3327,7 +3298,7 @@ void RegicePreFightDialogue(void) sub_8085930(DIRECTION_NORTH); // INTRUDER ALERT // EXTERMINATE - DisplayDungeonDialogue(&gRegicePreFightDialogue_1); + DisplayDungeonDialogue(gRegicePreFightDialogue_1); sub_803E708(10,70); sub_808563C(SetupRegiceFightHP); } @@ -3339,7 +3310,7 @@ void RegisteelPreFightDialogue(void) sub_8085930(DIRECTION_NORTH); // INTRUDER ALERT // EXTERMINATE - DisplayDungeonDialogue(&gRegisteelPreFightDialogue_1); + DisplayDungeonDialogue(gRegisteelPreFightDialogue_1); sub_803E708(10,70); sub_808563C(SetupRegisteelFightHP); } @@ -3457,34 +3428,34 @@ void sub_808B1CC(u8 r0) } -void SetupRegiFacingDirection(struct Entity *regiEntity) +void SetupRegiFacingDirection(Entity *regiEntity) { regiEntity->info->action.direction = DIRECTION_NORTH; sub_806CE68(regiEntity, DIRECTION_NORTH); } -void SetupRegirockFightHP(struct Entity *r0) +void SetupRegirockFightHP(Entity *r0) { SetupBossFightHP(r0, 450, MUS_BOSS_BATTLE); } -void SetupRegiceFightHP(struct Entity *r0) +void SetupRegiceFightHP(Entity *r0) { SetupBossFightHP(r0, 450, MUS_BOSS_BATTLE); } -void SetupRegisteelFightHP(struct Entity *r0) +void SetupRegisteelFightHP(Entity *r0) { SetupBossFightHP(r0, 450, MUS_BOSS_BATTLE); } void sub_808B2F4(void) { - struct Entity * LeaderEntity; - struct Entity * JirachiEntity; + Entity * LeaderEntity; + Entity * JirachiEntity; LeaderEntity = xxx_call_GetLeader(); JirachiEntity = GetEntityFromClientType(0x1a); @@ -3502,8 +3473,8 @@ void sub_808B2F4(void) void sub_808B35C(void) { - struct Entity * LeaderEntity; - struct Entity * JirachiEntity; + Entity * LeaderEntity; + Entity * JirachiEntity; LeaderEntity = xxx_call_GetLeader(); JirachiEntity = GetEntityFromClientType(0x1a); @@ -3552,26 +3523,26 @@ void sub_808B3E4(u8 param_1, u8 param_2, u8 param_3) void JirachiPreFightDialogue(void) { - struct Entity * LeaderEntity; - struct Entity * JirachiEntity; + Entity * LeaderEntity; + Entity * JirachiEntity; LeaderEntity = xxx_call_GetLeader(); JirachiEntity = GetEntityFromClientType(0x1a); sub_8086448(); sub_803E708(0x40,70); - DisplayDungeonDialogue(&gJirachiPreFightDialogue_1); + DisplayDungeonDialogue(gJirachiPreFightDialogue_1); sub_803E708(10,70); SpriteLookAroundEffect(LeaderEntity); sub_803E708(10,70); - DisplayDungeonDialogue(&gJirachiPreFightDialogue_2); + DisplayDungeonDialogue(gJirachiPreFightDialogue_2); sub_80861F8(0x37,JirachiEntity,1); sub_80855E4(SpriteShockEffect); sub_803E708(0x3c,70); JirachiDropInEffect(JirachiEntity); sub_803E708(0x5a,70); - DisplayDungeonDialogue(&gJirachiPreFightDialogue_3); + DisplayDungeonDialogue(gJirachiPreFightDialogue_3); sub_803E708(10,70); - DisplayDungeonDialogue(&gJirachiPreFightDialogue_4); + DisplayDungeonDialogue(gJirachiPreFightDialogue_4); sub_803E708(10,70); SetupBossFightHP(JirachiEntity,0x15e,MUS_BATTLE_WITH_RAYQUAZA); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); @@ -3579,7 +3550,7 @@ void JirachiPreFightDialogue(void) void sub_808B50C(void) { - struct Entity * JirachiEntity; + Entity * JirachiEntity; JirachiEntity = GetEntityFromClientType(0x1a); CopyMonsterNametoBuffer(gUnknown_202E038, MONSTER_JIRACHI); @@ -3592,15 +3563,15 @@ void sub_808B50C(void) DungeonFadeOutBGM(0x1e); sub_803E708(0x1e,70); // Fwaaaahhhh - DisplayDungeonDialogue(&gUnknown_810554C); + DisplayDungeonDialogue(gUnknown_810554C); DungeonStartNewBGM(MUS_FRIEND_AREA_FOREST); // I think I had a dream, and I was fighting in it // Did I imagine it? // I'm sleepy so I'm going back to sleep. - DisplayDungeonDialogue(&gUnknown_8105558); + DisplayDungeonDialogue(gUnknown_8105558); sub_803E708(10,70); JirachiSpinEffect(JirachiEntity); - DisplayDungeonDialogue(&gUnknown_81055F4); + DisplayDungeonDialogue(gUnknown_81055F4); sub_803E708(10,70); gDungeon->unk2 = 1; } @@ -3608,19 +3579,19 @@ void sub_808B50C(void) void JirachiWish(void) { u8 friendArea; - struct Entity *JirachiEntity; - struct Position *LeaderPos; - struct Entity *LeaderEntity; + Entity *JirachiEntity; + Position *LeaderPos; + Entity *LeaderEntity; s32 wishChoice; s32 counter; u32 direction; s32 index; - struct Item auStack152 [9]; - struct Item itemStack [9]; - struct Item strengthItems [9]; - struct Position pos1; - struct Position pos2; - struct Position pos3; + Item auStack152 [9]; + Item itemStack [9]; + Item strengthItems [9]; + Position pos1; + Position pos2; + Position pos3; JirachiEntity = GetEntityFromClientType(0x1a); CopyMonsterNametoBuffer(gUnknown_202E038, MONSTER_JIRACHI); @@ -3634,20 +3605,20 @@ void JirachiWish(void) gDungeon->unk1356C = 1; DungeonFadeOutBGM(0x1e); sub_803E708(0x1e,0x46); - DisplayDungeonDialogue(&gUnknown_8105668); + DisplayDungeonDialogue(gUnknown_8105668); sub_803E708(10,0x46); PlaySoundEffect(0x1a7); sub_803E708(0x96,0x46); SpriteShockEffect(JirachiEntity); - DisplayDungeonDialogue(&gUnknown_8105674); + DisplayDungeonDialogue(gUnknown_8105674); DungeonStartNewBGM(MUS_FRIEND_AREA_FOREST); sub_803E708(10,0x46); sub_80856E0(JirachiEntity, DIRECTION_SOUTH); PlaySoundEffect(0x16a); - DisplayDungeonDialogue(&gUnknown_81056B8); + DisplayDungeonDialogue(gUnknown_81056B8); sub_803E708(10,0x46); SpriteLookAroundEffect(JirachiEntity); - DisplayDungeonDialogue(&gUnknown_81056DC); + DisplayDungeonDialogue(gUnknown_81056DC); sub_803E708(10,0x46); while( 1 ) { while (1) { @@ -3657,14 +3628,14 @@ void JirachiWish(void) #else s32 r0 = 0; #endif - wishChoice = sub_8052C68(r0,*gUnknown_8105798,&gUnknown_810579C,0x705); + wishChoice = sub_8052C68(r0,*gUnknown_8105798,gUnknown_810579C,0x705); if (wishChoice >= 1) break; } sub_803E708(10,0x46); if (wishChoice == 1) { s32 r8; // Lots of Money - DisplayDungeonDialogue(&gUnknown_810581C); + DisplayDungeonDialogue(gUnknown_810581C); sub_803E708(10,0x46); JirachiWishGrantDialogue(JirachiEntity); @@ -3687,7 +3658,7 @@ void JirachiWish(void) } if (wishChoice == 2) { // Lots of Items - DisplayDungeonDialogue(&gUnknown_8105974); + DisplayDungeonDialogue(gUnknown_8105974); sub_803E708(10,0x46); JirachiWishGrantDialogue(JirachiEntity); @@ -3719,30 +3690,30 @@ void JirachiWish(void) if (friendArea == NUM_FRIEND_AREAS) { // You want a friend area? But you already have many friend areas... - DisplayDungeonDialogue(&gUnknown_8105A08); + DisplayDungeonDialogue(gUnknown_8105A08); sub_803E708(10,0x46); continue; } else { // You want a friend area? As you wish.. - DisplayDungeonDialogue(&gUnknown_8105AD4); + DisplayDungeonDialogue(gUnknown_8105AD4); sub_803E708(10,0x46); JirachiWishGrantDialogue(JirachiEntity); JirachiEntity->info->unk15D = 0; - DisplayDungeonDialogue(&gUnknown_8105B20); + DisplayDungeonDialogue(gUnknown_8105B20); UnlockFriendArea(friendArea); PlaySoundEffect(0xd4); LeaderEntity = GetLeader(); SetMessageArgument(gAvailablePokemonNames,LeaderEntity,0); sub_8092578(gUnknown_202DE58,friendArea,FALSE); // Obtained the friend area! - DisplayDungeonDialogue(&gUnknown_8105B68); + DisplayDungeonDialogue(gUnknown_8105B68); } } if (wishChoice == 4) { // More Strength.. - DisplayDungeonDialogue(&gUnknown_8105BA8); + DisplayDungeonDialogue(gUnknown_8105BA8); sub_803E708(10,0x46); JirachiWishGrantDialogue(JirachiEntity); @@ -3764,32 +3735,32 @@ void JirachiWish(void) } } JirachiEntity->info->unk15D = 0; - DisplayDungeonDialogue(&gUnknown_8105BF4); + DisplayDungeonDialogue(gUnknown_8105BF4); sub_803E708(10,0x46); } if (wishChoice == 5) { // Something Good... - DisplayDungeonDialogue(&gUnknown_8105D2C); + DisplayDungeonDialogue(gUnknown_8105D2C); sub_803E708(10,0x46); JirachiWishGrantDialogue(JirachiEntity); JirachiEntity->info->unk15D = 0; - DisplayDungeonDialogue(&gUnknown_8105D80); + DisplayDungeonDialogue(gUnknown_8105D80); sub_803E708(10,0x46); LeaderPos = &GetLeader()->pos; direction = GetDirectionTowardsPosition(&JirachiEntity->pos,LeaderPos); SetFacingDirection(JirachiEntity,direction); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gUnknown_8105D9C); + DisplayDungeonDialogue(gUnknown_8105D9C); sub_803E708(10,0x46); gDungeon->unk674 = 1; } break; } - DisplayDungeonDialogue(&gUnknown_81058E0); + DisplayDungeonDialogue(gUnknown_81058E0); JirachiSpinEffect(JirachiEntity); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gUnknown_810593C); + DisplayDungeonDialogue(gUnknown_810593C); sub_803E708(10,0x46); EnableJirachiWishWarpTile(); } @@ -3799,7 +3770,7 @@ void JirachiReFightDialogue(void) if(HasRecruitedMon(MONSTER_JIRACHI)) { sub_8086448(); - sub_80866C4(&gJirachiReFightDialogue_1); + sub_80866C4(gJirachiReFightDialogue_1); } else { @@ -3837,14 +3808,14 @@ void JirachiWishGrantFlash(void) sub_8085EB0(); } -void sub_808BB3C(struct Position *param_1) +void sub_808BB3C(Position *param_1) { #ifndef NONMATCHING register s32 iVar1 asm("r0"); #else s32 iVar1; #endif - struct Position local_8; + Position local_8; iVar1 = param_1->x * 0x1800 + 0xc00; if (iVar1 < 0) { @@ -3861,12 +3832,12 @@ void sub_808BB3C(struct Position *param_1) sub_8085EC8(100,0,0,&local_8,0); } -void sub_808BBA8(struct Entity *jirachiEntity) +void sub_808BBA8(Entity *jirachiEntity) { sub_806BFC0(jirachiEntity->info,0); } -void JirachiDropInEffect(struct Entity *jirachiEntity) +void JirachiDropInEffect(Entity *jirachiEntity) { s32 iVar1; s32 iVar2; @@ -3889,7 +3860,7 @@ void JirachiDropInEffect(struct Entity *jirachiEntity) jirachiEntity->info->unk174 = 0; } -void JirachiSpinEffect(struct Entity * jirachiEntity) +void JirachiSpinEffect(Entity * jirachiEntity) { s32 uVar1; @@ -3903,19 +3874,19 @@ void JirachiSpinEffect(struct Entity * jirachiEntity) sub_80861F8(99,jirachiEntity,1); } -void JirachiWishGrantDialogue(struct Entity *jirachiEntity) +void JirachiWishGrantDialogue(Entity *jirachiEntity) { u32 uVar2; jirachiEntity->info->unk15D = 1; // Nnnnnnnnnn! - DisplayDungeonDialogue(&gUnknown_81058A8); + DisplayDungeonDialogue(gUnknown_81058A8); PlaySoundEffect(0x375); sub_80861F8(0x67,jirachiEntity,1); PlaySoundEffect(0x2a8); uVar2 = sub_80861F8(0x68,jirachiEntity,0); // Taaaaaaaah! - DisplayDungeonDialogue(&gUnknown_81058C4); + DisplayDungeonDialogue(gUnknown_81058C4); if (sub_800E9A8(uVar2) != 0) { sub_800DC14(uVar2); } @@ -3989,8 +3960,8 @@ u8 JirachiFriendAreaSearch(void) void sub_808BDEC(void) { - struct Entity * LeaderEntity; - struct Entity * LugiaEntity; + Entity * LeaderEntity; + Entity * LugiaEntity; LeaderEntity = xxx_call_GetLeader(); LugiaEntity = GetEntityFromClientType(0x1b); @@ -4020,38 +3991,38 @@ void sub_808BE70(u8 param_1,u8 param_2) void LugiaPreFightDialogue(void) { - struct Entity * LeaderEntity; - struct Entity * LugiaEntity; + Entity * LeaderEntity; + Entity * LugiaEntity; LeaderEntity = xxx_call_GetLeader(); LugiaEntity = GetEntityFromClientType(0x1b); if (HasRecruitedMon(MONSTER_LUGIA)) { sub_8086448(); - sub_80866C4(&gLugiaPreFightDialogue_8); + sub_80866C4(gLugiaPreFightDialogue_8); } else { DungeonStopBGM(); sub_8086448(); - DisplayDungeonDialogue(&gLugiaPreFightDialogue_1); + DisplayDungeonDialogue(gLugiaPreFightDialogue_1); DungeonFadeInNewBGM(MUS_FRIEND_AREA_CRYPTIC_CAVE,0x3c); sub_808C0CC(); - DisplayDungeonDialogue(&gLugiaPreFightDialogue_2); + DisplayDungeonDialogue(gLugiaPreFightDialogue_2); LugiaScreenFlash(); - DisplayDungeonDialogue(&gLugiaPreFightDialogue_3); + DisplayDungeonDialogue(gLugiaPreFightDialogue_3); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gLugiaPreFightDialogue_4); + DisplayDungeonDialogue(gLugiaPreFightDialogue_4); PlaySoundEffect(0x1f8); sub_80861D4(LugiaEntity,0xd,0); sub_803E708(0x2b,0x46); sub_80861B8(LugiaEntity,0,0); - DisplayDungeonDialogue(&gLugiaPreFightDialogue_5); + DisplayDungeonDialogue(gLugiaPreFightDialogue_5); LugiaScreenFlash(); - DisplayDungeonDialogue(&gLugiaPreFightDialogue_6); + DisplayDungeonDialogue(gLugiaPreFightDialogue_6); LugiaScreenFlash2(); SetDungeonBGColorRGB(0xffffff06,0xffffff06,0xffffff06,1,0); DungeonStopBGM(); sub_80861D4(LugiaEntity,7,0); - DisplayDungeonDialogue(&gLugiaPreFightDialogue_7); + DisplayDungeonDialogue(gLugiaPreFightDialogue_7); LugiaScreenFlash(); SetupBossFightHP(LugiaEntity,800,MUS_BATTLE_WITH_RAYQUAZA); DungeonStartNewBGM(MUS_FRIEND_AREA_CRYPTIC_CAVE); @@ -4126,8 +4097,8 @@ void sub_808C0CC(void) void sub_808C10C(void) { - struct Entity * LeaderEntity; - struct Entity * KyogreEntity; + Entity * LeaderEntity; + Entity * KyogreEntity; u32 XPos; s32 YPos; @@ -4163,8 +4134,8 @@ void sub_808C1A4(u8 param_1,u8 param_2) void KyogrePreFightDialogue(void) { - struct Entity *LeaderEntity; - struct Entity *KyogreEntity; + Entity *LeaderEntity; + Entity *KyogreEntity; LeaderEntity = xxx_call_GetLeader(); KyogreEntity = GetEntityFromClientType(0x1c); @@ -4173,35 +4144,35 @@ void KyogrePreFightDialogue(void) DungeonFadeInNewBGM(MUS_FRIEND_AREA_CRYPTIC_CAVE,0x3c); SpriteLookAroundEffect(LeaderEntity); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gKyogrePreFightDialogue_8); + DisplayDungeonDialogue(gKyogrePreFightDialogue_8); sub_803E708(10,0x46); gDungeon->unk2 = 1; } else { - DisplayDungeonDialogue(&gKyogrePreFightDialogue_1); + DisplayDungeonDialogue(gKyogrePreFightDialogue_1); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gKyogrePreFightDialogue_2); + DisplayDungeonDialogue(gKyogrePreFightDialogue_2); sub_803E708(10,0x46); nullsub_99(); sub_803E708(10,0x46); // Gwwwwwooooooooh - DisplayDungeonDialogue(&gKyogrePreFightDialogue_3); + DisplayDungeonDialogue(gKyogrePreFightDialogue_3); sub_803E708(10,0x46); DungeonFadeInNewBGM(MUS_FRIEND_AREA_CRYPTIC_CAVE,0x3c); sub_808C360(); // My duels against {ARG_POKEMON_3} (Groudon) left us both exhausted - DisplayDungeonDialogue(&gKyogrePreFightDialogue_4); + DisplayDungeonDialogue(gKyogrePreFightDialogue_4); KyogreScreenFlash(); // I am {ARG_POKEMON_2} (Kyogre)! // The lord of the sea! - DisplayDungeonDialogue(&gKyogrePreFightDialogue_5); + DisplayDungeonDialogue(gKyogrePreFightDialogue_5); KyogreScreenFlash(); // Witness the destructive force of my waves! - DisplayDungeonDialogue(&gKyogrePreFightDialogue_6); + DisplayDungeonDialogue(gKyogrePreFightDialogue_6); KyogreScreenFlash(); // Marvel at my awesome // power! - DisplayDungeonDialogue(&gKyogrePreFightDialogue_7); + DisplayDungeonDialogue(gKyogrePreFightDialogue_7); sub_803E708(10,0x46); SetupBossFightHP(KyogreEntity,600,MUS_BOSS_BATTLE); DungeonStartNewBGM(MUS_FRIEND_AREA_CRYPTIC_CAVE); @@ -4248,7 +4219,7 @@ void sub_808C360(void) void sub_808C3A0(void) { - struct Entity * LeaderEntity; + Entity * LeaderEntity; LeaderEntity = xxx_call_GetLeader(); DungeonStopBGM(); @@ -4276,24 +4247,24 @@ void sub_808C414(u8 param_1,u8 param_2) void DeoxysPreFightDialogue(void) { - struct Entity * LeaderEntity; + Entity * LeaderEntity; LeaderEntity = xxx_call_GetLeader(); sub_8086448(); if (HasRecruitedMon(MONSTER_DEOXYS_NORMAL)) { // There appears to be no one here. // It's impossible to go any further - sub_80866C4(&gDeoxysPreFightDialogue_5); + sub_80866C4(gDeoxysPreFightDialogue_5); } else { - DisplayDungeonDialogue(&gDeoxysPreFightDialogue_1); + DisplayDungeonDialogue(gDeoxysPreFightDialogue_1); DungeonFadeInNewBGM(MUS_RAYQUAZAS_DOMAIN, 0x3c); sub_808C550(); - DisplayDungeonDialogue(&gDeoxysPreFightDialogue_2); + DisplayDungeonDialogue(gDeoxysPreFightDialogue_2); DeoxysScreenFlash(); - DisplayDungeonDialogue(&gDeoxysPreFightDialogue_3); + DisplayDungeonDialogue(gDeoxysPreFightDialogue_3); DeoxysScreenFlash(); - DisplayDungeonDialogue(&gDeoxysPreFightDialogue_4); + DisplayDungeonDialogue(gDeoxysPreFightDialogue_4); sub_803E708(10,0x46); sub_808563C(SetupDeoxysFightHP); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); @@ -4333,25 +4304,25 @@ void sub_808C550(void) DeoxysScreenFlash(); } -void sub_808C590(struct Entity *r0) +void sub_808C590(Entity *r0) { sub_8068FE0(r0, 0x21C, 0); } -void SetupDeoxysFacingDirection(struct Entity *deoxysEntity) +void SetupDeoxysFacingDirection(Entity *deoxysEntity) { SetFacingDirection(deoxysEntity, DIRECTION_SOUTH); } -void SetupDeoxysFightHP(struct Entity *deoxysEntity) +void SetupDeoxysFightHP(Entity *deoxysEntity) { SetupBossFightHP(deoxysEntity, 950, MUS_BATTLE_WITH_RAYQUAZA); } void sub_808C5C0(void) { - struct Entity * LeaderEntity; - struct Entity * CelebiEntity; + Entity * LeaderEntity; + Entity * CelebiEntity; u32 XPos; s32 YPos; @@ -4376,10 +4347,10 @@ void nullsub_100(u8 r0, u8 r1, u32 r2) #ifdef NONMATCHING void CelebiJoinDialogue(void) { - struct Entity *LeaderEntity; + Entity *LeaderEntity; s32 state; s32 menuChoice; - struct Entity *CelebiEntity; + Entity *CelebiEntity; LeaderEntity = xxx_call_GetLeader(); CelebiEntity = GetEntityFromClientType(0x1e); @@ -4389,7 +4360,7 @@ void CelebiJoinDialogue(void) SpriteLookAroundEffect(LeaderEntity); sub_803E708(10,0x46); // ......... - DisplayDungeonDialogue(&gCelebiJoinDialogue_10); + DisplayDungeonDialogue(gCelebiJoinDialogue_10); } else { @@ -4398,14 +4369,14 @@ void CelebiJoinDialogue(void) SpriteShockEffect(LeaderEntity); sub_803E708(10,0x46); // Oh? There's someone there. - DisplayDungeonDialogue(&gCelebiJoinDialogue_1); + DisplayDungeonDialogue(gCelebiJoinDialogue_1); sub_803E708(10,0x46); sub_8086598(); sub_8086598(); sub_8086598(); sub_8086598(); // The Time-Traveling Pokemon {ARG_POKEMON_2} (Celebi)! - DisplayDungeonDialogue(&gCelebiJoinDialogue_2); + DisplayDungeonDialogue(gCelebiJoinDialogue_2); PlaySoundEffect(0x1c7); sub_806CDD4(CelebiEntity,10,DIRECTION_SOUTH); sub_803E708(0x14,0x46); @@ -4413,7 +4384,7 @@ void CelebiJoinDialogue(void) sub_803E708(4,0x46); PlaySoundEffect(0x1c7); sub_806CDD4(CelebiEntity,10,DIRECTION_SOUTH); - DisplayDungeonDialogue(&gCelebiJoinDialogue_3); + DisplayDungeonDialogue(gCelebiJoinDialogue_3); sub_803E708(10,0x46); state = 0; do { @@ -4441,11 +4412,11 @@ void CelebiJoinDialogue(void) sub_803E708(0x1a,0x46); PlaySoundEffect(0x1d5); sub_803E708(0x1c,0x46); - DisplayDungeonDialogue(&gCelebiJoinDialogue_4); + DisplayDungeonDialogue(gCelebiJoinDialogue_4); sub_803E708(10,0x46); sub_806FDF4(LeaderEntity,CelebiEntity,&CelebiEntity); DungeonStartNewBGM(MUS_FRIEND_AREA_HEALING_FOREST); - DisplayDungeonDialogue(&gCelebiJoinDialogue_5); + DisplayDungeonDialogue(gCelebiJoinDialogue_5); sub_803E708(10,0x46); PlaySoundEffect(0x1c7); sub_80861D4(CelebiEntity,0xd,0); @@ -4454,7 +4425,7 @@ void CelebiJoinDialogue(void) sub_803E708(0x1a,0x46); PlaySoundEffect(0x1d5); sub_803E708(0x1b,0x46); - DisplayDungeonDialogue(&gCelebiJoinDialogue_6); + DisplayDungeonDialogue(gCelebiJoinDialogue_6); sub_803E708(10,0x46); state = 2; } @@ -4474,15 +4445,15 @@ void CelebiJoinDialogue(void) else { sub_803E708(10,0x46); - DisplayDungeonDialogue(&gCelebiJoinDialogue_7); + DisplayDungeonDialogue(gCelebiJoinDialogue_7); sub_80861F8(0x3e,CelebiEntity,1); sub_803E708(0x18,0x46); sub_80861F8(0x3e,CelebiEntity,1); sub_803E708(0xe,0x46); - DisplayDungeonDialogue(&gCelebiJoinDialogue_8); + DisplayDungeonDialogue(gCelebiJoinDialogue_8); sub_803E708(10,0x46); sub_808C8E0(CelebiEntity); - DisplayDungeonDialogue(&gCelebiJoinDialogue_9); + DisplayDungeonDialogue(gCelebiJoinDialogue_9); sub_803E708(10,0x46); state = 2; } @@ -4780,7 +4751,7 @@ void CelebiJoinDialogue(void) } #endif -void sub_808C8E0(struct Entity *param_1) +void sub_808C8E0(Entity *param_1) { s32 iVar1; @@ -4802,11 +4773,11 @@ void sub_808C938(void) sub_80855E4(sub_808C9B0); } -void sub_808C948(struct Entity *entity, u8 param_2) +void sub_808C948(Entity *entity, u8 param_2) { bool8 flag; s32 index; - struct Entity *pokeEntity; + Entity *pokeEntity; if (param_2 == 0x37) { flag = FALSE; @@ -4827,11 +4798,11 @@ void sub_808C998(void) { // Defeat the opposing team to win // Be careful, your opponents are tough - DisplayDungeonDialogue(&gUnknown_8106720); + DisplayDungeonDialogue(gUnknown_8106720); sub_803E708(0xA, 0x46); } -void sub_808C9B0(struct Entity *param_1) +void sub_808C9B0(Entity *param_1) { param_1->info->action.direction = DIRECTION_NORTH; sub_806CE68(param_1, DIRECTION_NORTH); @@ -4839,8 +4810,8 @@ void sub_808C9B0(struct Entity *param_1) void sub_808C9C4(void) { - struct Entity *LeaderEntity; - struct Entity *MedichamEntity; + Entity *LeaderEntity; + Entity *MedichamEntity; LeaderEntity = xxx_call_GetLeader(); MedichamEntity = GetEntityFromClientType(7); @@ -4856,19 +4827,19 @@ void sub_808C9C4(void) // Medicham Rescue Dialogue? void MedichamRescueDialogue(void) { - struct Entity *MedichamEntity; + Entity *MedichamEntity; s32 counter; MedichamEntity = GetEntityFromClientType(7); SpriteLookAroundEffect(MedichamEntity); sub_803E708(0xA, 0x46); // Oh my I can't seem to find a way out... - DisplayDungeonDialogue(&gMedichamRescueDialogue_1); + DisplayDungeonDialogue(gMedichamRescueDialogue_1); sub_803E708(0xA, 0x46); sub_80869E4(MedichamEntity, 4, 2, 4); sub_803E708(0xA, 0x46); // What am I to do...? - DisplayDungeonDialogue(&gMedichamRescueDialogue_2); + DisplayDungeonDialogue(gMedichamRescueDialogue_2); sub_803E708(0xA, 0x46); sub_8086448(); sub_8086598(); @@ -4876,7 +4847,7 @@ void MedichamRescueDialogue(void) SpriteShockEffect(MedichamEntity); sub_803E708(0x20, 0x46); sub_80869E4(MedichamEntity, 4, 2, 0); - DisplayDungeonDialogue(&gMedichamRescueDialogue_3); + DisplayDungeonDialogue(gMedichamRescueDialogue_3); sub_803E708(0xA, 0x46); PlaySoundEffect(0x1c7); sub_806CDD4(MedichamEntity, 0xA, DIRECTION_SOUTH); @@ -4890,7 +4861,7 @@ void MedichamRescueDialogue(void) // I am so lucky // // There appears to be no one here - DisplayDungeonDialogue(&gMedichamRescueDialogue_4); + DisplayDungeonDialogue(gMedichamRescueDialogue_4); sub_803E708(0xA, 0x46); sub_806CDD4(MedichamEntity, 0, DIRECTION_SOUTH); for(counter = 0x17; counter >= 0; counter--) @@ -4908,8 +4879,8 @@ void MedichamRescueDialogue(void) void sub_808CB5C(void) { - struct Entity *LeaderEntity; - struct Entity *MedichamEntity; + Entity *LeaderEntity; + Entity *MedichamEntity; LeaderEntity = xxx_call_GetLeader(); MedichamEntity = GetEntityFromClientType(7); @@ -4927,8 +4898,8 @@ void DummyFightDialogue(void) void sub_808CBB0(void) { - struct Entity *LeaderEntity; - struct Entity *SmeargleEntity; + Entity *LeaderEntity; + Entity *SmeargleEntity; LeaderEntity = xxx_call_GetLeader(); SmeargleEntity = GetEntityFromClientType(0x1F); @@ -4944,7 +4915,7 @@ void sub_808CBB0(void) // Smeargle Rescue dialogue scene void SmeargleRescueDialogue(void) { - struct Entity *SmeargleEntity; + Entity *SmeargleEntity; s32 counter; SmeargleEntity = GetEntityFromClientType(0x1F); @@ -4952,14 +4923,14 @@ void SmeargleRescueDialogue(void) sub_803E708(0xA, 0x46); // Ohhh... // I've lost my bearings - DisplayDungeonDialogue(&gSmeargleRescueDialogue_1); + DisplayDungeonDialogue(gSmeargleRescueDialogue_1); sub_803E708(0xA, 0x46); sub_80869E4(SmeargleEntity, 4, 2, 4); sub_803E708(0xA, 0x46); // I can't get out... // I'm hungry... // I'm in trouble - DisplayDungeonDialogue(&gSmeargleRescueDialogue_2); + DisplayDungeonDialogue(gSmeargleRescueDialogue_2); sub_803E708(0xA, 0x46); sub_8086448(); sub_8086598(); @@ -4968,7 +4939,7 @@ void SmeargleRescueDialogue(void) sub_803E708(0x20, 0x46); sub_80869E4(SmeargleEntity, 4, 2, 0); // Oh! You are? - DisplayDungeonDialogue(&gSmeargleRescueDialogue_3); + DisplayDungeonDialogue(gSmeargleRescueDialogue_3); sub_803E708(0xA, 0x46); PlaySoundEffect(0x1c7); sub_806CDD4(SmeargleEntity, 0xA, DIRECTION_SOUTH); @@ -4980,7 +4951,7 @@ void SmeargleRescueDialogue(void) sub_803E708(0x14, 0x46); // Did you maybe come to rescue me? // Am I glad to see you - DisplayDungeonDialogue(&gSmeargleRescueDialogue_4); + DisplayDungeonDialogue(gSmeargleRescueDialogue_4); sub_803E708(0xA, 0x46); sub_806CDD4(SmeargleEntity, 0, DIRECTION_SOUTH); for(counter = 0x17; counter >= 0; counter--) @@ -4999,8 +4970,8 @@ void SmeargleRescueDialogue(void) void sub_808CD44(void) { - struct Entity *LeaderEntity; - struct Entity *SmeargleEntity; + Entity *LeaderEntity; + Entity *SmeargleEntity; LeaderEntity = xxx_call_GetLeader(); SmeargleEntity = GetEntityFromClientType(0x1F); @@ -5008,7 +4979,7 @@ void sub_808CD44(void) sub_80854D4(); sub_8085930(DIRECTION_NORTH); sub_80855E4(sub_8086A3C); - sub_8068FE0(SmeargleEntity, 0x21C, 0); + sub_8068FE0(SmeargleEntity, 540, 0); sub_8085860(LeaderEntity->pos.x, LeaderEntity->pos.y - 3); CopyMonsterNametoBuffer(gUnknown_202E038, MONSTER_SMEARGLE); } @@ -5018,10 +4989,10 @@ void sub_808CD9C(u8 r0) sub_8086448(); // There appears to be no one here. // It's impossible to go any further - sub_80866C4(&gUnknown_810697C); + sub_80866C4(gUnknown_810697C); } -u64 *sub_808CDB0(u8 r0) +const u64 *sub_808CDB0(u8 r0) { return &gUnknown_8107544[r0]; } diff --git a/src/code_805A120.c b/src/code_805A120.c index 9a0090747..e2f59063a 100644 --- a/src/code_805A120.c +++ b/src/code_805A120.c @@ -1,4 +1,5 @@ #include "global.h" +#include "code_806CD90.h" #include "constants/ability.h" #include "constants/move_id.h" #include "constants/status.h" @@ -14,7 +15,7 @@ #include "dungeon_movement.h" #include "dungeon_random.h" #include "dungeon_util.h" -#include "item.h" +#include "items.h" #include "moves.h" #include "move_effects_target.h" #include "move_util.h" @@ -94,54 +95,44 @@ extern s16 gUnknown_80F4DE2; extern u8 *gUnknown_80FEB90[]; extern s16 gUnknown_80F501A[]; -extern u32 sub_8055864(struct Entity *pokemon, struct Entity *target, struct Move *param_3, s32 param_4, s32 param_5); +extern u32 sub_8055864(Entity *pokemon, Entity *target, Move *param_3, s32 param_4, s32 param_5); extern void sub_80943A0(void*, s32); -extern s16 sub_8057600(struct Move*, u32); -extern void sub_806CDD4(struct Entity *, u32, u32); +extern s16 sub_8057600(Move*, u32); extern u8 sub_8044B28(void); -extern u8 sub_803F428(struct Position *pos); -extern void IncreaseEntityPixelPos(struct Entity *, u32, u32); +extern u8 sub_803F428(Position *pos); +extern void IncreaseEntityPixelPos(Entity *, u32, u32); extern void sub_803E46C(u32); extern void sub_807EC28(bool8); -extern void sub_806F370(struct Entity *r0, struct Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32); -void sub_8075900(struct Entity *pokemon, u8 r1); -extern void sub_804535C(struct Entity *, u32); -extern void sub_804AC20(struct Position *); -extern void sub_806A5B8(struct Entity *entity); -extern void sub_80694C0(struct Entity *, s32, s32, u32); -extern void sub_807D148(struct Entity *pokemon, struct Entity *target, u32 r2, struct Position *r3); -extern void SetMessageArgument(u8 *buffer, struct Entity *r1, u32); -extern void SetMessageArgument_2(u8 *buffer, struct EntityInfo *r1, u32); -void sub_80522F4(struct Entity *r0, struct Entity *r1, char r2[]); -extern void sub_806A6E8(struct Entity *); -extern u32 sub_8055640(struct Entity *, struct Entity *, struct Move *, u32, u32); +extern void sub_806F370(Entity *r0, Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32); +void sub_8075900(Entity *pokemon, u8 r1); +extern void sub_804535C(Entity *, u32); +extern void sub_804AC20(Position *); +extern void sub_806A5B8(Entity *entity); +extern void sub_80694C0(Entity *, s32, s32, u32); +extern void sub_807D148(Entity *pokemon, Entity *target, u32 r2, Position *r3); +extern void SetMessageArgument(u8 *buffer, Entity *r1, u32); +extern void SetMessageArgument_2(u8 *buffer, EntityInfo *r1, u32); +void sub_80522F4(Entity *r0, Entity *r1, char r2[]); +extern void sub_806A6E8(Entity *); +extern u32 sub_8055640(Entity *, Entity *, Move *, u32, u32); extern void sub_807EA30(u32); -extern void sub_806ABAC(struct Entity *, struct Entity *); +extern void sub_806ABAC(Entity *, Entity *); extern u8 sub_807EAA0(u32, u32); -extern void sub_8045C28(struct Item *, u8 , u8); -extern void sub_805A7D4(struct Entity *, struct Entity *, struct Item *, struct Position *); -extern void sub_8045394(struct Entity *, s32, s32); -extern void sub_804652C(struct Entity *, struct Entity *, struct Item *, u32, struct Position *); -extern void sub_806EAF4(struct Entity *, struct Entity *, u8, u32, u32, s32 *, u32, u16, u32); +extern void sub_8045C28(Item *, u8 , u8); +extern void sub_805A7D4(Entity *, Entity *, Item *, Position *); +extern void sub_8045394(Entity *, s32, s32); +extern void sub_804652C(Entity *, Entity *, Item *, u32, Position *); +extern void sub_806EAF4(Entity *, Entity *, u8, u32, u32, s32 *, u32, u16, u32); extern u8 *gUnknown_80FEB60[]; extern u8 *gUnknown_80FE330[]; extern u8 *gUnknown_80FE36C[]; extern u8 *gPtrForecastPreventsTypeSwitchMessage[]; -struct unkStruct_80928C0 -{ - u32 unk0; - s32 unk4; - u8 unk8; - u8 unk9; -}; - -void sub_80928C0(u8 *buffer, struct Move *move, struct unkStruct_80928C0 *param_3); -extern u8 sub_806F4A4(struct Entity *, u32); -extern void sub_807DF38(struct Entity *pokemon, struct Entity *target, struct Position *pos, u32, u8 moveType, s16); +extern u8 sub_806F4A4(Entity *, u32); +extern void sub_807DF38(Entity *pokemon, Entity *target, Position *pos, u32, u8 moveType, s16); -bool8 sub_8059424(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8059424(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -156,7 +147,7 @@ bool8 sub_8059424(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_805946C(struct Entity * pokemon,struct Entity * target,struct Move * move,u32 param_4) +bool8 sub_805946C(Entity * pokemon,Entity * target,Move * move,u32 param_4) { s32 HP; bool8 flag; @@ -179,7 +170,7 @@ bool8 sub_805946C(struct Entity * pokemon,struct Entity * target,struct Move * m return flag; } -bool8 sub_80594E0(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_80594E0(Entity *pokemon, Entity *target, Move *move, u32 param_4) { gDungeon->unkE269 = gUnknown_80F4F42; if(sub_807EAA0(1, 0) == 0) @@ -189,13 +180,13 @@ bool8 sub_80594E0(struct Entity *pokemon, struct Entity *target, struct Move *mo return TRUE; } -bool8 sub_8059528(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8059528(Entity *pokemon, Entity *target, Move *move, u32 param_4) { LowerAccuracyStageTarget(pokemon, target, gUnknown_8106A4C, TRUE); return TRUE; } -bool8 sub_8059540(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8059540(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -210,13 +201,13 @@ bool8 sub_8059540(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_8059588(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8059588(Entity *pokemon, Entity *target, Move *move, u32 param_4) { RaiseAttackStageTarget(pokemon, target, gUnknown_8106A50, 1); return TRUE; } -bool8 sub_80595A0(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_80595A0(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -231,7 +222,7 @@ bool8 sub_80595A0(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_80595EC(struct Entity * pokemon,struct Entity * target,struct Move * move,u32 param_4) +bool8 sub_80595EC(Entity * pokemon,Entity * target,Move * move,u32 param_4) { u8 moveType; u8 local_20; @@ -249,7 +240,7 @@ bool8 sub_80595EC(struct Entity * pokemon,struct Entity * target,struct Move * m } } -bool8 SolarBeamMoveAction(struct Entity * pokemon,struct Entity * target,struct Move * move,u32 param_4) +bool8 SolarBeamMoveAction(Entity * pokemon,Entity * target,Move * move,u32 param_4) { u8 weather; // weather and flag are reused in same variable s32 movePower; @@ -271,7 +262,7 @@ bool8 SolarBeamMoveAction(struct Entity * pokemon,struct Entity * target,struct return weather; } -bool8 sub_8059714(struct Entity * pokemon,struct Entity * target,struct Move * move,u32 param_4) +bool8 sub_8059714(Entity * pokemon,Entity * target,Move * move,u32 param_4) { u8 local_20; @@ -281,7 +272,7 @@ bool8 sub_8059714(struct Entity * pokemon,struct Entity * target,struct Move * m return local_20; } -bool8 FlyMoveAction(struct Entity * pokemon, struct Entity * target, struct Move * move, u32 param_4) +bool8 FlyMoveAction(Entity * pokemon, Entity * target, Move * move, u32 param_4) { bool8 flag; @@ -297,13 +288,13 @@ bool8 FlyMoveAction(struct Entity * pokemon, struct Entity * target, struct Move return flag; } -bool8 sub_80597F0(struct Entity * pokemon,struct Entity * target,struct Move * move,u32 param_4) +bool8 sub_80597F0(Entity * pokemon,Entity * target,Move * move,u32 param_4) { sub_807DF38(pokemon,target,&target->pos,2,GetMoveType(move),sub_8057600(move,param_4)); return TRUE; } -bool8 DiveMoveAction(struct Entity * pokemon, struct Entity * target, struct Move * move, u32 param_4) +bool8 DiveMoveAction(Entity * pokemon, Entity * target, Move * move, u32 param_4) { bool8 flag; @@ -322,7 +313,7 @@ bool8 DiveMoveAction(struct Entity * pokemon, struct Entity * target, struct Mov return flag; } -bool8 sub_80598CC(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_80598CC(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -337,13 +328,13 @@ bool8 sub_80598CC(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 StockpileMoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 StockpileMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { HandleStockpile(pokemon, target); return TRUE; } -bool8 sub_8059928(struct Entity * pokemon,struct Entity * target,struct Move * move,u32 param_4) +bool8 sub_8059928(Entity * pokemon,Entity * target,Move * move,u32 param_4) { bool8 flag; s32 iVar2; @@ -363,7 +354,7 @@ bool8 sub_8059928(struct Entity * pokemon,struct Entity * target,struct Move * m return flag; } -bool8 sub_8059988(struct Entity * pokemon,struct Entity * target,struct Move * move,u32 param_4) +bool8 sub_8059988(Entity * pokemon,Entity * target,Move * move,u32 param_4) { bool8 flag; @@ -379,7 +370,7 @@ bool8 sub_8059988(struct Entity * pokemon,struct Entity * target,struct Move * m return flag; } -bool8 sub_80599EC(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_80599EC(Entity *pokemon, Entity *target, Move *move, u32 param_4) { s32 HP; @@ -390,13 +381,13 @@ bool8 sub_80599EC(struct Entity *pokemon, struct Entity *target, struct Move *mo return TRUE; } -bool8 sub_8059A18(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8059A18(Entity *pokemon, Entity *target, Move *move, u32 param_4) { RaiseAccuracyStageTarget(pokemon, target, gUnknown_8106A50); return TRUE; } -bool8 sub_8059A2C(struct Entity * pokemon,struct Entity * target,struct Move * move,u32 param_4) +bool8 sub_8059A2C(Entity * pokemon,Entity * target,Move * move,u32 param_4) { u8 local_20; u32 level; @@ -408,25 +399,25 @@ bool8 sub_8059A2C(struct Entity * pokemon,struct Entity * target,struct Move * m return local_20; } -bool8 sub_8059AA8(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8059AA8(Entity *pokemon, Entity *target, Move *move, u32 param_4) { ConfuseStatusTarget(pokemon, target, TRUE); return TRUE; } -bool8 sub_8059AB8(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8059AB8(Entity *pokemon, Entity *target, Move *move, u32 param_4) { TauntStatusTarget(pokemon, target); return TRUE; } -bool8 sub_8059AC4(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8059AC4(Entity *pokemon, Entity *target, Move *move, u32 param_4) { HealTargetHP(pokemon, target, gUnknown_80F501A[GetApparentWeather(pokemon)], 0, TRUE); return TRUE; } -bool8 sub_8059AF8(struct Entity * pokemon,struct Entity * target,struct Move * move,u32 param_4) +bool8 sub_8059AF8(Entity * pokemon,Entity * target,Move * move,u32 param_4) { u8 local_20; @@ -442,21 +433,21 @@ bool8 sub_8059AF8(struct Entity * pokemon,struct Entity * target,struct Move * m } } -bool8 sub_8059B94(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8059B94(Entity *pokemon, Entity *target, Move *move, u32 param_4) { RaiseAttackStageTarget(pokemon, target, gUnknown_8106A4C, 2); return TRUE; } -bool8 ConversionMoveAction(struct Entity * pokemon,struct Entity * target,struct Move * move,u32 param_4) +bool8 ConversionMoveAction(Entity * pokemon,Entity * target,Move * move,u32 param_4) { u8 moveType; - struct Move *movePtr; + Move *movePtr; s32 index; - struct EntityInfo * info; + EntityInfo * info; s32 counter; s32 newIndex; - struct Move *moveStack [MAX_MON_MOVES]; + Move *moveStack [MAX_MON_MOVES]; counter = 0; info = target->info; @@ -492,13 +483,13 @@ bool8 ConversionMoveAction(struct Entity * pokemon,struct Entity * target,struct } } -bool8 Conversion2MoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 Conversion2MoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { Conversion2StatusTarget(pokemon, target); return TRUE; } -bool8 HelpingHandMoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 HelpingHandMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; flag = FALSE; @@ -514,19 +505,19 @@ bool8 HelpingHandMoveAction(struct Entity *pokemon, struct Entity *target, struc return flag; } -bool8 sub_8059CD8(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8059CD8(Entity *pokemon, Entity *target, Move *move, u32 param_4) { RaiseDefenseStageTarget(pokemon, target, gUnknown_8106A4C, 2); return TRUE; } -bool8 sub_8059CF0(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8059CF0(Entity *pokemon, Entity *target, Move *move, u32 param_4) { sub_807D148(pokemon, target, 0, NULL); return TRUE; } -bool8 sub_8059D00(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8059D00(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -541,13 +532,13 @@ bool8 sub_8059D00(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_8059D48(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8059D48(Entity *pokemon, Entity *target, Move *move, u32 param_4) { ParalyzeStatusTarget(pokemon, target, TRUE); return TRUE; } -bool8 sub_8059D58(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8059D58(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -562,25 +553,25 @@ bool8 sub_8059D58(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_8059D98(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8059D98(Entity *pokemon, Entity *target, Move *move, u32 param_4) { ImmobilizedStatusTarget(pokemon, target); return TRUE; } -bool8 sub_8059DA4(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8059DA4(Entity *pokemon, Entity *target, Move *move, u32 param_4) { PoisonedStatusTarget(pokemon, target, TRUE); return TRUE; } -bool8 sub_8059DB4(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8059DB4(Entity *pokemon, Entity *target, Move *move, u32 param_4) { BadlyPoisonedStatusTarget(pokemon, target, TRUE); return TRUE; } -bool8 sub_8059DC4(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8059DC4(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -595,7 +586,7 @@ bool8 sub_8059DC4(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_8059E0C(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_8059E0C(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -610,7 +601,7 @@ bool8 sub_8059E0C(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_8059E54(struct Entity * pokemon,struct Entity * target,struct Move * move,u32 param_4,u8 param_5) +bool8 sub_8059E54(Entity * pokemon,Entity * target,Move * move,u32 param_4,u8 param_5) { u8 moveType; u32 movePower; @@ -639,7 +630,7 @@ bool8 sub_8059E54(struct Entity * pokemon,struct Entity * target,struct Move * m return flag; } -bool8 sub_8059F38(struct Entity * pokemon,struct Entity * target,struct Move * move,u32 param_4) +bool8 sub_8059F38(Entity * pokemon,Entity * target,Move * move,u32 param_4) { bool8 flag; @@ -660,7 +651,7 @@ bool8 sub_8059F38(struct Entity * pokemon,struct Entity * target,struct Move * m return flag; } -bool8 sub_8059FC8(struct Entity * pokemon,struct Entity * target,struct Move * move,u32 param_4,u8 param_5) +bool8 sub_8059FC8(Entity * pokemon,Entity * target,Move * move,u32 param_4,u8 param_5) { u8 moveType; u32 movePower; @@ -689,7 +680,7 @@ bool8 sub_8059FC8(struct Entity * pokemon,struct Entity * target,struct Move * m return flag; } -bool8 TriAttackMoveAction(struct Entity * pokemon, struct Entity * target, struct Move *move, u32 param_4) +bool8 TriAttackMoveAction(Entity * pokemon, Entity * target, Move *move, u32 param_4) { bool8 flag; @@ -717,16 +708,16 @@ bool8 TriAttackMoveAction(struct Entity * pokemon, struct Entity * target, struc return flag; } -bool8 sub_805A120(struct Entity * pokemon,struct Entity * target, struct Move *move, u32 param_4) +bool8 sub_805A120(Entity * pokemon,Entity * target, Move *move, u32 param_4) { - struct EntityInfo *r9; - struct EntityInfo *r8; - struct EntityInfo *r7; - struct EntityInfo *sp; - struct Item item; + EntityInfo *r9; + EntityInfo *r8; + EntityInfo *r7; + EntityInfo *sp; + Item item; bool32 flag; - struct Item *item1; - struct Item *item2; + Item *item1; + Item *item2; flag = FALSE; r9 = pokemon->info; @@ -775,7 +766,7 @@ bool8 sub_805A120(struct Entity * pokemon,struct Entity * target, struct Move *m } } -bool8 sub_805A210(struct Entity * pokemon, struct Entity * target, struct Move *move, u32 param_4) +bool8 sub_805A210(Entity * pokemon, Entity * target, Move *move, u32 param_4) { bool8 flag; @@ -784,7 +775,7 @@ bool8 sub_805A210(struct Entity * pokemon, struct Entity * target, struct Move * return flag; } -bool8 sub_805A23C(struct Entity * pokemon, struct Entity * target, struct Move *move, u32 param_4) +bool8 sub_805A23C(Entity * pokemon, Entity * target, Move *move, u32 param_4) { if(move->id == MOVE_MUD_SPORT) { @@ -798,7 +789,7 @@ bool8 sub_805A23C(struct Entity * pokemon, struct Entity * target, struct Move * } -bool8 sub_805A258(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_805A258(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -813,24 +804,24 @@ bool8 sub_805A258(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_805A2A0(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_805A2A0(Entity *pokemon, Entity *target, Move *move, u32 param_4) { return sub_805BA50(pokemon, target, move, param_4); } -bool8 sub_805A2B0(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_805A2B0(Entity *pokemon, Entity *target, Move *move, u32 param_4) { RaiseDefenseStageTarget(pokemon, target, gUnknown_8106A50, 2); return TRUE; } -bool8 sub_805A2C8(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_805A2C8(Entity *pokemon, Entity *target, Move *move, u32 param_4) { LowerAttackStageTarget(pokemon, target, gUnknown_8106A4C, 1, 1, TRUE); return TRUE; } -bool8 SurfMoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 SurfMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; u32 uVar2; @@ -848,10 +839,10 @@ bool8 SurfMoveAction(struct Entity *pokemon, struct Entity *target, struct Move return flag; } -bool8 RolePlayMoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 RolePlayMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { - struct EntityInfo * entityInfo; - struct EntityInfo * targetEntityInfo; + EntityInfo * entityInfo; + EntityInfo * targetEntityInfo; entityInfo = pokemon->info; targetEntityInfo = target->info; @@ -873,7 +864,7 @@ bool8 RolePlayMoveAction(struct Entity *pokemon, struct Entity *target, struct M } } -bool8 sub_805A394(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_805A394(Entity *pokemon, Entity *target, Move *move, u32 param_4) { gDungeon->unkE267[1] = gUnknown_80F4F42; if (sub_807EAA0(1,0) == 0) { @@ -882,19 +873,19 @@ bool8 sub_805A394(struct Entity *pokemon, struct Entity *target, struct Move *mo return TRUE; } -bool8 sub_805A3DC(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_805A3DC(Entity *pokemon, Entity *target, Move *move, u32 param_4) { LowerDefenseStageTarget(pokemon, target, gUnknown_8106A4C, 1, 1, TRUE); return TRUE; } -bool8 WishMoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 WishMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { WishStatusTarget(pokemon, target); return TRUE; } -bool8 sub_805A408(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_805A408(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -909,17 +900,17 @@ bool8 sub_805A408(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_805A450(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_805A450(Entity *pokemon, Entity *target, Move *move, u32 param_4) { sub_80522F4(pokemon,target,*gUnknown_80FC730); return FALSE; } -bool8 sub_805A464(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_805A464(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool32 flag; - struct Item item; - struct Position pos; + Item item; + Position pos; flag = FALSE; if (sub_8055640(pokemon, target, move, 0x100, param_4) != 0) { @@ -936,25 +927,25 @@ bool8 sub_805A464(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_805A4C0(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_805A4C0(Entity *pokemon, Entity *target, Move *move, u32 param_4) { sub_80522F4(pokemon,target,*gUnknown_80FC74C); return FALSE; } -bool8 sub_805A4D4(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_805A4D4(Entity *pokemon, Entity *target, Move *move, u32 param_4) { NappingStatusTarget(pokemon, target, CalculateStatusTurns(target, gUnknown_80F4E94, FALSE)); return TRUE; } -bool8 sub_805A4FC(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_805A4FC(Entity *pokemon, Entity *target, Move *move, u32 param_4) { IngrainedStatusTarget(pokemon, target); return TRUE; } -bool8 SwallowMoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 SwallowMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { u8 *stockpileStage; @@ -969,13 +960,13 @@ bool8 SwallowMoveAction(struct Entity *pokemon, struct Entity *target, struct Mo return TRUE; } -bool8 CurseMoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 CurseMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { CurseStatusTarget(pokemon, target); return TRUE; } -bool8 sub_805A568(struct Entity * pokemon, struct Entity * target, struct Move *move, u32 param_4) +bool8 sub_805A568(Entity * pokemon, Entity * target, Move *move, u32 param_4) { bool8 flag; @@ -983,7 +974,7 @@ bool8 sub_805A568(struct Entity * pokemon, struct Entity * target, struct Move * return flag; } -bool8 TickleMoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 TickleMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { u32 stat; bool32 flag; @@ -1000,9 +991,9 @@ bool8 TickleMoveAction(struct Entity *pokemon, struct Entity *target, struct Mov return flag; } -bool8 sub_805A5E8(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 stat, u32 param_5) +bool8 sub_805A5E8(Entity *pokemon, Entity *target, Move *move, u32 stat, u32 param_5) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; bool32 flag; flag = FALSE; @@ -1019,7 +1010,7 @@ bool8 sub_805A5E8(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 SpitUpMoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 SpitUpMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { u8 *stockpileStage; @@ -1034,7 +1025,7 @@ bool8 SpitUpMoveAction(struct Entity *pokemon, struct Entity *target, struct Mov return TRUE; } -bool8 sub_805A688(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_805A688(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -1049,14 +1040,14 @@ bool8 sub_805A688(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 KnockOffMoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 KnockOffMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { - struct EntityInfo *entityInfo; - struct EntityInfo *targetEntityInfo1; - struct EntityInfo *targetEntityInfo2; - struct Item heldItem; - struct Position pos; - struct Item *itemPtr; + EntityInfo *entityInfo; + EntityInfo *targetEntityInfo1; + EntityInfo *targetEntityInfo2; + Item heldItem; + Position pos; + Item *itemPtr; u32 flag; u32 itemFlag; @@ -1105,15 +1096,15 @@ bool8 KnockOffMoveAction(struct Entity *pokemon, struct Entity *target, struct M } } -void sub_805A7D4(struct Entity * pokemon, struct Entity * target, struct Item *item, struct Position *pos) +void sub_805A7D4(Entity * pokemon, Entity * target, Item *item, Position *pos) { - struct Entity stackEntity; + Entity stackEntity; stackEntity.type = ENTITY_ITEM; stackEntity.unk24 = 0; stackEntity.isVisible = TRUE; stackEntity.unk22 = 0; - stackEntity.info = (struct EntityInfo*) item; + stackEntity.info = (EntityInfo*) item; stackEntity.pos.x = target->pos.x + pos->x; stackEntity.pos.y = target->pos.y + pos->y; sub_8045394(&stackEntity,(target->pos.x * 0x18 + 4) * 0x100, @@ -1123,17 +1114,17 @@ void sub_805A7D4(struct Entity * pokemon, struct Entity * target, struct Item *i sub_804652C(pokemon,&stackEntity,item,1,0); } -bool8 sub_805A85C(struct Entity * pokemon, struct Entity * target, struct Move *move, u32 param_4) +bool8 sub_805A85C(Entity * pokemon, Entity * target, Move *move, u32 param_4) { int x; int y; int counter; - struct Position *r9; - struct Position pos1; - struct Move stackMove; - struct Position32 pos2; + Position *r9; + Position pos1; + Move stackMove; + Position32 pos2; struct Tile *tile; - struct Entity *entity; + Entity *entity; s32 temp; s32 temp2; u8 check; @@ -1208,9 +1199,9 @@ _0805A9FE: _0805AA5E: if (EntityExists(target)) { #ifndef NOMATCHING - register struct Position *pos asm("r1"); + register Position *pos asm("r1"); #else - struct Position *pos; + Position *pos; #endif sub_804535C(target, 0); pos = r9; @@ -1228,17 +1219,17 @@ _0805AA5E: return TRUE; } -bool8 sub_805AAD0(struct Entity * pokemon, struct Entity * target, struct Move *move, u32 param_4) +bool8 sub_805AAD0(Entity * pokemon, Entity * target, Move *move, u32 param_4) { FixedDamageStatusTarget(pokemon, pokemon); return TRUE; } -bool8 BellyDrumMoveAction(struct Entity * pokemon,struct Entity * target, struct Move *move, u32 param_4) +bool8 BellyDrumMoveAction(Entity * pokemon,Entity * target, Move *move, u32 param_4) { u32 *belly; u32 newBelly; - struct EntityInfo *info; + EntityInfo *info; bool8 flag; info = pokemon->info; @@ -1257,13 +1248,13 @@ bool8 BellyDrumMoveAction(struct Entity * pokemon,struct Entity * target, struct return flag; } -bool8 LightScreenMoveAction(struct Entity * pokemon, struct Entity * target, struct Move *move, u32 param_4) +bool8 LightScreenMoveAction(Entity * pokemon, Entity * target, Move *move, u32 param_4) { LightScreenStatusTarget(pokemon, target); return TRUE; } -bool8 SecretPowerMoveAction(struct Entity * pokemon, struct Entity * target, struct Move *move, u32 param_4) +bool8 SecretPowerMoveAction(Entity * pokemon, Entity * target, Move *move, u32 param_4) { bool8 flag; @@ -1306,7 +1297,7 @@ bool8 SecretPowerMoveAction(struct Entity * pokemon, struct Entity * target, str return flag; } -bool8 sub_805AC90(struct Entity * pokemon, struct Entity * target, struct Move *move, u32 param_4) +bool8 sub_805AC90(Entity * pokemon, Entity * target, Move *move, u32 param_4) { bool8 flag; @@ -1320,7 +1311,7 @@ bool8 sub_805AC90(struct Entity * pokemon, struct Entity * target, struct Move * return flag; } -bool8 BulkUpMoveAction(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 BulkUpMoveAction(Entity *pokemon, Entity *target, Move *move, u32 param_4) { s32 stat = gUnknown_8106A4C; RaiseAttackStageTarget(pokemon, target, stat, 1); @@ -1328,19 +1319,19 @@ bool8 BulkUpMoveAction(struct Entity *pokemon, struct Entity *target, struct Mov return TRUE; } -bool8 sub_805AD04(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_805AD04(Entity *pokemon, Entity *target, Move *move, u32 param_4) { PausedStatusTarget(pokemon, target, 1, CalculateStatusTurns(target, &gUnknown_80F4EE0, TRUE), TRUE); return TRUE; } -bool8 sub_805AD34(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_805AD34(Entity *pokemon, Entity *target, Move *move, u32 param_4) { LowerAttackStageTarget(pokemon, target, gUnknown_8106A4C, 2, 1, TRUE); return TRUE; } -static inline bool8 sub_805AD54_sub(struct Entity *entity) +static inline bool8 sub_805AD54_sub(Entity *entity) { if ((entity->info->joinedAt == 0x4A) || (entity->info->joinedAt == 0x47)) { return TRUE; @@ -1350,17 +1341,17 @@ static inline bool8 sub_805AD54_sub(struct Entity *entity) } } -bool8 sub_805AD54(struct Entity * pokemon, struct Entity * target, struct Move *move, u32 param_4) +bool8 sub_805AD54(Entity * pokemon, Entity * target, Move *move, u32 param_4) { s32 numPossibleTargets; - struct EntityInfo *info; - struct Entity *targetEntity; + EntityInfo *info; + Entity *targetEntity; #ifndef NONMATCHING register s32 index asm("r6"); #else s32 index; #endif - struct Entity **possibleTargets; + Entity **possibleTargets; bool8 flag; flag = FALSE; @@ -1393,7 +1384,7 @@ bool8 sub_805AD54(struct Entity * pokemon, struct Entity * target, struct Move * return flag; } -bool8 sub_805AE3C(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_805AE3C(Entity *pokemon, Entity *target, Move *move, u32 param_4) { bool8 flag; @@ -1402,7 +1393,7 @@ bool8 sub_805AE3C(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_805AE74(struct Entity * pokemon, struct Entity * target, struct Move *move, u32 param_4) +bool8 sub_805AE74(Entity * pokemon, Entity * target, Move *move, u32 param_4) { bool8 flag; @@ -1416,7 +1407,7 @@ bool8 sub_805AE74(struct Entity * pokemon, struct Entity * target, struct Move * return flag; } -bool8 sub_805AECC(struct Entity * pokemon, struct Entity * target, struct Move *move, u32 param_4) +bool8 sub_805AECC(Entity * pokemon, Entity * target, Move *move, u32 param_4) { bool8 flag; @@ -1431,17 +1422,17 @@ bool8 sub_805AECC(struct Entity * pokemon, struct Entity * target, struct Move * return flag; } -bool8 PresentMoveAction(struct Entity * pokemon, struct Entity * target, struct Move *move, u32 param_4) +bool8 PresentMoveAction(Entity * pokemon, Entity * target, Move *move, u32 param_4) { s32 rand1; s32 rand2; s32 HP; bool8 flag; #ifndef NONMATCHING - register struct Move *move_r6 asm("r6"); + register Move *move_r6 asm("r6"); register u32 param_4_r4 asm("r4"); #else - struct Move *move_r6; + Move *move_r6; u32 param_4_r4; #endif diff --git a/src/code_805D8C8.c b/src/code_805D8C8.c index e0c374ac9..5e22c7704 100644 --- a/src/code_805D8C8.c +++ b/src/code_805D8C8.c @@ -1,90 +1,93 @@ #include "global.h" -#include "file_system.h" +#include "code_805D8C8.h" #include "dungeon_global_data.h" #include "dungeon_util.h" -extern struct FileArchive gMonsterFileArchive; -extern u8 gUnknown_8106EA0[]; // ax%03d -extern int sprintf(char *, const char *, ...); -void sub_8068838(s16, bool32); -void sub_80688B0(void); -void sub_8068884(void); +// monster_sbin.s +extern const struct FileArchive gMonsterFileArchive; +// data_8106A4C.s +extern const u8 gUnknown_8106EA0[]; // ax%03d + +// ??? +extern s32 sprintf(char *, const char *, ...); + +static void sub_8068884(void); +static void sub_80688B0(void); void sub_8068768(void) { - struct Entity *entity; - int index; + Entity *entity; + s32 i; - for(index = 0; index < DUNGEON_MAX_POKEMON; index++) - { - entity = gDungeon->allPokemon[index]; - if ((entity != NULL) && EntityExists(entity)) { + for (i = 0; i < DUNGEON_MAX_POKEMON; i++) { + entity = gDungeon->allPokemon[i]; + + if (entity != NULL && EntityExists(entity)) sub_8068838(entity->info->apparentID, FALSE); - } } } void sub_80687AC(void) { gDungeon->unk37F0 = 0x400; - gDungeon->unk37F4 = 0xA; + gDungeon->unk37F4 = 10; } -struct OpenedFile *sub_80687D0(s16 _id) +OpenedFile *sub_80687D0(s16 species) { - s32 id = _id; - return gDungeon->sprites[id]; + s32 species32 = species; + return gDungeon->sprites[species32]; } // 85.94 matching (Seth) -// https://decomp.me/scratch/CI98Y +// https://decomp.me/scratch/CI98Y // -#ifdef NONMATCING -void sub_80687EC(s32 _id) +#ifdef NONMATCHING +static void sub_80687EC(s32 _id) { - u8 name [12]; - s16 id = _id; + u8 name [12]; + s16 id = _id; - if (gDungeon->sprites[id] == NULL) { - sprintf(name,gUnknown_8106EA0); - gDungeon->sprites[id] = OpenFileAndGetFileDataPtr(name,&gMonsterFileArchive); - } + if (gDungeon->sprites[id] == NULL) { + sprintf(name, gUnknown_8106EA0); + gDungeon->sprites[id] = OpenFileAndGetFileDataPtr(name, &gMonsterFileArchive); + } } #else NAKED -void sub_80687EC(s32 _id) +static void sub_80687EC(s32 _id) { asm_unified( - "\tpush {r4,r5,lr}\n" - "\tsub sp, 0xC\n" - "\tlsls r0, 16\n" - "\tasrs r2, r0, 16\n" - "\tldr r5, _08068828\n" - "\tldr r0, [r5]\n" - "\tlsls r4, r2, 2\n" - "\tldr r1, _0806882C\n" - "\tadds r0, r1\n" - "\tadds r0, r4\n" - "\tldr r0, [r0]\n" - "\tcmp r0, 0\n" - "\tbne _08068820\n" - "\tldr r1, _08068830\n" - "\tmov r0, sp\n" - "\tbl sprintf\n" - "\tldr r1, _08068834\n" - "\tmov r0, sp\n" - "\tbl OpenFileAndGetFileDataPtr\n" - "\tldr r1, [r5]\n" - "\tldr r2, _0806882C\n" - "\tadds r1, r2\n" - "\tadds r1, r4\n" - "\tstr r0, [r1]\n" + "\tpush {r4,r5,lr}\n" + "\tsub sp, 0xC\n" + "\tlsls r0, 16\n" + "\tasrs r2, r0, 16\n" + "\tldr r5, _08068828\n" + "\tldr r0, [r5]\n" + "\tlsls r4, r2, 2\n" + "\tldr r1, _0806882C\n" + "\tadds r0, r1\n" + "\tadds r0, r4\n" + "\tldr r0, [r0]\n" + "\tcmp r0, 0\n" + "\tbne _08068820\n" + "\tldr r1, _08068830\n" + "\tmov r0, sp\n" + "\tbl sprintf\n" + "\tldr r1, _08068834\n" + "\tmov r0, sp\n" + "\tbl OpenFileAndGetFileDataPtr\n" + "\tldr r1, [r5]\n" + "\tldr r2, _0806882C\n" + "\tadds r1, r2\n" + "\tadds r1, r4\n" + "\tstr r0, [r1]\n" "_08068820:\n" - "\tadd sp, 0xC\n" - "\tpop {r4,r5}\n" - "\tpop {r0}\n" - "\tbx r0\n" - "\t.align 2, 0\n" + "\tadd sp, 0xC\n" + "\tpop {r4,r5}\n" + "\tpop {r0}\n" + "\tbx r0\n" + "\t.align 2, 0\n" "_08068828: .4byte gDungeon\n" "_0806882C: .4byte 0x00017b44\n" "_08068830: .4byte gUnknown_8106EA0\n" @@ -92,25 +95,24 @@ void sub_80687EC(s32 _id) } #endif -void sub_8068838(s16 id, bool32 _param_2) +void sub_8068838(s16 id, bool32 a1) { s32 id_s32 = id; - bool8 param_2 = _param_2; + bool8 param_2 = a1; - - if ((param_2 == 0) && - ((id_s32 == MONSTER_DEOXYS_NORMAL) || (id_s32 == MONSTER_DEOXYS_ATTACK) || (id_s32 == MONSTER_DEOXYS_DEFENSE) || (id_s32 == MONSTER_DEOXYS_SPEED))) { + if (!param_2 && + (id_s32 == MONSTER_DEOXYS_NORMAL || id_s32 == MONSTER_DEOXYS_ATTACK || id_s32 == MONSTER_DEOXYS_DEFENSE || id_s32 == MONSTER_DEOXYS_SPEED)) { sub_80688B0(); } else { sub_80687EC(id_s32); - if ((u16)(id_s32 - MONSTER_CASTFORM) < 4) { + // >= MONSTER_CASTFORM && <= MONSTER_CASTFORM_RAINY + if ((u16)(id_s32 - MONSTER_CASTFORM) < 4) sub_8068884(); - } } } -void sub_8068884(void) +static void sub_8068884(void) { sub_80687EC(MONSTER_CASTFORM); sub_80687EC(MONSTER_CASTFORM_SNOWY); @@ -118,22 +120,19 @@ void sub_8068884(void) sub_80687EC(MONSTER_CASTFORM_RAINY); } -void sub_80688B0(void) +static void sub_80688B0(void) { sub_80687EC(gDungeon->unk3800); } void CloseAllSpriteFiles(void) { - s32 index; + s32 i; - for(index = 0; index < 0x1A8; index++) - { - if (gDungeon->sprites[index] != NULL) { - CloseFile(gDungeon->sprites[index]); - gDungeon->sprites[index] = NULL; + for (i = 0; i <= MONSTER_MAX; i++) { + if (gDungeon->sprites[i] != NULL) { + CloseFile(gDungeon->sprites[i]); + gDungeon->sprites[i] = NULL; } - } -} - - + } +} \ No newline at end of file diff --git a/src/code_8069E0C.c b/src/code_8069E0C.c index 3adcbba24..c0419cc04 100644 --- a/src/code_8069E0C.c +++ b/src/code_8069E0C.c @@ -15,7 +15,7 @@ #include "game_options.h" #include "text_util.h" -extern struct GameOptions *gGameOptionsRef; +extern GameOptions *gGameOptionsRef; struct unkStruct_80F520C { @@ -33,24 +33,24 @@ extern u8 *gUnknown_80FCC7C[]; extern u8 *gUnknown_80FCCAC[]; extern u8 *gUnknown_80FDCC8[]; -extern void SetMessageArgument(char[], struct Entity*, u32); -void sub_80522F4(struct Entity *r0, struct Entity *r1, const char r2[]); -extern void sub_8042900(struct Entity *r0); -extern void sub_8042968(struct Entity *r0); -extern void sub_806ABAC(struct Entity *, struct Entity *); -void sub_8041BBC(struct Entity *r0); -extern u8 sub_8045888(struct Entity *); -extern void sub_806A2BC(struct Entity *, u8); +extern void SetMessageArgument(char[], Entity*, u32); +void sub_80522F4(Entity *r0, Entity *r1, const char r2[]); +extern void sub_8042900(Entity *r0); +extern void sub_8042968(Entity *r0); +extern void sub_806ABAC(Entity *, Entity *); +void sub_8041BBC(Entity *r0); +extern u8 sub_8045888(Entity *); +extern void sub_806A2BC(Entity *, u8); extern void sub_804178C(u32); -extern void sub_803F508(struct Entity *); -extern void sub_804AC20(struct Position *); +extern void sub_803F508(Entity *); +extern void sub_804AC20(Position *); extern void sub_803E46C(u32); extern void sub_803E708(u32 r0, u32 r1); -void sub_8069E0C(struct Entity *pokemon) +void sub_8069E0C(Entity *pokemon) { s32 index; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; entityInfo = pokemon->info; if (HasAbility(pokemon, ABILITY_FORECAST)) { @@ -68,7 +68,7 @@ void sub_8069E0C(struct Entity *pokemon) void TriggerWeatherAbilities(void) { - struct Entity *entity; + Entity *entity; s32 index; if (gDungeon->unkC != 0) { @@ -96,7 +96,7 @@ void TriggerWeatherAbilities(void) } } -s32 sub_8069F54(struct Entity *pokemon, s16 param_2) +s32 sub_8069F54(Entity *pokemon, s16 param_2) { if ((((param_2 * 0x10000) + 0xfe880000U) >> 0x10) < 4) { if (HasAbility(pokemon, ABILITY_FORECAST)) { @@ -109,14 +109,14 @@ s32 sub_8069F54(struct Entity *pokemon, s16 param_2) return param_2; } -static inline u8 sub_8069F9C_sub(struct Entity *pokemon) +static inline u8 sub_8069F9C_sub(Entity *pokemon) { u32 weather; weather = GetApparentWeather(pokemon); return gUnknown_80F51E4[weather]; } -void sub_8069F9C(struct Entity *pokemon,struct Entity * target,struct Move *move) +void sub_8069F9C(Entity *pokemon,Entity * target,Move *move) { u8 type; u8 ability; @@ -128,9 +128,9 @@ void sub_8069F9C(struct Entity *pokemon,struct Entity * target,struct Move *move #endif int randomIndex; int abilityIndex; - struct EntityInfo *iVar6; // r7 - struct EntityInfo *iVar7; // r2 - struct EntityInfo *iVar8; + EntityInfo *iVar6; // r7 + EntityInfo *iVar7; // r2 + EntityInfo *iVar8; u8 local_20 [4]; if (!EntityExists(pokemon)) { @@ -203,12 +203,12 @@ _0806A068: } } -void sub_806A120(struct Entity * pokemon, struct Entity * target, struct Move* move) +void sub_806A120(Entity * pokemon, Entity * target, Move* move) { u32 uVar2_u32; u8 moveType; const char *typeString; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if ((((EntityExists(pokemon)) && (EntityExists(target))) && (pokemon != target)) && (entityInfo = target->info, entityInfo->protectionStatus == STATUS_CONVERSION2)) { @@ -226,17 +226,17 @@ void sub_806A120(struct Entity * pokemon, struct Entity * target, struct Move* m } } -void sub_806A1B0(struct Entity *pokemon) +void sub_806A1B0(Entity *pokemon) { if ((EntityExists(pokemon)) && (HasAbility(pokemon, ABILITY_TRUANT))) { PausedStatusTarget(pokemon,pokemon,0,1,0); } } -void sub_806A1E8(struct Entity *pokemon) +void sub_806A1E8(Entity *pokemon) { bool8 bVar3; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; bVar3 = FALSE; if (EntityExists(pokemon)) { @@ -253,10 +253,10 @@ void sub_806A1E8(struct Entity *pokemon) } } -void sub_806A240(struct Entity *pokemon, struct Entity *target) +void sub_806A240(Entity *pokemon, Entity *target) { bool8 isNotTeamMember; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; isNotTeamMember = FALSE; if (EntityExists(pokemon)){ @@ -278,7 +278,7 @@ void sub_806A240(struct Entity *pokemon, struct Entity *target) } } -void sub_806A2BC(struct Entity *pokemon, u8 param_2) +void sub_806A2BC(Entity *pokemon, u8 param_2) { if ((EntityExists(pokemon)) && (GetEntityType(pokemon) == ENTITY_MONSTER) && (gDungeon->cameraTarget != pokemon)) { if (param_2 != '\0') { diff --git a/src/code_806CD90.c b/src/code_806CD90.c index b065fb93c..273647b98 100644 --- a/src/code_806CD90.c +++ b/src/code_806CD90.c @@ -1,62 +1,61 @@ #include "global.h" #include "code_805D8C8.h" +#include "code_806CD90.h" #include "constants/direction.h" #include "constants/status.h" -#include "dungeon_entity.h" #include "dungeon_global_data.h" #include "dungeon_util.h" #include "pokemon.h" +#include "pokemon_mid.h" #include "random.h" #include "sprite.h" #include "tile_types.h" -extern u8 sub_806CEBC(struct Entity *); -extern void sub_806CCB4(struct Entity *, u8); -extern void sub_803E46C(u32); -extern bool8 sub_808DA44(s32 a1_, u32 a2_); -extern u32 sub_806CF98(struct Entity *); -extern struct OpenedFile *sub_80687D0(s16); -void sub_806CDD4(struct Entity *, u8, u32); - +// data_8106A4C.s extern const u8 gUnknown_8106EEF[]; -extern const u8 gDungeonWaterType[]; + +// code_803D110.s +extern void sub_803E46C(u32); void sub_806CC10(void) { - struct EntityInfo *entityInfo; - struct Entity *entity; - s32 index; - - for(index = 0; index < DUNGEON_MAX_POKEMON; index++) - { - entity = gDungeon->allPokemon[index]; - if (EntityExists(entity)) { - entityInfo = entity->info; + EntityInfo *entityInfo; + Entity *entity; + s32 i; - if ((entityInfo->unk166 != 0) && (entityInfo->unk166--, (entityInfo->unk166 & 1) == 0)) { - sub_806CDD4(entity,0, (entityInfo->action.direction - 1) & 7); - } + for (i = 0; i < DUNGEON_MAX_POKEMON; i++) { + entity = gDungeon->allPokemon[i]; + + if (EntityExists(entity)) { + entityInfo = entity->info; + + if (entityInfo->unk166 != 0) { + entityInfo->unk166--; + if ((entityInfo->unk166 & 1) == 0) // If value is even: + sub_806CDD4(entity, 0, (entityInfo->action.direction - 1) & 7); + } + } } - } } void sub_806CC70(void) { - s32 index; - struct Entity *entity; - for(index = 0; index < DUNGEON_MAX_POKEMON; index++) - { - entity = gDungeon->allPokemon[index]; - if(EntityExists(entity)) + s32 i; + Entity *entity; + + for (i = 0; i < DUNGEON_MAX_POKEMON; i++) { + entity = gDungeon->allPokemon[i]; + + if (EntityExists(entity)) sub_806CCB4(entity, sub_806CEBC(entity)); } } -void sub_806CCB4(struct Entity *entity, u8 param_2) +void sub_806CCB4(Entity *entity, u8 a1) { s32 sVar1; bool8 flag; - struct EntityInfo *info; + EntityInfo *info; info = entity->info; flag = gDungeon->hallucinating; @@ -64,8 +63,8 @@ void sub_806CCB4(struct Entity *entity, u8 param_2) if (entity == gDungeon->cameraTarget) flag = FALSE; - entity->unk6B = param_2; - entity->unk6A = param_2; + entity->unk6B = a1; + entity->unk6A = a1; entity->direction2 = info->action.direction; entity->direction = info->action.direction; entity->unk6F = 0; @@ -81,167 +80,153 @@ void sub_806CCB4(struct Entity *entity, u8 param_2) void sub_806CD90(void) { - s32 index; - struct Entity *entity; - for(index = 0; index < DUNGEON_MAX_POKEMON; index++) - { - entity = gDungeon->allPokemon[index]; - if(EntityExists(entity)) + s32 i; + Entity *entity; + + for (i = 0; i < DUNGEON_MAX_POKEMON; i++) { + entity = gDungeon->allPokemon[i]; + + if (EntityExists(entity)) sub_806CCB4(entity, sub_806CEBC(entity)); } } -void sub_806CDD4(struct Entity *entity, u8 r1, u32 r2) +void sub_806CDD4(Entity *entity, u8 a1, u32 a2) { - if(GetEntityType(entity) == ENTITY_MONSTER) - { - entity->unk6A = r1; - if(r2 < NUM_DIRECTIONS) entity->direction = r2; + if (GetEntityType(entity) == ENTITY_MONSTER) { + entity->unk6A = a1; + + if (a2 < NUM_DIRECTIONS) + entity->direction = a2; } } -void sub_806CDFC(struct Entity *entity, u8 r1, u32 r2) +void sub_806CDFC(Entity *entity, u8 a1, u32 a2) { - if(GetEntityType(entity) == ENTITY_MONSTER) - { - if(entity->unk6B == r1) - { - if(entity->direction2 == r2) - return; - else - goto change_dir; - } - else - { -change_dir: - sub_806CDD4(entity, r1, r2); - } + if (GetEntityType(entity) == ENTITY_MONSTER) { + if (entity->unk6B == a1 && entity->direction2 == a2) + return; + sub_806CDD4(entity, a1, a2); } } -void sub_806CE34(struct Entity *entity, u32 newDir) +void sub_806CE34(Entity *entity, u32 newDir) { - if(GetEntityType(entity) == ENTITY_MONSTER) - { + if (GetEntityType(entity) == ENTITY_MONSTER) { entity->unk6A = sub_806CEBC(entity); - if(newDir < NUM_DIRECTIONS) - { + + if (newDir < NUM_DIRECTIONS) { entity->info->action.direction = newDir & DIRECTION_MASK; entity->direction = newDir & DIRECTION_MASK; } } } -void sub_806CE68(struct Entity *entity, u32 newDir) +void sub_806CE68(Entity *entity, u32 newDir) { - if(GetEntityType(entity) == ENTITY_MONSTER) - { + if (GetEntityType(entity) == ENTITY_MONSTER) { entity->unk6A = sub_806CEBC(entity); - if(newDir < NUM_DIRECTIONS) - { + + if (newDir < NUM_DIRECTIONS) entity->direction = newDir; - } } } -void sub_806CE94(struct Entity *entity, u32 newDir) +void sub_806CE94(Entity *entity, u32 newDir) { - if(GetEntityType(entity) == ENTITY_MONSTER) - { + if (GetEntityType(entity) == ENTITY_MONSTER) { entity->unk6A = 6; - if(newDir < NUM_DIRECTIONS) - { + + if (newDir < NUM_DIRECTIONS) entity->direction = newDir; - } } } -u8 sub_806CEBC(struct Entity *entity) +u8 sub_806CEBC(Entity *entity) { - u8 sleep; - struct EntityInfo * entityInfo1; - struct EntityInfo * entityInfo2; + u8 sleep; + EntityInfo *entityInfo1; + EntityInfo *entityInfo2; - // NOTE: copy needed to match - entityInfo1 = entity->info; - entityInfo2 = entity->info; - sleep = entityInfo1->sleep; + // NOTE: copy needed to match + entityInfo1 = entity->info; + entityInfo2 = entity->info; + sleep = entityInfo1->sleep; - if ((sleep == STATUS_SLEEP) || (sleep == STATUS_NAPPING) || (sleep == STATUS_NIGHTMARE)) { - if ((entityInfo2->apparentID != MONSTER_SUDOWOODO) || (entityInfo2->sleepTurns != 0x7f)) { - return 5; + if (sleep == STATUS_SLEEP || sleep == STATUS_NAPPING || sleep == STATUS_NIGHTMARE) { + if (entityInfo2->apparentID != MONSTER_SUDOWOODO || entityInfo2->sleepTurns != 0x7F) + return 5; + else + return 7; } - else - return 7; - } - else if (entityInfo2->chargingStatus == STATUS_BIDE) { - return 0xB; - } - return 0x7; + if (entityInfo2->chargingStatus == STATUS_BIDE) + return 11; + return 7; } -void sub_806CEFC(struct Entity *entity, u32 newDir) +void sub_806CEFC(Entity *entity, u32 newDir) { - entity->info->action.direction = newDir & DIRECTION_MASK; - sub_806CE68(entity, (newDir & DIRECTION_MASK)); + entity->info->action.direction = newDir & DIRECTION_MASK; + sub_806CE68(entity, newDir & DIRECTION_MASK); } -void sub_806CF18(struct Entity *entity) +void sub_806CF18(Entity *entity) { - s32 index; - struct EntityInfo *entityInfo; + s32 i; + EntityInfo *entityInfo; - if (EntityExists(entity)) { + if (!EntityExists(entity)) + return; + entityInfo = entity->info; - for (index = 0; index < 100; index++) { - sub_803E46C(0x21); - if (!sub_808DA44(entityInfo->apparentID, entity->unk6B)) { - break; - } + for (i = 0; i < 100; i++) { + sub_803E46C(33); + + if (!sub_808DA44(entityInfo->apparentID, entity->unk6B)) + break; } - } } -u8 sub_806CF54(struct Entity *entity) +u8 sub_806CF54(Entity *entity) { return entity->info->unk204; } void sub_806CF60(void) { - struct Entity *entity; - s32 index; + Entity *entity; + s32 i; - for(index = 0; index < DUNGEON_MAX_POKEMON; index++) - { - entity = gDungeon->allPokemon[index]; - if (EntityExists(entity)) { - sub_806CF98(entity); + for (i = 0; i < DUNGEON_MAX_POKEMON; i++) { + entity = gDungeon->allPokemon[i]; + + if (EntityExists(entity)) + sub_806CF98(entity); } - } } -u32 sub_806CF98(struct Entity *entity) +u32 sub_806CF98(Entity *entity) { - struct Tile *mapTile; - u32 uVar3; - u16 terrainType; - struct EntityInfo *entityInfo; + struct Tile *mapTile; + u32 uVar3; + u16 terrainType; + EntityInfo *entityInfo; - mapTile = GetTileAtEntitySafe(entity); - terrainType = mapTile->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY); - entityInfo = entity->info; - uVar3 = GetShadowSize(entityInfo->apparentID); - if (terrainType == (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)) { - return 6; - } - if (terrainType == TERRAIN_TYPE_NORMAL) { - if (IsWaterTileset()) { - uVar3 = gUnknown_8106EEF[uVar3]; + mapTile = GetTileAtEntitySafe(entity); + terrainType = mapTile->terrainType & (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY); + entityInfo = entity->info; + uVar3 = GetShadowSize(entityInfo->apparentID); + + if (terrainType == (TERRAIN_TYPE_NORMAL | TERRAIN_TYPE_SECONDARY)) + return 6; + + if (terrainType == TERRAIN_TYPE_NORMAL) { + if (IsWaterTileset()) + uVar3 = gUnknown_8106EEF[uVar3]; } - } - else if ((terrainType == TERRAIN_TYPE_SECONDARY) && (gDungeonWaterType[gDungeon->tileset] != DUNGEON_WATER_TYPE_LAVA)) - uVar3 = gUnknown_8106EEF[uVar3]; - entityInfo->unk204 = uVar3; - return uVar3; + else if (terrainType == TERRAIN_TYPE_SECONDARY && gDungeonWaterType[gDungeon->tileset] != DUNGEON_WATER_TYPE_LAVA) + uVar3 = gUnknown_8106EEF[uVar3]; + + entityInfo->unk204 = uVar3; + return uVar3; } diff --git a/src/code_806E8B0.c b/src/code_806E8B0.c index b34ac0587..80ad86f6d 100644 --- a/src/code_806E8B0.c +++ b/src/code_806E8B0.c @@ -9,12 +9,12 @@ extern u8 *gUnknown_80FEE04[]; extern u8 *gUnknown_80FEE2C[]; extern u8 *gUnknown_80FEE54[]; -void sub_8042940(struct Entity *r0); -void sub_80428B0(struct Entity *r0); -void sub_80428C4(struct Entity *r0); -void sub_80522F4(struct Entity *r0, struct Entity *r1, const char r2[]); +void sub_8042940(Entity *r0); +void sub_80428B0(Entity *r0); +void sub_80428C4(Entity *r0); +void sub_80522F4(Entity *r0, Entity *r1, const char r2[]); -void sub_806E8B0(struct Entity * pokemon, struct Entity * target, u8 param_3, s32 *param_4, s32 *param_5, s32 param_6) +void sub_806E8B0(Entity * pokemon, Entity * target, u8 param_3, s32 *param_4, s32 *param_5, s32 param_6) { bool8 hasNegStatus_pokemon; bool8 visFlags_pokemon_1; @@ -23,8 +23,8 @@ void sub_806E8B0(struct Entity * pokemon, struct Entity * target, u8 param_3, s3 bool8 visFlags_target; s32 iVar3; bool32 isNotEnemy; - struct EntityInfo * entityInfo; - struct EntityInfo * entityInfo_1; + EntityInfo * entityInfo; + EntityInfo * entityInfo_1; s32 r7; s32 r8; s32 r10; diff --git a/src/code_8073CF0.c b/src/code_8073CF0.c index b44211c85..b69c2ddcc 100644 --- a/src/code_8073CF0.c +++ b/src/code_8073CF0.c @@ -1,21 +1,21 @@ #include "global.h" #include "dungeon_entity.h" -extern void sub_8067110(struct Entity *); -extern void sub_80671A0(struct Entity *); -extern void sub_8073D14(struct Entity *); +extern void sub_8067110(Entity *); +extern void sub_80671A0(Entity *); +extern void sub_8073D14(Entity *); -void sub_8073CF0(struct Entity *pokemon) +void sub_8073CF0(Entity *pokemon) { sub_8067110(pokemon); } -void sub_8073CFC(struct Entity *pokemon) +void sub_8073CFC(Entity *pokemon) { sub_80671A0(pokemon); } -void sub_8073D08(struct Entity *pokemon) +void sub_8073D08(Entity *pokemon) { sub_8073D14(pokemon); } diff --git a/src/code_8077274_1.c b/src/code_8077274_1.c index e46e3f954..e83d7b160 100644 --- a/src/code_8077274_1.c +++ b/src/code_8077274_1.c @@ -1,23 +1,24 @@ #include "global.h" +#include "code_80521D0.h" +#include "code_805D8C8.h" +#include "code_806CD90.h" +#include "code_8077274_1.h" +#include "code_808417C.h" #include "constants/ability.h" #include "constants/item.h" #include "constants/status.h" #include "constants/type.h" #include "dungeon_entity.h" #include "dungeon_global_data.h" +#include "dungeon_items.h" #include "dungeon_movement.h" #include "dungeon_pokemon_attributes.h" #include "dungeon_random.h" -#include "dungeon_items.h" #include "dungeon_util.h" -#include "code_80521D0.h" -#include "code_8077274_1.h" -#include "code_808417C.h" #include "moves.h" #include "move_effects_target.h" #include "pokemon.h" #include "status_checks_1.h" -#include "code_805D8C8.h" extern u8 gAvailablePokemonNames[0x58]; extern u8 gUnknown_202DFE8[0x58]; @@ -166,59 +167,55 @@ extern u8 *gUnknown_80FBF84[]; extern void sub_8049ED4(); extern void sub_8040A84(); extern void sub_803E46C(u32); -extern u8 sub_806CEBC(struct Entity *); -extern void sub_806CCB4(struct Entity *, u8); -extern void SetMessageArgument(u8 *buffer, struct Entity *r1, u32); -extern void sub_80522F4(struct Entity *pokemon, struct Entity *r1, const char[]); -extern void EntityUpdateStatusSprites(struct Entity *); -extern void sub_8042A74(struct Entity *r0); +extern void SetMessageArgument(u8 *buffer, Entity *r1, u32); +extern void sub_80522F4(Entity *pokemon, Entity *r1, const char[]); +extern void EntityUpdateStatusSprites(Entity *); +extern void sub_8042A74(Entity *r0); extern void sub_807EC28(bool8); -extern s32 sub_8069F54(struct Entity *param_1, s16 param_2); -extern struct OpenedFile *sub_80687D0(s16); -extern void sub_806A898(struct Entity *, u32, u32); -extern void HealTargetHP(struct Entity *pokemon, struct Entity *r1, s16, s16, u32); -extern void sub_806CE68(struct Entity *, s32); -extern void sub_806F324(struct Entity *, s16, u32, u32); -extern void sub_806BFC0(struct EntityInfo *, u32); -extern void sub_80420C8(struct Entity *r0); -extern void nullsub_68(struct Entity *); -extern void nullsub_67(struct Entity *); -extern void nullsub_66(struct Entity *); -extern void nullsub_65(struct Entity *); -extern void nullsub_64(struct Entity *); -extern void nullsub_63(struct Entity *); -extern void nullsub_62(struct Entity *); -extern void nullsub_61(struct Entity *); -extern void nullsub_60(struct Entity *); -extern void nullsub_59(struct Entity *); -extern void nullsub_58(struct Entity *); -extern void nullsub_57(struct Entity *); -extern void sub_8041B34(struct Entity *); -void sub_8041BD0(struct Entity *r0, u8 r1); -void sub_8041EB4(struct Entity *); -void sub_8041EA4(struct Entity *); -extern void sub_8041E84(struct Entity *); -extern void sub_8041E94(struct Entity *); -extern void sub_8041E74(struct Entity *); -extern void sub_8041E60(struct Entity *); -extern void sub_8041E4C(struct Entity *); -extern void sub_8041E3C(struct Entity *); +extern s32 sub_8069F54(Entity *param_1, s16 param_2); +extern void sub_806A898(Entity *, u32, u32); +extern void HealTargetHP(Entity *pokemon, Entity *r1, s16, s16, u32); +extern void sub_806F324(Entity *, s16, u32, u32); +extern void sub_806BFC0(EntityInfo *, u32); +extern void sub_80420C8(Entity *r0); +extern void nullsub_68(Entity *); +extern void nullsub_67(Entity *); +extern void nullsub_66(Entity *); +extern void nullsub_65(Entity *); +extern void nullsub_64(Entity *); +extern void nullsub_63(Entity *); +extern void nullsub_62(Entity *); +extern void nullsub_61(Entity *); +extern void nullsub_60(Entity *); +extern void nullsub_59(Entity *); +extern void nullsub_58(Entity *); +extern void nullsub_57(Entity *); +extern void sub_8041B34(Entity *); +void sub_8041BD0(Entity *r0, u8 r1); +void sub_8041EB4(Entity *); +void sub_8041EA4(Entity *); +extern void sub_8041E84(Entity *); +extern void sub_8041E94(Entity *); +extern void sub_8041E74(Entity *); +extern void sub_8041E60(Entity *); +extern void sub_8041E4C(Entity *); +extern void sub_8041E3C(Entity *); extern void sub_803F580(u32); -extern void sub_8041E1C(struct Entity *); -extern void nullsub_89(struct Entity *); -extern void nullsub_88(struct Entity *); -extern void nullsub_87(struct Entity *); -extern void nullsub_86(struct Entity *); -extern void sub_8041E0C(struct Entity *); -extern void sub_8041DD8(struct Entity *r0, s32 r1); // NOTE: is s16 in another file +extern void sub_8041E1C(Entity *); +extern void nullsub_89(Entity *); +extern void nullsub_88(Entity *); +extern void nullsub_87(Entity *); +extern void nullsub_86(Entity *); +extern void sub_8041E0C(Entity *); +extern void sub_8041DD8(Entity *r0, s32 r1); // NOTE: is s16 in another file extern s32 sub_803D870(void *, u32); -extern void sub_806CF98(struct Entity *); extern bool8 sub_806AA0C(s32, u32); -u32 ExtractSpeciesIndex(struct PokemonStruct **r0); // TODO: look more into this and fix it. +u32 ExtractSpeciesIndex(PokemonStruct1 **r0); // TODO: look more into this and fix it. +void CopyCyanMonsterNametoBuffer(u8 *buffer, s16 index); -void MuzzleTarget(struct Entity *pokemon, struct Entity *target) +void MuzzleTarget(Entity *pokemon, Entity *target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if ((EntityExists(target)) && (!HasSafeguardStatus(pokemon, target, TRUE))) { entityInfo = target->info; @@ -237,16 +234,16 @@ void MuzzleTarget(struct Entity *pokemon, struct Entity *target) } } -void TransformStatusTarget(struct Entity * pokemon, struct Entity * target) +void TransformStatusTarget(Entity * pokemon, Entity * target) { s16 species; s32 iVar5; s32 apparentID; s16 apparentID_s16; s32 index; - struct EntityInfo *entityInfo; - struct OpenedFile *iVar9; - struct PokemonStruct *auStack544[128]; + EntityInfo *entityInfo; + OpenedFile *iVar9; + PokemonStruct1 *auStack544[128]; if (!EntityExists(target)) return; @@ -294,10 +291,10 @@ void TransformStatusTarget(struct Entity * pokemon, struct Entity * target) } } -void MobileStatusTarget(struct Entity * pokemon, struct Entity * target) +void MobileStatusTarget(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo_1; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo_1; + EntityInfo *entityInfo; if (EntityExists(target)) { @@ -321,9 +318,9 @@ void MobileStatusTarget(struct Entity * pokemon, struct Entity * target) } } -void ExposeStatusTarget(struct Entity * pokemon, struct Entity * target, s16 param_3) +void ExposeStatusTarget(Entity * pokemon, Entity * target, s16 param_3) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; s32 param_3_s16; s32 param_3_s16_2; bool32 flag; @@ -367,9 +364,9 @@ void ExposeStatusTarget(struct Entity * pokemon, struct Entity * target, s16 par } } -void IdentityItemHolders(struct Entity *pokemon, struct Entity *target) +void IdentityItemHolders(Entity *pokemon, Entity *target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if ((EntityExists(target)) && (!HasSafeguardStatus(pokemon, target, TRUE))) { entityInfo = target->info; @@ -386,9 +383,9 @@ void IdentityItemHolders(struct Entity *pokemon, struct Entity *target) } } -void BlindTarget(struct Entity *pokemon, struct Entity *target) +void BlindTarget(Entity *pokemon, Entity *target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if ((EntityExists(target)) && (!HasSafeguardStatus(pokemon, target, TRUE))) { entityInfo = target->info; @@ -410,9 +407,9 @@ void BlindTarget(struct Entity *pokemon, struct Entity *target) } } -void CrossEyeVisionTarget(struct Entity *pokemon, struct Entity *target) +void CrossEyeVisionTarget(Entity *pokemon, Entity *target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { @@ -438,9 +435,9 @@ void CrossEyeVisionTarget(struct Entity *pokemon, struct Entity *target) } } -void RestoreVisionTarget(struct Entity *pokemon, struct Entity *target) +void RestoreVisionTarget(Entity *pokemon, Entity *target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { @@ -463,15 +460,15 @@ void RestoreVisionTarget(struct Entity *pokemon, struct Entity *target) } } -void RestorePPTarget(struct Entity * pokemon,struct Entity * target, s32 param_3) +void RestorePPTarget(Entity * pokemon,Entity * target, s32 param_3) { volatile s32 PP; volatile s32 basePP; - struct Move *movePtr; - struct Move *movePtr1; + Move *movePtr; + Move *movePtr1; s32 index; bool8 PPChanged; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; PPChanged = FALSE; if (EntityExists(target)) { @@ -505,13 +502,13 @@ void RestorePPTarget(struct Entity * pokemon,struct Entity * target, s32 param_3 } } -void RaiseAtkStatTarget(struct Entity * pokemon, struct Entity *target, s32 increment) +void RaiseAtkStatTarget(Entity * pokemon, Entity *target, s32 increment) { u32 oldStat; u32 oldStat1; s32 newStat; - struct EntityInfo *entityInfo; - struct EntityInfo *entityInfo1; + EntityInfo *entityInfo; + EntityInfo *entityInfo1; if (EntityExists(target)) { SetMessageArgument(gAvailablePokemonNames,target,0); @@ -538,13 +535,13 @@ void RaiseAtkStatTarget(struct Entity * pokemon, struct Entity *target, s32 incr } } -void RaiseSpAtkStatTarget(struct Entity * pokemon, struct Entity *target, s32 increment) +void RaiseSpAtkStatTarget(Entity * pokemon, Entity *target, s32 increment) { u32 oldStat; u32 oldStat1; s32 newStat; - struct EntityInfo *entityInfo; - struct EntityInfo *entityInfo1; + EntityInfo *entityInfo; + EntityInfo *entityInfo1; if (EntityExists(target)) { SetMessageArgument(gAvailablePokemonNames,target,0); @@ -571,13 +568,13 @@ void RaiseSpAtkStatTarget(struct Entity * pokemon, struct Entity *target, s32 in } } -void RaiseDefStatTarget(struct Entity * pokemon, struct Entity *target, s32 increment) +void RaiseDefStatTarget(Entity * pokemon, Entity *target, s32 increment) { u32 oldStat; u32 oldStat1; s32 newStat; - struct EntityInfo *entityInfo; - struct EntityInfo *entityInfo1; + EntityInfo *entityInfo; + EntityInfo *entityInfo1; if (EntityExists(target)) { SetMessageArgument(gAvailablePokemonNames,target,0); @@ -604,13 +601,13 @@ void RaiseDefStatTarget(struct Entity * pokemon, struct Entity *target, s32 incr } } -void RaiseSpDefStatTarget(struct Entity * pokemon, struct Entity *target, s32 increment) +void RaiseSpDefStatTarget(Entity * pokemon, Entity *target, s32 increment) { u32 oldStat; u32 oldStat1; s32 newStat; - struct EntityInfo *entityInfo; - struct EntityInfo *entityInfo1; + EntityInfo *entityInfo; + EntityInfo *entityInfo1; if (EntityExists(target)) { SetMessageArgument(gAvailablePokemonNames,target,0); @@ -637,9 +634,9 @@ void RaiseSpDefStatTarget(struct Entity * pokemon, struct Entity *target, s32 in } } -void LongTossStatusTarget(struct Entity * pokemon, struct Entity * target) +void LongTossStatusTarget(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; entityInfo = target->info; SetMessageArgument(gUnknown_202DFE8,target,0); @@ -654,9 +651,9 @@ void LongTossStatusTarget(struct Entity * pokemon, struct Entity * target) EntityUpdateStatusSprites(target); } -void PierceStatusTarget(struct Entity * pokemon, struct Entity * target) +void PierceStatusTarget(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; entityInfo = target->info; SetMessageArgument(gUnknown_202DFE8,target,0); @@ -671,15 +668,15 @@ void PierceStatusTarget(struct Entity * pokemon, struct Entity * target) EntityUpdateStatusSprites(target); } -void SetChargeStatusTarget(struct Entity *pokemon, struct Entity *target, u8 newStatus, struct Move *move, u8 *message) +void SetChargeStatusTarget(Entity *pokemon, Entity *target, u8 newStatus, Move *move, u8 *message) { bool8 bVar2; - struct Move *movePtr; + Move *movePtr; s32 index; bool8 uVar5; s32 iVar7; s32 iVar8; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { entityInfo = target->info; @@ -737,9 +734,9 @@ void SetChargeStatusTarget(struct Entity *pokemon, struct Entity *target, u8 new } } -void sub_8079764(struct Entity * pokemon) +void sub_8079764(Entity * pokemon) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(pokemon)) { entityInfo = pokemon->info; @@ -752,9 +749,9 @@ void sub_8079764(struct Entity * pokemon) } } -void CounterStatusTarget(struct Entity * pokemon, struct Entity * target, u8 newStatus) +void CounterStatusTarget(Entity * pokemon, Entity * target, u8 newStatus) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { entityInfo = target->info; @@ -774,9 +771,9 @@ void CounterStatusTarget(struct Entity * pokemon, struct Entity * target, u8 new } } -void SafeguardStatusTarget(struct Entity * pokemon, struct Entity * target) +void SafeguardStatusTarget(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { entityInfo = target->info; @@ -794,9 +791,9 @@ void SafeguardStatusTarget(struct Entity * pokemon, struct Entity * target) } } -void MistStatusTarget(struct Entity * pokemon, struct Entity * target) +void MistStatusTarget(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { entityInfo = target->info; @@ -814,9 +811,9 @@ void MistStatusTarget(struct Entity * pokemon, struct Entity * target) } } -void WishStatusTarget(struct Entity * pokemon, struct Entity * target) +void WishStatusTarget(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { entityInfo = target->info; @@ -834,9 +831,9 @@ void WishStatusTarget(struct Entity * pokemon, struct Entity * target) } } -void MagicCoatStatusTarget(struct Entity * pokemon, struct Entity * target) +void MagicCoatStatusTarget(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { entityInfo = target->info; @@ -854,9 +851,9 @@ void MagicCoatStatusTarget(struct Entity * pokemon, struct Entity * target) } } -void LightScreenStatusTarget(struct Entity * pokemon, struct Entity * target) +void LightScreenStatusTarget(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { entityInfo = target->info; @@ -874,9 +871,9 @@ void LightScreenStatusTarget(struct Entity * pokemon, struct Entity * target) } } -void ReflectStatusTarget(struct Entity * pokemon, struct Entity * target) +void ReflectStatusTarget(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { entityInfo = target->info; @@ -894,9 +891,9 @@ void ReflectStatusTarget(struct Entity * pokemon, struct Entity * target) } } -void ProtectStatusTarget(struct Entity * pokemon, struct Entity * target) +void ProtectStatusTarget(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { nullsub_63(target); @@ -915,9 +912,9 @@ void ProtectStatusTarget(struct Entity * pokemon, struct Entity * target) } } -void MirrorCoatStatusTarget(struct Entity * pokemon, struct Entity * target) +void MirrorCoatStatusTarget(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { entityInfo = target->info; @@ -935,9 +932,9 @@ void MirrorCoatStatusTarget(struct Entity * pokemon, struct Entity * target) } } -void EndureStatusTarget(struct Entity * pokemon, struct Entity * target) +void EndureStatusTarget(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { entityInfo = target->info; @@ -955,9 +952,9 @@ void EndureStatusTarget(struct Entity * pokemon, struct Entity * target) } } -void MirrorMoveStatusTarget(struct Entity * pokemon, struct Entity * target) +void MirrorMoveStatusTarget(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { entityInfo = target->info; @@ -975,9 +972,9 @@ void MirrorMoveStatusTarget(struct Entity * pokemon, struct Entity * target) } } -void Conversion2StatusTarget(struct Entity * pokemon, struct Entity * target) +void Conversion2StatusTarget(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { entityInfo = target->info; @@ -1001,9 +998,9 @@ void Conversion2StatusTarget(struct Entity * pokemon, struct Entity * target) } } -void VitalThrowStatusTarget(struct Entity * pokemon, struct Entity * target) +void VitalThrowStatusTarget(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { entityInfo = target->info; @@ -1021,10 +1018,10 @@ void VitalThrowStatusTarget(struct Entity * pokemon, struct Entity * target) } } -void sub_8079E34(struct Entity * pokemon, struct Entity * target, bool8 param_3) +void sub_8079E34(Entity * pokemon, Entity * target, bool8 param_3) { bool8 statChanged; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; s32 index; statChanged = FALSE; @@ -1071,12 +1068,12 @@ void sub_8079E34(struct Entity * pokemon, struct Entity * target, bool8 param_3) } } -void sub_8079F20(struct Entity * pokemon, struct Entity * target, u8 param_3, u8 param_4) +void sub_8079F20(Entity * pokemon, Entity * target, u8 param_3, u8 param_4) { bool8 moveUnsealed; // r9 s32 moveSpeed; - struct Move *move; - struct EntityInfo *entityInfo; // r7 + Move *move; + EntityInfo *entityInfo; // r7 bool8 bVar8; // r8 s32 index; @@ -1144,10 +1141,10 @@ void sub_8079F20(struct Entity * pokemon, struct Entity * target, u8 param_3, u8 } } -void sub_807A0CC(struct Entity * pokemon, struct Entity * target) +void sub_807A0CC(Entity * pokemon, Entity * target) { - struct Move *move; - struct EntityInfo *entityInfo; + Move *move; + EntityInfo *entityInfo; s32 index; if (EntityExists(target)) { @@ -1167,9 +1164,9 @@ void sub_807A0CC(struct Entity * pokemon, struct Entity * target) }; } -void SendSleepEndMessage(struct Entity * pokemon, struct Entity * target, bool8 param_3, bool8 param_4) +void SendSleepEndMessage(Entity * pokemon, Entity * target, bool8 param_3, bool8 param_4) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; bool8 isAsleep; isAsleep = FALSE; @@ -1219,9 +1216,9 @@ void SendSleepEndMessage(struct Entity * pokemon, struct Entity * target, bool8 } } -void SendNonVolatileEndMessage(struct Entity * pokemon, struct Entity * target) +void SendNonVolatileEndMessage(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (!EntityExists(target)) { return; @@ -1248,10 +1245,10 @@ void SendNonVolatileEndMessage(struct Entity * pokemon, struct Entity * target) EntityUpdateStatusSprites(target); } -void SendImmobilizeEndMessage(struct Entity * pokemon, struct Entity *target) +void SendImmobilizeEndMessage(Entity * pokemon, Entity *target) { bool8 isFrozen; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; isFrozen = FALSE; if (!EntityExists(target)) { @@ -1290,9 +1287,9 @@ void SendImmobilizeEndMessage(struct Entity * pokemon, struct Entity *target) } } -void SendVolatileEndMessage(struct Entity * pokemon, struct Entity *target) +void SendVolatileEndMessage(Entity * pokemon, Entity *target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (!EntityExists(target)) { return; @@ -1330,9 +1327,9 @@ void SendVolatileEndMessage(struct Entity * pokemon, struct Entity *target) CalcSpeedStage(target); } -void SendProtectionEndMessage(struct Entity * pokemon, struct Entity *target) +void SendProtectionEndMessage(Entity * pokemon, Entity *target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (!EntityExists(target)) { return; @@ -1388,10 +1385,10 @@ void SendProtectionEndMessage(struct Entity * pokemon, struct Entity *target) EntityUpdateStatusSprites(target); } -void SendWaitingEndMessage(struct Entity * pokemon, struct Entity * target, u8 waitingStatus) +void SendWaitingEndMessage(Entity * pokemon, Entity * target, u8 waitingStatus) { u32 uVar3; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { entityInfo = target->info; @@ -1428,9 +1425,9 @@ void SendWaitingEndMessage(struct Entity * pokemon, struct Entity * target, u8 w } } -void SendLinkedEndMessage(struct Entity * pokemon, struct Entity * target) +void SendLinkedEndMessage(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { entityInfo = target->info; @@ -1452,9 +1449,9 @@ void SendLinkedEndMessage(struct Entity * pokemon, struct Entity * target) } } -void SendMoveEndMessage(struct Entity * pokemon, struct Entity * target) +void SendMoveEndMessage(Entity * pokemon, Entity * target) { - struct EntityInfo * entityInfo; + EntityInfo * entityInfo; if (!EntityExists(target)) { return; @@ -1482,10 +1479,10 @@ void SendMoveEndMessage(struct Entity * pokemon, struct Entity * target) EntityUpdateStatusSprites(target); } -void SendTransformEndMessage(struct Entity * pokemon, struct Entity *target) +void SendTransformEndMessage(Entity * pokemon, Entity *target) { bool8 isInvisible; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; u32 uVar3; isInvisible = FALSE; @@ -1520,9 +1517,9 @@ void SendTransformEndMessage(struct Entity * pokemon, struct Entity *target) } } -void SendEyesightEndMessage(struct Entity * pokemon,struct Entity * target) +void SendEyesightEndMessage(Entity * pokemon,Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (!EntityExists(target)) { return; @@ -1552,9 +1549,9 @@ void SendEyesightEndMessage(struct Entity * pokemon,struct Entity * target) } } -void SendMuzzledEndMessage(struct Entity * pokemon, struct Entity * target) +void SendMuzzledEndMessage(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (!EntityExists(target)) { return; @@ -1575,10 +1572,10 @@ void SendMuzzledEndMessage(struct Entity * pokemon, struct Entity * target) // TODO: this involves a union for sleep/sleepTurns that I don't want to deal with right now /* - bool32 sub_807A96C(struct Entity * pokemon, struct Entity * target) + bool32 sub_807A96C(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; - struct EntityInfo *entityInfo_1; + EntityInfo *entityInfo; + EntityInfo *entityInfo_1; register bool32 bVar3 asm("r2"); entityInfo = target->info; @@ -1597,7 +1594,7 @@ void SendMuzzledEndMessage(struct Entity * pokemon, struct Entity * target) } */ NAKED -void sub_807A96C(struct Entity *pokemon, struct Entity *target) +void sub_807A96C(Entity *pokemon, Entity *target) { asm_unified( "\tpush {r4-r6,lr}\n" @@ -1635,9 +1632,9 @@ void sub_807A96C(struct Entity *pokemon, struct Entity *target) "_0807A9AC: .4byte 0x00007f01"); } -void WakeUpPokemon(struct Entity * pokemon) +void WakeUpPokemon(Entity * pokemon) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; entityInfo = pokemon->info; entityInfo->sleep = STATUS_NONE; @@ -1646,9 +1643,9 @@ void WakeUpPokemon(struct Entity * pokemon) EntityUpdateStatusSprites(pokemon); } -void SendThawedMessage(struct Entity *pokemon, struct Entity *target) +void SendThawedMessage(Entity *pokemon, Entity *target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { entityInfo = target->info; @@ -1671,9 +1668,9 @@ void sub_807AA30(void) s32 xDiff; s32 wildIndex; s32 yDiff; - struct Entity *teamEntity; - struct Entity *wildEntity; - struct EntityInfo *entityInfo; + Entity *teamEntity; + Entity *wildEntity; + EntityInfo *entityInfo; s32 teamIndex; for(wildIndex = 0; wildIndex < DUNGEON_MAX_WILD_POKEMON; wildIndex++) diff --git a/src/code_807CD9C.c b/src/code_807CD9C.c index 28f1e9940..3251c4dab 100644 --- a/src/code_807CD9C.c +++ b/src/code_807CD9C.c @@ -11,21 +11,21 @@ #include "moves.h" #include "move_util.h" -extern u8 UseAttack(struct Entity *); +extern u8 UseAttack(Entity *); extern void sub_805E804(void); -void sub_806A2BC(struct Entity *pokemon, u8 param_2); +void sub_806A2BC(Entity *pokemon, u8 param_2); extern u8 sub_8044B28(void); extern void sub_80426C8(u32, u32); -extern void sub_8068FE0(struct Entity *, u32, struct Entity *r2); -extern void nullsub_93(struct Position *); -extern void sub_80522F4(struct Entity *, struct Entity *, u8 *); -extern void SetMessageArgument(char[], struct Entity*, u32); -extern void sub_806F370(struct Entity *r0, struct Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32); -extern void sub_80694C0(struct Entity *, s32, s32, u32); -extern void sub_804535C(struct Entity *, u32); -extern void sub_804AC20(struct Position *); +extern void sub_8068FE0(Entity *, u32, Entity *r2); +extern void nullsub_93(Position *); +extern void sub_80522F4(Entity *, Entity *, u8 *); +extern void SetMessageArgument(char[], Entity*, u32); +extern void sub_806F370(Entity *r0, Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32); +extern void sub_80694C0(Entity *, s32, s32, u32); +extern void sub_804535C(Entity *, u32); +extern void sub_804AC20(Position *); extern void sub_807EC28(bool8); -extern void sub_806A5B8(struct Entity *); +extern void sub_806A5B8(Entity *); extern u32 gUnknown_80F5FAC[]; extern u8 *gUnknown_80F9C4C[]; @@ -35,11 +35,11 @@ extern u8 *gUnknown_80F9CBC[]; extern u8 gAvailablePokemonNames[]; extern u8 *gUnknown_80FCAC0[]; -void sub_807E1A0(struct Entity *pokemon,struct Entity *target,u8 param_3,s16 param_4,s32 param_5) +void sub_807E1A0(Entity *pokemon,Entity *target,u8 param_3,s16 param_4,s32 param_5) { - struct EntityInfo *targetInfo; + EntityInfo *targetInfo; u8 flag; - struct Move move; + Move move; s32 newHP; s32 param_4_s32; @@ -70,10 +70,10 @@ void sub_807E1A0(struct Entity *pokemon,struct Entity *target,u8 param_3,s16 par } } -void sub_807E254(struct Entity *pokemon,struct Entity *target) +void sub_807E254(Entity *pokemon,Entity *target) { - struct Position pokemonPos; - struct Position targetPos; + Position pokemonPos; + Position targetPos; if (HasAbility(pokemon, ABILITY_SUCTION_CUPS)) { @@ -121,7 +121,7 @@ void sub_807E254(struct Entity *pokemon,struct Entity *target) void sub_807E378(void) { u16 uVar2; - struct Entity *leader; + Entity *leader; leader = GetLeader(); if (EntityExists(leader)) { diff --git a/src/code_807E5AC.c b/src/code_807E5AC.c index c32e0d73c..acb2fcd9f 100644 --- a/src/code_807E5AC.c +++ b/src/code_807E5AC.c @@ -1,7 +1,7 @@ #include "global.h" #include "dungeon_global_data.h" -void sub_807FC3C(struct Position *pos, u32 param_2, u32 param_3) +void sub_807FC3C(Position *pos, u32 param_2, u32 param_3) { gDungeon->unk13574 = pos->x; gDungeon->unk13576 = pos->y; diff --git a/src/code_808417C.c b/src/code_808417C.c index a1e6e529f..99577cbc9 100644 --- a/src/code_808417C.c +++ b/src/code_808417C.c @@ -6,7 +6,7 @@ #include "dungeon_random.h" #include "dungeon_util.h" -s32 CalculateStatusTurns(struct Entity *target, s16 *turnRange, bool8 factorCurerSkills) +s32 CalculateStatusTurns(Entity *target, s16 *turnRange, bool8 factorCurerSkills) { s32 numTurns; diff --git a/src/code_80848F0.c b/src/code_80848F0.c index 56c19304b..79baac250 100644 --- a/src/code_80848F0.c +++ b/src/code_80848F0.c @@ -71,7 +71,7 @@ extern void sub_80878F4(u32,u8); extern void sub_8088088(u32,u8); extern void sub_8088818(u32,u8); extern void sub_80893B4(u32,u8); -extern void sub_8089788(struct Entity *,u32,u8); +extern void sub_8089788(Entity *,u32,u8); extern void sub_8089A00(u32,u8); extern void sub_8089CFC(u32,u8); extern void sub_8089FF0(u32,u8); @@ -86,7 +86,7 @@ extern void sub_808BE70(u32,u8,u8); extern void sub_808C1A4(u32,u8,u8); extern void sub_808C414(u32,u8,u8); extern void nullsub_100(u32,u8,u8); -extern void sub_808C948(struct Entity *,u8); +extern void sub_808C948(Entity *,u8); extern void sub_808AFB0(u8); extern void sub_808B030(u8); @@ -541,7 +541,7 @@ void DisplayPreFightDialogue(void) sub_8097FF8(); } -void sub_8084E00(struct Entity *entity, u8 param_2, u8 param_3) +void sub_8084E00(Entity *entity, u8 param_2, u8 param_3) { if (param_2 != 0) { switch(gDungeon->unk3A0D) { diff --git a/src/code_80869E4.c b/src/code_80869E4.c index 2894058bb..027ec7546 100644 --- a/src/code_80869E4.c +++ b/src/code_80869E4.c @@ -1,35 +1,28 @@ #include "global.h" +#include "code_806CD90.h" +#include "code_80869E4.h" #include "constants/direction.h" -#include "dungeon_entity.h" #include "dungeon_global_data.h" #include "dungeon_util_1.h" #include "random.h" -struct unkStruct_202F3D0 -{ - u8 unk0; - u8 unk1; - u8 unk2; - u8 unk3; - u8 unk4; - u8 unk5; -}; +// This file may originally be merged with code_8086A3C.c and code_8057824_1.c -EWRAM_DATA struct unkStruct_202F3D0 gUnknown_202F3D0; +// ??? +extern u32 gUnknown_202EDC8; + +EWRAM_DATA unkStruct_202F3D0 gUnknown_202F3D0 = {0}; + +// data_8107010.s +extern u32 gUnknown_8107314[]; s8 sub_8002984(s8, u8); void sub_803E708(u32, u32); -void sub_80869E4(struct Entity *entity, u32, u8, s8); extern void sub_803E46C(u32); extern void sub_803E9D0(void); extern void SetDungeonBGColorRGB(u32, u32, u32, u32, u32); extern void PlaySoundEffect(u32); -void SpriteLookAroundEffect(struct Entity *entity); -extern void DisplayDungeonDialogue(u32); -void sub_8086494(); - -extern u32 gUnknown_8107314[]; -extern u32 gUnknown_202EDC8; +extern void DisplayDungeonDialogue(const u8 *); extern void sub_8085EB0(void); @@ -38,25 +31,22 @@ extern void sub_80855E4(void *); extern s32 GetCameraXPos(void); extern s32 GetCameraYPos(void); extern void sub_803F878(u32, u32); -extern void sub_8086384(struct Entity *entity); -extern void IncreaseEntityPixelPos(struct Entity *, u32, u32); -extern void sub_806CE68(struct Entity *, u32); -extern void sub_806CDD4(struct Entity *, u8, u32); -extern void sub_804535C(struct Entity *, struct Position32 *); -extern void sub_8086A54(struct Entity *); -extern void sub_8086A3C(struct Entity *); +extern void IncreaseEntityPixelPos(Entity *, u32, u32); +extern void sub_804535C(Entity *, Position32 *); +extern void sub_8086A54(Entity *); +extern void sub_8086A3C(Entity *); extern void PlaySoundEffect(u32); -extern void sub_80861F8(u32, struct Entity *, u32); +extern void sub_80861F8(u32, Entity *, u32); -void SpriteShockEffect(struct Entity *entity) +void SpriteShockEffect(Entity *entity) { - PlaySoundEffect(0xE8 << 1); - sub_80861F8(0x143, entity, 0); + PlaySoundEffect(464); + sub_80861F8(323, entity, 0); } -void sub_80862DC(struct Entity *entity) +static void sub_80862DC(Entity *entity) { - struct Position32 pos; + Position32 pos; pos.x = entity->pixelPos.x; pos.y = entity->pixelPos.y + 0x3800; @@ -65,9 +55,9 @@ void sub_80862DC(struct Entity *entity) sub_8086A54(entity); } -void sub_8086310(struct Entity *entity) +static void sub_8086310(Entity *entity) { - struct Position32 pos; + Position32 pos; pos.x = entity->pixelPos.x; pos.y = entity->pixelPos.y + 0x9000; @@ -77,9 +67,9 @@ void sub_8086310(struct Entity *entity) entity->isVisible = 0; } -void sub_8086348(struct Entity *entity) +static void sub_8086348(Entity *entity) { - struct Position32 pos; + Position32 pos; pos.x = entity->pixelPos.x + 0x7800; pos.y = entity->pixelPos.y - 0x2000; @@ -88,9 +78,9 @@ void sub_8086348(struct Entity *entity) sub_8086A54(entity); } -void sub_8086384(struct Entity *entity) +static void sub_8086384(Entity *entity) { - struct Position32 pos; + Position32 pos; pos.x = entity->pixelPos.x + 0x7800; pos.y = entity->pixelPos.y; @@ -99,280 +89,276 @@ void sub_8086384(struct Entity *entity) sub_8086A54(entity); } -void sub_80863B8(struct Entity *entity) +static void sub_80863B8(Entity *entity) { sub_806CDD4(entity, 0, DIRECTION_NORTH); } -void sub_80863C8(struct Entity *entity) +static void sub_80863C8(Entity *entity) { sub_806CDD4(entity, 0, DIRECTION_SOUTH); } -void sub_80863D8(struct Entity *entity) +static void sub_80863D8(Entity *entity) { sub_806CDD4(entity, 0, DIRECTION_WEST); } -void sub_80863E8(struct Entity *entity) +static void sub_80863E8(Entity *entity) { sub_806CDD4(entity, 6, DIRECTION_NORTH); } -void sub_80863F8(struct Entity *entity) +static void sub_80863F8(Entity *entity) { sub_806CE68(entity, DIRECTION_NORTH); } -void sub_8086404(struct Entity *entity) +static void sub_8086404(Entity *entity) { sub_806CE68(entity, DIRECTION_WEST); } -void sub_8086410(struct Entity *entity) +static void sub_8086410(Entity *entity) { IncreaseEntityPixelPos(entity, 0, -0x100); } -void sub_8086424(struct Entity *entity) +static void sub_8086424(Entity *entity) { IncreaseEntityPixelPos(entity, 0, 0x100); } -void sub_8086434(struct Entity *entity) +static void sub_8086434(Entity *entity) { IncreaseEntityPixelPos(entity, -0x100, 0); } void sub_8086448(void) { - s32 index; + s32 i; u32 XPos; u32 YPos; sub_80855E4(sub_80862DC); - for(index = 0; index < 0x38; index++) - { + for (i = 0; i < 56; i++) { XPos = GetCameraXPos(); YPos = GetCameraYPos(); - YPos += (0x80 << 1); + YPos += 0x100; sub_803F878(XPos, YPos); sub_80855E4(sub_8086410); sub_803E46C(0x46); } + sub_80855E4(sub_80863F8); } -void sub_8086494(void) +static void sub_8086494(void) { - s32 index; + s32 i; sub_8085930(DIRECTION_NORTHEAST); - sub_803E708(4, 0x46); + sub_803E708(4, 70); sub_8085930(DIRECTION_EAST); - sub_803E708(4, 0x46); + sub_803E708(4, 70); sub_8085930(DIRECTION_SOUTHEAST); - sub_803E708(4, 0x46); + sub_803E708(4, 70); sub_8085930(DIRECTION_SOUTH); - sub_803E708(4, 0x46); + sub_803E708(4, 70); sub_80855E4(sub_80863C8); - for(index = 0; index < 0x90; index++) - { + + for (i = 0; i < 144; i++) { sub_80855E4(sub_8086424); - sub_803E46C(0x46); + sub_803E46C(70); } + sub_80855E4(sub_8086310); } void sub_8086500(void) { - s32 index; + s32 i; u32 XPos; u32 YPos; sub_80855E4(sub_8086348); - for(index = 0; index < 0x48; index++) - { + for (i = 0; i < 72; i++) { XPos = GetCameraXPos(); - XPos += (0x80 << 1); + XPos += 0x100; YPos = GetCameraYPos(); sub_803F878(XPos, YPos); sub_80855E4(sub_8086434); - sub_803E46C(0x46); + sub_803E46C(70); } + sub_80855E4(sub_8086404); } void sub_808654C(void) { - s32 index; + s32 i; u32 XPos; u32 YPos; sub_80855E4(sub_8086384); - for(index = 0; index < 0x78; index++) - { + for (i = 0; i < 120; i++) { XPos = GetCameraXPos(); - XPos += (0x80 << 1); + XPos += 0x100; YPos = GetCameraYPos(); sub_803F878(XPos, YPos); sub_80855E4(sub_8086434); - sub_803E46C(0x46); + sub_803E46C(70); } + sub_80855E4(sub_8086404); } void sub_8086598(void) { - s32 index; + s32 i; u32 XPos; u32 YPos; sub_80855E4(sub_80863B8); - for(index = 0; index < 0x18; index++) - { + for (i = 0; i < 24; i++) { XPos = GetCameraXPos(); YPos = GetCameraYPos(); - sub_803F878(XPos, YPos + (0xffffff00)); + sub_803F878(XPos, YPos - 0x100); sub_80855E4(sub_8086410); - sub_803E46C(0x46); + sub_803E46C(70); } + sub_80855E4(sub_80863F8); } void sub_80865E8(void) { - s32 index; + s32 i; u32 XPos; u32 YPos; sub_80855E4(sub_80863E8); - for(index = 0; index < 0xC; index++) - { + for (i = 0; i < 12; i++) { XPos = GetCameraXPos(); YPos = GetCameraYPos(); - sub_803F878(XPos, YPos + (0x80 << 2)); + sub_803F878(XPos, YPos + 0x200); sub_80855E4(sub_8086424); sub_80855E4(sub_8086424); - sub_803E46C(0x46); + sub_803E46C(70); } + sub_80855E4(sub_80863F8); } void sub_808663C(void) { - s32 index; + s32 i; u32 XPos; u32 YPos; sub_80855E4(sub_80863E8); - for(index = 0; index < 0x10; index++) - { + for (i = 0; i < 16; i++) { XPos = GetCameraXPos(); YPos = GetCameraYPos(); - sub_803F878(XPos, YPos + (0x80 << 2)); + sub_803F878(XPos, YPos + 0x200); sub_80855E4(sub_8086424); sub_80855E4(sub_8086424); - sub_803E46C(0x46); + sub_803E46C(70); } + sub_80855E4(sub_80863F8); } - void sub_8086690(void) { - s32 index; + s32 i; sub_80855E4(sub_80863D8); - for(index = 0; index < 0x30; index++) - { + for (i = 0; i < 48; i++) { sub_80855E4(sub_8086434); - sub_803E46C(0x46); + sub_803E46C(70); } + sub_80855E4(sub_8086404); } - -void sub_80866C4(u32 dialogue) +void sub_80866C4(const u8 *dialogue) { - SpriteLookAroundEffect(xxx_call_GetLeader()); - sub_803E708(0xA, 0x46); + sub_803E708(10, 70); DisplayDungeonDialogue(dialogue); - sub_803E708(0xA, 0x46); + sub_803E708(10, 70); sub_8086494(); gDungeon->unk2 = 1; } -void sub_80866FC(void) +UNUSED static void sub_80866FC(void) { - s32 index; + s32 i; - for(index = 0; index >= -0xFA; index -= 0xA) - { - SetDungeonBGColorRGB(index, index, index, 1, 0); - sub_803E46C(0x46); + for (i = 0; i >= -250; i -= 10) { + SetDungeonBGColorRGB(i, i, i, 1, 0); + sub_803E46C(70); } } -void sub_808627C(void) +UNUSED static void sub_808627C(void) { sub_803E748(); } void sub_8086738(void) { - s32 index; + s32 i; - for(index = 0; index < 0xFA; index += 0xA) - { - SetDungeonBGColorRGB(index, index, index, 1, 0); - sub_803E46C(0x46); + for (i = 0; i < 250; i += 10) { + SetDungeonBGColorRGB(i, i, i, 1, 0); + sub_803E46C(70); } } void sub_8086764(void) { - s32 index; + s32 i; - for(index = 0xFA; index >= 0; index -= 5) - { - SetDungeonBGColorRGB(index, index, index, 1, 0); - sub_803E46C(0x46); + for (i = 250; i >= 0; i -= 5) { + SetDungeonBGColorRGB(i, i, i, 1, 0); + sub_803E46C(70); } + sub_8085EB0(); } void sub_8086794(void) { - s32 index; + s32 i; gUnknown_202EDC8 = 0; - for(index = 0; index < 0xC8; index++) - { + for (i = 0; i < 200; i++) { SetDungeonBGColorRGB(0, 0, 0, 1, 0); sub_803E9D0(); - sub_803E46C(0x46); - if((index & 3) == 0) - { + sub_803E46C(70); + + if ((i & 3) == 0) { gUnknown_202EDC8++; - if(gUnknown_202EDC8 == 0x1F) + if (gUnknown_202EDC8 == 31) break; } } - sub_803E46C(0x46); + + sub_803E46C(70); gDungeon->unk7 = 0; } @@ -389,11 +375,11 @@ void sub_80867F4(void) void sub_808680C(void) { gUnknown_202F3D0.unk0 = 1; - if(gUnknown_202F3D0.unk3 != 0) - PlaySoundEffect(0x1F9); + if (gUnknown_202F3D0.unk3 != 0) + PlaySoundEffect(505); } -void sub_808682C(u8 entity) +void sub_808682C(void) { gUnknown_202F3D0.unk0 = 0; } @@ -413,44 +399,39 @@ void sub_8086848(u8 entity, u8 r1) void sub_8086854(void) { - if(gUnknown_202F3D0.unk0 != 0) - { - if(gUnknown_202F3D0.unk4 == 0) - { - if(gUnknown_202F3D0.unk1 != 0) - { - gUnknown_202F3D0.unk4 = 0x50; - gUnknown_202F3D0.unk5 = 0x10; + if (gUnknown_202F3D0.unk0) { + if (gUnknown_202F3D0.unk4 == 0) { + if (gUnknown_202F3D0.unk1) { + gUnknown_202F3D0.unk4 = 80; + gUnknown_202F3D0.unk5 = 16; } - else - { - gUnknown_202F3D0.unk4 = RandInt(0x6) + 2; - gUnknown_202F3D0.unk5 = RandInt(0x6) + 2; + else { + gUnknown_202F3D0.unk4 = RandInt(6) + 2; + gUnknown_202F3D0.unk5 = RandInt(6) + 2; } - if(gUnknown_202F3D0.unk3 != 0) - PlaySoundEffect(0x1F9); + + if (gUnknown_202F3D0.unk3 != 0) + PlaySoundEffect(505); } else - { gUnknown_202F3D0.unk4--; - } - if(gUnknown_202F3D0.unk5 != 0) + + if (gUnknown_202F3D0.unk5 != 0) gUnknown_202F3D0.unk5--; + gDungeon->unk181FC = gUnknown_8107314[gUnknown_202F3D0.unk5]; } else - { gDungeon->unk181FC = 0; - } } -void sub_80868F4(struct Entity *entity) +void sub_80868F4(Entity *entity) { entity->info->unk15C = 1; entity->info->unk15D = 1; } -void sub_8086910(struct Entity *entity) +void sub_8086910(Entity *entity) { entity->info->unk15C = 0; entity->info->unk15D = 0; @@ -459,19 +440,19 @@ void sub_8086910(struct Entity *entity) void sub_808692C(void) { sub_80859F0(DIRECTION_NORTHWEST); - sub_803E708(0x4, 0x46); + sub_803E708(4, 70); sub_80859F0(DIRECTION_WEST); - sub_803E708(0x4, 0x46); + sub_803E708(4, 70); sub_80859F0(DIRECTION_SOUTHWEST); - sub_803E708(0x4, 0x46); + sub_803E708(4, 70); sub_80859F0(DIRECTION_SOUTH); - sub_803E708(0x4, 0x46); + sub_803E708(4, 70); } -void SpriteLookAroundEffect(struct Entity *entity) +void SpriteLookAroundEffect(Entity *entity) { s8 r4; s8 r3; @@ -480,17 +461,87 @@ void SpriteLookAroundEffect(struct Entity *entity) sub_80869E4(entity, 4, 2, r4); - sub_803E708(0xF, 0x46); + sub_803E708(15, 70); r4 = sub_8002984(r4, 5); sub_80869E4(entity, 4, 1, r4); - sub_803E708(0xF, 0x46); + sub_803E708(15, 70); r3 = sub_8002984(r4, 4); sub_80869E4(entity, 4, 2, r3); - sub_803E708(0xF, 0x46); + sub_803E708(15, 70); } + +#ifdef NONMATCHING // 100% match, but params for sub_8002A70 are disputed... https://decomp.me/scratch/E3iF1 +void sub_80869E4(Entity *a0, s32 a1, u8 a2, s8 a3) +{ + u32 r4; + s8 *r5; + s32 tmp; + struct EntityInfo* info; + + tmp = (s8)a3; + + info = a0->info; + r4 = (s8)info->action.direction; + while (r4 != tmp) { + r4 = sub_8002A70(r4, tmp, a2); + info->action.direction = r4 % 8; + sub_806CE68(a0, info->action.direction); + sub_803E708(a1, 70); + } +} +#else +NAKED +void sub_80869E4(Entity *a0, s32 a1, u8 a2, s8 a3) +{ + asm_unified( + "push {r4-r7,lr}\n" + "\tmov r7, r9\n" + "\tmov r6, r8\n" + "\tpush {r6,r7}\n" + "\tadds r7, r0, 0\n" + "\tmov r9, r1\n" + "\tlsls r2, 24\n" + "\tlsrs r2, 24\n" + "\tmov r8, r2\n" + "\tlsls r3, 24\n" + "\tasrs r6, r3, 24\n" + "\tldr r0, [r7, 0x70]\n" + "\tadds r0, 0x46\n" + "\tmovs r4, 0\n" + "\tldrsb r4, [r0, r4]\n" + "\tcmp r4, r6\n" + "\tbeq _08086A30\n" + "\tadds r5, r0, 0\n" +"_08086A08:\n" + "\tadds r0, r4, 0\n" + "\tadds r1, r6, 0\n" + "\tmov r2, r8\n" + "\tbl sub_8002A70\n" + "\tlsls r0, 24\n" + "\tasrs r4, r0, 24\n" + "\tmovs r0, 0x7\n" + "\tands r0, r4\n" + "\tstrb r0, [r5]\n" + "\tldrb r1, [r5]\n" + "\tadds r0, r7, 0\n" + "\tbl sub_806CE68\n" + "\tmov r0, r9\n" + "\tmovs r1, 0x46\n" + "\tbl sub_803E708\n" + "\tcmp r4, r6\n" + "\tbne _08086A08\n" +"_08086A30:\n" + "\tpop {r3,r4}\n" + "\tmov r8, r3\n" + "\tmov r9, r4\n" + "\tpop {r4-r7}\n" + "\tpop {r0}\n" + "\tbx r0"); +} +#endif // NONMATCHING \ No newline at end of file diff --git a/src/code_8086A3C.c b/src/code_8086A3C.c index 8a45f0e00..c7b17fea0 100644 --- a/src/code_8086A3C.c +++ b/src/code_8086A3C.c @@ -1,89 +1,86 @@ -#include "constants/monster.h" #include "global.h" +#include "code_806CD90.h" +#include "code_80869E4.h" #include "constants/bg_music.h" #include "constants/direction.h" +#include "constants/monster.h" #include "dungeon_entity.h" #include "dungeon_global_data.h" #include "dungeon_music.h" #include "dungeon_pokemon_attributes.h" +#include "dungeon_util.h" +#include "dungeon_util_1.h" +#include "exclusive_pokemon.h" #include "pokemon.h" #include "pokemon_3.h" -#include "dungeon_util_1.h" -#include "dungeon_util.h" -#include "exclusive_pokemon.h" extern u8 sub_8044B28(void); extern u8 gUnknown_202E038[]; extern void sub_8085374(); extern void sub_80855E4(void *); -extern void sub_8068FE0(struct Entity *, u32, u32); -extern void DisplayDungeonDialogue(u8 *); -extern void sub_806CDD4(struct Entity *, u32, u32); -extern void sub_80869E4(struct Entity *, u32, u32, u32); +extern void sub_8068FE0(Entity *, u32, u32); +extern void DisplayDungeonDialogue(const u8 *); extern void sub_803E708(u32, u32); extern void sub_8086448(void); -extern void SpriteShockEffect(struct Entity *); -extern void SkarmoryEntry(struct Entity *); -extern void SpriteLookAroundEffect(struct Entity *); -extern void sub_8086A54(struct Entity *); +extern void SkarmoryEntry(Entity *); +extern void sub_8086A54(Entity *); extern void sub_808563C(void *); extern void sub_8087144(); -void sub_80866C4(u8 *); -extern void sub_8072008(struct Entity *pokemon, struct Entity *r1, u32 r2, u8 r3, u32); +extern void sub_8072008(Entity *pokemon, Entity *r1, u32 r2, u8 r3, u32); extern bool8 sub_8085B80(u8 *); -extern void sub_8085B4C(u8 *, void *, struct Entity **, u32); +extern void sub_8085B4C(u8 *, void *, Entity **, u32); extern void sub_803E46C(u32); -extern u8 gUnknown_810739C[]; -extern u8 gUnknown_81073D4[]; -extern u8 gUnknown_810740C[]; -extern s16 gUnknown_80F57CC; -extern u8 gUnknown_8101440[]; -extern u8 gSkarmoryPreFightDialogue_1; -extern u8 gSkarmoryPreFightDialogue_2; -extern u8 gSkarmoryPreFightDialogue_3; -extern u8 gSkarmoryPreFightDialogue_4; -extern u8 gSkarmoryPreFightDialogue_5; -extern u8 gSkarmoryPreFightDialogue_6; -extern u8 gSkarmoryPreFightDialogue_7; -extern u8 gSkarmoryPreFightDialogue_8; -extern u8 gSkarmoryPreFightDialogue_9; -extern u8 gSkarmoryReFightDialogue_1; -extern u8 gSkarmoryReFightDialogue_2; -extern u8 gSkarmoryReFightDialogue_3; -extern u8 gTeamMeaniesPreFightDialogue_1; -extern u8 gTeamMeaniesPreFightDialogue_2; -extern u8 gTeamMeaniesPreFightDialogue_3; -extern u8 gTeamMeaniesPreFightDialogue_4; -extern u8 gTeamMeaniesPreFightDialogue_5; -extern u8 gTeamMeaniesPreFightDialogue_6; -extern u8 gTeamMeaniesPreFightDialogue_7; -extern u8 gTeamMeaniesReFightDialogue_1; -extern u8 gTeamMeaniesReFightDialogue_2; -extern u8 gTeamMeaniesReFightDialogue_3; -extern u8 gTeamMeaniesReFightDialogue_4; -extern u8 gTeamMeaniesReFightDialogue_5; +extern const u8 gUnknown_810739C[]; +extern const u8 gUnknown_81073D4[]; +extern const u8 gUnknown_810740C[]; +extern const s16 gUnknown_80F57CC; +extern const u8 gUnknown_8101440[]; +extern const u8 gSkarmoryPreFightDialogue_1[]; +extern const u8 gSkarmoryPreFightDialogue_2[]; +extern const u8 gSkarmoryPreFightDialogue_3[]; +extern const u8 gSkarmoryPreFightDialogue_4[]; +extern const u8 gSkarmoryPreFightDialogue_5[]; +extern const u8 gSkarmoryPreFightDialogue_6[]; +extern const u8 gSkarmoryPreFightDialogue_7[]; +extern const u8 gSkarmoryPreFightDialogue_8[]; +extern const u8 gSkarmoryPreFightDialogue_9[]; +extern const u8 gSkarmoryReFightDialogue_1[]; +extern const u8 gSkarmoryReFightDialogue_2[]; +extern const u8 gSkarmoryReFightDialogue_3[]; +extern const u8 gTeamMeaniesPreFightDialogue_1[]; +extern const u8 gTeamMeaniesPreFightDialogue_2[]; +extern const u8 gTeamMeaniesPreFightDialogue_3[]; +extern const u8 gTeamMeaniesPreFightDialogue_4[]; +extern const u8 gTeamMeaniesPreFightDialogue_5[]; +extern const u8 gTeamMeaniesPreFightDialogue_6[]; +extern const u8 gTeamMeaniesPreFightDialogue_7[]; +extern const u8 gTeamMeaniesReFightDialogue_1[]; +extern const u8 gTeamMeaniesReFightDialogue_2[]; +extern const u8 gTeamMeaniesReFightDialogue_3[]; +extern const u8 gTeamMeaniesReFightDialogue_4[]; +extern const u8 gTeamMeaniesReFightDialogue_5[]; -extern u8 gUnknown_8100D3C; +extern const u8 gUnknown_8100D3C[]; -void sub_8086A3C(struct Entity *pokemon) +void sub_8086A3C(Entity *pokemon) { pokemon->info->unk15C = 1; pokemon->info->unk15E = 1; } -void sub_8086A54(struct Entity *pokemon) +void sub_8086A54(Entity *pokemon) { pokemon->info->unk15C = 1; pokemon->info->unk15E = 0; } -void SetupBossFightHP(struct Entity *pokemon, s32 newHP, u16 songIndex) +void SetupBossFightHP(Entity *pokemon, s32 newHP, u16 songIndex) { // NOTE: needed two of these to match.. very dumb - struct EntityInfo *entityInfo; - struct EntityInfo *enityData_1; + EntityInfo *entityInfo; + EntityInfo *enityData_1; entityInfo = pokemon->info; enityData_1 = pokemon->info; @@ -124,9 +121,9 @@ u8 sub_8086AE4(s16 _index) void sub_8086B14(void) { - struct Entity * LeaderEntity; - struct Entity * DiglettEntity; - struct Entity * SkarmoryEntity; + Entity * LeaderEntity; + Entity * DiglettEntity; + Entity * SkarmoryEntity; LeaderEntity = xxx_call_GetLeader(); DiglettEntity = GetEntityFromClientType(4); @@ -145,9 +142,9 @@ void sub_8086B14(void) void sub_8086B94(void) { - struct Entity * LeaderEntity; - struct Entity * DiglettEntity; - struct Entity * SkarmoryEntity; + Entity * LeaderEntity; + Entity * DiglettEntity; + Entity * SkarmoryEntity; LeaderEntity = xxx_call_GetLeader(); DiglettEntity = GetEntityFromClientType(4); @@ -170,13 +167,13 @@ void sub_8086BDC(char param_1, s32 param_2) void SkarmoryPreFightDialogue(void) { - struct Entity *LeaderEntity; - struct Entity *PartnerEntity; - struct Entity * DiglettEntity; - struct Entity * SkarmoryEntity; + Entity *LeaderEntity; + Entity *PartnerEntity; + Entity * DiglettEntity; + Entity * SkarmoryEntity; - struct Position32 pos1; - struct Position32 pos2; + Position32 pos1; + Position32 pos2; LeaderEntity = xxx_call_GetLeader(); // Player PartnerEntity = GetPartnerEntity(); // Partner @@ -194,33 +191,33 @@ void SkarmoryPreFightDialogue(void) SpriteShockEffect(PartnerEntity); sub_803E708(0x20,0x46); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gSkarmoryPreFightDialogue_1); + DisplayDungeonDialogue(gSkarmoryPreFightDialogue_1); ShiftCameraToPosition(&pos1,0x40); sub_803E708(0x40,0x46); ShiftCameraToPosition(&pos2,0x30); - DisplayDungeonDialogue(&gSkarmoryPreFightDialogue_2); + DisplayDungeonDialogue(gSkarmoryPreFightDialogue_2); sub_803E708(10,0x46); DiglettEntity->info->unk15D = 1; ShiftCameraToPosition(&pos1,0x30); - DisplayDungeonDialogue(&gSkarmoryPreFightDialogue_3); // Diglett: ...I...\nI'm scared. + DisplayDungeonDialogue(gSkarmoryPreFightDialogue_3); // Diglett: ...I...\nI'm scared. sub_803E708(10,0x46); ShiftCameraToPosition(&pos2,0x20); sub_803E708(0x20,0x46); SkarmoryEntry(SkarmoryEntity); - DisplayDungeonDialogue(&gSkarmoryPreFightDialogue_4); // Skarmory: You!\nWhat do you think you're doing here?! + DisplayDungeonDialogue(gSkarmoryPreFightDialogue_4); // Skarmory: You!\nWhat do you think you're doing here?! sub_803E708(10,0x46); - DisplayDungeonDialogue(&gSkarmoryPreFightDialogue_5); + DisplayDungeonDialogue(gSkarmoryPreFightDialogue_5); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gSkarmoryPreFightDialogue_6); + DisplayDungeonDialogue(gSkarmoryPreFightDialogue_6); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gSkarmoryPreFightDialogue_7); + DisplayDungeonDialogue(gSkarmoryPreFightDialogue_7); sub_803E708(10,0x46); sub_806CDD4(SkarmoryEntity,0xd,0); - DisplayDungeonDialogue(&gSkarmoryPreFightDialogue_8); + DisplayDungeonDialogue(gSkarmoryPreFightDialogue_8); sub_803E708(10,0x46); sub_80869E4(PartnerEntity,4,1,2); sub_80869E4(LeaderEntity,4,2,6); - DisplayDungeonDialogue(&gSkarmoryPreFightDialogue_9); + DisplayDungeonDialogue(gSkarmoryPreFightDialogue_9); sub_80869E4(PartnerEntity,4,2,4); sub_80869E4(LeaderEntity,4,1,4); sub_803E708(10,0x46); @@ -230,9 +227,9 @@ void SkarmoryPreFightDialogue(void) void SkarmoryReFightDialogue(void) { - struct Entity * LeaderEntity; - struct Entity * SkarmoryEntity; - struct Position32 pos; + Entity * LeaderEntity; + Entity * SkarmoryEntity; + Position32 pos; LeaderEntity = xxx_call_GetLeader(); SkarmoryEntity = GetEntityFromClientType(3); @@ -242,12 +239,12 @@ void SkarmoryReFightDialogue(void) sub_803E708(10,0x46); SkarmoryEntry(SkarmoryEntity); ShiftCameraToPosition(&pos,0x10); - DisplayDungeonDialogue(&gSkarmoryReFightDialogue_1); + DisplayDungeonDialogue(gSkarmoryReFightDialogue_1); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gSkarmoryReFightDialogue_2); + DisplayDungeonDialogue(gSkarmoryReFightDialogue_2); sub_803E708(10,0x46); sub_806CDD4(SkarmoryEntity,0xd,0); - DisplayDungeonDialogue(&gSkarmoryReFightDialogue_3); + DisplayDungeonDialogue(gSkarmoryReFightDialogue_3); sub_803E708(10,0x46); ShiftCameraToPosition(&LeaderEntity->pixelPos,0x10); DungeonStartNewBGM(MUS_BOSS_BATTLE); @@ -257,12 +254,12 @@ void sub_8086E40(void) { SpriteLookAroundEffect(xxx_call_GetLeader()); sub_803E708(10,0x46); - DisplayDungeonDialogue(&gUnknown_8100D3C); + DisplayDungeonDialogue(gUnknown_8100D3C); sub_803E708(10,0x46); gDungeon->unk2 = 1; } -void SkarmoryEntry(struct Entity * skarmoryEntity) +void SkarmoryEntry(Entity * skarmoryEntity) { sub_806CDD4(skarmoryEntity,0xf,0); sub_8086A54(skarmoryEntity); @@ -272,7 +269,7 @@ void SkarmoryEntry(struct Entity * skarmoryEntity) void sub_8086E9C(void) { - struct Entity * LeaderEntity; + Entity * LeaderEntity; LeaderEntity = xxx_call_GetLeader(); DungeonStartNewBGM(MUS_IN_THE_DEPTHS_OF_THE_PIT); @@ -289,7 +286,7 @@ void sub_8086E9C(void) void sub_8086F00(void) { - struct Entity * LeaderEntity; + Entity * LeaderEntity; LeaderEntity = xxx_call_GetLeader(); sub_80854D4(); @@ -306,7 +303,7 @@ void sub_8086F00(void) // https://decomp.me/scratch/BTqWo void sub_8086F54(u8 param_1, u8 param_2) { - struct Entity *entity; + Entity *entity; s32 index; u32 unk1 = 0; @@ -333,47 +330,47 @@ void sub_8086F54(u8 param_1, u8 param_2) void TeamMeaniesPreFightDialogue(void) { - struct Entity *LeaderEntity; + Entity *LeaderEntity; LeaderEntity = xxx_call_GetLeader(); sub_8086448(); sub_803E708(10, 0x46); - DisplayDungeonDialogue(&gTeamMeaniesPreFightDialogue_1); + DisplayDungeonDialogue(gTeamMeaniesPreFightDialogue_1); sub_803E708(10, 0x46); - DisplayDungeonDialogue(&gTeamMeaniesPreFightDialogue_2); + DisplayDungeonDialogue(gTeamMeaniesPreFightDialogue_2); sub_803E708(10, 0x46); sub_8087144(); DungeonStartNewBGM(MUS_THERES_TROUBLE); - DisplayDungeonDialogue(&gTeamMeaniesPreFightDialogue_3); + DisplayDungeonDialogue(gTeamMeaniesPreFightDialogue_3); sub_803E708(10, 0x46); - DisplayDungeonDialogue(&gTeamMeaniesPreFightDialogue_4); + DisplayDungeonDialogue(gTeamMeaniesPreFightDialogue_4); sub_803E708(10, 0x46); - DisplayDungeonDialogue(&gTeamMeaniesPreFightDialogue_5); + DisplayDungeonDialogue(gTeamMeaniesPreFightDialogue_5); sub_803E708(10, 0x46); - DisplayDungeonDialogue(&gTeamMeaniesPreFightDialogue_6); + DisplayDungeonDialogue(gTeamMeaniesPreFightDialogue_6); sub_803E708(10, 0x46); - DisplayDungeonDialogue(&gTeamMeaniesPreFightDialogue_7); + DisplayDungeonDialogue(gTeamMeaniesPreFightDialogue_7); sub_803E708(10, 0x46); ShiftCameraToPosition(&LeaderEntity->pixelPos, 0x10); } void TeamMeaniesReFightDialogue(void) { - struct Entity *LeaderEntity; - struct Entity *PartnerEntity; + Entity *LeaderEntity; + Entity *PartnerEntity; LeaderEntity = xxx_call_GetLeader(); PartnerEntity = GetPartnerEntity(); sub_8086448(); - DisplayDungeonDialogue(&gTeamMeaniesReFightDialogue_1); + DisplayDungeonDialogue(gTeamMeaniesReFightDialogue_1); sub_803E708(10, 0x46); - DisplayDungeonDialogue(&gTeamMeaniesPreFightDialogue_2); + DisplayDungeonDialogue(gTeamMeaniesPreFightDialogue_2); sub_803E708(10, 0x46); sub_8087144(); sub_803E708(10, 0x46); - DisplayDungeonDialogue(&gTeamMeaniesReFightDialogue_2); + DisplayDungeonDialogue(gTeamMeaniesReFightDialogue_2); sub_803E708(10, 0x46); - DisplayDungeonDialogue(&gTeamMeaniesReFightDialogue_3); + DisplayDungeonDialogue(gTeamMeaniesReFightDialogue_3); sub_803E708(10, 0x46); sub_806CDD4(LeaderEntity, 6, 4); sub_806CDD4(PartnerEntity, 6, 4); @@ -381,8 +378,8 @@ void TeamMeaniesReFightDialogue(void) sub_806CDD4(LeaderEntity, 7, 4); sub_806CDD4(PartnerEntity, 7, 4); sub_803E708(10, 0x46); - DisplayDungeonDialogue(&gTeamMeaniesReFightDialogue_4); - DisplayDungeonDialogue(&gTeamMeaniesReFightDialogue_5); + DisplayDungeonDialogue(gTeamMeaniesReFightDialogue_4); + DisplayDungeonDialogue(gTeamMeaniesReFightDialogue_5); sub_803E708(10, 0x46); ShiftCameraToPosition(&LeaderEntity->pixelPos, 0x10); } @@ -395,14 +392,14 @@ void sub_8087130(void) void sub_8087144(void) { - struct Entity *iVar2; - struct Entity *iVar3; - struct Entity *iVar4; + Entity *iVar2; + Entity *iVar3; + Entity *iVar4; u8 auStack_10c [56]; u8 puStack_60[56]; u8 puStack_5c[56]; u8 *puStack_64[3]; - struct Entity *pEStack_58[3]; + Entity *pEStack_58[3]; u8 auStack_4c [48]; iVar2 = GetEntityFromClientType(5); @@ -436,8 +433,8 @@ void sub_8087144(void) void sub_8087230(void) { - struct Entity *LeaderEntity; - struct Entity *ZapdosEntity; + Entity *LeaderEntity; + Entity *ZapdosEntity; LeaderEntity = xxx_call_GetLeader(); ZapdosEntity = GetEntityFromClientType(0x8); @@ -455,8 +452,8 @@ void sub_8087230(void) void sub_808729C(void) { - struct Entity *LeaderEntity; - struct Entity *ZapdosEntity; + Entity *LeaderEntity; + Entity *ZapdosEntity; LeaderEntity = xxx_call_GetLeader(); ZapdosEntity = GetEntityFromClientType(8); diff --git a/src/code_8092334.c b/src/code_8092334.c index 939177e7b..ee35b2102 100644 --- a/src/code_8092334.c +++ b/src/code_8092334.c @@ -1,7 +1,7 @@ #include "global.h" #include "code_8092334.h" #include "memory.h" -#include "item.h" +#include "items.h" s16 sub_8094828(u16 moveID, u8 id) diff --git a/src/code_809447C.c b/src/code_809447C.c index 77b3fefb1..e72ee1a8f 100644 --- a/src/code_809447C.c +++ b/src/code_809447C.c @@ -2,9 +2,10 @@ #include "code_80130A8.h" #include "code_8092334.h" #include "code_809447C.h" -#include "item.h" -#include "moves.h" +#include "dungeon.h" #include "dungeon_global_data.h" +#include "items.h" +#include "moves.h" #include "text_util.h" #include "text2.h" @@ -38,9 +39,7 @@ extern u8 *gUnknown_8113870[]; extern struct unkStruct_8113080 gUnknown_8113080[]; -void sub_80928C0(u8 *buffer, struct Move *move, struct unkStruct_80928C0 *param_3); extern void xxx_format_string(const char *, u8 *, void *, u32); -void PrintYellowDungeonNametoBuffer(u8 *buffer, struct DungeonLocation *dungeonLocation); extern s32 sub_8008ED0(u8 *); void sub_809447C(struct unkStruct_8094924 *r0, u8 *r1) @@ -59,7 +58,7 @@ static void sub_80944BC(s16 moveID, u8 *buffer) { u16 moveID_u16; s32 moveID_s32 = moveID; - struct Move move; + Move move; if (moveID_s32 < 0x1F4) { // Needed this cast/variable to match @@ -84,12 +83,12 @@ static u8 sub_8094528(s16 moveID) } } -void sub_8094558(u32 param_1,u8 *param_2,struct unkDungeonGlobal_unk1CE98_sub *param_3) +void sub_8094558(u32 param_1,u8 *param_2,unkDungeonGlobal_unk1CE98_sub *param_3) { int iVar2; u8 buffer [200]; s32 y; - struct Item *item; + Item *item; s32 var; sub_80073B8(param_1); diff --git a/src/code_8094F88.c b/src/code_8094F88.c index e4678aafe..a3f4d2408 100644 --- a/src/code_8094F88.c +++ b/src/code_8094F88.c @@ -1,34 +1,31 @@ #include "global.h" -#include "constants/wonder_mail.h" -#include "pokemon.h" #include "code_8094F88.h" -#include "memory.h" +#include "constants/wonder_mail.h" #include "dungeon.h" +#include "memory.h" +#include "moves.h" +#include "pokemon_mid.h" #include "random.h" #include "save.h" #include "text_util.h" -EWRAM_DATA_2 struct unkStruct_203B480 *gUnknown_203B480 = {0}; -EWRAM_DATA_2 struct unkStruct_203B484 *gUnknown_203B484 = {0}; +EWRAM_DATA_2 unkStruct_203B480 *gUnknown_203B480 = {0}; +EWRAM_DATA_2 unkStruct_203B484 *gUnknown_203B484 = {0}; EWRAM_DATA_2 u32 *gUnknown_203B488 = {0}; -EWRAM_DATA_2 struct unkStruct_203B48C *gUnknown_203B48C = {0}; +EWRAM_DATA_2 unkStruct_203B48C *gUnknown_203B48C = {0}; -EWRAM_DATA struct unkStruct_203B480 gUnknown_2038C88[0x20] = {0}; -EWRAM_DATA struct unkStruct_203B484 gUnknown_2039288 = {0}; +EWRAM_DATA unkStruct_203B480 gUnknown_2038C88[0x20] = {0}; +EWRAM_DATA unkStruct_203B484 gUnknown_2039288 = {0}; EWRAM_DATA UNUSED static u32 fill0 = {0}; // 203B484 is size 0x5C and I need to fill a gap of 0x4 EWRAM_DATA u32 gUnknown_20392E8[0x36] = {0}; -EWRAM_DATA struct unkStruct_203B48C gUnknown_20393C0 = {0}; +EWRAM_DATA unkStruct_203B48C gUnknown_20393C0 = {0}; -extern void SaveDungeonLocation(struct unkStruct_8094924*, struct DungeonLocation*); -extern void RestoreDungeonLocation(struct unkStruct_8094924*, struct DungeonLocation*); +extern void SaveDungeonLocation(struct unkStruct_8094924*, DungeonLocation*); +extern void RestoreDungeonLocation(struct unkStruct_8094924*, DungeonLocation*); extern void xxx_save_poke_sub_c_808F41C(struct unkStruct_8094924* a1, struct unkPokeSubStruct_C* unkC); extern void xxx_restore_poke_sub_c_808F410(struct unkStruct_8094924*, struct unkPokeSubStruct_C*); -extern void SavePokemonMoves(struct unkStruct_8094924 *r0, struct Move *moveSet); -extern void RestorePokemonMoves(struct unkStruct_8094924 *r0, struct Move *moveSet); -extern struct PokemonStruct *GetPlayerPokemonStruct(void); extern s32 sub_8094E4C(void); -extern void PrintPokeNameToBuffer(u8 *buffer, struct PokemonStruct *pokemon); extern void sub_8094D28(s32); void sub_80950BC(void) @@ -39,12 +36,12 @@ void sub_80950BC(void) gUnknown_203B48C = &gUnknown_20393C0; } -struct unkStruct_203B480 *sub_80950F8(void) +unkStruct_203B480 *sub_80950F8(void) { return gUnknown_2038C88; } -struct unkStruct_203B484 *sub_8095100(void) +unkStruct_203B484 *sub_8095100(void) { return &gUnknown_2039288; } @@ -54,7 +51,7 @@ u32 *sub_8095108(void) return gUnknown_20392E8; } -struct unkStruct_203B48C *sub_8095110(void) +unkStruct_203B48C *sub_8095110(void) { return &gUnknown_20393C0; } @@ -63,10 +60,10 @@ struct unkStruct_203B48C *sub_8095110(void) void sub_8095118(void) { s32 index; - struct unkStruct_203B480 *unused; + unkStruct_203B480 *unused; - MemoryFill8((u8*)gUnknown_203B480,0, 0x20 * sizeof(struct unkStruct_203B480)); - MemoryFill8((u8*)gUnknown_203B484,0, sizeof(struct unkStruct_203B484)); + MemoryFill8((u8*)gUnknown_203B480,0, 0x20 * sizeof(unkStruct_203B480)); + MemoryFill8((u8*)gUnknown_203B484,0, sizeof(unkStruct_203B484)); for(index = 0; index < 0x20; index++){ // NOTE: we use a temp variable here to force the match @@ -103,11 +100,11 @@ s32 FindOpenMailSlot(void) } // Fakematch -bool8 sub_80951BC(struct unkStruct_203B480 *mail) +bool8 sub_80951BC(unkStruct_203B480 *mail) { s32 index; - struct unkStruct_203B480 *preload; - struct unkStruct_203B480 *preload2; + unkStruct_203B480 *preload; + unkStruct_203B480 *preload2; index = FindOpenMailSlot(); @@ -124,16 +121,16 @@ bool8 sub_80951BC(struct unkStruct_203B480 *mail) } } -bool8 sub_80951FC(struct unkStruct_203B480 *param_1) +bool8 sub_80951FC(unkStruct_203B480 *param_1) { bool8 bVar1 = gUnknown_203B480[1].mailType != 0; gUnknown_203B480[1] = *param_1; return bVar1; } -struct unkStruct_203B480 * GetMailatIndex(u8 index) +unkStruct_203B480 * GetMailatIndex(u8 index) { - struct unkStruct_203B480 *ptr; + unkStruct_203B480 *ptr; ptr = &gUnknown_203B480[index]; return ptr; @@ -141,9 +138,9 @@ struct unkStruct_203B480 * GetMailatIndex(u8 index) void DeleteMailAtIndex(u8 index) { - struct unkStruct_203B480 *unused; + unkStruct_203B480 *unused; - MemoryFill8((u8*)&gUnknown_203B480[index],0,sizeof(struct unkStruct_203B480)); + MemoryFill8((u8*)&gUnknown_203B480[index],0,sizeof(unkStruct_203B480)); unused = &gUnknown_203B480[index]; gUnknown_203B480[index].mailType = 0; unused = &gUnknown_203B480[index]; @@ -188,7 +185,7 @@ void sub_80952C4(void) bool8 HasMail(u8 mailType, u32 param_2) { - struct unkStruct_203B480 *ptr; + unkStruct_203B480 *ptr; s32 index; for(index = 0, ptr = &gUnknown_203B480[0]; index < 0x20; ptr++, index++) @@ -200,7 +197,7 @@ bool8 HasMail(u8 mailType, u32 param_2) s32 CountMailType(u8 mailType) { - struct unkStruct_203B480 *ptr; + unkStruct_203B480 *ptr; s32 total = 0; s32 index; @@ -213,7 +210,7 @@ s32 CountMailType(u8 mailType) u32 CountAllMail(void) { - struct unkStruct_203B480 *ptr; + unkStruct_203B480 *ptr; u32 total = 0; s32 index; @@ -226,7 +223,7 @@ u32 CountAllMail(void) s32 sub_8095374(void) { - struct unkStruct_203B480 *ptr; + unkStruct_203B480 *ptr; s32 retvar = -1; s32 index; @@ -240,7 +237,7 @@ s32 sub_8095374(void) /* With mailType and (additonal data??), search mail and return exact index */ s32 GetMailIndex(u8 mailType, u32 param_2) { - struct unkStruct_203B480 *ptr; + unkStruct_203B480 *ptr; s32 index; for(index = 0, ptr = &gUnknown_203B480[0]; index < 0x20; ptr++, index++) @@ -253,7 +250,7 @@ s32 GetMailIndex(u8 mailType, u32 param_2) /* Return the index of the first mail of the requested type */ s32 GetFirstIndexofMailType(u8 mailType) { - struct unkStruct_203B480 *ptr; + unkStruct_203B480 *ptr; s32 index; for(index = 0, ptr = &gUnknown_203B480[0]; index < 0x20; ptr++, index++) @@ -275,14 +272,14 @@ s32 sub_8095400(u32 param_1) return -1; } -void sub_809542C(struct WonderMailSub *param_1) +void sub_809542C(WonderMailSub *param_1) { u32 seed; #ifndef NONMATCHING - register struct unkStruct_203B480 *preload asm("r2"); + register unkStruct_203B480 *preload asm("r2"); #else - struct unkStruct_203B480 *preload; + unkStruct_203B480 *preload; #endif u8 buffer [20]; @@ -301,11 +298,11 @@ void sub_809542C(struct WonderMailSub *param_1) gUnknown_203B480->rescuesAllowed = GetRescuesAllowed(gUnknown_203B480->unk4.dungeon.id); } -void sub_8095494(struct WonderMailSub *param_1, u8 index) +void sub_8095494(WonderMailSub *param_1, u8 index) { u32 seed; - struct DungeonLocation dungeon; - struct unkStruct_203B480 *mail; + DungeonLocation dungeon; + unkStruct_203B480 *mail; mail = gUnknown_203B480; mail += index; @@ -327,7 +324,7 @@ u32 sub_80954B4(void) u32 sub_80954CC(u8 *a, u32 b) { struct unkStruct_8094924 backup; - struct PokemonStruct *temp; + PokemonStruct1 *temp; s32 index; xxx_init_struct_8094924_restore_809485C(&backup, a, b); @@ -337,7 +334,7 @@ u32 sub_80954CC(u8 *a, u32 b) } RestoreIntegerBits(&backup, &gUnknown_203B484->unk0, 0x20); temp = &gUnknown_203B484->unk4; - memset(temp, 0, sizeof(struct PokemonStruct)); + memset(temp, 0, sizeof(PokemonStruct1)); RestoreIntegerBits(&backup, &temp->unk0, 2); RestoreIntegerBits(&backup, &temp->isTeamLeader, 1); RestoreIntegerBits(&backup, &temp->level, 7); @@ -370,7 +367,7 @@ u32 sub_80954CC(u8 *a, u32 b) u32 sub_8095624(u8 *a, u32 b) { struct unkStruct_8094924 backup; - struct PokemonStruct *temp; + PokemonStruct1 *temp; s32 index; xxx_init_struct_8094924_save_809486C(&backup, a, b); @@ -409,7 +406,7 @@ u32 sub_8095624(u8 *a, u32 b) return backup.unk8; } -void sub_8095774(struct unkStruct_8094924 * a, struct unkStruct_203B480 *b) +void sub_8095774(struct unkStruct_8094924 * a, unkStruct_203B480 *b) { u8 temp; @@ -430,7 +427,7 @@ void sub_8095774(struct unkStruct_8094924 * a, struct unkStruct_203B480 *b) b->unk2D = temp & 1; } -void sub_8095824(struct unkStruct_8094924 * a, struct unkStruct_203B480 *b) +void sub_8095824(struct unkStruct_8094924 * a, unkStruct_203B480 *b) { u8 neg1; u8 zero; diff --git a/src/code_80958E8.c b/src/code_80958E8.c index 06d6196eb..ee0953b18 100644 --- a/src/code_80958E8.c +++ b/src/code_80958E8.c @@ -1,6 +1,6 @@ #include "global.h" #include "memory.h" -#include "item.h" +#include "items.h" #include "friend_area.h" #include "constants/friend_area.h" #include "wonder_mail.h" @@ -11,25 +11,26 @@ #include "pokemon_3.h" #include "code_8094F88.h" -extern bool8 sub_809017C(struct DungeonLocation *); -extern u8 sub_803C1D0(struct DungeonLocation *, u8); +extern bool8 sub_809017C(DungeonLocation *); +extern u8 sub_803C1D0(DungeonLocation *, u8); extern bool8 sub_803C0DC(s16); extern void ResetMailboxSlot(u8); extern void ResetPelipperBoardSlot(u8); extern void ResetJobSlot(u8); -extern bool8 ValidateWonderMail(struct WonderMail *); +extern bool8 ValidateWonderMail(WonderMail *); -EWRAM_DATA_2 struct unkStruct_203B490 *gUnknown_203B490 = {0}; -EWRAM_DATA struct unkStruct_203B490 gUnknown_2039448 = {0}; +static EWRAM_DATA unkStruct_203B490 sUnknown_2039448 = {0}; + +EWRAM_DATA_2 unkStruct_203B490 *gUnknown_203B490 = {0}; void LoadMailInfo(void) { - gUnknown_203B490 = &gUnknown_2039448; + gUnknown_203B490 = &sUnknown_2039448; } -struct unkStruct_203B490 *GetMailInfo(void) +unkStruct_203B490 *GetMailInfo(void) { - return &gUnknown_2039448; + return &sUnknown_2039448; } void InitializeMailJobsNews(void) @@ -63,7 +64,7 @@ void InitializeMailJobsNews(void) } } -bool8 IsValidWonderMail(struct WonderMail *WonderMailData) +bool8 IsValidWonderMail(WonderMail *WonderMailData) { // Has to equal 5 for Wonder Mail // https://web.archive.org/web/20080913124416/http://www.upokecenter.com/games/dungeon/guides/passwords.html @@ -78,7 +79,7 @@ bool8 IsValidWonderMail(struct WonderMail *WonderMailData) } } -bool8 ValidateWonderMail(struct WonderMail *data) +bool8 ValidateWonderMail(WonderMail *data) { if(data->missionType > WONDER_MAIL_MISSION_TYPE_DELIVER_ITEM) diff --git a/src/code_80958E8_1.c b/src/code_80958E8_1.c index a104189f0..a26ceb157 100644 --- a/src/code_80958E8_1.c +++ b/src/code_80958E8_1.c @@ -3,9 +3,9 @@ #include "constants/dungeon.h" #include "constants/monster.h" #include "constants/wonder_mail.h" -#include "item.h" +#include "items.h" #include "code_80958E8.h" -#include "team_inventory.h" +#include "code_80958E8_1.h" #include "random.h" #include "pokemon.h" @@ -17,24 +17,23 @@ struct unkStruct_8096AF8 }; extern u8 IsJobSlotEmpty(u8); -extern struct WonderMail * GetJobSlotInfo(u8); -extern bool8 IsValidWonderMail(struct WonderMail *WonderMailData); -extern u8 sub_8095E38(struct WonderMail *, u8, u8, bool8); +extern bool8 IsValidWonderMail(WonderMail *WonderMailData); +extern u8 sub_8095E38(WonderMail *, u8, u8, bool8); extern void ResetJobSlot(u8); extern void sub_8096C80(void); extern void sub_8096D24(void); extern void sub_80965F4(); extern void SortPelipperJobs(); -extern struct WonderMail *GetPelipperBoardSlotInfo(u8); +extern WonderMail *GetPelipperBoardSlotInfo(u8); u8 sub_8097318(s16 param_1); -extern bool8 GenerateMailJobInfo(struct WonderMail *); +extern bool8 GenerateMailJobInfo(WonderMail *); void SortPelipperJobs(void) { s32 index1; s32 index2; - struct WonderMail mail; + WonderMail mail; for(index1 = 0; index1 < MAX_ACCEPTED_JOBS - 1; index1++) { @@ -57,7 +56,7 @@ void SortPelipperJobs(void) void GeneratePelipperJobs(void) { s32 range; - struct WonderMail *mail; + WonderMail *mail; s32 index; range = RandRange(4,8); @@ -126,9 +125,9 @@ void GeneratePelipperJobs(void) SortPelipperJobs(); } -bool8 IsMailinJobSlot(struct WonderMail *mail) +bool8 IsMailinJobSlot(WonderMail *mail) { - struct WonderMail *jobSlot; + WonderMail *jobSlot; s32 index; for(index = 0, jobSlot = &gUnknown_203B490->jobSlots[0]; index < MAX_ACCEPTED_JOBS; jobSlot++, index++) @@ -150,7 +149,7 @@ bool8 IsMailinJobSlot(struct WonderMail *mail) return FALSE; } -bool8 sub_809693C(struct WonderMail *mail) +bool8 sub_809693C(WonderMail *mail) { u8 dungeonIndex; u8 floor; @@ -196,7 +195,7 @@ s32 GetNumAcceptedJobs(void) s32 CountJobsinDungeon(u8 dungeon) { - struct WonderMail *mail; + WonderMail *mail; s32 index; s32 count; @@ -214,7 +213,7 @@ s32 CountJobsinDungeon(u8 dungeon) bool8 sub_8096A08(u8 dungeon, u8 *param_2) { - struct WonderMail *mail; + WonderMail *mail; s32 index; u32 local_14; s32 temp; @@ -243,7 +242,7 @@ bool8 sub_8096A08(u8 dungeon, u8 *param_2) return FALSE; } -bool8 AcceptJob(struct WonderMail *mail) +bool8 AcceptJob(WonderMail *mail) { s32 index; @@ -258,7 +257,7 @@ bool8 AcceptJob(struct WonderMail *mail) return TRUE; } -struct WonderMail *GetJobSlotInfo(u8 index) +WonderMail *GetJobSlotInfo(u8 index) { return &gUnknown_203B490->jobSlots[index]; } @@ -273,8 +272,8 @@ bool8 IsJobSlotEmpty(u8 index) void sub_8096AF8(struct unkStruct_8096AF8 *param_1, u8 slotIndex,u8 dungeon) { - struct WonderMail *jobSlot; - struct Item *item; + WonderMail *jobSlot; + Item *item; s32 index; jobSlot = GetJobSlotInfo(slotIndex); @@ -314,7 +313,7 @@ void sub_8096AF8(struct unkStruct_8096AF8 *param_1, u8 slotIndex,u8 dungeon) // Unused s16 sub_8096B98(u8 dungeon) { - struct WonderMail *mail; + WonderMail *mail; s32 index; for(index = 0; index < MAX_ACCEPTED_JOBS; index++) @@ -331,7 +330,7 @@ s16 sub_8096B98(u8 dungeon) void sub_8096BD0(void) { s32 index; - struct WonderMail *mail; + WonderMail *mail; for(mail = &gUnknown_203B490->jobSlots[0], index = 0; index < MAX_ACCEPTED_JOBS; mail++, index++) { @@ -351,7 +350,7 @@ void sub_8096BD0(void) bool8 sub_8096C08(u8 *jobIndex) { s32 index; - struct WonderMail *mail; + WonderMail *mail; for(mail = &gUnknown_203B490->jobSlots[0], index = 0; index < MAX_ACCEPTED_JOBS; mail++, index++) { diff --git a/src/code_80958E8_mid.c b/src/code_80958E8_mid.c index 6dd4af98f..31e343abe 100644 --- a/src/code_80958E8_mid.c +++ b/src/code_80958E8_mid.c @@ -2,17 +2,17 @@ #include "constants/dungeon.h" #include "constants/friend_area.h" #include "constants/wonder_mail.h" -#include "item.h" +#include "items.h" #include "random.h" #include "friend_area.h" #include "code_80958E8.h" +#include "code_80A26CC.h" -bool8 sub_8095E38(struct WonderMail *mail, u8 dungeon, u32 floor, u8 param_4); -extern s32 sub_80A29B0(u8 *param_1); +bool8 sub_8095E38(WonderMail *mail, u8 dungeon, u32 floor, u8 param_4); extern s32 GetDungeonFloorCount(u8); -extern bool8 sub_809017C(struct DungeonLocation *); +extern bool8 sub_809017C(DungeonLocation *); -bool8 GenerateMailJobDungeonInfo(struct WonderMail *mail) +bool8 GenerateMailJobDungeonInfo(WonderMail *mail) { s32 counter; s32 floor; @@ -25,7 +25,7 @@ bool8 GenerateMailJobDungeonInfo(struct WonderMail *mail) s32 floor_1; s32 halfFloorCount; s32 floorCount; - struct DungeonLocation dungeonLoc; + DungeonLocation dungeonLoc; cap = sub_80A29B0(dungeonStack); @@ -92,7 +92,7 @@ bool8 GenerateMailJobDungeonInfo(struct WonderMail *mail) } while( TRUE ); } -bool8 sub_8095E38(struct WonderMail *mail, u8 dungeon, u32 floor, u8 param_4) +bool8 sub_8095E38(WonderMail *mail, u8 dungeon, u32 floor, u8 param_4) { if (mail->mailType != MAIL_TYPE_NONE) { if ((mail->missionType == WONDER_MAIL_MISSION_TYPE_ESCORT_CLIENT) && (param_4 == 1)) { diff --git a/src/code_80972F4.c b/src/code_80972F4.c index 78a9afeac..d9d83e2d1 100644 --- a/src/code_80972F4.c +++ b/src/code_80972F4.c @@ -6,55 +6,45 @@ #include "dungeon.h" #include "exclusive_pokemon.h" #include "event_flag.h" +#include "code_80A26CC.h" +#include "code_80972F4.h" -struct MissionText -{ - u8 *text; - u8 unk4; - u8 unk5; - u8 unk6; - u8 unk7; -}; -extern struct MissionText gStoryMissionText[]; +extern MissionText gStoryMissionText[]; extern const char gFinalScenarioText[]; extern const char gMeetNinetalesText[]; extern const char gAvoidCaptureText[]; extern const u8 gUnknown_8109CC0[]; extern const u8 gDummyScenarioText[]; -extern u8 sub_80A270C(s16); -extern u8 sub_80A2728(s16); extern void sub_800199C(u8, u8, u16, s32); -void SaveWonderMail(struct unkStruct_8094924 *a, struct WonderMail *b); -void RestoreWonderMail(struct unkStruct_8094924 *a, struct WonderMail *b); -extern s32 sub_8096EB0(struct WonderMail *); -extern void SaveDungeonLocation(struct unkStruct_8094924*, struct DungeonLocation*); -extern void RestoreDungeonLocation(struct unkStruct_8094924*, struct DungeonLocation*); +void SaveWonderMail(struct unkStruct_8094924 *a, WonderMail *b); +void RestoreWonderMail(struct unkStruct_8094924 *a, WonderMail *b); +extern s32 sub_8096EB0(WonderMail *); +extern void SaveDungeonLocation(struct unkStruct_8094924*, DungeonLocation*); +extern void RestoreDungeonLocation(struct unkStruct_8094924*, DungeonLocation*); extern void sub_80015C0(u8, u8); extern u32 sub_8001784(u32, u32, u16); extern void GeneratePelipperJobs(void); -s16 sub_80A26B8(s16); extern void sub_80018D8(u8, u8, u32); -bool8 sub_8096F50(struct WonderMail *mail) +bool8 sub_8096F50(WonderMail *mail) { s32 index; s32 temp2; - struct subStruct_203B490 *temp; + subStruct_203B490 *temp; temp2 = sub_8096EB0(mail); - - for(index = 0; index < 0x10; index++) - { + for (index = 0; index < 0x10; index++) { temp = &gUnknown_203B490->unk230[index]; - if(temp->dungeon.id == mail->unk4.dungeon.id) - if(temp->dungeon.floor == mail->unk4.dungeon.floor) - if(temp->seed == mail->unk4.seed) - if(temp->unk8 == temp2) + if (temp->dungeon.id == mail->unk4.dungeon.id) + if (temp->dungeon.floor == mail->unk4.dungeon.floor) + if (temp->seed == mail->unk4.seed) + if (temp->unk8 == temp2) return TRUE; } + return FALSE; } @@ -147,7 +137,7 @@ u32 SaveMailInfo(u8 *r0, u32 size) return backup.unk8; } -void RestoreWonderMail(struct unkStruct_8094924 *a, struct WonderMail *b) +void RestoreWonderMail(struct unkStruct_8094924 *a, WonderMail *b) { RestoreIntegerBits(a, &b->mailType, 4); RestoreIntegerBits(a, &b->missionType, 3); @@ -162,7 +152,7 @@ void RestoreWonderMail(struct unkStruct_8094924 *a, struct WonderMail *b) RestoreDungeonLocation(a, &b->unk4.dungeon); } -void SaveWonderMail(struct unkStruct_8094924 *a, struct WonderMail *b) +void SaveWonderMail(struct unkStruct_8094924 *a, WonderMail *b) { SaveIntegerBits(a, &b->mailType, 4); SaveIntegerBits(a, &b->missionType, 3); @@ -232,18 +222,18 @@ void sub_809733C(short param_1,u32 param_2) bool32 sub_8097384(s16 param_1) { - bool32 iVar1; - - if (param_1 == 0xd) { - iVar1 = FALSE; - } - else { - iVar1 = sub_8001784(0,0x2c,param_1 & 0xffff); - if (iVar1 != 0) { - iVar1 = TRUE; + bool32 val; + + if (param_1 == 13) + val = FALSE; + else { + // May not need the & 0xFFFF if the 3rd param is s16 + val = sub_8001784(0, 44, param_1 & 0xFFFF); + if (val != 0) + val = TRUE; } - } - return iVar1; + + return val; } void sub_80973A8(s16 param_1,u32 param_2) @@ -264,23 +254,20 @@ void sub_80973A8(s16 param_1,u32 param_2) } } -s32 sub_80973F4(s32 param_1) +bool32 sub_80973F4(s16 param_1) { - s32 iVar1; - s16 param_1_u16 = param_1; - - if (param_1_u16 == 0xd) { - iVar1 = 0; - } - else { - s32 param_1_s32 = param_1_u16; - u16 param_1_temp = param_1_s32; - iVar1 = sub_8001784(0,0x2d,param_1_temp); - if (iVar1 != 0) { - iVar1 = 1; + bool32 val; + + if (param_1 == 13) + val = FALSE; + else { + // May not need the & 0xFFFF if the 3rd param is s16 + val = sub_8001784(0, 45, param_1 & 0xFFFF); + if (val != 0) + val = TRUE; } - } - return iVar1; + + return val; } void sub_8097418(s16 index,u32 param_2) @@ -289,7 +276,7 @@ void sub_8097418(s16 index,u32 param_2) u8 param_2_u8 = param_2; if (index_s32 != 0xd) { if ((param_2_u8 != 0) && (sub_800199C(0,0x2c,index_s32,0), index_s32 < 0x1f)) { - struct MissionText *mt = &gStoryMissionText[index_s32]; + MissionText *mt = &gStoryMissionText[index_s32]; if (mt->unk4 != 0xFF) { sub_8097FA8(mt->unk4); } @@ -333,7 +320,7 @@ const u8 *GetCurrentMissionText(s16 index) { if(index < 0x1F) { - struct MissionText *mt = &gStoryMissionText[index]; + MissionText *mt = &gStoryMissionText[index]; return mt->text; } else @@ -359,7 +346,7 @@ bool8 sub_8097504(s16 mazeIndex) #ifndef NONMATCHING register s32 mazeIndex_s32_1 asm("r1"); #else - s32 mazeIndex_s32_1; + s32 mazeIndex_s32_1; #endif s32 uVar3; @@ -434,7 +421,7 @@ const u8 *sub_80975C4(s16 index) return GetDungeonName1(sub_80A2728(index)); } -const char *sub_80975DC(u32 r0) +const u8 *sub_80975DC(u32 r0) { // TODO: slight hack but matches r0 <<= 16; diff --git a/src/code_8097670.c b/src/code_8097670.c index e2976bd50..c7a767e05 100644 --- a/src/code_8097670.c +++ b/src/code_8097670.c @@ -3,28 +3,30 @@ #include "pokemon.h" #include "pokemon_3.h" -EWRAM_DATA_2 struct unkStruct_203B494 *gUnknown_203B494 = {0}; -EWRAM_DATA struct unkStruct_203B494 gUnknown_2039778 = {0}; +static EWRAM_DATA struct unkStruct_203B494 sUnknown_2039778 = {0}; +EWRAM_DATA_2 struct unkStruct_203B494 *gUnknown_203B494 = {0}; + +// data_810AE24.s extern const u8 *gAdventureLogText[]; void sub_8097670(void) { - gUnknown_203B494 = &gUnknown_2039778; + gUnknown_203B494 = &sUnknown_2039778; } struct unkStruct_203B494 *sub_8097680(void) { - return &gUnknown_2039778; + return &sUnknown_2039778; } -void SetDungeonLocationInfo(struct DungeonLocation *r0) +void SetDungeonLocationInfo(DungeonLocation *r0) { gUnknown_203B494->dungeonLocation.id = r0->id; gUnknown_203B494->dungeonLocation.floor = r0->floor; } -struct DungeonLocation *GetDungeonLocationInfo(void) +DungeonLocation *GetDungeonLocationInfo(void) { return &gUnknown_203B494->dungeonLocation; } @@ -41,15 +43,11 @@ void sub_80976A8(void) gUnknown_203B494->unk8 = 0; gUnknown_203B494->unkC = 0; - for(index = 0; index < 0xE; index++) - { + for (index = 0; index < 14; index++) gUnknown_203B494->unk1C[index] = 0; - } - for(index = 0; index < 0xD; index++) - { + for (index = 0; index < 13; index++) gUnknown_203B494->unk8C[index] = 0; - } } void sub_80976F8(u8 r0) @@ -59,10 +57,9 @@ void sub_80976F8(u8 r0) bool8 sub_8097710(u8 r0) { - if(gUnknown_203B494->unk0 & (1 << r0)) + if (gUnknown_203B494->unk0 & (1 << r0)) return TRUE; - else - return FALSE; + return FALSE; } const u8 *GetAdventureLogLine(u8 index) @@ -78,7 +75,7 @@ void ResetNumAdventures(void) void IncrementNumAdventures(void) { gUnknown_203B494->numAdventures++; - if(gUnknown_203B494->numAdventures > 99999) + if (gUnknown_203B494->numAdventures > 99999) gUnknown_203B494->numAdventures = 99999; } @@ -87,7 +84,7 @@ s32 GetNumAdventures(void) return gUnknown_203B494->numAdventures; } -void SetNumAdventures(s32 numAdventures) +UNUSED static void SetNumAdventures(s32 numAdventures) { gUnknown_203B494->numAdventures = numAdventures; } @@ -95,8 +92,9 @@ void SetNumAdventures(s32 numAdventures) void sub_8097790(void) { gUnknown_203B494->unk8++; - if(gUnknown_203B494->unk8 > 99999) + if (gUnknown_203B494->unk8 > 99999) gUnknown_203B494->unk8 = 99999; + sub_80976F8(8); } @@ -105,7 +103,7 @@ s32 sub_80977B8(void) return gUnknown_203B494->unk8; } -void sub_80977C4(s32 r0) +UNUSED static void sub_80977C4(s32 r0) { gUnknown_203B494->unk8 = r0; } @@ -113,8 +111,9 @@ void sub_80977C4(s32 r0) void sub_80977D0(void) { gUnknown_203B494->unkC++; - if(gUnknown_203B494->unkC > 99999) + if (gUnknown_203B494->unkC > 99999) gUnknown_203B494->unkC = 99999; + sub_80976F8(9); } @@ -123,15 +122,16 @@ s32 sub_80977F8(void) return gUnknown_203B494->unkC; } -void sub_8097804(s32 r0) +UNUSED static void sub_8097804(s32 r0) { gUnknown_203B494->unkC = r0; } void sub_8097810(void) { - if(gUnknown_203B494->unk14 < 9999) + if (gUnknown_203B494->unk14 < 9999) gUnknown_203B494->unk14++; + sub_80976F8(11); } @@ -142,8 +142,9 @@ s16 sub_8097838(void) void sub_8097848(void) { - if(gUnknown_203B494->unk16 < 9999) + if (gUnknown_203B494->unk16 < 9999) gUnknown_203B494->unk16++; + sub_80976F8(10); } @@ -159,8 +160,9 @@ s16 sub_8097880(void) void sub_8097890(void) { - if(gUnknown_203B494->unkC0 < 99999) + if (gUnknown_203B494->unkC0 < 99999) gUnknown_203B494->unkC0++; + sub_80976F8(12); } @@ -171,33 +173,32 @@ s16 sub_80978B8(void) void sub_80978C8(s16 pokeIndex) { - s32 iVar2; - struct unkStruct_203B494 *preload; - s32 baseSpecies; + s32 iVar2; + struct unkStruct_203B494 *preload; + s32 baseSpecies; - baseSpecies = GetBaseSpeciesNoUnown(pokeIndex); - preload = gUnknown_203B494; - iVar2 = baseSpecies; - if (baseSpecies < 0) { - iVar2 = baseSpecies + 0x1f; - } - preload->unk54[iVar2 >> 5] |= 1 << (baseSpecies + (iVar2 >> 5) * -0x20); + baseSpecies = GetBaseSpeciesNoUnown(pokeIndex); + preload = gUnknown_203B494; + iVar2 = baseSpecies; + if (baseSpecies < 0) + iVar2 = baseSpecies + 0x1F; // 0x1F == MONSTER_NIDOQUEEN + + preload->unk54[iVar2 >> 5] |= 1 << (baseSpecies + (iVar2 >> 5) * -0x20); } bool8 sub_8097900(s16 pokeIndex) { - s32 iVar2; - struct unkStruct_203B494 *preload; - s32 baseSpecies; + s32 iVar2; + struct unkStruct_203B494 *preload; + s32 baseSpecies; - baseSpecies = GetBaseSpeciesNoUnown(pokeIndex); - preload = gUnknown_203B494; - iVar2 = baseSpecies; - if (baseSpecies < 0) { - iVar2 = baseSpecies + 0x1f; - } - if(preload->unk1C[iVar2 >> 5] & (1 << (baseSpecies + (iVar2 >> 5) * -0x20))) - return TRUE; - else + baseSpecies = GetBaseSpeciesNoUnown(pokeIndex); + preload = gUnknown_203B494; + iVar2 = baseSpecies; + if (baseSpecies < 0) + iVar2 = baseSpecies + 0x1F; // 0x1F == MONSTER_NIDOQUEEN + + if (preload->unk1C[iVar2 >> 5] & (1 << (baseSpecies + (iVar2 >> 5) * -0x20))) + return TRUE; return FALSE; -} +} \ No newline at end of file diff --git a/src/code_8097DD0.c b/src/code_8097DD0.c index f8336901c..58523c00a 100644 --- a/src/code_8097DD0.c +++ b/src/code_8097DD0.c @@ -1,29 +1,11 @@ #include "global.h" #include "code_8092334.h" +#include "code_8097670.h" #include "pokemon.h" #include "exclusive_pokemon.h" -struct unkStruct_203B494 -{ - // size: 0xC8? - u32 unk0; // 32 bit bitfield, I think - s32 numAdventures; - s32 unk8; - s32 unkC; - struct DungeonLocation dungeonLocation; - s16 unk14; - s16 unk16; - s16 unk18; - u32 unk1C[0xE]; - u32 unk54[0xE]; - u32 unk8C[0xD]; - s32 unkC0; -}; - -extern struct unkStruct_203B494 *gUnknown_203B494; - -extern void SaveDungeonLocation(struct unkStruct_8094924*, struct DungeonLocation*); -extern void RestoreDungeonLocation(struct unkStruct_8094924*, struct DungeonLocation*); +extern void SaveDungeonLocation(struct unkStruct_8094924*, DungeonLocation*); +extern void RestoreDungeonLocation(struct unkStruct_8094924*, DungeonLocation*); void ReadGameOptions(struct unkStruct_8094924 *param_1); void ReadPlayTime(struct unkStruct_8094924 *r0); void WriteGameOptions(struct unkStruct_8094924 *param_1); diff --git a/src/code_80A26CC.c b/src/code_80A26CC.c index ac99669cd..4106a75c1 100644 --- a/src/code_80A26CC.c +++ b/src/code_80A26CC.c @@ -1,21 +1,23 @@ #include "global.h" +#include "code_80972F4.h" #include "code_80A26CC.h" #include "event_flag.h" +#include "ground_main.h" -extern u8 sub_80973F4(s16); -extern u8 sub_8097384(s16); -s16 sub_80A26B8(s16); -extern struct unkStruct_80A2608 gUnknown_81168A8[]; -extern u8 sub_8098F88(void); -extern u32 sub_8001658(u32, u32); - -extern s16 gUnknown_8116F9A[]; -extern s16 gUnknown_8116F24[]; +// data_8115F5C.s +extern const unkStruct_80A2608 gUnknown_81168A8[]; +extern const s16 gUnknown_8116F24[]; +extern const s16 gUnknown_8116F9A[]; extern const u8 *gUnknown_8117000[]; -extern void sub_809AC18(s32, s32); -extern void sub_809ABB4(s32, s32); +// code_80972F4.h (read comment) +extern bool8 sub_8097384(s16); +extern bool8 sub_80973F4(s16); + +// code_8098BDC.s extern void sub_809AB4C(s32, s32); +extern void sub_809ABB4(s32, s32); +extern void sub_809AC18(s32, s32); s16 sub_80A8BBC(s16); @@ -62,91 +64,77 @@ void sub_80A2598(s16 r0, s16 r1) u32 sub_80A25AC(u16 param_1) { - if (sub_8098F88() != 0) { + if (sub_8098F88()) return param_1; - } - else - { - if (param_1 == 0x32) { - return 0x32; - } - else if (!sub_80023E4(0xc)) { - return 999; - } - else if (sub_80023E4(0xd)) { - return 0x13; - } - else if (param_1 != 1) { - return param_1; - } - else - { - sub_8001658(0,0x28); - return 1; - } - } + if (param_1 == 50) + return 50; + if (!sub_80023E4(12)) + return 999; + if (sub_80023E4(13)) + return 19; + if (param_1 != 1) + return param_1; + sub_8001658(0, 40); + return 1; } -struct unkStruct_80A2608 *sub_80A2608(s16 index) +const unkStruct_80A2608 *sub_80A2608(s16 index) { return &gUnknown_81168A8[index]; } -struct unkStruct_80A2608 *sub_80A2620(s16 index) +const unkStruct_80A2608 *sub_80A2620(s16 index) { u32 temp; temp = sub_80A26B8(index); return &gUnknown_81168A8[temp]; } -s16 sub_80A2644(u32 index) +UNUSED static s16 sub_80A2644(u32 index) { return gUnknown_8116F24[index]; } s16 sub_80A2654(s16 index) { - struct unkStruct_80A2608 *temp; + const unkStruct_80A2608 *temp; + temp = sub_80A2608(index); return temp->unkE; } // This is very ugly -s32 sub_80A2668(u32 r0) +s16 sub_80A2668(u32 r0) { u32 temp; - temp = 0xffc90000 + (r0 << 16); - if(temp >> 16 < 0x19) - { + temp = 0xFFC90000 + (r0 << 16); + if (temp >> 16 < 0x19) return ((s32)temp >> 16); - } - else - { - return -1; - } + + return -1; } -u32 sub_80A2688(u8 r0) +s16 sub_80A2688(u8 r0) { u32 uVar1; - uVar1 = r0 - 0x4B; + uVar1 = r0 - 75; // u8 cast is needed for only this compare - if ((u8)uVar1 < 0x17) + if ((u8)uVar1 < 23) return uVar1; - else if(r0 == 0x2F) - return 0x17; - else if (r0 == 0x30) - return 0x18; - else - return -1; + if (r0 == 47) + return 23; + if (r0 == 48) + return 24; + return -1; } s16 sub_80A26B8(s16 r0) { // Useless cast that forces correct ordering s32 temp; + temp = r0; return gUnknown_8116F9A[r0]; @@ -154,27 +142,22 @@ s16 sub_80A26B8(s16 r0) s16 sub_80A26CC(s16 r0) { - return (0xDC >> 2) + r0; + return 55 + r0; } - -s32 sub_80A26D8(u8 index) +UNUSED static s16 sub_80A26D8(u8 index) { - s32 counter; - s32 counter2; - s32 temp2; - struct unkStruct_80A2608 *temp; - for(counter = 0; counter <= 0x52; counter++) - { - temp2 = counter << 0x10; - counter2 = temp2 >> 0x10; + s32 i; + s16 counter2; + const unkStruct_80A2608 *temp; + + for (i = 0; i < 83; i++) { + counter2 = i; temp = sub_80A2608(counter2); - if(temp->unk11 != 0) - { - if(temp->dungeonIndex == index) - { + + if (temp->unk11 != 0) { + if (temp->dungeonIndex == index) return counter2; - } } } return -1; @@ -182,7 +165,7 @@ s32 sub_80A26D8(u8 index) u8 sub_80A270C(s16 index) { - struct unkStruct_80A2608 *temp; + const unkStruct_80A2608 *temp; s32 index_s32; index_s32 = index; // forcing a shift before addressing @@ -192,22 +175,24 @@ u8 sub_80A270C(s16 index) u8 sub_80A2728(s16 index) { - struct unkStruct_80A2608 *temp; - s16 temp_number = (0xDC >> 2) + index; + const unkStruct_80A2608 *temp; + + s16 temp_number = 55 + index; temp = sub_80A2608(temp_number); return temp->dungeonIndex; } u8 sub_80A2740(s32 index) { - struct unkStruct_80A2608 *temp; + const unkStruct_80A2608 *temp; + temp = sub_80A2608(index); return temp->dungeonIndex; } s16 sub_80A2750(s16 r0) { - struct unkStruct_80A2608 *temp; + const unkStruct_80A2608 *temp; s32 temp_32; s32 temp_2; @@ -215,25 +200,25 @@ s16 sub_80A2750(s16 r0) temp_32 = r0; temp_2 = temp_32; - if(r0 == 0x50) + if (r0 == 80) return 3; - if(r0 == 0x51) + if (r0 == 81) return 2; - if(r0 == 0x52) + if (r0 == 82) return 4; - if((u16)(r0 - 0x28) <= 0xE) + if ((u16)(r0 - 40) <= 14) return 2; - if((u16)(r0 - 0x37) <= 0x18) + if ((u16)(r0 - 55) <= 24) return 4; temp = sub_80A2608(temp_2); - if(temp->unkE == -1) + if (temp->unkE == -1) return 1; - if(sub_80023E4(5)) + if (sub_80023E4(5)) return 1; - if(sub_80973F4(temp->unkE) == 0) + if (!sub_80973F4(temp->unkE)) return 1; - if(!sub_80023E4(1)) + if (!sub_80023E4(1)) return 1; return 2; } @@ -242,250 +227,238 @@ bool8 sub_80A27CC(s16 r0) { s32 temp; s32 temp2; - struct unkStruct_80A2608 *return_var; + const unkStruct_80A2608 *t; // Same dumbness as above to get a match temp2 = r0; temp = temp2; - return_var = sub_80A2620(r0); - if(return_var->unk0 == -1) + t = sub_80A2620(r0); + if (t->unk0 == -1) return FALSE; - if(sub_80023E4(5)) + if (sub_80023E4(5)) return FALSE; - if(sub_8097384(r0) != 0) + if (sub_8097384(r0)) return TRUE; - if(!sub_80023E4(1)) + if (!sub_80023E4(1)) return FALSE; - if(sub_80973F4(temp) == 0) + if (!sub_80973F4(temp)) return FALSE; return TRUE; } bool8 sub_80A2824(u8 index) { - s32 counter; - struct unkStruct_80A2608 *temp; + s32 i; + const unkStruct_80A2608 *temp; - if(sub_80023E4(5)) + if (sub_80023E4(5)) return FALSE; - if(sub_80023E4(1)) - { - for(counter = 0; counter <= 0x2D; counter++) - { - temp = sub_80A2620(counter); - if(temp->unk11 != 0) - { - if(temp->dungeonIndex == index) - { - if(sub_8097384(counter) != 0) + + if (sub_80023E4(1)) { + for (i = 0; i < 46; i++) { + temp = sub_80A2620(i); + + if (temp->unk11 != 0) { + if (temp->dungeonIndex == index) { + if (sub_8097384(i)) return TRUE; - if(sub_80973F4(counter) != 0) + if (sub_80973F4(i)) return TRUE; } } } } - else - { - for(counter = 0; counter <= 0x2D; counter++) - { - temp = sub_80A2620(counter); - if(temp->unk11 != 0) - if(temp->dungeonIndex == index) - if(sub_8097384(counter) != 0) + else { + for (i = 0; i < 46; i++) { + temp = sub_80A2620(i); + + if (temp->unk11 != 0) + if (temp->dungeonIndex == index) + if (sub_8097384(i)) return TRUE; } } - return FALSE; + return FALSE; } -bool8 sub_80A28B4(s16 r0) +UNUSED static bool8 sub_80A28B4(s16 r0) { - struct unkStruct_80A2608 *temp; + const unkStruct_80A2608 *temp; temp = sub_80A2620(r0); - if(temp->unk0 != -1) - { - if(sub_8097384(r0) == 0 && sub_80973F4(r0) == 0) + + if (temp->unk0 != -1) { + if (!sub_8097384(r0) && !sub_80973F4(r0)) return FALSE; else return TRUE; } + return FALSE; } bool8 sub_80A28F0(u8 index) { s32 counter; - struct unkStruct_80A2608 *temp; + const unkStruct_80A2608 *temp; - for(counter = 0; counter < 0x2E; counter++) - { + for (counter = 0; counter < 0x2E; counter++) { temp = sub_80A2620(counter); - if(temp->unk11 != 0) - { - if(temp->dungeonIndex == index) - { - if(sub_8097384(counter) != 0) + + if (temp->unk11 != 0) { + if (temp->dungeonIndex == index) { + if (sub_8097384(counter)) return TRUE; - if(sub_80973F4(counter) != 0) + if (sub_80973F4(counter)) return TRUE; } } } + return FALSE; } -s32 sub_80A293C(u8 *param_1) +UNUSED static s32 sub_80A293C(u8 *param_1) { - u8 *pcVar2; - struct unkStruct_80A2608 * iVar3; - s32 index; - s32 counter; - u8 local_68 [0x40]; - u8 zero; + u8 *pcVar2; + const unkStruct_80A2608 *iVar3; + s32 index; + s32 counter; + u8 local_68[64]; + u8 zero; - counter = 0; - zero = 0; + counter = 0; + zero = 0; - pcVar2 = &local_68[0x3e]; - do { - *pcVar2 = zero; - pcVar2--; - } while ((int)pcVar2 >= (int)local_68); + pcVar2 = &local_68[62]; + do { + *pcVar2 = zero; + pcVar2--; + } while ((int)pcVar2 >= (int)local_68); - for(index = 0; index < 0x2E; index++) - { - iVar3 = sub_80A2620(index); - if ((iVar3->unk11 != 0) && - (sub_8097384(index) != 0)) { - local_68[iVar3->dungeonIndex] = 1; - } + for (index = 0; index < 46; index++) { + iVar3 = sub_80A2620(index); + if (iVar3->unk11 != 0 && sub_8097384(index)) + local_68[iVar3->dungeonIndex] = 1; } - for(index = 0; index < 0x3F; index++) - { - if (local_68[index] != 0) { - param_1[counter] = index; - counter++; + for (index = 0; index < 63; index++) { + if (local_68[index] != 0) { + param_1[counter] = index; + counter++; + } } - } - return counter; + + return counter; } s32 sub_80A29B0(u8 *param_1) { - u8 *pcVar2; - struct unkStruct_80A2608 * iVar3; - s32 index; - s32 counter; - u8 *local1; - u8 *local2; - u8 *local3; - u8 *local4; - u8 local_68 [0x40]; - u8 zero; + u8 *pcVar2; + const unkStruct_80A2608 *iVar3; + s32 index; + s32 counter; + u8 *local1; + u8 *local2; + u8 *local3; + u8 *local4; + u8 local_68[0x40]; + u8 zero; - counter = 0; - local1 = &local_68[0x2B]; - local2 = &local_68[0x2C]; - local3 = &local_68[0x2D]; - local4 = &local_68[0x2E]; - zero = 0; + counter = 0; + local1 = &local_68[43]; + local2 = &local_68[44]; + local3 = &local_68[45]; + local4 = &local_68[46]; + zero = 0; - pcVar2 = &local_68[0x3e]; - do { - *pcVar2 = zero; - pcVar2 = pcVar2 + -1; - } while ((int)pcVar2 >= (int)local_68); + pcVar2 = &local_68[62]; + do { + *pcVar2 = zero; + pcVar2 = pcVar2 + -1; + } while ((int)pcVar2 >= (int)local_68); - if (sub_80023E4(1)) { - for(index = 0; index < 0x2E; index++) - { - iVar3 = sub_80A2620(index); - if ((iVar3->unk11 != 0) && - (sub_80973F4(index) != 0)) { - local_68[iVar3->dungeonIndex] = 1; - } + if (sub_80023E4(1)) { + for (index = 0; index < 46; index++) { + iVar3 = sub_80A2620(index); + + if (iVar3->unk11 != 0 && sub_80973F4(index)) + local_68[iVar3->dungeonIndex] = 1; + } } - } - *local1 = 0; - *local2 = 0; - *local3 = 0; - *local4 = 0; - for(index = 0; index < 0x3F; index++) - { - if (local_68[index] != 0) { - param_1[counter] = index; - counter++; + *local1 = 0; + *local2 = 0; + *local3 = 0; + *local4 = 0; + + for (index = 0; index < 63; index++) { + if (local_68[index] != 0) { + param_1[counter] = index; + counter++; + } } - } - return counter; + + return counter; } -s32 sub_80A2A5C(u8 *param_1) +UNUSED static s32 sub_80A2A5C(u8 *param_1) { - u8 *pcVar2; - struct unkStruct_80A2608 *iVar3; - s32 index; - s32 counter; - u8 local_58 [0x40]; - u8 zero; + u8 *pcVar2; + const unkStruct_80A2608 *iVar3; + s32 index; + s32 counter; + u8 local_58[0x40]; + u8 zero; - counter = 0; - zero = 0; - - pcVar2 = &local_58[0x3E]; - do { - *pcVar2 = zero; - pcVar2--; - } while ((s32)pcVar2 >= (s32)local_58); + counter = 0; + zero = 0; - if (sub_80023E4(1)) { - for(index = 0; index < 0x2E; index++) - { - iVar3 = sub_80A2620(index); - if ((iVar3->unk11 != 0) && ((sub_8097384(index) != 0) || (sub_80973F4(index) != 0))) - { - local_58[iVar3->dungeonIndex] = 1; - } + pcVar2 = &local_58[62]; + do { + *pcVar2 = zero; + pcVar2--; + } while ((s32)pcVar2 >= (s32)local_58); + + if (sub_80023E4(1)) { + for (index = 0; index < 46; index++) { + iVar3 = sub_80A2620(index); + + if (iVar3->unk11 != 0 && (sub_8097384(index) || sub_80973F4(index))) + local_58[iVar3->dungeonIndex] = 1; + } } - } - else { - for(index = 0; index < 0x2E; index++) - { - iVar3 = sub_80A2620(index); - if ((iVar3->unk11 != 0) && (sub_8097384(index) != 0)) - { - local_58[iVar3->dungeonIndex] = 1; - } + else { + for (index = 0; index < 46; index++) { + iVar3 = sub_80A2620(index); + + if (iVar3->unk11 != 0 && sub_8097384(index)) + local_58[iVar3->dungeonIndex] = 1; + } } - } - for(index = 0; index < 0x3F; index++) - { - if (local_58[index] != 0) { - param_1[counter] = index; - counter++; + + for (index = 0; index < 63; index++) { + if (local_58[index] != 0) { + param_1[counter] = index; + counter++; + } } - } - return counter; + + return counter; } // Returns Location string for the pause menu const u8 *sub_80A2B18(s16 param_1) { s32 param_1_s32 = param_1; - const u8 **preload = gUnknown_8117000; - return preload[param_1_s32]; + return gUnknown_8117000[param_1_s32]; } -const u8 *sub_80A2B28(u16 r0) +UNUSED static const u8 *sub_80A2B28(u16 r0) { return sub_80A2B18(sub_8001658(0, 17)); -} - +} \ No newline at end of file diff --git a/src/code_80A7714.c b/src/code_80A7714.c index 9d0d8904a..26bd4e14a 100644 --- a/src/code_80A7714.c +++ b/src/code_80A7714.c @@ -5,10 +5,11 @@ extern void sub_80A68A0(u32); extern void sub_80A7094(struct axPokemon *, u32, u32, u32); extern void sub_80A7310(struct axPokemon *, u32, u32, u32); extern void sub_80A7784(); -extern s16 gUnknown_2039DE0; -extern u32 gUnknown_8117EFC; -extern u32 *gMapScriptTable[]; +static EWRAM_DATA s16 sUnknown_2039DE0 = {0}; + +extern const u32 gUnknown_8117EFC; +extern const u32 *gMapScriptTable[]; // 811E2F8 void sub_80A7714(u32 a0) { @@ -23,12 +24,12 @@ void sub_80A7720(struct axPokemon *a0, u32 a1, u32 a2) void sub_80A7744(void) { - gUnknown_2039DE0 = -1; + sUnknown_2039DE0 = -1; } void sub_80A7754(void) { - gUnknown_2039DE0 = -1; + sUnknown_2039DE0 = -1; } void sub_80A7764(s16 a0) @@ -38,13 +39,13 @@ void sub_80A7764(s16 a0) sub_80A7784(); if (temp != -1) - gUnknown_2039DE0 = temp; + sUnknown_2039DE0 = temp; } void sub_80A7784(void) { - if (gUnknown_2039DE0 != -1) - gUnknown_2039DE0 = -1; + if (sUnknown_2039DE0 != -1) + sUnknown_2039DE0 = -1; } bool8 sub_80A77A0(s16 a0) @@ -53,7 +54,7 @@ bool8 sub_80A77A0(s16 a0) s32 temp2; temp = a0; temp2 = temp; - if (gUnknown_2039DE0 != temp) { + if (sUnknown_2039DE0 != temp) { if (temp < 0) sub_80A7784(); else @@ -64,7 +65,7 @@ bool8 sub_80A77A0(s16 a0) } // TODO review this later -u32 *sub_80A77D0(s16 a0) +const u32 *sub_80A77D0(s16 a0) { if (a0 != -1) return gMapScriptTable[a0]; diff --git a/src/code_8272724.c b/src/code_8272724.c index a02b03358..8813fb5af 100644 --- a/src/code_8272724.c +++ b/src/code_8272724.c @@ -1,8 +1,8 @@ #include "global.h" #include "text1.h" -extern void sub_8272774(struct UnkTextStruct1 *r0, u32 r1); -extern void sub_8272884(struct UnkTextStruct1 *r0, u32 r1); +extern void sub_8272774(UnkTextStruct1 *r0, u32 r1); +extern void sub_8272884(UnkTextStruct1 *r0, u32 r1); void sub_8272760(u32 r0) { diff --git a/src/credits.c b/src/credits.c index ba24cc11e..91cb9a8a6 100644 --- a/src/credits.c +++ b/src/credits.c @@ -1,4 +1,6 @@ #include "global.h" +#include "code_8098BDC.h" +#include "event_flag.h" #include "input.h" #include "memory.h" #include "text1.h" @@ -7,7 +9,7 @@ // size: 0x6C struct unkCreditsStruct_203B340 { - struct UnkTextStruct2 unk0[4]; + UnkTextStruct2 unk0[4]; s32 unk60; // Unsure if s32/u32/ptr s32 unk64; /* 0x68 */ s32 creditsCategoryIndex; @@ -32,15 +34,13 @@ struct CreditsData EWRAM_DATA_2 struct unkCreditsStruct_203B340 *gUnknown_203B340 = {0}; EWRAM_DATA_2 struct unkCreditsStruct_203B344 *gUnknown_203B344 = {0}; -extern struct UnkTextStruct2 gUnknown_80E4A10; -extern struct UnkTextStruct2 gUnknown_80E4A28; +extern UnkTextStruct2 gUnknown_80E4A10; +extern UnkTextStruct2 gUnknown_80E4A28; extern const u32 gUnknown_80E4A40[]; extern struct CreditsData* gCreditsTable[27]; extern u16 gUnknown_80E5990[]; extern void sub_80015C0(u32, u32); -extern s32 sub_8001658(u32, u32); -extern void sub_8099690(u32); extern void sub_8099A5C(u32, u32, u32); extern void sub_8099AFC(u32, u32, u32); extern u8 sub_8099B94(); @@ -58,7 +58,7 @@ s32 DrawCredits(s32 creditsCategoryIndex, s32 param_2) u8 curChar; u8 buffer[128]; - gUnknown_203B340 = (struct unkCreditsStruct_203B340 *)MemoryAlloc(sizeof(struct unkCreditsStruct_203B340), 8); + gUnknown_203B340 = MemoryAlloc(sizeof(struct unkCreditsStruct_203B340), 8); gUnknown_203B340->unk60 = 0; gUnknown_203B340->unk64 = param_2; gUnknown_203B340->creditsCategoryIndex = creditsCategoryIndex; @@ -68,7 +68,7 @@ s32 DrawCredits(s32 creditsCategoryIndex, s32 param_2) gUnknown_203B340->unk0[0] = gUnknown_80E4A28; ResetUnusedInputStruct(); - sub_800641C(&gUnknown_203B340->unk0[0], 1, 1); + sub_800641C(&gUnknown_203B340->unk0[0], TRUE, TRUE); sub_8099690(2); sub_80073B8(0); @@ -151,7 +151,7 @@ s32 sub_8035574(void) case 3: if (sub_8099B94() == 0) { ResetUnusedInputStruct(); - sub_800641C(NULL, 1, 1); + sub_800641C(NULL, TRUE, TRUE); gUnknown_203B340->unk60 = 4; } break; diff --git a/src/data/code_801AFA4.h b/src/data/code_801AFA4.h new file mode 100644 index 000000000..26ba514ab --- /dev/null +++ b/src/data/code_801AFA4.h @@ -0,0 +1,11 @@ +ALIGNED(4) static const u8 sFill[] = _("pksdir0"); + +ALIGNED(4) static const u8 sFmtWhoWillLearnTheMove[] = _( + "{CENTER_ALIGN}Who will learn the move\n" + "{CENTER_ALIGN}{COLOR_1 CYAN}{ARG_POKEMON_7}{END_COLOR_TEXT_1}?"); +ALIGNED(4) static const u8 sFmtLearnedTheMove[] = _( + "{CENTER_ALIGN}{COLOR_1 CYAN_3}{ARG_POKEMON_8}{END_COLOR_TEXT_1} learned\n" + "{CENTER_ALIGN}the move {COLOR_1 CYAN}{ARG_POKEMON_7}{END_COLOR_TEXT_1}!"); +ALIGNED(4) static const u8 sFmtNoOneCanLearnThisMove[] = _( + "{CENTER_ALIGN}No one in the current team\n" + "{CENTER_ALIGN}can learn this move. "); \ No newline at end of file diff --git a/src/data/code_801B3C0.h b/src/data/code_801B3C0.h new file mode 100644 index 000000000..33df79e43 --- /dev/null +++ b/src/data/code_801B3C0.h @@ -0,0 +1,3 @@ +ALIGNED(4) static const u8 sFill[] = _("pksdir0"); + +ALIGNED(4) static const u8 sFmtPkmn0[] = _("{ARG_POKEMON_0}"); \ No newline at end of file diff --git a/src/data/code_801B60C.h b/src/data/code_801B60C.h new file mode 100644 index 000000000..5c38c4e73 --- /dev/null +++ b/src/data/code_801B60C.h @@ -0,0 +1,65 @@ +ALIGNED(4) static const u8 sFill[] = _("pksdir0"); + +static const UnkTextStruct2 sUnknown_80DBA58 = { + 0, 0, 0, 0, + 3, + 0, 0, + 0, 0, + 0, 0, + NULL +}; +static const UnkTextStruct2 sUnknown_80DBA70 = { + 0, 0, 0, 0, + 3, + 20, 4, + 6, 3, + 3, 0, + NULL +}; +static const UnkTextStruct2 sUnknown_80DBA88 = { + 0, 0, 0, 0, + 3, + 20, 14, + 6, 3, + 3, 0, + NULL +}; + +ALIGNED(4) static const u8 sFmtReceivedThePromised[] = _( + "{CENTER_ALIGN}{COLOR_1 YELLOW_5}{ARG_POKEMON_0}{END_COLOR_TEXT_1} received\n" + "{CENTER_ALIGN}the promised {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1}. "); +ALIGNED(4) static const u8 sFmtTeamReceivedThePromised[] = _( + "{CENTER_ALIGN}{COLOR_1 YELLOW_5}{ARG_POKEMON_0}{END_COLOR_TEXT_1}{APOSTROPHE}s team received\n" + "{CENTER_ALIGN}the promised {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1}."); +ALIGNED(4) static const u8 sFmtTeamAlsoReceived[] = _( + "{CENTER_ALIGN}The team also received\n" + "{CENTER_ALIGN}the item {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1}."); +ALIGNED(4) static const u8 sFmtReceivedStatue[] = _( + "{CENTER_ALIGN}Received the {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1}!{EXTRA_MSG}{CENTER_ALIGN}A very rare statue. It has been placed\n" + "{CENTER_ALIGN}outside your rescue team base."); +ALIGNED(4) static const u8 sFmtReceive1000Instead[] = _( + "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1}...\n" + "{CENTER_ALIGN}You{APOSTROPHE}ve already acquired it.{EXTRA_MSG}{CENTER_ALIGN}Sorry to see that...{EXTRA_MSG}{CENTER_ALIGN}In its place{COMMA} {COLOR_1 YELLOW_5}{ARG_POKEMON_0}{END_COLOR_TEXT_1}{COMMA}\n" + "{CENTER_ALIGN}you can have {COLOR_1 LIGHT_BLUE}1{COMMA}000{END_COLOR_TEXT_1} {POKE}."); +ALIGNED(4) static const u8 sFmtFullSoSentToStorage[] = _( + "{CENTER_ALIGN}Your Toolbox is full.\n" + "{CENTER_ALIGN}The item was sent to storage."); +ALIGNED(4) static const u8 sFmtFullSoPrompt[] = _( + "{CENTER_ALIGN}Your Toolbox is full.\n" + "{CENTER_ALIGN}What would you like to do?"); +ALIGNED(4) static const u8 sFmtConfirmThrowAway[] = _( + "{CENTER_ALIGN}Is it OK to throw away\n" + "{CENTER_ALIGN}this {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1}?"); +ALIGNED(4) static const u8 sFmtThrownAway[] = _( + "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1}\n" + "{CENTER_ALIGN}was thrown away."); +ALIGNED(4) static const u8 sFmtPutInStorageForReceive[] = _( + "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_1}{END_COLOR_TEXT_1} was put in\n" + "{CENTER_ALIGN}storage to get the {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1}."); +ALIGNED(4) static const u8 sFmtDiscardedForReceive[] = _( + "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_1}{END_COLOR_TEXT_1} was discarded\n" + "{CENTER_ALIGN}to get the {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1}."); +ALIGNED(4) static const u8 sTrashToolboxItem[] = _("Trash Toolbox Item"); +ALIGNED(4) static const u8 sTrashReceivedItem[] = _("Trash Received Item"); +ALIGNED(4) static const u8 sStorage[] = _("Storage"); +ALIGNED(4) static const u8 sTrash[] = _("Trash"); \ No newline at end of file diff --git a/src/data/code_803D0D8.h b/src/data/code_803D0D8.h new file mode 100644 index 000000000..6926d45d1 --- /dev/null +++ b/src/data/code_803D0D8.h @@ -0,0 +1,43 @@ +ALIGNED(4) static const u8 sFill[] = _("pksdir0"); + +static const u8 sUnknown_80F42D0[32] = { + 0x3f, 0x36, 0x37, 0x4e, 0x50, 0x52, 0x38, 0x39, + 0x46, 0x30, 0x2b, 0x85, 0x53, 0x54, 0x58, 0x59, + 0x34, 0x35, 0x4d, 0x43, 0x48, 0x4a, 0x2d, 0x4b, + 0x31, 0x32, 0x21, 0xbe, 0x33, 0x51, 0xbd, 0x57 +}; + +static const u8 sUnknown_80F42F0[256] = { + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0x1a, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0x0a, 0xff, 0x16, 0xff, 0xff, + 0x09, 0x18, 0x19, 0x1c, 0x10, 0x11, 0x01, 0x02, + 0x06, 0x07, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, + 0xff, 0xff, 0xff, 0x13, 0xff, 0xff, 0x08, 0xff, + 0x14, 0xff, 0x15, 0x17, 0xff, 0x12, 0x03, 0xff, + 0x04, 0x1d, 0x05, 0x0c, 0x0d, 0xff, 0xff, 0x1f, + 0x0e, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x0b, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0x1e, 0x1b, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, + 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff +}; \ No newline at end of file diff --git a/src/data/decompress.h b/src/data/decompress.h new file mode 100644 index 000000000..fd7c602b9 --- /dev/null +++ b/src/data/decompress.h @@ -0,0 +1,4 @@ + +ALIGNED(4) static const u8 sFill[] = _("pksdir0"); + +static const u32 gByteShiftLookup[4] = {0, 8, 16, 24}; \ No newline at end of file diff --git a/src/data/file_system.h b/src/data/file_system.h new file mode 100644 index 000000000..332f96ae2 --- /dev/null +++ b/src/data/file_system.h @@ -0,0 +1,87 @@ +// ALIGNED(4) static const u8 sFill[] = _("pksdir0"); + +// gFastMod3Lookup +// gFastDiv3Lookup +// gUnknown_80B8AE4 +// gUnknown_80B92E4 + +static const u32 gUnknown_80B96E4[300] = { + 0, 0, 45426, 71998, + 90852, 105476, 117424, 127527, + 136278, 143997, 150902, 157148, + 162850, 168096, 172953, 177474, + 181704, 185677, 189423, 192966, + 196328, 199525, 202574, 205487, + 208276, 210952, 213522, 215995, + 218379, 220679, 222900, 225049, + 227130, 229147, 231103, 233003, + 234849, 236645, 238392, 240095, + 241754, 243372, 244951, 246494, + 248000, 249473, 250913, 252323, + 253703, 255054, 256378, 257676, + 258948, 260197, 261422, 262624, + 263805, 264965, 266105, 267225, + 268326, 269410, 270475, 271524, + 272556, 273572, 274573, 275558, + 276529, 277486, 278429, 279358, + 280275, 281179, 282071, 282950, + 283818, 284675, 285521, 286356, + 287180, 287994, 288798, 289593, + 290378, 291153, 291920, 292677, + 293426, 294167, 294899, 295623, + 296339, 297048, 297749, 298442, + 299129, 299808, 300480, 301145, + 301804, 302456, 303102, 303741, + 304374, 305001, 305623, 306238, + 306848, 307452, 308050, 308643, + 309231, 309814, 310391, 310963, + 311531, 312093, 312651, 313204, + 313753, 314296, 314836, 315371, + 315901, 316428, 316950, 317468, + 317982, 318492, 318998, 319500, + 319999, 320493, 320984, 321472, + 321955, 322435, 322912, 323385, + 323855, 324321, 324785, 325244, + 325701, 326155, 326605, 327052, + 327497, 327938, 328376, 328812, + 329245, 329674, 330101, 330525, + 330947, 331366, 331782, 332195, + 332606, 333014, 333420, 333824, + 334224, 334623, 335019, 335412, + 335804, 336193, 336579, 336964, + 337346, 337726, 338103, 338479, + 338852, 339224, 339593, 339960, + 340325, 340688, 341049, 341408, + 341766, 342121, 342474, 342825, + 343175, 343523, 343868, 344212, + 344555, 344895, 345234, 345571, + 345906, 346240, 346571, 346902, + 347230, 347557, 347882, 348206, + 348528, 348848, 349167, 349485, + 349800, 350115, 350428, 350739, + 351049, 351357, 351664, 351970, + 352274, 352576, 352878, 353178, + 353476, 353773, 354069, 354364, + 354657, 354949, 355240, 355529, + 355817, 356104, 356389, 356674, + 356957, 357239, 357519, 357799, + 358077, 358354, 358630, 358905, + 359179, 359451, 359723, 359993, + 360262, 360530, 360797, 361063, + 361328, 361591, 361854, 362116, + 362376, 362636, 362894, 363152, + 363408, 363664, 363918, 364172, + 364424, 364676, 364927, 365176, + 365425, 365673, 365920, 366165, + 366410, 366655, 366898, 367140, + 367381, 367622, 367861, 368100, + 368338, 368575, 368811, 369047, + 369281, 369515, 369748, 369980, + 370211, 370441, 370671, 370899, + 371127, 371354, 371581, 371806, + 372031, 372255, 372479, 372701, + 372923, 373144, 373364, 373584 +}; + +ALIGNED(4) static const u8 gUnknown_80B9B94[] = _("pksdir0"); +ALIGNED(4) static const u8 gUnknown_80B9B9C[] = _("not find file [%s]\n"); \ No newline at end of file diff --git a/src/data/friend_area_action_menu.h b/src/data/friend_area_action_menu.h new file mode 100644 index 000000000..74ebabdaf --- /dev/null +++ b/src/data/friend_area_action_menu.h @@ -0,0 +1,83 @@ +static const UnkTextStruct2 sUnknown_80DD6EC = +{ + 0x00, 0x00, 0x00, 0x00, + 0x03, + 0x00, 0x00, + 0x00, 0x00, + 0x00, 0x00, + NULL +}; + +static const UnkTextStruct2 sUnknown_80DD704 = +{ + 0x00, 0x00, 0x00, 0x00, + 0x03, + 0x13, 0x04, + 0x09, 0x03, + 0x03, 0x00, + NULL +}; + +static const UnkTextStruct2 sUnknown_80DD71C = +{ + 0x00, 0x00, 0x00, 0x00, + 0x03, + 0x14, 0x04, + 0x06, 0x03, + 0x03, 0x00, + NULL +}; + +static const UnkTextStruct2 sUnknown_80DD734 = +{ + 0x00, 0x00, 0x00, 0x00, + 0x03, + 0x16, 0x04, + 0x06, 0x03, + 0x03, 0x00, + NULL +}; + +static const UnkTextStruct2 sUnknown_80DD74C = +{ + 0x00, 0x00, 0x00, 0x00, + 0x03, + 0x02, 0x11, + 0x1A, 0x02, + 0x02, 0x00, + NULL +}; + +ALIGNED(4) static const u8 sSayFarewellPrompt[] = _( + "You have chosen to say farewell\n" + "to this Pokémon.{EXTRA_MSG}" + "The Pokémon will leave its Friend Area.\n" + "It will no longer be available for\n" + "adventures. Is that OK?"); + +ALIGNED(4) static const u8 sSayFarewellConfirm[] = _( + "If you say farewell to this\n" + "Pokémon{COMMA} it will be gone forever.{EXTRA_MSG}" + "You will never be able to get another one\n" + "like it to join your team.\n" + "Will you release it anyway?"); + +ALIGNED(4) static const u8 sReturnedToToolbox[] = _( + "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1} was\n" + "{CENTER_ALIGN}returned to the Toolbox."); + +ALIGNED(4) static const u8 sSentToStorage[] = _( + "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1} was\n{CENTER_ALIGN}sent to storage."); + +ALIGNED(4) static const u8 sStandBy[] = "Stand By"; +ALIGNED(4) static const u8 sMakeLeader[] = "Make Leader"; +ALIGNED(4) static const u8 sJoinTeam[] = "Join Team"; +ALIGNED(4) static const u8 sSayFarewell[] = "Say Farewell"; +ALIGNED(4) static const u8 sGive[] = "Give"; +ALIGNED(4) static const u8 sTake[] = "Take"; +ALIGNED(4) static const u8 sSummary[] = "Summary"; +ALIGNED(4) static const u8 sMoves[] = "Moves"; +ALIGNED(4) static const u8 sCheckIQ[] = "Check IQ"; + +ALIGNED(4) static const u8 sItemBuffered[] = _("Item: {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1} "); +static const u8 sFill1[] = "pksdir0"; \ No newline at end of file diff --git a/src/data/friend_area_settings.h b/src/data/friend_area_settings.h new file mode 100644 index 000000000..ebae07149 --- /dev/null +++ b/src/data/friend_area_settings.h @@ -0,0 +1,293 @@ +static const FriendAreaSettings sFriendAreaSettings[NUM_FRIEND_AREAS] = // 810AA90 +{ + [NONE] = { + .num_pokemon = 0, + .unlock_condition = UNLOCK_SHOP_STORY, + .price = 0, + }, + [BOUNTIFUL_SEA] = { + .num_pokemon = 9, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 5500, + }, + [TREASURE_SEA] = { + .num_pokemon = 10, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 4500, + }, + [SERENE_SEA] = { + .num_pokemon = 4, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 8000, + }, + [DEEP_SEA_FLOOR] = { + .num_pokemon = 12, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 5500, + }, + [DEEP_SEA_CURRENT] = { + .num_pokemon = 1, + .unlock_condition = UNLOCK_LEGENDARY_REQUEST, + .price = 0, + }, + [SEAFLOOR_CAVE] = { + .num_pokemon = 1, + .unlock_condition = UNLOCK_LEGENDARY_REQUEST, + .price = 0, + }, + [SHALLOW_BEACH] = { + .num_pokemon = 5, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 5000, + }, + [MT_DEEPGREEN] = { + .num_pokemon = 12, + .unlock_condition = UNLOCK_SHOP_STORY, + .price = 130, + }, + [MT_CLEFT] = { + .num_pokemon = 9, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 5000, + }, + [MT_MOONVIEW] = { + .num_pokemon = 6, + .unlock_condition = UNLOCK_WONDER_MAIL, + .price = 0, + }, + [RAINBOW_PEAK] = { + .num_pokemon = 1, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 6500, + }, + [WILD_PLAINS] = { + .num_pokemon = 13, + .unlock_condition = UNLOCK_SHOP_STORY, + .price = 100, + }, + [BEAU_PLAINS] = { + .num_pokemon = 12, + .unlock_condition = UNLOCK_SHOP_STORY, + .price = 600, + }, + [SKY_BLUE_PLAINS] = { + .num_pokemon = 13, + .unlock_condition = UNLOCK_WONDER_MAIL, + .price = 0, + }, + [SAFARI] = { + .num_pokemon = 15, + .unlock_condition = UNLOCK_SHOP_STORY, + .price = 700, + }, + [SCORCHED_PLAINS] = { + .num_pokemon = 10, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 5000, + }, + [SACRED_FIELD] = { + .num_pokemon = 3, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 6500 + }, + [MIST_RISE_FOREST] = { + .num_pokemon = 14, + .unlock_condition = UNLOCK_SHOP_STORY, + .price = 150 + }, + [FLYAWAY_FOREST] = { + .num_pokemon = 12, + .unlock_condition = UNLOCK_SHOP_STORY, + .price = 550 + }, + [OVERGROWN_FOREST] = { + .num_pokemon = 9, + .unlock_condition = UNLOCK_SHOP_STORY, + .price = 600 + }, + [ENERGETIC_FOREST] = { + .num_pokemon = 15, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 5000 + }, + [MUSHROOM_FOREST] = { + .num_pokemon = 7, + .unlock_condition = UNLOCK_SHOP_STORY, + .price = 500 + }, + [HEALING_FOREST] = { + .num_pokemon = 1, + .unlock_condition = UNLOCK_LEGENDARY_REQUEST, + .price = 0 + }, + [TRANSFORM_FOREST] = { + .num_pokemon = 6, + .unlock_condition = UNLOCK_SHOP_STORY, + .price = 500 + }, + [SECRETIVE_FOREST] = { + .num_pokemon = 9, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 6500 + }, + [RUB_A_DUB_RIVER] = { + .num_pokemon = 7, + .unlock_condition = UNLOCK_SHOP_STORY, + .price = 500 + }, + [TADPOLE_POND] = { + .num_pokemon = 9, + .unlock_condition = UNLOCK_SHOP_STORY, + .price = 500 + }, + [TURTLESHELL_POND] = { + .num_pokemon = 10, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 5500 + }, + [MYSTIC_LAKE] = { + .num_pokemon = 4, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 2500 + }, + [WATERFALL_LAKE] = { + .num_pokemon = 4, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 3500 + }, + [PEANUT_SWAMP] = { + .num_pokemon = 7, + .unlock_condition = UNLOCK_SHOP_STORY, + .price = 2500 + }, + [POISON_SWAMP] = { + .num_pokemon = 6, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 8500 + }, + [ECHO_CAVE] = { + .num_pokemon = 11, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 7500 + }, + [CRYPTIC_CAVE] = { + .num_pokemon = 1, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 6500 + }, + [DRAGON_CAVE] = { + .num_pokemon = 3, + .unlock_condition = UNLOCK_WONDER_MAIL, + .price = 0 + }, + [BOULDER_CAVE] = { + .num_pokemon = 4, + .unlock_condition = UNLOCK_WONDER_MAIL, + .price = 0 + }, + [JUNGLE] = { + .num_pokemon = 13, + .unlock_condition = UNLOCK_SHOP_STORY, + .price = 800 + }, + [DECREPIT_LAB] = { + .num_pokemon = 7, + .unlock_condition = UNLOCK_SHOP_STORY, + .price = 1000 + }, + [MT_DISCIPLINE] = { + .num_pokemon = 11, + .unlock_condition = UNLOCK_SHOP_STORY, + .price = 1200 + }, + [THUNDER_MEADOW] = { + .num_pokemon = 11, + .unlock_condition = UNLOCK_SHOP_STORY, + .price = 1000 + }, + [POWER_PLANT] = { + .num_pokemon = 6, + .unlock_condition = UNLOCK_SHOP_STORY, + .price = 600 + }, + [CRATER] = { + .num_pokemon = 7, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 7500 + }, + [FURNACE_DESERT] = { + .num_pokemon = 7, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 8500 + }, + [AGED_CHAMBER_AN] = { + .num_pokemon = 14, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 5500 + }, + [AGED_CHAMBER_O_EXCLAIM] = { + .num_pokemon = 14, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 5500 + }, + [ANCIENT_RELIC] = { + .num_pokemon = 6, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 8000 + }, + [DARKNESS_RIDGE] = { + .num_pokemon = 13, + .unlock_condition = UNLOCK_LEGENDARY_REQUEST, + .price = 0 + }, + [FRIGID_CAVERN] = { + .num_pokemon = 7, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 9000 + }, + [ICE_FLOE_BEACH] = { + .num_pokemon = 5, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 9500 + }, + [VOLCANIC_PIT] = { + .num_pokemon = 1, + .unlock_condition = UNLOCK_LEGENDARY_REQUEST, + .price = 0 + }, + [STRATOS_LOOKOUT] = { + .num_pokemon = 1, + .unlock_condition = UNLOCK_LEGENDARY_REQUEST, + .price = 0 + }, + [RAVAGED_FIELD] = { + .num_pokemon = 5, + .unlock_condition = UNLOCK_SHOP_STORY, + .price = 1000 + }, + [MAGNETIC_QUARRY] = { + .num_pokemon = 3, + .unlock_condition = UNLOCK_SHOP_STORY, + .price = 1000 + }, + [LEGENDARY_ISLAND] = { + .num_pokemon = 3, + .unlock_condition = UNLOCK_LEGENDARY_REQUEST, + .price = 7500 + }, + [SOUTHERN_ISLAND] = { + .num_pokemon = 2, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 9500 + }, + [ENCLOSED_ISLAND] = { + .num_pokemon = 1, + .unlock_condition = UNLOCK_LEGENDARY_REQUEST, + .price = 0 + }, + [FINAL_ISLAND] = { + .num_pokemon = 1, + .unlock_condition = UNLOCK_SHOP_POST_GAME, + .price = 8500 + }, +}; \ No newline at end of file diff --git a/src/data/friend_list_menu.h b/src/data/friend_list_menu.h new file mode 100644 index 000000000..d28adabc7 --- /dev/null +++ b/src/data/friend_list_menu.h @@ -0,0 +1,66 @@ +static const UnkTextStruct2 sUnknown_80DD148 = { + 0x00, 0x00, 0x00, 0x00, + 0x03, + 0x00, 0x00, + 0x00, 0x00, + 0x00, 0x00, + NULL +}; + +static const UnkTextStruct2 sUnknown_80DD160 = { + 0x00, 0x00, 0x00, 0x00, + 0x03, + 0x13, 0x04, + 0x08, 0x03, + 0x03, 0x00, + NULL +}; + +static const UnkTextStruct2 sUnknown_80DD178 = { + 0x00, 0x00, 0x00, 0x00, + 0x03, + 0x14, 0x04, + 0x06, 0x03, + 0x03, 0x00, + NULL +}; + +static const UnkTextStruct2 sUnknown_80DD190 = { + 0x00, 0x00, 0x00, 0x00, + 0x03, + 0x02, 0x11, + 0x1A, 0x02, + 0x02, 0x00, + NULL +}; + +ALIGNED(4) static const u8 sVisitWhoPrompt[] = "Whom would you like to visit?"; + +ALIGNED(4) static const u8 sItemHandedOver[] = _( + "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_1}{END_COLOR_TEXT_1} was\n" + "{CENTER_ALIGN}handed over. "); + +ALIGNED(4) static const u8 sItemExchanged[] = _( + "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_1}{END_COLOR_TEXT_1} was\n" + "{CENTER_ALIGN}handed over.{EXTRA_MSG}" + "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1} was\n" + "{CENTER_ALIGN}returned to the Toolbox."); + +ALIGNED(4) static const u8 sReturnedToToolbox[] = _( + "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1} was\n" + "{CENTER_ALIGN}returned to the Toolbox."); + +ALIGNED(4) static const u8 sLeftOnStandby[] = _( + "{CENTER_ALIGN}{ARG_POKEMON_1} left the team to remain\n" + "{CENTER_ALIGN}on standby in the Friend Area."); + +ALIGNED(4) static const u8 sGive[] = "Give"; +ALIGNED(4) static const u8 sTake[] = "Take"; +ALIGNED(4) static const u8 sStandBy[] = "Stand By"; +ALIGNED(4) static const u8 sVisit[] = "Visit"; +ALIGNED(4) static const u8 sName[] = "Name"; +ALIGNED(4) static const u8 sSummary[] = "Summary"; +ALIGNED(4) static const u8 sMoves[] = "Moves"; +ALIGNED(4) static const u8 sCheckIQ[] = "Check IQ"; +ALIGNED(4) static const u8 sItemBuffered[] = _("Item: {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1} "); +ALIGNED(4) static const u8 sFill[] = "pksdir0"; \ No newline at end of file diff --git a/src/data/ground_main.h b/src/data/ground_main.h new file mode 100644 index 000000000..65e4fe50c --- /dev/null +++ b/src/data/ground_main.h @@ -0,0 +1,7 @@ +ALIGNED(4) static const u8 sFmtGroundRequest[] = "GroundMain ground request %3d %3d"; +ALIGNED(4) static const u8 sFmtRescueRequest[] = "GroundMain recue request %3d %3d"; +ALIGNED(4) static const u8 sFmtUserRescueRequest[] = "GroundMain user rescue request %3d"; +ALIGNED(4) static const u8 sFmtGameEndRequest[] = "GroundMain game end request %3d"; +ALIGNED(4) static const u8 sFmtGameCancelRequest[] = "GroundMain game cancel request %3d"; +UNUSED static const u8 sFill1[] = "pksdir0"; +UNUSED static const u8 sFill2[] = "pksdir0"; \ No newline at end of file diff --git a/src/data/gulpin_shop.h b/src/data/gulpin_shop.h new file mode 100644 index 000000000..aac130482 --- /dev/null +++ b/src/data/gulpin_shop.h @@ -0,0 +1,43 @@ +ALIGNED(4) static const u8 sFill[] = _("pksdir0"); + +static const UnkTextStruct2 gUnknown_80DC11C = { + 0, 0, 0, 0, + 3, + 0, 0, + 0, 0, + 0, 0, + NULL +}; + +static const UnkTextStruct2 gUnknown_80DC134 = { + 0, 0, 0, 0, + 3, + 22, 4, + 6, 3, + 3, 0, + NULL +}; + +UNUSED static const UnkTextStruct2 gUnknown_80DC14C = { + 0, 0, 0, 0, + 3, + 22, 14, + 6, 3, + 3, 0, + NULL +}; + +ALIGNED(4) static const u8 sWillAMoveBeForgotten[] = _( + "Only four moves may be learned!\n" + "Will a move be forgotten?"); + +ALIGNED(4) static const u8 sForgetMoveAndLinkedOnes[] = _( + "{CENTER_ALIGN}Forget the move {COLOR_1 GREEN}{ARG_POKEMON_1}{END_COLOR_TEXT_1} and\n" + "{CENTER_ALIGN}any moves linked to it{COMMA} and learn the move\n" + "{CENTER_ALIGN}{COLOR_1 CYAN}{ARG_POKEMON_0}{END_COLOR_TEXT_1}?"); + +ALIGNED(4) static const u8 sForgetMoveOnly[] = _( + "{CENTER_ALIGN}Forget the move {COLOR_1 GREEN}{ARG_POKEMON_1}{END_COLOR_TEXT_1}\n" + "{CENTER_ALIGN}and learn {COLOR_1 CYAN}{ARG_POKEMON_0}{END_COLOR_TEXT_1}?"); + +ALIGNED(4) static const u8 sForget[] = _("Forget"); \ No newline at end of file diff --git a/src/data/gulpin_shop_801FB50.h b/src/data/gulpin_shop_801FB50.h new file mode 100644 index 000000000..6ae53cc91 --- /dev/null +++ b/src/data/gulpin_shop_801FB50.h @@ -0,0 +1,65 @@ +ALIGNED(4) static const u8 sFill[] = _("pksdir0"); + +static const UnkTextStruct2 gUnknown_80DC31C = { + 0, 0, 0, 0, + 3, + 0, 0, + 0, 0, + 0, 0, + NULL +}; + +static const UnkTextStruct2 gUnknown_80DC334 = { + 0, 0, 0, 0, + 3, + 19, 4, + 8, 3, + 3, 0, + NULL +}; + +static const UnkTextStruct2 gUnknown_80DC34C = { + 0, 0, 0, 0, + 3, + 22, 4, + 6, 3, + 3, 0, + NULL +}; + +UNUSED static const UnkTextStruct2 gUnknown_80DC364 = { + 0, 0, 0, 0, + 3, + 22, 14, + 6, 3, + 3, 0, + NULL +}; + +static const UnkTextStruct2 gUnknown_80DC37C = { + 0, 0, 0, 0, + 3, + 22, 3, + 6, 3, + 3, 0, + NULL +}; + +ALIGNED(4) static const u8 gUnknown_80DC394[] = _( + "{R_BUTTON}+{DPAD}: Shift moves\n" + "{R_BUTTON}+{A_BUTTON}: Switch link {SELECT_BUTTON} Set"); + +ALIGNED(4) static const u8 gGulpinProceed[] = _("Proceed"); +ALIGNED(4) static const u8 gGulpinInfo[] = _("{COLOR_1 YELLOW}Info{END_COLOR_TEXT_1} "); +ALIGNED(4) static const u8 gUnknown_80DC3D8[] = _("Moves"); +ALIGNED(4) static const u8 gUnknown_80DC3E0[] = _("Summary"); +ALIGNED(4) static const u8 gUnknown_80DC3E8[] = _("Check IQ"); +ALIGNED(4) static const u8 gUnknown_80DC3F4[] = _("Remember"); +ALIGNED(4) static const u8 gGulpinDeselect[] = _("Deselect"); +ALIGNED(4) static const u8 gGulpinSet[] = _("Set"); +ALIGNED(4) static const u8 gGulpinLink[] = _("Link"); +ALIGNED(4) static const u8 gGulpinDelink[] = _("Delink"); +ALIGNED(4) static const u8 gGulpinForget[] = _("Forget"); +ALIGNED(4) static const u8 gUnknown_80DC428[] = _("Setting moves"); +ALIGNED(4) static const u8 gUnknown_80DC438[] = _("Linking moves"); +ALIGNED(4) static const u8 gUnknown_80DC448[] = _("Remembering moves"); \ No newline at end of file diff --git a/src/data/kangaskhan_storage1.h b/src/data/kangaskhan_storage1.h new file mode 100644 index 000000000..41cae7738 --- /dev/null +++ b/src/data/kangaskhan_storage1.h @@ -0,0 +1,39 @@ +ALIGNED(4) static const u8 sFill[] = _("pksdir0"); + +static const UnkTextStruct2 sUnknown_80DB748 = { + 0, 0, 0, 0, + 3, + 0, 0, + 0, 0, + 0, 0, + NULL +}; + +static const UnkTextStruct2 sUnknown_80DB760 = { + 0, 0, 0, 0, + 3, + 20, 4, + 6, 3, + 3, 0, + NULL +}; + +static const UnkTextStruct2 sUnknown_80DB778 = { + 0, 0, 0, 0, + 3, + 20, 9, + 6, 3, + 3, 0, + NULL +}; + +static const UnkTextStruct2 sUnknown_80DB790 = { + 0, 0, 0, 0, + 3, + 20, 14, + 6, 4, + 4, 0, + NULL +}; + +ALIGNED(4) static const u8 sNumber[] = _("Number?"); \ No newline at end of file diff --git a/src/data/kangaskhan_storage2.h b/src/data/kangaskhan_storage2.h new file mode 100644 index 000000000..6a0114c57 --- /dev/null +++ b/src/data/kangaskhan_storage2.h @@ -0,0 +1,48 @@ +ALIGNED(4) static const u8 sFill[] = _("pksdir0"); + +static const UnkTextStruct2 sUnknown_80DB7B8 = { + 0, 0, 0, 0, + 3, + 0, 0, + 0, 0, + 0, 0, + NULL +}; + +static const UnkTextStruct2 sUnknown_80DB7D0 = { + 0, 0, 0, 0, + 3, + 3, 3, + 6, 3, + 3, 0, + NULL +}; + +static const UnkTextStruct2 sUnknown_80DB7E8 = { + 0, 0, 0, 0, + 3, + 20, 4, + 6, 3, + 3, 0, + NULL +}; + +static const UnkTextStruct2 sUnknown_80DB800 = { + 0, 0, 0, 0, + 3, + 20, 9, + 6, 3, + 3, 0, + NULL +}; + +static const UnkTextStruct2 sUnknown_80DB818 = { + 0, 0, 0, 0, + 3, + 20, 14, + 6, 4, + 4, 0, + NULL +}; + +ALIGNED(4) static const u8 sNumber[] = _("Number?"); \ No newline at end of file diff --git a/src/data/kecleon_bros1.h b/src/data/kecleon_bros1.h new file mode 100644 index 000000000..f86fee175 --- /dev/null +++ b/src/data/kecleon_bros1.h @@ -0,0 +1,39 @@ +ALIGNED(4) static const u8 sFill[] = _("pksdir0"); + +static const UnkTextStruct2 sUnknown_80DB840 = { + 0, 0, 0, 0, + 3, + 0, 0, + 0, 0, + 0, 0, + NULL +}; + +static const UnkTextStruct2 sUnknown_80DB858 = { + 0, 0, 0, 0, + 3, + 20, 4, + 6, 3, + 3, 0, + NULL +}; + +static const UnkTextStruct2 sUnknown_80DB870 = { + 0, 0, 0, 0, + 3, + 20, 9, + 6, 3, + 3, 0, + NULL +}; + +static const UnkTextStruct2 sUnknown_80DB888 = { + 0, 0, 0, 0, + 3, + 20, 14, + 6, 3, + 3, 0, + NULL +}; + +ALIGNED(4) static const u8 sSellAll[] = _("Sell All"); \ No newline at end of file diff --git a/src/data/kecleon_bros2.h b/src/data/kecleon_bros2.h new file mode 100644 index 000000000..7dba00499 --- /dev/null +++ b/src/data/kecleon_bros2.h @@ -0,0 +1,22 @@ +ALIGNED(4) static const u8 sFill[] = _("pksdir0"); + +static const UnkTextStruct2 sUnknown_80DB8B4 = { + 0, 0, 0, 0, + 3, + 0, 0, + 0, 0, + 0, 0, + NULL +}; + +static const UnkTextStruct2 sUnknown_80DB8CC = { + 0, 0, 0, 0, + 6, + 2, 2, + 16, 4, + 6, 0, + NULL +}; + +ALIGNED(4) static const u8 sGoods[] = _("Goods"); +ALIGNED(4) static const u8 sFmtRed[] = _("{COLOR_1 RED}%s{END_COLOR_TEXT_1}"); \ No newline at end of file diff --git a/src/data/kecleon_bros3.h b/src/data/kecleon_bros3.h new file mode 100644 index 000000000..a08d462ef --- /dev/null +++ b/src/data/kecleon_bros3.h @@ -0,0 +1,22 @@ +ALIGNED(4) static const u8 sFill[] = _("pksdir0"); + +static const UnkTextStruct2 sUnknown_80DB8FC = { + 0, 0, 0, 0, + 3, + 0, 0, + 0, 0, + 0, 0, + NULL +}; + +static const UnkTextStruct2 sUnknown_80DB914 = { + 0, 0, 0, 0, + 6, + 2, 2, + 16, 4, + 6, 0, + NULL +}; + +ALIGNED(4) static const u8 sGoods[] = _("Goods"); +ALIGNED(4) static const u8 sFmtRed[] = _("{COLOR_1 RED}%s{END_COLOR_TEXT_1}"); \ No newline at end of file diff --git a/src/data/kecleon_bros4.h b/src/data/kecleon_bros4.h new file mode 100644 index 000000000..6d94f94e6 --- /dev/null +++ b/src/data/kecleon_bros4.h @@ -0,0 +1,26 @@ +ALIGNED(4) static const u8 sFill[] = _("pksdir0"); + +static const UnkTextStruct2 sUnknown_80DB944 = { + 0, 0, 0, 0, + 3, + 0, 0, + 0, 0, + 0, 0, + NULL +}; + +static const UnkTextStruct2 sUnknown_80DB95C = { + 0, 0, 0, 0, + 6, + 2, 2, + 16, 17, + 19, 0, + NULL +}; + +ALIGNED(4) static const u8 sTeamToolboxA[] = _("Team Toolbox A"); +ALIGNED(4) static const u8 sTeamToolboxB[] = _("Team Toolbox B"); +ALIGNED(4) static const u8 sFmtMoveItem0[] = _("{COLOR_1 UNK_COLOR_2}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1}"); +ALIGNED(4) static const u8 sFmtRed[] = _("{COLOR_1 RED}%s{END_COLOR_TEXT_1}"); +ALIGNED(4) static const u8 sItems[] = _("Items"); +ALIGNED(4) static const u8 sSlash[] = _("/"); \ No newline at end of file diff --git a/src/data/luminous_cave.h b/src/data/luminous_cave.h new file mode 100644 index 000000000..337a62c3b --- /dev/null +++ b/src/data/luminous_cave.h @@ -0,0 +1,106 @@ +ALIGNED(4) static const u8 sLuminousCaveSeekAwakening[] = _( + "{CENTER_ALIGN}...{WAIT_PRESS}A voice emanates from somewhere...{EXTRA_MSG}" + "{CENTER_ALIGN}...Ye who seek awakening...{EXTRA_MSG}" + "{CENTER_ALIGN}This is Luminous Cave.{WAIT_PRESS}\n" + "{CENTER_ALIGN}Do ye seek a new evolution?"); + +ALIGNED(4) static const u8 sLuminousCaveAskEvolution[] = _( + "{CENTER_ALIGN}Do ye seek evolution?"); + +ALIGNED(4) static const u8 sLuminousCaveEvolutionInfo[] = _( + "{CENTER_ALIGN}There are those among Pokémon\n" + "{CENTER_ALIGN}that can evolve.{EXTRA_MSG}" + "{CENTER_ALIGN}Such Pokémon can evolve at this very\n" + "{CENTER_ALIGN}spot if they satisfy certain conditions.{EXTRA_MSG}" + "{CENTER_ALIGN}Evolution brings about changes\n" + "{CENTER_ALIGN}in appearance and abilities.{EXTRA_MSG}" + "{CENTER_ALIGN}Not only that{COMMA} some Pokémon even change\n" + "{CENTER_ALIGN}type and learn different moves.{EXTRA_MSG}" + "{CENTER_ALIGN}However...{WAIT_PRESS} The requirements for\n" + "{CENTER_ALIGN}evolution differ among Pokémon.{EXTRA_MSG}" + "{CENTER_ALIGN}Some become ready for evolution\n" + "{CENTER_ALIGN}merely by leveling up.{EXTRA_MSG}" + "{CENTER_ALIGN}Still others may need special items\n" + "{CENTER_ALIGN}to attain evolution.{EXTRA_MSG}" + "{CENTER_ALIGN}Ye must also be aware of this:{EXTRA_MSG}" + "{CENTER_ALIGN}Once it has evolved{COMMA} a Pokémon\n" + "{CENTER_ALIGN}can never regain its previous form.{EXTRA_MSG}" + "{CENTER_ALIGN}That is why ye must think carefully\n" + "{CENTER_ALIGN}before committing to evolution."); + +ALIGNED(4) static const u8 sLuminousCaveYeShallReturn[] = _( + "{CENTER_ALIGN}Ye shall return if evolution\n" + "{CENTER_ALIGN}is what ye seek..."); + +ALIGNED(4) static const u8 sLuminousCaveGiveItem[] = _( + "{CENTER_ALIGN}Will ye give an item for evolution?"); + +ALIGNED(4) static const u8 sLuminousCaveGiveAnotherItem[] = _( + "{CENTER_ALIGN}Will ye give yet another item?"); + +ALIGNED(4) static const u8 sLuminousCaveLackWhatIsNeeded[] = _( + "{CENTER_ALIGN}Alas{COMMA} ye seem to lack what is needed\n" + "{CENTER_ALIGN}for evolution."); + +ALIGNED(4) static const u8 sLuminousCaveOnlyOneItem[] = _( + "{CENTER_ALIGN}Ye seem to have but one item."); + +ALIGNED(4) static const u8 sLuminousCaveLetUsBegin[] = _( + "{CENTER_ALIGN}...Ye who seek awakening...\n" + "{CENTER_ALIGN}Let us begin."); + +ALIGNED(4) static const u8 sLuminousCaveChangedAppearance[] = _( + "{CENTER_ALIGN}...{WAIT_PRESS}$n0 is undergoing changes...{EXTRA_MSG}" + "{CENTER_ALIGN}$n0{APOSTROPHE}s appearance changed...{EXTRA_MSG}"); + +ALIGNED(4) static const u8 sLuminousCaveEvolved[] = _( + "{CENTER_ALIGN}It evolved from {COLOR_1 GREEN}{ARG_POKEMON_0}{END_COLOR_TEXT_1}\n" + "{CENTER_ALIGN}to {COLOR_1 YELLOW}{ARG_POKEMON_1}{END_COLOR_TEXT_1}!"); + +ALIGNED(4) static const u8 sLuminousCaveComeAlone[] = _( + "{CENTER_ALIGN}...{EXTRA_MSG}" + "{CENTER_ALIGN}One cannot evolve if one\n" + "{CENTER_ALIGN}is in the company of others.{EXTRA_MSG}" + "{CENTER_ALIGN}Come alone if ye wish to evolve."); + +ALIGNED(4) static const u8 sLuminousCaveLackLevel[] = _( + "{CENTER_ALIGN}...{EXTRA_MSG}" + "{CENTER_ALIGN}Ye cannot evolve yet.{EXTRA_MSG}" + "{CENTER_ALIGN}Ye have not high enough a level."); + +ALIGNED(4) static const u8 sLuminousCaveCantEvolveAnymore[] = _( + "{CENTER_ALIGN}...{EXTRA_MSG}" + "{CENTER_ALIGN}Ye cannot evolve anymore."); + +ALIGNED(4) static const u8 sLuminousCaveLackFriendArea[] = _( + "{CENTER_ALIGN}...{EXTRA_MSG}" + "{CENTER_ALIGN}Ye cannot evolve yet.{EXTRA_MSG}" + "{CENTER_ALIGN}Ye need your Friend Area to evolve."); + +ALIGNED(4) static const u8 sLuminousCaveLackRoom[] = _( + "{CENTER_ALIGN}...{EXTRA_MSG}" + "{CENTER_ALIGN}Ye cannot evolve yet.{EXTRA_MSG}" + "{CENTER_ALIGN}The Friend Area to which ye shall go\n" + "{CENTER_ALIGN}has no room for ye."); + +ALIGNED(4) static const u8 sLuminousCaveLackIQ[] = _( + "{CENTER_ALIGN}...{EXTRA_MSG}" + "{CENTER_ALIGN}Ye cannot evolve yet.{EXTRA_MSG}" + "{CENTER_ALIGN}Ye seem to lack the IQ to evolve."); + +ALIGNED(4) static const u8 sLuminousCaveLackItem[] = _( + "{CENTER_ALIGN}{CENTER_ALIGN}...{EXTRA_MSG}" + "{CENTER_ALIGN}Ye cannot evolve yet.{EXTRA_MSG}" + "{CENTER_ALIGN}Ye seem to lack an item to evolve."); + +ALIGNED(4) static const u8 sLuminousCaveCantEvolveYet[] = _( + "{CENTER_ALIGN}{CENTER_ALIGN}...{EXTRA_MSG}" + "{CENTER_ALIGN}Ye cannot evolve yet. "); + +ALIGNED(4) static const u8 sLuminousCaveGiveName[] = _( + "{CENTER_ALIGN}Ye must give a name to\n" + "{CENTER_ALIGN}the evolved Pokémon. "); + +ALIGNED(4) static const u8 sFill1[] = "pksdir0"; +// TODO: This may be for the file after, which has no data? +ALIGNED(4) static const u8 sFill2[] = "pksdir0"; \ No newline at end of file diff --git a/src/data/makuhita_dojo1.h b/src/data/makuhita_dojo1.h new file mode 100644 index 000000000..d86590380 --- /dev/null +++ b/src/data/makuhita_dojo1.h @@ -0,0 +1,15 @@ +static const UnkTextStruct2 sUnknown_80E0760 = { + 0, 0, 0, 0, + 3, + 0, 0, + 0, 0, + 0, 0, + NULL +}; + +ALIGNED(4) static const u8 sReceivedBonslyDoll[] = _( + "{CENTER_ALIGN}{COLOR_1 YELLOW_5}$n0{END_COLOR_TEXT_1} received the {COLOR_1 GREEN_2}Bonsly Doll{END_COLOR_TEXT_1}!\n" + "{CENTER_ALIGN}It has been placed outside your\n" + "{CENTER_ALIGN}rescue team base."); +ALIGNED(4) static const u8 sGoTrain[] = _("Go Train"); +ALIGNED(4) static const u8 sFill[] = _("pksdir0"); \ No newline at end of file diff --git a/src/data/makuhita_dojo2.h b/src/data/makuhita_dojo2.h new file mode 100644 index 000000000..891530439 --- /dev/null +++ b/src/data/makuhita_dojo2.h @@ -0,0 +1,22 @@ +static const UnkTextStruct2 sUnknown_80E07EC = { + 0, 0, 0, 0, + 3, + 0, 0, + 0, 0, + 0, 0, + NULL +}; + +static const UnkTextStruct2 sUnknown_80E0804 = { + 0, 0, 0, 0, + 6, + 2, 2, + 14, 14, + 14, 0, + NULL +}; + +ALIGNED(4) static const u8 sCourses[] = _("Courses"); +ALIGNED(4) static const u8 sStarBullet[] = _("{STAR_BULLET}"); +ALIGNED(4) static const u8 sFmtColor[] = _("{COLOR_2}%c%s{END_COLOR_TEXT_2}"); +ALIGNED(4) static const u8 sFill[] = _("pksdir0"); \ No newline at end of file diff --git a/src/data/party_list_menu.h b/src/data/party_list_menu.h new file mode 100644 index 000000000..686584a63 --- /dev/null +++ b/src/data/party_list_menu.h @@ -0,0 +1,107 @@ +static const UnkTextStruct2 sUnknown_80DD310 = { + 0x00, 0x00, 0x00, 0x00, + 0x03, + 0x00, 0x00, + 0x00, 0x00, + 0x00, 0x00, + NULL +}; + +static const UnkTextStruct2 sUnknown_80DD328 = { + 0x00, 0x00, 0x00, 0x00, + 0x03, + 0x13, 0x03, + 0x08, 0x03, + 0x03, 0x00, + NULL +}; + +static const UnkTextStruct2 sUnknown_80DD340 = { + 0x00, 0x00, 0x00, 0x00, + 0x03, + 0x14, 0x04, + 0x06, 0x03, + 0x03, 0x00, + NULL +}; + +static const UnkTextStruct2 sUnknown_80DD358 = { + 0x00, 0x00, 0x00, 0x00, + 0x03, + 0x02, 0x11, + 0x1A, 0x02, + 0x02, 0x00, + NULL +}; + +static const UnkTextStruct2 sUnknown_80DD370 = { + 0x00, 0x00, 0x00, 0x00, + 0x03, + 0x02, 0x03, + 0x0F, 0x02, + 0x02, 0x00, + NULL +}; + +ALIGNED(4) static const u8 sUnknown_80DD388[] = _( + "You have chosen to say farewell\n" + "to this Pokémon.{EXTRA_MSG}" + "The Pokémon will leave its Friend Area.\n" + "It will no longer be available for\n" + "adventures. Is that OK?"); + +ALIGNED(4) static const u8 sUnknown_80DD420[] = _( + "If you say farewell to this\n" + "Pokémon{COMMA} it will be gone forever.{EXTRA_MSG}" + "You will never be able to get another one\n" + "like it to join your team.\n" + "Will you release it anyway?"); + +ALIGNED(4) static const u8 sUnknown_80DD4C4[] = _( + "{CENTER_ALIGN}{ARG_POKEMON_1} joined the\n" + "{CENTER_ALIGN}rescue team for adventures!"); + +ALIGNED(4) static const u8 sUnknown_80DD4F4[] = _( + "{CENTER_ALIGN}{ARG_POKEMON_1} left the team to remain\n" + "{CENTER_ALIGN}on standby in the Friend Area."); + +ALIGNED(4) static const u8 sBecameLeader[] = _( + "{CENTER_ALIGN}{ARG_POKEMON_1} became the leader\n" + "{CENTER_ALIGN}of the rescue team."); + +ALIGNED(4) static const u8 sUnknown_80DD564[] = _( + "{CENTER_ALIGN}{ARG_POKEMON_1} left\n" + "{CENTER_ALIGN}the Friend Area.\n" + "{CENTER_ALIGN}Bye-bye{COMMA} {ARG_POKEMON_1}!"); + +ALIGNED(4) static const u8 sUnknown_80DD594[] = _( + "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_1}{END_COLOR_TEXT_1} was\n" + "{CENTER_ALIGN}handed over. "); + +ALIGNED(4) static const u8 sUnknown_80DD5B8[] = _( + "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_1}{END_COLOR_TEXT_1} was\n" + "{CENTER_ALIGN}handed over.{EXTRA_MSG}" + "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1} was\n" + "{CENTER_ALIGN}returned to the Toolbox."); + +ALIGNED(4) static const u8 sUnknown_80DD60C[] = _( + "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1} was\n" + "{CENTER_ALIGN}returned to the Toolbox."); + +ALIGNED(4) static const u8 sUnknown_80DD63C[] = _( + "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1} was\n" + "{CENTER_ALIGN}sent to storage."); + +ALIGNED(4) static const u8 sPartyMenuStandBy[] = "Stand By"; +ALIGNED(4) static const u8 sPartyMenuMakeLeader[] = "Make Leader"; +ALIGNED(4) static const u8 sPartyMenuJoinTeam[] = "Join Team"; +ALIGNED(4) static const u8 sPartyMenuGiveGummi[] = "Give Gummi"; +ALIGNED(4) static const u8 sPartyMenuGive[] = "Give"; +ALIGNED(4) static const u8 sPartyMenuTake[] = "Take"; +ALIGNED(4) static const u8 sPartyMenuSayFarewell[] = "Say Farewell"; +ALIGNED(4) static const u8 sPartyMenuSummary[] = "Summary"; +ALIGNED(4) static const u8 sPartyMenuMoves[] = "Moves"; +ALIGNED(4) static const u8 sPartyMenuCheckIQ[] = "Check IQ"; +ALIGNED(4) static const u8 sPartyMenuItemPlaceholder[] = _("Item: {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1} "); +ALIGNED(4) static const u8 sUnknown_80DD6E0[] = "%s"; +ALIGNED(4) static const u8 sFill[] = "pksdir0"; \ No newline at end of file diff --git a/src/data/pelipper_help_guide_dialogue.h b/src/data/pelipper_help_guide_dialogue.h deleted file mode 100644 index 8cb43d009..000000000 --- a/src/data/pelipper_help_guide_dialogue.h +++ /dev/null @@ -1,187 +0,0 @@ -ALIGNED(4) const char gWhatdYouWantToKnow[] = - _(" So{COMMA} what{APOSTROPHE}d you want to\n" - "know?"); - -ALIGNED(4) const char gGettingHelpExplanation[] = - _(" If you need to call for\n" - "help{COMMA} first send your friend\n" - "an {COLOR_1 LIGHT_BLUE}SOS Mail{END_COLOR_TEXT_1}.{EXTRA_MSG}" - " Once you send that mail{COMMA}\n" - "wait until your friend sends you back\n" - "an {COLOR_1 LIGHT_BLUE}A-OK Mail{END_COLOR_TEXT_1}.{EXTRA_MSG}" - " When you get that\n" - "{COLOR_1 LIGHT_BLUE}A-OK Mail{END_COLOR_TEXT_1} back{COMMA} your team\n" - "can continue from where it went down.{EXTRA_MSG}" - " Make sure you send your\n" - "friend a {COLOR_1 LIGHT_BLUE}Thank-You Mail{END_COLOR_TEXT_1}.\n" - "That{APOSTROPHE}s if you get revived{COMMA} of course."); - -ALIGNED(4) const char gSendSOSMailExplanation[] = - _(" If your team gets defeated\n" - "in a dungeon{COMMA} you can send an {COLOR_1 LIGHT_BLUE}SOS Mail{END_COLOR_TEXT_1}\n" - "to a friend willing to help.{EXTRA_MSG}" - " But I have to warn you.\n" - "You can{APOSTROPHE}t get anyone to rescue you\n" - "in certain places.{EXTRA_MSG}" - " If you need to send\n" - "an {COLOR_1 LIGHT_BLUE}SOS Mail{END_COLOR_TEXT_1}{COMMA} you send it from the\n" - "{COLOR_1 LIGHT_BLUE}main menu{END_COLOR_TEXT_1}."); - -ALIGNED(4) const char gReceiveAOKMailExplanation[] = - _(" If your friend manages to\n" - "rescue your team{COMMA} you need to receive\n" - "an {COLOR_1 LIGHT_BLUE}A-OK Mail{END_COLOR_TEXT_1} from your friend.{EXTRA_MSG}" - " See{COMMA} once you get that\n" - "{COLOR_1 LIGHT_BLUE}A-OK Mail{END_COLOR_TEXT_1}{COMMA} your team can continue from\n" - "where it went down in the dungeon.{EXTRA_MSG}" - " And{COMMA} if you use\n" - "a {COLOR_1 LIGHT_BLUE}Game Link cable{END_COLOR_TEXT_1}{COMMA} your friend can\n" - "even send you a {COLOR_1 LIGHT_BLUE}helper Pokémon{END_COLOR_TEXT_1}.{EXTRA_MSG}" - " There{APOSTROPHE}s just one thing.\n" - "A {COLOR_1 LIGHT_BLUE}helper Pokémon{END_COLOR_TEXT_1} can{APOSTROPHE}t bring\n" - "any item it happens to be holding.{EXTRA_MSG}" - " You can receive that\n" - "team-saving {COLOR_1 LIGHT_BLUE}A-OK Mail{END_COLOR_TEXT_1} on the {COLOR_1 LIGHT_BLUE}main menu{END_COLOR_TEXT_1}{COMMA}\n" - "all right?"); - -ALIGNED(4) const char gSendThankYouMailExplanation[] = - _(" If your team gets rescued{COMMA}\n" - "be sure to send your friend\n" - "a {COLOR_1 LIGHT_BLUE}Thank-You Mail{END_COLOR_TEXT_1}.{EXTRA_MSG}" - " You do that by going to\n" - "the {COLOR_1 LIGHT_BLUE}right counter{END_COLOR_TEXT_1}{COMMA} or\n" - "by selecting it from the {COLOR_1 LIGHT_BLUE}main menu{END_COLOR_TEXT_1}.{EXTRA_MSG}" - " You can attach an item in\n" - "storage to your {COLOR_1 LIGHT_BLUE}Thank-You Mail{END_COLOR_TEXT_1}\n" - "as a {COLOR_1 LIGHT_BLUE}reward item{END_COLOR_TEXT_1}.{EXTRA_MSG}" - " You don{APOSTROPHE}t want to ever\n" - "forget to express your thanks."); - -ALIGNED(4) const char gRescueProceduresExplanation[] = - _(" If you want to go and\n" - "rescue your friend{APOSTROPHE}s KO{APOSTROPHE}d team{COMMA}\n" - "you need to receive an {COLOR_1 LIGHT_BLUE}SOS Mail{END_COLOR_TEXT_1}.{EXTRA_MSG}" - " When you get that mail{COMMA}\n" - "you can rescue your friend at\n" - "the {COLOR_1 LIGHT_BLUE}left counter{END_COLOR_TEXT_1} over there.{EXTRA_MSG}" - " If you do manage to rescue\n" - "the team{COMMA} you send your friend\n" - "an {COLOR_1 LIGHT_BLUE}A-OK Mail{END_COLOR_TEXT_1}.{EXTRA_MSG}" - " After you do that{COMMA} your\n" - "friend can send back to you\n" - "a {COLOR_1 LIGHT_BLUE}Thank-You Mail{END_COLOR_TEXT_1}."); - -ALIGNED(4) const char gReceiveSOSMailExplanation[] = - _(" To go off on a rescue{COMMA}\n" - "you first need to receive your friend{APOSTROPHE}s\n" - "{COLOR_1 LIGHT_BLUE}SOS Mail{END_COLOR_TEXT_1}.{EXTRA_MSG}" - " You do that at\n" - "the {COLOR_1 LIGHT_BLUE}left counter{END_COLOR_TEXT_1} over there{COMMA}\n" - "or by selecting it from the {COLOR_1 LIGHT_BLUE}main menu{END_COLOR_TEXT_1}."); - -ALIGNED(4) const char gSendAOKMailExplanation[] = - _(" If you succeed in rescuing\n" - "that team{COMMA} you send your friend an\n" - "{COLOR_1 LIGHT_BLUE}A-OK Mail{END_COLOR_TEXT_1}.{EXTRA_MSG}" - " You do that by going to\n" - "the {COLOR_1 LIGHT_BLUE}left counter{END_COLOR_TEXT_1}{COMMA}\n" - "or from the {COLOR_1 LIGHT_BLUE}main menu{END_COLOR_TEXT_1}.{EXTRA_MSG}" - " You can send your friend\n" - "a Pokémon as a helper from your Friend\n" - "Areas using a {COLOR_1 LIGHT_BLUE}Game Link cable{END_COLOR_TEXT_1}.{EXTRA_MSG}" - " This Pokémon won{APOSTROPHE}t\n" - "disappear from its Friend Area{COMMA} so\n" - "don{APOSTROPHE}t you worry any."); - -ALIGNED(4) const char gLeaveForRescueExplanation[] = - _(" If you get an {COLOR_1 LIGHT_BLUE}SOS Mail{END_COLOR_TEXT_1}{COMMA}\n" - "you head off on the rescue from\n" - "the {COLOR_1 LIGHT_BLUE}left counter{END_COLOR_TEXT_1}.{EXTRA_MSG}" - " But{COMMA} I have to warn you.\n" - "You can{APOSTROPHE}t go off to rescue in a dungeon\n" - "if you can{APOSTROPHE}t get into it.{EXTRA_MSG}" - " You{APOSTROPHE}ll be able to get\n" - "there when you go farther in your\n" - "adventure{COMMA} so it won{APOSTROPHE}t do to fret."); - -ALIGNED(4) const char gGetThankYouMailExplanation[] = - _(" If you send your friend\n" - "an {COLOR_1 LIGHT_BLUE}A-OK Mail{END_COLOR_TEXT_1}{COMMA} you can look forward\n" - "to getting a {COLOR_1 LIGHT_BLUE}Thank-You Mail{END_COLOR_TEXT_1} back.{EXTRA_MSG}" - " You can receive it at\n" - "the {COLOR_1 LIGHT_BLUE}right counter{END_COLOR_TEXT_1}\n" - "or on the {COLOR_1 LIGHT_BLUE}main menu{END_COLOR_TEXT_1}.{EXTRA_MSG}" - " But you need to {COLOR_1 RED}be careful{END_COLOR_TEXT_1}.\n" - "You {COLOR_1 RED}must not delete the A-OK Mail{END_COLOR_TEXT_1}\n" - "before you get the {COLOR_1 LIGHT_BLUE}Thank-You Mail{END_COLOR_TEXT_1} back."); - -ALIGNED(4) const char gImYourGuide[] = - _(" I{APOSTROPHE}m your guide to what you\n" - "can expect at the Pelipper Post Office.\n" - "If you have any questions{COMMA} just ask away!"); - -ALIGNED(4) const char gAnythingElse[] = - _(" Did you want to ask about\n" - "anything else?"); - -ALIGNED(4) const char gPostOfficeExplanation[] = - _(" {COLOR_1 LIGHT_BLUE}The Pelipper Post Office{END_COLOR_TEXT_1}\n" - "keeps track of information from\n" - "around the world.{EXTRA_MSG}" - " We inform folks\n" - "about everything from gossip to calls\n" - "for help from fellow Pokémon.{EXTRA_MSG}" - " For the latest news{COMMA} check\n" - "{COLOR_1 LIGHT_BLUE}your Mailbox{END_COLOR_TEXT_1} or the {COLOR_1 LIGHT_BLUE}Bulletin Board{END_COLOR_TEXT_1}\n" - "outside{COMMA} all right?{EXTRA_MSG}" - " Oh{COMMA} that{APOSTROPHE}s not all.\n" - "You can arrange for {COLOR_1 LIGHT_BLUE}Friend Rescue{END_COLOR_TEXT_1}\n" - "missions at that counter there.{EXTRA_MSG}" - " The {COLOR_1 LIGHT_BLUE}left counter{END_COLOR_TEXT_1} is\n" - "for rescues{COMMA} and the {COLOR_1 LIGHT_BLUE}right counter{END_COLOR_TEXT_1}\n" - "is for Thank-You Mail."); - -ALIGNED(4) const char gBulletinBoardExplanation[] = - _(" The {COLOR_1 LIGHT_BLUE}Bulletin Board{END_COLOR_TEXT_1} outside\n" - "here lists rescue requests.{EXTRA_MSG}" - " Take on rescue jobs from\n" - "the Bulletin Board. Be a hero and handle\n" - "the jobs for fellow Pokémon in need!"); - -ALIGNED(4) const char gDeliveryExplanation[] = - _(" If your rescue team\n" - "becomes famous for doing lots of rescues{COMMA}\n" - "expect to get rescue requests directly.{EXTRA_MSG}" - " Our delivery {ARG_POKEMON_0}\n" - "will take those jobs straight to your\n" - "{COLOR_1 LIGHT_BLUE}Mailbox{END_COLOR_TEXT_1}."); - -ALIGNED(4) const char gFriendRescueExplanation[] = - _(" Friend Rescue is what we\n" - "call rescue missions between friends using\n" - "a {COLOR_1 LIGHT_BLUE}Game Link cable{END_COLOR_TEXT_1}{COMMA} {COLOR_1 LIGHT_BLUE}passwords{END_COLOR_TEXT_1}{COMMA} etc.{EXTRA_MSG}" - " For instance{COMMA} you can send\n" - "out for help saying your team wiped out\n" - "in a dungeon at such and such a place.{EXTRA_MSG}" - " Your friend could play\n" - "the hero and come to your team{APOSTROPHE}s rescue.\n" - "Or it can be the other way around{COMMA} too.{EXTRA_MSG}" - " If you use {COLOR_1 LIGHT_BLUE}passwords{END_COLOR_TEXT_1}{COMMA}\n" - "you can do rescues with friends in\n" - "far-away places.{EXTRA_MSG}" - " You can apply for Friend\n" - "Rescue jobs at the {COLOR_1 LIGHT_BLUE}left counter{END_COLOR_TEXT_1} of\n" - "that counter there."); - -ALIGNED(4) const char gDeletingMailExplanation[] = - _(" Deleting mail just means\n" - "getting rid of old mail that you don{APOSTROPHE}t\n" - "need anymore.{EXTRA_MSG}" - " If you do lots of Friend\n" - "Rescues{COMMA} you{APOSTROPHE}ll find {COLOR_1 LIGHT_BLUE}SOS Mail{END_COLOR_TEXT_1} and\n" - "{COLOR_1 LIGHT_BLUE}A-OK Mail{END_COLOR_TEXT_1} piling up.{EXTRA_MSG}" - " Once you get {COLOR_1 LIGHT_BLUE}30 pieces{END_COLOR_TEXT_1}{COMMA}\n" - "you won{APOSTROPHE}t be able to receive more mail.\n" - "That{APOSTROPHE}s why you{APOSTROPHE}ll need to delete old mail.{EXTRA_MSG}" - " You can look through old\n" - "mail at the {COLOR_1 LIGHT_BLUE}left counter{END_COLOR_TEXT_1} over there."); diff --git a/src/data/post_office_guide1.h b/src/data/post_office_guide1.h new file mode 100644 index 000000000..0db013b7f --- /dev/null +++ b/src/data/post_office_guide1.h @@ -0,0 +1,277 @@ +enum PostOfficeMenuActions +{ + POST_OFFICE, + BULLETIN_BOARD, + DELIVERY, + FRIEND_RESCUE, + CANCEL, + EXIT, + FRIEND_RESCUE_INFO, + GO_RESCUE, + GET_HELP_MENU, + DELETING_MAIL, + RESCUE_PROCEDURES, + RECEIVE_SOS_MAIL, + LEAVE_FOR_RESCUE, + SEND_AOK_MAIL, + GET_THANK_YOU_MAIL, + GETTING_HELP, + SEND_SOS_MAIL, + RECEIVE_AOK_MAIL, + SEND_THANK_YOU_MAIL +}; + +static const u8 sPostOffice[]; +static const u8 sBulletinBoard[]; +static const u8 sDelivery[]; +static const u8 sFriendRescue[]; +static const u8 sCancel[]; + +static const MenuItem sPostOfficeHelpStartMenu[] = +{ + {sPostOffice, POST_OFFICE}, + {sBulletinBoard, BULLETIN_BOARD}, + {sDelivery, DELIVERY}, + {sFriendRescue, FRIEND_RESCUE}, + {sCancel, CANCEL}, + {NULL, EXIT} +}; + +ALIGNED(4) static const u8 sCancel[] = _("Cancel"); +ALIGNED(4) static const u8 sFriendRescue[] = _("{COLOR_1 YELLOW}Friend Rescue{END_COLOR_TEXT_1} "); +ALIGNED(4) static const u8 sDelivery[] = _("Delivery"); +ALIGNED(4) static const u8 sBulletinBoard[] = _("Bulletin Board"); +ALIGNED(4) static const u8 sPostOffice[] = _("Post Office"); + +static const u8 sFriendRescueInfo[]; +static const u8 sGoRescue[]; +static const u8 sGetHelp[]; +static const u8 sDeletingMailInfo[]; +static const u8 sExit[]; + +static const MenuItem gPostOfficeHelpFriendRescueMenu[] = +{ + {sFriendRescueInfo, FRIEND_RESCUE_INFO}, + {sGoRescue, GO_RESCUE}, + {sGetHelp, GET_HELP_MENU}, + {sDeletingMailInfo, DELETING_MAIL}, + {sExit, EXIT}, + {NULL, EXIT} +}; + +ALIGNED(4) static const u8 sExit[] = _("Exit"); +ALIGNED(4) static const u8 sDeletingMailInfo[] = _("Deleting Mail Info"); +ALIGNED(4) static const u8 sGetHelp[] = _("{COLOR_1 YELLOW}Get help{END_COLOR_TEXT_1} "); +ALIGNED(4) static const u8 sGoRescue[] = _("{COLOR_1 YELLOW}Go rescue{END_COLOR_TEXT_1} "); +ALIGNED(4) static const u8 sFriendRescueInfo[] = _("Friend Rescue Info"); + +static const MenuItem sPostOfficeHelpGoRescueMenu[] = +{ + {"Rescue Procedures", RESCUE_PROCEDURES}, + {"Receive SOS Mail", RECEIVE_SOS_MAIL}, + {"Leave for Rescue", LEAVE_FOR_RESCUE}, + {"Send A-OK Mail", SEND_AOK_MAIL}, + {"Get Thank-You Mail", GET_THANK_YOU_MAIL}, + {sExit, EXIT}, // Typing "Exit" as a literal will automatically point to the previous one also + {NULL, EXIT} +}; + +static const MenuItem sPostOfficeHelpGetHelpMenu[] = +{ + {"Getting Help", GETTING_HELP}, + {"Send SOS Mail", SEND_SOS_MAIL}, + {"Receive A-OK Mail", RECEIVE_AOK_MAIL}, + {"Send Thank-You Mail", SEND_THANK_YOU_MAIL}, + {sExit, EXIT}, // Typing "Exit" as a literal will automatically point to the previous one also + {NULL, EXIT} +}; + +ALIGNED(4) static const u8 sWhatdYouWantToKnow[] = + _(" So{COMMA} what{APOSTROPHE}d you want to\n" + "know?"); + +ALIGNED(4) static const u8 sGettingHelpExplanation[] = + _(" If you need to call for\n" + "help{COMMA} first send your friend\n" + "an {COLOR_1 LIGHT_BLUE}SOS Mail{END_COLOR_TEXT_1}.{EXTRA_MSG}" + " Once you send that mail{COMMA}\n" + "wait until your friend sends you back\n" + "an {COLOR_1 LIGHT_BLUE}A-OK Mail{END_COLOR_TEXT_1}.{EXTRA_MSG}" + " When you get that\n" + "{COLOR_1 LIGHT_BLUE}A-OK Mail{END_COLOR_TEXT_1} back{COMMA} your team\n" + "can continue from where it went down.{EXTRA_MSG}" + " Make sure you send your\n" + "friend a {COLOR_1 LIGHT_BLUE}Thank-You Mail{END_COLOR_TEXT_1}.\n" + "That{APOSTROPHE}s if you get revived{COMMA} of course."); + +ALIGNED(4) static const u8 sSendSOSMailExplanation[] = + _(" If your team gets defeated\n" + "in a dungeon{COMMA} you can send an {COLOR_1 LIGHT_BLUE}SOS Mail{END_COLOR_TEXT_1}\n" + "to a friend willing to help.{EXTRA_MSG}" + " But I have to warn you.\n" + "You can{APOSTROPHE}t get anyone to rescue you\n" + "in certain places.{EXTRA_MSG}" + " If you need to send\n" + "an {COLOR_1 LIGHT_BLUE}SOS Mail{END_COLOR_TEXT_1}{COMMA} you send it from the\n" + "{COLOR_1 LIGHT_BLUE}main menu{END_COLOR_TEXT_1}."); + +ALIGNED(4) static const u8 sReceiveAOKMailExplanation[] = + _(" If your friend manages to\n" + "rescue your team{COMMA} you need to receive\n" + "an {COLOR_1 LIGHT_BLUE}A-OK Mail{END_COLOR_TEXT_1} from your friend.{EXTRA_MSG}" + " See{COMMA} once you get that\n" + "{COLOR_1 LIGHT_BLUE}A-OK Mail{END_COLOR_TEXT_1}{COMMA} your team can continue from\n" + "where it went down in the dungeon.{EXTRA_MSG}" + " And{COMMA} if you use\n" + "a {COLOR_1 LIGHT_BLUE}Game Link cable{END_COLOR_TEXT_1}{COMMA} your friend can\n" + "even send you a {COLOR_1 LIGHT_BLUE}helper Pokémon{END_COLOR_TEXT_1}.{EXTRA_MSG}" + " There{APOSTROPHE}s just one thing.\n" + "A {COLOR_1 LIGHT_BLUE}helper Pokémon{END_COLOR_TEXT_1} can{APOSTROPHE}t bring\n" + "any item it happens to be holding.{EXTRA_MSG}" + " You can receive that\n" + "team-saving {COLOR_1 LIGHT_BLUE}A-OK Mail{END_COLOR_TEXT_1} on the {COLOR_1 LIGHT_BLUE}main menu{END_COLOR_TEXT_1}{COMMA}\n" + "all right?"); + +ALIGNED(4) static const u8 sSendThankYouMailExplanation[] = + _(" If your team gets rescued{COMMA}\n" + "be sure to send your friend\n" + "a {COLOR_1 LIGHT_BLUE}Thank-You Mail{END_COLOR_TEXT_1}.{EXTRA_MSG}" + " You do that by going to\n" + "the {COLOR_1 LIGHT_BLUE}right counter{END_COLOR_TEXT_1}{COMMA} or\n" + "by selecting it from the {COLOR_1 LIGHT_BLUE}main menu{END_COLOR_TEXT_1}.{EXTRA_MSG}" + " You can attach an item in\n" + "storage to your {COLOR_1 LIGHT_BLUE}Thank-You Mail{END_COLOR_TEXT_1}\n" + "as a {COLOR_1 LIGHT_BLUE}reward item{END_COLOR_TEXT_1}.{EXTRA_MSG}" + " You don{APOSTROPHE}t want to ever\n" + "forget to express your thanks."); + +ALIGNED(4) static const u8 sRescueProceduresExplanation[] = + _(" If you want to go and\n" + "rescue your friend{APOSTROPHE}s KO{APOSTROPHE}d team{COMMA}\n" + "you need to receive an {COLOR_1 LIGHT_BLUE}SOS Mail{END_COLOR_TEXT_1}.{EXTRA_MSG}" + " When you get that mail{COMMA}\n" + "you can rescue your friend at\n" + "the {COLOR_1 LIGHT_BLUE}left counter{END_COLOR_TEXT_1} over there.{EXTRA_MSG}" + " If you do manage to rescue\n" + "the team{COMMA} you send your friend\n" + "an {COLOR_1 LIGHT_BLUE}A-OK Mail{END_COLOR_TEXT_1}.{EXTRA_MSG}" + " After you do that{COMMA} your\n" + "friend can send back to you\n" + "a {COLOR_1 LIGHT_BLUE}Thank-You Mail{END_COLOR_TEXT_1}."); + +ALIGNED(4) static const u8 sReceiveSOSMailExplanation[] = + _(" To go off on a rescue{COMMA}\n" + "you first need to receive your friend{APOSTROPHE}s\n" + "{COLOR_1 LIGHT_BLUE}SOS Mail{END_COLOR_TEXT_1}.{EXTRA_MSG}" + " You do that at\n" + "the {COLOR_1 LIGHT_BLUE}left counter{END_COLOR_TEXT_1} over there{COMMA}\n" + "or by selecting it from the {COLOR_1 LIGHT_BLUE}main menu{END_COLOR_TEXT_1}."); + +ALIGNED(4) static const u8 sSendAOKMailExplanation[] = + _(" If you succeed in rescuing\n" + "that team{COMMA} you send your friend an\n" + "{COLOR_1 LIGHT_BLUE}A-OK Mail{END_COLOR_TEXT_1}.{EXTRA_MSG}" + " You do that by going to\n" + "the {COLOR_1 LIGHT_BLUE}left counter{END_COLOR_TEXT_1}{COMMA}\n" + "or from the {COLOR_1 LIGHT_BLUE}main menu{END_COLOR_TEXT_1}.{EXTRA_MSG}" + " You can send your friend\n" + "a Pokémon as a helper from your Friend\n" + "Areas using a {COLOR_1 LIGHT_BLUE}Game Link cable{END_COLOR_TEXT_1}.{EXTRA_MSG}" + " This Pokémon won{APOSTROPHE}t\n" + "disappear from its Friend Area{COMMA} so\n" + "don{APOSTROPHE}t you worry any."); + +ALIGNED(4) static const u8 sLeaveForRescueExplanation[] = + _(" If you get an {COLOR_1 LIGHT_BLUE}SOS Mail{END_COLOR_TEXT_1}{COMMA}\n" + "you head off on the rescue from\n" + "the {COLOR_1 LIGHT_BLUE}left counter{END_COLOR_TEXT_1}.{EXTRA_MSG}" + " But{COMMA} I have to warn you.\n" + "You can{APOSTROPHE}t go off to rescue in a dungeon\n" + "if you can{APOSTROPHE}t get into it.{EXTRA_MSG}" + " You{APOSTROPHE}ll be able to get\n" + "there when you go farther in your\n" + "adventure{COMMA} so it won{APOSTROPHE}t do to fret."); + +ALIGNED(4) static const u8 sGetThankYouMailExplanation[] = + _(" If you send your friend\n" + "an {COLOR_1 LIGHT_BLUE}A-OK Mail{END_COLOR_TEXT_1}{COMMA} you can look forward\n" + "to getting a {COLOR_1 LIGHT_BLUE}Thank-You Mail{END_COLOR_TEXT_1} back.{EXTRA_MSG}" + " You can receive it at\n" + "the {COLOR_1 LIGHT_BLUE}right counter{END_COLOR_TEXT_1}\n" + "or on the {COLOR_1 LIGHT_BLUE}main menu{END_COLOR_TEXT_1}.{EXTRA_MSG}" + " But you need to {COLOR_1 RED}be careful{END_COLOR_TEXT_1}.\n" + "You {COLOR_1 RED}must not delete the A-OK Mail{END_COLOR_TEXT_1}\n" + "before you get the {COLOR_1 LIGHT_BLUE}Thank-You Mail{END_COLOR_TEXT_1} back."); + +ALIGNED(4) static const u8 sImYourGuide[] = + _(" I{APOSTROPHE}m your guide to what you\n" + "can expect at the Pelipper Post Office.\n" + "If you have any questions{COMMA} just ask away!"); + +ALIGNED(4) static const u8 sAnythingElse[] = + _(" Did you want to ask about\n" + "anything else?"); + +ALIGNED(4) static const u8 sPostOfficeExplanation[] = + _(" {COLOR_1 LIGHT_BLUE}The Pelipper Post Office{END_COLOR_TEXT_1}\n" + "keeps track of information from\n" + "around the world.{EXTRA_MSG}" + " We inform folks\n" + "about everything from gossip to calls\n" + "for help from fellow Pokémon.{EXTRA_MSG}" + " For the latest news{COMMA} check\n" + "{COLOR_1 LIGHT_BLUE}your Mailbox{END_COLOR_TEXT_1} or the {COLOR_1 LIGHT_BLUE}Bulletin Board{END_COLOR_TEXT_1}\n" + "outside{COMMA} all right?{EXTRA_MSG}" + " Oh{COMMA} that{APOSTROPHE}s not all.\n" + "You can arrange for {COLOR_1 LIGHT_BLUE}Friend Rescue{END_COLOR_TEXT_1}\n" + "missions at that counter there.{EXTRA_MSG}" + " The {COLOR_1 LIGHT_BLUE}left counter{END_COLOR_TEXT_1} is\n" + "for rescues{COMMA} and the {COLOR_1 LIGHT_BLUE}right counter{END_COLOR_TEXT_1}\n" + "is for Thank-You Mail."); + +ALIGNED(4) static const u8 sBulletinBoardExplanation[] = + _(" The {COLOR_1 LIGHT_BLUE}Bulletin Board{END_COLOR_TEXT_1} outside\n" + "here lists rescue requests.{EXTRA_MSG}" + " Take on rescue jobs from\n" + "the Bulletin Board. Be a hero and handle\n" + "the jobs for fellow Pokémon in need!"); + +ALIGNED(4) static const u8 sDeliveryExplanation[] = + _(" If your rescue team\n" + "becomes famous for doing lots of rescues{COMMA}\n" + "expect to get rescue requests directly.{EXTRA_MSG}" + " Our delivery {ARG_POKEMON_0}\n" + "will take those jobs straight to your\n" + "{COLOR_1 LIGHT_BLUE}Mailbox{END_COLOR_TEXT_1}."); + +ALIGNED(4) static const u8 sFriendRescueExplanation[] = + _(" Friend Rescue is what we\n" + "call rescue missions between friends using\n" + "a {COLOR_1 LIGHT_BLUE}Game Link cable{END_COLOR_TEXT_1}{COMMA} {COLOR_1 LIGHT_BLUE}passwords{END_COLOR_TEXT_1}{COMMA} etc.{EXTRA_MSG}" + " For instance{COMMA} you can send\n" + "out for help saying your team wiped out\n" + "in a dungeon at such and such a place.{EXTRA_MSG}" + " Your friend could play\n" + "the hero and come to your team{APOSTROPHE}s rescue.\n" + "Or it can be the other way around{COMMA} too.{EXTRA_MSG}" + " If you use {COLOR_1 LIGHT_BLUE}passwords{END_COLOR_TEXT_1}{COMMA}\n" + "you can do rescues with friends in\n" + "far-away places.{EXTRA_MSG}" + " You can apply for Friend\n" + "Rescue jobs at the {COLOR_1 LIGHT_BLUE}left counter{END_COLOR_TEXT_1} of\n" + "that counter there."); + +ALIGNED(4) static const u8 sDeletingMailExplanation[] = + _(" Deleting mail just means\n" + "getting rid of old mail that you don{APOSTROPHE}t\n" + "need anymore.{EXTRA_MSG}" + " If you do lots of Friend\n" + "Rescues{COMMA} you{APOSTROPHE}ll find {COLOR_1 LIGHT_BLUE}SOS Mail{END_COLOR_TEXT_1} and\n" + "{COLOR_1 LIGHT_BLUE}A-OK Mail{END_COLOR_TEXT_1} piling up.{EXTRA_MSG}" + " Once you get {COLOR_1 LIGHT_BLUE}30 pieces{END_COLOR_TEXT_1}{COMMA}\n" + "you won{APOSTROPHE}t be able to receive more mail.\n" + "That{APOSTROPHE}s why you{APOSTROPHE}ll need to delete old mail.{EXTRA_MSG}" + " You can look through old\n" + "mail at the {COLOR_1 LIGHT_BLUE}left counter{END_COLOR_TEXT_1} over there."); + +ALIGNED(4) static const u8 sFill[] = _("pksdir0"); \ No newline at end of file diff --git a/src/data/post_office_guide2.h b/src/data/post_office_guide2.h new file mode 100644 index 000000000..18eddb061 --- /dev/null +++ b/src/data/post_office_guide2.h @@ -0,0 +1,31 @@ +static const UnkTextStruct2 sUnknown_80E1EFC = +{ + 0, 0, 0, 0, + 3, + 0, 0, + 0, 0, + 0, 0, + NULL +}; + +static const u8 sUnknown_80E1F14[] = {1, 0, 8, 0}; + +static const UnkTextStruct2 sUnknown_80E1F18 = +{ + 0, 0, 0, 0, + 6, + 2, 2, + 20, 4, + 4, 0, + sUnknown_80E1F14 +}; + +ALIGNED(4) static const u8 sObjectives[] = "Objectives"; +ALIGNED(4) static const u8 sFmt1[] = "%dF"; +ALIGNED(4) static const u8 sFmtRescue[] = _(" Rescue {COLOR_1 YELLOW}%s{END_COLOR_TEXT_1}"); +ALIGNED(4) static const u8 sJustGo[] = "Just go!"; +ALIGNED(4) static const u8 sFmtBring[] = _(" Bring {COLOR_1 GREEN}%s{END_COLOR_TEXT_1}"); +ALIGNED(4) static const u8 sFmtFind[] = _(" Find {COLOR_1 GREEN}%s{END_COLOR_TEXT_1}"); +ALIGNED(4) static const u8 sFmtEscort[] = _(" Escort to {COLOR_1 YELLOW}%s{END_COLOR_TEXT_1}"); +ALIGNED(4) static const u8 sRedQuestionMarks[] = _("{COLOR_1 RED_2}???{END_COLOR_TEXT_1}"); +ALIGNED(4) static const u8 sFill[] = "pksdir0"; \ No newline at end of file diff --git a/src/data/quick_save_read.h b/src/data/quick_save_read.h new file mode 100644 index 000000000..83bf84e6a --- /dev/null +++ b/src/data/quick_save_read.h @@ -0,0 +1,9 @@ +ALIGNED(4) static const u8 sFill[] = _("pksdir0"); + +ALIGNED(4) static const u8 sSaveFailedExplanation[] = _( + "{CENTER_ALIGN}Your data was not properly saved{COMMA}\n" + "{CENTER_ALIGN}so your game cannot be resumed\n" + "{CENTER_ALIGN}from your last spot.{EXTRA_MSG}" + "{CENTER_ALIGN}Your last outing is considered a defeat.\n" + "{CENTER_ALIGN}Before shutting down{COMMA} save in your\n" + "{CENTER_ALIGN}team base{COMMA} or quicksave in a dungeon."); \ No newline at end of file diff --git a/src/data/quick_save_write.h b/src/data/quick_save_write.h new file mode 100644 index 000000000..9e6ce1dd7 --- /dev/null +++ b/src/data/quick_save_write.h @@ -0,0 +1,25 @@ +ALIGNED(4) static const u8 sFill[] = _("pksdir0"); + +ALIGNED(4) static const u8 gUnknown_80D45AC[] = _( + "{CENTER_ALIGN}Quicksaving your adventure...\n" + "{CENTER_ALIGN}Please don{APOSTROPHE}t turn off the power."); + +ALIGNED(4) static const u8 gUnknown_80D45F4[] = _( + "{CENTER_ALIGN}Your adventure has been saved.\n" + "{CENTER_ALIGN}When you are in a dungeon{COMMA} quicksave\n" + "{CENTER_ALIGN}your progress before ending the game."); + +ALIGNED(4) static const u8 gUnknown_80D4668[] = _( + "{CENTER_ALIGN}Your adventure has been saved.\n" + "{CENTER_ALIGN}When you resume play{COMMA} the quicksave\n" + "{CENTER_ALIGN}data will be deleted.{EXTRA_MSG}" + "{CENTER_ALIGN}When you are shutting down the game{COMMA}\n" + "{CENTER_ALIGN}save your progress in your team base{COMMA}\n" + "{CENTER_ALIGN}or quicksave in a dungeon."); + +ALIGNED(4) static const u8 gSaveNotWritten2[] = _( + "{CENTER_ALIGN}The data could not be written.\n" + "{CENTER_ALIGN}Please turn off the power and remove\n" + "{CENTER_ALIGN}and reinsert the DS Card."); + +ALIGNED(4) static const u8 gSaveFailed2[] = _("{CENTER_ALIGN}Save failed."); \ No newline at end of file diff --git a/src/data/save_read.h b/src/data/save_read.h new file mode 100644 index 000000000..ed1f4604a --- /dev/null +++ b/src/data/save_read.h @@ -0,0 +1,5 @@ +ALIGNED(4) static const u8 sFill[] = _("pksdir0"); + +ALIGNED(4) static const u8 sSaveCorrupted[] = _( + "{CENTER_ALIGN}The game data is corrupted.\n" + "{CENTER_ALIGN}Your data will be erased."); \ No newline at end of file diff --git a/src/data/save_write.h b/src/data/save_write.h new file mode 100644 index 000000000..438c3042c --- /dev/null +++ b/src/data/save_write.h @@ -0,0 +1,19 @@ +ALIGNED(4) static const u8 sFill[] = _("pksdir0"); + +ALIGNED(4) static const u8 sSavingAdventure[] = _( + "{CENTER_ALIGN}Saving your adventure...\n" + "{CENTER_ALIGN}Please don{APOSTROPHE}t turn off the power."); + +ALIGNED(4) static const u8 sWriteGamePak[] = _( + "{CENTER_ALIGN}Writing to GBA Game Pak.\n" + "{CENTER_ALIGN}Do not remove the GBA Game Pak.\n" + "{CENTER_ALIGN}Please wait with the power on."); + +ALIGNED(4) static const u8 sSaveCompleted[] = _("{CENTER_ALIGN}Save completed!"); + +ALIGNED(4) static const u8 sSaveNotWritten[] = _( + "{CENTER_ALIGN}The data could not be written.\n" + "{CENTER_ALIGN}Please turn off the power and remove\n" + "{CENTER_ALIGN}and reinsert the DS Card."); + +ALIGNED(4) static const u8 sSaveFailed[] = _("{CENTER_ALIGN}Save failed."); \ No newline at end of file diff --git a/src/debug.c b/src/debug.c index fac6dea8e..62660fc58 100644 --- a/src/debug.c +++ b/src/debug.c @@ -50,7 +50,6 @@ ALIGNED(4) static const char debug_fill4[] = "pksdir0"; ALIGNED(4) static const char debug_fill5[] = "pksdir0"; ALIGNED(4) static const char debug_fill6[] = "pksdir0"; ALIGNED(4) static const char debug_fill7[] = "pksdir0"; -ALIGNED(4) static const char debug_fill8[] = "pksdir0"; void NDS_DebugInit(void) { @@ -72,25 +71,20 @@ void nullsub_26(void) { } -// Unused -void PrintFuncFileLineOrNotEntry(char * buf, struct DebugLocation *debug) +UNUSED static void PrintFuncFileLineOrNotEntry(u8 *buf, DebugLocation *debug) { - if(debug != NULL) - { + if (debug != NULL) sprintf(buf, gFuncFileLineString, debug->func, debug->file, debug->line); - } else - { sprintf(buf, gNotEntryText); - } } -void PrintFuncFileLine(char *buf, struct DebugLocation *loc, const char* prefix) +void PrintFuncFileLine(u8 *buf, DebugLocation *loc, const u8* prefix) { sprintf(buf, gFuncFileLineStringWPrefix, prefix, loc->func, loc->file, loc->line); } -void PrintMessageWithFuncFileLine(u8 *buffer, struct DebugLocation *debug, const char *text, ...) +void PrintMessageWithFuncFileLine(u8 *buffer, DebugLocation *debug, const u8 *text, ...) { va_list vArgv; u32 length; @@ -141,7 +135,7 @@ void nullsub_137(void) } -static void FatalErrorPrintFuncFileLine(const char *prefix, struct DebugLocation *debug) +static void FatalErrorPrintFuncFileLine(const char *prefix, DebugLocation *debug) { char buf[0x100]; if(prefix != NULL){ @@ -163,7 +157,7 @@ static void FatalErrorFormatMessage(const char *text, ...) } -void sub_8011B88(const char *text, ...) +void sub_8011B88(const u8 *text, ...) { char bufPrint[0x100]; va_list vArgv; @@ -199,7 +193,7 @@ void UnusedHang(void) Hang(); } -void Log(u8 num, const char *text, ...) +void Log(u8 num, const u8 *text, ...) { va_list vArgv; va_start(vArgv, text); @@ -235,7 +229,7 @@ static void FatalErrorHang() Hang(); } -void FatalError(struct DebugLocation *debug, const char *text, ...) +void FatalError(DebugLocation *debug, const char *text, ...) { char buf[0x100]; va_list vArgv; diff --git a/src/debug_menu1.c b/src/debug_menu1.c index 47d7a01b3..3014d8b7a 100644 --- a/src/debug_menu1.c +++ b/src/debug_menu1.c @@ -13,7 +13,7 @@ EWRAM_DATA_2 static struct DebugMenu *sDebugMenu = {0}; -static const struct UnkTextStruct2 sUnknown_80E7D40 = +static const UnkTextStruct2 sUnknown_80E7D40 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -23,7 +23,7 @@ static const struct UnkTextStruct2 sUnknown_80E7D40 = NULL }; -static const struct UnkTextStruct2 sUnknown_80E7D58 = +static const UnkTextStruct2 sUnknown_80E7D58 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -33,7 +33,7 @@ static const struct UnkTextStruct2 sUnknown_80E7D58 = NULL }; -static const struct MenuItem sDebugMenuItems[8] = +static const MenuItem sDebugMenuItems[8] = { {"Dungeons", MENU_DEBUG_MENU_DUNGEONS}, {"Field", MENU_DEBUG_MENU_FIELD}, @@ -70,14 +70,14 @@ void CreateDebugMenu(void) sDebugMenu->unk140[i] = sUnknown_80E7D40; ResetUnusedInputStruct(); - sub_800641C(sDebugMenu->unk140, 1, 1); + sub_800641C(sDebugMenu->unk140, TRUE, TRUE); SetDebugMenuItems(); } void DeleteDebugMenu(void) { ResetUnusedInputStruct(); - sub_800641C(NULL, 1, 1); + sub_800641C(NULL, TRUE, TRUE); if (sDebugMenu != NULL) { MemoryFree(sDebugMenu); sDebugMenu = NULL; diff --git a/src/debug_menu2.c b/src/debug_menu2.c index 47d689530..516fae6cd 100644 --- a/src/debug_menu2.c +++ b/src/debug_menu2.c @@ -5,13 +5,12 @@ #include "debug_menu2.h" #include "memory.h" #include "menu_input.h" -#include "team_inventory.h" #include "text1.h" #include "text2.h" EWRAM_DATA_2 static struct unkStruct_203B3F0 *sUnknown_203B3F0 = {0}; -static const struct UnkTextStruct2 sUnknown_80E7E34 = +static const UnkTextStruct2 sUnknown_80E7E34 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -20,7 +19,7 @@ static const struct UnkTextStruct2 sUnknown_80E7E34 = 0x00, 0x00, NULL }; -static const struct UnkTextStruct2 sUnknown_80E7E4C = +static const UnkTextStruct2 sUnknown_80E7E4C = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -29,7 +28,7 @@ static const struct UnkTextStruct2 sUnknown_80E7E4C = 0x03, 0x00, NULL }; -static const struct UnkTextStruct2 sUnknown_80E7E64 = +static const UnkTextStruct2 sUnknown_80E7E64 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -59,7 +58,7 @@ void sub_803A86C(void); u32 sub_803A45C(void) { ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sUnknown_203B3F0 = MemoryAlloc(sizeof(struct unkStruct_203B3F0), 8); sub_803A504(0); return 1; @@ -124,12 +123,12 @@ void sub_803A51C(void) } ResetUnusedInputStruct(); - sub_800641C(sUnknown_203B3F0->unkD8, 1, 1); + sub_800641C(sUnknown_203B3F0->unkD8, TRUE, TRUE); } void sub_803A5A0(void) { - struct Item item; + Item item; switch (sUnknown_203B3F0->state) { case 0: diff --git a/src/debug_menu3.c b/src/debug_menu3.c index 44435c433..c66f3ef8a 100644 --- a/src/debug_menu3.c +++ b/src/debug_menu3.c @@ -10,9 +10,9 @@ #include "text1.h" #include "text2.h" -EWRAM_DATA_2 static struct unkStruct_203B3F4 *sUnknown_203B3F4 = {0}; +EWRAM_DATA_2 static unkStruct_203B3F4 *sUnknown_203B3F4 = {0}; -static const struct UnkTextStruct2 sUnknown_80E7E8C = +static const UnkTextStruct2 sUnknown_80E7E8C = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -21,7 +21,7 @@ static const struct UnkTextStruct2 sUnknown_80E7E8C = 0x00, 0x00, NULL }; -static const struct UnkTextStruct2 sUnknown_80E7EA4 = +static const UnkTextStruct2 sUnknown_80E7EA4 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -51,8 +51,8 @@ bool8 sub_803ABC8(void); u32 sub_803A888(void) { ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); - sUnknown_203B3F4 = MemoryAlloc(sizeof(struct unkStruct_203B3F4), 8); + sub_800641C(NULL, TRUE, TRUE); + sUnknown_203B3F4 = MemoryAlloc(sizeof(unkStruct_203B3F4), 8); sub_803A924(0); return 1; } @@ -107,7 +107,7 @@ void sub_803A93C(void) } ResetUnusedInputStruct(); - sub_800641C(sUnknown_203B3F4->unk9C, 1, 1); + sub_800641C(sUnknown_203B3F4->unk9C, TRUE, TRUE); } void sub_803A9AC(void) @@ -232,7 +232,7 @@ void sub_803ABAC(void) bool8 sub_803ABC8(void) { - struct PokemonStruct *mon; + PokemonStruct1 *mon; s32 i; s32 mask; diff --git a/src/debug_menu4.c b/src/debug_menu4.c index a21d2a90a..3c0d65afb 100644 --- a/src/debug_menu4.c +++ b/src/debug_menu4.c @@ -8,9 +8,9 @@ #include "text1.h" #include "text2.h" -EWRAM_DATA_2 static struct unkStruct_203B3F8 *sUnknown_203B3F8 = {0}; +EWRAM_DATA_2 static unkStruct_203B3F8 *sUnknown_203B3F8 = {0}; -static const struct UnkTextStruct2 sUnknown_80E7ED4 = +static const UnkTextStruct2 sUnknown_80E7ED4 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -19,7 +19,7 @@ static const struct UnkTextStruct2 sUnknown_80E7ED4 = 0x00, 0x00, NULL }; -static const struct UnkTextStruct2 sUnknown_80E7EEC = +static const UnkTextStruct2 sUnknown_80E7EEC = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -28,7 +28,7 @@ static const struct UnkTextStruct2 sUnknown_80E7EEC = 0x03, 0x00, NULL }; -static const struct UnkTextStruct2 sUnknown_80E7F04 = +static const UnkTextStruct2 sUnknown_80E7F04 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -52,16 +52,14 @@ void sub_803AF88(void); void sub_803AFE8(void); void sub_803B034(void); -// Unused -u32 sub_803AC24(void) +UNUSED static bool8 sub_803AC24(void) { - sUnknown_203B3F8 = MemoryAlloc(sizeof(struct unkStruct_203B3F8), 8); + sUnknown_203B3F8 = MemoryAlloc(sizeof(unkStruct_203B3F8), 8); sub_803ACD0(0); - return 1; + return TRUE; } -// Unused -u32 sub_803AC48(void) +UNUSED static u32 sub_803AC48(void) { switch (sUnknown_203B3F8->state) { case 0: @@ -88,8 +86,7 @@ u32 sub_803AC48(void) return 0; } -// Unused -void sub_803ACB4(void) +UNUSED static void sub_803ACB4(void) { if (sUnknown_203B3F8 != NULL) { MemoryFree(sUnknown_203B3F8); @@ -126,7 +123,7 @@ void sub_803ACE8(void) } ResetUnusedInputStruct(); - sub_800641C(sUnknown_203B3F8->unkE0, 1, 1); + sub_800641C(sUnknown_203B3F8->unkE0, TRUE, TRUE); } void sub_803AD88(void) diff --git a/src/decompress.c b/src/decompress.c new file mode 100644 index 000000000..2eda26f8f --- /dev/null +++ b/src/decompress.c @@ -0,0 +1,942 @@ +#include "global.h" +#include "decompress.h" + +#define MAGIC_SIR0 0x30524953 +#define MAGIC_SIRO 0x4F524953 + +EWRAM_DATA u32 *gDecompressBufferPtr = {0}; +EWRAM_DATA u32 *gDecompressBufferStart = {0}; +EWRAM_DATA u32 gDecompressBufferCurrent = {0}; +EWRAM_DATA u32 gDecompressBufferByteInInt = {0}; + +#include "data/decompress.h" + +#ifndef NONMATCHING +UNUSED // Remove "UNUSED" when DecompressATGlobal is done +static void DecompressAT_AppendByte(char); +UNUSED +static void DecompressAT_Finish(void); +UNUSED +static char DecompressAT_GetByte(s32); +UNUSED +static void DecompressAT_Init(u32 *); +#else +static void DecompressAT_AppendByte(char); +static void DecompressAT_Finish(void); +static char DecompressAT_GetByte(s32); +static void DecompressAT_Init(u32 *); +#endif +static u32 DecompressATGlobal(u32 *, s32, const char *); +static void NDS_DecompressRLE(void *); + +u8 *GetSiroPtr(OpenedFile *openedFile) +{ + struct SiroArchive *siro = (struct SiroArchive *)openedFile->data; + + if (siro->magic == MAGIC_SIR0) + NDS_DecompressRLE(openedFile->data); + else if (siro->magic != MAGIC_SIRO) + return openedFile->data; + + openedFile->data = siro->data; + + return openedFile->data; +} + +UNUSED static void *UnusedGetSir0Ptr(struct SiroArchive *siro) +{ + if (siro->magic != MAGIC_SIR0) + return siro; + + NDS_DecompressRLE(siro); + return siro->data; +} + +static void NDS_DecompressRLE(void *unused) +{ +} + +void nullsub_16(void) +{ +} + +UNUSED static void nullsub_175(void) +{ +} + +u32 DecompressATFile(u8 *result, s32 resultLength, OpenedFile *file) +{ + return DecompressAT(result, resultLength, file->data); +} + +u32 DecompressAT(u8 *result, s32 resultLength, const u8 *compressedData) +{ + s32 compressedLength = compressedData[5] + (compressedData[6] << 8); + s32 bytesWritten = 0; + s32 currentByte = 0; + s32 cmdBit = 8; + s32 curIndex; + s32 flags[9]; + s32 idxStart; + + if (compressedData[0] == 'A' + && compressedData[1] == 'T' + && compressedData[2] == '4' + && compressedData[3] == 'P') { + u32 tmp2 = compressedData[0x10] + (compressedData[0x11] << 8); + if (resultLength != 0 && resultLength != tmp2) + return 0; + idxStart = 0x12; + } + else if (compressedData[0] == 'A' + && compressedData[1] == 'T' + && compressedData[2] == '3' + && compressedData[3] == 'P') { + idxStart = 0x10; + } + else + return 0; + + if (compressedData[4] == 'N') { + // uncompressed mode, unused + for (curIndex = 0; curIndex < compressedLength; curIndex++) { + result[curIndex] = compressedData[curIndex + 7]; + } + return curIndex; + } + + flags[0] = compressedData[0x7] + 3; + flags[1] = compressedData[0x8] + 3; + flags[2] = compressedData[0x9] + 3; + flags[3] = compressedData[0xa] + 3; + flags[4] = compressedData[0xb] + 3; + flags[5] = compressedData[0xc] + 3; + flags[6] = compressedData[0xd] + 3; + flags[7] = compressedData[0xe] + 3; + flags[8] = compressedData[0xf] + 3; + + curIndex = idxStart; + if (curIndex < compressedLength) { + + do { + if (resultLength != 0 && bytesWritten >= resultLength) + return 0; + + if (cmdBit == 8) { + currentByte = compressedData[curIndex++]; + cmdBit = 0; + } + if ((currentByte & 0x80) == 0) { + // if bit is unset, process command + u32 command = (compressedData[curIndex] >> 4) + 3; + u32 tmp = (compressedData[curIndex] & 0xf) << 8; + u32 c; + + if (command == flags[0]) command = 0x1f; + if (command == flags[1]) command = 0x1e; + if (command == flags[2]) command = 0x1d; + if (command == flags[3]) command = 0x1c; + if (command == flags[4]) command = 0x1b; + if (command == flags[5]) command = 0x1a; + if (command == flags[6]) command = 0x19; + if (command == flags[7]) command = 0x18; + if (command == flags[8]) command = 0x17; + + switch (command) { + case 0x1f: { // aaaa + c = compressedData[curIndex++] & 0xf; + result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); + result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); + break; + } + case 0x1e: { // abbb + u8 byte = compressedData[curIndex]; + c = 0xF; + c = byte & c; + curIndex++; + result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c + 1) & 0xf)); + result[bytesWritten++] = ((((c + 1) & 0xf) << 4) | ((c + 1) & 0xf)); + break; + } + case 0x1d: { // babb + c = compressedData[curIndex++] & 0xf; + result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c - 1) & 0xf)); + result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); + break; + } + case 0x1c: { // bbab + c = compressedData[curIndex++] & 0xf; + result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); + result[bytesWritten++] = ((((c - 1) & 0xf) << 4) | ((c + 0) & 0xf)); + break; + } + case 0x1b: { // bbba + c = compressedData[curIndex++] & 0xf; + result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); + result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c - 1) & 0xf)); + break; + } + case 0x1a: { // baaa -- the horrible, hard-to-match case + u8 byte = compressedData[curIndex]; + c = 0xF; + c = byte & c; + curIndex++; + result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c - 1) & 0xf)); + result[bytesWritten++] = ((((c - 1) & 0xf) << 4) | ((c - 1) & 0xf)); + break; + } + case 0x19: { // abaa + c = compressedData[curIndex++] & 0xf; + result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c + 1) & 0xf)); + result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); + break; + } + case 0x18: { // aaba + c = compressedData[curIndex++] & 0xf; + result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); + result[bytesWritten++] = ((((c + 1) & 0xf) << 4) | ((c + 0) & 0xf)); + break; + } + case 0x17: { // aaab + c = compressedData[curIndex++] & 0xf; + result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); + result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c + 1) & 0xf)); + break; + } + default: { + tmp += (compressedData[curIndex++, curIndex++]); + tmp += bytesWritten - 0x1000; + for(;command;command--) + { + result[bytesWritten++] = result[tmp]; + tmp++; + } + } + } + } else { + // if bit is set, just copy next byte + result[bytesWritten++] = (compressedData[curIndex]); + curIndex++; + } + cmdBit++; + currentByte <<= 1; + } while (curIndex < compressedLength); + } + + return bytesWritten; +} + +u32 DecompressATGlobalFile(u32 *result, s32 resultLength, OpenedFile *file) +{ + return DecompressATGlobal(result, resultLength, file->data); +} + +#ifndef NONMATCHING +NAKED +#endif +static u32 DecompressATGlobal(u32 *result, s32 resultLength, const char *compressedData) +{ +#ifdef NONMATCHING + s32 compressedLength; + s32 curIndex; + s32 bytesWritten; + s32 cmdBit; + s32 currentByte; + s32 flags1; + s32 flags2; + s32 flags3; + s32 flags4; + s32 flags5; + s32 flags6; + s32 flags7; + s32 flags8; + s32 flags9; + u32 command; + u32 tmp; + u32 tmp2; + u32 c; + + compressedLength = compressedData[5] + (compressedData[6] << 8); + bytesWritten = 0; + currentByte = 0; + cmdBit = 8; + + DecompressAT_Init(result); + + if (compressedData[0] == 'A' + && compressedData[1] == 'T' + && compressedData[2] == '4' + && compressedData[3] == 'P') { + tmp2 = compressedData[0x10] + (compressedData[0x11] << 8); + if (resultLength != 0 && resultLength != tmp2) + return bytesWritten; + curIndex = 0x12; + } else if (compressedData[0] == 'A' + && compressedData[1] == 'T' + && compressedData[2] == '3' + && compressedData[3] == 'P') { + curIndex = 0x10; + } else { + return 0; + } + + if (compressedData[4] == 'N') { + // uncompressed mode, unused + for (bytesWritten = 0; bytesWritten < compressedLength; bytesWritten++) { + DecompressAT_AppendByte(compressedData[bytesWritten + 7]); + } + DecompressAT_Finish(); + return bytesWritten; + } + + flags1 = compressedData[0x7] + 3; + flags2 = compressedData[0x8] + 3; + flags3 = compressedData[0x9] + 3; + flags4 = compressedData[0xa] + 3; + flags5 = compressedData[0xb] + 3; + flags6 = compressedData[0xc] + 3; + flags7 = compressedData[0xd] + 3; + flags8 = compressedData[0xe] + 3; + flags9 = compressedData[0xf] + 3; + + if (curIndex < compressedLength) { + + do { + if (resultLength != 0 && bytesWritten >= resultLength) + return 0; + + if (cmdBit == 8) { + currentByte = compressedData[curIndex++]; + cmdBit = 0; + } + if ((currentByte & 0x80) == 0) { + // if bit is unset, process command + command = (compressedData[curIndex] >> 4) + 3; + tmp2 = (compressedData[curIndex] & 0xf) << 8; + + if (command == flags1) command = 0x1f; + if (command == flags2) command = 0x1e; + if (command == flags3) command = 0x1d; + if (command == flags4) command = 0x1c; + if (command == flags5) command = 0x1b; + if (command == flags6) command = 0x1a; + if (command == flags7) command = 0x19; + if (command == flags8) command = 0x18; + if (command == flags9) command = 0x17; + + switch (command) { + case 0x1f: { // aaaa + c = compressedData[curIndex++] & 0xf; + DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); bytesWritten++; + DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); bytesWritten++; + break; + } + case 0x1e: { // abbb + c = compressedData[curIndex++] & 0xf; + DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c + 1) & 0xf)); bytesWritten++; + DecompressAT_AppendByte((((c + 1) & 0xf) << 4) | ((c + 1) & 0xf)); bytesWritten++; + break; + } + case 0x1d: { // babb + c = compressedData[curIndex++] & 0xf; + DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c - 1) & 0xf)); bytesWritten++; + DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); bytesWritten++; + break; + } + case 0x1c: { // bbab + c = compressedData[curIndex++] & 0xf; + DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); bytesWritten++; + DecompressAT_AppendByte((((c - 1) & 0xf) << 4) | ((c + 0) & 0xf)); bytesWritten++; + break; + } + case 0x1b: { // bbba + c = compressedData[curIndex++] & 0xf; + DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); bytesWritten++; + DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c - 1) & 0xf)); bytesWritten++; + break; + } + case 0x1a: { // baaa -- the horrible, unmatching case + c = compressedData[curIndex++] & 0xf; + DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c - 1) & 0xf)); bytesWritten++; + c -= 1; + DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); bytesWritten++; + break; + } + case 0x19: { // abaa + c = compressedData[curIndex++] & 0xf; + DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c + 1) & 0xf)); bytesWritten++; + DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); bytesWritten++; + break; + } + case 0x18: { // aaba + c = compressedData[curIndex++] & 0xf; + DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); bytesWritten++; + DecompressAT_AppendByte((((c + 1) & 0xf) << 4) | ((c + 0) & 0xf)); bytesWritten++; + break; + } + case 0x17: { // aaab + c = compressedData[curIndex++] & 0xf; + DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); bytesWritten++; + DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c + 1) & 0xf)); bytesWritten++; + break; + } + default: { + tmp = compressedData[curIndex++, curIndex++] + tmp2 - 0x1000 + bytesWritten; + for (; command != 0; tmp++, command--) { + DecompressAT_AppendByte(DecompressAT_GetByte(tmp)); bytesWritten++; + } + } + } + } else { + // if bit is set, just copy next byte + DecompressAT_AppendByte(compressedData[curIndex]); bytesWritten++; + curIndex++; + } + cmdBit++; + currentByte <<= 1; + } while (curIndex < compressedLength); + DecompressAT_Finish(); + } + + return bytesWritten; +#else + asm_unified( + "DecompressATGlobal:\n" + " push {r4-r7,lr}\n" + " mov r7, r10\n" + " mov r6, r9\n" + " mov r5, r8\n" + " push {r5-r7}\n" + " sub sp, 0x34\n" + " str r1, [sp, 0x24]\n" + " mov r10, r2\n" + " ldrb r2, [r2, 0x5]\n" + " mov r3, r10\n" + " ldrb r1, [r3, 0x6]\n" + " lsls r1, 8\n" + " adds r2, r1\n" + " str r2, [sp, 0x28]\n" + " movs r1, 0\n" + " mov r9, r1\n" + " movs r2, 0\n" + " str r2, [sp, 0x2C]\n" + " movs r3, 0x8\n" + " str r3, [sp, 0x30]\n" + " bl DecompressAT_Init\n" + " mov r1, r10\n" + " ldrb r0, [r1]\n" + " cmp r0, 0x41\n" + " bne _0800AE90\n" + " ldrb r0, [r1, 0x1]\n" + " adds r1, r0, 0\n" + " cmp r1, 0x54\n" + " bne _0800AE98\n" + " mov r2, r10\n" + " ldrb r0, [r2, 0x2]\n" + " cmp r0, 0x34\n" + " bne _0800AE98\n" + " ldrb r0, [r2, 0x3]\n" + " cmp r0, 0x50\n" + " bne _0800AE98\n" + " ldrb r1, [r2, 0x10]\n" + " ldrb r0, [r2, 0x11]\n" + " lsls r0, 8\n" + " adds r1, r0\n" + " ldr r3, [sp, 0x24]\n" + " cmp r3, 0\n" + " beq _0800AE94\n" + " cmp r3, r1\n" + " beq _0800AE94\n" + "_0800AE90:\n" + " movs r0, 0\n" + " b _0800B1AA\n" + "_0800AE94:\n" + " movs r1, 0x12\n" + " b _0800AEB2\n" + "_0800AE98:\n" + " mov r2, r10\n" + " ldrb r0, [r2]\n" + " cmp r0, 0x41\n" + " bne _0800AE90\n" + " cmp r1, 0x54\n" + " bne _0800AE90\n" + " ldrb r0, [r2, 0x2]\n" + " cmp r0, 0x33\n" + " bne _0800AE90\n" + " ldrb r0, [r2, 0x3]\n" + " cmp r0, 0x50\n" + " bne _0800AE90\n" + " movs r1, 0x10\n" + "_0800AEB2:\n" + " mov r3, r10\n" + " ldrb r0, [r3, 0x4]\n" + " cmp r0, 0x4E\n" + " bne _0800AEE0\n" + " movs r0, 0\n" + " mov r8, r0\n" + " ldr r1, [sp, 0x28]\n" + " cmp r8, r1\n" + " bge _0800AED8\n" + "_0800AEC4:\n" + " mov r0, r8\n" + " add r0, r10\n" + " ldrb r0, [r0, 0x7]\n" + " bl DecompressAT_AppendByte\n" + " movs r2, 0x1\n" + " add r8, r2\n" + " ldr r3, [sp, 0x28]\n" + " cmp r8, r3\n" + " blt _0800AEC4\n" + "_0800AED8:\n" + " bl DecompressAT_Finish\n" + " mov r0, r8\n" + " b _0800B1AA\n" + "_0800AEE0:\n" + " mov r2, r10\n" + " ldrb r0, [r2, 0x7]\n" + " adds r0, 0x3\n" + " str r0, [sp]\n" + " ldrb r0, [r2, 0x8]\n" + " adds r0, 0x3\n" + " str r0, [sp, 0x4]\n" + " ldrb r0, [r2, 0x9]\n" + " adds r0, 0x3\n" + " str r0, [sp, 0x8]\n" + " ldrb r0, [r2, 0xA]\n" + " adds r0, 0x3\n" + " str r0, [sp, 0xC]\n" + " ldrb r0, [r2, 0xB]\n" + " adds r0, 0x3\n" + " str r0, [sp, 0x10]\n" + " ldrb r0, [r2, 0xC]\n" + " adds r0, 0x3\n" + " str r0, [sp, 0x14]\n" + " ldrb r0, [r2, 0xD]\n" + " adds r0, 0x3\n" + " str r0, [sp, 0x18]\n" + " ldrb r0, [r2, 0xE]\n" + " adds r0, 0x3\n" + " str r0, [sp, 0x1C]\n" + " ldrb r0, [r2, 0xF]\n" + " adds r0, 0x3\n" + " str r0, [sp, 0x20]\n" + " mov r8, r1\n" + " ldr r3, [sp, 0x28]\n" + " cmp r8, r3\n" + " blt _0800AF22\n" + " b _0800B1A4\n" + "_0800AF22:\n" + " ldr r0, [sp, 0x24]\n" + " cmp r0, 0\n" + " beq _0800AF2C\n" + " cmp r9, r0\n" + " bge _0800AE90\n" + "_0800AF2C:\n" + " ldr r1, [sp, 0x30]\n" + " cmp r1, 0x8\n" + " bne _0800AF42\n" + " mov r0, r10\n" + " add r0, r8\n" + " ldrb r0, [r0]\n" + " str r0, [sp, 0x2C]\n" + " movs r2, 0x1\n" + " add r8, r2\n" + " movs r3, 0\n" + " str r3, [sp, 0x30]\n" + "_0800AF42:\n" + " movs r0, 0x80\n" + " ldr r1, [sp, 0x2C]\n" + " ands r0, r1\n" + " cmp r0, 0\n" + " beq _0800AF4E\n" + " b _0800B180\n" + "_0800AF4E:\n" + " mov r2, r10\n" + " add r2, r8\n" + " ldrb r1, [r2]\n" + " lsrs r0, r1, 4\n" + " adds r3, r0, 0x3\n" + " movs r0, 0xF\n" + " ands r0, r1\n" + " lsls r7, r0, 8\n" + " ldr r0, [sp]\n" + " cmp r3, r0\n" + " bne _0800AF66\n" + " movs r3, 0x1F\n" + "_0800AF66:\n" + " ldr r0, [sp, 0x4]\n" + " cmp r3, r0\n" + " bne _0800AF6E\n" + " movs r3, 0x1E\n" + "_0800AF6E:\n" + " ldr r0, [sp, 0x8]\n" + " cmp r3, r0\n" + " bne _0800AF76\n" + " movs r3, 0x1D\n" + "_0800AF76:\n" + " ldr r0, [sp, 0xC]\n" + " cmp r3, r0\n" + " bne _0800AF7E\n" + " movs r3, 0x1C\n" + "_0800AF7E:\n" + " ldr r0, [sp, 0x10]\n" + " cmp r3, r0\n" + " bne _0800AF86\n" + " movs r3, 0x1B\n" + "_0800AF86:\n" + " ldr r0, [sp, 0x14]\n" + " cmp r3, r0\n" + " bne _0800AF8E\n" + " movs r3, 0x1A\n" + "_0800AF8E:\n" + " ldr r0, [sp, 0x18]\n" + " cmp r3, r0\n" + " bne _0800AF96\n" + " movs r3, 0x19\n" + "_0800AF96:\n" + " ldr r0, [sp, 0x1C]\n" + " cmp r3, r0\n" + " bne _0800AF9E\n" + " movs r3, 0x18\n" + "_0800AF9E:\n" + " ldr r0, [sp, 0x20]\n" + " cmp r3, r0\n" + " bne _0800AFA6\n" + " movs r3, 0x17\n" + "_0800AFA6:\n" + " adds r0, r3, 0\n" + " subs r0, 0x17\n" + " cmp r0, 0x8\n" + " bls _0800AFB0\n" + " b _0800B13C\n" + "_0800AFB0:\n" + " lsls r0, 2\n" + " ldr r1, _0800AFBC\n" + " adds r0, r1\n" + " ldr r0, [r0]\n" + " mov pc, r0\n" + " .align 2, 0\n" + "_0800AFBC: .4byte _0800AFC0\n" + " .align 2, 0\n" + "_0800AFC0:\n" + " .4byte _0800B104\n" + " .4byte _0800B0DE\n" + " .4byte _0800B0BA\n" + " .4byte _0800B090\n" + " .4byte _0800B06E\n" + " .4byte _0800B048\n" + " .4byte _0800B024\n" + " .4byte _0800AFFE\n" + " .4byte _0800AFE4\n" + "_0800AFE4:\n" + " ldrb r0, [r2]\n" + " movs r1, 0xF\n" + " movs r2, 0x1\n" + " add r8, r2\n" + " ands r1, r0\n" + " lsls r4, r1, 4\n" + " orrs r4, r1\n" + " adds r0, r4, 0\n" + " bl DecompressAT_AppendByte\n" + " movs r3, 0x1\n" + " add r9, r3\n" + " b _0800B128\n" + "_0800AFFE:\n" + " ldrb r0, [r2]\n" + " movs r6, 0xF\n" + " ands r6, r0\n" + " movs r2, 0x1\n" + " add r8, r2\n" + " movs r1, 0xF\n" + " lsls r0, r6, 4\n" + " adds r4, r6, 0x1\n" + " ands r4, r1\n" + " orrs r0, r4\n" + " bl DecompressAT_AppendByte\n" + " movs r3, 0x1\n" + " add r9, r3\n" + " lsls r0, r4, 4\n" + " orrs r0, r4\n" + " lsls r0, 24\n" + " lsrs r0, 24\n" + " b _0800B12A\n" + "_0800B024:\n" + " ldrb r0, [r2]\n" + " movs r1, 0xF\n" + " movs r6, 0xF\n" + " ands r6, r0\n" + " movs r2, 0x1\n" + " add r8, r2\n" + " adds r5, r6, 0\n" + " ands r5, r1\n" + " lsls r4, r5, 4\n" + " subs r0, r6, 0x1\n" + " ands r0, r1\n" + " orrs r0, r4\n" + " bl DecompressAT_AppendByte\n" + " movs r3, 0x1\n" + " add r9, r3\n" + " orrs r4, r5\n" + " b _0800B128\n" + "_0800B048:\n" + " ldrb r0, [r2]\n" + " movs r5, 0xF\n" + " movs r6, 0xF\n" + " ands r6, r0\n" + " movs r2, 0x1\n" + " add r8, r2\n" + " adds r4, r6, 0\n" + " ands r4, r5\n" + " lsls r0, r4, 4\n" + " orrs r0, r4\n" + " bl DecompressAT_AppendByte\n" + " movs r3, 0x1\n" + " add r9, r3\n" + " subs r0, r6, 0x1\n" + " ands r0, r5\n" + " lsls r0, 4\n" + " orrs r0, r4\n" + " b _0800B12A\n" + "_0800B06E:\n" + " ldrb r0, [r2]\n" + " movs r5, 0xF\n" + " movs r6, 0xF\n" + " ands r6, r0\n" + " movs r2, 0x1\n" + " add r8, r2\n" + " adds r1, r6, 0\n" + " ands r1, r5\n" + " lsls r4, r1, 4\n" + " adds r0, r4, 0\n" + " orrs r0, r1\n" + " bl DecompressAT_AppendByte\n" + " movs r3, 0x1\n" + " add r9, r3\n" + " subs r0, r6, 0x1\n" + " b _0800B124\n" + "_0800B090:\n" + " ldrb r0, [r2]\n" + " movs r6, 0xF\n" + " ands r6, r0\n" + " movs r2, 0x1\n" + " add r8, r2\n" + " movs r1, 0xF\n" + " lsls r0, r6, 4\n" + " subs r4, r6, 0x1\n" + " ands r4, r1\n" + " orrs r0, r4\n" + " lsls r0, 24\n" + " lsrs r0, 24\n" + " bl DecompressAT_AppendByte\n" + " movs r3, 0x1\n" + " add r9, r3\n" + " lsls r0, r4, 4\n" + " orrs r0, r4\n" + " lsls r0, 24\n" + " lsrs r0, 24\n" + " b _0800B12A\n" + "_0800B0BA:\n" + " ldrb r0, [r2]\n" + " movs r1, 0xF\n" + " movs r6, 0xF\n" + " ands r6, r0\n" + " movs r2, 0x1\n" + " add r8, r2\n" + " adds r5, r6, 0\n" + " ands r5, r1\n" + " lsls r4, r5, 4\n" + " adds r0, r6, 0x1\n" + " ands r0, r1\n" + " orrs r0, r4\n" + " bl DecompressAT_AppendByte\n" + " movs r3, 0x1\n" + " add r9, r3\n" + " orrs r4, r5\n" + " b _0800B128\n" + "_0800B0DE:\n" + " ldrb r0, [r2]\n" + " movs r5, 0xF\n" + " movs r6, 0xF\n" + " ands r6, r0\n" + " movs r2, 0x1\n" + " add r8, r2\n" + " adds r4, r6, 0\n" + " ands r4, r5\n" + " lsls r0, r4, 4\n" + " orrs r0, r4\n" + " bl DecompressAT_AppendByte\n" + " movs r3, 0x1\n" + " add r9, r3\n" + " adds r0, r6, 0x1\n" + " ands r0, r5\n" + " lsls r0, 4\n" + " orrs r0, r4\n" + " b _0800B12A\n" + "_0800B104:\n" + " ldrb r0, [r2]\n" + " movs r5, 0xF\n" + " movs r6, 0xF\n" + " ands r6, r0\n" + " movs r2, 0x1\n" + " add r8, r2\n" + " adds r1, r6, 0\n" + " ands r1, r5\n" + " lsls r4, r1, 4\n" + " adds r0, r4, 0\n" + " orrs r0, r1\n" + " bl DecompressAT_AppendByte\n" + " movs r3, 0x1\n" + " add r9, r3\n" + " adds r0, r6, 0x1\n" + "_0800B124:\n" + " ands r0, r5\n" + " orrs r4, r0\n" + "_0800B128:\n" + " adds r0, r4, 0\n" + "_0800B12A:\n" + " bl DecompressAT_AppendByte\n" + " movs r0, 0x1\n" + " add r9, r0\n" + " ldr r5, [sp, 0x30]\n" + " adds r5, 0x1\n" + " ldr r1, [sp, 0x2C]\n" + " lsls r4, r1, 1\n" + " b _0800B198\n" + "_0800B13C:\n" + " movs r2, 0x1\n" + " add r8, r2\n" + " mov r0, r10\n" + " add r0, r8\n" + " ldrb r0, [r0]\n" + " adds r7, r0\n" + " add r8, r2\n" + " ldr r1, _0800B17C\n" + " adds r0, r7, r1\n" + " mov r2, r9\n" + " adds r7, r0, r2\n" + " ldr r5, [sp, 0x30]\n" + " adds r5, 0x1\n" + " ldr r0, [sp, 0x2C]\n" + " lsls r4, r0, 1\n" + " cmp r3, 0\n" + " beq _0800B198\n" + " adds r6, r3, 0\n" + "_0800B160:\n" + " adds r0, r7, 0\n" + " bl DecompressAT_GetByte\n" + " lsls r0, 24\n" + " lsrs r0, 24\n" + " bl DecompressAT_AppendByte\n" + " movs r1, 0x1\n" + " add r9, r1\n" + " adds r7, 0x1\n" + " subs r6, 0x1\n" + " cmp r6, 0\n" + " bne _0800B160\n" + " b _0800B198\n" + " .align 2, 0\n" + "_0800B17C: .4byte 0xfffff000\n" + "_0800B180:\n" + " mov r0, r10\n" + " add r0, r8\n" + " ldrb r0, [r0]\n" + " bl DecompressAT_AppendByte\n" + " movs r2, 0x1\n" + " add r9, r2\n" + " add r8, r2\n" + " ldr r5, [sp, 0x30]\n" + " adds r5, 0x1\n" + " ldr r3, [sp, 0x2C]\n" + " lsls r4, r3, 1\n" + "_0800B198:\n" + " str r5, [sp, 0x30]\n" + " str r4, [sp, 0x2C]\n" + " ldr r0, [sp, 0x28]\n" + " cmp r8, r0\n" + " bge _0800B1A4\n" + " b _0800AF22\n" + "_0800B1A4:\n" + " bl DecompressAT_Finish\n" + " mov r0, r9\n" + "_0800B1AA:\n" + " add sp, 0x34\n" + " pop {r3-r5}\n" + " mov r8, r3\n" + " mov r9, r4\n" + " mov r10, r5\n" + " pop {r4-r7}\n" + " pop {r1}\n" + " bx r1"); +#endif +} + +static void DecompressAT_Init(u32 *buffer) +{ + gDecompressBufferPtr = buffer; + gDecompressBufferStart = buffer; + gDecompressBufferCurrent = 0; + gDecompressBufferByteInInt = 0; +} + +static char DecompressAT_GetByte(s32 index) +{ + u32 data; + s32 offset; + + offset = index < 0 ? index + 3 : index; + data = gDecompressBufferStart[offset >> 2]; + + switch (index & 3) { + case 0: return data; + case 1: return data >> 8; + case 2: return data >> 16; + case 3: return data >> 24; + } + + return data; +} + +static void DecompressAT_AppendByte(char value) +{ + gDecompressBufferCurrent |= value << gByteShiftLookup[gDecompressBufferByteInInt]; + *gDecompressBufferPtr = gDecompressBufferCurrent; + gDecompressBufferByteInInt++; + + if (gDecompressBufferByteInInt == 4) { + gDecompressBufferPtr++; + gDecompressBufferCurrent = 0; + gDecompressBufferByteInInt = 0; + } +} + +static void DecompressAT_Finish(void) +{ + if (gDecompressBufferByteInInt) + *gDecompressBufferPtr = gDecompressBufferCurrent; +} + +UNUSED static bool32 IsATxPCompressed_unused(char *data) +{ + if ((data[0] == 'A' && data[1] == 'T' && data[2] == '4' && data[3] == 'P')) return TRUE; + if ((data[0] == 'A' && data[1] == 'T' && data[2] == '3' && data[3] == 'P')) return TRUE; + return FALSE; +} + +bool8 sub_800B2D4(char *arg0, char *arg1, s32 length) +{ + s32 i; + char a, b; + + for (i = 0; i < length; i++) { + a = arg0[i]; + b = arg1[i]; + // convert to lowercase + if ('A' <= a && a <= 'Z') a += 0x20; + if ('A' <= b && b <= 'Z') b += 0x20; + if (a != b) + return TRUE; + if (a == '\0') + break; + } + return FALSE; +} \ No newline at end of file diff --git a/src/ds_menus.c b/src/ds_menus.c index db9855c44..f41be8597 100644 --- a/src/ds_menus.c +++ b/src/ds_menus.c @@ -29,5 +29,5 @@ u32 UpdateWirelessCommsMenu(void) void CleanWirelessCommsMenu(void) { ResetUnusedInputStruct(); - sub_800641C(NULL, 1, 1); + sub_800641C(NULL, TRUE, TRUE); } diff --git a/src/dungeon.c b/src/dungeon.c index 0f4714eb5..78b837bf8 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -9,11 +9,11 @@ extern const char gUnknown_8108F10[]; extern const char gUnknown_8108F18[]; extern const char gUnknown_8108F2C[]; -extern struct DungeonLocation gUnknown_8107828[]; +extern DungeonLocation gUnknown_8107828[]; extern u8 gDungeonFloorCount[]; extern u8 gUnknown_81077E8[]; -void sub_80901D8(struct DungeonLocation *param_1,struct DungeonLocation *param_2); +void sub_80901D8(DungeonLocation *param_1,DungeonLocation *param_2); const u8 *GetDungeonName1(u8 dungeon) { @@ -80,8 +80,8 @@ s16 GetRandomMovementChance(u8 dungeon) return gDungeons[dungeon].randomMovementChance; } -bool8 sub_809017C(struct DungeonLocation* a1) { - struct DungeonLocation location; +bool8 sub_809017C(DungeonLocation* a1) { + DungeonLocation location; int i; sub_80901D8(&location, a1); for (i = 0; i < 999 && gUnknown_8107828[i].id != 63; ++i) { @@ -93,7 +93,7 @@ bool8 sub_809017C(struct DungeonLocation* a1) { return FALSE; } -void sub_80901D8(struct DungeonLocation *param_1,struct DungeonLocation *param_2) +void sub_80901D8(DungeonLocation *param_1,DungeonLocation *param_2) { if ((u8)(param_2->id - DUNGEON_NORMAL_MAZE_2) < NUM_DUNGEON_MAZE) { param_1->id = DUNGEON_NORMAL_MAZE; @@ -104,12 +104,12 @@ void sub_80901D8(struct DungeonLocation *param_1,struct DungeonLocation *param_2 } } -void PrintYellowDungeonNametoBuffer(u8 *buffer, struct DungeonLocation *dungeonLocation) +void PrintYellowDungeonNametoBuffer(u8 *buffer, DungeonLocation *dungeonLocation) { sprintfStatic(buffer, gUnknown_8108F10, gDungeonNames[dungeonLocation->id].name1); // {COLOR_2 YELLOW_4}%s{END_COLOR_TEXT_2} (normal floor print (no B) } -void PrintDungeonLocationtoBuffer(u8 *buffer, struct DungeonLocation *dungeonLocation) +void PrintDungeonLocationtoBuffer(u8 *buffer, DungeonLocation *dungeonLocation) { if(gDungeons[dungeonLocation->id].stairDirectionUp){ sprintfStatic(buffer, gUnknown_8108F18, gDungeonNames[dungeonLocation->id].name1, dungeonLocation->floor); //_F @@ -120,7 +120,7 @@ void PrintDungeonLocationtoBuffer(u8 *buffer, struct DungeonLocation *dungeonLoc } } -void CopyDungeonName1toBuffer(u8 *buffer, struct DungeonLocation *dungeonLocation) +void CopyDungeonName1toBuffer(u8 *buffer, DungeonLocation *dungeonLocation) { strncpy(buffer, gDungeonNames[dungeonLocation->id].name1, 0x50); } @@ -145,13 +145,13 @@ u8 sub_80902C8(u8 dungeon) return gUnknown_81077E8[dungeon]; } -void SaveDungeonLocation(struct unkStruct_8094924* r0, struct DungeonLocation* r1) +void SaveDungeonLocation(struct unkStruct_8094924* r0, DungeonLocation* r1) { SaveIntegerBits(r0, &r1->id, 0x7); SaveIntegerBits(r0, &r1->floor, 0x7); } -void RestoreDungeonLocation(struct unkStruct_8094924* r0, struct DungeonLocation* r1) +void RestoreDungeonLocation(struct unkStruct_8094924* r0, DungeonLocation* r1) { r1->id = 0; r1->floor = 0; diff --git a/src/dungeon_2_1.c b/src/dungeon_2_1.c index 74807c2ae..2854ba394 100644 --- a/src/dungeon_2_1.c +++ b/src/dungeon_2_1.c @@ -15,8 +15,8 @@ s32 sub_8091E94(s32 a1, s32 a2, s32 a3); // items.c bool8 sub_8090820(u16 moveID) { - struct PokemonStruct *pokeStruct; - struct Move *move; + PokemonStruct1 *pokeStruct; + Move *move; s32 moveIndex; s32 index; s32 one; @@ -72,7 +72,7 @@ void sub_8090888(u8 *param_1, u8 *param_2) *param_1 = 0; } -u32 sub_80908D8(struct DungeonLocation *dungeon) +u32 sub_80908D8(DungeonLocation *dungeon) { if ((dungeon->id < DUNGEON_OUT_ON_RESCUE) && (dungeon->floor < gDungeonFloorCount[dungeon->id])) { return gUnknown_8108084[dungeon->id][dungeon->floor]; @@ -82,7 +82,7 @@ u32 sub_80908D8(struct DungeonLocation *dungeon) } } -u8 sub_8090910(struct DungeonLocation *dungeon, u32 param_2) +u8 sub_8090910(DungeonLocation *dungeon, u32 param_2) { u32 rand1; u32 rand2; diff --git a/src/dungeon_action.c b/src/dungeon_action.c index 4265273df..e121602f3 100644 --- a/src/dungeon_action.c +++ b/src/dungeon_action.c @@ -1,6 +1,5 @@ #include "global.h" #include "dungeon_action.h" - #include "constants/ability.h" #include "constants/dungeon_action.h" #include "dungeon_ai.h" @@ -11,19 +10,19 @@ #include "dungeon_util.h" #include "dungeon_pokemon_attributes.h" #include "pokemon.h" -#include "item.h" +#include "items.h" extern u8 *gUnknown_80F91EC[]; extern u8 *gUnknown_80F7C50[]; extern u8 gUnknown_80F697C[]; extern s16 gSpeedTurns[2][0x19]; -struct ItemText +typedef struct ItemText { u8 *desc; u8 *useText; -}; -extern const struct ItemText gActions[]; +} ItemText; +extern const ItemText gActions[]; extern void sub_8071B48(void); extern void sub_8043ED0(u32); @@ -36,18 +35,18 @@ extern void UseAttack(u32); extern void sub_8071B48(void); extern void TriggerWeatherAbilities(void); -extern void sub_8074094(struct Entity *); -extern void sub_8071DA4(struct Entity *); -extern u8 sub_8072CF4(struct Entity *); -extern void TickStatusHeal(struct Entity *); +extern void sub_8074094(Entity *); +extern void sub_8071DA4(Entity *); +extern u8 sub_8072CF4(Entity *); +extern void TickStatusHeal(Entity *); void sub_8044820(void) { s32 movSpeed; - struct EntityInfo *entityInfo; - struct EntityInfo *entityInfo2; - struct Entity * entity; - struct Entity * entity2; + EntityInfo *entityInfo; + EntityInfo *entityInfo2; + Entity * entity; + Entity * entity2; s32 index; for (index = 0; index < DUNGEON_MAX_WILD_POKEMON; index++) { @@ -103,9 +102,9 @@ void sub_8044820(void) void TrySpawnMonsterAndActivatePlusMinus(void) { - struct EntityInfo * entityInfo; - struct EntityInfo * entityInfo2; - struct Entity *entity; + EntityInfo * entityInfo; + EntityInfo * entityInfo2; + Entity *entity; u32 isNotEnemy; s32 index; @@ -222,7 +221,7 @@ u8 *sub_8044BA8(u16 param_1, u8 id) void sub_8044C10(u8 param_1) { - struct EntityInfo * entityInfo = GetLeaderInfo(); + EntityInfo * entityInfo = GetLeaderInfo(); entityInfo->action.action = ACTION_NOTHING; @@ -237,7 +236,7 @@ void sub_8044C10(u8 param_1) void sub_8044C50(u16 action) { - struct EntityInfo * entityInfo = GetLeaderInfo(); + EntityInfo * entityInfo = GetLeaderInfo(); entityInfo->action.action = action; entityInfo->action.actionUseIndex = 0; @@ -246,21 +245,21 @@ void sub_8044C50(u16 action) entityInfo->action.itemTargetPosition.y = -1; } -void ClearMonsterActionFields(struct ActionContainer *actionPointer) +void ClearMonsterActionFields(ActionContainer *actionPointer) { actionPointer->action = ACTION_NOTHING; actionPointer->actionUseIndex = 0; actionPointer->unkC = 0; } -void SetMonsterActionFields(struct ActionContainer *actionPointer, u16 action) +void SetMonsterActionFields(ActionContainer *actionPointer, u16 action) { actionPointer->action = action; actionPointer->actionUseIndex = 0; actionPointer->unkC = 0; } -void SetActionPassTurnOrWalk(struct ActionContainer *actionPointer, s16 species) +void SetActionPassTurnOrWalk(ActionContainer *actionPointer, s16 species) { if (CanMove(species)) { diff --git a/src/dungeon_ai.c b/src/dungeon_ai.c index 9fc479df3..d09cab10c 100644 --- a/src/dungeon_ai.c +++ b/src/dungeon_ai.c @@ -37,19 +37,19 @@ extern char gAvailablePokemonNames[]; extern char *gPtrCouldntBeUsedMessage; extern char *gPtrItsaMonsterHouseMessage; -extern void SetMessageArgument(char[], struct Entity*, u32); +extern void SetMessageArgument(char[], Entity*, u32); extern u8 sub_8044B28(void); -extern void sub_807AB38(struct Entity *, u32); +extern void sub_807AB38(Entity *, u32); extern void sub_8041888(u32); extern u8 sub_803F428(s16 *); extern void sub_803E708(u32, u32); -u32 sub_8075818(struct Entity *entity) +u32 sub_8075818(Entity *entity) { struct Tile *tile; - struct EntityInfo *entityInfo; - struct Entity *subEntity; - struct Item *item; + EntityInfo *entityInfo; + Entity *subEntity; + Item *item; u8 *trapData; // TODO: turn into struct when more research is done.. u8 r1; @@ -133,7 +133,7 @@ error: return 0; } -void sub_8075900(struct Entity *pokemon, u8 r1) +void sub_8075900(Entity *pokemon, u8 r1) { if(EntityExists(pokemon)) { @@ -159,9 +159,9 @@ void sub_8075900(struct Entity *pokemon, u8 r1) } } -void RunMonsterAI(struct Entity *pokemon, u32 unused) +void RunMonsterAI(Entity *pokemon, u32 unused) { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; if (pokemonInfo->flags & MOVEMENT_FLAG_SWAPPING_PLACES_PETRIFIED_ALLY) { if (pokemonInfo->immobilizeStatus == STATUS_PETRIFIED) @@ -194,7 +194,7 @@ void RunMonsterAI(struct Entity *pokemon, u32 unused) if (gDungeon->decoyActive) { s32 i; - struct Entity *target; + Entity *target; for (i = 0; i < DUNGEON_MAX_POKEMON; i++) { target = gDungeon->allPokemon[i]; diff --git a/src/dungeon_ai_attack.c b/src/dungeon_ai_attack.c index 9a275baa5..a576098d8 100644 --- a/src/dungeon_ai_attack.c +++ b/src/dungeon_ai_attack.c @@ -1,4 +1,5 @@ #include "global.h" +#include "code_806CD90.h" #include "dungeon_ai_attack.h" #include "constants/direction.h" @@ -38,19 +39,19 @@ extern bool8 gCanAttackInDirection[NUM_DIRECTIONS]; extern s32 gNumPotentialTargets; extern s32 gPotentialAttackTargetWeights[NUM_DIRECTIONS]; extern u8 gPotentialAttackTargetDirections[NUM_DIRECTIONS]; -extern struct Entity *gPotentialTargets[NUM_DIRECTIONS]; +extern Entity *gPotentialTargets[NUM_DIRECTIONS]; -extern void sub_8055A00(struct Entity *, u8, u32, u32, u32); -extern void sub_806A9B4(struct Entity *, u8); +extern void sub_8055A00(Entity *, u8, u32, u32, u32); +extern void sub_806A9B4(Entity *, u8); extern bool8 sub_8044B28(void); -extern void sub_8057588(struct Entity *, u32); -extern void sub_806A1B0(struct Entity *); -extern struct Item *sub_8044D90(struct Entity *, s32, u32); -extern bool8 sub_8044D40(struct ActionContainer *, u32); +extern void sub_8057588(Entity *, u32); +extern void sub_806A1B0(Entity *); +extern Item *sub_8044D90(Entity *, s32, u32); +extern bool8 sub_8044D40(ActionContainer *, u32); -void DecideAttack(struct Entity *pokemon) +void DecideAttack(Entity *pokemon) { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; s32 i; s32 chargeStatus = STATUS_CHARGING; struct AIPossibleMove aiPossibleMove[MAX_MON_MOVES + 1]; @@ -102,7 +103,7 @@ void DecideAttack(struct Entity *pokemon) numUsableMoves = 0; for (i = 0; i < MAX_MON_MOVES; i++) { - struct Move *move = &pokemonInfo->moves[i]; + Move *move = &pokemonInfo->moves[i]; if (pokemonInfo->moves[i].moveFlags & MOVE_FLAG_EXISTS) { if (pokemonInfo->moves[i].moveFlags & MOVE_FLAG_ENABLED_FOR_AI) @@ -114,7 +115,7 @@ void DecideAttack(struct Entity *pokemon) } if (total == 0) { - struct Move struggle; + Move struggle; InitPokemonMove(&struggle, MOVE_STRUGGLE); AIConsiderMove(&aiPossibleMove[0], pokemon, &struggle); if (aiPossibleMove[0].canBeUsed) @@ -141,7 +142,7 @@ void DecideAttack(struct Entity *pokemon) // This requires a separate check from the 0-PP check used for unlinked moves. for (i = 0; i < MAX_MON_MOVES; i++) { - struct Move *move = &pokemonInfo->moves[i]; + Move *move = &pokemonInfo->moves[i]; if (!(move->moveFlags & MOVE_FLAG_EXISTS)) { break; @@ -180,7 +181,7 @@ void DecideAttack(struct Entity *pokemon) } for (i = 0; i < MAX_MON_MOVES; i++) { - struct Move *move; + Move *move; aiPossibleMove[i].canBeUsed = FALSE; move = &pokemonInfo->moves[i]; if (move->moveFlags & MOVE_FLAG_EXISTS && @@ -336,11 +337,11 @@ void DecideAttack(struct Entity *pokemon) } } -s32 AIConsiderMove(struct AIPossibleMove *aiPossibleMove, struct Entity *pokemon, struct Move *move) +s32 AIConsiderMove(struct AIPossibleMove *aiPossibleMove, Entity *pokemon, Move *move) { s32 targetingFlags; s32 moveWeight = 1; - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; s32 numPotentialTargets = 0; s32 i; bool8 hasStatusChecker; @@ -353,7 +354,7 @@ s32 AIConsiderMove(struct AIPossibleMove *aiPossibleMove, struct Entity *pokemon targetingFlags = GetMoveTargetAndRangeForPokemon(pokemon, move, TRUE); hasStatusChecker = IQSkillIsEnabled(pokemon, IQ_STATUS_CHECKER); aiPossibleMove->canBeUsed = FALSE; - if ((pokemonInfo->volatileStatus == STATUS_TAUNTED && !MovesIgnoresTaunted(move)) || + if ((pokemonInfo->volatileStatus == STATUS_TAUNTED && !MoveIgnoresTaunted(move)) || (hasStatusChecker && !CanUseOnSelfWithStatusChecker(pokemon, move))) { return 1; @@ -384,7 +385,7 @@ s32 AIConsiderMove(struct AIPossibleMove *aiPossibleMove, struct Entity *pokemon s16 rangeTargetingFlags = rangeTargetingFlags2 = targetingFlags & 0xF0; struct Tile *adjacentTile = GetTile(pokemon->pos.x + gAdjacentTileOffsets[i].x, pokemon->pos.y + gAdjacentTileOffsets[i].y); - struct Entity *adjacentPokemon = adjacentTile->monster; + Entity *adjacentPokemon = adjacentTile->monster; if (adjacentPokemon != NULL && GetEntityType(adjacentPokemon) == ENTITY_MONSTER) { if (rangeTargetingFlags != TARGETING_FLAG_TARGET_FRONTAL_CONE && @@ -405,7 +406,7 @@ s32 AIConsiderMove(struct AIPossibleMove *aiPossibleMove, struct Entity *pokemon s32 i; for (i = 0; i < DUNGEON_MAX_POKEMON; i++) { - struct Entity *target = gDungeon->allPokemon[i]; + Entity *target = gDungeon->allPokemon[i]; if (EntityExists(target) && CanSeeTarget(pokemon, target)) { numPotentialTargets = TryAddTargetToAITargetList(numPotentialTargets, targetingFlags, pokemon, target, move, hasStatusChecker); @@ -420,7 +421,7 @@ s32 AIConsiderMove(struct AIPossibleMove *aiPossibleMove, struct Entity *pokemon pokemon->pos.y + gAdjacentTileOffsets[i].y); if (CanAttackInDirection(pokemon, i)) { - struct Entity *targetPokemon = targetTile->monster; + Entity *targetPokemon = targetTile->monster; if (targetPokemon != NULL && GetEntityType(targetPokemon) == ENTITY_MONSTER) { s32 prevNumPotentialTargets = numPotentialTargets; @@ -450,7 +451,7 @@ s32 AIConsiderMove(struct AIPossibleMove *aiPossibleMove, struct Entity *pokemon } for (i = 0; i < DUNGEON_MAX_POKEMON; i++) { - struct Entity *target = gDungeon->allPokemon[i]; + Entity *target = gDungeon->allPokemon[i]; if (EntityExists(target) && pokemon != target) { s32 direction = GetDirectionTowardsPosition(&pokemon->pos, &target->pos); @@ -474,7 +475,7 @@ s32 AIConsiderMove(struct AIPossibleMove *aiPossibleMove, struct Entity *pokemon s32 i; for (i = 0; i < DUNGEON_MAX_POKEMON; i++) { - struct Entity *target = gDungeon->allPokemon[i]; + Entity *target = gDungeon->allPokemon[i]; if (EntityExists(target)) { numPotentialTargets = TryAddTargetToAITargetList(numPotentialTargets, targetingFlags, pokemon, target, move, hasStatusChecker); @@ -530,7 +531,7 @@ s32 AIConsiderMove(struct AIPossibleMove *aiPossibleMove, struct Entity *pokemon return moveWeight; } -bool8 IsTargetInLineRange(struct Entity *user, struct Entity *target, s32 range) +bool8 IsTargetInLineRange(Entity *user, Entity *target, s32 range) { s32 distanceX = user->pos.x - target->pos.x; s32 distanceY, distance; @@ -594,12 +595,12 @@ bool8 IsTargetInLineRange(struct Entity *user, struct Entity *target, s32 range) return TRUE; } -s32 TryAddTargetToAITargetList(s32 numPotentialTargets, s32 targetingFlags, struct Entity *user, struct Entity *target, struct Move *move, bool32 hasStatusChecker) +s32 TryAddTargetToAITargetList(s32 numPotentialTargets, s32 targetingFlags, Entity *user, Entity *target, Move *move, bool32 hasStatusChecker) { s32 direction; s32 targetingFlags2 = (s16) targetingFlags; bool8 hasStatusChecker2 = hasStatusChecker; - struct EntityInfo *userData = user->info; + EntityInfo *userData = user->info; if ((user->pos.x == target->pos.x && user->pos.y == target->pos.y) || (targetingFlags2 & 0xF0) == TARGETING_FLAG_TARGET_ROOM || (targetingFlags2 & 0xF0) == TARGETING_FLAG_TARGET_FLOOR || @@ -623,9 +624,9 @@ s32 TryAddTargetToAITargetList(s32 numPotentialTargets, s32 targetingFlags, stru return numPotentialTargets; } -bool8 IsAITargetEligible(s32 targetingFlags, struct Entity *user, struct Entity *target, struct Move *move, bool32 hasStatusChecker) +bool8 IsAITargetEligible(s32 targetingFlags, Entity *user, Entity *target, Move *move, bool32 hasStatusChecker) { - struct EntityInfo *targetData; + EntityInfo *targetData; s32 targetingFlags2 = (s16) targetingFlags; bool8 hasStatusChecker2 = hasStatusChecker; bool8 hasTarget = FALSE; @@ -749,17 +750,17 @@ bool8 IsAITargetEligible(s32 targetingFlags, struct Entity *user, struct Entity return hasTarget; } -s32 WeightMove(struct Entity *user, s32 targetingFlags, struct Entity *target, u32 moveType) +s32 WeightMove(Entity *user, s32 targetingFlags, Entity *target, u32 moveType) { #ifndef NONMATCHING - register struct EntityInfo *targetData asm("r4"); + register EntityInfo *targetData asm("r4"); #else - struct EntityInfo *targetData; + EntityInfo *targetData; #endif s32 targetingFlags2 = (s16) targetingFlags; u8 moveType2 = moveType; u8 weight = 1; - struct EntityInfo *targetData2; + EntityInfo *targetData2; targetData2 = targetData = target->info; if (!targetData->isNotTeamMember || (targetingFlags2 & 0xF) != TARGETING_FLAG_TARGET_OTHER) { @@ -787,9 +788,9 @@ s32 WeightMove(struct Entity *user, s32 targetingFlags, struct Entity *target, u return weight; } -bool8 TargetRegularAttack(struct Entity *pokemon, u32 *targetDir, bool8 checkPetrified) +bool8 TargetRegularAttack(Entity *pokemon, u32 *targetDir, bool8 checkPetrified) { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; s32 numPotentialTargets = 0; s32 direction = pokemonInfo->action.direction; s32 faceTurnLimit = pokemonInfo->eyesightStatus == STATUS_BLINKER ? 1 : 8; @@ -800,7 +801,7 @@ bool8 TargetRegularAttack(struct Entity *pokemon, u32 *targetDir, bool8 checkPet bool8 hasStatusChecker = IQSkillIsEnabled(pokemon, IQ_STATUS_CHECKER); for (i = 0; i < faceTurnLimit; i++, direction++) { - struct Entity *target; + Entity *target; direction &= DIRECTION_MASK; target = GetTile(pokemon->pos.x + gAdjacentTileOffsets[direction].x, pokemon->pos.y + gAdjacentTileOffsets[direction].y)->monster; @@ -863,7 +864,7 @@ bool8 TargetRegularAttack(struct Entity *pokemon, u32 *targetDir, bool8 checkPet } -bool8 IsTargetInRange(struct Entity *pokemon, struct Entity *targetPokemon, s32 direction, s32 maxRange) +bool8 IsTargetInRange(Entity *pokemon, Entity *targetPokemon, s32 direction, s32 maxRange) { s32 distanceX = pokemon->pos.x - targetPokemon->pos.x; s32 effectiveMaxRange; @@ -931,9 +932,9 @@ bool8 IsTargetInRange(struct Entity *pokemon, struct Entity *targetPokemon, s32 return FALSE; } -void sub_807CABC(struct Entity *target) +void sub_807CABC(Entity *target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; s32 counter; counter = 0; @@ -959,14 +960,14 @@ void sub_807CABC(struct Entity *target) } #if NONMATCHING // 99.09% https://decomp.me/scratch/rpwXh -void sub_807CB3C(struct Entity *pokemon) +void sub_807CB3C(Entity *pokemon) { bool8 r4; - struct Item *item; - struct Item IVar5; - struct EntityInfo *entityInfo; // r7 - struct ActionContainer act; - struct Move move; + Item *item; + Item IVar5; + EntityInfo *entityInfo; // r7 + ActionContainer act; + Move move; struct AIPossibleMove sp28; bool8 r8; @@ -1058,7 +1059,7 @@ void sub_807CB3C(struct Entity *pokemon) } #else NAKED -void sub_807CB3C(struct Entity *pokemon) +void sub_807CB3C(Entity *pokemon) { asm_unified( "push {r4-r7,lr}\n" diff --git a/src/dungeon_ai_item_weight.c b/src/dungeon_ai_item_weight.c index b023d40f5..86910e1a3 100644 --- a/src/dungeon_ai_item_weight.c +++ b/src/dungeon_ai_item_weight.c @@ -11,15 +11,15 @@ #include "number_util.h" #include "status_checks_1.h" -u32 EvaluateItem(struct Entity *targetPokemon, struct Item *item, u32 itemTargetFlags) +u32 EvaluateItem(Entity *targetPokemon, Item *item, u32 itemTargetFlags) { - struct EntityInfo *pokemonInfo = targetPokemon->info; + EntityInfo *pokemonInfo = targetPokemon->info; s32 itemWeight = 0; bool8 targetOther = itemTargetFlags & 1; u16 targetAlly = (itemTargetFlags >> 1) & 1; s32 i; - struct Move *move; - struct Move *move2; + Move *move; + Move *move2; switch (item->id) { case ITEM_STICK: @@ -443,13 +443,13 @@ u32 EvaluateItem(struct Entity *targetPokemon, struct Item *item, u32 itemTarget return itemWeight; } -bool8 CanTargetAdjacentPokemon(struct Entity *pokemon) +bool8 CanTargetAdjacentPokemon(Entity *pokemon) { s32 direction; for (direction = 0; direction < NUM_DIRECTIONS; direction++) { struct Tile *mapTile = GetTile(pokemon->pos.x + gAdjacentTileOffsets[direction].x, pokemon->pos.y + gAdjacentTileOffsets[direction].y); - struct Entity *adjacentPokemon = mapTile->monster; + Entity *adjacentPokemon = mapTile->monster; if (adjacentPokemon != NULL && GetEntityType(adjacentPokemon) != ENTITY_NOTHING && CanTarget(pokemon, adjacentPokemon, FALSE, TRUE) == TARGET_CAPABILITY_CAN_TARGET) { diff --git a/src/dungeon_ai_items.c b/src/dungeon_ai_items.c index 74d44c091..ed3e84e1a 100644 --- a/src/dungeon_ai_items.c +++ b/src/dungeon_ai_items.c @@ -18,11 +18,11 @@ #include "dungeon_random.h" #include "dungeon_util.h" #include "dungeon_visibility.h" -#include "item.h" +#include "items.h" #include "position.h" #include "position_util.h" #include "status.h" -#include "team_inventory.h" + #define NUM_POTENTIAL_ROCK_TARGETS 20 #define GROUND_ITEM_TOOLBOX_INDEX 0x80 @@ -38,12 +38,12 @@ extern s32 gNumPotentialTargets; extern u32 gPotentialItemTargetWeights[NUM_DIRECTIONS]; extern u32 gPotentialItemTargetDirections[NUM_DIRECTIONS]; extern bool8 gTargetAhead[NUM_DIRECTIONS]; -extern struct TeamInventory *gTeamInventoryRef; +extern TeamInventory *gTeamInventoryRef; -void sub_807360C(struct Entity *pokemon) +void sub_807360C(Entity *pokemon) { s32 index; - struct Entity *entity; + Entity *entity; for(index = 0; index < DUNGEON_MAX_POKEMON; index++) { @@ -59,11 +59,11 @@ void sub_807360C(struct Entity *pokemon) } } -void DecideUseItem(struct Entity *pokemon) +void DecideUseItem(Entity *pokemon) { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; void *null; - struct Item *item; + Item *item; s32 toolboxIndex; u8 selectedToolboxIndex; u32 *potentialTargetWeights; @@ -108,7 +108,7 @@ void DecideUseItem(struct Entity *pokemon) } else if (itemType == CATEGORY_THROWN_ARC) { - struct Position potentialTargetPositions[NUM_POTENTIAL_ROCK_TARGETS]; + Position potentialTargetPositions[NUM_POTENTIAL_ROCK_TARGETS]; FindRockItemTargets(pokemon, item, potentialTargetPositions, TRUE); if (gNumPotentialTargets == 0) { @@ -155,7 +155,7 @@ void DecideUseItem(struct Entity *pokemon) { // This seems unused. toolboxIndex can never be 0. struct Tile *mapTile = GetTile(pokemon->pos.x, pokemon->pos.y); - struct Entity *object = mapTile->object; + Entity *object = mapTile->object; if (object != null) { u32 objectType = GetEntityType(object); @@ -231,7 +231,7 @@ void DecideUseItem(struct Entity *pokemon) u8 itemType = GetItemCategory(item->id); if (itemType == CATEGORY_THROWN_ARC) { - struct Position potentialTargetPositions[NUM_POTENTIAL_ROCK_TARGETS]; + Position potentialTargetPositions[NUM_POTENTIAL_ROCK_TARGETS]; FindRockItemTargets(pokemon, item, potentialTargetPositions, FALSE); if (gNumPotentialTargets != 0) { @@ -269,7 +269,7 @@ void DecideUseItem(struct Entity *pokemon) } } -void FindStraightThrowableTargets(struct Entity *pokemon, s32 thrownAIFlag, struct Item *item, bool8 ignoreRollChance) +void FindStraightThrowableTargets(Entity *pokemon, s32 thrownAIFlag, Item *item, bool8 ignoreRollChance) { s32 i; gNumPotentialTargets = 0; @@ -279,7 +279,7 @@ void FindStraightThrowableTargets(struct Entity *pokemon, s32 thrownAIFlag, stru } for (i = 0; i < DUNGEON_MAX_POKEMON; i++) { - struct Entity *targetPokemon = gDungeon->allPokemon[i]; + Entity *targetPokemon = gDungeon->allPokemon[i]; if (EntityExists(targetPokemon) && pokemon != targetPokemon) { s32 targetingFlags; @@ -310,13 +310,13 @@ void FindStraightThrowableTargets(struct Entity *pokemon, s32 thrownAIFlag, stru } } -void FindRockItemTargets(struct Entity *pokemon, struct Item *item, struct Position potentialTargets[], bool8 ignoreRollChance) +void FindRockItemTargets(Entity *pokemon, Item *item, Position potentialTargets[], bool8 ignoreRollChance) { s32 i; gNumPotentialTargets = 0; for (i = 0; i < DUNGEON_MAX_POKEMON; i++) { - struct Entity *targetPokemon = gDungeon->allPokemon[i]; + Entity *targetPokemon = gDungeon->allPokemon[i]; if (EntityExists(targetPokemon) && pokemon != targetPokemon && CanSeeTarget(pokemon, targetPokemon) && CanTarget(pokemon, targetPokemon, FALSE, TRUE) == TARGET_CAPABILITY_CAN_TARGET) { @@ -338,7 +338,7 @@ void FindRockItemTargets(struct Entity *pokemon, struct Item *item, struct Posit } if (distance <= 10) { - struct Position *newPotentialTarget; + Position *newPotentialTarget; if (!ignoreRollChance) { u32 itemWeight = EvaluateItem(targetPokemon, item, ITEM_TARGET_OTHER); @@ -356,7 +356,7 @@ void FindRockItemTargets(struct Entity *pokemon, struct Item *item, struct Posit } } -void TargetThrownItem(struct Entity *pokemon, struct Entity *targetPokemon, struct Item *item, s32 targetingFlags, bool8 ignoreRollChance) +void TargetThrownItem(Entity *pokemon, Entity *targetPokemon, Item *item, s32 targetingFlags, bool8 ignoreRollChance) { s32 distanceX = pokemon->pos.x - targetPokemon->pos.x; s32 distanceY; diff --git a/src/dungeon_ai_leader.c b/src/dungeon_ai_leader.c index feb07657b..0c38739f5 100644 --- a/src/dungeon_ai_leader.c +++ b/src/dungeon_ai_leader.c @@ -9,7 +9,7 @@ #include "pokemon.h" #include "pokemon_3.h" -bool8 TargetLeader(struct Entity *pokemon) +bool8 TargetLeader(Entity *pokemon) { if (pokemon->info->isNotTeamMember) { @@ -18,11 +18,11 @@ bool8 TargetLeader(struct Entity *pokemon) return TacticsTargetLeader(pokemon->info->tactic); } -struct Entity* GetLeaderIfVisible(struct Entity *pokemon) +Entity* GetLeaderIfVisible(Entity *pokemon) { if (!pokemon->info->isNotTeamMember) { - struct Entity *leader = GetLeader(); + Entity *leader = GetLeader(); if (leader && leader->info->waitingStatus != STATUS_DECOY && CanTarget(pokemon, leader, FALSE, FALSE) == TARGET_CAPABILITY_CANNOT_ATTACK && diff --git a/src/dungeon_ai_movement.c b/src/dungeon_ai_movement.c index 45fdf6689..54caf261c 100644 --- a/src/dungeon_ai_movement.c +++ b/src/dungeon_ai_movement.c @@ -43,9 +43,9 @@ struct CanMoveInDirectionInfo const s32 gFaceDirectionIncrements[] = {0, 1, -1, 2, -2, 3, -3, 4, 0, -1, 1, -2, 2, -3, 3, 4}; -void MoveIfPossible(struct Entity *pokemon, bool8 showRunAwayEffect) +void MoveIfPossible(Entity *pokemon, bool8 showRunAwayEffect) { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; pokemonInfo->aiNotNextToTarget = FALSE; pokemonInfo->aiTargetingEnemy = FALSE; pokemonInfo->aiTurningAround = FALSE; @@ -101,11 +101,11 @@ void MoveIfPossible(struct Entity *pokemon, bool8 showRunAwayEffect) } } -bool8 CanTakeItem(struct Entity *pokemon) +bool8 CanTakeItem(Entity *pokemon) { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; struct Tile *mapTile; - struct Entity *object; + Entity *object; if (!EntityExists(pokemon) || CannotUseItems(pokemon)) { return FALSE; @@ -137,12 +137,12 @@ bool8 CanTakeItem(struct Entity *pokemon) return FALSE; } -bool8 ChooseTargetPosition(struct Entity *pokemon) +bool8 ChooseTargetPosition(Entity *pokemon) { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; if (!TargetLeader(pokemon)) { - struct Entity **possibleTargets; + Entity **possibleTargets; s32 maxPossibleTargets; s32 targetIndex; bool8 canCrossWalls; @@ -168,7 +168,7 @@ bool8 ChooseTargetPosition(struct Entity *pokemon) targetDistance = INFINITY; for (i = 0; i < maxPossibleTargets; i++) { - struct Entity *target = possibleTargets[i]; + Entity *target = possibleTargets[i]; if (EntityExists(target) && target->info->clientType == CLIENT_TYPE_NONE) { if (gDungeon->decoyActive) @@ -264,7 +264,7 @@ bool8 ChooseTargetPosition(struct Entity *pokemon) { if (!pokemonInfo->isNotTeamMember) { - struct Entity *leader = GetLeaderIfVisible(pokemon); + Entity *leader = GetLeaderIfVisible(pokemon); if (EntityExists(leader)) { pokemonInfo->aiObjective = AI_CHASE_TARGET; @@ -310,7 +310,7 @@ bool8 ChooseTargetPosition(struct Entity *pokemon) { for (x = minX; x <= maxX; x++) { - struct Entity *object = GetTileSafe(x, y)->object; + Entity *object = GetTileSafe(x, y)->object; if (object && GetEntityType(object) == ENTITY_ITEM) { pokemonInfo->aiObjective = AI_TAKE_ITEM; @@ -330,7 +330,7 @@ bool8 ChooseTargetPosition(struct Entity *pokemon) { if (pokemonInfo->aiTarget->spawnGenID == pokemonInfo->aiTargetSpawnGenID) { - struct EntityInfo *targetData = pokemonInfo->aiTarget->info; + EntityInfo *targetData = pokemonInfo->aiTarget->info; s32 i; for (i = 0; i < NUM_PREV_POS; i++) { @@ -355,9 +355,9 @@ bool8 ChooseTargetPosition(struct Entity *pokemon) return TRUE; } -void DecideMovement(struct Entity *pokemon, bool8 showRunAwayEffect) +void DecideMovement(Entity *pokemon, bool8 showRunAwayEffect) { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; s32 direction; s32 turnLimit; s32 i; @@ -500,15 +500,15 @@ void DecideMovement(struct Entity *pokemon, bool8 showRunAwayEffect) } } -bool8 AvoidEnemies(struct Entity *pokemon) +bool8 AvoidEnemies(Entity *pokemon) { bool8 pokemonInFront; u8 closestTargetRoom; s32 closestTargetDistance = INFINITY_2; - struct Entity *closestTarget; - struct EntityInfo *pokemonInfo = pokemon->info; + Entity *closestTarget; + EntityInfo *pokemonInfo = pokemon->info; u8 room = GetEntityRoom(pokemon); - struct Entity **possibleTargets; + Entity **possibleTargets; s32 numPossibleTargets; s32 i; if (gDungeon->decoyActive) @@ -530,7 +530,7 @@ bool8 AvoidEnemies(struct Entity *pokemon) closestTargetRoom = CORRIDOR_ROOM; for (i = 0; i < numPossibleTargets; i++) { - struct Entity *target = possibleTargets[i]; + Entity *target = possibleTargets[i]; if (EntityExists(target) && CanSeeTarget(pokemon, target)) { s32 distance; @@ -556,7 +556,7 @@ bool8 AvoidEnemies(struct Entity *pokemon) struct Tile *tile = GetTile(pokemon->pos.x, pokemon->pos.y); if (tile->terrainType & TERRAIN_TYPE_NATURAL_JUNCTION) { - struct Position aiTargetPos; + Position aiTargetPos; s32 targetDir; aiTargetPos.x = pokemon->pos.x; aiTargetPos.y = pokemon->pos.y; @@ -593,7 +593,7 @@ bool8 AvoidEnemies(struct Entity *pokemon) // If there are any room exits that the Pokémon can head towards without moving // closer to the target, head towards the furthest eligible exit. s32 naturalJunctionListCounts; - struct Position *naturalJunctionList = gDungeon->naturalJunctionList[room]; + Position *naturalJunctionList = gDungeon->naturalJunctionList[room]; s32 furthestTargetExitIndex; s32 furthestTargetToExitDistance; s32 distanceX; @@ -700,9 +700,9 @@ bool8 AvoidEnemies(struct Entity *pokemon) } #ifdef NONMATCHING -bool8 Wander(struct Entity *pokemon) +bool8 Wander(Entity *pokemon) { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; s32 room = GetEntityRoom(pokemon); s32 targetFacingDir; if (room == CORRIDOR_ROOM) @@ -737,7 +737,7 @@ bool8 Wander(struct Entity *pokemon) else { s32 naturalJunctionListCounts = gDungeon->naturalJunctionListCounts[room]; - struct Position *naturalJunctionList = gDungeon->naturalJunctionList[room]; + Position *naturalJunctionList = gDungeon->naturalJunctionList[room]; if (pokemonInfo->moveRandomly) { s32 targetFacingDir = DungeonRandInt(NUM_DIRECTIONS); @@ -802,7 +802,7 @@ bool8 Wander(struct Entity *pokemon) } #else NAKED -bool8 Wander(struct Entity *pokemon) +bool8 Wander(Entity *pokemon) { asm_unified("push {r4-r7,lr}\n" "mov r7, r10\n" @@ -1103,9 +1103,9 @@ bool8 Wander(struct Entity *pokemon) } #endif -void sub_807BB78(struct Entity *pokemon) +void sub_807BB78(Entity *pokemon) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; entityInfo = pokemon->info; entityInfo->aiObjective = 0; diff --git a/src/dungeon_ai_targeting.c b/src/dungeon_ai_targeting.c index 3663c9270..71c7104f4 100644 --- a/src/dungeon_ai_targeting.c +++ b/src/dungeon_ai_targeting.c @@ -20,7 +20,7 @@ #include "map.h" #include "tile_types.h" -extern void ShowVisualFlags(struct Entity *r0); +extern void ShowVisualFlags(Entity *r0); const u8 gDirectionBitMasks_2[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80}; const u8 gDirectionBitMasks_3[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80}; @@ -62,7 +62,7 @@ const u8 gTargetingData[3][2][2][2] = { } }; -bool8 sub_8070F3C(struct Entity * pokemon, struct Position *pos, s32 direction) +bool8 sub_8070F3C(Entity * pokemon, Position *pos, s32 direction) { u8 terrain; struct Tile *tile; @@ -107,7 +107,7 @@ bool8 sub_8070F3C(struct Entity * pokemon, struct Position *pos, s32 direction) return FALSE; } -bool8 sub_8070F14(struct Entity * pokemon, s32 direction) +bool8 sub_8070F14(Entity * pokemon, s32 direction) { struct Tile *tile; @@ -125,7 +125,7 @@ bool8 sub_8070F14(struct Entity * pokemon, s32 direction) return FALSE; } -bool8 sub_8070F80(struct Entity * pokemon, s32 direction) +bool8 sub_8070F80(Entity * pokemon, s32 direction) { u8 terrain; struct Tile *tile; @@ -170,7 +170,7 @@ bool8 sub_8070F80(struct Entity * pokemon, s32 direction) return FALSE; } -bool8 sub_8071058(struct Entity * pokemon, s32 direction) +bool8 sub_8071058(Entity * pokemon, s32 direction) { u8 terrain; struct Tile *tile; @@ -215,7 +215,7 @@ bool8 sub_8071058(struct Entity * pokemon, s32 direction) return FALSE; } -bool8 CanAttackInDirection(struct Entity *pokemon, s32 direction) +bool8 CanAttackInDirection(Entity *pokemon, s32 direction) { u8 crossableTerrain = GetCrossableTerrain(pokemon->info->id); struct Tile *tile; @@ -262,7 +262,7 @@ bool8 CanAttackInDirection(struct Entity *pokemon, s32 direction) return FALSE; } -bool8 CanAIMonsterMoveInDirection(struct Entity *pokemon, s32 direction, bool8 *pokemonInFront) +bool8 CanAIMonsterMoveInDirection(Entity *pokemon, s32 direction, bool8 *pokemonInFront) { u8 crossableTerrain = GetCrossableTerrain(pokemon->info->id); struct Tile *frontTile, *currentTile; @@ -332,7 +332,7 @@ bool8 CanAIMonsterMoveInDirection(struct Entity *pokemon, s32 direction, bool8 * return FALSE; } -bool8 IsAtJunction(struct Entity *pokemon) +bool8 IsAtJunction(Entity *pokemon) { u32 crossableTerrain = GetCrossableTerrain(pokemon->info->id); if (!IsCurrentFixedRoomBossFight()) @@ -352,7 +352,7 @@ bool8 IsAtJunction(struct Entity *pokemon) } if (crossableTerrain == CROSSABLE_TERRAIN_WALL) { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; pokemonInfo->mobileTurnTimer += DungeonRandInt(100); if (pokemonInfo->mobileTurnTimer < 200) { @@ -392,7 +392,7 @@ bool8 IsAtJunction(struct Entity *pokemon) return TRUE; } -bool8 ShouldAvoidFirstHit(struct Entity *pokemon, bool8 forceAvoid) +bool8 ShouldAvoidFirstHit(Entity *pokemon, bool8 forceAvoid) { if (!HasTactic(pokemon, TACTIC_AVOID_THE_FIRST_HIT)) return FALSE; @@ -401,7 +401,7 @@ bool8 ShouldAvoidFirstHit(struct Entity *pokemon, bool8 forceAvoid) return TRUE; } -bool8 ShouldMonsterRunAway(struct Entity *pokemon) +bool8 ShouldMonsterRunAway(Entity *pokemon) { if (!EntityExists(pokemon)) { @@ -409,7 +409,7 @@ bool8 ShouldMonsterRunAway(struct Entity *pokemon) } else { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; if (pokemonInfo->terrifiedTurns != 0) { return TRUE; @@ -435,7 +435,7 @@ bool8 ShouldMonsterRunAway(struct Entity *pokemon) } } -bool8 ShouldMonsterRunAwayAndShowEffect(struct Entity *pokemon, bool8 showRunAwayEffect) +bool8 ShouldMonsterRunAwayAndShowEffect(Entity *pokemon, bool8 showRunAwayEffect) { if (ShouldMonsterRunAway(pokemon)) { @@ -445,11 +445,11 @@ bool8 ShouldMonsterRunAwayAndShowEffect(struct Entity *pokemon, bool8 showRunAwa return FALSE; } -void CheckRunAwayVisualFlag(struct Entity *pokemon, bool8 showRunAwayEffect) +void CheckRunAwayVisualFlag(Entity *pokemon, bool8 showRunAwayEffect) { bool8 cVar1; - struct EntityInfo *iVar2; - struct EntityInfo *iVar3; + EntityInfo *iVar2; + EntityInfo *iVar3; iVar2 = pokemon->info; iVar3 = iVar2; @@ -460,10 +460,10 @@ void CheckRunAwayVisualFlag(struct Entity *pokemon, bool8 showRunAwayEffect) } } -u8 CanTarget(struct Entity *pokemon, struct Entity *targetPokemon, bool8 ignoreInvisible, bool8 checkPetrified) +u8 CanTarget(Entity *pokemon, Entity *targetPokemon, bool8 ignoreInvisible, bool8 checkPetrified) { - struct EntityInfo *pokemonInfo = pokemon->info; - struct EntityInfo *targetData = targetPokemon->info; + EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *targetData = targetPokemon->info; u8 targetingDecoy; u8 pokemonTargetingDecoy; bool8 pokemonIsEnemy; @@ -526,7 +526,7 @@ u8 CanTarget(struct Entity *pokemon, struct Entity *targetPokemon, bool8 ignoreI return gTargetingData[targetingDecoy][pokemonIsEnemy][targetIsEnemy][targetIsDecoy]; } -static inline bool8 JoinLocationCannotUseItems_1(struct EntityInfo *pokemonInfo) +static inline bool8 JoinLocationCannotUseItems_1(EntityInfo *pokemonInfo) { if (pokemonInfo->joinedAt == DUNGEON_JOIN_LOCATION_CLIENT_POKEMON) { @@ -539,11 +539,11 @@ static inline bool8 JoinLocationCannotUseItems_1(struct EntityInfo *pokemonInfo) return FALSE; } -u8 sub_807167C(struct Entity * pokemon, struct Entity * target) +u8 sub_807167C(Entity * pokemon, Entity * target) { bool8 cannotUseItems; - struct EntityInfo * targetEntityInfo; - struct EntityInfo * pokemonEntityData; + EntityInfo * targetEntityInfo; + EntityInfo * pokemonEntityData; pokemonEntityData = pokemon->info; targetEntityInfo = target->info; diff --git a/src/dungeon_capabilities.c b/src/dungeon_capabilities.c index 33fbd5ea7..3b2836da5 100644 --- a/src/dungeon_capabilities.c +++ b/src/dungeon_capabilities.c @@ -17,9 +17,9 @@ const u8 gDirectionBitMasks_1[] = {0x1, 0x2, 0x4, 0x8, 0x10, 0x20, 0x40, 0x80}; -bool8 CannotMove(struct Entity *pokemon, bool8 checkBlinker) +bool8 CannotMove(Entity *pokemon, bool8 checkBlinker) { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; if ((checkBlinker && pokemonInfo->eyesightStatus == STATUS_BLINKER) || pokemonInfo->sleep == STATUS_SLEEP @@ -36,9 +36,9 @@ bool8 CannotMove(struct Entity *pokemon, bool8 checkBlinker) return FALSE; } -bool8 sub_8070BC0(struct Entity* entity) +bool8 sub_8070BC0(Entity* entity) { - struct EntityInfo *entityInfo = entity->info; + EntityInfo *entityInfo = entity->info; if (IsCharging(entity, FALSE) || entityInfo->sleep == STATUS_YAWNING @@ -74,7 +74,7 @@ bool8 sub_8070BC0(struct Entity* entity) return FALSE; } -static inline bool8 JoinLocationCannotUseItems(struct EntityInfo *pokemonInfo) +static inline bool8 JoinLocationCannotUseItems(EntityInfo *pokemonInfo) { if (pokemonInfo->joinedAt == DUNGEON_JOIN_LOCATION_CLIENT_POKEMON) return TRUE; @@ -83,9 +83,9 @@ static inline bool8 JoinLocationCannotUseItems(struct EntityInfo *pokemonInfo) return FALSE; } -bool8 CannotUseItems(struct Entity *pokemon) +bool8 CannotUseItems(Entity *pokemon) { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; if (pokemonInfo->clientType == CLIENT_TYPE_CLIENT || JoinLocationCannotUseItems(pokemonInfo) @@ -100,9 +100,9 @@ bool8 CannotUseItems(struct Entity *pokemon) return FALSE; } -bool8 HasStatusThatPreventsActing(struct Entity *pokemon) +bool8 HasStatusThatPreventsActing(Entity *pokemon) { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; if ((pokemonInfo->sleep != STATUS_SLEEPLESS && pokemonInfo->sleep != STATUS_NONE) @@ -116,9 +116,9 @@ bool8 HasStatusThatPreventsActing(struct Entity *pokemon) return FALSE; } -bool8 CannotAttack(struct Entity *pokemon, bool8 skipSleep) +bool8 CannotAttack(Entity *pokemon, bool8 skipSleep) { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; if ((skipSleep || pokemonInfo->sleep == STATUS_SLEEPLESS || @@ -138,7 +138,7 @@ bool8 CannotAttack(struct Entity *pokemon, bool8 skipSleep) return TRUE; } -bool8 CanMoveInDirection(struct Entity *pokemon, u32 direction) +bool8 CanMoveInDirection(Entity *pokemon, u32 direction) { u8 crossableTerrain = GetCrossableTerrain(pokemon->info->id); struct Tile *currentMapTile = GetTile(pokemon->pos.x + gAdjacentTileOffsets[direction].x, diff --git a/src/dungeon_engine.c b/src/dungeon_engine.c index e6d8551ad..92ab54603 100644 --- a/src/dungeon_engine.c +++ b/src/dungeon_engine.c @@ -17,11 +17,11 @@ extern void sub_8044574(void); extern void sub_8044820(void); extern void sub_8044AB4(void); extern u8 UseAttack(u32); -extern u8 sub_8072CF4(struct Entity *); -extern void TickStatusHeal(struct Entity *); +extern u8 sub_8072CF4(Entity *); +extern void TickStatusHeal(Entity *); extern void sub_8086AC0(void); extern void sub_8043ED0(u32); -extern void sub_8071DA4(struct Entity *); +extern void sub_8071DA4(Entity *); extern void TriggerWeatherAbilities(void); extern void sub_805D8C8(void); extern void sub_805F02C(void); @@ -92,8 +92,8 @@ void RunFractionalTurn(bool8 param_1) static bool8 xxx_dungeon_80442D0(bool8 param_1) { - struct EntityInfo *entityInfo; - struct Entity *entity; + EntityInfo *entityInfo; + Entity *entity; s32 movSpeed; entity = GetLeader(); @@ -172,8 +172,8 @@ static bool8 xxx_dungeon_80442D0(bool8 param_1) static void sub_8044454(void) { - struct Entity *entity; - struct EntityInfo *entityInfo; + Entity *entity; + EntityInfo *entityInfo; s32 index; if (gDungeon->unkE) { @@ -198,10 +198,10 @@ static void sub_8044454(void) } } -void sub_80444F4(struct Entity *pokemon) +void sub_80444F4(Entity *pokemon) { - struct Entity *entity; - struct EntityInfo *entityInfo; + Entity *entity; + EntityInfo *entityInfo; s32 index; if (pokemon == GetLeader() && gDungeon->unkE) { diff --git a/src/dungeon_items.c b/src/dungeon_items.c index 5adb7ce73..8878ec89b 100644 --- a/src/dungeon_items.c +++ b/src/dungeon_items.c @@ -1,12 +1,11 @@ #include "global.h" +#include "code_80869E4.h" #include "dungeon_items.h" - #include "dungeon_capabilities.h" #include "dungeon_global_data.h" #include "dungeon_leader.h" #include "dungeon_random.h" #include "dungeon_util.h" -#include "team_inventory.h" #include "pokemon.h" extern u8 gAvailablePokemonNames[]; @@ -22,10 +21,9 @@ extern s32 sub_8052B8C(u32, u8 *, u32); extern void sub_80861A8(void); extern void PrintFieldMessage(u32, u8 *, u32); extern void sub_803E708(u32, u32); -extern void sub_80869E4(struct Entity *, u32, u32, u32); -extern void sub_80416E0(struct Position32 *r0, u32, u32); -extern void SetMessageArgument(u8 *r0, struct Entity *r1, u32); -extern void sub_80421C0(struct Entity *, u32); +extern void sub_80416E0(Position32 *r0, u32, u32); +extern void SetMessageArgument(u8 *r0, Entity *r1, u32); +extern void sub_80421C0(Entity *, u32); extern void sub_80855E4(void *); extern void PlaySoundEffect(u32); extern void sub_804178C(u32); @@ -33,10 +31,10 @@ extern void sub_8040A84(void); void MusicBoxCreation(void); -bool8 HasHeldItem(struct Entity *pokemon, u8 id) +bool8 HasHeldItem(Entity *pokemon, u8 id) { // Weird assignment to fix a regswap. - struct EntityInfo *pokemonInfo = pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemonInfo = pokemon->info; if (!(pokemonInfo->heldItem.flags & ITEM_FLAG_EXISTS)) { return FALSE; @@ -98,9 +96,9 @@ void MusicBoxCreation(void) { bool8 musicBoxOnce; bool8 createMusicBox; - struct Item *pbVar3; // r2 + Item *pbVar3; // r2 s32 iVar4; - struct Entity *entity; + Entity *entity; s32 indexes[3]; @@ -129,8 +127,8 @@ void MusicBoxCreation(void) if ((indexes[0] >= 0) && (indexes[1] >= 0) && (indexes[2] >= 0)) { // NOTE: doesn't match here.. tried to register pin but still not perfect - register struct Item *pbVar4 asm("r1"); - register struct Item *pbVar5 asm("r0"); + register Item *pbVar4 asm("r1"); + register Item *pbVar5 asm("r0"); musicBoxOnce = TRUE; createMusicBox = TRUE; @@ -355,12 +353,12 @@ void MusicBoxCreation(void) } #endif -bool8 sub_8046F00(struct Item *item) +bool8 sub_8046F00(Item *item) { bool8 canLearnMove; bool8 cannotMove; u16 moveID; - struct Entity *entity; + Entity *entity; s32 index; if (GetItemCategory(item->id) == CATEGORY_TMS_HMS) { @@ -387,9 +385,9 @@ bool8 sub_8046F00(struct Item *item) void sub_8046F84(s32 itemFlag) { - struct Item *item; - struct Entity *entity; - struct EntityInfo *entityInfo; + Item *item; + Entity *entity; + EntityInfo *entityInfo; s32 index; for(index = 0; index < INVENTORY_SIZE; index++) @@ -420,9 +418,9 @@ void sub_8046F84(s32 itemFlag) void sub_804700C(void) { - struct Item *item; - struct Entity *entity; - struct EntityInfo *entityInfo; + Item *item; + Entity *entity; + EntityInfo *entityInfo; s32 index; for(index = 0; index < INVENTORY_SIZE; index++) @@ -449,9 +447,9 @@ void sub_804700C(void) bool8 sub_8047084(s32 itemFlag) { - struct Item *item; - struct Entity *entity; - struct EntityInfo *entityInfo; + Item *item; + Entity *entity; + EntityInfo *entityInfo; s32 index; // NEED THIS ORDERING TO MATCH @@ -482,7 +480,7 @@ bool8 sub_8047084(s32 itemFlag) void sub_8047104(void) { - struct Item *item; + Item *item; s32 index; for(index = 0; index < INVENTORY_SIZE; index++) diff --git a/src/dungeon_leader.c b/src/dungeon_leader.c index 6b42c3cfd..0082bba4b 100644 --- a/src/dungeon_leader.c +++ b/src/dungeon_leader.c @@ -1,20 +1,19 @@ #include "global.h" -#include "dungeon_leader.h" - #include "dungeon_global_data.h" +#include "dungeon_leader.h" #include "dungeon_util.h" -extern struct Entity *gLeaderPointer; +extern Entity *gLeaderPointer; -struct Entity* GetLeader() +Entity* GetLeader(void) { - struct Entity *leader = gLeaderPointer; + Entity *leader = gLeaderPointer; if (leader == NULL) { s32 i; for (i = 0; i < MAX_TEAM_MEMBERS; i++) { - struct Entity *currentPokemon = gDungeon->teamPokemon[i]; + Entity *currentPokemon = gDungeon->teamPokemon[i]; if (EntityExists(currentPokemon) && currentPokemon->info->isTeamLeader) { gLeaderPointer = currentPokemon; @@ -26,7 +25,7 @@ struct Entity* GetLeader() return leader; } -struct EntityInfo* GetLeaderInfo(void) +EntityInfo* GetLeaderInfo(void) { return GetLeader()->info; } diff --git a/src/dungeon_map_access.c b/src/dungeon_map_access.c index 08d951eec..8282ddda3 100644 --- a/src/dungeon_map_access.c +++ b/src/dungeon_map_access.c @@ -1,16 +1,17 @@ #include "global.h" #include "code_8004AA0.h" #include "constants/walkable_tile.h" +#include "decompress.h" #include "dungeon_map_access.h" #include "dungeon_global_data.h" #include "tile_types.h" #include "random.h" #include "dungeon_engine.h" -extern struct unkStruct_202F190 gUnknown_202F190; -extern struct unkStruct_202F190 *gUnknown_203B430; -extern struct unkStruct_202F190 gUnknown_80F69D4; -extern struct unkStruct_202F190 gUnknown_80F69EC; +extern unkStruct_202F190 gUnknown_202F190; +extern unkStruct_202F190 *gUnknown_203B430; +extern unkStruct_202F190 gUnknown_80F69D4; +extern unkStruct_202F190 gUnknown_80F69EC; extern u8 gUnknown_8108EC0[]; extern u8 gUnknown_80F6A04[]; @@ -21,31 +22,30 @@ extern u8 gUnknown_80F6A34[]; extern u8 gUnknown_80F6A40[]; extern const struct FileArchive gDungeonFileArchive; -extern struct OpenedFile *gUnknown_202F18C; -extern struct OpenedFile *gDungeonPaletteFile; -extern struct unkStruct_202EE8C gUnknown_202EE8C[32]; +extern OpenedFile *gUnknown_202F18C; +extern OpenedFile *gDungeonPaletteFile; +extern unkStruct_202EE8C gUnknown_202EE8C[32]; extern u8 gWalkableTileToCrossableTerrain[8]; -extern const u8 gDungeonWaterType[]; extern u8 sub_8043CE4(u32); extern int sprintf(char *, const char *, ...); void sub_8049BB0(s32, s32); void sub_80498A8(s32, s32); -struct Tile* GetTile(s32 x, s32 y) +Tile *GetTile(s32 x, s32 y) { if (x >= 0 && y >= 0 && x < DUNGEON_MAX_SIZE_X && y < DUNGEON_MAX_SIZE_Y) { return gDungeon->tilePointers[y][x]; } - return (struct Tile*) gUnknown_203B430->unk0; + return (Tile *) gUnknown_203B430->unk0; } -struct Tile* GetTileSafe(s32 x, s32 y) +Tile *GetTileSafe(s32 x, s32 y) { if (x < 0 || y < 0 || x >= DUNGEON_MAX_SIZE_X || y >= DUNGEON_MAX_SIZE_Y) { - struct Tile* tile = (struct Tile*) gUnknown_202F190.unk0; + Tile *tile = (Tile *) gUnknown_202F190.unk0; gUnknown_202F190 = *gUnknown_203B430; return tile; } @@ -71,8 +71,8 @@ void sub_80495E4(void) void LoadDungeonTilesetAssets(void) { - struct OpenedFile *file; - struct OpenedFile *file_1; + OpenedFile *file; + OpenedFile *file_1; u8 fileName [12]; sprintf(fileName,gUnknown_80F6A04,gUnknown_8108EC0[gDungeon->tileset]); // b%02dfon diff --git a/src/dungeon_map_access_1.c b/src/dungeon_map_access_1.c index cd2279c98..fa3d1775a 100644 --- a/src/dungeon_map_access_1.c +++ b/src/dungeon_map_access_1.c @@ -1,14 +1,14 @@ #include "global.h" -#include "dungeon_map_access.h" -#include "dungeon_global_data.h" -#include "file_system.h" -#include "tile_types.h" -#include "random.h" +#include "code_8009804.h" #include "dungeon_engine.h" +#include "dungeon_global_data.h" +#include "dungeon_map_access.h" +#include "file_system.h" +#include "random.h" #include "text1.h" +#include "tile_types.h" extern void sub_80402AC(s32, s32); -extern void sub_80098F8(u32); void sub_804AA60(void) { s32 i; @@ -105,7 +105,7 @@ void sub_804AAD4(void) gDungeon->unk104C0 = maxRooms + 1; } -void sub_804AC20(struct Position *pos) +void sub_804AC20(Position *pos) { s32 y; struct Tile *tile2; diff --git a/src/dungeon_movement.c b/src/dungeon_movement.c index ed16e4491..0040a8464 100644 --- a/src/dungeon_movement.c +++ b/src/dungeon_movement.c @@ -66,12 +66,12 @@ u8 sub_807034C(s16 id, struct Tile *tile) return TRUE; } -u8 sub_80703A0(struct Entity *pokemon, struct Position *pos) +u8 sub_80703A0(Entity *pokemon, Position *pos) { u8 crossableTerrain; struct Tile *tile; u16 tileFlags; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; entityInfo = pokemon->info; tile = GetTile(pos->x,pos->y); @@ -104,10 +104,10 @@ u8 sub_80703A0(struct Entity *pokemon, struct Position *pos) return TRUE; } -bool8 CanCrossWalls(struct Entity *pokemon) +bool8 CanCrossWalls(Entity *pokemon) { - struct EntityInfo *pokemonInfo = pokemon->info; - struct EntityInfo *pokemonInfo2 = pokemonInfo; + EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo2 = pokemonInfo; if (pokemonInfo2->transformStatus == STATUS_MOBILE) { return TRUE; @@ -123,12 +123,12 @@ bool8 CanCrossWalls(struct Entity *pokemon) return FALSE; } -bool8 sub_807049C(struct Entity *pokemon, struct Position *pos) +bool8 sub_807049C(Entity *pokemon, Position *pos) { s32 crossableTerrain; struct Tile *tile; u16 tileFlags; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; entityInfo = pokemon->info; tile = GetTile(pos->x, pos->y); @@ -163,12 +163,12 @@ bool8 sub_807049C(struct Entity *pokemon, struct Position *pos) return TRUE; } -bool8 sub_8070564(struct Entity *pokemon, struct Position *pos) +bool8 sub_8070564(Entity *pokemon, Position *pos) { u8 crossableTerrain; struct Tile *tile; u16 tileFlags; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; #ifndef NONMATCHING register s32 tileFlags_0 asm("r0"); register s32 crossableTerrain2 asm("r3"); @@ -207,12 +207,12 @@ bool8 sub_8070564(struct Entity *pokemon, struct Position *pos) return TRUE; } -bool8 sub_80705F0(struct Entity *pokemon, struct Position *pos) +bool8 sub_80705F0(Entity *pokemon, Position *pos) { s32 crossableTerrain; struct Tile *tile; u16 tileFlags; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; entityInfo = pokemon->info; tile = GetTile(pos->x, pos->y); @@ -245,12 +245,12 @@ bool8 sub_80705F0(struct Entity *pokemon, struct Position *pos) return TRUE; } -bool8 sub_80706A4(struct Entity *pokemon, struct Position *pos) +bool8 sub_80706A4(Entity *pokemon, Position *pos) { s32 crossableTerrain; struct Tile *tile; u16 tileFlags; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; entityInfo = pokemon->info; tile = GetTile(pos->x, pos->y); @@ -285,11 +285,11 @@ bool8 sub_80706A4(struct Entity *pokemon, struct Position *pos) return TRUE; } -s32 CalcSpeedStage(struct Entity *pokemon) +s32 CalcSpeedStage(Entity *pokemon) { s32 index; s32 speed; - struct EntityInfo * entityInfo; + EntityInfo * entityInfo; entityInfo = pokemon->info; speed = 0; diff --git a/src/dungeon_music.c b/src/dungeon_music.c index 0f298e8c4..ba3658cf8 100644 --- a/src/dungeon_music.c +++ b/src/dungeon_music.c @@ -24,22 +24,22 @@ extern u8 gUnknown_810AC68; // 0x8 extern u8 gUnknown_810AC64; // 0x8 extern u8 gUnknown_810AC66; // 0x8 -extern void sub_80709C8(u8 *buffer, struct EntityInfo *entityInfo); +extern void sub_80709C8(u8 *buffer, EntityInfo *entityInfo); // Dungeon Music Player adds in this flag to tell // the system to fade in rather than immediately playing #define DUNGEON_MUSIC_FADE_IN 0x8000 -void sub_8083AB0(s16 param_0, struct Entity * target, struct Entity * entity) +void sub_8083AB0(s16 param_0, Entity * target, Entity * entity) { u8 *defPtr; u8 *attackPtr; u8 *spDefPtr; - struct EntityInfo * entityInfo; - struct EntityInfo * targetEntityInfo; + EntityInfo * entityInfo; + EntityInfo * targetEntityInfo; u8 *spAttPtr; u8 buffer [0x14]; - struct unkDungeonGlobal_unk1CE98_sub *temp; + unkDungeonGlobal_unk1CE98_sub *temp; u8 *id; s32 param_0_s32 = param_0; @@ -101,7 +101,7 @@ void sub_8083AB0(s16 param_0, struct Entity * target, struct Entity * entity) bool8 sub_8083C24(void) { - struct unkDungeonGlobal_unk1CE98_sub *temp; + unkDungeonGlobal_unk1CE98_sub *temp; temp = &gDungeon->unk1CE98; @@ -115,7 +115,7 @@ bool8 sub_8083C24(void) bool8 sub_8083C50(void) { - struct unkDungeonGlobal_unk1CE98_sub *temp; + unkDungeonGlobal_unk1CE98_sub *temp; temp = &gDungeon->unk1CE98; @@ -129,7 +129,7 @@ bool8 sub_8083C50(void) bool8 sub_8083C88(u8 param_1) { - struct unkDungeonGlobal_unk1CE98_sub *temp; + unkDungeonGlobal_unk1CE98_sub *temp; temp = &gDungeon->unk1CE98; @@ -265,7 +265,7 @@ u16 DungeonGetCurrentBGSong(void) void StopDungeonBGM(void) { - struct DungeonMusicPlayer *temp = &gDungeon->musPlayer; + DungeonMusicPlayer *temp = &gDungeon->musPlayer; temp->state = 0; temp->fadeOutSpeed = 0; temp->songIndex = STOP_BGM; @@ -283,7 +283,7 @@ void UpdateDungeonMusic(void) u16 *bossSongIndex; #endif s32 newSongIndex; - struct DungeonMusicPlayer *musPlayer; + DungeonMusicPlayer *musPlayer; musPlayer = &gDungeon->musPlayer; diff --git a/src/dungeon_pokemon_attributes.c b/src/dungeon_pokemon_attributes.c index 1281d60fd..3275a7663 100644 --- a/src/dungeon_pokemon_attributes.c +++ b/src/dungeon_pokemon_attributes.c @@ -22,11 +22,11 @@ extern u8 gAvailablePokemonNames[]; extern u32 gUnknown_80FC31C; extern u32 gUnknown_80FCEFC; extern u32 gUnknown_80FC2FC; -extern bool8 sub_805744C(struct Entity *, struct Move *, u32); -extern void SetMessageArgument(char[], struct Entity*, u32); -extern void sub_80522F4(struct Entity *r1, struct Entity *r2, u32); +extern bool8 sub_805744C(Entity *, Move *, u32); +extern void SetMessageArgument(char[], Entity*, u32); +extern void sub_80522F4(Entity *r1, Entity *r2, u32); -bool8 HasSafeguardStatus(struct Entity * pokemon, struct Entity * target, bool8 displayMessage) +bool8 HasSafeguardStatus(Entity * pokemon, Entity * target, bool8 displayMessage) { if (target->info->protectionStatus == STATUS_SAFEGUARD) { if (displayMessage) { @@ -38,7 +38,7 @@ bool8 HasSafeguardStatus(struct Entity * pokemon, struct Entity * target, bool8 return FALSE; } -bool8 sub_8071728(struct Entity * pokemon, struct Entity * target, bool8 displayMessage) +bool8 sub_8071728(Entity * pokemon, Entity * target, bool8 displayMessage) { if (target->info->protectionStatus == STATUS_MIST) { if (displayMessage) { @@ -59,9 +59,9 @@ bool8 sub_8071728(struct Entity * pokemon, struct Entity * target, bool8 display return FALSE; } -bool8 sub_80717A4(struct Entity *pokemon, u16 moveID) +bool8 sub_80717A4(Entity *pokemon, u16 moveID) { - struct EntityInfo * entityInfo; + EntityInfo * entityInfo; s32 index; entityInfo = pokemon->info; @@ -72,12 +72,12 @@ bool8 sub_80717A4(struct Entity *pokemon, u16 moveID) { // Pin this register to match #ifndef NONMATCHING - register struct Move *pokeMove asm("r4"); + register Move *pokeMove asm("r4"); #else - struct Move *pokeMove; + Move *pokeMove; #endif - struct Move *pokeMove2; // some reason uses another pointer to same struct + Move *pokeMove2; // some reason uses another pointer to same struct for(index = 0, pokeMove = entityInfo->moves, pokeMove2 = pokeMove; index < MAX_MON_MOVES; pokeMove++, pokeMove2++, index++) { @@ -90,7 +90,7 @@ bool8 sub_80717A4(struct Entity *pokemon, u16 moveID) } } -bool8 HasAbility(struct Entity *pokemon, u8 ability) +bool8 HasAbility(Entity *pokemon, u8 ability) { if (!EntityExists(pokemon)) { @@ -98,7 +98,7 @@ bool8 HasAbility(struct Entity *pokemon, u8 ability) } else { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; if (pokemonInfo->abilities[0] == ability || pokemonInfo->abilities[1] == ability) { return TRUE; @@ -107,9 +107,9 @@ bool8 HasAbility(struct Entity *pokemon, u8 ability) } } -bool8 MonsterIsType(struct Entity *pokemon, u8 type) +bool8 MonsterIsType(Entity *pokemon, u8 type) { - struct EntityInfo *pokemonInfo = pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemonInfo = pokemon->info; if (type == TYPE_NONE) { return FALSE; @@ -125,9 +125,9 @@ bool8 MonsterIsType(struct Entity *pokemon, u8 type) return FALSE; } -bool8 CanSeeInvisibleMonsters(struct Entity *pokemon) +bool8 CanSeeInvisibleMonsters(Entity *pokemon) { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; if (pokemonInfo->eyesightStatus != STATUS_EYEDROPS) { if (!HasHeldItem(pokemon, ITEM_GOGGLE_SPECS)) @@ -139,9 +139,9 @@ bool8 CanSeeInvisibleMonsters(struct Entity *pokemon) return TRUE; } -bool8 HasTactic(struct Entity *pokemon, u8 tactic) +bool8 HasTactic(Entity *pokemon, u8 tactic) { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; if (pokemonInfo->isTeamLeader) { bool8 isGoTheOtherWay = tactic == TACTIC_GO_THE_OTHER_WAY; @@ -150,21 +150,21 @@ bool8 HasTactic(struct Entity *pokemon, u8 tactic) return pokemonInfo->tactic == tactic; } -bool8 IQSkillIsEnabled(struct Entity *pokemon, u8 IQSkill) +bool8 IQSkillIsEnabled(Entity *pokemon, u8 IQSkill) { return IsIQSkillSet(pokemon->info->IQSkillFlags, 1 << IQSkill); } -bool8 IQSkillPairIsEnabled(struct Entity *pokemon, u8 IQSkill1, u8 IQSkill2) +bool8 IQSkillPairIsEnabled(Entity *pokemon, u8 IQSkill1, u8 IQSkill2) { return IsIQSkillSet(pokemon->info->IQSkillFlags, 1 << IQSkill1 | 1 << IQSkill2); } -void LoadIQSkills(struct Entity *pokemon) +void LoadIQSkills(Entity *pokemon) { u8 *iVar2; s32 IQSkill; - struct EntityInfo *pokemonInfo; + EntityInfo *pokemonInfo; pokemonInfo = pokemon->info; if (pokemonInfo->isNotTeamMember) { @@ -193,9 +193,9 @@ void LoadIQSkills(struct Entity *pokemon) } } -bool8 CanSeeTeammate(struct Entity * pokemon) +bool8 CanSeeTeammate(Entity * pokemon) { - struct Entity *teamMember; + Entity *teamMember; s32 memberIdx; if (pokemon->info->isNotTeamMember) { @@ -215,7 +215,7 @@ bool8 CanSeeTeammate(struct Entity * pokemon) } } -u8 GetMoveTypeForMonster(struct Entity *pokemon, struct Move *pokeMove) +u8 GetMoveTypeForMonster(Entity *pokemon, Move *pokeMove) { if (pokeMove->id == MOVE_HIDDEN_POWER) return pokemon->info->hiddenPowerType; @@ -223,7 +223,7 @@ u8 GetMoveTypeForMonster(struct Entity *pokemon, struct Move *pokeMove) return GetMoveType(pokeMove); } -s32 GetMovePower(struct Entity *pokemon, struct Move *pokeMove) +s32 GetMovePower(Entity *pokemon, Move *pokeMove) { if(pokeMove->id == MOVE_HIDDEN_POWER) return (pokemon->info->hiddenPowerBasePower + pokeMove->ginseng); @@ -231,14 +231,14 @@ s32 GetMovePower(struct Entity *pokemon, struct Move *pokeMove) return (GetMoveBasePower(pokeMove) + pokeMove->ginseng); } -bool8 ToolboxEnabled(struct EntityInfo *pokemon) +bool8 ToolboxEnabled(EntityInfo *pokemon) { if(!IsToolboxEnabled(pokemon->id)) return FALSE; return TRUE; } -static inline bool8 sub_8071A8C_sub(struct EntityInfo *pokemonInfo) +static inline bool8 sub_8071A8C_sub(EntityInfo *pokemonInfo) { if(pokemonInfo->joinedAt == DUNGEON_JOIN_LOCATION_CLIENT_POKEMON || pokemonInfo->joinedAt == DUNGEON_RESCUE_TEAM_BASE) @@ -247,9 +247,9 @@ static inline bool8 sub_8071A8C_sub(struct EntityInfo *pokemonInfo) return FALSE; } -bool8 sub_8071A8C(struct Entity *pokemon) +bool8 sub_8071A8C(Entity *pokemon) { - struct EntityInfo *pokemonInfo; + EntityInfo *pokemonInfo; if(EntityExists(pokemon)) { pokemonInfo = pokemon->info; @@ -262,7 +262,7 @@ bool8 sub_8071A8C(struct Entity *pokemon) return FALSE; } -bool8 SetVisualFlags(struct EntityInfo *entityInfo, u16 newFlag, bool8 param_3) +bool8 SetVisualFlags(EntityInfo *entityInfo, u16 newFlag, bool8 param_3) { if ((entityInfo->visualFlags & newFlag)) { entityInfo->previousVisualFlags = newFlag | entityInfo->previousVisualFlags; diff --git a/src/dungeon_range.c b/src/dungeon_range.c index 9cfe8e350..026e93ad5 100644 --- a/src/dungeon_range.c +++ b/src/dungeon_range.c @@ -5,7 +5,7 @@ #include "dungeon_map_access.h" #include "map.h" -bool8 IsPositionActuallyInSight(struct Position *pos1, struct Position *pos2) +bool8 IsPositionActuallyInSight(Position *pos1, Position *pos2) { u8 pos1Room; u8 visibility = gDungeon->visibilityRange; @@ -47,7 +47,7 @@ bool8 IsPositionActuallyInSight(struct Position *pos1, struct Position *pos2) } } -bool8 IsPositionInSight(struct Position *pos1, struct Position *pos2) +bool8 IsPositionInSight(Position *pos1, Position *pos2) { struct Tile *tile; u8 pos1Room; @@ -97,7 +97,7 @@ returnFalse: return TRUE; } -void sub_80833E8(struct Position *param_1, s32 *param_2) +void sub_80833E8(Position *param_1, s32 *param_2) { struct Tile *tile; struct RoomData *mapRoom; @@ -125,7 +125,7 @@ void sub_80833E8(struct Position *param_1, s32 *param_2) } } -bool8 IsTargetTwoTilesAway(struct Position *pos1, struct Position *pos2) +bool8 IsTargetTwoTilesAway(Position *pos1, Position *pos2) { s32 i; struct Tile *tile; diff --git a/src/dungeon_util.c b/src/dungeon_util.c index ac067ce47..99a6b7777 100644 --- a/src/dungeon_util.c +++ b/src/dungeon_util.c @@ -6,14 +6,14 @@ extern u8 gUnknown_202EE70[0x6]; extern u8 gUnknown_202EE76[0x10]; -u32 EntityGetStatusSprites(struct Entity *entity); +u32 EntityGetStatusSprites(Entity *entity); void UpdateDungeonPokemonSprite(int id, short species, int status, char visible); -void sub_806C51C(struct Entity *entity); -extern void sub_80462AC(struct Entity * ,u32, u32, u32, u32); +void sub_806C51C(Entity *entity); +extern void sub_80462AC(Entity * ,u32, u32, u32, u32); extern void sub_807FA9C(); -const struct Position gAdjacentTileOffsets[] = { +const Position gAdjacentTileOffsets[] = { {0, 1}, {1, 1}, {1, 0}, @@ -24,7 +24,7 @@ const struct Position gAdjacentTileOffsets[] = { {-1, 1} }; -bool8 EntityExists(struct Entity *entity) +bool8 EntityExists(Entity *entity) { if (!entity) { @@ -33,42 +33,42 @@ bool8 EntityExists(struct Entity *entity) return entity->type != ENTITY_NOTHING; } -u32 GetEntityType(struct Entity *entity) +u32 GetEntityType(Entity *entity) { return entity->type; } -u8 GetEntityRoom(struct Entity *entity) +u8 GetEntityRoom(Entity *entity) { return entity->room; } -struct EntityInfo* GetTrapData(struct Entity *entity) +EntityInfo* GetTrapData(Entity *entity) { return entity->info; } -struct Item* GetItemData(struct Entity *entity) +Item* GetItemData(Entity *entity) { - return (struct Item *)entity->info; + return (Item *)entity->info; } -struct EntityInfo* GetTrapData_1(struct Entity *entity) +EntityInfo* GetTrapData_1(Entity *entity) { return entity->info; } -struct Item* GetItemData_1(struct Entity *entity) +Item* GetItemData_1(Entity *entity) { - return (struct Item*)entity->info; + return (Item*)entity->info; } -struct Tile* GetTileAtEntity(struct Entity *entity) +Tile *GetTileAtEntity(Entity *entity) { return GetTile(entity->pos.x, entity->pos.y); } -struct Tile* GetTileAtEntitySafe(struct Entity *entity) +Tile *GetTileAtEntitySafe(Entity *entity) { return GetTileSafe(entity->pos.x, entity->pos.y); } @@ -119,9 +119,9 @@ void sub_804513C(void) void sub_804522C(void) { s32 index; - struct Entity *entity; - struct Entity *entity2; - struct EntityInfo *info; + Entity *entity; + Entity *entity2; + EntityInfo *info; u32 statusSprites; bool8 crossEyed; @@ -175,7 +175,7 @@ void sub_804522C(void) { } } -void sub_804535C(struct Entity *entity, struct Position32 *pos) +void sub_804535C(Entity *entity, Position32 *pos) { if (pos != NULL) { @@ -188,13 +188,13 @@ void sub_804535C(struct Entity *entity, struct Position32 *pos) } } -void sub_8045394(struct Entity *entity, s32 x, s32 y) +void sub_8045394(Entity *entity, s32 x, s32 y) { entity->pixelPos.x = x; entity->pixelPos.y = y; } -void IncreaseEntityPixelPos(struct Entity *entity, s32 x, s32 y) +void IncreaseEntityPixelPos(Entity *entity, s32 x, s32 y) { entity->pixelPos.x += x; entity->pixelPos.y += y; diff --git a/src/dungeon_util_1.c b/src/dungeon_util_1.c index c9bbd4e0a..f72a6c782 100644 --- a/src/dungeon_util_1.c +++ b/src/dungeon_util_1.c @@ -1,4 +1,5 @@ #include "global.h" +#include "code_806CD90.h" #include "dungeon_util_1.h" #include "constants/direction.h" @@ -10,8 +11,7 @@ extern const u8 gUnknown_8107358[25]; -extern void sub_806CE68(struct Entity *, u32); -extern void sub_804535C(struct Entity *, u32); +extern void sub_804535C(Entity *, u32); extern s32 GetCameraXPos(void); extern s32 GetCameraYPos(void); extern void sub_803F4A0(u32); @@ -19,22 +19,22 @@ extern void sub_803F878(s32, s32); extern void sub_803E46C(u32); extern void sub_803E708(u32, u32); -extern void sub_8068FE0(struct Entity *, u32, u8 *); +extern void sub_8068FE0(Entity *, u32, u8 *); extern void sub_80457DC(u8 *); -extern void sub_80861D4(struct Entity *, u32, s32 direction); -extern void sub_80694C0(struct Entity *, s32, s32, u32); +extern void sub_80861D4(Entity *, u32, s32 direction); +extern void sub_80694C0(Entity *, s32, s32, u32); -typedef void (*DungeonCallback)(struct Entity *); +typedef void (*DungeonCallback)(Entity *); -struct Entity *xxx_call_GetLeader(void) +Entity *xxx_call_GetLeader(void) { return GetLeader(); } -struct Entity *GetPartnerEntity(void) +Entity *GetPartnerEntity(void) { s32 counter; - struct Entity *entity; + Entity *entity; for(counter = 0; counter < MAX_TEAM_MEMBERS; counter++) { entity = gDungeon->teamPokemon[counter]; @@ -48,15 +48,15 @@ struct Entity *GetPartnerEntity(void) void sub_80854D4(void) { - struct Entity *stack1[MAX_TEAM_MEMBERS]; - struct Entity *stack2[MAX_TEAM_MEMBERS]; + Entity *stack1[MAX_TEAM_MEMBERS]; + Entity *stack2[MAX_TEAM_MEMBERS]; s32 counter = 0; s32 index; - struct Entity *entity; - struct Entity *entity2; - struct Entity *entity3; - struct Entity *entity4; - struct Entity *entity5; + Entity *entity; + Entity *entity2; + Entity *entity3; + Entity *entity4; + Entity *entity5; for(index = 0; index < MAX_TEAM_MEMBERS; index++) { @@ -117,8 +117,8 @@ void sub_80854D4(void) void sub_80855E4(DungeonCallback func) { bool8 flag; - struct Entity * entity; - struct Entity * partnerEntity; + Entity * entity; + Entity * partnerEntity; s32 index; flag = FALSE; @@ -139,7 +139,7 @@ void sub_80855E4(DungeonCallback func) void sub_808563C(DungeonCallback func) { - struct Entity * entity; + Entity * entity; s32 index; for(index = 0; index < DUNGEON_MAX_WILD_POKEMON; index++) @@ -151,9 +151,9 @@ void sub_808563C(DungeonCallback func) } } -struct Entity *GetEntityFromClientType(u8 entityType) +Entity *GetEntityFromClientType(u8 entityType) { - struct Entity * entity; + Entity * entity; s32 index; for(index = 0; index < DUNGEON_MAX_POKEMON; index++) @@ -164,15 +164,15 @@ struct Entity *GetEntityFromClientType(u8 entityType) return NULL; } -void sub_80856C8(struct Entity * pokemon, s32 x, s32 y) +void sub_80856C8(Entity * pokemon, s32 x, s32 y) { sub_80694C0(pokemon, x, y, 1); sub_804535C(pokemon,0); } -void sub_80856E0(struct Entity * pokemon, s32 direction) +void sub_80856E0(Entity * pokemon, s32 direction) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; s32 counter; entityInfo = pokemon->info; @@ -197,7 +197,7 @@ void sub_80856E0(struct Entity * pokemon, s32 direction) void sub_8085764(void) { - struct Entity *entity; + Entity *entity; s32 index; u8 auStack128 [116]; @@ -214,8 +214,8 @@ void sub_8085764(void) void sub_80857B8(void) { u8 *direction; - struct EntityInfo *entityInfo; - struct Entity *entity; + EntityInfo *entityInfo; + Entity *entity; int index; for(index = 0; index < DUNGEON_MAX_POKEMON; index++) @@ -248,7 +248,7 @@ void sub_8085890(s32 x, s32 y) sub_803F878(x, y); } -void ShiftCameraToPosition(struct Position32 *posStruct, s32 cameraSteps) +void ShiftCameraToPosition(Position32 *posStruct, s32 cameraSteps) { s32 XPos; s32 YPos; @@ -273,7 +273,7 @@ void ShiftCameraToPosition(struct Position32 *posStruct, s32 cameraSteps) sub_803E46C(0x46); } -void SetFacingDirection(struct Entity *pokemon, s32 direction) +void SetFacingDirection(Entity *pokemon, s32 direction) { pokemon->info->action.direction = direction & DIRECTION_MASK; sub_806CE68(pokemon, direction); @@ -282,7 +282,7 @@ void SetFacingDirection(struct Entity *pokemon, s32 direction) void sub_8085930(s32 direction) { s32 index; - struct Entity *entity; + Entity *entity; for(index = 0; index < MAX_TEAM_MEMBERS; index++) { entity = gDungeon->teamPokemon[index]; @@ -323,7 +323,7 @@ void sub_8085930(s32 direction) void sub_80859F0(s32 direction) { s32 index; - struct Entity *entity; + Entity *entity; for(index = 0; index < DUNGEON_MAX_WILD_POKEMON; index++) { entity = gDungeon->wildPokemon[index]; @@ -342,9 +342,9 @@ void sub_80859F0(s32 direction) } } -bool8 IsMovingClient(struct Entity *pokemon) +bool8 IsMovingClient(Entity *pokemon) { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; switch (pokemonInfo->clientType) { case CLIENT_TYPE_CLIENT: @@ -390,7 +390,7 @@ bool8 IsMovingClient(struct Entity *pokemon) } } -void sub_8085B0C(struct Entity *pokemon) +void sub_8085B0C(Entity *pokemon) { s32 index; u8 local_28 [25]; diff --git a/src/dungeon_visibility.c b/src/dungeon_visibility.c index 56d616e24..4a1fe5b8d 100644 --- a/src/dungeon_visibility.c +++ b/src/dungeon_visibility.c @@ -6,7 +6,7 @@ #include "dungeon_range.h" #include "dungeon_util.h" -bool8 CanSeeTarget(struct Entity *entity, struct Entity *targetEntity) +bool8 CanSeeTarget(Entity *entity, Entity *targetEntity) { if (!EntityExists(entity) || !EntityExists(targetEntity) || !targetEntity->isVisible) { @@ -33,7 +33,7 @@ bool8 CanSeeTarget(struct Entity *entity, struct Entity *targetEntity) return IsPositionActuallyInSight(&entity->pos, &targetEntity->pos); } -bool8 CanTargetEntity(struct Entity *entity, struct Entity *targetEntity) +bool8 CanTargetEntity(Entity *entity, Entity *targetEntity) { if (!EntityExists(entity) || !EntityExists(targetEntity) || !targetEntity->isVisible) { @@ -60,7 +60,7 @@ bool8 CanTargetEntity(struct Entity *entity, struct Entity *targetEntity) return IsPositionInSight(&entity->pos, &targetEntity->pos); } -bool8 sub_8045A70(struct Entity *entity, struct Entity *targetEntity) +bool8 sub_8045A70(Entity *entity, Entity *targetEntity) { if (EntityExists(entity) && EntityExists(targetEntity) && targetEntity->isVisible) { @@ -69,12 +69,12 @@ bool8 sub_8045A70(struct Entity *entity, struct Entity *targetEntity) return FALSE; } -bool8 sub_8045AAC(struct Entity *entity, struct Position *pos) +bool8 sub_8045AAC(Entity *entity, Position *pos) { return IsPositionActuallyInSight(&entity->pos, pos); } -bool8 CanTargetPosition(struct Entity *entity, struct Position *pos) +bool8 CanTargetPosition(Entity *entity, Position *pos) { return IsPositionInSight(&entity->pos, pos); } diff --git a/src/event_flag.c b/src/event_flag.c index 72bde62f2..210e87c8a 100644 --- a/src/event_flag.c +++ b/src/event_flag.c @@ -1,7 +1,7 @@ #include "global.h" #include "constants/friend_area.h" #include "constants/item.h" -#include "item.h" +#include "items.h" #include "event_flag.h" #include "debug.h" #include "memory.h" @@ -9,7 +9,7 @@ #include "rescue_team_info.h" #include "other_random.h" #include "friend_area.h" -#include "team_inventory.h" +#include "code_80972F4.h" #include "code_8097670.h" #include "pokemon.h" #include "pokemon_3.h" @@ -36,26 +36,28 @@ extern u8 gUnknown_80B7144[]; extern u8 *gUnknown_80B714C[]; extern u8 *gUnknown_80B71A0[]; extern u8 gUnknown_80B72CC[]; -extern struct DebugLocation gUnknown_80B7318; +extern DebugLocation gUnknown_80B7318; extern u8 gUnknown_80B7324[]; -extern struct DebugLocation gUnknown_80B7350; +extern DebugLocation gUnknown_80B7350; extern u8 gUnknown_80B735C[]; extern u8 gUnknown_80B7378[]; extern u8 gUnknown_80B7388[]; -void FatalError(struct DebugLocation *, const char *, ...) __attribute__((noreturn)); -extern u8 sub_80973F4(u32); +void FatalError(DebugLocation *, const char *, ...) __attribute__((noreturn)); extern bool8 HasCompletedAllMazes(void); extern void sub_8097418(u32, u32); extern void sub_800160C(struct UnkEventStruct *r0, u32 r1, u32 r2); extern u8 sub_8002658(s16); -extern u32 sub_8001658(u32, s32); extern void sub_80018D8(u32, u32, u32); extern void sub_809733C(u32, u32); extern void sub_80973A8(u32, u32); extern void sub_800199C(u32, s32, u32, s32); extern s32 sub_8001784(u32, s32, u16); + +// code_80972F4.h (read comment) +extern bool8 sub_80973F4(s16); + u8 *sub_8001A74(s16 param_1) { struct UnkEventStruct local_1c; diff --git a/src/felicity_bank.c b/src/felicity_bank.c index b04767e6e..c036abc04 100644 --- a/src/felicity_bank.c +++ b/src/felicity_bank.c @@ -5,7 +5,7 @@ #include "memory.h" #include "menu_input.h" #include "pokemon.h" -#include "team_inventory.h" + #include "text1.h" #include "text2.h" @@ -22,9 +22,9 @@ extern u8 *gUnknown_80D4970[]; extern u8 *gFelicityDeposit; extern u8 *gFelicityWithdraw; extern u8 *gFelicityDialogue[2][15]; -extern struct UnkTextStruct2 gUnknown_80DB6DC; -extern struct UnkTextStruct2 gUnknown_80DB6F4; -extern struct UnkTextStruct2 gUnknown_80DB70C; +extern UnkTextStruct2 gUnknown_80DB6DC; +extern UnkTextStruct2 gUnknown_80DB6F4; +extern UnkTextStruct2 gUnknown_80DB70C; extern u8 gFelicitySavings[]; extern u8 gFelicityMoney[]; extern u8 gUnknown_80DB738; @@ -45,17 +45,17 @@ void UpdateFelicityBankState(u32); u32 CreateFelicityBank(s32 isAsleep) { char *monName; - struct OpenedFile * faceFile; + OpenedFile * faceFile; ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); gFelicityBankWork = MemoryAlloc(sizeof(struct FelicityBankWork), 8); gFelicityBankWork->menuAction = 0; gFelicityBankWork->isAsleep = isAsleep; CopyYellowMonsterNametoBuffer(gUnknown_202E5D8, MONSTER_PERSIAN); CopyYellowMonsterNametoBuffer(gUnknown_202E1C8, MONSTER_PERSIAN); monName = GetMonSpecies(MONSTER_PERSIAN); - strcpy(gUnknown_202E1C8 - 0x50, monName); + strcpy(gUnknown_202E1C8 - 80, monName); if (gFelicityBankWork->isAsleep == 1) gFelicityBankWork->unkA4 = NULL; @@ -135,7 +135,7 @@ void sub_801645C(void) gFelicityBankWork->unkA8[2].unk0 = 0x80; gFelicityBankWork->unkA8[3] = gUnknown_80DB6F4; ResetUnusedInputStruct(); - sub_800641C(gFelicityBankWork->unkA8, 1, 0); + sub_800641C(gFelicityBankWork->unkA8, TRUE, FALSE); break; case 8: case 11: @@ -144,14 +144,14 @@ void sub_801645C(void) gFelicityBankWork->unkA8[3] = gUnknown_80DB6F4; gFelicityBankWork->unkA8[2] = gUnknown_80DB70C; ResetUnusedInputStruct(); - sub_800641C(gFelicityBankWork->unkA8, 1, 0); + sub_800641C(gFelicityBankWork->unkA8, TRUE, FALSE); break; default: for (index = 0; index < 4; index++) { gFelicityBankWork->unkA8[index] = gUnknown_80DB6DC; } ResetUnusedInputStruct(); - sub_800641C(gFelicityBankWork->unkA8, 1, 1); + sub_800641C(gFelicityBankWork->unkA8, TRUE, TRUE); break; } } diff --git a/src/file_system.c b/src/file_system.c index 232a2c36e..73682e6a2 100644 --- a/src/file_system.c +++ b/src/file_system.c @@ -1,46 +1,27 @@ #include "global.h" +#include "decompress.h" #include "file_system.h" EWRAM_DATA u32 gUnknown_202D2A4 = {0}; -EWRAM_DATA struct OpenedFile gFileCache[64] = {0}; -EWRAM_DATA u32 *gDecompressBufferPtr = {0}; -EWRAM_DATA u32 *gDecompressBufferStart = {0}; -EWRAM_DATA u32 gDecompressBufferCurrent = {0}; -EWRAM_DATA u32 gDecompressBufferByteInInt = {0}; +EWRAM_DATA OpenedFile gFileCache[64] = {0}; -EWRAM_DATA_2 u32 gFileCacheCursorPosition = {0}; +static EWRAM_DATA_2 u32 sFileCacheCursorPosition = {0}; -extern const u32 gByteShiftLookup[4]; +#include "data/file_system.h" +// ??? +extern s32 sprintf(char *, const char *, ...); -extern int sprintf(char *, const char *, ...); - -void DecompressAT_Init(u32 *buffer); -void DecompressAT_AppendByte(char value); -void DecompressAT_Finish(void); -char DecompressAT_GetByte(int index); - -u32 DecompressAT(char *result, s32 resultLength, const char *compressedData); -u32 DecompressATGlobal(u32 *result, s32 resultLength, const char *compressedData); -u8 *GetSiroPtr(struct OpenedFile *); -void NDS_DecompressRLE(void *); - -struct UnkFileStruct -{ - /* 0x0 */ u32 unk0; - /* 0x4 */ u32 unk4; -}; - -extern u32 gUnknown_80B96E4[]; - -void sub_800A894(struct UnkFileStruct *r0, s32 r1) +UNUSED static void sub_800A894(UnkFileStruct *r0, s32 r1) { s32 temp; + temp = r1; - if(r1 <= 0) + if (temp < 1) temp = 1; - if(temp > 299) + if (temp > 299) temp = 299; + r0->unk4 = gUnknown_80B96E4[temp]; r0->unk0 = 0; } @@ -49,13 +30,12 @@ void InitFileSystem(void) { s32 i; - for (i = 0; i < 64; i++) - { + for (i = 0; i < 64; i++) { gFileCache[i].file = NULL; gFileCache[i].data = NULL; } - gFileCacheCursorPosition = 0; + sFileCacheCursorPosition = 0; gUnknown_202D2A4 = 1; } @@ -66,18 +46,18 @@ u32 sub_800A8F8(u32 value) return oldValue; } -struct OpenedFile *OpenFile(const char *filename, const struct FileArchive *arc) +OpenedFile *OpenFile(const u8 *filename, const FileArchive *arc) { - char buffer[0x12C]; + u8 buffer[300]; s32 left, right; s32 cursor; s32 i; u32 magic = 0; bool32 magicFound; - struct File *entries; - struct File *file; + File *entries; + File *file; - magic = strcmp(arc->magic, "pksdir0") != 0; + magic = strcmp(arc->magic, gUnknown_80B9B94) != 0; magicFound = 0; @@ -91,42 +71,35 @@ struct OpenedFile *OpenFile(const char *filename, const struct FileArchive *arc) left = 0; right = arc->count - 1; - while (left < right) - { + while (left < right) { s32 mid = (left + right) / 2; - int result = strcmp(entries[mid].name, filename); - if (result == 0) - { + s32 result = strcmp(entries[mid].name, filename); + if (result == 0) { left = mid; break; } - else if (result < 0) - { + + if (result < 0) left = mid + 1; - } else - { right = mid; - } } file = &entries[left]; - if (strcmp(file->name, filename)) - { - sprintf(buffer, "not find file [%s]\n", filename); + if (strcmp(file->name, filename)) { + sprintf(buffer, gUnknown_80B9B9C, filename); return NULL; } - cursor = gFileCacheCursorPosition; + cursor = sFileCacheCursorPosition; - for (i = 0; i < 64; i++) - { + for (i = 0; i < 64; i++) { cursor++; if (cursor > 63) cursor = 0; - if (!gFileCache[cursor].file) - { + + if (!gFileCache[cursor].file) { gFileCache[cursor].file = file; gFileCache[cursor].data = NULL; return &gFileCache[cursor]; @@ -136,965 +109,41 @@ struct OpenedFile *OpenFile(const char *filename, const struct FileArchive *arc) return NULL; } -static u8 *_GetFileDataPtr(struct OpenedFile *openedFile) +static u8 *_GetFileDataPtr(OpenedFile *openedFile) { openedFile->data = openedFile->file->data; return openedFile->data; } -u8 *GetFileDataPtr(struct OpenedFile *openedFile, int unused) +u8 *GetFileDataPtr(OpenedFile *openedFile, s32 unused) { _GetFileDataPtr(openedFile); return GetSiroPtr(openedFile); } -struct OpenedFile *OpenFileAndGetFileDataPtr(const char *filename, const struct FileArchive *arc) +OpenedFile *OpenFileAndGetFileDataPtr(const u8 *filename, const FileArchive *arc) { - struct OpenedFile *openedFile = OpenFile(filename, arc); + OpenedFile *openedFile = OpenFile(filename, arc); if (openedFile) GetFileDataPtr(openedFile, 0); return openedFile; } -struct OpenedFile *Call_OpenFileAndGetFileDataPtr(const char *filename, const struct FileArchive *arc) +OpenedFile *Call_OpenFileAndGetFileDataPtr(const u8 *filename, const FileArchive *arc) { return OpenFileAndGetFileDataPtr(filename, arc); } -void CloseFile(struct OpenedFile *openedFile) +void CloseFile(OpenedFile *openedFile) { s32 i; - for (i = 0; i < 64; i++) - { - if (&gFileCache[i] == openedFile) - { + for (i = 0; i < 64; i++) { + if (&gFileCache[i] == openedFile) { gFileCache[i].file = NULL; gFileCache[i].data = NULL; - gFileCacheCursorPosition = i; + sFileCacheCursorPosition = i; return; } } -} - -u8 *GetSiroPtr(struct OpenedFile *openedFile) -{ - struct SiroArchive *siro = (struct SiroArchive *)openedFile->data; - - if (siro->magic == 0x30524953) - { - NDS_DecompressRLE(openedFile->data); - } - else if (siro->magic != 0x4F524953) - { - return openedFile->data; - } - - openedFile->data = siro->data; - - return openedFile->data; -} - -void *UnusedGetSir0Ptr(struct SiroArchive *siro) -{ - if (siro->magic != 0x30524953) - return siro; - - NDS_DecompressRLE(siro); - return siro->data; -} - -void NDS_DecompressRLE(void *unused) -{ -} - -void nullsub_16(void) -{ -} - -void nullsub_175(void) -{ -} - -u32 DecompressATFile(char *result, s32 resultLength, struct OpenedFile *file) -{ - return DecompressAT(result, resultLength, file->data); -} - -// 800AAB4 -u32 DecompressAT(char *result, s32 resultLength, const char *compressedData) -{ - s32 compressedLength = compressedData[5] + (compressedData[6] << 8); - s32 bytesWritten = 0; - s32 currentByte = 0; - s32 cmdBit = 8; - s32 curIndex; - s32 flags[9]; - s32 idxStart; - - if (compressedData[0] == 'A' - && compressedData[1] == 'T' - && compressedData[2] == '4' - && compressedData[3] == 'P') { - u32 tmp2 = compressedData[0x10] + (compressedData[0x11] << 8); - if (resultLength != 0 && resultLength != tmp2) - return 0; - idxStart = 0x12; - } else if (compressedData[0] == 'A' - && compressedData[1] == 'T' - && compressedData[2] == '3' - && compressedData[3] == 'P') { - idxStart = 0x10; - } else { - return 0; - } - - if (compressedData[4] == 'N') { - // uncompressed mode, unused - for (curIndex = 0; curIndex < compressedLength; curIndex++) { - result[curIndex] = compressedData[curIndex + 7]; - } - return curIndex; - } - - flags[0] = compressedData[0x7] + 3; - flags[1] = compressedData[0x8] + 3; - flags[2] = compressedData[0x9] + 3; - flags[3] = compressedData[0xa] + 3; - flags[4] = compressedData[0xb] + 3; - flags[5] = compressedData[0xc] + 3; - flags[6] = compressedData[0xd] + 3; - flags[7] = compressedData[0xe] + 3; - flags[8] = compressedData[0xf] + 3; - - curIndex = idxStart; - if (curIndex < compressedLength) { - - do { - if (resultLength != 0 && bytesWritten >= resultLength) - return 0; - - if (cmdBit == 8) { - currentByte = compressedData[curIndex++]; - cmdBit = 0; - } - if ((currentByte & 0x80) == 0) { - // if bit is unset, process command - u32 command = (compressedData[curIndex] >> 4) + 3; - u32 tmp = (compressedData[curIndex] & 0xf) << 8; - u32 c; - - if (command == flags[0]) command = 0x1f; - if (command == flags[1]) command = 0x1e; - if (command == flags[2]) command = 0x1d; - if (command == flags[3]) command = 0x1c; - if (command == flags[4]) command = 0x1b; - if (command == flags[5]) command = 0x1a; - if (command == flags[6]) command = 0x19; - if (command == flags[7]) command = 0x18; - if (command == flags[8]) command = 0x17; - - switch (command) { - case 0x1f: { // aaaa - c = compressedData[curIndex++] & 0xf; - result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); - result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); - break; - } - case 0x1e: { // abbb - u8 byte = compressedData[curIndex]; - c = 0xF; - c = byte & c; - curIndex++; - result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c + 1) & 0xf)); - result[bytesWritten++] = ((((c + 1) & 0xf) << 4) | ((c + 1) & 0xf)); - break; - } - case 0x1d: { // babb - c = compressedData[curIndex++] & 0xf; - result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c - 1) & 0xf)); - result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); - break; - } - case 0x1c: { // bbab - c = compressedData[curIndex++] & 0xf; - result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); - result[bytesWritten++] = ((((c - 1) & 0xf) << 4) | ((c + 0) & 0xf)); - break; - } - case 0x1b: { // bbba - c = compressedData[curIndex++] & 0xf; - result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); - result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c - 1) & 0xf)); - break; - } - case 0x1a: { // baaa -- the horrible, hard-to-match case - u8 byte = compressedData[curIndex]; - c = 0xF; - c = byte & c; - curIndex++; - result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c - 1) & 0xf)); - result[bytesWritten++] = ((((c - 1) & 0xf) << 4) | ((c - 1) & 0xf)); - break; - } - case 0x19: { // abaa - c = compressedData[curIndex++] & 0xf; - result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c + 1) & 0xf)); - result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); - break; - } - case 0x18: { // aaba - c = compressedData[curIndex++] & 0xf; - result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); - result[bytesWritten++] = ((((c + 1) & 0xf) << 4) | ((c + 0) & 0xf)); - break; - } - case 0x17: { // aaab - c = compressedData[curIndex++] & 0xf; - result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); - result[bytesWritten++] = ((((c + 0) & 0xf) << 4) | ((c + 1) & 0xf)); - break; - } - default: { - tmp += (compressedData[curIndex++, curIndex++]); - tmp += bytesWritten - 0x1000; - for(;command;command--) - { - result[bytesWritten++] = result[tmp]; - tmp++; - } - } - } - } else { - // if bit is set, just copy next byte - result[bytesWritten++] = (compressedData[curIndex]); - curIndex++; - } - cmdBit++; - currentByte <<= 1; - } while (curIndex < compressedLength); - } - - return bytesWritten; -} - -u32 DecompressATGlobalFile(u32 *result, s32 resultLength, struct OpenedFile *file) -{ - return DecompressATGlobal(result, resultLength, file->data); -} - -// 800AE34 -#ifndef NONMATCHING -NAKED -#endif -u32 DecompressATGlobal(u32 *result, s32 resultLength, const char *compressedData) -{ -#ifdef NONMATCHING - s32 compressedLength; - s32 curIndex; - s32 bytesWritten; - s32 cmdBit; - s32 currentByte; - s32 flags1; - s32 flags2; - s32 flags3; - s32 flags4; - s32 flags5; - s32 flags6; - s32 flags7; - s32 flags8; - s32 flags9; - u32 command; - u32 tmp; - u32 tmp2; - u32 c; - - compressedLength = compressedData[5] + (compressedData[6] << 8); - bytesWritten = 0; - currentByte = 0; - cmdBit = 8; - - DecompressAT_Init(result); - - if (compressedData[0] == 'A' - && compressedData[1] == 'T' - && compressedData[2] == '4' - && compressedData[3] == 'P') { - tmp2 = compressedData[0x10] + (compressedData[0x11] << 8); - if (resultLength != 0 && resultLength != tmp2) - return bytesWritten; - curIndex = 0x12; - } else if (compressedData[0] == 'A' - && compressedData[1] == 'T' - && compressedData[2] == '3' - && compressedData[3] == 'P') { - curIndex = 0x10; - } else { - return 0; - } - - if (compressedData[4] == 'N') { - // uncompressed mode, unused - for (bytesWritten = 0; bytesWritten < compressedLength; bytesWritten++) { - DecompressAT_AppendByte(compressedData[bytesWritten + 7]); - } - DecompressAT_Finish(); - return bytesWritten; - } - - flags1 = compressedData[0x7] + 3; - flags2 = compressedData[0x8] + 3; - flags3 = compressedData[0x9] + 3; - flags4 = compressedData[0xa] + 3; - flags5 = compressedData[0xb] + 3; - flags6 = compressedData[0xc] + 3; - flags7 = compressedData[0xd] + 3; - flags8 = compressedData[0xe] + 3; - flags9 = compressedData[0xf] + 3; - - if (curIndex < compressedLength) { - - do { - if (resultLength != 0 && bytesWritten >= resultLength) - return 0; - - if (cmdBit == 8) { - currentByte = compressedData[curIndex++]; - cmdBit = 0; - } - if ((currentByte & 0x80) == 0) { - // if bit is unset, process command - command = (compressedData[curIndex] >> 4) + 3; - tmp2 = (compressedData[curIndex] & 0xf) << 8; - - if (command == flags1) command = 0x1f; - if (command == flags2) command = 0x1e; - if (command == flags3) command = 0x1d; - if (command == flags4) command = 0x1c; - if (command == flags5) command = 0x1b; - if (command == flags6) command = 0x1a; - if (command == flags7) command = 0x19; - if (command == flags8) command = 0x18; - if (command == flags9) command = 0x17; - - switch (command) { - case 0x1f: { // aaaa - c = compressedData[curIndex++] & 0xf; - DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); bytesWritten++; - DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); bytesWritten++; - break; - } - case 0x1e: { // abbb - c = compressedData[curIndex++] & 0xf; - DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c + 1) & 0xf)); bytesWritten++; - DecompressAT_AppendByte((((c + 1) & 0xf) << 4) | ((c + 1) & 0xf)); bytesWritten++; - break; - } - case 0x1d: { // babb - c = compressedData[curIndex++] & 0xf; - DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c - 1) & 0xf)); bytesWritten++; - DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); bytesWritten++; - break; - } - case 0x1c: { // bbab - c = compressedData[curIndex++] & 0xf; - DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); bytesWritten++; - DecompressAT_AppendByte((((c - 1) & 0xf) << 4) | ((c + 0) & 0xf)); bytesWritten++; - break; - } - case 0x1b: { // bbba - c = compressedData[curIndex++] & 0xf; - DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); bytesWritten++; - DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c - 1) & 0xf)); bytesWritten++; - break; - } - case 0x1a: { // baaa -- the horrible, unmatching case - c = compressedData[curIndex++] & 0xf; - DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c - 1) & 0xf)); bytesWritten++; - c -= 1; - DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); bytesWritten++; - break; - } - case 0x19: { // abaa - c = compressedData[curIndex++] & 0xf; - DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c + 1) & 0xf)); bytesWritten++; - DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); bytesWritten++; - break; - } - case 0x18: { // aaba - c = compressedData[curIndex++] & 0xf; - DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); bytesWritten++; - DecompressAT_AppendByte((((c + 1) & 0xf) << 4) | ((c + 0) & 0xf)); bytesWritten++; - break; - } - case 0x17: { // aaab - c = compressedData[curIndex++] & 0xf; - DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c + 0) & 0xf)); bytesWritten++; - DecompressAT_AppendByte((((c + 0) & 0xf) << 4) | ((c + 1) & 0xf)); bytesWritten++; - break; - } - default: { - tmp = compressedData[curIndex++, curIndex++] + tmp2 - 0x1000 + bytesWritten; - for (; command != 0; tmp++, command--) { - DecompressAT_AppendByte(DecompressAT_GetByte(tmp)); bytesWritten++; - } - } - } - } else { - // if bit is set, just copy next byte - DecompressAT_AppendByte(compressedData[curIndex]); bytesWritten++; - curIndex++; - } - cmdBit++; - currentByte <<= 1; - } while (curIndex < compressedLength); - DecompressAT_Finish(); - } - - return bytesWritten; -#else - asm_unified( - "DecompressATGlobal:\n" - " push {r4-r7,lr}\n" - " mov r7, r10\n" - " mov r6, r9\n" - " mov r5, r8\n" - " push {r5-r7}\n" - " sub sp, 0x34\n" - " str r1, [sp, 0x24]\n" - " mov r10, r2\n" - " ldrb r2, [r2, 0x5]\n" - " mov r3, r10\n" - " ldrb r1, [r3, 0x6]\n" - " lsls r1, 8\n" - " adds r2, r1\n" - " str r2, [sp, 0x28]\n" - " movs r1, 0\n" - " mov r9, r1\n" - " movs r2, 0\n" - " str r2, [sp, 0x2C]\n" - " movs r3, 0x8\n" - " str r3, [sp, 0x30]\n" - " bl DecompressAT_Init\n" - " mov r1, r10\n" - " ldrb r0, [r1]\n" - " cmp r0, 0x41\n" - " bne _0800AE90\n" - " ldrb r0, [r1, 0x1]\n" - " adds r1, r0, 0\n" - " cmp r1, 0x54\n" - " bne _0800AE98\n" - " mov r2, r10\n" - " ldrb r0, [r2, 0x2]\n" - " cmp r0, 0x34\n" - " bne _0800AE98\n" - " ldrb r0, [r2, 0x3]\n" - " cmp r0, 0x50\n" - " bne _0800AE98\n" - " ldrb r1, [r2, 0x10]\n" - " ldrb r0, [r2, 0x11]\n" - " lsls r0, 8\n" - " adds r1, r0\n" - " ldr r3, [sp, 0x24]\n" - " cmp r3, 0\n" - " beq _0800AE94\n" - " cmp r3, r1\n" - " beq _0800AE94\n" - "_0800AE90:\n" - " movs r0, 0\n" - " b _0800B1AA\n" - "_0800AE94:\n" - " movs r1, 0x12\n" - " b _0800AEB2\n" - "_0800AE98:\n" - " mov r2, r10\n" - " ldrb r0, [r2]\n" - " cmp r0, 0x41\n" - " bne _0800AE90\n" - " cmp r1, 0x54\n" - " bne _0800AE90\n" - " ldrb r0, [r2, 0x2]\n" - " cmp r0, 0x33\n" - " bne _0800AE90\n" - " ldrb r0, [r2, 0x3]\n" - " cmp r0, 0x50\n" - " bne _0800AE90\n" - " movs r1, 0x10\n" - "_0800AEB2:\n" - " mov r3, r10\n" - " ldrb r0, [r3, 0x4]\n" - " cmp r0, 0x4E\n" - " bne _0800AEE0\n" - " movs r0, 0\n" - " mov r8, r0\n" - " ldr r1, [sp, 0x28]\n" - " cmp r8, r1\n" - " bge _0800AED8\n" - "_0800AEC4:\n" - " mov r0, r8\n" - " add r0, r10\n" - " ldrb r0, [r0, 0x7]\n" - " bl DecompressAT_AppendByte\n" - " movs r2, 0x1\n" - " add r8, r2\n" - " ldr r3, [sp, 0x28]\n" - " cmp r8, r3\n" - " blt _0800AEC4\n" - "_0800AED8:\n" - " bl DecompressAT_Finish\n" - " mov r0, r8\n" - " b _0800B1AA\n" - "_0800AEE0:\n" - " mov r2, r10\n" - " ldrb r0, [r2, 0x7]\n" - " adds r0, 0x3\n" - " str r0, [sp]\n" - " ldrb r0, [r2, 0x8]\n" - " adds r0, 0x3\n" - " str r0, [sp, 0x4]\n" - " ldrb r0, [r2, 0x9]\n" - " adds r0, 0x3\n" - " str r0, [sp, 0x8]\n" - " ldrb r0, [r2, 0xA]\n" - " adds r0, 0x3\n" - " str r0, [sp, 0xC]\n" - " ldrb r0, [r2, 0xB]\n" - " adds r0, 0x3\n" - " str r0, [sp, 0x10]\n" - " ldrb r0, [r2, 0xC]\n" - " adds r0, 0x3\n" - " str r0, [sp, 0x14]\n" - " ldrb r0, [r2, 0xD]\n" - " adds r0, 0x3\n" - " str r0, [sp, 0x18]\n" - " ldrb r0, [r2, 0xE]\n" - " adds r0, 0x3\n" - " str r0, [sp, 0x1C]\n" - " ldrb r0, [r2, 0xF]\n" - " adds r0, 0x3\n" - " str r0, [sp, 0x20]\n" - " mov r8, r1\n" - " ldr r3, [sp, 0x28]\n" - " cmp r8, r3\n" - " blt _0800AF22\n" - " b _0800B1A4\n" - "_0800AF22:\n" - " ldr r0, [sp, 0x24]\n" - " cmp r0, 0\n" - " beq _0800AF2C\n" - " cmp r9, r0\n" - " bge _0800AE90\n" - "_0800AF2C:\n" - " ldr r1, [sp, 0x30]\n" - " cmp r1, 0x8\n" - " bne _0800AF42\n" - " mov r0, r10\n" - " add r0, r8\n" - " ldrb r0, [r0]\n" - " str r0, [sp, 0x2C]\n" - " movs r2, 0x1\n" - " add r8, r2\n" - " movs r3, 0\n" - " str r3, [sp, 0x30]\n" - "_0800AF42:\n" - " movs r0, 0x80\n" - " ldr r1, [sp, 0x2C]\n" - " ands r0, r1\n" - " cmp r0, 0\n" - " beq _0800AF4E\n" - " b _0800B180\n" - "_0800AF4E:\n" - " mov r2, r10\n" - " add r2, r8\n" - " ldrb r1, [r2]\n" - " lsrs r0, r1, 4\n" - " adds r3, r0, 0x3\n" - " movs r0, 0xF\n" - " ands r0, r1\n" - " lsls r7, r0, 8\n" - " ldr r0, [sp]\n" - " cmp r3, r0\n" - " bne _0800AF66\n" - " movs r3, 0x1F\n" - "_0800AF66:\n" - " ldr r0, [sp, 0x4]\n" - " cmp r3, r0\n" - " bne _0800AF6E\n" - " movs r3, 0x1E\n" - "_0800AF6E:\n" - " ldr r0, [sp, 0x8]\n" - " cmp r3, r0\n" - " bne _0800AF76\n" - " movs r3, 0x1D\n" - "_0800AF76:\n" - " ldr r0, [sp, 0xC]\n" - " cmp r3, r0\n" - " bne _0800AF7E\n" - " movs r3, 0x1C\n" - "_0800AF7E:\n" - " ldr r0, [sp, 0x10]\n" - " cmp r3, r0\n" - " bne _0800AF86\n" - " movs r3, 0x1B\n" - "_0800AF86:\n" - " ldr r0, [sp, 0x14]\n" - " cmp r3, r0\n" - " bne _0800AF8E\n" - " movs r3, 0x1A\n" - "_0800AF8E:\n" - " ldr r0, [sp, 0x18]\n" - " cmp r3, r0\n" - " bne _0800AF96\n" - " movs r3, 0x19\n" - "_0800AF96:\n" - " ldr r0, [sp, 0x1C]\n" - " cmp r3, r0\n" - " bne _0800AF9E\n" - " movs r3, 0x18\n" - "_0800AF9E:\n" - " ldr r0, [sp, 0x20]\n" - " cmp r3, r0\n" - " bne _0800AFA6\n" - " movs r3, 0x17\n" - "_0800AFA6:\n" - " adds r0, r3, 0\n" - " subs r0, 0x17\n" - " cmp r0, 0x8\n" - " bls _0800AFB0\n" - " b _0800B13C\n" - "_0800AFB0:\n" - " lsls r0, 2\n" - " ldr r1, _0800AFBC\n" - " adds r0, r1\n" - " ldr r0, [r0]\n" - " mov pc, r0\n" - " .align 2, 0\n" - "_0800AFBC: .4byte _0800AFC0\n" - " .align 2, 0\n" - "_0800AFC0:\n" - " .4byte _0800B104\n" - " .4byte _0800B0DE\n" - " .4byte _0800B0BA\n" - " .4byte _0800B090\n" - " .4byte _0800B06E\n" - " .4byte _0800B048\n" - " .4byte _0800B024\n" - " .4byte _0800AFFE\n" - " .4byte _0800AFE4\n" - "_0800AFE4:\n" - " ldrb r0, [r2]\n" - " movs r1, 0xF\n" - " movs r2, 0x1\n" - " add r8, r2\n" - " ands r1, r0\n" - " lsls r4, r1, 4\n" - " orrs r4, r1\n" - " adds r0, r4, 0\n" - " bl DecompressAT_AppendByte\n" - " movs r3, 0x1\n" - " add r9, r3\n" - " b _0800B128\n" - "_0800AFFE:\n" - " ldrb r0, [r2]\n" - " movs r6, 0xF\n" - " ands r6, r0\n" - " movs r2, 0x1\n" - " add r8, r2\n" - " movs r1, 0xF\n" - " lsls r0, r6, 4\n" - " adds r4, r6, 0x1\n" - " ands r4, r1\n" - " orrs r0, r4\n" - " bl DecompressAT_AppendByte\n" - " movs r3, 0x1\n" - " add r9, r3\n" - " lsls r0, r4, 4\n" - " orrs r0, r4\n" - " lsls r0, 24\n" - " lsrs r0, 24\n" - " b _0800B12A\n" - "_0800B024:\n" - " ldrb r0, [r2]\n" - " movs r1, 0xF\n" - " movs r6, 0xF\n" - " ands r6, r0\n" - " movs r2, 0x1\n" - " add r8, r2\n" - " adds r5, r6, 0\n" - " ands r5, r1\n" - " lsls r4, r5, 4\n" - " subs r0, r6, 0x1\n" - " ands r0, r1\n" - " orrs r0, r4\n" - " bl DecompressAT_AppendByte\n" - " movs r3, 0x1\n" - " add r9, r3\n" - " orrs r4, r5\n" - " b _0800B128\n" - "_0800B048:\n" - " ldrb r0, [r2]\n" - " movs r5, 0xF\n" - " movs r6, 0xF\n" - " ands r6, r0\n" - " movs r2, 0x1\n" - " add r8, r2\n" - " adds r4, r6, 0\n" - " ands r4, r5\n" - " lsls r0, r4, 4\n" - " orrs r0, r4\n" - " bl DecompressAT_AppendByte\n" - " movs r3, 0x1\n" - " add r9, r3\n" - " subs r0, r6, 0x1\n" - " ands r0, r5\n" - " lsls r0, 4\n" - " orrs r0, r4\n" - " b _0800B12A\n" - "_0800B06E:\n" - " ldrb r0, [r2]\n" - " movs r5, 0xF\n" - " movs r6, 0xF\n" - " ands r6, r0\n" - " movs r2, 0x1\n" - " add r8, r2\n" - " adds r1, r6, 0\n" - " ands r1, r5\n" - " lsls r4, r1, 4\n" - " adds r0, r4, 0\n" - " orrs r0, r1\n" - " bl DecompressAT_AppendByte\n" - " movs r3, 0x1\n" - " add r9, r3\n" - " subs r0, r6, 0x1\n" - " b _0800B124\n" - "_0800B090:\n" - " ldrb r0, [r2]\n" - " movs r6, 0xF\n" - " ands r6, r0\n" - " movs r2, 0x1\n" - " add r8, r2\n" - " movs r1, 0xF\n" - " lsls r0, r6, 4\n" - " subs r4, r6, 0x1\n" - " ands r4, r1\n" - " orrs r0, r4\n" - " lsls r0, 24\n" - " lsrs r0, 24\n" - " bl DecompressAT_AppendByte\n" - " movs r3, 0x1\n" - " add r9, r3\n" - " lsls r0, r4, 4\n" - " orrs r0, r4\n" - " lsls r0, 24\n" - " lsrs r0, 24\n" - " b _0800B12A\n" - "_0800B0BA:\n" - " ldrb r0, [r2]\n" - " movs r1, 0xF\n" - " movs r6, 0xF\n" - " ands r6, r0\n" - " movs r2, 0x1\n" - " add r8, r2\n" - " adds r5, r6, 0\n" - " ands r5, r1\n" - " lsls r4, r5, 4\n" - " adds r0, r6, 0x1\n" - " ands r0, r1\n" - " orrs r0, r4\n" - " bl DecompressAT_AppendByte\n" - " movs r3, 0x1\n" - " add r9, r3\n" - " orrs r4, r5\n" - " b _0800B128\n" - "_0800B0DE:\n" - " ldrb r0, [r2]\n" - " movs r5, 0xF\n" - " movs r6, 0xF\n" - " ands r6, r0\n" - " movs r2, 0x1\n" - " add r8, r2\n" - " adds r4, r6, 0\n" - " ands r4, r5\n" - " lsls r0, r4, 4\n" - " orrs r0, r4\n" - " bl DecompressAT_AppendByte\n" - " movs r3, 0x1\n" - " add r9, r3\n" - " adds r0, r6, 0x1\n" - " ands r0, r5\n" - " lsls r0, 4\n" - " orrs r0, r4\n" - " b _0800B12A\n" - "_0800B104:\n" - " ldrb r0, [r2]\n" - " movs r5, 0xF\n" - " movs r6, 0xF\n" - " ands r6, r0\n" - " movs r2, 0x1\n" - " add r8, r2\n" - " adds r1, r6, 0\n" - " ands r1, r5\n" - " lsls r4, r1, 4\n" - " adds r0, r4, 0\n" - " orrs r0, r1\n" - " bl DecompressAT_AppendByte\n" - " movs r3, 0x1\n" - " add r9, r3\n" - " adds r0, r6, 0x1\n" - "_0800B124:\n" - " ands r0, r5\n" - " orrs r4, r0\n" - "_0800B128:\n" - " adds r0, r4, 0\n" - "_0800B12A:\n" - " bl DecompressAT_AppendByte\n" - " movs r0, 0x1\n" - " add r9, r0\n" - " ldr r5, [sp, 0x30]\n" - " adds r5, 0x1\n" - " ldr r1, [sp, 0x2C]\n" - " lsls r4, r1, 1\n" - " b _0800B198\n" - "_0800B13C:\n" - " movs r2, 0x1\n" - " add r8, r2\n" - " mov r0, r10\n" - " add r0, r8\n" - " ldrb r0, [r0]\n" - " adds r7, r0\n" - " add r8, r2\n" - " ldr r1, _0800B17C\n" - " adds r0, r7, r1\n" - " mov r2, r9\n" - " adds r7, r0, r2\n" - " ldr r5, [sp, 0x30]\n" - " adds r5, 0x1\n" - " ldr r0, [sp, 0x2C]\n" - " lsls r4, r0, 1\n" - " cmp r3, 0\n" - " beq _0800B198\n" - " adds r6, r3, 0\n" - "_0800B160:\n" - " adds r0, r7, 0\n" - " bl DecompressAT_GetByte\n" - " lsls r0, 24\n" - " lsrs r0, 24\n" - " bl DecompressAT_AppendByte\n" - " movs r1, 0x1\n" - " add r9, r1\n" - " adds r7, 0x1\n" - " subs r6, 0x1\n" - " cmp r6, 0\n" - " bne _0800B160\n" - " b _0800B198\n" - " .align 2, 0\n" - "_0800B17C: .4byte 0xfffff000\n" - "_0800B180:\n" - " mov r0, r10\n" - " add r0, r8\n" - " ldrb r0, [r0]\n" - " bl DecompressAT_AppendByte\n" - " movs r2, 0x1\n" - " add r9, r2\n" - " add r8, r2\n" - " ldr r5, [sp, 0x30]\n" - " adds r5, 0x1\n" - " ldr r3, [sp, 0x2C]\n" - " lsls r4, r3, 1\n" - "_0800B198:\n" - " str r5, [sp, 0x30]\n" - " str r4, [sp, 0x2C]\n" - " ldr r0, [sp, 0x28]\n" - " cmp r8, r0\n" - " bge _0800B1A4\n" - " b _0800AF22\n" - "_0800B1A4:\n" - " bl DecompressAT_Finish\n" - " mov r0, r9\n" - "_0800B1AA:\n" - " add sp, 0x34\n" - " pop {r3-r5}\n" - " mov r8, r3\n" - " mov r9, r4\n" - " mov r10, r5\n" - " pop {r4-r7}\n" - " pop {r1}\n" - " bx r1"); -#endif -} - -// 800B1BC -void DecompressAT_Init(u32 *buffer) { - gDecompressBufferPtr = buffer; - gDecompressBufferStart = buffer; - gDecompressBufferCurrent = 0; - gDecompressBufferByteInInt = 0; -} - -// 800B1E0 -char DecompressAT_GetByte(int index) { - u32 data; - int offset; - - offset = index < 0 ? index + 3 : index; - data = gDecompressBufferStart[offset >> 2]; - - switch (index & 3) { - case 0: return data; - case 1: return data >> 8; - case 2: return data >> 16; - case 3: return data >> 24; - } - - return data; -} - -// 800B220 -void DecompressAT_AppendByte(char value) { - gDecompressBufferCurrent |= value << gByteShiftLookup[gDecompressBufferByteInInt]; - *gDecompressBufferPtr = gDecompressBufferCurrent; - gDecompressBufferByteInInt++; - if (gDecompressBufferByteInInt == 4) { - gDecompressBufferPtr++; - gDecompressBufferCurrent = 0; - gDecompressBufferByteInInt = 0; - } -} - -// 800B270 -void DecompressAT_Finish(void) { - if (gDecompressBufferByteInInt) - *gDecompressBufferPtr = gDecompressBufferCurrent; -} - -// 800B294 -bool32 IsATxPCompressed_unused(char *data) { - if ((data[0] == 'A' && data[1] == 'T' && data[2] == '4' && data[3] == 'P')) return TRUE; - if ((data[0] == 'A' && data[1] == 'T' && data[2] == '3' && data[3] == 'P')) return TRUE; - return FALSE; -} - -// 800B2D4 -bool32 sub_800B2D4(char *arg0, char *arg1, int length) { - int i; - char a, b; - for (i = 0; i < length; i++) { - a = arg0[i]; - b = arg1[i]; - // convert to lowercase - if ('A' <= a && a <= 'Z') a += 0x20; - if ('A' <= b && b <= 'Z') b += 0x20; - if (a != b) - return TRUE; - if (a == '\0') - break; - } - return FALSE; -} - -// Has to be down here to match (rodata ordering) -ALIGNED(4) const char file_filler[] = _("pksdir0"); -const u32 gByteShiftLookup[4] = {0, 8, 16, 24}; -ALIGNED(4) const char file_filler1[] = _("pksdir0"); -ALIGNED(4) const char file_filler2[] = _("pksdir0"); - +} \ No newline at end of file diff --git a/src/friend_area.c b/src/friend_area.c index 652fc4ba4..14ba10cbd 100644 --- a/src/friend_area.c +++ b/src/friend_area.c @@ -1,388 +1,93 @@ #include "global.h" +#include "code_800D090.h" +#include "code_8092334.h" #include "constants/dungeon.h" #include "constants/friend_area.h" #include "friend_area.h" +#include "items.h" #include "pokemon.h" -#include "code_800D090.h" -EWRAM_DATA bool8 gBoughtFriendAreas[NUM_FRIEND_AREAS] = {0}; +EWRAM_DATA static bool8 sBoughtFriendAreas[NUM_FRIEND_AREAS] = {0}; + EWRAM_DATA_2 bool8 *gFriendAreas = {0}; - -extern bool8 *gFriendAreas; - -extern u8 *gFriendAreaDescriptions[]; -extern const char *gFriendAreaNames[]; -extern const char gUnknown_81098A4; -extern const char gUnknown_81098AC; - -extern void sub_8090FEC(u32, u8 *r1, u32); - -const struct FriendAreaSettings gFriendAreaSettings[NUM_FRIEND_AREAS] = -{ - [NONE] = { - .num_pokemon = 0, - .unlock_condition = UNLOCK_SHOP_STORY, - .price = 0, - }, - [BOUNTIFUL_SEA] = { - .num_pokemon = 9, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 5500, - }, - [TREASURE_SEA] = { - .num_pokemon = 10, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 4500, - }, - [SERENE_SEA] = { - .num_pokemon = 4, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 8000, - }, - [DEEP_SEA_FLOOR] = { - .num_pokemon = 12, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 5500, - }, - [DEEP_SEA_CURRENT] = { - .num_pokemon = 1, - .unlock_condition = UNLOCK_LEGENDARY_REQUEST, - .price = 0, - }, - [SEAFLOOR_CAVE] = { - .num_pokemon = 1, - .unlock_condition = UNLOCK_LEGENDARY_REQUEST, - .price = 0, - }, - [SHALLOW_BEACH] = { - .num_pokemon = 5, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 5000, - }, - [MT_DEEPGREEN] = { - .num_pokemon = 12, - .unlock_condition = UNLOCK_SHOP_STORY, - .price = 130, - }, - [MT_CLEFT] = { - .num_pokemon = 9, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 5000, - }, - [MT_MOONVIEW] = { - .num_pokemon = 6, - .unlock_condition = UNLOCK_WONDER_MAIL, - .price = 0, - }, - [RAINBOW_PEAK] = { - .num_pokemon = 1, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 6500, - }, - [WILD_PLAINS] = { - .num_pokemon = 13, - .unlock_condition = UNLOCK_SHOP_STORY, - .price = 100, - }, - [BEAU_PLAINS] = { - .num_pokemon = 12, - .unlock_condition = UNLOCK_SHOP_STORY, - .price = 600, - }, - [SKY_BLUE_PLAINS] = { - .num_pokemon = 13, - .unlock_condition = UNLOCK_WONDER_MAIL, - .price = 0, - }, - [SAFARI] = { - .num_pokemon = 15, - .unlock_condition = UNLOCK_SHOP_STORY, - .price = 700, - }, - [SCORCHED_PLAINS] = { - .num_pokemon = 10, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 5000, - }, - [SACRED_FIELD] = { - .num_pokemon = 3, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 6500 - }, - [MIST_RISE_FOREST] = { - .num_pokemon = 14, - .unlock_condition = UNLOCK_SHOP_STORY, - .price = 150 - }, - [FLYAWAY_FOREST] = { - .num_pokemon = 12, - .unlock_condition = UNLOCK_SHOP_STORY, - .price = 550 - }, - [OVERGROWN_FOREST] = { - .num_pokemon = 9, - .unlock_condition = UNLOCK_SHOP_STORY, - .price = 600 - }, - [ENERGETIC_FOREST] = { - .num_pokemon = 15, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 5000 - }, - [MUSHROOM_FOREST] = { - .num_pokemon = 7, - .unlock_condition = UNLOCK_SHOP_STORY, - .price = 500 - }, - [HEALING_FOREST] = { - .num_pokemon = 1, - .unlock_condition = UNLOCK_LEGENDARY_REQUEST, - .price = 0 - }, - [TRANSFORM_FOREST] = { - .num_pokemon = 6, - .unlock_condition = UNLOCK_SHOP_STORY, - .price = 500 - }, - [SECRETIVE_FOREST] = { - .num_pokemon = 9, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 6500 - }, - [RUB_A_DUB_RIVER] = { - .num_pokemon = 7, - .unlock_condition = UNLOCK_SHOP_STORY, - .price = 500 - }, - [TADPOLE_POND] = { - .num_pokemon = 9, - .unlock_condition = UNLOCK_SHOP_STORY, - .price = 500 - }, - [TURTLESHELL_POND] = { - .num_pokemon = 10, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 5500 - }, - [MYSTIC_LAKE] = { - .num_pokemon = 4, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 2500 - }, - [WATERFALL_LAKE] = { - .num_pokemon = 4, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 3500 - }, - [PEANUT_SWAMP] = { - .num_pokemon = 7, - .unlock_condition = UNLOCK_SHOP_STORY, - .price = 2500 - }, - [POISON_SWAMP] = { - .num_pokemon = 6, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 8500 - }, - [ECHO_CAVE] = { - .num_pokemon = 11, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 7500 - }, - [CRYPTIC_CAVE] = { - .num_pokemon = 1, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 6500 - }, - [DRAGON_CAVE] = { - .num_pokemon = 3, - .unlock_condition = UNLOCK_WONDER_MAIL, - .price = 0 - }, - [BOULDER_CAVE] = { - .num_pokemon = 4, - .unlock_condition = UNLOCK_WONDER_MAIL, - .price = 0 - }, - [JUNGLE] = { - .num_pokemon = 13, - .unlock_condition = UNLOCK_SHOP_STORY, - .price = 800 - }, - [DECREPIT_LAB] = { - .num_pokemon = 7, - .unlock_condition = UNLOCK_SHOP_STORY, - .price = 1000 - }, - [MT_DISCIPLINE] = { - .num_pokemon = 11, - .unlock_condition = UNLOCK_SHOP_STORY, - .price = 1200 - }, - [THUNDER_MEADOW] = { - .num_pokemon = 11, - .unlock_condition = UNLOCK_SHOP_STORY, - .price = 1000 - }, - [POWER_PLANT] = { - .num_pokemon = 6, - .unlock_condition = UNLOCK_SHOP_STORY, - .price = 600 - }, - [CRATER] = { - .num_pokemon = 7, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 7500 - }, - [FURNACE_DESERT] = { - .num_pokemon = 7, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 8500 - }, - [AGED_CHAMBER_AN] = { - .num_pokemon = 14, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 5500 - }, - [AGED_CHAMBER_O_EXCLAIM] = { - .num_pokemon = 14, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 5500 - }, - [ANCIENT_RELIC] = { - .num_pokemon = 6, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 8000 - }, - [DARKNESS_RIDGE] = { - .num_pokemon = 13, - .unlock_condition = UNLOCK_LEGENDARY_REQUEST, - .price = 0 - }, - [FRIGID_CAVERN] = { - .num_pokemon = 7, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 9000 - }, - [ICE_FLOE_BEACH] = { - .num_pokemon = 5, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 9500 - }, - [VOLCANIC_PIT] = { - .num_pokemon = 1, - .unlock_condition = UNLOCK_LEGENDARY_REQUEST, - .price = 0 - }, - [STRATOS_LOOKOUT] = { - .num_pokemon = 1, - .unlock_condition = UNLOCK_LEGENDARY_REQUEST, - .price = 0 - }, - [RAVAGED_FIELD] = { - .num_pokemon = 5, - .unlock_condition = UNLOCK_SHOP_STORY, - .price = 1000 - }, - [MAGNETIC_QUARRY] = { - .num_pokemon = 3, - .unlock_condition = UNLOCK_SHOP_STORY, - .price = 1000 - }, - [LEGENDARY_ISLAND] = { - .num_pokemon = 3, - .unlock_condition = UNLOCK_LEGENDARY_REQUEST, - .price = 7500 - }, - [SOUTHERN_ISLAND] = { - .num_pokemon = 2, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 9500 - }, - [ENCLOSED_ISLAND] = { - .num_pokemon = 1, - .unlock_condition = UNLOCK_LEGENDARY_REQUEST, - .price = 0 - }, - [FINAL_ISLAND] = { - .num_pokemon = 1, - .unlock_condition = UNLOCK_SHOP_POST_GAME, - .price = 8500 - }, -}; +// data_8107010.s +extern const u8 sUnknown_81098A4[]; +extern const u8 sUnknown_81098AC[]; +#include "data/friend_area_settings.h" // 810AA90 +// data_810AE24.s +extern const u8 *sFriendAreaNames[]; // 81139D0 +extern const u8 *sFriendAreaDescriptions[]; // 8113E30 void LoadFriendAreas(void) { - gFriendAreas = gBoughtFriendAreas; + gFriendAreas = sBoughtFriendAreas; } bool8 *GetBoughtFriendAreas(void) { - return gBoughtFriendAreas; + return sBoughtFriendAreas; } void InitializeFriendAreas(void) { - s32 counter; - for(counter = 0; counter < NUM_FRIEND_AREAS; counter++) - { - gFriendAreas[counter] = FALSE; - } + s32 i; + + for (i = 0; i < NUM_FRIEND_AREAS; i++) + gFriendAreas[i] = FALSE; } u8 sub_80923D4(s32 target) { - s32 counter; + s32 i; s32 sum = 0; - for(counter = 0; counter < NUM_FRIEND_AREAS; counter++) - { - sum += gFriendAreaSettings[counter].num_pokemon; - if(sum > target) - { - return counter; - } + + for (i = 0; i < NUM_FRIEND_AREAS; i++) { + sum += sFriendAreaSettings[i].num_pokemon; + if (sum > target) + return i; } + return 0; } -#ifdef NONMATCHING +#ifdef NONMATCHING // 96.99% https://decomp.me/scratch/pj7Q5 void sub_8092404(u8 r0, u16 *r1, bool8 r2, bool8 r3) { - s32 counter; + s32 i; bool32 flag; - s32 r6; - struct PokemonStruct *pokemon; + s32 count; + PokemonStruct1 *pokemon; - r6 = 0; - for(counter = 0; counter <= 412; counter++) - { - pokemon = &gRecruitedPokemonRef->pokemon[counter]; - if((u8)(pokemon->unk0) & 1) - { - if((pokemon->isTeamLeader == 0) || r2) - { - flag = pokemon->dungeonLocation.id == DUNGEON_JOIN_LOCATION_PARTNER; - if(!flag || r3) - { - if(sub_80923D4(counter) == r0) - { - if(r6 <= 15) - { - r1[r6] = counter; - r6++; - } - } - } - } - } + count = 0; + + for (i = 0; i < NUM_MONSTERS; i++) { + pokemon = &gRecruitedPokemonRef->pokemon[i]; + + if (!((u8)pokemon->unk0 & 1)) + continue; + if (pokemon->isTeamLeader && !r2) + continue; + + flag = pokemon->dungeonLocation.id == DUNGEON_JOIN_LOCATION_PARTNER; + if (flag && !r3) + continue; + if (sub_80923D4(i) != r0) + continue; + if (count > 15) + continue; + + r1[count] = i; + count++; } - r1[r6] = 0xffff; + + r1[count] = 0xFFFF; } #else -NAKED void sub_8092404(u8 r0, u16 *r1, bool8 r2, bool8 r3) +NAKED +void sub_8092404(u8 r0, u16 *r1, bool8 r2, bool8 r3) { - asm_unified("\tpush {r4-r7,lr}\n" + asm_unified("push {r4-r7,lr}\n" "\tmov r7, r10\n" "\tmov r6, r9\n" "\tmov r5, r8\n" @@ -462,77 +167,72 @@ NAKED void sub_8092404(u8 r0, u16 *r1, bool8 r2, bool8 r3) "_08092494: .4byte gRecruitedPokemonRef\n" "_08092498: .4byte 0x0000ffff"); } -#endif +#endif // NONMATCHING void sub_809249C(u8 friendArea, bool8 clear) { - s32 index; + s32 i; bool32 dungeonCheck; bool32 isTeamLeader; - if(!gFriendAreas[friendArea]) + if (!gFriendAreas[friendArea]) return; - for(index = 0; index < NUM_MONSTERS; index++) - { - struct PokemonStruct *pokemon = &gRecruitedPokemonRef->pokemon[index]; - - if((u8)(pokemon->unk0) & 1) - { - if(sub_80923D4(index) == friendArea) - { - dungeonCheck = pokemon->dungeonLocation.id == DUNGEON_JOIN_LOCATION_PARTNER; - if(dungeonCheck || (isTeamLeader = pokemon->isTeamLeader != FALSE, isTeamLeader)) - clear = FALSE; - else - pokemon->unk0 = 0; - } - } + + for (i = 0; i < NUM_MONSTERS; i++) { + PokemonStruct1 *pokemon = &gRecruitedPokemonRef->pokemon[i]; + + if (!((u8)pokemon->unk0 & 1)) + continue; + if (sub_80923D4(i) != friendArea) + continue; + + dungeonCheck = pokemon->dungeonLocation.id == DUNGEON_JOIN_LOCATION_PARTNER; + if (dungeonCheck || (isTeamLeader = pokemon->isTeamLeader != FALSE, isTeamLeader)) + clear = FALSE; + else + pokemon->unk0 = 0; } - if(clear) - { + + if (clear) gFriendAreas[friendArea] = FALSE; - } } -const char *GetFriendAreaName(u8 index) +const u8 *GetFriendAreaName(u8 index) { - return gFriendAreaNames[index]; + return sFriendAreaNames[index]; } u8 GetFriendAreaUnlockCondition(u8 index) { - return gFriendAreaSettings[index].unlock_condition; + return sFriendAreaSettings[index].unlock_condition; } s32 GetFriendAreaPrice(u8 index) { - return gFriendAreaSettings[index].price; + return sFriendAreaSettings[index].price; } void sub_8092558(u8 *buffer, u8 index) { - // colors the friend area name green and prints to buffer? - sprintfStatic(buffer, &gUnknown_81098A4, gFriendAreaNames[index]); + sprintfStatic(buffer, sUnknown_81098A4, sFriendAreaNames[index]); } void sub_8092578(u8 *buffer, u8 index, bool8 printPrice) { // I think this is when we buy the friend area from wigglytuff - u8 priceBuffer[0x14]; - if(printPrice) - { - sub_8090FEC(gFriendAreaSettings[index].price, priceBuffer, 1); - sprintfStatic(buffer, &gUnknown_81098AC, gFriendAreaNames[index], 96, priceBuffer); + u8 priceBuffer[20]; + + if (printPrice) { + sub_8090FEC(sFriendAreaSettings[index].price, priceBuffer, 1); + sprintfStatic(buffer, sUnknown_81098AC, sFriendAreaNames[index], 96, priceBuffer); } else - { - strcpy(buffer, gFriendAreaNames[index]); - } + strcpy(buffer, sFriendAreaNames[index]); } -u8 *GetFriendAreaDescription(u8 index) +const u8 *GetFriendAreaDescription(u8 index) { - return gFriendAreaDescriptions[index]; + return sFriendAreaDescriptions[index]; } void UnlockFriendArea(u8 index) @@ -547,43 +247,40 @@ bool8 GetFriendAreaStatus(u8 index) bool8 HasAllFriendAreas(void) { - s32 counter; - for(counter = 1; counter < NUM_FRIEND_AREAS; counter++) - { - if(!gFriendAreas[counter]) - { + s32 i; + + for (i = 1; i < NUM_FRIEND_AREAS; i++) { + if (!gFriendAreas[i]) return FALSE; - } } + return TRUE; } -void sub_8092638(u8 friendArea, struct unkStruct_8092638 *param_2, bool8 checkLeader, bool8 checkDungeon) +void sub_8092638(u8 friendArea, unkStruct_8092638 *param_2, bool8 checkLeader, bool8 checkDungeon) { - struct PokemonStruct *pokeStruct; - s32 counter; + PokemonStruct1 *pokeStruct; + s32 i; s32 iVar4; - iVar4 = 0; - for(counter = 0; counter < friendArea; counter++) - { - iVar4 += gFriendAreaSettings[counter].num_pokemon; - } - param_2->unk8 = iVar4; + for (i = 0; i < friendArea; i++) + iVar4 += sFriendAreaSettings[i].num_pokemon; + + param_2->unk8 = iVar4; + param_2->hasFriendArea = gFriendAreas[i]; - param_2->hasFriendArea = gFriendAreas[counter]; if (param_2->hasFriendArea) { param_2->unk2 = 0; - param_2->numPokemon = gFriendAreaSettings[counter].num_pokemon; + param_2->numPokemon = sFriendAreaSettings[i].num_pokemon; - for(counter = 0; counter < param_2->numPokemon; counter++, iVar4++) - { + for (i = 0; i < param_2->numPokemon; i++, iVar4++) { pokeStruct = &gRecruitedPokemonRef->pokemon[iVar4]; - if (((((u8)pokeStruct->unk0 & 1) != 0) && - ((checkLeader == 0 || (!pokeStruct->isTeamLeader)))) && - ((checkDungeon == 0 || ((pokeStruct->dungeonLocation).id != DUNGEON_JOIN_LOCATION_PARTNER)))) { + + if ((((u8)pokeStruct->unk0 & 1) && + (!checkLeader || !pokeStruct->isTeamLeader)) && + (!checkDungeon || pokeStruct->dungeonLocation.id != DUNGEON_JOIN_LOCATION_PARTNER)) { param_2->unk2++; } } @@ -593,3 +290,80 @@ void sub_8092638(u8 friendArea, struct unkStruct_8092638 *param_2, bool8 checkLe param_2->numPokemon = 0; } } + +void sub_80926F8(u8 a0, unkStruct_8092638 *a1, u8 a2) +{ + PokemonStruct1 *mon; + s32 r5; + s32 i; + s32 max; + + r5 = 0; + + for (i = 0; i < a0; i++) + r5 += sFriendAreaSettings[i].num_pokemon; + + a1->unk8 = r5; + a1->hasFriendArea = gFriendAreas[i]; + + if (a1->hasFriendArea) { + a1->unk2 = 0; + a1->numPokemon = sFriendAreaSettings[i].num_pokemon; + max = a1->numPokemon; + + for (i = 0; i < max; i++, r5++) { + mon = &gRecruitedPokemonRef->pokemon[r5]; + if ((u8)mon->unk0 & 1) { + if (mon->isTeamLeader || (a2 == 0 && mon->dungeonLocation.id == DUNGEON_JOIN_LOCATION_PARTNER)) + a1->numPokemon--; + else + a1->unk2++; + } + } + } + else { + a1->unk2 = 0; + a1->numPokemon = 0; + } +} + +u32 SaveFriendAreas(u8 *r0, u32 size) +{ + struct unkStruct_8094924 unk; + u32 temp; + s32 i; + + xxx_init_struct_8094924_save_809486C(&unk, r0, size); + + for (i = 0; i < NUM_FRIEND_AREAS; i++) { + if (gFriendAreas[i] != 0) + temp = -1; + else + temp = 0; + SaveIntegerBits(&unk, (u8*)&temp, 1); + } + + nullsub_102(&unk); + return unk.unk8; +} + +u32 ReadSavedFriendAreas(u8 *r0, s32 size) +{ + struct unkStruct_8094924 unk; + u32 temp; + s32 i; + + xxx_init_struct_8094924_restore_809485C(&unk, r0, size); + + for (i = 0; i < NUM_FRIEND_AREAS; i++) { + RestoreIntegerBits(&unk, &temp, 1); + // It's setting whether we have the friend area or not + if (temp & 1) + gFriendAreas[i] = TRUE; + else + gFriendAreas[i] = FALSE; + } + + nullsub_102(&unk); + return unk.unk8; +} \ No newline at end of file diff --git a/src/friend_area_1.c b/src/friend_area_1.c deleted file mode 100644 index 4b3d495fd..000000000 --- a/src/friend_area_1.c +++ /dev/null @@ -1,44 +0,0 @@ -#include "global.h" -#include "constants/friend_area.h" -#include "code_8092334.h" -#include "friend_area.h" - -u32 SaveFriendAreas(u8 *r0, u32 size) -{ - struct unkStruct_8094924 unk; - u32 temp; - s32 counter; - - xxx_init_struct_8094924_save_809486C(&unk, r0, size); - for(counter = 0; counter < NUM_FRIEND_AREAS; counter++) - { - if(gFriendAreas[counter] != 0) - temp = -1; - else - temp = 0; - SaveIntegerBits(&unk, (u8*)&temp, 1); - } - nullsub_102(&unk); - return unk.unk8; -} - -u32 ReadSavedFriendAreas(u8 *r0, s32 size) -{ - struct unkStruct_8094924 unk; - u32 temp; - s32 counter; - - xxx_init_struct_8094924_restore_809485C(&unk, r0, size); - for(counter = 0; counter < NUM_FRIEND_AREAS; counter++) - { - RestoreIntegerBits(&unk, &temp, 1); - // It's setting whether we have the friend area or not - if(temp & 1) - gFriendAreas[counter] = 1; - else - gFriendAreas[counter] = 0; - } - nullsub_102(&unk); - return unk.unk8; -} - diff --git a/src/friend_area_action_menu.c b/src/friend_area_action_menu.c index dac7208c6..52b0c5ef4 100644 --- a/src/friend_area_action_menu.c +++ b/src/friend_area_action_menu.c @@ -1,20 +1,23 @@ #include "global.h" +#include "code_80130A8.h" +#include "code_801B3C0.h" +#include "code_801C620.h" +#include "code_801EE10.h" +#include "code_801EE10_1.h" +#include "code_801EE10_mid.h" +#include "code_8098BDC.h" #include "constants/dungeon.h" +#include "event_flag.h" +#include "friend_area_action_menu.h" +#include "items.h" +#include "kecleon_bros4.h" #include "memory.h" +#include "menu_input.h" +#include "moves.h" +#include "pokemon.h" +#include "sprite.h" #include "text1.h" #include "text2.h" -#include "item.h" -#include "pokemon.h" -#include "team_inventory.h" -#include "friend_area_action_menu.h" -#include "menu_input.h" -#include "kecleon_bros.h" -#include "sprite.h" -#include "code_80130A8.h" -#include "code_801EE10_1.h" -#include "code_801B3C0.h" -#include "event_flag.h" -#include "moves.h" extern struct unkStruct_203B2BC *gUnknown_203B2BC; @@ -22,13 +25,7 @@ extern u8 *gUnknown_80D4920[]; extern u8 *gUnknown_80D4928[]; extern u8 *gUnknown_80D4970[]; -extern void sub_8024458(s16, u32); -extern void sub_801BEEC(s16); -extern void sub_801F808(u16*); -extern void sub_801F1B0(u32, u32); -extern void sub_801EE10(u32, s16, struct Move *, u32, u32, u32); - -void sub_8027D40(u32, struct BulkItem *heldItem); +void sub_8027D40(u32, BulkItem *heldItem); void sub_8027794(void); extern void SetFriendAreaActionMenuState(u32); extern void sub_802719C(); @@ -47,120 +44,26 @@ extern void sub_8027CA0(); extern void sub_8027D00(); extern void CreateFriendActionMenu(); extern void sub_80276A8(); -bool8 sub_8027D9C(struct PokemonStruct *pokeStruct); -extern u8 sub_8027DCC(struct PokemonStruct *); -extern u32 sub_801EF38(u8 r0); -extern void sub_801F214(); +bool8 sub_8027D9C(PokemonStruct1 *pokeStruct); +extern u8 sub_8027DCC(PokemonStruct1 *); extern void SetFriendAreaActionMenuState(u32); extern void PlaySound(u32); extern void nullsub_104(); -extern void sub_8099690(u32); -extern void sub_808D31C(struct PokemonStruct *); -extern struct PokemonStruct *sub_808D3F8(void); -extern struct PokemonStruct *sub_808D3BC(void); -extern u32 sub_801F890(void); -extern void sub_801F8D0(void); +extern void sub_808D31C(PokemonStruct1 *); +extern PokemonStruct1 *sub_808D3F8(void); +extern PokemonStruct1 *sub_808D3BC(void); extern u8 gUnknown_202DE58[]; -extern u32 sub_801F194(void); -extern u32 sub_801BF48(void); -extern void sub_801BF98(void); extern u32 sub_80244E4(void); -extern void sub_802453C(void); extern bool8 sub_808D750(s16 index_); -extern struct PokemonStruct *GetPlayerPokemonStruct(void); extern void sub_808ED00(void); -u32 sub_8027E18(struct PokemonStruct *); -u8 sub_8027E4C(struct PokemonStruct *r0); +u32 sub_8027E18(PokemonStruct1 *); +u8 sub_8027E4C(PokemonStruct1 *r0); void sub_8027EB8(void); -const struct UnkTextStruct2 gUnknown_80DD6EC = -{ - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x00, 0x00, - 0x00, 0x00, - 0x00, 0x00, - NULL -}; - - -const struct UnkTextStruct2 gUnknown_80DD704 = -{ - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x13, 0x04, - 0x09, 0x03, - 0x03, 0x00, - NULL -}; - -const struct UnkTextStruct2 gUnknown_80DD71C = -{ - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x14, 0x04, - 0x06, 0x03, - 0x03, 0x00, - NULL -}; - -const struct UnkTextStruct2 gUnknown_80DD734 = -{ - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x16, 0x04, - 0x06, 0x03, - 0x03, 0x00, - NULL -}; - -const struct UnkTextStruct2 gUnknown_80DD74C = -{ - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x02, 0x11, - 0x1A, 0x02, - 0x02, 0x00, - NULL -}; - - -ALIGNED(4) const u8 gFriendAreaActionSayFarewellPrompt[] = _( - "You have chosen to say farewell\n" - "to this Pokémon.{EXTRA_MSG}" - "The Pokémon will leave its Friend Area.\n" - "It will no longer be available for\n" - "adventures. Is that OK?"); - -ALIGNED(4) const u8 gFriendAreaActionSayFarewellConfirm[] = _( - "If you say farewell to this\n" - "Pokémon{COMMA} it will be gone forever.{EXTRA_MSG}" - "You will never be able to get another one\n" - "like it to join your team.\n" - "Will you release it anyway?"); - -ALIGNED(4) const u8 gUnknown_80DD8A0[] = _( - "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1} was\n" - "{CENTER_ALIGN}returned to the Toolbox."); - -ALIGNED(4) const u8 gUnknown_80DD8D0[] = _( - "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1} was\n{CENTER_ALIGN}sent to storage."); - -ALIGNED(4) const u8 gFriendActionStandby[] = "Stand By"; -ALIGNED(4) const u8 gFriendActionMakeLeader[] = "Make Leader"; -ALIGNED(4) const u8 gFriendActionJoinTeam[] = "Join Team"; -ALIGNED(4) const u8 gFriendActionSayFarewell[] = "Say Farewell"; -ALIGNED(4) const u8 gFriendActionGive[] = "Give"; -ALIGNED(4) const u8 gFriendActionTake[] = "Take"; -ALIGNED(4) const u8 gFriendActionSummary[] = "Summary"; -ALIGNED(4) const u8 gFriendActionMoves[] = "Moves"; -ALIGNED(4) const u8 gFriendActionCheckIQ[] = "Check IQ"; - -ALIGNED(4) const u8 gUnknown_80DD958[] = _("Item: {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1} "); -static const u8 filler[] = "pksdir0"; +#include "data/friend_area_action_menu.h" u32 sub_8027074(void) { @@ -248,105 +151,101 @@ void sub_802719C(void) switch(gUnknown_203B2BC->state) { case 3: - gUnknown_203B2BC->unk180[3] = gUnknown_80DD74C; + gUnknown_203B2BC->unk180[3] = sUnknown_80DD74C; CreateFriendActionMenu(); - gUnknown_203B2BC->unk180[2] = gUnknown_80DD704; + gUnknown_203B2BC->unk180[2] = sUnknown_80DD704; sub_8012CAC(&gUnknown_203B2BC->unk180[2], gUnknown_203B2BC->menuItems); break; case 0xC: sub_80276A8(); - gUnknown_203B2BC->unk180[2] = gUnknown_80DD71C; + gUnknown_203B2BC->unk180[2] = sUnknown_80DD71C; sub_8012CAC(&gUnknown_203B2BC->unk180[2], gUnknown_203B2BC->menuItems); break; default: for(index = 0; index < 4; index++) { - gUnknown_203B2BC->unk180[index] = gUnknown_80DD6EC; + gUnknown_203B2BC->unk180[index] = sUnknown_80DD6EC; } break; } ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2BC->unk180, 1, 1); + sub_800641C(gUnknown_203B2BC->unk180, TRUE, TRUE); } void sub_8027274(void) { - struct Item slot; + Item slot; - switch(gUnknown_203B2BC->state) { - case FRIEND_AREA_ACTION_MENU_INIT: - case FRIEND_AREA_ACTION_MENU_EXIT: - break; - case FRIEND_AREA_ACTION_MENU_MAIN: - sub_8023868(1,0,0,7); - break; - case FRIEND_AREA_ACTION_MENU_MAIN_2: - sub_8023B7C(1); - break; - case 3: - sub_8027D40(3,&gUnknown_203B2BC->item2); - sub_8023DA4(); - sub_8012D60(&gUnknown_203B2BC->unk7C,gUnknown_203B2BC->menuItems,0,gUnknown_203B2BC->unk16C,gUnknown_203B2BC->menuAction1,2); - break; - case FRIEND_AREA_ACTION_MENU_SUMMARY: - sub_8024458(gUnknown_203B2BC->targetPoke,2); - break; - case FRIEND_AREA_ACTION_MENU_CHECK_IQ: - sub_801BEEC(gUnknown_203B2BC->targetPoke); - break; - case 10: - sub_801A5D8(1,0,0,10); - break; - case 0xb: - sub_801A8D0(1); - break; - case 0xc: - sub_801A9E0(); - sub_8012D60(&gUnknown_203B2BC->unk7C,gUnknown_203B2BC->menuItems,0,gUnknown_203B2BC->unk16C,gUnknown_203B2BC->menuAction2,2); - break; - case 0xd: - HeldItemToSlot(&slot, &gUnknown_203B2BC->itemToGive); - sub_801B3C0(&slot); - break; - case 0xe: - unk_CopyMoves4To8(gUnknown_203B2BC->moves,gUnknown_203B2BC->pokeStruct->moves); - sub_801EE10(3,gUnknown_203B2BC->targetPoke,gUnknown_203B2BC->moves,0,0,0); - break; - case 0xf: - sub_801F1B0(1,0); - break; - case FRIEND_AREA_ACTION_MENU_SAY_FAREWELL_PROMPT: - sub_8027794(); - sub_8014248(gFriendAreaActionSayFarewellPrompt,0,3,gUnknown_203B2BC->menuItems,0,4,0,0,0x101); - break; - case FRIEND_AREA_ACTION_MENU_SAY_FAREWELL_CONFIRM: - sub_8027794(); - sub_8014248(gFriendAreaActionSayFarewellConfirm,0,3,gUnknown_203B2BC->menuItems,0,4,0,0,0x101); - break; - case 0x10: - GetLinkedSequence(gUnknown_203B2BC->moveIndex,gUnknown_203B2BC->moves,gUnknown_203B2BC->moveIDs); - sub_801F808(gUnknown_203B2BC->moveIDs); - break; - case 6: - gUnknown_203B2BC->fallbackState = FRIEND_AREA_ACTION_MENU_MAIN_2; - // The {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1} was - // returned to the Toolbox - sub_80141B4(gUnknown_80DD8A0,0,0,0x101); - break; - case 7: - gUnknown_203B2BC->fallbackState = FRIEND_AREA_ACTION_MENU_MAIN_2; - // The {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1} was - // returned to storage - sub_80141B4(gUnknown_80DD8D0,0,0,0x101); - break; - } + switch (gUnknown_203B2BC->state) { + case FRIEND_AREA_ACTION_MENU_INIT: + case FRIEND_AREA_ACTION_MENU_EXIT: + break; + case FRIEND_AREA_ACTION_MENU_MAIN: + sub_8023868(1,0,0,7); + break; + case FRIEND_AREA_ACTION_MENU_MAIN_2: + sub_8023B7C(1); + break; + case 3: + sub_8027D40(3, &gUnknown_203B2BC->item2); + sub_8023DA4(); + sub_8012D60(&gUnknown_203B2BC->unk7C, gUnknown_203B2BC->menuItems, 0, gUnknown_203B2BC->unk16C, gUnknown_203B2BC->menuAction1, 2); + break; + case FRIEND_AREA_ACTION_MENU_SUMMARY: + sub_8024458(gUnknown_203B2BC->targetPoke, 2); + break; + case FRIEND_AREA_ACTION_MENU_CHECK_IQ: + sub_801BEEC(gUnknown_203B2BC->targetPoke); + break; + case 10: + sub_801A5D8(1, 0, NULL, 10); + break; + case 0xb: + sub_801A8D0(TRUE); + break; + case 0xc: + sub_801A9E0(); + sub_8012D60(&gUnknown_203B2BC->unk7C,gUnknown_203B2BC->menuItems,0,gUnknown_203B2BC->unk16C,gUnknown_203B2BC->menuAction2,2); + break; + case 0xd: + HeldItemToSlot(&slot, &gUnknown_203B2BC->itemToGive); + sub_801B3C0(&slot); + break; + case 0xe: + unk_CopyMoves4To8(gUnknown_203B2BC->moves,gUnknown_203B2BC->pokeStruct->moves); + sub_801EE10(3,gUnknown_203B2BC->targetPoke,gUnknown_203B2BC->moves,0,NULL,0); + break; + case 0xf: + sub_801F1B0(TRUE, FALSE); + break; + case FRIEND_AREA_ACTION_MENU_SAY_FAREWELL_PROMPT: + sub_8027794(); + sub_8014248(sSayFarewellPrompt,0,3,gUnknown_203B2BC->menuItems,0,4,0,0,0x101); + break; + case FRIEND_AREA_ACTION_MENU_SAY_FAREWELL_CONFIRM: + sub_8027794(); + sub_8014248(sSayFarewellConfirm,0,3,gUnknown_203B2BC->menuItems,0,4,0,0,0x101); + break; + case 0x10: + GetLinkedSequence(gUnknown_203B2BC->moveIndex,gUnknown_203B2BC->moves,gUnknown_203B2BC->moveIDs); + sub_801F808(gUnknown_203B2BC->moveIDs); + break; + case 6: + gUnknown_203B2BC->fallbackState = FRIEND_AREA_ACTION_MENU_MAIN_2; + sub_80141B4(sReturnedToToolbox, 0, 0, 0x101); + break; + case 7: + gUnknown_203B2BC->fallbackState = FRIEND_AREA_ACTION_MENU_MAIN_2; + sub_80141B4(sSentToStorage, 0, 0, 0x101); + break; + } } void CreateFriendActionMenu(void) { int index; s32 loopMax; - struct PokemonStruct *pokeStruct; + PokemonStruct1 *pokeStruct; loopMax = 0; pokeStruct = &gRecruitedPokemonRef->pokemon[gUnknown_203B2BC->targetPoke]; @@ -354,7 +253,7 @@ void CreateFriendActionMenu(void) if((pokeStruct->unk0 >> 1) % 2) { - gUnknown_203B2BC->menuItems[loopMax].text = gFriendActionStandby; + gUnknown_203B2BC->menuItems[loopMax].text = sStandBy; gUnknown_203B2BC->menuItems[loopMax].menuAction = FRIEND_AREA_ACTION_MENU_ACTION_STANDBY; if(!sub_8027D9C(pokeStruct)) { @@ -363,21 +262,21 @@ void CreateFriendActionMenu(void) loopMax += 1; if(sub_80023E4(8) && !pokeStruct->isTeamLeader) { - gUnknown_203B2BC->menuItems[loopMax].text = gFriendActionMakeLeader; + gUnknown_203B2BC->menuItems[loopMax].text = sMakeLeader; gUnknown_203B2BC->menuItems[loopMax].menuAction = FRIEND_AREA_ACTION_MENU_ACTION_MAKE_LEADER; loopMax += 1; } } else { - gUnknown_203B2BC->menuItems[loopMax].text = gFriendActionJoinTeam; + gUnknown_203B2BC->menuItems[loopMax].text = sJoinTeam; gUnknown_203B2BC->menuItems[loopMax].menuAction = FRIEND_AREA_ACTION_MENU_ACTION_JOIN_TEAM; if(!sub_808D750(gUnknown_203B2BC->targetPoke)) { gUnknown_203B2BC->unk16C[loopMax] = 1; } loopMax += 1; - gUnknown_203B2BC->menuItems[loopMax].text = gFriendActionSayFarewell; + gUnknown_203B2BC->menuItems[loopMax].text = sSayFarewell; gUnknown_203B2BC->menuItems[loopMax].menuAction = FRIEND_AREA_ACTION_MENU_ACTION_SAY_FAREWELL; if(!sub_8027DCC(pokeStruct)) { @@ -387,7 +286,7 @@ void CreateFriendActionMenu(void) } - gUnknown_203B2BC->menuItems[loopMax].text = gFriendActionGive; + gUnknown_203B2BC->menuItems[loopMax].text = sGive; gUnknown_203B2BC->menuItems[loopMax].menuAction = FRIEND_AREA_ACTION_MENU_ACTION_GIVE; if(GetNumberOfFilledInventorySlots() == 0) { @@ -395,23 +294,23 @@ void CreateFriendActionMenu(void) } loopMax += 1; - gUnknown_203B2BC->menuItems[loopMax].text = gFriendActionTake; + gUnknown_203B2BC->menuItems[loopMax].text = sTake; gUnknown_203B2BC->menuItems[loopMax].menuAction = FRIEND_AREA_ACTION_MENU_ACTION_TAKE; if(GetNumberOfFilledInventorySlots() >= INVENTORY_SIZE || gUnknown_203B2BC->item2.id == ITEM_NOTHING) { gUnknown_203B2BC->unk16C[loopMax] = 1; } loopMax += 1; - gUnknown_203B2BC->menuItems[loopMax].text = gFriendActionSummary; + gUnknown_203B2BC->menuItems[loopMax].text = sSummary; gUnknown_203B2BC->menuItems[loopMax].menuAction = FRIEND_AREA_ACTION_MENU_ACTION_SUMMARY; loopMax += 1; - gUnknown_203B2BC->menuItems[loopMax].text = gFriendActionMoves; + gUnknown_203B2BC->menuItems[loopMax].text = sMoves; gUnknown_203B2BC->menuItems[loopMax].menuAction = FRIEND_AREA_ACTION_MENU_ACTION_MOVES; loopMax += 1; - gUnknown_203B2BC->menuItems[loopMax].text = gFriendActionCheckIQ; + gUnknown_203B2BC->menuItems[loopMax].text = sCheckIQ; gUnknown_203B2BC->menuItems[loopMax].menuAction = FRIEND_AREA_ACTION_MENU_ACTION_CHECK_IQ; loopMax += 1; - gUnknown_203B2BC->menuItems[loopMax].text = 0; + gUnknown_203B2BC->menuItems[loopMax].text = NULL; gUnknown_203B2BC->menuItems[loopMax].menuAction = FRIEND_AREA_ACTION_MENU_ACTION_NONE; for(index = 0; index < loopMax; index++) @@ -440,7 +339,7 @@ void sub_80276A8(void) loopMax = 0; MemoryFill16(gUnknown_203B2BC->unk16C,0,sizeof(gUnknown_203B2BC->unk16C)); - gUnknown_203B2BC->menuItems[loopMax].text = gFriendActionGive; + gUnknown_203B2BC->menuItems[loopMax].text = sGive; gUnknown_203B2BC->menuItems[loopMax].menuAction = FRIEND_AREA_ACTION_MENU_ACTION_GIVE; if (GetNumberOfFilledInventorySlots() == 0) { gUnknown_203B2BC->unk16C[loopMax] = 1; @@ -488,7 +387,7 @@ void sub_8027794(void) void sub_80277FC(void) { - struct PokemonStruct *pokeStruct; + PokemonStruct1 *pokeStruct; switch(sub_8023A94(TRUE)) { case 0: @@ -519,9 +418,9 @@ void sub_80277FC(void) void sub_80278B4(void) { - struct PokemonStruct *playerStruct; - struct PokemonStruct *pokeStruct1; - struct PokemonStruct *pokeStruct2; + PokemonStruct1 *playerStruct; + PokemonStruct1 *pokeStruct1; + PokemonStruct1 *pokeStruct2; u32 menuAction; menuAction = 0; @@ -535,10 +434,10 @@ void sub_80278B4(void) #ifdef NONMATCHING pokeStruct1 = &gRecruitedPokemonRef->pokemon[gUnknown_203B2BC->targetPoke]; #else - register size_t offset asm("r1") = offsetof(struct unkStruct_203B45C, pokemon[gUnknown_203B2BC->targetPoke]); - struct PokemonStruct* p = gRecruitedPokemonRef->pokemon; + register size_t offset asm("r1") = offsetof(unkStruct_203B45C, pokemon[gUnknown_203B2BC->targetPoke]); + PokemonStruct1* p = gRecruitedPokemonRef->pokemon; size_t addr = offset + (size_t)p; - pokeStruct1 = (struct PokemonStruct*)addr; + pokeStruct1 = (PokemonStruct1*)addr; #endif pokeStruct1->unk0 |= FLAG_ON_TEAM; nullsub_104(); @@ -794,10 +693,10 @@ void FriendAreaActionMenu_GotoFallbackState(void) } } -void sub_8027D40(u32 r0, struct BulkItem *heldItem) +void sub_8027D40(u32 r0, BulkItem *heldItem) { - struct Item slot; + Item slot; struct unkStruct_8090F58 a3; sub_8008C54(r0); @@ -808,11 +707,11 @@ void sub_8027D40(u32 r0, struct BulkItem *heldItem) a3.unk8 = 1; slot.flags = ITEM_FLAG_EXISTS; sub_8090E14(gUnknown_202DE58, &slot, &a3); - xxx_format_and_draw(4, 3, gUnknown_80DD958, r0, 0); + xxx_format_and_draw(4, 3, sItemBuffered, r0, 0); sub_80073E0(r0); } -bool8 sub_8027D9C(struct PokemonStruct *pokeStruct) +bool8 sub_8027D9C(PokemonStruct1 *pokeStruct) { u32 var1; if(!pokeStruct->isTeamLeader) @@ -831,7 +730,7 @@ bool8 sub_8027D9C(struct PokemonStruct *pokeStruct) return TRUE; } -bool8 sub_8027DCC(struct PokemonStruct *pokeStruct) +bool8 sub_8027DCC(PokemonStruct1 *pokeStruct) { u32 var1; if(sub_808D3BC() != pokeStruct) @@ -856,7 +755,7 @@ bool8 sub_8027DCC(struct PokemonStruct *pokeStruct) return FALSE; } -u32 sub_8027E18(struct PokemonStruct *pokeStruct) +u32 sub_8027E18(PokemonStruct1 *pokeStruct) { if(pokeStruct->heldItem.id == ITEM_NOTHING) return 0; @@ -868,7 +767,7 @@ u32 sub_8027E18(struct PokemonStruct *pokeStruct) return 3; } -bool8 sub_8027E4C(struct PokemonStruct *pokeStruct) +bool8 sub_8027E4C(PokemonStruct1 *pokeStruct) { if(!IsNotMoneyOrUsedTMItem(pokeStruct->heldItem.id)) return FALSE; diff --git a/src/friend_list_menu.c b/src/friend_list_menu.c index 9e12fffdf..284c2bc3c 100644 --- a/src/friend_list_menu.c +++ b/src/friend_list_menu.c @@ -1,25 +1,28 @@ #include "global.h" +#include "code_80118A4.h" +#include "code_8012A18_1.h" +#include "code_80130A8.h" +#include "code_801B3C0.h" +#include "code_801C620.h" +#include "code_801EE10.h" +#include "code_801EE10_1.h" +#include "code_801EE10_mid.h" +#include "code_8098BDC.h" #include "constants/dungeon.h" +#include "event_flag.h" +#include "items.h" +#include "kecleon_bros4.h" #include "memory.h" +#include "menu_input.h" +#include "moves.h" +#include "pokemon.h" #include "text1.h" #include "text2.h" -#include "item.h" -#include "pokemon.h" -#include "moves.h" -#include "menu_input.h" -#include "team_inventory.h" -#include "kecleon_bros.h" -#include "code_80130A8.h" -#include "code_801EE10_1.h" -#include "code_8012A18_1.h" -#include "code_801B3C0.h" -#include "code_80118A4.h" -#include "event_flag.h" // there might be more overlap with unkStruct_203B2BC // I was working on the moves and put the data that seemed to correspond to that // into a separate struct -struct unkStruct_203B2B4 +typedef struct unkStruct_203B2B4 { // size: 0x178 s32 unk0; @@ -29,115 +32,38 @@ struct unkStruct_203B2B4 u8 unkD; s16 species; u32 itemIndex; - struct BulkItem item1; - struct BulkItem item2; - /* 0x1C */ struct PokemonStruct *pokeStruct; - u32 moveIndex; // some sort of move index + BulkItem item1; + BulkItem item2; + /* 0x1C */ PokemonStruct1 *pokeStruct; + u32 moveIndex; // some sort of move index u16 moveID; - struct Move moves[8]; - u16 moveIDs[4]; // some list of move IDs + Move moves[8]; + u16 moveIDs[4]; // some list of move IDs u32 menuAction1; s32 menuAction2; - struct MenuStruct unk78; - struct MenuItem unkC8[8]; + MenuStruct unk78; + MenuItem unkC8[8]; u16 unk108[8]; - struct UnkTextStruct2 unk118[4]; -}; -EWRAM_DATA_2 struct unkStruct_203B2B4 *gUnknown_203B2B4 = {0}; + UnkTextStruct2 unk118[4]; +} unkStruct_203B2B4; -const struct UnkTextStruct2 gUnknown_80DD148 = { - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x00, 0x00, - 0x00, 0x00, - 0x00, 0x00, - NULL -}; - -const struct UnkTextStruct2 gUnknown_80DD160 = { - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x13, 0x04, - 0x08, 0x03, - 0x03, 0x00, - NULL -}; - -const struct UnkTextStruct2 gUnknown_80DD178 = { - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x14, 0x04, - 0x06, 0x03, - 0x03, 0x00, - NULL -}; - -const struct UnkTextStruct2 gUnknown_80DD190 = { - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x02, 0x11, - 0x1A, 0x02, - 0x02, 0x00, - NULL -}; - -extern u8 gAvailablePokemonNames[]; -extern u8 gUnknown_202DEA8[]; -extern u8 *gUnknown_80D4970[]; extern u8 gUnknown_202DE58[]; +extern u8 gUnknown_202DEA8[]; +extern u8 gAvailablePokemonNames[]; -ALIGNED(4) const u8 gUnknown_80DD1A8[] = "Whom would you like to visit?"; +EWRAM_DATA_2 unkStruct_203B2B4 *gUnknown_203B2B4 = {0}; -ALIGNED(4) const u8 gUnknown_80DD1C8[] = _( - "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_1}{END_COLOR_TEXT_1} was\n" - "{CENTER_ALIGN}handed over. "); +extern u8 *gUnknown_80D4970[]; -ALIGNED(4) const u8 gUnknown_80DD1EC[] = _( - "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_1}{END_COLOR_TEXT_1} was\n" - "{CENTER_ALIGN}handed over.{EXTRA_MSG}" - "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1} was\n" - "{CENTER_ALIGN}returned to the Toolbox."); - -ALIGNED(4) const u8 gUnknown_80DD240[] = _( - "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1} was\n" - "{CENTER_ALIGN}returned to the Toolbox."); - -ALIGNED(4) const u8 gUnknown_80DD270[] = _( - "{CENTER_ALIGN}{ARG_POKEMON_1} left the team to remain\n" - "{CENTER_ALIGN}on standby in the Friend Area."); - -ALIGNED(4) const u8 gFriendListGive[] = "Give"; -ALIGNED(4) const u8 gFriendListTake[] = "Take"; -ALIGNED(4) const u8 gFriendListStandBy[] = "Stand By"; -ALIGNED(4) const u8 gFriendListVisit[] = "Visit"; -ALIGNED(4) const u8 gFriendListName[] = "Name"; -ALIGNED(4) const u8 gFriendListSummary[] = "Summary"; -ALIGNED(4) const u8 gFriendListMoves[] = "Moves"; -ALIGNED(4) const u8 gFriendListCheckIQ[] = "Check IQ"; -ALIGNED(4) const u8 gFriendListItem[] = _("Item: {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1} "); -ALIGNED(4) static const u8 fill0[] = "pksdir0"; +#include "data/friend_list_menu.h" extern s16 sub_80A5728(void); extern u8 sub_8002658(s16); extern bool8 sub_8024108(u32); -extern void sub_801F1B0(u32, u32); -extern void sub_8024458(s16, u32); -extern void sub_801BEEC(s16); extern void nullsub_104(void); extern void sub_808ED00(void); extern u32 sub_80244E4(void); -extern void sub_802453C(void); -extern u32 sub_801BF48(void); -extern void sub_801BF98(void); -extern u32 sub_801EF38(u32); -extern u32 sub_801F194(void); -extern void sub_801F214(void); -extern void sub_801EE10(u32, s16, struct Move *, u32, u32, u32); -extern void sub_801F808(u16 *); -extern void sub_8099690(u32); -extern void sub_801F8D0(void); -extern u32 sub_801F890(void); extern void sub_80160D8(void); extern u32 sub_8016080(void); extern s32 sub_80144A4(s32 *); @@ -158,8 +84,8 @@ void sub_8025DAC(void); void sub_8025E08(void); void sub_8025E24(void); void sub_8025E44(void); -void sub_8025E68(u32 , struct BulkItem *); -bool8 sub_8025EC4(struct PokemonStruct *); +void sub_8025E68(u32 , BulkItem *); +bool8 sub_8025EC4(PokemonStruct1 *); bool8 sub_80252F0(s32 param_1) @@ -168,7 +94,7 @@ bool8 sub_80252F0(s32 param_1) return FALSE; } else { - gUnknown_203B2B4 = MemoryAlloc(sizeof(struct unkStruct_203B2B4),8); + gUnknown_203B2B4 = MemoryAlloc(sizeof(unkStruct_203B2B4),8); gUnknown_203B2B4->menuAction1 = 0; gUnknown_203B2B4->unk0 = param_1; gUnknown_203B2B4->unkC = sub_8002658(sub_80A5728()); @@ -251,47 +177,45 @@ void sub_8025434(s32 newState) void sub_802544C(void) { - s32 index; - - sub_8006518(gUnknown_203B2B4->unk118); + s32 i; - switch(gUnknown_203B2B4->state) - { - case 3: - if (gUnknown_203B2B4->unk0 == 0) { - gUnknown_203B2B4->unk118[3] = gUnknown_80DD190; - } - sub_8025728(); - gUnknown_203B2B4->unk118[2] = gUnknown_80DD160; - sub_8012CAC(&gUnknown_203B2B4->unk118[2],gUnknown_203B2B4->unkC8); - break; - case 0xD: - sub_802591C(); - gUnknown_203B2B4->unk118[2] = gUnknown_80DD178; - sub_8012CAC(&gUnknown_203B2B4->unk118[2],gUnknown_203B2B4->unkC8); - break; - default: - for(index = 0; index < 4; index++) - { - gUnknown_203B2B4->unk118[index] = gUnknown_80DD148; - } - break; + sub_8006518(gUnknown_203B2B4->unk118); - } - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2B4->unk118,1,1); + switch (gUnknown_203B2B4->state) { + case 3: + if (gUnknown_203B2B4->unk0 == 0) + gUnknown_203B2B4->unk118[3] = sUnknown_80DD190; + + sub_8025728(); + gUnknown_203B2B4->unk118[2] = sUnknown_80DD160; + sub_8012CAC(&gUnknown_203B2B4->unk118[2], gUnknown_203B2B4->unkC8); + break; + case 13: + sub_802591C(); + gUnknown_203B2B4->unk118[2] = sUnknown_80DD178; + sub_8012CAC(&gUnknown_203B2B4->unk118[2], gUnknown_203B2B4->unkC8); + break; + default: + for (i = 0; i < 4; i++) + gUnknown_203B2B4->unk118[i] = sUnknown_80DD148; + break; + + } + + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B2B4->unk118, TRUE, TRUE); } void sub_8025518(void) { u32 uVar3; - struct Item item; + Item item; switch(gUnknown_203B2B4->state) { case 0: gUnknown_203B2B4->fallbackState = 1; - sub_80141B4(gUnknown_80DD1A8,0,0,0x301); + sub_80141B4(sVisitWhoPrompt,0,0,0x301); break; case 1: uVar3 = 4; @@ -319,10 +243,10 @@ void sub_8025518(void) sub_801BEEC(gUnknown_203B2B4->species); break; case 0xb: - sub_801A5D8(1,0,0,10); + sub_801A5D8(1, 0, NULL, 10); break; case 0xc: - sub_801A8D0(1); + sub_801A8D0(TRUE); break; case 0xd: sub_801A9E0(); @@ -334,27 +258,27 @@ void sub_8025518(void) break; case 8: gUnknown_203B2B4->fallbackState = 2; - sub_80141B4(gUnknown_80DD1C8,0,0,0x101); + sub_80141B4(sItemHandedOver,0,0,0x101); break; case 9: gUnknown_203B2B4->fallbackState = 2; - sub_80141B4(gUnknown_80DD1EC,0,0,0x101); + sub_80141B4(sItemExchanged,0,0,0x101); break; case 10: gUnknown_203B2B4->fallbackState = 2; - sub_80141B4(gUnknown_80DD240,0,0,0x101); + sub_80141B4(sReturnedToToolbox,0,0,0x101); break; case 7: gUnknown_203B2B4->fallbackState = 1; PlaySound(0xcf); - sub_80141B4(gUnknown_80DD270,0,0,0x101); + sub_80141B4(sLeftOnStandby,0,0,0x101); break; case 0xf: unk_CopyMoves4To8(gUnknown_203B2B4->moves,gUnknown_203B2B4->pokeStruct->moves); - sub_801EE10(3,gUnknown_203B2B4->species,gUnknown_203B2B4->moves,0,0,0); + sub_801EE10(3,gUnknown_203B2B4->species,gUnknown_203B2B4->moves,0,NULL,0); break; case 0x10: - sub_801F1B0(1,0); + sub_801F1B0(TRUE, FALSE); break; case 0x11: GetLinkedSequence(gUnknown_203B2B4->moveIndex,gUnknown_203B2B4->moves, gUnknown_203B2B4->moveIDs); @@ -371,20 +295,20 @@ void sub_8025518(void) void sub_8025728(void) { int index; - struct PokemonStruct *pokeStruct; + PokemonStruct1 *pokeStruct; s32 loopMax = 0; pokeStruct = &gRecruitedPokemonRef->pokemon[gUnknown_203B2B4->species]; MemoryFill16(gUnknown_203B2B4->unk108,0,sizeof(gUnknown_203B2B4->unk108)); if (gUnknown_203B2B4->unk0 == 0) { - gUnknown_203B2B4->unkC8[loopMax].text = gFriendListGive; + gUnknown_203B2B4->unkC8[loopMax].text = sGive; gUnknown_203B2B4->unkC8[loopMax].menuAction = 10; if (GetNumberOfFilledInventorySlots() == 0) { gUnknown_203B2B4->unk108[loopMax] = 1; } loopMax += 1; - gUnknown_203B2B4->unkC8[loopMax].text = gFriendListTake; + gUnknown_203B2B4->unkC8[loopMax].text = sTake; gUnknown_203B2B4->unkC8[loopMax].menuAction = 0xb; if ((INVENTORY_SIZE <= GetNumberOfFilledInventorySlots()) || (gUnknown_203B2B4->item2.id == ITEM_NOTHING)) { gUnknown_203B2B4->unk108[loopMax] = 1; @@ -392,13 +316,13 @@ void sub_8025728(void) loopMax += 1; if (sub_8025EC4(pokeStruct)) { - gUnknown_203B2B4->unkC8[loopMax].text = gFriendListStandBy; + gUnknown_203B2B4->unkC8[loopMax].text = sStandBy; gUnknown_203B2B4->unkC8[loopMax].menuAction = 9; loopMax += 1; } } else { - gUnknown_203B2B4->unkC8[loopMax].text = gFriendListVisit; + gUnknown_203B2B4->unkC8[loopMax].text = sVisit; gUnknown_203B2B4->unkC8[loopMax].menuAction = 7; if (gUnknown_203B2B4->unkC == GetFriendArea(gUnknown_203B2B4->pokeStruct->speciesNum)) { gUnknown_203B2B4->unk108[loopMax] = 1; @@ -407,17 +331,17 @@ void sub_8025728(void) } if ((pokeStruct->speciesNum == 0x13d) && (IsPokemonRenamed(pokeStruct))) { - gUnknown_203B2B4->unkC8[loopMax].text = gFriendListName; + gUnknown_203B2B4->unkC8[loopMax].text = sName; gUnknown_203B2B4->unkC8[loopMax].menuAction = 8; loopMax += 1; } - gUnknown_203B2B4->unkC8[loopMax].text = gFriendListSummary; + gUnknown_203B2B4->unkC8[loopMax].text = sSummary; gUnknown_203B2B4->unkC8[loopMax].menuAction = 4; loopMax += 1; - gUnknown_203B2B4->unkC8[loopMax].text = gFriendListMoves; + gUnknown_203B2B4->unkC8[loopMax].text = sMoves; gUnknown_203B2B4->unkC8[loopMax].menuAction = 6; loopMax += 1; - gUnknown_203B2B4->unkC8[loopMax].text = gFriendListCheckIQ; + gUnknown_203B2B4->unkC8[loopMax].text = sCheckIQ; gUnknown_203B2B4->unkC8[loopMax].menuAction = 5; loopMax += 1; gUnknown_203B2B4->unkC8[loopMax].text = NULL; @@ -449,7 +373,7 @@ void sub_802591C(void) MemoryFill16(gUnknown_203B2B4->unk108,0, sizeof(gUnknown_203B2B4->unk108)); - gUnknown_203B2B4->unkC8[loopMax].text = gFriendListGive; + gUnknown_203B2B4->unkC8[loopMax].text = sGive; gUnknown_203B2B4->unkC8[loopMax].menuAction = 10; if (GetNumberOfFilledInventorySlots() == 0) { gUnknown_203B2B4->unk108[loopMax] = 1; @@ -625,7 +549,7 @@ void sub_8025CB4(void) u32 uVar2; s32 menuAction; struct unkStruct_8090F58 a3; - struct Item item; + Item item; menuAction = 0; sub_801A6E8(FALSE); @@ -737,9 +661,9 @@ void sub_8025E44(void) } } -void sub_8025E68(u32 r0, struct BulkItem *heldItem) +void sub_8025E68(u32 r0, BulkItem *heldItem) { - struct Item item; + Item item; struct unkStruct_8090F58 a3; sub_8008C54(r0); @@ -750,11 +674,11 @@ void sub_8025E68(u32 r0, struct BulkItem *heldItem) a3.unk8 = 1; item.flags = ITEM_FLAG_EXISTS; sub_8090E14(gUnknown_202DE58, &item, &a3); - xxx_format_and_draw(4, 3, gFriendListItem, r0, 0); + xxx_format_and_draw(4, 3, sItemBuffered, r0, 0); sub_80073E0(r0); } -bool8 sub_8025EC4(struct PokemonStruct *pokeStruct) +bool8 sub_8025EC4(PokemonStruct1 *pokeStruct) { bool32 flag; if (pokeStruct->isTeamLeader) diff --git a/src/friend_rescue.c b/src/friend_rescue.c index b0cfd8235..3326b39f1 100644 --- a/src/friend_rescue.c +++ b/src/friend_rescue.c @@ -5,12 +5,12 @@ #include "text1.h" #include "text2.h" #include "text_util.h" -#include "item.h" -#include "team_inventory.h" +#include "items.h" +#include "code_801B3C0.h" #include "pokemon.h" #include "friend_rescue.h" #include "memory.h" -#include "save.h" +#include "save_write.h" #include "rescue_password_menu.h" #include "menu_input.h" #include "code_8094F88.h" @@ -18,18 +18,16 @@ #include "main_menu.h" #include "code_801EE10_1.h" #include "code_801C620.h" -#include "code_801B3C0.h" #include "cpu.h" #include "code_80118A4.h" extern void SetFriendRescueMenuState(u32); -extern struct PokemonStruct *GetPlayerPokemonStruct(void); extern void sub_802F2C0(); extern u32 sub_802F298(); extern char gUnknown_202E5D8[0x50]; extern char gAvailablePokemonNames[0x50]; -extern struct TeamInventory *gTeamInventoryRef; +extern TeamInventory *gTeamInventoryRef; extern u8 gUnknown_80E44A4[]; extern u8 gUnknown_80E4500[]; @@ -137,39 +135,39 @@ 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 MenuItem gUnknown_80E20B8; +extern MenuItem gUnknown_80E2108; +extern MenuItem gUnknown_80E20E0; +extern MenuItem gUnknown_80E2068; +extern MenuItem gUnknown_80E24F8; +extern MenuItem gUnknown_80E2554; +extern MenuItem gUnknown_80E22F0; +extern MenuItem gUnknown_80E236C; +extern MenuItem gUnknown_80E2440; +extern MenuItem gUnknown_80E2470; +extern MenuItem gUnknown_80E24B0; +extern MenuItem gUnknown_80E2130; +extern MenuItem gUnknown_80E2190; +extern MenuItem gUnknown_80E21B8; +extern MenuItem gUnknown_80E2268; +extern MenuItem gUnknown_80E2218; +extern MenuItem gUnknown_80E2240; +extern MenuItem gUnknown_80E2290; +extern MenuItem gUnknown_80E22D0; +extern MenuItem gUnknown_80E234C; +extern MenuItem gUnknown_80E24D8; +extern MenuItem gUnknown_80E2458; +extern MenuItem gUnknown_80E2408; +extern MenuItem gUnknown_80E23A8; +extern MenuItem gUnknown_80E22B4; -extern struct UnkTextStruct2 gUnknown_80E231C; -extern struct UnkTextStruct2 gUnknown_80E23F0; -extern struct UnkTextStruct2 gUnknown_80E2334; +extern UnkTextStruct2 gUnknown_80E231C; +extern UnkTextStruct2 gUnknown_80E23F0; +extern UnkTextStruct2 gUnknown_80E2334; -extern struct MenuItem gUnknown_80E25B4; +extern MenuItem gUnknown_80E25B4; -EWRAM_DATA_2 struct WonderMailStruct_203B33C *gUnknown_203B33C = {0}; +EWRAM_DATA_2 WonderMailStruct_203B33C *gUnknown_203B33C = {0}; extern u8 sub_8039880(void); @@ -270,23 +268,20 @@ 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_8024458(s16, u32); extern void sub_8035D1C(void); -extern u32 sub_8039068(u32, u8 *passwordBuffer, struct unkStruct_203B480 *r0); +extern u32 sub_8039068(u32, u8 *passwordBuffer, unkStruct_203B480 *r0); extern void sub_803084C(void); extern void sub_8031E10(void); extern void sub_80155F0(void); extern void sub_802F2C0(void); extern void sub_8030DE4(void); -extern void sub_802453C(void); extern u8 sub_800D588(void); extern void sub_80151C0(u32, u8 *); extern u32 sub_801D008(void); extern u32 sub_8023CE8(void); -extern void sub_802F204(struct unkStruct_802F204 *, u32); -extern u32 sub_80306A8(u32 wonderMailType, u32, struct UnkTextStruct2_sub *, u32); +extern void sub_802F204(unkStruct_802F204 *, u32); +extern u32 sub_80306A8(u32 wonderMailType, u32, UnkTextStruct2_sub *, u32); extern u32 sub_8030894(void); extern void sub_803092C(void); extern bool8 sub_8031D70(u32 mailIndex, s32); @@ -295,11 +290,10 @@ extern s32 sub_8037D64(u32, void *, void *); extern s32 sub_80381F4(u32, void *, void *); extern s32 CountMailType(u8 mailType); -extern u32 GetDungeonTeamRankPts(struct DungeonLocation *, u32); -struct unkStruct_203B480 * GetMailatIndex(u8 index); +extern u32 GetDungeonTeamRankPts(DungeonLocation *, u32); +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 ResetUnusedInputStruct(void); extern void sprintfStatic(char *buffer, const char *text, ...); @@ -310,9 +304,9 @@ u32 CreateFriendRescueMenu(void) int counter; ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); - gUnknown_203B33C = MemoryAlloc(sizeof(struct WonderMailStruct_203B33C), 8); - MemoryFill8((u8 *) gUnknown_203B33C, 0, sizeof(struct WonderMailStruct_203B33C)); + sub_800641C(NULL, TRUE, TRUE); + gUnknown_203B33C = MemoryAlloc(sizeof(WonderMailStruct_203B33C), 8); + MemoryFill8((u8 *) gUnknown_203B33C, 0, sizeof(WonderMailStruct_203B33C)); gUnknown_203B33C->unk530 = 0; gUnknown_203B33C->unk218 = -1; gUnknown_203B33C->speciesNum = -1; @@ -699,11 +693,11 @@ void nullsub_40(void) void sub_8032828(void) { - struct unkStruct_203B480 *mail; + unkStruct_203B480 *mail; u32 temp; u8 buffer [80]; - struct PokemonStruct *pokeStruct1; - struct PokemonStruct *pokeStruct2; + PokemonStruct1 *pokeStruct1; + PokemonStruct1 *pokeStruct2; char *monName; switch (gUnknown_203B33C->state) { @@ -815,7 +809,7 @@ void sub_8032828(void) case 0x32: if (sub_8030894() == 0) { ResetUnusedInputStruct(); - sub_800641C(NULL, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_80306A8(1, 0, NULL, 6); } break; @@ -839,7 +833,7 @@ void sub_8032828(void) case 0x3A: sub_8006518(gUnknown_203B33C->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_8031D70(gUnknown_203B33C->unk218, 0); break; case 0x3B: @@ -891,7 +885,7 @@ void sub_8032828(void) if (sub_8023CE8() != 0) sub_8023C60(); ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_8023868(3, 0, 0, 9); break; case 0x27: @@ -912,7 +906,7 @@ void sub_8032828(void) case 0x1D: if (sub_8030894() == 0) { ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_80306A8(4, 0, NULL, 6); } break; @@ -947,13 +941,13 @@ void sub_8032828(void) #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)); + MemoryFill8((u8*)&gUnknown_203B33C->unk48, 0, sizeof(unkStruct_203B480)); + MemoryFill8((u8*)&gUnknown_203B33C->unk78, 0, sizeof(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)); + MemoryFill8((u8*)&gUnknown_203B33C->unk48, 0, sizeof(unkStruct_203B480)); + MemoryFill8((u8*)&gUnknown_203B33C->unk78, 0, sizeof(unkStruct_203B480)); #ifdef NONMATCHING // Regswaps gUnknown_203B33C->unk48 = *GetMailatIndex(gUnknown_203B33C->unk218); @@ -966,13 +960,13 @@ void sub_8032828(void) 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)); + MemoryFill8((u8*)&gUnknown_203B33C->unkA8, 0, sizeof(WonderMailStruct_203B2C0_sub)); + MemoryFill8((u8*)&gUnknown_203B33C->unk130, 0, sizeof(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)); + MemoryFill8((u8*)&gUnknown_203B33C->unkA8, 0, sizeof(WonderMailStruct_203B2C0_sub)); + MemoryFill8((u8*)&gUnknown_203B33C->unk130, 0, sizeof(WonderMailStruct_203B2C0_sub)); gUnknown_203B33C->unkA8.pokemon.speciesNum = 0; gUnknown_203B33C->unk130.pokemon.speciesNum = 0; gUnknown_203B33C->unkA8.mail = *GetMailatIndex(gUnknown_203B33C->unk218); @@ -980,7 +974,7 @@ void sub_8032828(void) pokeStruct1 = &gUnknown_203B33C->unkA8.pokemon; pokeStruct2 = gRecruitedPokemonRef->pokemon; pokeStruct2 += gUnknown_203B33C->speciesNum; - memcpy(pokeStruct1, pokeStruct2, sizeof(struct PokemonStruct)); + memcpy(pokeStruct1, pokeStruct2, sizeof(PokemonStruct1)); } gUnknown_203B33C->status = sub_8037D64(gUnknown_203B33C->unk40, &gUnknown_203B33C->unkA8, &gUnknown_203B33C->unk130); break; @@ -1019,7 +1013,7 @@ void sub_8032828(void) if (sub_8030894() != 0) break; ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_80306A8(1, 0, NULL, 6); break; case 0x15: @@ -1048,7 +1042,7 @@ void sub_8032828(void) case 0x1A: sub_8006518(gUnknown_203B33C->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_80151C0(4, gUnknown_203B33C->passwordBuffer); break; case 0x5A: @@ -1066,9 +1060,9 @@ void sub_8032828(void) case 0x5F: if (sub_801D008() == 0) { ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); { - struct UnkTextStruct2_sub local_x = {3, 2}; + UnkTextStruct2_sub local_x = {3, 2}; sub_801C8C4(0, 1, &local_x, 9); } } @@ -1113,7 +1107,7 @@ void sub_8032828(void) case 0x73: sub_8006518(gUnknown_203B33C->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_80151C0(4, gUnknown_203B33C->passwordBuffer); break; case 0x66: @@ -1123,7 +1117,7 @@ void sub_8032828(void) case 0x2E: sub_8006518(gUnknown_203B33C->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_8031D70(gUnknown_203B33C->unk218, 0); break; case 0x68: @@ -1229,7 +1223,7 @@ void sub_8032828(void) case 0x5C: if (sub_8030894() == 0) { ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_80306A8(5, 0, 0, 6); } break; @@ -1643,11 +1637,11 @@ void sub_8033DBC(void) { u32 return_var; u32 mailMode; - struct unkStruct_203B480 mail; - struct unkStruct_203B480 *mail2; + unkStruct_203B480 mail; + unkStruct_203B480 *mail2; return_var = sub_80154F0(); - MemoryFill8((u8 *)&mail, 0, sizeof(struct unkStruct_203B480)); + MemoryFill8((u8 *)&mail, 0, sizeof(unkStruct_203B480)); switch(return_var) { case 3: @@ -1697,7 +1691,7 @@ void sub_8033DBC(void) sub_80951FC(&mail); mail2 = GetMailatIndex(GetMailIndex(1, mail.unk10.unk10)); mail2->mailType = 7; - MemoryFill8((u8 *)gUnknown_203B484, 0, sizeof(struct unkStruct_203B484)); + MemoryFill8((u8 *)gUnknown_203B484, 0, sizeof(unkStruct_203B484)); SetFriendRescueMenuState(0x40); break; case 24: @@ -1709,7 +1703,7 @@ void sub_8033DBC(void) case 2: sub_80155F0(); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); + sub_800641C(gUnknown_203B33C->unk3BC, TRUE, TRUE); SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); break; default: @@ -1781,7 +1775,7 @@ void sub_8033FE4(void) gUnknown_203B33C->unk218 = sub_80307EC(); sub_8006518(gUnknown_203B33C->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_8030D40(gUnknown_203B33C->unk218, 0); SetFriendRescueMenuState(0x1F); break; @@ -1806,7 +1800,7 @@ void sub_8034074(void) gUnknown_203B33C->fallbackState = FRIEND_RESCUE_MENU_DEFAULT_FALLBACK; sub_8006518(gUnknown_203B33C->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_8030D40(gUnknown_203B33C->unk218, 0); SetFriendRescueMenuState(0x1F); break; @@ -1827,7 +1821,7 @@ void sub_8034130(void) case 3: sub_8030DE4(); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); + sub_800641C(gUnknown_203B33C->unk3BC, TRUE, TRUE); sub_803092C(); if(gUnknown_203B33C->fallbackState == FRIEND_RESCUE_MENU_DEFAULT_FALLBACK) { @@ -1864,7 +1858,7 @@ void sub_803418C(void) gUnknown_203B33C->speciesNum = sub_8023B44(); sub_8006518(gUnknown_203B33C->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_8024458(gUnknown_203B33C->speciesNum, 0); SetFriendRescueMenuState(0x28); break; @@ -1889,7 +1883,7 @@ void sub_8034254(void) gUnknown_203B33C->fallbackState = FRIEND_RESCUE_MENU_DEFAULT_FALLBACK; sub_8006518(gUnknown_203B33C->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_8024458(gUnknown_203B33C->speciesNum, 0); SetFriendRescueMenuState(0x28); break; @@ -1913,7 +1907,7 @@ void sub_8034310(void) case 3: sub_802453C(); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); + sub_800641C(gUnknown_203B33C->unk3BC, TRUE, TRUE); sub_8023B7C(1); if(gUnknown_203B33C->fallbackState == FRIEND_RESCUE_MENU_DEFAULT_FALLBACK) { @@ -2031,7 +2025,7 @@ void sub_80344C0(void) case 3: sub_8031E10(); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); + sub_800641C(gUnknown_203B33C->unk3BC, TRUE, TRUE); SetFriendRescueMenuState(0x2F); break; case 1: @@ -2059,7 +2053,7 @@ void sub_8034500(void) gUnknown_203B33C->unk218 = sub_80307EC(); sub_8006518(gUnknown_203B33C->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_8030D40(gUnknown_203B33C->unk218, 0); SetFriendRescueMenuState(0x34); break; @@ -2084,7 +2078,7 @@ void sub_8034590(void) gUnknown_203B33C->fallbackState = FRIEND_RESCUE_MENU_DEFAULT_FALLBACK; sub_8006518(gUnknown_203B33C->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_8030D40(gUnknown_203B33C->unk218, 0); SetFriendRescueMenuState(0x34); break; @@ -2105,7 +2099,7 @@ void sub_803464C(void) case 3: sub_8030DE4(); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); + sub_800641C(gUnknown_203B33C->unk3BC, TRUE, TRUE); sub_803092C(); if(gUnknown_203B33C->fallbackState == FRIEND_RESCUE_MENU_DEFAULT_FALLBACK) { @@ -2178,7 +2172,7 @@ void sub_803473C(void) case 3: sub_8031E10(); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); + sub_800641C(gUnknown_203B33C->unk3BC, TRUE, TRUE); SetFriendRescueMenuState(0x3B); break; case 1: @@ -2262,7 +2256,7 @@ void sub_8034848(void) s32 temp; if(sub_80144A4(&temp) == 0) { - MemoryFill8((u8 *)&gUnknown_203B33C->item, 0 , sizeof(struct Item)); + MemoryFill8((u8 *)&gUnknown_203B33C->item, 0 , sizeof(Item)); gUnknown_203B33C->item.id = ITEM_NOTHING; gUnknown_203B33C->item.quantity = 1; gUnknown_203B33C->item.flags = 0; @@ -2292,7 +2286,7 @@ void sub_80348C4(void) s32 temp; if(sub_80144A4(&temp) == 0) { - MemoryFill8((u8 *)&gUnknown_203B33C->item, 0 , sizeof(struct Item)); + MemoryFill8((u8 *)&gUnknown_203B33C->item, 0 , sizeof(Item)); gUnknown_203B33C->item.id = ITEM_NOTHING; gUnknown_203B33C->item.quantity = 1; gUnknown_203B33C->item.flags = 0; @@ -2337,7 +2331,7 @@ void sub_8034970(void) case 3: sub_8031E10(); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); + sub_800641C(gUnknown_203B33C->unk3BC, TRUE, TRUE); SetFriendRescueMenuState(0x68); break; case 1: @@ -2383,7 +2377,7 @@ void sub_80349E0(void) gUnknown_203B33C->unk218 = sub_80307EC(); sub_8006518(gUnknown_203B33C->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_8030D40(gUnknown_203B33C->unk218, 0); SetFriendRescueMenuState(0x5E); break; @@ -2408,7 +2402,7 @@ void sub_8034A70(void) gUnknown_203B33C->fallbackState = FRIEND_RESCUE_MENU_DEFAULT_FALLBACK; sub_8006518(gUnknown_203B33C->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_8030D40(gUnknown_203B33C->unk218, 0); SetFriendRescueMenuState(0x5E); break; @@ -2429,7 +2423,7 @@ void sub_8034B2C(void) case 3: sub_8030DE4(); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); + sub_800641C(gUnknown_203B33C->unk3BC, TRUE, TRUE); sub_803092C(); if(gUnknown_203B33C->fallbackState == FRIEND_RESCUE_MENU_DEFAULT_FALLBACK) { @@ -2464,7 +2458,7 @@ void sub_8034B88(void) gUnknown_203B33C->item.id = sub_801CB24(); sub_8006518(gUnknown_203B33C->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_801B3C0(&gUnknown_203B33C->item); SetFriendRescueMenuState(0x61); break; @@ -2479,7 +2473,7 @@ void sub_8034C38(void) case 3: sub_801B450(); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); + sub_800641C(gUnknown_203B33C->unk3BC, TRUE, TRUE); sub_801CB5C(TRUE); if(gUnknown_203B33C->fallbackState == FRIEND_RESCUE_MENU_DEFAULT_FALLBACK) { @@ -2513,7 +2507,7 @@ void sub_8034C98(void) gUnknown_203B33C->fallbackState = FRIEND_RESCUE_MENU_DEFAULT_FALLBACK; sub_8006518(gUnknown_203B33C->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_801B3C0(&gUnknown_203B33C->item); SetFriendRescueMenuState(0x61); break; @@ -2539,11 +2533,11 @@ void sub_8034D54(void) void sub_8034D74(void) { u32 return_var; - struct unkStruct_203B480 mail; - struct unkStruct_203B480 *mail2; + unkStruct_203B480 mail; + unkStruct_203B480 *mail2; return_var = sub_80154F0(); - MemoryFill8((u8 *)&mail, 0, sizeof(struct unkStruct_203B480)); + MemoryFill8((u8 *)&mail, 0, sizeof(unkStruct_203B480)); switch(return_var) { case 3: @@ -2577,7 +2571,7 @@ void sub_8034D74(void) case 2: sub_80155F0(); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B33C->unk3BC, 1, 1); + sub_800641C(gUnknown_203B33C->unk3BC, TRUE, TRUE); SetFriendRescueMenuState(FRIEND_RESCUE_MENU_MAIN); break; default: @@ -2654,7 +2648,7 @@ void sub_8034F58(void) void sub_8034F88(void) { s32 menuAction; - struct unkStruct_203B480 *mail; + unkStruct_203B480 *mail; if(sub_80144A4(&menuAction) == 0) { @@ -2850,7 +2844,7 @@ void sub_80351E0(void) void sub_8035210(void) { s32 menuAction; - struct unkStruct_203B480 *mail; + unkStruct_203B480 *mail; if(sub_80144A4(&menuAction) == 0) { diff --git a/src/game_options.c b/src/game_options.c index e83099501..f73d4b30c 100644 --- a/src/game_options.c +++ b/src/game_options.c @@ -1,6 +1,7 @@ #include "global.h" -#include "game_options.h" +#include "code_8009804.h" #include "code_8092334.h" +#include "game_options.h" struct WindowBG { @@ -16,17 +17,16 @@ struct unkStruct_8094CB0 extern struct WindowBG gWindowBGColors; -EWRAM_DATA_2 struct GameOptions *gGameOptionsRef = {0}; -EWRAM_DATA struct GameOptions gGameOptions = {0}; +EWRAM_DATA_2 GameOptions *gGameOptionsRef = {0}; +EWRAM_DATA GameOptions gGameOptions = {0}; extern void SetWindowBGColor(void); -extern void sub_80099F0(u32); void LoadGameOptions(void) { gGameOptionsRef = &gGameOptions; } -struct GameOptions * GetGameOptions(void) +GameOptions * GetGameOptions(void) { return &gGameOptions; } @@ -49,7 +49,7 @@ void InitializeGameOptions(bool8 initializeGender) SetWindowBGColor(); } -bool8 GameOptionsNotChange(struct GameOptions *r0) +bool8 GameOptionsNotChange(GameOptions *r0) { // NOTE: had to nest to match if(gGameOptionsRef->windowColor == r0->windowColor) diff --git a/src/ground_link.c b/src/ground_link.c index b8ee8853f..c9a300e38 100644 --- a/src/ground_link.c +++ b/src/ground_link.c @@ -14,8 +14,8 @@ struct unkStruct_203B4B8 }; EWRAM_DATA_2 struct unkStruct_203B4B8 gUnknown_203B4B8 = {0}; -extern struct DebugLocation gUnknown_8118798; -extern struct unkStruct_80A77D0 *sub_80A77D0(s16 r0, struct DebugLocation *r1); +extern DebugLocation gUnknown_8118798; +extern struct unkStruct_80A77D0 *sub_80A77D0(s16 r0, DebugLocation *r1); void sub_80AD868(void) { diff --git a/src/ground_main.c b/src/ground_main.c index ba5fc7611..8b4c3b4cb 100644 --- a/src/ground_main.c +++ b/src/ground_main.c @@ -1,19 +1,23 @@ #include "global.h" -#include "play_time.h" -#include "input.h" -#include "debug.h" -#include "code_80A26CC.h" -#include "event_flag.h" +#include "code_8009804.h" +#include "code_800C9CC.h" #include "code_80118A4.h" +#include "code_80A26CC.h" +#include "debug.h" +#include "event_flag.h" +#include "ground_main.h" +#include "ground_map_2.h" +#include "input.h" +#include "play_time.h" EWRAM_DATA u32 gUnknown_20398A8 = {0}; EWRAM_DATA u32 gUnknown_20398AC = {0}; EWRAM_DATA u32 gUnknown_20398B0 = {0}; EWRAM_DATA u32 gUnknown_20398B4 = {0}; EWRAM_DATA u8 gUnknown_20398B8 = {0}; -EWRAM_DATA u8 gUnknown_20398B9 = {0}; -EWRAM_DATA u8 gUnknown_20398BA = {0}; -EWRAM_DATA UNUSED static u8 gUnknown_20398BB = {0}; // NOTE: Needed for matching but not used +EWRAM_DATA bool8 gUnknown_20398B9 = {0}; +EWRAM_DATA bool8 gUnknown_20398BA = {0}; +UNUSED EWRAM_DATA static u8 gUnknown_20398BB = {0}; EWRAM_DATA u16 gUnknown_20398BC = {0}; EWRAM_DATA u16 gUnknown_20398BE = {0}; EWRAM_DATA u32 gUnknown_20398C0 = {0}; @@ -22,24 +26,9 @@ EWRAM_DATA s16 gUnknown_20398C4 = {0}; EWRAM_DATA_2 u8 gUnknown_203B49C = {0}; EWRAM_DATA_2 u8 gUnknown_203B49D = {0}; -const char gUnknown_8115F5C[] = "GroundMain ground request %3d %3d"; -const char gUnknown_8115F80[] = "GroundMain recue request %3d %3d"; -const char gUnknown_8115FA4[] = "GroundMain user rescue request %3d"; -const char gUnknown_8115FC8[] = "GroundMain game end request %3d"; -const char gUnknown_8115FE8[] = "GroundMain game cancel request %3d"; -static const char unused_text[] = "pksdir0"; -static const char unused_text1[] = "pksdir0"; +#include "data/ground_main.h" -struct unkStruct_811BAF4 -{ - s16 unk0; - s16 unk2; - s16 unk4; - s16 unk6; - u8 *text; -}; - -extern struct unkStruct_811BAF4 gUnknown_811BAF4[10]; +extern unkStruct_811BAF4 gUnknown_811BAF4[10]; extern void sub_809B57C(); extern void GroundScript_Unlock(); @@ -50,14 +39,11 @@ extern void sub_809CA20(); extern void sub_80A6E80(); extern void sub_8099BE4(); extern void sub_8099744(); -extern void sub_800CB20(); extern void nullsub_120(); -extern void sub_80A5E70(); extern void sub_809B638(); extern void nullsub_106(); extern void sub_80A73EC(); extern void sub_8099750(); -extern void sub_8009908(); extern void xxx_call_update_bg_sound_input(); extern void sub_80A6E68(); extern void GroundMap_Action(); @@ -66,7 +52,6 @@ extern void GroundLives_Action(); extern void GroundObject_Action(); extern void GroundEffect_Action(); -extern s32 sub_8001658(u8, u8); extern s32 sub_8001784(u8, u8, u8); extern void sub_809CB8C(); extern void sub_80015C0(u8, u8); @@ -76,10 +61,8 @@ extern void sub_8098CC8(); extern void GeneratePelipperJobs(); extern void sub_80961B4(); extern void ClearAllItems_8091FB4(); -extern const char *sub_80A2B18(s16); extern void ChooseKecleonShopInventory(u32); extern u8 sub_809C730(); -extern s16 sub_80A2750(s16); void sub_8098BDC(void) { @@ -115,31 +98,29 @@ void sub_8098BDC(void) void sub_8098C58(void) { s32 temp; - sub_80015C0(0, 0x36); - sub_80015C0(0, 0x39); + sub_80015C0(0, 54); + sub_80015C0(0, 57); sub_809CB8C(); sub_8001D88(); - if(sub_8001658(0, 0x2A) != 0) - { - temp = sub_8001658(0, 0x29); + if (sub_8001658(0, 42) != 0) { + temp = sub_8001658(0, 41); temp++; - if(temp > 0xF){ + if (temp > 15) temp = 0; - } - sub_80018D8(0, 0x29, temp); - sub_80018D8(0, 0x2A, 0); + + sub_80018D8(0, 41, temp); + sub_80018D8(0, 42, 0); } // TODO this uses r2 but it should be r3 // Else this matches so nonmatch for now #ifdef NONMATCHING - temp = sub_8001784(0, 0x42, 0); - if(temp <= 0) - { + temp = sub_8001784(0, 66, 0); + if (temp <= 0) temp = 1; - } - sub_800199C(0, 0x42, 0, temp - 1); + + sub_800199C(0, 66, 0, temp - 1); #else asm_unified("\tmovs r0, 0\n" "\tmovs r1, 0x42\n" @@ -191,7 +172,7 @@ bool8 GroundMainGroundRequest(s16 r0, u32 r1, u32 r2) temp = r0; // force a asr shift if(gUnknown_20398A8 == 0) { - Log(0, gUnknown_8115F5C, temp, r2); + Log(0, sFmtGroundRequest, temp, r2); gUnknown_20398A8 = 1; gUnknown_20398AC = 1; gUnknown_20398B0 = r2; @@ -242,7 +223,7 @@ bool8 GroundMainRescueRequest(s16 r0, u32 r1) s32 r2 = r0, r5 = r2; if(gUnknown_20398A8 == 0) { - Log(0, gUnknown_8115F80, r2, r1); + Log(0, sFmtRescueRequest, r2, r1); if(gUnknown_203B49D != 0) { gUnknown_20398A8 = 7; @@ -268,58 +249,53 @@ bool8 GroundMainRescueRequest(s16 r0, u32 r1) return FALSE; } -// Unused -u32 GroundMainUserRescueRequest(u32 r0) +UNUSED static bool8 GroundMainUserRescueRequest(u32 r0) { - if(gUnknown_20398A8 == 0) - { - if(gUnknown_203B49D != 0) - { - Log(0, gUnknown_8115FA4, r0); + if (gUnknown_20398A8 == 0) { + if(gUnknown_203B49D != 0) { + Log(0, sFmtUserRescueRequest, r0); gUnknown_20398A8 = 7; gUnknown_20398AC = 1; gUnknown_20398B0 = r0; sub_809C730(); - return 1; + return TRUE; } } - return 0; + return FALSE; } -u32 GroundMainGameEndRequest(u32 r0) +bool32 GroundMainGameEndRequest(u32 r0) { - if(gUnknown_20398A8 == 0) - { - Log(0, gUnknown_8115FC8, r0); + if (gUnknown_20398A8 == 0) { + Log(0, sFmtGameEndRequest, r0); gUnknown_20398A8 = 9; gUnknown_20398AC = 1; gUnknown_20398B0 = r0; sub_809C730(); - return 1; + return TRUE; } - return 0; + return FALSE; } -u32 GroundMainGameCancelRequest(u32 r0) +bool32 GroundMainGameCancelRequest(u32 r0) { - if(gUnknown_20398A8 == 0) - { - Log(0, gUnknown_8115FE8, r0); + if (gUnknown_20398A8 == 0) { + Log(0, sFmtGameCancelRequest, r0); gUnknown_20398A8 = 10; gUnknown_20398AC = 1; gUnknown_20398B0 = r0; sub_809C730(); - return 1; + return TRUE; } - return 0; + return FALSE; } -u32 sub_8098F88(void) +bool8 sub_8098F88(void) { return gUnknown_20398B9; } -u32 sub_8098F94(void) +bool8 sub_8098F94(void) { return gUnknown_20398BA; } @@ -334,13 +310,12 @@ const char *sub_8098FB4(void) return sub_80A2B18(sub_8001658(0, 0x11)); } - s16 sub_8098FCC(u32 unused) { s32 iVar4; s32 iVar5; s32 iVar6; - struct unkStruct_80A2608 *iVar3; + const unkStruct_80A2608 *iVar3; iVar5 = (s16)sub_8001658(0,0x13); iVar6 = iVar5; @@ -383,4 +358,4 @@ const char *sub_80990B8(void) { return sub_8098FB4(); } -} +} \ No newline at end of file diff --git a/src/ground_map.c b/src/ground_map.c index ba64b249a..54fb3c78a 100644 --- a/src/ground_map.c +++ b/src/ground_map.c @@ -1,33 +1,27 @@ #include "global.h" -#include "memory.h" #include "debug.h" +#include "ground_map.h" +#include "ground_map_2.h" #include "ground_script.h" +#include "memory.h" -IWRAM_DATA struct GroundScript_ExecutePP_1 *gUnknown_3001B6C = {0}; // iwram -IWRAM_DATA u8 *gUnknown_3001B70 = {0}; +IWRAM_DATA GroundScript_ExecutePP_1 *gUnknown_3001B6C = {0}; +IWRAM_DATA unkStruct_3001B70 *gUnknown_3001B70 = {0}; -extern struct DebugLocation gUnknown_8117538[]; +extern const u8 gUnknown_811736C[]; +extern const DebugLocation gUnknown_8117538[]; -extern u8 gUnknown_811736C[]; - -extern void sub_809D600(void *, u8 *, u32, u32, u32); -extern void GroundMap_Reset(void); -extern void sub_80A5E8C(u32); +extern void sub_809D600(void *, const u8 *, u32, u32, u32); extern void sub_809D648(void *); -extern void sub_80A5EBC(void); - -extern void sub_80A2D00(void *); +extern void sub_80A2D00(unkStruct_3001B70 *); extern void sub_80015C0(u32, u32); -extern void sub_80A5EDC(u32); -extern void sub_809D754(struct GroundScript_ExecutePP_1 *, struct DebugLocation *); -extern void sub_80A2D68(void *); -extern void nullsub_121(void); -extern void sub_80A2D88(void *); -extern void nullsub_122(void); +extern void sub_809D754(GroundScript_ExecutePP_1 *, const DebugLocation *); +extern void sub_80A2D68(unkStruct_3001B70 *); +extern void sub_80A2D88(unkStruct_3001B70 *); void sub_80A4A7C(void) { - gUnknown_3001B6C = MemoryAlloc(0x110, 6); + gUnknown_3001B6C = MemoryAlloc(sizeof(GroundScript_ExecutePP_1), 6); gUnknown_3001B6C->unkE4 = -1; sub_809D600(gUnknown_3001B6C, gUnknown_811736C, 0, -1, -1); sub_80A5E8C(0); @@ -48,25 +42,28 @@ void GroundMap_Reset(void) sub_80015C0(0, 0x37); sub_80015C0(0, 0x38); sub_809D754(gUnknown_3001B6C, gUnknown_8117538); - if(gUnknown_3001B70 != NULL) - { + + if (gUnknown_3001B70 != NULL) { sub_80A2D00(gUnknown_3001B70); MemoryFree(gUnknown_3001B70); gUnknown_3001B70 = NULL; } + sub_80A5EDC(0); } void sub_80A4B38(void) { nullsub_121(); - if(gUnknown_3001B70 != NULL) + + if (gUnknown_3001B70 != NULL) sub_80A2D68(gUnknown_3001B70); } void sub_80A4B54(void) { - if(gUnknown_3001B70 != NULL) + if (gUnknown_3001B70 != NULL) sub_80A2D88(gUnknown_3001B70); + nullsub_122(); -} +} \ No newline at end of file diff --git a/src/ground_map_1.c b/src/ground_map_1.c index 38cfdf052..80de304b3 100644 --- a/src/ground_map_1.c +++ b/src/ground_map_1.c @@ -1,108 +1,98 @@ #include "global.h" #include "debug.h" +#include "ground_main.h" #include "ground_map_1.h" #include "ground_script.h" -extern struct GroundScript_ExecutePP_1 *gUnknown_3001B6C; +extern GroundScript_ExecutePP_1 *gUnknown_3001B6C; -struct unkStruct_811BAF4 -{ - s16 unk0; - s16 unk2; - s16 unk4; - s16 unk6; - u8 *text; -}; +extern const u8 gUnknown_8117594[]; +extern const u8 gUnknown_81175EC[]; +extern const DebugLocation gUnknown_81175E0; +extern const DebugLocation gUnknown_8117644; +extern const u8 gUnknown_8117650[]; +extern const DebugLocation gUnknown_8117698; +extern const unkStruct_811BAF4 gUnknown_811BAF4[10]; -extern struct unkStruct_811BAF4 gUnknown_811BAF4[10]; +extern void GroundMap_GetStationScript(GroundScript_ExecutePP_3 *, s16, u32, u32); -extern struct DebugLocation gUnknown_8117698; -extern struct DebugLocation gUnknown_8117644; -extern struct DebugLocation gUnknown_81175E0; -extern u8 gUnknown_8117594[]; -extern u8 gUnknown_81175EC[]; -extern u8 gUnknown_8117650[]; - -extern void GroundMap_GetStationScript(struct GroundScript_ExecutePP_3 *, s16, u32, u32); - -bool8 GroundScript_ExecutePP(struct GroundScript_ExecutePP_1 *param_1, s32 *param_2, struct GroundScript_ExecutePP_3 *param_3, struct DebugLocation *unused); extern u8 sub_809D678(void *); -extern void sub_809D710(u8 *, struct GroundScript_ExecutePP_3 *, s32); +extern void sub_809D710(u8 *, GroundScript_ExecutePP_3 *, s32); extern bool8 sub_809D968(void *, s32); -void sub_80A4BE8(struct GroundScript_ExecutePP_3 *script, s16 r1) +static void sub_80A4BE8(GroundScript_ExecutePP_3 *script, s16 r1) { GroundMap_GetStationScript(script, r1, 0, 0); } void GroundMap_ExecuteEvent(s16 scriptIndex, u32 param_2) { - struct GroundScript_ExecutePP_3 script; - s32 index_s32; - u8 iVar2; + GroundScript_ExecutePP_3 script; + s32 index_s32; + u8 iVar2; - index_s32 = scriptIndex; - iVar2 = param_2; - - Log(0,gUnknown_8117594,index_s32,iVar2); // "GroundMap ExecuteEvent %3d %d - sub_809D710(NULL, &script, index_s32); - if (iVar2 != 0) { - script.scriptType = 5; - } - GroundScript_ExecutePP(gUnknown_3001B6C,0,&script,&gUnknown_81175E0); + index_s32 = scriptIndex; + iVar2 = param_2; + + Log(0,gUnknown_8117594, index_s32, iVar2); // "GroundMap ExecuteEvent %3d %d + sub_809D710(NULL, &script, index_s32); + if (iVar2 != 0) + script.scriptType = 5; + + GroundScript_ExecutePP(gUnknown_3001B6C, 0, &script, &gUnknown_81175E0); } void GroundMap_ExecuteStation(s16 param_1, s16 param_2, s8 param_3, u32 param_4) { - struct GroundScript_ExecutePP_3 script; - s32 iVar1; - s32 iVar2; - s32 iVar3; - u8 iVar4; + GroundScript_ExecutePP_3 script; + s32 iVar1; + s32 iVar2; + s32 iVar3; + u8 iVar4; - iVar1 = param_1; - iVar2 = param_2; - iVar3 = param_3; - iVar4 = param_4; - - Log(0,gUnknown_81175EC,iVar1,iVar2,iVar3,iVar4); // GroundMap ExecuteStation %3d %3d %3d %d - GroundMap_GetStationScript(&script,iVar1,iVar2,iVar3); - if (iVar4 != 0) { - script.scriptType = 5; - } - GroundScript_ExecutePP(gUnknown_3001B6C,0,&script,&gUnknown_8117644); + iVar1 = param_1; + iVar2 = param_2; + iVar3 = param_3; + iVar4 = param_4; + + Log(0, gUnknown_81175EC, iVar1, iVar2, iVar3, iVar4); // GroundMap ExecuteStation %3d %3d %3d %d + GroundMap_GetStationScript(&script, iVar1, iVar2, iVar3); + if (iVar4 != 0) + script.scriptType = 5; + + GroundScript_ExecutePP(gUnknown_3001B6C, 0, &script, &gUnknown_8117644); } void GroundMap_ExecuteEnter(s16 param_1) { - struct GroundScript_ExecutePP_3 script; - s32 iVar1; + GroundScript_ExecutePP_3 script; + s32 iVar1; - iVar1 = param_1; - - Log(0,gUnknown_8117650,iVar1); // GroundMap ExecuteEnter %3d - sub_80A4BE8(&script, iVar1); - script.scriptType = 2; - script.unk6 = 0; - script.unk8 = 0; - GroundScript_ExecutePP(gUnknown_3001B6C,0,&script,&gUnknown_8117698); + iVar1 = param_1; + + Log(0, gUnknown_8117650, iVar1); // GroundMap ExecuteEnter %3d + sub_80A4BE8(&script, iVar1); + script.scriptType = 2; + script.unk6 = 0; + script.unk8 = 0; + GroundScript_ExecutePP(gUnknown_3001B6C, 0, &script, &gUnknown_8117698); } -u8 sub_80A4D14(void) +UNUSED static u8 sub_80A4D14(void) { - return sub_809D678(gUnknown_3001B6C); + return sub_809D678(gUnknown_3001B6C); } bool8 sub_80A4D2C(s16 param_1) { - s32 iVar1 = param_1; - return sub_809D968(gUnknown_3001B6C,iVar1); + s32 iVar1 = param_1; + return sub_809D968(gUnknown_3001B6C, iVar1); } bool8 sub_80A4D48(s16 index) { - if (index == -1) return TRUE; - else if(gUnknown_811BAF4[index].unk0 == 5) return FALSE; - else if(gUnknown_811BAF4[index].unk0 != 8) return TRUE; - else return FALSE; -} + if (index == -1) return TRUE; + if (gUnknown_811BAF4[index].unk0 == 5) return FALSE; + if (gUnknown_811BAF4[index].unk0 != 8) return TRUE; + return FALSE; +} \ No newline at end of file diff --git a/src/ground_map_2.c b/src/ground_map_2.c index 458b89541..3819de6a1 100644 --- a/src/ground_map_2.c +++ b/src/ground_map_2.c @@ -1,87 +1,72 @@ #include "global.h" #include "memory.h" #include "debug.h" - -struct unkStruct_3001B74 -{ - // size: 0x24 - s16 unk0; - u8 unk2; - u32 unk4; - u32 unk8; - s32 unkC; - u32 unk10; - u32 unk14; - u32 unk18; - u32 unk1C; - u32 unk20; -}; - -IWRAM_DATA struct unkStruct_3001B74 *gUnknown_3001B74 = {0}; // iwram +#include "ground_map.h" +#include "ground_map_2.h" extern u16 gUnknown_2026E4E; -// size: 0x55C -IWRAM_DATA u8 *gUnknown_3001B78 = {0}; // iwram +IWRAM_DATA unkStruct_3001B74 *gUnknown_3001B74 = {0}; +IWRAM_DATA unkStruct_3001B70 *gUnknown_3001B78 = {0}; -extern u8 gUnknown_8117784[]; -extern s16 gUnknown_811E5F4[][2]; -extern u8 gGroundWeatherSelect[]; -extern u8 *gUnknown_3001B70; -extern s32 gUnknown_81177BC[]; +extern const u8 gUnknown_8117784[]; +extern const s16 gUnknown_811E5F4[][2]; +extern const u8 gGroundWeatherSelect[]; +extern const s32 gUnknown_81177BC[]; -extern void sub_80A3BB0(void* , u32); +extern void sub_80A3BB0(unkStruct_3001B70 *, u32); extern void sub_80018D8(u8, u8, u32); -extern void sub_80A2D00(void *); -extern void sub_80A2B40(void *, u8 *); -extern void sub_80A2FBC(void *, u32); -extern void sub_80A49E8(void *); -extern void sub_80A456C(void *, u32, s32 *); -extern void sub_80A4580(void *, u32, s32 *); +extern void sub_80A2D00(unkStruct_3001B70 *); +extern void sub_80A2B40(unkStruct_3001B70 *, const u8 *); +extern void sub_80A2FBC(unkStruct_3001B70 *, u32); +extern void sub_80A49E8(unkStruct_3001B70 *); +extern void sub_80A456C(unkStruct_3001B70 *, u32, const s32 *); +extern void sub_80A4580(unkStruct_3001B70 *, u32, s32 *); extern void sub_80A56C0(s32 *); -extern void sub_80A4764(void *); +extern void sub_80A4764(unkStruct_3001B70 *); -void sub_80A62D0(void); -void sub_80A5EDC(u8 param_1); +static void sub_80A62D0(void); void sub_80A5E70(void) { - if (gUnknown_3001B70 != NULL) { - sub_80A49E8(gUnknown_3001B70); - } - sub_80A62D0(); + if (gUnknown_3001B70 != NULL) + sub_80A49E8(gUnknown_3001B70); + + sub_80A62D0(); } void sub_80A5E8C(u8 param_1) { - gUnknown_3001B74 = MemoryAlloc(sizeof(struct unkStruct_3001B74), 6); - gUnknown_3001B74->unk0 = -1; - gUnknown_3001B74->unk2 = 0; - sub_80A5EDC(param_1); + gUnknown_3001B74 = MemoryAlloc(sizeof(unkStruct_3001B74), 6); + gUnknown_3001B74->unk0 = -1; + gUnknown_3001B74->unk2 = 0; + sub_80A5EDC(param_1); } void sub_80A5EBC(void) { - sub_80A5EDC(0); - MemoryFree(gUnknown_3001B74); - gUnknown_3001B74 = NULL; + sub_80A5EDC(0); + MemoryFree(gUnknown_3001B74); + gUnknown_3001B74 = NULL; } void sub_80A5EDC(u8 param_1) { - sub_80018D8(0, 0x1b, -1); - gUnknown_3001B74->unk0 = -1; - gUnknown_3001B74->unk2 = param_1; - if (gUnknown_3001B78 != NULL) { - sub_80A2D00(gUnknown_3001B78); - MemoryFree(gUnknown_3001B78); - gUnknown_3001B78 = NULL; - } - if (param_1 != 0) { - gUnknown_3001B78 = MemoryAlloc(0x55c,6); - sub_80A2B40(gUnknown_3001B78,gUnknown_8117784); - sub_80A2FBC(gUnknown_3001B78,-1); - } + sub_80018D8(0, 27, -1); + gUnknown_3001B74->unk0 = -1; + gUnknown_3001B74->unk2 = param_1; + + if (gUnknown_3001B78 != NULL) { + sub_80A2D00(gUnknown_3001B78); + MemoryFree(gUnknown_3001B78); + gUnknown_3001B78 = NULL; + } + + if (param_1) { + gUnknown_3001B78 = MemoryAlloc(sizeof(unkStruct_3001B70), 6); + sub_80A2B40(gUnknown_3001B78, gUnknown_8117784); + sub_80A2FBC(gUnknown_3001B78, -1); + } } void nullsub_121(void) @@ -92,44 +77,50 @@ void nullsub_122(void) void GroundWeather_Select(s16 param_1) { - s32 iVar2; - s32 iVar3; - s16 *pVar1; - - iVar2 = param_1; - iVar3 = iVar2; - Log(0,gGroundWeatherSelect,iVar2,gUnknown_3001B74->unk2); - sub_80018D8(0,0x1b,iVar2); - gUnknown_3001B74->unk0 = iVar2; - if (gUnknown_3001B74->unk2 != 0) { + s32 iVar2; + s32 iVar3; + const s16 *pVar1; + + iVar2 = param_1; + iVar3 = iVar2; + Log(0, gGroundWeatherSelect, iVar2, gUnknown_3001B74->unk2); + sub_80018D8(0, 27, iVar2); + gUnknown_3001B74->unk0 = iVar2; + + if (gUnknown_3001B74->unk2 == 0) + return; + if (iVar2 == -1) { - sub_80A2FBC(gUnknown_3001B78, -1); + sub_80A2FBC(gUnknown_3001B78, -1); + return; } - else { - pVar1 = gUnknown_811E5F4[iVar3]; - sub_80A2FBC(gUnknown_3001B78, pVar1[1]); - gUnknown_3001B74->unk4 = 0; - gUnknown_3001B74->unk8 = 0; - gUnknown_3001B74->unkC = 0; - gUnknown_3001B74->unk10 = 0; - gUnknown_3001B74->unk20 = 0; - gUnknown_3001B74->unk1C = 0; - gUnknown_3001B74->unk18 = 0; - gUnknown_3001B74->unk14 = 0; - switch(gUnknown_3001B74->unk0) { + + pVar1 = gUnknown_811E5F4[iVar3]; + sub_80A2FBC(gUnknown_3001B78, pVar1[1]); + + gUnknown_3001B74->unk4 = 0; + gUnknown_3001B74->unk8 = 0; + gUnknown_3001B74->unkC = 0; + gUnknown_3001B74->unk10 = 0; + gUnknown_3001B74->unk20 = 0; + gUnknown_3001B74->unk1C = 0; + gUnknown_3001B74->unk18 = 0; + gUnknown_3001B74->unk14 = 0; + + switch (gUnknown_3001B74->unk0) { case 9: - sub_80A3BB0(gUnknown_3001B78,1); + sub_80A3BB0(gUnknown_3001B78, 1); gUnknown_2026E4E = 0x40c; break; case 7: gUnknown_2026E4E = 0x808; break; - case 0xe: - sub_80A3BB0(gUnknown_3001B78,1); + case 14: + sub_80A3BB0(gUnknown_3001B78, 1); gUnknown_2026E4E = 0x1010; break; - case 0xf: - sub_80A3BB0(gUnknown_3001B78,1); + case 15: + sub_80A3BB0(gUnknown_3001B78, 1); gUnknown_2026E4E = 0x40c; break; case 0: @@ -140,17 +131,15 @@ void GroundWeather_Select(s16 param_1) gUnknown_2026E4E = 0x1010; break; default: - if (pVar1[0] == 1) { - sub_80A3BB0(gUnknown_3001B78,1); - } + if (pVar1[0] == 1) + sub_80A3BB0(gUnknown_3001B78, 1); + gUnknown_2026E4E = 0x1000; break; - } } - } } -s16 sub_80A60C4(void) +UNUSED static s16 sub_80A60C4(void) { return gUnknown_3001B74->unk0; } @@ -160,108 +149,111 @@ void nullsub_123(void) void sub_80A60D8(void) { - s32 r0; + s32 r0; #ifndef NONMATCHING register s32 r1 asm("r1"); #else s32 r1; #endif - s32 r3; - s32 r4; + s32 r3; + s32 r4; - s32 local_00[2]; // sp 0x0 - s32 local_08[2]; // sp 0x8 - s32 local_10[2]; // sp 0x10 - s32 local_18[2]; // sp 0x18 - s32 local_20[2]; // sp 0x20 - s16 *puVar1; - - if (gUnknown_3001B74->unk2 == 0) { - return; - } - switch((s16)(gUnknown_3001B74->unk0 + 1)) { - case 10: - r1 = gUnknown_3001B74->unk4; - r0 = r1 + 2; - gUnknown_3001B74->unk4 = r0; - r4 = gUnknown_3001B74->unk8; - r3 = r4 + 1; - gUnknown_3001B74->unk8 = r3; - if (r0 < 0) { - r0 = r1 + 5; - } - gUnknown_3001B74->unkC += (r0 >> 2); - r1 = r3; - if (r1 < 0) { - r1 = r4 + 4; - } - gUnknown_3001B74->unk10 += (r1 >> 2); - sub_80A4580(gUnknown_3001B78,0,&gUnknown_3001B74->unkC); - gUnknown_3001B74->unk4 &= 3; - gUnknown_3001B74->unk8 &= 3; - sub_80A56C0(local_00); - local_00[0] -= gUnknown_3001B74->unkC; - local_00[1] += gUnknown_3001B74->unk10; - sub_80A4580(gUnknown_3001B78,0,local_00); - sub_80A456C(gUnknown_3001B78,0,local_00); - break; - case 0xb: - case 0xc: - case 0xd: - case 0xe: - sub_80A56C0(local_08); - sub_80A456C(gUnknown_3001B78,0,local_08); - break; - case 0xf: - r1 = gUnknown_3001B74->unk4 ; - r0 = r1 + 1; - gUnknown_3001B74->unk4 = r0; - if (r0 < 0) { - r0 = r1 + 4; - } - gUnknown_3001B74->unkC += (r0 >> 2); - sub_80A4580(gUnknown_3001B78,0,&gUnknown_3001B74->unkC); - gUnknown_3001B74->unk4 &= 3; - sub_80A56C0(local_10); - local_10[0] -= gUnknown_3001B74->unkC; - local_10[1] = 0; - sub_80A4580(gUnknown_3001B78,0,local_10); - sub_80A456C(gUnknown_3001B78,0,local_10); - break; - case 0x10: - r1 = gUnknown_3001B74->unk4; - r0 = r1 + 2; - gUnknown_3001B74->unk4 = r0; - if (r0 < 0) { - r0 = r1 + 5; - } - gUnknown_3001B74->unkC += (r0 >> 2); - sub_80A4580(gUnknown_3001B78,0,&gUnknown_3001B74->unkC); - gUnknown_3001B74->unk4 &= 3; - sub_80A56C0(local_18); - local_18[0] -= gUnknown_3001B74->unkC; - local_18[1] = 0; - sub_80A4580(gUnknown_3001B78,0,local_18); - sub_80A456C(gUnknown_3001B78,0,local_18); - break; - default: - puVar1 = gUnknown_811E5F4[gUnknown_3001B74->unk0]; - if (puVar1[0] == 0) { - sub_80A56C0(local_20); - sub_80A456C(gUnknown_3001B78,0,local_20); + s32 local_00[2]; // sp 0x0 + s32 local_08[2]; // sp 0x8 + s32 local_10[2]; // sp 0x10 + s32 local_18[2]; // sp 0x18 + s32 local_20[2]; // sp 0x20 + const s16 *puVar1; + + if (gUnknown_3001B74->unk2 == 0) + return; + + switch ((s16)(gUnknown_3001B74->unk0 + 1)) { + case 10: + r1 = gUnknown_3001B74->unk4; + r0 = r1 + 2; + gUnknown_3001B74->unk4 = r0; + + r4 = gUnknown_3001B74->unk8; + r3 = r4 + 1; + gUnknown_3001B74->unk8 = r3; + + if (r0 < 0) + r0 = r1 + 5; + + gUnknown_3001B74->unkC += (r0 >> 2); + r1 = r3; + if (r1 < 0) + r1 = r4 + 4; + + gUnknown_3001B74->unk10 += (r1 >> 2); + sub_80A4580(gUnknown_3001B78, 0, &gUnknown_3001B74->unkC); + gUnknown_3001B74->unk4 &= 3; + gUnknown_3001B74->unk8 &= 3; + sub_80A56C0(local_00); + local_00[0] -= gUnknown_3001B74->unkC; + local_00[1] += gUnknown_3001B74->unk10; + sub_80A4580(gUnknown_3001B78, 0, local_00); + sub_80A456C(gUnknown_3001B78, 0, local_00); break; - } - // NOTE: Fallthrough needed here.. - case 0: - sub_80A456C(gUnknown_3001B78,0,gUnknown_81177BC); - break; - } - sub_80A4764(gUnknown_3001B78); + case 11: + case 12: + case 13: + case 14: + sub_80A56C0(local_08); + sub_80A456C(gUnknown_3001B78,0,local_08); + break; + case 15: + r1 = gUnknown_3001B74->unk4 ; + r0 = r1 + 1; + gUnknown_3001B74->unk4 = r0; + + if (r0 < 0) + r0 = r1 + 4; + + gUnknown_3001B74->unkC += (r0 >> 2); + sub_80A4580(gUnknown_3001B78, 0, &gUnknown_3001B74->unkC); + gUnknown_3001B74->unk4 &= 3; + sub_80A56C0(local_10); + local_10[0] -= gUnknown_3001B74->unkC; + local_10[1] = 0; + sub_80A4580(gUnknown_3001B78, 0, local_10); + sub_80A456C(gUnknown_3001B78, 0, local_10); + break; + case 16: + r1 = gUnknown_3001B74->unk4; + r0 = r1 + 2; + gUnknown_3001B74->unk4 = r0; + if (r0 < 0) + r0 = r1 + 5; + + gUnknown_3001B74->unkC += (r0 >> 2); + sub_80A4580(gUnknown_3001B78, 0, &gUnknown_3001B74->unkC); + gUnknown_3001B74->unk4 &= 3; + sub_80A56C0(local_18); + local_18[0] -= gUnknown_3001B74->unkC; + local_18[1] = 0; + sub_80A4580(gUnknown_3001B78, 0, local_18); + sub_80A456C(gUnknown_3001B78, 0, local_18); + break; + default: + puVar1 = gUnknown_811E5F4[gUnknown_3001B74->unk0]; + if (puVar1[0] == 0) { + sub_80A56C0(local_20); + sub_80A456C(gUnknown_3001B78,0,local_20); + break; + } + // NOTE: Fallthrough needed here.. + case 0: + sub_80A456C(gUnknown_3001B78, 0, gUnknown_81177BC); + break; + } + + sub_80A4764(gUnknown_3001B78); } -void sub_80A62D0(void) +static void sub_80A62D0(void) { - if (gUnknown_3001B74->unk2 != 0) { - sub_80A49E8(gUnknown_3001B78); - } -} + if (gUnknown_3001B74->unk2 != 0) + sub_80A49E8(gUnknown_3001B78); +} \ No newline at end of file diff --git a/src/ground_script.c b/src/ground_script.c index 6f845c8f6..b4b71328d 100644 --- a/src/ground_script.c +++ b/src/ground_script.c @@ -14,7 +14,7 @@ extern u8 gUnknown_8116594[]; extern u8 gUnknown_8116544[]; extern u8 gUnknown_811656C[]; -extern struct DebugLocation gUnknown_81165C8; +extern DebugLocation gUnknown_81165C8; extern void sub_809D520(void *); extern void sub_809D568(void *); @@ -22,24 +22,24 @@ extern u8 sub_80AC378(void); extern u8 sub_80AD290(void); extern u8 sub_80A8B74(void); extern u8 sub_809A750(void); -extern u8 *sub_80A2460(struct GroundScript_ExecutePP_1 *param_1, u32); +extern u8 *sub_80A2460(GroundScript_ExecutePP_1 *param_1, u32); void FatalError(u32 *, const char *, ...) __attribute__((noreturn)); -struct FunctionScript +typedef struct FunctionScript { u32 unk0; u8 *funcName; u8 *script; -}; +} FunctionScript; -extern struct FunctionScript gFunctionScriptTable[]; +extern FunctionScript gFunctionScriptTable[]; -void sub_809D6D8(struct GroundScript_ExecutePP_1 *param_1, s16 index, u8 *param_3) +void sub_809D6D8(GroundScript_ExecutePP_1 *param_1, s16 index, u8 *param_3) { param_1->unk14[index] = param_3; } -bool8 sub_809D6E4(struct GroundScript_ExecutePP_1 *param_1, struct GroundScript_ExecutePP_3 *script, s16 _index) +bool8 sub_809D6E4(GroundScript_ExecutePP_1 *param_1, GroundScript_ExecutePP_3 *script, s16 _index) { u8 *scriptPtr; s32 index = _index; @@ -52,7 +52,7 @@ bool8 sub_809D6E4(struct GroundScript_ExecutePP_1 *param_1, struct GroundScript_ return scriptPtr != NULL; } -void sub_809D710(struct GroundScript_ExecutePP_1 *param_1, struct GroundScript_ExecutePP_3 *script, s16 index) +void sub_809D710(GroundScript_ExecutePP_1 *param_1, GroundScript_ExecutePP_3 *script, s16 index) { s32 index_s32 = index; script->scriptPointer = gFunctionScriptTable[index_s32].script; @@ -67,14 +67,14 @@ void sub_809D710(struct GroundScript_ExecutePP_1 *param_1, struct GroundScript_E } } -bool8 sub_809D754(struct GroundScript_ExecutePP_1 *param_1, struct DebugLocation *unused) +bool8 sub_809D754(GroundScript_ExecutePP_1 *param_1, DebugLocation *unused) { sub_809D568(¶m_1->unk24); sub_809D568(¶m_1->unk84); return TRUE; } -bool8 sub_809D770(struct GroundScript_ExecutePP_1 *param_1, struct DebugLocation *unused) +bool8 sub_809D770(GroundScript_ExecutePP_1 *param_1, DebugLocation *unused) { sub_809D568(¶m_1->unk24); sub_809D568(¶m_1->unk84); @@ -82,7 +82,7 @@ bool8 sub_809D770(struct GroundScript_ExecutePP_1 *param_1, struct DebugLocation return TRUE; } -bool8 GroundScript_ExecutePP(struct GroundScript_ExecutePP_1 *param_1, s32 *param_2, struct GroundScript_ExecutePP_3 *param_3, struct DebugLocation *unused) +bool8 GroundScript_ExecutePP(GroundScript_ExecutePP_1 *param_1, s32 *param_2, GroundScript_ExecutePP_3 *param_3, const DebugLocation *unused) { if ((param_3 == NULL) || (param_3->scriptPointer == NULL)) { return FALSE; @@ -143,15 +143,15 @@ bool8 GroundScript_ExecutePP(struct GroundScript_ExecutePP_1 *param_1, s32 *para return TRUE; } -bool8 sub_809D8C0(struct GroundScript_ExecutePP_1 *param_1, s32 *param_2, s16 index, struct DebugLocation *debug) +bool8 sub_809D8C0(GroundScript_ExecutePP_1 *param_1, s32 *param_2, s16 index, DebugLocation *debug) { - struct GroundScript_ExecutePP_3 auStack28; + GroundScript_ExecutePP_3 auStack28; sub_809D6E4(param_1,&auStack28,index); return GroundScript_ExecutePP(param_1, param_2, &auStack28, debug); } -u8 sub_809D8EC(struct GroundScript_ExecutePP_1 *param_1, s16 param_2) +u8 sub_809D8EC(GroundScript_ExecutePP_1 *param_1, s16 param_2) { s32 param_2_s32; @@ -170,7 +170,7 @@ u8 sub_809D8EC(struct GroundScript_ExecutePP_1 *param_1, s16 param_2) } -bool8 GroundScript_Cancel(struct GroundScript_ExecutePP_1 *r0) +bool8 GroundScript_Cancel(GroundScript_ExecutePP_1 *r0) { // NOTE: Will always return TRUE return sub_809D770(r0, &gUnknown_81165C8); @@ -186,7 +186,7 @@ u8 sub_809D940(void) return ret; } -bool8 sub_809D968(struct GroundScript_ExecutePP_1 * param_1, s16 param_2) +bool8 sub_809D968(GroundScript_ExecutePP_1 *param_1, s16 param_2) { s16 sVar1; s16 sVar2; @@ -224,7 +224,7 @@ void sub_809D9E0(s16 index, s32 r1) gUnknown_2039A36 = 1; } -bool8 sub_809DA08(struct GroundScript_ExecutePP_1 *param_1, s16 index, u32 param_3) +bool8 sub_809DA08(GroundScript_ExecutePP_1 *param_1, s16 index, u32 param_3) { s32 index_s32; @@ -244,4 +244,4 @@ bool8 sub_809DA08(struct GroundScript_ExecutePP_1 *param_1, s16 index, u32 param param_1->unk24.unk2 = 2; gUnknown_2039A36 = 1; return TRUE; -} +} \ No newline at end of file diff --git a/src/ground_sprite.c b/src/ground_sprite.c index d60afed20..7a63b7a89 100644 --- a/src/ground_sprite.c +++ b/src/ground_sprite.c @@ -8,14 +8,14 @@ #include "memory.h" #include "sprite.h" -extern struct unkStruct_2039DB0 gUnknown_2039DB0; -extern struct unkStruct_2039DB0 gUnknown_2039DC0; +extern unkStruct_2039DB0 gUnknown_2039DB0; +extern unkStruct_2039DB0 gUnknown_2039DC0; extern u16 gUnknown_2039DCC; extern u16 gUnknown_2039DCE; extern u8 gUnknown_2039DD0; extern u32 gUnknown_2039DD4; -extern struct OpenedFile *gUnknown_203B4B4; -extern struct unkStruct_3001B7C *gUnknown_3001B7C; +extern OpenedFile *gUnknown_203B4B4; +extern unkStruct_3001B7C *gUnknown_3001B7C; // dungeon_sbin.s extern const struct FileArchive gDungeonFileArchive; @@ -41,11 +41,11 @@ extern void sub_80A6460(void); void sub_80A62F0(void) { s32 r0; - struct unkStruct_3001B7C_sub0 *sub0; - struct unkStruct_3001B7C_sub108 *sub108; + unkStruct_3001B7C_sub0 *sub0; + unkStruct_3001B7C_sub108 *sub108; s32 r6; - gUnknown_3001B7C = MemoryAlloc(sizeof(struct unkStruct_3001B7C), 6); + gUnknown_3001B7C = MemoryAlloc(sizeof(unkStruct_3001B7C), 6); gUnknown_203B4B4 = OpenFileAndGetFileDataPtr(gUnknown_81177CC, &gDungeonFileArchive); sub_800DAC0(1); @@ -74,8 +74,8 @@ void sub_80A62F0(void) void GroundSprite_Reset(s16 a0) { s32 uVar2; - struct unkStruct_2039DB0 *bee; - struct unkStruct_2039DB0 *see; + unkStruct_2039DB0 *bee; + unkStruct_2039DB0 *see; uVar2 = a0; @@ -112,7 +112,7 @@ void GroundSprite_Reset(s16 a0) void sub_80A6460(void) { - struct OpenedFile *file; + OpenedFile *file; s32 i; u8 *data; u16 something; @@ -136,8 +136,8 @@ void sub_80A64A4(void) u8 *r2; u16 r4; u32 r5; - struct OpenedFile *file; - struct unkStruct_3001B7C_sub108 *r7; + OpenedFile *file; + unkStruct_3001B7C_sub108 *r7; s32 i; s16 r9; u16 sl; diff --git a/src/gulpin_shop.c b/src/gulpin_shop.c index e297a0b95..642513059 100644 --- a/src/gulpin_shop.c +++ b/src/gulpin_shop.c @@ -1,5 +1,7 @@ #include "global.h" #include "code_80118A4.h" +#include "code_801EE10.h" +#include "code_801EE10_mid.h" #include "code_80130A8.h" #include "gulpin_shop.h" #include "pokemon.h" @@ -9,73 +11,64 @@ #include "text1.h" #include "text2.h" -extern struct GulpinShopWork *gGulpinShopWork; -extern const struct UnkTextStruct2 gUnknown_80DC11C; -extern const struct UnkTextStruct2 gUnknown_80DC134; +extern u8 gAvailablePokemonNames[]; // 202DF98 + +EWRAM_DATA_2 GulpinShopWork *sGulpinShopWork = {0}; + +// data_80D47B8.s extern const u8 *gUnknown_80D4920[]; extern const u8 *gUnknown_80D4928[]; extern const u8 *gUnknown_80D4970[]; -extern const u8 *gUnknown_80DC164[]; -extern const u8 gUnknown_80DC1A0[]; -extern const u8 gUnknown_80DC1FC[]; -extern const u8 gUnknown_80DC230[]; -extern u8 gAvailablePokemonNames[0x50 * 2]; -extern const u8 *gGulpinDialogue[2][25]; +extern const u8 *gGulpinDialogue[2][25]; // 80D8888 -void sub_801EC7C(void); -void sub_801ECBC(void); -void sub_801ED28(void); -void sub_801EDA4(void); -void sub_801EDC0(void); -void sub_801E980(void); -void sub_801EA28(void); -void sub_801EBC4(void); -extern void sub_801EE10(u32, s16, struct Move *, u32, void *, u32); -extern u32 sub_801EF38(u32); -extern u32 sub_801F194(void); -extern void sub_801F1B0(u32, u32); -extern void sub_801F214(void); -extern void sub_801F280(u32); -extern void sub_801F808(u16 *); -extern u32 sub_801F890(void); -extern void sub_801F8D0(void); -void SetGulpinShopState(u32); +#include "data/gulpin_shop.h" -u32 CreateGulpinShop(s32 isAsleep, s16 pokeSpecies, struct Move *moves) +static void SetGulpinShopState(u32); + +static void sub_801E980(void); +static void sub_801EA28(void); +static void sub_801EBC4(void); +static void sub_801EC7C(void); +static void sub_801ECBC(void); +static void sub_801ED28(void); +static void sub_801EDA4(void); +static void sub_801EDC0(void); + +bool8 CreateGulpinShop(s32 isAsleep, s16 pokeSpecies, Move *moves) { - struct OpenedFile *faceFile; - s32 species_32; + OpenedFile *faceFile; + s32 species_32; - species_32 = pokeSpecies; // dumb cast needed to get lsr/asr combo - - gGulpinShopWork = MemoryAlloc(sizeof(struct GulpinShopWork), 8); - gGulpinShopWork->isAsleep = isAsleep; - gGulpinShopWork->speciesNum = species_32; - gGulpinShopWork->moves = moves; - gGulpinShopWork->unk1C = moves[4].id; // 5th move..? + species_32 = pokeSpecies; // dumb cast needed to get lsr/asr combo - if (isAsleep == 0) - gGulpinShopWork->unk128 = &gGulpinShopWork->faceFile; - else - gGulpinShopWork->unk128 = NULL; + sGulpinShopWork = MemoryAlloc(sizeof(GulpinShopWork), 8); + sGulpinShopWork->isAsleep = isAsleep; + sGulpinShopWork->speciesNum = species_32; + sGulpinShopWork->moves = moves; + sGulpinShopWork->unk1C = moves[4].id; // 5th move..? - faceFile = GetDialogueSpriteDataPtr(MONSTER_GULPIN); - gGulpinShopWork->faceFile = faceFile; - gGulpinShopWork->faceData = faceFile->data; + if (isAsleep == 0) + sGulpinShopWork->unk128 = &sGulpinShopWork->faceFile; + else + sGulpinShopWork->unk128 = NULL; - gGulpinShopWork->unk124 = 0; - gGulpinShopWork->unk125 = 0; - gGulpinShopWork->unk126 = 0; + faceFile = GetDialogueSpriteDataPtr(MONSTER_GULPIN); + sGulpinShopWork->faceFile = faceFile; + sGulpinShopWork->faceData = faceFile->data; - gGulpinShopWork->unk120 = 2; - gGulpinShopWork->unk122 = 8; - SetGulpinShopState(0); - return 1; + sGulpinShopWork->unk124 = 0; + sGulpinShopWork->unk125 = 0; + sGulpinShopWork->unk126 = 0; + + sGulpinShopWork->unk120 = 2; + sGulpinShopWork->unk122 = 8; + SetGulpinShopState(0); + return TRUE; } u32 sub_801E8C0(void) { - switch (gGulpinShopWork->state) { + switch (sGulpinShopWork->state) { case 0: case 1: sub_801ECBC(); @@ -88,7 +81,7 @@ u32 sub_801E8C0(void) break; case 4: sub_801EDC0(); - if (gGulpinShopWork->state == 5) + if (sGulpinShopWork->state == 5) return 3; break; case 5: @@ -101,123 +94,119 @@ u32 sub_801E8C0(void) bool8 GulpinIsNextMoveLinked(void) { - return gGulpinShopWork->isNextMoveLinked; + return sGulpinShopWork->isNextMoveLinked; } void DestroyGulpinShop(void) { - if (gGulpinShopWork != NULL) { - CloseFile(gGulpinShopWork->faceFile); - MemoryFree(gGulpinShopWork); - gGulpinShopWork = NULL; + if (sGulpinShopWork != NULL) { + CloseFile(sGulpinShopWork->faceFile); + MemoryFree(sGulpinShopWork); + sGulpinShopWork = NULL; } } -void SetGulpinShopState(u32 newState) +static void SetGulpinShopState(u32 newState) { - gGulpinShopWork->state = newState; + sGulpinShopWork->state = newState; sub_801E980(); sub_801EA28(); } -void sub_801E980(void) +static void sub_801E980(void) { s32 index; - sub_8006518(gGulpinShopWork->unk12C); + sub_8006518(sGulpinShopWork->unk12C); - switch (gGulpinShopWork->state) { + switch (sGulpinShopWork->state) { case 2: sub_801EBC4(); - gGulpinShopWork->unk12C[1] = gUnknown_80DC11C; - gGulpinShopWork->unk12C[2] = gUnknown_80DC134; - sub_8012CAC(&gGulpinShopWork->unk12C[2], gGulpinShopWork->unk28); + sGulpinShopWork->unk12C[1] = gUnknown_80DC11C; + sGulpinShopWork->unk12C[2] = gUnknown_80DC134; + sub_8012CAC(&sGulpinShopWork->unk12C[2], sGulpinShopWork->unk28); break; default: for(index = 0; index < 4; index++) { - gGulpinShopWork->unk12C[index] = gUnknown_80DC11C; + sGulpinShopWork->unk12C[index] = gUnknown_80DC11C; } break; } ResetUnusedInputStruct(); - sub_800641C(gGulpinShopWork->unk12C, 1, 1); + sub_800641C(sGulpinShopWork->unk12C, TRUE, TRUE); } -void sub_801EA28(void) +static void sub_801EA28(void) { - switch (gGulpinShopWork->state) { + switch (sGulpinShopWork->state) { case 0: - sub_801EE10(2, gGulpinShopWork->speciesNum, gGulpinShopWork->moves, 0, gUnknown_80DC164, 0); + sub_801EE10(2, sGulpinShopWork->speciesNum, sGulpinShopWork->moves, 0, sWillAMoveBeForgotten, 0); break; case 1: - sub_801F1B0(1, 0); + sub_801F1B0(TRUE, FALSE); break; case 2: sub_801F280(0); - sub_8012D60(&gGulpinShopWork->unk78, gGulpinShopWork->unk28, 0, gGulpinShopWork->unk68, gGulpinShopWork->unk24, 2); + sub_8012D60(&sGulpinShopWork->unk78, sGulpinShopWork->unk28, 0, sGulpinShopWork->unk68, sGulpinShopWork->unk24, 2); break; case 3: - GetLinkedSequence(gGulpinShopWork->unk20, gGulpinShopWork->moves, &gGulpinShopWork->unk14[0]); - sub_801F808(&gGulpinShopWork->unk14[0]); + GetLinkedSequence(sGulpinShopWork->unk20, sGulpinShopWork->moves, &sGulpinShopWork->unk14[0]); + sub_801F808(&sGulpinShopWork->unk14[0]); break; case 4: sub_801EC7C(); - sub_8092C84(gAvailablePokemonNames, gGulpinShopWork->unk1C); - sub_8092C84(&gAvailablePokemonNames[0x50], gGulpinShopWork->unk1E); + sub_8092C84(gAvailablePokemonNames, sGulpinShopWork->unk1C); + sub_8092C84(&gAvailablePokemonNames[0x50], sGulpinShopWork->unk1E); - switch (gGulpinShopWork->isAsleep) { + switch (sGulpinShopWork->isAsleep) { case 0: case 1: - if (gGulpinShopWork->isNextMoveLinked) - sub_8014248(gGulpinDialogue[gGulpinShopWork->isAsleep][12], 0, 5, &gGulpinShopWork->unk28[0], - &gGulpinShopWork->unk68, 4, 0, gGulpinShopWork->unk128, 12); // Forget the move and any moves linked to it and learn? + if (sGulpinShopWork->isNextMoveLinked) + sub_8014248(gGulpinDialogue[sGulpinShopWork->isAsleep][12], 0, 5, &sGulpinShopWork->unk28[0], &sGulpinShopWork->unk68, 4, 0, sGulpinShopWork->unk128, 12); else - sub_8014248(gGulpinDialogue[gGulpinShopWork->isAsleep][11], 0, 5, &gGulpinShopWork->unk28[0], - &gGulpinShopWork->unk68, 4, 0, gGulpinShopWork->unk128, 12); // Forget the move and learn? + sub_8014248(gGulpinDialogue[sGulpinShopWork->isAsleep][11], 0, 5, &sGulpinShopWork->unk28[0], &sGulpinShopWork->unk68, 4, 0, sGulpinShopWork->unk128, 12); break; case 2: - if (gGulpinShopWork->isNextMoveLinked) - sub_8014248(gUnknown_80DC1A0, 0, 5, &gGulpinShopWork->unk28[0], - &gGulpinShopWork->unk68, 4, 0, NULL, 32); + if (sGulpinShopWork->isNextMoveLinked) + sub_8014248(sForgetMoveAndLinkedOnes, 0, 5, &sGulpinShopWork->unk28[0], &sGulpinShopWork->unk68, 4, 0, NULL, 32); else - sub_8014248(gUnknown_80DC1FC, 0, 5, &gGulpinShopWork->unk28[0], - &gGulpinShopWork->unk68, 4, 0, NULL, 32); + sub_8014248(sForgetMoveOnly, 0, 5, &sGulpinShopWork->unk28[0], &sGulpinShopWork->unk68, 4, 0, NULL, 32); break; } break; } } -void sub_801EBC4(void) +static void sub_801EBC4(void) { s32 which; s32 i; which = 0; - MemoryFill16(gGulpinShopWork->unk68, 0, sizeof(gGulpinShopWork->unk68)); + MemoryFill16(sGulpinShopWork->unk68, 0, sizeof(sGulpinShopWork->unk68)); - gGulpinShopWork->unk28[which].text = gUnknown_80DC230; // "Forget" - gGulpinShopWork->unk28[which].menuAction = 2; + sGulpinShopWork->unk28[which].text = sForget; + sGulpinShopWork->unk28[which].menuAction = 2; - if (!IsAnyMoveLinked(gGulpinShopWork->unk1E, gGulpinShopWork->moves) || (s32)gGulpinShopWork->unk20 >= 4) - gGulpinShopWork->unk68[0] = 1; + if (!IsAnyMoveLinked(sGulpinShopWork->unk1E, sGulpinShopWork->moves) || (s32)sGulpinShopWork->unk20 >= 4) + sGulpinShopWork->unk68[0] = 1; which++; - gGulpinShopWork->unk28[which].text = *gUnknown_80D4970; // "Info" - gGulpinShopWork->unk28[which].menuAction = 3; + sGulpinShopWork->unk28[which].text = *gUnknown_80D4970; + sGulpinShopWork->unk28[which].menuAction = 3; which++; - gGulpinShopWork->unk28[which].text = NULL; - gGulpinShopWork->unk28[which].menuAction = 1; + sGulpinShopWork->unk28[which].text = NULL; + sGulpinShopWork->unk28[which].menuAction = 1; i = 0; if (i < which) { - if (gGulpinShopWork->unk68[0] == 0) - gGulpinShopWork->unk24 = gGulpinShopWork->unk28[0].menuAction; + if (sGulpinShopWork->unk68[0] == 0) + sGulpinShopWork->unk24 = sGulpinShopWork->unk28[0].menuAction; else { while (i < which) { - if (gGulpinShopWork->unk68[i] == 0) { - gGulpinShopWork->unk24 = gGulpinShopWork->unk28[i].menuAction; + if (sGulpinShopWork->unk68[i] == 0) { + sGulpinShopWork->unk24 = sGulpinShopWork->unk28[i].menuAction; break; } i++; @@ -226,42 +215,42 @@ void sub_801EBC4(void) } } -void sub_801EC7C(void) +static void sub_801EC7C(void) { s32 which; which = 0; - MemoryFill16(gGulpinShopWork->unk68, 0, sizeof(gGulpinShopWork->unk68)); - gGulpinShopWork->unk28[which].text = *gUnknown_80D4920; // "Yes" - gGulpinShopWork->unk28[which].menuAction = 4; + MemoryFill16(sGulpinShopWork->unk68, 0, sizeof(sGulpinShopWork->unk68)); + sGulpinShopWork->unk28[which].text = *gUnknown_80D4920; + sGulpinShopWork->unk28[which].menuAction = 4; which++; - gGulpinShopWork->unk28[which].text = *gUnknown_80D4928; // "No" - gGulpinShopWork->unk28[which].menuAction = 5; + sGulpinShopWork->unk28[which].text = *gUnknown_80D4928; + sGulpinShopWork->unk28[which].menuAction = 5; which++; - gGulpinShopWork->unk28[which].text = NULL; - gGulpinShopWork->unk28[which].menuAction = 1; + sGulpinShopWork->unk28[which].text = NULL; + sGulpinShopWork->unk28[which].menuAction = 1; } -void sub_801ECBC(void) +static void sub_801ECBC(void) { switch (sub_801EF38(1)) { case 3: { - struct Move* move; - gGulpinShopWork->unk20 = sub_801F194(); - move = gGulpinShopWork->moves; - move = &move[gGulpinShopWork->unk20]; - gGulpinShopWork->unk1E = move->id; + Move* move; + sGulpinShopWork->unk20 = sub_801F194(); + move = sGulpinShopWork->moves; + move = &move[sGulpinShopWork->unk20]; + sGulpinShopWork->unk1E = move->id; SetGulpinShopState(2); break; } case 4: { - struct Move* move; - gGulpinShopWork->unk20 = sub_801F194(); - move = gGulpinShopWork->moves; - move = &move[gGulpinShopWork->unk20]; - gGulpinShopWork->unk1E = move->id; + Move* move; + sGulpinShopWork->unk20 = sub_801F194(); + move = sGulpinShopWork->moves; + move = &move[sGulpinShopWork->unk20]; + sGulpinShopWork->unk1E = move->id; SetGulpinShopState(3); break; } @@ -272,14 +261,14 @@ void sub_801ECBC(void) } } -void sub_801ED28(void) +static void sub_801ED28(void) { s32 menuAction; menuAction = 0; sub_801EF38(0); - if (sub_8012FD8(&gGulpinShopWork->unk78) == 0) - sub_8013114(&gGulpinShopWork->unk78, &menuAction); + if (sub_8012FD8(&sGulpinShopWork->unk78) == 0) + sub_8013114(&sGulpinShopWork->unk78, &menuAction); switch (menuAction) { case 1: @@ -288,7 +277,7 @@ void sub_801ED28(void) break; case 2: PlaySound(0x133); - gGulpinShopWork->isNextMoveLinked = IsNextMoveLinked(gGulpinShopWork->unk20, gGulpinShopWork->moves); + sGulpinShopWork->isNextMoveLinked = IsNextMoveLinked(sGulpinShopWork->unk20, sGulpinShopWork->moves); SetGulpinShopState(4); break; case 3: @@ -297,7 +286,7 @@ void sub_801ED28(void) } } -void sub_801EDA4(void) +static void sub_801EDA4(void) { switch (sub_801F890()) { case 2: @@ -311,7 +300,7 @@ void sub_801EDA4(void) } } -void sub_801EDC0(void) +static void sub_801EDC0(void) { s32 temp; @@ -319,8 +308,8 @@ void sub_801EDC0(void) switch (temp) { case 4: sub_801F214(); - RemoveLinkSequenceFromMoves8(gGulpinShopWork->moves, gGulpinShopWork->unk20); - gGulpinShopWork->state = 5; + RemoveLinkSequenceFromMoves8(sGulpinShopWork->moves, sGulpinShopWork->unk20); + sGulpinShopWork->state = 5; break; case 1: case 5: @@ -328,4 +317,4 @@ void sub_801EDC0(void) break; } } -} +} \ No newline at end of file diff --git a/src/gulpin_shop_1.c b/src/gulpin_shop_801FB50.c similarity index 80% rename from src/gulpin_shop_1.c rename to src/gulpin_shop_801FB50.c index 8ecaf3841..68cd83752 100644 --- a/src/gulpin_shop_1.c +++ b/src/gulpin_shop_801FB50.c @@ -1,184 +1,109 @@ #include "global.h" +#include "code_80118A4.h" +#include "code_80130A8.h" +#include "code_801C620.h" +#include "code_801EE10.h" +#include "code_801EE10_1.h" +#include "code_801EE10_mid.h" +#include "felicity_bank.h" +#include "gulpin_shop.h" +#include "gulpin_shop_801FB50.h" #include "memory.h" -#include "pokemon.h" +#include "menu_input.h" +#include "moves.h" #include "pokemon_3.h" +#include "pokemon_mid.h" #include "text1.h" #include "text2.h" -#include "team_inventory.h" -#include "menu_input.h" -#include "gulpin_shop.h" -#include "moves.h" -#include "felicity_bank.h" -#include "code_80130A8.h" -#include "code_801EE10_1.h" -#include "code_80118A4.h" -// size: 0x1E0 -struct unkStruct_203B27C -{ - /* 0x0 */ bool32 isAsleep; - /* 0x4 */ s32 state; - /* 0x8 */ u32 fallbackState; - /* 0xC */ s16 speciesNum; - /* 0x10 */ struct PokemonStruct *pokeStruct; - /* 0x14 */ bool8 isNextMoveLinked; - bool8 unk15; - /* 0x16 */ bool8 isTeamLeader; - /* 0x18 */ u32 moveIndex; - // Group of move ids but not sure purpose just yet... - u16 unk1C; - u16 unk1E; - u16 unk20; - /* 0x24 */ struct Move moves[MAX_MON_MOVES * 2]; - /* 0x64 */ u16 sequenceMoveIDs[MAX_MON_MOVES]; - /* 0x6C */ u32 menuAction1; - /* 0x70 */ u32 menuAction2; - /* 0x74 */ u32 menuAction3; - /* 0x78 */ u32 menuAction4; - struct MenuItem unk7C[8]; - u16 unkBC[8]; - struct MenuStruct unkCC; - u8 fill11C[0x16C - 0x11C]; - /* 0x16C */ struct OpenedFile *faceFile; - /* 0x170 */ u8 *faceData; - u16 unk174; - u16 unk176; - u8 unk178; - u8 unk179; - u8 unk17A; - struct OpenedFile **unk17C; - struct UnkTextStruct2 unk180[4]; -}; +EWRAM_DATA_2 unkStruct_203B27C *gUnknown_203B27C = {0}; -EWRAM_DATA_2 struct unkStruct_203B27C *gUnknown_203B27C = {0}; - -extern u8 gAvailablePokemonNames[]; +extern u8 gAvailablePokemonNames[]; // 202DF98 extern u8 gUnknown_202DFE8[]; +extern u8 gUnknown_202E128[]; extern u8 gUnknown_202E1C8[]; extern u8 gUnknown_202E5D8[]; -extern struct UnkTextStruct2 gUnknown_80DC31C; -extern struct UnkTextStruct2 gUnknown_80DC334; -extern struct UnkTextStruct2 gUnknown_80DC31C; -extern struct UnkTextStruct2 gUnknown_80DC34C; -extern struct UnkTextStruct2 gUnknown_80DC37C; +extern const u8 *gUnknown_80D4920[]; +extern const u8 *gUnknown_80D4928[]; +extern const u8 *gUnknown_80D4934[]; +extern const u8 *gUnknown_80D4970[]; +extern const u8 *gGulpinDialogue[2][25]; // 80D8888 -extern const u8 *gGulpinDialogue[2][25]; -extern u8 gUnknown_80DC3D8[]; -extern u8 gUnknown_80DC3E0[]; -extern u8 gUnknown_80DC3E8[]; -extern u8 gUnknown_80DC3F4[]; -extern u8 gUnknown_80DC394[]; -extern u8 gGulpinProceed[]; -extern u8 gGulpinInfo[]; -extern u8 *gUnknown_80D4934[]; -extern u8 *gUnknown_80D4920[]; -extern u8 *gUnknown_80D4928[]; -extern u8 gGulpinForget[]; -extern u8 gGulpinLink[]; -extern u8 gGulpinDelink[]; -extern u8 gGulpinSet[]; -extern u8 gGulpinDeselect[]; -extern u8 *gUnknown_80D4970[]; -extern u8 gUnknown_80DC428[]; -extern u8 gUnknown_80DC438[]; -extern u8 gUnknown_80DC448[]; -extern u8 gUnknown_202E128[]; +#include "data/gulpin_shop_801FB50.h" -bool8 sub_8021178(void); -void CreateGulpinShopMenu(void); -void sub_8020950(void); -void sub_8020900(void); -bool8 sub_801F808(u16 *moveIDs); -void sub_801F700(void); -bool8 sub_801F428(s16 index, s32 param_2); -void sub_801F5F0(u8 r0); -extern void sub_801F1B0(u32, u32); -extern void sub_801F280(u32); -void sub_8024458(u32, u32); -extern void sub_801BEEC(s16); -extern void sub_801EE10(u32, s16, struct Move *, u32, void *, u32); -void sub_80208B0(void); -void PrintPokeNameToBuffer(u8 *buffer, struct PokemonStruct *pokemon); -extern struct PokemonStruct *GetPlayerPokemonStruct(void); -extern void sub_801FDA8(s32); -extern void sub_8020A80(void); -extern void sub_8020B38(void); -extern void sub_8020C2C(void); -extern void sub_8020C48(void); -extern void sub_8020C64(void); -extern void sub_8020CC0(void); -extern void sub_8020D74(void); -extern void sub_8020D90(void); -extern void sub_8020DCC(void); -extern void sub_8020EB4(void); -extern void sub_80210C8(void); -extern void sub_80210E4(void); -extern void sub_8021154(void); -extern void sub_80209AC(void); -extern void sub_8021130(void); -extern void sub_80209FC(void); -extern void sub_8020A34(void); -extern void sub_801FDC0(void); -extern void sub_801FF28(void); +// code_801EE10_1.c (return var type) extern u32 sub_80244E4(void); -extern u32 sub_801BF48(void); -extern void sub_802453C(void); -extern void sub_801BF98(void); -extern u32 sub_801F520(u32); -extern void sub_801F63C(void); -extern u16 sub_801F5B4(void); -extern void sub_801F8D0(void); -extern u32 sub_801F890(void); -extern u32 sub_801E8C0(void); -extern u32 sub_801F194(void); -bool8 sub_801F1A4(void); -void sub_801F214(void); -extern u32 sub_801EF38(u32); -extern void CreateGulpinLinkMenu(void); -extern void sub_802069C(void); -extern void sub_80205D0(void); +static void CreateGulpinLinkMenu(void); +static void CreateGulpinShopMenu(void); -bool8 sub_801FB50(bool32 isAsleep) +static void sub_801FDA8(s32); +static void sub_801FDC0(void); +static void sub_801FF28(void); +static void sub_80205D0(void); +static void sub_802069C(void); +static void sub_80208B0(void); +static void sub_8020900(void); +static void sub_8020950(void); +static void sub_80209AC(void); +static void sub_80209FC(void); +static void sub_8020A34(void); +static void sub_8020A80(void); +static void sub_8020B38(void); +static void sub_8020C2C(void); +static void sub_8020C48(void); +static void sub_8020C64(void); +static void sub_8020CC0(void); +static void sub_8020D74(void); +static void sub_8020D90(void); +static void sub_8020DCC(void); +static void sub_8020EB4(void); +static void sub_80210C8(void); +static void sub_80210E4(void); +static void sub_8021130(void); +static void sub_8021154(void); +static bool8 sub_8021178(void); + +bool8 sub_801FB50(u32 mode) { - char *name; - struct OpenedFile *faceFile; - - ResetUnusedInputStruct(); - sub_800641C(0,1,1); - gUnknown_203B27C = MemoryAlloc(sizeof(struct unkStruct_203B27C), 0x8); - gUnknown_203B27C->menuAction2 = 0; - gUnknown_203B27C->menuAction3 = 0; - gUnknown_203B27C->menuAction4 = 0; - gUnknown_203B27C->isAsleep = isAsleep; - gUnknown_203B27C->unk15 = FALSE; - CopyYellowMonsterNametoBuffer(gUnknown_202E5D8,MONSTER_GULPIN); - CopyYellowMonsterNametoBuffer(gUnknown_202E1C8,MONSTER_GULPIN); - name = GetMonSpecies(MONSTER_GULPIN); - strcpy(gUnknown_202E1C8 - 0x50, name); - PrintPokeNameToBuffer(gUnknown_202E1C8 - 0xF0, GetPlayerPokemonStruct()); - if (gUnknown_203B27C->isAsleep == 1) { - gUnknown_203B27C->unk17C = NULL; - } - else { - gUnknown_203B27C->unk17C = &gUnknown_203B27C->faceFile; - } - faceFile = GetDialogueSpriteDataPtr(MONSTER_GULPIN); - gUnknown_203B27C->faceFile = faceFile; - gUnknown_203B27C->faceData = faceFile->data; - gUnknown_203B27C->unk178 = 0; - gUnknown_203B27C->unk179 = 0; - gUnknown_203B27C->unk17A = 0; - gUnknown_203B27C->unk174 = 2; - gUnknown_203B27C->unk176 = 8; - sub_801FDA8(0); - return TRUE; + u8 *name; + OpenedFile *faceFile; + + ResetUnusedInputStruct(); + sub_800641C(NULL, TRUE, TRUE); + gUnknown_203B27C = MemoryAlloc(sizeof(unkStruct_203B27C), 0x8); + gUnknown_203B27C->menuAction2 = 0; + gUnknown_203B27C->menuAction3 = 0; + gUnknown_203B27C->menuAction4 = 0; + gUnknown_203B27C->isAsleep = mode; + gUnknown_203B27C->unk15 = FALSE; + CopyYellowMonsterNametoBuffer(gUnknown_202E5D8, MONSTER_GULPIN); + CopyYellowMonsterNametoBuffer(gUnknown_202E1C8, MONSTER_GULPIN); + name = GetMonSpecies(MONSTER_GULPIN); + strcpy(gUnknown_202E1C8 - 80, name); + PrintPokeNameToBuffer(gUnknown_202E1C8 - 0xF0, GetPlayerPokemonStruct()); + + if (gUnknown_203B27C->isAsleep == TRUE) + gUnknown_203B27C->unk17C = NULL; + else + gUnknown_203B27C->unk17C = &gUnknown_203B27C->faceFile; + + faceFile = GetDialogueSpriteDataPtr(MONSTER_GULPIN); + gUnknown_203B27C->faceFile = faceFile; + gUnknown_203B27C->faceData = faceFile->data; + gUnknown_203B27C->unk178 = 0; + gUnknown_203B27C->unk179 = 0; + gUnknown_203B27C->unk17A = 0; + gUnknown_203B27C->unk174 = 2; + gUnknown_203B27C->unk176 = 8; + sub_801FDA8(0); + return TRUE; } u32 sub_801FC40(void) { - switch(gUnknown_203B27C->state) { + switch (gUnknown_203B27C->state) { case 0: case 1: sub_8021154(); @@ -232,9 +157,8 @@ u32 sub_801FC40(void) sub_80210E4(); break; case 0xd: - if (gUnknown_203B27C->unk15 == TRUE) { + if (gUnknown_203B27C->unk15 == TRUE) gTeamInventoryRef->teamMoney -= 150; - } return 3; default: sub_8021130(); @@ -245,49 +169,48 @@ u32 sub_801FC40(void) void sub_801FD7C(void) { - if(gUnknown_203B27C) - { + if (gUnknown_203B27C) { CloseFile(gUnknown_203B27C->faceFile); MemoryFree(gUnknown_203B27C); gUnknown_203B27C = NULL; } } -void sub_801FDA8(s32 newState) +static void sub_801FDA8(s32 newState) { gUnknown_203B27C->state = newState; sub_801FDC0(); sub_801FF28(); } -void sub_801FDC0(void) +static void sub_801FDC0(void) { s32 index; sub_8006518(gUnknown_203B27C->unk180); - switch(gUnknown_203B27C->state) - { + + switch (gUnknown_203B27C->state) { case 0x2: gUnknown_203B27C->unk180[0].unk0 = 0x80; gUnknown_203B27C->unk180[1].unk0 = 0x80; gUnknown_203B27C->unk180[2].unk0 = 0x80; gUnknown_203B27C->unk180[3] = gUnknown_80DC37C; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B27C->unk180, 1, 0); + sub_800641C(gUnknown_203B27C->unk180, TRUE, FALSE); break; case 0x11: sub_80205D0(); gUnknown_203B27C->unk180[2] = gUnknown_80DC334; sub_8012CAC(&gUnknown_203B27C->unk180[2], gUnknown_203B27C->unk7C); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B27C->unk180, 1, 1); + sub_800641C(gUnknown_203B27C->unk180, TRUE, TRUE); break; case 0x17: sub_802069C(); gUnknown_203B27C->unk180[2] = gUnknown_80DC334; sub_8012CAC(&gUnknown_203B27C->unk180[2], gUnknown_203B27C->unk7C); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B27C->unk180, 1, 1); + sub_800641C(gUnknown_203B27C->unk180, TRUE, TRUE); break; case 0x20: CreateGulpinLinkMenu(); @@ -295,20 +218,19 @@ void sub_801FDC0(void) gUnknown_203B27C->unk180[2] = gUnknown_80DC34C; sub_8012CAC(&gUnknown_203B27C->unk180[2], gUnknown_203B27C->unk7C); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B27C->unk180, 1, 1); + sub_800641C(gUnknown_203B27C->unk180, TRUE, TRUE); break; default: - for(index = 0; index < 4; index++) - { - gUnknown_203B27C->unk180[index] = gUnknown_80DC31C; - } + for (index = 0; index < 4; index++) + gUnknown_203B27C->unk180[index] = gUnknown_80DC31C; + ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B27C->unk180, 1, 1); + sub_800641C(gUnknown_203B27C->unk180, TRUE, TRUE); break; } } -void sub_801FF28(void) +static void sub_801FF28(void) { s32 index; @@ -400,7 +322,7 @@ void sub_801FF28(void) sub_801F428(gUnknown_203B27C->speciesNum,0); break; case 0x16: - sub_801F5F0(1); + sub_801F5F0(TRUE); break; case 0x17: sub_801F700(); @@ -453,7 +375,7 @@ void sub_801FF28(void) sub_801EE10(1,gUnknown_203B27C->speciesNum,gUnknown_203B27C->moves,gUnknown_203B27C->unk15,gUnknown_80DC394,0); break; case 0x1f: - sub_801F1B0(1,gUnknown_203B27C->unk15); + sub_801F1B0(TRUE, gUnknown_203B27C->unk15); break; case 0x20: sub_801F280(0); @@ -490,7 +412,7 @@ void sub_801FF28(void) } } -void CreateGulpinShopMenu(void) +static void CreateGulpinShopMenu(void) { s32 loopMax = 0; MemoryFill16(gUnknown_203B27C->unkBC, 0, sizeof(gUnknown_203B27C->unkBC)); @@ -507,17 +429,17 @@ void CreateGulpinShopMenu(void) gUnknown_203B27C->unk7C[loopMax].menuAction = 1; } -void sub_80205D0(void) +static void sub_80205D0(void) { s32 loopMax; s32 i; loopMax = 0; - + MemoryFill16(gUnknown_203B27C->unkBC, 0, sizeof(gUnknown_203B27C->unkBC)); - + gUnknown_203B27C->unk7C[loopMax].text = gUnknown_80DC3D8; gUnknown_203B27C->unk7C[loopMax].menuAction = 4; - + loopMax++; gUnknown_203B27C->unk7C[loopMax].text = gUnknown_80DC3E0; gUnknown_203B27C->unk7C[loopMax].menuAction = 0xB; @@ -546,14 +468,14 @@ void sub_80205D0(void) } } -void sub_802069C(void) +static void sub_802069C(void) { s32 loopMax; s32 i; loopMax = 0; - + MemoryFill16(gUnknown_203B27C->unkBC, 0, sizeof(gUnknown_203B27C->unkBC)); - + gUnknown_203B27C->unk7C[loopMax].text = gUnknown_80DC3F4; gUnknown_203B27C->unk7C[loopMax].menuAction = 0x3; @@ -577,12 +499,12 @@ void sub_802069C(void) } } -void CreateGulpinLinkMenu(void) +static void CreateGulpinLinkMenu(void) { s32 loopMax; s32 i; loopMax = 0; - + MemoryFill16(gUnknown_203B27C->unkBC, 0, sizeof(gUnknown_203B27C->unkBC)); if(gUnknown_203B27C->isTeamLeader) @@ -643,7 +565,7 @@ void CreateGulpinLinkMenu(void) } } -void sub_80208B0(void) +static void sub_80208B0(void) { s32 loopMax = 0; MemoryFill16(gUnknown_203B27C->unkBC, 0, sizeof(gUnknown_203B27C->unkBC)); @@ -657,7 +579,7 @@ void sub_80208B0(void) gUnknown_203B27C->unk7C[loopMax].menuAction = 1; } -void sub_8020900(void) +static void sub_8020900(void) { s32 loopMax = 0; MemoryFill16(gUnknown_203B27C->unkBC, 0, sizeof(gUnknown_203B27C->unkBC)); @@ -671,7 +593,7 @@ void sub_8020900(void) gUnknown_203B27C->unk7C[loopMax].menuAction = -1; } -void sub_8020950(void) +static void sub_8020950(void) { s32 loopMax = 0; MemoryFill16(gUnknown_203B27C->unkBC, 0, sizeof(gUnknown_203B27C->unkBC)); @@ -689,7 +611,7 @@ void sub_8020950(void) gUnknown_203B27C->unk7C[loopMax].menuAction = 1; } -void sub_80209AC(void) +static void sub_80209AC(void) { s32 menuAction; if(sub_80144A4(&menuAction) == 0) @@ -710,7 +632,7 @@ void sub_80209AC(void) } } -void sub_80209FC(void) +static void sub_80209FC(void) { s32 menuAction; if(sub_80144A4(&menuAction) == 0) @@ -728,7 +650,7 @@ void sub_80209FC(void) } } -void sub_8020A34(void) +static void sub_8020A34(void) { s32 menuAction; if(sub_80144A4(&menuAction) == 0) @@ -751,7 +673,7 @@ void sub_8020A34(void) } } -void sub_8020A80(void) +static void sub_8020A80(void) { switch(sub_8023A94(TRUE)) { @@ -779,7 +701,7 @@ void sub_8020A80(void) } } -void sub_8020B38(void) +static void sub_8020B38(void) { s32 menuAction; @@ -824,7 +746,7 @@ void sub_8020B38(void) } } -void sub_8020C2C(void) +static void sub_8020C2C(void) { switch(sub_80244E4()) { @@ -839,7 +761,7 @@ void sub_8020C2C(void) } } -void sub_8020C48(void) +static void sub_8020C48(void) { switch(sub_801BF48()) { @@ -854,7 +776,7 @@ void sub_8020C48(void) } } -void sub_8020C64(void) +static void sub_8020C64(void) { switch(sub_801F520(1)) { @@ -873,12 +795,12 @@ void sub_8020C64(void) } } -void sub_8020CC0(void) +static void sub_8020CC0(void) { s32 menuAction; s32 index; - struct Move *move; - + Move *move; + menuAction = 0; sub_801F520(0); if (!sub_8012FD8(&gUnknown_203B27C->unkCC)) { @@ -921,7 +843,7 @@ void sub_8020CC0(void) } } -void sub_8020D74(void) +static void sub_8020D74(void) { switch(sub_801F890()) { @@ -936,7 +858,7 @@ void sub_8020D74(void) } } -void sub_8020D90(void) +static void sub_8020D90(void) { switch(sub_801E8C0()) { @@ -955,11 +877,11 @@ void sub_8020D90(void) } } -void sub_8020DCC(void) +static void sub_8020DCC(void) { switch(sub_801EF38(1)) { case 3: - if (sub_801F1A4() != 0) { + if (sub_801F1A4()) { gUnknown_203B27C->unk15 = TRUE; } gUnknown_203B27C->moveIndex = sub_801F194(); @@ -968,7 +890,7 @@ void sub_8020DCC(void) sub_801FDA8(0x20); break; case 4: - if (sub_801F1A4() != 0) { + if (sub_801F1A4()) { gUnknown_203B27C->unk15 = TRUE; } gUnknown_203B27C->moveIndex = sub_801F194(); @@ -977,7 +899,7 @@ void sub_8020DCC(void) sub_801FDA8(0x21); break; case 2: - if (sub_801F1A4() != 0) { + if (sub_801F1A4()) { gUnknown_203B27C->unk15 = TRUE; } sub_801F214(); @@ -985,7 +907,7 @@ void sub_8020DCC(void) sub_801FDA8(0x10); break; case 1: - if (sub_801F1A4() != 0) { + if (sub_801F1A4()) { gUnknown_203B27C->unk15 = TRUE; } break; @@ -994,10 +916,10 @@ void sub_8020DCC(void) } } -void sub_8020EB4(void) +static void sub_8020EB4(void) { s32 menuAction; - + menuAction = 0; sub_801EF38(0); if (!sub_8012FD8(&gUnknown_203B27C->unkCC)) { @@ -1095,21 +1017,20 @@ void sub_8020EB4(void) } break; case 0xB: - sub_801FDA8(0x21); + sub_801FDA8(33); break; case 0xC ... 0xF: break; } } -void sub_80210C8(void) +static void sub_80210C8(void) { - switch(sub_801F890()) - { + switch (sub_801F890()) { case 2: case 3: sub_801F8D0(); - sub_801FDA8(0x1F); + sub_801FDA8(31); break; case 0: case 1: @@ -1117,49 +1038,47 @@ void sub_80210C8(void) } } -void sub_80210E4(void) +static void sub_80210E4(void) { s32 menuAction; - if(sub_80144A4(&menuAction) == 0) - { - switch(menuAction) - { - case 0x10: + + if (sub_80144A4(&menuAction) == 0) { + switch (menuAction) { + case 16: RemoveLinkSequenceFromMoves8(gUnknown_203B27C->moves, gUnknown_203B27C->moveIndex); - sub_801FDA8(0x23); + sub_801FDA8(35); break; case 1: - case 0x11: - sub_801FDA8(0x1F); + case 17: + sub_801FDA8(31); break; } } } -void sub_8021130(void) +static void sub_8021130(void) { s32 temp; - if(sub_80144A4(&temp) == 0) - { + + if (sub_80144A4(&temp) == 0) sub_801FDA8(gUnknown_203B27C->fallbackState); - } } -void sub_8021154(void) +static void sub_8021154(void) { s32 temp; - if(sub_80144A4(&temp) == 4) - { + + if (sub_80144A4(&temp) == 4) sub_801FDA8(gUnknown_203B27C->fallbackState); - } } -bool8 sub_8021178(void) +static bool8 sub_8021178(void) { s32 count; - struct unkStruct_808E218_arg local; + unkStruct_808E218_arg local; count = sub_808E218(&local, gUnknown_203B27C->pokeStruct); - if(count == 0) return TRUE; + if (count == 0) + return TRUE; else return FALSE; -} +} \ No newline at end of file diff --git a/src/hints_menu.c b/src/hints_menu.c index 9da423af8..865a48277 100644 --- a/src/hints_menu.c +++ b/src/hints_menu.c @@ -17,30 +17,30 @@ struct Hints struct unkStruct_203B268 { // size: 0xA0 - struct MenuInputStruct input; + MenuInputStruct input; u32 unk34; - struct UnkTextStruct2 *unk38; - struct UnkTextStruct2 unk3C[4]; + UnkTextStruct2 *unk38; + UnkTextStruct2 unk3C[4]; u8 unk9C[4]; }; struct unkStruct_203B264 { // size: 0x9C - struct MenuInputStruct input; + MenuInputStruct input; u32 unk34; - struct UnkTextStruct2 *unk38; - struct UnkTextStruct2 unk3C[4]; + UnkTextStruct2 *unk38; + UnkTextStruct2 unk3C[4]; }; extern struct unkStruct_203B264 *gUnknown_203B264; extern struct unkStruct_203B268 *gUnknown_203B268; -extern struct UnkTextStruct2 gUnknown_80DC0A0; -extern struct UnkTextStruct2 gUnknown_80DC0BC; -extern struct UnkTextStruct2 gUnknown_80DC0E4; -extern struct UnkTextStruct2 gUnknown_80DC0FC; +extern UnkTextStruct2 gUnknown_80DC0A0; +extern UnkTextStruct2 gUnknown_80DC0BC; +extern UnkTextStruct2 gUnknown_80DC0E4; +extern UnkTextStruct2 gUnknown_80DC0FC; extern struct Hints gGameHints[MAX_HINTS]; extern u8 gUnknown_80DC0D4[MAX_HINTS]; @@ -61,7 +61,7 @@ u32 sub_801E3F0(u32 r0) gUnknown_203B264->unk3C[gUnknown_203B264->unk34] = gUnknown_80DC0BC; sub_8012D08(gUnknown_203B264->unk38, 0xA); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B264->unk3C, 1, 1); + sub_800641C(gUnknown_203B264->unk3C, TRUE, TRUE); sub_8013818(&gUnknown_203B264->input, 0x5, 0xA, r0); sub_801E594(); DrawHintSelectionMenu(); @@ -106,7 +106,7 @@ s32 GetChosenHintIndex(void) void CreateHintSelectionScreen(u8 r0) { ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B264->unk3C, 0, 0); + sub_800641C(gUnknown_203B264->unk3C, FALSE, FALSE); sub_8013984(&gUnknown_203B264->input); sub_801E594(); DrawHintSelectionMenu(); @@ -120,13 +120,13 @@ void sub_801E54C(void) { gUnknown_203B264->unk3C[gUnknown_203B264->unk34] = gUnknown_80DC0A0; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B264->unk3C, 1, 1); + sub_800641C(gUnknown_203B264->unk3C, TRUE, TRUE); MemoryFree(gUnknown_203B264); gUnknown_203B264 = NULL; } } -NAKED +NAKED // sub_80095E4 memes void sub_801E594(void) { asm_unified( @@ -195,7 +195,7 @@ u32 CreateHintDisplayScreen(u32 index) gUnknown_203B268->unk3C[gUnknown_203B268->unk34] = gUnknown_80DC0FC; gUnknown_203B268->unk38->unk14 = gUnknown_203B268->unk9C; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B268->unk3C, 1, 1); + sub_800641C(gUnknown_203B268->unk3C, TRUE, TRUE); sub_8013818(&gUnknown_203B268->input, 5, 1, gUnknown_203B268->unk34); gUnknown_203B268->input.unk1E = index; sub_801E714(); @@ -235,7 +235,7 @@ void DestroyHintDisplayScreen(void) { gUnknown_203B268->unk3C[gUnknown_203B268->unk34] = gUnknown_80DC0E4; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B268->unk3C, 1, 1); + sub_800641C(gUnknown_203B268->unk3C, TRUE, TRUE); MemoryFree(gUnknown_203B268); gUnknown_203B268 = NULL; } @@ -248,7 +248,7 @@ void sub_801E76C(void) gUnknown_203B268->unk9C[2] = 0xF; gUnknown_203B268->unk9C[3] = 0; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B268->unk3C, 1, 1); + sub_800641C(gUnknown_203B268->unk3C, TRUE, TRUE); } void DisplayChosenHint(void) diff --git a/src/input.c b/src/input.c index d5285952d..fca78f578 100644 --- a/src/input.c +++ b/src/input.c @@ -1,15 +1,14 @@ #include "global.h" +#include "code_800C9CC.h" #include "input.h" -EWRAM_DATA struct Inputs gRealInputs = {0}; -EWRAM_DATA struct UnusedInputStruct gUnusedInputsRelated = {0}; -EWRAM_DATA u32 gUnusedScrambledInputJunk = {0}; -EWRAM_DATA struct Inputs gBufferedInputs = {0}; -EWRAM_DATA struct Inputs gCurrentInputs = {0}; -EWRAM_DATA struct Inputs gLastInputs = {0}; -EWRAM_DATA struct InputTimers gInputTimers = {0}; - -void ReadKeyInput(struct Inputs *r0); +EWRAM_DATA Inputs gRealInputs = {0}; // 20255F0 +static EWRAM_DATA UnusedInputStruct sUnusedInputsRelated = {0}; // 2025600 +static EWRAM_DATA u32 sUnusedScrambledInputJunk[3] = {0}; // 202562C +static EWRAM_DATA Inputs sBufferedInputs = {0}; // 2025638 +static EWRAM_DATA Inputs sCurrentInputs = {0}; // 2025648 +static EWRAM_DATA Inputs sPrevInputs = {0}; // 2025658 +static EWRAM_DATA InputTimers sInputTimers = {0}; // 2025668 void InitInput(void) { @@ -18,189 +17,189 @@ void InitInput(void) gRealInputs.repeated = 0; gRealInputs.shortPress = 0; - gBufferedInputs.held = 0; - gBufferedInputs.pressed = 0; - gBufferedInputs.repeated = 0; - gBufferedInputs.shortPress = 0; + sBufferedInputs.held = 0; + sBufferedInputs.pressed = 0; + sBufferedInputs.repeated = 0; + sBufferedInputs.shortPress = 0; - gUnusedScrambledInputJunk = 0x4a14c1; // seems like random keyboard mashing (see UpdateInput) + sUnusedScrambledInputJunk[0] = 0x4A14C1; // seems like random keyboard mashing (see UpdateInput) - gUnusedInputsRelated.unk20 = 0; - gUnusedInputsRelated.unk0 = 0xffff; // probably a mask - gUnusedInputsRelated.unk2 = -1; - gUnusedInputsRelated.unk4 = -1; - gUnusedInputsRelated.unk6 = -1; - gUnusedInputsRelated.unk1C = -1; - gUnusedInputsRelated.unk1E = -1; - gUnusedInputsRelated.unk8 = -1; - gUnusedInputsRelated.unkA = -1; - gUnusedInputsRelated.unkC = -1; - gUnusedInputsRelated.unkE = -1; - gUnusedInputsRelated.unk10 = -1; - gUnusedInputsRelated.unk12 = -1; - gUnusedInputsRelated.unk14 = -1; - gUnusedInputsRelated.unk16 = -1; - gUnusedInputsRelated.unk28 = 0; - gUnusedInputsRelated.unk29 = 0; + sUnusedInputsRelated.unk20 = 0; + sUnusedInputsRelated.unk0 = 0xFFFF; // probably a mask + sUnusedInputsRelated.unk2 = -1; + sUnusedInputsRelated.unk4 = -1; + sUnusedInputsRelated.unk6 = -1; + sUnusedInputsRelated.unk1C = -1; + sUnusedInputsRelated.unk1E = -1; + sUnusedInputsRelated.unk8 = -1; + sUnusedInputsRelated.unkA = -1; + sUnusedInputsRelated.unkC = -1; + sUnusedInputsRelated.unkE = -1; + sUnusedInputsRelated.unk10 = -1; + sUnusedInputsRelated.unk12 = -1; + sUnusedInputsRelated.unk14 = -1; + sUnusedInputsRelated.unk16 = -1; + sUnusedInputsRelated.unk28 = 0; + sUnusedInputsRelated.unk29 = 0; - gInputTimers.holdTimerB = 0; - gInputTimers.holdTimerR = 0; + sInputTimers.holdTimerB = 0; + sInputTimers.holdTimerR = 0; } void LoadBufferedInputs(void) { - gRealInputs = gBufferedInputs; + gRealInputs = sBufferedInputs; - gBufferedInputs.held = 0; - gBufferedInputs.pressed = 0; - gBufferedInputs.repeated = 0; - gBufferedInputs.shortPress = 0; + sBufferedInputs.held = 0; + sBufferedInputs.pressed = 0; + sBufferedInputs.repeated = 0; + sBufferedInputs.shortPress = 0; - gUnusedInputsRelated.unk0 = 0xffff; - gUnusedInputsRelated.unk2 = -1; - gUnusedInputsRelated.unk4 = -1; - gUnusedInputsRelated.unk6 = -1; - gUnusedInputsRelated.unk8 = -1; - gUnusedInputsRelated.unkA = -1; - gUnusedInputsRelated.unkC = -1; - gUnusedInputsRelated.unkE = -1; - gUnusedInputsRelated.unk10 = -1; - gUnusedInputsRelated.unk12 = -1; - gUnusedInputsRelated.unk14 = -1; - gUnusedInputsRelated.unk16 = -1; + sUnusedInputsRelated.unk0 = 0xFFFF; + sUnusedInputsRelated.unk2 = -1; + sUnusedInputsRelated.unk4 = -1; + sUnusedInputsRelated.unk6 = -1; + sUnusedInputsRelated.unk8 = -1; + sUnusedInputsRelated.unkA = -1; + sUnusedInputsRelated.unkC = -1; + sUnusedInputsRelated.unkE = -1; + sUnusedInputsRelated.unk10 = -1; + sUnusedInputsRelated.unk12 = -1; + sUnusedInputsRelated.unk14 = -1; + sUnusedInputsRelated.unk16 = -1; - gUnusedInputsRelated.unk28 = 0; - gUnusedInputsRelated.unk29 = 0; + sUnusedInputsRelated.unk28 = 0; + sUnusedInputsRelated.unk29 = 0; } -// Unused -u8 sub_80048B8(void) +UNUSED static bool8 sub_80048B8(void) { - return 0; + return FALSE; } -u8 sub_80048BC(void) +bool8 sub_80048BC(void) { - return 0; + return FALSE; } -// Unused -u8 sub_80048C0(void) +UNUSED static bool8 sub_80048C0(void) { - return 0; + return FALSE; } -// Unused -u8 sub_80048C4(void) +UNUSED static bool8 sub_80048C4(void) { - return 0; + return FALSE; } -u8 sub_80048C8(void) +bool8 sub_80048C8(void) { - return 0; + return FALSE; } -// Unused -u8 sub_80048CC(void) +UNUSED static bool8 sub_80048CC(void) { - return 0; + return FALSE; } void ResetRepeatTimers(void) { gRealInputs.repeated = 0; - gCurrentInputs.repeatTimerDpad = 0; - gCurrentInputs.heldDpad = 0; - gInputTimers.holdTimerB = 999; - gInputTimers.holdTimerR = 999; - + sCurrentInputs.repeatTimerDpad = 0; + sCurrentInputs.heldDpad = 0; + sInputTimers.holdTimerB = 999; + sInputTimers.holdTimerR = 999; } void UnpressButtons(void) { gRealInputs.pressed = 0; - gBufferedInputs.pressed = 0; - gCurrentInputs.pressed = 0; + sBufferedInputs.pressed = 0; + sCurrentInputs.pressed = 0; } void ResetUnusedInputStruct(void) { - gUnusedInputsRelated.unk20 = 0x5; - gUnusedInputsRelated.unk24 = 0; - gUnusedInputsRelated.unk0 = 0xffff; - gUnusedInputsRelated.unk2 = -1; - gUnusedInputsRelated.unk4 = -1; - gUnusedInputsRelated.unk6 = -1; - gUnusedInputsRelated.unk8 = -1; - gUnusedInputsRelated.unkA = -1; - gUnusedInputsRelated.unkC = -1; - gUnusedInputsRelated.unkE = -1; - gUnusedInputsRelated.unk10 = -1; - gUnusedInputsRelated.unk12 = -1; - gUnusedInputsRelated.unk14 = -1; - gUnusedInputsRelated.unk16 = -1; - - gUnusedInputsRelated.unk28 = 0; - gUnusedInputsRelated.unk29 = 0; + sUnusedInputsRelated.unk20 = 5; + sUnusedInputsRelated.unk24 = 0; + sUnusedInputsRelated.unk0 = 0xFFFF; + sUnusedInputsRelated.unk2 = -1; + sUnusedInputsRelated.unk4 = -1; + sUnusedInputsRelated.unk6 = -1; + sUnusedInputsRelated.unk8 = -1; + sUnusedInputsRelated.unkA = -1; + sUnusedInputsRelated.unkC = -1; + sUnusedInputsRelated.unkE = -1; + sUnusedInputsRelated.unk10 = -1; + sUnusedInputsRelated.unk12 = -1; + sUnusedInputsRelated.unk14 = -1; + sUnusedInputsRelated.unk16 = -1; + sUnusedInputsRelated.unk28 = 0; + sUnusedInputsRelated.unk29 = 0; } void UpdateInput(void) { - gLastInputs = gCurrentInputs; + sPrevInputs = sCurrentInputs; - ReadKeyInput(&gCurrentInputs); + ReadKeyInput(&sCurrentInputs); - gCurrentInputs.pressed = (gLastInputs.held ^ gCurrentInputs.held) & gCurrentInputs.held; + sCurrentInputs.pressed = (sPrevInputs.held ^ sCurrentInputs.held) & sCurrentInputs.held; - if (gCurrentInputs.held) { - if ((gCurrentInputs.heldDpad & DPAD_ANY) == (gCurrentInputs.held & DPAD_ANY)) { - if (gCurrentInputs.repeatTimerDpad < 50) - gCurrentInputs.repeatTimerDpad++; - } else { - gCurrentInputs.heldDpad = gCurrentInputs.held & DPAD_ANY; - gCurrentInputs.repeatTimerDpad = 1; + if (sCurrentInputs.held) { + if ((sCurrentInputs.heldDpad & DPAD_ANY) == (sCurrentInputs.held & DPAD_ANY)) { + if (sCurrentInputs.repeatTimerDpad < 50) + sCurrentInputs.repeatTimerDpad++; } - } else { - gCurrentInputs.repeatTimerDpad = 0; - gCurrentInputs.heldDpad = 0; + else { + sCurrentInputs.heldDpad = sCurrentInputs.held & DPAD_ANY; + sCurrentInputs.repeatTimerDpad = 1; + } + } + else { + sCurrentInputs.repeatTimerDpad = 0; + sCurrentInputs.heldDpad = 0; } - if (gCurrentInputs.repeatTimerDpad == 1) { - gCurrentInputs.repeated = (gCurrentInputs.heldDpad & DPAD_ANY) | gCurrentInputs.pressed; - } else if (gCurrentInputs.repeatTimerDpad == 48) { - gCurrentInputs.repeatTimerDpad = 43; - gCurrentInputs.repeated = (gCurrentInputs.heldDpad & DPAD_ANY) | gCurrentInputs.pressed; - } else { - gCurrentInputs.repeated = 0; + if (sCurrentInputs.repeatTimerDpad == 1) { + sCurrentInputs.repeated = (sCurrentInputs.heldDpad & DPAD_ANY) | sCurrentInputs.pressed; } - gCurrentInputs.shortPress = 0; - - if (gCurrentInputs.held & B_BUTTON) { - if (gInputTimers.holdTimerB < 100) - gInputTimers.holdTimerB++; - } else if (1 < gInputTimers.holdTimerB && gInputTimers.holdTimerB < 12) { - gCurrentInputs.shortPress = B_BUTTON; - gInputTimers.holdTimerB = 0; - } else { - gInputTimers.holdTimerB = 0; + else if (sCurrentInputs.repeatTimerDpad == 48) { + sCurrentInputs.repeatTimerDpad = 43; + sCurrentInputs.repeated = (sCurrentInputs.heldDpad & DPAD_ANY) | sCurrentInputs.pressed; } + else + sCurrentInputs.repeated = 0; - if (gCurrentInputs.held & R_BUTTON) { - if (gInputTimers.holdTimerR < 100) - gInputTimers.holdTimerR++; - } else if (1 < gInputTimers.holdTimerR && gInputTimers.holdTimerR < 12) { - gCurrentInputs.shortPress |= R_BUTTON; - gInputTimers.holdTimerR = 0; - } else { - gInputTimers.holdTimerR = 0; + sCurrentInputs.shortPress = 0; + + if (sCurrentInputs.held & B_BUTTON) { + if (sInputTimers.holdTimerB < 100) + sInputTimers.holdTimerB++; } + else if (1 < sInputTimers.holdTimerB && sInputTimers.holdTimerB < 12) { + sCurrentInputs.shortPress = B_BUTTON; + sInputTimers.holdTimerB = 0; + } + else + sInputTimers.holdTimerB = 0; - gBufferedInputs.held |= gCurrentInputs.held; - gBufferedInputs.pressed |= gCurrentInputs.pressed; - gBufferedInputs.repeated |= gCurrentInputs.repeated; - gBufferedInputs.shortPress |= gCurrentInputs.shortPress; + if (sCurrentInputs.held & R_BUTTON) { + if (sInputTimers.holdTimerR < 100) + sInputTimers.holdTimerR++; + } + else if (1 < sInputTimers.holdTimerR && sInputTimers.holdTimerR < 12) { + sCurrentInputs.shortPress |= R_BUTTON; + sInputTimers.holdTimerR = 0; + } + else + sInputTimers.holdTimerR = 0; - gUnusedScrambledInputJunk *= gCurrentInputs.held | 0x54a1c41; // very similar to odd constant in InitInput - probably keymashing -} + sBufferedInputs.held |= sCurrentInputs.held; + sBufferedInputs.pressed |= sCurrentInputs.pressed; + sBufferedInputs.repeated |= sCurrentInputs.repeated; + sBufferedInputs.shortPress |= sCurrentInputs.shortPress; + + sUnusedScrambledInputJunk[0] *= sCurrentInputs.held | 0x54A1C41; // very similar to odd constant in InitInput - probably keymashing +} \ No newline at end of file diff --git a/src/items.c b/src/items.c index d672be9a8..ed121b076 100644 --- a/src/items.c +++ b/src/items.c @@ -1,13 +1,11 @@ #include "global.h" #include "constants/colors.h" -#include "item.h" +#include "items.h" #include "moves.h" -#include "team_inventory.h" #include "random.h" #include "pokemon.h" #include "random.h" #include "subStruct_203B240.h" -#include "team_inventory.h" #include "code_800D090.h" #include "text_util.h" #include "text2.h" @@ -21,7 +19,7 @@ extern const char gUnknown_81097A4[]; extern s32 gUnknown_81097B0[]; extern u8 gUnknown_81097C4[]; extern u16 gGummiStatBoostLUT[]; -extern u8 gUnknown_202DE58[0x58]; +extern u8 gUnknown_202DE58[]; extern u32 gUnknown_202DE30; extern u8* gPtrTypeText; // ptr to "Type\0" extern u8* gPtrPPD0Text; // ptr to "PP $d0 \0" @@ -33,25 +31,27 @@ extern u8 gUnknown_8108F64[0x3f][32]; // some sort of bit lookup table extern s16 gTypeGummiIQBoost[0x12][NUMBER_OF_GUMMIS]; extern u8 gInvalidItemIDs[0x10]; -EWRAM_DATA struct OpenedFile *gItemParametersFile = {0}; -EWRAM_DATA struct ItemDataEntry *gItemParametersData = {0}; -EWRAM_DATA struct TeamInventory gTeamInventory = {0}; -EWRAM_DATA_2 struct TeamInventory *gTeamInventoryRef = {0}; +EWRAM_DATA OpenedFile *gItemParametersFile = {0}; +EWRAM_DATA ItemDataEntry *gItemParametersData = {0}; +EWRAM_DATA TeamInventory gTeamInventory = {0}; +EWRAM_DATA_2 TeamInventory *gTeamInventoryRef = {0}; -extern s32 sub_8090FEC(s32 a1, u8* a2, u8 a3); extern u32 sub_8097DF0(char *, struct subStruct_203B240 **); extern s32 sub_8091E94(s32 a1, s32 a2, s32 a3); extern void SortKecleonShopInventory(); bool8 AddKecleonWareItem(u8); + +static void sub_8090F58(u8 *, u8 *, Item *, unkStruct_8090F58 *); + void LoadItemParameters(void) { gTeamInventoryRef = &gTeamInventory; gItemParametersFile = OpenFileAndGetFileDataPtr(gItemParaFileName,&gSystemFileArchive); - gItemParametersData = (struct ItemDataEntry *) gItemParametersFile->data; + gItemParametersData = (ItemDataEntry *) gItemParametersFile->data; } -struct TeamInventory *GetMoneyItemsInfo(void) +TeamInventory *GetMoneyItemsInfo(void) { return &gTeamInventory; } @@ -101,7 +101,7 @@ bool8 IsThrowableItem(u8 id) return TRUE; } -void xxx_init_itemslot_8090A8C(struct Item *slot, u8 id, u8 param_3) +void xxx_init_itemslot_8090A8C(Item *slot, u8 id, u8 param_3) { u32 uVar3; u32 uVar4; @@ -130,7 +130,7 @@ void xxx_init_itemslot_8090A8C(struct Item *slot, u8 id, u8 param_3) } } -void xxx_init_helditem_8090B08(struct BulkItem *held, u8 id) +void xxx_init_helditem_8090B08(BulkItem *held, u8 id) { u32 uVar2; u32 uVar3; @@ -153,7 +153,7 @@ void xxx_init_helditem_8090B08(struct BulkItem *held, u8 id) } } -void HeldItemToSlot(struct Item *slot, struct BulkItem *held) +void HeldItemToSlot(Item *slot, BulkItem *held) { u8 is_throwable; @@ -177,7 +177,7 @@ void HeldItemToSlot(struct Item *slot, struct BulkItem *held) } } -void SlotToHeldItem(struct BulkItem *held,struct Item *slot) +void SlotToHeldItem(BulkItem *held,Item *slot) { if ((slot->flags & ITEM_FLAG_EXISTS) != 0) { held->id = slot->id; @@ -193,7 +193,7 @@ u8 GetItemCategory(u8 index) return gItemParametersData[index].category; } -s32 GetStackBuyValue(struct Item *param_1) +s32 GetStackBuyValue(Item *param_1) { if (param_1->id == ITEM_POKE) { return GetMoneyValue(param_1); @@ -208,7 +208,7 @@ s32 GetStackBuyValue(struct Item *param_1) } } -s32 GetStackSellValue(struct Item *param_1) +s32 GetStackSellValue(Item *param_1) { if (param_1->id == ITEM_POKE) { return GetMoneyValue(param_1); @@ -223,7 +223,7 @@ s32 GetStackSellValue(struct Item *param_1) } } -s32 GetStackBuyPrice(struct Item *param_1) +s32 GetStackBuyPrice(Item *param_1) { if (!CanSellItem(param_1->id)) { return 0; @@ -238,7 +238,7 @@ s32 GetStackBuyPrice(struct Item *param_1) } } -s32 GetStackSellPrice(struct Item *param_1) +s32 GetStackSellPrice(Item *param_1) { if (!CanSellItem(param_1->id)) { return 0; @@ -293,15 +293,18 @@ bool8 GetItemAIFlag(u8 id, u32 r1) return gItemParametersData[id].aiFlags[r1]; } -void sub_8090DC4(void* param_1,u8 id, struct unkStruct_8090F58* param_3) +// a2 is always NULL +// This func probably appends the quantity of 1, but I haven't checked +// If it appends quantity, we can rename the func +void BufferItemName(u8* dest, u8 id, struct unkStruct_8090F58* a2) { char acStack104 [80]; - struct Item unkItem; + Item unkItem; - strncpy(acStack104,gItemParametersData[id].name,0x50); - xxx_init_itemslot_8090A8C(&unkItem,id,0); + strncpy(acStack104, gItemParametersData[id].name, 80); + xxx_init_itemslot_8090A8C(&unkItem, id, 0); unkItem.quantity = 1; - sub_8090F58(param_1,acStack104,&unkItem,param_3); + sub_8090F58(dest, acStack104, &unkItem, a2); } extern const u8 gUnknown_8109770[]; @@ -310,7 +313,7 @@ extern const u8 gUnknown_810977C[]; extern const u8 gUnknown_8109784[]; extern const u8 gUnknown_810978C[]; -void sub_8090E14(u8* ext_buffer, struct Item* slot, struct unkStruct_8090F58* a3) { +void sub_8090E14(u8* ext_buffer, Item* slot, struct unkStruct_8090F58* a3) { s32 unk8 = 0; u8 buffer[80]; @@ -370,7 +373,7 @@ void sub_8090E14(u8* ext_buffer, struct Item* slot, struct unkStruct_8090F58* a3 return; } -void sub_8090F58(void* a1, u8 *a2, struct Item *slot, struct unkStruct_8090F58* a4) { +static void sub_8090F58(u8* a1, u8 *a2, Item *slot, struct unkStruct_8090F58* a4) { u32 unk0; s32 value; u8 buffer[40]; @@ -411,7 +414,7 @@ void sub_8090F58(void* a1, u8 *a2, struct Item *slot, struct unkStruct_8090F58* } } -s32 sub_8090FEC(s32 a1, u8* strbuf, u8 a3) +s32 sub_8090FEC(s32 a1, u8 *strbuf, u8 a3) { s32 i, count; s32 cond = 0; @@ -482,14 +485,14 @@ void FillInventoryGaps() // clear out the rest of the slots for (; last_filled < INVENTORY_SIZE; last_filled++) { - struct Item *slot; + Item *slot; #ifdef NONMATCHING slot = &gTeamInventoryRef->teamItems[last_filled]; #else size_t offs = last_filled << 2; size_t _slot = offs; _slot += (size_t)gTeamInventoryRef->teamItems; - slot = (struct Item*)_slot; // &gTeamInventoryRef->teamItems[end]; + slot = (Item*)_slot; // &gTeamInventoryRef->teamItems[end]; #endif slot->id = ITEM_NOTHING; slot->quantity = 0; @@ -523,7 +526,7 @@ s32 GetItemCountInInventory(u8 _id) // have to do hacky stuff to fix initialization order of r6 and r2 u32 id = _id; s32 count = 0; - struct Item *slot = gTeamInventoryRef->teamItems; + Item *slot = gTeamInventoryRef->teamItems; s32 one = 1; s32 i = 19; @@ -545,9 +548,9 @@ s32 GetItemPossessionCount(u8 id) s32 item_count = GetItemCountInInventory(id); s32 i = 0; - struct unkStruct_203B45C *_gRecruitedPokemonRef = gRecruitedPokemonRef; + unkStruct_203B45C *_gRecruitedPokemonRef = gRecruitedPokemonRef; for (i = 0; i < NUM_MONSTERS; i++) { - struct PokemonStruct* pokemon = &_gRecruitedPokemonRef->pokemon[i]; + PokemonStruct1* pokemon = &_gRecruitedPokemonRef->pokemon[i]; if ((1 & pokemon->unk0) && ((pokemon->unk0 >> 1) % 2) && (pokemon->heldItem.id != ITEM_NOTHING) @@ -576,26 +579,26 @@ void ClearItemSlotAt(u32 index) bool8 sub_809124C(u8 id, u8 param_3) { - struct Item temp; + Item temp; xxx_init_itemslot_8090A8C(&temp, id, param_3); return AddItemToInventory(&temp); } -bool8 AddHeldItemToInventory(struct BulkItem* slot) +bool8 AddHeldItemToInventory(BulkItem* slot) { - struct Item temp; + Item temp; HeldItemToSlot(&temp, slot); return AddItemToInventory(&temp); } -bool8 AddItemToInventory(const struct Item* slot) +bool8 AddItemToInventory(const Item* slot) { s32 i; // try to add item to inventory, return 1 if failed for (i = 0; i < INVENTORY_SIZE; i++) { - UNUSED struct Item* current = &gTeamInventoryRef->teamItems[i]; + UNUSED Item* current = &gTeamInventoryRef->teamItems[i]; if (!(i[gTeamInventoryRef->teamItems].flags & ITEM_FLAG_EXISTS)) { gTeamInventoryRef->teamItems[i] = *slot; return FALSE; @@ -609,10 +612,10 @@ void ConvertMoneyItemToMoney() s32 i = 0; do { - UNUSED struct TeamInventory * _gTeamInventoryRef = gTeamInventoryRef; - UNUSED size_t offs = offsetof(struct TeamInventory, teamItems[i]); + UNUSED TeamInventory * _gTeamInventoryRef = gTeamInventoryRef; + UNUSED size_t offs = offsetof(TeamInventory, teamItems[i]); - struct Item* current_slot = &gTeamInventoryRef->teamItems[i]; + Item* current_slot = &gTeamInventoryRef->teamItems[i]; if ((current_slot->flags & ITEM_FLAG_EXISTS) && (current_slot->id == ITEM_POKE)) { u32 result; @@ -628,7 +631,7 @@ void ConvertMoneyItemToMoney() i = 0; do { s32 lowest_index = -1; - UNUSED size_t offs = offsetof(struct TeamInventory, teamItems[i]); + UNUSED size_t offs = offsetof(TeamInventory, teamItems[i]); bool8 item_occupied = i[gTeamInventoryRef->teamItems].flags & ITEM_FLAG_EXISTS; s32 next = i + 1; @@ -639,7 +642,7 @@ void ConvertMoneyItemToMoney() // find next lowest for (j = next; j < INVENTORY_SIZE; j++) { - UNUSED size_t offs = offsetof(struct TeamInventory, teamItems[j]); + UNUSED size_t offs = offsetof(TeamInventory, teamItems[j]); if ((j[gTeamInventoryRef->teamItems].flags & ITEM_FLAG_EXISTS) && (lowest_order > GetItemOrder(gTeamInventoryRef->teamItems[j].id))) { lowest_index = j; lowest_order = GetItemOrder(gTeamInventoryRef->teamItems[j].id); @@ -648,7 +651,7 @@ void ConvertMoneyItemToMoney() if (lowest_index >= 0) { // swap the slots - struct Item current = gTeamInventoryRef->teamItems[i]; + Item current = gTeamInventoryRef->teamItems[i]; gTeamInventoryRef->teamItems[i] = gTeamInventoryRef->teamItems[lowest_index]; gTeamInventoryRef->teamItems[lowest_index] = current; } @@ -678,22 +681,22 @@ u16 GetItemMoveID(u8 index) return gItemParametersData[index].moveID; } -u32 sub_80913E0(struct Item* slot, u32 a2, struct subStruct_203B240 ** a3) +u32 sub_80913E0(Item* slot, u32 a2, struct subStruct_203B240 ** a3) { u8 buffer88[88]; // some struct GetItemDescription(slot->id); - sub_8090DC4(buffer88, slot->id, 0); + BufferItemName(buffer88, slot->id, NULL); if (slot->id == ITEM_TM_USED_TM) { // empty TM - sub_8090DC4(&gUnknown_202DE58, (u8)(slot->quantity + 125), 0); + BufferItemName(gUnknown_202DE58, (u8)(slot->quantity + 125), NULL); } sub_80073B8(a2); xxx_format_and_draw(16, 0, buffer88, a2, 0); xxx_format_and_draw(8, 24, GetItemDescription(slot->id), a2, 0); if (GetItemCategory(slot->id) == CATEGORY_TMS_HMS) { - struct Move *buffer8 = (struct Move*) (buffer88 + 0x50); // field in struct + Move *buffer8 = (Move*) (buffer88 + 80); // field in struct u16 move = GetItemMoveID(slot->id); u8 moves_data; const u8* typestring; @@ -720,16 +723,16 @@ bool8 CanSellItem(u32 id) id = (u8)id; id_ = id; - if((id != ITEM_NOTHING) - && (id != ITEM_POKE) - && (id != ITEM_ROCK_PART) - && (id != ITEM_ICE_PART) - && (id != ITEM_STEEL_PART) - && (id != ITEM_MUSIC_BOX) - && (GetItemSellPrice(id_)) - && (GetItemBuyPrice(id_))) { + if (id != ITEM_NOTHING + && id != ITEM_POKE + && id != ITEM_ROCK_PART + && id != ITEM_ICE_PART + && id != ITEM_STEEL_PART + && id != ITEM_MUSIC_BOX + && GetItemSellPrice(id_) + && GetItemBuyPrice(id_)) return TRUE; - } + return FALSE; } @@ -807,18 +810,18 @@ bool8 IsHMItem(u8 id) return FALSE; } -u32 GetMoneyValue(struct Item* slot) +u32 GetMoneyValue(Item* slot) { return gUnknown_810A3F0[slot->quantity]; } -u32 GetMoneyValueHeld(struct BulkItem* slot) +u32 GetMoneyValueHeld(BulkItem* slot) { // potentially different slot type (used for held item) return gUnknown_810A3F0[slot->quantity]; } -void GetGummiItemStatBoost(struct PokemonStruct* pokemon, u8 id, bool8 checkBoostFlags, struct Gummi* gummi) +void GetGummiItemStatBoost(PokemonStruct1* pokemon, u8 id, bool8 checkBoostFlags, Gummi *gummi) { // item stat buff? s8 result; @@ -927,7 +930,7 @@ bool8 HasGummiItem() { s32 i; for (i = 0; i < INVENTORY_SIZE; i++) { - UNUSED size_t offs = offsetof(struct TeamInventory, teamItems[i]); + UNUSED size_t offs = offsetof(TeamInventory, teamItems[i]); if ((i[gTeamInventoryRef->teamItems].flags & ITEM_FLAG_EXISTS) && IsGummiItem(i[gTeamInventoryRef->teamItems].id)) { return TRUE; } @@ -935,7 +938,7 @@ bool8 HasGummiItem() return FALSE; } -void MoveToStorage(struct Item* slot) +void MoveToStorage(Item* slot) { if (IsThrowableItem(slot->id)) { gTeamInventoryRef->teamStorage[slot->id] += slot->quantity; @@ -963,14 +966,14 @@ s32 CountKecleonShopItems(void) void InitKecleonShopItem(u8 index) { - struct BulkItem* shopItem; + BulkItem* shopItem; shopItem = &gTeamInventoryRef->kecleonShopItems[index]; shopItem->id = ITEM_NOTHING; shopItem->quantity = 0; } -struct BulkItem* GetKecleonShopItem(u8 i) +BulkItem* GetKecleonShopItem(u8 i) { return &gTeamInventoryRef->kecleonShopItems[i]; } @@ -1016,7 +1019,7 @@ void SortKecleonShopInventory(void) { s32 order_i = GetItemOrder(gTeamInventoryRef->kecleonShopItems[i].id); s32 order_j = GetItemOrder(gTeamInventoryRef->kecleonShopItems[j].id); if (order_i > order_j || (order_i == order_j && gTeamInventoryRef->kecleonShopItems[i].quantity < gTeamInventoryRef->kecleonShopItems[j].quantity)) { - struct BulkItem str_i = gTeamInventoryRef->kecleonShopItems[i]; + BulkItem str_i = gTeamInventoryRef->kecleonShopItems[i]; gTeamInventoryRef->kecleonShopItems[i] = gTeamInventoryRef->kecleonShopItems[j]; gTeamInventoryRef->kecleonShopItems[j] = str_i; } @@ -1042,7 +1045,7 @@ void ChooseKecleonShopInventory(u8 index) { } bool8 AddKecleonShopItem(u8 itemIndex) { - struct BulkItem held; + BulkItem held; s32 i; xxx_init_helditem_8090B08(&held, itemIndex); // initialize @@ -1067,12 +1070,12 @@ u32 CountKecleonWareItems(void) { } void InitKecleonWareItem(u8 index) { - struct BulkItem* wareItem = &gTeamInventoryRef->kecleonWareItems[index]; + BulkItem* wareItem = &gTeamInventoryRef->kecleonWareItems[index]; wareItem->id = ITEM_NOTHING; wareItem->quantity = 0; } -struct BulkItem* GetKecleonWareItem(u8 index) { +BulkItem* GetKecleonWareItem(u8 index) { return &gTeamInventoryRef->kecleonWareItems[index]; } @@ -1115,7 +1118,7 @@ void SortKecleonWareInventory(void) { s32 order_i = GetItemOrder(gTeamInventoryRef->kecleonWareItems[i].id); s32 order_j = GetItemOrder(gTeamInventoryRef->kecleonWareItems[j].id); if (order_i > order_j || (order_i == order_j && gTeamInventoryRef->kecleonWareItems[i].quantity < gTeamInventoryRef->kecleonWareItems[j].quantity)) { - struct BulkItem str_i = gTeamInventoryRef->kecleonWareItems[i]; + BulkItem str_i = gTeamInventoryRef->kecleonWareItems[i]; gTeamInventoryRef->kecleonWareItems[i] = gTeamInventoryRef->kecleonWareItems[j]; gTeamInventoryRef->kecleonWareItems[j] = str_i; } @@ -1140,7 +1143,7 @@ void ChooseKecleonWareInventory(u8 index) { } bool8 AddKecleonWareItem(u8 itemIndex) { - struct BulkItem held; + BulkItem held; s32 i; xxx_init_helditem_8090B08(&held, itemIndex); // initialize @@ -1201,26 +1204,26 @@ s32 RestoreTeamInventory(u8 *unk0, u32 size) return unk.unk8; } -void RestoreHeldItem(struct unkStruct_8094924 *a1, struct BulkItem *item) +void RestoreHeldItem(struct unkStruct_8094924 *a1, BulkItem *item) { RestoreIntegerBits(a1, &item->id, 8); RestoreIntegerBits(a1, &item->quantity, 7); } -void SaveHeldItem(struct unkStruct_8094924 *a1, struct BulkItem *item) +void SaveHeldItem(struct unkStruct_8094924 *a1, BulkItem *item) { SaveIntegerBits(a1, &item->id, 8); SaveIntegerBits(a1, &item->quantity, 7); } -void RestoreItemSlot(struct unkStruct_8094924 *a1, struct Item *slot) +void RestoreItemSlot(struct unkStruct_8094924 *a1, Item *slot) { RestoreIntegerBits(a1, &slot->flags, 8); RestoreIntegerBits(a1, &slot->quantity, 7); RestoreIntegerBits(a1, &slot->id, 8); } -void SaveItemSlot(struct unkStruct_8094924 *a1, struct Item *slot) +void SaveItemSlot(struct unkStruct_8094924 *a1, Item *slot) { SaveIntegerBits(a1, &slot->flags, 8); SaveIntegerBits(a1, &slot->quantity, 7); @@ -1463,7 +1466,7 @@ void ClearAllItems_8091FB4() { s32 i; for (i = 0; i < INVENTORY_SIZE; i++) { - struct Item* slot = &gTeamInventoryRef->teamItems[i]; + Item* slot = &gTeamInventoryRef->teamItems[i]; if (slot->flags & ITEM_FLAG_EXISTS) { slot->flags &= 0xf7; if (slot->id == ITEM_POKE) { @@ -1476,14 +1479,14 @@ void ClearAllItems_8091FB4() { } FillInventoryGaps(); for (i = 0; i < NUM_MONSTERS; i++) { - struct PokemonStruct* pokemon; + PokemonStruct1* pokemon; #ifdef NONMATCHING pokemon = &i[gRecruitedPokemonRef->pokemon]; #else - register size_t offset asm("r1") = offsetof(struct unkStruct_203B45C, pokemon[i]); - struct PokemonStruct* p = gRecruitedPokemonRef->pokemon; + register size_t offset asm("r1") = offsetof(unkStruct_203B45C, pokemon[i]); + PokemonStruct1* p = gRecruitedPokemonRef->pokemon; size_t addr = offset + (size_t)p; - pokemon = (struct PokemonStruct*)addr; + pokemon = (PokemonStruct1*)addr; #endif if ((u8)pokemon->unk0 & 1) { diff --git a/src/kangaskhan_storage.c b/src/kangaskhan_storage1.c similarity index 55% rename from src/kangaskhan_storage.c rename to src/kangaskhan_storage1.c index 404c6df3a..f6a6a239f 100644 --- a/src/kangaskhan_storage.c +++ b/src/kangaskhan_storage1.c @@ -2,21 +2,20 @@ #include "code_80130A8.h" #include "code_801B3C0.h" #include "code_801C620.h" -#include "item.h" -#include "kangaskhan_storage.h" -#include "kecleon_bros.h" +#include "code_8098BDC.h" +#include "kangaskhan_storage1.h" +#include "kecleon_bros4.h" #include "memory.h" #include "menu_input.h" #include "pokemon.h" -#include "team_inventory.h" #include "text1.h" #include "text2.h" extern u8 gUnknown_202DE58[]; extern u8 gUnknown_202E1C8[]; extern u8 gUnknown_202E5D8[]; + EWRAM_DATA_2 struct KangaskhanStorageWork *gKangaskhanStorageWork = {0}; -EWRAM_DATA_2 struct unkStruct_203B20C *gUnknown_203B20C = {0}; extern const u8 *gUnknown_80D4920[]; extern const u8 *gUnknown_80D4928[]; @@ -24,74 +23,45 @@ extern const u8 *gUnknown_80D4934[]; extern const u8 *gUnknown_80D4958[]; extern const u8 *gUnknown_80D4964[]; extern const u8 *gUnknown_80D4970[]; -extern const u8 *gUnknown_80D4984[]; -extern struct UnkTextStruct2 gUnknown_80DB748; -extern struct UnkTextStruct2 gUnknown_80DB760; -extern struct UnkTextStruct2 gUnknown_80DB778; -extern struct UnkTextStruct2 gUnknown_80DB790; -extern const u8 gUnknown_80DB7A8[]; // "Number?\0" -extern struct UnkTextStruct2 gUnknown_80DB7B8; -extern struct UnkTextStruct2 gUnknown_80DB7D0; -extern struct UnkTextStruct2 gUnknown_80DB7E8; -extern struct UnkTextStruct2 gUnknown_80DB800; -extern struct UnkTextStruct2 gUnknown_80DB818; -extern const u8 gUnknown_80DB830[]; // "Number?\0" +extern const u8 *gKangaskhanStorageDialogue[2][20]; // 80D5404 -extern const u8 *gKangaskhanStorageDialogue[2][20]; +#include "data/kangaskhan_storage1.h" // 80DB748 -// code_8098BDC.s -extern void sub_8099690(u32); +static void AdvanceToKangaskhanStorageFallbackState(void); +static void UpdateKangaskhanStorageState(u32); -void sub_8016E80(void); -void sub_8016FF8(void); -void sub_8017598(void); -void sub_80175FC(void); -void sub_80176B8(void); -void sub_8017758(void); -void sub_80177F8(void); -void sub_8017828(void); -void sub_80178D0(void); -void sub_8017928(void); -void sub_80179A8(void); -void sub_8017A1C(void); -void sub_8017AF8(void); -void sub_8017B88(void); -void sub_8017C28(void); -void sub_8017C7C(void); -void sub_8017D24(void); -void sub_8017DC0(void); -void sub_8017DDC(void); -void sub_8017F10(u32); -void sub_8017F28(void); -void sub_8018100(void); -void sub_8018280(void); -void sub_80182E4(void); -void sub_801841C(void); -void sub_80184D4(void); -void sub_8018588(void); -void sub_8018620(void); -void sub_80186F8(void); -void sub_8018854(void); -void sub_8018904(void); -void sub_80189C8(void); -void sub_8018AC8(void); -void sub_8018AE4(void); +static void sub_8016E80(void); +static void sub_8016FF8(void); +static void sub_8017598(void); +static void sub_80175FC(void); +static void sub_80176B8(void); +static void sub_8017758(void); +static void sub_80177F8(void); +static void sub_8017828(void); +static void sub_80178D0(void); +static void sub_8017928(void); +static void sub_80179A8(void); +static void sub_8017A1C(void); +static void sub_8017AF8(void); +static void sub_8017B88(void); +static void sub_8017C28(void); +static void sub_8017C7C(void); +static void sub_8017D24(void); +static void sub_8017DC0(void); +static void sub_8017DDC(void); -void AdvanceToKangaskhanStorageFallbackState(void); -void UpdateKangaskhanStorageState(u32); - -u32 CreateKangaskhanStorage(bool32 isAsleep) +bool8 CreateKangaskhanStorage(u32 mode) { - char *monName; - struct OpenedFile *faceFile; - + u8 *monName; + OpenedFile *faceFile; + ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); gKangaskhanStorageWork = MemoryAlloc(sizeof(struct KangaskhanStorageWork), 8); gKangaskhanStorageWork->menuAction1 = 0; gKangaskhanStorageWork->menuAction2 = 0; gKangaskhanStorageWork->menuAction3 = 0; - gKangaskhanStorageWork->isAsleep = isAsleep; + gKangaskhanStorageWork->isAsleep = mode; CopyYellowMonsterNametoBuffer(gUnknown_202E5D8, MONSTER_KANGASKHAN); CopyYellowMonsterNametoBuffer(gUnknown_202E1C8, MONSTER_KANGASKHAN); monName = GetMonSpecies(MONSTER_KANGASKHAN); @@ -111,7 +81,7 @@ u32 CreateKangaskhanStorage(bool32 isAsleep) gKangaskhanStorageWork->unkE0 = 2; gKangaskhanStorageWork->unkE2 = 8; UpdateKangaskhanStorageState(KANGASKHAN_STORAGE_INIT); - return 1; + return TRUE; } u32 KangaskhanStorageCallback(void) @@ -174,14 +144,14 @@ void DeleteKangaskhanStorage(void) } } -void UpdateKangaskhanStorageState(u32 newState) +static void UpdateKangaskhanStorageState(u32 newState) { gKangaskhanStorageWork->currState = newState; sub_8016E80(); sub_8016FF8(); } -void sub_8016E80(void) +static void sub_8016E80(void) { s32 index; @@ -190,36 +160,36 @@ void sub_8016E80(void) switch (gKangaskhanStorageWork->currState) { case 13: case 14: - gKangaskhanStorageWork->unkEC[0] = gUnknown_80DB748; - gKangaskhanStorageWork->unkEC[1] = gUnknown_80DB748; - gKangaskhanStorageWork->unkEC[2] = gUnknown_80DB748; - gKangaskhanStorageWork->unkEC[0] = gUnknown_80DB748; + gKangaskhanStorageWork->unkEC[0] = sUnknown_80DB748; + gKangaskhanStorageWork->unkEC[1] = sUnknown_80DB748; + gKangaskhanStorageWork->unkEC[2] = sUnknown_80DB748; + gKangaskhanStorageWork->unkEC[0] = sUnknown_80DB748; break; case 22: case 23: - gKangaskhanStorageWork->unkEC[0] = gUnknown_80DB748; - gKangaskhanStorageWork->unkEC[1] = gUnknown_80DB748; - gKangaskhanStorageWork->unkEC[2] = gUnknown_80DB748; - gKangaskhanStorageWork->unkEC[0] = gUnknown_80DB778; + gKangaskhanStorageWork->unkEC[0] = sUnknown_80DB748; + gKangaskhanStorageWork->unkEC[1] = sUnknown_80DB748; + gKangaskhanStorageWork->unkEC[2] = sUnknown_80DB748; + gKangaskhanStorageWork->unkEC[0] = sUnknown_80DB778; break; case 24: - gKangaskhanStorageWork->unkEC[1] = gUnknown_80DB790; + gKangaskhanStorageWork->unkEC[1] = sUnknown_80DB790; break; case 15: case 25: - gKangaskhanStorageWork->unkEC[2] = gUnknown_80DB760; + gKangaskhanStorageWork->unkEC[2] = sUnknown_80DB760; break; default: for (index = 0; index < 4; index++) - gKangaskhanStorageWork->unkEC[index] = gUnknown_80DB748; + gKangaskhanStorageWork->unkEC[index] = sUnknown_80DB748; break; } ResetUnusedInputStruct(); - sub_800641C(gKangaskhanStorageWork->unkEC, 1, 1); + sub_800641C(gKangaskhanStorageWork->unkEC, TRUE, TRUE); } -void sub_8016FF8(void) +static void sub_8016FF8(void) { switch (gKangaskhanStorageWork->currState) { case KANGASKHAN_STORAGE_INIT: @@ -286,10 +256,10 @@ void sub_8016FF8(void) sub_80141B4(gKangaskhanStorageDialogue[gKangaskhanStorageWork->isAsleep][4], 0, gKangaskhanStorageWork->unkE8, 0x30D); break; case 13: - sub_801A5D8(3, 3, 0, 10); + sub_801A5D8(3, 3, NULL, 10); break; case 14: - sub_801A8D0(1); + sub_801A8D0(TRUE); break; case 15: sub_801A9E0(); @@ -392,11 +362,11 @@ void sub_8016FF8(void) } } -void sub_8017598(void) +static void sub_8017598(void) { sub_8008C54(gKangaskhanStorageWork->unkBC); sub_80073B8(gKangaskhanStorageWork->unkBC); - xxx_call_draw_string(4, 0, gUnknown_80DB7A8, gKangaskhanStorageWork->unkBC, 0); + xxx_call_draw_string(4, 0, sNumber, gKangaskhanStorageWork->unkBC, 0); sub_8013C68(&gKangaskhanStorageWork->unkA8); sub_80073E0(gKangaskhanStorageWork->unkBC); sub_801CCD8(); @@ -404,7 +374,7 @@ void sub_8017598(void) sub_8012EA4(&gKangaskhanStorageWork->unk58, 0); } -void sub_80175FC(void) +static void sub_80175FC(void) { s32 index; s32 loopMax; @@ -445,7 +415,7 @@ void sub_80175FC(void) } } -void sub_80176B8(void) +static void sub_80176B8(void) { s32 index; s32 loopMax; @@ -478,7 +448,7 @@ void sub_80176B8(void) } } -void sub_8017758(void) +static void sub_8017758(void) { s32 index; s32 loopMax; @@ -511,7 +481,7 @@ void sub_8017758(void) } } -void sub_80177F8(void) +static void sub_80177F8(void) { s32 loopMax; @@ -528,7 +498,7 @@ void sub_80177F8(void) gKangaskhanStorageWork->unk24[loopMax].menuAction = 1; } -void sub_8017828(void) +static void sub_8017828(void) { s32 menuAction; @@ -564,7 +534,7 @@ void sub_8017828(void) } } -void sub_80178D0(void) +static void sub_80178D0(void) { s32 menuAction; @@ -585,10 +555,10 @@ void sub_80178D0(void) } } -void sub_8017928(void) +static void sub_8017928(void) { s32 menuAction; - struct BulkItem item; + BulkItem item; if (sub_80144A4(&menuAction) != 0) return; @@ -608,7 +578,7 @@ void sub_8017928(void) } } -void sub_80179A8(void) +static void sub_80179A8(void) { s32 index; s32 menuAction; @@ -637,11 +607,11 @@ void sub_80179A8(void) } } -void sub_8017A1C(void) +static void sub_8017A1C(void) { s32 itemID; - int menuAction; - struct BulkItem item; + s32 menuAction; + BulkItem item; if (sub_80144A4(&menuAction) != 0) return; @@ -675,7 +645,7 @@ void sub_8017A1C(void) } } -void sub_8017AF8(void) +static void sub_8017AF8(void) { switch (sub_801A6E8(TRUE)) { case 3: @@ -701,7 +671,7 @@ void sub_8017AF8(void) } } -void sub_8017B88(void) +static void sub_8017B88(void) { switch (sub_801CA08(TRUE)) { case 3: @@ -730,7 +700,7 @@ void sub_8017B88(void) } } -void sub_8017C28(void) +static void sub_8017C28(void) { sub_801CA08(FALSE); sub_8012FD8(&gKangaskhanStorageWork->unk58); @@ -752,7 +722,7 @@ void sub_8017C28(void) } } -void sub_8017C7C(void) +static void sub_8017C7C(void) { s32 menuAction; menuAction = 0; @@ -784,7 +754,7 @@ void sub_8017C7C(void) } } -void sub_8017D24(void) +static void sub_8017D24(void) { s32 menuAction; menuAction = 0; @@ -816,7 +786,7 @@ void sub_8017D24(void) } } -void sub_8017DC0(void) +static void sub_8017DC0(void) { switch (sub_801B410()) { case 0: @@ -831,7 +801,7 @@ void sub_8017DC0(void) } } -void sub_8017DDC(void) +static void sub_8017DDC(void) { switch (sub_801B410()) { case 0: @@ -846,601 +816,10 @@ void sub_8017DDC(void) } } -void AdvanceToKangaskhanStorageFallbackState(void) +static void AdvanceToKangaskhanStorageFallbackState(void) { s32 temp; + if (sub_80144A4(&temp) == 0) UpdateKangaskhanStorageState(gKangaskhanStorageWork->fallbackState); -} - -u32 sub_8017E1C(void) -{ - ResetUnusedInputStruct(); - sub_800641C(NULL, 1, 1); - gUnknown_203B20C = MemoryAlloc(sizeof(struct unkStruct_203B20C), 8); - gUnknown_203B20C->menuAction1 = 0; - gUnknown_203B20C->menuAction2 = 0; - gUnknown_203B20C->menuAction3 = 0; - sub_8017F10(0); - return 1; -} - -u32 sub_8017E54(void) -{ - switch (gUnknown_203B20C->state) { - case 0: - sub_8017F10(1); - break; - case 1: - sub_8018588(); - break; - case 4: - case 5: - sub_8018620(); - break; - case 6: - sub_8018904(); - break; - case 7: - sub_8018AC8(); - break; - case 10: - case 11: - sub_80186F8(); - break; - case 12: - sub_8018854(); - break; - case 13: - sub_80189C8(); - break; - case 14: - sub_8018AE4(); - break; - case 3: - return 3; - } - return 0; -} - -void sub_8017EF4(void) -{ - if (gUnknown_203B20C != NULL) { - MemoryFree(gUnknown_203B20C); - gUnknown_203B20C = NULL; - } -} - -void sub_8017F10(u32 newState) -{ - gUnknown_203B20C->state = newState; - sub_8017F28(); - sub_8018100(); -} - -void sub_8017F28(void) -{ - s32 index; - - sub_8006518(gUnknown_203B20C->unkF0); - - switch (gUnknown_203B20C->state) { - case 1: - gUnknown_203B20C->unkF0[0] = gUnknown_80DB7B8; - gUnknown_203B20C->unkF0[1] = gUnknown_80DB7B8; - gUnknown_203B20C->unkF0[0] = gUnknown_80DB7B8; - sub_80182E4(); - gUnknown_203B20C->unkF0[2] = gUnknown_80DB7D0; - sub_8012CAC(&gUnknown_203B20C->unkF0[2], gUnknown_203B20C->unk20); - break; - case 4: - case 5: - gUnknown_203B20C->unkF0[0] = gUnknown_80DB7B8; - gUnknown_203B20C->unkF0[1] = gUnknown_80DB7B8; - gUnknown_203B20C->unkF0[2] = gUnknown_80DB7B8; - gUnknown_203B20C->unkF0[0] = gUnknown_80DB7B8; - break; - case 10: - case 11: - gUnknown_203B20C->unkF0[0] = gUnknown_80DB7B8; - gUnknown_203B20C->unkF0[1] = gUnknown_80DB7B8; - gUnknown_203B20C->unkF0[2] = gUnknown_80DB7B8; - gUnknown_203B20C->unkF0[0] = gUnknown_80DB800; - break; - case 12: - gUnknown_203B20C->unkF0[1] = gUnknown_80DB818; - break; - case 6: - case 13: - gUnknown_203B20C->unkF0[2] = gUnknown_80DB7E8; - break; - default: - case 0: - for (index = 0; index < 4; index++) - gUnknown_203B20C->unkF0[index] = gUnknown_80DB7B8; - break; - } - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B20C->unkF0, 1, 1); -} - -void sub_8018100(void) -{ - switch (gUnknown_203B20C->state) { - case 1: - sub_8012D60(&gUnknown_203B20C->unk70, gUnknown_203B20C->unk20, 0, gUnknown_203B20C->unk60, gUnknown_203B20C->menuAction1, 2); - break; - case 4: - sub_801A5D8(3, 3, 0, 10); - break; - case 5: - sub_801A8D0(1); - break; - case 6: - sub_801A9E0(); - sub_801841C(); - sub_8012D60(&gUnknown_203B20C->unk70, gUnknown_203B20C->unk20, 0, gUnknown_203B20C->unk60, gUnknown_203B20C->menuAction2, 2); - break; - case 7: - sub_801B3C0(&gUnknown_203B20C->item); - break; - case 10: - sub_801C8C4(1, 3, 0, 10); - sub_801AD34(0); - break; - case 11: - sub_801CB5C(TRUE); - sub_801AD34(0); - break; - case 12: - gUnknown_203B20C->unkD0 = 2; - gUnknown_203B20C->unkC8 = 1; - - if (gTeamInventoryRef->teamStorage[gUnknown_203B20C->item.id] > 99) - gUnknown_203B20C->unkCC = 99; - else - gUnknown_203B20C->unkCC = gTeamInventoryRef->teamStorage[gUnknown_203B20C->item.id]; - - gUnknown_203B20C->unkC4 = gUnknown_203B20C->unkCC; - gUnknown_203B20C->unkD4 = 1; - gUnknown_203B20C->unkD8 = &gUnknown_203B20C->unkF0[1]; - gUnknown_203B20C->unkDC = 40; - gUnknown_203B20C->unkE0 = 18; - sub_8013AA0(&gUnknown_203B20C->unkC0); - sub_8018280(); - break; - case 13: - sub_801CCD8(); - sub_801AD34(0); - sub_80184D4(); - sub_8012D60(&gUnknown_203B20C->unk70, gUnknown_203B20C->unk20, 0, gUnknown_203B20C->unk60, gUnknown_203B20C->menuAction3, 2); - break; - case 14: - sub_801B3C0(&gUnknown_203B20C->item); - break; - case 0: - default: - break; - } -} - -void sub_8018280(void) -{ - sub_8008C54(gUnknown_203B20C->unkD4); - sub_80073B8(gUnknown_203B20C->unkD4); - xxx_call_draw_string(4, 0, gUnknown_80DB830, gUnknown_203B20C->unkD4, 0); - sub_8013C68(&gUnknown_203B20C->unkC0); - sub_80073E0(gUnknown_203B20C->unkD4); - sub_801CCD8(); - sub_801AD34(0); - sub_8012EA4(&gUnknown_203B20C->unk70, 0); -} - -void sub_80182E4(void) -{ - int index; - s32 loopMax; - - loopMax = 0; - MemoryFill16(gUnknown_203B20C->unk60, 0, sizeof(gUnknown_203B20C->unk60)); - gUnknown_203B20C->unk20[0].text = *gUnknown_80D4958; - gUnknown_203B20C->unk20[0].menuAction = 2; - - if (GetNumberOfFilledInventorySlots() == 0 || sub_801CF50(0)) - gUnknown_203B20C->unk60[0] = 1; - - loopMax += 1; - gUnknown_203B20C->unk20[loopMax].text = *gUnknown_80D4964; - gUnknown_203B20C->unk20[loopMax].menuAction = 3; - - if (sub_801CF14(1) || INVENTORY_SIZE <= GetNumberOfFilledInventorySlots()) - gUnknown_203B20C->unk60[loopMax] = 1; - - loopMax += 1; - gUnknown_203B20C->unk20[loopMax].text = *gUnknown_80D4934; - gUnknown_203B20C->unk20[loopMax].menuAction = 1; - - loopMax += 1; - gUnknown_203B20C->unk20[loopMax].text = NULL; - gUnknown_203B20C->unk20[loopMax].menuAction = 1; - - for (index = 0; index < loopMax; index++) { - if (gUnknown_203B20C->unk60[index] == 0) { - if (gUnknown_203B20C->unk20[index].menuAction == gUnknown_203B20C->menuAction1) - return; - } - } - - for (index = 0; index < loopMax; index++) { - if (gUnknown_203B20C->unk60[index] == 0) { - gUnknown_203B20C->menuAction1 = gUnknown_203B20C->unk20[index].menuAction; - break; - } - } -} - -void sub_801841C(void) -{ - int index; - s32 loopMax; - - loopMax = 0; - MemoryFill16(gUnknown_203B20C->unk60,0,sizeof(gUnknown_203B20C->unk60)); - gUnknown_203B20C->unk20[0].text = *gUnknown_80D4958; - gUnknown_203B20C->unk20[0].menuAction = 2; - if (!sub_801ADA0(gUnknown_203B20C->itemIndex)) - gUnknown_203B20C->unk60[0] = 1; - - loopMax += 1; - gUnknown_203B20C->unk20[loopMax].text = *gUnknown_80D4970; - gUnknown_203B20C->unk20[loopMax].menuAction = 4; - - loopMax += 1; - gUnknown_203B20C->unk20[loopMax].text = NULL; - gUnknown_203B20C->unk20[loopMax].menuAction = 1; - - for (index = 0; index < loopMax; index++) { - if (gUnknown_203B20C->unk60[index] == 0) { - if (gUnknown_203B20C->unk20[index].menuAction == gUnknown_203B20C->menuAction2) - return; - } - } - - for (index = 0; index < loopMax; index++) { - if (gUnknown_203B20C->unk60[index] == 0) { - gUnknown_203B20C->menuAction2 = gUnknown_203B20C->unk20[index].menuAction; - break; - } - } -} - -void sub_80184D4(void) -{ - int index; - s32 loopMax; - - loopMax = 0; - MemoryFill16(gUnknown_203B20C->unk60, 0, sizeof(gUnknown_203B20C->unk60)); - gUnknown_203B20C->unk20[0].text = *gUnknown_80D4964; - gUnknown_203B20C->unk20[0].menuAction = 3; - - if (GetNumberOfFilledInventorySlots() >= INVENTORY_SIZE) - gUnknown_203B20C->unk60[0] = 1; - - loopMax += 1; - gUnknown_203B20C->unk20[loopMax].text = *gUnknown_80D4970; - gUnknown_203B20C->unk20[loopMax].menuAction = 4; - - loopMax += 1; - gUnknown_203B20C->unk20[loopMax].text = NULL; - gUnknown_203B20C->unk20[loopMax].menuAction = 1; - - for (index = 0; index < loopMax; index++) { - if (gUnknown_203B20C->unk60[index] == 0) { - if (gUnknown_203B20C->unk20[index].menuAction == gUnknown_203B20C->menuAction3) - return; - } - } - - for (index = 0; index < loopMax; index++) { - if (gUnknown_203B20C->unk60[index] == 0) { - gUnknown_203B20C->menuAction3 = gUnknown_203B20C->unk20[index].menuAction; - break; - } - } -} - -void sub_8018588(void) -{ - s32 menuAction; - menuAction = 0; - - if (sub_8012FD8(&gUnknown_203B20C->unk70) == 0) { - sub_8013114(&gUnknown_203B20C->unk70, &menuAction); - if (menuAction != 1) - gUnknown_203B20C->menuAction1 = menuAction; - } - - switch (menuAction) { - case 2: - if (GetNumberOfFilledInventorySlots() != 0 && !sub_801CF50(0)) - sub_8017F10(4); - else - sub_8012EA4(&gUnknown_203B20C->unk70, 1); - break; - case 3: - if (sub_801CF14(1)) - sub_8012EA4(&gUnknown_203B20C->unk70, 1); - else - sub_8017F10(10); - break; - case 1: - sub_8017F10(3); - break; - } -} - -void sub_8018620(void) -{ - s32 index; - - switch (sub_801A6E8(TRUE)) { - case 3: - if (sub_801AEA8() != 0) { - for (index = 0; index < INVENTORY_SIZE; index++) { - if (sub_801AED0(index) != 0) { - MoveToStorage(&gTeamInventoryRef->teamItems[index]); - gTeamInventoryRef->teamItems[index].id = 0; - gTeamInventoryRef->teamItems[index].flags = 0; - } - } - - FillInventoryGaps(); - sub_801AE84(); - - if (GetNumberOfFilledInventorySlots() == 0) { - sub_801A928(); - sub_8017F10(1); - } - else - sub_8017F10(5); - } - else { - gUnknown_203B20C->itemIndex = sub_801A8AC(); - gUnknown_203B20C->item = gTeamInventoryRef->teamItems[gUnknown_203B20C->itemIndex]; - sub_8017F10(6); - } - break; - case 4: - gUnknown_203B20C->itemIndex = sub_801A8AC(); - gUnknown_203B20C->item = gTeamInventoryRef->teamItems[gUnknown_203B20C->itemIndex]; - sub_8017F10(7); - break; - case 2: - sub_801A928(); - sub_8017F10(1); - break; - } -} - -void sub_80186F8(void) -{ - struct BulkItem item; - s32 itemID; - - switch (sub_801CA08(TRUE)) { - case 3: - if (sub_801CFB8() != 0) { - for (itemID = 0; itemID < NUMBER_OF_ITEM_IDS; itemID++) { - if (sub_801CFE0(itemID) != 0) { - item.id = itemID; - - if (IsThrowableItem(item.id)) { - if (gTeamInventoryRef->teamStorage[item.id] > 99) - item.quantity = 99; - else - item.quantity = gTeamInventoryRef->teamStorage[item.id]; - } - else - item.quantity = 1; - - gTeamInventoryRef->teamStorage[item.id] -= item.quantity; - AddHeldItemToInventory(&item); - } - } - - FillInventoryGaps(); - sub_801CF94(); - - if (!sub_801CF14(1) && GetNumberOfFilledInventorySlots() < INVENTORY_SIZE) - sub_8017F10(11); - else { - sub_801CBB8(); - sub_8017F10(1); - } - } - else { - gUnknown_203B20C->id = sub_801CB24(); - xxx_init_itemslot_8090A8C(&gUnknown_203B20C->item, gUnknown_203B20C->id, 0); - gUnknown_203B20C->item.quantity = 1; - sub_8017F10(13); - } - break; - case 4: - gUnknown_203B20C->id = sub_801CB24(); - xxx_init_itemslot_8090A8C(&gUnknown_203B20C->item, gUnknown_203B20C->id, 0); - gUnknown_203B20C->item.quantity = 1; - sub_8017F10(14); - break; - case 2: - sub_801CBB8(); - sub_8017F10(1); - break; - case 1: - sub_801AD34(0); - break; - } -} - -void sub_8018854(void) -{ - struct BulkItem item; - - sub_801CA08(FALSE); - sub_8012FD8(&gUnknown_203B20C->unk70); - - switch (sub_8013BBC(&gUnknown_203B20C->unkC0)) { - case 3: - gUnknown_203B20C->item.quantity = gUnknown_203B20C->unkC0; - gTeamInventoryRef->teamStorage[gUnknown_203B20C->item.id] -= gUnknown_203B20C->item.quantity; - item.id = gUnknown_203B20C->item.id; - item.quantity = gUnknown_203B20C->item.quantity; - AddHeldItemToInventory(&item); - - if (!sub_801CF14(1)) { - if (GetNumberOfFilledInventorySlots() >= INVENTORY_SIZE) { - error: - sub_801CBB8(); - sub_8017F10(1); - } - else - sub_8017F10(11); - } - else - goto error; - break; - case 2: - sub_8017F10(11); - break; - case 1: - sub_8018280(); - break; - case 0: - break; - } -} - -void sub_8018904(void) -{ - s32 menuAction; - - menuAction = 0; - - sub_801A6E8(FALSE); - if (sub_8012FD8(&gUnknown_203B20C->unk70) == 0) { - sub_8013114(&gUnknown_203B20C->unk70, &menuAction); - if (menuAction != 1) - gUnknown_203B20C->menuAction2 = menuAction; - } - - switch (menuAction) { - case 2: - if (IsNotMoneyOrUsedTMItem(gUnknown_203B20C->item.id)) { - if (sub_801ADA0(gUnknown_203B20C->itemIndex) == 0) { - error: - sub_8012EA4(&gUnknown_203B20C->unk70, 1); - } - else { - MoveToStorage(&gUnknown_203B20C->item); - ShiftItemsDownFrom(gUnknown_203B20C->itemIndex); - FillInventoryGaps(); - - if (GetNumberOfFilledInventorySlots() == 0) { - sub_801A928(); - sub_8017F10(1); - } - else - sub_8017F10(5); - } - } - else - goto error; - break; - case 4: - sub_8099690(0); - sub_8017F10(7); - break; - case 1: - sub_8017F10(5); - break; - } -} - -void sub_80189C8(void) -{ - struct BulkItem item; - s32 menuAction; - - menuAction = 0; - - sub_801CA08(FALSE); - if (sub_8012FD8(&gUnknown_203B20C->unk70) == 0) { - sub_8013114(&gUnknown_203B20C->unk70, &menuAction); - if (menuAction != 1) - gUnknown_203B20C->menuAction3 = menuAction; - } - - switch (menuAction) { - case 3: - if (GetNumberOfFilledInventorySlots() >= INVENTORY_SIZE) - sub_8012EA4(&gUnknown_203B20C->unk70, 1); - else if (IsThrowableItem(gUnknown_203B20C->item.id)) - sub_8017F10(12); - else { - gTeamInventoryRef->teamStorage[gUnknown_203B20C->item.id] -= gUnknown_203B20C->item.quantity; - item.id = gUnknown_203B20C->item.id; - item.quantity = gUnknown_203B20C->item.quantity; - AddHeldItemToInventory(&item); - - if (!sub_801CF14(1)) { - if (GetNumberOfFilledInventorySlots() >= INVENTORY_SIZE) - { - error: - sub_801CBB8(); - sub_8017F10(1); - } - else - sub_8017F10(11); - } - else - goto error; - } - break; - case 4: - sub_8017F10(14); - break; - case 1: - sub_8017F10(11); - break; - } -} - -void sub_8018AC8(void) -{ - switch (sub_801B410()) { - case 2: - case 3: - sub_801B450(); - sub_8017F10(5); - break; - case 0: - case 1: - default: - break; - } -} - -void sub_8018AE4(void) -{ - switch (sub_801B410()) { - case 2: - case 3: - sub_801B450(); - sub_8017F10(11); - break; - case 0: - case 1: - default: - break; - } } \ No newline at end of file diff --git a/src/kangaskhan_storage2.c b/src/kangaskhan_storage2.c new file mode 100644 index 000000000..075eb2558 --- /dev/null +++ b/src/kangaskhan_storage2.c @@ -0,0 +1,628 @@ +#include "global.h" +#include "code_80130A8.h" +#include "code_801B3C0.h" +#include "code_801C620.h" +#include "code_8098BDC.h" +#include "kangaskhan_storage2.h" +#include "kecleon_bros4.h" +#include "memory.h" +#include "menu_input.h" +#include "text1.h" +#include "text2.h" + +EWRAM_DATA_2 unkStruct_203B20C *gUnknown_203B20C = {0}; + +extern const u8 *gUnknown_80D4934[]; +extern const u8 *gUnknown_80D4958[]; +extern const u8 *gUnknown_80D4964[]; +extern const u8 *gUnknown_80D4970[]; + +#include "data/kangaskhan_storage2.h" // 80DB7B8 + +static void sub_8017F10(u32); +static void sub_8017F28(void); +static void sub_8018100(void); +static void sub_8018280(void); +static void sub_80182E4(void); +static void sub_801841C(void); +static void sub_80184D4(void); +static void sub_8018588(void); +static void sub_8018620(void); +static void sub_80186F8(void); +static void sub_8018854(void); +static void sub_8018904(void); +static void sub_80189C8(void); +static void sub_8018AC8(void); +static void sub_8018AE4(void); + +bool8 sub_8017E1C(void) +{ + ResetUnusedInputStruct(); + sub_800641C(NULL, TRUE, TRUE); + gUnknown_203B20C = MemoryAlloc(sizeof(unkStruct_203B20C), 8); + gUnknown_203B20C->menuAction1 = 0; + gUnknown_203B20C->menuAction2 = 0; + gUnknown_203B20C->menuAction3 = 0; + sub_8017F10(0); + return TRUE; +} + +u32 sub_8017E54(void) +{ + switch (gUnknown_203B20C->state) { + case 0: + sub_8017F10(1); + break; + case 1: + sub_8018588(); + break; + case 4: + case 5: + sub_8018620(); + break; + case 6: + sub_8018904(); + break; + case 7: + sub_8018AC8(); + break; + case 10: + case 11: + sub_80186F8(); + break; + case 12: + sub_8018854(); + break; + case 13: + sub_80189C8(); + break; + case 14: + sub_8018AE4(); + break; + case 3: + return 3; + } + return 0; +} + +void sub_8017EF4(void) +{ + if (gUnknown_203B20C != NULL) { + MemoryFree(gUnknown_203B20C); + gUnknown_203B20C = NULL; + } +} + +static void sub_8017F10(u32 newState) +{ + gUnknown_203B20C->state = newState; + sub_8017F28(); + sub_8018100(); +} + +static void sub_8017F28(void) +{ + s32 index; + + sub_8006518(gUnknown_203B20C->unkF0); + + switch (gUnknown_203B20C->state) { + case 1: + gUnknown_203B20C->unkF0[0] = sUnknown_80DB7B8; + gUnknown_203B20C->unkF0[1] = sUnknown_80DB7B8; + gUnknown_203B20C->unkF0[0] = sUnknown_80DB7B8; + sub_80182E4(); + gUnknown_203B20C->unkF0[2] = sUnknown_80DB7D0; + sub_8012CAC(&gUnknown_203B20C->unkF0[2], gUnknown_203B20C->unk20); + break; + case 4: + case 5: + gUnknown_203B20C->unkF0[0] = sUnknown_80DB7B8; + gUnknown_203B20C->unkF0[1] = sUnknown_80DB7B8; + gUnknown_203B20C->unkF0[2] = sUnknown_80DB7B8; + gUnknown_203B20C->unkF0[0] = sUnknown_80DB7B8; + break; + case 10: + case 11: + gUnknown_203B20C->unkF0[0] = sUnknown_80DB7B8; + gUnknown_203B20C->unkF0[1] = sUnknown_80DB7B8; + gUnknown_203B20C->unkF0[2] = sUnknown_80DB7B8; + gUnknown_203B20C->unkF0[0] = sUnknown_80DB800; + break; + case 12: + gUnknown_203B20C->unkF0[1] = sUnknown_80DB818; + break; + case 6: + case 13: + gUnknown_203B20C->unkF0[2] = sUnknown_80DB7E8; + break; + default: + case 0: + for (index = 0; index < 4; index++) + gUnknown_203B20C->unkF0[index] = sUnknown_80DB7B8; + break; + } + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B20C->unkF0, TRUE, TRUE); +} + +static void sub_8018100(void) +{ + switch (gUnknown_203B20C->state) { + case 1: + sub_8012D60(&gUnknown_203B20C->unk70, gUnknown_203B20C->unk20, 0, gUnknown_203B20C->unk60, gUnknown_203B20C->menuAction1, 2); + break; + case 4: + sub_801A5D8(3, 3, NULL, 10); + break; + case 5: + sub_801A8D0(TRUE); + break; + case 6: + sub_801A9E0(); + sub_801841C(); + sub_8012D60(&gUnknown_203B20C->unk70, gUnknown_203B20C->unk20, 0, gUnknown_203B20C->unk60, gUnknown_203B20C->menuAction2, 2); + break; + case 7: + sub_801B3C0(&gUnknown_203B20C->item); + break; + case 10: + sub_801C8C4(1, 3, 0, 10); + sub_801AD34(0); + break; + case 11: + sub_801CB5C(TRUE); + sub_801AD34(0); + break; + case 12: + gUnknown_203B20C->unkD0 = 2; + gUnknown_203B20C->unkC8 = 1; + + if (gTeamInventoryRef->teamStorage[gUnknown_203B20C->item.id] > 99) + gUnknown_203B20C->unkCC = 99; + else + gUnknown_203B20C->unkCC = gTeamInventoryRef->teamStorage[gUnknown_203B20C->item.id]; + + gUnknown_203B20C->unkC4 = gUnknown_203B20C->unkCC; + gUnknown_203B20C->unkD4 = 1; + gUnknown_203B20C->unkD8 = &gUnknown_203B20C->unkF0[1]; + gUnknown_203B20C->unkDC = 40; + gUnknown_203B20C->unkE0 = 18; + sub_8013AA0(&gUnknown_203B20C->unkC0); + sub_8018280(); + break; + case 13: + sub_801CCD8(); + sub_801AD34(0); + sub_80184D4(); + sub_8012D60(&gUnknown_203B20C->unk70, gUnknown_203B20C->unk20, 0, gUnknown_203B20C->unk60, gUnknown_203B20C->menuAction3, 2); + break; + case 14: + sub_801B3C0(&gUnknown_203B20C->item); + break; + case 0: + default: + break; + } +} + +static void sub_8018280(void) +{ + sub_8008C54(gUnknown_203B20C->unkD4); + sub_80073B8(gUnknown_203B20C->unkD4); + xxx_call_draw_string(4, 0, sNumber, gUnknown_203B20C->unkD4, 0); + sub_8013C68(&gUnknown_203B20C->unkC0); + sub_80073E0(gUnknown_203B20C->unkD4); + sub_801CCD8(); + sub_801AD34(0); + sub_8012EA4(&gUnknown_203B20C->unk70, 0); +} + +static void sub_80182E4(void) +{ + int index; + s32 loopMax; + + loopMax = 0; + MemoryFill16(gUnknown_203B20C->unk60, 0, sizeof(gUnknown_203B20C->unk60)); + gUnknown_203B20C->unk20[0].text = *gUnknown_80D4958; + gUnknown_203B20C->unk20[0].menuAction = 2; + + if (GetNumberOfFilledInventorySlots() == 0 || sub_801CF50(0)) + gUnknown_203B20C->unk60[0] = 1; + + loopMax += 1; + gUnknown_203B20C->unk20[loopMax].text = *gUnknown_80D4964; + gUnknown_203B20C->unk20[loopMax].menuAction = 3; + + if (sub_801CF14(1) || INVENTORY_SIZE <= GetNumberOfFilledInventorySlots()) + gUnknown_203B20C->unk60[loopMax] = 1; + + loopMax += 1; + gUnknown_203B20C->unk20[loopMax].text = *gUnknown_80D4934; + gUnknown_203B20C->unk20[loopMax].menuAction = 1; + + loopMax += 1; + gUnknown_203B20C->unk20[loopMax].text = NULL; + gUnknown_203B20C->unk20[loopMax].menuAction = 1; + + for (index = 0; index < loopMax; index++) { + if (gUnknown_203B20C->unk60[index] == 0) { + if (gUnknown_203B20C->unk20[index].menuAction == gUnknown_203B20C->menuAction1) + return; + } + } + + for (index = 0; index < loopMax; index++) { + if (gUnknown_203B20C->unk60[index] == 0) { + gUnknown_203B20C->menuAction1 = gUnknown_203B20C->unk20[index].menuAction; + break; + } + } +} + +static void sub_801841C(void) +{ + s32 index; + s32 loopMax; + + loopMax = 0; + MemoryFill16(gUnknown_203B20C->unk60,0,sizeof(gUnknown_203B20C->unk60)); + gUnknown_203B20C->unk20[0].text = *gUnknown_80D4958; + gUnknown_203B20C->unk20[0].menuAction = 2; + if (!sub_801ADA0(gUnknown_203B20C->itemIndex)) + gUnknown_203B20C->unk60[0] = 1; + + loopMax += 1; + gUnknown_203B20C->unk20[loopMax].text = *gUnknown_80D4970; + gUnknown_203B20C->unk20[loopMax].menuAction = 4; + + loopMax += 1; + gUnknown_203B20C->unk20[loopMax].text = NULL; + gUnknown_203B20C->unk20[loopMax].menuAction = 1; + + for (index = 0; index < loopMax; index++) { + if (gUnknown_203B20C->unk60[index] == 0) { + if (gUnknown_203B20C->unk20[index].menuAction == gUnknown_203B20C->menuAction2) + return; + } + } + + for (index = 0; index < loopMax; index++) { + if (gUnknown_203B20C->unk60[index] == 0) { + gUnknown_203B20C->menuAction2 = gUnknown_203B20C->unk20[index].menuAction; + break; + } + } +} + +static void sub_80184D4(void) +{ + s32 index; + s32 loopMax; + + loopMax = 0; + MemoryFill16(gUnknown_203B20C->unk60, 0, sizeof(gUnknown_203B20C->unk60)); + gUnknown_203B20C->unk20[0].text = *gUnknown_80D4964; + gUnknown_203B20C->unk20[0].menuAction = 3; + + if (GetNumberOfFilledInventorySlots() >= INVENTORY_SIZE) + gUnknown_203B20C->unk60[0] = 1; + + loopMax += 1; + gUnknown_203B20C->unk20[loopMax].text = *gUnknown_80D4970; + gUnknown_203B20C->unk20[loopMax].menuAction = 4; + + loopMax += 1; + gUnknown_203B20C->unk20[loopMax].text = NULL; + gUnknown_203B20C->unk20[loopMax].menuAction = 1; + + for (index = 0; index < loopMax; index++) { + if (gUnknown_203B20C->unk60[index] == 0) { + if (gUnknown_203B20C->unk20[index].menuAction == gUnknown_203B20C->menuAction3) + return; + } + } + + for (index = 0; index < loopMax; index++) { + if (gUnknown_203B20C->unk60[index] == 0) { + gUnknown_203B20C->menuAction3 = gUnknown_203B20C->unk20[index].menuAction; + break; + } + } +} + +static void sub_8018588(void) +{ + s32 menuAction; + menuAction = 0; + + if (sub_8012FD8(&gUnknown_203B20C->unk70) == 0) { + sub_8013114(&gUnknown_203B20C->unk70, &menuAction); + if (menuAction != 1) + gUnknown_203B20C->menuAction1 = menuAction; + } + + switch (menuAction) { + case 2: + if (GetNumberOfFilledInventorySlots() != 0 && !sub_801CF50(0)) + sub_8017F10(4); + else + sub_8012EA4(&gUnknown_203B20C->unk70, 1); + break; + case 3: + if (sub_801CF14(1)) + sub_8012EA4(&gUnknown_203B20C->unk70, 1); + else + sub_8017F10(10); + break; + case 1: + sub_8017F10(3); + break; + } +} + +static void sub_8018620(void) +{ + s32 index; + + switch (sub_801A6E8(TRUE)) { + case 3: + if (sub_801AEA8() != 0) { + for (index = 0; index < INVENTORY_SIZE; index++) { + if (sub_801AED0(index) != 0) { + MoveToStorage(&gTeamInventoryRef->teamItems[index]); + gTeamInventoryRef->teamItems[index].id = 0; + gTeamInventoryRef->teamItems[index].flags = 0; + } + } + + FillInventoryGaps(); + sub_801AE84(); + + if (GetNumberOfFilledInventorySlots() == 0) { + sub_801A928(); + sub_8017F10(1); + } + else + sub_8017F10(5); + } + else { + gUnknown_203B20C->itemIndex = sub_801A8AC(); + gUnknown_203B20C->item = gTeamInventoryRef->teamItems[gUnknown_203B20C->itemIndex]; + sub_8017F10(6); + } + break; + case 4: + gUnknown_203B20C->itemIndex = sub_801A8AC(); + gUnknown_203B20C->item = gTeamInventoryRef->teamItems[gUnknown_203B20C->itemIndex]; + sub_8017F10(7); + break; + case 2: + sub_801A928(); + sub_8017F10(1); + break; + } +} + +static void sub_80186F8(void) +{ + BulkItem item; + s32 itemID; + + switch (sub_801CA08(TRUE)) { + case 3: + if (sub_801CFB8() != 0) { + for (itemID = 0; itemID < NUMBER_OF_ITEM_IDS; itemID++) { + if (sub_801CFE0(itemID) != 0) { + item.id = itemID; + + if (IsThrowableItem(item.id)) { + if (gTeamInventoryRef->teamStorage[item.id] > 99) + item.quantity = 99; + else + item.quantity = gTeamInventoryRef->teamStorage[item.id]; + } + else + item.quantity = 1; + + gTeamInventoryRef->teamStorage[item.id] -= item.quantity; + AddHeldItemToInventory(&item); + } + } + + FillInventoryGaps(); + sub_801CF94(); + + if (!sub_801CF14(1) && GetNumberOfFilledInventorySlots() < INVENTORY_SIZE) + sub_8017F10(11); + else { + sub_801CBB8(); + sub_8017F10(1); + } + } + else { + gUnknown_203B20C->id = sub_801CB24(); + xxx_init_itemslot_8090A8C(&gUnknown_203B20C->item, gUnknown_203B20C->id, 0); + gUnknown_203B20C->item.quantity = 1; + sub_8017F10(13); + } + break; + case 4: + gUnknown_203B20C->id = sub_801CB24(); + xxx_init_itemslot_8090A8C(&gUnknown_203B20C->item, gUnknown_203B20C->id, 0); + gUnknown_203B20C->item.quantity = 1; + sub_8017F10(14); + break; + case 2: + sub_801CBB8(); + sub_8017F10(1); + break; + case 1: + sub_801AD34(0); + break; + } +} + +static void sub_8018854(void) +{ + BulkItem item; + + sub_801CA08(FALSE); + sub_8012FD8(&gUnknown_203B20C->unk70); + + switch (sub_8013BBC(&gUnknown_203B20C->unkC0)) { + case 3: + gUnknown_203B20C->item.quantity = gUnknown_203B20C->unkC0; + gTeamInventoryRef->teamStorage[gUnknown_203B20C->item.id] -= gUnknown_203B20C->item.quantity; + item.id = gUnknown_203B20C->item.id; + item.quantity = gUnknown_203B20C->item.quantity; + AddHeldItemToInventory(&item); + + if (!sub_801CF14(1)) { + if (GetNumberOfFilledInventorySlots() >= INVENTORY_SIZE) { + error: + sub_801CBB8(); + sub_8017F10(1); + } + else + sub_8017F10(11); + } + else + goto error; + break; + case 2: + sub_8017F10(11); + break; + case 1: + sub_8018280(); + break; + case 0: + break; + } +} + +static void sub_8018904(void) +{ + s32 menuAction; + + menuAction = 0; + + sub_801A6E8(FALSE); + if (sub_8012FD8(&gUnknown_203B20C->unk70) == 0) { + sub_8013114(&gUnknown_203B20C->unk70, &menuAction); + if (menuAction != 1) + gUnknown_203B20C->menuAction2 = menuAction; + } + + switch (menuAction) { + case 2: + if (IsNotMoneyOrUsedTMItem(gUnknown_203B20C->item.id)) { + if (!sub_801ADA0(gUnknown_203B20C->itemIndex)) { + error: + sub_8012EA4(&gUnknown_203B20C->unk70, 1); + } + else { + MoveToStorage(&gUnknown_203B20C->item); + ShiftItemsDownFrom(gUnknown_203B20C->itemIndex); + FillInventoryGaps(); + + if (GetNumberOfFilledInventorySlots() == 0) { + sub_801A928(); + sub_8017F10(1); + } + else + sub_8017F10(5); + } + } + else + goto error; + break; + case 4: + sub_8099690(0); + sub_8017F10(7); + break; + case 1: + sub_8017F10(5); + break; + } +} + +static void sub_80189C8(void) +{ + BulkItem item; + s32 menuAction; + + menuAction = 0; + + sub_801CA08(FALSE); + if (sub_8012FD8(&gUnknown_203B20C->unk70) == 0) { + sub_8013114(&gUnknown_203B20C->unk70, &menuAction); + if (menuAction != 1) + gUnknown_203B20C->menuAction3 = menuAction; + } + + switch (menuAction) { + case 3: + if (GetNumberOfFilledInventorySlots() >= INVENTORY_SIZE) + sub_8012EA4(&gUnknown_203B20C->unk70, 1); + else if (IsThrowableItem(gUnknown_203B20C->item.id)) + sub_8017F10(12); + else { + gTeamInventoryRef->teamStorage[gUnknown_203B20C->item.id] -= gUnknown_203B20C->item.quantity; + item.id = gUnknown_203B20C->item.id; + item.quantity = gUnknown_203B20C->item.quantity; + AddHeldItemToInventory(&item); + + if (!sub_801CF14(1)) { + if (GetNumberOfFilledInventorySlots() >= INVENTORY_SIZE) + { + error: + sub_801CBB8(); + sub_8017F10(1); + } + else + sub_8017F10(11); + } + else + goto error; + } + break; + case 4: + sub_8017F10(14); + break; + case 1: + sub_8017F10(11); + break; + } +} + +static void sub_8018AC8(void) +{ + switch (sub_801B410()) { + case 2: + case 3: + sub_801B450(); + sub_8017F10(5); + break; + case 0: + case 1: + default: + break; + } +} + +static void sub_8018AE4(void) +{ + switch (sub_801B410()) { + case 2: + case 3: + sub_801B450(); + sub_8017F10(11); + break; + case 0: + case 1: + default: + break; + } +} \ No newline at end of file diff --git a/src/kecleon_bros.c b/src/kecleon_bros.c deleted file mode 100644 index e2105c2e2..000000000 --- a/src/kecleon_bros.c +++ /dev/null @@ -1,1763 +0,0 @@ -#include "global.h" -#include "code_800D090.h" -#include "code_80118A4.h" -#include "code_80130A8.h" -#include "code_801B3C0.h" -#include "constants/input.h" -#include "felicity_bank.h" -#include "kecleon_bros.h" -#include "memory.h" -#include "menu_input.h" -#include "pokemon.h" -#include "team_inventory.h" -#include "text1.h" -#include "text2.h" - -extern struct KecleonBrosWork *gKecleonBrosWork; -extern struct unkStruct_203B214 *gUnknown_203B214; -extern u16 gUnknown_203B218; -extern struct unkStruct_203B214 *gUnknown_203B21C; -extern u16 gUnknown_203B220; -extern struct unkStruct_203B224 *gUnknown_203B224; -extern u16 gUnknown_203B228; -extern u16 gUnknown_203B22A; -extern u32 gUnknown_202DE30; -extern u8 gUnknown_202DE58[]; -extern u8 gUnknown_202E5D8[]; -extern u8 gUnknown_202E1C8[]; - -extern u8 *gUnknown_80D4920[]; -extern u8 *gUnknown_80D4928[]; -extern u8 *gUnknown_80D4934[]; -extern u8 *gUnknown_80D4970[]; -extern u8 * gUnknown_80D4978[]; -extern u8 *gUnknown_80D4984[]; -extern struct UnkTextStruct2 gUnknown_80DB840; -extern struct UnkTextStruct2 gUnknown_80DB858; -extern struct UnkTextStruct2 gUnknown_80DB870; -extern struct UnkTextStruct2 gUnknown_80DB888; -extern u8 gUnknown_80DB8A0[]; -extern struct UnkTextStruct2 gUnknown_80DB8B4; -extern struct UnkTextStruct2 gUnknown_80DB8CC; -extern u8 gUnknown_80DB8E4[]; -extern u8 gUnknown_80DB8EC[]; -extern struct UnkTextStruct2 gUnknown_80DB8FC; -extern const struct UnkTextStruct2 gUnknown_80DB914; -extern u8 gUnknown_80DB92C[]; -extern u8 gUnknown_80DB934[]; -extern struct UnkTextStruct2 gUnknown_80DB944; -extern struct UnkTextStruct2 gUnknown_80DB95C; -extern u8 gUnknown_80DB994[]; -extern u8 gUnknown_80DB9A0[]; -extern u8 gUnknown_80DB9A8[]; -extern u8 gUnknown_80DB9B0[]; - -extern const u8 *gKecleonShopDialogue[KECLEON_BROS_MODE_COUNT][23]; -extern const u8 gTeamToolboxA[]; -extern const u8 gTeamToolboxB[]; - -// code_8098BDC.s -extern void sub_8099690(u32); - -void sub_8018D30(void); -void sub_80194F8(void); -void sub_80195C0(void); -void sub_8019660(void); -void sub_8019700(void); -void sub_8019730(void); -void sub_8019850(void); -void sub_80198E8(void); -void sub_8019944(void); -void sub_80199CC(void); -void sub_8019B08(void); -void sub_8019BBC(void); -void sub_8019C78(void); -void sub_8019D30(void); -void sub_8019D4C(void); -void sub_8019D68(void); -void sub_8019DAC(void); -void sub_8019E04(bool32); -u32 sub_8019E40(u32); -u32 sub_8019EDC(u8); -u8 sub_8019FB0(void); -void sub_8019FCC(u8); -void sub_801A010(void); -void sub_801A064(void); -void sub_801A0D8(void); -u32 sub_801A20C(u32); -u32 sub_801A2A8(u8); -u8 sub_801A37C(void); -void sub_801A398(u8); -void sub_801A3DC(void); -void sub_801A430(void); -void sub_801A4A4(void); -void sub_801A998(void); -s32 sub_801AE24(u32); - -u32 CountKecleonItems(void); -void SetKecleonBrosState(u32); -void SortInventoryItems(void); -void UpdateKecleonStoreDialogue(void); - -u32 CreateKecleonBros(u32 mode) -{ - char *monName; - struct OpenedFile *faceFile; - - gKecleonBrosWork = MemoryAlloc(sizeof(struct KecleonBrosWork), 8); - gKecleonBrosWork->menuAction1 = 0; - gKecleonBrosWork->menuAction2 = 0; - gKecleonBrosWork->menuAction3 = 0; - gKecleonBrosWork->mode = mode; - - switch (mode) { - case KECLEON_BROS_MODE_ITEMS_AWAKE: - gKecleonBrosWork->isKecleonItemShop = TRUE; - gKecleonBrosWork->unkE4 = &gKecleonBrosWork->faceFile; - CopyYellowMonsterNametoBuffer(gUnknown_202E5D8, MONSTER_KECLEON); - CopyYellowMonsterNametoBuffer(gUnknown_202E1C8, MONSTER_KECLEON); - monName = GetMonSpecies(MONSTER_KECLEON); - strcpy(gUnknown_202E1C8 - 0x50, monName); - break; - case KECLEON_BROS_MODE_ITEMS_ASLEEP: - gKecleonBrosWork->isKecleonItemShop = TRUE; - gKecleonBrosWork->unkE4 = NULL; - CopyYellowMonsterNametoBuffer(gUnknown_202E5D8, MONSTER_KECLEON); - CopyYellowMonsterNametoBuffer(gUnknown_202E1C8, MONSTER_KECLEON); - monName = GetMonSpecies(MONSTER_KECLEON); - strcpy(gUnknown_202E1C8 - 0x50, monName); - break; - case KECLEON_BROS_MODE_WARES_AWAKE: - gKecleonBrosWork->isKecleonItemShop = FALSE; - gKecleonBrosWork->unkE4 = &gKecleonBrosWork->faceFile; - CopyYellowMonsterNametoBuffer(gUnknown_202E5D8, MONSTER_KECLEON); - CopyYellowMonsterNametoBuffer(gUnknown_202E1C8, MONSTER_KECLEON); - monName = GetMonSpecies(MONSTER_KECLEON); - strcpy(gUnknown_202E1C8 - 0x50, monName); - break; - case KECLEON_BROS_MODE_WARES_ASLEEP: - gKecleonBrosWork->isKecleonItemShop = FALSE; - gKecleonBrosWork->unkE4 = NULL; - CopyYellowMonsterNametoBuffer(gUnknown_202E5D8, MONSTER_KECLEON); - CopyYellowMonsterNametoBuffer(gUnknown_202E1C8, MONSTER_KECLEON); - monName = GetMonSpecies(MONSTER_KECLEON); - strcpy(gUnknown_202E1C8 - 0x50, monName); - break; - default: - break; - } - - faceFile = GetDialogueSpriteDataPtr(MONSTER_KECLEON); - gKecleonBrosWork->faceFile = faceFile; - gKecleonBrosWork->faceData = faceFile->data; - gKecleonBrosWork->unkE0 = 0; - gKecleonBrosWork->unkE1 = 0; - gKecleonBrosWork->unkE2 = 0; - gKecleonBrosWork->unkDC = 2; - gKecleonBrosWork->unkDE = 8; - SetKecleonBrosState(KECLEON_STORE_INIT); - return 1; -} - -u32 KecleonBrosCallback(void) -{ - switch (gKecleonBrosWork->currState) { - case KECLEON_STORE_INIT: - case KECLEON_STORE_MAIN_MENU: - sub_8019730(); - break; - case 0x12: - case 0x13: - sub_80199CC(); - break; - case 0x1a: - case 0x1b: - sub_8019B08(); - break; - case 0x14: - sub_8019BBC(); - break; - case 0x1c: - sub_8019C78(); - break; - case 0x16: - sub_8019850(); - break; - case 0x1e: - sub_80198E8(); - break; - case 0x1f: - sub_8019944(); - break; - case 0x15: - sub_8019D30(); - break; - case 0x1d: - sub_8019D4C(); - break; - case KECLEON_STORE_EXIT: - return 3; - default: - sub_8019D68(); - break; - } - return 0; -} - -void DeleteKecleonBros(void) -{ - if (gKecleonBrosWork != NULL) { - CloseFile(gKecleonBrosWork->faceFile); - MemoryFree(gKecleonBrosWork); - gKecleonBrosWork = NULL; - } -} - -void SetKecleonBrosState(u32 newState) -{ - gKecleonBrosWork->currState = newState; - sub_8018D30(); - UpdateKecleonStoreDialogue(); -} - -void sub_8018D30(void) -{ - s32 index; - sub_8006518(gKecleonBrosWork->unkE8); - - switch (gKecleonBrosWork->currState) { - case 0x12: - case 0x13: - gKecleonBrosWork->unkE8[0] = gUnknown_80DB840; - gKecleonBrosWork->unkE8[2] = gUnknown_80DB840; - gKecleonBrosWork->unkE8[0] = gUnknown_80DB870; - gKecleonBrosWork->unkE8[1] = gUnknown_80DB888; - break; - case 0x1A: - case 0x1B: - gKecleonBrosWork->unkE8[0] = gUnknown_80DB840; - gKecleonBrosWork->unkE8[1] = gUnknown_80DB840; - gKecleonBrosWork->unkE8[2] = gUnknown_80DB840; - gKecleonBrosWork->unkE8[1] = gUnknown_80DB888; - break; - case 0x14: - case 0x1C: - gKecleonBrosWork->unkE8[2] = gUnknown_80DB858; - break; - default: - case 0x15: - case 0x16: - case 0x17: - case 0x18: - case 0x19: - for(index = 0; index < 4; index++) - gKecleonBrosWork->unkE8[index] = gUnknown_80DB840; - break; - } - - ResetUnusedInputStruct(); - sub_800641C(gKecleonBrosWork->unkE8, 1, 1); -} - -void UpdateKecleonStoreDialogue(void) -{ - switch (gKecleonBrosWork->currState) { - case 0: - sub_8019DAC(); - sub_80194F8(); - sub_8019E04(FALSE); - sub_8014248(gKecleonShopDialogue[gKecleonBrosWork->mode][0], 0, gKecleonBrosWork->menuAction1, - gKecleonBrosWork->menuItems, gKecleonBrosWork->unk74, 4, 0, gKecleonBrosWork->unkE4, 12); - break; - case 1: - sub_8019DAC(); - sub_80194F8(); - sub_8019E04(FALSE); - sub_8014248(gKecleonShopDialogue[gKecleonBrosWork->mode][1], 0, gKecleonBrosWork->menuAction1, - gKecleonBrosWork->menuItems, gKecleonBrosWork->unk74, 4, 0, gKecleonBrosWork->unkE4, 12); - break; - case 2: - gKecleonBrosWork->fallbackState = 1; - sub_8019E04(FALSE); - sub_80141B4(gKecleonShopDialogue[gKecleonBrosWork->mode][22], 0, gKecleonBrosWork->unkE4, 0x10D); - break; - case 3: - gKecleonBrosWork->fallbackState = 4; - sub_8019E04(FALSE); - sub_80141B4(gKecleonShopDialogue[gKecleonBrosWork->mode][2], 0, gKecleonBrosWork->unkE4, 0x30D); - break; - case 5: - gKecleonBrosWork->fallbackState = 1; - sub_8019E04(FALSE); - sub_80141B4(gKecleonShopDialogue[gKecleonBrosWork->mode][12], 0, gKecleonBrosWork->unkE4, 0x10D); - break; - case 6: - gKecleonBrosWork->fallbackState = 16; - sub_8019E04(TRUE); - sub_80141B4(gKecleonShopDialogue[gKecleonBrosWork->mode][13], 0, gKecleonBrosWork->unkE4, 0x10D); - break; - case 7: - gKecleonBrosWork->fallbackState = 1; - sub_8019E04(TRUE); - sub_80141B4(gKecleonShopDialogue[gKecleonBrosWork->mode][14], 0, gKecleonBrosWork->unkE4, 0x10D); - break; - case 8: - gKecleonBrosWork->fallbackState = 1; - sub_8019E04(TRUE); - sub_80141B4(gKecleonShopDialogue[gKecleonBrosWork->mode][15], 0, gKecleonBrosWork->unkE4, 0x10D); - break; - case 9: - gKecleonBrosWork->fallbackState = 1; - sub_8019E04(TRUE); - sub_80141B4(gKecleonShopDialogue[gKecleonBrosWork->mode][16], 0, gKecleonBrosWork->unkE4, 0x10D); - break; - case 10: - gKecleonBrosWork->fallbackState = 1; - sub_8019E04(TRUE); - sub_80141B4(gKecleonShopDialogue[gKecleonBrosWork->mode][17], 0, gKecleonBrosWork->unkE4, 0x10D); - break; - case 11: - gKecleonBrosWork->fallbackState = 1; - sub_8019E04(FALSE); - sub_80141B4(gKecleonShopDialogue[gKecleonBrosWork->mode][18], 0, gKecleonBrosWork->unkE4, 0x10D); - break; - case 12: - gKecleonBrosWork->fallbackState = 16; - sub_8019E04(TRUE); - sub_80141B4(gKecleonShopDialogue[gKecleonBrosWork->mode][19], 0, gKecleonBrosWork->unkE4, 0x10D); - break; - case 13: - sub_8090E14(gUnknown_202DE58, &gKecleonBrosWork->soldItem, NULL); - gKecleonBrosWork->fallbackState = 24; - sub_8019E04(TRUE); - sub_80141B4(gKecleonShopDialogue[gKecleonBrosWork->mode][20], 0, gKecleonBrosWork->unkE4, 0x10D); - break; - case 14: - gKecleonBrosWork->fallbackState = 24; - sub_8019E04(TRUE); - sub_80141B4(gKecleonShopDialogue[gKecleonBrosWork->mode][21], 0, gKecleonBrosWork->unkE4, 0x10D); - break; - case 15: - gKecleonBrosWork->fallbackState = 18; - sub_8019E04(FALSE); - sub_80141B4(gKecleonShopDialogue[gKecleonBrosWork->mode][3], 0, gKecleonBrosWork->unkE4, 0x10D); - break; - case 16: - gKecleonBrosWork->fallbackState = 19; - sub_8019E04(FALSE); - sub_80141B4(gKecleonShopDialogue[gKecleonBrosWork->mode][4], 0, gKecleonBrosWork->unkE4, 0x10D); - break; - case 18: - if (gKecleonBrosWork->isKecleonItemShop != FALSE) - sub_8019E40(3); - else - sub_801A20C(3); - - sub_801AD34(0); - DrawTeamMoneyBox(1); - break; - case 19: - if (gKecleonBrosWork->isKecleonItemShop != FALSE) - sub_8019FCC(1); - else - sub_801A398(1); - - sub_801AD34(0); - DrawTeamMoneyBox(1); - break; - case 20: - if (gKecleonBrosWork->isKecleonItemShop != FALSE) - sub_801A0D8(); - else - sub_801A4A4(); - - sub_801AD34(0); - DrawTeamMoneyBox(1); - sub_80195C0(); - sub_8012D60(&gKecleonBrosWork->menu, gKecleonBrosWork->menuItems, 0, gKecleonBrosWork->unk74, gKecleonBrosWork->menuAction3, 2); - break; - case 22: - sub_8019700(); - sub_8090E14(gUnknown_202DE58, &gKecleonBrosWork->soldItem, 0); - gUnknown_202DE30 = gKecleonBrosWork->itemSellPrice; - sub_8019E04(FALSE); - sub_8014248(gKecleonShopDialogue[gKecleonBrosWork->mode][5], 0, 5,gKecleonBrosWork->menuItems, NULL, 4, 0, gKecleonBrosWork->unkE4, 12); - break; - case 17: - if (CountKecleonItems() == 0) { - if (gKecleonBrosWork->isKecleonItemShop != FALSE) - sub_801A010(); - else - sub_801A3DC(); - gKecleonBrosWork->fallbackState = 11; - } - else { - if (GetNumberOfFilledInventorySlots() >= INVENTORY_SIZE) { - if (gKecleonBrosWork->isKecleonItemShop != FALSE) - sub_801A010(); - else - sub_801A3DC(); - gKecleonBrosWork->fallbackState = 1; - } - else - gKecleonBrosWork->fallbackState = 16; - } - sub_8019E04(FALSE); - sub_80141B4(gKecleonShopDialogue[gKecleonBrosWork->mode][6], 0, gKecleonBrosWork->unkE4, 0x10D); - break; - case 23: - gKecleonBrosWork->fallbackState = 26; - sub_8019E04(FALSE); - sub_80141B4(gKecleonShopDialogue[gKecleonBrosWork->mode][7], 0, gKecleonBrosWork->unkE4, 0x10D); - break; - case 24: - gKecleonBrosWork->fallbackState = 27; - sub_8019E04(FALSE); - sub_80141B4(gKecleonShopDialogue[gKecleonBrosWork->mode][8], 0, gKecleonBrosWork->unkE4, 0x10D); - break; - case 26: - sub_801A5D8(4, 3, NULL, 10); - DrawTeamMoneyBox(1); - break; - case 27: - sub_801A8D0(1); - DrawTeamMoneyBox(1); - break; - case 28: - sub_801A9E0(); - DrawTeamMoneyBox(1); - sub_8019660(); - sub_8012D60(&gKecleonBrosWork->menu, gKecleonBrosWork->menuItems, 0, gKecleonBrosWork->unk74, gKecleonBrosWork->menuAction2, 2); - break; - case 30: - sub_8019700(); - sub_8090E14(gUnknown_202DE58, &gKecleonBrosWork->soldItem, NULL); - gUnknown_202DE30 = gKecleonBrosWork->itemSellPrice; - sub_8019E04(FALSE); - sub_8014248(gKecleonShopDialogue[gKecleonBrosWork->mode][9], 0, 5, gKecleonBrosWork->menuItems, NULL, 4, 0, gKecleonBrosWork->unkE4, 12); - break; - case 21: - case 29: - sub_801B3C0(&gKecleonBrosWork->soldItem); - break; - case 25: - if (GetNumberOfFilledInventorySlots() == 0 || gTeamInventoryRef->teamMoney >= MAX_TEAM_MONEY) { - sub_801A928(); - gKecleonBrosWork->fallbackState = 1; - } - else - gKecleonBrosWork->fallbackState = 24; - - sub_8019E04(FALSE); - sub_80141B4(gKecleonShopDialogue[gKecleonBrosWork->mode][11], 0, gKecleonBrosWork->unkE4, 0x10D); - break; - case 31: - sub_8019700(); - gUnknown_202DE30 = gKecleonBrosWork->inventoryItemSellPrice; - sub_8019E04(FALSE); - sub_8014248(gKecleonShopDialogue[gKecleonBrosWork->mode][10], 0, 5, gKecleonBrosWork->menuItems, NULL, 4, 0, gKecleonBrosWork->unkE4, 12); - break; - case 32: - gKecleonBrosWork->fallbackState = 1; - sub_8019E04(FALSE); - sub_80141B4(gKecleonShopDialogue[gKecleonBrosWork->mode][11], 0, gKecleonBrosWork->unkE4, 0x10D); - break; - } -} - -void sub_80194F8(void) -{ - s32 index; - s32 loopMax; - - MemoryFill16(gKecleonBrosWork->unk74, 0, sizeof(gKecleonBrosWork->unk74)); - - loopMax = 0; - gKecleonBrosWork->menuItems[loopMax].text = *gUnknown_80D4978; - gKecleonBrosWork->menuItems[loopMax].menuAction = 2; - - loopMax += 1; - gKecleonBrosWork->menuItems[loopMax].text = *gUnknown_80D4984; - gKecleonBrosWork->menuItems[loopMax].menuAction = 3; - - loopMax += 1; - gKecleonBrosWork->menuItems[loopMax].text = gUnknown_80DB8A0; - gKecleonBrosWork->menuItems[loopMax].menuAction = 4; - - loopMax += 1; - gKecleonBrosWork->menuItems[loopMax].text = *gUnknown_80D4970; - gKecleonBrosWork->menuItems[loopMax].menuAction = 7; - - loopMax += 1; - gKecleonBrosWork->menuItems[loopMax].text = *gUnknown_80D4934; - gKecleonBrosWork->menuItems[loopMax].menuAction = 1; - - loopMax += 1; - gKecleonBrosWork->menuItems[loopMax].text = NULL; - gKecleonBrosWork->menuItems[loopMax].menuAction = 1; - - for (index = 0; index < loopMax; index++) { - if (gKecleonBrosWork->unk74[index] == 0) { - if (gKecleonBrosWork->menuItems[index].menuAction == gKecleonBrosWork->menuAction1) - return; - } - } - - for (index = 0; index < loopMax; index++) { - if (gKecleonBrosWork->unk74[index] == 0) { - gKecleonBrosWork->menuAction1 = gKecleonBrosWork->menuItems[index].menuAction; - break; - } - } -} - -void sub_80195C0(void) -{ - s32 index; - s32 loopMax; - - MemoryFill16(gKecleonBrosWork->unk74, 0, sizeof(gKecleonBrosWork->unk74)); - - loopMax = 0; - gKecleonBrosWork->menuItems[loopMax].text = *gUnknown_80D4978; - gKecleonBrosWork->menuItems[loopMax].menuAction = 2; - - loopMax += 1; - gKecleonBrosWork->menuItems[loopMax].text = *gUnknown_80D4970; - gKecleonBrosWork->menuItems[loopMax].menuAction = 7; - - loopMax += 1; - gKecleonBrosWork->menuItems[loopMax].text = NULL; - gKecleonBrosWork->menuItems[loopMax].menuAction = 1; - - for (index = 0; index < loopMax; index++) { - if (gKecleonBrosWork->unk74[index] == 0) { - if (gKecleonBrosWork->menuItems[index].menuAction == gKecleonBrosWork->menuAction3) - return; - } - } - - for (index = 0; index < loopMax; index++) { - if (gKecleonBrosWork->unk74[index] == 0) { - gKecleonBrosWork->menuAction3 = gKecleonBrosWork->menuItems[index].menuAction; - break; - } - } -} - -void sub_8019660(void) -{ - s32 index; - s32 loopMax; - - MemoryFill16(gKecleonBrosWork->unk74, 0, sizeof(gKecleonBrosWork->unk74)); - - loopMax = 0; - gKecleonBrosWork->menuItems[loopMax].text = *gUnknown_80D4984; - gKecleonBrosWork->menuItems[loopMax].menuAction = 3; - - loopMax += 1; - gKecleonBrosWork->menuItems[loopMax].text = *gUnknown_80D4970; - gKecleonBrosWork->menuItems[loopMax].menuAction = 7; - - loopMax += 1; - gKecleonBrosWork->menuItems[loopMax].text = NULL; - gKecleonBrosWork->menuItems[loopMax].menuAction = 1; - - for (index = 0; index < loopMax; index++) { - if (gKecleonBrosWork->unk74[index] == 0) { - if (gKecleonBrosWork->menuItems[index].menuAction == gKecleonBrosWork->menuAction2) - return; - } - } - - for (index = 0; index < loopMax; index++) { - if (gKecleonBrosWork->unk74[index] == 0) { - gKecleonBrosWork->menuAction2 = gKecleonBrosWork->menuItems[index].menuAction; - break; - } - } -} - -void sub_8019700(void) -{ - s32 loopMax = 0; - gKecleonBrosWork->menuItems[loopMax].text = *gUnknown_80D4920; - gKecleonBrosWork->menuItems[loopMax].menuAction = 5; - - loopMax += 1; - gKecleonBrosWork->menuItems[loopMax].text = *gUnknown_80D4928; - gKecleonBrosWork->menuItems[loopMax].menuAction = 6; - - loopMax += 1; - gKecleonBrosWork->menuItems[loopMax].text = NULL; - gKecleonBrosWork->menuItems[loopMax].menuAction = 1; -} - -void sub_8019730(void) -{ - s32 menuAction; - - if (sub_80144A4(&menuAction) != 0) - return; - - if (menuAction != 1) - gKecleonBrosWork->menuAction1 = menuAction; - - switch (menuAction) { - case 2: - if (CountKecleonItems() == 0) - SetKecleonBrosState(KECLEON_STORE_NO_STORE_ITEMS); - else if (GetNumberOfFilledInventorySlots() >= INVENTORY_SIZE) - SetKecleonBrosState(KECLEON_STORE_TOO_MANY_ITEMS); - else - SetKecleonBrosState(15); - break; - case 3: - if (GetNumberOfFilledInventorySlots() == 0) - SetKecleonBrosState(KECLEON_STORE_NO_ITEMS_TO_SELL); - else if (gKecleonBrosWork->numInventoryItemToSell == 0) - SetKecleonBrosState(8); - else if (gTeamInventoryRef->teamMoney < MAX_TEAM_MONEY) - SetKecleonBrosState(23); - else - SetKecleonBrosState(7); - break; - case 4: - if (GetNumberOfFilledInventorySlots() == 0) - SetKecleonBrosState(KECLEON_STORE_NO_ITEMS_TO_SELL); - else if (gKecleonBrosWork->numInventoryItemToSell == 0) - SetKecleonBrosState(8); - else if (gKecleonBrosWork->inventoryItemSellPrice + gTeamInventoryRef->teamMoney > MAX_TEAM_MONEY) - SetKecleonBrosState(7); - else - SetKecleonBrosState(31); - break; - case 7: - SetKecleonBrosState(2); - break; - case 1: - SetKecleonBrosState(3); - break; - } -} - -void sub_8019850(void) -{ - s32 menuAction; - - if (sub_80144A4(&menuAction) == 0) { - switch (menuAction) { - case 5: - AddToTeamMoney(-gKecleonBrosWork->itemSellPrice); - - if (gKecleonBrosWork->isKecleonItemShop) { - AddHeldItemToInventory(GetKecleonShopItem(gKecleonBrosWork->itemShopItemIndex)); - InitKecleonShopItem(gKecleonBrosWork->itemShopItemIndex); - FillKecleonShopGaps(); - } - else { - AddHeldItemToInventory(GetKecleonWareItem(gKecleonBrosWork->wareShopItemIndex)); - InitKecleonWareItem(gKecleonBrosWork->wareShopItemIndex); - FillKecleonWareGaps(); - } - - PlaySound(0x14c); - SetKecleonBrosState(17); - break; - case 6: - case 1: - SetKecleonBrosState(16); - break; - } - } -} - -void sub_80198E8(void) -{ - s32 menuAction; - - if (sub_80144A4(&menuAction) == 0) { - switch (menuAction) { - case 5: - AddToTeamMoney(gKecleonBrosWork->itemSellPrice); - ShiftItemsDownFrom(gKecleonBrosWork->soldItemInventoryIndex); - PlaySound(0x14c); - SetKecleonBrosState(25); - break; - case 6: - case 1: - SetKecleonBrosState(24); - break; - } - } -} - -void sub_8019944(void) -{ - s32 slotIndex; - s32 menuAction; - struct Item *item; - - if (sub_80144A4(&menuAction) == 0) { - switch (menuAction) { - case 5: - for (slotIndex = 0; slotIndex < INVENTORY_SIZE; slotIndex++) { - item = &gTeamInventoryRef->teamItems[slotIndex]; - - if ((item->flags & ITEM_FLAG_EXISTS) && CanSellItem(item->id)) - ClearItemSlotAt(slotIndex); - } - - FillInventoryGaps(); - AddToTeamMoney(gKecleonBrosWork->inventoryItemSellPrice); - PlaySound(0x14c); - SetKecleonBrosState(32); - break; - case 1: - case 6: - SetKecleonBrosState(KECLEON_STORE_MAIN_MENU); - break; - } - } -} - -void sub_80199CC(void) -{ - u32 menuAction; - struct BulkItem *item; - - if (gKecleonBrosWork->isKecleonItemShop) - menuAction = sub_8019EDC(1); - else - menuAction = sub_801A2A8(1); - - switch (menuAction) { - case 3: - if (gKecleonBrosWork->isKecleonItemShop) { - gKecleonBrosWork->itemShopItemIndex = sub_8019FB0(); - item = GetKecleonShopItem(gKecleonBrosWork->itemShopItemIndex); - } - else { - gKecleonBrosWork->wareShopItemIndex = sub_801A37C(); - item = GetKecleonWareItem(gKecleonBrosWork->wareShopItemIndex); - } - - xxx_init_itemslot_8090A8C(&gKecleonBrosWork->soldItem, item->id, 0); - gKecleonBrosWork->soldItem.quantity = item->quantity; - gKecleonBrosWork->itemSellPrice = GetStackBuyPrice(&gKecleonBrosWork->soldItem); - SetKecleonBrosState(20); - break; - case 4: - if (gKecleonBrosWork->isKecleonItemShop) { - gKecleonBrosWork->itemShopItemIndex = sub_8019FB0(); - item = GetKecleonShopItem(gKecleonBrosWork->itemShopItemIndex); - } - else { - gKecleonBrosWork->wareShopItemIndex = sub_801A37C(); - item = GetKecleonWareItem(gKecleonBrosWork->wareShopItemIndex); - } - - xxx_init_itemslot_8090A8C(&gKecleonBrosWork->soldItem, item->id, 0); - gKecleonBrosWork->soldItem.quantity = item->quantity; - gKecleonBrosWork->itemSellPrice = GetStackBuyPrice(&gKecleonBrosWork->soldItem); - SetKecleonBrosState(21); - break; - case 2: - if (gKecleonBrosWork->isKecleonItemShop) - sub_801A010(); - else - sub_801A3DC(); - - SetKecleonBrosState(KECLEON_STORE_MAIN_MENU); - break; - case 1: - sub_801AD34(0); - DrawTeamMoneyBox(1); - break; - } -} - -void sub_8019B08(void) -{ - switch (sub_801A6E8(TRUE)) { - case 0: - break; - case 3: - gKecleonBrosWork->soldItemInventoryIndex = sub_801A8AC(); - gKecleonBrosWork->soldItem = gTeamInventoryRef->teamItems[gKecleonBrosWork->soldItemInventoryIndex]; - gKecleonBrosWork->itemSellPrice = GetStackSellPrice(&gKecleonBrosWork->soldItem); - SetKecleonBrosState(28); - break; - case 4: - gKecleonBrosWork->soldItemInventoryIndex = sub_801A8AC(); - gKecleonBrosWork->soldItem = gTeamInventoryRef->teamItems[gKecleonBrosWork->soldItemInventoryIndex]; - gKecleonBrosWork->itemSellPrice = GetStackSellPrice(&gKecleonBrosWork->soldItem); - sub_8099690(0); - SetKecleonBrosState(29); - break; - case 2: - sub_801A928(); - SetKecleonBrosState(KECLEON_STORE_MAIN_MENU); - break; - case 1: - default: - DrawTeamMoneyBox(1); - break; - } -} - -void sub_8019BBC(void) -{ - s32 menuAction; - - menuAction = 0; - - if (gKecleonBrosWork->isKecleonItemShop) - sub_8019EDC(0); - else - sub_801A2A8(0); - - if (sub_8012FD8(&gKecleonBrosWork->menu) == 0 && (sub_8013114(&gKecleonBrosWork->menu, &menuAction), menuAction != 1)) - gKecleonBrosWork->menuAction3 = menuAction; - - switch (menuAction) { - case 2: - if (gTeamInventoryRef->teamMoney == 0) - SetKecleonBrosState(KECLEON_STORE_NO_MONEY); - else if (gKecleonBrosWork->itemSellPrice > gTeamInventoryRef->teamMoney) - SetKecleonBrosState(KECLEON_STORE_NOT_ENOUGH_MONEY); - else - SetKecleonBrosState(22); - break; - case 7: - SetKecleonBrosState(21); - break; - case 1: - SetKecleonBrosState(19); - break; - } -} - -void sub_8019C78(void) -{ - s32 menuAction; - - menuAction = 0; - sub_801A6E8(FALSE); - - if (sub_8012FD8(&gKecleonBrosWork->menu) == FALSE && (sub_8013114(&gKecleonBrosWork->menu, &menuAction), menuAction != 1)) - gKecleonBrosWork->menuAction2 = menuAction; - - switch (menuAction) { - case 3: - sub_8099690(0); - - if (!CanSellItem(gKecleonBrosWork->soldItem.id)) - SetKecleonBrosState(KECLEON_STORE_CANT_SELL_ITEM); - else if (gKecleonBrosWork->itemSellPrice + gTeamInventoryRef->teamMoney > MAX_TEAM_MONEY) - SetKecleonBrosState(14); - else - SetKecleonBrosState(30); - break; - case 7: - sub_8099690(0); - SetKecleonBrosState(29); - break; - case 1: - SetKecleonBrosState(27); - break; - } -} - -void sub_8019D30(void) -{ - switch (sub_801B410()) { - case 2: - case 3: - sub_801B450(); - SetKecleonBrosState(19); - break; - case 0: - case 1: - break; - } -} - -void sub_8019D4C(void) -{ - switch (sub_801B410()) { - case 2: - case 3: - sub_801B450(); - SetKecleonBrosState(27); - break; - case 0: - case 1: - break; - } -} - - -void sub_8019D68(void) -{ - s32 temp; - if (sub_80144A4(&temp) == 0) - SetKecleonBrosState(gKecleonBrosWork->fallbackState); -} - -u32 CountKecleonItems(void) -{ - if (gKecleonBrosWork->isKecleonItemShop) - return CountKecleonShopItems(); - else - return CountKecleonWareItems(); -} - -void sub_8019DAC(void) -{ - s32 sellPrice; - struct Item *item; - s32 index; - - gKecleonBrosWork->numInventoryItemToSell = 0; - gKecleonBrosWork->inventoryItemSellPrice = 0; - for (index = 0; index < INVENTORY_SIZE; index++) { - item = &gTeamInventoryRef->teamItems[index]; - - if ((item->flags & ITEM_FLAG_EXISTS) != 0 && CanSellItem(item->id)) { - sellPrice = GetStackSellPrice(item); - gKecleonBrosWork->inventoryItemSellPrice += sellPrice; - gKecleonBrosWork->numInventoryItemToSell++; - } - } -} - -void sub_8019E04(bool32 param_1) -{ - if (gKecleonBrosWork->isKecleonItemShop) { - if (param_1 == TRUE) - gKecleonBrosWork->unkE0 = 1; - else - gKecleonBrosWork->unkE0 = 0; - } - else { - if (param_1 == TRUE) - gKecleonBrosWork->unkE0 = 7; - else - gKecleonBrosWork->unkE0 = 6; - } -} - -bool32 sub_8019E40(u32 r0) -{ - if (CountKecleonShopItems() == 0) - return FALSE; - - gUnknown_203B214 = MemoryAlloc(sizeof(struct unkStruct_203B214), 8); - gUnknown_203B214->unk34 = r0; - gUnknown_203B214->unk38 = &gUnknown_203B214->unk3C[gUnknown_203B214->unk34]; - sub_8006518(gUnknown_203B214->unk3C); - gUnknown_203B214->unk3C[gUnknown_203B214->unk34] = gUnknown_80DB8CC; - gUnknown_203B214->unk38->unk14 = gUnknown_203B214->unk9C; - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B214->unk3C, 1, 1); - sub_8013818(&gUnknown_203B214->input, CountKecleonShopItems(), 10, r0); - gUnknown_203B214->input.menuIndex = gUnknown_203B218; - sub_8013984(&gUnknown_203B214->input); - sub_801A064(); - sub_801A0D8(); - return TRUE; -} - -u32 sub_8019EDC(u8 r0) -{ - struct Item slot; - struct BulkItem *item; - - if (r0 == 0) { - sub_8013660(&gUnknown_203B214->input); - return 0; - } - - switch (GetKeyPress(&gUnknown_203B214->input)) { - case INPUT_B_BUTTON: - PlayMenuSoundEffect(1); - return 2; - case INPUT_A_BUTTON: - item = GetKecleonShopItem(sub_8019FB0()); - slot.id = item->id; - slot.quantity = item->quantity; - - if (GetStackBuyPrice(&slot) > gTeamInventoryRef->teamMoney) - PlayMenuSoundEffect(2); - else - PlayMenuSoundEffect(0); - return 3; - case INPUT_START_BUTTON: - PlayMenuSoundEffect(4); - return 4; - default: - if (sub_80138B8(&gUnknown_203B214->input, 1) != FALSE) { - sub_801A064(); - sub_801A0D8(); - return 1; - } - return 0; - } -} - -u8 sub_8019FB0(void) -{ - return (gUnknown_203B214->input.unk1E * gUnknown_203B214->input.unk1C) + (u8)gUnknown_203B214->input.menuIndex; -} - -void sub_8019FCC(u8 r0) -{ - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B214->unk3C, 0, 0); - gUnknown_203B214->input.unk22 = CountKecleonShopItems(); - sub_8013984(&gUnknown_203B214->input); - sub_801A064(); - sub_801A0D8(); - if (r0) - AddMenuCursorSprite(&gUnknown_203B214->input); -} - -void sub_801A010(void) -{ - if (gUnknown_203B214 != NULL) { - gUnknown_203B218 = gUnknown_203B214->input.menuIndex; - gUnknown_203B214->unk3C[gUnknown_203B214->unk34] = gUnknown_80DB8B4; - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B214->unk3C, 1, 1); - MemoryFree(gUnknown_203B214); - gUnknown_203B214 = NULL; - } -} - -#if NONMATCHING // https://decomp.me/scratch/VjeuO -void sub_801A064(void) -{ - s16 val; - - gUnknown_203B214->unk9C[0] = gUnknown_203B214->input.unk20; - gUnknown_203B214->unk9C[1] = gUnknown_203B214->input.unk1E; - gUnknown_203B214->unk9C[2] = 10; - gUnknown_203B214->unk9C[3] = 0; - - val = sub_80095E4(gUnknown_203B214->input.unk1A, 12) + 2; - gUnknown_203B214->unk3C[gUnknown_203B214->unk34].unkE = val; - gUnknown_203B214->unk3C[gUnknown_203B214->unk34].unk10 = val + 2; - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B214->unk3C, 1, 1); -} -#else -NAKED -void sub_801A064(void) -{ - asm_unified( - "\tpush {r4,lr}\n" - "\tldr r4, _0801A0D4\n" - "\tldr r0, [r4]\n" - "\tldrh r1, [r0, 0x20]\n" - "\tadds r0, 0x9C\n" - "\tmovs r2, 0\n" - "\tstrb r1, [r0]\n" - "\tldr r0, [r4]\n" - "\tldrh r1, [r0, 0x1E]\n" - "\tadds r0, 0x9D\n" - "\tstrb r1, [r0]\n" - "\tldr r0, [r4]\n" - "\tadds r0, 0x9E\n" - "\tmovs r1, 0xA\n" - "\tstrb r1, [r0]\n" - "\tldr r0, [r4]\n" - "\tadds r0, 0x9F\n" - "\tstrb r2, [r0]\n" - "\tldr r0, [r4]\n" - "\tmovs r1, 0x1A\n" - "\tldrsh r0, [r0, r1]\n" - "\tmovs r1, 0xC\n" - "\tbl sub_80095E4\n" - "\tadds r0, 0x2\n" - "\tlsls r0, 16\n" - "\tldr r2, [r4]\n" - "\tldr r3, [r2, 0x34]\n" - "\tlsls r1, r3, 1\n" - "\tadds r1, r3\n" - "\tlsls r1, 3\n" - "\tadds r1, r2, r1\n" - "\tadds r1, 0x4A\n" - "\tasrs r3, r0, 16\n" - "\tlsrs r0, 16\n" - "\tstrh r0, [r1]\n" - "\tldr r1, [r2, 0x34]\n" - "\tlsls r0, r1, 1\n" - "\tadds r0, r1\n" - "\tlsls r0, 3\n" - "\tadds r2, r0\n" - "\tadds r3, 0x2\n" - "\tadds r2, 0x4C\n" - "\tstrh r3, [r2]\n" - "\tbl ResetUnusedInputStruct\n" - "\tldr r0, [r4]\n" - "\tadds r0, 0x3C\n" - "\tmovs r1, 0x1\n" - "\tmovs r2, 0x1\n" - "\tbl sub_800641C\n" - "\tpop {r4}\n" - "\tpop {r0}\n" - "\tbx r0\n" - "\t.align 2, 0\n" - "_0801A0D4: .4byte gUnknown_203B214"); -} -#endif // NONMATCHING - -void sub_801A0D8(void) -{ - struct BulkItem *heldItem; - s32 buyPrice; - s32 y; - s32 index; - u8 auStack204 [80]; - struct unkStruct_8090F58 local_7c; - u8 auStack112 [80]; - struct Item item; - u8 temp_calc; - - sub_8008C54(gUnknown_203B214->unk34); - sub_80073B8(gUnknown_203B214->unk34); - xxx_call_draw_string((gUnknown_203B214->input.unk1E * 8) + 10, 0, gUnknown_80DB8E4, gUnknown_203B214->unk34, 0); - - for (index = 0; index < gUnknown_203B214->input.unk1A; index++) { - temp_calc = (gUnknown_203B214->input.unk1E * gUnknown_203B214->input.unk1C) + index; - heldItem = GetKecleonShopItem(temp_calc); - item.id = heldItem->id; - item.quantity = heldItem->quantity; - item.flags = (ITEM_FLAG_EXISTS | ITEM_FLAG_IN_SHOP); - local_7c.unk0 = 1; - local_7c.unk4 = 0; - local_7c.unk6 = 88; - local_7c.unk8 = 1; - sub_8090E14(auStack204, &item, &local_7c); - buyPrice = GetStackBuyPrice(&item); - - if (buyPrice <= gTeamInventoryRef->teamMoney) { - y = sub_8013800(&gUnknown_203B214->input, index); - xxx_call_draw_string(8, y, auStack204, gUnknown_203B214->unk34, 0); - } - else { - sprintfStatic(auStack112, gUnknown_80DB8EC, auStack204); - y = sub_8013800(&gUnknown_203B214->input, index); - xxx_call_draw_string(8, y, auStack112, gUnknown_203B214->unk34, 0); - } - } - - sub_80073E0(gUnknown_203B214->unk34); -} - -u32 sub_801A20C(u32 r0) -{ - if (CountKecleonWareItems() == 0) - return 0; - - gUnknown_203B21C = MemoryAlloc(sizeof(struct unkStruct_203B214), 8); - gUnknown_203B21C->unk34 = r0; - gUnknown_203B21C->unk38 = &gUnknown_203B21C->unk3C[gUnknown_203B21C->unk34]; - sub_8006518(gUnknown_203B21C->unk3C); - gUnknown_203B21C->unk3C[gUnknown_203B21C->unk34] = gUnknown_80DB914; - gUnknown_203B21C->unk38->unk14 = gUnknown_203B21C->unk9C; - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B21C->unk3C, 1, 1); - sub_8013818(&gUnknown_203B21C->input, CountKecleonWareItems(), 10, r0); - gUnknown_203B21C->input.menuIndex = gUnknown_203B220; - sub_8013984(&gUnknown_203B21C->input); - sub_801A430(); - sub_801A4A4(); - return 1; -} - -u32 sub_801A2A8(u8 r0) -{ - struct Item slot; - struct BulkItem *item; - - if (r0 == 0) { - sub_8013660(&gUnknown_203B21C->input); - return 0; - } - - switch (GetKeyPress(&gUnknown_203B21C->input)) { - case INPUT_B_BUTTON: - PlayMenuSoundEffect(1); - return 2; - case INPUT_A_BUTTON: - item = GetKecleonWareItem(sub_801A37C()); - - slot.id = item->id; - slot.quantity = item->quantity; - - if (GetStackBuyPrice(&slot) > gTeamInventoryRef->teamMoney) - PlayMenuSoundEffect(2); - else - PlayMenuSoundEffect(0); - return 3; - case INPUT_START_BUTTON: - PlayMenuSoundEffect(4); - return 4; - default: - if (sub_80138B8(&gUnknown_203B21C->input, 1) != 0) { - sub_801A430(); - sub_801A4A4(); - return 1; - } - return 0; - } -} - -u8 sub_801A37C(void) -{ - return (gUnknown_203B21C->input.unk1E * gUnknown_203B21C->input.unk1C) + gUnknown_203B21C->input.menuIndex; -} - -void sub_801A398(u8 r0) -{ - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B21C->unk3C, 0, 0); - gUnknown_203B21C->input.unk22 = CountKecleonWareItems(); - sub_8013984(&gUnknown_203B21C->input); - sub_801A430(); - sub_801A4A4(); - if (r0) - AddMenuCursorSprite(&gUnknown_203B21C->input); -} - -void sub_801A3DC(void) -{ - if (gUnknown_203B21C != NULL) { - gUnknown_203B220 = gUnknown_203B21C->input.menuIndex; - gUnknown_203B21C->unk3C[gUnknown_203B21C->unk34] = gUnknown_80DB8FC; - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B21C->unk3C, 1, 1); - MemoryFree(gUnknown_203B21C); - gUnknown_203B21C = NULL; - } -} - -#if NONMATCHING // https://decomp.me/scratch/L78xC -void sub_801A430(void) -{ - s16 val; - - gUnknown_203B21C->unk9C[0] = gUnknown_203B21C->input.unk20; - gUnknown_203B21C->unk9C[1] = gUnknown_203B21C->input.unk1E; - gUnknown_203B21C->unk9C[2] = 10; - gUnknown_203B21C->unk9C[3] = 0; - - val = sub_80095E4(gUnknown_203B21C->input.unk1A, 12) + 2; - gUnknown_203B21C->unk3C[gUnknown_203B21C->unk34].unkE = val; - gUnknown_203B21C->unk3C[gUnknown_203B21C->unk34].unk10 = val + 2; - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B21C->unk3C, 1, 1); -} -#else -NAKED -void sub_801A430(void) -{ - asm_unified("\tpush {r4,lr}\n" - "\tldr r4, _0801A4A0\n" - "\tldr r0, [r4]\n" - "\tldrh r1, [r0, 0x20]\n" - "\tadds r0, 0x9C\n" - "\tmovs r2, 0\n" - "\tstrb r1, [r0]\n" - "\tldr r0, [r4]\n" - "\tldrh r1, [r0, 0x1E]\n" - "\tadds r0, 0x9D\n" - "\tstrb r1, [r0]\n" - "\tldr r0, [r4]\n" - "\tadds r0, 0x9E\n" - "\tmovs r1, 0xA\n" - "\tstrb r1, [r0]\n" - "\tldr r0, [r4]\n" - "\tadds r0, 0x9F\n" - "\tstrb r2, [r0]\n" - "\tldr r0, [r4]\n" - "\tmovs r1, 0x1A\n" - "\tldrsh r0, [r0, r1]\n" - "\tmovs r1, 0xC\n" - "\tbl sub_80095E4\n" - "\tadds r0, 0x2\n" - "\tlsls r0, 16\n" - "\tldr r2, [r4]\n" - "\tldr r3, [r2, 0x34]\n" - "\tlsls r1, r3, 1\n" - "\tadds r1, r3\n" - "\tlsls r1, 3\n" - "\tadds r1, r2, r1\n" - "\tadds r1, 0x4A\n" - "\tasrs r3, r0, 16\n" - "\tlsrs r0, 16\n" - "\tstrh r0, [r1]\n" - "\tldr r1, [r2, 0x34]\n" - "\tlsls r0, r1, 1\n" - "\tadds r0, r1\n" - "\tlsls r0, 3\n" - "\tadds r2, r0\n" - "\tadds r3, 0x2\n" - "\tadds r2, 0x4C\n" - "\tstrh r3, [r2]\n" - "\tbl ResetUnusedInputStruct\n" - "\tldr r0, [r4]\n" - "\tadds r0, 0x3C\n" - "\tmovs r1, 0x1\n" - "\tmovs r2, 0x1\n" - "\tbl sub_800641C\n" - "\tpop {r4}\n" - "\tpop {r0}\n" - "\tbx r0\n" - "\t.align 2, 0\n" -"_0801A4A0: .4byte gUnknown_203B21C"); -} -#endif // NONMATCHING - -void sub_801A4A4(void) -{ - struct BulkItem *heldItem; - s32 buyPrice; - s32 y; - s32 index; - u8 buffer1 [80]; - struct unkStruct_8090F58 local_7c; - u8 buffer2 [80]; - struct Item item; - u8 temp_calc; - - sub_8008C54(gUnknown_203B21C->unk34); - sub_80073B8(gUnknown_203B21C->unk34); - xxx_call_draw_string(gUnknown_203B21C->input.unk1E * 8 + 10, 0, gUnknown_80DB92C, gUnknown_203B21C->unk34, 0); - - for (index = 0; index < gUnknown_203B21C->input.unk1A; index++) { - temp_calc = (gUnknown_203B21C->input.unk1E * gUnknown_203B21C->input.unk1C) + index; - heldItem = GetKecleonWareItem(temp_calc); - item.id = heldItem->id; - item.quantity = heldItem->quantity; - item.flags = (ITEM_FLAG_EXISTS | ITEM_FLAG_IN_SHOP); - local_7c.unk0 = 1; - local_7c.unk4 = 0; - local_7c.unk6 = 88; - local_7c.unk8 = 1; - sub_8090E14(buffer1, &item, &local_7c); - buyPrice = GetStackBuyPrice(&item); - - if (buyPrice <= gTeamInventoryRef->teamMoney) { - y = sub_8013800(&gUnknown_203B21C->input, index); - xxx_call_draw_string(8, y, buffer1, gUnknown_203B21C->unk34, 0); - } - else { - sprintfStatic(buffer2, gUnknown_80DB934, buffer1); - y = sub_8013800(&gUnknown_203B21C->input, index); - xxx_call_draw_string(8, y, buffer2, gUnknown_203B21C->unk34, 0); - } - } - sub_80073E0(gUnknown_203B21C->unk34); -} - -bool32 sub_801A5D8(u32 param_1, s32 param_2, struct UnkTextStruct2_sub *param_3, u32 param_4) -{ - if (GetNumberOfFilledInventorySlots() == 0) - return FALSE; - - if (gUnknown_203B224 == NULL) - gUnknown_203B224 = MemoryAlloc(sizeof(struct unkStruct_203B224), 8); - - gUnknown_203B224->unk0 = param_1; - FillInventoryGaps(); - sub_801AE84(); - gUnknown_203B224->unk88 = param_2; - gUnknown_203B224->unk8C = &gUnknown_203B224->unk90[param_2]; - sub_8006518(gUnknown_203B224->unk90); - gUnknown_203B224->unk90[gUnknown_203B224->unk88] = gUnknown_80DB95C; - gUnknown_203B224->unk8C->unk14 = gUnknown_203B224->unkF0; - - if (param_3 != NULL) - gUnknown_203B224->unk90[gUnknown_203B224->unk88].unk8 = *param_3; - - sub_8012D08(gUnknown_203B224->unk8C, param_4); - sub_8099690(1); - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B224->unk90, 1, 1); - sub_8013818(&gUnknown_203B224->input, GetNumberOfFilledInventorySlots(), param_4, param_2); - gUnknown_203B224->input.menuIndex = gUnknown_203B228; - gUnknown_203B224->input.unk1E = gUnknown_203B22A; - sub_8013984(&gUnknown_203B224->input); - sub_801A998(); - sub_801A9E0(); - return TRUE; -} - -u32 sub_801A6E8(bool8 param_1) -{ - s32 index; - struct Item item; - - if (param_1 == FALSE) { - sub_8013660(&gUnknown_203B224->input); - return 0; - } - - switch (GetKeyPress(&gUnknown_203B224->input)) { - case INPUT_B_BUTTON: - PlayMenuSoundEffect(1); - return 2; - case INPUT_A_BUTTON: - switch (gUnknown_203B224->unk0) { - case 0: - case 1: - case 2: - if (gUnknown_203B224->unk4[sub_801A8AC()] != 0) - PlayMenuSoundEffect(2); - else - PlayMenuSoundEffect(0); - break; - case 3: - if (sub_801AEA8() != 0 || sub_801ADA0(sub_801A8AC())) - PlayMenuSoundEffect(0); - else - PlayMenuSoundEffect(2); - break; - case 4: - item = gTeamInventoryRef->teamItems[sub_801A8AC()]; - - if (CanSellItem(item.id) && GetStackSellPrice(&item) + gTeamInventoryRef->teamMoney <= MAX_TEAM_MONEY) - PlayMenuSoundEffect(0); - else - PlayMenuSoundEffect(2); - break; - case 5: - PlayMenuSoundEffect(0); - break; - } - return 3; - case INPUT_START_BUTTON: - PlayMenuSoundEffect(4); - return 4; - case INPUT_L_BUTTON: - case INPUT_R_BUTTON: - if (gUnknown_203B224->unk0 != 3) - goto _0801A87C; - - index = sub_801A8AC(); - if (gUnknown_203B224->unk4[index] != 0 || sub_801ADA0(index)) { - PlayMenuSoundEffect(6); - gUnknown_203B224->unk4[index] ^= 1; - sub_80138B8(&gUnknown_203B224->input, 0); - sub_801A9E0(); - return 1; - } - - PlayMenuSoundEffect(2); - goto _0801A87C; - case INPUT_SELECT_BUTTON: - if (gUnknown_203B224->unk0 != 2) { - PlayMenuSoundEffect(5); - SortInventoryItems(); - sub_801A9E0(); - } - // NOTE: fallthrough needed here - default: - _0801A87C: - if (sub_80138B8(&gUnknown_203B224->input, 1) != FALSE) { - sub_801A998(); - sub_801A9E0(); - return 1; - } - else - return 0; - break; - } -} - -s32 sub_801A8AC(void) -{ - return (gUnknown_203B224->input.unk1E * gUnknown_203B224->input.unk1C) + gUnknown_203B224->input.menuIndex; -} - -void sub_801A8D0(u8 r0) -{ - sub_8099690(1); - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B224->unk90, 0, 0); - FillInventoryGaps(); - gUnknown_203B224->input.unk22 = GetNumberOfFilledInventorySlots(); - sub_8013984(&gUnknown_203B224->input); - sub_801A998(); - sub_801A9E0(); - if (r0) - AddMenuCursorSprite(&gUnknown_203B224->input); -} - -void sub_801A928(void) -{ - if (gUnknown_203B224 != NULL) { - gUnknown_203B228 = gUnknown_203B224->input.menuIndex; - gUnknown_203B22A = gUnknown_203B224->input.unk1E; - gUnknown_203B224->unk90[gUnknown_203B224->unk88] = gUnknown_80DB944; - sub_8099690(0); - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B224->unk90, 1, 1); - MemoryFree(gUnknown_203B224); - gUnknown_203B224 = NULL; - } -} - -void sub_801A998(void) -{ - gUnknown_203B224->unkF0[0] = gUnknown_203B224->input.unk20; - gUnknown_203B224->unkF0[1] = gUnknown_203B224->input.unk1E; - gUnknown_203B224->unkF0[2] = 11; - gUnknown_203B224->unkF0[3] = 0; - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B224->unk90, 1, 1); -} - -void sub_801A9E0(void) -{ - s32 teamItemIndex; - s32 r7; - s32 x; - char buffer1 [0x50]; // sp 0x4 - struct unkStruct_8090F58 stack; // sp 0x54 - struct unkStruct_8090F58 stack1; // sp 0x60 - struct unkStruct_8090F58 stack2; // sp 0x6C - struct unkStruct_8090F58 stack3; // sp 0x78 - // NOTE: this var is unused but makes sure we get correct stack size - // This is also why we need special build flag for this file - u8 local_6c[0x44]; // sp 0x78 ?? (why is this at same location..) - struct Item item; // sp 0xC8 - - sub_8008C54(gUnknown_203B224->unk88); - sub_80073B8(gUnknown_203B224->unk88); - x = gUnknown_203B224->input.unk1E * 8 + 10; - - if (gUnknown_203B224->input.unk1E == 0) - xxx_call_draw_string(x, 0, gTeamToolboxA, gUnknown_203B224->unk88, 0); - else - xxx_call_draw_string(x, 0, gTeamToolboxB, gUnknown_203B224->unk88, 0); - - for (r7 = 0; r7 < gUnknown_203B224->input.unk1A; r7++) { - teamItemIndex = (gUnknown_203B224->input.unk1E * gUnknown_203B224->input.unk1C) + r7; - item = gTeamInventoryRef->teamItems[teamItemIndex]; - - switch (gUnknown_203B224->unk0) { - case 0: - sub_8090E14(buffer1, &item, 0); - xxx_call_draw_string(8, sub_8013800(&gUnknown_203B224->input, r7), buffer1, gUnknown_203B224->unk88, 0); - break; - case 1: - case 2: - stack.unk0 = 0; - stack.unk4 = 0; - stack.unk8 = 1; - item.flags = 1; - sub_8090E14(buffer1, &item, &stack); - xxx_call_draw_string(8, sub_8013800(&gUnknown_203B224->input, r7), buffer1, gUnknown_203B224->unk88, 0); - break; - case 3: - stack1.unk0 = 0; - stack1.unk4 = 0; - stack1.unk8 = 1; - item.flags = 1; - sub_8090E14(buffer1, &item, &stack1); - - if (gUnknown_203B224->unk4[teamItemIndex] != 0 || sub_801ADA0(teamItemIndex)) - xxx_call_draw_string(8,sub_8013800(&gUnknown_203B224->input,r7),buffer1,gUnknown_203B224->unk88, 0); - else { - strncpy(gUnknown_202DE58, buffer1, 0x50); - xxx_format_and_draw(8, sub_8013800(&gUnknown_203B224->input, r7), gUnknown_80DB994, gUnknown_203B224->unk88, 0); - } - break; - case 4: - if (CanSellItem(item.id)) { - stack2.unk0 = 3; - stack2.unk4 = 0; - stack2.unk6 = 0x58; - stack2.unk8 = 1; - item.flags = 3; - sub_8090E14(buffer1, &item, &stack2); - - if (GetStackSellPrice(&item) + gTeamInventoryRef->teamMoney > MAX_TEAM_MONEY) { - // very dumb but this matches... - sprintfStatic((char *)&stack3, gUnknown_80DB9A0, buffer1); - xxx_call_draw_string(8, sub_8013800(&gUnknown_203B224->input, r7), (u8 *)&stack3, gUnknown_203B224->unk88, 0); - } - else - xxx_call_draw_string(8, sub_8013800(&gUnknown_203B224->input, r7), buffer1, gUnknown_203B224->unk88, 0); - } - else { - sub_8090E14(buffer1, &item, 0); - strncpy(gUnknown_202DE58, buffer1, 0x50); - xxx_format_and_draw(8, sub_8013800(&gUnknown_203B224->input, r7), gUnknown_80DB994, gUnknown_203B224->unk88, 0); - } - break; - case 5: - stack3.unk0 = 0; - stack3.unk4 = 0; - stack3.unk8 = 1; - item.flags = 1; - sub_8090E14(buffer1, &item, &stack3); - - if (IsGummiItem(item.id)) - xxx_call_draw_string(8, sub_8013800(&gUnknown_203B224->input, r7), buffer1, gUnknown_203B224->unk88, 0); - else { - strncpy(gUnknown_202DE58, buffer1, 0x50); - xxx_format_and_draw(8, sub_8013800(&gUnknown_203B224->input, r7), gUnknown_80DB994, gUnknown_203B224->unk88, 0); - } - break; - } - - if ((sub_801AED0(teamItemIndex) & 1) != 0) - sub_8007B7C(gUnknown_203B224->unk88, 8, sub_8013800(&gUnknown_203B224->input, r7), (gUnknown_203B224->unk8C->unkC - 2) * 8, 10); - } - - sub_80073E0(gUnknown_203B224->unk88); -} - -void sub_801AD34(u32 param_1) -{ - sub_8008C54(param_1); - sub_80073B8(param_1); - xxx_call_draw_string(6, 0, gUnknown_80DB9A8, param_1, 0); - sub_8012BC4(18, 13, GetNumberOfFilledInventorySlots(), 2, 7, param_1); - xxx_call_draw_string(22, 13, gUnknown_80DB9B0, param_1, 0); - sub_8012BC4(43, 13, INVENTORY_SIZE, 2, 7, param_1); - sub_80073E0(param_1); -} - -bool8 sub_801ADA0(s32 param_1) -{ - u16 uVar2; - u32 uVar2_32; - - u16 uVar3; - u32 uVar3_32; - s32 sum1; - s32 sum2; - struct Item item; - - item = gTeamInventoryRef->teamItems[param_1]; - if (!IsNotMoneyOrUsedTMItem(item.id)) - return FALSE; - - if (IsThrowableItem(item.id)) { - uVar3_32 = sub_801AE24(item.id); - sum1 = gTeamInventoryRef->teamStorage[item.id]; - uVar3 = uVar3_32; - sum1 += uVar3; - sum1 += (item.quantity); - if (sum1 > 999) - return FALSE; - } - else { - uVar2_32 = sub_801AE24(item.id); - sum2 = gTeamInventoryRef->teamStorage[item.id]; - uVar2 = uVar2_32; - sum2 += uVar2; - if (sum2 > 998) - return FALSE; - } - return 1; -} - -s32 sub_801AE24(u32 itemID) -{ - struct Item item; - u16 count; - s32 invIndex; - - count = 0; - for (invIndex = 0; invIndex < GetNumberOfFilledInventorySlots(); invIndex++) { - if (gUnknown_203B224->unk4[invIndex] != 0) { - item = gTeamInventoryRef->teamItems[invIndex]; - - if (item.id == itemID) { - if (IsThrowableItem(item.id)) - count += item.quantity; - else - count++; - } - } - } - return count; -} - -void sub_801AE84(void) -{ - s32 index; - - for (index = 0; index < INVENTORY_SIZE; index++) - gUnknown_203B224->unk4[index] = 0; -} - -s32 sub_801AEA8(void) -{ - s32 index; - s32 count; - - count = 0; - for (index = 0; index < INVENTORY_SIZE; index++) { - if (gUnknown_203B224->unk4[index] != 0) - count++; - } - return count; -} - -s32 sub_801AED0(s32 index) -{ - return gUnknown_203B224->unk4[index]; -} - -void sub_801AEE4(s32 index, s32 value) -{ - gUnknown_203B224->unk4[index] = value; -} - -void SortInventoryItems(void) -{ - struct Item *itemSlotR; - u32 *itemIDR; - u32 *base; - s32 orderL; - s32 orderR; - u32 itemIDL; - struct Item itemSlotL; - s32 itemR; - s32 itemL; - - for (itemL = 0; itemL < GetNumberOfFilledInventorySlots() - 1; itemL++) { - for (itemR = itemL + 1; itemR < GetNumberOfFilledInventorySlots(); itemR++) { - orderL = GetItemOrder(gTeamInventoryRef->teamItems[itemL].id); - orderR = GetItemOrder(gTeamInventoryRef->teamItems[itemR].id); - - if (orderL > orderR - || (orderL == orderR && gTeamInventoryRef->teamItems[itemL].quantity < gTeamInventoryRef->teamItems[itemR].quantity)) { - itemSlotL = gTeamInventoryRef->teamItems[itemL]; - itemSlotR = &gTeamInventoryRef->teamItems[itemR]; - gTeamInventoryRef->teamItems[itemL] = *itemSlotR; - *itemSlotR = itemSlotL; - - base = gUnknown_203B224->unk4; - itemIDL = gUnknown_203B224->unk4[itemL]; - itemIDR = &base[itemR]; - base[itemL] = *itemIDR; - *itemIDR = itemIDL; - } - } - } -} - -struct unkStruct_203B224 *sub_801AF98(void) -{ - return gUnknown_203B224; -} \ No newline at end of file diff --git a/src/kecleon_bros1.c b/src/kecleon_bros1.c new file mode 100644 index 000000000..9954cf7e9 --- /dev/null +++ b/src/kecleon_bros1.c @@ -0,0 +1,907 @@ +#include "global.h" +#include "code_80118A4.h" +#include "code_80130A8.h" +#include "code_801B3C0.h" +#include "code_8098BDC.h" +#include "felicity_bank.h" +#include "items.h" +#include "kecleon_bros1.h" +#include "kecleon_bros2.h" +#include "kecleon_bros3.h" +#include "kecleon_bros4.h" +#include "memory.h" +#include "menu_input.h" +#include "pokemon.h" +#include "text1.h" +#include "text2.h" + +extern u32 gUnknown_202DE30; +extern u8 gUnknown_202DE58[]; +extern u8 gUnknown_202E1C8[]; +extern u8 gUnknown_202E5D8[]; + +static EWRAM_DATA_2 KecleonBrosWork1 *sKecleonBrosWork1 = {0}; + +extern const u8 *gUnknown_80D4920[]; +extern const u8 *gUnknown_80D4928[]; +extern const u8 *gUnknown_80D4934[]; +extern const u8 *gUnknown_80D4970[]; +extern const u8 *gUnknown_80D4978[]; +extern const u8 *gUnknown_80D4984[]; +extern const u8 *gKecleonShopDialogue[KECLEON_BROS_MODE_COUNT][23]; // 80D5EC8 + +#include "data/kecleon_bros1.h" + +static u32 CountKecleonItems(void); +static void SetKecleonBrosState(u32); +static void UpdateKecleonStoreDialogue(void); + +static void sub_8018D30(void); +static void sub_80194F8(void); +static void sub_80195C0(void); +static void sub_8019660(void); +static void sub_8019700(void); +static void sub_8019730(void); +static void sub_8019850(void); +static void sub_80198E8(void); +static void sub_8019944(void); +static void sub_80199CC(void); +static void sub_8019B08(void); +static void sub_8019BBC(void); +static void sub_8019C78(void); +static void sub_8019D30(void); +static void sub_8019D4C(void); +static void sub_8019D68(void); +static void sub_8019DAC(void); +static void sub_8019E04(bool32); + +bool8 CreateKecleonBros(u32 mode) +{ + u8 *monName; + OpenedFile *faceFile; + + sKecleonBrosWork1 = MemoryAlloc(sizeof(KecleonBrosWork1), 8); + sKecleonBrosWork1->menuAction1 = 0; + sKecleonBrosWork1->menuAction2 = 0; + sKecleonBrosWork1->menuAction3 = 0; + sKecleonBrosWork1->mode = mode; + + switch (mode) { + case KECLEON_BROS_MODE_ITEMS_AWAKE: + sKecleonBrosWork1->isKecleonItemShop = TRUE; + sKecleonBrosWork1->unkE4 = &sKecleonBrosWork1->faceFile; + CopyYellowMonsterNametoBuffer(gUnknown_202E5D8, MONSTER_KECLEON); + CopyYellowMonsterNametoBuffer(gUnknown_202E1C8, MONSTER_KECLEON); + monName = GetMonSpecies(MONSTER_KECLEON); + strcpy(gUnknown_202E1C8 - 0x50, monName); + break; + case KECLEON_BROS_MODE_ITEMS_ASLEEP: + sKecleonBrosWork1->isKecleonItemShop = TRUE; + sKecleonBrosWork1->unkE4 = NULL; + CopyYellowMonsterNametoBuffer(gUnknown_202E5D8, MONSTER_KECLEON); + CopyYellowMonsterNametoBuffer(gUnknown_202E1C8, MONSTER_KECLEON); + monName = GetMonSpecies(MONSTER_KECLEON); + strcpy(gUnknown_202E1C8 - 0x50, monName); + break; + case KECLEON_BROS_MODE_WARES_AWAKE: + sKecleonBrosWork1->isKecleonItemShop = FALSE; + sKecleonBrosWork1->unkE4 = &sKecleonBrosWork1->faceFile; + CopyYellowMonsterNametoBuffer(gUnknown_202E5D8, MONSTER_KECLEON); + CopyYellowMonsterNametoBuffer(gUnknown_202E1C8, MONSTER_KECLEON); + monName = GetMonSpecies(MONSTER_KECLEON); + strcpy(gUnknown_202E1C8 - 0x50, monName); + break; + case KECLEON_BROS_MODE_WARES_ASLEEP: + sKecleonBrosWork1->isKecleonItemShop = FALSE; + sKecleonBrosWork1->unkE4 = NULL; + CopyYellowMonsterNametoBuffer(gUnknown_202E5D8, MONSTER_KECLEON); + CopyYellowMonsterNametoBuffer(gUnknown_202E1C8, MONSTER_KECLEON); + monName = GetMonSpecies(MONSTER_KECLEON); + strcpy(gUnknown_202E1C8 - 0x50, monName); + break; + default: + break; + } + + faceFile = GetDialogueSpriteDataPtr(MONSTER_KECLEON); + sKecleonBrosWork1->faceFile = faceFile; + sKecleonBrosWork1->faceData = faceFile->data; + sKecleonBrosWork1->unkE0 = 0; + sKecleonBrosWork1->unkE1 = 0; + sKecleonBrosWork1->unkE2 = 0; + sKecleonBrosWork1->unkDC = 2; + sKecleonBrosWork1->unkDE = 8; + SetKecleonBrosState(KECLEON_STORE_INIT); + return TRUE; +} + +u32 KecleonBrosCallback(void) +{ + switch (sKecleonBrosWork1->currState) { + case KECLEON_STORE_INIT: + case KECLEON_STORE_MAIN_MENU: + sub_8019730(); + break; + case 0x12: + case 0x13: + sub_80199CC(); + break; + case 0x1a: + case 0x1b: + sub_8019B08(); + break; + case 0x14: + sub_8019BBC(); + break; + case 0x1c: + sub_8019C78(); + break; + case 0x16: + sub_8019850(); + break; + case 0x1e: + sub_80198E8(); + break; + case 0x1f: + sub_8019944(); + break; + case 0x15: + sub_8019D30(); + break; + case 0x1d: + sub_8019D4C(); + break; + case KECLEON_STORE_EXIT: + return 3; + default: + sub_8019D68(); + break; + } + return 0; +} + +void DeleteKecleonBros(void) +{ + if (sKecleonBrosWork1 != NULL) { + CloseFile(sKecleonBrosWork1->faceFile); + MemoryFree(sKecleonBrosWork1); + sKecleonBrosWork1 = NULL; + } +} + +static void SetKecleonBrosState(u32 newState) +{ + sKecleonBrosWork1->currState = newState; + sub_8018D30(); + UpdateKecleonStoreDialogue(); +} + +static void sub_8018D30(void) +{ + s32 i; + + sub_8006518(sKecleonBrosWork1->unkE8); + + switch (sKecleonBrosWork1->currState) { + case 18: + case 19: + sKecleonBrosWork1->unkE8[0] = sUnknown_80DB840; + sKecleonBrosWork1->unkE8[2] = sUnknown_80DB840; + sKecleonBrosWork1->unkE8[0] = sUnknown_80DB870; + sKecleonBrosWork1->unkE8[1] = sUnknown_80DB888; + break; + case 26: + case 27: + sKecleonBrosWork1->unkE8[0] = sUnknown_80DB840; + sKecleonBrosWork1->unkE8[1] = sUnknown_80DB840; + sKecleonBrosWork1->unkE8[2] = sUnknown_80DB840; + sKecleonBrosWork1->unkE8[1] = sUnknown_80DB888; + break; + case 20: + case 28: + sKecleonBrosWork1->unkE8[2] = sUnknown_80DB858; + break; + default: + case 21: + case 22: + case 23: + case 24: + case 25: + for (i = 0; i < 4; i++) + sKecleonBrosWork1->unkE8[i] = sUnknown_80DB840; + break; + } + + ResetUnusedInputStruct(); + sub_800641C(sKecleonBrosWork1->unkE8, TRUE, TRUE); +} + +static void UpdateKecleonStoreDialogue(void) +{ + switch (sKecleonBrosWork1->currState) { + case 0: + sub_8019DAC(); + sub_80194F8(); + sub_8019E04(FALSE); + sub_8014248(gKecleonShopDialogue[sKecleonBrosWork1->mode][0], 0, sKecleonBrosWork1->menuAction1, + sKecleonBrosWork1->menuItems, sKecleonBrosWork1->unk74, 4, 0, sKecleonBrosWork1->unkE4, 12); + break; + case 1: + sub_8019DAC(); + sub_80194F8(); + sub_8019E04(FALSE); + sub_8014248(gKecleonShopDialogue[sKecleonBrosWork1->mode][1], 0, sKecleonBrosWork1->menuAction1, + sKecleonBrosWork1->menuItems, sKecleonBrosWork1->unk74, 4, 0, sKecleonBrosWork1->unkE4, 12); + break; + case 2: + sKecleonBrosWork1->fallbackState = 1; + sub_8019E04(FALSE); + sub_80141B4(gKecleonShopDialogue[sKecleonBrosWork1->mode][22], 0, sKecleonBrosWork1->unkE4, 0x10D); + break; + case 3: + sKecleonBrosWork1->fallbackState = 4; + sub_8019E04(FALSE); + sub_80141B4(gKecleonShopDialogue[sKecleonBrosWork1->mode][2], 0, sKecleonBrosWork1->unkE4, 0x30D); + break; + case 5: + sKecleonBrosWork1->fallbackState = 1; + sub_8019E04(FALSE); + sub_80141B4(gKecleonShopDialogue[sKecleonBrosWork1->mode][12], 0, sKecleonBrosWork1->unkE4, 0x10D); + break; + case 6: + sKecleonBrosWork1->fallbackState = 16; + sub_8019E04(TRUE); + sub_80141B4(gKecleonShopDialogue[sKecleonBrosWork1->mode][13], 0, sKecleonBrosWork1->unkE4, 0x10D); + break; + case 7: + sKecleonBrosWork1->fallbackState = 1; + sub_8019E04(TRUE); + sub_80141B4(gKecleonShopDialogue[sKecleonBrosWork1->mode][14], 0, sKecleonBrosWork1->unkE4, 0x10D); + break; + case 8: + sKecleonBrosWork1->fallbackState = 1; + sub_8019E04(TRUE); + sub_80141B4(gKecleonShopDialogue[sKecleonBrosWork1->mode][15], 0, sKecleonBrosWork1->unkE4, 0x10D); + break; + case 9: + sKecleonBrosWork1->fallbackState = 1; + sub_8019E04(TRUE); + sub_80141B4(gKecleonShopDialogue[sKecleonBrosWork1->mode][16], 0, sKecleonBrosWork1->unkE4, 0x10D); + break; + case 10: + sKecleonBrosWork1->fallbackState = 1; + sub_8019E04(TRUE); + sub_80141B4(gKecleonShopDialogue[sKecleonBrosWork1->mode][17], 0, sKecleonBrosWork1->unkE4, 0x10D); + break; + case 11: + sKecleonBrosWork1->fallbackState = 1; + sub_8019E04(FALSE); + sub_80141B4(gKecleonShopDialogue[sKecleonBrosWork1->mode][18], 0, sKecleonBrosWork1->unkE4, 0x10D); + break; + case 12: + sKecleonBrosWork1->fallbackState = 16; + sub_8019E04(TRUE); + sub_80141B4(gKecleonShopDialogue[sKecleonBrosWork1->mode][19], 0, sKecleonBrosWork1->unkE4, 0x10D); + break; + case 13: + sub_8090E14(gUnknown_202DE58, &sKecleonBrosWork1->soldItem, NULL); + sKecleonBrosWork1->fallbackState = 24; + sub_8019E04(TRUE); + sub_80141B4(gKecleonShopDialogue[sKecleonBrosWork1->mode][20], 0, sKecleonBrosWork1->unkE4, 0x10D); + break; + case 14: + sKecleonBrosWork1->fallbackState = 24; + sub_8019E04(TRUE); + sub_80141B4(gKecleonShopDialogue[sKecleonBrosWork1->mode][21], 0, sKecleonBrosWork1->unkE4, 0x10D); + break; + case 15: + sKecleonBrosWork1->fallbackState = 18; + sub_8019E04(FALSE); + sub_80141B4(gKecleonShopDialogue[sKecleonBrosWork1->mode][3], 0, sKecleonBrosWork1->unkE4, 0x10D); + break; + case 16: + sKecleonBrosWork1->fallbackState = 19; + sub_8019E04(FALSE); + sub_80141B4(gKecleonShopDialogue[sKecleonBrosWork1->mode][4], 0, sKecleonBrosWork1->unkE4, 0x10D); + break; + case 18: + if (sKecleonBrosWork1->isKecleonItemShop) + sub_8019E40(3); + else + sub_801A20C(3); + + sub_801AD34(0); + DrawTeamMoneyBox(1); + break; + case 19: + if (sKecleonBrosWork1->isKecleonItemShop) + sub_8019FCC(TRUE); + else + sub_801A398(TRUE); + + sub_801AD34(0); + DrawTeamMoneyBox(1); + break; + case 20: + if (sKecleonBrosWork1->isKecleonItemShop) + sub_801A0D8(); + else + sub_801A4A4(); + + sub_801AD34(0); + DrawTeamMoneyBox(1); + sub_80195C0(); + sub_8012D60(&sKecleonBrosWork1->menu, sKecleonBrosWork1->menuItems, 0, sKecleonBrosWork1->unk74, sKecleonBrosWork1->menuAction3, 2); + break; + case 22: + sub_8019700(); + sub_8090E14(gUnknown_202DE58, &sKecleonBrosWork1->soldItem, 0); + gUnknown_202DE30 = sKecleonBrosWork1->itemSellPrice; + sub_8019E04(FALSE); + sub_8014248(gKecleonShopDialogue[sKecleonBrosWork1->mode][5], 0, 5,sKecleonBrosWork1->menuItems, NULL, 4, 0, sKecleonBrosWork1->unkE4, 12); + break; + case 17: + if (CountKecleonItems() == 0) { + if (sKecleonBrosWork1->isKecleonItemShop != FALSE) + sub_801A010(); + else + sub_801A3DC(); + sKecleonBrosWork1->fallbackState = 11; + } + else { + if (GetNumberOfFilledInventorySlots() >= INVENTORY_SIZE) { + if (sKecleonBrosWork1->isKecleonItemShop != FALSE) + sub_801A010(); + else + sub_801A3DC(); + sKecleonBrosWork1->fallbackState = 1; + } + else + sKecleonBrosWork1->fallbackState = 16; + } + sub_8019E04(FALSE); + sub_80141B4(gKecleonShopDialogue[sKecleonBrosWork1->mode][6], 0, sKecleonBrosWork1->unkE4, 0x10D); + break; + case 23: + sKecleonBrosWork1->fallbackState = 26; + sub_8019E04(FALSE); + sub_80141B4(gKecleonShopDialogue[sKecleonBrosWork1->mode][7], 0, sKecleonBrosWork1->unkE4, 0x10D); + break; + case 24: + sKecleonBrosWork1->fallbackState = 27; + sub_8019E04(FALSE); + sub_80141B4(gKecleonShopDialogue[sKecleonBrosWork1->mode][8], 0, sKecleonBrosWork1->unkE4, 0x10D); + break; + case 26: + sub_801A5D8(4, 3, NULL, 10); + DrawTeamMoneyBox(1); + break; + case 27: + sub_801A8D0(TRUE); + DrawTeamMoneyBox(1); + break; + case 28: + sub_801A9E0(); + DrawTeamMoneyBox(1); + sub_8019660(); + sub_8012D60(&sKecleonBrosWork1->menu, sKecleonBrosWork1->menuItems, 0, sKecleonBrosWork1->unk74, sKecleonBrosWork1->menuAction2, 2); + break; + case 30: + sub_8019700(); + sub_8090E14(gUnknown_202DE58, &sKecleonBrosWork1->soldItem, NULL); + gUnknown_202DE30 = sKecleonBrosWork1->itemSellPrice; + sub_8019E04(FALSE); + sub_8014248(gKecleonShopDialogue[sKecleonBrosWork1->mode][9], 0, 5, sKecleonBrosWork1->menuItems, NULL, 4, 0, sKecleonBrosWork1->unkE4, 12); + break; + case 21: + case 29: + sub_801B3C0(&sKecleonBrosWork1->soldItem); + break; + case 25: + if (GetNumberOfFilledInventorySlots() == 0 || gTeamInventoryRef->teamMoney >= MAX_TEAM_MONEY) { + sub_801A928(); + sKecleonBrosWork1->fallbackState = 1; + } + else + sKecleonBrosWork1->fallbackState = 24; + + sub_8019E04(FALSE); + sub_80141B4(gKecleonShopDialogue[sKecleonBrosWork1->mode][11], 0, sKecleonBrosWork1->unkE4, 0x10D); + break; + case 31: + sub_8019700(); + gUnknown_202DE30 = sKecleonBrosWork1->inventoryItemSellPrice; + sub_8019E04(FALSE); + sub_8014248(gKecleonShopDialogue[sKecleonBrosWork1->mode][10], 0, 5, sKecleonBrosWork1->menuItems, NULL, 4, 0, sKecleonBrosWork1->unkE4, 12); + break; + case 32: + sKecleonBrosWork1->fallbackState = 1; + sub_8019E04(FALSE); + sub_80141B4(gKecleonShopDialogue[sKecleonBrosWork1->mode][11], 0, sKecleonBrosWork1->unkE4, 0x10D); + break; + } +} + +static void sub_80194F8(void) +{ + s32 i; + s32 loopMax; + + MemoryFill16(sKecleonBrosWork1->unk74, 0, sizeof(sKecleonBrosWork1->unk74)); + + loopMax = 0; + sKecleonBrosWork1->menuItems[loopMax].text = *gUnknown_80D4978; + sKecleonBrosWork1->menuItems[loopMax].menuAction = 2; + + loopMax += 1; + sKecleonBrosWork1->menuItems[loopMax].text = *gUnknown_80D4984; + sKecleonBrosWork1->menuItems[loopMax].menuAction = 3; + + loopMax += 1; + sKecleonBrosWork1->menuItems[loopMax].text = sSellAll; + sKecleonBrosWork1->menuItems[loopMax].menuAction = 4; + + loopMax += 1; + sKecleonBrosWork1->menuItems[loopMax].text = *gUnknown_80D4970; + sKecleonBrosWork1->menuItems[loopMax].menuAction = 7; + + loopMax += 1; + sKecleonBrosWork1->menuItems[loopMax].text = *gUnknown_80D4934; + sKecleonBrosWork1->menuItems[loopMax].menuAction = 1; + + loopMax += 1; + sKecleonBrosWork1->menuItems[loopMax].text = NULL; + sKecleonBrosWork1->menuItems[loopMax].menuAction = 1; + + for (i = 0; i < loopMax; i++) { + if (sKecleonBrosWork1->unk74[i] == 0) { + if (sKecleonBrosWork1->menuItems[i].menuAction == sKecleonBrosWork1->menuAction1) + return; + } + } + + for (i = 0; i < loopMax; i++) { + if (sKecleonBrosWork1->unk74[i] == 0) { + sKecleonBrosWork1->menuAction1 = sKecleonBrosWork1->menuItems[i].menuAction; + break; + } + } +} + +static void sub_80195C0(void) +{ + s32 i; + s32 loopMax; + + MemoryFill16(sKecleonBrosWork1->unk74, 0, sizeof(sKecleonBrosWork1->unk74)); + + loopMax = 0; + sKecleonBrosWork1->menuItems[loopMax].text = *gUnknown_80D4978; + sKecleonBrosWork1->menuItems[loopMax].menuAction = 2; + + loopMax += 1; + sKecleonBrosWork1->menuItems[loopMax].text = *gUnknown_80D4970; + sKecleonBrosWork1->menuItems[loopMax].menuAction = 7; + + loopMax += 1; + sKecleonBrosWork1->menuItems[loopMax].text = NULL; + sKecleonBrosWork1->menuItems[loopMax].menuAction = 1; + + for (i = 0; i < loopMax; i++) { + if (sKecleonBrosWork1->unk74[i] == 0) { + if (sKecleonBrosWork1->menuItems[i].menuAction == sKecleonBrosWork1->menuAction3) + return; + } + } + + for (i = 0; i < loopMax; i++) { + if (sKecleonBrosWork1->unk74[i] == 0) { + sKecleonBrosWork1->menuAction3 = sKecleonBrosWork1->menuItems[i].menuAction; + break; + } + } +} + +static void sub_8019660(void) +{ + s32 i; + s32 loopMax; + + MemoryFill16(sKecleonBrosWork1->unk74, 0, sizeof(sKecleonBrosWork1->unk74)); + + loopMax = 0; + sKecleonBrosWork1->menuItems[loopMax].text = *gUnknown_80D4984; + sKecleonBrosWork1->menuItems[loopMax].menuAction = 3; + + loopMax += 1; + sKecleonBrosWork1->menuItems[loopMax].text = *gUnknown_80D4970; + sKecleonBrosWork1->menuItems[loopMax].menuAction = 7; + + loopMax += 1; + sKecleonBrosWork1->menuItems[loopMax].text = NULL; + sKecleonBrosWork1->menuItems[loopMax].menuAction = 1; + + for (i = 0; i < loopMax; i++) { + if (sKecleonBrosWork1->unk74[i] == 0) { + if (sKecleonBrosWork1->menuItems[i].menuAction == sKecleonBrosWork1->menuAction2) + return; + } + } + + for (i = 0; i < loopMax; i++) { + if (sKecleonBrosWork1->unk74[i] == 0) { + sKecleonBrosWork1->menuAction2 = sKecleonBrosWork1->menuItems[i].menuAction; + break; + } + } +} + +static void sub_8019700(void) +{ + s32 loopMax = 0; + sKecleonBrosWork1->menuItems[loopMax].text = *gUnknown_80D4920; + sKecleonBrosWork1->menuItems[loopMax].menuAction = 5; + + loopMax += 1; + sKecleonBrosWork1->menuItems[loopMax].text = *gUnknown_80D4928; + sKecleonBrosWork1->menuItems[loopMax].menuAction = 6; + + loopMax += 1; + sKecleonBrosWork1->menuItems[loopMax].text = NULL; + sKecleonBrosWork1->menuItems[loopMax].menuAction = 1; +} + +static void sub_8019730(void) +{ + s32 menuAction; + + if (sub_80144A4(&menuAction) != 0) + return; + + if (menuAction != 1) + sKecleonBrosWork1->menuAction1 = menuAction; + + switch (menuAction) { + case 2: + if (CountKecleonItems() == 0) + SetKecleonBrosState(KECLEON_STORE_NO_STORE_ITEMS); + else if (GetNumberOfFilledInventorySlots() >= INVENTORY_SIZE) + SetKecleonBrosState(KECLEON_STORE_TOO_MANY_ITEMS); + else + SetKecleonBrosState(15); + break; + case 3: + if (GetNumberOfFilledInventorySlots() == 0) + SetKecleonBrosState(KECLEON_STORE_NO_ITEMS_TO_SELL); + else if (sKecleonBrosWork1->numInventoryItemToSell == 0) + SetKecleonBrosState(8); + else if (gTeamInventoryRef->teamMoney < MAX_TEAM_MONEY) + SetKecleonBrosState(23); + else + SetKecleonBrosState(7); + break; + case 4: + if (GetNumberOfFilledInventorySlots() == 0) + SetKecleonBrosState(KECLEON_STORE_NO_ITEMS_TO_SELL); + else if (sKecleonBrosWork1->numInventoryItemToSell == 0) + SetKecleonBrosState(8); + else if (sKecleonBrosWork1->inventoryItemSellPrice + gTeamInventoryRef->teamMoney > MAX_TEAM_MONEY) + SetKecleonBrosState(7); + else + SetKecleonBrosState(31); + break; + case 7: + SetKecleonBrosState(2); + break; + case 1: + SetKecleonBrosState(3); + break; + } +} + +static void sub_8019850(void) +{ + s32 menuAction; + + if (sub_80144A4(&menuAction) == 0) { + switch (menuAction) { + case 5: + AddToTeamMoney(-sKecleonBrosWork1->itemSellPrice); + + if (sKecleonBrosWork1->isKecleonItemShop) { + AddHeldItemToInventory(GetKecleonShopItem(sKecleonBrosWork1->itemShopItemIndex)); + InitKecleonShopItem(sKecleonBrosWork1->itemShopItemIndex); + FillKecleonShopGaps(); + } + else { + AddHeldItemToInventory(GetKecleonWareItem(sKecleonBrosWork1->wareShopItemIndex)); + InitKecleonWareItem(sKecleonBrosWork1->wareShopItemIndex); + FillKecleonWareGaps(); + } + + PlaySound(332); + SetKecleonBrosState(17); + break; + case 6: + case 1: + SetKecleonBrosState(16); + break; + } + } +} + +static void sub_80198E8(void) +{ + s32 menuAction; + + if (sub_80144A4(&menuAction) == 0) { + switch (menuAction) { + case 5: + AddToTeamMoney(sKecleonBrosWork1->itemSellPrice); + ShiftItemsDownFrom(sKecleonBrosWork1->soldItemInventoryIndex); + PlaySound(332); + SetKecleonBrosState(25); + break; + case 6: + case 1: + SetKecleonBrosState(24); + break; + } + } +} + +static void sub_8019944(void) +{ + s32 slotIndex; + s32 menuAction; + Item *item; + + if (sub_80144A4(&menuAction) == 0) { + switch (menuAction) { + case 5: + for (slotIndex = 0; slotIndex < INVENTORY_SIZE; slotIndex++) { + item = &gTeamInventoryRef->teamItems[slotIndex]; + + if ((item->flags & ITEM_FLAG_EXISTS) && CanSellItem(item->id)) + ClearItemSlotAt(slotIndex); + } + + FillInventoryGaps(); + AddToTeamMoney(sKecleonBrosWork1->inventoryItemSellPrice); + PlaySound(0x14c); + SetKecleonBrosState(32); + break; + case 1: + case 6: + SetKecleonBrosState(KECLEON_STORE_MAIN_MENU); + break; + } + } +} + +static void sub_80199CC(void) +{ + u32 menuAction; + BulkItem *item; + + if (sKecleonBrosWork1->isKecleonItemShop) + menuAction = sub_8019EDC(TRUE); + else + menuAction = sub_801A2A8(TRUE); + + switch (menuAction) { + case 3: + if (sKecleonBrosWork1->isKecleonItemShop) { + sKecleonBrosWork1->itemShopItemIndex = sub_8019FB0(); + item = GetKecleonShopItem(sKecleonBrosWork1->itemShopItemIndex); + } + else { + sKecleonBrosWork1->wareShopItemIndex = sub_801A37C(); + item = GetKecleonWareItem(sKecleonBrosWork1->wareShopItemIndex); + } + + xxx_init_itemslot_8090A8C(&sKecleonBrosWork1->soldItem, item->id, 0); + sKecleonBrosWork1->soldItem.quantity = item->quantity; + sKecleonBrosWork1->itemSellPrice = GetStackBuyPrice(&sKecleonBrosWork1->soldItem); + SetKecleonBrosState(20); + break; + case 4: + if (sKecleonBrosWork1->isKecleonItemShop) { + sKecleonBrosWork1->itemShopItemIndex = sub_8019FB0(); + item = GetKecleonShopItem(sKecleonBrosWork1->itemShopItemIndex); + } + else { + sKecleonBrosWork1->wareShopItemIndex = sub_801A37C(); + item = GetKecleonWareItem(sKecleonBrosWork1->wareShopItemIndex); + } + + xxx_init_itemslot_8090A8C(&sKecleonBrosWork1->soldItem, item->id, 0); + sKecleonBrosWork1->soldItem.quantity = item->quantity; + sKecleonBrosWork1->itemSellPrice = GetStackBuyPrice(&sKecleonBrosWork1->soldItem); + SetKecleonBrosState(21); + break; + case 2: + if (sKecleonBrosWork1->isKecleonItemShop) + sub_801A010(); + else + sub_801A3DC(); + + SetKecleonBrosState(KECLEON_STORE_MAIN_MENU); + break; + case 1: + sub_801AD34(0); + DrawTeamMoneyBox(1); + break; + } +} + +static void sub_8019B08(void) +{ + switch (sub_801A6E8(TRUE)) { + case 0: + break; + case 3: + sKecleonBrosWork1->soldItemInventoryIndex = sub_801A8AC(); + sKecleonBrosWork1->soldItem = gTeamInventoryRef->teamItems[sKecleonBrosWork1->soldItemInventoryIndex]; + sKecleonBrosWork1->itemSellPrice = GetStackSellPrice(&sKecleonBrosWork1->soldItem); + SetKecleonBrosState(28); + break; + case 4: + sKecleonBrosWork1->soldItemInventoryIndex = sub_801A8AC(); + sKecleonBrosWork1->soldItem = gTeamInventoryRef->teamItems[sKecleonBrosWork1->soldItemInventoryIndex]; + sKecleonBrosWork1->itemSellPrice = GetStackSellPrice(&sKecleonBrosWork1->soldItem); + sub_8099690(0); + SetKecleonBrosState(29); + break; + case 2: + sub_801A928(); + SetKecleonBrosState(KECLEON_STORE_MAIN_MENU); + break; + case 1: + default: + DrawTeamMoneyBox(1); + break; + } +} + +static void sub_8019BBC(void) +{ + s32 menuAction; + + menuAction = 0; + + if (sKecleonBrosWork1->isKecleonItemShop) + sub_8019EDC(FALSE); + else + sub_801A2A8(FALSE); + + if (sub_8012FD8(&sKecleonBrosWork1->menu) == 0 && (sub_8013114(&sKecleonBrosWork1->menu, &menuAction), menuAction != 1)) + sKecleonBrosWork1->menuAction3 = menuAction; + + switch (menuAction) { + case 2: + if (gTeamInventoryRef->teamMoney == 0) + SetKecleonBrosState(KECLEON_STORE_NO_MONEY); + else if (sKecleonBrosWork1->itemSellPrice > gTeamInventoryRef->teamMoney) + SetKecleonBrosState(KECLEON_STORE_NOT_ENOUGH_MONEY); + else + SetKecleonBrosState(22); + break; + case 7: + SetKecleonBrosState(21); + break; + case 1: + SetKecleonBrosState(19); + break; + } +} + +static void sub_8019C78(void) +{ + s32 menuAction; + + menuAction = 0; + sub_801A6E8(FALSE); + + if (sub_8012FD8(&sKecleonBrosWork1->menu) == FALSE && (sub_8013114(&sKecleonBrosWork1->menu, &menuAction), menuAction != 1)) + sKecleonBrosWork1->menuAction2 = menuAction; + + switch (menuAction) { + case 3: + sub_8099690(0); + + if (!CanSellItem(sKecleonBrosWork1->soldItem.id)) + SetKecleonBrosState(KECLEON_STORE_CANT_SELL_ITEM); + else if (sKecleonBrosWork1->itemSellPrice + gTeamInventoryRef->teamMoney > MAX_TEAM_MONEY) + SetKecleonBrosState(14); + else + SetKecleonBrosState(30); + break; + case 7: + sub_8099690(0); + SetKecleonBrosState(29); + break; + case 1: + SetKecleonBrosState(27); + break; + } +} + +static void sub_8019D30(void) +{ + switch (sub_801B410()) { + case 2: + case 3: + sub_801B450(); + SetKecleonBrosState(19); + break; + case 0: + case 1: + break; + } +} + +static void sub_8019D4C(void) +{ + switch (sub_801B410()) { + case 2: + case 3: + sub_801B450(); + SetKecleonBrosState(27); + break; + case 0: + case 1: + break; + } +} + +static void sub_8019D68(void) +{ + s32 temp; + + if (sub_80144A4(&temp) == 0) + SetKecleonBrosState(sKecleonBrosWork1->fallbackState); +} + +static u32 CountKecleonItems(void) +{ + if (sKecleonBrosWork1->isKecleonItemShop) + return CountKecleonShopItems(); + else + return CountKecleonWareItems(); +} + +static void sub_8019DAC(void) +{ + s32 sellPrice; + Item *item; + s32 index; + + sKecleonBrosWork1->numInventoryItemToSell = 0; + sKecleonBrosWork1->inventoryItemSellPrice = 0; + for (index = 0; index < INVENTORY_SIZE; index++) { + item = &gTeamInventoryRef->teamItems[index]; + + if ((item->flags & ITEM_FLAG_EXISTS) != 0 && CanSellItem(item->id)) { + sellPrice = GetStackSellPrice(item); + sKecleonBrosWork1->inventoryItemSellPrice += sellPrice; + sKecleonBrosWork1->numInventoryItemToSell++; + } + } +} + +static void sub_8019E04(bool32 a0) +{ + if (sKecleonBrosWork1->isKecleonItemShop) { + if (a0 == TRUE) + sKecleonBrosWork1->unkE0 = 1; + else + sKecleonBrosWork1->unkE0 = 0; + } + else { + if (a0 == TRUE) + sKecleonBrosWork1->unkE0 = 7; + else + sKecleonBrosWork1->unkE0 = 6; + } +} \ No newline at end of file diff --git a/src/kecleon_bros2.c b/src/kecleon_bros2.c new file mode 100644 index 000000000..1aca68aaf --- /dev/null +++ b/src/kecleon_bros2.c @@ -0,0 +1,225 @@ +#include "global.h" +#include "code_800D090.h" +#include "code_80118A4.h" +#include "constants/input.h" +#include "items.h" +#include "kecleon_bros2.h" +#include "memory.h" +#include "menu_input.h" +#include "text1.h" +#include "text2.h" + +static EWRAM_DATA_2 unkStruct_203B214 *gUnknown_203B214 = {0}; +static EWRAM_DATA_2 u16 gUnknown_203B218 = {0}; + +#include "data/kecleon_bros2.h" + +static void sub_801A064(void); + +bool8 sub_8019E40(u32 r0) +{ + if (CountKecleonShopItems() == 0) + return FALSE; + + gUnknown_203B214 = MemoryAlloc(sizeof(unkStruct_203B214), 8); + gUnknown_203B214->unk34 = r0; + gUnknown_203B214->unk38 = &gUnknown_203B214->unk3C[gUnknown_203B214->unk34]; + sub_8006518(gUnknown_203B214->unk3C); + gUnknown_203B214->unk3C[gUnknown_203B214->unk34] = sUnknown_80DB8CC; + gUnknown_203B214->unk38->unk14 = gUnknown_203B214->unk9C; + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B214->unk3C, TRUE, TRUE); + sub_8013818(&gUnknown_203B214->input, CountKecleonShopItems(), 10, r0); + gUnknown_203B214->input.menuIndex = gUnknown_203B218; + sub_8013984(&gUnknown_203B214->input); + sub_801A064(); + sub_801A0D8(); + return TRUE; +} + +u32 sub_8019EDC(bool8 r0) +{ + Item slot; + BulkItem *item; + + if (!r0) { + sub_8013660(&gUnknown_203B214->input); + return 0; + } + + switch (GetKeyPress(&gUnknown_203B214->input)) { + case INPUT_B_BUTTON: + PlayMenuSoundEffect(1); + return 2; + case INPUT_A_BUTTON: + item = GetKecleonShopItem(sub_8019FB0()); + slot.id = item->id; + slot.quantity = item->quantity; + + if (GetStackBuyPrice(&slot) > gTeamInventoryRef->teamMoney) + PlayMenuSoundEffect(2); + else + PlayMenuSoundEffect(0); + return 3; + case INPUT_START_BUTTON: + PlayMenuSoundEffect(4); + return 4; + default: + if (sub_80138B8(&gUnknown_203B214->input, 1) != FALSE) { + sub_801A064(); + sub_801A0D8(); + return 1; + } + return 0; + } +} + +u8 sub_8019FB0(void) +{ + return (gUnknown_203B214->input.unk1E * gUnknown_203B214->input.unk1C) + (u8)gUnknown_203B214->input.menuIndex; +} + +void sub_8019FCC(bool8 r0) +{ + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B214->unk3C, FALSE, FALSE); + gUnknown_203B214->input.unk22 = CountKecleonShopItems(); + sub_8013984(&gUnknown_203B214->input); + sub_801A064(); + sub_801A0D8(); + if (r0) + AddMenuCursorSprite(&gUnknown_203B214->input); +} + +void sub_801A010(void) +{ + if (gUnknown_203B214 != NULL) { + gUnknown_203B218 = gUnknown_203B214->input.menuIndex; + gUnknown_203B214->unk3C[gUnknown_203B214->unk34] = sUnknown_80DB8B4; + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B214->unk3C, TRUE, TRUE); + MemoryFree(gUnknown_203B214); + gUnknown_203B214 = NULL; + } +} + +#if NONMATCHING // sub_80095E4 memes https://decomp.me/scratch/VjeuO +static void sub_801A064(void) +{ + s16 val; + + gUnknown_203B214->unk9C[0] = gUnknown_203B214->input.unk20; + gUnknown_203B214->unk9C[1] = gUnknown_203B214->input.unk1E; + gUnknown_203B214->unk9C[2] = 10; + gUnknown_203B214->unk9C[3] = 0; + + val = sub_80095E4(gUnknown_203B214->input.unk1A, 12) + 2; + gUnknown_203B214->unk3C[gUnknown_203B214->unk34].unkE = val; + gUnknown_203B214->unk3C[gUnknown_203B214->unk34].unk10 = val + 2; + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B214->unk3C, TRUE, TRUE); +} +#else +NAKED +static void sub_801A064(void) +{ + asm_unified( + "\tpush {r4,lr}\n" + "\tldr r4, _0801A0D4\n" + "\tldr r0, [r4]\n" + "\tldrh r1, [r0, 0x20]\n" + "\tadds r0, 0x9C\n" + "\tmovs r2, 0\n" + "\tstrb r1, [r0]\n" + "\tldr r0, [r4]\n" + "\tldrh r1, [r0, 0x1E]\n" + "\tadds r0, 0x9D\n" + "\tstrb r1, [r0]\n" + "\tldr r0, [r4]\n" + "\tadds r0, 0x9E\n" + "\tmovs r1, 0xA\n" + "\tstrb r1, [r0]\n" + "\tldr r0, [r4]\n" + "\tadds r0, 0x9F\n" + "\tstrb r2, [r0]\n" + "\tldr r0, [r4]\n" + "\tmovs r1, 0x1A\n" + "\tldrsh r0, [r0, r1]\n" + "\tmovs r1, 0xC\n" + "\tbl sub_80095E4\n" + "\tadds r0, 0x2\n" + "\tlsls r0, 16\n" + "\tldr r2, [r4]\n" + "\tldr r3, [r2, 0x34]\n" + "\tlsls r1, r3, 1\n" + "\tadds r1, r3\n" + "\tlsls r1, 3\n" + "\tadds r1, r2, r1\n" + "\tadds r1, 0x4A\n" + "\tasrs r3, r0, 16\n" + "\tlsrs r0, 16\n" + "\tstrh r0, [r1]\n" + "\tldr r1, [r2, 0x34]\n" + "\tlsls r0, r1, 1\n" + "\tadds r0, r1\n" + "\tlsls r0, 3\n" + "\tadds r2, r0\n" + "\tadds r3, 0x2\n" + "\tadds r2, 0x4C\n" + "\tstrh r3, [r2]\n" + "\tbl ResetUnusedInputStruct\n" + "\tldr r0, [r4]\n" + "\tadds r0, 0x3C\n" + "\tmovs r1, 0x1\n" + "\tmovs r2, 0x1\n" + "\tbl sub_800641C\n" + "\tpop {r4}\n" + "\tpop {r0}\n" + "\tbx r0\n" + "\t.align 2, 0\n" + "_0801A0D4: .4byte gUnknown_203B214"); +} +#endif // NONMATCHING + +void sub_801A0D8(void) +{ + BulkItem *heldItem; + s32 buyPrice; + s32 y; + s32 index; + u8 auStack204[80]; + struct unkStruct_8090F58 local_7c; + u8 auStack112[80]; + Item item; + u8 temp_calc; + + sub_8008C54(gUnknown_203B214->unk34); + sub_80073B8(gUnknown_203B214->unk34); + xxx_call_draw_string((gUnknown_203B214->input.unk1E * 8) + 10, 0, sGoods, gUnknown_203B214->unk34, 0); + + for (index = 0; index < gUnknown_203B214->input.unk1A; index++) { + temp_calc = (gUnknown_203B214->input.unk1E * gUnknown_203B214->input.unk1C) + index; + heldItem = GetKecleonShopItem(temp_calc); + item.id = heldItem->id; + item.quantity = heldItem->quantity; + item.flags = (ITEM_FLAG_EXISTS | ITEM_FLAG_IN_SHOP); + local_7c.unk0 = 1; + local_7c.unk4 = 0; + local_7c.unk6 = 88; + local_7c.unk8 = 1; + sub_8090E14(auStack204, &item, &local_7c); + buyPrice = GetStackBuyPrice(&item); + + if (buyPrice <= gTeamInventoryRef->teamMoney) { + y = sub_8013800(&gUnknown_203B214->input, index); + xxx_call_draw_string(8, y, auStack204, gUnknown_203B214->unk34, 0); + } + else { + sprintfStatic(auStack112, sFmtRed, auStack204); + y = sub_8013800(&gUnknown_203B214->input, index); + xxx_call_draw_string(8, y, auStack112, gUnknown_203B214->unk34, 0); + } + } + + sub_80073E0(gUnknown_203B214->unk34); +} \ No newline at end of file diff --git a/src/kecleon_bros3.c b/src/kecleon_bros3.c new file mode 100644 index 000000000..eae57a0ae --- /dev/null +++ b/src/kecleon_bros3.c @@ -0,0 +1,225 @@ +#include "global.h" +#include "code_800D090.h" +#include "code_80118A4.h" +#include "constants/input.h" +#include "items.h" +#include "kecleon_bros3.h" +#include "memory.h" +#include "menu_input.h" +#include "text1.h" +#include "text2.h" + +static EWRAM_DATA_2 unkStruct_203B21C *gUnknown_203B21C = {0}; +static EWRAM_DATA_2 u16 gUnknown_203B220 = {0}; + +#include "data/kecleon_bros3.h" + +static void sub_801A430(void); + +u8 sub_801A20C(u32 r0) +{ + if (CountKecleonWareItems() == 0) + return 0; + + gUnknown_203B21C = MemoryAlloc(sizeof(unkStruct_203B21C), 8); + gUnknown_203B21C->unk34 = r0; + gUnknown_203B21C->unk38 = &gUnknown_203B21C->unk3C[gUnknown_203B21C->unk34]; + sub_8006518(gUnknown_203B21C->unk3C); + gUnknown_203B21C->unk3C[gUnknown_203B21C->unk34] = sUnknown_80DB914; + gUnknown_203B21C->unk38->unk14 = gUnknown_203B21C->unk9C; + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B21C->unk3C, TRUE, TRUE); + sub_8013818(&gUnknown_203B21C->input, CountKecleonWareItems(), 10, r0); + gUnknown_203B21C->input.menuIndex = gUnknown_203B220; + sub_8013984(&gUnknown_203B21C->input); + sub_801A430(); + sub_801A4A4(); + return TRUE; +} + +u32 sub_801A2A8(bool8 r0) +{ + Item slot; + BulkItem *item; + + if (!r0) { + sub_8013660(&gUnknown_203B21C->input); + return 0; + } + + switch (GetKeyPress(&gUnknown_203B21C->input)) { + case INPUT_B_BUTTON: + PlayMenuSoundEffect(1); + return 2; + case INPUT_A_BUTTON: + item = GetKecleonWareItem(sub_801A37C()); + + slot.id = item->id; + slot.quantity = item->quantity; + + if (GetStackBuyPrice(&slot) > gTeamInventoryRef->teamMoney) + PlayMenuSoundEffect(2); + else + PlayMenuSoundEffect(0); + return 3; + case INPUT_START_BUTTON: + PlayMenuSoundEffect(4); + return 4; + default: + if (sub_80138B8(&gUnknown_203B21C->input, 1) != 0) { + sub_801A430(); + sub_801A4A4(); + return 1; + } + return 0; + } +} + +u8 sub_801A37C(void) +{ + return (gUnknown_203B21C->input.unk1E * gUnknown_203B21C->input.unk1C) + gUnknown_203B21C->input.menuIndex; +} + +void sub_801A398(bool8 r0) +{ + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B21C->unk3C, FALSE, FALSE); + gUnknown_203B21C->input.unk22 = CountKecleonWareItems(); + sub_8013984(&gUnknown_203B21C->input); + sub_801A430(); + sub_801A4A4(); + if (r0) + AddMenuCursorSprite(&gUnknown_203B21C->input); +} + +void sub_801A3DC(void) +{ + if (gUnknown_203B21C != NULL) { + gUnknown_203B220 = gUnknown_203B21C->input.menuIndex; + gUnknown_203B21C->unk3C[gUnknown_203B21C->unk34] = sUnknown_80DB8FC; + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B21C->unk3C, TRUE, TRUE); + MemoryFree(gUnknown_203B21C); + gUnknown_203B21C = NULL; + } +} + +#if NONMATCHING // sub_80095E4 memes https://decomp.me/scratch/L78xC +static void sub_801A430(void) +{ + s16 val; + + gUnknown_203B21C->unk9C[0] = gUnknown_203B21C->input.unk20; + gUnknown_203B21C->unk9C[1] = gUnknown_203B21C->input.unk1E; + gUnknown_203B21C->unk9C[2] = 10; + gUnknown_203B21C->unk9C[3] = 0; + + val = sub_80095E4(gUnknown_203B21C->input.unk1A, 12) + 2; + gUnknown_203B21C->unk3C[gUnknown_203B21C->unk34].unkE = val; + gUnknown_203B21C->unk3C[gUnknown_203B21C->unk34].unk10 = val + 2; + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B21C->unk3C, TRUE, TRUE); +} +#else +NAKED +static void sub_801A430(void) +{ + asm_unified("\tpush {r4,lr}\n" + "\tldr r4, _0801A4A0\n" + "\tldr r0, [r4]\n" + "\tldrh r1, [r0, 0x20]\n" + "\tadds r0, 0x9C\n" + "\tmovs r2, 0\n" + "\tstrb r1, [r0]\n" + "\tldr r0, [r4]\n" + "\tldrh r1, [r0, 0x1E]\n" + "\tadds r0, 0x9D\n" + "\tstrb r1, [r0]\n" + "\tldr r0, [r4]\n" + "\tadds r0, 0x9E\n" + "\tmovs r1, 0xA\n" + "\tstrb r1, [r0]\n" + "\tldr r0, [r4]\n" + "\tadds r0, 0x9F\n" + "\tstrb r2, [r0]\n" + "\tldr r0, [r4]\n" + "\tmovs r1, 0x1A\n" + "\tldrsh r0, [r0, r1]\n" + "\tmovs r1, 0xC\n" + "\tbl sub_80095E4\n" + "\tadds r0, 0x2\n" + "\tlsls r0, 16\n" + "\tldr r2, [r4]\n" + "\tldr r3, [r2, 0x34]\n" + "\tlsls r1, r3, 1\n" + "\tadds r1, r3\n" + "\tlsls r1, 3\n" + "\tadds r1, r2, r1\n" + "\tadds r1, 0x4A\n" + "\tasrs r3, r0, 16\n" + "\tlsrs r0, 16\n" + "\tstrh r0, [r1]\n" + "\tldr r1, [r2, 0x34]\n" + "\tlsls r0, r1, 1\n" + "\tadds r0, r1\n" + "\tlsls r0, 3\n" + "\tadds r2, r0\n" + "\tadds r3, 0x2\n" + "\tadds r2, 0x4C\n" + "\tstrh r3, [r2]\n" + "\tbl ResetUnusedInputStruct\n" + "\tldr r0, [r4]\n" + "\tadds r0, 0x3C\n" + "\tmovs r1, 0x1\n" + "\tmovs r2, 0x1\n" + "\tbl sub_800641C\n" + "\tpop {r4}\n" + "\tpop {r0}\n" + "\tbx r0\n" + "\t.align 2, 0\n" +"_0801A4A0: .4byte gUnknown_203B21C"); +} +#endif // NONMATCHING + +void sub_801A4A4(void) +{ + BulkItem *heldItem; + s32 buyPrice; + s32 y; + s32 index; + u8 buffer1[80]; + struct unkStruct_8090F58 local_7c; + u8 buffer2[80]; + Item item; + u8 temp_calc; + + sub_8008C54(gUnknown_203B21C->unk34); + sub_80073B8(gUnknown_203B21C->unk34); + xxx_call_draw_string(gUnknown_203B21C->input.unk1E * 8 + 10, 0, sGoods, gUnknown_203B21C->unk34, 0); + + for (index = 0; index < gUnknown_203B21C->input.unk1A; index++) { + temp_calc = (gUnknown_203B21C->input.unk1E * gUnknown_203B21C->input.unk1C) + index; + heldItem = GetKecleonWareItem(temp_calc); + item.id = heldItem->id; + item.quantity = heldItem->quantity; + item.flags = (ITEM_FLAG_EXISTS | ITEM_FLAG_IN_SHOP); + local_7c.unk0 = 1; + local_7c.unk4 = 0; + local_7c.unk6 = 88; + local_7c.unk8 = 1; + sub_8090E14(buffer1, &item, &local_7c); + buyPrice = GetStackBuyPrice(&item); + + if (buyPrice <= gTeamInventoryRef->teamMoney) { + y = sub_8013800(&gUnknown_203B21C->input, index); + xxx_call_draw_string(8, y, buffer1, gUnknown_203B21C->unk34, 0); + } + else { + sprintfStatic(buffer2, sFmtRed, buffer1); + y = sub_8013800(&gUnknown_203B21C->input, index); + xxx_call_draw_string(8, y, buffer2, gUnknown_203B21C->unk34, 0); + } + } + + sub_80073E0(gUnknown_203B21C->unk34); +} \ No newline at end of file diff --git a/src/kecleon_bros4.c b/src/kecleon_bros4.c new file mode 100644 index 000000000..eefd235df --- /dev/null +++ b/src/kecleon_bros4.c @@ -0,0 +1,431 @@ +#include "global.h" +#include "code_800D090.h" +#include "code_80118A4.h" +#include "code_80130A8.h" +#include "code_8098BDC.h" +#include "constants/input.h" +#include "items.h" +#include "kecleon_bros4.h" +#include "memory.h" +#include "menu_input.h" +#include "text1.h" +#include "text2.h" + +extern u8 gUnknown_202DE58[]; + +static EWRAM_DATA_2 unkStruct_203B224 *gUnknown_203B224 = {0}; +static EWRAM_DATA_2 u16 gUnknown_203B228 = {0}; +static EWRAM_DATA_2 u16 gUnknown_203B22A = {0}; + +#include "data/kecleon_bros4.h" + +static void SortInventoryItems(void); + +static void sub_801A998(void); +static s32 sub_801AE24(u32); + +bool8 sub_801A5D8(u32 param_1, s32 param_2, UnkTextStruct2_sub *param_3, u32 param_4) +{ + if (GetNumberOfFilledInventorySlots() == 0) + return FALSE; + + if (gUnknown_203B224 == NULL) + gUnknown_203B224 = MemoryAlloc(sizeof(unkStruct_203B224), 8); + + gUnknown_203B224->unk0 = param_1; + FillInventoryGaps(); + sub_801AE84(); + gUnknown_203B224->unk88 = param_2; + gUnknown_203B224->unk8C = &gUnknown_203B224->unk90[param_2]; + sub_8006518(gUnknown_203B224->unk90); + gUnknown_203B224->unk90[gUnknown_203B224->unk88] = sUnknown_80DB95C; + gUnknown_203B224->unk8C->unk14 = gUnknown_203B224->unkF0; + + if (param_3 != NULL) + gUnknown_203B224->unk90[gUnknown_203B224->unk88].unk8 = *param_3; + + sub_8012D08(gUnknown_203B224->unk8C, param_4); + sub_8099690(1); + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B224->unk90, TRUE, TRUE); + sub_8013818(&gUnknown_203B224->input, GetNumberOfFilledInventorySlots(), param_4, param_2); + gUnknown_203B224->input.menuIndex = gUnknown_203B228; + gUnknown_203B224->input.unk1E = gUnknown_203B22A; + sub_8013984(&gUnknown_203B224->input); + sub_801A998(); + sub_801A9E0(); + return TRUE; +} + +u32 sub_801A6E8(bool8 param_1) +{ + s32 index; + Item item; + + if (param_1 == FALSE) { + sub_8013660(&gUnknown_203B224->input); + return 0; + } + + switch (GetKeyPress(&gUnknown_203B224->input)) { + case INPUT_B_BUTTON: + PlayMenuSoundEffect(1); + return 2; + case INPUT_A_BUTTON: + switch (gUnknown_203B224->unk0) { + case 0: + case 1: + case 2: + if (gUnknown_203B224->unk4[sub_801A8AC()] != 0) + PlayMenuSoundEffect(2); + else + PlayMenuSoundEffect(0); + break; + case 3: + if (sub_801AEA8() != 0 || sub_801ADA0(sub_801A8AC())) + PlayMenuSoundEffect(0); + else + PlayMenuSoundEffect(2); + break; + case 4: + item = gTeamInventoryRef->teamItems[sub_801A8AC()]; + + if (CanSellItem(item.id) && GetStackSellPrice(&item) + gTeamInventoryRef->teamMoney <= MAX_TEAM_MONEY) + PlayMenuSoundEffect(0); + else + PlayMenuSoundEffect(2); + break; + case 5: + PlayMenuSoundEffect(0); + break; + } + return 3; + case INPUT_START_BUTTON: + PlayMenuSoundEffect(4); + return 4; + case INPUT_L_BUTTON: + case INPUT_R_BUTTON: + if (gUnknown_203B224->unk0 != 3) + goto _0801A87C; + + index = sub_801A8AC(); + if (gUnknown_203B224->unk4[index] != 0 || sub_801ADA0(index)) { + PlayMenuSoundEffect(6); + gUnknown_203B224->unk4[index] ^= 1; + sub_80138B8(&gUnknown_203B224->input, 0); + sub_801A9E0(); + return 1; + } + + PlayMenuSoundEffect(2); + goto _0801A87C; + case INPUT_SELECT_BUTTON: + if (gUnknown_203B224->unk0 != 2) { + PlayMenuSoundEffect(5); + SortInventoryItems(); + sub_801A9E0(); + } + // NOTE: fallthrough needed here + default: + _0801A87C: + if (sub_80138B8(&gUnknown_203B224->input, 1) != FALSE) { + sub_801A998(); + sub_801A9E0(); + return 1; + } + else + return 0; + break; + } +} + +s32 sub_801A8AC(void) +{ + return (gUnknown_203B224->input.unk1E * gUnknown_203B224->input.unk1C) + gUnknown_203B224->input.menuIndex; +} + +void sub_801A8D0(bool8 r0) +{ + sub_8099690(1); + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B224->unk90, FALSE, FALSE); + FillInventoryGaps(); + gUnknown_203B224->input.unk22 = GetNumberOfFilledInventorySlots(); + sub_8013984(&gUnknown_203B224->input); + sub_801A998(); + sub_801A9E0(); + if (r0) + AddMenuCursorSprite(&gUnknown_203B224->input); +} + +void sub_801A928(void) +{ + if (gUnknown_203B224 != NULL) { + gUnknown_203B228 = gUnknown_203B224->input.menuIndex; + gUnknown_203B22A = gUnknown_203B224->input.unk1E; + gUnknown_203B224->unk90[gUnknown_203B224->unk88] = sUnknown_80DB944; + sub_8099690(0); + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B224->unk90, TRUE, TRUE); + MemoryFree(gUnknown_203B224); + gUnknown_203B224 = NULL; + } +} + +static void sub_801A998(void) +{ + gUnknown_203B224->unkF0[0] = gUnknown_203B224->input.unk20; + gUnknown_203B224->unkF0[1] = gUnknown_203B224->input.unk1E; + gUnknown_203B224->unkF0[2] = 11; + gUnknown_203B224->unkF0[3] = 0; + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B224->unk90, TRUE, TRUE); +} + +void sub_801A9E0(void) +{ + s32 teamItemIndex; + s32 r7; + s32 x; + u8 buf1[80]; // sp4 + Item item; // spC8 + + sub_8008C54(gUnknown_203B224->unk88); + sub_80073B8(gUnknown_203B224->unk88); + x = gUnknown_203B224->input.unk1E * 8 + 10; + + if (gUnknown_203B224->input.unk1E == 0) + xxx_call_draw_string(x, 0, sTeamToolboxA, gUnknown_203B224->unk88, 0); + else + xxx_call_draw_string(x, 0, sTeamToolboxB, gUnknown_203B224->unk88, 0); + + for (r7 = 0; r7 < gUnknown_203B224->input.unk1A; r7++) { + teamItemIndex = (gUnknown_203B224->input.unk1E * gUnknown_203B224->input.unk1C) + r7; + item = gTeamInventoryRef->teamItems[teamItemIndex]; + + switch (gUnknown_203B224->unk0) { + case 0: { + sub_8090E14(buf1, &item, 0); + xxx_call_draw_string(8, sub_8013800(&gUnknown_203B224->input, r7), buf1, gUnknown_203B224->unk88, 0); + break; + } + case 1: + case 2: { + struct unkStruct_8090F58 thing; // sp54 + + thing.unk0 = 0; + thing.unk4 = 0; + thing.unk8 = 1; + item.flags = 1; + sub_8090E14(buf1, &item, &thing); + + xxx_call_draw_string(8, sub_8013800(&gUnknown_203B224->input, r7), buf1, gUnknown_203B224->unk88, 0); + break; + } + case 3: { + struct unkStruct_8090F58 thing; // sp60 + + thing.unk0 = 0; + thing.unk4 = 0; + thing.unk8 = 1; + item.flags = 1; + sub_8090E14(buf1, &item, &thing); + + if (gUnknown_203B224->unk4[teamItemIndex] != 0 || sub_801ADA0(teamItemIndex)) + xxx_call_draw_string(8,sub_8013800(&gUnknown_203B224->input,r7), buf1, gUnknown_203B224->unk88, 0); + else { + strncpy(gUnknown_202DE58, buf1, 80); + xxx_format_and_draw(8, sub_8013800(&gUnknown_203B224->input, r7), sFmtMoveItem0, gUnknown_203B224->unk88, 0); + } + break; + } + case 4: { + struct unkStruct_8090F58 thing; // sp6C + u8 buf2[80]; // sp78 + + if (CanSellItem(item.id)) { + thing.unk0 = 3; + thing.unk4 = 0; + thing.unk6 = 88; + thing.unk8 = 1; + item.flags = 3; + sub_8090E14(buf1, &item, &thing); + + if (GetStackSellPrice(&item) + gTeamInventoryRef->teamMoney > MAX_TEAM_MONEY) { + sprintfStatic(buf2, sFmtRed, buf1); + xxx_call_draw_string(8, sub_8013800(&gUnknown_203B224->input, r7), buf2, gUnknown_203B224->unk88, 0); + } + else + xxx_call_draw_string(8, sub_8013800(&gUnknown_203B224->input, r7), buf1, gUnknown_203B224->unk88, 0); + } + else { + sub_8090E14(buf1, &item, 0); + strncpy(gUnknown_202DE58, buf1, 80); + xxx_format_and_draw(8, sub_8013800(&gUnknown_203B224->input, r7), sFmtMoveItem0, gUnknown_203B224->unk88, 0); + } + break; + } + case 5: { + UNUSED struct unkStruct_8090F58 thingUnused; // sp6C + struct unkStruct_8090F58 thing; // sp78 + + thing.unk0 = 0; + thing.unk4 = 0; + thing.unk8 = 1; + item.flags = 1; + sub_8090E14(buf1, &item, &thing); + + if (IsGummiItem(item.id)) + xxx_call_draw_string(8, sub_8013800(&gUnknown_203B224->input, r7), buf1, gUnknown_203B224->unk88, 0); + else { + strncpy(gUnknown_202DE58, buf1, 80); + xxx_format_and_draw(8, sub_8013800(&gUnknown_203B224->input, r7), sFmtMoveItem0, gUnknown_203B224->unk88, 0); + } + break; + } + } + + if (sub_801AED0(teamItemIndex) & 1) + sub_8007B7C(gUnknown_203B224->unk88, 8, sub_8013800(&gUnknown_203B224->input, r7), (gUnknown_203B224->unk8C->unkC - 2) * 8, 10); + } + + sub_80073E0(gUnknown_203B224->unk88); +} + +void sub_801AD34(u32 param_1) +{ + sub_8008C54(param_1); + sub_80073B8(param_1); + xxx_call_draw_string(6, 0, sItems, param_1, 0); + sub_8012BC4(18, 13, GetNumberOfFilledInventorySlots(), 2, 7, param_1); + xxx_call_draw_string(22, 13, sSlash, param_1, 0); + sub_8012BC4(43, 13, INVENTORY_SIZE, 2, 7, param_1); + sub_80073E0(param_1); +} + +bool8 sub_801ADA0(s32 param_1) +{ + u16 uVar2; + u32 uVar2_32; + + u16 uVar3; + u32 uVar3_32; + s32 sum1; + s32 sum2; + Item item; + + item = gTeamInventoryRef->teamItems[param_1]; + if (!IsNotMoneyOrUsedTMItem(item.id)) + return FALSE; + + if (IsThrowableItem(item.id)) { + uVar3_32 = sub_801AE24(item.id); + sum1 = gTeamInventoryRef->teamStorage[item.id]; + uVar3 = uVar3_32; + sum1 += uVar3; + sum1 += (item.quantity); + if (sum1 > 999) + return FALSE; + } + else { + uVar2_32 = sub_801AE24(item.id); + sum2 = gTeamInventoryRef->teamStorage[item.id]; + uVar2 = uVar2_32; + sum2 += uVar2; + if (sum2 > 998) + return FALSE; + } + return 1; +} + +static s32 sub_801AE24(u32 itemID) +{ + Item item; + u16 count; + s32 invIndex; + + count = 0; + for (invIndex = 0; invIndex < GetNumberOfFilledInventorySlots(); invIndex++) { + if (gUnknown_203B224->unk4[invIndex] != 0) { + item = gTeamInventoryRef->teamItems[invIndex]; + + if (item.id == itemID) { + if (IsThrowableItem(item.id)) + count += item.quantity; + else + count++; + } + } + } + return count; +} + +void sub_801AE84(void) +{ + s32 index; + + for (index = 0; index < INVENTORY_SIZE; index++) + gUnknown_203B224->unk4[index] = 0; +} + +s32 sub_801AEA8(void) +{ + s32 index; + s32 count; + + count = 0; + for (index = 0; index < INVENTORY_SIZE; index++) { + if (gUnknown_203B224->unk4[index] != 0) + count++; + } + return count; +} + +s32 sub_801AED0(s32 index) +{ + return gUnknown_203B224->unk4[index]; +} + +void sub_801AEE4(s32 index, s32 value) +{ + gUnknown_203B224->unk4[index] = value; +} + +static void SortInventoryItems(void) +{ + Item *itemSlotR; + u32 *itemIDR; + u32 *base; + s32 orderL; + s32 orderR; + u32 itemIDL; + Item itemSlotL; + s32 itemR; + s32 itemL; + + for (itemL = 0; itemL < GetNumberOfFilledInventorySlots() - 1; itemL++) { + for (itemR = itemL + 1; itemR < GetNumberOfFilledInventorySlots(); itemR++) { + orderL = GetItemOrder(gTeamInventoryRef->teamItems[itemL].id); + orderR = GetItemOrder(gTeamInventoryRef->teamItems[itemR].id); + + if (orderL > orderR + || (orderL == orderR && gTeamInventoryRef->teamItems[itemL].quantity < gTeamInventoryRef->teamItems[itemR].quantity)) { + itemSlotL = gTeamInventoryRef->teamItems[itemL]; + itemSlotR = &gTeamInventoryRef->teamItems[itemR]; + gTeamInventoryRef->teamItems[itemL] = *itemSlotR; + *itemSlotR = itemSlotL; + + base = gUnknown_203B224->unk4; + itemIDL = gUnknown_203B224->unk4[itemL]; + itemIDR = &base[itemR]; + base[itemL] = *itemIDR; + *itemIDR = itemIDL; + } + } + } +} + +UNUSED static unkStruct_203B224 *sub_801AF98(void) +{ + return gUnknown_203B224; +} \ No newline at end of file diff --git a/src/load_screen.c b/src/load_screen.c index 7c13ffa90..9cec7ca26 100644 --- a/src/load_screen.c +++ b/src/load_screen.c @@ -1,20 +1,22 @@ #include "global.h" -#include "constants/wonder_mail.h" -#include "input.h" -#include "main_menu.h" -#include "play_time.h" -#include "file_system.h" -#include "memory.h" -#include "menu.h" -#include "text1.h" -#include "text2.h" -#include "text_util.h" -#include "pokemon.h" -#include "save.h" +#include "bg_palette_buffer.h" #include "code_800D090.h" #include "code_8094F88.h" -#include "menu_input.h" +#include "code_8097670.h" +#include "constants/wonder_mail.h" #include "event_flag.h" +#include "file_system.h" +#include "input.h" +#include "main_menu.h" +#include "memory.h" +#include "menu.h" +#include "menu_input.h" +#include "play_time.h" +#include "pokemon.h" +#include "save.h" +#include "text_util.h" +#include "text1.h" +#include "text2.h" extern const struct FileArchive gTitleMenuFileArchive; @@ -22,8 +24,8 @@ struct LoadScreen { // size: 0x27c u32 currMenu; - struct MenuStruct unk4[4]; - struct UnkTextStruct2 unk144[4]; + MenuStruct unk4[4]; + UnkTextStruct2 unk144[4]; /* 0x1A4 */ u8 formattedTeamName[0x24]; /* 0x1C8 */ u8 formattedPlayerName[0x24]; /* 0x1EC */ u8 formattedLocation[0x24]; @@ -33,29 +35,23 @@ struct LoadScreen }; EWRAM_DATA_2 struct LoadScreen *gLoadScreen = {0}; -EWRAM_DATA_2 struct MenuItem gUnknown_203B378[2] = {0}; +EWRAM_DATA_2 MenuItem gUnknown_203B378[2] = {0}; EWRAM_DATA_2 u32 gUnknown_203B388[12] = {0}; EWRAM_DATA_2 u32 gUnknown_203B3B8[12] = {0}; -extern struct unkStruct_203B484 *gUnknown_203B484; +extern unkStruct_203B484 *gUnknown_203B484; u8 IsQuickSave(void); void DrawLoadScreenText(void); void sub_80397B4(void); extern void sub_80920D8(u8 *); -extern struct PokemonStruct *GetPlayerPokemonStruct(void); extern u8 *sub_8098FB4(); -extern u8 *GetDungeonLocationInfo(void); -extern u32 GetNumAdventures(void); -extern void PrintDungeonLocationtoBuffer(u8 *, u8 *); -extern u32 sub_8001658(u32, u32); +extern void PrintDungeonLocationtoBuffer(u8 *, DungeonLocation *); extern void xxx_format_string(u8 *, u8 *, u8 *, u32); -extern void SetBGPaletteBufferColorArray(s32, s32); - -const struct UnkTextStruct2 gUnknown_80E75F8 = { +const UnkTextStruct2 gUnknown_80E75F8 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, @@ -64,7 +60,7 @@ const struct UnkTextStruct2 gUnknown_80E75F8 = { NULL }; -const struct UnkTextStruct2 gUnknown_80E7610 = { +const UnkTextStruct2 gUnknown_80E7610 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x02, @@ -75,7 +71,7 @@ const struct UnkTextStruct2 gUnknown_80E7610 = { const u8 gUnkData_80E7628[] = {0x20, 0x00, 0x00, 0x00}; -const struct UnkTextStruct2 gUnknown_80E762C = { +const UnkTextStruct2 gUnknown_80E762C = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x0F, @@ -84,42 +80,42 @@ const struct UnkTextStruct2 gUnknown_80E762C = { NULL }; -const struct MenuItem gResumeQuicksaveMenuItems[3] = +const MenuItem gResumeQuicksaveMenuItems[3] = { {"Resuming from quicksave.", 5}, {"Is that OK?", 5}, {NULL, 3}, }; -const struct MenuItem gResumeAdventureMenuItems[3] = +const MenuItem gResumeAdventureMenuItems[3] = { {"Resuming saved adventure.", 5}, {"Is that OK?", 5}, {NULL, 3}, }; -const struct MenuItem gQuitWaitingRescueMenuItems[3] = +const MenuItem gQuitWaitingRescueMenuItems[3] = { {"Quit awaiting rescue?", 5}, {"Is that OK?", 5}, {NULL, 3}, }; -const struct MenuItem gDeleteSavePromptMenuItems[3] = +const MenuItem gDeleteSavePromptMenuItems[3] = { {"Your saved data will be", 5}, {"deleted. Is that OK?", 5}, {NULL, 3}, }; -const struct MenuItem gDeleteSaveConfirmMenuItems[3] = +const MenuItem gDeleteSaveConfirmMenuItems[3] = { {"Are you sure you want to", 5}, {"delete all of your saved data?", 5}, {NULL, 3}, }; -const struct UnkTextStruct2 gUnknown_80E7784 = +const UnkTextStruct2 gUnknown_80E7784 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -129,7 +125,7 @@ const struct UnkTextStruct2 gUnknown_80E7784 = NULL }; -const struct MenuItem gLoadScreenYesNoMenu[3] = +const MenuItem gLoadScreenYesNoMenu[3] = { {"Yes", 1}, {"No", 2}, @@ -167,7 +163,7 @@ void CreateLoadScreen(u32 currMenu) gLoadScreen->unk144[index] = gUnknown_80E75F8; } ResetUnusedInputStruct(); - sub_800641C(gLoadScreen->unk144,1,1); + sub_800641C(gLoadScreen->unk144, TRUE, TRUE); SetMenuItems(gLoadScreen->unk4,gLoadScreen->unk144,0,&gUnknown_80E7610,gUnknown_203B378,0,6,0); switch(gLoadScreen->currMenu){ case MENU_CONTINUE: @@ -196,7 +192,7 @@ void CreateLoadScreen(u32 currMenu) void CleanLoadScreen(void) { ResetUnusedInputStruct(); - sub_800641C(NULL, 1, 1); + sub_800641C(NULL, TRUE, TRUE); if(gLoadScreen != NULL) { MemoryFree(gLoadScreen); @@ -265,8 +261,8 @@ void DrawLoadScreenText(void) u32 hours; u32 minutes; u32 seconds; - struct PokemonStruct *playerInfo; - struct unkStruct_203B484 *temp2; + PokemonStruct1 *playerInfo; + unkStruct_203B484 *temp2; u8 *r2; iVar2 = sub_8011FA8(); @@ -373,16 +369,16 @@ void DrawLoadScreenText(void) // TODO clean up but it matches so yea void sub_80397B4(void) { - struct OpenedFile *clmkFile; - int index; - int x; + OpenedFile *clmkFile; + s32 index; + s32 x; s32 y; clmkFile = OpenFileAndGetFileDataPtr(gClmkpatFileName,&gTitleMenuFileArchive); // clmkpat for(index = 0; index < 64; index++) { - SetBGPaletteBufferColorArray(index + 176,*(int *)((clmkFile->data) + 4) + index * 4); + SetBGPaletteBufferColorArray(index + 176, (u8 *)(*(s32 *)((clmkFile->data) + 4) + index * 4)); } x = 8; @@ -401,7 +397,7 @@ void sub_80397B4(void) bool8 IsQuickSave(void) { - int iVar1; + s32 iVar1; bool8 isQuicksave; iVar1 = sub_8011FA8(); diff --git a/src/luminous_cave.c b/src/luminous_cave.c index 2ed6da597..16d357ca2 100644 --- a/src/luminous_cave.c +++ b/src/luminous_cave.c @@ -1,175 +1,65 @@ #include "global.h" +#include "code_80118A4.h" +#include "code_8012A18_1.h" +#include "code_80130A8.h" +#include "code_80130A8.h" +#include "code_801B3C0.h" +#include "code_8097670.h" +#include "code_8098BDC.h" #include "constants/bg_music.h" #include "constants/colors.h" #include "constants/evolution_status.h" #include "input.h" -#include "item.h" +#include "kecleon_bros4.h" +#include "luminous_cave.h" #include "memory.h" +#include "menu_input.h" #include "pokemon.h" -#include "pokemon_3.h" #include "random.h" +#include "text_util.h" #include "text1.h" #include "text2.h" -#include "text_util.h" -#include "team_inventory.h" -#include "menu_input.h" -#include "kecleon_bros.h" -#include "code_80130A8.h" -#include "code_8012A18_1.h" -#include "code_801B3C0.h" -#include "code_80118A4.h" -#include "luminous_cave.h" + +extern u8 gAvailablePokemonNames[]; // 202DF98 +extern u8 gPlayerName[]; // 202E2B8 EWRAM_DATA_2 struct unkStruct_203B2B0 *gUnknown_203B2B0 = {0}; -extern struct UnkTextStruct2 gUnknown_80DCA00; -extern struct UnkTextStruct2 gUnknown_80DC9E8; -extern u8 gPlayerName[]; -extern u8 gAvailablePokemonNames[]; -extern u8 gUnknown_202DFE8[]; -extern u8 *gUnknown_80D4970[]; -extern u8 *gUnknown_80D4934[]; +// data_80D47B8.s +extern const u8 *gUnknown_80D4934[]; +extern const u8 *gUnknown_80D4970[]; +extern const UnkTextStruct2 gUnknown_80DC9E8; +extern const UnkTextStruct2 gUnknown_80DCA00; +extern const u8 gUnknown_80DCA18[]; +extern const u8 gUnknown_80DCA24[]; +extern const u8 gUnknown_80DCA2C[]; -extern u8 gUnknown_80DCA18[]; -extern u8 gUnknown_80DCA24[]; -extern u8 gUnknown_80DCA2C[]; +#include "data/luminous_cave.h" -ALIGNED(4) const u8 gLuminousCaveSeekAwakening[] = _( - "{CENTER_ALIGN}...{WAIT_PRESS}A voice emanates from somewhere...{EXTRA_MSG}" - "{CENTER_ALIGN}...Ye who seek awakening...{EXTRA_MSG}" - "{CENTER_ALIGN}This is Luminous Cave.{WAIT_PRESS}\n" - "{CENTER_ALIGN}Do ye seek a new evolution?"); +// code_8098BDC.s +extern void nullsub_104(void); -ALIGNED(4) const u8 gLuminousCaveAskEvolution[] = _( - "{CENTER_ALIGN}Do ye seek evolution?"); +static void LuminousCave_AdvancetoFallbackState(void); +static bool8 LuminousCave_HasOnly1Member(void); +static void UpdateLuminousCaveDialogue(void); +static void UpdateLuminousCaveState(u32); -ALIGNED(4) const u8 gLuminousCaveEvolutionInfo[] = _( - "{CENTER_ALIGN}There are those among Pokémon\n" - "{CENTER_ALIGN}that can evolve.{EXTRA_MSG}" - "{CENTER_ALIGN}Such Pokémon can evolve at this very\n" - "{CENTER_ALIGN}spot if they satisfy certain conditions.{EXTRA_MSG}" - "{CENTER_ALIGN}Evolution brings about changes\n" - "{CENTER_ALIGN}in appearance and abilities.{EXTRA_MSG}" - "{CENTER_ALIGN}Not only that{COMMA} some Pokémon even change\n" - "{CENTER_ALIGN}type and learn different moves.{EXTRA_MSG}" - "{CENTER_ALIGN}However...{WAIT_PRESS} The requirements for\n" - "{CENTER_ALIGN}evolution differ among Pokémon.{EXTRA_MSG}" - "{CENTER_ALIGN}Some become ready for evolution\n" - "{CENTER_ALIGN}merely by leveling up.{EXTRA_MSG}" - "{CENTER_ALIGN}Still others may need special items\n" - "{CENTER_ALIGN}to attain evolution.{EXTRA_MSG}" - "{CENTER_ALIGN}Ye must also be aware of this:{EXTRA_MSG}" - "{CENTER_ALIGN}Once it has evolved{COMMA} a Pokémon\n" - "{CENTER_ALIGN}can never regain its previous form.{EXTRA_MSG}" - "{CENTER_ALIGN}That is why ye must think carefully\n" - "{CENTER_ALIGN}before committing to evolution."); - -ALIGNED(4) const u8 gLuminousCaveYeShallReturn[] = _( - "{CENTER_ALIGN}Ye shall return if evolution\n" - "{CENTER_ALIGN}is what ye seek..."); - -ALIGNED(4) const u8 gLuminousCaveGiveItem[] = _( - "{CENTER_ALIGN}Will ye give an item for evolution?"); - -ALIGNED(4) const u8 gLuminousCaveGiveAnotherItem[] = _( - "{CENTER_ALIGN}Will ye give yet another item?"); - -ALIGNED(4) const u8 gLuminousCaveLackWhatIsNeeded[] = _( - "{CENTER_ALIGN}Alas{COMMA} ye seem to lack what is needed\n" - "{CENTER_ALIGN}for evolution."); - -ALIGNED(4) const u8 gLuminousCaveOnlyOneItem[] = _( - "{CENTER_ALIGN}Ye seem to have but one item."); - -ALIGNED(4) const u8 gLuminousCaveLetUsBegin[] = _( - "{CENTER_ALIGN}...Ye who seek awakening...\n" - "{CENTER_ALIGN}Let us begin."); - -ALIGNED(4) const u8 gLuminousCaveChangedAppearance[] = _( - "{CENTER_ALIGN}...{WAIT_PRESS}$n0 is undergoing changes...{EXTRA_MSG}" - "{CENTER_ALIGN}$n0{APOSTROPHE}s appearance changed...{EXTRA_MSG}"); - -ALIGNED(4) const u8 gLuminousCaveEvolved[] = _( - "{CENTER_ALIGN}It evolved from {COLOR_1 GREEN}{ARG_POKEMON_0}{END_COLOR_TEXT_1}\n" - "{CENTER_ALIGN}to {COLOR_1 YELLOW}{ARG_POKEMON_1}{END_COLOR_TEXT_1}!"); - -ALIGNED(4) const u8 gLuminousCaveComeAlone[] = _( - "{CENTER_ALIGN}...{EXTRA_MSG}" - "{CENTER_ALIGN}One cannot evolve if one\n" - "{CENTER_ALIGN}is in the company of others.{EXTRA_MSG}" - "{CENTER_ALIGN}Come alone if ye wish to evolve."); - -ALIGNED(4) const u8 gLuminousCaveLackLevel[] = _( - "{CENTER_ALIGN}...{EXTRA_MSG}" - "{CENTER_ALIGN}Ye cannot evolve yet.{EXTRA_MSG}" - "{CENTER_ALIGN}Ye have not high enough a level."); - -ALIGNED(4) const u8 gLuminousCaveCantEvolveAnymore[] = _( - "{CENTER_ALIGN}...{EXTRA_MSG}" - "{CENTER_ALIGN}Ye cannot evolve anymore."); - -ALIGNED(4) const u8 gLuminousCaveLackFriendArea[] = _( - "{CENTER_ALIGN}...{EXTRA_MSG}" - "{CENTER_ALIGN}Ye cannot evolve yet.{EXTRA_MSG}" - "{CENTER_ALIGN}Ye need your Friend Area to evolve."); - -ALIGNED(4) const u8 gLuminousCaveLackRoom[] = _( - "{CENTER_ALIGN}...{EXTRA_MSG}" - "{CENTER_ALIGN}Ye cannot evolve yet.{EXTRA_MSG}" - "{CENTER_ALIGN}The Friend Area to which ye shall go\n" - "{CENTER_ALIGN}has no room for ye."); - -ALIGNED(4) const u8 gLuminousCaveLackIQ[] = _( - "{CENTER_ALIGN}...{EXTRA_MSG}" - "{CENTER_ALIGN}Ye cannot evolve yet.{EXTRA_MSG}" - "{CENTER_ALIGN}Ye seem to lack the IQ to evolve."); - -ALIGNED(4) const u8 gLuminousCaveLackItem[] = _( - "{CENTER_ALIGN}{CENTER_ALIGN}...{EXTRA_MSG}" - "{CENTER_ALIGN}Ye cannot evolve yet.{EXTRA_MSG}" - "{CENTER_ALIGN}Ye seem to lack an item to evolve."); - -ALIGNED(4) const u8 gLuminousCaveCantEvolveYet[] = _( - "{CENTER_ALIGN}{CENTER_ALIGN}...{EXTRA_MSG}" - "{CENTER_ALIGN}Ye cannot evolve yet. "); - -ALIGNED(4) const u8 gLuminousCaveGiveName[] = _( - "{CENTER_ALIGN}Ye must give a name to\n" - "{CENTER_ALIGN}the evolved Pokémon. "); - -ALIGNED(4) static const u8 fill0[] = "pksdir0"; -ALIGNED(4) static const u8 fill1[] = "pksdir0"; - -extern struct PokemonStruct *GetPlayerPokemonStruct(void); -extern void UpdateLuminousCaveState(u32); - -extern void sub_8024E9C(void); -extern void sub_8024F00(void); -extern void sub_8024FD4(void); -extern void sub_80250EC(void); -extern void sub_80251CC(void); -extern void sub_8024F70(void); -extern void sub_8025058(void); -extern void sub_802515C(void); -extern void sub_80251E8(void); -extern void sub_8025204(void); -extern void LuminousCave_AdvancetoFallbackState(void); -extern void sub_8024804(void); -extern void UpdateLuminousCaveDialogue(void); - -void sub_80977D0(void); -void sub_8024CFC(void); -void sub_8025254(void); -void sub_8024D48(void); -extern void nullsub_104(); -void sub_8024DBC(void); -void sub_8024E30(void); -void sub_801AEE4(u32, u32); -u32 sub_801602C(u32 r0, u8 *name); -extern s32 sub_80144A4(s32 *); -extern s32 sub_801A8AC(void); -extern void sub_8099690(u32); -bool8 LuminousCave_HasOnly1Member(void); +static void sub_8024804(void); +static void sub_8024CFC(void); +static void sub_8024D48(void); +static void sub_8024DBC(void); +static void sub_8024E30(void); +static void sub_8024E9C(void); +static void sub_8024F00(void); +static void sub_8024F70(void); +static void sub_8024FD4(void); +static void sub_8025058(void); +static void sub_80250EC(void); +static void sub_802515C(void); +static void sub_80251CC(void); +static void sub_80251E8(void); +static void sub_8025204(void); +static void sub_8025254(void); enum { @@ -198,72 +88,72 @@ enum u32 sub_802465C(void) { - struct OpenedFile *faceFile; + OpenedFile *faceFile; - ResetUnusedInputStruct(); - sub_800641C(0,1,1); - gUnknown_203B2B0 = MemoryAlloc(sizeof(struct unkStruct_203B2B0),8); - gUnknown_203B2B0->menuAction1 = 0; - gUnknown_203B2B0->menuAction2 = 0; - gUnknown_203B2B0->menuAction3 = 0; - gUnknown_203B2B0->pokeStruct = GetPlayerPokemonStruct(); - gUnknown_203B2B0->pokeRenamed = IsPokemonRenamed(gUnknown_203B2B0->pokeStruct); - gUnknown_203B2B0->evolutionComplete = FALSE; - faceFile = GetDialogueSpriteDataPtr(MONSTER_GULPIN); - gUnknown_203B2B0->unk104 = faceFile; - gUnknown_203B2B0->unk108 = faceFile->data; - gUnknown_203B2B0->unk110 = 0; - gUnknown_203B2B0->unk111 = 0; - gUnknown_203B2B0->unk112 = 0; - gUnknown_203B2B0->unk10C = 2; - gUnknown_203B2B0->unk10E = 8; - UpdateLuminousCaveState(LUMINOUS_CAVE_ENTRY); - return 1; + ResetUnusedInputStruct(); + sub_800641C(NULL, TRUE, TRUE); + gUnknown_203B2B0 = MemoryAlloc(sizeof(struct unkStruct_203B2B0), 8); + gUnknown_203B2B0->menuAction1 = 0; + gUnknown_203B2B0->menuAction2 = 0; + gUnknown_203B2B0->menuAction3 = 0; + gUnknown_203B2B0->pokeStruct = GetPlayerPokemonStruct(); + gUnknown_203B2B0->pokeRenamed = IsPokemonRenamed(gUnknown_203B2B0->pokeStruct); + gUnknown_203B2B0->evolutionComplete = FALSE; + faceFile = GetDialogueSpriteDataPtr(MONSTER_GULPIN); + gUnknown_203B2B0->unk104 = faceFile; + gUnknown_203B2B0->unk108 = faceFile->data; + gUnknown_203B2B0->unk110 = 0; + gUnknown_203B2B0->unk111 = 0; + gUnknown_203B2B0->unk112 = 0; + gUnknown_203B2B0->unk10C = 2; + gUnknown_203B2B0->unk10E = 8; + UpdateLuminousCaveState(LUMINOUS_CAVE_ENTRY); + return TRUE; } u32 sub_80246F0(void) { - switch(gUnknown_203B2B0->state) { - case LUMINOUS_CAVE_ENTRY: - case LUMINOUS_CAVE_ASK_EVOLVE: - sub_8024E9C(); - break; - case LUMINOUS_CAVE_GIVE_ITEM_1: - sub_8024F00(); - break; - case 6: - case 7: - sub_8024FD4(); - break; - case 8: - sub_80250EC(); - break; - case 9: - sub_80251CC(); - break; - case LUMINOUS_CAVE_GIVE_ITEM_2: - sub_8024F70(); - break; - case 0xb: - case 0xc: - sub_8025058(); - break; - case 0xd: - sub_802515C(); - break; - case 0xe: - sub_80251E8(); - break; - case LUMINOUS_CAVE_FINISH_NAME: - sub_8025204(); - break; - case 4: - return 3; - default: - LuminousCave_AdvancetoFallbackState(); - break; - } - return 0; + switch (gUnknown_203B2B0->state) { + case LUMINOUS_CAVE_ENTRY: + case LUMINOUS_CAVE_ASK_EVOLVE: + sub_8024E9C(); + break; + case LUMINOUS_CAVE_GIVE_ITEM_1: + sub_8024F00(); + break; + case 6: + case 7: + sub_8024FD4(); + break; + case 8: + sub_80250EC(); + break; + case 9: + sub_80251CC(); + break; + case LUMINOUS_CAVE_GIVE_ITEM_2: + sub_8024F70(); + break; + case 11: + case 12: + sub_8025058(); + break; + case 13: + sub_802515C(); + break; + case 14: + sub_80251E8(); + break; + case LUMINOUS_CAVE_FINISH_NAME: + sub_8025204(); + break; + case 4: + return 3; + default: + LuminousCave_AdvancetoFallbackState(); + break; + } + return 0; } bool8 HasEvolutionCompleted(void) @@ -273,245 +163,275 @@ bool8 HasEvolutionCompleted(void) void CleanLuminousCave(void) { - if(gUnknown_203B2B0 != NULL) - { + if (gUnknown_203B2B0 != NULL) { CloseFile(gUnknown_203B2B0->unk104); MemoryFree(gUnknown_203B2B0); gUnknown_203B2B0 = NULL; } } -void UpdateLuminousCaveState(u32 newState) +static void UpdateLuminousCaveState(u32 newState) { gUnknown_203B2B0->state = newState; sub_8024804(); UpdateLuminousCaveDialogue(); } -void sub_8024804(void) +static void sub_8024804(void) { - s32 index; + s32 i; - sub_8006518(gUnknown_203B2B0->unk114); - switch(gUnknown_203B2B0->state) { - case 8: - case 0xD: - gUnknown_203B2B0->unk114[2] = gUnknown_80DCA00; - break; - case LUMINOUS_CAVE_LET_US_BEGIN: - case LUMINOUS_CAVE_CHANGED_APPEARANCE: - case LUMINOUS_CAVE_EVOLVED: - case LUMINOUS_CAVE_COME_ALONE: - case LUMINOUS_CAVE_LACK_LEVEL: - case LUMINOUS_CAVE_CANT_EVOLVE_ANYMORE: - case LUMINOUS_CAVE_LACK_FRIEND_AREA: - case LUMINOUS_CAVE_LACK_ROOM: - case LUMINOUS_CAVE_LACK_IQ: - case LUMINOUS_CAVE_LACK_ITEM: - break; - default: - for(index = 0; index < 4; index++) - { - gUnknown_203B2B0->unk114[index] = gUnknown_80DC9E8; - } - break; - } - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2B0->unk114, 1, 1); + sub_8006518(gUnknown_203B2B0->unk114); + + switch (gUnknown_203B2B0->state) { + case 8: + case 13: + gUnknown_203B2B0->unk114[2] = gUnknown_80DCA00; + break; + case LUMINOUS_CAVE_LET_US_BEGIN: + case LUMINOUS_CAVE_CHANGED_APPEARANCE: + case LUMINOUS_CAVE_EVOLVED: + case LUMINOUS_CAVE_COME_ALONE: + case LUMINOUS_CAVE_LACK_LEVEL: + case LUMINOUS_CAVE_CANT_EVOLVE_ANYMORE: + case LUMINOUS_CAVE_LACK_FRIEND_AREA: + case LUMINOUS_CAVE_LACK_ROOM: + case LUMINOUS_CAVE_LACK_IQ: + case LUMINOUS_CAVE_LACK_ITEM: + break; + default: + for (i = 0; i < 4; i++) + gUnknown_203B2B0->unk114[i] = gUnknown_80DC9E8; + break; + } + + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B2B0->unk114, TRUE, TRUE); } -void UpdateLuminousCaveDialogue(void) +static void UpdateLuminousCaveDialogue(void) { - char *monName; + u8 *monName; - switch(gUnknown_203B2B0->state) { - case LUMINOUS_CAVE_ENTRY: - if (LuminousCave_HasOnly1Member()) { - gUnknown_203B2B0->menuAction1 = 3; - } - else { - gUnknown_203B2B0->menuAction1 = 1; - } - sub_8024CFC(); - sub_8014248(gLuminousCaveSeekAwakening,0,gUnknown_203B2B0->menuAction1,gUnknown_203B2B0->unk34,gUnknown_203B2B0->unk74,4,0,0,5); - break; - case LUMINOUS_CAVE_ASK_EVOLVE: - sub_8024CFC(); - sub_8014248(gLuminousCaveAskEvolution,0,gUnknown_203B2B0->menuAction1,gUnknown_203B2B0->unk34,gUnknown_203B2B0->unk74,4,0,0,5); - break; - case LUMINOUS_CAVE_EVOLVE_INFO: - gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_ASK_EVOLVE; - sub_80141B4(gLuminousCaveEvolutionInfo,0,0,0x105); - break; - case LUMINOUS_CAVE_SHALL_RETURN: - gUnknown_203B2B0->fallbackState = 4; - xxx_call_fade_in_new_bgm(MUS_FILE_SELECT,0x3c); - sub_80141B4(gLuminousCaveYeShallReturn,0,0,0x305); - break; + switch (gUnknown_203B2B0->state) { + case LUMINOUS_CAVE_ENTRY: + if (LuminousCave_HasOnly1Member()) + gUnknown_203B2B0->menuAction1 = 3; + else + gUnknown_203B2B0->menuAction1 = 1; - case LUMINOUS_CAVE_GIVE_ITEM_1: - sub_8024D48(); - sub_8014248(gLuminousCaveGiveItem,0,gUnknown_203B2B0->menuAction2,gUnknown_203B2B0->unk34,gUnknown_203B2B0->unk74,4,0,0,5); - break; - case 6: - sub_801A5D8(2,3,0,10); - break; - case 7: - sub_801A8D0(1); - break; - case LUMINOUS_CAVE_GIVE_ITEM_2: - sub_8024DBC(); - sub_8014248(gLuminousCaveGiveAnotherItem,0,gUnknown_203B2B0->menuAction2,gUnknown_203B2B0->unk34,gUnknown_203B2B0->unk74,4,0,0,5); - break; - case 0xb: - sub_801A5D8(2,3,0,10); - sub_801AEE4(gUnknown_203B2B0->evoItem1_InvIndex,1); - sub_801A9E0(); - break; - case 0xc: - sub_801A8D0(1); - sub_801AEE4(gUnknown_203B2B0->evoItem1_InvIndex,1); - sub_801A9E0(); - break; - case 8: - case 0xd: - sub_801A9E0(); - sub_8024E30(); - sub_8012D60(&gUnknown_203B2B0->unk84,gUnknown_203B2B0->unk34,0,gUnknown_203B2B0->unk74, - gUnknown_203B2B0->menuAction3,2); - break; - case 9: - case 0xe: - sub_801B3C0(&gUnknown_203B2B0->chosenItem); - break; - case LUMINOUS_CAVE_LACK_WHAT_NEEDED: - gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_GIVE_ITEM_1; - sub_80141B4(gLuminousCaveLackWhatIsNeeded,0,0,0x105); - break; - case LUMINOUS_CAVE_ONLY_ONE_ITEM: - gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_GIVE_ITEM_2; - sub_80141B4(gLuminousCaveOnlyOneItem,0,0,0x105); - break; - case LUMINOUS_CAVE_LET_US_BEGIN: - sub_8025254(); + sub_8024CFC(); + sub_8014248(sLuminousCaveSeekAwakening,0,gUnknown_203B2B0->menuAction1,gUnknown_203B2B0->unk34,gUnknown_203B2B0->unk74,4,0,0,5); + break; + case LUMINOUS_CAVE_ASK_EVOLVE: + sub_8024CFC(); + sub_8014248(sLuminousCaveAskEvolution,0,gUnknown_203B2B0->menuAction1,gUnknown_203B2B0->unk34,gUnknown_203B2B0->unk74,4,0,0,5); + break; + case LUMINOUS_CAVE_EVOLVE_INFO: + gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_ASK_EVOLVE; + sub_80141B4(sLuminousCaveEvolutionInfo,0,0,0x105); + break; + case LUMINOUS_CAVE_SHALL_RETURN: + gUnknown_203B2B0->fallbackState = 4; + xxx_call_fade_in_new_bgm(MUS_FILE_SELECT,0x3c); + sub_80141B4(sLuminousCaveYeShallReturn,0,0,0x305); + break; + case LUMINOUS_CAVE_GIVE_ITEM_1: + sub_8024D48(); + sub_8014248(sLuminousCaveGiveItem,0,gUnknown_203B2B0->menuAction2,gUnknown_203B2B0->unk34,gUnknown_203B2B0->unk74,4,0,0,5); + break; + case 6: + sub_801A5D8(2,3,NULL,10); + break; + case 7: + sub_801A8D0(TRUE); + break; + case LUMINOUS_CAVE_GIVE_ITEM_2: + sub_8024DBC(); + sub_8014248(sLuminousCaveGiveAnotherItem,0,gUnknown_203B2B0->menuAction2,gUnknown_203B2B0->unk34,gUnknown_203B2B0->unk74,4,0,0,5); + break; + case 11: + sub_801A5D8(2,3,NULL,10); + sub_801AEE4(gUnknown_203B2B0->evoItem1_InvIndex,1); + sub_801A9E0(); + break; + case 12: + sub_801A8D0(TRUE); + sub_801AEE4(gUnknown_203B2B0->evoItem1_InvIndex,1); + sub_801A9E0(); + break; + case 8: + case 13: + sub_801A9E0(); + sub_8024E30(); + sub_8012D60(&gUnknown_203B2B0->unk84,gUnknown_203B2B0->unk34,0,gUnknown_203B2B0->unk74, + gUnknown_203B2B0->menuAction3,2); + break; + case 9: + case 14: + sub_801B3C0(&gUnknown_203B2B0->chosenItem); + break; + case LUMINOUS_CAVE_LACK_WHAT_NEEDED: + gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_GIVE_ITEM_1; + sub_80141B4(sLuminousCaveLackWhatIsNeeded,0,0,0x105); + break; + case LUMINOUS_CAVE_ONLY_ONE_ITEM: + gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_GIVE_ITEM_2; + sub_80141B4(sLuminousCaveOnlyOneItem,0,0,0x105); + break; + case LUMINOUS_CAVE_LET_US_BEGIN: + sub_8025254(); - if((gUnknown_203B2B0->evolveStatus.evolutionConditionStatus & EVOLUTION_GOOD)) - gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_CHANGED_APPEARANCE; - else if(gUnknown_203B2B0->evolveStatus.evolutionConditionStatus == EVOLUTION_NO_MORE) - gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_CANT_EVOLVE_ANYMORE; - else if(gUnknown_203B2B0->evolveStatus.evolutionConditionStatus == EVOLUTION_LACK_LEVEL) - gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_LACK_LEVEL; - else if(gUnknown_203B2B0->evolveStatus.evolutionConditionStatus == EVOLUTION_LACK_IQ) - gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_LACK_IQ; - else if(gUnknown_203B2B0->evolveStatus.evolutionConditionStatus == EVOLUTION_LACK_FRIEND_AREA) - gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_LACK_FRIEND_AREA; - else if(gUnknown_203B2B0->evolveStatus.evolutionConditionStatus == EVOLUTION_LACK_ROOM) - gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_LACK_ROOM; - else if(gUnknown_203B2B0->evolveStatus.evolutionConditionStatus == EVOLUTION_LACK_ITEM) - gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_LACK_ITEM; - else - gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_CANT_EVOLVE_YET; - xxx_call_fade_out_bgm(0x3c); - sub_80141B4(gLuminousCaveLetUsBegin,0,0,0x105); - break; - case LUMINOUS_CAVE_CHANGED_APPEARANCE: - PrintColoredPokeNameToBuffer(gPlayerName,gUnknown_203B2B0->pokeStruct, COLOR_CYAN); - PlaySound(0x1ff); - gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_EVOLVED; - sub_80141B4(gLuminousCaveChangedAppearance,0,0,0x105); - break; - case LUMINOUS_CAVE_EVOLVED: - monName = GetMonSpecies(gUnknown_203B2B0->pokeStruct->speciesNum); - strcpy(gAvailablePokemonNames,monName); - monName = GetMonSpecies(gUnknown_203B2B0->evolveStatus.targetEvolveSpecies); - strcpy(gAvailablePokemonNames + 0x50,monName); - gUnknown_203B2B0->evolutionComplete = TRUE; - sub_80977D0(); - sub_808F734(gUnknown_203B2B0->pokeStruct,gUnknown_203B2B0->evolveStatus.targetEvolveSpecies); - nullsub_104(); - gUnknown_203B2B0->pokeStruct = GetPlayerPokemonStruct(); - if (gUnknown_203B2B0->evoItem1_InvIndex != INVENTORY_SIZE) { - ClearItemSlotAt(gUnknown_203B2B0->evoItem1_InvIndex); - } - if (gUnknown_203B2B0->evoItem2_InvIndex != INVENTORY_SIZE) { - ClearItemSlotAt(gUnknown_203B2B0->evoItem2_InvIndex); - } - FillInventoryGaps(); - xxx_call_stop_fanfare_se(0x1ff); - PlaySound(0xd2); - if (gUnknown_203B2B0->pokeRenamed) { - BoundedCopyStringtoBuffer(gUnknown_203B2B0->pokeStruct->name,GetMonSpecies(gUnknown_203B2B0->pokeStruct->speciesNum),POKEMON_NAME_LENGTH); - } - gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_SHALL_RETURN; - sub_80141B4(gLuminousCaveEvolved,0,0,0x105); - break; - case LUMINOUS_CAVE_COME_ALONE: - gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_SHALL_RETURN; - sub_80141B4(gLuminousCaveComeAlone,0,0,0x105); - break; - case LUMINOUS_CAVE_LACK_LEVEL: - gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_SHALL_RETURN; - sub_80141B4(gLuminousCaveLackLevel,0,0,0x105); - break; - case LUMINOUS_CAVE_CANT_EVOLVE_ANYMORE: - gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_SHALL_RETURN; - sub_80141B4(gLuminousCaveCantEvolveAnymore,0,0,0x105); - break; - case LUMINOUS_CAVE_LACK_FRIEND_AREA: - gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_SHALL_RETURN; - sub_80141B4(gLuminousCaveLackFriendArea,0,0,0x105); - break; - case LUMINOUS_CAVE_LACK_ROOM: - gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_SHALL_RETURN; - sub_80141B4(gLuminousCaveLackRoom,0,0,0x105); - break; - case LUMINOUS_CAVE_LACK_IQ: - gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_SHALL_RETURN; - sub_80141B4(gLuminousCaveLackIQ,0,0,0x105); - break; - case LUMINOUS_CAVE_LACK_ITEM: - gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_SHALL_RETURN; - sub_80141B4(gLuminousCaveLackItem,0,0,0x105); - break; - case LUMINOUS_CAVE_CANT_EVOLVE_YET: - gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_SHALL_RETURN; - sub_80141B4(gLuminousCaveCantEvolveYet,0,0,0x105); - break; - case LUMINOUS_CAVE_PROMPT_NAME: - xxx_call_fade_in_new_bgm(8,0x3c); - gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_FINISH_NAME; - sub_80141B4(gLuminousCaveGiveName,0,0,0x105); - break; - case LUMINOUS_CAVE_FINISH_NAME: - if (gUnknown_203B2B0->pokeRenamed) { - BoundedCopyStringtoBuffer(gUnknown_203B2B0->pokeStruct->name,GetMonSpecies(gUnknown_203B2B0->pokeStruct->speciesNum),POKEMON_NAME_LENGTH); - } - sub_801602C(0,gUnknown_203B2B0->pokeStruct->name); - break; - default: - break; - } + if((gUnknown_203B2B0->evolveStatus.evolutionConditionStatus & EVOLUTION_GOOD)) + gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_CHANGED_APPEARANCE; + else if(gUnknown_203B2B0->evolveStatus.evolutionConditionStatus == EVOLUTION_NO_MORE) + gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_CANT_EVOLVE_ANYMORE; + else if(gUnknown_203B2B0->evolveStatus.evolutionConditionStatus == EVOLUTION_LACK_LEVEL) + gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_LACK_LEVEL; + else if(gUnknown_203B2B0->evolveStatus.evolutionConditionStatus == EVOLUTION_LACK_IQ) + gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_LACK_IQ; + else if(gUnknown_203B2B0->evolveStatus.evolutionConditionStatus == EVOLUTION_LACK_FRIEND_AREA) + gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_LACK_FRIEND_AREA; + else if(gUnknown_203B2B0->evolveStatus.evolutionConditionStatus == EVOLUTION_LACK_ROOM) + gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_LACK_ROOM; + else if(gUnknown_203B2B0->evolveStatus.evolutionConditionStatus == EVOLUTION_LACK_ITEM) + gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_LACK_ITEM; + else + gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_CANT_EVOLVE_YET; + xxx_call_fade_out_bgm(0x3c); + sub_80141B4(sLuminousCaveLetUsBegin,0,0,0x105); + break; + case LUMINOUS_CAVE_CHANGED_APPEARANCE: + PrintColoredPokeNameToBuffer(gPlayerName,gUnknown_203B2B0->pokeStruct, COLOR_CYAN); + PlaySound(0x1ff); + gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_EVOLVED; + sub_80141B4(sLuminousCaveChangedAppearance,0,0,0x105); + break; + case LUMINOUS_CAVE_EVOLVED: + monName = GetMonSpecies(gUnknown_203B2B0->pokeStruct->speciesNum); + strcpy(gAvailablePokemonNames,monName); + monName = GetMonSpecies(gUnknown_203B2B0->evolveStatus.targetEvolveSpecies); + strcpy(gAvailablePokemonNames + 0x50,monName); + gUnknown_203B2B0->evolutionComplete = TRUE; + sub_80977D0(); + sub_808F734(gUnknown_203B2B0->pokeStruct,gUnknown_203B2B0->evolveStatus.targetEvolveSpecies); + nullsub_104(); + gUnknown_203B2B0->pokeStruct = GetPlayerPokemonStruct(); + if (gUnknown_203B2B0->evoItem1_InvIndex != INVENTORY_SIZE) { + ClearItemSlotAt(gUnknown_203B2B0->evoItem1_InvIndex); + } + if (gUnknown_203B2B0->evoItem2_InvIndex != INVENTORY_SIZE) { + ClearItemSlotAt(gUnknown_203B2B0->evoItem2_InvIndex); + } + FillInventoryGaps(); + xxx_call_stop_fanfare_se(0x1ff); + PlaySound(0xd2); + if (gUnknown_203B2B0->pokeRenamed) { + BoundedCopyStringtoBuffer(gUnknown_203B2B0->pokeStruct->name,GetMonSpecies(gUnknown_203B2B0->pokeStruct->speciesNum),POKEMON_NAME_LENGTH); + } + gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_SHALL_RETURN; + sub_80141B4(sLuminousCaveEvolved,0,0,0x105); + break; + case LUMINOUS_CAVE_COME_ALONE: + gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_SHALL_RETURN; + sub_80141B4(sLuminousCaveComeAlone,0,0,0x105); + break; + case LUMINOUS_CAVE_LACK_LEVEL: + gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_SHALL_RETURN; + sub_80141B4(sLuminousCaveLackLevel,0,0,0x105); + break; + case LUMINOUS_CAVE_CANT_EVOLVE_ANYMORE: + gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_SHALL_RETURN; + sub_80141B4(sLuminousCaveCantEvolveAnymore,0,0,0x105); + break; + case LUMINOUS_CAVE_LACK_FRIEND_AREA: + gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_SHALL_RETURN; + sub_80141B4(sLuminousCaveLackFriendArea,0,0,0x105); + break; + case LUMINOUS_CAVE_LACK_ROOM: + gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_SHALL_RETURN; + sub_80141B4(sLuminousCaveLackRoom,0,0,0x105); + break; + case LUMINOUS_CAVE_LACK_IQ: + gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_SHALL_RETURN; + sub_80141B4(sLuminousCaveLackIQ,0,0,0x105); + break; + case LUMINOUS_CAVE_LACK_ITEM: + gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_SHALL_RETURN; + sub_80141B4(sLuminousCaveLackItem,0,0,0x105); + break; + case LUMINOUS_CAVE_CANT_EVOLVE_YET: + gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_SHALL_RETURN; + sub_80141B4(sLuminousCaveCantEvolveYet,0,0,0x105); + break; + case LUMINOUS_CAVE_PROMPT_NAME: + xxx_call_fade_in_new_bgm(8,0x3c); + gUnknown_203B2B0->fallbackState = LUMINOUS_CAVE_FINISH_NAME; + sub_80141B4(sLuminousCaveGiveName,0,0,0x105); + break; + case LUMINOUS_CAVE_FINISH_NAME: + if (gUnknown_203B2B0->pokeRenamed) { + BoundedCopyStringtoBuffer(gUnknown_203B2B0->pokeStruct->name,GetMonSpecies(gUnknown_203B2B0->pokeStruct->speciesNum),POKEMON_NAME_LENGTH); + } + sub_801602C(0,gUnknown_203B2B0->pokeStruct->name); + break; + default: + break; + } } -void sub_8024CFC(void) +static void sub_8024CFC(void) { s32 loopMax = 0; MemoryFill16(gUnknown_203B2B0->unk74, 0, sizeof(gUnknown_203B2B0->unk74)); + gUnknown_203B2B0->unk34[loopMax].text = gUnknown_80DCA18; gUnknown_203B2B0->unk34[loopMax].menuAction = 3; + loopMax += 1; gUnknown_203B2B0->unk34[loopMax].text = *gUnknown_80D4970; gUnknown_203B2B0->unk34[loopMax].menuAction = 2; + + loopMax += 1; + gUnknown_203B2B0->unk34[loopMax].text = *gUnknown_80D4934; + gUnknown_203B2B0->unk34[loopMax].menuAction = 1; + + loopMax += 1; + gUnknown_203B2B0->unk34[loopMax].text = NULL; + gUnknown_203B2B0->unk34[loopMax].menuAction = 1; +} + +static void sub_8024D48(void) +{ + s32 index; + s32 loopMax; + + loopMax = 0; + MemoryFill16(gUnknown_203B2B0->unk74, 0, sizeof(gUnknown_203B2B0->unk74)); + gUnknown_203B2B0->unk34[loopMax].text = gUnknown_80DCA24; + gUnknown_203B2B0->unk34[loopMax].menuAction = 4; + loopMax += 1; + gUnknown_203B2B0->unk34[loopMax].text = gUnknown_80DCA2C; + gUnknown_203B2B0->unk34[loopMax].menuAction = 5; loopMax += 1; gUnknown_203B2B0->unk34[loopMax].text = *gUnknown_80D4934; gUnknown_203B2B0->unk34[loopMax].menuAction = 1; loopMax += 1; gUnknown_203B2B0->unk34[loopMax].text = NULL; gUnknown_203B2B0->unk34[loopMax].menuAction = 1; + + for (index = 0; index < loopMax; index++) { + if (gUnknown_203B2B0->unk74[index] == 0) { + if (gUnknown_203B2B0->unk34[index].menuAction == gUnknown_203B2B0->menuAction2) + return; + } + } + + gUnknown_203B2B0->menuAction2 = 4; } -void sub_8024D48(void) +static void sub_8024DBC(void) { s32 index; s32 loopMax; @@ -542,38 +462,7 @@ void sub_8024D48(void) gUnknown_203B2B0->menuAction2 = 4; } -void sub_8024DBC(void) -{ - s32 index; - s32 loopMax; - - loopMax = 0; - MemoryFill16(gUnknown_203B2B0->unk74, 0, sizeof(gUnknown_203B2B0->unk74)); - gUnknown_203B2B0->unk34[loopMax].text = gUnknown_80DCA24; - gUnknown_203B2B0->unk34[loopMax].menuAction = 4; - loopMax += 1; - gUnknown_203B2B0->unk34[loopMax].text = gUnknown_80DCA2C; - gUnknown_203B2B0->unk34[loopMax].menuAction = 5; - loopMax += 1; - gUnknown_203B2B0->unk34[loopMax].text = *gUnknown_80D4934; - gUnknown_203B2B0->unk34[loopMax].menuAction = 1; - loopMax += 1; - gUnknown_203B2B0->unk34[loopMax].text = NULL; - gUnknown_203B2B0->unk34[loopMax].menuAction = 1; - - for(index = 0; index < loopMax; index++) - { - if(gUnknown_203B2B0->unk74[index] == 0) - { - if(gUnknown_203B2B0->unk34[index].menuAction == gUnknown_203B2B0->menuAction2) - return; - } - } - - gUnknown_203B2B0->menuAction2 = 4; -} - -void sub_8024E30(void) +static void sub_8024E30(void) { s32 index; s32 loopMax; @@ -601,7 +490,7 @@ void sub_8024E30(void) gUnknown_203B2B0->menuAction3 = 5; } -void sub_8024E9C(void) +static void sub_8024E9C(void) { s32 menuAction; if(sub_80144A4(&menuAction) == 0) @@ -625,7 +514,7 @@ void sub_8024E9C(void) } } -void sub_8024F00(void) +static void sub_8024F00(void) { s32 menuAction; if(sub_80144A4(&menuAction) == 0) @@ -651,7 +540,7 @@ void sub_8024F00(void) } } -void sub_8024F70(void) +static void sub_8024F70(void) { s32 menuAction; if(sub_80144A4(&menuAction) == 0) @@ -675,7 +564,7 @@ void sub_8024F70(void) } } -void sub_8024FD4(void) +static void sub_8024FD4(void) { switch(sub_801A6E8(TRUE)) { @@ -697,7 +586,7 @@ void sub_8024FD4(void) } } -void sub_8025058(void) +static void sub_8025058(void) { switch(sub_801A6E8(TRUE)) { @@ -723,7 +612,7 @@ void sub_8025058(void) } } -void sub_80250EC(void) +static void sub_80250EC(void) { s32 menuAction; menuAction = 0; @@ -750,7 +639,7 @@ void sub_80250EC(void) } } -void sub_802515C(void) +static void sub_802515C(void) { s32 menuAction; menuAction = 0; @@ -777,7 +666,7 @@ void sub_802515C(void) } } -void sub_80251CC(void) +static void sub_80251CC(void) { switch(sub_801B410()) { @@ -792,7 +681,7 @@ void sub_80251CC(void) } } -void sub_80251E8(void) +static void sub_80251E8(void) { switch(sub_801B410()) { @@ -807,7 +696,7 @@ void sub_80251E8(void) } } -void sub_8025204(void) +static void sub_8025204(void) { switch(sub_8016080()) { @@ -821,7 +710,7 @@ void sub_8025204(void) } } -void LuminousCave_AdvancetoFallbackState(void) +static void LuminousCave_AdvancetoFallbackState(void) { s32 temp; if(sub_80144A4(&temp) == 0) @@ -830,7 +719,7 @@ void LuminousCave_AdvancetoFallbackState(void) } } -void sub_8025254(void) +static void sub_8025254(void) { if(gUnknown_203B2B0->evoItem1_InvIndex == INVENTORY_SIZE) gUnknown_203B2B0->evolveStatus.evoItem1 = 0; @@ -849,11 +738,11 @@ void sub_8025254(void) sub_808F468(gUnknown_203B2B0->pokeStruct, &gUnknown_203B2B0->evolveStatus, 1); } -bool8 LuminousCave_HasOnly1Member(void) +static bool8 LuminousCave_HasOnly1Member(void) { s32 memberCount; s32 index; - struct PokemonStruct *preload; + PokemonStruct1 *preload; preload = &gRecruitedPokemonRef->pokemon[0]; memberCount = 0; @@ -867,4 +756,4 @@ bool8 LuminousCave_HasOnly1Member(void) return TRUE; else return FALSE; -} +} \ No newline at end of file diff --git a/src/mailbox.c b/src/mailbox.c index 7c3e15c5e..cae1ba2d5 100644 --- a/src/mailbox.c +++ b/src/mailbox.c @@ -11,7 +11,7 @@ EWRAM_DATA_2 struct unkStruct_203B304 *gUnknown_203B304 = {0}; -const struct UnkTextStruct2 gUnknown_80E0284 = +const UnkTextStruct2 gUnknown_80E0284 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -21,7 +21,7 @@ const struct UnkTextStruct2 gUnknown_80E0284 = NULL }; -const struct UnkTextStruct2 gUnknown_80E029C = +const UnkTextStruct2 gUnknown_80E029C = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -31,7 +31,7 @@ const struct UnkTextStruct2 gUnknown_80E029C = NULL }; -const struct UnkTextStruct2 gUnknown_80E02B4 = +const UnkTextStruct2 gUnknown_80E02B4 = { 0x00, 0x00, 0x00, 0x00, 0x04, @@ -41,7 +41,7 @@ const struct UnkTextStruct2 gUnknown_80E02B4 = NULL }; -const struct UnkTextStruct2 gUnknown_80E02CC = +const UnkTextStruct2 gUnknown_80E02CC = { 0x00, 0x00, 0x00, 0x00, 0x04, @@ -63,7 +63,7 @@ static const u8 mailbox_fill[] = "pksdir0"; extern u8 *gUnknown_80D4990[]; extern u8 *gUnknown_80D4970[]; -extern bool8 IsMailinJobSlot(struct WonderMail *mail); +extern bool8 IsMailinJobSlot(WonderMail *mail); void sub_802E578(void); void HandleMailActionMenu(void); @@ -82,8 +82,8 @@ extern void sub_802BD14(u32, u32, u32); extern void sub_802BE94(u32); extern void CreateMailMenu(void); extern void CreateMailAcceptedStatusBox(u32); -extern void sub_803B35C(struct WonderMail *, struct unkStruct_802C39C *); -extern void sub_802DE84(struct unkStruct_802C39C *); +extern void sub_803B35C(WonderMail *, unkStruct_802C39C *); +extern void sub_802DE84(unkStruct_802C39C *); extern void InitializeJobListMenu(u32); extern void sub_802B640(u32, u32, u32); extern void sub_802B7D0(u32); @@ -97,10 +97,10 @@ extern u32 sub_802C898(void); extern void sub_802C8F4(void); extern u32 sub_802DEE0(void); extern void sub_802DF24(void); -extern struct WonderMail *GetMailboxSlotInfo(u8); +extern WonderMail *GetMailboxSlotInfo(u8); extern u8 HasNoMailinMailbox(void); extern u32 sub_802BDEC(u32); -extern void AcceptJob(struct WonderMail *); +extern void AcceptJob(WonderMail *); extern void sub_8096C80(void); extern void sub_8096D24(void); extern void ResetMailboxSlot(u8); @@ -207,7 +207,7 @@ void sub_802E0A0(void) break; } ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B304->unk10C, 1, 1); + sub_800641C(gUnknown_203B304->unk10C, TRUE, TRUE); } void sub_802E1AC(void) @@ -305,7 +305,7 @@ void CreateMailboxMenu(void) void CreateMailActionMenu(void) { s32 index; - struct WonderMail *mail; + WonderMail *mail; s32 loopMax = 0; mail = GetMailboxSlotInfo(gUnknown_203B304->mailboxIndex); if(mail->mailType == 1) @@ -390,7 +390,7 @@ void HandleMailboxMenu(void) void sub_802E578(void) { - struct WonderMail *mail; + WonderMail *mail; switch(sub_802BDEC(1)) { @@ -424,7 +424,7 @@ void sub_802E578(void) void HandleMailActionMenu(void) { s32 menuAction = 0; - struct WonderMail *mail; + WonderMail *mail; sub_802BDEC(0); diff --git a/src/mailbox_8095F8C.c b/src/mailbox_8095F8C.c index 95c25528f..4f4996b81 100644 --- a/src/mailbox_8095F8C.c +++ b/src/mailbox_8095F8C.c @@ -2,7 +2,7 @@ #include "wonder_mail.h" #include "code_80958E8.h" -extern struct unkStruct_203B490 *gUnknown_203B490; +extern unkStruct_203B490 *gUnknown_203B490; bool8 IsMailSlotEmpty(u8); void ResetMailboxSlot(u8); @@ -22,7 +22,7 @@ s32 CountFilledMailboxSlots(void) } // Unused -bool8 sub_8095FB0(struct WonderMail *mail) +bool8 sub_8095FB0(WonderMail *mail) { s32 index; @@ -37,7 +37,7 @@ bool8 sub_8095FB0(struct WonderMail *mail) return TRUE; } -struct WonderMail *GetMailboxSlotInfo(u8 index) +WonderMail *GetMailboxSlotInfo(u8 index) { return &gUnknown_203B490->mailboxSlots[index]; } diff --git a/src/main.c b/src/main.c index d58379ad9..8e1ef8031 100644 --- a/src/main.c +++ b/src/main.c @@ -3,12 +3,14 @@ #include "bg_palette_buffer.h" #include "code_8004AA0.h" #include "code_800558C.h" +#include "code_8009804.h" #include "cpu.h" #include "crt0.h" #include "file_system.h" #include "flash.h" #include "input.h" #include "main.h" +#include "music.h" #include "random.h" #include "reg_control.h" #include "sprite.h" @@ -19,34 +21,30 @@ EWRAM_DATA u8 IntrMain_Buffer[0x120] = {0}; EWRAM_DATA IntrCallback gIntrTable[6] = {0}; EWRAM_DATA IntrCallback gIntrCallbacks[6] = {0}; -extern char ewram_start[]; -extern char alt_203B038[]; -extern char gTitlePaletteFile[]; -extern char gUnknown_203BC04[]; -extern char iwram_start[]; -extern char alt_3001B58[]; -extern char unk_code[]; -extern char unk_code_ram[]; -extern char unk_code_ram_end[]; +extern u8 ewram_start[]; +extern u8 ewramClearEnd[]; +extern u8 ewramClearEnd2[]; // Force a second storage in the asm +extern u8 ewram2_end[]; +extern u8 iwram_start[]; +extern u8 iwramClearEnd[]; +extern u8 unk_code[]; +extern u8 unk_code_ram[]; +extern u8 unk_code_ram_end[]; EWRAM_DATA_2 u8 gInterruptsEnabled = {0}; // data_8270000.s -extern const char gUnknown_8270000[]; +extern const u8 gUnknown_8270000[]; // data_80B9BB8.s extern const u8 gUnknown_80B9BF1[]; extern const IntrCallback gInitialIntrTable[6]; -// code_8009804.c -extern void sub_80098A0(void); // code_2.c extern void GameLoop(void); // code_800D090.c extern void Hang(void); extern void sub_800D6AC(void); extern void sub_800D7D0(void); -// music.c -extern void InitMusic(void); // music initializer void InitIntrTable(const IntrCallback *interrupt_table); IntrCallback SetInterruptCallback(u32 index, IntrCallback new_callback); @@ -65,20 +63,20 @@ void AgbMain(void) DmaStop(2); DmaStop(3); - if (gUnknown_203BC04 - gTitlePaletteFile > 0) - CpuCopy32(gUnknown_8270000, gTitlePaletteFile, gUnknown_203BC04 - gTitlePaletteFile); + if (ewram2_end - ewramClearEnd > 0) + CpuCopy32(gUnknown_8270000, ewramClearEnd, ewram2_end - ewramClearEnd); - if (alt_203B038 - ewram_start > 0) { + if (ewramClearEnd2 - ewram_start > 0) { memset(value, 0, 4); - CpuSet(&value, ewram_start, CPU_SET_SRC_FIXED | CPU_SET_32BIT | (((alt_203B038 - ewram_start) / 4) & 0x1FFFFF)); + CpuSet(&value, ewram_start, CPU_SET_SRC_FIXED | CPU_SET_32BIT | (((ewramClearEnd2 - ewram_start) / 4) & 0x1FFFFF)); } if (unk_code_ram_end - unk_code_ram > 0) CpuCopy32(unk_code, unk_code_ram, unk_code_ram_end - unk_code_ram); - if (alt_3001B58 - iwram_start > 0) { + if (iwramClearEnd - iwram_start > 0) { memset(value, 0, 4); - CpuSet(&value, iwram_start, CPU_SET_SRC_FIXED | CPU_SET_32BIT | (((alt_3001B58 - iwram_start) / 4) & 0x1FFFFF)); + CpuSet(&value, iwram_start, CPU_SET_SRC_FIXED | CPU_SET_32BIT | (((iwramClearEnd - iwram_start) / 4) & 0x1FFFFF)); } REG_WIN0H = 0; diff --git a/src/main_menu.c b/src/main_menu.c index 641609810..74d301435 100644 --- a/src/main_menu.c +++ b/src/main_menu.c @@ -1,8 +1,9 @@ #include "global.h" +#include "code_803D0D8.h" #include "text1.h" #include "text2.h" #include "menu_input.h" -#include "adventure_log.h" +#include "adventure_log_menu.h" #include "debug_menu1.h" #include "ds_menus.h" #include "pokemon.h" @@ -14,6 +15,7 @@ #include "save.h" #include "trade_items_menu.h" #include "constants/wonder_mail.h" +#include "code_8098BDC.h" // NOTE: 0x13 and 0x14 // Communication Screen? @@ -33,8 +35,8 @@ struct unkStruct_203B34C { // size: 0x1A8 u32 unk0; - struct MenuStruct unk4[4]; - struct UnkTextStruct2 unk144[4]; + MenuStruct unk4[4]; + UnkTextStruct2 unk144[4]; /* 0x1A4 */ u32 currMenuChoice; }; @@ -44,7 +46,6 @@ EWRAM_DATA_2 u32 gUnknown_203B350 = {0}; EWRAM_DATA_2 u32 gUnknown_203B354 = {0}; // unused everywhere else except here.. extern void SetWindowBGColor(void); -extern void sub_8099690(u32); extern void sub_8036FDC(s32); extern void CreateWonderMailMenu(void); extern void CreateSaveMenu(u32); @@ -56,7 +57,6 @@ extern void sub_80370D4(void); extern void CleanWonderMailMenu(void); extern void sub_80383A8(void); extern void CleanSaveMenu(void); -extern u8 sub_803D0D8(); void CleanMainMenu(void); void DrawMainMenu(void); @@ -87,7 +87,7 @@ static const u8 sUnknown_80E6008[]; static const u8 sUnknown_80E6048[]; static const u8 sUnknown_80E6070[]; -const struct UnkTextStruct2 gUnknown_80E59A8 = { +const UnkTextStruct2 gUnknown_80E59A8 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, @@ -98,7 +98,7 @@ const struct UnkTextStruct2 gUnknown_80E59A8 = { static const char main_menu_fill[] = "pksdir0"; -const struct UnkTextStruct2 gUnknown_80E59C8 = { +const UnkTextStruct2 gUnknown_80E59C8 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, @@ -107,7 +107,7 @@ const struct UnkTextStruct2 gUnknown_80E59C8 = { NULL }; -const struct UnkTextStruct2 gUnknown_80E59E0 = { +const UnkTextStruct2 gUnknown_80E59E0 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x02, @@ -116,14 +116,14 @@ const struct UnkTextStruct2 gUnknown_80E59E0 = { NULL }; -const struct MenuItem gUnknown_80E59F8[] = +const MenuItem gUnknown_80E59F8[] = { {"New Game", MENU_NEW_GAME}, {"Adventure Log", MENU_ADVENTURE_LOG}, {NULL, 0xffdd}, }; -const struct UnkTextStruct2 gUnknown_80E5A29 = { +const UnkTextStruct2 gUnknown_80E5A29 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x02, @@ -132,13 +132,13 @@ const struct UnkTextStruct2 gUnknown_80E5A29 = { NULL }; -const struct MenuItem gUnknown_80E5A44[] = +const MenuItem gUnknown_80E5A44[] = { {"Wonder Mail", MENU_WONDER_MAIL}, {NULL, 0xffdd}, }; -const struct UnkTextStruct2 gUnknown_80E5A60 = { +const UnkTextStruct2 gUnknown_80E5A60 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x02, @@ -147,7 +147,7 @@ const struct UnkTextStruct2 gUnknown_80E5A60 = { NULL }; -const struct UnkTextStruct2 gUnknown_80E5A78 = { +const UnkTextStruct2 gUnknown_80E5A78 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x02, @@ -156,7 +156,7 @@ const struct UnkTextStruct2 gUnknown_80E5A78 = { NULL }; -const struct MenuItem gUnknown_80E5A90[] = +const MenuItem gUnknown_80E5A90[] = { {"Continue", MENU_CONTINUE}, {"Delete Save Data", MENU_DELETE_SAVE_PROMPT}, @@ -166,7 +166,7 @@ const struct MenuItem gUnknown_80E5A90[] = {NULL, 0xffdd}, }; -const struct MenuItem gUnknown_80E5AFC[] = +const MenuItem gUnknown_80E5AFC[] = { {"Continue", MENU_CONTINUE}, {"Delete Save Data", MENU_DELETE_SAVE_PROMPT}, @@ -177,7 +177,7 @@ const struct MenuItem gUnknown_80E5AFC[] = {NULL, 0xffdd}, }; -const struct UnkTextStruct2 gUnknown_80E5B34 = { +const UnkTextStruct2 gUnknown_80E5B34 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x02, @@ -186,7 +186,7 @@ const struct UnkTextStruct2 gUnknown_80E5B34 = { NULL }; -const struct MenuItem gUnknown_80E5B4C[] = +const MenuItem gUnknown_80E5B4C[] = { {"Awaiting Rescue", MENU_AWAITING_RESCUE}, {"Delete Save Data", MENU_DELETE_SAVE_PROMPT}, @@ -196,7 +196,7 @@ const struct MenuItem gUnknown_80E5B4C[] = {NULL, 0xffdd}, }; -const struct MenuItem gUnknown_80E5B8C[] = +const MenuItem gUnknown_80E5B8C[] = { {"Awaiting Rescue", MENU_AWAITING_RESCUE}, {"Delete Save Data", MENU_DELETE_SAVE_PROMPT}, @@ -207,7 +207,7 @@ const struct MenuItem gUnknown_80E5B8C[] = {NULL, 0xffdd}, }; -const struct UnkTextStruct2 gUnknown_80E5BC4 = { +const UnkTextStruct2 gUnknown_80E5BC4 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x02, @@ -216,7 +216,7 @@ const struct UnkTextStruct2 gUnknown_80E5BC4 = { NULL }; -const struct MenuItem gUnknown_80E5BDC[] = +const MenuItem gUnknown_80E5BDC[] = { {"Revive Team", MENU_CONTINUE}, {"Delete Save Data", MENU_DELETE_SAVE_PROMPT}, @@ -226,7 +226,7 @@ const struct MenuItem gUnknown_80E5BDC[] = {NULL, 0xffdd}, }; -const struct MenuItem gUnknown_80E5C18[] = +const MenuItem gUnknown_80E5C18[] = { {"Revive Team", MENU_CONTINUE}, {"Delete Save Data", MENU_DELETE_SAVE_PROMPT}, @@ -237,7 +237,7 @@ const struct MenuItem gUnknown_80E5C18[] = {NULL, 0xffdd}, }; -const struct UnkTextStruct2 gUnknown_80E5C50 = { +const UnkTextStruct2 gUnknown_80E5C50 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x02, @@ -246,21 +246,21 @@ const struct UnkTextStruct2 gUnknown_80E5C50 = { NULL }; -const struct MenuItem gUnknown_80E5C68[] = +const MenuItem gUnknown_80E5C68[] = { {"Send Items", MENU_SEND_ITEMS}, {"Receive Items", MENU_RECEIVE_ITEMS}, {NULL, 0xffdd}, }; -const struct MenuItem gUnknown_80E5C9C[] = +const MenuItem gUnknown_80E5C9C[] = { {"Send Items", -1}, {"Receive Items", MENU_RECEIVE_ITEMS}, {NULL, 0xffdd}, }; -const struct UnkTextStruct2 gUnknown_80E5CB4 = { +const UnkTextStruct2 gUnknown_80E5CB4 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x02, 0x0F, @@ -269,7 +269,7 @@ const struct UnkTextStruct2 gUnknown_80E5CB4 = { NULL }; -const struct MenuItem gUnknown_80E5CCC[] = +const MenuItem gUnknown_80E5CCC[] = { {sUnknown_80E5CE8, 0xffde}, {sUnknown_80E5CE4, 0xffde}, @@ -279,7 +279,7 @@ const struct MenuItem gUnknown_80E5CCC[] = static const u8 sUnknown_80E5CE4[] = " "; static const u8 sUnknown_80E5CE8[] = "Start an entirely new adventure."; -const struct MenuItem gUnknown_80E5D0C[] = +const MenuItem gUnknown_80E5D0C[] = { {sUnknown_80E5D24, 0xffde}, {sUnknown_80E5CE4, 0xffde}, @@ -288,7 +288,7 @@ const struct MenuItem gUnknown_80E5D0C[] = static const u8 sUnknown_80E5D24[] = "Check your career as an adventurer."; -const struct MenuItem gUnknown_80E5D48[] = +const MenuItem gUnknown_80E5D48[] = { {sUnknown_80E5D88, 0xffde}, {sUnknown_80E5D60, 0xffde}, @@ -298,7 +298,7 @@ const struct MenuItem gUnknown_80E5D48[] = static const u8 sUnknown_80E5D60[] = _("It won{APOSTROPHE}t be in the release version."); static const u8 sUnknown_80E5D88[] = "This is the Debug Mode."; -const struct MenuItem gUnknown_80E5DA0[] = +const MenuItem gUnknown_80E5DA0[] = { {sUnknown_80E5DCC, 0xffde}, {sUnknown_80E5DB8, 0xffde}, @@ -308,7 +308,7 @@ const struct MenuItem gUnknown_80E5DA0[] = static const u8 sUnknown_80E5DB8[] = "you last saved. "; static const u8 sUnknown_80E5DCC[] = "Resume your adventure from where"; -const struct MenuItem gUnknown_80E5DF0[] = { +const MenuItem gUnknown_80E5DF0[] = { {sUnknown_80E5E34, 0xFFDE}, {sUnknown_80E5E08, 0xFFDE}, {0, 0xFFDD} @@ -317,7 +317,7 @@ const struct MenuItem gUnknown_80E5DF0[] = { static const u8 sUnknown_80E5E08[] = _("#C2Beware#R! This will delete it forever!"); static const u8 sUnknown_80E5E34[] = "This will delete your saved game data."; -const struct MenuItem gUnknown_80E5E5C[] = { +const MenuItem gUnknown_80E5E5C[] = { {sUnknown_80E5EA0, 0xFFDE}, {sUnknown_80E5E74, 0xFFDE}, {0, 0xFFDD} @@ -326,7 +326,7 @@ const struct MenuItem gUnknown_80E5E5C[] = { ALIGNED(4) static const u8 sUnknown_80E5E74[] = _("passwords{COMMA} friends may rescue each other."); static const u8 sUnknown_80E5EA0[] = "Using a Game Link cable or"; -const struct MenuItem gUnknown_80E5EBC[] = { +const MenuItem gUnknown_80E5EBC[] = { {sUnknown_80E5EF8, 0xFFDE}, {sUnknown_80E5ED4, 0xFFDE}, {0, 0xFFDD} @@ -335,7 +335,7 @@ const struct MenuItem gUnknown_80E5EBC[] = { static const u8 sUnknown_80E5ED4[] = "trade stored items with a friend."; ALIGNED(4) static const u8 sUnknown_80E5EF8[] = _("Using a Game Link cable{COMMA} you can"); -const struct MenuItem gUnknown_80E5F1C[] = { +const MenuItem gUnknown_80E5F1C[] = { {sUnknown_80E5F58, 0xFFDE}, {sUnknown_80E5F34, 0xFFDE}, {0, 0xFFDD} @@ -344,7 +344,7 @@ const struct MenuItem gUnknown_80E5F1C[] = { static const u8 sUnknown_80E5F34[] = "You can give up waiting for rescue."; static const u8 sUnknown_80E5F58[] = "You are awaiting rescue by a friend."; -const struct MenuItem gUnknown_80E5F80[] = { +const MenuItem gUnknown_80E5F80[] = { {sUnknown_80E5FB0, 0xFFDE}, {sUnknown_80E5F98, 0xFFDE}, {0, 0xFFDD} @@ -353,7 +353,7 @@ const struct MenuItem gUnknown_80E5F80[] = { static const u8 sUnknown_80E5F98[] = "receive Wonder Mail."; ALIGNED(4) static const u8 sUnknown_80E5FB0[] = _("Using passwords{COMMA} you can"); -const struct MenuItem gUnknown_80E5FCC[] = { +const MenuItem gUnknown_80E5FCC[] = { {sUnknown_80E6008, 0xFFDE}, {sUnknown_80E5FE4, 0xFFDE}, {NULL, 0xFFDD} @@ -362,7 +362,7 @@ const struct MenuItem gUnknown_80E5FCC[] = { static const u8 sUnknown_80E5FE4[] = "receive teams from your friends."; ALIGNED(4) static const u8 sUnknown_80E6008[] = _("Using the Dual Slot function{COMMA} you can"); -const struct MenuItem gUnknown_80E6030[] = { +const MenuItem gUnknown_80E6030[] = { {sUnknown_80E6070, 0xFFDE}, {sUnknown_80E6048, 0xFFDE}, {NULL, 0xFFDD} @@ -620,12 +620,12 @@ void sub_8035C1C(void) gMainMenu->sub.unk2D = 0; } -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) +void SetMenuItems(MenuStruct *param_1, UnkTextStruct2 *unkData, s32 index, + const UnkTextStruct2 *param_4, const MenuItem *menuItems, u8 param_6, u32 menuAction, u32 unused_8) { unkData[index] = *param_4; ResetUnusedInputStruct(); - sub_800641C(unkData,1,1); + sub_800641C(unkData, TRUE, TRUE); if (param_6 != 0) { sub_8012D60(¶m_1[index],menuItems,0,0,menuAction,index); } @@ -635,15 +635,15 @@ void SetMenuItems(struct MenuStruct *param_1, struct UnkTextStruct2 *unkData, s3 param_1[index].unk4C = TRUE; } -void sub_8035CC0(struct UnkTextStruct2 *dataArray, u32 index) +void sub_8035CC0(UnkTextStruct2 *dataArray, u32 index) { sub_8006518(dataArray); dataArray[index] = gUnknown_80E59A8; ResetUnusedInputStruct(); - sub_800641C(dataArray, 1, 1); + sub_800641C(dataArray, TRUE, TRUE); } -void sub_8035CF4(struct MenuStruct * Menu, u32 index, bool8 r2) +void sub_8035CF4(MenuStruct * Menu, u32 index, bool8 r2) { Menu[index].unk4C = r2; Menu[index].unk4D = 1; @@ -769,7 +769,7 @@ void DrawMainMenu(void) } ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B34C->unk144, 1, 1); + sub_800641C(gUnknown_203B34C->unk144, TRUE, TRUE); SetMainMenuItems(); gUnknown_203B34C->currMenuChoice = -1; @@ -785,7 +785,7 @@ void DrawMainMenu(void) void CleanMainMenu(void) { ResetUnusedInputStruct(); - sub_800641C(NULL, 1, 1); + sub_800641C(NULL, TRUE, TRUE); if(gUnknown_203B34C != NULL) { MemoryFree(gUnknown_203B34C); @@ -875,7 +875,7 @@ u32 UpdateMainMenu(void) bool8 SetMainMenuText(void) { u32 menuChoice; - const struct MenuItem *preload; + const MenuItem *preload; // Have to load the pointer before the index preload = gUnknown_203B34C->unk4[0].menuItems; diff --git a/src/makuhita_dojo.c b/src/makuhita_dojo.c deleted file mode 100644 index 4062ade05..000000000 --- a/src/makuhita_dojo.c +++ /dev/null @@ -1,591 +0,0 @@ -#include "global.h" -#include "code_800D090.h" -#include "code_80118A4.h" -#include "code_80130A8.h" -#include "constants/colors.h" -#include "constants/input.h" -#include "dungeon.h" -#include "makuhita_dojo.h" -#include "memory.h" -#include "menu_input.h" -#include "pokemon.h" -#include "text1.h" -#include "text2.h" - -extern u8 gUnknown_202E5D8[]; -extern u8 gUnknown_202E1C8[]; -extern struct unkStruct_203B31C *gUnknown_203B31C; -extern struct unkStruct_203B318 *gUnknown_203B318; -extern u8 gAvailablePokemonNames[]; -extern u8 gPlayerName[]; - -extern const u8 *gMakuhitaDialogue[2][10]; -extern u8 *gUnknown_80D4934[]; -extern u8 *gUnknown_80D4970[]; - -ALIGNED(4) const u8 gUnknown_80E0744[] = "Dungeons"; -ALIGNED(4) const u8 gUnknown_80E0750[] = {0x83, 0xC2}; -ALIGNED(4) const u8 gUnknown_80E0754[] = {0x83, 0xC0}; -static const u8 makuhita_dojo_fill1[] = "pksdir0"; - -const struct UnkTextStruct2 gUnknown_80E0760 = { - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x00, 0x00, - 0x00, 0x00, - 0x00, 0x00, - NULL -}; - -ALIGNED(4) const u8 gMakuhitaDojoBonslyDoll[] = _( - "{CENTER_ALIGN}{COLOR_1 YELLOW_5}$n0{END_COLOR_TEXT_1} received the {COLOR_1 GREEN_2}Bonsly Doll{END_COLOR_TEXT_1}!\n" - "{CENTER_ALIGN}It has been placed outside your\n" - "{CENTER_ALIGN}rescue team base."); - -const u8 gMakuhitaDojoGoTrain[] = "Go Train"; - -static const u8 makuhita_dojo_fill2[] = "pksdir0"; - -const struct UnkTextStruct2 gUnknown_80E07EC = { - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x00, 0x00, - 0x00, 0x00, - 0x00, 0x00, - NULL -}; -const struct UnkTextStruct2 gUnknown_80E0804 = { - 0x00, 0x00, 0x00, 0x00, - 0x06, - 0x02, 0x02, - 0x0E, 0x0E, - 0x0E, 0x00, - NULL -}; - -const u8 gMakuhitaDojoHeader[] = "Courses"; -ALIGNED(4) const u8 gUnknown_80E0824[] = _("{STAR_BULLET}"); -ALIGNED(4) const u8 gMakuhitaCoursePlaceholder[] = _("{COLOR_2}%c%s{END_COLOR_TEXT_2}"); -static const u8 makuhita_dojo_fill3[] = "pksdir0"; - -extern u32 sub_80095E4(s16, u32); -extern u32 sub_801B60C(u32, u8, u8); -extern u32 sub_801B6AC(void); -extern void sub_801B72C(void); -extern void sub_803053C(void); -extern bool8 sub_8097504(s16); -extern s16 sub_80A2668(u32 r0); -extern s16 sub_80A26CC(s16 r0); -extern u8 sub_80A2740(s32 r0); - -extern struct PokemonStruct *GetPlayerPokemonStruct(void); -extern bool8 IsMazeCompleted(s32); -extern void PrintColoredPokeNameToBuffer(u8 *, struct PokemonStruct *, s32); -extern void PrintYellowDungeonNametoBuffer(u8 *, struct DungeonLocation *); - -void MakuhitaDojo_DrawCourseList(void); -void MakuhitaDojo_DrawMainMenu(void); -void MakuhitaDojo_GoToFallbackState(void); -bool8 MakuhitaDojo_ReturnFalse(void); -void MakuhitaDojo_SetState(s32); -void MakuhitaDojo_UpdateDialogue(void); - -void sub_802FF1C(void); -void sub_8030208(void); -void sub_8030258(void); -void sub_80302A8(void); -void sub_80304C8(void); -s32 sub_8030668(void); - -u32 MakuhitaDojo_New(u32 mode) -{ - char *monName; - struct OpenedFile *faceFile; - u32 initialState; - - ResetUnusedInputStruct(); - sub_800641C(NULL, 1, 1); - gUnknown_203B318 = MemoryAlloc(sizeof(struct unkStruct_203B318), 8); - gUnknown_203B318->unk10 = -1; - gUnknown_203B318->mode = mode; - - switch (mode) { - case MAKUHITA_DOJO_MODE_UNK0_AWAKE: - initialState = 0; - gUnknown_203B318->isAsleep = FALSE; - break; - case MAKUHITA_DOJO_MODE_UNK1_AWAKE: - initialState = 7; - gUnknown_203B318->isAsleep = FALSE; - break; - case MAKUHITA_DOJO_MODE_UNK2_AWAKE: - initialState = 6; - gUnknown_203B318->isAsleep = FALSE; - break; - case MAKUHITA_DOJO_MODE_UNK3_AWAKE: - initialState = 8; - gUnknown_203B318->isAsleep = FALSE; - break; - case MAKUHITA_DOJO_MODE_UNK4_ASLEEP: - initialState = 0; - gUnknown_203B318->isAsleep = TRUE; - break; - case MAKUHITA_DOJO_MODE_UNK5_ASLEEP: - initialState = 7; - gUnknown_203B318->isAsleep = TRUE; - break; - case MAKUHITA_DOJO_MODE_UNK6_ASLEEP: - initialState = 6; - gUnknown_203B318->isAsleep = TRUE; - break; - case MAKUHITA_DOJO_MODE_UNK7_ASLEEP: - default: - initialState = 8; - gUnknown_203B318->isAsleep = TRUE; - break; - } - - if (gUnknown_203B318->isAsleep == TRUE) - gUnknown_203B318->unk68 = NULL; - else - gUnknown_203B318->unk68 = &gUnknown_203B318->faceFile; - - CopyYellowMonsterNametoBuffer(gUnknown_202E5D8, MONSTER_MAKUHITA); - CopyYellowMonsterNametoBuffer(gUnknown_202E1C8, MONSTER_MAKUHITA); - monName = GetMonSpecies(MONSTER_MAKUHITA); - strcpy(gUnknown_202E1C8 - 0x50, monName); - - faceFile = GetDialogueSpriteDataPtr(MONSTER_MAKUHITA); - gUnknown_203B318->faceFile = faceFile; - gUnknown_203B318->faceData = faceFile->data; - gUnknown_203B318->unk64 = 0; - gUnknown_203B318->unk65 = 0; - gUnknown_203B318->unk66 = 0; - gUnknown_203B318->unk60 = 2; - gUnknown_203B318->unk62 = 8; - MakuhitaDojo_SetState(initialState); - return 1; -} - -u32 sub_802FE58(void) -{ - switch (gUnknown_203B318->state) { - case 0: - case 1: - sub_8030208(); - break; - case 4: - sub_8030258(); - break; - case 11: - sub_80302A8(); - break; - case 13: - return 3; - default: - MakuhitaDojo_GoToFallbackState(); - break; - } - return 0; -} - -s16 sub_802FED0(void) -{ - return gUnknown_203B318->unk10; -} - -void MakuhitaDojo_Delete(void) -{ - if (gUnknown_203B318 != NULL) { - CloseFile(gUnknown_203B318->faceFile); - MemoryFree(gUnknown_203B318); - gUnknown_203B318 = NULL; - } -} - -void MakuhitaDojo_SetState(s32 newState) -{ - gUnknown_203B318->state = newState; - sub_802FF1C(); - MakuhitaDojo_UpdateDialogue(); -} - -void sub_802FF1C(void) -{ - s32 index; - - sub_8006518(gUnknown_203B318->unk6C); - - switch (gUnknown_203B318->state) { - case 0: - case 4: - case 13: - for(index = 0; index < 4; index++) - gUnknown_203B318->unk6C[index] = gUnknown_80E0760; - break; - default: - break; - } - - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B318->unk6C, 1, 1); -} - -void MakuhitaDojo_UpdateDialogue(void) -{ - struct DungeonLocation dLoc; - - switch (gUnknown_203B318->state) { - case 0: - MakuhitaDojo_DrawMainMenu(); - sub_8014248(gMakuhitaDialogue[gUnknown_203B318->isAsleep][0], 0, gUnknown_203B318->menuAction, gUnknown_203B318->unk18, NULL, 4, 0, gUnknown_203B318->unk68, 12); - break; - case 1: - sub_8014248(gMakuhitaDialogue[gUnknown_203B318->isAsleep][1], 0, gUnknown_203B318->menuAction, gUnknown_203B318->unk18, NULL, 4, 0, gUnknown_203B318->unk68, 12); - break; - case 2: - gUnknown_203B318->fallbackState = 13; - sub_80141B4(gMakuhitaDialogue[gUnknown_203B318->isAsleep][2], 0, gUnknown_203B318->unk68, 0x10D); - break; - case 3: - gUnknown_203B318->fallbackState = 4; - sub_80141B4(gMakuhitaDialogue[gUnknown_203B318->isAsleep][3], 0, gUnknown_203B318->unk68, 0x10D); - break; - case 4: - sub_80302E8(3, NULL, 10); - break; - case 5: - gUnknown_203B318->fallbackState = 13; - dLoc.id = sub_80A2740(gUnknown_203B318->unk10); - dLoc.floor = 1; - PrintYellowDungeonNametoBuffer(gAvailablePokemonNames, &dLoc); - sub_80141B4(gMakuhitaDialogue[gUnknown_203B318->isAsleep][4], 0, gUnknown_203B318->unk68, 0x10D); - break; - case 7: - gUnknown_203B318->fallbackState = 13; - sub_80141B4(gMakuhitaDialogue[gUnknown_203B318->isAsleep][6], 0, gUnknown_203B318->unk68, 0x10D); - break; - case 6: - gUnknown_203B318->fallbackState = 13; - sub_80141B4(gMakuhitaDialogue[gUnknown_203B318->isAsleep][5], 0, gUnknown_203B318->unk68, 0x10D); - break; - case 8: - gUnknown_203B318->fallbackState = 9; - sub_80141B4(gMakuhitaDialogue[gUnknown_203B318->isAsleep][7], 0, gUnknown_203B318->unk68, 0x10D); - break; - case 9: - PrintColoredPokeNameToBuffer(gPlayerName, GetPlayerPokemonStruct(), COLOR_YELLOW); - gUnknown_203B318->fallbackState = 11; - PlaySound(0xCB); - sub_80141B4(gMakuhitaDojoBonslyDoll, 0, 0, 0x101); - break; - case 10: - gUnknown_203B318->fallbackState = 13; - sub_80141B4(gMakuhitaDialogue[gUnknown_203B318->isAsleep][8], 0, gUnknown_203B318->unk68, 0x10D); - break; - case 11: - sub_801B60C(1, ITEM_GINSENG, 1); - break; - case 12: - gUnknown_203B318->fallbackState = 1; - sub_80141B4(gMakuhitaDialogue[gUnknown_203B318->isAsleep][9], 0, gUnknown_203B318->unk68, 0x10D); - break; - case 13: - return; - } -} - -void MakuhitaDojo_DrawMainMenu(void) -{ - s32 loopMax; - - gUnknown_203B318->menuAction = 2; - loopMax = 0; - gUnknown_203B318->unk18[loopMax].text = gMakuhitaDojoGoTrain; - gUnknown_203B318->unk18[loopMax].menuAction = 2; - - if (MakuhitaDojo_ReturnFalse()) { - gUnknown_203B318->unk18[loopMax].menuAction = -1; - gUnknown_203B318->menuAction = 1; - } - - loopMax += 1; - gUnknown_203B318->unk18[loopMax].text = *gUnknown_80D4970; - gUnknown_203B318->unk18[loopMax].menuAction = 3; - loopMax += 1; - gUnknown_203B318->unk18[loopMax].text = *gUnknown_80D4934; - gUnknown_203B318->unk18[loopMax].menuAction = 1; - loopMax += 1; - gUnknown_203B318->unk18[loopMax].text = NULL; - gUnknown_203B318->unk18[loopMax].menuAction = 1; -} - -void sub_8030208(void) -{ - s32 menuAction; - if (sub_80144A4(&menuAction) == 0) { - gUnknown_203B318->menuAction = menuAction; - - switch (menuAction) { - case 2: - MakuhitaDojo_SetState(3); - break; - case 3: - MakuhitaDojo_SetState(12); - break; - case 1: - MakuhitaDojo_SetState(2); - break; - } - } -} - -void sub_8030258(void) -{ - switch (sub_80303AC(TRUE)) { - case 3: - gUnknown_203B318->unk10 = sub_8030418(); - sub_8030480(); - MakuhitaDojo_SetState(5); - break; - case 2: - sub_8030480(); - gUnknown_203B318->unk10 = -1; - MakuhitaDojo_SetState(1); - break; - case 0: - case 1: - break; - } -} - -void sub_80302A8(void) -{ - switch (sub_801B6AC()) { - case 2: - case 3: - sub_801B72C(); - MakuhitaDojo_SetState(10); - break; - case 0: - case 1: - break; - } -} - -void MakuhitaDojo_GoToFallbackState(void) -{ - s32 temp; - if (sub_80144A4(&temp) == 0) - MakuhitaDojo_SetState(gUnknown_203B318->fallbackState); -} - -bool8 sub_80302E8(s32 param_1, struct UnkTextStruct2_sub *param_2, u32 param_3) -{ - if (MakuhitaDojo_ReturnFalse()) - return FALSE; - - if (gUnknown_203B31C == NULL) - gUnknown_203B31C = MemoryAlloc(sizeof(struct unkStruct_203B31C), 8); - - gUnknown_203B31C->unk64 = param_1; - gUnknown_203B31C->unk68 = &gUnknown_203B31C->unk6C[param_1]; - sub_8006518(gUnknown_203B31C->unk6C); - gUnknown_203B31C->unk6C[gUnknown_203B31C->unk64] = gUnknown_80E0804; - gUnknown_203B31C->unk68->unk14 = gUnknown_203B31C->unkCC; - - if (param_2 != NULL) - gUnknown_203B31C->unk6C[gUnknown_203B31C->unk64].unk8 = *param_2; - - sub_8012D08(gUnknown_203B31C->unk68, param_3); - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B31C->unk6C, 1, 1); - sub_8013818(&gUnknown_203B31C->input, sub_8030668(), param_3, param_1); - sub_80304C8(); - MakuhitaDojo_DrawCourseList(); - return TRUE; -} - -u32 sub_80303AC(bool8 param_1) -{ - if (param_1 == FALSE) { - sub_8013660(&gUnknown_203B31C->input); - return 0; - } - - switch (GetKeyPress(&gUnknown_203B31C->input)) { - case INPUT_B_BUTTON: - PlayMenuSoundEffect(1); - return 2; - case INPUT_A_BUTTON: - PlayMenuSoundEffect(0); - return 3; - default: - if (sub_80138B8(&gUnknown_203B31C->input, 1)) { - sub_80304C8(); - MakuhitaDojo_DrawCourseList(); - return 1; - } - else - return 0; - } -} - -s16 sub_8030418(void) -{ - return gUnknown_203B31C->unk0[(gUnknown_203B31C->input.unk1E * gUnknown_203B31C->input.unk1C) + gUnknown_203B31C->input.menuIndex]; -} - -// Unused? -void sub_8030444(u8 r0) -{ - gUnknown_203B31C->input.unk22 = sub_8030668(); - sub_8013984(&gUnknown_203B31C->input); - sub_80304C8(); - MakuhitaDojo_DrawCourseList(); - if (r0) - AddMenuCursorSprite(&gUnknown_203B31C->input); -} - -void sub_8030480(void) -{ - if (gUnknown_203B31C != NULL) { - gUnknown_203B31C->unk6C[gUnknown_203B31C->unk64] = gUnknown_80E07EC; - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B31C->unk6C, 1, 1); - MemoryFree(gUnknown_203B31C); - gUnknown_203B31C = NULL; - } -} - -#ifdef NONMATCHING // https://decomp.me/scratch/lM7lE -void sub_80304C8(void) -{ - s16 test; - - gUnknown_203B31C->unkCC[0] = 1; - gUnknown_203B31C->unkCC[1] = 0; - gUnknown_203B31C->unkCC[2] = 8; - gUnknown_203B31C->unkCC[3] = 0; - - test = sub_80095E4(gUnknown_203B31C->input.unk1A, 12) + 2; - gUnknown_203B31C->unk6C[gUnknown_203B31C->unk64].unkE = test; - gUnknown_203B31C->unk6C[gUnknown_203B31C->unk64].unk10 = test + 2; - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B31C->unk6C, 1, 1); -} -#else -NAKED -void sub_80304C8(void) -{ - asm_unified( - "\tpush {r4,lr}\n" - "\tldr r4, _08030538\n" - "\tldr r0, [r4]\n" - "\tadds r0, 0xCC\n" - "\tmovs r2, 0\n" - "\tmovs r1, 0x1\n" - "\tstrb r1, [r0]\n" - "\tldr r0, [r4]\n" - "\tadds r0, 0xCD\n" - "\tstrb r2, [r0]\n" - "\tldr r0, [r4]\n" - "\tadds r0, 0xCE\n" - "\tmovs r1, 0x8\n" - "\tstrb r1, [r0]\n" - "\tldr r0, [r4]\n" - "\tadds r0, 0xCF\n" - "\tstrb r2, [r0]\n" - "\tldr r0, [r4]\n" - "\tadds r0, 0x4A\n" - "\tmovs r1, 0\n" - "\tldrsh r0, [r0, r1]\n" - "\tmovs r1, 0xC\n" - "\tbl sub_80095E4\n" - "\tadds r0, 0x2\n" - "\tlsls r0, 16\n" - "\tldr r2, [r4]\n" - "\tldr r3, [r2, 0x64]\n" - "\tlsls r1, r3, 1\n" - "\tadds r1, r3\n" - "\tlsls r1, 3\n" - "\tadds r1, r2, r1\n" - "\tadds r1, 0x7A\n" - "\tasrs r3, r0, 16\n" - "\tlsrs r0, 16\n" - "\tstrh r0, [r1]\n" - "\tldr r1, [r2, 0x64]\n" - "\tlsls r0, r1, 1\n" - "\tadds r0, r1\n" - "\tlsls r0, 3\n" - "\tadds r2, r0\n" - "\tadds r3, 0x2\n" - "\tadds r2, 0x7C\n" - "\tstrh r3, [r2]\n" - "\tbl ResetUnusedInputStruct\n" - "\tldr r0, [r4]\n" - "\tadds r0, 0x6C\n" - "\tmovs r1, 0x1\n" - "\tmovs r2, 0x1\n" - "\tbl sub_800641C\n" - "\tpop {r4}\n" - "\tpop {r0}\n" - "\tbx r0\n" - "\t.align 2, 0\n" -"_08030538: .4byte gUnknown_203B31C"); -} -#endif // NONMATCHING - -void MakuhitaDojo_DrawCourseList(void) -{ - u8 dungeonIndex; - s32 mazeIndex; - s32 y; - s32 iVar6; - u32 color; - s32 index; - u8 buffer[256]; - - sub_8008C54(gUnknown_203B31C->unk64); - sub_80073B8(gUnknown_203B31C->unk64); - xxx_call_draw_string(10, 0, gMakuhitaDojoHeader, gUnknown_203B31C->unk64, 0); // Courses - sub_8012BC4((gUnknown_203B31C->unkCC[2] * 8) + 4, 0, gUnknown_203B31C->input.unk1E + 1, 2, 7, gUnknown_203B31C->unk64); - - for (index = 0; index < gUnknown_203B31C->input.unk1A; index++) { - iVar6 = gUnknown_203B31C->unk0[gUnknown_203B31C->input.unk1E * gUnknown_203B31C->input.unk1C + index]; - dungeonIndex = sub_80A2740(iVar6); - - mazeIndex = sub_80A2668(iVar6); - - y = sub_8013800(&gUnknown_203B31C->input, index); - color = COLOR_WHITE_2; // COLOR_WHITE again? - if (IsMazeCompleted(mazeIndex)) { - xxx_call_draw_string(8, y, gUnknown_80E0824, gUnknown_203B31C->unk64, 0); // Draw Star symbol - color = COLOR_GREEN; - } - sprintfStatic(buffer, gMakuhitaCoursePlaceholder, color, GetDungeonName1(dungeonIndex)); // "#c%c%s#r" - xxx_call_draw_string(16, y, buffer, gUnknown_203B31C->unk64, 0); - } - sub_80073E0(gUnknown_203B31C->unk64); -} - -s32 sub_8030668(void) -{ - s32 index; - s32 counter; - - counter = 0; - - for (index = 0; index < NUM_DUNGEON_MAZE; index++) { - if (sub_8097504(index)) { - gUnknown_203B31C->unk0[counter] = sub_80A26CC(index); - counter++; - } - } - return counter; -} - -bool8 MakuhitaDojo_ReturnFalse(void) -{ - return FALSE; -} \ No newline at end of file diff --git a/src/makuhita_dojo1.c b/src/makuhita_dojo1.c new file mode 100644 index 000000000..0034b8236 --- /dev/null +++ b/src/makuhita_dojo1.c @@ -0,0 +1,322 @@ +#include "global.h" +#include "code_80118A4.h" +#include "code_80130A8.h" +#include "code_801B60C.h" +#include "code_80A26CC.h" +#include "constants/colors.h" +#include "dungeon.h" +#include "makuhita_dojo1.h" +#include "makuhita_dojo2.h" +#include "memory.h" +#include "pokemon.h" +#include "text1.h" +#include "text2.h" + +extern u8 gAvailablePokemonNames[]; // 202DF98 +extern u8 gUnknown_202E1C8[]; +extern u8 gPlayerName[]; // 202E2B8 +extern u8 gUnknown_202E5D8[]; + +static EWRAM_DATA_2 MakuhitaDojoWork1 *sMakuhitaDojoWork1 = {0}; + +// data_80D47B8.s +extern const u8 *gUnknown_80D4934[]; +extern const u8 *gUnknown_80D4970[]; +// data_80D47B8.s +extern const u8 *gMakuhitaDialogue[2][10]; // 80D9FC8 + +#include "data/makuhita_dojo1.h" // 80E0760 + +static void MakuhitaDojo_DrawMainMenu(void); +static void MakuhitaDojo_GoToFallbackState(void); +static void MakuhitaDojo_SetState(s32); +static void MakuhitaDojo_UpdateDialogue(void); + +static void sub_802FF1C(void); +static void sub_8030208(void); +static void sub_8030258(void); +static void sub_80302A8(void); + +bool8 MakuhitaDojo_New(u32 mode) +{ + u8 *monName; + OpenedFile *faceFile; + u32 initialState; + + ResetUnusedInputStruct(); + sub_800641C(NULL, TRUE, TRUE); + + sMakuhitaDojoWork1 = MemoryAlloc(sizeof(MakuhitaDojoWork1), 8); + sMakuhitaDojoWork1->unk10 = -1; + sMakuhitaDojoWork1->mode = mode; + + switch (mode) { + case MAKUHITA_DOJO_MODE_UNK0_AWAKE: + initialState = 0; + sMakuhitaDojoWork1->isAsleep = FALSE; + break; + case MAKUHITA_DOJO_MODE_UNK1_AWAKE: + initialState = 7; + sMakuhitaDojoWork1->isAsleep = FALSE; + break; + case MAKUHITA_DOJO_MODE_UNK2_AWAKE: + initialState = 6; + sMakuhitaDojoWork1->isAsleep = FALSE; + break; + case MAKUHITA_DOJO_MODE_UNK3_AWAKE: + initialState = 8; + sMakuhitaDojoWork1->isAsleep = FALSE; + break; + case MAKUHITA_DOJO_MODE_UNK4_ASLEEP: + initialState = 0; + sMakuhitaDojoWork1->isAsleep = TRUE; + break; + case MAKUHITA_DOJO_MODE_UNK5_ASLEEP: + initialState = 7; + sMakuhitaDojoWork1->isAsleep = TRUE; + break; + case MAKUHITA_DOJO_MODE_UNK6_ASLEEP: + initialState = 6; + sMakuhitaDojoWork1->isAsleep = TRUE; + break; + case MAKUHITA_DOJO_MODE_UNK7_ASLEEP: + default: + initialState = 8; + sMakuhitaDojoWork1->isAsleep = TRUE; + break; + } + + if (sMakuhitaDojoWork1->isAsleep == TRUE) + sMakuhitaDojoWork1->unk68 = NULL; + else + sMakuhitaDojoWork1->unk68 = &sMakuhitaDojoWork1->faceFile; + + CopyYellowMonsterNametoBuffer(gUnknown_202E5D8, MONSTER_MAKUHITA); + CopyYellowMonsterNametoBuffer(gUnknown_202E1C8, MONSTER_MAKUHITA); + monName = GetMonSpecies(MONSTER_MAKUHITA); + strcpy(gUnknown_202E1C8 - 0x50, monName); + + faceFile = GetDialogueSpriteDataPtr(MONSTER_MAKUHITA); + sMakuhitaDojoWork1->faceFile = faceFile; + sMakuhitaDojoWork1->faceData = faceFile->data; + sMakuhitaDojoWork1->unk64 = 0; + sMakuhitaDojoWork1->unk65 = 0; + sMakuhitaDojoWork1->unk66 = 0; + sMakuhitaDojoWork1->unk60 = 2; + sMakuhitaDojoWork1->unk62 = 8; + MakuhitaDojo_SetState(initialState); + return TRUE; +} + +u32 sub_802FE58(void) +{ + switch (sMakuhitaDojoWork1->state) { + case 0: + case 1: + sub_8030208(); + break; + case 4: + sub_8030258(); + break; + case 11: + sub_80302A8(); + break; + case 13: + return 3; + default: + MakuhitaDojo_GoToFallbackState(); + break; + } + return 0; +} + +s16 sub_802FED0(void) +{ + return sMakuhitaDojoWork1->unk10; +} + +void MakuhitaDojo_Delete(void) +{ + if (sMakuhitaDojoWork1 != NULL) { + CloseFile(sMakuhitaDojoWork1->faceFile); + MemoryFree(sMakuhitaDojoWork1); + sMakuhitaDojoWork1 = NULL; + } +} + +static void MakuhitaDojo_SetState(s32 newState) +{ + sMakuhitaDojoWork1->state = newState; + sub_802FF1C(); + MakuhitaDojo_UpdateDialogue(); +} + +static void sub_802FF1C(void) +{ + s32 index; + + sub_8006518(sMakuhitaDojoWork1->unk6C); + + switch (sMakuhitaDojoWork1->state) { + case 0: + case 4: + case 13: + for(index = 0; index < 4; index++) + sMakuhitaDojoWork1->unk6C[index] = sUnknown_80E0760; + break; + default: + break; + } + + ResetUnusedInputStruct(); + sub_800641C(sMakuhitaDojoWork1->unk6C, TRUE, TRUE); +} + +static void MakuhitaDojo_UpdateDialogue(void) +{ + DungeonLocation dLoc; + + switch (sMakuhitaDojoWork1->state) { + case 0: + MakuhitaDojo_DrawMainMenu(); + sub_8014248(gMakuhitaDialogue[sMakuhitaDojoWork1->isAsleep][0], 0, sMakuhitaDojoWork1->menuAction, sMakuhitaDojoWork1->unk18, NULL, 4, 0, sMakuhitaDojoWork1->unk68, 12); + break; + case 1: + sub_8014248(gMakuhitaDialogue[sMakuhitaDojoWork1->isAsleep][1], 0, sMakuhitaDojoWork1->menuAction, sMakuhitaDojoWork1->unk18, NULL, 4, 0, sMakuhitaDojoWork1->unk68, 12); + break; + case 2: + sMakuhitaDojoWork1->fallbackState = 13; + sub_80141B4(gMakuhitaDialogue[sMakuhitaDojoWork1->isAsleep][2], 0, sMakuhitaDojoWork1->unk68, 0x10D); + break; + case 3: + sMakuhitaDojoWork1->fallbackState = 4; + sub_80141B4(gMakuhitaDialogue[sMakuhitaDojoWork1->isAsleep][3], 0, sMakuhitaDojoWork1->unk68, 0x10D); + break; + case 4: + sub_80302E8(3, NULL, 10); + break; + case 5: + sMakuhitaDojoWork1->fallbackState = 13; + dLoc.id = sub_80A2740(sMakuhitaDojoWork1->unk10); + dLoc.floor = 1; + PrintYellowDungeonNametoBuffer(gAvailablePokemonNames, &dLoc); + sub_80141B4(gMakuhitaDialogue[sMakuhitaDojoWork1->isAsleep][4], 0, sMakuhitaDojoWork1->unk68, 0x10D); + break; + case 7: + sMakuhitaDojoWork1->fallbackState = 13; + sub_80141B4(gMakuhitaDialogue[sMakuhitaDojoWork1->isAsleep][6], 0, sMakuhitaDojoWork1->unk68, 0x10D); + break; + case 6: + sMakuhitaDojoWork1->fallbackState = 13; + sub_80141B4(gMakuhitaDialogue[sMakuhitaDojoWork1->isAsleep][5], 0, sMakuhitaDojoWork1->unk68, 0x10D); + break; + case 8: + sMakuhitaDojoWork1->fallbackState = 9; + sub_80141B4(gMakuhitaDialogue[sMakuhitaDojoWork1->isAsleep][7], 0, sMakuhitaDojoWork1->unk68, 0x10D); + break; + case 9: + PrintColoredPokeNameToBuffer(gPlayerName, GetPlayerPokemonStruct(), COLOR_YELLOW); + sMakuhitaDojoWork1->fallbackState = 11; + PlaySound(203); + sub_80141B4(sReceivedBonslyDoll, 0, 0, 0x101); + break; + case 10: + sMakuhitaDojoWork1->fallbackState = 13; + sub_80141B4(gMakuhitaDialogue[sMakuhitaDojoWork1->isAsleep][8], 0, sMakuhitaDojoWork1->unk68, 0x10D); + break; + case 11: + sub_801B60C(1, ITEM_GINSENG, 1); + break; + case 12: + sMakuhitaDojoWork1->fallbackState = 1; + sub_80141B4(gMakuhitaDialogue[sMakuhitaDojoWork1->isAsleep][9], 0, sMakuhitaDojoWork1->unk68, 0x10D); + break; + case 13: + return; + } +} + +static void MakuhitaDojo_DrawMainMenu(void) +{ + s32 loopMax; + + sMakuhitaDojoWork1->menuAction = 2; + loopMax = 0; + sMakuhitaDojoWork1->unk18[loopMax].text = sGoTrain; + sMakuhitaDojoWork1->unk18[loopMax].menuAction = 2; + + if (MakuhitaDojo_ReturnFalse()) { + sMakuhitaDojoWork1->unk18[loopMax].menuAction = -1; + sMakuhitaDojoWork1->menuAction = 1; + } + + loopMax += 1; + sMakuhitaDojoWork1->unk18[loopMax].text = *gUnknown_80D4970; + sMakuhitaDojoWork1->unk18[loopMax].menuAction = 3; + loopMax += 1; + sMakuhitaDojoWork1->unk18[loopMax].text = *gUnknown_80D4934; + sMakuhitaDojoWork1->unk18[loopMax].menuAction = 1; + loopMax += 1; + sMakuhitaDojoWork1->unk18[loopMax].text = NULL; + sMakuhitaDojoWork1->unk18[loopMax].menuAction = 1; +} + +static void sub_8030208(void) +{ + s32 menuAction; + if (sub_80144A4(&menuAction) == 0) { + sMakuhitaDojoWork1->menuAction = menuAction; + + switch (menuAction) { + case 2: + MakuhitaDojo_SetState(3); + break; + case 3: + MakuhitaDojo_SetState(12); + break; + case 1: + MakuhitaDojo_SetState(2); + break; + } + } +} + +static void sub_8030258(void) +{ + switch (sub_80303AC(TRUE)) { + case 3: + sMakuhitaDojoWork1->unk10 = sub_8030418(); + sub_8030480(); + MakuhitaDojo_SetState(5); + break; + case 2: + sub_8030480(); + sMakuhitaDojoWork1->unk10 = -1; + MakuhitaDojo_SetState(1); + break; + case 0: + case 1: + break; + } +} + +static void sub_80302A8(void) +{ + switch (sub_801B6AC()) { + case 2: + case 3: + sub_801B72C(); + MakuhitaDojo_SetState(10); + break; + case 0: + case 1: + break; + } +} + +static void MakuhitaDojo_GoToFallbackState(void) +{ + s32 temp; + if (sub_80144A4(&temp) == 0) + MakuhitaDojo_SetState(sMakuhitaDojoWork1->fallbackState); +} \ No newline at end of file diff --git a/src/makuhita_dojo2.c b/src/makuhita_dojo2.c new file mode 100644 index 000000000..ff3416328 --- /dev/null +++ b/src/makuhita_dojo2.c @@ -0,0 +1,231 @@ +#include "global.h" +#include "code_800D090.h" +#include "code_80118A4.h" +#include "code_80972F4.h" +#include "code_80A26CC.h" +#include "constants/colors.h" +#include "constants/input.h" +#include "dungeon.h" +#include "makuhita_dojo2.h" +#include "memory.h" +#include "menu_input.h" +#include "text1.h" +#include "text2.h" + +static EWRAM_DATA_2 MakuhitaDojoWork2 *sMakuhitaDojoWork2 = {0}; + +#include "data/makuhita_dojo2.h" // 80E07EC + +static void MakuhitaDojo_DrawCourseList(void); + +static void sub_80304C8(void); +static s32 sub_8030668(void); + +bool8 sub_80302E8(s32 param_1, UnkTextStruct2_sub *param_2, u32 param_3) +{ + if (MakuhitaDojo_ReturnFalse()) + return FALSE; + + if (sMakuhitaDojoWork2 == NULL) + sMakuhitaDojoWork2 = MemoryAlloc(sizeof(MakuhitaDojoWork2), 8); + + sMakuhitaDojoWork2->unk64 = param_1; + sMakuhitaDojoWork2->unk68 = &sMakuhitaDojoWork2->unk6C[param_1]; + sub_8006518(sMakuhitaDojoWork2->unk6C); + sMakuhitaDojoWork2->unk6C[sMakuhitaDojoWork2->unk64] = sUnknown_80E0804; + sMakuhitaDojoWork2->unk68->unk14 = sMakuhitaDojoWork2->unkCC; + + if (param_2 != NULL) + sMakuhitaDojoWork2->unk6C[sMakuhitaDojoWork2->unk64].unk8 = *param_2; + + sub_8012D08(sMakuhitaDojoWork2->unk68, param_3); + ResetUnusedInputStruct(); + sub_800641C(sMakuhitaDojoWork2->unk6C, TRUE, TRUE); + sub_8013818(&sMakuhitaDojoWork2->input, sub_8030668(), param_3, param_1); + sub_80304C8(); + MakuhitaDojo_DrawCourseList(); + return TRUE; +} + +u32 sub_80303AC(bool8 param_1) +{ + if (param_1 == FALSE) { + sub_8013660(&sMakuhitaDojoWork2->input); + return 0; + } + + switch (GetKeyPress(&sMakuhitaDojoWork2->input)) { + case INPUT_B_BUTTON: + PlayMenuSoundEffect(1); + return 2; + case INPUT_A_BUTTON: + PlayMenuSoundEffect(0); + return 3; + default: + if (sub_80138B8(&sMakuhitaDojoWork2->input, 1)) { + sub_80304C8(); + MakuhitaDojo_DrawCourseList(); + return 1; + } + else + return 0; + } +} + +s16 sub_8030418(void) +{ + return sMakuhitaDojoWork2->unk0[(sMakuhitaDojoWork2->input.unk1E * sMakuhitaDojoWork2->input.unk1C) + sMakuhitaDojoWork2->input.menuIndex]; +} + +UNUSED static void sub_8030444(bool8 a0) +{ + sMakuhitaDojoWork2->input.unk22 = sub_8030668(); + sub_8013984(&sMakuhitaDojoWork2->input); + sub_80304C8(); + MakuhitaDojo_DrawCourseList(); + if (a0) + AddMenuCursorSprite(&sMakuhitaDojoWork2->input); +} + +void sub_8030480(void) +{ + if (sMakuhitaDojoWork2 != NULL) { + sMakuhitaDojoWork2->unk6C[sMakuhitaDojoWork2->unk64] = sUnknown_80E07EC; + ResetUnusedInputStruct(); + sub_800641C(sMakuhitaDojoWork2->unk6C, TRUE, TRUE); + MemoryFree(sMakuhitaDojoWork2); + sMakuhitaDojoWork2 = NULL; + } +} + +#ifdef NONMATCHING // sub_80095E4 memes https://decomp.me/scratch/lM7lE +static void sub_80304C8(void) +{ + s16 test; + + sMakuhitaDojoWork2->unkCC[0] = 1; + sMakuhitaDojoWork2->unkCC[1] = 0; + sMakuhitaDojoWork2->unkCC[2] = 8; + sMakuhitaDojoWork2->unkCC[3] = 0; + + test = sub_80095E4(sMakuhitaDojoWork2->input.unk1A, 12) + 2; + sMakuhitaDojoWork2->unk6C[sMakuhitaDojoWork2->unk64].unkE = test; + sMakuhitaDojoWork2->unk6C[sMakuhitaDojoWork2->unk64].unk10 = test + 2; + ResetUnusedInputStruct(); + sub_800641C(sMakuhitaDojoWork2->unk6C, TRUE, TRUE); +} +#else +NAKED +static void sub_80304C8(void) +{ + asm_unified( + "\tpush {r4,lr}\n" + "\tldr r4, _08030538\n" + "\tldr r0, [r4]\n" + "\tadds r0, 0xCC\n" + "\tmovs r2, 0\n" + "\tmovs r1, 0x1\n" + "\tstrb r1, [r0]\n" + "\tldr r0, [r4]\n" + "\tadds r0, 0xCD\n" + "\tstrb r2, [r0]\n" + "\tldr r0, [r4]\n" + "\tadds r0, 0xCE\n" + "\tmovs r1, 0x8\n" + "\tstrb r1, [r0]\n" + "\tldr r0, [r4]\n" + "\tadds r0, 0xCF\n" + "\tstrb r2, [r0]\n" + "\tldr r0, [r4]\n" + "\tadds r0, 0x4A\n" + "\tmovs r1, 0\n" + "\tldrsh r0, [r0, r1]\n" + "\tmovs r1, 0xC\n" + "\tbl sub_80095E4\n" + "\tadds r0, 0x2\n" + "\tlsls r0, 16\n" + "\tldr r2, [r4]\n" + "\tldr r3, [r2, 0x64]\n" + "\tlsls r1, r3, 1\n" + "\tadds r1, r3\n" + "\tlsls r1, 3\n" + "\tadds r1, r2, r1\n" + "\tadds r1, 0x7A\n" + "\tasrs r3, r0, 16\n" + "\tlsrs r0, 16\n" + "\tstrh r0, [r1]\n" + "\tldr r1, [r2, 0x64]\n" + "\tlsls r0, r1, 1\n" + "\tadds r0, r1\n" + "\tlsls r0, 3\n" + "\tadds r2, r0\n" + "\tadds r3, 0x2\n" + "\tadds r2, 0x7C\n" + "\tstrh r3, [r2]\n" + "\tbl ResetUnusedInputStruct\n" + "\tldr r0, [r4]\n" + "\tadds r0, 0x6C\n" + "\tmovs r1, 0x1\n" + "\tmovs r2, 0x1\n" + "\tbl sub_800641C\n" + "\tpop {r4}\n" + "\tpop {r0}\n" + "\tbx r0\n" + "\t.align 2, 0\n" +"_08030538: .4byte sMakuhitaDojoWork2"); +} +#endif // NONMATCHING + +static void MakuhitaDojo_DrawCourseList(void) +{ + u8 dungeonIndex; + s32 mazeIndex; + s32 y; + s32 iVar6; + u32 color; + s32 i; + u8 buffer[256]; + + sub_8008C54(sMakuhitaDojoWork2->unk64); + sub_80073B8(sMakuhitaDojoWork2->unk64); + xxx_call_draw_string(10, 0, sCourses, sMakuhitaDojoWork2->unk64, 0); + sub_8012BC4((sMakuhitaDojoWork2->unkCC[2] * 8) + 4, 0, sMakuhitaDojoWork2->input.unk1E + 1, 2, 7, sMakuhitaDojoWork2->unk64); + + for (i = 0; i < sMakuhitaDojoWork2->input.unk1A; i++) { + iVar6 = sMakuhitaDojoWork2->unk0[sMakuhitaDojoWork2->input.unk1E * sMakuhitaDojoWork2->input.unk1C + i]; + dungeonIndex = sub_80A2740(iVar6); + + mazeIndex = sub_80A2668(iVar6); + + y = sub_8013800(&sMakuhitaDojoWork2->input, i); + color = COLOR_WHITE_2; // COLOR_WHITE again? + if ((bool8)IsMazeCompleted(mazeIndex)) { + xxx_call_draw_string(8, y, sStarBullet, sMakuhitaDojoWork2->unk64, 0); + color = COLOR_GREEN; + } + sprintfStatic(buffer, sFmtColor, color, GetDungeonName1(dungeonIndex)); + xxx_call_draw_string(16, y, buffer, sMakuhitaDojoWork2->unk64, 0); + } + sub_80073E0(sMakuhitaDojoWork2->unk64); +} + +static s32 sub_8030668(void) +{ + s32 i; + s32 counter; + + counter = 0; + + for (i = 0; i < NUM_DUNGEON_MAZE; i++) { + if (sub_8097504(i)) { + sMakuhitaDojoWork2->unk0[counter] = sub_80A26CC(i); + counter++; + } + } + return counter; +} + +bool8 MakuhitaDojo_ReturnFalse(void) +{ + return FALSE; +} \ No newline at end of file diff --git a/src/memory.c b/src/memory.c index c03a6efcb..b6165ab05 100644 --- a/src/memory.c +++ b/src/memory.c @@ -2,12 +2,13 @@ #include "cpu.h" #include "memory.h" -extern struct HeapFreeListElement gMainHeapFreeList[32]; -extern u8 gMainHeap[HEAP_SIZE]; -extern struct HeapDescriptor gMainHeapDescriptor; - -EWRAM_DATA struct HeapDescriptor *gHeapDescriptorList[8] = {0}; -EWRAM_DATA u32 gHeapCount = {0}; +EWRAM_DATA struct HeapDescriptor *gHeapDescriptorList[8] = {0}; // 2000E88 +EWRAM_DATA u32 gHeapCount = {0}; // 2000EA8 +UNUSED static EWRAM_DATA u32 sUnused1 = {0}; // 2000EAC +EWRAM_DATA struct HeapDescriptor gMainHeapDescriptor = {0}; // 2000EB0 +UNUSED static EWRAM_DATA u32 sUnused2 = {0}; // 2000ECC +extern struct HeapFreeListElement gMainHeapFreeList[32]; // 2000ED0 (CAPACITY OR STRUCT SIZE IS WRONG) +extern u8 gMainHeap[HEAP_SIZE]; // 20011D0 void InitHeapInternal(void); diff --git a/src/menu_input.c b/src/menu_input.c index b967cbbf1..d53c636bf 100644 --- a/src/menu_input.c +++ b/src/menu_input.c @@ -19,13 +19,14 @@ extern const u8 gUnknown_80D4828[]; extern s32 sub_8008ED0(const u8 *); extern s16 sub_8009614(u32, u32); -static void sub_8013134(struct MenuInputStruct *, u32, u32); +static void sub_8013134(MenuInputStruct *, u32, u32); static void sub_801332C(s16 *); -static void sub_8013470(struct MenuInputStruct *); +static void sub_8013470(MenuInputStruct *); +ALIGNED(4) static const char fill_save7[] = _("pksdir0"); const u32 gDefaultMenuTextColors[3] = { COLOR_WHITE_2, COLOR_RED, COLOR_RED }; -u32 sub_8012A64(struct MenuInputStructSub *r0, s32 r1) +u32 sub_8012A64(MenuInputStructSub *r0, s32 r1) { if (r0 == NULL) return sub_8012AE8(); @@ -45,7 +46,7 @@ u32 sub_8012A64(struct MenuInputStructSub *r0, s32 r1) return INPUT_B_BUTTON; } -s32 GetKeyPress(struct MenuInputStruct *r0) +s32 GetKeyPress(MenuInputStruct *r0) { if (r0 != NULL) { if (r0->unk28.a_button != 0) @@ -180,7 +181,7 @@ void sub_8012C60(u32 x, u32 y, u32 a2, u32 color, u32 a4) xxx_call_draw_char(x + add_x, y, uVar2, color, a4); } -void sub_8012CAC(struct UnkTextStruct2 *a0, const struct MenuItem *a1) +void sub_8012CAC(UnkTextStruct2 *a0, const MenuItem *a1) { s16 length; int r5; @@ -221,8 +222,8 @@ void sub_8012CAC(struct UnkTextStruct2 *a0, const struct MenuItem *a1) sub_8012D08(a0, r7); } -NAKED -void sub_8012D08(struct UnkTextStruct2 *a0, s32 a1) +NAKED // sub_80095E4 memes +void sub_8012D08(UnkTextStruct2 *a0, s32 a1) { asm_unified( "\tpush {r4,lr}\n" @@ -250,7 +251,7 @@ void sub_8012D08(struct UnkTextStruct2 *a0, s32 a1) // https://decomp.me/scratch/QadfW (200 - 90% matched) - Seth NAKED -void sub_8012D34(struct UnkTextStruct2 *a0, s32 a1) +void sub_8012D34(UnkTextStruct2 *a0, s32 a1) { asm_unified( "\tpush {r4,lr}\n" @@ -276,7 +277,7 @@ void sub_8012D34(struct UnkTextStruct2 *a0, s32 a1) "\tbx r0"); } -void sub_8012D60(struct MenuStruct *param_1, const struct MenuItem *menuItems, u32 *colorArray, u16 *param_4, s32 menuAction, s32 index) +void sub_8012D60(MenuStruct *param_1, const MenuItem *menuItems, u32 *colorArray, u16 *param_4, s32 menuAction, s32 index) { const u8 *textPtr; s32 counter; @@ -323,11 +324,11 @@ void sub_8012D60(struct MenuStruct *param_1, const struct MenuItem *menuItems, u param_1->menuAction = -1; } -void sub_8012E04(struct MenuStruct *param_1, const struct MenuItem *menuItems, u32 *colorArray, u16 *param_4, s32 menuAction, s32 index) +void sub_8012E04(MenuStruct *param_1, const MenuItem *menuItems, u32 *colorArray, u16 *param_4, s32 menuAction, s32 index) { const u8 *textPtr; s32 counter; - const struct MenuItem *menuItemPtr; + const MenuItem *menuItemPtr; s32 iVar1; s32 menuIndex; @@ -371,28 +372,28 @@ void sub_8012E04(struct MenuStruct *param_1, const struct MenuItem *menuItems, u param_1->menuAction = -1; } -void sub_8012EA4(struct MenuStruct *param_1, bool8 r1) +void sub_8012EA4(MenuStruct *param_1, bool8 r1) { param_1->unk4C = r1; param_1->unk4D = TRUE; sub_8012EBC(param_1); } -void sub_8012EBC(struct MenuStruct *param_1) +void sub_8012EBC(MenuStruct *param_1) { s32 x; s32 y; u32 color; const u8 *textPtr; - const struct MenuItem *menuItemsPtr; + const MenuItem *menuItemsPtr; u16 *_puVar2; const u32 *colorArray; s32 counter; s32 index; - struct UnkTextStruct2 textStack[4]; + UnkTextStruct2 textStack[4]; u8 buffer[256]; - struct UnkTextStruct1 *ptr_text; - struct UnkTextStruct2 *ptr_text2; + UnkTextStruct1 *ptr_text; + UnkTextStruct2 *ptr_text2; if (param_1->unk4D) { sub_80073B8(param_1->index); @@ -446,11 +447,11 @@ void sub_8012EBC(struct MenuStruct *param_1) } } -bool8 sub_8012FD8(struct MenuStruct *param_1) +bool8 sub_8012FD8(MenuStruct *param_1) { u32 prevMenuIndex; s32 index; - const struct MenuItem *item; + const MenuItem *item; prevMenuIndex = param_1->input.menuIndex; @@ -500,10 +501,10 @@ bool8 sub_8012FD8(struct MenuStruct *param_1) return param_1->unk4C; } -bool8 sub_80130A8(struct MenuStruct *param_1) +bool8 sub_80130A8(MenuStruct *param_1) { s32 index; - const struct MenuItem *menuItem; + const MenuItem *menuItem; if (param_1->unk4C) { switch (GetKeyPress(¶m_1->input)) @@ -530,7 +531,7 @@ bool8 sub_80130A8(struct MenuStruct *param_1) return param_1->unk4C; } -bool8 sub_8013114(struct MenuStruct *param_1, s32 *menuAction) +bool8 sub_8013114(MenuStruct *param_1, s32 *menuAction) { if (param_1->unk4C) return TRUE; @@ -541,9 +542,9 @@ bool8 sub_8013114(struct MenuStruct *param_1, s32 *menuAction) return FALSE; } -static void sub_8013134(struct MenuInputStruct *param_1, u32 menuItemCounter, u32 index) +static void sub_8013134(MenuInputStruct *param_1, u32 menuItemCounter, u32 index) { - struct UnkTextStruct1 *temp; + UnkTextStruct1 *temp; temp = &gUnknown_2027370[index]; @@ -566,7 +567,7 @@ static void sub_8013134(struct MenuInputStruct *param_1, u32 menuItemCounter, u3 sub_801317C(¶m_1->unk28); } -void sub_801317C(struct MenuInputStructSub *param_1) +void sub_801317C(MenuInputStructSub *param_1) { param_1->unk0 = 0; param_1->a_button = 0; @@ -579,15 +580,15 @@ void sub_801317C(struct MenuInputStructSub *param_1) ResetUnusedInputStruct(); } -void AddMenuCursorSprite(struct MenuInputStruct *param_1) +void AddMenuCursorSprite(MenuInputStruct *param_1) { AddMenuCursorSprite_(param_1, 0); } -void AddMenuCursorSprite_(struct MenuInputStruct *a0, u32 a1) +void AddMenuCursorSprite_(MenuInputStruct *a0, u32 a1) { - struct SpriteOAM sp = {}; - struct SpriteOAM* ptr; + SpriteOAM sp = {}; + SpriteOAM* ptr; s32 value; s32 r0; s32 r1; @@ -666,15 +667,15 @@ void AddMenuCursorSprite_(struct MenuInputStruct *a0, u32 a1) a0->unk24++; } -void nullsub_34(struct MenuInputStructSub *a0) +void nullsub_34(MenuInputStructSub *a0) { } -// Maybe struct Position +// Maybe Position static void sub_801332C(s16 *a0) { - struct SpriteOAM sp = {}; - struct SpriteOAM* ptr; + SpriteOAM sp = {}; + SpriteOAM* ptr; #ifdef NONMATCHING u32 r0, r1, r2; #else @@ -741,14 +742,14 @@ static void sub_801332C(s16 *a0) AddSprite(&sp, 0xFF, NULL, NULL); } -static void sub_8013470(struct MenuInputStruct *a0) +static void sub_8013470(MenuInputStruct *a0) { - struct SpriteOAM sp = {}; + SpriteOAM sp = {}; #if NONMATCHING - struct SpriteOAM *ptr; + SpriteOAM *ptr; u32 r0, r1, r5; #else - register struct SpriteOAM *ptr asm("r3"); + register SpriteOAM *ptr asm("r3"); register u32 r0 asm("r0"); register u32 r1 asm("r1"); register u32 r5 asm("r5"); @@ -870,7 +871,7 @@ static void sub_8013470(struct MenuInputStruct *a0) } } -void sub_8013660(struct MenuInputStruct *param_1) +void sub_8013660(MenuInputStruct *param_1) { if (0 < param_1->unk1A) { UpdateMenuCursorSpriteCoords(param_1); @@ -878,10 +879,10 @@ void sub_8013660(struct MenuInputStruct *param_1) } } -void UpdateMenuCursorSpriteCoords(struct MenuInputStruct *param_1) +void UpdateMenuCursorSpriteCoords(MenuInputStruct *param_1) { s32 index; - struct UnkTextStruct1 *temp; + UnkTextStruct1 *temp; index = param_1->unk0; temp = &gUnknown_2027370[index]; @@ -889,7 +890,7 @@ void UpdateMenuCursorSpriteCoords(struct MenuInputStruct *param_1) param_1->unkA = temp->unk2 * 8 + sub_8013800(param_1, param_1->menuIndex); } -void MoveMenuCursorDown(struct MenuInputStruct *param_1) +void MoveMenuCursorDown(MenuInputStruct *param_1) { param_1->unk24 = 0; @@ -903,7 +904,7 @@ void MoveMenuCursorDown(struct MenuInputStruct *param_1) } } -void sub_80136E0(struct MenuInputStruct *param_1, u8 param_2) +void sub_80136E0(MenuInputStruct *param_1, u8 param_2) { param_1->unk24 = 0; @@ -921,7 +922,7 @@ void sub_80136E0(struct MenuInputStruct *param_1, u8 param_2) } } -void MoveMenuCursorUp(struct MenuInputStruct *param_1) +void MoveMenuCursorUp(MenuInputStruct *param_1) { param_1->unk24 = 0; @@ -935,7 +936,7 @@ void MoveMenuCursorUp(struct MenuInputStruct *param_1) } } -void sub_8013744(struct MenuInputStruct *param_1, u8 param_2) +void sub_8013744(MenuInputStruct *param_1, u8 param_2) { param_1->unk24 = 0; @@ -953,7 +954,7 @@ void sub_8013744(struct MenuInputStruct *param_1, u8 param_2) } } -void sub_8013780(struct MenuInputStruct *param_1, s32 param_2) +void sub_8013780(MenuInputStruct *param_1, s32 param_2) { if (param_2 < 0) param_1->menuIndex = 0; @@ -965,12 +966,12 @@ void sub_8013780(struct MenuInputStruct *param_1, s32 param_2) param_1->unk24 = 0; } -s32 sub_80137A8(struct MenuInputStruct *param_1) +s32 sub_80137A8(MenuInputStruct *param_1) { return param_1->menuIndex; } -void sub_80137B0(struct MenuInputStruct *param_1, s32 param_2) +void sub_80137B0(MenuInputStruct *param_1, s32 param_2) { s32 iVar1; #ifndef NONMATCHING @@ -994,12 +995,12 @@ void sub_80137B0(struct MenuInputStruct *param_1, s32 param_2) param_1->unk10 = iVar2 / param_1->unk1C; } -void sub_80137F8(struct MenuInputStruct *param_1, u32 param_2) +void sub_80137F8(MenuInputStruct *param_1, u32 param_2) { param_1->unk10 = param_2 << 8; } -s32 sub_8013800(struct MenuInputStruct *param_1, s32 param_2) +s32 sub_8013800(MenuInputStruct *param_1, s32 param_2) { s32 iVar1; s32 iVar2; @@ -1012,7 +1013,7 @@ s32 sub_8013800(struct MenuInputStruct *param_1, s32 param_2) return iVar2 + (iVar1 >> 8); } -void sub_8013818(struct MenuInputStruct *param_1, s32 param_2, u32 param_3, s32 param_4) +void sub_8013818(MenuInputStruct *param_1, s32 param_2, u32 param_3, s32 param_4) { param_1->unk0 = param_4; param_1->unk22 = param_2; @@ -1028,7 +1029,7 @@ void sub_8013818(struct MenuInputStruct *param_1, s32 param_2, u32 param_3, s32 } -void sub_8013848(struct MenuInputStruct *param_1, s32 param_2, u32 param_3, s32 param_4) +void sub_8013848(MenuInputStruct *param_1, s32 param_2, u32 param_3, s32 param_4) { param_1->unk0 = param_4; param_1->unk22 = param_2; @@ -1043,7 +1044,7 @@ void sub_8013848(struct MenuInputStruct *param_1, s32 param_2, u32 param_3, s32 sub_80137F8(param_1, 24); } -void sub_8013878(struct MenuInputStruct *param_1, s32 param_2) +void sub_8013878(MenuInputStruct *param_1, s32 param_2) { if (param_2 < 0) param_2 = 0; @@ -1056,7 +1057,7 @@ void sub_8013878(struct MenuInputStruct *param_1, s32 param_2) sub_8013984(param_1); } -bool8 sub_80138B8(struct MenuInputStruct *param_1, bool8 param_2) +bool8 sub_80138B8(MenuInputStruct *param_1, bool8 param_2) { s32 sVar1; s32 oldIndex; @@ -1093,7 +1094,7 @@ bool8 sub_80138B8(struct MenuInputStruct *param_1, bool8 param_2) return FALSE; } -bool8 sub_8013938(struct MenuInputStruct *param_1) +bool8 sub_8013938(MenuInputStruct *param_1) { s32 sVar1; @@ -1118,11 +1119,11 @@ bool8 sub_8013938(struct MenuInputStruct *param_1) return FALSE; } -void sub_8013984(struct MenuInputStruct *param_1) +void sub_8013984(MenuInputStruct *param_1) { s32 iVar2; s32 iVar4; - struct UnkTextStruct1 *ptr; + UnkTextStruct1 *ptr; iVar4 = param_1->unk0; ptr = &gUnknown_2027370[iVar4]; @@ -1161,7 +1162,7 @@ void sub_8013984(struct MenuInputStruct *param_1) param_1->unkE = (ptr->unk2 + 1) * 8 - 2; } -void sub_8013A54(struct MenuInputStruct *param_1) +void sub_8013A54(MenuInputStruct *param_1) { if (param_1->unk1E < param_1->unk20 - 1) param_1->unk1E++; @@ -1171,7 +1172,7 @@ void sub_8013A54(struct MenuInputStruct *param_1) sub_8013984(param_1); } -void sub_8013A7C(struct MenuInputStruct *param_1) +void sub_8013A7C(MenuInputStruct *param_1) { if (param_1->unk1E < 1) param_1->unk1E = param_1->unk20 - 1; diff --git a/src/move_checks.c b/src/move_checks.c index 7add1f123..57825f325 100644 --- a/src/move_checks.c +++ b/src/move_checks.c @@ -15,7 +15,7 @@ #include "status.h" #include "status_actions.h" #include "status_checks_1.h" -#include "team_inventory.h" + #include "text_util.h" #include "tile_types.h" #include "trap.h" @@ -102,9 +102,9 @@ const u8 gDungeonCamouflageTypes[76] = { }; -bool8 CanUseOnSelfWithStatusChecker(struct Entity *pokemon, struct Move *move) +bool8 CanUseOnSelfWithStatusChecker(Entity *pokemon, Move *move) { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; switch (move->id) { case MOVE_HAIL: @@ -367,7 +367,7 @@ bool8 CanUseOnSelfWithStatusChecker(struct Entity *pokemon, struct Move *move) } case MOVE_TRAP_BUSTER: { - struct Entity *object = GetTileAtEntitySafe(pokemon)->object; + Entity *object = GetTileAtEntitySafe(pokemon)->object; if (object == NULL || GetEntityType(object) != ENTITY_TRAP) { return FALSE; @@ -494,7 +494,7 @@ bool8 CanUseOnSelfWithStatusChecker(struct Entity *pokemon, struct Move *move) s32 i; for (i = 0; i < DUNGEON_MAX_WILD_POKEMON; i++) { - struct Entity *target = gDungeon->wildPokemon[i]; + Entity *target = gDungeon->wildPokemon[i]; if (EntityExists(target) && target != pokemon && CanSeeTarget(pokemon, target)) { if (target->info->offensiveStages[STAT_STAGE_ATK] >= MAX_STAT_STAGE) @@ -518,7 +518,7 @@ bool8 CanUseOnSelfWithStatusChecker(struct Entity *pokemon, struct Move *move) s32 i; for (i = 0; i < MAX_TEAM_MEMBERS; i++) { - struct Entity *target = gDungeon->teamPokemon[i]; + Entity *target = gDungeon->teamPokemon[i]; if (EntityExists(target) && target != pokemon && CanSeeTarget(pokemon, target)) { if (target->info->offensiveStages[STAT_STAGE_ATK] >= MAX_STAT_STAGE) @@ -541,10 +541,10 @@ bool8 CanUseOnSelfWithStatusChecker(struct Entity *pokemon, struct Move *move) return TRUE; } -bool8 CanUseOnTargetWithStatusChecker(struct Entity *user, struct Entity *target, struct Move *move) +bool8 CanUseOnTargetWithStatusChecker(Entity *user, Entity *target, Move *move) { - struct EntityInfo *userData = user->info; - struct EntityInfo *targetData = target->info; + EntityInfo *userData = user->info; + EntityInfo *targetData = target->info; s32 i; if (targetData->immobilizeStatus == STATUS_FROZEN && MoveCannotHitFrozen(move)) { @@ -904,7 +904,7 @@ bool8 CanUseOnTargetWithStatusChecker(struct Entity *user, struct Entity *target return TRUE; } -bool8 HasDisabledMove(struct Move *moves) +bool8 HasDisabledMove(Move *moves) { s32 i; for (i = 0; i < MAX_MON_MOVES; i++) @@ -921,7 +921,7 @@ bool8 HasDisabledMove(struct Move *moves) return FALSE; } -bool8 LastUsedMoveOutOfPP(struct Move *moves) +bool8 LastUsedMoveOutOfPP(Move *moves) { s32 i; for (i = 0; i < MAX_MON_MOVES; i++) @@ -936,7 +936,7 @@ bool8 LastUsedMoveOutOfPP(struct Move *moves) return FALSE; } -bool8 HasLastUsedMove(struct Move *moves) +bool8 HasLastUsedMove(Move *moves) { s32 i; for (i = 0; i < MAX_MON_MOVES; i++) diff --git a/src/move_effects_target.c b/src/move_effects_target.c index 87b1f36b5..f68e0461e 100644 --- a/src/move_effects_target.c +++ b/src/move_effects_target.c @@ -1,6 +1,5 @@ #include "global.h" - - +#include "code_806CD90.h" #include "constants/ability.h" #include "constants/dungeon_action.h" #include "constants/direction.h" @@ -69,7 +68,6 @@ extern u8 *gUnknown_80FB564[]; extern u8 *gUnknown_80FB548[]; extern u8 *gUnknown_80FCE84[]; extern u8 *gUnknown_80FCE5C[]; -extern const u8 gDungeonWaterType[]; extern u8 *gUnknown_80FD524[]; extern s16 gUnknown_80F4E34[]; extern u8 *gUnknown_80FCEDC[]; @@ -125,39 +123,37 @@ extern u8 *gUnknown_80FC270[]; extern u8 *gUnknown_80FC138[]; extern u8 *gUnknown_80FC21C[]; -extern bool8 sub_8071728(struct Entity * pokemon, struct Entity * target, bool8 displayMessage); -extern void sub_8041F28(struct Entity *, s32); -extern void sub_8041F4C(struct Entity *, s32); -extern void sub_8041F70(struct Entity *, s32); -extern void sub_8041F94(struct Entity *, s32); -extern void sub_8041C08(struct Entity *); +extern bool8 sub_8071728(Entity * pokemon, Entity * target, bool8 displayMessage); +extern void sub_8041F28(Entity *, s32); +extern void sub_8041F4C(Entity *, s32); +extern void sub_8041F70(Entity *, s32); +extern void sub_8041F94(Entity *, s32); +extern void sub_8041C08(Entity *); extern void sub_8076CB4(s32); -extern void sub_8041F08(struct Entity *); -extern void sub_8041C7C(struct Entity *); -extern void sub_8041C6C(struct Entity *); -extern void sub_806CE94(struct Entity *, u32); -extern void sub_8041C34(struct Entity *); -extern void sub_8041EF8(struct Entity *); -extern void sub_8041EE8(struct Entity *); -extern void sub_8041EC8(struct Entity *); -extern void sub_8041ED8(struct Entity *); -extern void EntityUpdateStatusSprites(struct Entity *); -extern void SetMessageArgument(char[], struct Entity*, u32); -extern void SetMessageArgument_2(char[], struct EntityInfo*, u32); -extern void sub_8041AF4(struct Entity *); -extern void sub_80522F4(struct Entity *r1, struct Entity *r2, u8 *); -extern void sub_806CE68(struct Entity *, s32); -extern void nullsub_91(struct Entity *); -extern void nullsub_90(struct Entity *); -extern void nullsub_72(struct Entity *); -extern void nullsub_71(struct Entity *); -extern void nullsub_70(struct Entity *); -extern void nullsub_69(struct Entity *, struct Entity *); +extern void sub_8041F08(Entity *); +extern void sub_8041C7C(Entity *); +extern void sub_8041C6C(Entity *); +extern void sub_8041C34(Entity *); +extern void sub_8041EF8(Entity *); +extern void sub_8041EE8(Entity *); +extern void sub_8041EC8(Entity *); +extern void sub_8041ED8(Entity *); +extern void EntityUpdateStatusSprites(Entity *); +extern void SetMessageArgument(char[], Entity*, u32); +extern void SetMessageArgument_2(char[], EntityInfo*, u32); +extern void sub_8041AF4(Entity *); +extern void sub_80522F4(Entity *r1, Entity *r2, u8 *); +extern void nullsub_91(Entity *); +extern void nullsub_90(Entity *); +extern void nullsub_72(Entity *); +extern void nullsub_71(Entity *); +extern void nullsub_70(Entity *); +extern void nullsub_69(Entity *, Entity *); -void sub_8075BA4(struct Entity *param_1, u8 param_2) +void sub_8075BA4(Entity *param_1, u8 param_2) { - struct EntityInfo * entityInfo = param_1->info; + EntityInfo * entityInfo = param_1->info; if ((param_2 != 0) && (entityInfo->volatileStatus == STATUS_COWERING)) { entityInfo->action.direction = (entityInfo->action.direction + 4) & DIRECTION_MASK; @@ -169,9 +165,9 @@ void sub_8075BA4(struct Entity *param_1, u8 param_2) } } -u8 sub_8075BF4(struct Entity * pokemon, s32 sleepTurns) +u8 sub_8075BF4(Entity * pokemon, s32 sleepTurns) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; u32 uVar4; uVar4 = 0; @@ -200,7 +196,7 @@ u8 sub_8075BF4(struct Entity * pokemon, s32 sleepTurns) return uVar4; } -void sub_8075C58(struct Entity * pokemon, struct Entity * target, s32 turns, u8 displayMessage) +void sub_8075C58(Entity * pokemon, Entity * target, s32 turns, u8 displayMessage) { u8 sleep; u8 cVar2; @@ -231,7 +227,7 @@ void sub_8075C58(struct Entity * pokemon, struct Entity * target, s32 turns, u8 } } -bool8 CannotSleep(struct Entity * pokemon, struct Entity * target, u8 param_3, bool8 displayMessage) +bool8 CannotSleep(Entity * pokemon, Entity * target, u8 param_3, bool8 displayMessage) { if ((!EntityExists(target)) || ((SetMessageArgument(gAvailablePokemonNames,target,0), param_3 != 0 && @@ -265,10 +261,10 @@ bool8 CannotSleep(struct Entity * pokemon, struct Entity * target, u8 param_3, b return FALSE; } -void NightmareStatusTarget(struct Entity * pokemon, struct Entity * target, s32 turns) +void NightmareStatusTarget(Entity * pokemon, Entity * target, s32 turns) { bool8 hasNightmare; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; hasNightmare = FALSE; if (!CannotSleep(pokemon, target, 1, TRUE)) { @@ -302,10 +298,10 @@ void NightmareStatusTarget(struct Entity * pokemon, struct Entity * target, s32 } } -void NappingStatusTarget(struct Entity * pokemon, struct Entity * target, s32 turns) +void NappingStatusTarget(Entity * pokemon, Entity * target, s32 turns) { bool8 isSleeping; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; isSleeping = FALSE; if (!CannotSleep(pokemon, target, 0, TRUE)) { @@ -339,9 +335,9 @@ void NappingStatusTarget(struct Entity * pokemon, struct Entity * target, s32 tu } } -void YawnedStatusTarget(struct Entity * pokemon, struct Entity * target, s32 turns) +void YawnedStatusTarget(Entity * pokemon, Entity * target, s32 turns) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (CannotSleep(pokemon,target,1,TRUE)) { return; @@ -369,9 +365,9 @@ void YawnedStatusTarget(struct Entity * pokemon, struct Entity * target, s32 tur EntityUpdateStatusSprites(target); } -void SleeplessStatusTarget(struct Entity * pokemon, struct Entity * target) +void SleeplessStatusTarget(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; bool8 isAsleep; isAsleep = FALSE; @@ -404,9 +400,9 @@ void SleeplessStatusTarget(struct Entity * pokemon, struct Entity * target) EntityUpdateStatusSprites(target); } -void PausedStatusTarget(struct Entity * pokemon, struct Entity * target, u8 param_3, s32 turns, bool8 displayMessage) +void PausedStatusTarget(Entity * pokemon, Entity * target, u8 param_3, s32 turns, bool8 displayMessage) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (!EntityExists(target)) { return; @@ -439,9 +435,9 @@ void PausedStatusTarget(struct Entity * pokemon, struct Entity * target, u8 para EntityUpdateStatusSprites(target); } -void InfatuateStatusTarget(struct Entity * pokemon, struct Entity * target, bool8 displayMessage) +void InfatuateStatusTarget(Entity * pokemon, Entity * target, bool8 displayMessage) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { @@ -471,14 +467,14 @@ void InfatuateStatusTarget(struct Entity * pokemon, struct Entity * target, bool } } -void BurnedStatusTarget(struct Entity * pokemon, struct Entity * target, u8 param_3, bool8 displayMessage) +void BurnedStatusTarget(Entity * pokemon, Entity * target, u8 param_3, bool8 displayMessage) { bool8 isNotBurned; bool8 hasSynchronized; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; struct Tile *tile_1; struct Tile *tile_2; - struct Entity *entity; + Entity *entity; s32 index; if (!EntityExists(target)) { @@ -559,13 +555,13 @@ void BurnedStatusTarget(struct Entity * pokemon, struct Entity * target, u8 para } } -void PoisonedStatusTarget(struct Entity * pokemon, struct Entity * target, bool8 displayMessage) +void PoisonedStatusTarget(Entity * pokemon, Entity * target, bool8 displayMessage) { bool8 isNotPoisoned; bool8 hasSynchronized; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; struct Tile *tile; - struct Entity *entity; + Entity *entity; s32 index; if (!EntityExists(target)) { @@ -648,13 +644,13 @@ void PoisonedStatusTarget(struct Entity * pokemon, struct Entity * target, bool8 } } -void BadlyPoisonedStatusTarget(struct Entity * pokemon, struct Entity * target, bool8 displayMessage) +void BadlyPoisonedStatusTarget(Entity * pokemon, Entity * target, bool8 displayMessage) { bool8 isNotBadlyPoisoned; bool8 hasSynchronized; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; struct Tile *tile; - struct Entity *entity; + Entity *entity; s32 index; if (!EntityExists(target)) { @@ -730,9 +726,9 @@ void BadlyPoisonedStatusTarget(struct Entity * pokemon, struct Entity * target, } } -void FrozenStatusTarget(struct Entity * pokemon, struct Entity * target, bool8 displayMessage) +void FrozenStatusTarget(Entity * pokemon, Entity * target, bool8 displayMessage) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; struct Tile *tile; if (!EntityExists(target)) { @@ -778,9 +774,9 @@ void FrozenStatusTarget(struct Entity * pokemon, struct Entity * target, bool8 d } } -void SqueezedStatusTarget(struct Entity * pokemon, struct Entity * target, s16 param_3, bool32 displayMessage) +void SqueezedStatusTarget(Entity * pokemon, Entity * target, s16 param_3, bool32 displayMessage) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; s32 param_3_s32 = param_3; bool8 displayMessage_u8 = displayMessage; @@ -810,9 +806,9 @@ void SqueezedStatusTarget(struct Entity * pokemon, struct Entity * target, s16 p } } -void ImmobilizedStatusTarget(struct Entity * pokemon, struct Entity * target) +void ImmobilizedStatusTarget(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if ((EntityExists(target)) && (!HasSafeguardStatus(pokemon,target,TRUE))) { entityInfo = target->info; @@ -839,10 +835,10 @@ void ImmobilizedStatusTarget(struct Entity * pokemon, struct Entity * target) } } -void IngrainedStatusTarget(struct Entity * pokemon, struct Entity * target) +void IngrainedStatusTarget(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; - struct EntityInfo *entityInfo2; + EntityInfo *entityInfo; + EntityInfo *entityInfo2; if (EntityExists(target)) { entityInfo = target->info; @@ -865,12 +861,12 @@ void IngrainedStatusTarget(struct Entity * pokemon, struct Entity * target) } } -void WrapTarget(struct Entity * pokemon, struct Entity * target) +void WrapTarget(Entity * pokemon, Entity * target) { - struct EntityInfo * targetEntityInfo; + EntityInfo * targetEntityInfo; s32 *piVar3; s32 *iVar5; - struct EntityInfo * pokemonEntityData; + EntityInfo * pokemonEntityData; if (!EntityExists(target)) { return; @@ -926,8 +922,8 @@ _08076C98: void sub_8076CB4(s32 param_1) { - struct Entity *entity; - struct EntityInfo *entityInfo; + Entity *entity; + EntityInfo *entityInfo; s32 index; for(index = 0; index < DUNGEON_MAX_POKEMON; index++) @@ -946,11 +942,11 @@ void sub_8076CB4(s32 param_1) } } -void PetrifiedStatusTarget(struct Entity * pokemon, struct Entity * target) +void PetrifiedStatusTarget(Entity * pokemon, Entity * target) { - struct EntityInfo * targetEntityInfo; - struct EntityInfo * entityInfo; - struct Entity * entity; + EntityInfo * targetEntityInfo; + EntityInfo * entityInfo; + Entity * entity; s32 index; if ((EntityExists(target)) && (!HasSafeguardStatus(pokemon,target,TRUE))) { @@ -994,9 +990,9 @@ void PetrifiedStatusTarget(struct Entity * pokemon, struct Entity * target) } } -void LowerAttackStageTarget(struct Entity * pokemon, struct Entity * target, s32 index, s32 decrement, u8 param_5, bool8 displayMessage) +void LowerAttackStageTarget(Entity * pokemon, Entity * target, s32 index, s32 decrement, u8 param_5, bool8 displayMessage) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; s32 attackStage = decrement; if (!EntityExists(target)) { @@ -1049,9 +1045,9 @@ _08076EE4: } } -void LowerDefenseStageTarget(struct Entity * pokemon, struct Entity * target, s32 index, s32 decrement, u8 param_5, bool8 displayMessage) +void LowerDefenseStageTarget(Entity * pokemon, Entity * target, s32 index, s32 decrement, u8 param_5, bool8 displayMessage) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; s32 defenseStage = decrement; if (!EntityExists(target)) { @@ -1089,9 +1085,9 @@ void LowerDefenseStageTarget(struct Entity * pokemon, struct Entity * target, s3 } } -void RaiseAttackStageTarget(struct Entity * pokemon, struct Entity * target, s32 index, s32 increment) +void RaiseAttackStageTarget(Entity * pokemon, Entity * target, s32 index, s32 increment) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; s32 attackStage = increment; if (!EntityExists(target)) { @@ -1129,9 +1125,9 @@ void RaiseAttackStageTarget(struct Entity * pokemon, struct Entity * target, s32 EntityUpdateStatusSprites(target); } -void RaiseDefenseStageTarget(struct Entity * pokemon, struct Entity * target, s32 index, s32 increment) +void RaiseDefenseStageTarget(Entity * pokemon, Entity * target, s32 index, s32 increment) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; s32 defenseStage = increment; if (!EntityExists(target)) { diff --git a/src/move_util.c b/src/move_util.c index 6553672ae..2d8343e48 100644 --- a/src/move_util.c +++ b/src/move_util.c @@ -12,9 +12,9 @@ extern bool8 sub_8044B28(void); -extern void sub_80429C8(struct Entity *r0); +extern void sub_80429C8(Entity *r0); -typedef bool8 (*MoveCallback)(struct Entity *pokemon, struct Entity *target, struct Move *move, s32 param_4); +typedef bool8 (*MoveCallback)(Entity *pokemon, Entity *target, Move *move, s32 param_4); struct NaturePowerMove { u16 moveID; @@ -23,25 +23,25 @@ struct NaturePowerMove }; extern struct NaturePowerMove gNaturePowerMoveTable[76]; -bool8 sub_805755C(struct Entity* pokemon,u16 param_2); +bool8 sub_805755C(Entity* pokemon,u16 param_2); -u32 sub_8057144(struct Entity * pokemon) +u32 sub_8057144(Entity * pokemon) { - struct Move **ppbVar3; + Move **ppbVar3; s32 entityIndex; - struct Move *move1; - struct Move *move2; + Move *move1; + Move *move2; s32 index; - struct Entity *entity; + Entity *entity; s32 counter; - struct Move *moveStack [80]; - struct Move **local_20; + Move *moveStack [80]; + Move **local_20; #ifndef NONMATCHING register s32 counter_1 asm("r0"); - register struct Move** move_1 asm("r1"); + register Move** move_1 asm("r1"); #else s32 counter_1; - struct Move** move_1; + Move** move_1; #endif counter = 0; @@ -83,11 +83,11 @@ u32 sub_8057144(struct Entity * pokemon) } } -bool8 sub_80571F0(struct Entity * pokemon, struct Move *move) +bool8 sub_80571F0(Entity * pokemon, Move *move) { u16 moveID; s32 tileset; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; entityInfo = pokemon->info; @@ -121,7 +121,7 @@ bool8 sub_80571F0(struct Entity * pokemon, struct Move *move) return FALSE; } -bool8 sub_805727C(struct Entity * pokemon, struct Entity * target, s32 chance) +bool8 sub_805727C(Entity * pokemon, Entity * target, s32 chance) { bool8 uVar2; if (!sub_8044B28() && EntityExists(pokemon) && EntityExists(target) && @@ -153,7 +153,7 @@ end: goto end; } -bool8 sub_8057308(struct Entity *pokemon, s32 chance) +bool8 sub_8057308(Entity *pokemon, s32 chance) { if(!EntityExists(pokemon)) return FALSE; @@ -165,10 +165,10 @@ bool8 sub_8057308(struct Entity *pokemon, s32 chance) return DungeonRandOutcome_2(chance); } -bool8 CanAIUseMove(struct Entity *pokemon, s32 moveIndex, bool8 hasPPChecker) +bool8 CanAIUseMove(Entity *pokemon, s32 moveIndex, bool8 hasPPChecker) { - struct EntityInfo *pokemonInfo = pokemon->info; - struct Move *move = &pokemonInfo->moves[moveIndex]; + EntityInfo *pokemonInfo = pokemon->info; + Move *move = &pokemonInfo->moves[moveIndex]; s32 i; if (!(move->moveFlags & MOVE_FLAG_EXISTS)) { @@ -208,9 +208,9 @@ bool8 CanAIUseMove(struct Entity *pokemon, s32 moveIndex, bool8 hasPPChecker) goto incMoveIndex; } -bool8 CanMonsterUseMove(struct Entity *pokemon, struct Move *move, bool8 hasPPChecker) +bool8 CanMonsterUseMove(Entity *pokemon, Move *move, bool8 hasPPChecker) { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; if (move->id == MOVE_REGULAR_ATTACK) { return TRUE; @@ -225,7 +225,7 @@ bool8 CanMonsterUseMove(struct Entity *pokemon, struct Move *move, bool8 hasPPCh { return FALSE; } - if (pokemonInfo->volatileStatus == STATUS_TAUNTED && !MovesIgnoresTaunted(move)) + if (pokemonInfo->volatileStatus == STATUS_TAUNTED && !MoveIgnoresTaunted(move)) { return FALSE; } @@ -247,9 +247,9 @@ bool8 CanMonsterUseMove(struct Entity *pokemon, struct Move *move, bool8 hasPPCh return TRUE; } -bool8 sub_805744C(struct Entity * pokemon, struct Move *move, bool8 param_3) +bool8 sub_805744C(Entity * pokemon, Move *move, bool8 param_3) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; entityInfo = pokemon->info; if (move->id != MOVE_REGULAR_ATTACK) { @@ -257,7 +257,7 @@ bool8 sub_805744C(struct Entity * pokemon, struct Move *move, bool8 param_3) return FALSE; } if (param_3 != 0) { - if ((entityInfo->volatileStatus == STATUS_TAUNTED) && (!MovesIgnoresTaunted(move))) return FALSE; + if ((entityInfo->volatileStatus == STATUS_TAUNTED) && (!MoveIgnoresTaunted(move))) return FALSE; if (entityInfo->volatileStatus == STATUS_ENCORE) { if (move->id == MOVE_STRUGGLE) { if((entityInfo->struggleMoveFlags & MOVE_FLAG_LAST_USED) == 0) return FALSE; diff --git a/src/moves.c b/src/moves.c index 01ece9c5a..e690dc13f 100644 --- a/src/moves.c +++ b/src/moves.c @@ -1,161 +1,138 @@ #include "global.h" -#include "moves.h" -#include "code_8092334.h" -#include "memory.h" -#include "pokemon.h" -#include "subStruct_203B240.h" -#include "code_809447C.h" -#include "text_util.h" -#include "text2.h" -#include "constants/colors.h" -#include "constants/monster.h" #include "code_800D090.h" #include "code_80130A8.h" +#include "code_8092334.h" +#include "constants/colors.h" +#include "constants/monster.h" +#include "memory.h" +#include "moves.h" +#include "text_util.h" +#include "text2.h" -struct MoveLearnset { - u8 *levelUpMoves; - u8 *HMTMMoves; -}; +static EWRAM_DATA OpenedFile *sWazaParametersFile = {0}; +static EWRAM_DATA MoveDataEntry *sMovesData = {0}; +static EWRAM_DATA MoveLearnset *sMoveLearnsets = {0}; // 420 entries, aka (MONSTER_DEOXYS_SPEED + 1), aka (MONSTER_MUNCHLAX) -struct MoveDataFile -{ - struct MoveDataEntry *moveData; - struct MoveLearnset *moveLearnsets; -}; - - -extern struct unkStruct_80928C0 gUnknown_81098C4; -extern struct FileArchive gSystemFileArchive; - -extern struct OpenedFile *gWazaParametersFile; -extern struct MoveDataEntry *gMovesData; -extern struct MoveLearnset *gMoveLearnsets[420]; - -extern u8 gUnknown_81098D0[]; -extern u8 gUnknown_81098DC[]; -extern u8 gUnknown_810990C[]; -extern u8 gUnknown_8109908[]; -extern u8 gUnknown_8109928[]; -extern u8 gUnknown_8109910[]; -extern u8 gUnknown_81098E0[]; -extern u8 gUnknown_81098EC[]; -extern u8 *gRangeNames[]; -extern u8 gUnknown_810992C[]; -extern u8 gUnknown_810992B; - -extern void sub_8093F10(struct Move *, struct Move *); -extern void sub_80928C0(u8 *, struct Move *, struct unkStruct_80928C0 *); - -extern u8 gAvailablePokemonNames[]; -extern const char gUnknown_8109930[]; -extern struct MoveDataEntry *gMovesData; - -bool8 UnlinkMovesAfter(int param_1, struct Move* src_struct); -bool8 TryLinkMovesAfter(int param_1, struct Move* src_struct); -bool8 sub_80933D8(int param_1, void* src_struct); -bool8 DoesMoveCharge(u16 move); - -int unk_PrintMoveDescription(int, struct Move*, int, struct subStruct_203B240**); - -void sub_80928C0(u8 *buffer, struct Move *move, struct unkStruct_80928C0 *param_3); -extern void unk_MovePrintData(struct Move*, int); // print something -extern u32 sub_8097DF0(char *, struct subStruct_203B240 **); - -extern u8 sub_8092B00(struct Move*); -extern u32 sub_8092BC0(struct Move*); +// ??? extern u32 gUnknown_202DE30; -extern u8* gPtrTypeText; // "Type" -extern u8* gUnknown_810CF00; // "Range#=@.$m0 " +extern u8 gAvailablePokemonNames[]; // 202DF98 + +// data_8107010.s +extern const unkStruct_80928C0 gUnknown_81098C4; +extern const u8 gUnknown_81098D0[]; +extern const u8 gUnknown_81098DC[]; +extern const u8 gUnknown_81098E0[]; +extern const u8 gUnknown_81098EC[]; +extern const u8 gUnknown_8109908[]; +extern const u8 gUnknown_810990C[]; +extern const u8 gUnknown_8109910[]; +extern const u8 gUnknown_8109928[]; +extern const u8 gUnknown_810992B; +extern const u8 gUnknown_810992C[]; +extern const u8 gUnknown_8109930[]; + +// data_810AE24.s +extern const u8* gPtrTypeText; // "Type" +extern const u8 *gRangeNames[]; +extern const u8* gUnknown_810CF00; // "Range#=@.$m0 " + +// system_sbin.s +extern const struct FileArchive gSystemFileArchive; + +// code_8097DD0.s +extern u32 sub_8097DF0(u8 *, struct subStruct_203B240 **); + +static void CopyAndResetMove(Move *, Move *); +static bool8 sub_80933D8(s32, Move *); +static s32 unk_FindMarkedMoveInLinkedSequences44(Move [MAX_MON_MOVES][MAX_MON_MOVES]); +static s32 unk_FindMarkedMoveInLinkedSequences88(Move [8][8]); +static s32 unk_FindMarkedMoveInLinkedSequences88_v2(Move [8][8]); +static void unk_GetLinkedSequences4(Move *, Move [MAX_MON_MOVES][MAX_MON_MOVES]); +static void unk_GetLinkedSequences8(Move *, Move [8][8]); +static void unk_GetLinkedSequences8_v2(Move *, Move [8][8]); +static void unk_LinkedSequencesToMoves4(Move *, Move [MAX_MON_MOVES][MAX_MON_MOVES]); +static void unk_LinkedSequencesToMoves8(Move *, Move [8][8]); +static void unk_LinkedSequencesToMoves8_v2(Move *, Move [8][8]); +static void unk_MovePrintData(Move *, s32); void LoadWazaParameters(void) { - gWazaParametersFile = OpenFileAndGetFileDataPtr(gUnknown_81098D0, &gSystemFileArchive); + sWazaParametersFile = OpenFileAndGetFileDataPtr(gUnknown_81098D0, &gSystemFileArchive); - gMovesData = ((struct MoveDataFile *)(gWazaParametersFile->data))->moveData; - *gMoveLearnsets = ((struct MoveDataFile *)(gWazaParametersFile->data))->moveLearnsets; + sMovesData = ((MoveDataFile *)(sWazaParametersFile->data))->moveData; + sMoveLearnsets = ((MoveDataFile *)(sWazaParametersFile->data))->moveLearnsets; } -u8 sub_809287C(struct Move *move) +u8 sub_809287C(Move *move) { - if((move->moveFlags & MOVE_FLAG_DISABLED) != 0) - return 0x32; - else if((move->moveFlags2 & MOVE_FLAG_SEALED) == 0) - return 0x34; - else - return 0x32; + if (move->moveFlags & MOVE_FLAG_DISABLED) + return 50; + if (!(move->moveFlags2 & MOVE_FLAG_SEALED)) + return 52; + return 50; } -void sub_80928A0(u8 *buffer, struct Move *move, struct unkStruct_80928C0 *r2) +void sub_80928A0(u8 *buffer, Move *move, const unkStruct_80928C0 *a2) { - struct Move stack; + Move stack; CopyAndResetMove(&stack, move); - sub_80928C0(buffer, &stack, r2); + sub_80928C0(buffer, &stack, a2); } -void sub_80928C0(u8 *buffer, struct Move *move, struct unkStruct_80928C0 *param_3) +void sub_80928C0(u8 *buffer, Move *move, const unkStruct_80928C0 *param_3) { - u32 uVar2; - u32 basePP; - u8 localBuffer[12]; + u32 uVar2; + u32 basePP; + u8 localBuffer[12]; - uVar2 = sub_809287C(move); - if (param_3 == NULL) { - param_3 = &gUnknown_81098C4; - } + uVar2 = sub_809287C(move); - if (move->ginseng != 0) - sprintfStatic(localBuffer,gUnknown_81098DC,move->ginseng); // %+d - else - localBuffer[0] = '\0'; + if (param_3 == NULL) + param_3 = &gUnknown_81098C4; - if (param_3->unk8 != 0) { + if (move->ginseng != 0) + sprintfStatic(localBuffer, gUnknown_81098DC, move->ginseng); // %+d + else + localBuffer[0] = '\0'; + + if (param_3->unk8 != 0) uVar2 = 2; - } - if (param_3->unk9 != 0 && DoesMoveCharge(move->id)) { + if (param_3->unk9 != 0 && DoesMoveCharge(move->id)) uVar2 = 2; - } - switch(param_3->unk0) { + + switch (param_3->unk0) { case 0: - sprintfStatic - (buffer,gUnknown_81098E0,uVar2, - gMovesData[move->id].name,localBuffer); + sprintfStatic(buffer, gUnknown_81098E0, + uVar2, sMovesData[move->id].name, localBuffer); break; - case 1: basePP = GetMoveBasePP(move); - sprintfStatic - (buffer,gUnknown_81098EC,uVar2,move->moveFlags & MOVE_FLAG_SET ? gUnknown_8109908 : gUnknown_810990C, - gMovesData[move->id].name,localBuffer,param_3->unk4, - move->PP,basePP); + sprintfStatic(buffer, gUnknown_81098EC, + uVar2, move->moveFlags & MOVE_FLAG_SET ? gUnknown_8109908 : gUnknown_810990C, + sMovesData[move->id].name, localBuffer, param_3->unk4, move->PP, basePP); break; - case 2: basePP = GetMoveBasePP(move); - sprintfStatic - (buffer,gUnknown_8109910,uVar2,move->moveFlags & MOVE_FLAG_SET ? gUnknown_8109908 : gUnknown_810990C, - gMovesData[move->id].name,localBuffer,param_3->unk4, - move->PP,basePP); + sprintfStatic(buffer, gUnknown_8109910, + uVar2, move->moveFlags & MOVE_FLAG_SET ? gUnknown_8109908 : gUnknown_810990C, + sMovesData[move->id].name, localBuffer, param_3->unk4, move->PP, basePP); break; - case 3: basePP = GetMoveBasePP(move); - sprintfStatic - (buffer,gUnknown_81098EC,uVar2,move->moveFlags & MOVE_FLAG_ENABLED_FOR_AI ? gUnknown_8109928 : gUnknown_810990C, - gMovesData[move->id].name,localBuffer,param_3->unk4, - move->PP,basePP); + sprintfStatic(buffer, gUnknown_81098EC, + uVar2, move->moveFlags & MOVE_FLAG_ENABLED_FOR_AI ? gUnknown_8109928 : gUnknown_810990C, + sMovesData[move->id].name, localBuffer, param_3->unk4, move->PP, basePP); break; - case 4: basePP = GetMoveBasePP(move); - sprintfStatic - (buffer,gUnknown_8109910,uVar2, move->moveFlags & MOVE_FLAG_ENABLED_FOR_AI ? gUnknown_8109928 : gUnknown_810990C, - gMovesData[move->id].name,localBuffer,param_3->unk4, - move->PP,basePP); + sprintfStatic(buffer, gUnknown_8109910, + uVar2, move->moveFlags & MOVE_FLAG_ENABLED_FOR_AI ? gUnknown_8109928 : gUnknown_810990C, + sMovesData[move->id].name, localBuffer, param_3->unk4, move->PP, basePP); break; - } + } } -void InitPokemonMove(struct Move *move, u16 moveID) +void InitPokemonMove(Move *move, u16 moveID) { move->moveFlags = MOVE_FLAG_ENABLED_FOR_AI | MOVE_FLAG_EXISTS; move->moveFlags2 = 0; @@ -164,12 +141,11 @@ void InitPokemonMove(struct Move *move, u16 moveID) move->ginseng = 0; } -void sub_8092AA8(struct Move *move, u16 moveID) +void sub_8092AA8(Move *move, u16 moveID) { - if(moveID == 0) + if (moveID == 0) move->moveFlags = 0; - else - { + else { move->moveFlags = MOVE_FLAG_ENABLED_FOR_AI | MOVE_FLAG_EXISTS; move->moveFlags2 = 0; move->id = moveID; @@ -178,27 +154,25 @@ void sub_8092AA8(struct Move *move, u16 moveID) } } -void InitZeroedPPPokemonMove(struct Move *move, u16 moveID) +void InitZeroedPPPokemonMove(Move *move, u16 moveID) { move->moveFlags = MOVE_FLAG_ENABLED_FOR_AI | MOVE_FLAG_EXISTS; move->id = moveID; move->PP = 0; } -s16 GetMoveTargetAndRange(struct Move *move, bool32 isAI) +s16 GetMoveTargetAndRange(Move *move, bool32 isAI) { - return gMovesData[move->id].targetingFlags[isAI]; + return sMovesData[move->id].targetingFlags[isAI]; } -u8 GetMoveType(struct Move *move) +u8 GetMoveType(Move *move) { - return gMovesData[move->id].type; + return sMovesData[move->id].type; } - -u8 *GetLevelUpMoves(s16 species) +const u8 *GetLevelUpMoves(s16 species) { - #ifndef NONMATCHING register s32 species1 asm("r1"), species2; #else @@ -208,19 +182,16 @@ u8 *GetLevelUpMoves(s16 species) species1 = species; species2 = species1; if (species1 == MONSTER_DECOY || species1 == MONSTER_NONE) - { return &gUnknown_810992B; - } + if (species2 == MONSTER_MUNCHLAX) - { return &gUnknown_810992B; - } - return (*gMoveLearnsets)[species2].levelUpMoves; + + return sMoveLearnsets[species2].levelUpMoves; } -u8 *GetHMTMMoves(s16 species) +const u8 *GetHMTMMoves(s16 species) { - #ifndef NONMATCHING register s32 species1 asm("r1"), species2; #else @@ -230,147 +201,146 @@ u8 *GetHMTMMoves(s16 species) species1 = species; species2 = species1; if (species1 == MONSTER_DECOY || species1 == MONSTER_NONE) - { return &gUnknown_810992B; - } + if (species2 == MONSTER_MUNCHLAX) - { return &gUnknown_810992B; - } - return (*gMoveLearnsets)[species2].HMTMMoves; + + return sMoveLearnsets[species2].HMTMMoves; } -u8 GetMoveAIWeight(struct Move *move) +u8 GetMoveAIWeight(Move *move) { - return gMovesData[move->id].aiWeight; + return sMovesData[move->id].aiWeight; } -u32 GetMoveNumberOfChainedHits(struct Move *move) +u32 GetMoveNumberOfChainedHits(Move *move) { - return gMovesData[move->id].numberOfChainedHits; + return sMovesData[move->id].numberOfChainedHits; } -s32 GetMoveBasePower(struct Move *move) +s32 GetMoveBasePower(Move *move) { - return gMovesData[move->id].basePower; + return sMovesData[move->id].basePower; } -s32 GetMoveAccuracyOrAIChance(struct Move *move, u32 accuracyType) +s32 GetMoveAccuracyOrAIChance(Move *move, u32 accuracyType) { - return gMovesData[move->id].accuracy[accuracyType]; + return sMovesData[move->id].accuracy[accuracyType]; } -u32 GetMoveBasePP(struct Move *move) +u32 GetMoveBasePP(Move *move) { - return gMovesData[move->id].basePP; + return sMovesData[move->id].basePP; } -u32 GetMoveMaxUpgradeLevel(struct Move *move) +u32 GetMoveMaxUpgradeLevel(Move *move) { - return gMovesData[move->id].maxUpgradeLevel; + return sMovesData[move->id].maxUpgradeLevel; } -u32 GetMoveCritChance(struct Move *move) +u32 GetMoveCritChance(Move *move) { - return gMovesData[move->id].critChance; + return sMovesData[move->id].critChance; } -bool8 MoveCannotHitFrozen(struct Move *move) +bool8 MoveCannotHitFrozen(Move *move) { - return gMovesData[move->id].cannotHitFrozen; + return sMovesData[move->id].cannotHitFrozen; } -bool8 MovesIgnoresTaunted(struct Move *move) +bool8 MoveIgnoresTaunted(Move *move) { - return gMovesData[move->id].ignoresTaunted; + return sMovesData[move->id].ignoresTaunted; } -u32 GetMoveRangeID(struct Move *move) +static u32 GetMoveRangeID(Move *move) { - return gMovesData[move->id].rangeID; + return sMovesData[move->id].rangeID; } void sub_8092C84(u8 *buffer, u16 moveID) { - struct Move stack; + Move stack; InitPokemonMove(&stack, moveID); sub_80928C0(buffer, &stack, NULL); } u8 *GetMoveUseText(u16 moveID) { - return gMovesData[moveID].useText; + return sMovesData[moveID].useText; } bool8 IsReflectedByMagicCoat(u16 moveID) { - return gMovesData[moveID].affectedByMagicCoat; + return sMovesData[moveID].affectedByMagicCoat; } bool8 CanBeSnatched(u16 moveID) { - return gMovesData[moveID].isSnatchable; + return sMovesData[moveID].isSnatchable; } bool8 FailsWhileMuzzled(u16 moveID) { - return gMovesData[moveID].usesMouth; + return sMovesData[moveID].usesMouth; } -bool8 IsSoundMove(struct Move *move) +bool8 IsSoundMove(Move *move) { - if(move->id == MOVE_GROWL) return TRUE; - if(move->id == MOVE_ROAR) return TRUE; - if(move->id == MOVE_METAL_SOUND) return TRUE; - if(move->id == MOVE_SING) return TRUE; - if(move->id == MOVE_GRASSWHISTLE) return TRUE; - if(move->id == MOVE_SUPERSONIC) return TRUE; - if(move->id == MOVE_PERISH_SONG) return TRUE; - if(move->id == MOVE_SCREECH) return TRUE; - if(move->id == MOVE_HYPER_VOICE) return TRUE; - if(move->id == MOVE_SNORE) return TRUE; - if(move->id == MOVE_HEAL_BELL) return TRUE; + if (move->id == MOVE_GROWL) return TRUE; + if (move->id == MOVE_ROAR) return TRUE; + if (move->id == MOVE_METAL_SOUND) return TRUE; + if (move->id == MOVE_SING) return TRUE; + if (move->id == MOVE_GRASSWHISTLE) return TRUE; + if (move->id == MOVE_SUPERSONIC) return TRUE; + if (move->id == MOVE_PERISH_SONG) return TRUE; + if (move->id == MOVE_SCREECH) return TRUE; + if (move->id == MOVE_HYPER_VOICE) return TRUE; + if (move->id == MOVE_SNORE) return TRUE; + if (move->id == MOVE_HEAL_BELL) return TRUE; return FALSE; } -void sub_8092D54(u8 *buffer, struct Move *move) +static void sub_8092D54(u8 *buffer, Move *move) { sprintfStatic(buffer, gUnknown_810992C, gRangeNames[GetMoveRangeID(move)]); } // this function is the same as the two after the next one // except this one is for 4, and the other 2 for 8 and 8_v2 -int unk_FindMoveEnabledForAIAfter4(struct Move* moves, int index) { - int i; - - for (i = 0; i < 4; i++) { +s32 unk_FindMoveEnabledForAIAfter4(Move *moves, s32 index) +{ + s32 i; + + for (i = 0; i < MAX_MON_MOVES; i++) { u8 flag; - - if (++index == 4) { + + if (++index == MAX_MON_MOVES) return 0; - } - - if (!(moves[index].moveFlags & MOVE_FLAG_EXISTS)) { + + if (!(moves[index].moveFlags & MOVE_FLAG_EXISTS)) return 0; - } + // checks MOVE_FLAG_ENABLED_FOR_AI flag = (moves[index].moveFlags >> 1); - if (!(flag & 1)) { + if (!(flag & 1)) return index; - } } + return 0; } -int sub_8092DB8(struct Move* moves, int index) { - int i, j; - - for (i = 0; i < 4; i++) { +s32 sub_8092DB8(Move *moves, s32 index) +{ + s32 i, j; + + for (i = 0; i < MAX_MON_MOVES; i++) { u8 flag; if (--index < 0) { - for (j = 3; j >= 0; j--) { + for (j = MAX_MON_MOVES - 1; j >= 0; j--) { if (!(moves[j].moveFlags & MOVE_FLAG_EXISTS)) { continue; } @@ -380,175 +350,177 @@ int sub_8092DB8(struct Move* moves, int index) { } // return 0 if loop ends without setting index - if (j < 0) + if (j < 0) return 0; } - - if (!(moves[index].moveFlags & MOVE_FLAG_EXISTS)) { + + if (!(moves[index].moveFlags & MOVE_FLAG_EXISTS)) return 0; - } + // checks MOVE_FLAG_ENABLED_FOR_AI flag = (moves[index].moveFlags >> 1); - if (!(flag & 1)) { + if (!(flag & 1)) return index; - } } + return 0; } -int unk_FindMoveEnabledForAIAfter8(struct Move* moves, int index) { - int i; - +s32 unk_FindMoveEnabledForAIAfter8(Move *moves, s32 index) +{ + s32 i; + for (i = 0; i < 8; i++) { u8 flag; - if (++index == 8) { + if (++index == 8) return 0; - } - - if (!(moves[index].moveFlags & 1)) { + + if (!(moves[index].moveFlags & 1)) return 0; - } + // checks MOVE_FLAG_ENABLED_FOR_AI flag = (moves[index].moveFlags >> 1); - if (!(flag & 1)) { + if (!(flag & 1)) return index; - } } + return 0; } -int unk_FindMoveEnabledForAIAfter8_v2(struct Move* moves, int index) { - int i; - +s32 unk_FindMoveEnabledForAIAfter8_v2(Move *moves, s32 index) +{ + s32 i; + for (i = 0; i < 8; i++) { u8 flag; - - if (++index == 8) { + + if (++index == 8) return 0; - } - - if (!(moves[index].moveFlags & 1)) { + + if (!(moves[index].moveFlags & 1)) return 0; - } + // checks MOVE_FLAG_ENABLED_FOR_AI flag = (moves[index].moveFlags >> 1); - if (!(flag & 1)) { + if (!(flag & 1)) return index; - } } + return 0; } // the next 2 functions are the same // should be 8 and 8_v2 -int unk_FindMoveEnabledForAIBefore8(struct Move* moves, int index) { - int i, j; - +s32 unk_FindMoveEnabledForAIBefore8(Move *moves, s32 index) +{ + s32 i, j; + for (i = 0; i < 8; i++) { u8 flag; - + if (--index < 0) { for (j = 7; j > 0; j--) { - if (!(moves[j].moveFlags & MOVE_FLAG_EXISTS)) { + if (!(moves[j].moveFlags & MOVE_FLAG_EXISTS)) continue; - } - + // checks MOVE_FLAG_ENABLED_FOR_AI flag = (moves[j].moveFlags >> 1); - if (!(flag & 1)) { + if (!(flag & 1)) return j; - } } return 0; } - - if (!(moves[index].moveFlags & MOVE_FLAG_EXISTS)) { + + if (!(moves[index].moveFlags & MOVE_FLAG_EXISTS)) return 0; - } + // checks MOVE_FLAG_ENABLED_FOR_AI flag = (moves[index].moveFlags >> 1); - if (!(flag & 1)) { + if (!(flag & 1)) return index; - } } + return 0; } -int unk_FindMoveEnabledForAIBefore8_v2(struct Move* moves, int index) { - int i, j; - +s32 unk_FindMoveEnabledForAIBefore8_v2(Move *moves, s32 index) +{ + s32 i, j; + for (i = 0; i < 8; i++) { u8 flag; - + if (--index < 0) { for (j = 7; j > 0; j--) { - if (!(moves[j].moveFlags & MOVE_FLAG_EXISTS)) { + if (!(moves[j].moveFlags & MOVE_FLAG_EXISTS)) continue; - } - + // checks MOVE_FLAG_ENABLED_FOR_AI flag = (moves[j].moveFlags >> 1); - if (!(flag & 1)) { + if (!(flag & 1)) return j; - } } return 0; } - - if (!(moves[index].moveFlags & MOVE_FLAG_EXISTS)) { + + if (!(moves[index].moveFlags & MOVE_FLAG_EXISTS)) return 0; - } + // checks MOVE_FLAG_ENABLED_FOR_AI flag = (moves[index].moveFlags >> 1); - if (!(flag & 1)) { + if (!(flag & 1)) return index; - } } + return 0; } -int sub_8092F4C(struct Move* moves, int index) { - int i; +s32 sub_8092F4C(Move *moves, s32 index) +{ + s32 i; + for (i = index; i > 0; i--) { - struct Move* move = &moves[i]; + Move* move = &moves[i]; u8 flag; - if (!(move->moveFlags & MOVE_FLAG_EXISTS)) { + + if (!(move->moveFlags & MOVE_FLAG_EXISTS)) return 0; - } + // checks MOVE_FLAG_ENABLED_FOR_AI flag = (move->moveFlags >> 1); - if (!(flag & 1)) { + if (!(flag & 1)) return i; - } } + return 0; } // the next 3 functions are the same, except the first // is for 4, then for 8 then for 8_v2 -int unk_SetMoveToLastInLinkedSequence4(struct Move* moves, int index) { - struct Move* move; - struct Move linkedSequence[4][4]; +s32 unk_SetMoveToLastInLinkedSequence4(Move *moves, s32 index) +{ + Move* move; + Move linkedSequence[4][4]; s32 startIndex; - int result; - int i; - + s32 result; + s32 i; + result = index; - + move = &moves[index]; move->moveFlags |= MOVE_FLAG_INTERNAL_MARKER; unk_GetLinkedSequences4(moves, linkedSequence); - + startIndex = unk_FindMarkedMoveInLinkedSequences44(linkedSequence); if (startIndex >= 0 && startIndex < 3) { for (i = 0; i < 4; i++) { - const struct Move temp = linkedSequence[startIndex][i]; + const Move temp = linkedSequence[startIndex][i]; linkedSequence[startIndex][i] = linkedSequence[startIndex + 1][i]; linkedSequence[startIndex + 1][i] = temp; } } - + unk_LinkedSequencesToMoves4(moves, linkedSequence); for (startIndex = 0; startIndex < 4; startIndex++) { if (moves[startIndex].moveFlags & MOVE_FLAG_INTERNAL_MARKER) { @@ -557,31 +529,33 @@ int unk_SetMoveToLastInLinkedSequence4(struct Move* moves, int index) { break; } } + return result; } -int unk_SetMoveToLastInLinkedSequence8(struct Move* moves, int index) { - struct Move* move; - struct Move linkedSequence[8][8]; +UNUSED static s32 unk_SetMoveToLastInLinkedSequence8(Move *moves, s32 index) +{ + Move* move; + Move linkedSequence[8][8]; s32 startIndex; - int result; - int i; - + s32 result; + s32 i; + result = index; - + move = &moves[index]; move->moveFlags |= MOVE_FLAG_INTERNAL_MARKER; unk_GetLinkedSequences8(moves, linkedSequence); - + startIndex = unk_FindMarkedMoveInLinkedSequences88(linkedSequence); if (startIndex >= 0 && startIndex < 7) { for (i = 0; i < 8; i++) { - const struct Move temp = linkedSequence[startIndex][i]; + const Move temp = linkedSequence[startIndex][i]; linkedSequence[startIndex][i] = linkedSequence[startIndex + 1][i]; linkedSequence[startIndex + 1][i] = temp; } } - + unk_LinkedSequencesToMoves8(moves, linkedSequence); for (startIndex = 0; startIndex < 8; startIndex++) { if (moves[startIndex].moveFlags & MOVE_FLAG_INTERNAL_MARKER) { @@ -590,31 +564,33 @@ int unk_SetMoveToLastInLinkedSequence8(struct Move* moves, int index) { break; } } + return result; } -int unk_SetMoveToLastInLinkedSequence8_v2(struct Move* moves, int index) { - struct Move* move; - struct Move linkedSequence[8][8]; +s32 unk_SetMoveToLastInLinkedSequence8_v2(Move *moves, s32 index) +{ + Move* move; + Move linkedSequence[8][8]; s32 startIndex; - int result; - int i; - + s32 result; + s32 i; + result = index; - + move = &moves[index]; move->moveFlags |= MOVE_FLAG_INTERNAL_MARKER; unk_GetLinkedSequences8_v2(moves, linkedSequence); - + startIndex = unk_FindMarkedMoveInLinkedSequences88_v2(linkedSequence); if (startIndex >= 0 && startIndex < 7) { for (i = 0; i < 8; i++) { - const struct Move temp = linkedSequence[startIndex][i]; + const Move temp = linkedSequence[startIndex][i]; linkedSequence[startIndex][i] = linkedSequence[startIndex + 1][i]; linkedSequence[startIndex + 1][i] = temp; } } - + unk_LinkedSequencesToMoves8_v2(moves, linkedSequence); for (startIndex = 0; startIndex < 8; startIndex++) { if (moves[startIndex].moveFlags & MOVE_FLAG_INTERNAL_MARKER) { @@ -623,34 +599,36 @@ int unk_SetMoveToLastInLinkedSequence8_v2(struct Move* moves, int index) { break; } } + return result; } // the next 3 functions are the same, but for // 4, 8 and 8_v2 -int unk_SetMoveToFirstInLinkedSequence4(struct Move* moves, int index) { - struct Move* move; - struct Move linkedSequence[4][4]; +s32 unk_SetMoveToFirstInLinkedSequence4(Move *moves, s32 index) +{ + Move* move; + Move linkedSequence[4][4]; s32 startIndex, prevIndex; - int result; - int i; - + s32 result; + s32 i; + result = index; - + move = &moves[index]; move->moveFlags |= MOVE_FLAG_INTERNAL_MARKER; unk_GetLinkedSequences4(moves, linkedSequence); - + startIndex = unk_FindMarkedMoveInLinkedSequences44(linkedSequence); prevIndex = startIndex - 1; if (prevIndex >= 0 && prevIndex < 3) { for (i = 0; i < 4; i++) { - const struct Move temp = linkedSequence[startIndex][i]; + const Move temp = linkedSequence[startIndex][i]; linkedSequence[startIndex][i] = linkedSequence[prevIndex][i]; linkedSequence[prevIndex][i] = temp; } } - + unk_LinkedSequencesToMoves4(moves, linkedSequence); for (startIndex = 0; startIndex < 4; startIndex++) { if (moves[startIndex].moveFlags & MOVE_FLAG_INTERNAL_MARKER) { @@ -659,32 +637,34 @@ int unk_SetMoveToFirstInLinkedSequence4(struct Move* moves, int index) { break; } } + return result; } -int unk_SetMoveToFirstInLinkedSequence8(struct Move* moves, int index) { - struct Move* move; - struct Move linkedSequence[8][8]; +UNUSED static s32 unk_SetMoveToFirstInLinkedSequence8(Move *moves, s32 index) +{ + Move* move; + Move linkedSequence[8][8]; s32 startIndex, prevIndex; int result; int i; - + result = index; - + move = &moves[index]; move->moveFlags |= MOVE_FLAG_INTERNAL_MARKER; unk_GetLinkedSequences8(moves, linkedSequence); - + startIndex = unk_FindMarkedMoveInLinkedSequences88(linkedSequence); prevIndex = startIndex - 1; if (prevIndex >= 0 && prevIndex < 7) { for (i = 0; i < 8; i++) { - const struct Move temp = linkedSequence[startIndex][i]; + const Move temp = linkedSequence[startIndex][i]; linkedSequence[startIndex][i] = linkedSequence[prevIndex][i]; linkedSequence[prevIndex][i] = temp; } } - + unk_LinkedSequencesToMoves8(moves, linkedSequence); for (startIndex = 0; startIndex < 8; startIndex++) { if (moves[startIndex].moveFlags & MOVE_FLAG_INTERNAL_MARKER) { @@ -693,32 +673,34 @@ int unk_SetMoveToFirstInLinkedSequence8(struct Move* moves, int index) { break; } } + return result; } -int unk_SetMoveToFirstInLinkedSequence8_v2(struct Move* moves, int index) { - struct Move* move; - struct Move linkedSequence[8][8]; +s32 unk_SetMoveToFirstInLinkedSequence8_v2(Move *moves, s32 index) +{ + Move* move; + Move linkedSequence[8][8]; s32 startIndex, prevIndex; - int result; - int i; - + s32 result; + s32 i; + result = index; - + move = &moves[index]; move->moveFlags |= MOVE_FLAG_INTERNAL_MARKER; unk_GetLinkedSequences8_v2(moves, linkedSequence); - + startIndex = unk_FindMarkedMoveInLinkedSequences88_v2(linkedSequence); prevIndex = startIndex - 1; if (prevIndex >= 0 && prevIndex < 7) { for (i = 0; i < 8; i++) { - const struct Move temp = linkedSequence[startIndex][i]; + const Move temp = linkedSequence[startIndex][i]; linkedSequence[startIndex][i] = linkedSequence[prevIndex][i]; linkedSequence[prevIndex][i] = temp; } } - + unk_LinkedSequencesToMoves8_v2(moves, linkedSequence); for (startIndex = 0; startIndex < 8; startIndex++) { if (moves[startIndex].moveFlags & MOVE_FLAG_INTERNAL_MARKER) { @@ -727,115 +709,112 @@ int unk_SetMoveToFirstInLinkedSequence8_v2(struct Move* moves, int index) { break; } } + return result; } -bool8 IsMoveSet(int index, struct Move* struct_ptr) +bool8 IsMoveSet(s32 index, Move *moves) { - if ((struct_ptr[index].moveFlags & MOVE_FLAG_SET) != 0) { + if (moves[index].moveFlags & MOVE_FLAG_SET) return TRUE; - } return FALSE; } -bool8 IsMoveEnabled(int index, struct Move* struct_ptr) +bool8 IsMoveEnabled(s32 index, Move *moves) { - if ((struct_ptr[index].moveFlags & MOVE_FLAG_ENABLED_FOR_AI) != 0) { + if (moves[index].moveFlags & MOVE_FLAG_ENABLED_FOR_AI) return TRUE; - } return FALSE; } -bool8 sub_8093318(int param_1, void* src_struct) +bool8 sub_8093318(s32 param_1, Move *moves) { - struct Move dest_struct[8]; - MemoryCopy8((void*)dest_struct, src_struct, 64); + Move dest_struct[MAX_MON_MOVES * 2]; + MemoryCopy8((void *)dest_struct, (void *)moves, sizeof(Move) * MAX_MON_MOVES * 2); return TryLinkMovesAfter(param_1, dest_struct); } -bool8 sub_809333C(int param_1, void* src_struct) +bool8 sub_809333C(s32 param_1, Move *moves) { - struct Move dest_struct[8]; - MemoryCopy8((void*)dest_struct, src_struct, 64); + Move dest_struct[MAX_MON_MOVES * 2]; + MemoryCopy8((void *)dest_struct, (void *)moves, sizeof(Move) * MAX_MON_MOVES * 2); return UnlinkMovesAfter(param_1, dest_struct); } -bool8 sub_8093360(int param_1, void* src_struct) +UNUSED static bool8 sub_8093360(s32 param_1, Move *moves) { - u8 dest_struct[64]; - MemoryCopy8(dest_struct, src_struct, 64); + Move dest_struct[MAX_MON_MOVES * 2]; + MemoryCopy8((void *)dest_struct, (void *)moves, sizeof(Move) * MAX_MON_MOVES * 2); return sub_80933D8(param_1, dest_struct); } -// appears unused -bool8 IsMoveNotSet(int index, struct Move* struct_ptr) +UNUSED static bool8 IsMoveNotSet(s32 index, Move* moves) { - if ((struct_ptr[index].moveFlags & MOVE_FLAG_SET) != 0) { + if (moves[index].moveFlags & MOVE_FLAG_SET) return FALSE; - } return TRUE; } -bool8 IsAnyMoveLinked(int unused, struct Move* moves) { - int i; - int counter; +bool8 IsAnyMoveLinked(s32 unused, Move *moves) +{ + s32 i; + s32 counter; counter = 0; + for (i = 0; i < 8; i++) { - if ((moves[i].moveFlags & MOVE_FLAG_EXISTS) && !(moves[i].moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN)) { + if ((moves[i].moveFlags & MOVE_FLAG_EXISTS) && !(moves[i].moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN)) counter++; - } } - if (counter > 1) { + + if (counter > 1) return TRUE; - } return FALSE; } -bool8 sub_80933D8(int param_1, void* src_struct) +static bool8 sub_80933D8(s32 param_1, Move *src_struct) { - int result; + if (TryLinkMovesAfter(param_1, src_struct)) + return TRUE; - if (!TryLinkMovesAfter(param_1, src_struct)) { - result = UnlinkMovesAfter(param_1, src_struct); - } - else { - result = TRUE; - } - return result; + return UnlinkMovesAfter(param_1, src_struct); } -bool8 TryLinkMovesAfter(int index, struct Move* moves) { - int i; - const struct Move *move = &moves[index]; - if (DoesMoveCharge(move->id)) { +bool8 TryLinkMovesAfter(s32 index, Move *moves) +{ + s32 i; + const Move *move = &moves[index]; + + if (DoesMoveCharge(move->id)) return FALSE; - } - + for (i = index + 1; i < 8; i++) { - if (!(moves[i].moveFlags & MOVE_FLAG_EXISTS)) { + if (!(moves[i].moveFlags & MOVE_FLAG_EXISTS)) return FALSE; - } - if (DoesMoveCharge(moves[i].id)) { + + if (DoesMoveCharge(moves[i].id)) return FALSE; - } + if (!(moves[i].moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN)) { moves[i].moveFlags |= MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN; unk_FixLinkedMovesSetEnabled8_v2(moves); return TRUE; } } + return FALSE; } -bool8 UnlinkMovesAfter(int index, struct Move* moves) { - int i; +bool8 UnlinkMovesAfter(s32 index, Move *moves) +{ + s32 i; bool8 result = FALSE; - int r4; + s32 r4; for (i = index + 1, r4 = 0; r4 < 8 && i < 8; i++, r4++) { if (!(moves[i].moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN)) goto label; // for some reason we can't use break here + moves[i].moveFlags &= ~MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN; result = TRUE; } @@ -844,164 +823,170 @@ label: return result; } +bool8 IsNextMoveLinked(s32 index, Move *moves) +{ + Move *move; -bool8 IsNextMoveLinked(int index, struct Move* moves) { - struct Move* move; - if (index + 1 >= 8) { + if (index + 1 >= MAX_MON_MOVES * 2) return FALSE; - } + move = &moves[index + 1]; + if (!(move->moveFlags & MOVE_FLAG_EXISTS)) return FALSE; - if ((move->moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN)) + + if (move->moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN) return TRUE; + return FALSE; } -bool8 ToggleSetMove(int index, struct Move* moves) { - struct Move* move; +bool8 ToggleSetMove(s32 index, Move *moves) +{ + Move* move; u8 flags; - int i; + s32 i; move = &moves[index]; - if (moves[index].moveFlags & MOVE_FLAG_SET) { + + if (moves[index].moveFlags & MOVE_FLAG_SET) flags = move->moveFlags & ~MOVE_FLAG_SET; - } else { // clear set flag from other moves - for (i = 0; i < 4; i++) { - if (moves[i].moveFlags & MOVE_FLAG_EXISTS) { + for (i = 0; i < MAX_MON_MOVES; i++) { + if (moves[i].moveFlags & MOVE_FLAG_EXISTS) moves[i].moveFlags &= ~MOVE_FLAG_SET; - } } + flags = move->moveFlags | MOVE_FLAG_SET; } + move->moveFlags = flags; unk_FixLinkedMovesSetEnabled8_v2(moves); return TRUE; } -void UnSetMove(int index, struct Move* moves) { - struct Move* move = &moves[index]; +void UnSetMove(s32 index, Move *moves) +{ + Move* move = &moves[index]; move->moveFlags &= ~MOVE_FLAG_SET; unk_FixLinkedMovesSetEnabled8_v2(moves); } -bool8 ToggleMoveEnabled(int index, struct Move* moves) { - struct Move* move = &moves[index]; +bool8 ToggleMoveEnabled(s32 index, Move *moves) +{ + Move* move = &moves[index]; move->moveFlags ^= MOVE_FLAG_ENABLED_FOR_AI; unk_FixLinkedMovesSetEnabled8_v2(moves); return TRUE; } -int GetLinkedSequence(int index, struct Move* moves, u16* sequenceMoveIDs) { - int i; - int linkedSequenceLength; - struct Move* move; +s32 GetLinkedSequence(s32 index, Move *moves, u16 *sequenceMoveIDs) +{ + s32 i; + s32 linkedSequenceLength; + Move* move; linkedSequenceLength = 1; move = &moves[index]; sequenceMoveIDs[0] = move->id; - for (i = 1; i < 4; i++) { + + for (i = 1; i < 4; i++) sequenceMoveIDs[i] = 0; - } for (index++, sequenceMoveIDs++; index < 8 && linkedSequenceLength <= 3; index++) { move = &moves[index]; - if ((move->moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN) == 0) { + if (!(move->moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN)) return linkedSequenceLength; - } *sequenceMoveIDs++ = move->id; linkedSequenceLength++; } + return linkedSequenceLength; } -int sub_80935B8(struct Move *moves, int index) { - int i; - int linkSequenceStart; - int isNonTrivialLinkSequence; - int any_move_linked; - int pp; - int v1; - - pp = 99; - any_move_linked = 0; - isNonTrivialLinkSequence = 0; +s32 sub_80935B8(Move *moves, s32 index) +{ + s32 i; + s32 linkSequenceStart; + bool8 isNonTrivialLinkSequence; + bool8 any_move_linked; + s32 pp; + bool8 v1; + pp = 99; + any_move_linked = FALSE; + isNonTrivialLinkSequence = FALSE; linkSequenceStart = index; + while (linkSequenceStart >= 0) { - struct Move *move = &moves[linkSequenceStart]; - if (!((move->moveFlags & MOVE_FLAG_EXISTS) && (move->moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN))) { + Move *move = &moves[linkSequenceStart]; + + if (!((move->moveFlags & MOVE_FLAG_EXISTS) && (move->moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN))) break; - } - + linkSequenceStart--; } // this is so stupid but it works - isNonTrivialLinkSequence++;isNonTrivialLinkSequence--; + #ifndef NONMATCHING + isNonTrivialLinkSequence++; isNonTrivialLinkSequence--; + #endif - for (i = linkSequenceStart + 1; i < 4; i++) { - struct Move *move = &moves[i]; - if (!((move->moveFlags & MOVE_FLAG_EXISTS) && (move->moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN))) { + for (i = linkSequenceStart + 1; i < MAX_MON_MOVES; i++) { + Move *move = &moves[i]; + + if (!((move->moveFlags & MOVE_FLAG_EXISTS) && (move->moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN))) break; - } - - isNonTrivialLinkSequence = 1; + + isNonTrivialLinkSequence = TRUE; } - if (!isNonTrivialLinkSequence) { + if (!isNonTrivialLinkSequence) return 99; - } - v1 = 0; + v1 = FALSE; + while (--i >= linkSequenceStart) { - struct Move* move = &moves[i]; - if (!(move->moveFlags & MOVE_FLAG_EXISTS)) { + Move* move = &moves[i]; + + if (!(move->moveFlags & MOVE_FLAG_EXISTS)) break; - } - if (pp > move->PP) { + + if (pp > move->PP) pp = move->PP; - } - if (move->PP == 0) { - v1 = 1; - } - if (move->moveFlags2 & MOVE_FLAG_REPLACE) { - v1 = 1; - } + if (move->PP == 0) + v1 = TRUE; + if (move->moveFlags2 & MOVE_FLAG_REPLACE) + v1 = TRUE; } - if (!v1) { + if (!v1) return pp; - } - for (i = linkSequenceStart + 1; i < 4; i++) { - struct Move* move = &moves[i]; - if (!(moves[i].moveFlags & MOVE_FLAG_EXISTS)) { + for (i = linkSequenceStart + 1; i < MAX_MON_MOVES; i++) { + Move* move = &moves[i]; + + if (!(moves[i].moveFlags & MOVE_FLAG_EXISTS)) break; - } if (move->moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN) { move->moveFlags &= ~MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN; - any_move_linked = 1; + any_move_linked = TRUE; } - else { + else break; - } } - if (any_move_linked) { + if (any_move_linked) return 0; - } - else { - return pp; - } + return pp; } -void unk_FixLinkedMovesSetEnabled4(struct Move* moves) { - struct Move linkedSequences[4][4]; +void unk_FixLinkedMovesSetEnabled4(Move *moves) +{ + Move linkedSequences[4][4]; // all that doing these in a row seems to do is // fix the set/enabled flags by moving them to @@ -1010,145 +995,146 @@ void unk_FixLinkedMovesSetEnabled4(struct Move* moves) { unk_LinkedSequencesToMoves4(moves, linkedSequences); } -void unk_FixLinkedMovesSetEnabled8(struct Move* moves) { - struct Move linkedSequences[8][8]; +void unk_FixLinkedMovesSetEnabled8(Move *moves) +{ + Move linkedSequences[8][8]; + unk_GetLinkedSequences8(moves, linkedSequences); unk_LinkedSequencesToMoves8(moves, linkedSequences); } -void unk_FixLinkedMovesSetEnabled8_v2(struct Move* moves) { - struct Move linkedSequences[8][8]; +void unk_FixLinkedMovesSetEnabled8_v2(Move *moves) +{ + Move linkedSequences[8][8]; unk_GetLinkedSequences8_v2(moves, linkedSequences); unk_LinkedSequencesToMoves8_v2(moves, linkedSequences); } -int unk_FindMarkedMoveInLinkedSequences44(struct Move moves[4][4]) { - int i, j; +static s32 unk_FindMarkedMoveInLinkedSequences44(Move moves[MAX_MON_MOVES][MAX_MON_MOVES]) +{ + s32 i, j; - for (i = 0; i < 4; i++) { - for (j = 0; j < 4; j++) { - if ((moves[i][j].moveFlags & MOVE_FLAG_EXISTS) && (moves[i][j].moveFlags & MOVE_FLAG_INTERNAL_MARKER)) { + for (i = 0; i < MAX_MON_MOVES; i++) { + for (j = 0; j < MAX_MON_MOVES; j++) { + if ((moves[i][j].moveFlags & MOVE_FLAG_EXISTS) && (moves[i][j].moveFlags & MOVE_FLAG_INTERNAL_MARKER)) return i; - } } } + return -1; } -void unk_GetLinkedSequences4(struct Move* moves, struct Move linkedSequences[4][4]) { - int i, j; - int k; - int moveSetIndex; +static void unk_GetLinkedSequences4(Move *moves, Move linkedSequences[MAX_MON_MOVES][MAX_MON_MOVES]) +{ + s32 i, j; + s32 k; + s32 moveSetIndex; - for (i = 0; i < 4; i++) { - for (j = 0; j < 4; j++) { + for (i = 0; i < MAX_MON_MOVES; i++) { + for (j = 0; j < MAX_MON_MOVES; j++) linkedSequences[i][j].moveFlags = 0; - } } moveSetIndex = -1; - for (j = 0, k = 0; k < 4; j++, k++) { + + for (j = 0, k = 0; k < MAX_MON_MOVES; j++, k++) { if (k == 0 || !(moves[k].moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN)) { moveSetIndex++; j = 0; } + linkedSequences[moveSetIndex][j] = moves[k]; linkedSequences[moveSetIndex][j].moveFlags &= ~MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN; } } +static void unk_LinkedSequencesToMoves4(Move *moves, Move linkedSequences[MAX_MON_MOVES][MAX_MON_MOVES]) +{ + s32 i, j; + s32 movesCopied; -void unk_LinkedSequencesToMoves4(struct Move* moves, struct Move linkedSequences[4][4]) { - int i, j; - int movesCopied; - - bool8 moves_set[4]; - bool8 moves_enabled[4]; + bool8 moves_set[MAX_MON_MOVES]; + bool8 moves_enabled[MAX_MON_MOVES]; movesCopied = 0; - - // figure out which linked sequences contain set / enabled moves - for (i = 0; i < 4; i++) { + + // Figure out which linked sequences contain set / enabled moves + for (i = 0; i < MAX_MON_MOVES; i++) { moves_set[i] = 0; moves_enabled[i] = 0; - for (j = 0; j < 4; j++) { + for (j = 0; j < MAX_MON_MOVES; j++) { u8 flag; - if (!(linkedSequences[i][j].moveFlags & MOVE_FLAG_EXISTS)) { + if (!(linkedSequences[i][j].moveFlags & MOVE_FLAG_EXISTS)) continue; - } flag = MOVE_FLAG_SET; flag &= linkedSequences[i][j].moveFlags; - if (flag) { + if (flag) moves_set[i] = TRUE; - } - if (linkedSequences[i][j].moveFlags & MOVE_FLAG_ENABLED_FOR_AI) { + + if (linkedSequences[i][j].moveFlags & MOVE_FLAG_ENABLED_FOR_AI) moves_enabled[i] = TRUE; - } } } - for (i = 0; i < 4; i++) { - for (j = 0; j < 4; j++) { - if (linkedSequences[i][j].moveFlags & MOVE_FLAG_EXISTS) { - moves[movesCopied] = linkedSequences[i][j]; + for (i = 0; i < MAX_MON_MOVES; i++) { + for (j = 0; j < MAX_MON_MOVES; j++) { + if (!(linkedSequences[i][j].moveFlags & MOVE_FLAG_EXISTS)) + continue; - if (j == 0) { - moves[movesCopied].moveFlags &= ~MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN; - } - else { - moves[movesCopied].moveFlags |= MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN; - } - - moves[movesCopied].moveFlags &= ~MOVE_FLAG_SET; - moves[movesCopied].moveFlags &= ~MOVE_FLAG_ENABLED_FOR_AI; - if (moves_set[i] && (j == 0)) { - moves[movesCopied].moveFlags |= MOVE_FLAG_SET; - } - if (moves_enabled[i] && (j == 0)) { - moves[movesCopied].moveFlags |= MOVE_FLAG_ENABLED_FOR_AI; - } + moves[movesCopied] = linkedSequences[i][j]; - movesCopied++; - if (movesCopied == 4) { - return; - } - } + if (j == 0) + moves[movesCopied].moveFlags &= ~MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN; + else + moves[movesCopied].moveFlags |= MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN; + + moves[movesCopied].moveFlags &= ~MOVE_FLAG_SET; + moves[movesCopied].moveFlags &= ~MOVE_FLAG_ENABLED_FOR_AI; + + if (moves_set[i] && j == 0) + moves[movesCopied].moveFlags |= MOVE_FLAG_SET; + if (moves_enabled[i] && j == 0) + moves[movesCopied].moveFlags |= MOVE_FLAG_ENABLED_FOR_AI; + + movesCopied++; + if (movesCopied == MAX_MON_MOVES) + return; } } } -// the next two functions are exactly the same -int unk_FindMarkedMoveInLinkedSequences88(struct Move linkedSequences[8][8]) { - int i, j; +// The next two functions are exactly the same +static s32 unk_FindMarkedMoveInLinkedSequences88(Move linkedSequences[8][8]) +{ + s32 i, j; for (i = 0; i < 8; i++) { for (j = 0; j < 8; j++) { - if ((linkedSequences[i][j].moveFlags & MOVE_FLAG_EXISTS) && (linkedSequences[i][j].moveFlags & MOVE_FLAG_INTERNAL_MARKER)) { + if ((linkedSequences[i][j].moveFlags & MOVE_FLAG_EXISTS) && (linkedSequences[i][j].moveFlags & MOVE_FLAG_INTERNAL_MARKER)) return i; - } } } - + return -1; } -// I expect the intent was to check for a different flag in this one +// I expect the intent was to check for a different flag in this one... // or the argument is a struct type that does hold the moves as a field -int unk_FindMarkedMoveInLinkedSequences88_v2(struct Move linkedSequences[8][8]) { - int i, j; +static s32 unk_FindMarkedMoveInLinkedSequences88_v2(Move linkedSequences[8][8]) +{ + s32 i, j; for (i = 0; i < 8; i++) { for (j = 0; j < 8; j++) { - if ((linkedSequences[i][j].moveFlags & MOVE_FLAG_EXISTS) && (linkedSequences[i][j].moveFlags & MOVE_FLAG_INTERNAL_MARKER)) { + if ((linkedSequences[i][j].moveFlags & MOVE_FLAG_EXISTS) && (linkedSequences[i][j].moveFlags & MOVE_FLAG_INTERNAL_MARKER)) return i; - } } } - + return -1; } @@ -1158,47 +1144,54 @@ int unk_FindMarkedMoveInLinkedSequences88_v2(struct Move linkedSequences[8][8]) // it seems to find all the _actually_ separate moves, and split them // out into link sequences in the destination linkedSequences -void unk_GetLinkedSequences8(struct Move* moves, struct Move linkedSequences[8][8]) { - int i, j; - int k; - int moveSetIndex; +static void unk_GetLinkedSequences8(Move *moves, Move linkedSequences[8][8]) +{ + s32 i, j; + s32 k; + s32 moveSetIndex; // clear out linkedSequences for (i = 0; i < 8; i++) { - for (j = 0; j < 8; j++) { + for (j = 0; j < 8; j++) linkedSequences[i][j].moveFlags = 0; - } } moveSetIndex = -1; + for (j = 0, k = 0; k < 8; j++, k++) { - struct Move* move = &moves[k]; + Move* move = &moves[k]; + if (k == 0 || !(move->moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN)) { moveSetIndex++; j = 0; } + linkedSequences[moveSetIndex][j] = *move; linkedSequences[moveSetIndex][j].moveFlags &= ~MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN; } } -void unk_GetLinkedSequences8_v2(struct Move* moves, struct Move linkedSequences[8][8]) { - int i, j; - int k; - int moveSetIndex; +static void unk_GetLinkedSequences8_v2(Move *moves, Move linkedSequences[8][8]) +{ + s32 i, j; + s32 k; + s32 moveSetIndex; for (i = 0; i < 8; i++) { - for (j = 0; j < 8; j++) { + for (j = 0; j < 8; j++) linkedSequences[i][j].moveFlags = 0; - } } + moveSetIndex = -1; + for (j = 0, k = 0; k < 8; j++, k++) { - struct Move* move = &moves[k]; + Move* move = &moves[k]; + if (k == 0 || !(move->moveFlags & 2)) { moveSetIndex++; j = 0; } + linkedSequences[moveSetIndex][j] = *move; linkedSequences[moveSetIndex][j].moveFlags &= ~MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN; } @@ -1207,15 +1200,16 @@ void unk_GetLinkedSequences8_v2(struct Move* moves, struct Move linkedSequences[ // the next 2 functions are again exactly the same // these functions are the same as unk_LinkedSequencesToMoves4 but for [8][8] linkedSequences // instead of [4][4] linkedSequences -void unk_LinkedSequencesToMoves8(struct Move* moves, struct Move linkedSequences[8][8]) { +static void unk_LinkedSequencesToMoves8(Move *moves, Move linkedSequences[8][8]) +{ int i, j; int movesCopied; - + bool8 moveFlags8[8]; bool8 moveFlags4[8]; movesCopied = 0; - + for (i = 0; i < 8; i++) { moveFlags8[i] = 0; moveFlags4[i] = 0; @@ -1223,60 +1217,57 @@ void unk_LinkedSequencesToMoves8(struct Move* moves, struct Move linkedSequences for (j = 0; j < 8; j++) { u8 flag; - if (!(linkedSequences[i][j].moveFlags & MOVE_FLAG_EXISTS)) { + if (!(linkedSequences[i][j].moveFlags & MOVE_FLAG_EXISTS)) continue; - } flag = MOVE_FLAG_SET; flag &= linkedSequences[i][j].moveFlags; - if (flag) { + + if (flag) moveFlags8[i] = TRUE; - } - if (linkedSequences[i][j].moveFlags & MOVE_FLAG_ENABLED_FOR_AI) { + + if (linkedSequences[i][j].moveFlags & MOVE_FLAG_ENABLED_FOR_AI) moveFlags4[i] = TRUE; - } } } for (i = 0; i < 8; i++) { for (j = 0; j < 8; j++) { - if (linkedSequences[i][j].moveFlags & MOVE_FLAG_EXISTS) { - moves[movesCopied] = linkedSequences[i][j]; + if (!(linkedSequences[i][j].moveFlags & MOVE_FLAG_EXISTS)) + continue; - if (j == 0) { - moves[movesCopied].moveFlags &= ~MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN; - } - else { - moves[movesCopied].moveFlags |= MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN; - } - - moves[movesCopied].moveFlags &= ~MOVE_FLAG_SET; - moves[movesCopied].moveFlags &= ~MOVE_FLAG_ENABLED_FOR_AI; - if (moveFlags8[i] && (j == 0)) { - moves[movesCopied].moveFlags |= MOVE_FLAG_SET; - } - if (moveFlags4[i] && (j == 0)) { - moves[movesCopied].moveFlags |= MOVE_FLAG_ENABLED_FOR_AI; - } + moves[movesCopied] = linkedSequences[i][j]; - movesCopied++; - if (movesCopied == 8) { - return; - } - } + if (j == 0) + moves[movesCopied].moveFlags &= ~MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN; + else + moves[movesCopied].moveFlags |= MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN; + + moves[movesCopied].moveFlags &= ~MOVE_FLAG_SET; + moves[movesCopied].moveFlags &= ~MOVE_FLAG_ENABLED_FOR_AI; + + if (moveFlags8[i] && (j == 0)) + moves[movesCopied].moveFlags |= MOVE_FLAG_SET; + if (moveFlags4[i] && (j == 0)) + moves[movesCopied].moveFlags |= MOVE_FLAG_ENABLED_FOR_AI; + + movesCopied++; + if (movesCopied == 8) + return; } } } -void unk_LinkedSequencesToMoves8_v2(struct Move* moves, struct Move linkedSequences[8][8]) { - int i, j; - int movesCopied; - +static void unk_LinkedSequencesToMoves8_v2(Move *moves, Move linkedSequences[8][8]) +{ + s32 i, j; + s32 movesCopied; + bool8 moveFlags8[8]; bool8 moveFlags4[8]; movesCopied = 0; - + for (i = 0; i < 8; i++) { moveFlags8[i] = 0; moveFlags4[i] = 0; @@ -1284,170 +1275,174 @@ void unk_LinkedSequencesToMoves8_v2(struct Move* moves, struct Move linkedSequen for (j = 0; j < 8; j++) { u8 flag; - if (!(linkedSequences[i][j].moveFlags & MOVE_FLAG_EXISTS)) { + if (!(linkedSequences[i][j].moveFlags & MOVE_FLAG_EXISTS)) continue; - } flag = MOVE_FLAG_SET; flag &= linkedSequences[i][j].moveFlags; - if (flag) { + + if (flag) moveFlags8[i] = TRUE; - } - if (linkedSequences[i][j].moveFlags & MOVE_FLAG_ENABLED_FOR_AI) { + + if (linkedSequences[i][j].moveFlags & MOVE_FLAG_ENABLED_FOR_AI) moveFlags4[i] = TRUE; - } } } for (i = 0; i < 8; i++) { for (j = 0; j < 8; j++) { - if (linkedSequences[i][j].moveFlags & MOVE_FLAG_EXISTS) { - moves[movesCopied] = linkedSequences[i][j]; + if (!(linkedSequences[i][j].moveFlags & MOVE_FLAG_EXISTS)) + continue; - if (j == 0) { - moves[movesCopied].moveFlags &= ~MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN; - } - else { - moves[movesCopied].moveFlags |= MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN; - } - - moves[movesCopied].moveFlags &= ~MOVE_FLAG_SET; - moves[movesCopied].moveFlags &= ~MOVE_FLAG_ENABLED_FOR_AI; - if (moveFlags8[i] && (j == 0)) { - moves[movesCopied].moveFlags |= MOVE_FLAG_SET; - } - if (moveFlags4[i] && (j == 0)) { - moves[movesCopied].moveFlags |= MOVE_FLAG_ENABLED_FOR_AI; - } + moves[movesCopied] = linkedSequences[i][j]; - movesCopied++; - if (movesCopied == 8) { - return; - } - } + if (j == 0) + moves[movesCopied].moveFlags &= ~MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN; + else + moves[movesCopied].moveFlags |= MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN; + + moves[movesCopied].moveFlags &= ~MOVE_FLAG_SET; + moves[movesCopied].moveFlags &= ~MOVE_FLAG_ENABLED_FOR_AI; + + if (moveFlags8[i] && (j == 0)) + moves[movesCopied].moveFlags |= MOVE_FLAG_SET; + if (moveFlags4[i] && (j == 0)) + moves[movesCopied].moveFlags |= MOVE_FLAG_ENABLED_FOR_AI; + + movesCopied++; + if (movesCopied == 8) + return; } } } +// The next two are the same again +UNUSED static void RemoveLinkSequenceFromMoves8_v2(Move *moves, s32 index) +{ + s32 i; + s32 copiedMoves; + Move moveSet[8]; -// the next two are again the same -void RemoveLinkSequenceFromMoves8_v2(struct Move* moves, int index) { - int i; - int copiedMoves; - struct Move moveSet[8]; - moves[index].moveFlags = 0; - for (i = index + 1; i < 8; i++) { - struct Move* move = &moves[i]; - // TODO: don't do this trickery + for (i = index + 1; i < 8; i++) { + Move* move = &moves[i]; + + #ifndef NONMATCHING asm(""); - if (!(move->moveFlags & MOVE_FLAG_EXISTS)) { + #endif + + if (!(move->moveFlags & MOVE_FLAG_EXISTS)) break; - } - if (!(move->moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN)) { + + if (!(move->moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN)) break; - } move->moveFlags = 0; } copiedMoves = 0; + for (i = 0; i < 8; i++) { - if (moves[i].moveFlags & MOVE_FLAG_EXISTS) { + if (moves[i].moveFlags & MOVE_FLAG_EXISTS) moveSet[copiedMoves++] = moves[i]; - } } - while (copiedMoves < 8) { + while (copiedMoves < 8) moveSet[copiedMoves++].moveFlags = 0; - } - for (i = 0; i < 8; i++) { + for (i = 0; i < 8; i++) moves[i] = moveSet[i]; - } } -void RemoveLinkSequenceFromMoves8(struct Move* moves, int index) { - int i; - int copiedMoves; - struct Move moveSet[8]; - +void RemoveLinkSequenceFromMoves8(Move *moves, s32 index) +{ + s32 i; + s32 copiedMoves; + Move moveSet[8]; + // remove link sequence (set flags to 0) moves[index].moveFlags = 0; + for (i = index + 1; i < 8; i++) { - struct Move* move = &moves[i]; + Move* move = &moves[i]; + + #ifndef NONMATCHING asm(""); - if (!(move->moveFlags & MOVE_FLAG_EXISTS)) { + #endif + + if (!(move->moveFlags & MOVE_FLAG_EXISTS)) break; - } - if (!(move->moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN)) { + + if (!(move->moveFlags & MOVE_FLAG_SUBSEQUENT_IN_LINK_CHAIN)) break; - } move->moveFlags = 0; } // copy over other moves copiedMoves = 0; + for (i = 0; i < 8; i++) { - if (moves[i].moveFlags & MOVE_FLAG_EXISTS) { + if (moves[i].moveFlags & MOVE_FLAG_EXISTS) moveSet[copiedMoves++] = moves[i]; - } } // fill with nonexistent moves - while (copiedMoves < 8) { + while (copiedMoves < 8) moveSet[copiedMoves++].moveFlags = 0; - } // copy back to original moves pointer - for (i = 0; i < 8; i++) { + for (i = 0; i < 8; i++) moves[i] = moveSet[i]; - } } -int unk_MoveIDPrintMoveDescription(int a1, u16 moveID, int a3, struct subStruct_203B240** a4) { - struct Move move; +s32 unk_MoveIDPrintMoveDescription(s32 a1, u16 moveID, s32 a3, struct subStruct_203B240 **a4) +{ + Move move; InitPokemonMove(&move, moveID); return unk_PrintMoveDescription(a1, &move, a3, a4); } -int unk_MovePrintMoveDescription(int a1, struct Move* move, int a3, struct subStruct_203B240** a4) { - struct Move newMove; +UNUSED static s32 unk_MovePrintMoveDescription(s32 a1, Move *move, s32 a3, struct subStruct_203B240 **a4) +{ + Move newMove; CopyAndResetMove(&newMove, move); return unk_PrintMoveDescription(a1, &newMove, a3, a4); } -int unk_PrintMoveDescription(int x, struct Move* move, int a3, struct subStruct_203B240** a4) { - char* moveDescription; - int y; - char buffer[800]; - +s32 unk_PrintMoveDescription(s32 x, Move *move, s32 a3, struct subStruct_203B240 **a4) +{ + u8 *moveDescription; + s32 y; + u8 buffer[800]; + sub_80073B8(a3); sub_80928C0(gAvailablePokemonNames, move, 0); xxx_format_and_draw(8 * x + 16, 0, gUnknown_8109930, a3, 0); y = 19; - moveDescription = gMovesData[move->id].description; - if (moveDescription[0] == '*') - { + moveDescription = sMovesData[move->id].description; + + if (moveDescription[0] == '*') { y = 16; ++moveDescription; } + xxx_format_and_draw(4, y, moveDescription, a3, 0); unk_MovePrintData(move, a3); sub_80073E0(a3); - strcpy(buffer, gMovesData[move->id].description); + strcpy(buffer, sMovesData[move->id].description); return sub_8097DF0(buffer, a4); } -void unk_MovePrintData(struct Move* move, int y) { +static void unk_MovePrintData(Move *move, s32 y) +{ u8 type; s32 power; - const char* text; - + const u8 *text; + sub_80078A4(y, 4, 72, 200, COLOR_WHITE_2); sub_8092D54(gAvailablePokemonNames, move); xxx_format_and_draw(4, 74, gUnknown_810CF00, y, 0); @@ -1459,143 +1454,141 @@ void unk_MovePrintData(struct Move* move, int y) { gUnknown_202DE30 = power; } -void CopyAndResetMove(struct Move* dest, struct Move* src) { +static void CopyAndResetMove(Move *dest, Move *src) +{ if (src->moveFlags & MOVE_FLAG_EXISTS) { dest->moveFlags = src->moveFlags; dest->moveFlags2 = 0; dest->id = src->id; - dest->PP = gMovesData[src->id].basePP; - dest->ginseng = src->PP; // this seems horribly bugged + dest->PP = sMovesData[src->id].basePP; + dest->ginseng = src->PP; // This seems horribly bugged } - else { + else dest->moveFlags = 0; - } } -void CopyAndResetMoves(struct Move *destMoves, struct Move *srcMoves) { - int i; +void CopyAndResetMoves(Move *destMoves, Move *srcMoves) +{ + s32 i; - for (i = 0; i < 4; i++) { + for (i = 0; i < MAX_MON_MOVES; i++) { if (srcMoves[i].moveFlags & 1) { destMoves[i].moveFlags = srcMoves[i].moveFlags; destMoves[i].moveFlags2 = 0; destMoves[i].id = srcMoves[i].id; - destMoves[i].PP = gMovesData[srcMoves[i].id].basePP; - destMoves[i].ginseng = srcMoves[i].PP; + destMoves[i].PP = sMovesData[srcMoves[i].id].basePP; + destMoves[i].ginseng = srcMoves[i].PP; // This seems horribly bugged } - else { + else destMoves[i].moveFlags = 0; - } } // possibly destMoves is not just an array and this is the // next struct field // this index would be out of bounds after all - destMoves[4].moveFlags = 0; + destMoves[MAX_MON_MOVES].moveFlags = 0; } -void CopyBareMoveData(struct Move *destMoves, struct Move *srcMoves) { - int i; +void CopyBareMoveData(Move *destMoves, Move *srcMoves) +{ + s32 i; - for (i = 0; i < 4; i++) { + for (i = 0; i < MAX_MON_MOVES; i++) { destMoves[i].moveFlags = srcMoves[i].moveFlags; destMoves[i].id = srcMoves[i].id; destMoves[i].PP = srcMoves[i].ginseng; } } -void unk_CopyMoves4To8AndClearFlag2Unk4(struct Move* destMoves, struct Move* srcMoves) { - int movesCopied; +void unk_CopyMoves4To8AndClearFlag2Unk4(Move *destMoves, Move *srcMoves) +{ + s32 movesCopied; movesCopied = 0; - for (movesCopied = 0; movesCopied < 4; movesCopied++) { - if (!(srcMoves[movesCopied].moveFlags & MOVE_FLAG_EXISTS)) { + + for (movesCopied = 0; movesCopied < MAX_MON_MOVES; movesCopied++) { + if (!(srcMoves[movesCopied].moveFlags & MOVE_FLAG_EXISTS)) break; - } destMoves[movesCopied] = srcMoves[movesCopied]; destMoves[movesCopied].moveFlags2 &= ~MOVE_FLAG2_UNK4; } - while (movesCopied < 8) { + while (movesCopied < 8) destMoves[movesCopied++].moveFlags = 0; - } } -void unk_CopyMoves4To8(struct Move* destMoves, struct Move* srcMoves) { - int movesCopied; +void unk_CopyMoves4To8(Move *destMoves, Move *srcMoves) +{ + s32 movesCopied; movesCopied = 0; - for (movesCopied = 0; movesCopied < 4; movesCopied++) { - if (!(srcMoves[movesCopied].moveFlags & MOVE_FLAG_EXISTS)) { + for (movesCopied = 0; movesCopied < MAX_MON_MOVES; movesCopied++) { + if (!(srcMoves[movesCopied].moveFlags & MOVE_FLAG_EXISTS)) break; - } destMoves[movesCopied] = srcMoves[movesCopied]; } - while (movesCopied < 8) { + while (movesCopied < 8) destMoves[movesCopied++].moveFlags = 0; - } } -void sub_8094060(struct Move* srcMoves, struct Move* destMoves) { - int i, j; +void sub_8094060(Move *srcMoves, Move *destMoves) +{ + s32 i, j; j = 0; for (i = 0; i < 8; i++) { - struct Move* srcMove = &srcMoves[i]; - struct Move* destMove; - if (!(srcMove->moveFlags & MOVE_FLAG_EXISTS)) { + Move* srcMove = &srcMoves[i]; + Move* destMove; + + if (!(srcMove->moveFlags & MOVE_FLAG_EXISTS)) continue; - } - - if (j >= 4) { + + if (j >= MAX_MON_MOVES) break; - } + destMove = &destMoves[j]; *destMove = *srcMove; j++; } - while (j < 4) { + while (j < MAX_MON_MOVES) destMoves[j++].moveFlags = 0; - } } -void SavePokemonMove(struct unkStruct_8094924 *r0, struct Move *move) +static void SavePokemonMove(struct unkStruct_8094924 *r0, Move *move) { SaveIntegerBits(r0, &move->moveFlags, 4); SaveIntegerBits(r0, &move->id, 9); SaveIntegerBits(r0, &move->PP, 7); } -void RestorePokemonMove(struct unkStruct_8094924 *r0, struct Move *move) +static void RestorePokemonMove(struct unkStruct_8094924 *r0, Move *move) { RestoreIntegerBits(r0, &move->moveFlags, 4); RestoreIntegerBits(r0, &move->id, 9); RestoreIntegerBits(r0, &move->PP, 7); } -void SavePokemonMoves(struct unkStruct_8094924 *r0, struct Move *moveSet) +void SavePokemonMoves(struct unkStruct_8094924 *r0, Move *moveSet) { - s32 iVar4; - for(iVar4 = 0; iVar4 < MAX_MON_MOVES; iVar4++) - { - SavePokemonMove(r0, &moveSet[iVar4]); - } + s32 i; + + for (i = 0; i < MAX_MON_MOVES; i++) + SavePokemonMove(r0, &moveSet[i]); } -void RestorePokemonMoves(struct unkStruct_8094924 *r0, struct Move *moveSet) +void RestorePokemonMoves(struct unkStruct_8094924 *r0, Move *moveSet) { - s32 iVar4; - for(iVar4 = 0; iVar4 < MAX_MON_MOVES; iVar4++) - { - RestorePokemonMove(r0, &moveSet[iVar4]); - } + s32 i; + + for (i = 0; i < MAX_MON_MOVES; i++) + RestorePokemonMove(r0, &moveSet[i]); } -void sub_8094148(struct unkStruct_8094924 *r0, struct Move *move) +static void sub_8094148(struct unkStruct_8094924 *r0, Move *move) { SaveIntegerBits(r0, &move->moveFlags, 4); SaveIntegerBits(r0, &move->moveFlags2, 1); @@ -1606,18 +1599,17 @@ void sub_8094148(struct unkStruct_8094924 *r0, struct Move *move) void sub_8094184(struct unkStruct_8094924 *r0, struct unkStruct_8094184 *r1) { - s32 r4; + s32 i; + + for (i = 0; i < MAX_MON_MOVES; i++) + sub_8094148(r0, &r1->moves[i]); - for(r4 = 0; r4 < MAX_MON_MOVES; r4++) - { - sub_8094148(r0, &r1->moves[r4]); - } SaveIntegerBits(r0, &r1->unk20, 8); } -void sub_80941B0(struct unkStruct_8094924 *r0, struct Move *move) +static void sub_80941B0(struct unkStruct_8094924 *r0, Move *move) { - memset(move, 0, sizeof(struct Move)); + memset(move, 0, sizeof(Move)); RestoreIntegerBits(r0, &move->moveFlags, 4); RestoreIntegerBits(r0, &move->moveFlags2, 1); RestoreIntegerBits(r0, &move->id, 9); @@ -1627,34 +1619,26 @@ void sub_80941B0(struct unkStruct_8094924 *r0, struct Move *move) void sub_80941FC(struct unkStruct_8094924 *r0, struct unkStruct_8094184 *r1) { - s32 iVar4; - for(iVar4 = 0; iVar4 < MAX_MON_MOVES; iVar4++) - { - sub_80941B0(r0, &r1->moves[iVar4]); - } + s32 i; + + for (i = 0; i < MAX_MON_MOVES; i++) + sub_80941B0(r0, &r1->moves[i]); + r1->unk20 = 0; RestoreIntegerBits(r0, &r1->unk20, 8); } bool8 DoesMoveCharge(u16 move) { - if(move == MOVE_SOLARBEAM) - return TRUE; - if(move == MOVE_SKY_ATTACK) - return TRUE; - if(move == MOVE_RAZOR_WIND) - return TRUE; - if(move == MOVE_FOCUS_PUNCH) - return TRUE; - if(move == MOVE_SKULL_BASH) - return TRUE; - if(move == MOVE_FLY) - return TRUE; - if(move == MOVE_BOUNCE) - return TRUE; - if(move == MOVE_DIVE) - return TRUE; - if(move == MOVE_DIG) - return TRUE; + if (move == MOVE_SOLARBEAM) return TRUE; + if (move == MOVE_SKY_ATTACK) return TRUE; + if (move == MOVE_RAZOR_WIND) return TRUE; + if (move == MOVE_FOCUS_PUNCH) return TRUE; + if (move == MOVE_SKULL_BASH) return TRUE; + if (move == MOVE_FLY) return TRUE; + if (move == MOVE_BOUNCE) return TRUE; + if (move == MOVE_DIVE) return TRUE; + if (move == MOVE_DIG) return TRUE; + return FALSE; -} +} \ No newline at end of file diff --git a/src/music.c b/src/music.c index 24b1b209c..27654f880 100644 --- a/src/music.c +++ b/src/music.c @@ -4,24 +4,32 @@ #include "main.h" #include "music.h" -EWRAM_DATA u16 gBGMusicPlayerState = {0}; -EWRAM_DATA u16 gCurrentBGSong = {0}; -EWRAM_DATA u16 gQueuedBGSong = {0}; -EWRAM_DATA u16 gCurrentFanfareSong = {0}; -EWRAM_DATA u16 gFanfareMusicPlayerState = {0}; -EWRAM_DATA u16 gMusicTransitionCounter = {0}; -EWRAM_DATA bool8 gRestartBGM = {0}; +static EWRAM_DATA u16 sBGMusicPlayerstate = {0}; +static EWRAM_DATA u16 sCurrentBGSong = {0}; +static EWRAM_DATA u16 sQueuedBGSong = {0}; +static EWRAM_DATA u16 sCurrentFanfareSong = {0}; +static EWRAM_DATA u16 sFanfareMusicPlayerState = {0}; +static EWRAM_DATA u16 sMusicTransitionCounter = {0}; +static EWRAM_DATA bool8 sRestartBGM = {0}; -IWRAM_DATA struct PMDMusicPlayer gBGMusicPlayers[NUM_BG_PLAYERS] = {0}; -IWRAM_DATA struct PMDMusicPlayer gSEMusicPlayers[NUM_SE_PLAYERS] = {0}; +static IWRAM_DATA PMDMusicPlayer sBGMusicPlayers[NUM_BG_PLAYERS] = {0}; +static IWRAM_DATA PMDMusicPlayer sSEMusicPlayers[NUM_SE_PLAYERS] = {0}; -void nullsub_21(u16); +static u16 GetMusicPlayerIndex(u16 songIndex); +static bool8 IsBGSong(u32 songIndex); +static bool8 IsFanfare(u32 songIndex); +static bool8 IsMusicPlayerPlaying(u16 playerIndex); +static bool8 IsSoundEffect(u32 songIndex); + +static void nullsub_19(void); +static void nullsub_20(u16 songIndex); +static void nullsub_21(u16 songIndex); void InitMusic(void) { s32 playerIndex; - struct PMDMusicPlayer *musicPlayer; + PMDMusicPlayer *musicPlayer; DmaStop(0); DmaStop(1); @@ -30,25 +38,25 @@ void InitMusic(void) m4aSoundInit(); - gBGMusicPlayerState = 0; - gCurrentBGSong = STOP_BGM; - gQueuedBGSong = STOP_BGM; - gCurrentFanfareSong = STOP_SOUND_EFFECT; - gFanfareMusicPlayerState = 0; - gMusicTransitionCounter = 0; - gRestartBGM = FALSE; + sBGMusicPlayerstate = 0; + sCurrentBGSong = STOP_BGM; + sQueuedBGSong = STOP_BGM; + sCurrentFanfareSong = STOP_SOUND_EFFECT; + sFanfareMusicPlayerState = 0; + sMusicTransitionCounter = 0; + sRestartBGM = FALSE; - for(playerIndex = INDEX_BGM, musicPlayer = &gBGMusicPlayers[0]; playerIndex < INDEX_SE6 + 1; playerIndex++, musicPlayer++) - { + for (playerIndex = INDEX_BGM, musicPlayer = &sBGMusicPlayers[0]; playerIndex < INDEX_SE6 + 1; playerIndex++, musicPlayer++) { musicPlayer->unk0 = 0; musicPlayer->songIndex = STOP_SOUND_EFFECT; musicPlayer->volume = 0; musicPlayer->isNotMaxVolume = FALSE; } + nullsub_19(); } -void StopAllMusic(void) +UNUSED static void StopAllMusic(void) { StopBGM(); StopFanfareSE(STOP_FANFARE); @@ -59,30 +67,28 @@ void StartNewBGM(u16 songIndex) { bool8 interrupt_flag; - if(!IsBGSong(songIndex)) + if (!IsBGSong(songIndex)) return; - if(songIndex == STOP_BGM) + if (songIndex == STOP_BGM) return; - if(songIndex == gCurrentBGSong) - { - if((u16)(gBGMusicPlayerState - 1) <= 1) + if (songIndex == sCurrentBGSong) { + if ((u16)(sBGMusicPlayerstate - 1) <= 1) return; } - if(GetMusicPlayerIndex(songIndex) != INDEX_BGM) - { + if (GetMusicPlayerIndex(songIndex) != INDEX_BGM) { nullsub_20(songIndex); return; } - interrupt_flag = DisableInterrupts(); - gCurrentBGSong = songIndex; - gRestartBGM = TRUE; - if(gFanfareMusicPlayerState == 0) - { - gBGMusicPlayerState = BG_PLAYER_STATE_PLAYING; + interrupt_flag = DisableInterrupts(); + sCurrentBGSong = songIndex; + sRestartBGM = TRUE; + + if (sFanfareMusicPlayerState == 0) { + sBGMusicPlayerstate = BG_PLAYER_STATE_PLAYING; m4aSongNumStart(songIndex); } - if(interrupt_flag) + if (interrupt_flag) EnableInterrupts(); } @@ -90,70 +96,63 @@ void FadeInNewBGM(u16 songIndex, u16 speed) { bool8 interrupt_flag; - if(!IsBGSong(songIndex)) + if (!IsBGSong(songIndex)) return; - if(songIndex == STOP_BGM) + if (songIndex == STOP_BGM) return; - if(songIndex == gCurrentBGSong) - { - if((u16)(gBGMusicPlayerState - 1) <= 1) + if (songIndex == sCurrentBGSong) { + if ((u16)(sBGMusicPlayerstate - 1) <= 1) return; } - if((speed > 256)) - { + if (speed > 256) speed = 16; - - } - else - { - if((speed >>= 4) == 0) - { + else { + speed >>= 4; + if (speed == 0) speed = 1; - } } interrupt_flag = DisableInterrupts(); - gCurrentBGSong = songIndex; - gRestartBGM = TRUE; + sCurrentBGSong = songIndex; + sRestartBGM = TRUE; - if(gFanfareMusicPlayerState == 0) - { - gBGMusicPlayerState = BG_PLAYER_STATE_PLAYING; + if (sFanfareMusicPlayerState == 0) { + sBGMusicPlayerstate = BG_PLAYER_STATE_PLAYING; m4aSongNumStart(songIndex); m4aMPlayImmInit(&gMPlayInfo_BGM); m4aMPlayVolumeControl(&gMPlayInfo_BGM, 0xFF, 0); m4aSongNumStop(songIndex); m4aMPlayFadeIn(&gMPlayInfo_BGM, speed); } - if(interrupt_flag) + + if (interrupt_flag) EnableInterrupts(); } void QueueBGM(u16 songIndex) { - if(gCurrentBGSong == STOP_BGM) - { + if (sCurrentBGSong == STOP_BGM) { StartNewBGM(songIndex); - gQueuedBGSong = STOP_BGM; + sQueuedBGSong = STOP_BGM; } else - gQueuedBGSong = songIndex; + sQueuedBGSong = songIndex; } void StopBGM(void) { bool8 interrupt_flag = DisableInterrupts(); - if(gFanfareMusicPlayerState == 0) - { - if(gCurrentBGSong != STOP_BGM) - { + + if (sFanfareMusicPlayerState == 0) { + if (sCurrentBGSong != STOP_BGM) m4aMPlayStop(&gMPlayInfo_BGM); - } } - gCurrentBGSong = STOP_BGM; - gQueuedBGSong = STOP_BGM; - if(interrupt_flag) + + sCurrentBGSong = STOP_BGM; + sQueuedBGSong = STOP_BGM; + + if (interrupt_flag) EnableInterrupts(); } @@ -161,225 +160,208 @@ void FadeOutBGM(u16 speed) { bool8 interrupt_flag; - if(speed > ((0x80 << 17) / 65536)) - { +// TODO: int16 memes + if (speed > (0x80 << 17) / 65536) speed = 16; - } - else - { - if((speed >>= 4) == 0) - { + else { + speed >>= 4; + if (speed == 0) speed = 1; - } } + interrupt_flag = DisableInterrupts(); - if(gFanfareMusicPlayerState == 0) - { - if(gCurrentBGSong != STOP_BGM) - { - if(gBGMusicPlayerState == 2) - { - gBGMusicPlayerState = 3; + + if (sFanfareMusicPlayerState == 0) { + if (sCurrentBGSong != STOP_BGM) { + if (sBGMusicPlayerstate == 2) { + sBGMusicPlayerstate = 3; m4aMPlayFadeOut(&gMPlayInfo_BGM, speed); } - else - { - gCurrentBGSong = STOP_BGM; + else { + sCurrentBGSong = STOP_BGM; m4aMPlayStop(&gMPlayInfo_BGM); } } } else - { - gCurrentBGSong = STOP_BGM; - } - gQueuedBGSong = STOP_BGM; - if(interrupt_flag) + sCurrentBGSong = STOP_BGM; + + sQueuedBGSong = STOP_BGM; + + if (interrupt_flag) EnableInterrupts(); } u16 GetCurrentBGSong(void) { - return gCurrentBGSong; + return sCurrentBGSong; } void PlayFanfareSE(u16 songIndex, u16 volume) { - bool8 interrupt_flag; - bool8 interrupt_flag2; - u16 playerIndex; - struct PMDMusicPlayer *musicPlayer; + bool8 interrupt_flag; + bool8 interrupt_flag2; + u16 playerIndex; + PMDMusicPlayer *musicPlayer; - if (songIndex == STOP_SOUND_EFFECT) - return; - if (volume > MAX_VOLUME) - volume = MAX_VOLUME; + if (songIndex == STOP_SOUND_EFFECT) + return; + if (volume > MAX_VOLUME) + volume = MAX_VOLUME; - if (IsFanfare(songIndex)) - { - if (GetMusicPlayerIndex(songIndex) == INDEX_FANFARE) { - interrupt_flag = DisableInterrupts(); - gCurrentFanfareSong = songIndex; - if(gFanfareMusicPlayerState == 0) - { - if (gCurrentBGSong != STOP_BGM) - { - if ((u16)(gBGMusicPlayerState - 1) < 2) - { - gFanfareMusicPlayerState = 1; - gMusicTransitionCounter = 16; - gRestartBGM = FALSE; - m4aMPlayFadeOutTemporarily(&gMPlayInfo_BGM, 1); + if (IsFanfare(songIndex)) { + if (GetMusicPlayerIndex(songIndex) == INDEX_FANFARE) { + interrupt_flag = DisableInterrupts(); + sCurrentFanfareSong = songIndex; + if (sFanfareMusicPlayerState == 0) { + if (sCurrentBGSong != STOP_BGM) { + if ((u16)(sBGMusicPlayerstate - 1) < 2) { + sFanfareMusicPlayerState = 1; + sMusicTransitionCounter = 16; + sRestartBGM = FALSE; + m4aMPlayFadeOutTemporarily(&gMPlayInfo_BGM, 1); + } + else if (sBGMusicPlayerstate == 3) + sFanfareMusicPlayerState = 2; + else { + sFanfareMusicPlayerState = FANFARE_PLAYER_STATE_PLAYING; + m4aMPlayStop(&gMPlayInfo_BGM); + m4aSongNumStart(sCurrentFanfareSong); + } + } + else { + sFanfareMusicPlayerState = FANFARE_PLAYER_STATE_PLAYING; + m4aMPlayStop(&gMPlayInfo_BGM); + m4aSongNumStart(sCurrentFanfareSong); + } } - else if (gBGMusicPlayerState == 3) - gFanfareMusicPlayerState = 2; - else - { - gFanfareMusicPlayerState = FANFARE_PLAYER_STATE_PLAYING; - m4aMPlayStop(&gMPlayInfo_BGM); - m4aSongNumStart(gCurrentFanfareSong); + else { + if (1 < (u16)(sFanfareMusicPlayerState - 1)) { + m4aMPlayStop(&gMPlayInfo_BGM); + m4aSongNumStart(sCurrentFanfareSong); + sFanfareMusicPlayerState = FANFARE_PLAYER_STATE_PLAYING; + } } + + switch (sCurrentBGSong) { + case MUS_RAYQUAZAS_DOMAIN: + case MUS_FRIEND_AREA_STRATOS_LOOKOUT: + case MUS_FRIEND_AREA_RAINBOW_PEAK: + case MUS_DREAM_EATER: + case MUS_FRIEND_AREA_DEEPSEA_CURRENT: + case MUS_FRIEND_AREA_SEAFLOOR_CAVE: + case MUS_FRIEND_AREA_VOLCANIC_PIT: + case MUS_FRIEND_AREA_CRYPTIC_CAVE: + case MUS_THE_OTHER_SIDE: + case MUS_THE_MOUNTAIN_OF_FIRE: + case MUS_FRIEND_AREA_LEGENDARY_ISLAND: + case MUS_FRIEND_AREA_SOUTHERN_ISLAND: + case MUS_FRIEND_AREA_ENCLOSED_ISLAND: + case MUS_FRIEND_AREA_FINAL_ISLAND: + case MUS_FRIEND_AREA_HEALING_FOREST: + sRestartBGM = TRUE; + break; + default: + break; + } + + if (interrupt_flag) + EnableInterrupts(); } + else + nullsub_20(songIndex); + } + else { + if (!IsSoundEffect(songIndex)) + return; + + playerIndex = GetMusicPlayerIndex(songIndex); + musicPlayer = &sBGMusicPlayers[playerIndex]; // need to load this before comparison to match + + if (playerIndex < INDEX_SE1) + nullsub_20(songIndex); else { - gFanfareMusicPlayerState = FANFARE_PLAYER_STATE_PLAYING; - m4aMPlayStop(&gMPlayInfo_BGM); - m4aSongNumStart(gCurrentFanfareSong); + interrupt_flag2 = DisableInterrupts(); + m4aSongNumStart(songIndex); + musicPlayer->unk0 = 1; + musicPlayer->songIndex = songIndex; + + if (volume == MAX_VOLUME) + musicPlayer->isNotMaxVolume = FALSE; + else + musicPlayer->isNotMaxVolume = TRUE; + + musicPlayer->volume = volume; + if (interrupt_flag2) + EnableInterrupts(); } - } - else - { - if (1 < (u16)(gFanfareMusicPlayerState - 1)) - { - m4aMPlayStop(&gMPlayInfo_BGM); - m4aSongNumStart(gCurrentFanfareSong); - gFanfareMusicPlayerState = FANFARE_PLAYER_STATE_PLAYING; - } - } - switch(gCurrentBGSong) - { - case MUS_RAYQUAZAS_DOMAIN: - case MUS_FRIEND_AREA_STRATOS_LOOKOUT: - case MUS_FRIEND_AREA_RAINBOW_PEAK: - case MUS_DREAM_EATER: - case MUS_FRIEND_AREA_DEEPSEA_CURRENT: - case MUS_FRIEND_AREA_SEAFLOOR_CAVE: - case MUS_FRIEND_AREA_VOLCANIC_PIT: - case MUS_FRIEND_AREA_CRYPTIC_CAVE: - case MUS_THE_OTHER_SIDE: - case MUS_THE_MOUNTAIN_OF_FIRE: - case MUS_FRIEND_AREA_LEGENDARY_ISLAND: - case MUS_FRIEND_AREA_SOUTHERN_ISLAND: - case MUS_FRIEND_AREA_ENCLOSED_ISLAND: - case MUS_FRIEND_AREA_FINAL_ISLAND: - case MUS_FRIEND_AREA_HEALING_FOREST: - gRestartBGM = TRUE; - break; - default: - break; - } - if (interrupt_flag) - EnableInterrupts(); } - else - { - nullsub_20(songIndex); - } - } - else - { - if (!IsSoundEffect(songIndex)) - return; - playerIndex = GetMusicPlayerIndex(songIndex); - musicPlayer = &gBGMusicPlayers[playerIndex]; // need to load this before comparison to match - if (playerIndex < INDEX_SE1) - nullsub_20(songIndex); - else - { - interrupt_flag2 = DisableInterrupts(); - m4aSongNumStart(songIndex); - musicPlayer->unk0 = 1; - musicPlayer->songIndex = songIndex; - if(volume == MAX_VOLUME) - { - musicPlayer->isNotMaxVolume = FALSE; - } - else - { - musicPlayer->isNotMaxVolume = TRUE; - } - musicPlayer->volume = volume; - if (interrupt_flag2) - EnableInterrupts(); - } - } } -void SetSoundEffectVolume(u16 songIndex, u16 volume) +UNUSED static void SetSoundEffectVolume(u16 songIndex, u16 volume) { - bool8 interrupt_flag; - u16 playerIndex; - struct MusicPlayerInfo *info; - struct PMDMusicPlayer *musicPlayer; + bool8 interrupt_flag; + u16 playerIndex; + struct MusicPlayerInfo *info; + PMDMusicPlayer *musicPlayer; - if (MAX_VOLUME < volume) { - volume = MAX_VOLUME; - } + if (MAX_VOLUME < volume) + volume = MAX_VOLUME; - if ((!IsFanfare(songIndex)) && (IsSoundEffect(songIndex))) { - playerIndex = GetMusicPlayerIndex(songIndex); - info = gMPlayTable[playerIndex].info; - musicPlayer = &gBGMusicPlayers[playerIndex]; - if (playerIndex >= INDEX_SE1) { - interrupt_flag = DisableInterrupts(); - if (musicPlayer->songIndex == songIndex) { - m4aMPlayVolumeControl(info, 0xf, volume); - } - if (interrupt_flag) - EnableInterrupts(); + if (!IsFanfare(songIndex) && IsSoundEffect(songIndex)) { + playerIndex = GetMusicPlayerIndex(songIndex); + info = gMPlayTable[playerIndex].info; + musicPlayer = &sBGMusicPlayers[playerIndex]; + if (playerIndex >= INDEX_SE1) { + interrupt_flag = DisableInterrupts(); + if (musicPlayer->songIndex == songIndex) + m4aMPlayVolumeControl(info, 0xf, volume); + + if (interrupt_flag) + EnableInterrupts(); + } } - } } void StopFanfareSE(u16 songIndex) { // Each section needs a var for interrupts.. - char cVar1; - char cVar2; - char cVar3; - char cVar4; + bool8 cVar1; + bool8 cVar2; + bool8 cVar3; + bool8 cVar4; u32 playerIndex; s32 playerIndex2; struct MusicPlayerInfo *info; - struct PMDMusicPlayer *musicPlayer; - struct PMDMusicPlayer *musicPlayer1; + PMDMusicPlayer *musicPlayer; + PMDMusicPlayer *musicPlayer1; if (songIndex == STOP_SOUND_EFFECT) { cVar1 = DisableInterrupts(); - for(playerIndex2 = INDEX_SE1, musicPlayer1 = &gSEMusicPlayers[0]; playerIndex2 < INDEX_SE6; playerIndex2++, musicPlayer1++) - { + for (playerIndex2 = INDEX_SE1, musicPlayer1 = &sSEMusicPlayers[0]; playerIndex2 < INDEX_SE6; playerIndex2++, musicPlayer1++) { m4aMPlayStop(gMPlayTable[playerIndex2].info); musicPlayer1->unk0 = 0; musicPlayer1->songIndex = STOP_SOUND_EFFECT; musicPlayer1->volume = 0; musicPlayer1->isNotMaxVolume = FALSE; } - if (cVar1 != '\0') { + + if (cVar1) EnableInterrupts(); - } } - else if (IsSoundEffect(songIndex)) - { + else if (IsSoundEffect(songIndex)) { playerIndex = GetMusicPlayerIndex(songIndex); info = gMPlayTable[playerIndex].info; - musicPlayer = &gBGMusicPlayers[playerIndex]; - if (playerIndex < INDEX_SE1) { + musicPlayer = &sBGMusicPlayers[playerIndex]; + + if (playerIndex < INDEX_SE1) nullsub_21(songIndex); - } else { cVar2 = DisableInterrupts(); + if (musicPlayer->songIndex == songIndex) { m4aMPlayStop(info); musicPlayer->unk0 = 0; @@ -387,73 +369,69 @@ void StopFanfareSE(u16 songIndex) musicPlayer->volume = 0; musicPlayer->isNotMaxVolume = FALSE; } - if (cVar2 != '\0') { + + if (cVar2) EnableInterrupts(); - } } } - else if (songIndex == STOP_FANFARE) - { + else if (songIndex == STOP_FANFARE) { cVar3 = DisableInterrupts(); - if (gFanfareMusicPlayerState != 0) { - if (gCurrentFanfareSong != STOP_SOUND_EFFECT) { - gCurrentFanfareSong = STOP_SOUND_EFFECT; + + if (sFanfareMusicPlayerState != 0) { + if (sCurrentFanfareSong != STOP_SOUND_EFFECT) { + sCurrentFanfareSong = STOP_SOUND_EFFECT; m4aMPlayStop(&gMPlayInfo_Fanfare); } } - if (cVar3 != '\0') { + + if (cVar3) EnableInterrupts(); - } } - else if (IsFanfare(songIndex)) - { + else if (IsFanfare(songIndex)) { cVar4 = DisableInterrupts(); - if (gFanfareMusicPlayerState != 0) { - if (gCurrentFanfareSong == songIndex) { - gCurrentFanfareSong = STOP_SOUND_EFFECT; + + if (sFanfareMusicPlayerState != 0) { + if (sCurrentFanfareSong == songIndex) { + sCurrentFanfareSong = STOP_SOUND_EFFECT; m4aMPlayStop(&gMPlayInfo_Fanfare); } } - if (cVar4 != '\0') { + + if (cVar4) EnableInterrupts(); - } } } void FadeOutFanfareSE(u16 songIndex, u16 speed) { - char cVar1; - char cVar2; - char cVar3; - char cVar4; + bool8 cVar1; + bool8 cVar2; + bool8 cVar3; + bool8 cVar4; u32 comparison; s32 playerIndex2; u32 playerIndex; - struct PMDMusicPlayer *musicPlayer; - struct PMDMusicPlayer *musicPlayer1; + PMDMusicPlayer *musicPlayer; + PMDMusicPlayer *musicPlayer1; struct MusicPlayerInfo *playerInfo; +// TODO: int16 memes comparison = 0x80 << 17; // 16777216 - if((speed * 65536) > comparison) - { + if (speed * 65536 > comparison) speed = 16; - } - else - { - if((speed >>= 4) == 0) - { + else { + speed >>= 4; + if (speed == 0) speed = 1; - } } if (songIndex == STOP_SOUND_EFFECT) { cVar1 = DisableInterrupts(); - for(playerIndex2 = INDEX_SE1, musicPlayer1 = &gSEMusicPlayers[0]; playerIndex2 < INDEX_SE6; playerIndex2++, musicPlayer1++) - { + + for(playerIndex2 = INDEX_SE1, musicPlayer1 = &sSEMusicPlayers[0]; playerIndex2 < INDEX_SE6; playerIndex2++, musicPlayer1++) { if (musicPlayer1->songIndex != STOP_SOUND_EFFECT) { - if (IsMusicPlayerPlaying(playerIndex2)) { - m4aMPlayFadeOut(gMPlayTable[playerIndex2].info,speed); - } + if (IsMusicPlayerPlaying(playerIndex2)) + m4aMPlayFadeOut(gMPlayTable[playerIndex2].info, speed); else { m4aMPlayStop(gMPlayTable[playerIndex2].info); musicPlayer1->unk0 = 0; @@ -463,19 +441,19 @@ void FadeOutFanfareSE(u16 songIndex, u16 speed) } } } - if (cVar1 != '\0') { + + if (cVar1) EnableInterrupts(); - } } else if (IsSoundEffect(songIndex)) { playerIndex = GetMusicPlayerIndex(songIndex); - musicPlayer = &gBGMusicPlayers[playerIndex]; + musicPlayer = &sBGMusicPlayers[playerIndex]; playerInfo = gMPlayTable[playerIndex].info; cVar2 = DisableInterrupts(); + if (musicPlayer->songIndex != STOP_SOUND_EFFECT) { - if (IsMusicPlayerPlaying(playerIndex)) { - m4aMPlayFadeOut(playerInfo,speed); - } + if (IsMusicPlayerPlaying(playerIndex)) + m4aMPlayFadeOut(playerInfo, speed); else { m4aMPlayStop(playerInfo); musicPlayer->unk0 = 0; @@ -484,253 +462,228 @@ void FadeOutFanfareSE(u16 songIndex, u16 speed) musicPlayer->isNotMaxVolume = FALSE; } } - if (cVar2 != '\0') { + + if (cVar2) EnableInterrupts(); - } } else if (songIndex == STOP_FANFARE) { cVar3 = DisableInterrupts(); - if ((gFanfareMusicPlayerState != 0) && (gCurrentFanfareSong != STOP_SOUND_EFFECT)) { - if (IsMusicPlayerPlaying(INDEX_FANFARE)) { - m4aMPlayFadeOut(&gMPlayInfo_Fanfare,speed); - } + + if (sFanfareMusicPlayerState != 0 && sCurrentFanfareSong != STOP_SOUND_EFFECT) { + if (IsMusicPlayerPlaying(INDEX_FANFARE)) + m4aMPlayFadeOut(&gMPlayInfo_Fanfare, speed); else { m4aMPlayStop(&gMPlayInfo_Fanfare); - gCurrentFanfareSong = STOP_SOUND_EFFECT; + sCurrentFanfareSong = STOP_SOUND_EFFECT; } } - if (cVar3 != '\0') { + + if (cVar3) EnableInterrupts(); - } } else if (IsFanfare(songIndex)) { cVar4 = DisableInterrupts(); - if ((gFanfareMusicPlayerState != 0) && (gCurrentFanfareSong == songIndex)) { - if (IsMusicPlayerPlaying(INDEX_FANFARE)) { - m4aMPlayFadeOut(&gMPlayInfo_Fanfare,speed); - } + + if (sFanfareMusicPlayerState != 0 && sCurrentFanfareSong == songIndex) { + if (IsMusicPlayerPlaying(INDEX_FANFARE)) + m4aMPlayFadeOut(&gMPlayInfo_Fanfare, speed); else { m4aMPlayStop(&gMPlayInfo_Fanfare); - gCurrentFanfareSong = STOP_SOUND_EFFECT; + sCurrentFanfareSong = STOP_SOUND_EFFECT; } } - if (cVar4 != '\0') { + + if (cVar4) EnableInterrupts(); - } } } bool8 IsFanfareSEPlaying(u16 songIndex) { - u32 playerIndex; - struct PMDMusicPlayer *musicPlayer; -#ifndef NONMATCHING - register u32 songIndex_u32 asm("r4"); - register u32 songIndex_u32_2 asm("r5"); -#else - u32 songIndex_u32; - u32 songIndex_u32_2; -#endif + u32 playerIndex; + PMDMusicPlayer *musicPlayer; + #ifndef NONMATCHING + register u32 songIndex_u32 asm("r4"); + register u32 songIndex_u32_2 asm("r5"); + #else + u32 songIndex_u32; + u32 songIndex_u32_2; + #endif - songIndex_u32 = songIndex; - songIndex_u32_2 = songIndex_u32; + songIndex_u32 = songIndex; + songIndex_u32_2 = songIndex_u32; - if (IsFanfare(songIndex_u32)) { - if ((gFanfareMusicPlayerState != 0) && (gCurrentFanfareSong == songIndex_u32)) { - return TRUE; + if (IsFanfare(songIndex_u32)) { + if (sFanfareMusicPlayerState != 0 && sCurrentFanfareSong == songIndex_u32) + return TRUE; } - } - else - { - if (IsSoundEffect(songIndex_u32)) { - playerIndex = GetMusicPlayerIndex(songIndex_u32); - musicPlayer = &gBGMusicPlayers[playerIndex]; - if ((INDEX_SE1 <= playerIndex) && (musicPlayer->songIndex == songIndex_u32_2)) { - return TRUE; - } + else { + if (IsSoundEffect(songIndex_u32)) { + playerIndex = GetMusicPlayerIndex(songIndex_u32); + musicPlayer = &sBGMusicPlayers[playerIndex]; + if (INDEX_SE1 <= playerIndex && musicPlayer->songIndex == songIndex_u32_2) + return TRUE; + } } - } - return FALSE; + + return FALSE; } void SoundVSync(void) { - u8 cVar1; + bool8 cVar1; - cVar1 = DisableInterrupts(); - m4aSoundVSync(); - if(cVar1) - EnableInterrupts(); + cVar1 = DisableInterrupts(); + + m4aSoundVSync(); + + if (cVar1) + EnableInterrupts(); } - void nullsub_18(void) { } void UpdateSound(void) { - struct PMDMusicPlayer *musicPlayer; // r4 + PMDMusicPlayer *musicPlayer; // r4 s32 musicPlayerIndex; // r5 - + m4aSoundMain(); - if(gFanfareMusicPlayerState != 0) - { - switch(gFanfareMusicPlayerState) - { + if (sFanfareMusicPlayerState != 0) { + switch (sFanfareMusicPlayerState) { case 1: - if (gMusicTransitionCounter != 0) - { - gMusicTransitionCounter--; + if (sMusicTransitionCounter != 0) + sMusicTransitionCounter--; + else if (sCurrentFanfareSong == STOP_SOUND_EFFECT) { + sFanfareMusicPlayerState = 4; + sMusicTransitionCounter = 32; } - else if (gCurrentFanfareSong == STOP_SOUND_EFFECT) - { - gFanfareMusicPlayerState = 4; - gMusicTransitionCounter = 32; - } - else - { - m4aSongNumStart(gCurrentFanfareSong); - gFanfareMusicPlayerState = FANFARE_PLAYER_STATE_PLAYING; + else { + m4aSongNumStart(sCurrentFanfareSong); + sFanfareMusicPlayerState = FANFARE_PLAYER_STATE_PLAYING; } break; case 2: - if ((gCurrentBGSong != STOP_BGM) && (IsMusicPlayerPlaying(INDEX_BGM))) + if (sCurrentBGSong != STOP_BGM && IsMusicPlayerPlaying(INDEX_BGM)) break; - if (gCurrentFanfareSong == STOP_SOUND_EFFECT) - { - gFanfareMusicPlayerState = 4; - gMusicTransitionCounter = 32; + + if (sCurrentFanfareSong == STOP_SOUND_EFFECT) { + sFanfareMusicPlayerState = 4; + sMusicTransitionCounter = 32; } - else - { - m4aSongNumStart(gCurrentFanfareSong); - gFanfareMusicPlayerState = FANFARE_PLAYER_STATE_PLAYING; + else { + m4aSongNumStart(sCurrentFanfareSong); + sFanfareMusicPlayerState = FANFARE_PLAYER_STATE_PLAYING; } break; case 3: - if ((gCurrentFanfareSong != STOP_SOUND_EFFECT) && (!IsMusicPlayerPlaying(INDEX_FANFARE))) // INDEX_FANFARE + if (sCurrentFanfareSong != STOP_SOUND_EFFECT && !IsMusicPlayerPlaying(INDEX_FANFARE)) // INDEX_FANFARE break; - else { - gFanfareMusicPlayerState = 4; - gMusicTransitionCounter = 32; - } + + sFanfareMusicPlayerState = 4; + sMusicTransitionCounter = 32; break; case 4: - if (gCurrentFanfareSong != STOP_SOUND_EFFECT) - { - if (IsMusicPlayerPlaying(INDEX_FANFARE)) break; // INDEX_FANFARE + if (sCurrentFanfareSong != STOP_SOUND_EFFECT) { + if (IsMusicPlayerPlaying(INDEX_FANFARE)) + break; // INDEX_FANFARE } else m4aMPlayStop(&gMPlayInfo_Fanfare); - if (gMusicTransitionCounter != 0) - { - gMusicTransitionCounter--; + if (sMusicTransitionCounter != 0) { + sMusicTransitionCounter--; break; } - else if (gCurrentBGSong != STOP_BGM) - { - gBGMusicPlayerState = BG_PLAYER_STATE_PLAYING; - if (gRestartBGM) - m4aSongNumStart(gCurrentBGSong); + + if (sCurrentBGSong != STOP_BGM) { + sBGMusicPlayerstate = BG_PLAYER_STATE_PLAYING; + + if (sRestartBGM) + m4aSongNumStart(sCurrentBGSong); else m4aMPlayFadeIn(&gMPlayInfo_BGM,4); } - else - { - gBGMusicPlayerState = 0; + else { + sBGMusicPlayerstate = 0; m4aMPlayStop(&gMPlayInfo_BGM); } - gFanfareMusicPlayerState = 0; - gCurrentFanfareSong = STOP_SOUND_EFFECT; + + sFanfareMusicPlayerState = 0; + sCurrentFanfareSong = STOP_SOUND_EFFECT; break; } } - else if (gBGMusicPlayerState != BG_PLAYER_STATE_INITIALIZE) - { - switch(gBGMusicPlayerState) - { - + else if (sBGMusicPlayerstate != BG_PLAYER_STATE_INITIALIZE) { + switch (sBGMusicPlayerstate) { case BG_PLAYER_STATE_PLAYING: - if ((gCurrentBGSong == STOP_BGM) || IsMusicPlayerPlaying(INDEX_BGM)) // INDEX_BGM - { - gBGMusicPlayerState = 2; - } + if (sCurrentBGSong == STOP_BGM || IsMusicPlayerPlaying(INDEX_BGM)) // INDEX_BGM + sBGMusicPlayerstate = 2; break; case 2: case 3: - if (gCurrentBGSong != STOP_BGM) - { - if (IsMusicPlayerPlaying(INDEX_BGM)) break; // INDEX_BGM + if (sCurrentBGSong != STOP_BGM) { + if (IsMusicPlayerPlaying(INDEX_BGM)) + break; // INDEX_BGM } else m4aMPlayStop(&gMPlayInfo_BGM); - gBGMusicPlayerState = 0; - gCurrentBGSong = STOP_BGM; + + sBGMusicPlayerstate = 0; + sCurrentBGSong = STOP_BGM; break; - case BG_PLAYER_STATE_STOPPED: // can also be other constants + case BG_PLAYER_STATE_STOPPED: // Can also be other constants break; } } - else - { - if (!IsMusicPlayerPlaying(INDEX_BGM)) - { + else { + if (!IsMusicPlayerPlaying(INDEX_BGM)) { #ifndef NONMATCHING - register u16 r2 asm("r2") = gQueuedBGSong, r1 = r2; + register u16 r2 asm("r2") = sQueuedBGSong, r1 = r2; #else u16 r2, r1; - r2 = gQueuedBGSong, r1 = r2; + r2 = sQueuedBGSong, r1 = r2; #endif - if (r1 != STOP_BGM) - { - gBGMusicPlayerState = BG_PLAYER_STATE_PLAYING; - gCurrentBGSong = r2; + if (r1 != STOP_BGM) { + sBGMusicPlayerstate = BG_PLAYER_STATE_PLAYING; + sCurrentBGSong = r2; m4aSongNumStart(r1); - gQueuedBGSong = STOP_BGM; + sQueuedBGSong = STOP_BGM; } - else - { - gBGMusicPlayerState = 0; - gCurrentBGSong = STOP_BGM; + else { + sBGMusicPlayerstate = 0; + sCurrentBGSong = STOP_BGM; } } } - for(musicPlayerIndex = INDEX_SE1, musicPlayer = &gSEMusicPlayers[0]; musicPlayerIndex < INDEX_SE6; musicPlayerIndex++, musicPlayer++) - { - if (musicPlayer->songIndex != STOP_SOUND_EFFECT) - { - switch(musicPlayer->unk0) - { - case 1: - if ((musicPlayer->songIndex == STOP_BGM) || (IsMusicPlayerPlaying(musicPlayerIndex))) - { - musicPlayer->unk0 = 2; - } - break; - case 2: - if (IsMusicPlayerPlaying(musicPlayerIndex)) - { - if(musicPlayer->isNotMaxVolume) - { - musicPlayer->isNotMaxVolume = FALSE; - m4aMPlayVolumeControl(gMPlayTable[musicPlayerIndex].info,0xff,musicPlayer->volume); - } - } - else - { - musicPlayer->unk0 = 0; - musicPlayer->songIndex = STOP_SOUND_EFFECT; - musicPlayer->volume = 0; + for (musicPlayerIndex = INDEX_SE1, musicPlayer = &sSEMusicPlayers[0]; musicPlayerIndex < INDEX_SE6; musicPlayerIndex++, musicPlayer++) { + if (musicPlayer->songIndex != STOP_SOUND_EFFECT) { + switch (musicPlayer->unk0){ + case 1: + if (musicPlayer->songIndex == STOP_BGM || IsMusicPlayerPlaying(musicPlayerIndex)) + musicPlayer->unk0 = 2; + break; + case 2: + if (IsMusicPlayerPlaying(musicPlayerIndex)) { + if (musicPlayer->isNotMaxVolume) { musicPlayer->isNotMaxVolume = FALSE; + m4aMPlayVolumeControl(gMPlayTable[musicPlayerIndex].info, 0xFF, musicPlayer->volume); } - break; - case 3: - case 0: - break; + } + else { + musicPlayer->unk0 = 0; + musicPlayer->songIndex = STOP_SOUND_EFFECT; + musicPlayer->volume = 0; + musicPlayer->isNotMaxVolume = FALSE; + } + break; + case 3: + case 0: + break; } } } @@ -745,144 +698,116 @@ void StopBGMusicVSync(void) FadeOutFanfareSE(STOP_FANFARE, 0x10); interrupt_flag = DisableInterrupts(); - if(gFanfareMusicPlayerState == 0) - { - if(gCurrentBGSong != STOP_BGM) - { - temp = gBGMusicPlayerState - 1; - if(temp <= 1) - { - if(gBGMusicPlayerState == 2) - { - gRestartBGM = FALSE; - } - else if(gBGMusicPlayerState == BG_PLAYER_STATE_PLAYING) - { - gRestartBGM = TRUE; - } - gBGMusicPlayerState = BG_PLAYER_STATE_STOPPED; + + if (sFanfareMusicPlayerState == 0) { + if (sCurrentBGSong != STOP_BGM) { + temp = sBGMusicPlayerstate - 1; + if (temp <= 1) { + if (sBGMusicPlayerstate == 2) + sRestartBGM = FALSE; + else if (sBGMusicPlayerstate == BG_PLAYER_STATE_PLAYING) + sRestartBGM = TRUE; + + sBGMusicPlayerstate = BG_PLAYER_STATE_STOPPED; } } } + m4aMPlayStop(&gMPlayInfo_BGM); m4aSoundVSyncOff(); - if(interrupt_flag) - { + + if (interrupt_flag) EnableInterrupts(); - } } void StartBGMusicVSync(void) { bool8 interrupt_flag = DisableInterrupts(); + m4aSoundVSyncOn(); - if(gFanfareMusicPlayerState == 0) - { - if(gCurrentBGSong != STOP_BGM) - { - if(gBGMusicPlayerState == BG_PLAYER_STATE_STOPPED) - { - gBGMusicPlayerState = BG_PLAYER_STATE_PLAYING; - if(gRestartBGM) - { - m4aSongNumStart(gCurrentBGSong); - } + + if (sFanfareMusicPlayerState == 0) { + if (sCurrentBGSong != STOP_BGM) { + if (sBGMusicPlayerstate == BG_PLAYER_STATE_STOPPED) { + sBGMusicPlayerstate = BG_PLAYER_STATE_PLAYING; + + if (sRestartBGM) + m4aSongNumStart(sCurrentBGSong); else - { m4aMPlayContinue(&gMPlayInfo_BGM); - } } } } - if(interrupt_flag) - { + + if (interrupt_flag) EnableInterrupts(); - } - } -void nullsub_179(void) +UNUSED static void nullsub_179(void) { } -// Unused -bool8 IsValidSong(u32 songIndex) +UNUSED static bool8 IsValidSong(u32 songIndex) { - if(IsBGSong(songIndex)) - { - if(GetMusicPlayerIndex(songIndex) == INDEX_BGM) - { + if (IsBGSong(songIndex)) { + if (GetMusicPlayerIndex(songIndex) == INDEX_BGM) return TRUE; - } } - if(IsFanfare(songIndex)) - { - if(GetMusicPlayerIndex(songIndex) == INDEX_FANFARE) - { + + if (IsFanfare(songIndex)) { + if (GetMusicPlayerIndex(songIndex) == INDEX_FANFARE) return TRUE; - } } - else if(IsSoundEffect(songIndex)) - { - if(GetMusicPlayerIndex(songIndex) >= INDEX_SE1) - { + else if (IsSoundEffect(songIndex)) { + if (GetMusicPlayerIndex(songIndex) >= INDEX_SE1) return TRUE; - } } + return FALSE; } -void nullsub_19(void) +static void nullsub_19(void) { } -bool8 IsBGSong(u32 songIndex) +static bool8 IsBGSong(u32 songIndex) { - if(songIndex <= NUM_BG_SONGS) - { + if (songIndex <= NUM_BG_SONGS) return TRUE; - } return FALSE; } -bool8 IsSoundEffect(u32 songIndex) +static bool8 IsSoundEffect(u32 songIndex) { - if(songIndex - SOUND_EFFECTS_START_INDEX <= NUM_SOUND_EFFECTS) - { + if (songIndex - SOUND_EFFECTS_START_INDEX <= NUM_SOUND_EFFECTS) return TRUE; - } return FALSE; } -bool8 IsFanfare(u32 songIndex) +static bool8 IsFanfare(u32 songIndex) { - if(songIndex - FANFARE_START_INDEX <= NUM_FANFARES) - { + if (songIndex - FANFARE_START_INDEX <= NUM_FANFARES) return TRUE; - } return FALSE; } -u16 GetMusicPlayerIndex(u16 songIndex) +static u16 GetMusicPlayerIndex(u16 songIndex) { return gSongTable[songIndex].ms; } -bool8 IsMusicPlayerPlaying(u16 playerIndex) +static bool8 IsMusicPlayerPlaying(u16 playerIndex) { // Had to cast this.. m4a_internal header has this as u32 - if((u16)gMPlayTable[playerIndex].info->status == 0) - { + if ((u16)gMPlayTable[playerIndex].info->status == 0) return FALSE; - } return TRUE; } -void nullsub_20(u16 songIndex) +static void nullsub_20(u16 songIndex) { } -void nullsub_21(u16 songIndex) +static void nullsub_21(u16 songIndex) { -} - +} \ No newline at end of file diff --git a/src/options_menu.c b/src/options_menu.c index fcf306914..08945235a 100644 --- a/src/options_menu.c +++ b/src/options_menu.c @@ -1,6 +1,7 @@ #include "global.h" #include "code_80118A4.h" #include "code_80130A8.h" +#include "code_8098BDC.h" #include "constants/colors.h" #include "constants/input.h" #include "game_options.h" @@ -14,31 +15,31 @@ struct unkStruct_203B25C // size: 0x11C u32 state; u32 chosenHintIndex; - struct GameOptions newOptions; + GameOptions newOptions; u32 menuAction; - struct MenuStruct menu; - struct MenuItem menuItems[8]; + MenuStruct menu; + MenuItem menuItems[8]; u16 unkAC[8]; - struct UnkTextStruct2 unkBC[4]; + UnkTextStruct2 unkBC[4]; }; struct unkStruct_203B260 { - struct GameOptions *optionsMenu; - struct MenuInputStructSub unk4; - struct MenuInputStruct input; + GameOptions *optionsMenu; + MenuInputStructSub unk4; + MenuInputStruct input; u32 unk44; - struct UnkTextStruct2 * unk48; - struct UnkTextStruct2 unk4C[4]; + UnkTextStruct2 * unk48; + UnkTextStruct2 unk4C[4]; }; struct unkStruct_203B260 *gUnknown_203B260; -extern struct GameOptions *gGameOptionsRef; +extern GameOptions *gGameOptionsRef; extern struct unkStruct_203B25C *gUnknown_203B25C; -extern const struct UnkTextStruct2 gUnknown_80DBFB0; -extern const struct UnkTextStruct2 gUnknown_80DBFCC; -extern const struct UnkTextStruct2 gUnknown_80DC020; -extern const struct UnkTextStruct2 gUnknown_80DC03C; +extern const UnkTextStruct2 gUnknown_80DBFB0; +extern const UnkTextStruct2 gUnknown_80DBFCC; +extern const UnkTextStruct2 gUnknown_80DC020; +extern const UnkTextStruct2 gUnknown_80DC03C; extern u8 gWindowBGTitle[]; extern u8 gUnknown_80DC064[]; @@ -65,7 +66,7 @@ extern void sub_801E0FC(); extern void HandleChangeSettingsMenu(); extern void sub_801DD84(); extern void sub_801DED0(); -extern bool8 sub_801E198(struct GameOptions *); +extern bool8 sub_801E198(GameOptions *); extern void CreateHintDisplayScreen(u32); extern void sub_801E3F0(u32); extern void CreateHintSelectionScreen(u32); @@ -78,7 +79,6 @@ extern void DestroyHintDisplayScreen(void); extern u32 sub_801E218(void); extern void sub_801E2C4(void); extern void SetWindowBGColor(void); -extern void sub_8099690(u32); enum { @@ -194,7 +194,7 @@ void sub_801DD84(void) break; } ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B25C->unkBC, 1, 1); + sub_800641C(gUnknown_203B25C->unkBC, TRUE, TRUE); } void sub_801DED0(void) @@ -367,7 +367,7 @@ void HandleChangeSettingsMenu(void) } } -bool8 sub_801E198(struct GameOptions *optionsMenu) +bool8 sub_801E198(GameOptions *optionsMenu) { gUnknown_203B260 = MemoryAlloc(sizeof(struct unkStruct_203B260), 8); gUnknown_203B260->optionsMenu = optionsMenu; @@ -378,7 +378,7 @@ bool8 sub_801E198(struct GameOptions *optionsMenu) gUnknown_203B260->unk4C[gUnknown_203B260->unk44] = gUnknown_80DC03C; sub_8012D08(gUnknown_203B260->unk48,1); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B260->unk4C,1,1); + sub_800641C(gUnknown_203B260->unk4C, TRUE, TRUE); sub_8013818(&gUnknown_203B260->input,1,1,gUnknown_203B260->unk44); nullsub_38(); CreateOptionsMenu(); @@ -443,7 +443,7 @@ void sub_801E2C4(void) { gUnknown_203B260->unk4C[gUnknown_203B260->unk44] = gUnknown_80DC020; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B260->unk4C, 1, 1); + sub_800641C(gUnknown_203B260->unk4C, TRUE, TRUE); MemoryFree(gUnknown_203B260); gUnknown_203B260 = NULL; } diff --git a/src/other_menus.c b/src/other_menus.c index 7c40c3ee1..3a212253a 100644 --- a/src/other_menus.c +++ b/src/other_menus.c @@ -1,9 +1,10 @@ #include "global.h" +#include "code_8009804.h" +#include "code_800C9CC.h" #include "constants/communication_error_codes.h" #include "input.h" #include "main_menu.h" -#include "item.h" -#include "team_inventory.h" +#include "items.h" #include "menu.h" #include "memory.h" #include "text1.h" @@ -21,27 +22,27 @@ struct unkStruct_203B35C u32 unk0; u32 linkStatus; u32 state; - struct SpriteOAM unkC; + SpriteOAM unkC; u32 unk14; u8 fill18[0x1C - 0x18]; - struct MenuStruct unk1C[4]; - struct UnkTextStruct2 unk15C[4]; + MenuStruct unk1C[4]; + UnkTextStruct2 unk15C[4]; struct unkStruct_8035D94 unk1BC[2]; - struct unkStruct_203B480 unk1CC; - struct unkStruct_203B480 unk1FC; - struct unkStruct_203B480 unk22C; - struct unkStruct_203B480 unk25C; - struct unkStruct_203B480 unk28C; - struct PokemonStruct unk2BC; - struct unkStruct_203B480 unk314; - struct PokemonStruct unk344; + unkStruct_203B480 unk1CC; + unkStruct_203B480 unk1FC; + unkStruct_203B480 unk22C; + unkStruct_203B480 unk25C; + unkStruct_203B480 unk28C; + PokemonStruct1 unk2BC; + unkStruct_203B480 unk314; + PokemonStruct1 unk344; u8 unk39C[0xB4]; u8 unk450[0xB4]; }; EWRAM_DATA_2 struct unkStruct_203B35C *gUnknown_203B35C = {0}; -const struct UnkTextStruct2 gUnknown_80E653C = { +const UnkTextStruct2 gUnknown_80E653C = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, @@ -49,7 +50,7 @@ const struct UnkTextStruct2 gUnknown_80E653C = { 0x00, 0x00, NULL }; -const struct UnkTextStruct2 gUnknown_80E6554 = { +const UnkTextStruct2 gUnknown_80E6554 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x08, @@ -61,7 +62,7 @@ const struct UnkTextStruct2 gUnknown_80E6554 = { const u8 sUnknown_80E65C4[]; const u8 sUnknown_80E65AC[]; const u8 sUnknown_80E658C[]; -const struct MenuItem gUnknown_80E656C[4] = { +const MenuItem gUnknown_80E656C[4] = { {sUnknown_80E65C4, 0x5}, {sUnknown_80E65AC, 0x5}, {sUnknown_80E658C, 0x5}, @@ -73,7 +74,7 @@ ALIGNED(4) const u8 sUnknown_80E65AC[] = _("{CENTER_ALIGN}Item transmitting!"); ALIGNED(4) const u8 sUnknown_80E65C4[] = _("{CENTER_ALIGN}{COLOR_1 RED}Caution!{END_COLOR_TEXT_1} "); const u8 sUnknown_80E65F8[]; -const struct MenuItem gUnknown_80E65D8[4] = { +const MenuItem gUnknown_80E65D8[4] = { {sUnknown_80E65C4, 0x5}, {sUnknown_80E65F8, 0x5}, {sUnknown_80E658C, 0x5}, @@ -83,7 +84,7 @@ const struct MenuItem gUnknown_80E65D8[4] = { ALIGNED(4) const u8 sUnknown_80E65F8[] = _("{CENTER_ALIGN}Thank-You Mail in transmission!"); const u8 sUnknown_80E663C[]; -const struct MenuItem gUnknown_80E661C[4] = { +const MenuItem gUnknown_80E661C[4] = { {sUnknown_80E65C4, 0x5}, {sUnknown_80E663C, 0x5}, {sUnknown_80E658C, 0x5}, @@ -92,7 +93,7 @@ const struct MenuItem gUnknown_80E661C[4] = { }; ALIGNED(4) const u8 sUnknown_80E663C[] = _("{CENTER_ALIGN}A-OK Mail in transmission!"); -const struct MenuItem gUnknown_80E665C[4] = { +const MenuItem gUnknown_80E665C[4] = { {sUnknown_80E65C4, 0x5}, {sUnknown_80E65F8, 0x5}, {sUnknown_80E658C, 0x5}, @@ -101,7 +102,7 @@ const struct MenuItem gUnknown_80E665C[4] = { }; const u8 sUnknown_80E669C[]; -const struct MenuItem gUnknown_80E667C[4] = { +const MenuItem gUnknown_80E667C[4] = { {sUnknown_80E65C4, 0x5}, {sUnknown_80E669C, 0x5}, {sUnknown_80E658C, 0x5}, @@ -110,7 +111,7 @@ const struct MenuItem gUnknown_80E667C[4] = { }; ALIGNED(4) const u8 sUnknown_80E669C[] = _("{CENTER_ALIGN}Wonder Mail in transmission!"); -const struct UnkTextStruct2 gUnknown_80E66BC = { +const UnkTextStruct2 gUnknown_80E66BC = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x08, @@ -122,7 +123,7 @@ const struct UnkTextStruct2 gUnknown_80E66BC = { const u8 sUnknown_80E6734[]; const u8 sUnknown_80E6710[]; const u8 sUnknown_80E66F4[]; -const struct MenuItem gUnknown_80E66D4[4] = { +const MenuItem gUnknown_80E66D4[4] = { {sUnknown_80E6734, 0x5}, {sUnknown_80E6710, 0x5}, {sUnknown_80E66F4, 0x5}, @@ -133,7 +134,7 @@ ALIGNED(4) const u8 sUnknown_80E66F4[] = _("{CENTER_ALIGN}Please press any butto ALIGNED(4) const u8 sUnknown_80E6710[] = _("{CENTER_ALIGN}Your adventure will be continued."); ALIGNED(4) const u8 sUnknown_80E6734[] = _("{CENTER_ALIGN}{COLOR_1 LIGHT_BLUE}Success!{END_COLOR_TEXT_1} "); -const struct UnkTextStruct2 gUnknown_80E6748 = { +const UnkTextStruct2 gUnknown_80E6748 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x08, @@ -145,7 +146,7 @@ const struct UnkTextStruct2 gUnknown_80E6748 = { const u8 sUnknown_80E6780[]; const u8 sUnknown_80E6794[]; const u8 sUnknown_80E67B4[]; -const struct MenuItem gUnknown_80E6760[4] = { +const MenuItem gUnknown_80E6760[4] = { {sUnknown_80E67B4, 0x5}, {sUnknown_80E6794, 0x5}, {sUnknown_80E6780, 0x5}, @@ -156,7 +157,7 @@ ALIGNED(4) const u8 sUnknown_80E6780[] = _("{CENTER_ALIGN}please try again."); ALIGNED(4) const u8 sUnknown_80E6794[] = _("{CENTER_ALIGN}Check the Game Link cable and"); ALIGNED(4) const u8 sUnknown_80E67B4[] = _("{CENTER_ALIGN}#C2Communication error!{END_COLOR_TEXT_1} "); -const struct UnkTextStruct2 gUnknown_80E67D4 = { +const UnkTextStruct2 gUnknown_80E67D4 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x08, @@ -166,7 +167,7 @@ const struct UnkTextStruct2 gUnknown_80E67D4 = { }; const u8 sUnknown_80E680C[]; -const struct MenuItem gUnknown_80E67EC[4] = { +const MenuItem gUnknown_80E67EC[4] = { {sUnknown_80E67B4, 0x5}, {sUnknown_80E680C, 0x5}, {sUnknown_80E6780, 0x5}, @@ -174,7 +175,7 @@ const struct MenuItem gUnknown_80E67EC[4] = { }; ALIGNED(4) const u8 sUnknown_80E680C[] = _("{CENTER_ALIGN}Check your communication mode and"); -const struct UnkTextStruct2 gUnknown_80E6830 = { +const UnkTextStruct2 gUnknown_80E6830 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x08, @@ -185,7 +186,7 @@ const struct UnkTextStruct2 gUnknown_80E6830 = { const u8 sUnknown_80E6888[]; const u8 sUnknown_80E6868[]; -const struct MenuItem gUnknown_80E6848[4] = { +const MenuItem gUnknown_80E6848[4] = { {sUnknown_80E67B4, 0x5}, {sUnknown_80E6888, 0x5}, {sUnknown_80E6868, 0x5}, @@ -194,7 +195,7 @@ const struct MenuItem gUnknown_80E6848[4] = { ALIGNED(4) const u8 sUnknown_80E6868[] = _("{CENTER_ALIGN}Please inform the programmer."); ALIGNED(4) const u8 sUnknown_80E6888[] = _("{CENTER_ALIGN}Check sum error."); -const struct UnkTextStruct2 gUnknown_80E689C = { +const UnkTextStruct2 gUnknown_80E689C = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x08, @@ -206,7 +207,7 @@ const struct UnkTextStruct2 gUnknown_80E689C = { const u8 sUnknown_80E6928[]; const u8 sUnknown_80E68FC[]; const u8 sUnknown_80E68D4[]; -const struct MenuItem gUnknown_80E68B4[4] = { +const MenuItem gUnknown_80E68B4[4] = { {sUnknown_80E6928, 0x5}, {sUnknown_80E68FC, 0x5}, {sUnknown_80E68D4, 0x5}, @@ -216,7 +217,7 @@ ALIGNED(4) const u8 sUnknown_80E68D4[] = _("{CENTER_ALIGN}someone{APOSTROPHE}s s ALIGNED(4) const u8 sUnknown_80E68FC[] = _("{CENTER_ALIGN}An item could not be transferred because"); ALIGNED(4) const u8 sUnknown_80E6928[] = _("{CENTER_ALIGN}#C2Error!{END_COLOR_TEXT_1} "); -const struct UnkTextStruct2 gUnknown_80E6938 = { +const UnkTextStruct2 gUnknown_80E6938 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x08, @@ -227,7 +228,7 @@ const struct UnkTextStruct2 gUnknown_80E6938 = { const u8 sUnknown_80E6988[]; const u8 sUnknown_80E6970[]; -const struct MenuItem gUnknown_80E6950[4] = { +const MenuItem gUnknown_80E6950[4] = { {sUnknown_80E6928, 0x5}, {sUnknown_80E6988, 0x5}, {sUnknown_80E6970, 0x5}, @@ -236,7 +237,7 @@ const struct MenuItem gUnknown_80E6950[4] = { ALIGNED(4) const u8 sUnknown_80E6970[] = _("{CENTER_ALIGN}Please check again."); ALIGNED(4) const u8 sUnknown_80E6988[] = _("{CENTER_ALIGN}This {COLOR_1 LIGHT_BLUE}SOS Mail{END_COLOR_TEXT_1} can{APOSTROPHE}t be used."); -const struct UnkTextStruct2 gUnknown_80E69B0 = { +const UnkTextStruct2 gUnknown_80E69B0 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x08, @@ -246,7 +247,7 @@ const struct UnkTextStruct2 gUnknown_80E69B0 = { }; const u8 sUnknown_80E69E8[]; -const struct MenuItem gUnknown_80E69C8[4] = { +const MenuItem gUnknown_80E69C8[4] = { {sUnknown_80E6928, 0x5}, {sUnknown_80E69E8, 0x5}, {sUnknown_80E6970, 0x5}, @@ -254,7 +255,7 @@ const struct MenuItem gUnknown_80E69C8[4] = { }; ALIGNED(4) const u8 sUnknown_80E69E8[] = _("{CENTER_ALIGN}This {COLOR_1 LIGHT_BLUE}A-OK Mail{END_COLOR_TEXT_1} can{APOSTROPHE}t be used."); -const struct UnkTextStruct2 gUnknown_80E6A10 = { +const UnkTextStruct2 gUnknown_80E6A10 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x08, @@ -264,7 +265,7 @@ const struct UnkTextStruct2 gUnknown_80E6A10 = { }; const u8 sUnknown_80E6A48[]; -const struct MenuItem gUnknown_80E6A28[4] = { +const MenuItem gUnknown_80E6A28[4] = { {sUnknown_80E6928, 0x5}, {sUnknown_80E6A48, 0x5}, {sUnknown_80E6970, 0x5}, @@ -272,7 +273,7 @@ const struct MenuItem gUnknown_80E6A28[4] = { }; ALIGNED(4) const u8 sUnknown_80E6A48[] = _("{CENTER_ALIGN}This {COLOR_1 LIGHT_BLUE}Thank-You Mail{END_COLOR_TEXT_1} can{APOSTROPHE}t be used."); -const struct UnkTextStruct2 gUnknown_80E6A74 = { +const UnkTextStruct2 gUnknown_80E6A74 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x08, @@ -283,7 +284,7 @@ const struct UnkTextStruct2 gUnknown_80E6A74 = { const u8 sUnknown_80E6AC8[]; const u8 sUnknown_80E6AAC[]; -const struct MenuItem gUnknown_80E6A8C[4] = { +const MenuItem gUnknown_80E6A8C[4] = { {sUnknown_80E6928, 0x5}, {sUnknown_80E6AC8, 0x5}, {sUnknown_80E6AAC, 0x5}, @@ -292,7 +293,7 @@ const struct MenuItem gUnknown_80E6A8C[4] = { ALIGNED(4) const u8 sUnknown_80E6AAC[] = _("{CENTER_ALIGN}It can{APOSTROPHE}t be received."); ALIGNED(4) const u8 sUnknown_80E6AC8[] = _("{CENTER_ALIGN}There is no space for new mail."); -const struct UnkTextStruct2 gUnknown_80E6AEC = { +const UnkTextStruct2 gUnknown_80E6AEC = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x08, @@ -303,7 +304,7 @@ const struct UnkTextStruct2 gUnknown_80E6AEC = { const u8 sUnknown_80E6B4C[]; const u8 sUnknown_80E6B24[]; -const struct MenuItem gUnknown_80E6B04[4] = { +const MenuItem gUnknown_80E6B04[4] = { {sUnknown_80E6928, 0x5}, {sUnknown_80E6B4C, 0x5}, {sUnknown_80E6B24, 0x5}, @@ -312,7 +313,7 @@ const struct MenuItem gUnknown_80E6B04[4] = { ALIGNED(4) const u8 sUnknown_80E6B24[] = _("{CENTER_ALIGN}You need to go further in the story."); ALIGNED(4) const u8 sUnknown_80E6B4C[] = _("{CENTER_ALIGN}You may not go to that {COLOR_1 LIGHT_BLUE}dungeon{END_COLOR_TEXT_1} yet."); -const struct UnkTextStruct2 gUnknown_80E6B78 = { +const UnkTextStruct2 gUnknown_80E6B78 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x08, @@ -323,7 +324,7 @@ const struct UnkTextStruct2 gUnknown_80E6B78 = { const u8 sUnknown_80E6BC4[]; const u8 sUnknown_80E6BB0[]; -const struct MenuItem gUnknown_80E6B90[4] = { +const MenuItem gUnknown_80E6B90[4] = { {sUnknown_80E6928, 0x5}, {sUnknown_80E6BC4, 0x5}, {sUnknown_80E6BB0, 0x5}, @@ -332,7 +333,7 @@ const struct MenuItem gUnknown_80E6B90[4] = { ALIGNED(4) const u8 sUnknown_80E6BB0[] = _("{CENTER_ALIGN}Please try again."); ALIGNED(4) const u8 sUnknown_80E6BC4[] = _("{CENTER_ALIGN}There was a problem on your friend{APOSTROPHE}s end."); -const struct UnkTextStruct2 gUnknown_80E6BF4 = { +const UnkTextStruct2 gUnknown_80E6BF4 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x08, @@ -342,7 +343,7 @@ const struct UnkTextStruct2 gUnknown_80E6BF4 = { }; const u8 sUnknown_80E6C2C[]; -const struct MenuItem gUnknown_80E6C0C[4] = { +const MenuItem gUnknown_80E6C0C[4] = { {sUnknown_80E6928, 0x5}, {sUnknown_80E6C2C, 0x5}, {sUnknown_80E6BB0, 0x5}, @@ -350,7 +351,7 @@ const struct MenuItem gUnknown_80E6C0C[4] = { }; ALIGNED(4) const u8 sUnknown_80E6C2C[] = _("{CENTER_ALIGN}Your friend is not responding."); -const struct UnkTextStruct2 gUnknown_80E6C50 = { +const UnkTextStruct2 gUnknown_80E6C50 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x08, @@ -361,7 +362,7 @@ const struct UnkTextStruct2 gUnknown_80E6C50 = { const u8 sUnknown_80E6CA8[]; const u8 sUnknown_80E6C88[]; -const struct MenuItem gUnknown_80E6C68[4] = { +const MenuItem gUnknown_80E6C68[4] = { {sUnknown_80E6734, 0x5}, {sUnknown_80E6CA8, 0x5}, {sUnknown_80E6C88, 0x5}, @@ -371,7 +372,7 @@ ALIGNED(4) const u8 sUnknown_80E6C88[] = _("{CENTER_ALIGN}went through successfu ALIGNED(4) const u8 sUnknown_80E6CA8[] = _("{CENTER_ALIGN}The item exchange with your friend"); -const struct UnkTextStruct2 gUnknown_80E6CD0 = { +const UnkTextStruct2 gUnknown_80E6CD0 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x08, @@ -382,7 +383,7 @@ const struct UnkTextStruct2 gUnknown_80E6CD0 = { const u8 sUnknown_80E6D2C[]; const u8 sUnknown_80E6D08[]; -const struct MenuItem gUnknown_80E6CE8[4] = { +const MenuItem gUnknown_80E6CE8[4] = { {sUnknown_80E65C4, 0x5}, {sUnknown_80E6D2C, 0x5}, {sUnknown_80E6D08, 0x5}, @@ -391,7 +392,7 @@ const struct MenuItem gUnknown_80E6CE8[4] = { ALIGNED(4) const u8 sUnknown_80E6D08[] = _("{CENTER_ALIGN}you and your friend are ready."); ALIGNED(4) const u8 sUnknown_80E6D2C[] = _("{CENTER_ALIGN}Please communicate only after both"); -const struct UnkTextStruct2 gUnknown_80E6D54 = { +const UnkTextStruct2 gUnknown_80E6D54 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x08, @@ -402,7 +403,7 @@ const struct UnkTextStruct2 gUnknown_80E6D54 = { const u8 sUnknown_80E6DB0[]; const u8 sUnknown_80E6D8C[]; -const struct MenuItem gUnknown_80E6D6C[4] = { +const MenuItem gUnknown_80E6D6C[4] = { {sUnknown_80E6928, 0x5}, {sUnknown_80E6DB0, 0x5}, {sUnknown_80E6D8C, 0x5}, @@ -411,7 +412,7 @@ const struct MenuItem gUnknown_80E6D6C[4] = { ALIGNED(4) const u8 sUnknown_80E6D8C[] = _("{CENTER_ALIGN}connected. Please check again."); ALIGNED(4) const u8 sUnknown_80E6DB0[] = _("{CENTER_ALIGN}An incorrect number of GBA systems are"); -const struct UnkTextStruct2 gUnknown_80E6DDC = { +const UnkTextStruct2 gUnknown_80E6DDC = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x08, @@ -422,7 +423,7 @@ const struct UnkTextStruct2 gUnknown_80E6DDC = { const u8 sUnknown_80E6E30[]; const u8 sUnknown_80E6E14[]; -const struct MenuItem gUnknown_80E6DF4[4] = { +const MenuItem gUnknown_80E6DF4[4] = { {sUnknown_80E6928, 0x5}, {sUnknown_80E6E30, 0x5}, {sUnknown_80E6E14, 0x5}, @@ -446,11 +447,8 @@ extern void sub_8037748(void); extern void sub_80371B8(void); extern void sub_8037900(void); extern u32 sub_8037798(void); -extern void sub_8005838(u32, u32); -extern void sub_800CB20(); extern void TransferBGPaletteBuffer(); extern void xxx_call_update_bg_vram(); -extern void sub_8009908(); extern void xxx_call_update_bg_sound_input(); extern s32 sub_8037D64(u32 mode, void *, void *); extern s32 sub_80381F4(u32 mode, void *, void *); @@ -466,7 +464,7 @@ void sub_8036FDC(s32 param_1) int index2; ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); ResetSprites(FALSE); if (gUnknown_203B35C == NULL) { gUnknown_203B35C = MemoryAlloc(sizeof(struct unkStruct_203B35C),8); @@ -485,7 +483,7 @@ void sub_8036FDC(s32 param_1) gUnknown_203B35C->unk15C[index2] = gUnknown_80E653C; } ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B35C->unk15C,1,1); + sub_800641C(gUnknown_203B35C->unk15C, TRUE, TRUE); SetMenuItems(gUnknown_203B35C->unk1C,gUnknown_203B35C->unk15C,0,&gUnknown_80E6CD0,gUnknown_80E6CE8,0,6,0); sub_8035CF4(gUnknown_203B35C->unk1C,0,TRUE); sub_80376CC(); @@ -549,8 +547,8 @@ u32 sub_80370F0(void) void sub_80371B8(void) { struct unkStruct_8035D94 *item; - const struct MenuItem *MenuItems; - const struct UnkTextStruct2 *puVar5; + const MenuItem *MenuItems; + const UnkTextStruct2 *puVar5; puVar5 = NULL; MenuItems = NULL; @@ -633,19 +631,18 @@ void sub_80371B8(void) void sub_80373C4(void) { - sub_8005838(0,0); - sub_80060EC(); - sub_800CB20(); - LoadBufferedInputs(); - TransferBGPaletteBuffer(); - xxx_call_update_bg_vram(); - sub_8009908(); - xxx_call_update_bg_sound_input(); - ResetSprites(FALSE); + sub_8005838(NULL, 0); + sub_80060EC(); + sub_800CB20(); + LoadBufferedInputs(); + TransferBGPaletteBuffer(); + xxx_call_update_bg_vram(); + sub_8009908(); + xxx_call_update_bg_sound_input(); + ResetSprites(FALSE); } -// Unused -struct unkStruct_203B35C *sub_80373F4(void) +UNUSED static struct unkStruct_203B35C *sub_80373F4(void) { return gUnknown_203B35C; } diff --git a/src/other_menus_1.c b/src/other_menus_1.c index aa1041d54..e5db8299c 100644 --- a/src/other_menus_1.c +++ b/src/other_menus_1.c @@ -5,7 +5,7 @@ #include "pokemon.h" #include "code_8094F88.h" #include "save.h" -#include "team_inventory.h" + #include "main_menu.h" #include "memory.h" @@ -69,11 +69,11 @@ void sub_8037C44(s32 mode, void *data) case 3: case 6: case 7: - sub_800D59C(data, sizeof(struct unkStruct_203B480)); + sub_800D59C(data, sizeof(unkStruct_203B480)); break; case 4: case 5: - sub_800D59C(data, sizeof(struct WonderMailStruct_203B2C0_sub)); + sub_800D59C(data, sizeof(WonderMailStruct_203B2C0_sub)); break; case 9: case 10: @@ -95,13 +95,13 @@ void sub_8037CC4(s32 mode, void *param_2, void *param_3) case 3: case 6: case 7: - sub_800D670(0, param_2, sizeof(struct unkStruct_203B480)); - sub_800D670(1, param_3, sizeof(struct unkStruct_203B480)); + sub_800D670(0, param_2, sizeof(unkStruct_203B480)); + sub_800D670(1, param_3, sizeof(unkStruct_203B480)); break; case 4: case 5: - sub_800D670(0, param_2, sizeof(struct WonderMailStruct_203B2C0_sub)); - sub_800D670(1, param_3, sizeof(struct WonderMailStruct_203B2C0_sub)); + sub_800D670(0, param_2, sizeof(WonderMailStruct_203B2C0_sub)); + sub_800D670(1, param_3, sizeof(WonderMailStruct_203B2C0_sub)); break; case 9: case 10: @@ -196,7 +196,7 @@ void sub_8037E38(struct unkStruct_8035D94 *param_1,struct unkStruct_8035D94 *par } } -void sub_8037E90(struct unkStruct_203B480 *param_1, struct unkStruct_203B480 *param_2) +void sub_8037E90(unkStruct_203B480 *param_1, unkStruct_203B480 *param_2) { if(sub_800D588() == 0) { @@ -210,9 +210,9 @@ void sub_8037E90(struct unkStruct_203B480 *param_1, struct unkStruct_203B480 *pa void nullsub_53(void *param_1, void *param_2) {} -void sub_8037EBC(struct WonderMailStruct_203B2C0_sub *param_1, struct WonderMailStruct_203B2C0_sub *param_2) { - struct unkStruct_203B480 *mail; - struct WonderMailStruct_203B2C0_sub *puVar2; +void sub_8037EBC(WonderMailStruct_203B2C0_sub *param_1, WonderMailStruct_203B2C0_sub *param_2) { + unkStruct_203B480 *mail; + WonderMailStruct_203B2C0_sub *puVar2; if(sub_800D588() == 0) { @@ -237,14 +237,14 @@ void sub_8037EBC(struct WonderMailStruct_203B2C0_sub *param_1, struct WonderMai } else { - MemoryFill8((u8 *)gUnknown_203B484, 0, sizeof(struct unkStruct_203B484)); + MemoryFill8((u8 *)gUnknown_203B484, 0, sizeof(unkStruct_203B484)); gUnknown_203B484->unk4.speciesNum = MONSTER_NONE; } } -void sub_8037F4C(struct unkStruct_203B480 *param_1, struct unkStruct_203B480 *param_2) +void sub_8037F4C(unkStruct_203B480 *param_1, unkStruct_203B480 *param_2) { - struct unkStruct_203B480 *mail; + unkStruct_203B480 *mail; struct MainMenu *mainMenu; if(sub_800D588() == 0) @@ -316,7 +316,7 @@ s32 sub_8038014(struct unkStruct_8035D94 *param_1,struct unkStruct_8035D94 *para return linkStatus; } -s32 sub_8038078(struct unkStruct_203B480 *param_1,struct unkStruct_203B480 *param_2) +s32 sub_8038078(unkStruct_203B480 *param_1,unkStruct_203B480 *param_2) { u32 uVar2; u32 uVar3; @@ -339,10 +339,10 @@ s32 sub_8038078(struct unkStruct_203B480 *param_1,struct unkStruct_203B480 *para } } -s32 sub_80380C4(struct unkStruct_203B480 *param_1,struct unkStruct_203B480 *param_2) +s32 sub_80380C4(unkStruct_203B480 *param_1,unkStruct_203B480 *param_2) { u32 uVar2; - struct unkStruct_203B480 *mail; + unkStruct_203B480 *mail; if (sub_800D588() == 0) { mail = param_1; @@ -369,7 +369,7 @@ s32 sub_80380C4(struct unkStruct_203B480 *param_1,struct unkStruct_203B480 *para } } -s32 sub_803812C(struct unkStruct_203B480 *param_1, struct unkStruct_203B480 *param_2) +s32 sub_803812C(unkStruct_203B480 *param_1, unkStruct_203B480 *param_2) { if (sub_800D588() == 0) { param_2 = param_1; diff --git a/src/party_list_menu.c b/src/party_list_menu.c index 003c3d9b1..1ae7d237d 100644 --- a/src/party_list_menu.c +++ b/src/party_list_menu.c @@ -1,204 +1,87 @@ #include "global.h" -#include "constants/dungeon.h" -#include "item.h" -#include "memory.h" -#include "pokemon.h" -#include "text1.h" -#include "text2.h" -#include "text_util.h" -#include "team_inventory.h" -#include "constants/move.h" #include "code_800D090.h" -#include "menu_input.h" -#include "moves.h" -#include "kecleon_bros.h" +#include "code_80118A4.h" #include "code_80130A8.h" #include "code_801B3C0.h" -#include "code_80118A4.h" +#include "code_801C620.h" +#include "code_801EE10.h" +#include "code_801EE10_1.h" +#include "code_801EE10_mid.h" +#include "code_8098BDC.h" +#include "constants/dungeon.h" #include "event_flag.h" +#include "items.h" +#include "kecleon_bros4.h" +#include "memory.h" +#include "menu_input.h" +#include "moves.h" +#include "pokemon.h" +#include "text_util.h" +#include "text1.h" +#include "text2.h" -struct unkStruct_203B2B8 +// size: 0x280 +typedef struct unkStruct_203B2B8 { - // size: 0x280 s32 state; s32 fallbackState; bool8 unk8; /* 0xA */ s16 pokeSpecies; u32 id; - /* 0x10 */ struct BulkItem item1; - /* 0x14 */ struct BulkItem item2; - struct PokemonStruct *pokeStruct; + /* 0x10 */ BulkItem item1; + /* 0x14 */ BulkItem item2; + PokemonStruct1 *pokeStruct; bool8 isTeamLeader; u32 moveIndex; /* 0x24 */ u16 moveID; - struct Move moves[8]; - u16 moveIDs[4]; // some list of move IDs + Move moves[8]; + u16 moveIDs[4]; // some list of move IDs u32 menuAction1; u32 menuAction2; u32 menuAction3; // unused - struct MenuStruct unk7C; - struct MenuStruct unkCC; - struct MenuStruct unk11C; // unused - struct MenuItem unk16C[10]; - struct MenuItem unk1BC[10]; + MenuStruct unk7C; + MenuStruct unkCC; + MenuStruct unk11C; // unused + MenuItem unk16C[10]; + MenuItem unk1BC[10]; u16 unk20C[10]; - struct UnkTextStruct2 unk220[4]; -}; -EWRAM_DATA_2 struct unkStruct_203B2B8 *gUnknown_203B2B8 = {0}; + UnkTextStruct2 unk220[4]; +} unkStruct_203B2B8; -const struct UnkTextStruct2 gUnknown_80DD310 = { - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x00, 0x00, - 0x00, 0x00, - 0x00, 0x00, - NULL -}; - -const struct UnkTextStruct2 gUnknown_80DD328 = { - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x13, 0x03, - 0x08, 0x03, - 0x03, 0x00, - NULL -}; - -const struct UnkTextStruct2 gUnknown_80DD340 = { - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x14, 0x04, - 0x06, 0x03, - 0x03, 0x00, - NULL -}; - -const struct UnkTextStruct2 gUnknown_80DD358 = { - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x02, 0x11, - 0x1A, 0x02, - 0x02, 0x00, - NULL -}; - -const struct UnkTextStruct2 gUnknown_80DD370 = { - 0x00, 0x00, 0x00, 0x00, - 0x03, - 0x02, 0x03, - 0x0F, 0x02, - 0x02, 0x00, - NULL -}; - -extern u8 gAvailablePokemonNames[0x58]; -extern u8 gUnknown_202DEA8[0x58]; extern u8 gUnknown_202DE58[0x58]; +extern u8 gUnknown_202DEA8[0x58]; +extern u8 gAvailablePokemonNames[0x58]; // 202DF98 -extern u8 *gUnknown_80D4920[]; -extern u8 *gUnknown_80D4928[]; -extern u8 *gUnknown_80D4970[]; -extern u8 *gUnknown_80D4970[]; +EWRAM_DATA_2 unkStruct_203B2B8 *gUnknown_203B2B8 = {0}; -ALIGNED(4) const u8 gUnknown_80DD388[] = _( - "You have chosen to say farewell\n" - "to this Pokémon.{EXTRA_MSG}" - "The Pokémon will leave its Friend Area.\n" - "It will no longer be available for\n" - "adventures. Is that OK?"); +// data_80D47B8.s +extern const u8 *gUnknown_80D4920[]; +extern const u8 *gUnknown_80D4928[]; +extern const u8 *gUnknown_80D4970[]; -ALIGNED(4) const u8 gUnknown_80DD420[] = _( - "If you say farewell to this\n" - "Pokémon{COMMA} it will be gone forever.{EXTRA_MSG}" - "You will never be able to get another one\n" - "like it to join your team.\n" - "Will you release it anyway?"); +#include "data/party_list_menu.h" -ALIGNED(4) const u8 gUnknown_80DD4C4[] = _( - "{CENTER_ALIGN}{ARG_POKEMON_1} joined the\n" - "{CENTER_ALIGN}rescue team for adventures!"); - -ALIGNED(4) const u8 gUnknown_80DD4F4[] = _( - "{CENTER_ALIGN}{ARG_POKEMON_1} left the team to remain\n" - "{CENTER_ALIGN}on standby in the Friend Area."); - -ALIGNED(4) const u8 gBecameLeader[] = _( - "{CENTER_ALIGN}{ARG_POKEMON_1} became the leader\n" - "{CENTER_ALIGN}of the rescue team."); - -ALIGNED(4) const u8 gUnknown_80DD564[] = _( - "{CENTER_ALIGN}{ARG_POKEMON_1} left\n" - "{CENTER_ALIGN}the Friend Area.\n" - "{CENTER_ALIGN}Bye-bye{COMMA} {ARG_POKEMON_1}!"); - -ALIGNED(4) const u8 gUnknown_80DD594[] = _( - "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_1}{END_COLOR_TEXT_1} was\n" - "{CENTER_ALIGN}handed over. "); - -ALIGNED(4) const u8 gUnknown_80DD5B8[] = _( - "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_1}{END_COLOR_TEXT_1} was\n" - "{CENTER_ALIGN}handed over.{EXTRA_MSG}" - "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1} was\n" - "{CENTER_ALIGN}returned to the Toolbox."); - -ALIGNED(4) const u8 gUnknown_80DD60C[] = _( - "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1} was\n" - "{CENTER_ALIGN}returned to the Toolbox."); - -ALIGNED(4) const u8 gUnknown_80DD63C[] = _( - "{CENTER_ALIGN}The {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1} was\n" - "{CENTER_ALIGN}sent to storage."); - -ALIGNED(4) const u8 gPartyMenuStandBy[] = "Stand By"; -ALIGNED(4) const u8 gPartyMenuMakeLeader[] = "Make Leader"; -ALIGNED(4) const u8 gPartyMenuJoinTeam[] = "Join Team"; -ALIGNED(4) const u8 gPartyMenuGiveGummi[] = "Give Gummi"; -ALIGNED(4) const u8 gPartyMenuGive[] = "Give"; -ALIGNED(4) const u8 gPartyMenuTake[] = "Take"; -ALIGNED(4) const u8 gPartyMenuSayFarewell[] = "Say Farewell"; -ALIGNED(4) const u8 gPartyMenuSummary[] = "Summary"; -ALIGNED(4) const u8 gPartyMenuMoves[] = "Moves"; -ALIGNED(4) const u8 gPartyMenuCheckIQ[] = "Check IQ"; -ALIGNED(4) const u8 gPartyMenuItemPlaceholder[] = _("Item: {COLOR_1 GREEN}{ARG_MOVE_ITEM_0}{END_COLOR_TEXT_1} "); -ALIGNED(4) const u8 gUnknown_80DD6E0[] = "%s"; -ALIGNED(4) static const u8 fill0[] = "pksdir0"; - -extern u32 sub_8026F04(struct PokemonStruct *); +extern u32 sub_8026F04(PokemonStruct1 *); extern void sub_8026074(s32); -bool8 CanTakePokemonHeldItem(struct PokemonStruct *r0); -extern struct PokemonStruct *sub_808D3F8(void); -extern struct PokemonStruct *sub_808D3BC(void); -extern void sub_801F214(void); -extern u32 sub_801F194(void); -extern u32 sub_801EF38(u32); +bool8 CanTakePokemonHeldItem(PokemonStruct1 *r0); +extern PokemonStruct1 *sub_808D3F8(void); +extern PokemonStruct1 *sub_808D3BC(void); extern s32 sub_8008ED0(u8 *); -extern u32 sub_801F890(void); -extern void sub_801F8D0(void); extern void nullsub_104(void); -extern void sub_8099690(u32); extern u32 sub_8022860(void); extern void sub_8022908(void); -extern void sub_801BF98(void); -extern u32 sub_801BF48(void); -extern void sub_802453C(void); extern u32 sub_80244E4(void); extern bool8 sub_808D750(s16 index_); extern void sub_808ED00(void); -extern struct PokemonStruct *GetPlayerPokemonStruct(void); -bool8 sub_8026E88(struct PokemonStruct *r0); +bool8 sub_8026E88(PokemonStruct1 *r0); bool8 HasGummiItem(); -bool8 sub_8026EB8(struct PokemonStruct *r0); -extern void sub_8024458(s16, u32); +bool8 sub_8026EB8(PokemonStruct1 *r0); void sub_8026E08(u32 r0); -void sub_8026DAC(u32 r0, struct BulkItem *item); -bool8 sub_801BEEC(s16 species); +void sub_8026DAC(u32 r0, BulkItem *item); void sub_8026FA4(void); void sub_8026878(void); -extern void sub_801F808(u16*); -extern void sub_80227B8(struct PokemonStruct *); -extern void sub_801EE10(u32, s16, struct Move *, u32, u32, u32); -extern void sub_801F1B0(u32, u32); -extern void sub_808D31C(struct PokemonStruct *); +extern void sub_80227B8(PokemonStruct1 *); +extern void sub_808D31C(PokemonStruct1 *); void sub_802678C(void); void sub_80264CC(void); @@ -218,33 +101,31 @@ void sub_8026D0C(void); void sub_8026D6C(void); void sub_8026D88(void); -u32 sub_8025EF4(struct PokemonStruct *pokeStruct) +u32 sub_8025EF4(PokemonStruct1 *pokeStruct) { - s32 index; - gUnknown_203B2B8 = MemoryAlloc(sizeof(struct unkStruct_203B2B8), 0x8); + s32 i; + + gUnknown_203B2B8 = MemoryAlloc(sizeof(unkStruct_203B2B8), 8); gUnknown_203B2B8->pokeStruct = pokeStruct; - for(index = 0; index < NUM_MONSTERS; index++) - { - if(gUnknown_203B2B8->pokeStruct == &gRecruitedPokemonRef->pokemon[(s16)index]) - { - gUnknown_203B2B8->pokeSpecies = index; + for (i = 0; i < NUM_MONSTERS; i++) { + if (gUnknown_203B2B8->pokeStruct == &gRecruitedPokemonRef->pokemon[(s16)i]) { + gUnknown_203B2B8->pokeSpecies = i; break; } } - + gUnknown_203B2B8->menuAction1 = 0; gUnknown_203B2B8->menuAction2 = 0; gUnknown_203B2B8->menuAction3 = 0; gUnknown_203B2B8->unk8 = FALSE; sub_8026074(0); - return 1; + return TRUE; } u32 sub_8025F68(void) { - switch(gUnknown_203B2B8->state) - { + switch (gUnknown_203B2B8->state) { case 0: sub_8026074(1); break; @@ -324,34 +205,34 @@ void sub_802608C(void) case 2: for(index = 0; index < 4; index++) { - gUnknown_203B2B8->unk220[index] = gUnknown_80DD310; + gUnknown_203B2B8->unk220[index] = sUnknown_80DD310; } - gUnknown_203B2B8->unk220[0] = gUnknown_80DD358; - gUnknown_203B2B8->unk220[3] = gUnknown_80DD370; + gUnknown_203B2B8->unk220[0] = sUnknown_80DD358; + gUnknown_203B2B8->unk220[3] = sUnknown_80DD370; sub_80264CC(); - gUnknown_203B2B8->unk220[2] = gUnknown_80DD328; + gUnknown_203B2B8->unk220[2] = sUnknown_80DD328; sub_8012CAC(&gUnknown_203B2B8->unk220[2], gUnknown_203B2B8->unk16C); gUnknown_203B2B8->unk220[2].unkC = 9; break; case 0x14: sub_802678C(); - gUnknown_203B2B8->unk220[2] = gUnknown_80DD340; + gUnknown_203B2B8->unk220[2] = sUnknown_80DD340; sub_8012CAC(&gUnknown_203B2B8->unk220[2], gUnknown_203B2B8->unk16C); break; default: for(index = 0; index < 4; index++) { - gUnknown_203B2B8->unk220[index] = gUnknown_80DD310; + gUnknown_203B2B8->unk220[index] = sUnknown_80DD310; } break; } ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2B8->unk220, 1, 1); + sub_800641C(gUnknown_203B2B8->unk220, TRUE, TRUE); } void sub_80261D0(void) { - struct Item item; + Item item; switch(gUnknown_203B2B8->state) { case 1: @@ -378,10 +259,10 @@ void sub_80261D0(void) sub_80227B8(gUnknown_203B2B8->pokeStruct); break; case 0x12: - sub_801A5D8(1,0,0,10); + sub_801A5D8(1,0,NULL,10); break; case 0x13: - sub_801A8D0(1); + sub_801A8D0(TRUE); break; case 0x14: sub_801A9E0(); @@ -393,18 +274,18 @@ void sub_80261D0(void) break; case 0x16: unk_CopyMoves4To8(gUnknown_203B2B8->moves,gUnknown_203B2B8->pokeStruct->moves); - sub_801EE10(3,gUnknown_203B2B8->pokeSpecies,gUnknown_203B2B8->moves,0,0,0); + sub_801EE10(3,gUnknown_203B2B8->pokeSpecies,gUnknown_203B2B8->moves,0,NULL,0); break; case 0x17: - sub_801F1B0(1,0); + sub_801F1B0(TRUE, FALSE); break; case 0xc: sub_8026878(); - sub_8014248(gUnknown_80DD388,0,3,gUnknown_203B2B8->unk1BC,0,4,0,0,0x101); + sub_8014248(sUnknown_80DD388,0,3,gUnknown_203B2B8->unk1BC,0,4,0,0,0x101); break; case 0xd: sub_8026878(); - sub_8014248(gUnknown_80DD420,0,3,gUnknown_203B2B8->unk1BC,0,4,0,0,0x101); + sub_8014248(sUnknown_80DD420,0,3,gUnknown_203B2B8->unk1BC,0,4,0,0,0x101); break; case 0x18: GetLinkedSequence(gUnknown_203B2B8->moveIndex, gUnknown_203B2B8->moves,gUnknown_203B2B8->moveIDs); @@ -413,22 +294,22 @@ void sub_80261D0(void) case 5: gUnknown_203B2B8->fallbackState = 0x19; PlaySound(0xcf); - sub_80141B4(gUnknown_80DD4C4,0,0,0x101); + sub_80141B4(sUnknown_80DD4C4,0,0,0x101); break; case 6: gUnknown_203B2B8->fallbackState = 0x19; PlaySound(0xcf); - sub_80141B4(gUnknown_80DD4F4,0,0,0x101); + sub_80141B4(sUnknown_80DD4F4,0,0,0x101); break; case 7: gUnknown_203B2B8->fallbackState = 0x19; PlaySound(0xcc); - sub_80141B4(gBecameLeader,0,0,0x101); + sub_80141B4(sBecameLeader,0,0,0x101); break; case 8: gUnknown_203B2B8->fallbackState = 9; PlaySound(0xca); - sub_80141B4(gUnknown_80DD564,0,0,0x101); + sub_80141B4(sUnknown_80DD564,0,0,0x101); break; case 9: sub_8026FA4(); @@ -437,23 +318,23 @@ void sub_80261D0(void) break; case 0xf: gUnknown_203B2B8->fallbackState = 2; - sub_80141B4(gUnknown_80DD594,0,0,0x101); + sub_80141B4(sUnknown_80DD594,0,0,0x101); break; case 0x10: gUnknown_203B2B8->fallbackState = 2; - sub_80141B4(gUnknown_80DD5B8,0,0,0x101); + sub_80141B4(sUnknown_80DD5B8,0,0,0x101); break; case 0x11: gUnknown_203B2B8->fallbackState = 2; - sub_80141B4(gUnknown_80DD60C,0,0,0x101); + sub_80141B4(sUnknown_80DD60C,0,0,0x101); break; case 10: gUnknown_203B2B8->fallbackState = 0x19; - sub_80141B4(gUnknown_80DD60C,0,0,0x101); + sub_80141B4(sUnknown_80DD60C,0,0,0x101); break; case 0xb: gUnknown_203B2B8->fallbackState = 0x19; - sub_80141B4(gUnknown_80DD63C,0,0,0x101); + sub_80141B4(sUnknown_80DD63C,0,0,0x101); break; case 0: case 0x19: @@ -462,7 +343,7 @@ void sub_80261D0(void) } void sub_80264CC(void) { - struct PokemonStruct *pokeStruct; + PokemonStruct1 *pokeStruct; s32 index; s32 one; u16 temp; @@ -475,7 +356,7 @@ void sub_80264CC(void) { if(temp = pokeStruct->unk0 >> 1, one = 1, temp & one) { - gUnknown_203B2B8->unk16C[loopMax].text = gPartyMenuStandBy; + gUnknown_203B2B8->unk16C[loopMax].text = sPartyMenuStandBy; gUnknown_203B2B8->unk16C[loopMax].menuAction = 7; if(!sub_8026E88(pokeStruct)) { @@ -485,14 +366,14 @@ void sub_80264CC(void) { if(sub_80023E4(8) && !pokeStruct->isTeamLeader) { - gUnknown_203B2B8->unk16C[loopMax].text = gPartyMenuMakeLeader; + gUnknown_203B2B8->unk16C[loopMax].text = sPartyMenuMakeLeader; gUnknown_203B2B8->unk16C[loopMax].menuAction = 8; loopMax += 1; } } else { - gUnknown_203B2B8->unk16C[loopMax].text = gPartyMenuJoinTeam; + gUnknown_203B2B8->unk16C[loopMax].text = sPartyMenuJoinTeam; gUnknown_203B2B8->unk16C[loopMax].menuAction = 6; if(!sub_808D750(gUnknown_203B2B8->pokeSpecies)) { @@ -501,7 +382,7 @@ void sub_80264CC(void) { loopMax += 1; } - gUnknown_203B2B8->unk16C[loopMax].text = gPartyMenuGiveGummi; + gUnknown_203B2B8->unk16C[loopMax].text = sPartyMenuGiveGummi; gUnknown_203B2B8->unk16C[loopMax].menuAction = 10; if(!HasGummiItem()) { @@ -509,7 +390,7 @@ void sub_80264CC(void) { } loopMax += 1; - gUnknown_203B2B8->unk16C[loopMax].text = gPartyMenuGive; + gUnknown_203B2B8->unk16C[loopMax].text = sPartyMenuGive; gUnknown_203B2B8->unk16C[loopMax].menuAction = 0xB; if(GetNumberOfFilledInventorySlots() == 0) { @@ -517,7 +398,7 @@ void sub_80264CC(void) { } loopMax += 1; - gUnknown_203B2B8->unk16C[loopMax].text = gPartyMenuTake; + gUnknown_203B2B8->unk16C[loopMax].text = sPartyMenuTake; gUnknown_203B2B8->unk16C[loopMax].menuAction = 0xC; if(GetNumberOfFilledInventorySlots() >= INVENTORY_SIZE || gUnknown_203B2B8->item2.id == ITEM_NOTHING) { @@ -527,7 +408,7 @@ void sub_80264CC(void) { if((temp = pokeStruct->unk0 >> 1, one = 1, temp & one) == 0) { - gUnknown_203B2B8->unk16C[loopMax].text = gPartyMenuSayFarewell; + gUnknown_203B2B8->unk16C[loopMax].text = sPartyMenuSayFarewell; gUnknown_203B2B8->unk16C[loopMax].menuAction = 9; if(!sub_8026EB8(pokeStruct)) { @@ -536,13 +417,13 @@ void sub_80264CC(void) { loopMax += 1; } - gUnknown_203B2B8->unk16C[loopMax].text = gPartyMenuSummary; + gUnknown_203B2B8->unk16C[loopMax].text = sPartyMenuSummary; gUnknown_203B2B8->unk16C[loopMax].menuAction = 4; loopMax += 1; - gUnknown_203B2B8->unk16C[loopMax].text = gPartyMenuMoves; + gUnknown_203B2B8->unk16C[loopMax].text = sPartyMenuMoves; gUnknown_203B2B8->unk16C[loopMax].menuAction = 0xD; loopMax += 1; - gUnknown_203B2B8->unk16C[loopMax].text = gPartyMenuCheckIQ; + gUnknown_203B2B8->unk16C[loopMax].text = sPartyMenuCheckIQ; gUnknown_203B2B8->unk16C[loopMax].menuAction = 5; loopMax += 1; gUnknown_203B2B8->unk16C[loopMax].text = NULL; @@ -571,7 +452,7 @@ void sub_802678C(void) s32 index; s32 loopMax = 0; MemoryFill16(gUnknown_203B2B8->unk20C, 0, sizeof(gUnknown_203B2B8->unk20C)); - gUnknown_203B2B8->unk16C[loopMax].text = gPartyMenuGive; + gUnknown_203B2B8->unk16C[loopMax].text = sPartyMenuGive; gUnknown_203B2B8->unk16C[loopMax].menuAction = 0xB; if(GetNumberOfFilledInventorySlots() == 0) { @@ -616,9 +497,9 @@ void sub_8026878(void) { void sub_80268CC(void) { - struct PokemonStruct *playerPokemon; - struct PokemonStruct *pokeStruct; - struct PokemonStruct *pokeStruct2; + PokemonStruct1 *playerPokemon; + PokemonStruct1 *pokeStruct; + PokemonStruct1 *pokeStruct2; s32 choice; choice = 0; @@ -632,10 +513,10 @@ void sub_80268CC(void) #ifdef NONMATCHING pokeStruct = &gUnknown_203B2B8->pokeSpecies[gRecruitedPokemonRef->pokemon]; #else - register size_t offset asm("r1") = offsetof(struct unkStruct_203B45C, pokemon[gUnknown_203B2B8->pokeSpecies]); - struct PokemonStruct* p = gRecruitedPokemonRef->pokemon; + register size_t offset asm("r1") = offsetof(unkStruct_203B45C, pokemon[gUnknown_203B2B8->pokeSpecies]); + PokemonStruct1* p = gRecruitedPokemonRef->pokemon; size_t addr = offset + (size_t)p; - pokeStruct = (struct PokemonStruct*)addr; + pokeStruct = (PokemonStruct1*)addr; #endif pokeStruct->unk0 |= FLAG_ON_TEAM; @@ -825,7 +706,7 @@ void sub_8026C14(void) u32 nextState; struct unkStruct_8090F58 temp; int menuAction; - struct Item slot; + Item slot; menuAction = 0; sub_801A6E8(FALSE); @@ -924,9 +805,9 @@ void sub_8026D88(void) } } -void sub_8026DAC(u32 r0, struct BulkItem *item) +void sub_8026DAC(u32 r0, BulkItem *item) { - struct Item slot; + Item slot; struct unkStruct_8090F58 temp; sub_8008C54(r0); @@ -937,7 +818,7 @@ void sub_8026DAC(u32 r0, struct BulkItem *item) temp.unk8 = 1; slot.flags = ITEM_FLAG_EXISTS; sub_8090E14(gUnknown_202DE58, &slot, &temp); - xxx_format_and_draw(4, 3, gPartyMenuItemPlaceholder, r0, 0); + xxx_format_and_draw(4, 3, sPartyMenuItemPlaceholder, r0, 0); sub_80073E0(r0); } @@ -951,13 +832,13 @@ void sub_8026E08(u32 r0) sub_80073B8(r0); sub_80922B4(gAvailablePokemonNames, gUnknown_203B2B8->pokeStruct->name, POKEMON_NAME_LENGTH); sub_808D930(buffer, gUnknown_203B2B8->pokeStruct->speciesNum); - sprintfStatic(buffer1, gUnknown_80DD6E0, gAvailablePokemonNames); + sprintfStatic(buffer1, sUnknown_80DD6E0, gAvailablePokemonNames); x = sub_8008ED0(buffer1); - xxx_call_draw_string(((gUnknown_80DD370.unkC << 3) - x) / 2, 3, buffer1, r0, 0); + xxx_call_draw_string(((sUnknown_80DD370.unkC << 3) - x) / 2, 3, buffer1, r0, 0); sub_80073E0(r0); } -bool8 sub_8026E88(struct PokemonStruct *r0) +bool8 sub_8026E88(PokemonStruct1 *r0) { bool8 flag; if(!r0->isTeamLeader) @@ -972,7 +853,7 @@ bool8 sub_8026E88(struct PokemonStruct *r0) return TRUE; } -bool8 sub_8026EB8(struct PokemonStruct *r0) +bool8 sub_8026EB8(PokemonStruct1 *r0) { bool8 flag; if(sub_808D3BC() != r0) @@ -994,7 +875,7 @@ bool8 sub_8026EB8(struct PokemonStruct *r0) } -u32 sub_8026F04(struct PokemonStruct *r0) +u32 sub_8026F04(PokemonStruct1 *r0) { if(r0->heldItem.id == ITEM_NOTHING) return 0; @@ -1006,7 +887,7 @@ u32 sub_8026F04(struct PokemonStruct *r0) return 3; } -bool8 CanTakePokemonHeldItem(struct PokemonStruct *r0) +bool8 CanTakePokemonHeldItem(PokemonStruct1 *r0) { if(IsNotMoneyOrUsedTMItem(r0->heldItem.id)) { diff --git a/src/pelipper_board.c b/src/pelipper_board.c index 3d2cfbe35..06f041ad5 100644 --- a/src/pelipper_board.c +++ b/src/pelipper_board.c @@ -1,7 +1,7 @@ #include "global.h" #include "mailbox.h" #include "pokemon.h" -#include "item.h" +#include "items.h" #include "memory.h" #include "text1.h" #include "text2.h" @@ -9,13 +9,13 @@ #include "input.h" #include "wonder_mail.h" #include "menu_input.h" -#include "team_inventory.h" + #include "pelipper_board.h" #include "code_80118A4.h" EWRAM_DATA_2 struct unkStruct_203B308 *gPelipperBoard = {0}; -const struct UnkTextStruct2 gUnknown_80E0330 = +const UnkTextStruct2 gUnknown_80E0330 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -25,7 +25,7 @@ const struct UnkTextStruct2 gUnknown_80E0330 = NULL }; -const struct UnkTextStruct2 gUnknown_80E0348 = +const UnkTextStruct2 gUnknown_80E0348 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -35,7 +35,7 @@ const struct UnkTextStruct2 gUnknown_80E0348 = NULL }; -const struct UnkTextStruct2 gUnknown_80E0360 = +const UnkTextStruct2 gUnknown_80E0360 = { 0x00, 0x00, 0x00, 0x00, 0x04, @@ -45,7 +45,7 @@ const struct UnkTextStruct2 gUnknown_80E0360 = NULL }; -const struct UnkTextStruct2 gUnknown_80E0378 = +const UnkTextStruct2 gUnknown_80E0378 = { 0x00, 0x00, 0x00, 0x00, 0x04, @@ -76,26 +76,26 @@ extern void sub_802C10C(u32, u32, u32); extern void sub_802C28C(u32); extern void DrawPelipperBoardJobMenu(void); extern void CreatePelipperAcceptedStatusBox(u32); -extern void sub_803B35C(struct WonderMail *, struct unkStruct_802C39C *); -extern void sub_802DE84(struct unkStruct_802C39C *); +extern void sub_803B35C(WonderMail *, unkStruct_802C39C *); +extern void sub_802DE84(unkStruct_802C39C *); extern void InitializeJobListMenu(u32); extern u32 sub_802C898(void); extern void sub_802C8F4(void); extern u32 sub_802DEE0(void); extern void sub_802DF24(void); -extern struct WonderMail *GetPelipperBoardSlotInfo(u8); +extern WonderMail *GetPelipperBoardSlotInfo(u8); extern u8 HasNoPelipperBoardJobs(void); extern void sub_8096C80(void); extern void sub_8096D24(void); -extern void AcceptJob(struct WonderMail*); +extern void AcceptJob(WonderMail*); extern void ResetPelipperBoardSlot(u8); extern void sub_80965F4(void); extern void sub_802C2D4(void); extern u32 sub_802C1E4(u32); extern u8 sub_802C26C(void); extern u8 HasNoAcceptedJobs(void); -extern bool8 IsMailinJobSlot(struct WonderMail *mail); +extern bool8 IsMailinJobSlot(WonderMail *mail); extern u8 *gUnknown_80D4990[]; extern u8 *gUnknown_80D4970[]; @@ -196,7 +196,7 @@ void sub_802E94C(void) break; } ResetUnusedInputStruct(); - sub_800641C(gPelipperBoard->unk10C, 1, 1); + sub_800641C(gPelipperBoard->unk10C, TRUE, TRUE); } void sub_802EA58(void) @@ -363,7 +363,7 @@ void sub_802ED4C(void) void sub_802EDBC(void) { - struct WonderMail *mail; + WonderMail *mail; s32 menuAction = 0; sub_802C1E4(0); diff --git a/src/personality_test.c b/src/personality_test.c index c05375849..8e6f7ae93 100644 --- a/src/personality_test.c +++ b/src/personality_test.c @@ -1,20 +1,22 @@ #include "global.h" -#include "personality_test.h" +#include "bg_palette_buffer.h" +#include "code_80118A4.h" +#include "code_8012A18_1.h" +#include "code_80130A8.h" +#include "code_8098BDC.h" #include "constants/emotions.h" #include "constants/input.h" #include "constants/type.h" -#include "random.h" -#include "pokemon.h" -#include "save.h" -#include "memory.h" #include "game_options.h" +#include "memory.h" +#include "menu_input.h" +#include "personality_test.h" +#include "pokemon.h" +#include "random.h" +#include "save.h" #include "text1.h" #include "text2.h" #include "text_util.h" -#include "menu_input.h" -#include "code_80130A8.h" -#include "code_8012A18_1.h" -#include "code_80118A4.h" enum { @@ -44,16 +46,13 @@ extern s32 sub_8094E4C(void); extern void sub_8094D28(s32); extern void sub_8001044(u32 *); -extern void sub_8099690(u32); - extern void sub_800836C(u32, u8 *r0, u32); -extern void SetBGPaletteBufferColorArray(s32 index, u8 *colorArray); extern void RedrawPartnerSelectionMenu(void); extern u32 sub_80095E4(s16, u32); -extern struct GameOptions *gGameOptionsRef; +extern GameOptions *gGameOptionsRef; extern const char gStarterReveal[]; @@ -256,7 +255,7 @@ const u8 gNatureQuestionTable[NUM_QUIZ_QUESTIONS + 1] = ALIGNED(4) const u8 gGenderText[] = "Are you a boy or a girl?"; const char * const gGenderTextPtr = gGenderText; -const struct MenuItem gGenderMenu[] = +const MenuItem gGenderMenu[] = { {BoyText, 0}, {GirlText, 1}, @@ -328,7 +327,7 @@ const char * const gPersonalityTypeDescriptionTable[NUM_PERSONALITIES] = #include "data/nature_description.h" -const struct UnkTextStruct2 gUnknown_80F4244 = +const UnkTextStruct2 gUnknown_80F4244 = { 0x00, 0x00, 0x00, 0x00, 0x05, @@ -354,7 +353,7 @@ const s16 gPartners[NUM_PARTNERS] = MONSTER_MUDKIP }; -const struct UnkTextStruct2 gUnknown_80F4278 = +const UnkTextStruct2 gUnknown_80F4278 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -364,7 +363,7 @@ const struct UnkTextStruct2 gUnknown_80F4278 = NULL }; -const struct UnkTextStruct2 gUnknown_80F4290 = +const UnkTextStruct2 gUnknown_80F4290 = { 0x00, 0x00, 0x00, 0x00, 0x06, @@ -374,7 +373,7 @@ const struct UnkTextStruct2 gUnknown_80F4290 = NULL }; -const struct UnkTextStruct2 gUnknown_80F42A8 = +const UnkTextStruct2 gUnknown_80F42A8 = { 0x00, 0x00, 0x00, 0x00, 0x05, @@ -385,7 +384,6 @@ const struct UnkTextStruct2 gUnknown_80F42A8 = }; const char gPartnerSelectionHeaderText[] = _("Pokémon"); -const char personality_test_fill[] = "pksdir0"; u8 CreateTestTracker(void) { @@ -704,7 +702,7 @@ void PromptNewQuestion(void) { sub_8014248(gPersonalityQuestionPointerTable[gPersonalityTestTracker->currQuestionIndex]->question, 0, 0, - (struct MenuItem *)gPersonalityQuestionPointerTable[gPersonalityTestTracker->currQuestionIndex]->answers, + (MenuItem *)gPersonalityQuestionPointerTable[gPersonalityTestTracker->currQuestionIndex]->answers, 0, 3, 0, 0, 0x101); } @@ -718,17 +716,17 @@ void PrintPersonalityTypeDescription(void) void PersonalityTest_DisplayStarterSprite(void) { s32 starterID; - struct OpenedFile *faceFile; + OpenedFile *faceFile; int palleteIndex; u8 *r6; u32 faceIndex; - struct UnkTextStruct2 stackArray[4]; + UnkTextStruct2 stackArray[4]; starterID = gPersonalityTestTracker->StarterID; sub_8006518(stackArray); stackArray[1] = gUnknown_80F4244; ResetUnusedInputStruct(); - sub_800641C(stackArray, 1, 0); + sub_800641C(stackArray, TRUE, FALSE); sub_8008C54(1); sub_80073B8(1); faceFile = GetDialogueSpriteDataPtr(starterID); @@ -764,7 +762,7 @@ void CreatePartnerSelectionMenu(s16 starterID) gUnknown_203B404->unkb4[2] = 6; gUnknown_203B404->unkb4[3] = 0; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B404->unk54, 1, 1); + sub_800641C(gUnknown_203B404->unk54, TRUE, TRUE); sub_8013818(&gUnknown_203B404->input, GetValidPartners(), 0xA, gUnknown_203B404->unk4C); RedrawPartnerSelectionMenu(); PersonalityTest_DisplayPartnerSprite(); @@ -812,7 +810,7 @@ void sub_803CE6C() { gUnknown_203B404->unk54[gUnknown_203B404->unk4C] = gUnknown_80F4278; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B404->unk54, 1, 1); + sub_800641C(gUnknown_203B404->unk54, TRUE, TRUE); sub_803CECC(); // Free 203B404 } @@ -836,7 +834,7 @@ void sub_803CECC(void) } } -#ifdef NONMATCHING +#ifdef NONMATCHING // sub_80095E4 memes void RedrawPartnerSelectionMenu(void) { s32 sVar1; @@ -856,7 +854,7 @@ void RedrawPartnerSelectionMenu(void) // Everything after this matches ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B404->unk54,1,1); + sub_800641C(gUnknown_203B404->unk54, TRUE, TRUE); sub_8008C54(gUnknown_203B404->unk4C); sub_80073B8(gUnknown_203B404->unk4C); xxx_call_draw_string(0xc, 0, gPartnerSelectionHeaderText, gUnknown_203B404->unk4C, 0); @@ -975,7 +973,7 @@ void RedrawPartnerSelectionMenu(void) void PersonalityTest_DisplayPartnerSprite(void) { s32 partnerID; - struct OpenedFile *faceFile; + OpenedFile *faceFile; int palleteIndex; u8 *r6; u32 faceIndex; diff --git a/src/pokemon.c b/src/pokemon.c index 18daecf7a..3674cc0a5 100644 --- a/src/pokemon.c +++ b/src/pokemon.c @@ -5,23 +5,23 @@ extern struct FileArchive gSystemFileArchive; extern const char gUnknown_81075F4; -EWRAM_DATA struct MonsterDataEntry *gMonsterParameters; -EWRAM_DATA struct OpenedFile *gMonsterParametersFile; -EWRAM_DATA struct unkStruct_203B45C gRecruitedPokemon; +EWRAM_DATA MonsterDataEntry *gMonsterParameters; +EWRAM_DATA OpenedFile *gMonsterParametersFile; +EWRAM_DATA unkStruct_203B45C gRecruitedPokemon; EWRAM_DATA u16 gLevelCurrentPokeId; -EWRAM_DATA_2 struct unkStruct_203B45C *gRecruitedPokemonRef = {0}; +EWRAM_DATA_2 unkStruct_203B45C *gRecruitedPokemonRef = {0}; void LoadMonsterParameters(void) { gRecruitedPokemonRef = &gRecruitedPokemon; gMonsterParametersFile = OpenFileAndGetFileDataPtr(&gUnknown_81075F4, &gSystemFileArchive); - gMonsterParameters = (struct MonsterDataEntry *)gMonsterParametersFile->data; + gMonsterParameters = (MonsterDataEntry *)gMonsterParametersFile->data; gLevelCurrentPokeId = 0; } -struct unkStruct_203B45C *GetRecruitedPokemon(void) +unkStruct_203B45C *GetRecruitedPokemon(void) { return &gRecruitedPokemon; } @@ -50,8 +50,8 @@ void InitializeRecruitedPokemon(void) // https://decomp.me/scratch/wQbZB // void sub_808CE74(s16 _species, bool8 _isLeader, u8* name) // { - // struct PokemonStruct pokemon; - // struct PokemonStruct *temp; + // PokemonStruct1 pokemon; + // PokemonStruct1 *temp; // u8 name_buffer[20]; // u32 friendArea; // s32 i; diff --git a/src/pokemon_3.c b/src/pokemon_3.c index a4f7e54fb..1a88445ce 100644 --- a/src/pokemon_3.c +++ b/src/pokemon_3.c @@ -1,5 +1,4 @@ #include "global.h" - #include "pokemon.h" #include "pokemon_3.h" #include "random.h" @@ -11,6 +10,8 @@ #include "text_util.h" #include "friend_area.h" #include "luminous_cave.h" +#include "code_8097670.h" +#include "moves.h" extern u8 *gIQSkillNames[]; extern u8 *gIQSkillDescriptions[]; @@ -35,7 +36,7 @@ struct unkStruct_808E9EC }; extern s32 gUnknown_81076C4[6]; // x-coord positioning for shadow sprites -extern struct SpriteOAM gUnknown_202F3E8[3]; // Shadow sprites of some kind +extern SpriteOAM gUnknown_202F3E8[3]; // Shadow sprites of some kind extern s16 gUnknown_810AC60; // 0xC extern s16 gUnknown_810AC62; // 0xC extern s16 gUnknown_810AC68; // 0x8 @@ -45,30 +46,25 @@ extern s16 gUnknown_810AC66; // 0x8 // 2, 4, 6, 7, 8, 9, 0xA, 0xD, 0xF, 0x11 extern s32 gUnknown_810AC90[10]; -extern void SaveDungeonLocation(struct unkStruct_8094924*, struct DungeonLocation*); +extern void SaveDungeonLocation(struct unkStruct_8094924*, DungeonLocation*); extern void xxx_save_poke_sub_c_808F41C(struct unkStruct_8094924*, struct unkPokeSubStruct_C*); -extern void SavePokemonMoves(struct unkStruct_8094924*, struct Move*); -void RestoreDungeonLocation(struct unkStruct_8094924*, struct DungeonLocation*); +void RestoreDungeonLocation(struct unkStruct_8094924*, DungeonLocation*); void xxx_restore_poke_sub_c_808F410(struct unkStruct_8094924*, struct unkPokeSubStruct_C*); -void RestorePokemonMoves(struct unkStruct_8094924*, struct Move*); -extern void sub_8094184(struct unkStruct_8094924*, void*); extern void sub_809449C(struct unkStruct_8094924*, void*); extern void sub_808F448(struct unkStruct_8094924*, struct unkStruct_808E6F4*); -extern void sub_80941FC(struct unkStruct_8094924*, void*); extern void sub_809447C(struct unkStruct_8094924*, void*); extern void sub_808F428(struct unkStruct_8094924*, struct unkStruct_808E6F4*); -s16 GetPokemonEvolveConditions(s16 index, struct unkEvolve *r1); +s16 GetPokemonEvolveConditions(s16 index, unkEvolve *r1); -u32 sub_808F798(struct PokemonStruct *, s16); -void sub_8097848(void); +u32 sub_808F798(PokemonStruct1 *, s16); bool8 sub_808E668(s16 species, s16* a2, s16* a3) { if (species != MONSTER_DIGLETT && species != MONSTER_DUGTRIO) { u8 shadowSize = GetShadowSize(species); u32 x, unk6; - struct SpriteOAM* spr; + SpriteOAM* spr; x = a2[0] + a3[8]; unk6 = a2[1] + a3[9]; @@ -107,7 +103,7 @@ void sub_808E6F4(struct unkStruct_808E6F4* a1) bool8 HasRecruitedMon(s16 species) { s32 species_s32 = species; s32 i = 0; - struct PokemonStruct *pokemon = gRecruitedPokemonRef->pokemon; + PokemonStruct1 *pokemon = gRecruitedPokemonRef->pokemon; for (i = 0; i < NUM_MONSTERS; i++) { if (((u8)pokemon->unk0 & 1)) { @@ -278,31 +274,31 @@ s32 GetUnownIndex(s16 index) return 0; } -u32 ExtractSpeciesIndex(struct PokemonStruct *r0) +u32 ExtractSpeciesIndex(PokemonStruct1 *r0) { return r0->unk0 & 0x000001ff; } -void sub_808E9C4(struct PokemonStruct *r0, s16 r1) +void sub_808E9C4(PokemonStruct1 *r0, s16 r1) { s32 r1_s32 = r1; // cast needed to match r0->unk0 = ((0xFE << 8) & r0->unk0) | r1_s32 ; } -void sub_808E9D8(struct PokemonStruct *r0, s32 r1, s16 r2) +void sub_808E9D8(PokemonStruct1 *r0, s32 r1, s16 r2) { s32 r2_32 = r2; // dumb cast to match r0->unk0 = r2_32 | (r1 << 9) ; } -u32 ExtractLevel(struct PokemonStruct *r0) +u32 ExtractLevel(PokemonStruct1 *r0) { return (r0->unk0 >> 9); } // Unused #ifdef NONMATCHING -void sub_808E9EC(struct PokemonStruct *r0, struct unkStruct_808E9EC *r1) +void sub_808E9EC(PokemonStruct1 *r0, struct unkStruct_808E9EC *r1) { u8 pokeAtt; u8 r4; @@ -357,7 +353,7 @@ void sub_808E9EC(struct PokemonStruct *r0, struct unkStruct_808E9EC *r1) } #else NAKED -void sub_808E9EC(struct PokemonStruct *r0, struct unkStruct_808E9EC *r1) +void sub_808E9EC(PokemonStruct1 *r0, struct unkStruct_808E9EC *r1) { asm_unified("\tpush {r4-r6,lr}\n" "\tadds r3, r1, 0\n" @@ -638,8 +634,6 @@ u32 sub_808ECFC(void) return 0; } -extern s32 sub_808D580(s32*); - void sub_808ED00() { s32 team[4]; s32 i; @@ -662,7 +656,7 @@ s32 SaveRecruitedPokemon(u8 *a1, s32 a2) s16 data_s16; s32 count; s32 i; - struct PokemonStruct *pokemon; + PokemonStruct1 *pokemon; xxx_init_struct_8094924_save_809486C(&backup, a1, a2); @@ -751,7 +745,7 @@ s32 RestoreRecruitedPokemon(u8 *a1, s32 a2) return backup.unk8; } -void SavePokemonStruct(struct unkStruct_8094924* a1, struct PokemonStruct* pokemon) +void SavePokemonStruct(struct unkStruct_8094924* a1, PokemonStruct1* pokemon) { SaveIntegerBits(a1, &pokemon->level, 7); SaveIntegerBits(a1, &pokemon->speciesNum, 9); @@ -772,9 +766,9 @@ void SavePokemonStruct(struct unkStruct_8094924* a1, struct PokemonStruct* pokem SaveIntegerBits(a1, pokemon->name, 80); } -void RestorePokemonStruct(struct unkStruct_8094924* a1, struct PokemonStruct* pokemon) +void RestorePokemonStruct(struct unkStruct_8094924* a1, PokemonStruct1* pokemon) { - memset(pokemon, 0, sizeof(struct PokemonStruct)); + memset(pokemon, 0, sizeof(PokemonStruct1)); pokemon->unk0 = 0; pokemon->isTeamLeader = 0; RestoreIntegerBits(a1, &pokemon->level, 7); @@ -811,7 +805,7 @@ s32 SavePokemonStruct2(u8* a1, s32 size) data_u8_zero = 0; for (i = 0; i < 4; i++) { - struct PokemonStruct2* pokemon2 = &gRecruitedPokemonRef->pokemon2[i]; + PokemonStruct2* pokemon2 = &gRecruitedPokemonRef->pokemon2[i]; SaveIntegerBits(&backup, &pokemon2->unk0, 2); SaveIntegerBits(&backup, pokemon2->isTeamLeader ? &data_u8_neg1 : &data_u8_zero, 1); @@ -849,10 +843,10 @@ s32 RestorePokemonStruct2(u8* a1, s32 size) xxx_init_struct_8094924_restore_809485C(&backup, a1, size); for (i = 0; i < 4; i++) { - struct PokemonStruct2* pokemon2 = &gRecruitedPokemonRef->pokemon2[i]; + PokemonStruct2* pokemon2 = &gRecruitedPokemonRef->pokemon2[i]; u8 unk2; - memset(pokemon2, 0, sizeof(struct PokemonStruct2)); + memset(pokemon2, 0, sizeof(PokemonStruct2)); RestoreIntegerBits(&backup, &pokemon2->unk0, 2); @@ -900,26 +894,26 @@ void xxx_save_poke_sub_c_808F41C(struct unkStruct_8094924* a1, struct unkPokeSub SaveIntegerBits(a1, &unkC->level, 7); } -void sub_808F428(struct unkStruct_8094924* a1, struct unkStruct_808E6F4* a2) +void sub_808F428(unkStruct_8094924* a1, unkStruct_808E6F4* a2) { RestoreIntegerBits(a1, &a2->unk0, 10); RestoreIntegerBits(a1, &a2->unk2, 5); } -void sub_808F448(struct unkStruct_8094924* a1, struct unkStruct_808E6F4* a2) +void sub_808F448(unkStruct_8094924* a1, unkStruct_808E6F4* a2) { SaveIntegerBits(a1, &a2->unk0, 10); SaveIntegerBits(a1, &a2->unk2, 5); } -void sub_808F468(struct PokemonStruct *param_1, struct EvolveStatus *evolveStatus, u8 param_3) +void sub_808F468(PokemonStruct1 *param_1, EvolveStatus *evolveStatus, u8 param_3) { bool8 evolFlag; u8 friendArea; u8 uVar2; s32 numPokemon; - struct unkStruct_8092638 local_40; // sp 0x0 - struct unkEvolve evolveConditions; // r7 + unkStruct_8092638 local_40; // sp 0x0 + unkEvolve evolveConditions; // r7 s32 index, index2; #ifndef NONMATCHING register s32 defaultReason asm("sl"); @@ -1081,9 +1075,9 @@ void sub_808F468(struct PokemonStruct *param_1, struct EvolveStatus *evolveStatu } } -u8 sub_808F700(struct PokemonStruct *pokemon) +u8 sub_808F700(PokemonStruct1 *pokemon) { - struct EvolveStatus evolveStatus; + EvolveStatus evolveStatus; sub_808F468(pokemon, &evolveStatus, 0); if ((evolveStatus.evolutionConditionStatus & EVOLUTION_GOOD)) { @@ -1097,11 +1091,11 @@ u8 sub_808F700(struct PokemonStruct *pokemon) } } -u32 sub_808F734(struct PokemonStruct *pokemon, s16 _species) +u32 sub_808F734(PokemonStruct1 *pokemon, s16 _species) { u32 uVar1; int iVar3; - struct PokemonStruct pokeStruct; + PokemonStruct1 pokeStruct; s32 species = _species; iVar3 = 0; diff --git a/src/pokemon_mid.c b/src/pokemon_mid.c index af5e9e983..918a0a326 100644 --- a/src/pokemon_mid.c +++ b/src/pokemon_mid.c @@ -1,16 +1,17 @@ #include "global.h" -#include "pokemon.h" -#include "pokemon_3.h" -#include "file_system.h" -#include "item.h" -#include "moves.h" -#include "subStruct_203B240.h" +#include "code_800D090.h" #include "constants/colors.h" #include "constants/move_id.h" -#include "code_800D090.h" +#include "decompress.h" +#include "items.h" +#include "moves.h" +#include "pokemon.h" +#include "pokemon_3.h" +#include "pokemon_mid.h" +#include "subStruct_203B240.h" #include "text_util.h" -extern struct MonsterDataEntry *gMonsterParameters; +extern MonsterDataEntry *gMonsterParameters; extern const char gUnknown_8107600[]; extern const char gUnknown_8107608[]; extern const char gUnownLetters[]; @@ -27,17 +28,18 @@ extern char* gFormattedStatusNames[]; // wram data: extern u16 gLevelCurrentPokeId; -extern struct LevelData gLevelCurrentData[]; +extern LevelData gLevelCurrentData[]; extern int sprintf(char *, const char *, ...); extern u32 ReturnIntFromChar(u8 r0); -extern void CopyAndResetMoves(void*, void*); extern void sub_80943A0(void*, s32); -extern void xxx_pokemon2_to_pokemonstruct_808DF44(struct PokemonStruct*, struct PokemonStruct2*); -extern u8* DecompressMoveID(u8* a1, u16* a2); +extern void xxx_pokemon2_to_pokemonstruct_808DF44(PokemonStruct1*, PokemonStruct2*); +extern const u8 *DecompressMoveID(const u8 *a1, u16 *a2); extern u32 sub_8097DF0(char *, struct subStruct_203B240 **); +extern u8 GetBodySize(s16 index); + struct unkStruct_8107654 { s16 unk0; s16 fill2; @@ -46,7 +48,7 @@ struct unkStruct_8107654 { extern u8 gUnknown_8107645[12]; extern struct unkStruct_8107654 gUnknown_8107654[6]; -extern struct MonsterDataEntry *gMonsterParameters; +extern MonsterDataEntry *gMonsterParameters; extern struct FileArchive gMonsterFileArchive; extern const char gUnknown_8107684[]; @@ -57,7 +59,7 @@ bool8 sub_808D6E8() s32 count = 0; s32 size_count = 0; for (i = 0; i < NUM_MONSTERS; i++) { - struct PokemonStruct* pokemon = &gRecruitedPokemonRef->pokemon[i]; + PokemonStruct1* pokemon = &gRecruitedPokemonRef->pokemon[i]; if ((1 & pokemon->unk0) && ((pokemon->unk0 >> 1) % 2)) { size_count += GetBodySize(pokemon->speciesNum); count++; @@ -154,7 +156,7 @@ bool8 sub_808D750(s16 index_) { // s32 size_count = 0; // for (i = 0; i < 413; i++) { -// register struct PokemonStruct* pokemon = &i[gRecruitedPokemonRef->pokemon]; +// register PokemonStruct1* pokemon = &i[gRecruitedPokemonRef->pokemon]; // register u16 unk0 = pokemon->unk0; // if ((unk0 & 1) && ((pokemon->unk0 >> 1) & 1)) { // size_count += GetBodySize(pokemon->speciesNum); @@ -163,7 +165,7 @@ bool8 sub_808D750(s16 index_) { // } // if (count < 4) { -// struct PokemonStruct* pokemon; +// PokemonStruct1* pokemon; // pokemon = &gRecruitedPokemonRef->pokemon[index]; @@ -176,21 +178,21 @@ bool8 sub_808D750(s16 index_) { // } -void PeekPokemonItem(s16 index_, struct BulkItem* item) { +void PeekPokemonItem(s16 index_, BulkItem* item) { s32 index = index_; - struct PokemonStruct* pokemon = &gRecruitedPokemonRef->pokemon[index]; + PokemonStruct1* pokemon = &gRecruitedPokemonRef->pokemon[index]; item->id = pokemon->heldItem.id; item->quantity = pokemon->heldItem.quantity; } -void GivePokemonItem(s16 index_, struct BulkItem* item) { +void GivePokemonItem(s16 index_, BulkItem* item) { s32 index = index_; - struct PokemonStruct* pokemon = &gRecruitedPokemonRef->pokemon[index]; + PokemonStruct1* pokemon = &gRecruitedPokemonRef->pokemon[index]; pokemon->heldItem.id = item->id; pokemon->heldItem.quantity = item->quantity; } -bool8 IsPokemonRenamed(struct PokemonStruct* pokemon) { +bool8 IsPokemonRenamed(PokemonStruct1* pokemon) { char species_name[20]; char* species = GetMonSpecies(pokemon->speciesNum); s32 i; @@ -268,7 +270,7 @@ char * GetMonSpecies(s16 index) return gMonsterParameters[index].species; } -void PrintColoredPokeNameToBuffer(u8 *buffer, struct PokemonStruct *pokemon, s32 colorNum) +void PrintColoredPokeNameToBuffer(u8 *buffer, PokemonStruct1 *pokemon, s32 colorNum) { u8 nameBuffer [20]; @@ -279,7 +281,7 @@ void PrintColoredPokeNameToBuffer(u8 *buffer, struct PokemonStruct *pokemon, s32 sprintfStatic(buffer,gUnknown_810763C,colorNum,nameBuffer); // {COLOR_2}%c%s{END_COLOR_TEXT_2} } -void sub_808D9DC(u8 *buffer, struct PokemonStruct2 *param_2, s32 colorNum) +void sub_808D9DC(u8 *buffer, PokemonStruct2 *param_2, s32 colorNum) { u8 nameBuffer [20]; @@ -290,7 +292,7 @@ void sub_808D9DC(u8 *buffer, struct PokemonStruct2 *param_2, s32 colorNum) sprintfStatic(buffer,gUnknown_810763C,colorNum,nameBuffer); // {COLOR_2}%c%s{END_COLOR_TEXT_2} } -void sub_808DA0C(u8 *buffer, struct PokemonStruct2 *param_2) +void sub_808DA0C(u8 *buffer, PokemonStruct2 *param_2) { u8 nameBuffer [20]; @@ -298,7 +300,7 @@ void sub_808DA0C(u8 *buffer, struct PokemonStruct2 *param_2) sprintfStatic(buffer,gUnknown_8107638,nameBuffer); // %s } -void PrintPokeNameToBuffer(u8 *buffer, struct PokemonStruct *pokemon) +void PrintPokeNameToBuffer(u8 *buffer, PokemonStruct1 *pokemon) { sub_80922B4(buffer, pokemon->name, POKEMON_NAME_LENGTH); } @@ -451,10 +453,10 @@ s32 CalculateEXPGain(s16 index, s32 level) return expYield + (expYield * (level - 1)) / 10; } -s16 GetPokemonEvolveConditions(s16 index, struct unkEvolve *r1) +s16 GetPokemonEvolveConditions(s16 index, unkEvolve *r1) { - struct PreEvolution temp2; - struct EvolutionRequirements temp1; + PreEvolution temp2; + EvolutionRequirements temp1; temp1 = gMonsterParameters[index].evolutionRequirements; temp2 = gMonsterParameters[index].preEvolution; r1->preEvolution = temp2; @@ -478,7 +480,7 @@ u8 GetPokemonOverworldPalette(s16 index, u32 r1) } } -struct OpenedFile *OpenPokemonDialogueSpriteFile(s16 index) +OpenedFile *OpenPokemonDialogueSpriteFile(s16 index) { // Looks like this loads the dialogue sprite for the pokemon @@ -491,7 +493,7 @@ struct OpenedFile *OpenPokemonDialogueSpriteFile(s16 index) return OpenFile(buffer, &gMonsterFileArchive); } -struct OpenedFile *GetDialogueSpriteDataPtr(s16 index) +OpenedFile *GetDialogueSpriteDataPtr(s16 index) { // Looks like this loads the dialogue sprite for the pokemon @@ -515,11 +517,11 @@ void xxx_pokemonstruct_index_to_pokemon2_808DE30(void* r0, u32 r1) xxx_pokemonstruct_to_pokemon2_808DE50(r0, &gRecruitedPokemonRef->pokemon[r1], r1); } -void xxx_pokemonstruct_to_pokemon2_808DE50(struct PokemonStruct2 * a1, struct PokemonStruct *pokemon, s32 a3) +void xxx_pokemonstruct_to_pokemon2_808DE50(PokemonStruct2 * a1, PokemonStruct1 *pokemon, s32 a3) { s32 i; - struct BulkItem* held; - struct Item* slot; + BulkItem* held; + Item* slot; u32 somestruct_80943A0; u32 somestruct2_80943A0; @@ -542,7 +544,7 @@ void xxx_pokemonstruct_to_pokemon2_808DE50(struct PokemonStruct2 * a1, struct Po } a1->currExp = pokemon->currExp; - CopyAndResetMoves(&a1->moves, &pokemon->moves); + CopyAndResetMoves(a1->moves.moves, pokemon->moves); for (i = 0; i < POKEMON_NAME_LENGTH; i++) { a1->name[i] = pokemon->name[i]; @@ -565,15 +567,13 @@ void xxx_pokemonstruct_to_pokemon2_808DE50(struct PokemonStruct2 * a1, struct Po a1->unk48 = somestruct2_80943A0; } -void xxx_pokemon2_to_pokemonstruct_index_808DF2C(s32 a1, struct PokemonStruct2* a2) +void xxx_pokemon2_to_pokemonstruct_index_808DF2C(s32 a1, PokemonStruct2* a2) { xxx_pokemon2_to_pokemonstruct_808DF44(&a1[gRecruitedPokemonRef->pokemon], a2); } -extern void CopyBareMoveData(struct Move*, struct unkStruct_8094184*); - -void xxx_pokemon2_to_pokemonstruct_808DF44(struct PokemonStruct* pokemon, struct PokemonStruct2* a2) +void xxx_pokemon2_to_pokemonstruct_808DF44(PokemonStruct1* pokemon, PokemonStruct2* a2) { s32 i; @@ -593,7 +593,7 @@ void xxx_pokemon2_to_pokemonstruct_808DF44(struct PokemonStruct* pokemon, struct } pokemon->currExp = a2->currExp; - CopyBareMoveData(pokemon->moves, &a2->moves); + CopyBareMoveData(pokemon->moves, a2->moves.moves); for (i = 0; i < POKEMON_NAME_LENGTH; i++) { pokemon->name[i] = a2->name[i]; @@ -607,10 +607,10 @@ void xxx_pokemon2_to_pokemonstruct_808DF44(struct PokemonStruct* pokemon, struct } } -void sub_808DFDC(s32 a1, struct PokemonStruct2* a2) +void sub_808DFDC(s32 a1, PokemonStruct2* a2) { // transfer item from unk to pokemon at index - struct PokemonStruct* pokemon = &gRecruitedPokemonRef->pokemon[a1]; + PokemonStruct1* pokemon = &gRecruitedPokemonRef->pokemon[a1]; if (a2->itemSlot.flags & ITEM_FLAG_EXISTS) { SlotToHeldItem(&pokemon->heldItem, &a2->itemSlot); } @@ -619,14 +619,14 @@ void sub_808DFDC(s32 a1, struct PokemonStruct2* a2) } } -void GetPokemonLevelData(struct LevelData* a1, s16 _id, s32 level) +void GetPokemonLevelData(LevelData* a1, s16 _id, s32 level) { u8 buffer[12]; s32 id = _id; if ((s16)gLevelCurrentPokeId != id) { - struct OpenedFile *file; + OpenedFile *file; gLevelCurrentPokeId = id; // lvmp%03d\0 @@ -642,7 +642,7 @@ void GetPokemonLevelData(struct LevelData* a1, s16 _id, s32 level) *a1 = gLevelCurrentData[level]; } -u8* DecompressMoveID(u8* a1, u16* moveID) +const u8* DecompressMoveID(const u8* a1, u16* moveID) { u32 r1 = *a1++; u32 r3; @@ -671,7 +671,7 @@ u8* DecompressMoveID(u8* a1, u16* moveID) s32 sub_808E0AC(u16* a1, s16 species, s32 a3, s32 IQPoints) { - u8* stream; + const u8* stream; u16 moveID; // moveID s32 count; register s32 _species asm("r2"); // weird regalloc @@ -720,7 +720,7 @@ bool8 CanMonLearnMove(u16 moveID, s16 _species) u16 levelUpMoveID; u16 HMTMMoveID; s32 species = _species; // r4 - u8* learnsetPtr; + const u8* learnsetPtr; if (species == MONSTER_DECOY) return 0; if (species == MONSTER_NONE) return 0; @@ -747,7 +747,7 @@ bool8 CanMonLearnMove(u16 moveID, s16 _species) } -s32 sub_808E218(struct unkStruct_808E218_arg* a1, struct PokemonStruct* pokemon) +s32 sub_808E218(unkStruct_808E218_arg* a1, PokemonStruct1* pokemon) { s32 i; s32 count; @@ -762,7 +762,7 @@ s32 sub_808E218(struct unkStruct_808E218_arg* a1, struct PokemonStruct* pokemon) sequence_length = GetEvolutionSequence(pokemon, evolve_sequence); for (i = 0; i < sequence_length; i++) { - u8* ptr; + const u8 *ptr; u16 result; ptr = GetLevelUpMoves(evolve_sequence[i].speciesNum); @@ -807,7 +807,7 @@ s32 sub_808E218(struct unkStruct_808E218_arg* a1, struct PokemonStruct* pokemon) } -s32 GetEvolutionSequence(struct PokemonStruct* pokemon, struct EvolveStage* a2) +s32 GetEvolutionSequence(PokemonStruct1* pokemon, struct EvolveStage* a2) { #ifdef NONMATCHING s32 count; @@ -897,7 +897,7 @@ s32 sub_808E400(s32 _species, s16* _a2, s32 _a3, s32 _a4) return count; } -void sub_808E490(struct Move* a1, s16 species) +void sub_808E490(Move* a1, s16 species) { u16 buffer[0x10]; // of moveIDs s32 i; diff --git a/src/pokemon_news.c b/src/pokemon_news.c index b53bcd2bb..2b5e7c028 100644 --- a/src/pokemon_news.c +++ b/src/pokemon_news.c @@ -2,6 +2,7 @@ #include "global.h" #include "pokemon.h" #include "pokemon_mail.h" +#include "pokemon_mid.h" #include "memory.h" #include "text1.h" #include "text2.h" @@ -9,15 +10,16 @@ #include "menu_input.h" #include "code_80130A8.h" #include "code_80118A4.h" +#include "code_803B050.h" struct unkStruct_203B2CC { // size: 0xD4; u8 receivedNewsletters[NUM_POKEMON_NEWS]; - struct MenuInputStruct input; + MenuInputStruct input; u32 unk6C; - struct UnkTextStruct2 *unk70; - struct UnkTextStruct2 unk74[4]; + UnkTextStruct2 *unk70; + UnkTextStruct2 unk74[4]; }; extern struct unkStruct_203B2CC *gUnknown_203B2CC; @@ -31,8 +33,8 @@ struct unkStruct_203B2D4 const u8 *unk10[4]; u32 unk20; u32 unk24; - struct UnkTextStruct2 unk28[4]; - struct MenuInputStructSub unk88; + UnkTextStruct2 unk28[4]; + MenuInputStructSub unk88; }; extern struct unkStruct_203B2D4 *gUnknown_203B2D4; @@ -40,16 +42,16 @@ struct unkStruct_203B2D8 { // size: 0xA4 u8 unk0[4]; - struct MenuInputStruct input; + MenuInputStruct input; u32 unk38; - struct UnkTextStruct2 *unk3C; - struct UnkTextStruct2 unk40[4]; + UnkTextStruct2 *unk3C; + UnkTextStruct2 unk40[4]; u8 unkA0[4]; }; extern struct unkStruct_203B2D8 *gUnknown_203B2D8; -extern struct GameOptions *gGameOptionsRef; +extern GameOptions *gGameOptionsRef; -const struct UnkTextStruct2 gUnknown_80DFBD0 = +const UnkTextStruct2 gUnknown_80DFBD0 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -61,7 +63,7 @@ const struct UnkTextStruct2 gUnknown_80DFBD0 = const u8 gUnknown_80DFBE8[] = { 0x01, 0x00, 0x0C, 0x00 }; -const struct UnkTextStruct2 gUnknown_80DFBEC = +const UnkTextStruct2 gUnknown_80DFBEC = { 0x00, 0x00, 0x00, 0x00, 0x06, @@ -74,7 +76,7 @@ const struct UnkTextStruct2 gUnknown_80DFBEC = ALIGNED(4) const u8 gUnknown_80DFC04[] = "News List"; ALIGNED(4) static const char wonder_mail_2_fill1[] = "pksdir0"; -const struct UnkTextStruct2 gUnknown_80DFC18 = +const UnkTextStruct2 gUnknown_80DFC18 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -86,7 +88,7 @@ const struct UnkTextStruct2 gUnknown_80DFC18 = const u8 gUnkData_80DFC30[] = { 0x01, 0x00, 0x16, 0x00 }; -const struct UnkTextStruct2 gUnknown_80DFC34 = +const UnkTextStruct2 gUnknown_80DFC34 = { 0x00, 0x00, 0x00, 0x00, 0x06, @@ -100,7 +102,7 @@ ALIGNED(4) const u8 gUnknown_80DFC4C[] = "She"; ALIGNED(4) const u8 gUnknown_80DFC50[] = "He"; ALIGNED(4) static const char wonder_mail_2_fill2[] = "pksdir0"; -const struct UnkTextStruct2 gUnknown_80DFC5C = +const UnkTextStruct2 gUnknown_80DFC5C = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -110,7 +112,7 @@ const struct UnkTextStruct2 gUnknown_80DFC5C = NULL }; -const struct UnkTextStruct2 gUnknown_80DFC74 = +const UnkTextStruct2 gUnknown_80DFC74 = { 0x00, 0x00, 0x00, 0x00, 0x06, @@ -123,7 +125,7 @@ const struct UnkTextStruct2 gUnknown_80DFC74 = ALIGNED(4) const u8 gMailboxText[] = "Mailbox"; ALIGNED(4) static const char wonder_mail_2_fill3[] = "pksdir0"; -const struct UnkTextStruct2 gUnknown_80DFC9C = +const UnkTextStruct2 gUnknown_80DFC9C = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -133,7 +135,7 @@ const struct UnkTextStruct2 gUnknown_80DFC9C = NULL }; -const struct UnkTextStruct2 gUnknown_80DFCB4 = +const UnkTextStruct2 gUnknown_80DFCB4 = { 0x00, 0x00, 0x00, 0x00, 0x06, @@ -168,11 +170,9 @@ extern void sub_8013E54(void); extern char gUnknown_202E5D8[0x50]; extern char gAvailablePokemonNames[0x50]; extern void sub_802BC7C(void); -extern void sub_803B6B0(u32, u32, u32, u32); -extern struct PokemonStruct *sub_808D3BC(void); -extern void PrintPokeNameToBuffer(u8 *buffer, struct PokemonStruct *pokemon); +extern PokemonStruct1 *sub_808D3BC(void); -u32 sub_802B640(u32 r0, struct UnkTextStruct2_sub *r1, u32 r2) +u32 sub_802B640(u32 r0, UnkTextStruct2_sub *r1, u32 r2) { if (HasNoPKMNNews()) return 0; @@ -192,7 +192,7 @@ u32 sub_802B640(u32 r0, struct UnkTextStruct2_sub *r1, u32 r2) sub_8012D08(gUnknown_203B2CC->unk70, r2); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2CC->unk74, 1, 1); + sub_800641C(gUnknown_203B2CC->unk74, TRUE, TRUE); sub_8013818(&gUnknown_203B2CC->input, GetNumPKMNNews(), r2, r0); @@ -244,7 +244,7 @@ u8 GetPokemonNewsIndex(void) void sub_802B7D0(u8 r0) { ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2CC->unk74, 0, 0); + sub_800641C(gUnknown_203B2CC->unk74, FALSE, FALSE); gUnknown_203B2CC->input.unk22 = GetNumPKMNNews(); sub_8013984(&gUnknown_203B2CC->input); @@ -265,14 +265,14 @@ void sub_802B81C(void) gUnknown_203B2CC->unk74[gUnknown_203B2CC->unk6C] = gUnknown_80DFBD0; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2CC->unk74, 1, 1); + sub_800641C(gUnknown_203B2CC->unk74, TRUE, TRUE); MemoryFree(gUnknown_203B2CC); gUnknown_203B2CC = NULL; } } -NAKED +NAKED // sub_80095E4 memes void sub_802B880(void) { asm_unified( @@ -381,7 +381,7 @@ u32 sub_802B9FC(u8 mailIndex) gUnknown_203B2D4->unk28[2] = gUnknown_80DFC18; gUnknown_203B2D4->unk28[3] = gUnknown_80DFC18; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2D4->unk28, 1, 1); + sub_800641C(gUnknown_203B2D4->unk28, TRUE, TRUE); gUnknown_203B2D4->unk8 = 0; sub_802BCC4(); sub_802BC7C(); @@ -413,7 +413,7 @@ void sub_802BACC(void) if (gUnknown_203B2D4 != NULL) { gUnknown_203B2D4->unk28[gUnknown_203B2D4->unk24] = gUnknown_80DFC18; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2D4->unk28, 1, 1); + sub_800641C(gUnknown_203B2D4->unk28, TRUE, TRUE); MemoryFree(gUnknown_203B2D4); gUnknown_203B2D4 = NULL; } @@ -521,7 +521,7 @@ void sub_802BCC4(void) } } -u32 sub_802BD14(s32 param_1, struct UnkTextStruct2_sub *param_2, u32 param_3) +u32 sub_802BD14(s32 param_1, UnkTextStruct2_sub *param_2, u32 param_3) { if (HasNoMailinMailbox()) return 0; @@ -540,7 +540,7 @@ u32 sub_802BD14(s32 param_1, struct UnkTextStruct2_sub *param_2, u32 param_3) sub_8012D34(gUnknown_203B2D8->unk3C,param_3); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2D8->unk40,1,1); + sub_800641C(gUnknown_203B2D8->unk40, TRUE, TRUE); sub_8013848(&gUnknown_203B2D8->input,CountEmptyMailSlots(),param_3,param_1); gUnknown_203B2D8->input.menuIndex = gUnknown_203B2DC; sub_8013984(&gUnknown_203B2D8->input); @@ -585,7 +585,7 @@ u8 sub_802BE74(void) void sub_802BE94(u8 r0) { ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2D8->unk40, 0, 0); + sub_800641C(gUnknown_203B2D8->unk40, FALSE, FALSE); gUnknown_203B2D8->input.unk22 = CountEmptyMailSlots(); sub_8013984(&gUnknown_203B2D8->input); @@ -602,7 +602,7 @@ void sub_802BEDC(void) gUnknown_203B2DC = gUnknown_203B2D8->input.menuIndex; gUnknown_203B2D8->unk40[gUnknown_203B2D8->unk38] = gUnknown_80DFC5C; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2D8->unk40, 1, 1); + sub_800641C(gUnknown_203B2D8->unk40, TRUE, TRUE); MemoryFree(gUnknown_203B2D8); gUnknown_203B2D8 = NULL; } diff --git a/src/position_util.c b/src/position_util.c index 09473d33d..07fe6fb7e 100644 --- a/src/position_util.c +++ b/src/position_util.c @@ -9,7 +9,7 @@ const s32 gFacingDirMapping[3][3] = { {DIRECTION_SOUTHWEST, DIRECTION_SOUTH, DIRECTION_SOUTHEAST} }; -s32 GetDirectionTowardsPosition(struct Position *originPos, struct Position *targetPos) +s32 GetDirectionTowardsPosition(Position *originPos, Position *targetPos) { s32 direction; s32 yDiff; @@ -44,7 +44,7 @@ s32 GetDirectionTowardsPosition(struct Position *originPos, struct Position *tar return direction; } -s32 GetDistance(struct Position *pos1, struct Position *pos2) +s32 GetDistance(Position *pos1, Position *pos2) { s32 distanceX = pos1->x - pos2->x; s32 distance; diff --git a/src/post_office_guide.c b/src/post_office_guide.c deleted file mode 100644 index 95e6015b8..000000000 --- a/src/post_office_guide.c +++ /dev/null @@ -1,676 +0,0 @@ -#include "global.h" -#include "pokemon.h" -#include "constants/mailbox.h" -#include "memory.h" -#include "text1.h" -#include "text2.h" -#include "wonder_mail.h" -#include "code_800D090.h" -#include "code_8094F88.h" -#include "menu_input.h" -#include "code_80130A8.h" -#include "code_80118A4.h" - -struct PostOfficeHelper -{ - // size: 0x18 - u8 state; - s32 currMenuChoice; - struct OpenedFile *faceFile; - u8 *faceData; - u16 unk10; - u16 unk12; - u8 unk14; - u8 unk15; - u8 unk16; -}; - -EWRAM_DATA_2 struct PostOfficeHelper *gPostOfficeHelper = {0}; - - -struct unkStruct_203B330 -{ - // size: 0x78 - struct MenuInputStructSub input; - u8 unkC; - u8 dungeonIndex; - u8 fillE[2]; - u32 unk10; - struct UnkTextStruct2 *unk14; - struct UnkTextStruct2 unk18[4]; -}; -EWRAM_DATA_2 struct unkStruct_203B330 *gUnknown_203B330 = {0}; - - -extern const char GetHelp_Text[]; -extern const char GoRescue_Text[]; -extern const char FriendRescueInfo_Text[]; -extern const char FriendRescue_80E0A80[]; -extern const char Delivery_Text[]; -extern const char BulletinBoard_Text[]; -extern const char PostOffice_Text[]; - -enum PostOfficeStates -{ - EXIT_POST_OFFICE_MENU, - IM_GUIDE_START_MENU, - ANYTHING_ELSE_START_MENU, - RETURN_TO_START_MENU, - DISPLAY_FRIEND_RESCUE_MENU, - RETURN_TO_FRIEND_RESCUE, - DISPLAY_GO_RESCUE_MENU, - RETURN_TO_GO_RESCUE, - DISPLAY_GET_HELP_MENU, - RETURN_TO_GET_HELP, -}; - -enum PostOfficeMenuActions -{ - POST_OFFICE, - BULLETIN_BOARD, - DELIVERY, - FRIEND_RESCUE, - CANCEL, - EXIT, - FRIEND_RESCUE_INFO, - GO_RESCUE, - GET_HELP_MENU, - DELETING_MAIL, - RESCUE_PROCEDURES, - RECEIVE_SOS_MAIL, - LEAVE_FOR_RESCUE, - SEND_AOK_MAIL, - GET_THANK_YOU_MAIL, - GETTING_HELP, - SEND_SOS_MAIL, - RECEIVE_AOK_MAIL, - SEND_THANK_YOU_MAIL -}; - -const struct MenuItem gPostOfficeHelpStartMenu[] = -{ - {PostOffice_Text, POST_OFFICE}, - {BulletinBoard_Text, BULLETIN_BOARD}, - {Delivery_Text, DELIVERY}, - {FriendRescue_80E0A80, FRIEND_RESCUE}, - {"Cancel", CANCEL}, - {NULL, EXIT} -}; - -ALIGNED(4) const char FriendRescue_80E0A80[] = _("{COLOR_1 YELLOW}Friend Rescue{END_COLOR_TEXT_1} "); -ALIGNED(4) const char Delivery_Text[] = _("Delivery"); -ALIGNED(4) const char BulletinBoard_Text[] = _("Bulletin Board"); -ALIGNED(4) const char PostOffice_Text[] = _("Post Office"); - -const struct MenuItem gPostOfficeHelpFriendRescueMenu[] = -{ - {FriendRescueInfo_Text, FRIEND_RESCUE_INFO}, - {GoRescue_Text, GO_RESCUE}, - {GetHelp_Text, GET_HELP_MENU}, - {"Deleting Mail Info", DELETING_MAIL}, - {"Exit", EXIT}, - {NULL, EXIT} -}; - -ALIGNED(4) const char GetHelp_Text[] = _("{COLOR_1 YELLOW}Get help{END_COLOR_TEXT_1} "); -ALIGNED(4) const char GoRescue_Text[] = _("{COLOR_1 YELLOW}Go rescue{END_COLOR_TEXT_1} "); -ALIGNED(4) const char FriendRescueInfo_Text[] = _("Friend Rescue Info"); - - -const struct MenuItem gPostOfficeHelpGoRescueMenu[] = -{ - {"Rescue Procedures", RESCUE_PROCEDURES}, - {"Receive SOS Mail", RECEIVE_SOS_MAIL}, - {"Leave for Rescue", LEAVE_FOR_RESCUE}, - {"Send A-OK Mail", SEND_AOK_MAIL}, - {"Get Thank-You Mail", GET_THANK_YOU_MAIL}, - {"Exit", EXIT}, - {NULL, EXIT} -}; - -const struct MenuItem gPostOfficeHelpGetHelpMenu[] = -{ - {"Getting Help", GETTING_HELP}, - {"Send SOS Mail", SEND_SOS_MAIL}, - {"Receive A-OK Mail", RECEIVE_AOK_MAIL}, - {"Send Thank-You Mail", SEND_THANK_YOU_MAIL}, - {"Exit", EXIT}, - {NULL, EXIT} -}; - -#include "data/pelipper_help_guide_dialogue.h" - -ALIGNED(4) const u8 wonder_mail_fill[] = _("pksdir0"); - -const struct UnkTextStruct2 gUnknown_80E1EFC = -{ - 0, 0, 0, 0, - 3, - 0, 0, - 0, 0, - 0, 0, - NULL -}; - -const u8 gUnkData_80E1F14[] = {1, 0, 8, 0}; - -const struct UnkTextStruct2 gUnknown_80E1F18 = -{ - 0, 0, 0, 0, - 6, - 2, 2, - 0x14, 4, - 4, 0, - gUnkData_80E1F14 -}; - -ALIGNED(4) const u8 gUnknown_80E1F30[] = "Objectives"; -ALIGNED(4) const u8 gUnknown_80E1F3C[] = "%dF"; -ALIGNED(4) const u8 gUnknown_80E1F40[] = _(" Rescue {COLOR_1 YELLOW}%s{END_COLOR_TEXT_1}"); -ALIGNED(4) const u8 gUnknown_80E1F54[] = "Just go!"; -ALIGNED(4) const u8 gUnknown_80E1F60[] = _(" Bring {COLOR_1 GREEN}%s{END_COLOR_TEXT_1}"); -ALIGNED(4) const u8 gUnknown_80E1F70[] = _(" Find {COLOR_1 GREEN}%s{END_COLOR_TEXT_1}"); -ALIGNED(4) const u8 gUnknown_80E1F80[] = _(" Escort to {COLOR_1 YELLOW}%s{END_COLOR_TEXT_1}"); -ALIGNED(4) const u8 gUnknown_80E1F94[] = _("{COLOR_1 RED_2}???{END_COLOR_TEXT_1}"); -ALIGNED(4) static const u8 post_office_fill[] = "pksdir0"; - -extern u8 gUnknown_202DE58[]; -extern u8 gUnknown_202E5D8[]; -extern u8 gAvailablePokemonNames[]; - -extern void sub_8031A84(); -extern void DisplayMissionObjectives(); -extern u8 *GetCurrentMissionText(s16 r0); -extern u8 *sub_80975DC(u32 r0); -extern u8 sub_8099360(u8 *); -extern u8 sub_8099394(volatile u8 *); -extern struct WonderMail *GetJobSlotInfo(u8); -extern void sub_803B6B0(u32, u32, u32, u32); -extern s16 sub_80A2688(u8 r0); -extern u8 sub_80992E0(s16 *, s16 *); - -extern void sub_8031A2C(void); - -void UpdateHelperPelipperState(u8); -void HandlePostOfficeHelpStartMenuSelection(); -void ReturnToPostOfficeStartMenu(); -extern void HandlePostOfficeHelpFriendRescueMenuSelection(); -extern void ReturnToFriendRescueMenu(); -extern void HandlePostOfficeHelpGoRescueMenuSelection(); -extern void ReturntoGoRescueMenu(); -extern void HandlePostOfficeHelpGetHelpMenuSelection(); -extern void ReturnToGetHelpMenu(); -extern s32 CountJobsinDungeon(u8); - -u32 CreateHelperPelipperMenu(s16 speciesID) -{ - char *monName; - struct OpenedFile *faceFile; - int species_32; - - species_32 = speciesID; - ResetUnusedInputStruct(); - sub_800641C(0,1,1); - gPostOfficeHelper = MemoryAlloc(sizeof(struct PostOfficeHelper), 8); - CopyYellowMonsterNametoBuffer(gUnknown_202E5D8, speciesID); - monName = GetMonSpecies(speciesID); - strcpy(gAvailablePokemonNames, monName); - gPostOfficeHelper->faceFile = NULL; - gPostOfficeHelper->faceData = NULL; - if (speciesID != MONSTER_NONE) { - faceFile = GetDialogueSpriteDataPtr(species_32); - gPostOfficeHelper->faceFile = faceFile; - gPostOfficeHelper->unk14 = 0; - gPostOfficeHelper->unk15 = 0; - gPostOfficeHelper->unk16 = 0; - gPostOfficeHelper->unk10 = 2; - gPostOfficeHelper->unk12 = 8; - if (gPostOfficeHelper->faceFile != NULL) { - gPostOfficeHelper->faceData = gPostOfficeHelper->faceFile->data; - } - } - gPostOfficeHelper->currMenuChoice = 0; - UpdateHelperPelipperState(IM_GUIDE_START_MENU); - return 1; -} - - -u32 HelperPelipperCallback(void) -{ - switch(gPostOfficeHelper->state) { - case IM_GUIDE_START_MENU: - case ANYTHING_ELSE_START_MENU: - HandlePostOfficeHelpStartMenuSelection(); - break; - case RETURN_TO_START_MENU: - ReturnToPostOfficeStartMenu(); - break; - case DISPLAY_FRIEND_RESCUE_MENU: - HandlePostOfficeHelpFriendRescueMenuSelection(); - break; - case RETURN_TO_FRIEND_RESCUE: - ReturnToFriendRescueMenu(); - break; - case DISPLAY_GO_RESCUE_MENU: - HandlePostOfficeHelpGoRescueMenuSelection(); - break; - case RETURN_TO_GO_RESCUE: - ReturntoGoRescueMenu(); - break; - case EXIT_POST_OFFICE_MENU: - return 3; - case DISPLAY_GET_HELP_MENU: - HandlePostOfficeHelpGetHelpMenuSelection(); - break; - case RETURN_TO_GET_HELP: - ReturnToGetHelpMenu(); - break; - } - return 0; -} - -void CleanHelperPelipper(void) -{ - if(gPostOfficeHelper != NULL) - { - if(gPostOfficeHelper->faceFile != NULL) - CloseFile(gPostOfficeHelper->faceFile); - MemoryFree(gPostOfficeHelper); - gPostOfficeHelper = NULL; - } -} - -void nullsub_39(void) -{ -} - -void UpdateHelperPelipperText(void) -{ - struct OpenedFile **faceFile; - faceFile = NULL; - if(gPostOfficeHelper->faceFile != NULL) - faceFile = &gPostOfficeHelper->faceFile; - - switch(gPostOfficeHelper->state) - { - case DISPLAY_GET_HELP_MENU: - sub_8014248(gWhatdYouWantToKnow, 0, gPostOfficeHelper->currMenuChoice, gPostOfficeHelpGetHelpMenu, 0, 4, 0, faceFile, 0xC); - break; - case RETURN_TO_GET_HELP: - switch(gPostOfficeHelper->currMenuChoice) - { - case GETTING_HELP: - sub_80141B4(gGettingHelpExplanation, 0, faceFile, 0x10d); - break; - case SEND_SOS_MAIL: - sub_80141B4(gSendSOSMailExplanation, 0, faceFile, 0x10d); - break; - case RECEIVE_AOK_MAIL: - sub_80141B4(gReceiveAOKMailExplanation, 0, faceFile, 0x10d); - break; - case SEND_THANK_YOU_MAIL: - sub_80141B4(gSendThankYouMailExplanation, 0, faceFile, 0x10d); - break; - default: - break; - } - break; - case DISPLAY_GO_RESCUE_MENU: - sub_8014248(gWhatdYouWantToKnow, 0, gPostOfficeHelper->currMenuChoice, gPostOfficeHelpGoRescueMenu, 0, 4, 0, faceFile, 0xC); - break; - case RETURN_TO_GO_RESCUE: - switch(gPostOfficeHelper->currMenuChoice) - { - case RESCUE_PROCEDURES: - sub_80141B4(gRescueProceduresExplanation, 0, faceFile, 0x10d); - break; - case RECEIVE_SOS_MAIL: - sub_80141B4(gReceiveSOSMailExplanation, 0, faceFile, 0x10d); - break; - case SEND_AOK_MAIL: - sub_80141B4(gSendAOKMailExplanation, 0, faceFile, 0x10d); - break; - case LEAVE_FOR_RESCUE: - sub_80141B4(gLeaveForRescueExplanation, 0, faceFile, 0x10d); - break; - case GET_THANK_YOU_MAIL: - sub_80141B4(gGetThankYouMailExplanation, 0, faceFile, 0x10d); - break; - default: - break; - } - break; - case IM_GUIDE_START_MENU: - sub_8014248(gImYourGuide, 0, gPostOfficeHelper->currMenuChoice, gPostOfficeHelpStartMenu, 0, 4, 0, faceFile, 0xC); - break; - case ANYTHING_ELSE_START_MENU: - sub_8014248(gAnythingElse, 0, gPostOfficeHelper->currMenuChoice, gPostOfficeHelpStartMenu, 0, 4, 0, faceFile, 0xC); - break; - case RETURN_TO_START_MENU: - switch(gPostOfficeHelper->currMenuChoice) - { - case POST_OFFICE: - sub_80141B4(gPostOfficeExplanation, 0, faceFile, 0x10d); - break; - case BULLETIN_BOARD: - sub_80141B4(gBulletinBoardExplanation, 0, faceFile, 0x10d); - break; - case DELIVERY: - sub_80141B4(gDeliveryExplanation, 0, faceFile, 0x10d); - break; - default: - break; - } - break; - case DISPLAY_FRIEND_RESCUE_MENU: - sub_8014248(gWhatdYouWantToKnow, 0, gPostOfficeHelper->currMenuChoice, gPostOfficeHelpFriendRescueMenu, 0, 4, 0, faceFile, 0xC); - break; - case RETURN_TO_FRIEND_RESCUE: - switch(gPostOfficeHelper->currMenuChoice) - { - case FRIEND_RESCUE_INFO: - sub_80141B4(gFriendRescueExplanation, 0, faceFile, 0x10d); - break; - case DELETING_MAIL: - sub_80141B4(gDeletingMailExplanation, 0, faceFile, 0x10d); - break; - default: - break; - } - break; - default: - break; - } -} - -void UpdateHelperPelipperState(u8 newState) -{ - gPostOfficeHelper->state = newState; - nullsub_39(); - UpdateHelperPelipperText(); -} - -void HandlePostOfficeHelpStartMenuSelection(void) -{ - s32 chosenAction; - if(sub_80144A4(&chosenAction) == 0) - { - switch(chosenAction) - { - case CANCEL: - case EXIT: - UpdateHelperPelipperState(EXIT_POST_OFFICE_MENU); - break; - case FRIEND_RESCUE: - gPostOfficeHelper->currMenuChoice = chosenAction; - UpdateHelperPelipperState(DISPLAY_FRIEND_RESCUE_MENU); - break; - case POST_OFFICE: - case BULLETIN_BOARD: - case DELIVERY: - gPostOfficeHelper->currMenuChoice = chosenAction; - UpdateHelperPelipperState(RETURN_TO_START_MENU); - break; - } - } -} - -void ReturnToPostOfficeStartMenu(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - UpdateHelperPelipperState(ANYTHING_ELSE_START_MENU); - } -} - -void HandlePostOfficeHelpFriendRescueMenuSelection(void) -{ - s32 chosenAction; - if(sub_80144A4(&chosenAction) == 0) - { - switch(chosenAction) - { - case EXIT: - UpdateHelperPelipperState(ANYTHING_ELSE_START_MENU); - break; - case GO_RESCUE: - UpdateHelperPelipperState(DISPLAY_GO_RESCUE_MENU); - break; - case GET_HELP_MENU: - UpdateHelperPelipperState(DISPLAY_GET_HELP_MENU); - break; - case FRIEND_RESCUE_INFO: - case DELETING_MAIL: - gPostOfficeHelper->currMenuChoice = chosenAction; - UpdateHelperPelipperState(RETURN_TO_FRIEND_RESCUE); - break; - } - } -} - -void ReturnToFriendRescueMenu(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - UpdateHelperPelipperState(DISPLAY_FRIEND_RESCUE_MENU); - } -} - -void HandlePostOfficeHelpGoRescueMenuSelection(void) -{ - s32 chosenAction; - if(sub_80144A4(&chosenAction) == 0) - { - switch(chosenAction) - { - case EXIT: - UpdateHelperPelipperState(DISPLAY_FRIEND_RESCUE_MENU); - break; - case RESCUE_PROCEDURES: - case RECEIVE_SOS_MAIL: - case LEAVE_FOR_RESCUE: - case SEND_AOK_MAIL: - case GET_THANK_YOU_MAIL: - gPostOfficeHelper->currMenuChoice = chosenAction; - UpdateHelperPelipperState(RETURN_TO_GO_RESCUE); - break; - } - } -} - -void ReturntoGoRescueMenu(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - UpdateHelperPelipperState(DISPLAY_GO_RESCUE_MENU); - } -} - -void HandlePostOfficeHelpGetHelpMenuSelection(void) -{ - s32 chosenAction; - if(sub_80144A4(&chosenAction) == 0) - { - switch(chosenAction) - { - case EXIT: - UpdateHelperPelipperState(DISPLAY_FRIEND_RESCUE_MENU); - break; - case GETTING_HELP: - case SEND_SOS_MAIL: - case RECEIVE_AOK_MAIL: - case SEND_THANK_YOU_MAIL: - gPostOfficeHelper->currMenuChoice = chosenAction; - UpdateHelperPelipperState(RETURN_TO_GET_HELP); - break; - } - } -} - -void ReturnToGetHelpMenu(void) -{ - s32 temp; - if(sub_80144A4(&temp) == 0) - { - UpdateHelperPelipperState(DISPLAY_GET_HELP_MENU); - } -} - -u32 sub_80319A4(u8 param_1,u8 dungeon,int param_3) -{ - - gUnknown_203B330 = MemoryAlloc(sizeof(struct unkStruct_203B330),8); - gUnknown_203B330->unkC = param_1; - gUnknown_203B330->dungeonIndex = dungeon; - sub_801317C(&gUnknown_203B330->input); - gUnknown_203B330->unk10 = param_3; - gUnknown_203B330->unk14 = &gUnknown_203B330->unk18[param_3]; - sub_8031A2C(); - return 1; -} - -u32 sub_80319F8(void) -{ - switch(sub_8012A64(&gUnknown_203B330->input, gUnknown_203B330->unk10)) - { - case 2: - PlayMenuSoundEffect(1); - return 2; - case 1: - PlayMenuSoundEffect(0); - return 3; - default: - return 0; - } -} - -void sub_8031A2C(void) -{ - sub_8031A84(); - DisplayMissionObjectives(); -} - -void sub_8031A3C(void) -{ - if(gUnknown_203B330 != NULL) - { - gUnknown_203B330->unk18[gUnknown_203B330->unk10] = gUnknown_80E1EFC; - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B330->unk18, 1, 1); - MemoryFree(gUnknown_203B330); - gUnknown_203B330 = NULL; - } -} - -void sub_8031A84(void) -{ - s32 jobs; - - sub_8006518(gUnknown_203B330->unk18); - gUnknown_203B330->unk18[gUnknown_203B330->unk10] = gUnknown_80E1F18; - if (gUnknown_203B330->unkC == 2) { - jobs = CountJobsinDungeon(gUnknown_203B330->dungeonIndex); - if (jobs == 0) { - jobs = 1; - } - sub_8012D08(gUnknown_203B330->unk14,jobs); - } - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B330->unk18,1,1); -} - -void DisplayMissionObjectives(void) -{ - s32 yCoord; - s32 jobSlotIdx; - struct unkStruct_203B480 *mail; - struct WonderMail *jobInfo; - u8 buffer [100]; - volatile u8 local_94; - u8 buffer1 [100]; - s16 auStack44; - s16 missionIndex; - u8 local_test; - - sub_80073B8(gUnknown_203B330->unk10); - // Objectives - xxx_call_draw_string(10,0,gUnknown_80E1F30,gUnknown_203B330->unk10,0); - switch(gUnknown_203B330->unkC) - { - case 1: - sub_8099394(&local_94); - mail = GetMailatIndex(local_94); - sub_803B6B0(10,16,3,gUnknown_203B330->unk10); - // %dF - sprintfStatic(buffer,gUnknown_80E1F3C,mail->unk4.dungeon.floor); - xxx_call_draw_string(0x15,16,buffer,gUnknown_203B330->unk10,0); - // Rescue #C6%s#R - sprintfStatic(buffer,gUnknown_80E1F40,GetMonSpecies(mail->clientSpecies)); - xxx_call_draw_string(0x28,16,buffer,gUnknown_203B330->unk10,0); - break; - case 2: - if (CountJobsinDungeon(gUnknown_203B330->dungeonIndex) == 0) { - // Just go! - xxx_call_draw_string(10,16,gUnknown_80E1F54,gUnknown_203B330->unk10,0); - } - else - { - yCoord = 16; - - // 8 Job Slots... check each of them - for(jobSlotIdx = 0; jobSlotIdx < MAX_ACCEPTED_JOBS; jobSlotIdx++) - { - jobInfo = GetJobSlotInfo(jobSlotIdx); - if ((((jobInfo->unk4.dungeon.id == gUnknown_203B330->dungeonIndex) && (jobInfo->mailType != 0) - ) && (jobInfo->mailType != MAIL_TYPE_SUSPENDED_JOB)) && (jobInfo->mailType != MAIL_TYPE_UNK7)) { - sub_803B6B0(10,yCoord,3,gUnknown_203B330->unk10); - if (jobInfo->missionType != WONDER_MAIL_MISSION_TYPE_FIND_ITEM) { - sprintfStatic(buffer1,gUnknown_80E1F3C,jobInfo->unk4.dungeon.floor); - xxx_call_draw_string(21,yCoord,buffer1,gUnknown_203B330->unk10,0); - } - switch(jobInfo->missionType) - { - case WONDER_MAIL_MISSION_TYPE_DELIVER_ITEM: - // Bring #C4%s#R - sub_8090DC4(gUnknown_202DE58,jobInfo->targetItem,0); - sprintfStatic(buffer1,gUnknown_80E1F60,gUnknown_202DE58); - xxx_call_draw_string(40,yCoord,buffer1,gUnknown_203B330->unk10,0); - break; - case WONDER_MAIL_MISSION_TYPE_FIND_ITEM: - // Find #C4%s#R - sub_8090DC4(gUnknown_202DE58,jobInfo->targetItem,0); - sprintfStatic(buffer1,gUnknown_80E1F70,gUnknown_202DE58); - xxx_call_draw_string(40,yCoord,buffer1,gUnknown_203B330->unk10,0); - break; - case WONDER_MAIL_MISSION_TYPE_ESCORT_CLIENT: - // Escort to #C6$s#R - sprintfStatic(buffer1,gUnknown_80E1F80,GetMonSpecies(jobInfo->targetSpecies)); - xxx_call_draw_string(40,yCoord,buffer1,gUnknown_203B330->unk10,0); - break; - default: - // Rescue #C6%s#R - sprintfStatic(buffer1,gUnknown_80E1F40,GetMonSpecies(jobInfo->targetSpecies)); - xxx_call_draw_string(40,yCoord,buffer1,gUnknown_203B330->unk10,0); - break; - } - yCoord = yCoord + 12; - } - } - } - break; - case 3: - case 0: - default: - if (sub_80992E0(&auStack44,&missionIndex) != 0) - xxx_call_draw_string(10,16,GetCurrentMissionText(missionIndex),gUnknown_203B330->unk10,0); - else if (sub_8099360(&local_test) != 0) - xxx_call_draw_string(10,16,sub_80975DC(sub_80A2688(local_test)),gUnknown_203B330->unk10,0); - else - xxx_call_draw_string(10,16,gUnknown_80E1F94,gUnknown_203B330->unk10,0); - break; - } - sub_80073E0(gUnknown_203B330->unk10); -} diff --git a/src/post_office_guide1.c b/src/post_office_guide1.c new file mode 100644 index 000000000..5143788f4 --- /dev/null +++ b/src/post_office_guide1.c @@ -0,0 +1,346 @@ +#include "global.h" +#include "code_80130A8.h" +#include "memory.h" +#include "menu.h" +#include "pokemon.h" +#include "post_office_guide1.h" +#include "text1.h" + +enum PostOfficeStates +{ + EXIT_POST_OFFICE_MENU, + IM_GUIDE_START_MENU, + ANYTHING_ELSE_START_MENU, + RETURN_TO_START_MENU, + DISPLAY_FRIEND_RESCUE_MENU, + RETURN_TO_FRIEND_RESCUE, + DISPLAY_GO_RESCUE_MENU, + RETURN_TO_GO_RESCUE, + DISPLAY_GET_HELP_MENU, + RETURN_TO_GET_HELP, +}; + +extern u8 gAvailablePokemonNames[]; // 202DF98 +extern u8 gUnknown_202E5D8[]; + +static EWRAM_DATA_2 PostOfficeWork *sPostOfficeHelper = {0}; + +#include "data/post_office_guide1.h" + +static void HandlePostOfficeHelpFriendRescueMenuSelection(void); +static void HandlePostOfficeHelpGetHelpMenuSelection(void); +static void HandlePostOfficeHelpGoRescueMenuSelection(void); +static void HandlePostOfficeHelpStartMenuSelection(void); +static void ReturnToFriendRescueMenu(void); +static void ReturnToGetHelpMenu(void); +static void ReturntoGoRescueMenu(void); +static void ReturnToPostOfficeStartMenu(void); +static void UpdateHelperPelipperState(u8); + +bool8 CreateHelperPelipperMenu(s16 speciesID) +{ + u8 *monName; + OpenedFile *faceFile; + s32 species_32; + + species_32 = speciesID; + ResetUnusedInputStruct(); + sub_800641C(NULL, TRUE, TRUE); + + sPostOfficeHelper = MemoryAlloc(sizeof(PostOfficeWork), 8); + CopyYellowMonsterNametoBuffer(gUnknown_202E5D8, speciesID); + monName = GetMonSpecies(speciesID); + strcpy(gAvailablePokemonNames, monName); + sPostOfficeHelper->faceFile = NULL; + sPostOfficeHelper->faceData = NULL; + + if (speciesID != MONSTER_NONE) { + faceFile = GetDialogueSpriteDataPtr(species_32); + sPostOfficeHelper->faceFile = faceFile; + sPostOfficeHelper->unk14 = 0; + sPostOfficeHelper->unk15 = 0; + sPostOfficeHelper->unk16 = 0; + sPostOfficeHelper->unk10 = 2; + sPostOfficeHelper->unk12 = 8; + + if (sPostOfficeHelper->faceFile != NULL) + sPostOfficeHelper->faceData = sPostOfficeHelper->faceFile->data; + } + + sPostOfficeHelper->currMenuChoice = 0; + UpdateHelperPelipperState(IM_GUIDE_START_MENU); + return TRUE; +} + +u32 HelperPelipperCallback(void) +{ + switch (sPostOfficeHelper->state) { + case IM_GUIDE_START_MENU: + case ANYTHING_ELSE_START_MENU: + HandlePostOfficeHelpStartMenuSelection(); + break; + case RETURN_TO_START_MENU: + ReturnToPostOfficeStartMenu(); + break; + case DISPLAY_FRIEND_RESCUE_MENU: + HandlePostOfficeHelpFriendRescueMenuSelection(); + break; + case RETURN_TO_FRIEND_RESCUE: + ReturnToFriendRescueMenu(); + break; + case DISPLAY_GO_RESCUE_MENU: + HandlePostOfficeHelpGoRescueMenuSelection(); + break; + case RETURN_TO_GO_RESCUE: + ReturntoGoRescueMenu(); + break; + case EXIT_POST_OFFICE_MENU: + return 3; + case DISPLAY_GET_HELP_MENU: + HandlePostOfficeHelpGetHelpMenuSelection(); + break; + case RETURN_TO_GET_HELP: + ReturnToGetHelpMenu(); + break; + } + return 0; +} + +void CleanHelperPelipper(void) +{ + if (sPostOfficeHelper != NULL) { + if (sPostOfficeHelper->faceFile != NULL) + CloseFile(sPostOfficeHelper->faceFile); + MemoryFree(sPostOfficeHelper); + sPostOfficeHelper = NULL; + } +} + +static void nullsub_39(void) +{ +} + +static void UpdateHelperPelipperText(void) +{ + OpenedFile **faceFile; + faceFile = NULL; + + if (sPostOfficeHelper->faceFile != NULL) + faceFile = &sPostOfficeHelper->faceFile; + + switch (sPostOfficeHelper->state) { + case DISPLAY_GET_HELP_MENU: + sub_8014248(sWhatdYouWantToKnow, 0, sPostOfficeHelper->currMenuChoice, sPostOfficeHelpGetHelpMenu, 0, 4, 0, faceFile, 12); + break; + case RETURN_TO_GET_HELP: + switch (sPostOfficeHelper->currMenuChoice) { + case GETTING_HELP: + sub_80141B4(sGettingHelpExplanation, 0, faceFile, 0x10d); + break; + case SEND_SOS_MAIL: + sub_80141B4(sSendSOSMailExplanation, 0, faceFile, 0x10d); + break; + case RECEIVE_AOK_MAIL: + sub_80141B4(sReceiveAOKMailExplanation, 0, faceFile, 0x10d); + break; + case SEND_THANK_YOU_MAIL: + sub_80141B4(sSendThankYouMailExplanation, 0, faceFile, 0x10d); + break; + default: + break; + } + break; + case DISPLAY_GO_RESCUE_MENU: + sub_8014248(sWhatdYouWantToKnow, 0, sPostOfficeHelper->currMenuChoice, sPostOfficeHelpGoRescueMenu, 0, 4, 0, faceFile, 12); + break; + case RETURN_TO_GO_RESCUE: + switch (sPostOfficeHelper->currMenuChoice) { + case RESCUE_PROCEDURES: + sub_80141B4(sRescueProceduresExplanation, 0, faceFile, 0x10d); + break; + case RECEIVE_SOS_MAIL: + sub_80141B4(sReceiveSOSMailExplanation, 0, faceFile, 0x10d); + break; + case SEND_AOK_MAIL: + sub_80141B4(sSendAOKMailExplanation, 0, faceFile, 0x10d); + break; + case LEAVE_FOR_RESCUE: + sub_80141B4(sLeaveForRescueExplanation, 0, faceFile, 0x10d); + break; + case GET_THANK_YOU_MAIL: + sub_80141B4(sGetThankYouMailExplanation, 0, faceFile, 0x10d); + break; + default: + break; + } + break; + case IM_GUIDE_START_MENU: + sub_8014248(sImYourGuide, 0, sPostOfficeHelper->currMenuChoice, sPostOfficeHelpStartMenu, 0, 4, 0, faceFile, 12); + break; + case ANYTHING_ELSE_START_MENU: + sub_8014248(sAnythingElse, 0, sPostOfficeHelper->currMenuChoice, sPostOfficeHelpStartMenu, 0, 4, 0, faceFile, 12); + break; + case RETURN_TO_START_MENU: + switch (sPostOfficeHelper->currMenuChoice) { + case POST_OFFICE: + sub_80141B4(sPostOfficeExplanation, 0, faceFile, 0x10d); + break; + case BULLETIN_BOARD: + sub_80141B4(sBulletinBoardExplanation, 0, faceFile, 0x10d); + break; + case DELIVERY: + sub_80141B4(sDeliveryExplanation, 0, faceFile, 0x10d); + break; + default: + break; + } + break; + case DISPLAY_FRIEND_RESCUE_MENU: + sub_8014248(sWhatdYouWantToKnow, 0, sPostOfficeHelper->currMenuChoice, gPostOfficeHelpFriendRescueMenu, 0, 4, 0, faceFile, 12); + break; + case RETURN_TO_FRIEND_RESCUE: + switch (sPostOfficeHelper->currMenuChoice) { + case FRIEND_RESCUE_INFO: + sub_80141B4(sFriendRescueExplanation, 0, faceFile, 0x10d); + break; + case DELETING_MAIL: + sub_80141B4(sDeletingMailExplanation, 0, faceFile, 0x10d); + break; + default: + break; + } + break; + default: + break; + } +} + +static void UpdateHelperPelipperState(u8 newState) +{ + sPostOfficeHelper->state = newState; + nullsub_39(); + UpdateHelperPelipperText(); +} + +static void HandlePostOfficeHelpStartMenuSelection(void) +{ + s32 chosenAction; + + if (sub_80144A4(&chosenAction) == 0) { + switch (chosenAction) { + case CANCEL: + case EXIT: + UpdateHelperPelipperState(EXIT_POST_OFFICE_MENU); + break; + case FRIEND_RESCUE: + sPostOfficeHelper->currMenuChoice = chosenAction; + UpdateHelperPelipperState(DISPLAY_FRIEND_RESCUE_MENU); + break; + case POST_OFFICE: + case BULLETIN_BOARD: + case DELIVERY: + sPostOfficeHelper->currMenuChoice = chosenAction; + UpdateHelperPelipperState(RETURN_TO_START_MENU); + break; + } + } +} + +static void ReturnToPostOfficeStartMenu(void) +{ + s32 temp; + + if (sub_80144A4(&temp) == 0) + UpdateHelperPelipperState(ANYTHING_ELSE_START_MENU); +} + +static void HandlePostOfficeHelpFriendRescueMenuSelection(void) +{ + s32 chosenAction; + + if (sub_80144A4(&chosenAction) == 0) { + switch (chosenAction) { + case EXIT: + UpdateHelperPelipperState(ANYTHING_ELSE_START_MENU); + break; + case GO_RESCUE: + UpdateHelperPelipperState(DISPLAY_GO_RESCUE_MENU); + break; + case GET_HELP_MENU: + UpdateHelperPelipperState(DISPLAY_GET_HELP_MENU); + break; + case FRIEND_RESCUE_INFO: + case DELETING_MAIL: + sPostOfficeHelper->currMenuChoice = chosenAction; + UpdateHelperPelipperState(RETURN_TO_FRIEND_RESCUE); + break; + } + } +} + +static void ReturnToFriendRescueMenu(void) +{ + s32 temp; + + if (sub_80144A4(&temp) == 0) + UpdateHelperPelipperState(DISPLAY_FRIEND_RESCUE_MENU); +} + +static void HandlePostOfficeHelpGoRescueMenuSelection(void) +{ + s32 chosenAction; + + if (sub_80144A4(&chosenAction) != 0) + return; + + switch (chosenAction) { + case EXIT: + UpdateHelperPelipperState(DISPLAY_FRIEND_RESCUE_MENU); + break; + case RESCUE_PROCEDURES: + case RECEIVE_SOS_MAIL: + case LEAVE_FOR_RESCUE: + case SEND_AOK_MAIL: + case GET_THANK_YOU_MAIL: + sPostOfficeHelper->currMenuChoice = chosenAction; + UpdateHelperPelipperState(RETURN_TO_GO_RESCUE); + break; + } +} + +static void ReturntoGoRescueMenu(void) +{ + s32 temp; + + if (sub_80144A4(&temp) == 0) + UpdateHelperPelipperState(DISPLAY_GO_RESCUE_MENU); +} + +static void HandlePostOfficeHelpGetHelpMenuSelection(void) +{ + s32 chosenAction; + + if (sub_80144A4(&chosenAction) != 0) + return; + + switch (chosenAction) { + case EXIT: + UpdateHelperPelipperState(DISPLAY_FRIEND_RESCUE_MENU); + break; + case GETTING_HELP: + case SEND_SOS_MAIL: + case RECEIVE_AOK_MAIL: + case SEND_THANK_YOU_MAIL: + sPostOfficeHelper->currMenuChoice = chosenAction; + UpdateHelperPelipperState(RETURN_TO_GET_HELP); + break; + } +} + +static void ReturnToGetHelpMenu(void) +{ + s32 temp; + + if (sub_80144A4(&temp) == 0) + UpdateHelperPelipperState(DISPLAY_GET_HELP_MENU); +} \ No newline at end of file diff --git a/src/post_office_guide2.c b/src/post_office_guide2.c new file mode 100644 index 000000000..6a9f8b34c --- /dev/null +++ b/src/post_office_guide2.c @@ -0,0 +1,186 @@ +#include "global.h" +#include "code_800D090.h" +#include "code_80118A4.h" +#include "code_803B050.h" +#include "code_8094F88.h" +#include "code_80958E8_1.h" +#include "code_80972F4.h" +#include "code_80A26CC.h" +#include "constants/mailbox.h" +#include "constants/wonder_mail.h" +#include "items.h" +#include "memory.h" +#include "menu_input.h" +#include "post_office_guide2.h" +#include "text1.h" +#include "text2.h" +#include "wonder_mail.h" + +extern u8 gUnknown_202DE58[]; + +static EWRAM_DATA_2 unkStruct_203B330 *sUnknown_203B330 = {0}; + +#include "data/post_office_guide2.h" + +// code_8098BDC.s +extern u8 sub_80992E0(s16 *, s16 *); +extern u8 sub_8099360(u8 *); +extern u8 sub_8099394(volatile u8 *); + +static void DisplayMissionObjectives(void); + +static void sub_8031A2C(void); +static void sub_8031A84(void); + +bool8 sub_80319A4(u8 param_1, u8 dungeon, s32 param_3) +{ + sUnknown_203B330 = MemoryAlloc(sizeof(unkStruct_203B330), 8); + sUnknown_203B330->unkC = param_1; + sUnknown_203B330->dungeonIndex = dungeon; + sub_801317C(&sUnknown_203B330->input); + sUnknown_203B330->unk10 = param_3; + sUnknown_203B330->unk14 = &sUnknown_203B330->unk18[param_3]; + sub_8031A2C(); + return TRUE; +} + +u32 sub_80319F8(void) +{ + switch (sub_8012A64(&sUnknown_203B330->input, sUnknown_203B330->unk10)) { + case 2: + PlayMenuSoundEffect(1); + return 2; + case 1: + PlayMenuSoundEffect(0); + return 3; + default: + return 0; + } +} + +static void sub_8031A2C(void) +{ + sub_8031A84(); + DisplayMissionObjectives(); +} + +void sub_8031A3C(void) +{ + if (sUnknown_203B330 != NULL) { + sUnknown_203B330->unk18[sUnknown_203B330->unk10] = sUnknown_80E1EFC; + ResetUnusedInputStruct(); + sub_800641C(sUnknown_203B330->unk18, TRUE, TRUE); + MemoryFree(sUnknown_203B330); + sUnknown_203B330 = NULL; + } +} + +static void sub_8031A84(void) +{ + s32 jobs; + + sub_8006518(sUnknown_203B330->unk18); + sUnknown_203B330->unk18[sUnknown_203B330->unk10] = sUnknown_80E1F18; + + if (sUnknown_203B330->unkC == 2) { + jobs = CountJobsinDungeon(sUnknown_203B330->dungeonIndex); + if (jobs == 0) + jobs = 1; + + sub_8012D08(sUnknown_203B330->unk14, jobs); + } + + ResetUnusedInputStruct(); + sub_800641C(sUnknown_203B330->unk18, TRUE, TRUE); +} + +static void DisplayMissionObjectives(void) +{ + s32 yCoord; + s32 jobSlotIdx; + unkStruct_203B480 *mail; + WonderMail *jobInfo; + u8 buffer[100]; + volatile u8 local_94; + u8 buffer1[100]; + s16 auStack44; + s16 missionIndex; + u8 local_test; + + sub_80073B8(sUnknown_203B330->unk10); + // Objectives + xxx_call_draw_string(10, 0, sObjectives, sUnknown_203B330->unk10, 0); + + switch (sUnknown_203B330->unkC) { + case 1: + sub_8099394(&local_94); + mail = GetMailatIndex(local_94); + sub_803B6B0(10, 16, 3, sUnknown_203B330->unk10); + // %dF + sprintfStatic(buffer,sFmt1,mail->unk4.dungeon.floor); + xxx_call_draw_string(21,16,buffer,sUnknown_203B330->unk10,0); + // Rescue #C6%s#R + sprintfStatic(buffer,sFmtRescue,GetMonSpecies(mail->clientSpecies)); + xxx_call_draw_string(40, 16, buffer, sUnknown_203B330->unk10, 0); + break; + case 2: + if (CountJobsinDungeon(sUnknown_203B330->dungeonIndex) == 0) + xxx_call_draw_string(10, 16, sJustGo, sUnknown_203B330->unk10, 0); + else { + yCoord = 16; + + // 8 Job Slots... check each of them + for (jobSlotIdx = 0; jobSlotIdx < MAX_ACCEPTED_JOBS; jobSlotIdx++) { + jobInfo = GetJobSlotInfo(jobSlotIdx); + + if (jobInfo->unk4.dungeon.id == sUnknown_203B330->dungeonIndex + && jobInfo->mailType != 0 + && jobInfo->mailType != MAIL_TYPE_SUSPENDED_JOB + && jobInfo->mailType != MAIL_TYPE_UNK7) { + sub_803B6B0(10, yCoord, 3, sUnknown_203B330->unk10); + + if (jobInfo->missionType != WONDER_MAIL_MISSION_TYPE_FIND_ITEM) { + sprintfStatic(buffer1, sFmt1, jobInfo->unk4.dungeon.floor); + xxx_call_draw_string(21, yCoord, buffer1, sUnknown_203B330->unk10, 0); + } + + switch (jobInfo->missionType) { + case WONDER_MAIL_MISSION_TYPE_DELIVER_ITEM: + BufferItemName(gUnknown_202DE58, jobInfo->targetItem, NULL); + sprintfStatic(buffer1, sFmtBring, gUnknown_202DE58); + xxx_call_draw_string(40, yCoord, buffer1, sUnknown_203B330->unk10, 0); + break; + case WONDER_MAIL_MISSION_TYPE_FIND_ITEM: + BufferItemName(gUnknown_202DE58, jobInfo->targetItem, NULL); + sprintfStatic(buffer1, sFmtFind, gUnknown_202DE58); + xxx_call_draw_string(40, yCoord, buffer1, sUnknown_203B330->unk10, 0); + break; + case WONDER_MAIL_MISSION_TYPE_ESCORT_CLIENT: + sprintfStatic(buffer1, sFmtEscort, GetMonSpecies(jobInfo->targetSpecies)); + xxx_call_draw_string(40, yCoord, buffer1, sUnknown_203B330->unk10, 0); + break; + default: + sprintfStatic(buffer1, sFmtRescue, GetMonSpecies(jobInfo->targetSpecies)); + xxx_call_draw_string(40, yCoord, buffer1, sUnknown_203B330->unk10, 0); + break; + } + + yCoord += 12; + } + } + } + break; + case 3: + case 0: + default: + if (sub_80992E0(&auStack44, &missionIndex) != 0) + xxx_call_draw_string(10, 16, GetCurrentMissionText(missionIndex), sUnknown_203B330->unk10, 0); + else if (sub_8099360(&local_test) != 0) + xxx_call_draw_string(10, 16, sub_80975DC(sub_80A2688(local_test)), sUnknown_203B330->unk10, 0); + else + xxx_call_draw_string(10, 16, sRedQuestionMarks, sUnknown_203B330->unk10, 0); + break; + } + + sub_80073E0(sUnknown_203B330->unk10); +} \ No newline at end of file diff --git a/src/quick_save_read.c b/src/quick_save_read.c new file mode 100644 index 000000000..39c0a4fd1 --- /dev/null +++ b/src/quick_save_read.c @@ -0,0 +1,64 @@ +#include "global.h" +#include "code_80130A8.h" +#include "memory.h" +#include "quick_save_read.h" +#include "save.h" + +static EWRAM_DATA_2 QuickSaveRead *sQuickSaveRead = {0}; + +#include "data/quick_save_read.h" + +void PrepareQuickSaveRead(u8 *dest, u32 size) +{ + sQuickSaveRead = MemoryAlloc(sizeof(QuickSaveRead), 5); + sQuickSaveRead->dest = dest; + sQuickSaveRead->size = size; + sQuickSaveRead->saveValid = FALSE; + sQuickSaveRead->state = 1; +} + +bool8 ReadQuickSave(void) +{ + u32 stack_1; + u32 stack_2; + + switch (sQuickSaveRead->state) { + case 0: + sQuickSaveRead->state = 1; + break; + case 1: + stack_1 = 16; + + if (sub_8011F9C(&stack_1, sQuickSaveRead->dest, sQuickSaveRead->size) == READ_SAVE_VALID) { + sQuickSaveRead->saveValid = TRUE; + sQuickSaveRead->state = 3; + } + else { + sub_80141B4(sSaveFailedExplanation, 0, 0, 0x301); + sQuickSaveRead->state = 2; + } + break; + case 2: + if (sub_80144A4(&stack_2) == 0) + sQuickSaveRead->state = 3; + break; + case 3: + return FALSE; + default: + break; + } + return TRUE; +} + +bool8 IsQuickSaveValid(void) +{ + return sQuickSaveRead->saveValid; +} + +void FinishQuickSaveRead(void) +{ + if (sQuickSaveRead != NULL){ + MemoryFree(sQuickSaveRead); + sQuickSaveRead = 0; + } +} \ No newline at end of file diff --git a/src/quick_save_write.c b/src/quick_save_write.c new file mode 100644 index 000000000..a429cb3ed --- /dev/null +++ b/src/quick_save_write.c @@ -0,0 +1,91 @@ +#include "global.h" +#include "code_80130A8.h" +#include "memory.h" +#include "quick_save_write.h" +#include "save.h" + +static EWRAM_DATA_2 QuickSaveWrite *sQuickSaveWrite = {0}; + +#include "data/quick_save_write.h" + +void PrepareQuickSaveWrite(u8 *r0, u32 r1, u8 r2) +{ + sQuickSaveWrite = MemoryAlloc(sizeof(QuickSaveWrite), 5); + sQuickSaveWrite->unk4 = r0; + sQuickSaveWrite->unk8 = r1; + sQuickSaveWrite->unkC = r2; + sQuickSaveWrite->state = 0; + + if (sQuickSaveWrite->unkC != 0) + sub_80141B4(gUnknown_80D45AC, 0, 0, 0x20); + else + sub_80141B4(gUnknown_80D45AC, 0, 0, 0x20); +} + +u32 WriteQuickSave(void) +{ + u32 stack_1; + u32 stack_2; + + switch (sQuickSaveWrite->state) { + case 0: + sQuickSaveWrite->state = 1; + break; + case 1: + sub_80140DC(); + stack_1 = 16; + sQuickSaveWrite->quickSaveStatus = sub_80121D4(&stack_1, sQuickSaveWrite->unk4, sQuickSaveWrite->unk8); + sQuickSaveWrite->state = 2; + return 1; + case 2: + stack_1 = 0; + + if (sQuickSaveWrite->quickSaveStatus == 0) + sQuickSaveWrite->quickSaveStatus = WriteSavetoPak(&stack_1, 2); + + switch (sQuickSaveWrite->quickSaveStatus) { + case SAVE_COMPLETED: + sub_80121E0(987655); + + if (sQuickSaveWrite->unkC != 0) + sub_80141B4(gUnknown_80D45F4, 0, 0, 0x301); + else + sub_80141B4(gUnknown_80D4668, 0, 0, 0x301); + + sQuickSaveWrite->state = 3; + break; + case SAVE_NOT_WRTTEN: + sub_80141B4(gSaveNotWritten2, 0, 0, 0); + sQuickSaveWrite->state = 4; + break; + default: + sub_80121E0(987657); + sub_80141B4(gSaveFailed2, 0, 0, 0x301); + sQuickSaveWrite->state = 3; + break; + } + sub_8014114(); + break; + case 3: + if (sub_80144A4(&stack_2) == 0) + sQuickSaveWrite->state = 5; + break; + case 4: + break; + case 5: + if (sQuickSaveWrite->quickSaveStatus == SAVE_COMPLETED) + return 2; + return 3; + default: + break; + } + return 0; +} + +void FinishQuickSaveWrite() +{ + if (sQuickSaveWrite) { + MemoryFree(sQuickSaveWrite); + sQuickSaveWrite = NULL; + } +} \ No newline at end of file diff --git a/src/reg_control.c b/src/reg_control.c index 33dd869fd..67d6ba05d 100644 --- a/src/reg_control.c +++ b/src/reg_control.c @@ -6,8 +6,8 @@ #include "reg_control.h" #include "sprite.h" -extern struct unkStruct_202D648 gUnknown_202D608[8]; -extern struct unkStruct_202D648 gUnknown_202D648[8]; +extern unkStruct_202D648 gUnknown_202D608[8]; +extern unkStruct_202D648 gUnknown_202D648[8]; EWRAM_DATA bool8 gUnknown_203B099; EWRAM_DATA bool8 gUnknown_203B09A; diff --git a/src/rescue_password_menu.c b/src/rescue_password_menu.c index fd7c50a36..60ed4594b 100644 --- a/src/rescue_password_menu.c +++ b/src/rescue_password_menu.c @@ -1,7 +1,7 @@ #include "global.h" #include "memory.h" #include "input.h" -#include "item.h" +#include "items.h" #include "menu.h" #include "pokemon.h" #include "save.h" @@ -19,13 +19,13 @@ EWRAM_DATA s32 gCommsTimeout = {0}; EWRAM_DATA u8 gRescuePasswordBuffer[RESCUE_PASSWORD_SIZE] = {0}; -extern struct unkStruct_203B484 *gUnknown_203B484; +extern unkStruct_203B484 *gUnknown_203B484; EWRAM_DATA_2 u8 gUnknown_203B368 = {0}; EWRAM_DATA_2 u32 gUnknown_203B36C = {0}; EWRAM_DATA_2 struct RescuePasswordMenu *gRescuePasswordMenu = {0}; -const struct UnkTextStruct2 gUnknown_80E71E4 = { +const UnkTextStruct2 gUnknown_80E71E4 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, @@ -34,7 +34,7 @@ const struct UnkTextStruct2 gUnknown_80E71E4 = { NULL }; -const struct UnkTextStruct2 gUnknown_80E71FC = { +const UnkTextStruct2 gUnknown_80E71FC = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x09, @@ -47,7 +47,7 @@ const u8 Error_80E7268[]; const u8 IncorrectPassword_80E7250[]; const u8 CheckAgain_80E7234[]; -const struct MenuItem gUnknown_80E7214[4] = { +const MenuItem gUnknown_80E7214[4] = { {Error_80E7268, 0xC}, {IncorrectPassword_80E7250, 0xC}, {CheckAgain_80E7234, 0xC}, @@ -58,7 +58,7 @@ ALIGNED(4) const u8 CheckAgain_80E7234[] = _("{CENTER_ALIGN}Please check it agai ALIGNED(4) const u8 IncorrectPassword_80E7250[] = _("{CENTER_ALIGN}Incorrect password!"); ALIGNED(4) const u8 Error_80E7268[] = _("{CENTER_ALIGN}{COLOR_1 RED}Error!{END_COLOR_TEXT_1} "); -const struct UnkTextStruct2 gUnknown_80E7278 = { +const UnkTextStruct2 gUnknown_80E7278 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x09, @@ -71,7 +71,7 @@ const u8 Success_80E72D8[]; const u8 PasswordAccept_80E72B4[]; const u8 DATA_80E72B0[]; -const struct MenuItem gUnknown_80E7290[4] = { +const MenuItem gUnknown_80E7290[4] = { {Success_80E72D8, 0xC}, {PasswordAccept_80E72B4, 0xC}, {DATA_80E72B0, 0xC}, @@ -82,7 +82,7 @@ ALIGNED(4) const u8 DATA_80E72B0[] = " "; ALIGNED(4) const u8 PasswordAccept_80E72B4[] = _("{CENTER_ALIGN}The password has been accepted."); ALIGNED(4) const u8 Success_80E72D8[] = _("{CENTER_ALIGN}{COLOR_1 LIGHT_BLUE}Success!{END_COLOR_TEXT_1} "); -const struct UnkTextStruct2 gUnknown_80E72EC = { +const UnkTextStruct2 gUnknown_80E72EC = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x09, @@ -93,7 +93,7 @@ const struct UnkTextStruct2 gUnknown_80E72EC = { const u8 NotSOSMail_80E7324[]; -const struct MenuItem gUnknown_80E7304[4] = { +const MenuItem gUnknown_80E7304[4] = { {Error_80E7268, 0xC}, {NotSOSMail_80E7324, 0xC}, {CheckAgain_80E7234, 0xC}, @@ -102,7 +102,7 @@ const struct MenuItem gUnknown_80E7304[4] = { ALIGNED(4) const u8 NotSOSMail_80E7324[] = _("{CENTER_ALIGN}This is not an {COLOR_1 LIGHT_BLUE}SOS Mail{END_COLOR_TEXT_1}."); -const struct UnkTextStruct2 gUnknown_80E7344 = { +const UnkTextStruct2 gUnknown_80E7344 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x09, @@ -113,7 +113,7 @@ const struct UnkTextStruct2 gUnknown_80E7344 = { const u8 ReceiveSOSMail_80E737C[]; -const struct MenuItem gUnknown_80E735C[4] = { +const MenuItem gUnknown_80E735C[4] = { {Error_80E7268, 0xC}, {ReceiveSOSMail_80E737C, 0xC}, {CheckAgain_80E7234, 0xC}, @@ -122,7 +122,7 @@ const struct MenuItem gUnknown_80E735C[4] = { ALIGNED(4) const u8 ReceiveSOSMail_80E737C[] = _("{CENTER_ALIGN}This {COLOR_1 LIGHT_BLUE}SOS Mail{END_COLOR_TEXT_1} has been received already."); -const struct UnkTextStruct2 gUnknown_80E73AC = { +const UnkTextStruct2 gUnknown_80E73AC = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x09, @@ -133,7 +133,7 @@ const struct UnkTextStruct2 gUnknown_80E73AC = { const u8 sUnknown_80E73E4[]; -const struct MenuItem gUnknown_80E73C4[4] = { +const MenuItem gUnknown_80E73C4[4] = { {Error_80E7268, 0xC}, {sUnknown_80E73E4, 0xC}, {CheckAgain_80E7234, 0xC}, @@ -142,7 +142,7 @@ const struct MenuItem gUnknown_80E73C4[4] = { ALIGNED(4) const u8 sUnknown_80E73E4[] = _("{CENTER_ALIGN}This is not an {COLOR_1 LIGHT_BLUE}A-OK Mail{END_COLOR_TEXT_1}."); -const struct UnkTextStruct2 gUnknown_80E7408 = { +const UnkTextStruct2 gUnknown_80E7408 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x09, @@ -153,7 +153,7 @@ const struct UnkTextStruct2 gUnknown_80E7408 = { const u8 sUnknown_80E7440[]; -const struct MenuItem gUnknown_80E7420[4] = { +const MenuItem gUnknown_80E7420[4] = { {Error_80E7268, 0xC}, {sUnknown_80E7440, 0xC}, {CheckAgain_80E7234, 0xC}, @@ -162,7 +162,7 @@ const struct MenuItem gUnknown_80E7420[4] = { ALIGNED(4) const u8 sUnknown_80E7440[] = _("{CENTER_ALIGN}This {COLOR_1 LIGHT_BLUE}A-OK Mail{END_COLOR_TEXT_1} cannot be used."); -const struct UnkTextStruct2 gUnknown_80E7468 = { +const UnkTextStruct2 gUnknown_80E7468 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x09, @@ -173,7 +173,7 @@ const struct UnkTextStruct2 gUnknown_80E7468 = { const u8 sUnknown_80E74A0[]; -const struct MenuItem gUnknown_80E7480[4] = { +const MenuItem gUnknown_80E7480[4] = { {Error_80E7268, 0xC}, {sUnknown_80E74A0, 0xC}, {CheckAgain_80E7234, 0xC}, @@ -181,7 +181,7 @@ const struct MenuItem gUnknown_80E7480[4] = { }; ALIGNED(4) const u8 sUnknown_80E74A0[] = _("{CENTER_ALIGN}This is not a {COLOR_1 LIGHT_BLUE}Thank-You Mail{END_COLOR_TEXT_1}."); -const struct UnkTextStruct2 gUnknown_80E74C8 = { +const UnkTextStruct2 gUnknown_80E74C8 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x09, @@ -192,7 +192,7 @@ const struct UnkTextStruct2 gUnknown_80E74C8 = { const u8 sUnknown_80E7500[]; -const struct MenuItem gUnknown_80E74E0[4] = { +const MenuItem gUnknown_80E74E0[4] = { {Error_80E7268, 0xC}, {sUnknown_80E7500, 0xC}, {CheckAgain_80E7234, 0xC}, @@ -201,7 +201,7 @@ const struct MenuItem gUnknown_80E74E0[4] = { ALIGNED(4) const u8 sUnknown_80E7500[] = _("{CENTER_ALIGN}This {COLOR_1 LIGHT_BLUE}Thank-You Mail{END_COLOR_TEXT_1} cannot be used."); -const struct UnkTextStruct2 gUnknown_80E752C = { +const UnkTextStruct2 gUnknown_80E752C = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x09, @@ -212,7 +212,7 @@ const struct UnkTextStruct2 gUnknown_80E752C = { const u8 sUnknown_80E7564[]; -const struct MenuItem gUnknown_80E7544[4] = { +const MenuItem gUnknown_80E7544[4] = { {Error_80E7268, 0xC}, {sUnknown_80E7564, 0xC}, {CheckAgain_80E7234, 0xC}, @@ -220,7 +220,7 @@ const struct MenuItem gUnknown_80E7544[4] = { }; ALIGNED(4) const u8 sUnknown_80E7564[] = _("{CENTER_ALIGN}This is not a {COLOR_1 LIGHT_BLUE}Wonder Mail{END_COLOR_TEXT_1}."); -const struct UnkTextStruct2 gUnknown_80E7588 = { +const UnkTextStruct2 gUnknown_80E7588 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x09, @@ -231,7 +231,7 @@ const struct UnkTextStruct2 gUnknown_80E7588 = { const u8 sUnknown_80E75C0[]; const u8 sUnknown_80E75CC[]; -const struct MenuItem gUnknown_80E75A0[4] = { +const MenuItem gUnknown_80E75A0[4] = { {Error_80E7268, 0xC}, {sUnknown_80E75CC, 0xC}, {sUnknown_80E75C0, 0xC}, @@ -255,14 +255,14 @@ extern void xxx_draw_string_80144C4(void); void DisplayRescuePasswordError(u32 error); void sub_8039174(void); void DisplayPasswordAcceptScreen(void); -u32 sub_8039068(u32, u8 *passwordBuffer, struct unkStruct_203B480 *r0); +u32 sub_8039068(u32, u8 *passwordBuffer, unkStruct_203B480 *r0); void sub_80391F8(void); -bool8 sub_803D204(u8 *, struct unkStruct_203B480 *); +bool8 sub_803D204(u8 *, unkStruct_203B480 *); u32 ConvertMenutoRescuePasswordState(u32); void CreateRescuePasswordMenu(u32 currMenu) { - struct unkStruct_203B480 *temp; + unkStruct_203B480 *temp; s32 counter; if(gRescuePasswordMenu == NULL) @@ -275,7 +275,7 @@ void CreateRescuePasswordMenu(u32 currMenu) gRescuePasswordMenu->unk148[counter] = gUnknown_80E71E4; ResetUnusedInputStruct(); - sub_800641C(gRescuePasswordMenu->unk148, 1, 1); + sub_800641C(gRescuePasswordMenu->unk148, TRUE, TRUE); if ((gUnknown_203B368 != 0) || (gUnknown_203B36C != currMenu)) { for(counter = 0; counter < RESCUE_PASSWORD_SIZE; counter++) @@ -302,7 +302,7 @@ void CreateRescuePasswordMenu(u32 currMenu) break; case MENU_DISPLAY_RESCUE_PASSWORD: temp = GetMailatIndex(0x1F); - MemoryFill8((u8 *)temp, 0, sizeof(struct unkStruct_203B480)); + MemoryFill8((u8 *)temp, 0, sizeof(unkStruct_203B480)); temp->mailType = 2; temp->item.id = ITEM_NOTHING; sub_8031D70(0x1F, 0); @@ -320,7 +320,7 @@ void CleanRescuePasswordMenu(void) { ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); if (gRescuePasswordMenu != NULL) { sub_80155F0(); sub_8031E10(); @@ -344,12 +344,12 @@ static inline s32 UpdateRescuePasswordMenu_sub(s32 otherMenu) s32 UpdateRescuePasswordMenu(void) { - struct unkStruct_203B480 *mailPtr1; - struct unkStruct_203B480 *mailPtr2; + unkStruct_203B480 *mailPtr1; + unkStruct_203B480 *mailPtr2; u32 iVar7; struct MainMenu *mainMenuPtr; s32 nextMenu; - struct unkStruct_203B480 mail; + unkStruct_203B480 mail; u32 menuAction; u32 subtract; @@ -365,7 +365,7 @@ s32 UpdateRescuePasswordMenu(void) case 3: case 5: iVar7 = sub_80154F0(); - MemoryFill8((u8 *)&mail, 0, sizeof(struct unkStruct_203B480)); + MemoryFill8((u8 *)&mail, 0, sizeof(unkStruct_203B480)); switch(iVar7) { case 1: @@ -432,7 +432,7 @@ s32 UpdateRescuePasswordMenu(void) sub_80951FC(&mail); mailPtr1 = GetMailatIndex(GetMailIndex(1, mail.unk10.unk10)); mailPtr1->mailType = WONDER_MAIL_TYPE_OKD; - MemoryFill8((u8 *)&gUnknown_203B484, 0, sizeof(struct unkStruct_203B484)); + MemoryFill8((u8 *)&gUnknown_203B484, 0, sizeof(unkStruct_203B484)); break; case PASSWORD_ENTRY_NOT_THANK_YOU_MAIL: nextMenu = PASSWORD_ENTRY_NOT_THANK_YOU_MAIL; @@ -501,7 +501,7 @@ s32 UpdateRescuePasswordMenu(void) case 0xC: sub_8039174(); ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); sub_80151C0(4,gRescuePasswordBuffer); gRescuePasswordMenu->state = 8; subtract = gRescuePasswordMenu->currMenu - 0x21; @@ -529,7 +529,7 @@ s32 UpdateRescuePasswordMenu(void) case 0xC: sub_8039174(); ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); sub_80151C0(4,gRescuePasswordBuffer); gRescuePasswordMenu->state = ConvertMenutoRescuePasswordState(gRescuePasswordMenu->currMenu); subtract = gRescuePasswordMenu->currMenu - 0x21; @@ -552,7 +552,7 @@ void DisplayRescuePasswordError(u32 passwordError) { sub_8006518(gRescuePasswordMenu->unk1A8); ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); sub_80155F0(); switch(passwordError) { case PASSWORD_ENTRY_INCORRECT_PASSWORD: @@ -592,7 +592,7 @@ void DisplayPasswordAcceptScreen(void) { sub_8006518(gRescuePasswordMenu->unk1A8); ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); sub_80155F0(); SetMenuItems(gRescuePasswordMenu->unk8,gRescuePasswordMenu->unk148,0,&gUnknown_80E7278,gUnknown_80E7290,0,0xd,0); sub_8035CF4(gRescuePasswordMenu->unk8,0,TRUE); @@ -632,7 +632,7 @@ u32 ConvertMenutoRescuePasswordState(u32 unused) return state; } -u32 sub_8039068(u32 mailMode, u8 *passwordBuffer, struct unkStruct_203B480 *param_3) +u32 sub_8039068(u32 mailMode, u8 *passwordBuffer, unkStruct_203B480 *param_3) { if ( (!sub_803D204(passwordBuffer, param_3)) || (WONDER_MAIL_TYPE_OKD < param_3->mailType) || (param_3->unk4.dungeon.floor >= GetDungeonFloorCount(param_3->unk4.dungeon.id)) || @@ -692,7 +692,7 @@ void sub_8039174(void) #else u32 r2; // r4 but should be r2 #endif //NONMATCHING - struct SpriteOAM* spr; // r2 but should be r3 + SpriteOAM* spr; // r2 but should be r3 u16 r4; // r3 but should be r4 spr = &gRescuePasswordMenu->unk208; @@ -736,7 +736,7 @@ void sub_8039174(void) void sub_80391F8(void) { - struct SpriteOAM *spr; + SpriteOAM *spr; u32 val; spr = &gRescuePasswordMenu->unk208; diff --git a/src/save.c b/src/save.c index c90b5ea55..341b673b0 100644 --- a/src/save.c +++ b/src/save.c @@ -1,149 +1,49 @@ #include "global.h" +#include "code_80118A4.h" +#include "code_80130A8.h" +#include "code_8097670.h" #include "event_flag.h" +#include "exclusive_pokemon.h" #include "flash.h" #include "friend_area.h" +#include "game_options.h" #include "memory.h" #include "pokemon.h" #include "random.h" #include "save.h" -#include "team_inventory.h" -#include "exclusive_pokemon.h" -#include "game_options.h" -#include "code_80130A8.h" -#include "code_80118A4.h" EWRAM_DATA_2 u32 gUnknown_203B17C = {0}; EWRAM_DATA_2 char *gUnknown_203B180 = {0}; EWRAM_DATA_2 struct UnkStruct_203B184 *gUnknown_203B184 = {0}; -extern struct GameOptions *gGameOptionsRef; +extern GameOptions *gGameOptionsRef; +// size: 0x800 struct unk_struct { - // size: 0x800 u32 unk0; - u8 gameInternalName[0x10]; // has "POKE_DUNGEON__05 + u8 gameInternalName[16]; // has "POKE_DUNGEON__05 u32 checksum; u32 unk18; - u32 dungeonLocation; + DungeonLocation dungeonLocation; u32 unk20; u32 padding[503]; }; -struct SavePakRead -{ - u32 state; - u32 readStatus; -}; - -EWRAM_DATA_2 struct SavePakRead *gSavePakRead = {0}; - -struct SavePakWrite -{ - u32 state; - s32 unk4; - u32 saveStatus; - struct OpenedFile *faceFile; - u8 *faceData; - u16 unk14; - u16 unk16; - u8 unk18; - u8 unk19; - u8 unk1A; - u8 unk1B; - u16 pokeID; -}; - -EWRAM_DATA_2 struct SavePakWrite *gSavePakWrite = {0}; - -struct QuickSaveRead -{ - s32 state; - u8 *dest; - u32 size; - bool8 saveValid; -}; -EWRAM_DATA_2 struct QuickSaveRead *gQuickSaveRead = {0}; - -struct QuickSaveWrite -{ - s32 state; - u8 *unk4; - u32 unk8; - u8 unkC; - u32 quickSaveStatus; -}; -EWRAM_DATA_2 struct QuickSaveWrite *gQuickSaveWrite = {0}; - extern s32 gUnknown_202DE28; extern u32 *gUnknown_203B488; -extern u32 gUnknown_203B494; +ALIGNED(4) static const char debug_fill8[] = "pksdir0"; ALIGNED(4) const char sGameInternalVersion[] = _("POKE_DUNGEON__05"); ALIGNED(4) static const char fill_save0[] = _("pksdir0"); ALIGNED(4) static const char fill_save1[] = _("pksdir0"); ALIGNED(4) static const char fill_save2[] = _("pksdir0"); -ALIGNED(4) static const char fill_save3[] = _("pksdir0"); - -ALIGNED(4) const char gSaveCorrupted[] = _("{CENTER_ALIGN}The game data is corrupted.\n" - "{CENTER_ALIGN}Your data will be erased."); - -ALIGNED(4) static const char fill_save4[] = _("pksdir0"); - -ALIGNED(4) const char gSavingAdventure[] = _("{CENTER_ALIGN}Saving your adventure...\n" - "{CENTER_ALIGN}Please don{APOSTROPHE}t turn off the power."); - -ALIGNED(4) const char gWriteGamePak[] = _("{CENTER_ALIGN}Writing to GBA Game Pak.\n" - "{CENTER_ALIGN}Do not remove the GBA Game Pak.\n" - "{CENTER_ALIGN}Please wait with the power on."); - -ALIGNED(4) const char gSaveCompleted[] = _("{CENTER_ALIGN}Save completed!"); - -ALIGNED(4) const char gSaveNotWritten[] = _("{CENTER_ALIGN}The data could not be written.\n" - "{CENTER_ALIGN}Please turn off the power and remove\n" - "{CENTER_ALIGN}and reinsert the DS Card."); - -ALIGNED(4) const char gSaveFailed[] = _("{CENTER_ALIGN}Save failed."); - -ALIGNED(4) static const char fill_save5[] = _("pksdir0"); - -ALIGNED(4) const char gUnknown_80D44C8[] = _("{CENTER_ALIGN}Your data was not properly saved{COMMA}\n" - "{CENTER_ALIGN}so your game cannot be resumed\n" - "{CENTER_ALIGN}from your last spot.{EXTRA_MSG}" - "{CENTER_ALIGN}Your last outing is considered a defeat.\n" - "{CENTER_ALIGN}Before shutting down{COMMA} save in your\n" - "{CENTER_ALIGN}team base{COMMA} or quicksave in a dungeon."); - -ALIGNED(4) static const char fill_save6[] = _("pksdir0"); - -ALIGNED(4) const char gUnknown_80D45AC[] = _("{CENTER_ALIGN}Quicksaving your adventure...\n" - "{CENTER_ALIGN}Please don{APOSTROPHE}t turn off the power."); - -ALIGNED(4) const char gUnknown_80D45F4[] = _("{CENTER_ALIGN}Your adventure has been saved.\n" - "{CENTER_ALIGN}When you are in a dungeon{COMMA} quicksave\n" - "{CENTER_ALIGN}your progress before ending the game."); - -ALIGNED(4) const char gUnknown_80D4668[] = _("{CENTER_ALIGN}Your adventure has been saved.\n" - "{CENTER_ALIGN}When you resume play{COMMA} the quicksave\n" - "{CENTER_ALIGN}data will be deleted.{EXTRA_MSG}" - "{CENTER_ALIGN}When you are shutting down the game{COMMA}\n" - "{CENTER_ALIGN}save your progress in your team base{COMMA}\n" - "{CENTER_ALIGN}or quicksave in a dungeon."); - -ALIGNED(4) const char gSaveNotWritten2[] = _("{CENTER_ALIGN}The data could not be written.\n" - "{CENTER_ALIGN}Please turn off the power and remove\n" - "{CENTER_ALIGN}and reinsert the DS Card."); - -ALIGNED(4) const char gSaveFailed2[] = _("{CENTER_ALIGN}Save failed."); -ALIGNED(4) static const char fill_save7[] = _("pksdir0"); extern bool8 sub_800DAB0(u16, u8*, s32); extern bool8 sub_800DAB4(u16, u8*, s32); extern bool8 sub_800DAB8(void); -extern void sub_80140DC(); -extern void sub_8014114(); extern u32 SaveRecruitedPokemon(u8 *, u32); extern u32 RestoreRecruitedPokemon(void* a, s32 b); extern u32 SavePokemonStruct2(u8 *, u32); @@ -153,20 +53,14 @@ extern u32 sub_80954CC(void* a, s32 b); extern u32 sub_8095624(u8 *, u32); extern u32 RestoreMailInfo(void* a, s32 b); extern u32 SaveMailInfo(u8 *, u32); -extern void sub_80976A8(); extern u32 sub_8097D60(u8 *, u32); extern u32 sub_8097D98(void* a, s32 b); -extern void sub_80993E4(); extern void sub_800135C(void); extern void sub_80958E4(u32 *a, u32 b); -extern struct unkStruct_203B490 *GetMailInfo(void); +extern unkStruct_203B490 *GetMailInfo(void); extern void InitializeMailJobsNews(void); extern void sub_80972F4(void); -extern u32 sub_8097680(void); -extern u32 *GetDungeonLocationInfo(void); extern void sub_80974E8(void); -extern void ResetNumAdventures(void); -extern void sub_80993D8(void); u32 sub_8011C1C(void) { @@ -292,8 +186,7 @@ u32 ReadSaveSector(s32 *a, u8 *dest, s32 size) return READ_SAVE_VALID; } -// Unused -bool8 sub_8011DA8(void) +UNUSED static bool8 sub_8011DA8(void) { return TRUE; } @@ -493,7 +386,6 @@ u32 WriteSavetoPak(s32 *param_1, u32 param_2) return SAVE_COMPLETED; } - s32 sub_80121D4(s32 *a, u8 *src, s32 size) { return WriteSaveSector(a, src, size); @@ -592,381 +484,41 @@ void InitializePlayerData(void) } -// Unused -void nullsub_200(u32 r0) +UNUSED static void nullsub_200(u32 r0) { } -// Unused -void sub_8012334(struct UnkStruct_203B184 *r0) +UNUSED static void sub_8012334(struct UnkStruct_203B184 *r0) { gUnknown_203B184 = r0; - if(r0 != NULL) - { - gTeamInventoryRef = r0->MoneyItems; - gRecruitedPokemonRef = r0->recruitedPokemon; - gUnknown_203B480 = r0->unk8; - gUnknown_203B484 = r0->unkC; - gUnknown_203B488 = r0->unk10; - gUnknown_203B48C = r0->unk14; - gUnknown_203B490 = r0->mailInfo; - gRescueTeamInfoRef = r0->RescueTeamInfo; - gUnknown_203B494 = r0->unk20; - gUnknown_203B498 = r0->ExclusivePokemon; - gFriendAreas = r0->BoughtFriendAreas; - gGameOptionsRef = r0->gameOptions; - gPlayTimeRef = r0->playTime; - return; + if (r0 != NULL) { + gTeamInventoryRef = r0->MoneyItems; + gRecruitedPokemonRef = r0->recruitedPokemon; + gUnknown_203B480 = r0->unk8; + gUnknown_203B484 = r0->unkC; + gUnknown_203B488 = r0->unk10; + gUnknown_203B48C = r0->unk14; + gUnknown_203B490 = r0->mailInfo; + gRescueTeamInfoRef = r0->RescueTeamInfo; + gUnknown_203B494 = r0->unk20; + gUnknown_203B498 = r0->ExclusivePokemon; + gFriendAreas = r0->BoughtFriendAreas; + gGameOptionsRef = r0->gameOptions; + gPlayTimeRef = r0->playTime; } - gTeamInventoryRef = GetMoneyItemsInfo(); - gRecruitedPokemonRef = GetRecruitedPokemon(); - gUnknown_203B480 = sub_80950F8(); - gUnknown_203B484 = sub_8095100(); - gUnknown_203B488 = sub_8095108(); - gUnknown_203B48C = sub_8095110(); - gUnknown_203B490 = GetMailInfo(); - gRescueTeamInfoRef = GetRescueTeamInfo(); - gUnknown_203B494 = sub_8097680(); - gUnknown_203B498 = GetExclusivePokemon(); - gFriendAreas = GetBoughtFriendAreas(); - gGameOptionsRef = GetGameOptions(); - gPlayTimeRef = GetPlayTime(); - -} - -void PrepareSavePakRead(void) -{ - gSavePakRead = MemoryAlloc(sizeof(struct SavePakRead), 5); - gSavePakRead->state = 1; - -} - -u8 ReadSavePak(void) -{ - u32 temp; - u32 temp2; - switch(gSavePakRead->state) - { - case 0: - gSavePakRead->state = 1; - break; - case 1: - temp = 0; - gSavePakRead->readStatus = ReadSaveFromPak(&temp); - gSavePakRead->state = 2; - break; - case 2: - if(gSavePakRead->readStatus != READ_SAVE_VALID) - { - if(IsSaveCorrupted()) - { - sub_80141B4(gSaveCorrupted, 0, 0, 0x301); - gSavePakRead->state = 3; - } - else - { - gSavePakRead->state = 4; - } - } - else - { - gSavePakRead->state = 6; - } - break; - case 3: - if(sub_80144A4(&temp2) == 0) - gSavePakRead->state = 4; - break; - case 4: - sub_8012298(); - gSavePakRead->state = 6; - case 5: - break; - case 6: - return 0; + else { + gTeamInventoryRef = GetMoneyItemsInfo(); + gRecruitedPokemonRef = GetRecruitedPokemon(); + gUnknown_203B480 = sub_80950F8(); + gUnknown_203B484 = sub_8095100(); + gUnknown_203B488 = sub_8095108(); + gUnknown_203B48C = sub_8095110(); + gUnknown_203B490 = GetMailInfo(); + gRescueTeamInfoRef = GetRescueTeamInfo(); + gUnknown_203B494 = sub_8097680(); + gUnknown_203B498 = GetExclusivePokemon(); + gFriendAreas = GetBoughtFriendAreas(); + gGameOptionsRef = GetGameOptions(); + gPlayTimeRef = GetPlayTime(); } - return 1; -} - -void FinishReadSavePak(void) -{ - if(gSavePakRead != NULL) - { - MemoryFree(gSavePakRead); - gSavePakRead = NULL; - } -} - -void PrepareSavePakWrite(s16 PokemonID) -{ - struct OpenedFile *file; - s32 id_s32; - struct OpenedFile **preload_face; - - id_s32 = PokemonID; // had to cast for asr shift - - sub_80993D8(); - gSavePakWrite = MemoryAlloc(sizeof(struct SavePakWrite),5); - gSavePakWrite->pokeID = id_s32; - gSavePakWrite->faceFile = NULL; - gSavePakWrite->faceData = NULL; - if (PokemonID != MONSTER_NONE) { - file = GetDialogueSpriteDataPtr(PokemonID); - gSavePakWrite->faceFile = file; - gSavePakWrite->faceData = file->data; - gSavePakWrite->unk18 = 0; - gSavePakWrite->unk19 = 0; - gSavePakWrite->unk1A = 0; - gSavePakWrite->unk14 = 2; - gSavePakWrite->unk16 = 8; - } - if (gSavePakWrite->faceFile != 0) { - preload_face = &gSavePakWrite->faceFile; - sub_80141B4(gSavingAdventure,0,preload_face,0x20); - } - else { - sub_80141B4(gSavingAdventure,0,NULL,0x20); - } - gSavePakWrite->state = 3; -} - -bool8 WriteSavePak(void) -{ - struct OpenedFile **faceFile; - u32 local_14; - u32 other_stack; - - faceFile = NULL; - if (gSavePakWrite->faceFile != 0) { - faceFile = &gSavePakWrite->faceFile; - } - switch(gSavePakWrite->state) - { - case 0: - gSavePakWrite->state = 7; - break; - case 1: - gSavePakWrite->unk4++; - if (gSavePakWrite->unk4 > 8) { - sub_80141B4(gWriteGamePak, 0, 0, 0x20); - gSavePakWrite->state = 3; - } - break; - case 2: - break; - case 3: - gSavePakWrite->state = 4; - break; - case 4: - local_14 = 0; - sub_80140DC(); - gSavePakWrite->saveStatus = WriteSavetoPak(&local_14, sub_8011C1C()); - switch(gSavePakWrite->saveStatus) - { - case SAVE_COMPLETED: - if(gSavePakWrite->faceFile != NULL) - sub_80141B4(gSaveCompleted, 0, faceFile, 0x101); - else - sub_80141B4(gSaveCompleted, 0, faceFile, 0x101); - gSavePakWrite->state = 5; - break; - case SAVE_NOT_WRTTEN: - sub_80141B4(gSaveNotWritten, 0, 0, 0); - gSavePakWrite->state = 6; - break; - default: - if(gSavePakWrite->faceFile != NULL) - sub_80141B4(gSaveFailed, 0, faceFile, 0x101); - else - sub_80141B4(gSaveFailed, 0, faceFile, 0x101); - gSavePakWrite->state = 5; - break; - } - sub_8014114(); - break; - case 5: - if (sub_80144A4(&other_stack) == 0) - gSavePakWrite->state = 7; - break; - case 6: - break; - case 7: - return FALSE; - } - return TRUE; -} - -u32 GetSavePakStatus(void) -{ - return gSavePakWrite->saveStatus; -} - -void FinishWriteSavePak(void) -{ - if(gSavePakWrite != NULL) - { - if(gSavePakWrite->faceFile != NULL) - CloseFile(gSavePakWrite->faceFile); - MemoryFree(gSavePakWrite); - gSavePakWrite = NULL; - } - sub_80993E4(); -} - -void PrepareQuickSaveRead(u8 *dest, u32 size) -{ - gQuickSaveRead = MemoryAlloc(sizeof(struct QuickSaveRead), 5); - gQuickSaveRead->dest = dest; - gQuickSaveRead->size = size; - gQuickSaveRead->saveValid = FALSE; - gQuickSaveRead->state = 1; -} - -bool8 ReadQuickSave(void) -{ - u32 stack_1; - u32 stack_2; - - switch(gQuickSaveRead->state) - { - case 0: - gQuickSaveRead->state = 1; - break; - case 1: - stack_1 = 16; - if(sub_8011F9C(&stack_1, gQuickSaveRead->dest, gQuickSaveRead->size) == READ_SAVE_VALID) - { - gQuickSaveRead->saveValid = TRUE; - gQuickSaveRead->state = 3; - } - else - { - // Data was not properly saved - // so your game cannot be resumed - // from your last spot. Your last outing is considered a defeat. - // Before shutting down, save in your - // team base or quicksave in a dungeon - sub_80141B4(gUnknown_80D44C8, 0, 0, 0x301); - gQuickSaveRead->state = 2; - } - break; - case 2: - if(sub_80144A4(&stack_2) == 0) - gQuickSaveRead->state = 3; - break; - case 3: - return FALSE; - default: - break; - } - return TRUE; -} - -bool8 IsQuickSaveValid(void) -{ - return gQuickSaveRead->saveValid; -} - -void FinishQuickSaveRead(void) -{ - if(gQuickSaveRead != NULL){ - MemoryFree(gQuickSaveRead); - gQuickSaveRead = 0; - } -} - -void PrepareQuickSaveWrite(u8 *r0, u32 r1, u8 r2) -{ - gQuickSaveWrite = MemoryAlloc(sizeof(struct QuickSaveWrite), 5); - gQuickSaveWrite->unk4 = r0; - gQuickSaveWrite->unk8 = r1; - gQuickSaveWrite->unkC = r2; - gQuickSaveWrite->state = 0; - if(gQuickSaveWrite->unkC != 0) - // Quicksaving your adventure... - // Please don't turn off the power. - sub_80141B4(gUnknown_80D45AC, 0, 0, 0x20); - else - // Quicksaving your adventure... - // Please don't turn off the power. - sub_80141B4(gUnknown_80D45AC, 0, 0, 0x20); -} - -u32 WriteQuickSave(void) -{ - u32 stack_1; - u32 stack_2; - switch(gQuickSaveWrite->state) - { - case 0: - gQuickSaveWrite->state = 1; - break; - case 1: - sub_80140DC(); - stack_1 = 16; - gQuickSaveWrite->quickSaveStatus = sub_80121D4(&stack_1, gQuickSaveWrite->unk4, gQuickSaveWrite->unk8); - gQuickSaveWrite->state = 2; - return 1; - case 2: - stack_1 = 0; - if(gQuickSaveWrite->quickSaveStatus == 0) - gQuickSaveWrite->quickSaveStatus = WriteSavetoPak(&stack_1, 2); - switch(gQuickSaveWrite->quickSaveStatus) - { - case SAVE_COMPLETED: - sub_80121E0(0xf1207); - if(gQuickSaveWrite->unkC != 0) - // Your adventure has been saved - // When you are in a dungeon, quicksave - // your progress before ending the game. - sub_80141B4(gUnknown_80D45F4, 0, 0, 0x301); - else - // Your adventure has been saved. - // When you resume play, the quicksave - // data will be deleted. When you are shutting down the game, - // save your progress in your team base, - // or quicksave in a dungeon. - sub_80141B4(gUnknown_80D4668, 0, 0, 0x301); - gQuickSaveWrite->state = 3; - break; - case SAVE_NOT_WRTTEN: - // The data could not be written. - // Please turn off the power and remove - // and reinsert the DS Card - sub_80141B4(gSaveNotWritten2, 0, 0, 0); - gQuickSaveWrite->state = 4; - break; - default: - sub_80121E0(0xf1209); - sub_80141B4(gSaveFailed2, 0, 0, 0x301); - gQuickSaveWrite->state = 3; - break; - } - sub_8014114(); - break; - case 3: - if(sub_80144A4(&stack_2) == 0) - gQuickSaveWrite->state = 5; - break; - case 4: - break; - case 5: - if(gQuickSaveWrite->quickSaveStatus == SAVE_COMPLETED) - return 2; - else - return 3; - break; - default: - break; - } - return 0; -} - -void FinishQuickSaveWrite() -{ - if (gQuickSaveWrite) { - MemoryFree(gQuickSaveWrite); - gQuickSaveWrite = NULL; - } -} - +} \ No newline at end of file diff --git a/src/save_menu.c b/src/save_menu.c index ff7c5f9dc..8d77a11df 100644 --- a/src/save_menu.c +++ b/src/save_menu.c @@ -12,15 +12,15 @@ struct unkStruct_203B360 // size: 0x1b4 u32 currMenu; u32 unk4; - struct MenuStruct unk8[4]; - struct UnkTextStruct2 unk148[4]; - struct SpriteOAM unk1A8; + MenuStruct unk8[4]; + UnkTextStruct2 unk148[4]; + SpriteOAM unk1A8; u32 unk1B0; // Sprite count? }; EWRAM_DATA_2 struct unkStruct_203B360 *gUnknown_203B364 = {0}; -const struct UnkTextStruct2 gUnknown_80E6F20 = +const UnkTextStruct2 gUnknown_80E6F20 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -30,7 +30,7 @@ const struct UnkTextStruct2 gUnknown_80E6F20 = NULL }; -const struct UnkTextStruct2 gUnknown_80E6F38 = +const UnkTextStruct2 gUnknown_80E6F38 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -44,7 +44,7 @@ const u8 sUnknown_80E6F70[]; const u8 sUnknown_80E6F90[]; const u8 sUnknown_80E6FAC[]; -const struct MenuItem gSavingAdventureMenuItems[] = { +const MenuItem gSavingAdventureMenuItems[] = { {sUnknown_80E6FAC, 4}, {sUnknown_80E6F90, 4}, {sUnknown_80E6F70, 4}, @@ -58,7 +58,7 @@ extern const u8 sUnknown_80E6FDC[]; extern const u8 sUnknown_80E7008[]; extern const u8 sUnknown_80E6FF0[]; -const struct MenuItem gAdventureSavedMenuItems[] = { +const MenuItem gAdventureSavedMenuItems[] = { {sUnknown_80E7008, 4}, {sUnknown_80E6FF0, 4}, {sUnknown_80E6FDC, 4}, @@ -72,7 +72,7 @@ extern const u8 sUnknown_80E7078[]; extern const u8 sUnknown_80E7050[]; extern const u8 sUnknown_80E703C[]; -const struct MenuItem gAdventureCouldNotBeSavedMenuItems[] = { +const MenuItem gAdventureCouldNotBeSavedMenuItems[] = { {sUnknown_80E7078, 4}, {sUnknown_80E7050, 4}, {sUnknown_80E703C, 4}, @@ -85,7 +85,7 @@ ALIGNED(4) const u8 sUnknown_80E7078[] = _("{CENTER_ALIGN}{COLOR_1 RED}Save fail extern const u8 DeletingAdventure_80E70B0[]; -const struct MenuItem gDeletingYourAdventureMenuItems[] = { +const MenuItem gDeletingYourAdventureMenuItems[] = { {sUnknown_80E6FAC, 4}, {DeletingAdventure_80E70B0, 4}, {sUnknown_80E6F70, 4}, @@ -96,7 +96,7 @@ ALIGNED(4) const u8 DeletingAdventure_80E70B0[] = _("{CENTER_ALIGN}Deleting your extern const u8 Data_80E70EC[]; extern const u8 AdventureDeleted_80E70F0[]; -const struct MenuItem gDeletedSaveMenuItems[] = { +const MenuItem gDeletedSaveMenuItems[] = { {sUnknown_80E7008, 4}, {AdventureDeleted_80E70F0, 4}, {Data_80E70EC, 4}, @@ -109,7 +109,7 @@ ALIGNED(4) const u8 AdventureDeleted_80E70F0[] = _("{CENTER_ALIGN}Your adventure extern const u8 sUnknown_80E7134[]; extern const u8 sUnknown_80E715C[]; -const struct MenuItem gAdventureCouldNotBeDeletedMenuItems[] = { +const MenuItem gAdventureCouldNotBeDeletedMenuItems[] = { {sUnknown_80E715C, 4}, {sUnknown_80E7134, 4}, {sUnknown_80E703C, 4}, @@ -128,7 +128,6 @@ extern void sub_8038440(); extern void sub_80384D0(); extern void sub_8038830(); extern void sub_80388C4(void); -extern void sub_8014114(); extern void sub_80140F8(void); void CreateSaveMenu(s32 currMenu) @@ -143,7 +142,7 @@ void CreateSaveMenu(s32 currMenu) gUnknown_203B364->unk148[index] = gUnknown_80E6F20; } ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B364->unk148,1,1); + sub_800641C(gUnknown_203B364->unk148, TRUE, TRUE); if (currMenu == MENU_DELETE_SAVE) { // Beware, Deleting your Adventure @@ -164,7 +163,7 @@ void CreateSaveMenu(s32 currMenu) void CleanSaveMenu(void) { ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); if (gUnknown_203B364 != NULL) { MemoryFree(gUnknown_203B364); gUnknown_203B364 = NULL; @@ -286,7 +285,7 @@ void sub_8038830(void) u32 r1; u32 r4; u32 r5; - struct SpriteOAM *sprite; + SpriteOAM *sprite; r5 = 0; sprite = &gUnknown_203B364->unk1A8; diff --git a/src/save_read.c b/src/save_read.c new file mode 100644 index 000000000..a5f1a8111 --- /dev/null +++ b/src/save_read.c @@ -0,0 +1,64 @@ +#include "global.h" +#include "code_80130A8.h" +#include "memory.h" +#include "save.h" +#include "save_read.h" + +EWRAM_DATA_2 SavePakRead *gSavePakRead = {0}; + +#include "data/save_read.h" + +void PrepareSavePakRead(void) +{ + gSavePakRead = MemoryAlloc(sizeof(SavePakRead), 5); + gSavePakRead->state = 1; +} + +u8 ReadSavePak(void) +{ + u32 temp; + u32 temp2; + + switch (gSavePakRead->state) { + case 0: + gSavePakRead->state = 1; + break; + case 1: + temp = 0; + gSavePakRead->readStatus = ReadSaveFromPak(&temp); + gSavePakRead->state = 2; + break; + case 2: + if (gSavePakRead->readStatus != READ_SAVE_VALID) { + if (IsSaveCorrupted()) { + sub_80141B4(sSaveCorrupted, 0, 0, 0x301); + gSavePakRead->state = 3; + } + else + gSavePakRead->state = 4; + } + else + gSavePakRead->state = 6; + break; + case 3: + if (sub_80144A4(&temp2) == 0) + gSavePakRead->state = 4; + break; + case 4: + sub_8012298(); + gSavePakRead->state = 6; + case 5: + break; + case 6: + return 0; + } + return 1; +} + +void FinishReadSavePak(void) +{ + if (gSavePakRead != NULL) { + MemoryFree(gSavePakRead); + gSavePakRead = NULL; + } +} \ No newline at end of file diff --git a/src/save_write.c b/src/save_write.c new file mode 100644 index 000000000..aa27ce6f4 --- /dev/null +++ b/src/save_write.c @@ -0,0 +1,128 @@ +#include "global.h" +#include "code_80130A8.h" +#include "code_8098BDC.h" +#include "memory.h" +#include "save.h" +#include "save_write.h" + +static EWRAM_DATA_2 SavePakWrite *sSavePakWrite = {0}; + +#include "data/save_write.h" + +void PrepareSavePakWrite(s16 pokemonID) +{ + OpenedFile *file; + s32 id_s32; + OpenedFile **preload_face; + + id_s32 = pokemonID; // had to cast for asr shift + + sub_80993D8(); + sSavePakWrite = MemoryAlloc(sizeof(SavePakWrite), 5); + sSavePakWrite->pokeID = id_s32; + sSavePakWrite->faceFile = NULL; + sSavePakWrite->faceData = NULL; + + if (pokemonID != MONSTER_NONE) { + file = GetDialogueSpriteDataPtr(pokemonID); + sSavePakWrite->faceFile = file; + sSavePakWrite->faceData = file->data; + sSavePakWrite->unk18 = 0; + sSavePakWrite->unk19 = 0; + sSavePakWrite->unk1A = 0; + sSavePakWrite->unk14 = 2; + sSavePakWrite->unk16 = 8; + } + + if (sSavePakWrite->faceFile != 0) { + preload_face = &sSavePakWrite->faceFile; + sub_80141B4(sSavingAdventure, 0, preload_face, 0x20); + } + else + sub_80141B4(sSavingAdventure, 0, NULL, 0x20); + + sSavePakWrite->state = 3; +} + +bool8 WriteSavePak(void) +{ + OpenedFile **faceFile; + u32 local_14; + u32 other_stack; + + faceFile = NULL; + if (sSavePakWrite->faceFile != NULL) + faceFile = &sSavePakWrite->faceFile; + + switch (sSavePakWrite->state) { + case 0: + sSavePakWrite->state = 7; + break; + case 1: + sSavePakWrite->unk4++; + if (sSavePakWrite->unk4 > 8) { + sub_80141B4(sWriteGamePak, 0, 0, 0x20); + sSavePakWrite->state = 3; + } + break; + case 2: + break; + case 3: + sSavePakWrite->state = 4; + break; + case 4: + local_14 = 0; + sub_80140DC(); + sSavePakWrite->saveStatus = WriteSavetoPak(&local_14, sub_8011C1C()); + + switch (sSavePakWrite->saveStatus) { + case SAVE_COMPLETED: + if (sSavePakWrite->faceFile != NULL) + sub_80141B4(sSaveCompleted, 0, faceFile, 0x101); + else + sub_80141B4(sSaveCompleted, 0, faceFile, 0x101); + + sSavePakWrite->state = 5; + break; + case SAVE_NOT_WRTTEN: + sub_80141B4(sSaveNotWritten, 0, 0, 0); + sSavePakWrite->state = 6; + break; + default: + if (sSavePakWrite->faceFile != NULL) + sub_80141B4(sSaveFailed, 0, faceFile, 0x101); + else + sub_80141B4(sSaveFailed, 0, faceFile, 0x101); + + sSavePakWrite->state = 5; + break; + } + sub_8014114(); + break; + case 5: + if (sub_80144A4(&other_stack) == 0) + sSavePakWrite->state = 7; + break; + case 6: + break; + case 7: + return FALSE; + } + return TRUE; +} + +u32 GetSavePakStatus(void) +{ + return sSavePakWrite->saveStatus; +} + +void FinishWriteSavePak(void) +{ + if (sSavePakWrite != NULL) { + if (sSavePakWrite->faceFile != NULL) + CloseFile(sSavePakWrite->faceFile); + MemoryFree(sSavePakWrite); + sSavePakWrite = NULL; + } + sub_80993E4(); +} \ No newline at end of file diff --git a/src/sprite.c b/src/sprite.c index 1b4e2a3ba..f491516a8 100644 --- a/src/sprite.c +++ b/src/sprite.c @@ -3,24 +3,38 @@ #include "random.h" #include "sprite.h" -extern u16 gUnknown_2025670; // Number of sprites in OAM? -extern s16 gUnknown_2025672[8]; -extern s16 gUnknown_2025682[9]; -extern struct Position gUnknown_2025694; -extern u32 gUnknown_2025698; -extern struct SpriteList gUnknown_20256A0; -extern struct UnkSpriteLink gUnknown_2025EA8[128]; -extern struct SpriteOAM gUnknown_20262A8[128]; -extern s32 gSpriteCount; /* 20266A8 */ -extern struct unkStruct_20266B0 gUnknown_20266B0[160]; -extern void *gCharMemCursor; /* 2026E30 */ -extern struct unkStruct_20266B0 *gUnknown_203B074; +static EWRAM_DATA u16 sOAMSpriteCount = {0}; // 2025670 Written to but never read +#ifndef NONMATCHING +UNUSED // TODO: Remove the "UNUSED" attribute after sub_8004EA8 is done +#endif +static EWRAM_DATA s16 sUnknown_2025672[8] = {0}; +#ifndef NONMATCHING +UNUSED // TODO: Remove the "UNUSED" attribute after sub_8004EA8 is done +#endif +static EWRAM_DATA s16 sUnknown_2025682[9] = {0}; +static EWRAM_DATA Position sUnknown_2025694 = {0}; +static EWRAM_DATA u32 sUnknown_2025698 = {0}; +UNUSED static EWRAM_DATA u32 sUnused1 = {0}; // 202569C +static EWRAM_DATA SpriteList sUnknown_20256A0 = {0}; +static EWRAM_DATA UnkSpriteLink sUnknown_2025EA8[128] = {0}; +static EWRAM_DATA SpriteOAM sUnknown_20262A8[128] = {0}; +static EWRAM_DATA s32 sSpriteCount = {0}; // 20266A8 +UNUSED static EWRAM_DATA u32 sUnused2 = {0}; // 20266AC +static EWRAM_DATA unkStruct_20266B0 sUnknown_20266B0[160] = {0}; +static EWRAM_DATA void *sCharMemCursor = {0}; // 2026E30 +UNUSED static EWRAM_DATA u32 sUnused3 = {0}; // 2026E34 + +static EWRAM_DATA_2 unkStruct_20266B0 *sUnknown_203B074 = {0}; // code.c extern void nullsub_3(s32, s32); -void RegisterSpriteParts_80052BC(struct UnkSpriteMem *); -void sub_800545C(struct EntitySpriteInfo *, struct Dungeon_ax *, u32, u32, u32, bool8); +#ifndef NONMATCHING +UNUSED // TODO: Remove the "UNUSED" attribute after sub_8004EA8 is done +#endif +static void RegisterSpriteParts_80052BC(UnkSpriteMem *); + +static void sub_800545C(EntitySpriteInfo *, Dungeon_ax *, u32, u32, u32, bool8); void InitSprites(void) { @@ -31,17 +45,17 @@ void InitSprites(void) void ResetSprites(bool8 a0) { s32 i; - struct UnkSpriteLink *a; - struct UnkSpriteLink *b; - struct SpriteOAM *c; - struct SpriteOAM *d; - struct UnkSpriteLink *e; + UnkSpriteLink *a; + UnkSpriteLink *b; + SpriteOAM *c; + SpriteOAM *d; + UnkSpriteLink *e; - gSpriteCount = 0; - gCharMemCursor = OBJ_VRAM0; - gUnknown_203B074 = &gUnknown_20266B0[0]; + sSpriteCount = 0; + sCharMemCursor = OBJ_VRAM0; + sUnknown_203B074 = &sUnknown_20266B0[0]; - a = &gUnknown_20256A0.sprites[0]; + a = &sUnknown_20256A0.sprites[0]; b = a + 1; // 16 loops, very smart @@ -115,8 +129,8 @@ void ResetSprites(bool8 a0) if (a0) { e = NULL; - d = &gUnknown_20262A8[0]; - a = &gUnknown_2025EA8[0]; + d = &sUnknown_20262A8[0]; + a = &sUnknown_2025EA8[0]; for (i = 0; i < 128; i++) { a->unk0 = e; a->unk4 = d; @@ -125,11 +139,11 @@ void ResetSprites(bool8 a0) } } - gUnknown_20256A0.unk800 = 0; - gUnknown_20256A0.unk804 = 0; + sUnknown_20256A0.unk800 = 0; + sUnknown_20256A0.unk804 = 0; } -void sub_8004E8C(struct unkStruct_2039DB0 *a0) +void sub_8004E8C(unkStruct_2039DB0 *a0) { a0->unk0 = 0xFFFF; a0->unk2 = -1; @@ -142,7 +156,7 @@ void sub_8004E8C(struct unkStruct_2039DB0 *a0) // https://decomp.me/scratch/VYqKb // spriteMasks is a u16[6] #if NONMATCHING -void sub_8004EA8(struct ax_pose *a0, struct axdata1 *a1, struct UnkSpriteMem *a2, u16 *spriteMasks) +static void sub_8004EA8(ax_pose *a0, axdata1 *a1, UnkSpriteMem *a2, u16 *spriteMasks) { // size: 0xC struct UnkStackFor8004EA8 @@ -155,7 +169,7 @@ void sub_8004EA8(struct ax_pose *a0, struct axdata1 *a1, struct UnkSpriteMem *a2 u16 flags3; u16 unkA; } sp; - struct SpriteOAM *sprite; + SpriteOAM *sprite; u32 uVar9; s32 r7; @@ -167,7 +181,7 @@ void sub_8004EA8(struct ax_pose *a0, struct axdata1 *a1, struct UnkSpriteMem *a2 if (a2 != NULL) RegisterSpriteParts_80052BC(a2); - if (gSpriteCount >= 128) + if (sSpriteCount >= 128) return; sp.unk0 = a0->sprite; @@ -176,7 +190,7 @@ void sub_8004EA8(struct ax_pose *a0, struct axdata1 *a1, struct UnkSpriteMem *a2 sp.flags2 = a0->flags2 & ~(0x200 | 0x400 | 0x800); sp.flags3 = a0->flags3; sp.unkA = ((a0->flags2 & (0x200 | 0x400 | 0x800)) >> 9) | ((a0->flags1 & (0x1 | 0x2 | 0x4 | 0x8 | 0x10 | 0x20 | 0x40 | 0x80 | 0x100 | 0x200)) << 4); - sprite = gUnknown_20262A8 + gSpriteCount; + sprite = sUnknown_20262A8 + sSpriteCount; r7 = a1->unk16 + sp.unk3; if (r7 < 0) @@ -197,8 +211,8 @@ void sub_8004EA8(struct ax_pose *a0, struct axdata1 *a1, struct UnkSpriteMem *a2 sprite->unk6 = sp.unkA; } - if (sp.unk2 != 0 && gUnknown_2025672[sp.unk2] != 0) { - tileNum = gUnknown_2025672[sp.unk2] & 0x3FF; + if (sp.unk2 != 0 && sUnknown_2025672[sp.unk2] != 0) { + tileNum = sUnknown_2025672[sp.unk2] & 0x3FF; } else { tileNum = (sprite->attrib3 & 0x3FF) + a1->vramTileOrMaybeAnimTimer; @@ -236,15 +250,15 @@ void sub_8004EA8(struct ax_pose *a0, struct axdata1 *a1, struct UnkSpriteMem *a2 sprite->attrib3 = ((a1->paletteNum & 0xF) << 12) | (sprite->attrib3 & earlyMask); if (sp.unk2 != 0) - sprite->attrib3 = ((gUnknown_2025682[sp.unk2] & 0xF) << 12) | (sprite->attrib3 & earlyMask); + sprite->attrib3 = ((sUnknown_2025682[sp.unk2] & 0xF) << 12) | (sprite->attrib3 & earlyMask); - gUnknown_2025EA8[gSpriteCount].unk0 = gUnknown_20256A0.sprites[r7].unk0; - gUnknown_20256A0.sprites[r7].unk0 = gUnknown_2025EA8 + gSpriteCount; - gSpriteCount++; + sUnknown_2025EA8[sSpriteCount].unk0 = sUnknown_20256A0.sprites[r7].unk0; + sUnknown_20256A0.sprites[r7].unk0 = sUnknown_2025EA8 + sSpriteCount; + sSpriteCount++; } #else NAKED -void sub_8004EA8(struct ax_pose *a0, struct axdata1 *a1, struct UnkSpriteMem *a2, u16 *spriteMasks) +static void sub_8004EA8(ax_pose *a0, axdata1 *a1, UnkSpriteMem *a2, u16 *spriteMasks) { asm_unified( "push {r4-r7,lr}\n" @@ -327,11 +341,11 @@ void sub_8004EA8(struct ax_pose *a0, struct axdata1 *a1, struct UnkSpriteMem *a2 "\tstrh r0, [r1, 0x2]\n" "\tb _08004F86\n" "\t.align 2, 0\n" -"_08004F40: .4byte gSpriteCount\n" +"_08004F40: .4byte sSpriteCount\n" "_08004F44: .4byte 0x0000fcff\n" "_08004F48: .4byte 0x0000f1ff\n" "_08004F4C: .4byte 0x000003ff\n" -"_08004F50: .4byte gUnknown_20262A8\n" +"_08004F50: .4byte sUnknown_20262A8\n" "_08004F54:\n" "\tadd r4, sp, 0x4\n" "\tldrh r1, [r4]\n" @@ -377,7 +391,7 @@ void sub_8004EA8(struct ax_pose *a0, struct axdata1 *a1, struct UnkSpriteMem *a2 "\tands r1, r0\n" "\tb _08004FC0\n" "\t.align 2, 0\n" -"_08004FA8: .4byte gUnknown_2025672\n" +"_08004FA8: .4byte sUnknown_2025672\n" "_08004FAC: .4byte 0x000003ff\n" "_08004FB0:\n" "\tldrh r1, [r3, 0x4]\n" @@ -502,25 +516,25 @@ void sub_8004EA8(struct ax_pose *a0, struct axdata1 *a1, struct UnkSpriteMem *a2 "_08005098: .4byte 0xffffff00\n" "_0800509C: .4byte 0x00000fff\n" "_080050A0: .4byte 0xfffffe00\n" -"_080050A4: .4byte gUnknown_2025682\n" -"_080050A8: .4byte gUnknown_2025EA8\n" -"_080050AC: .4byte gUnknown_20256A0"); +"_080050A4: .4byte sUnknown_2025682\n" +"_080050A8: .4byte sUnknown_2025EA8\n" +"_080050AC: .4byte sUnknown_20256A0"); } #endif // NONMATCHING // a2 and a3 are always called with NULL lol #ifdef NONMATCHING // https://decomp.me/scratch/YCfKG -void AddSprite(struct SpriteOAM *a0, s32 a1, struct UnkSpriteMem *a2, struct unkStruct_2039DB0 *a3) +void AddSprite(SpriteOAM *a0, s32 a1, UnkSpriteMem *a2, unkStruct_2039DB0 *a3) { s32 yPos; - struct SpriteOAM *spr; - struct UnkSpriteLink *a; - struct UnkSpriteLink *b; + SpriteOAM *spr; + UnkSpriteLink *a; + UnkSpriteLink *b; - if (gSpriteCount >= 128) + if (sSpriteCount >= 128) return; - spr = &gUnknown_20262A8[gSpriteCount]; + spr = &sUnknown_20262A8[sSpriteCount]; if (a1 < 0) a1 = 0; @@ -549,18 +563,18 @@ void AddSprite(struct SpriteOAM *a0, s32 a1, struct UnkSpriteMem *a2, struct unk if (a2 != NULL) RegisterSpriteParts_80052BC(a2); - a = &gUnknown_2025EA8[0]; - a += gSpriteCount; - b = &gUnknown_20256A0.sprites[0]; + a = &sUnknown_2025EA8[0]; + a += sSpriteCount; + b = &sUnknown_20256A0.sprites[0]; b += a1; a->unk0 = b->unk0; b->unk0 = a; - gSpriteCount++; + sSpriteCount++; } #else NAKED -void AddSprite(struct SpriteOAM *a0, s32 a1, struct UnkSpriteMem *a2, struct unkStruct_2039DB0 *a3) +void AddSprite(SpriteOAM *a0, s32 a1, UnkSpriteMem *a2, unkStruct_2039DB0 *a3) { asm_unified( "push {r4-r7,lr}\n" @@ -599,8 +613,8 @@ void AddSprite(struct SpriteOAM *a0, s32 a1, struct UnkSpriteMem *a2, struct unk "\tstrh r0, [r2, 0x2]\n" "\tb _08005128\n" "\t.align 2, 0\n" -"_080050F4: .4byte gSpriteCount\n" -"_080050F8: .4byte gUnknown_20262A8\n" +"_080050F4: .4byte sSpriteCount\n" +"_080050F8: .4byte sUnknown_20262A8\n" "_080050FC:\n" "\tldrh r1, [r6]\n" "\tldrh r0, [r4]\n" @@ -663,18 +677,18 @@ void AddSprite(struct SpriteOAM *a0, s32 a1, struct UnkSpriteMem *a2, struct unk "\tpop {r0}\n" "\tbx r0\n" "\t.align 2, 0\n" -"_08005174: .4byte gUnknown_2025EA8\n" -"_08005178: .4byte gSpriteCount\n" -"_0800517C: .4byte gUnknown_20256A0"); +"_08005174: .4byte sUnknown_2025EA8\n" +"_08005178: .4byte sSpriteCount\n" +"_0800517C: .4byte sUnknown_20256A0"); } #endif void sub_8005180(void) { - struct UnkSpriteLink *r1; - struct UnkSpriteLink *r2; + UnkSpriteLink *r1; + UnkSpriteLink *r2; - r2 = &gUnknown_20256A0.sprites[0]; + r2 = &sUnknown_20256A0.sprites[0]; r1 = r2; if (r2 != NULL) { @@ -693,12 +707,12 @@ void sub_8005180(void) void CopySpritesToOam(void) { - struct UnkSpriteLink *sLink; - struct SpriteOAM *spr; + UnkSpriteLink *sLink; + SpriteOAM *spr; vu16 *oam; s32 count; - sLink = &gUnknown_20256A0.sprites[0]; + sLink = &sUnknown_20256A0.sprites[0]; oam = (vu16 *)(OAM + OAM_SIZE); // End of OAM. Work backwards count = 0; @@ -738,29 +752,29 @@ void CopySpritesToOam(void) *oam = DISPLAY_HEIGHT; } - gUnknown_2025670 = count; + sOAMSpriteCount = count; } -void SetSavingIconCoords(struct Position *pos) +void SetSavingIconCoords(Position *pos) { if (pos == NULL) { - gUnknown_2025694.x = 0; - gUnknown_2025694.y = DISPLAY_HEIGHT; + sUnknown_2025694.x = 0; + sUnknown_2025694.y = DISPLAY_HEIGHT; } else { - gUnknown_2025694.x = pos->x; - gUnknown_2025694.y = pos->y; - gUnknown_2025698 = 0; + sUnknown_2025694.x = pos->x; + sUnknown_2025694.y = pos->y; + sUnknown_2025698 = 0; } } void BlinkSavingIcon(void) { - volatile u16 *oam; + vu16 *oam; u32 uVar1; - oam = (u16 *)OAM; - uVar1 = gUnknown_2025698++; + oam = (vu16 *)OAM; + uVar1 = sUnknown_2025698++; if (uVar1 & 16) { // Set y to 160 @@ -777,13 +791,13 @@ void BlinkSavingIcon(void) *oam = 0; } else { - // Set y to gUnknown_2025694.y + // Set y to sUnknown_2025694.y // Set affineMode/objMode/mosaic/bpp/shape to 0 - *oam++ = gUnknown_2025694.y; - // Set x to gUnknown_2025694.x + *oam++ = sUnknown_2025694.y; + // Set x to sUnknown_2025694.x // Set matrixNum to 0 // Set size to 1 - *oam++ = gUnknown_2025694.x + 0x4000; + *oam++ = sUnknown_2025694.x + 0x4000; // Set tileNum to 0x3FC // Set priority to 0 // Set paletteNum to 15 @@ -794,15 +808,15 @@ void BlinkSavingIcon(void) } #ifdef NONMATCHING // https://decomp.me/scratch/taTIU -extern u32 RegisterSpriteParts_80052BC_end[0] asm("gCharMemCursor"); -void RegisterSpriteParts_80052BC(struct UnkSpriteMem *a0) +extern u32 RegisterSpriteParts_80052BC_end[0] asm("sCharMemCursor"); +static void RegisterSpriteParts_80052BC(UnkSpriteMem *a0) { if (a0->byteCount) { - struct unkStruct_20266B0 **r5 = &gUnknown_203B074; + unkStruct_20266B0 **r5 = &sUnknown_203B074; void *r6 = RegisterSpriteParts_80052BC_end; - void **r4 = &gCharMemCursor; + void **r4 = &sCharMemCursor; do { - struct unkStruct_20266B0 *r2 = *r5; + unkStruct_20266B0 *r2 = *r5; if ((uintptr_t)r2 >= (uintptr_t)r6) return; r2->byteCount = a0->byteCount; @@ -815,8 +829,9 @@ void RegisterSpriteParts_80052BC(struct UnkSpriteMem *a0) } } #else +UNUSED // TODO: Remove the "UNUSED" attribute after sub_8004EA8 is done NAKED -void RegisterSpriteParts_80052BC(struct UnkSpriteMem *a0) +static void RegisterSpriteParts_80052BC(UnkSpriteMem *a0) { asm_unified( "push {r4-r6,lr}\n" @@ -852,17 +867,17 @@ void RegisterSpriteParts_80052BC(struct UnkSpriteMem *a0) "\tpop {r0}\n" "\tbx r0\n" "\t.align 2, 0\n" -"_080052F8: .4byte gUnknown_203B074\n" -"_080052FC: .4byte gCharMemCursor\n" -"_08005300: .4byte gCharMemCursor"); +"_080052F8: .4byte sUnknown_203B074\n" +"_080052FC: .4byte sCharMemCursor\n" +"_08005300: .4byte sCharMemCursor"); } #endif // NONMATCHING void sub_8005304(void) { - struct unkStruct_20266B0 *s; + unkStruct_20266B0 *s; - for (s = &gUnknown_20266B0[0]; s < gUnknown_203B074; s++) { + for (s = &sUnknown_20266B0[0]; s < sUnknown_203B074; s++) { if (s->src != NULL) CpuCopy(s->dest, s->src, s->byteCount); else @@ -871,13 +886,13 @@ void sub_8005304(void) } // spriteMasks is a u16[6] -void sub_800533C(struct ax_pose **a0, struct UnkSpriteMem **a1, struct axdata1 *a2, u16 *spriteMasks, bool8 a4) +void sub_800533C(ax_pose **a0, UnkSpriteMem **a1, axdata1 *a2, u16 *spriteMasks, bool8 a4) { - struct UnkSpriteMem *mem; - struct ax_pose *r4; + UnkSpriteMem *mem; + ax_pose *r4; r4 = a0[a2->poseId]; - gCharMemCursor = OBJ_VRAM0 + (a2->vramTileOrMaybeAnimTimer * 0x20); + sCharMemCursor = OBJ_VRAM0 + (a2->vramTileOrMaybeAnimTimer * 0x20); for (mem = NULL; (u16)r4->sprite != 0xFFFF || r4->unk2 != 0xFFFF; r4++, mem = NULL) { if (a4 != 0 && r4->sprite > -1) mem = a1[r4->sprite]; @@ -886,12 +901,12 @@ void sub_800533C(struct ax_pose **a0, struct UnkSpriteMem **a1, struct axdata1 * } } -void sub_80053AC(struct EntitySpriteInfo *a0, struct OpenedFile *a1, u32 a2, u32 a3, u32 a4, u32 spriteAnimIndex, bool8 a6) +void sub_80053AC(EntitySpriteInfo *a0, OpenedFile *a1, u32 a2, u32 a3, u32 a4, u32 spriteAnimIndex, bool8 a6) { - sub_80053D0(a0, (struct Dungeon_ax *)a1->data, a2, a3, a4, spriteAnimIndex, a6); + sub_80053D0(a0, (Dungeon_ax *)a1->data, a2, a3, a4, spriteAnimIndex, a6); } -void sub_80053D0(struct EntitySpriteInfo *a0, struct Dungeon_ax *a1, u32 a2, u32 direction, u32 a4, u32 spriteAnimIndex, bool8 a6) +void sub_80053D0(EntitySpriteInfo *a0, Dungeon_ax *a1, u32 a2, u32 direction, u32 a4, u32 spriteAnimIndex, bool8 a6) { a0->unk0 = 0x8000; if (a6) @@ -914,12 +929,12 @@ void sub_80053D0(struct EntitySpriteInfo *a0, struct Dungeon_ax *a1, u32 a2, u32 a0->unk30 = a1->unk10; } -void sub_800543C(struct EntitySpriteInfo *a0, struct OpenedFile *a1, u32 a2, u32 a3, u32 spriteAnimIndex, bool8 a5) +void sub_800543C(EntitySpriteInfo *a0, OpenedFile *a1, u32 a2, u32 a3, u32 spriteAnimIndex, bool8 a5) { - sub_800545C(a0, (struct Dungeon_ax *)a1->data, a2, a3, spriteAnimIndex, a5); + sub_800545C(a0, (Dungeon_ax *)a1->data, a2, a3, spriteAnimIndex, a5); } -void sub_800545C(struct EntitySpriteInfo *a0, struct Dungeon_ax *a1, u32 a2, u32 a3, u32 spriteAnimIndex, bool8 a5) +static void sub_800545C(EntitySpriteInfo *a0, Dungeon_ax *a1, u32 a2, u32 a3, u32 spriteAnimIndex, bool8 a5) { a0->unk0 = 0x8000; if (a5) @@ -941,10 +956,10 @@ void sub_800545C(struct EntitySpriteInfo *a0, struct Dungeon_ax *a1, u32 a2, u32 a0->unk30 = 0; } -#if NONMATCHING // https://decomp.me/scratch/n4Umb +#if NONMATCHING // 99.95% https://decomp.me/scratch/n4Umb void sub_80054BC(struct axPokemon *a0) { - struct ax_anim *aData; + ax_anim *aData; s16 flag; if (a0->axdata.flags & 0x2000) diff --git a/src/status.c b/src/status.c index c0126be35..df26e8153 100644 --- a/src/status.c +++ b/src/status.c @@ -1,5 +1,6 @@ #include "global.h" #include "status.h" +#include "code_806CD90.h" #include "constants/ability.h" #include "constants/status.h" #include "constants/type.h" @@ -119,57 +120,55 @@ extern s16 gUnknown_80F4EF4[]; extern s32 gUnknown_202DE30[10]; -extern void sub_8041D84(struct Entity *); +extern void sub_8041D84(Entity *); extern void sub_804178C(u32); -extern void sub_8041D5C(struct Entity *); -extern void RaiseAttackStageTarget(struct Entity *, struct Entity *, u32, u32); -extern void RaiseDefenseStageTarget(struct Entity *, struct Entity *, u32, u32); -extern void sub_8041D48(struct Entity *); -extern u8 sub_806CEBC(struct Entity *); -extern void sub_8041D38(struct Entity * pokemon); +extern void sub_8041D5C(Entity *); +extern void RaiseAttackStageTarget(Entity *, Entity *, u32, u32); +extern void RaiseDefenseStageTarget(Entity *, Entity *, u32, u32); +extern void sub_8041D48(Entity *); +extern void sub_8041D38(Entity * pokemon); extern void sub_803E46C(u32); -extern void sub_806CCB4(struct Entity *, u8); extern u8 sub_8043D10(void); -extern void sub_8041CDC(struct Entity *pokemon); -extern void sub_8041CEC(struct Entity *pokemon); -extern void nullsub_73(struct Entity *); -extern void nullsub_74(struct Entity *); -extern void nullsub_75(struct Entity *); -extern void nullsub_76(struct Entity *); -extern void nullsub_77(struct Entity *); -extern void nullsub_78(struct Entity *); -extern void nullsub_79(struct Entity *); -extern void nullsub_80(struct Entity *); -extern void nullsub_81(struct Entity *); -extern void nullsub_82(struct Entity *); -extern void nullsub_83(struct Entity *); +extern void sub_8041CDC(Entity *pokemon); +extern void sub_8041CEC(Entity *pokemon); +extern void nullsub_73(Entity *); +extern void nullsub_74(Entity *); +extern void nullsub_75(Entity *); +extern void nullsub_76(Entity *); +extern void nullsub_77(Entity *); +extern void nullsub_78(Entity *); +extern void nullsub_79(Entity *); +extern void nullsub_80(Entity *); +extern void nullsub_81(Entity *); +extern void nullsub_82(Entity *); +extern void nullsub_83(Entity *); extern void sub_803F580(u32); extern void sub_8040A84(void); -extern void sub_8041CA8(struct Entity *); -extern void sub_8041C94(struct Entity *); -extern u8 sub_8045888(struct Entity *r0); -extern void sub_803ED30(s32, struct Entity *r0, u8, s32); -extern void sub_8041BF8(struct Entity *); -extern void sub_8041BE8(struct Entity *); -extern void sub_8041CCC(struct Entity *); -extern void sub_8041CB8(struct Entity *r0); -extern void sub_8041C1C(struct Entity *r0); -extern void sub_8042060(struct Entity *, s32); -extern bool8 sub_8071728(struct Entity * param_1, struct Entity * param_2, u8 param_3); -extern void sub_8041FB4(struct Entity *r0, u32 r1); -extern void sub_8041FD8(struct Entity *r0, u32 r1); -extern void sub_80522F4(struct Entity *r1, struct Entity *r2, u8 *); +extern void sub_8041CA8(Entity *); +extern void sub_8041C94(Entity *); +extern u8 sub_8045888(Entity *r0); +extern void sub_803ED30(s32, Entity *r0, u8, s32); +extern void sub_8041BF8(Entity *); +extern void sub_8041BE8(Entity *); +extern void sub_8041CCC(Entity *); +extern void sub_8041CB8(Entity *r0); +extern void sub_8041C1C(Entity *r0); +extern void sub_8042060(Entity *, s32); +extern bool8 sub_8071728(Entity * param_1, Entity * param_2, u8 param_3); +extern void sub_8041FB4(Entity *r0, u32 r1); +extern void sub_8041FD8(Entity *r0, u32 r1); +extern void sub_80522F4(Entity *r1, Entity *r2, u8 *); extern s32 sub_8009DA4(s32, s32); -extern void sub_804201C(struct Entity *r0, u32 r1); -extern void sub_8041FFC(struct Entity *r0, u32 r1); -extern void SetMessageArgument(char[], struct Entity*, u32); -extern void SetMessageArgument_2(char[], struct EntityInfo*, u32); -extern void sub_8041C58(struct Entity *r0); -extern void EntityUpdateStatusSprites(struct Entity *); -extern void sub_8042040(struct Entity *, s32); -extern void sub_80420A0(struct Entity *); +extern void sub_804201C(Entity *r0, u32 r1); +extern void sub_8041FFC(Entity *r0, u32 r1); +extern void SetMessageArgument(char[], Entity*, u32); +extern void SetMessageArgument_2(char[], EntityInfo*, u32); +extern void sub_8041C58(Entity *r0); +extern void EntityUpdateStatusSprites(Entity *); +extern void sub_8042040(Entity *, s32); +extern void sub_80420A0(Entity *); -u8 GetFlashFireStatus(struct Entity *pokemon) +u8 GetFlashFireStatus(Entity *pokemon) { if (!EntityExists(pokemon) || !HasAbility(pokemon, ABILITY_FLASH_FIRE)) { @@ -182,7 +181,7 @@ u8 GetFlashFireStatus(struct Entity *pokemon) return FLASH_FIRE_STATUS_NOT_MAXED; } -static inline s32 UpdateFlashFireBoost_sub(struct EntityInfo * entityInfo) +static inline s32 UpdateFlashFireBoost_sub(EntityInfo * entityInfo) { s32 flashFireBoost; @@ -194,10 +193,10 @@ static inline s32 UpdateFlashFireBoost_sub(struct EntityInfo * entityInfo) return flashFireBoost; } -void UpdateFlashFireBoost(struct Entity * pokemon, struct Entity *target) +void UpdateFlashFireBoost(Entity * pokemon, Entity *target) { - struct EntityInfo * entityInfo; - struct EntityInfo * entityInfo_1; + EntityInfo * entityInfo; + EntityInfo * entityInfo_1; s32 flashFireBoost; if (EntityExists(target)) { @@ -213,9 +212,9 @@ void UpdateFlashFireBoost(struct Entity * pokemon, struct Entity *target) } } -void ChangeAttackMultiplierTarget(struct Entity *pokemon, struct Entity *target, u32 statStage, s32 param_4, bool8 displayMessage) +void ChangeAttackMultiplierTarget(Entity *pokemon, Entity *target, u32 statStage, s32 param_4, bool8 displayMessage) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; s32 oldMulti; if (!EntityExists(target)) { @@ -278,9 +277,9 @@ void ChangeAttackMultiplierTarget(struct Entity *pokemon, struct Entity *target, EntityUpdateStatusSprites(target); } -void ChangeDefenseMultiplierTarget(struct Entity *pokemon, struct Entity *target, u32 statStage, s32 param_4, bool8 displayMessage) +void ChangeDefenseMultiplierTarget(Entity *pokemon, Entity *target, u32 statStage, s32 param_4, bool8 displayMessage) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; s32 oldMulti; if (!EntityExists(target)) { @@ -329,9 +328,9 @@ void ChangeDefenseMultiplierTarget(struct Entity *pokemon, struct Entity *target EntityUpdateStatusSprites(target); } -void RaiseAccuracyStageTarget(struct Entity * pokemon, struct Entity * target, s32 statStage) +void RaiseAccuracyStageTarget(Entity * pokemon, Entity * target, s32 statStage) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { entityInfo = target->info; @@ -354,9 +353,9 @@ void RaiseAccuracyStageTarget(struct Entity * pokemon, struct Entity * target, s } } -void LowerAccuracyStageTarget(struct Entity * pokemon, struct Entity * target, s32 statStage, bool8 displayMessage) +void LowerAccuracyStageTarget(Entity * pokemon, Entity * target, s32 statStage, bool8 displayMessage) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { if (statStage != STAT_STAGE_ACCURACY) { @@ -390,9 +389,9 @@ void LowerAccuracyStageTarget(struct Entity * pokemon, struct Entity * target, s } } -void CringeStatusTarget(struct Entity * pokemon,struct Entity * target, bool8 displayMessage) +void CringeStatusTarget(Entity * pokemon,Entity * target, bool8 displayMessage) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { if (!HasSafeguardStatus(pokemon, target, displayMessage)) { @@ -421,11 +420,11 @@ void CringeStatusTarget(struct Entity * pokemon,struct Entity * target, bool8 di } } -void ParalyzeStatusTarget(struct Entity * pokemon, struct Entity * target, bool8 displayMessage) +void ParalyzeStatusTarget(Entity * pokemon, Entity * target, bool8 displayMessage) { struct Tile *mapTile; - struct EntityInfo *entityInfo; - struct Entity *mapPokemonEntity; + EntityInfo *entityInfo; + Entity *mapPokemonEntity; int index; bool8 bVar6; bool8 bVar7; @@ -479,12 +478,12 @@ void ParalyzeStatusTarget(struct Entity * pokemon, struct Entity * target, bool8 } } -void RaiseMovementSpeedTarget(struct Entity * pokemon, struct Entity * target, s32 turns, bool8 displayMessage) +void RaiseMovementSpeedTarget(Entity * pokemon, Entity * target, s32 turns, bool8 displayMessage) { s32 movSpeed; s32 index; s32 movSpeed_1; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (!EntityExists(target)) { return; @@ -523,13 +522,13 @@ void RaiseMovementSpeedTarget(struct Entity * pokemon, struct Entity * target, s EntityUpdateStatusSprites(target); } -void LowerMovementSpeedTarget(struct Entity * pokemon, struct Entity * target, s32 levels, bool8 displayMessage) +void LowerMovementSpeedTarget(Entity * pokemon, Entity * target, s32 levels, bool8 displayMessage) { s32 movSpeed; s32 counter; s32 index; s32 movSpeed_1; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (!EntityExists(target)) { return; @@ -569,9 +568,9 @@ void LowerMovementSpeedTarget(struct Entity * pokemon, struct Entity * target, s EntityUpdateStatusSprites(target); } -void ConfuseStatusTarget(struct Entity * pokemon, struct Entity * target, bool8 displayMessage) +void ConfuseStatusTarget(Entity * pokemon, Entity * target, bool8 displayMessage) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (!EntityExists(target)) { return; @@ -609,9 +608,9 @@ void ConfuseStatusTarget(struct Entity * pokemon, struct Entity * target, bool8 } } -void CowerStatusTarget(struct Entity * pokemon, struct Entity * target, bool8 displayMessage) +void CowerStatusTarget(Entity * pokemon, Entity * target, bool8 displayMessage) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if ((EntityExists(target)) && (!HasSafeguardStatus(pokemon,target,displayMessage))) { entityInfo = target->info; @@ -629,9 +628,9 @@ void CowerStatusTarget(struct Entity * pokemon, struct Entity * target, bool8 di } } -void HealTargetHP(struct Entity *pokemon, struct Entity *target, s32 param_3, s32 param_4, bool32 displayMessage) +void HealTargetHP(Entity *pokemon, Entity *target, s32 param_3, s32 param_4, bool32 displayMessage) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; s32 HP; s32 maxHPStat; s32 r8; @@ -709,7 +708,7 @@ void HealTargetHP(struct Entity *pokemon, struct Entity *target, s32 param_3, s3 } } -void HandleScannerOrb(struct Entity* pokemon, struct Entity* target) +void HandleScannerOrb(Entity* pokemon, Entity* target) { if (EntityExists(target)) { if (target->info->scanning) { @@ -728,7 +727,7 @@ void HandleScannerOrb(struct Entity* pokemon, struct Entity* target) } } -void HandleStairsOrb(struct Entity* pokemon, struct Entity* target) +void HandleStairsOrb(Entity* pokemon, Entity* target) { if (EntityExists(target)) { if(sub_8043D10()) @@ -754,7 +753,7 @@ void HandleStairsOrb(struct Entity* pokemon, struct Entity* target) } } -void HandleRadarOrb(struct Entity* pokemon, struct Entity* target) +void HandleRadarOrb(Entity* pokemon, Entity* target) { if (EntityExists(target)) { if (target->info->powerEars != 0) { @@ -773,10 +772,10 @@ void HandleRadarOrb(struct Entity* pokemon, struct Entity* target) } } -void HandleLeechSeed(struct Entity * pokemon, struct Entity * target, bool8 displayMessage) +void HandleLeechSeed(Entity * pokemon, Entity * target, bool8 displayMessage) { - struct EntityInfo *entityInfo; - struct EntityInfo *entityInfo2; + EntityInfo *entityInfo; + EntityInfo *entityInfo2; s32 index; if ((EntityExists(target)) && (GetEntityType(pokemon) == ENTITY_MONSTER)) { @@ -827,11 +826,11 @@ void HandleLeechSeed(struct Entity * pokemon, struct Entity * target, bool8 disp } } -void sub_8078084(struct Entity * pokemon) +void sub_8078084(Entity * pokemon) { - struct EntityInfo *entityInfo; - struct EntityInfo *entityInfo2; - struct Entity *target; + EntityInfo *entityInfo; + EntityInfo *entityInfo2; + Entity *target; s32 index; entityInfo = pokemon->info; @@ -852,10 +851,10 @@ void sub_8078084(struct Entity * pokemon) } } -void DestinyBondStatusTarget(struct Entity * pokemon, struct Entity * target) +void DestinyBondStatusTarget(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; - struct EntityInfo *entityInfo2; + EntityInfo *entityInfo; + EntityInfo *entityInfo2; s32 index; u8 *linkedStatus; s32 zero; @@ -894,9 +893,9 @@ void DestinyBondStatusTarget(struct Entity * pokemon, struct Entity * target) } } -void SureShotStatusTarget(struct Entity *pokemon, struct Entity * target, s32 turns) +void SureShotStatusTarget(Entity *pokemon, Entity * target, s32 turns) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { entityInfo = target->info; @@ -914,9 +913,9 @@ void SureShotStatusTarget(struct Entity *pokemon, struct Entity * target, s32 tu } } -void WhifferStatusTarget(struct Entity *pokemon, struct Entity * target, s32 turns) +void WhifferStatusTarget(Entity *pokemon, Entity * target, s32 turns) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target) && !HasSafeguardStatus(pokemon, target, TRUE)) { entityInfo = target->info; @@ -934,9 +933,9 @@ void WhifferStatusTarget(struct Entity *pokemon, struct Entity * target, s32 tur } } -void FixedDamageStatusTarget(struct Entity *pokemon, struct Entity * target) +void FixedDamageStatusTarget(Entity *pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { entityInfo = target->info; @@ -954,9 +953,9 @@ void FixedDamageStatusTarget(struct Entity *pokemon, struct Entity * target) } } -void FocusEnergyStatusTarget(struct Entity *pokemon, struct Entity * target) +void FocusEnergyStatusTarget(Entity *pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if (EntityExists(target)) { entityInfo = target->info; @@ -974,13 +973,13 @@ void FocusEnergyStatusTarget(struct Entity *pokemon, struct Entity * target) } } -void sub_80783C4(struct Entity * pokemon, struct Entity * target, u8 param_3) +void sub_80783C4(Entity * pokemon, Entity * target, u8 param_3) { - struct EntityInfo *targetEntityInfo; - struct EntityInfo *entityInfo; - struct Entity * entity; - struct Entity * entity2; - struct ActionContainer action; + EntityInfo *targetEntityInfo; + EntityInfo *entityInfo; + Entity * entity; + Entity * entity2; + ActionContainer action; s32 index; if ((EntityExists(target)) && (!HasSafeguardStatus(pokemon, target, TRUE))) { @@ -1033,12 +1032,12 @@ void sub_80783C4(struct Entity * pokemon, struct Entity * target, u8 param_3) } } -void CurseStatusTarget(struct Entity *pokemon, struct Entity * target) +void CurseStatusTarget(Entity *pokemon, Entity * target) { u32 statStage; s32 HP; - struct EntityInfo * pokemonEntityData; - struct EntityInfo * targetEntityInfo; + EntityInfo * pokemonEntityData; + EntityInfo * targetEntityInfo; if ((EntityExists(pokemon) ) && (EntityExists(target))) { @@ -1073,12 +1072,12 @@ void CurseStatusTarget(struct Entity *pokemon, struct Entity * target) } } -void SnatchStatusTarget(struct Entity * pokemon, struct Entity * target) +void SnatchStatusTarget(Entity * pokemon, Entity * target) { - struct Entity * entity; + Entity * entity; s32 index; - struct EntityInfo * targetEntityInfo; - struct EntityInfo * targetEntityInfo2; + EntityInfo * targetEntityInfo; + EntityInfo * targetEntityInfo2; if (EntityExists(target)) { SendWaitingEndMessage(pokemon,target,STATUS_SNATCH); @@ -1108,9 +1107,9 @@ void SnatchStatusTarget(struct Entity * pokemon, struct Entity * target) } } -void TauntStatusTarget(struct Entity * pokemon, struct Entity * target) +void TauntStatusTarget(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if ((EntityExists(target)) && (!HasSafeguardStatus(pokemon,target,TRUE))) { entityInfo = target->info; @@ -1128,9 +1127,9 @@ void TauntStatusTarget(struct Entity * pokemon, struct Entity * target) } } -void HandleStockpile(struct Entity * pokemon, struct Entity * target) +void HandleStockpile(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; if ((EntityExists(target))) { entityInfo = target->info; @@ -1149,10 +1148,10 @@ void HandleStockpile(struct Entity * pokemon, struct Entity * target) } } -void InvisibleStatusTarget(struct Entity * pokemon, struct Entity * target) +void InvisibleStatusTarget(Entity * pokemon, Entity * target) { - struct EntityInfo * targetEntityInfo; - struct EntityInfo * targetEntityInfo_1; + EntityInfo * targetEntityInfo; + EntityInfo * targetEntityInfo_1; if (EntityExists(target)) { targetEntityInfo = target->info; @@ -1174,9 +1173,9 @@ void InvisibleStatusTarget(struct Entity * pokemon, struct Entity * target) } } -void PerishSongTarget(struct Entity * pokemon, struct Entity * target) +void PerishSongTarget(Entity * pokemon, Entity * target) { - struct EntityInfo * entityInfo; + EntityInfo * entityInfo; if (EntityExists(target) && !HasSafeguardStatus(pokemon, target, TRUE)) { nullsub_82(target); @@ -1193,11 +1192,11 @@ void PerishSongTarget(struct Entity * pokemon, struct Entity * target) } } -void EncoreStatusTarget(struct Entity *pokemon,struct Entity *target) +void EncoreStatusTarget(Entity *pokemon,Entity *target) { - struct Move *movePtr; + Move *movePtr; int index; - struct EntityInfo *EntityInfo; + EntityInfo *EntityInfo; EntityInfo = target->info; if ((EntityExists(target)) && (!HasSafeguardStatus(pokemon,target,TRUE))) { diff --git a/src/status_actions.c b/src/status_actions.c index 216a9253c..0510282cc 100644 --- a/src/status_actions.c +++ b/src/status_actions.c @@ -1,6 +1,6 @@ #include "global.h" #include "status_actions.h" - +#include "code_806CD90.h" #include "code_80521D0.h" #include "code_8077274_1.h" #include "code_808417C.h" @@ -24,71 +24,70 @@ //#include "pokemon.h" // NOTE: overriding some of the funcs below... when fixed, uncomment this #include "status.h" #include "status_checks_1.h" -#include "team_inventory.h" + #include "text_util.h" #include "tile_types.h" #include "trap.h" #include "weather.h" -extern void sub_807F43C(struct Entity *, struct Entity *); -extern void MobileStatusTarget(struct Entity *, struct Entity *); -extern void sub_807DC68(struct Entity *, struct Entity *); -extern void sub_8078A58(struct Entity *, struct Entity *, s16, u32); +extern void sub_807F43C(Entity *, Entity *); +extern void MobileStatusTarget(Entity *, Entity *); +extern void sub_807DC68(Entity *, Entity *); +extern void sub_8078A58(Entity *, Entity *, s16, u32); extern u32 sub_803D73C(u32); -extern void sub_8045C28(struct Item *, u8 , u8); -extern void sub_80464C8(struct Entity *, struct Position *, struct Item *); -extern void sub_8068FE0(struct Entity *, u32, struct Entity *r2); -extern void sub_80522F4(struct Entity *r1, struct Entity *r2, const char []); -extern void sub_806F370(struct Entity *r0, struct Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32); -extern void sub_807FC3C(struct Position *, u32, u32); -extern void sub_8042A64(struct Position *); +extern void sub_8045C28(Item *, u8 , u8); +extern void sub_80464C8(Entity *, Position *, Item *); +extern void sub_8068FE0(Entity *, u32, Entity *r2); +extern void sub_80522F4(Entity *r1, Entity *r2, const char []); +extern void sub_806F370(Entity *r0, Entity *r1, u32, u32, u8 *, u8, s32, u32, u32, u32); +extern void sub_807FC3C(Position *, u32, u32); +extern void sub_8042A64(Position *); extern void sub_8040A84(void); extern void sub_8049ED4(void); extern void sub_80498A8(s32, s32); -extern void sub_806CF60(); -extern void sub_8042A54(struct Position *); +extern void sub_8042A54(Position *); extern void sub_8049BB0(s32, s32); -extern s16 sub_8057600(struct Move*, u32); -extern u32 sub_8055864(struct Entity *pokemon, struct Entity *target, struct Move *param_3, s32 param_4, s32 param_5); -extern void sub_807D148(struct Entity *pokemon, struct Entity *r1, u32 r2, struct Position *r3); +extern s16 sub_8057600(Move*, u32); +extern u32 sub_8055864(Entity *pokemon, Entity *target, Move *param_3, s32 param_4, s32 param_5); +extern void sub_807D148(Entity *pokemon, Entity *r1, u32 r2, Position *r3); extern void sub_807FE04(u32 *, u32); -extern void sub_807DB74(struct Entity *); -extern void SetMessageArgument(char[], struct Entity*, u32); -extern void HandleLuminousOrbAction(struct Entity *pokemon); -extern void sub_807D510(struct Entity *, struct Entity *); -extern void sub_807DA14(struct Entity *, struct Entity *, s32); +extern void sub_807DB74(Entity *); +extern void SetMessageArgument(char[], Entity*, u32); +extern void HandleLuminousOrbAction(Entity *pokemon); +extern void sub_807D510(Entity *, Entity *); +extern void sub_807DA14(Entity *, Entity *, s32); extern s16 sub_803D970(u32); extern u8 sub_806AA0C(s32, u32); -extern void sub_806BB6C(struct Entity *, s32); -extern void sub_8075C58(struct Entity *, struct Entity *, s32, s32); -extern void sub_807E254(struct Entity *, struct Entity *, u32); -extern bool8 sub_805727C(struct Entity * pokemon, struct Entity * target, s32 chance); -extern u32 sub_8055640(struct Entity *, struct Entity *, struct Move *, u32, u32); -extern void sub_806A6E8(struct Entity *); -extern void sub_807D3CC(struct Entity *, struct Entity *); -extern u8 sub_8069D18(struct Position *); -extern u8 sub_804AD34(struct Position *); -extern u8 sub_8057308(struct Entity *, u32); +extern void sub_806BB6C(Entity *, s32); +extern void sub_8075C58(Entity *, Entity *, s32, s32); +extern void sub_807E254(Entity *, Entity *, u32); +extern bool8 sub_805727C(Entity * pokemon, Entity * target, s32 chance); +extern u32 sub_8055640(Entity *, Entity *, Move *, u32, u32); +extern void sub_806A6E8(Entity *); +extern void sub_807D3CC(Entity *, Entity *); +extern u8 sub_8069D18(Position *); +extern u8 sub_804AD34(Position *); +extern u8 sub_8057308(Entity *, u32); // TODO include dungeon_ai.h when SqueezedStatusTarget is figured out -extern void LowerDefenseStageTarget(struct Entity *, struct Entity *, s32, s32, u8, bool8); -extern void RaiseAttackStageTarget(struct Entity *, struct Entity *, s32, s32); -extern void PoisonedStatusTarget(struct Entity *, struct Entity *, bool8); -extern void RaiseDefenseStageTarget(struct Entity *, struct Entity *, s32, s32); -extern void InfatuateStatusTarget(struct Entity *, struct Entity *, bool8); -extern void LowerAttackStageTarget(struct Entity *, struct Entity *, s32, s32, u8, bool8); -extern void PetrifiedStatusTarget(struct Entity *, struct Entity *); -extern void WrapTarget(struct Entity *, struct Entity *); +extern void LowerDefenseStageTarget(Entity *, Entity *, s32, s32, u8, bool8); +extern void RaiseAttackStageTarget(Entity *, Entity *, s32, s32); +extern void PoisonedStatusTarget(Entity *, Entity *, bool8); +extern void RaiseDefenseStageTarget(Entity *, Entity *, s32, s32); +extern void InfatuateStatusTarget(Entity *, Entity *, bool8); +extern void LowerAttackStageTarget(Entity *, Entity *, s32, s32, u8, bool8); +extern void PetrifiedStatusTarget(Entity *, Entity *); +extern void WrapTarget(Entity *, Entity *); // TODO having matching issues when this isn't s32.. -extern void SqueezedStatusTarget(struct Entity *, struct Entity *, s32, bool32); +extern void SqueezedStatusTarget(Entity *, Entity *, s32, bool32); -extern void sub_806F324(struct Entity *, s32, u32, u32); -extern bool8 sub_805755C(struct Entity* pokemon,u16 moveID); -extern void sub_80783C4(struct Entity *, struct Entity *, u32); -extern bool8 sub_807FCD4(struct Position *, u32, u8); -extern void sub_807CD9C(struct Entity *, struct Entity *, u8 direction); +extern void sub_806F324(Entity *, s32, u32, u32); +extern bool8 sub_805755C(Entity* pokemon,u16 moveID); +extern void sub_80783C4(Entity *, Entity *, u32); +extern bool8 sub_807FCD4(Position *, u32, u8); +extern void sub_807CD9C(Entity *, Entity *, u8 direction); // NOTE: Override pokemon.c types for these two funcs @@ -154,7 +153,7 @@ extern u8 *gUnknown_80FEFF4[]; extern u32 gUnknown_80F51C4[]; -typedef bool8 (*MoveCallback)(struct Entity *pokemon, struct Entity *target, struct Move *move, s32 param_4); +typedef bool8 (*MoveCallback)(Entity *pokemon, Entity *target, Move *move, s32 param_4); struct NaturePowerMove { @@ -164,7 +163,7 @@ struct NaturePowerMove }; extern struct NaturePowerMove gUnknown_80F59C8[10]; -bool8 sub_805AFA4(struct Entity * pokemon, struct Entity * target, struct Move *move, u32 param_4) +bool8 sub_805AFA4(Entity * pokemon, Entity * target, Move *move, u32 param_4) { s32 r0; s32 r2; @@ -172,9 +171,9 @@ bool8 sub_805AFA4(struct Entity * pokemon, struct Entity * target, struct Move * bool8 flag; #ifndef NONMATCHING - register struct EntityInfo *entityInfo asm("r3"); + register EntityInfo *entityInfo asm("r3"); #else - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; #endif SendThawedMessage(pokemon, target); @@ -204,13 +203,13 @@ bool8 sub_805AFA4(struct Entity * pokemon, struct Entity * target, struct Move * return flag; } -bool8 sub_805B028(struct Entity * pokemon,struct Entity * target,struct Move *move) +bool8 sub_805B028(Entity * pokemon,Entity * target,Move *move) { ParalyzeStatusTarget(pokemon,target, TRUE); return TRUE; } -bool8 TransformMoveAction(struct Entity * pokemon, struct Entity * target, struct Move *move) +bool8 TransformMoveAction(Entity * pokemon, Entity * target, Move *move) { if (IsBossFight()) { sub_80522F4(pokemon,target,*gUnknown_80FEFF4); @@ -223,7 +222,7 @@ bool8 TransformMoveAction(struct Entity * pokemon, struct Entity * target, struc } } -bool8 sub_805B074(struct Entity * pokemon, struct Entity * target, struct Move *move, s32 param_4) +bool8 sub_805B074(Entity * pokemon, Entity * target, Move *move, s32 param_4) { bool8 flag; @@ -237,17 +236,17 @@ bool8 sub_805B074(struct Entity * pokemon, struct Entity * target, struct Move * return flag; } -bool8 sub_805B0BC(struct Entity * pokemon, struct Entity * target) +bool8 sub_805B0BC(Entity * pokemon, Entity * target) { sub_807CD9C(pokemon, target, pokemon->info->action.direction); return TRUE; } -bool8 HandleColorChange(struct Entity * pokemon, struct Entity * target) +bool8 HandleColorChange(Entity * pokemon, Entity * target) { u8 newType; const char *typeString; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; entityInfo = target->info; newType = gDungeonCamouflageTypes[gDungeon->tileset]; @@ -267,13 +266,13 @@ bool8 HandleColorChange(struct Entity * pokemon, struct Entity * target) } } -bool8 sub_805B164(struct Entity * pokemon, struct Entity * target, struct Move *move, s32 param_4) +bool8 sub_805B164(Entity * pokemon, Entity * target, Move *move, s32 param_4) { RaiseAttackStageTarget(pokemon,target,gUnknown_8106A50, 2); return TRUE; } -bool8 sub_805B17C(struct Entity * pokemon, struct Entity * target, struct Move *move, s32 param_4) +bool8 sub_805B17C(Entity * pokemon, Entity * target, Move *move, s32 param_4) { s32 uVar4; bool8 flag; @@ -298,19 +297,19 @@ bool8 sub_805B17C(struct Entity * pokemon, struct Entity * target, struct Move * return flag; } -bool8 PerishSongMoveAction(struct Entity * pokemon,struct Entity * target,struct Move *move, s32 param_4) +bool8 PerishSongMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param_4) { PerishSongTarget(pokemon, target); return TRUE; } -bool8 sub_805B214(struct Entity * pokemon,struct Entity * target,struct Move *move, s32 param_4) +bool8 sub_805B214(Entity * pokemon,Entity * target,Move *move, s32 param_4) { WrapTarget(pokemon, target); return TRUE; } -bool8 TrapperOrbAction(struct Entity * pokemon, struct Entity * target) +bool8 TrapperOrbAction(Entity * pokemon, Entity * target) { bool8 trapLaid; u8 uVar2; @@ -334,12 +333,12 @@ bool8 TrapperOrbAction(struct Entity * pokemon, struct Entity * target) return trapLaid; } -bool8 sub_805B264(struct Entity * pokemon, struct Entity * target, struct Move *move, s32 param_4) +bool8 sub_805B264(Entity * pokemon, Entity * target, Move *move, s32 param_4) { s32 r3; bool8 r6; s32 iVar5; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; entityInfo = target->info; r3 = gUnknown_202F224; @@ -355,31 +354,31 @@ bool8 sub_805B264(struct Entity * pokemon, struct Entity * target, struct Move * return r6; } -bool8 MagicCoatMoveAction(struct Entity * pokemon,struct Entity * target,struct Move *move, s32 param_4) +bool8 MagicCoatMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param_4) { MagicCoatStatusTarget(pokemon, target); return TRUE; } -bool8 ProtectMoveAction(struct Entity * pokemon,struct Entity * target,struct Move *move, s32 param_4) +bool8 ProtectMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param_4) { ProtectStatusTarget(pokemon, target); return TRUE; } -bool8 sub_805B2FC(struct Entity * pokemon,struct Entity * target,struct Move *move, s32 param_4) +bool8 sub_805B2FC(Entity * pokemon,Entity * target,Move *move, s32 param_4) { RaiseDefenseStageTarget(pokemon,target,gUnknown_8106A4C,1); return TRUE; } -bool8 sub_805B314(struct Entity * pokemon,struct Entity * target,struct Move *move, s32 param_4) +bool8 sub_805B314(Entity * pokemon,Entity * target,Move *move, s32 param_4) { sub_80783C4(pokemon, target, 1); return TRUE; } -bool8 sub_805B324(struct Entity * pokemon,struct Entity * target,struct Move *move, s32 param_4) +bool8 sub_805B324(Entity * pokemon,Entity * target,Move *move, s32 param_4) { bool8 flag; @@ -393,24 +392,24 @@ bool8 sub_805B324(struct Entity * pokemon,struct Entity * target,struct Move *mo return flag; } -bool8 DestinyBondMoveAction(struct Entity * pokemon,struct Entity * target,struct Move *move, s32 param_4) +bool8 DestinyBondMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param_4) { DestinyBondStatusTarget(pokemon, target); return TRUE; } -bool8 sub_805B388(struct Entity * pokemon,struct Entity * target,struct Move *move, s32 param_4) +bool8 sub_805B388(Entity * pokemon,Entity * target,Move *move, s32 param_4) { return (sub_8055640(pokemon,target,move,0x100,param_4)) ? TRUE : FALSE; } -bool8 MirrorCoatMoveAction(struct Entity * pokemon,struct Entity * target,struct Move *move, s32 param_4) +bool8 MirrorCoatMoveAction(Entity * pokemon,Entity * target,Move *move, s32 param_4) { MirrorCoatStatusTarget(pokemon, target); return TRUE; } -bool8 sub_805B3B4(struct Entity * pokemon,struct Entity * target,struct Move *move, s32 param_4) +bool8 sub_805B3B4(Entity * pokemon,Entity * target,Move *move, s32 param_4) { u32 stat = gUnknown_8106A50; RaiseAttackStageTarget(pokemon,target,stat,1); @@ -418,15 +417,15 @@ bool8 sub_805B3B4(struct Entity * pokemon,struct Entity * target,struct Move *mo return TRUE; } -bool8 sub_805B3E0(struct Entity * pokemon,struct Entity * target,struct Move *move, s32 param_4) +bool8 sub_805B3E0(Entity * pokemon,Entity * target,Move *move, s32 param_4) { sub_8055640(pokemon,target,move,0x100,param_4); return TRUE; } -bool8 sub_805B3FC(struct Entity * pokemon,struct Entity * target,struct Move *move, s32 param_4, s32 param_5) +bool8 sub_805B3FC(Entity * pokemon,Entity * target,Move *move, s32 param_4, s32 param_5) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; bool8 flag; flag = FALSE; @@ -443,17 +442,17 @@ bool8 sub_805B3FC(struct Entity * pokemon,struct Entity * target,struct Move *mo return flag; } -bool8 sub_805B454(struct Entity * pokemon, struct Entity * target) +bool8 sub_805B454(Entity * pokemon, Entity * target) { InfatuateStatusTarget(pokemon, target, TRUE); return TRUE; } -bool8 MimicMoveAction(struct Entity * pokemon, struct Entity * target) +bool8 MimicMoveAction(Entity * pokemon, Entity * target) { - struct EntityInfo *entityInfo; - struct EntityInfo *targetEntityInfo; - struct Move *move; + EntityInfo *entityInfo; + EntityInfo *targetEntityInfo; + Move *move; s32 moveCounter; s32 moveIndex; bool8 mimicSuccess; @@ -488,14 +487,14 @@ bool8 MimicMoveAction(struct Entity * pokemon, struct Entity * target) return mimicSuccess; } -bool8 sub_805B53C(struct Entity * pokemon, struct Entity * target, struct Move *move, s32 param_4) +bool8 sub_805B53C(Entity * pokemon, Entity * target, Move *move, s32 param_4) { s16 *r1; s32 index; s32 r5; s32 IQ; u8 local_24; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; local_24 = 0; entityInfo = pokemon->info; @@ -517,7 +516,7 @@ _0805B598: return local_24; } -bool8 LeechSeedMoveAction(struct Entity * pokemon, struct Entity * target) +bool8 LeechSeedMoveAction(Entity * pokemon, Entity * target) { HandleLeechSeed(pokemon, target, TRUE); if (pokemon->info->unkFB == 0) { @@ -526,10 +525,10 @@ bool8 LeechSeedMoveAction(struct Entity * pokemon, struct Entity * target) return TRUE; } -bool8 sub_805B618(struct Entity * pokemon, struct Entity * target, struct Move *move, s32 param_4) +bool8 sub_805B618(Entity * pokemon, Entity * target, Move *move, s32 param_4) { bool8 flag; - struct Move natureMove; + Move natureMove; u32 index; index = gUnknown_202F228; @@ -539,7 +538,7 @@ bool8 sub_805B618(struct Entity * pokemon, struct Entity * target, struct Move * return flag; } -bool8 sub_805B668(struct Entity * pokemon, struct Entity * target, struct Move *move, s32 param_4) +bool8 sub_805B668(Entity * pokemon, Entity * target, Move *move, s32 param_4) { bool8 hasLiquidOoze; s32 iVar3; @@ -577,17 +576,17 @@ bool8 sub_805B668(struct Entity * pokemon, struct Entity * target, struct Move * return flag; } -bool8 sub_805B734(struct Entity * pokemon, struct Entity * target) +bool8 sub_805B734(Entity * pokemon, Entity * target) { SnatchStatusTarget(pokemon, target); return TRUE; } -bool8 RecycleMoveAction(struct Entity * pokemon, struct Entity * target) +bool8 RecycleMoveAction(Entity * pokemon, Entity * target) { - struct Item *item; + Item *item; s32 index; - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; bool8 isTMRecycled; entityInfo = target->info; @@ -598,10 +597,10 @@ bool8 RecycleMoveAction(struct Entity * pokemon, struct Entity * target) #ifdef NONMATCHING item = &gTeamInventoryRef->teamItems[index]; #else - register size_t offset asm("r1") = offsetof(struct TeamInventory, teamItems[index]); - struct Item* p = gTeamInventoryRef->teamItems; + register size_t offset asm("r1") = offsetof(TeamInventory, teamItems[index]); + Item* p = gTeamInventoryRef->teamItems; size_t addr = offset + (size_t)p; - item = (struct Item*)addr; + item = (Item*)addr; #endif if ((item->flags & ITEM_FLAG_EXISTS) && ((item->flags & ITEM_FLAG_IN_SHOP) == 0)) if(item->id == ITEM_TM_USED_TM) { @@ -623,13 +622,13 @@ bool8 RecycleMoveAction(struct Entity * pokemon, struct Entity * target) return isTMRecycled; } -bool8 ReflectMoveAction(struct Entity * pokemon, struct Entity * target, struct Move *move, s32 param_4) +bool8 ReflectMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) { ReflectStatusTarget(pokemon, target); return TRUE; } -bool8 sub_805B808(struct Entity * pokemon, struct Entity * target, struct Move *move, s32 param_4) +bool8 sub_805B808(Entity * pokemon, Entity * target, Move *move, s32 param_4) { u8 local_20; @@ -639,14 +638,14 @@ bool8 sub_805B808(struct Entity * pokemon, struct Entity * target, struct Move * return local_20; } -bool8 sub_805B884( struct Entity * pokemon, struct Entity * target) +bool8 sub_805B884( Entity * pokemon, Entity * target) { RaiseAttackStageTarget(pokemon, target, gUnknown_8106A4C, 1); RaiseMovementSpeedTarget(pokemon, target, 0, TRUE); return TRUE; } -bool8 SkullBashMoveAction(struct Entity * pokemon, struct Entity * target, struct Move * move, s32 param_4) +bool8 SkullBashMoveAction(Entity * pokemon, Entity * target, Move * move, s32 param_4) { bool8 flag; @@ -661,7 +660,7 @@ bool8 SkullBashMoveAction(struct Entity * pokemon, struct Entity * target, struc return flag; } -bool8 sub_805B910(struct Entity * pokemon, struct Entity * target, struct Move * move, s32 param_4) +bool8 sub_805B910(Entity * pokemon, Entity * target, Move * move, s32 param_4) { bool8 flag; @@ -676,7 +675,7 @@ bool8 sub_805B910(struct Entity * pokemon, struct Entity * target, struct Move * return flag; } -bool8 sub_805B968(struct Entity * pokemon, struct Entity * target, struct Move * move, s32 param_4) +bool8 sub_805B968(Entity * pokemon, Entity * target, Move * move, s32 param_4) { s32 entityHP; s32 newHP; @@ -700,17 +699,17 @@ bool8 sub_805B968(struct Entity * pokemon, struct Entity * target, struct Move * return flag; } -bool8 RockSmashMoveAction(struct Entity * pokemon, struct Entity * target, struct Move *move, s32 param_4) +bool8 RockSmashMoveAction(Entity * pokemon, Entity * target, Move *move, s32 param_4) { bool8 flag; - struct Position pos; + Position pos; #ifdef NONMATCHING - struct Entity *temp; - struct Entity *temp1; + Entity *temp; + Entity *temp1; #else - register struct Entity *temp asm("r5"); - register struct Entity *temp1 asm("r4"); + register Entity *temp asm("r5"); + register Entity *temp1 asm("r4"); #endif temp = pokemon; @@ -729,21 +728,21 @@ bool8 RockSmashMoveAction(struct Entity * pokemon, struct Entity * target, struc return flag; } -bool8 sub_805BA44(struct Entity * pokemon, struct Entity * target) +bool8 sub_805BA44(Entity * pokemon, Entity * target) { sub_807D3CC(pokemon, target); return TRUE; } -bool8 sub_805BA50(struct Entity * pokemon, struct Entity * target, struct Move *move, s32 param_4) +bool8 sub_805BA50(Entity * pokemon, Entity * target, Move *move, s32 param_4) { - struct EntityInfo *iVar2; - struct EntityInfo *iVar3; - struct EntityInfo *iVar5; - struct EntityInfo *iVar6; + EntityInfo *iVar2; + EntityInfo *iVar3; + EntityInfo *iVar5; + EntityInfo *iVar6; bool8 flag; - struct Item *pokeItem; - struct Item *targetItem; + Item *pokeItem; + Item *targetItem; flag = FALSE; if (sub_8055640(pokemon,target,move,0x100,param_4) != 0) { @@ -791,13 +790,13 @@ bool8 sub_805BA50(struct Entity * pokemon, struct Entity * target, struct Move * return flag; } -bool8 sub_805BB64(struct Entity * pokemon, struct Entity * target) +bool8 sub_805BB64(Entity * pokemon, Entity * target) { CounterStatusTarget(pokemon, target, STATUS_MINI_COUNTER); return TRUE; } -bool8 sub_805BB74(struct Entity * pokemon, struct Entity * target) +bool8 sub_805BB74(Entity * pokemon, Entity * target) { if(pokemon->info->unkFB == 0) { @@ -807,17 +806,17 @@ bool8 sub_805BB74(struct Entity * pokemon, struct Entity * target) return TRUE; } -bool8 sub_805BB98(struct Entity * pokemon, struct Entity * target) +bool8 sub_805BB98(Entity * pokemon, Entity * target) { sub_807D148(pokemon, target, 1, NULL); return TRUE; } -bool8 CleanseOrbAction(struct Entity * pokemon, struct Entity * target) +bool8 CleanseOrbAction(Entity * pokemon, Entity * target) { - struct Item *item; - struct Entity *entity; - struct EntityInfo *entityInfo; + Item *item; + Entity *entity; + EntityInfo *entityInfo; s32 index; bool8 isItemCleaned; @@ -832,7 +831,7 @@ bool8 CleanseOrbAction(struct Entity * pokemon, struct Entity * target) if (!entityInfo->isNotTeamMember) { for(index = 0; index < INVENTORY_SIZE; index++){ // WTF why does this work... - UNUSED struct Item* current = &gTeamInventoryRef->teamItems[index]; + UNUSED Item* current = &gTeamInventoryRef->teamItems[index]; flag = index[gTeamInventoryRef->teamItems].flags; if (((flag & ITEM_FLAG_EXISTS) != 0) && ((flag & ITEM_FLAG_IN_SHOP) == 0)) if((flag & ITEM_FLAG_STICKY) != 0) { @@ -861,15 +860,15 @@ bool8 CleanseOrbAction(struct Entity * pokemon, struct Entity * target) return isItemCleaned; } -bool8 sub_805BC70(struct Entity * pokemon, struct Entity * target) +bool8 sub_805BC70(Entity * pokemon, Entity * target) { sub_8075C58(pokemon,target,CalculateStatusTurns(target, gUnknown_80F4E74, TRUE), TRUE); return TRUE; } -bool8 sub_805BC98(struct Entity * pokemon, struct Entity * target, struct Move *move, s32 param_4) +bool8 sub_805BC98(Entity * pokemon, Entity * target, Move *move, s32 param_4) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; bool8 flag; s32 targetHP; s32 pokeHP; @@ -900,27 +899,27 @@ bool8 sub_805BC98(struct Entity * pokemon, struct Entity * target, struct Move * return flag; } -bool8 SilenceOrbAction(struct Entity * pokemon, struct Entity * target) +bool8 SilenceOrbAction(Entity * pokemon, Entity * target) { MuzzleTarget(pokemon, target); return TRUE; } -bool8 ScannerOrbAction(struct Entity * pokemon, struct Entity * target) +bool8 ScannerOrbAction(Entity * pokemon, Entity * target) { HandleScannerOrb(pokemon, target); return TRUE; } -bool8 RadarOrbAction(struct Entity * pokemon, struct Entity * target) +bool8 RadarOrbAction(Entity * pokemon, Entity * target) { HandleRadarOrb(pokemon, target); return TRUE; } -bool8 TransferOrbAction(struct Entity *pokemon, struct Entity * target) +bool8 TransferOrbAction(Entity *pokemon, Entity * target) { - struct EntityInfo *entityInfo; + EntityInfo *entityInfo; s32 oldID; //r8 s32 targetID; // r5 s32 r6; // r6 @@ -962,37 +961,37 @@ bool8 TransferOrbAction(struct Entity *pokemon, struct Entity * target) return didTransfer; } -bool8 sub_805BE90(struct Entity *pokemon, struct Entity *target) +bool8 sub_805BE90(Entity *pokemon, Entity *target) { LowerMovementSpeedTarget(pokemon, target, 1, TRUE); return TRUE; } -bool8 LuminousOrbAction(struct Entity * pokemon, struct Entity * target) +bool8 LuminousOrbAction(Entity * pokemon, Entity * target) { HandleLuminousOrbAction(pokemon); return TRUE; } -bool8 sub_805BEAC(struct Entity * pokemon, struct Entity * target) +bool8 sub_805BEAC(Entity * pokemon, Entity * target) { PetrifiedStatusTarget(pokemon, target); return TRUE; } -bool8 sub_805BEB8(struct Entity * pokemon, struct Entity * target) +bool8 sub_805BEB8(Entity * pokemon, Entity * target) { sub_807DA14(pokemon, target, 8); return TRUE; } -bool8 sub_805BEC8(struct Entity * pokemon, struct Entity * target) +bool8 sub_805BEC8(Entity * pokemon, Entity * target) { sub_807D510(pokemon, target); return TRUE; } -bool8 EscapeOrbAction(struct Entity * pokemon, struct Entity * target) +bool8 EscapeOrbAction(Entity * pokemon, Entity * target) { SetMessageArgument(gAvailablePokemonNames,pokemon,0); if (gDungeon->unk66E != 0) { @@ -1006,16 +1005,16 @@ bool8 EscapeOrbAction(struct Entity * pokemon, struct Entity * target) return FALSE; } -bool8 sub_805BF34(struct Entity * pokemon, struct Entity * target) +bool8 sub_805BF34(Entity * pokemon, Entity * target) { sub_807DB74(pokemon); return TRUE; } -bool8 TrapbustOrbAction(struct Entity * pokemon,struct Entity * target) +bool8 TrapbustOrbAction(Entity * pokemon,Entity * target) { struct Tile *tile; - struct Entity *object; + Entity *object; u8 *trapData; s32 bottomRightCornerX, bottomRightCornerY; s32 xCoord, yCoord; @@ -1067,11 +1066,11 @@ bool8 TrapbustOrbAction(struct Entity * pokemon,struct Entity * target) return foundTrap; } -bool8 sub_805C080(struct Entity * pokemon, struct Entity *target) +bool8 sub_805C080(Entity * pokemon, Entity *target) { - struct Entity **possibleTargets; + Entity **possibleTargets; s32 numPossibleTargets; - struct Entity *targetEntity; + Entity *targetEntity; bool8 foundTarget; s32 index; @@ -1098,13 +1097,13 @@ bool8 sub_805C080(struct Entity * pokemon, struct Entity *target) return foundTarget; } -bool8 sub_805C128(struct Entity * pokemon, struct Entity * target) +bool8 sub_805C128(Entity * pokemon, Entity * target) { InvisibleStatusTarget(pokemon, pokemon); return TRUE; } -bool8 sub_805C138(struct Entity * pokemon, struct Entity * target, struct Move *move, s32 param_4) +bool8 sub_805C138(Entity * pokemon, Entity * target, Move *move, s32 param_4) { u8 local_20; @@ -1114,13 +1113,13 @@ bool8 sub_805C138(struct Entity * pokemon, struct Entity * target, struct Move * return local_20; } -bool8 IdentifyOrbAction(struct Entity *pokemon, struct Entity *target) +bool8 IdentifyOrbAction(Entity *pokemon, Entity *target) { IdentityItemHolders(pokemon, target); return TRUE; } -bool8 sub_805C1BC(struct Entity *pokemon, struct Entity *target, struct Move *move, s32 param_4) +bool8 sub_805C1BC(Entity *pokemon, Entity *target, Move *move, s32 param_4) { bool8 flag; @@ -1128,19 +1127,19 @@ bool8 sub_805C1BC(struct Entity *pokemon, struct Entity *target, struct Move *mo return flag; } -bool8 sub_805C1E4(struct Entity *pokemon, struct Entity *target) +bool8 sub_805C1E4(Entity *pokemon, Entity *target) { sub_80522F4(pokemon, target, *gUnknown_80FD454); return FALSE; } -bool8 ShockerOrbAction(struct Entity *pokemon, struct Entity *target) +bool8 ShockerOrbAction(Entity *pokemon, Entity *target) { CowerStatusTarget(pokemon, target, TRUE); return TRUE; } -bool8 sub_805C208(struct Entity *pokemon, struct Entity *target, struct Move *move, u32 param_4) +bool8 sub_805C208(Entity *pokemon, Entity *target, Move *move, u32 param_4) { u32 targetSize; u8 local_24; @@ -1153,26 +1152,26 @@ bool8 sub_805C208(struct Entity *pokemon, struct Entity *target, struct Move *mo return local_24; } -bool8 sub_805C288(struct Entity *pokemon, struct Entity *target) +bool8 sub_805C288(Entity *pokemon, Entity *target) { sub_8078A58(pokemon, target, gUnknown_80F4FC6, 0); return TRUE; } -bool8 sub_805C2A0(struct Entity *pokemon, struct Entity *target) +bool8 sub_805C2A0(Entity *pokemon, Entity *target) { sub_807DC68(pokemon, target); return TRUE; } -bool8 FillInOrbAction(struct Entity *pokemon,struct Entity *target) +bool8 FillInOrbAction(Entity *pokemon,Entity *target) { struct Tile *tileToFill; - struct EntityInfo *targetInfo; + EntityInfo *targetInfo; int y; bool8 filledInTile; int x; - struct Position tileCoords; + Position tileCoords; filledInTile = FALSE; targetInfo = target->info; @@ -1215,7 +1214,7 @@ bool8 FillInOrbAction(struct Entity *pokemon,struct Entity *target) } } -bool8 sub_805C3DC(struct Entity *pokemon, struct Entity *target) +bool8 sub_805C3DC(Entity *pokemon, Entity *target) { u32 var; var = (target->info->isNotTeamMember ? 2 : 1); @@ -1223,10 +1222,10 @@ bool8 sub_805C3DC(struct Entity *pokemon, struct Entity *target) return TRUE; } -bool8 sub_805C3F8(struct Entity *pokemon, struct Entity *target) +bool8 sub_805C3F8(Entity *pokemon, Entity *target) { - struct Item stack; - struct Position posStruct = target->pos; + Item stack; + Position posStruct = target->pos; if(target->info->clientType != CLIENT_TYPE_NONE) { @@ -1243,31 +1242,31 @@ bool8 sub_805C3F8(struct Entity *pokemon, struct Entity *target) } } -bool8 sub_805C45C(struct Entity *pokemon, struct Entity *target) +bool8 sub_805C45C(Entity *pokemon, Entity *target) { sub_807F43C(pokemon, target); return TRUE; } -bool8 MobileOrbAction(struct Entity *pokemon, struct Entity *target) +bool8 MobileOrbAction(Entity *pokemon, Entity *target) { MobileStatusTarget(pokemon, target); return TRUE; } -bool8 StairsOrbAction(struct Entity *pokemon, struct Entity *target) +bool8 StairsOrbAction(Entity *pokemon, Entity *target) { HandleStairsOrb(pokemon, target); return TRUE; } -bool8 LongtossOrbAction(struct Entity *pokemon, struct Entity *target) +bool8 LongtossOrbAction(Entity *pokemon, Entity *target) { LongTossStatusTarget(pokemon, target); return TRUE; } -bool8 PierceOrbAction(struct Entity *pokemon, struct Entity *target) +bool8 PierceOrbAction(Entity *pokemon, Entity *target) { PierceStatusTarget(pokemon, target); return TRUE; diff --git a/src/status_checks.c b/src/status_checks.c index 9e7ae4fe2..5bf08903b 100644 --- a/src/status_checks.c +++ b/src/status_checks.c @@ -24,11 +24,11 @@ extern u8 gAvailablePokemonNames[]; extern u8 *gUnknown_80F95EC[]; extern char *gPtrMoveInterruptedMessage[]; -extern void SetMessageArgument(char[], struct Entity*, u32); +extern void SetMessageArgument(char[], Entity*, u32); -bool8 HasStatusAffectingActions(struct Entity *pokemon) +bool8 HasStatusAffectingActions(Entity *pokemon) { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; SetMessageArgument(gAvailablePokemonNames, pokemon, 0); SetMonsterActionFields(&pokemonInfo->action, ACTION_PASS_TURN); switch (pokemonInfo->sleep) @@ -107,14 +107,14 @@ bool8 HasStatusAffectingActions(struct Entity *pokemon) return FALSE; } -bool8 sub_80701A4(struct Entity *pokemon) +bool8 sub_80701A4(Entity *pokemon) { bool8 flag; - struct Move *move; - struct Move *move2; + Move *move; + Move *move2; s32 index; s32 index_1; - struct EntityInfo * pokemonInfo; + EntityInfo * pokemonInfo; u8 *r7; pokemonInfo = pokemon->info; diff --git a/src/status_checks_1.c b/src/status_checks_1.c index 028c78708..b7098f578 100644 --- a/src/status_checks_1.c +++ b/src/status_checks_1.c @@ -17,7 +17,7 @@ #include "pokemon.h" #include "weather.h" -extern void sub_80429B4(struct Entity *r0); +extern void sub_80429B4(Entity *r0); extern u8 *gUnknown_80FEE80[]; extern u8 *gUnknown_80F8974[]; @@ -25,8 +25,9 @@ extern u8 *gUnknown_80F8994[]; extern u8 *gUnknown_80F8968[]; extern u8 *gUnknown_80F8988[]; extern u8 gUnknown_8106FA4[]; +void CopyCyanMonsterNametoBuffer(u8 *buffer, s16 index); -s32 sub_8070828(struct Entity *pokemon, bool8 displayMessage) +s32 sub_8070828(Entity *pokemon, bool8 displayMessage) { bool8 flag; @@ -54,7 +55,7 @@ s32 sub_8070828(struct Entity *pokemon, bool8 displayMessage) } } -void SetMessageArgument_2(u8 *buffer, struct EntityInfo *param_2, s32 colorNum) +void SetMessageArgument_2(u8 *buffer, EntityInfo *param_2, s32 colorNum) { if (((gDungeon->blinded || gDungeon->hallucinating) || @@ -85,7 +86,7 @@ void SetMessageArgument_2(u8 *buffer, struct EntityInfo *param_2, s32 colorNum) } } -void sub_8070968(u8 *buffer, struct EntityInfo *entityInfo, s32 colorNum) +void sub_8070968(u8 *buffer, EntityInfo *entityInfo, s32 colorNum) { if (entityInfo->waitingStatus == STATUS_DECOY) { sprintfStatic(buffer, gUnknown_8106FA4, colorNum + 0x30, *gUnknown_80F8974); @@ -98,7 +99,7 @@ void sub_8070968(u8 *buffer, struct EntityInfo *entityInfo, s32 colorNum) } } -void sub_80709C8(u8 *buffer, struct EntityInfo *entityInfo) +void sub_80709C8(u8 *buffer, EntityInfo *entityInfo) { if (((gDungeon->blinded || gDungeon->hallucinating) || @@ -125,9 +126,9 @@ void sub_80709C8(u8 *buffer, struct EntityInfo *entityInfo) } } -bool8 HasNegativeStatus(struct Entity *pokemon) +bool8 HasNegativeStatus(Entity *pokemon) { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; s32 i; if (pokemonInfo->sleep == STATUS_SLEEP || pokemonInfo->sleep == STATUS_NIGHTMARE || @@ -149,7 +150,7 @@ bool8 HasNegativeStatus(struct Entity *pokemon) } for (i = 0; i < MAX_MON_MOVES; i++) { - struct Move *moves = pokemonInfo->moves; + Move *moves = pokemonInfo->moves; if (moves[i].moveFlags & MOVE_FLAG_EXISTS && moves[i].moveFlags2 & MOVE_FLAG_SEALED) { return TRUE; @@ -165,7 +166,7 @@ bool8 HasNegativeStatus(struct Entity *pokemon) return FALSE; } -bool8 IsSleeping(struct Entity *pokemon) +bool8 IsSleeping(Entity *pokemon) { if (pokemon->info->sleep != STATUS_SLEEP && pokemon->info->sleep != STATUS_NAPPING && @@ -176,10 +177,10 @@ bool8 IsSleeping(struct Entity *pokemon) return TRUE; } -bool8 HasLowHealth(struct Entity *pokemon) +bool8 HasLowHealth(Entity *pokemon) { - struct EntityInfo *pokemonInfo = pokemon->info; - struct EntityInfo *pokemonInfo2 = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo2 = pokemon->info; s32 maxHPStat = pokemonInfo->maxHPStat; if (maxHPStat < 0) { diff --git a/src/targeting.c b/src/targeting.c index 9971978ae..2f4efe4e5 100644 --- a/src/targeting.c +++ b/src/targeting.c @@ -3,9 +3,9 @@ #include "dungeon_util.h" -void TargetTileInFront(struct Entity *pokemon) +void TargetTileInFront(Entity *pokemon) { - struct EntityInfo *pokemonInfo = pokemon->info; + EntityInfo *pokemonInfo = pokemon->info; pokemonInfo->targetPos.x = pokemon->pos.x + gAdjacentTileOffsets[pokemonInfo->action.direction].x; pokemonInfo->targetPos.y = pokemon->pos.y + gAdjacentTileOffsets[pokemonInfo->action.direction].y; } diff --git a/src/targeting_flags.c b/src/targeting_flags.c index 2594c9383..e55617ecf 100644 --- a/src/targeting_flags.c +++ b/src/targeting_flags.c @@ -6,7 +6,7 @@ #include "dungeon_pokemon_attributes.h" #include "moves.h" -s16 GetMoveTargetAndRangeForPokemon(struct Entity *pokemon, struct Move *move, bool32 isAI) +s16 GetMoveTargetAndRangeForPokemon(Entity *pokemon, Move *move, bool32 isAI) { if (move->id == MOVE_CURSE && !isAI && !MonsterIsType(pokemon, TYPE_GHOST)) { diff --git a/src/text1.c b/src/text1.c index 8b7e10006..f497ad570 100644 --- a/src/text1.c +++ b/src/text1.c @@ -5,37 +5,38 @@ #include "text1.h" #include "text2.h" -EWRAM_DATA struct UnkTextStruct1 gUnknown_2027370[4]; -EWRAM_DATA u8 *gCharmaps[2]; -EWRAM_DATA s16 gCharacterSpacing; -EWRAM_DATA u8 gUnknown_20274A5; -EWRAM_DATA u32 gCurrentCharmap; -EWRAM_DATA vu32 gUnknown_20274B0; -EWRAM_DATA u32 gUnknown_20274B4[0xEC0]; -EWRAM_DATA struct OpenedFile *gCharmapFiles[2]; -EWRAM_DATA struct UnkTextStruct2 gUnknown_202AFC0[4]; -EWRAM_DATA u32 gUnknown_202B020; -EWRAM_DATA u32 gUnknown_202B024; -EWRAM_DATA u32 gUnknown_202B028[2]; -EWRAM_DATA u32 gUnknown_202B030; // Some text color info is stored; retrieve via "& 0xF" -EWRAM_DATA u8 gUnknown_202B034; -EWRAM_DATA u16 gUnknown_202B038[4][32][32]; +extern UnkTextStruct1 gUnknown_2027370[4]; +extern u8 *gCharmaps[2]; +extern s16 gCharacterSpacing; +extern u8 gUnknown_20274A5; +extern u32 gCurrentCharmap; +extern vu32 gUnknown_20274B0; +extern u32 gUnknown_20274B4[0xEC0]; +extern OpenedFile *gCharmapFiles[2]; // 202AFB4 +// u32 unused // 202AFBC +extern UnkTextStruct2 gUnknown_202AFC0[4]; +extern u32 gUnknown_202B020; +extern u32 gUnknown_202B024; +extern u32 gUnknown_202B028[2]; +extern u32 gUnknown_202B030; // Some text color info is stored; retrieve via "& 0xF" +extern u8 gUnknown_202B034; +extern u16 gUnknown_202B038[4][32][32]; // ? extern s16 gUnknown_3000E94[]; // data.s -extern const struct UnkTextStruct2 gUnknown_80B857C[4]; +extern const UnkTextStruct2 gUnknown_80B857C[4]; +extern const u8 gKanjiA_file_string[]; // 80B87B4 +extern const u8 gKanjiB_file_string[]; // 80B87BC extern const u32 gUnknown_80B87C4[8]; extern const u32 gUnknown_80B87E4[8]; extern const u32 gUnknown_80B8804[4]; extern const u32 gUnknown_80B8814[]; -extern const char gKanjiA_file_string[]; -extern const char gKanjiB_file_string[]; // system_sbin.s extern const struct FileArchive gSystemFileArchive; -static void sub_8006438(const struct UnkTextStruct2 *, u8, u8, struct UnkTextStruct2_sub *); +static void sub_8006438(const UnkTextStruct2 *, bool8, bool8, UnkTextStruct2_sub *); void LoadCharmaps(void) { @@ -81,7 +82,7 @@ void LoadCharmaps(void) u32 xxx_update_some_bg_tiles(u32 a0) { u32 r5 = gUnknown_20274B0; - u32 *r4 = (u32 *)(VRAM + 0x4f40); + u32 *r4 = (u32 *)(VRAM + 0x4F40); const u32 *r2; gUnknown_20274B0 = a0; @@ -131,24 +132,25 @@ void sub_80063D8(int a0) retval = 0x88888888; } else { - retval = (a0 & 0xf) | ((a0 & 0xf) << 4); - retval |= ((a0 & 0xf) << 8); - retval |= ((a0 & 0xf) << 12); - retval |= ((a0 & 0xf) << 16); - retval |= ((a0 & 0xf) << 20); - retval |= ((a0 & 0xf) << 24); - retval |= ((a0 & 0xf) << 28); + retval = (a0 & 0xF) | ((a0 & 0xF) << 4); // Must be one line for matching + retval |= ((a0 & 0xF) << 8); + retval |= ((a0 & 0xF) << 12); + retval |= ((a0 & 0xF) << 16); + retval |= ((a0 & 0xF) << 20); + retval |= ((a0 & 0xF) << 24); + retval |= ((a0 & 0xF) << 28); } gUnknown_202B030 = retval; } -void sub_800641C(struct UnkTextStruct2 *a0, u8 a1, u8 a2) +// TODO: Move sub_800641C and sub_8006438 to text2.c ? data.s shows text1 and text2 are merged somehow but not fully +void sub_800641C(UnkTextStruct2 *a0, bool8 a1, bool8 a2) { - struct UnkTextStruct2_sub r3 = {0, 0}; + UnkTextStruct2_sub r3 = {0, 0}; sub_8006438(a0, a1, a2, &r3); } -static void sub_8006438(const struct UnkTextStruct2 *a0, u8 a1, u8 a2, struct UnkTextStruct2_sub *a3) +static void sub_8006438(const UnkTextStruct2 *a0, bool8 a1, bool8 a2, UnkTextStruct2_sub *a3) { s32 i; u32 r9; diff --git a/src/text2.c b/src/text2.c index 529405e23..ee1e45c18 100644 --- a/src/text2.c +++ b/src/text2.c @@ -10,28 +10,28 @@ extern const struct unkStruct_80B8824 gUnknown_80B8824; extern const struct unkStruct_80B8848 gUnknown_80B8848; // text.s -extern void sub_8007E64(struct UnkTextStruct1 *, u16 *, u32, u32, u32, u32, u32, u8 *, u32); -extern void sub_8008C6C(struct UnkTextStruct1 *, u32); +extern void sub_8007E64(UnkTextStruct1 *, u16 *, u32, u32, u32, u32, u32, u8 *, u32); +extern void sub_8008C6C(UnkTextStruct1 *, u32); void nullsub_129(u32, s32, s32, s32, u32); -u32 xxx_draw_char(struct UnkTextStruct1 *, s32, s32, u32, u32, u32); +u32 xxx_draw_char(UnkTextStruct1 *, s32, s32, u32, u32, u32); -void sub_800677C(struct UnkTextStruct1 *, s32, u16 *, u8); -void sub_80069CC(struct UnkTextStruct1 *, s32, s32, s32, u16 *); -void sub_8006AC4(struct UnkTextStruct1 *, s32, s32, s32, u16 *); -void sub_8006B70(struct UnkTextStruct1 *, s32, s32, s32, u16 *); -void sub_8006C44(struct UnkTextStruct1 *, s32, u16 *, u8); -void sub_8006E94(struct UnkTextStruct1 *, s32, u32, const u8 *, u16 *); -void sub_8007958(struct UnkTextStruct1 *, u32, s32, s32, s32, u32); -void sub_8007AA4(struct UnkTextStruct1 *, u32, s32, s32, s32, u32); -void sub_8007BA8(struct UnkTextStruct1 *, u32, s32, s32, s32, s32); -void sub_8007D00(struct UnkTextStruct1 *, u32, s32, s32, s32, s32); +void sub_800677C(UnkTextStruct1 *, s32, u16 *, u8); +void sub_80069CC(UnkTextStruct1 *, s32, s32, s32, u16 *); +void sub_8006AC4(UnkTextStruct1 *, s32, s32, s32, u16 *); +void sub_8006B70(UnkTextStruct1 *, s32, s32, s32, u16 *); +void sub_8006C44(UnkTextStruct1 *, s32, u16 *, u8); +void sub_8006E94(UnkTextStruct1 *, s32, u32, const u8 *, u16 *); +void sub_8007958(UnkTextStruct1 *, u32, s32, s32, s32, u32); +void sub_8007AA4(UnkTextStruct1 *, u32, s32, s32, s32, u32); +void sub_8007BA8(UnkTextStruct1 *, u32, s32, s32, s32, s32); +void sub_8007D00(UnkTextStruct1 *, u32, s32, s32, s32, s32); void nullsub_152(void) { } -void sub_8006518(struct UnkTextStruct2 *unkData) +void sub_8006518(UnkTextStruct2 *unkData) { s32 iVar2; for (iVar2 = 0; iVar2 < 4; iVar2++) @@ -48,9 +48,9 @@ u32 sub_8006544(u32 index) } // a1 is a VRAM pointer -void sub_8006554(struct UnkTextStruct1 *a0, u32 *a1, u32 *a2, u16 *a3, u32 a4, const struct UnkTextStruct2 *a5, u8 a6, u32 a7, struct UnkTextStruct2_sub *a8, u8 a9) +void sub_8006554(UnkTextStruct1 *a0, u32 *a1, u32 *a2, u16 *a3, u32 a4, const UnkTextStruct2 *a5, bool8 a6, u32 a7, UnkTextStruct2_sub *a8, u8 a9) { - struct UnkTextStruct1 *t1; + UnkTextStruct1 *t1; s32 iVar3; s32 iVar5; s32 iVar6; @@ -100,19 +100,19 @@ void sub_8006554(struct UnkTextStruct1 *a0, u32 *a1, u32 *a2, u16 *a3, u32 a4, c temp = iVar5 - 1; if (t1->unkC == 6) { - uVar1 = (a6 != 0) ? t1->unk14 : 0; + uVar1 = a6 ? t1->unk14 : 0; sub_8006E94(t1, temp, uVar1, a5->unk14, a3); temp = iVar5 + 2; - uVar1 = (a6 != 0) ? t1->unk14 + t1->unk4 * (a5->unk12 + 2) : 0; + uVar1 = a6 ? t1->unk14 + t1->unk4 * (a5->unk12 + 2) : 0; numI = t1->unk6 - 2; } else { sub_800677C(t1, temp, a3, a9); temp = iVar5; - uVar1 = (a6 != 0) ? t1->unk14 : 0; + uVar1 = a6 ? t1->unk14 : 0; numI = t1->unk6; } @@ -125,7 +125,7 @@ void sub_8006554(struct UnkTextStruct1 *a0, u32 *a1, u32 *a2, u16 *a3, u32 a4, c sub_8006AC4(t1, iVar6, temp, uVar1, a3); iVar6++; - if (a6 != 0) + if (a6) uVar1++; } @@ -141,7 +141,7 @@ void sub_8006554(struct UnkTextStruct1 *a0, u32 *a1, u32 *a2, u16 *a3, u32 a4, c t1->unk46 = 0; } -void sub_800677C(struct UnkTextStruct1 *a0, s32 a1, u16 *a2, u8 a3) +void sub_800677C(UnkTextStruct1 *a0, s32 a1, u16 *a2, u8 a3) { s32 iVar5; s32 i; @@ -214,7 +214,7 @@ void sub_800677C(struct UnkTextStruct1 *a0, s32 a1, u16 *a2, u8 a3) } } -void sub_80069CC(struct UnkTextStruct1 *a0, s32 a1, s32 a2, s32 a3, u16 *a4) +void sub_80069CC(UnkTextStruct1 *a0, s32 a1, s32 a2, s32 a3, u16 *a4) { if (a2 > 28) return; @@ -255,7 +255,7 @@ void sub_80069CC(struct UnkTextStruct1 *a0, s32 a1, s32 a2, s32 a3, u16 *a4) } } -void sub_8006AC4(struct UnkTextStruct1 *a0, s32 a1, s32 a2, s32 a3, u16 *a4) +void sub_8006AC4(UnkTextStruct1 *a0, s32 a1, s32 a2, s32 a3, u16 *a4) { if (a2 > 28) return; @@ -282,7 +282,7 @@ void sub_8006AC4(struct UnkTextStruct1 *a0, s32 a1, s32 a2, s32 a3, u16 *a4) } } -void sub_8006B70(struct UnkTextStruct1 *a0, s32 a1, s32 a2, s32 a3, u16 *a4) +void sub_8006B70(UnkTextStruct1 *a0, s32 a1, s32 a2, s32 a3, u16 *a4) { if (a2 > 28) return; @@ -323,7 +323,7 @@ void sub_8006B70(struct UnkTextStruct1 *a0, s32 a1, s32 a2, s32 a3, u16 *a4) } } -void sub_8006C44(struct UnkTextStruct1 *a0, s32 a1, u16 *a2, u8 a3) +void sub_8006C44(UnkTextStruct1 *a0, s32 a1, u16 *a2, u8 a3) { s32 iVar5; s32 i; @@ -398,7 +398,7 @@ void sub_8006C44(struct UnkTextStruct1 *a0, s32 a1, u16 *a2, u8 a3) #ifdef NONMATCHING // Not even close but I don't feel like continuing atm https://decomp.me/scratch/F58jg -void sub_8006E94(struct UnkTextStruct1 *a0, s32 a1, u32 a2, const u8 *a3, u16 *a4) +void sub_8006E94(UnkTextStruct1 *a0, s32 a1, u32 a2, const u8 *a3, u16 *a4) { s32 bVar1; s32 iVar2; @@ -582,7 +582,7 @@ void sub_8006E94(struct UnkTextStruct1 *a0, s32 a1, u32 a2, const u8 *a3, u16 *a } #else NAKED -void sub_8006E94(struct UnkTextStruct1 *a0, s32 a1, u32 a2, const u8 *a3, u16 *a4) +void sub_8006E94(UnkTextStruct1 *a0, s32 a1, u32 a2, const u8 *a3, u16 *a4) { asm_unified( "\tpush {r4-r7,lr}\n" @@ -1183,7 +1183,7 @@ void sub_8007334(s32 a0) { s32 r1; s32 r2; - struct UnkTextStruct1 *r3; + UnkTextStruct1 *r3; s32 r4; u32 r5; s32 r6; @@ -1277,14 +1277,13 @@ void sub_8007334(s32 a0) } #endif // NONMATCHING -// Unused -void nullsub_154(void) +UNUSED static void nullsub_154(void) { } void sub_80073B8(s32 a0) { - struct UnkTextStruct1 *r1; + UnkTextStruct1 *r1; r1 = &gUnknown_2027370[a0]; @@ -1293,14 +1292,13 @@ void sub_80073B8(s32 a0) r1->unk46 = 1; } -// Unused -void nullsub_155(void) +UNUSED static void nullsub_155(void) { } void sub_80073E0(s32 a0) { - struct UnkTextStruct1 *r1; + UnkTextStruct1 *r1; r1 = &gUnknown_2027370[a0]; @@ -1319,8 +1317,7 @@ void sub_80073E0(s32 a0) r1->unk46 = 0; } -// Unused -void nullsub_156(void) +UNUSED static void nullsub_156(void) { } @@ -1337,7 +1334,7 @@ bool8 sub_8007464(void) // https://decomp.me/scratch/F06Ty NAKED -u32 xxx_draw_char(struct UnkTextStruct1 *a0, s32 x, s32 y, u32 a3, u32 color, u32 a5) +u32 xxx_draw_char(UnkTextStruct1 *a0, s32 x, s32 y, u32 a3, u32 color, u32 a5) { asm_unified( "push {r4-r7,lr}\n" @@ -1915,8 +1912,7 @@ void sub_80078A4(u32 a0, s32 x, s32 y, s32 a3, u32 color) sub_800792C(a0, x, y + 1, a3, gUnknown_202B030 & 0xF); } -// Unused -void sub_80078E8(u32 a0, s32 x, s32 y, s32 a3, u32 color) +UNUSED static void sub_80078E8(u32 a0, s32 x, s32 y, s32 a3, u32 color) { nullsub_129(a0, x, y, a3, color); nullsub_129(a0, x, y + 1, a3, gUnknown_202B030 & 0xF); @@ -1931,13 +1927,13 @@ void nullsub_129(u32 a0, s32 x, s32 y, s32 a3, u32 color) { } -void sub_8007958(struct UnkTextStruct1 *a0, u32 a1, s32 x, s32 y, s32 a4, u32 color) +void sub_8007958(UnkTextStruct1 *a0, u32 a1, s32 x, s32 y, s32 a4, u32 color) { u32 uVar4; u32 *dest; s32 r4; const struct unkShiftData *shiftData; - struct UnkTextStruct1 *r5; + UnkTextStruct1 *r5; s32 r6; u32 r9; struct unkStruct_80B8824 dataLOL; @@ -1997,17 +1993,16 @@ void sub_8007A78(u32 a0, s32 x, s32 y, s32 a3, u32 color) sub_8007AA4(gUnknown_2027370, a0, x, y, a3, color); } -// Unused -void nullsub_157(void) +UNUSED static void nullsub_157(void) { } // https://decomp.me/scratch/4tFKb -void sub_8007AA4(struct UnkTextStruct1 *a0, u32 a1, s32 x, s32 y, s32 a4, u32 color) +void sub_8007AA4(UnkTextStruct1 *a0, u32 a1, s32 x, s32 y, s32 a4, u32 color) { s32 r2; s32 r3; - struct UnkTextStruct1 *r4; + UnkTextStruct1 *r4; u32 ip; u32 *dest; struct unkStruct_80B8848 dataLOL; @@ -2053,13 +2048,12 @@ void sub_8007B7C(u32 a0, s32 x, s32 y, s32 a3, u32 color) sub_8007BA8(gUnknown_2027370, a0, x, y, a3, color); } -// Unused -void nullsub_158(void) +UNUSED static void nullsub_158(void) { } #if NONMATCHING // https://decomp.me/scratch/AU1bH -void sub_8007BA8(struct UnkTextStruct1 *a0, u32 a1, s32 x, s32 y, s32 a4, s32 color) +void sub_8007BA8(UnkTextStruct1 *a0, u32 a1, s32 x, s32 y, s32 a4, s32 color) { s32 iVar1; // r1 s32 iVar3; @@ -2068,7 +2062,7 @@ void sub_8007BA8(struct UnkTextStruct1 *a0, u32 a1, s32 x, s32 y, s32 a4, s32 co u32 *r4; u32 r5; u32 r6; - struct UnkTextStruct1 *ip; + UnkTextStruct1 *ip; s32 sp4; s32 sp8; u32 sp1C; // Used correctly @@ -2131,7 +2125,7 @@ void sub_8007BA8(struct UnkTextStruct1 *a0, u32 a1, s32 x, s32 y, s32 a4, s32 co } #else NAKED -void sub_8007BA8(struct UnkTextStruct1 *a0, u32 a1, s32 x, s32 y, s32 a4, s32 color) +void sub_8007BA8(UnkTextStruct1 *a0, u32 a1, s32 x, s32 y, s32 a4, s32 color) { asm_unified( "push {r4-r7,lr}\n" @@ -2299,19 +2293,17 @@ void sub_8007BA8(struct UnkTextStruct1 *a0, u32 a1, s32 x, s32 y, s32 a4, s32 co } #endif // NONMATCHING -// Unused -void sub_8007CD4(u32 a0, s32 a1, s32 a2, s32 a3, s32 a4) +UNUSED static void sub_8007CD4(u32 a0, s32 a1, s32 a2, s32 a3, s32 a4) { sub_8007D00(gUnknown_2027370, a0, a1, a2, a3, a4); } -// Unused -void nullsub_159(void) +UNUSED static void nullsub_159(void) { } NAKED // Very similar to sub_8007BA8 -void sub_8007D00(struct UnkTextStruct1 *a0, u32 a1, s32 x, s32 y, s32 a4, s32 color) +void sub_8007D00(UnkTextStruct1 *a0, u32 a1, s32 x, s32 y, s32 a4, s32 color) { asm_unified( "push {r4-r7,lr}\n" @@ -2477,7 +2469,6 @@ void sub_8007E20(u32 a0, u32 a1, u32 a2, u32 a3, u32 a4, u8 *a5, u32 a6) sub_8007E64(gUnknown_2027370, &gUnknown_202B038[0][0][0], a0, a1, a2, a3, a4, a5, a6); } -// Unused -void nullsub_160(void) +UNUSED static void nullsub_160(void) { } \ No newline at end of file diff --git a/src/thank_you_wonder_mail.c b/src/thank_you_wonder_mail.c index a2de589f6..cee4e30e0 100644 --- a/src/thank_you_wonder_mail.c +++ b/src/thank_you_wonder_mail.c @@ -1,8 +1,9 @@ #include "global.h" #include "constants/communication_error_codes.h" #include "save.h" +#include "save_write.h" #include "pokemon.h" -#include "item.h" +#include "items.h" #include "code_8094F88.h" #include "wonder_mail.h" #include "memory.h" @@ -10,17 +11,16 @@ #include "text1.h" #include "text2.h" #include "text_util.h" -#include "team_inventory.h" +#include "code_801B3C0.h" #include "code_800D090.h" #include "menu_input.h" #include "code_80130A8.h" #include "main_menu.h" #include "code_801C620.h" -#include "code_801B3C0.h" #include "cpu.h" #include "code_80118A4.h" -extern struct WonderMailStruct_203B2C4 *gUnknown_203B2C4; +extern WonderMailStruct_203B2C4 *gUnknown_203B2C4; #define THANK_YOU_MAIL_MAIN_MENU 0 #define ANYTHING_ELSE_THANK_YOU_MAIN_MENU 1 @@ -50,7 +50,7 @@ extern struct WonderMailStruct_203B2C4 *gUnknown_203B2C4; #define PROCESS_THANK_YOU_PASSWORD 0x27 #define THANK_YOU_PASSWORD_WRONG 0x28 -const struct Item gUnknown_80DED44 = +const Item gUnknown_80DED44 = { 1, 0, 0 }; @@ -59,7 +59,7 @@ extern char gUnknown_202E5D8[0x50]; extern char gAvailablePokemonNames[0x50]; -const struct UnkTextStruct2 gUnknown_80DED48 = +const UnkTextStruct2 gUnknown_80DED48 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -69,7 +69,7 @@ const struct UnkTextStruct2 gUnknown_80DED48 = NULL }; -const struct UnkTextStruct2 gUnknown_80DED60 = +const UnkTextStruct2 gUnknown_80DED60 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -82,7 +82,7 @@ const struct UnkTextStruct2 gUnknown_80DED60 = extern const u8 SendItem_Text[]; extern const u8 DontSendItem_Text[]; -const struct MenuItem gUnknown_80DED78[3] = +const MenuItem gUnknown_80DED78[3] = { {"Confirm", 0xB}, {"Info", 0xC}, @@ -90,7 +90,7 @@ const struct MenuItem gUnknown_80DED78[3] = }; // Unused -const struct UnkTextStruct2 gUnknown_80DEDA0 = +const UnkTextStruct2 gUnknown_80DEDA0 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -101,7 +101,7 @@ const struct UnkTextStruct2 gUnknown_80DEDA0 = }; -const struct MenuItem gThankYouMailMainMenuItems[4] = +const MenuItem gThankYouMailMainMenuItems[4] = { {"Send Thank-You Mail", 0x1}, {"Get Thank-You Mail", 0x2}, @@ -109,7 +109,7 @@ const struct MenuItem gThankYouMailMainMenuItems[4] = {NULL, 0x0}, }; -const struct MenuItem gUnknown_80DEE08[4] = +const MenuItem gUnknown_80DEE08[4] = { {"Game Link cable", WONDER_MAIL_GAME_LINK}, {"Password", WONDER_MAIL_PASSWORD}, @@ -117,21 +117,21 @@ const struct MenuItem gUnknown_80DEE08[4] = {NULL, 0x0}, }; -const struct MenuItem gUnknown_80DEE44[3] = +const MenuItem gUnknown_80DEE44[3] = { {"Yes", 0x7}, {"Cancel", 0x0}, {NULL, 0x0}, }; -const struct MenuItem gUnknown_80DEE60[3] = +const MenuItem gUnknown_80DEE60[3] = { {"Yes", 0x7}, {"No", 0x8}, {NULL, 0x0}, }; -const struct MenuItem gUnknown_80DEE7C[4] = +const MenuItem gUnknown_80DEE7C[4] = { {SendItem_Text, 0x9}, {DontSendItem_Text, 0xA}, @@ -142,14 +142,14 @@ const struct MenuItem gUnknown_80DEE7C[4] = ALIGNED(4) static const u8 DontSendItem_Text[] = _("Don{APOSTROPHE}t Send Item"); ALIGNED(4) static const u8 SendItem_Text[] = "Send Item"; -const struct MenuItem gUnknown_80DEEBC[3] = +const MenuItem gUnknown_80DEEBC[3] = { {"Send w/o Item", 0xA}, {"Cancel", 0x0}, {NULL, 0x0}, }; -const struct MenuItem gUnknown_80DEEE4[4] = +const MenuItem gUnknown_80DEEE4[4] = { {"Yes", 0x7}, {"No", 0x8}, @@ -214,8 +214,7 @@ extern void sub_80155F0(); extern void sub_8031E10(); extern void sub_802F2C0(); extern void SetThankYouMailMenuState(u32); -extern struct PokemonStruct *GetPlayerPokemonStruct(void); -extern void sub_802F204(struct unkStruct_802F204 *, u32); +extern void sub_802F204(unkStruct_802F204 *, u32); extern void sub_80151C0(u32, u8 *); extern void sub_803092C(void); extern s32 sub_8037B28(u32); @@ -225,27 +224,27 @@ extern void sub_80306A8(u32, u32, u32, u32); extern s32 sub_8037D64(u32, void *, void *); extern s32 sub_80381F4(u32, void *, void *); extern u8 sub_800D588(void); -extern u32 GetDungeonTeamRankPts(struct DungeonLocation *, u32); +extern u32 GetDungeonTeamRankPts(DungeonLocation *, u32); extern void sub_8031D70(u8, u32); extern void sub_803092C(void); extern void sub_8011C28(u32); extern u32 sub_80154F0(void); -extern u32 sub_8039068(u32, u8 *r1, struct unkStruct_203B480 *r0); +extern u32 sub_8039068(u32, u8 *r1, unkStruct_203B480 *r0); u32 CreateThankYouMailPelipper(void) { char *monName; - struct OpenedFile *faceFile; + OpenedFile *faceFile; s32 index; int counter; - struct unkStruct_203B480 *mail; + unkStruct_203B480 *mail; ResetUnusedInputStruct(); - sub_800641C(0,1,1); - gUnknown_203B2C4 = MemoryAlloc(sizeof(struct WonderMailStruct_203B2C4), 8); - MemoryFill8((u8 *)gUnknown_203B2C4, 0, sizeof(struct WonderMailStruct_203B2C4)); + sub_800641C(NULL, TRUE, TRUE); + gUnknown_203B2C4 = MemoryAlloc(sizeof(WonderMailStruct_203B2C4), 8); + MemoryFill8((u8 *)gUnknown_203B2C4, 0, sizeof(WonderMailStruct_203B2C4)); CopyYellowMonsterNametoBuffer(gUnknown_202E5D8, MONSTER_PELIPPER); monName = GetMonSpecies(MONSTER_PELIPPER); @@ -487,7 +486,7 @@ void DisplayThankYouMailCommsOutcome(void) if (sub_80144A4(&auStack20) != 0) { return; } - MemoryFill8((u8 *)&gUnknown_203B2C4->unk41C, 0, sizeof(struct Item)); + MemoryFill8((u8 *)&gUnknown_203B2C4->unk41C, 0, sizeof(Item)); gUnknown_203B2C4->unk41C.id = ITEM_NOTHING; gUnknown_203B2C4->unk41C.quantity = 1; gUnknown_203B2C4->unk41C.flags = 0; @@ -531,7 +530,7 @@ void sub_802A050(void) case 2: sub_8031E10(); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2C4->unk3BC, 1, 1); + sub_800641C(gUnknown_203B2C4->unk3BC, TRUE, TRUE); SetThankYouMailMenuState(0x1B); break; case 1: @@ -579,7 +578,7 @@ void sub_802A0C8(void) gUnknown_203B2C4->mailIndex = sub_80307EC(); sub_8006518(gUnknown_203B2C4->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); sub_8030D40(gUnknown_203B2C4->mailIndex,0); SetThankYouMailMenuState(0x12); break; @@ -615,7 +614,7 @@ void sub_802A174(void) gUnknown_203B2C4->fallbackState = 0x2b; sub_8006518(gUnknown_203B2C4->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); sub_8030D40(gUnknown_203B2C4->mailIndex,0); SetThankYouMailMenuState(0x12); break; @@ -637,7 +636,7 @@ void sub_802A230(void) case 3: sub_8030DE4(); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2C4->unk3BC, 1, 1); + sub_800641C(gUnknown_203B2C4->unk3BC, TRUE, TRUE); sub_803092C(); if (gUnknown_203B2C4->fallbackState == 0x2b) { sub_8035CF4(gUnknown_203B2C4->unk21C, 3, TRUE); @@ -674,7 +673,7 @@ void sub_802A28C(void) gUnknown_203B2C4->unk41C.id = sub_801CB24(); sub_8006518(gUnknown_203B2C4->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); sub_801B3C0(&gUnknown_203B2C4->unk41C); SetThankYouMailMenuState(SHOW_ITEM_TO_SEND_INFO); break; @@ -689,7 +688,7 @@ void sub_802A33C(void) case 3: sub_801B450(); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2C4->unk3BC,1,1); + sub_800641C(gUnknown_203B2C4->unk3BC, TRUE, TRUE); sub_801CB5C(TRUE); if (gUnknown_203B2C4->fallbackState == 0x2b) { sub_8035CF4(gUnknown_203B2C4->unk21C,3,TRUE); @@ -725,7 +724,7 @@ void sub_802A39C(void) gUnknown_203B2C4->fallbackState = 0x2b; sub_8006518(gUnknown_203B2C4->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); sub_801B3C0(&gUnknown_203B2C4->unk41C); SetThankYouMailMenuState(SHOW_ITEM_TO_SEND_INFO); break; @@ -798,12 +797,12 @@ void AdvanceToThankYouPasswordProcessing(void) void HandleThankYouMailPasswordMenu(void) { u8 mailIndex; - struct unkStruct_203B480 *mail; + unkStruct_203B480 *mail; u32 return_var; - struct unkStruct_203B480 mail1; + unkStruct_203B480 mail1; return_var = sub_80154F0(); - MemoryFill8((u8 *)&mail1, 0, sizeof(struct unkStruct_203B480)); + MemoryFill8((u8 *)&mail1, 0, sizeof(unkStruct_203B480)); switch(return_var) { case 3: @@ -838,7 +837,7 @@ void HandleThankYouMailPasswordMenu(void) case 2: sub_80155F0(); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2C4->unk3BC, 1, 1); + sub_800641C(gUnknown_203B2C4->unk3BC, TRUE, TRUE); SetThankYouMailMenuState(ANYTHING_ELSE_THANK_YOU_MAIN_MENU); break; } @@ -930,7 +929,7 @@ void sub_802A75C(void) void HandleConfirmItemtoSendMenu(void) { s32 menuAction; - struct unkStruct_203B480 *mail; + unkStruct_203B480 *mail; if(sub_80144A4(&menuAction) == 0) { switch(menuAction) @@ -1113,7 +1112,7 @@ void sub_802A9FC(void) void HandleMailCommunicationMenu(void) { s32 menuAction; - struct unkStruct_203B480 *mail; + unkStruct_203B480 *mail; if(sub_80144A4(&menuAction) == 0) { switch(menuAction) @@ -1251,10 +1250,10 @@ void UpdateThankYouMailText(void) u8 buffer1 [80]; u8 buffer2 [80]; u8 mailIndex; - struct PokemonStruct *pokeStruct; - struct PokemonStruct *pokeStruct2; + PokemonStruct1 *pokeStruct; + PokemonStruct1 *pokeStruct2; s32 linkStatus; - struct unkStruct_203B480 *mail; + unkStruct_203B480 *mail; switch(gUnknown_203B2C4->state) { case 5: @@ -1275,7 +1274,7 @@ void UpdateThankYouMailText(void) if (sub_8030894() != 0) break; ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); sub_80306A8(WONDER_MAIL_TYPE_THANK_YOU,0,0,6); break; case 0x11: @@ -1288,9 +1287,9 @@ void UpdateThankYouMailText(void) if (sub_801D008() != 0) break; ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); { - struct UnkTextStruct2_sub local_x = {3, 2}; + UnkTextStruct2_sub local_x = {3, 2}; sub_801C8C4(0, 1, &local_x, 9); } break; @@ -1310,13 +1309,13 @@ void UpdateThankYouMailText(void) switch(gUnknown_203B2C4->unk40) { case 6: - MemoryFill8((u8 *)&gUnknown_203B2C4->unk1B8,0, sizeof(struct unkStruct_203B480)); + MemoryFill8((u8 *)&gUnknown_203B2C4->unk1B8,0, sizeof(unkStruct_203B480)); gUnknown_203B2C4->unk1B8 = *GetMailatIndex(gUnknown_203B2C4->mailIndex); gUnknown_203B2C4->linkError = sub_8037D64(gUnknown_203B2C4->unk40,&gUnknown_203B2C4->unk1B8,&gUnknown_203B2C4->unk1E8); break; case 7: - MemoryFill8((u8 *)&gUnknown_203B2C4->unk1B8,0, sizeof(struct unkStruct_203B480)); - MemoryFill8((u8 *)&gUnknown_203B2C4->unk1E8,0, sizeof(struct unkStruct_203B480)); + MemoryFill8((u8 *)&gUnknown_203B2C4->unk1B8,0, sizeof(unkStruct_203B480)); + MemoryFill8((u8 *)&gUnknown_203B2C4->unk1E8,0, sizeof(unkStruct_203B480)); gUnknown_203B2C4->linkError = sub_8037D64(gUnknown_203B2C4->unk40,&gUnknown_203B2C4->unk1B8,&gUnknown_203B2C4->unk1E8); break; } @@ -1344,13 +1343,13 @@ void UpdateThankYouMailText(void) case PROCESS_THANK_YOU_PASSWORD: sub_8006518(gUnknown_203B2C4->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); sub_80151C0(4,gUnknown_203B2C4->passwordBuffer); break; case 0x1a: sub_8006518(gUnknown_203B2C4->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); sub_8031D70(gUnknown_203B2C4->mailIndex,0); break; case 0x1b: diff --git a/src/tile_types.c b/src/tile_types.c index 1063cd805..99e6265dd 100644 --- a/src/tile_types.c +++ b/src/tile_types.c @@ -1,6 +1,6 @@ #include "global.h" #include "tile_types.h" - +#include "code_806CD90.h" #include "dungeon_global_data.h" #include "dungeon_map_access.h" #include "dungeon_util.h" @@ -87,14 +87,13 @@ const u8 gDungeonWaterType[] = { extern void sub_80498A8(s32, s32); extern void sub_80402AC(s32, s32); extern void sub_8049BB0(s32, s32); -extern u32 sub_806CF98(struct Entity *); -void sub_8042A14(struct Position *); +void sub_8042A14(Position *); extern void sub_8049ED4(void); -bool8 sub_804ACE4(struct Position *pos) +bool8 sub_804ACE4(Position *pos) { struct Tile *tile; - struct Entity *entity; + Entity *entity; tile = GetTile(pos->x,pos->y); entity = tile->object; @@ -104,10 +103,10 @@ bool8 sub_804ACE4(struct Position *pos) return FALSE; } -struct Entity *sub_804AD0C(struct Position *pos) +Entity *sub_804AD0C(Position *pos) { struct Tile *tile; - struct Entity *entity; + Entity *entity; tile = GetTile(pos->x,pos->y); entity = tile->monster; @@ -117,11 +116,11 @@ struct Entity *sub_804AD0C(struct Position *pos) return NULL; } -bool8 sub_804AD34(struct Position *pos) +bool8 sub_804AD34(Position *pos) { struct Tile *tile; s32 x; - struct Entity * entity; + Entity * entity; s32 y; bool8 iVar8; s32 index; @@ -157,7 +156,7 @@ bool8 sub_804AD34(struct Position *pos) return iVar8; } -bool8 sub_804AE08(struct Position *pos) +bool8 sub_804AE08(Position *pos) { struct Tile *tile; s32 x; @@ -184,11 +183,11 @@ bool8 sub_804AE08(struct Position *pos) return uVar6; } -void sub_804AE84(struct Position *pos) +void sub_804AE84(Position *pos) { struct Tile *tile; s32 x; - struct Entity * entity; + Entity * entity; s32 index; s32 y; @@ -217,7 +216,7 @@ void sub_804AE84(struct Position *pos) } } -bool8 IsTileGround(struct Tile* tile) +bool8 IsTileGround(Tile *tile) { bool8 isGround = FALSE; if (IsWaterTileset()) diff --git a/src/trade_items_menu.c b/src/trade_items_menu.c index afaea47cd..5020b14c0 100644 --- a/src/trade_items_menu.c +++ b/src/trade_items_menu.c @@ -3,12 +3,11 @@ #include "code_801B3C0.h" #include "code_801C620.h" #include "constants/communication_error_codes.h" -#include "item.h" +#include "items.h" #include "main_menu.h" -#include "team_inventory.h" #include "trade_items_menu.h" #include "memory.h" -#include "save.h" +#include "save_write.h" #include "menu_input.h" #include "text1.h" #include "text2.h" @@ -20,19 +19,19 @@ EWRAM_DATA_2 struct TradeItemsMenu *gTradeItemsMenu = {0}; extern u32 gUnknown_202DE30; extern u8 gUnknown_202DE58[]; -const struct MenuItem gUnknown_80E60A0[3] = { +const MenuItem gUnknown_80E60A0[3] = { {"Send item", 1}, {"Receive item", 2}, {NULL, 0}, }; -const struct MenuItem gUnknown_80E60D4[3] = { +const MenuItem gUnknown_80E60D4[3] = { {"Send item", -1}, {"Receive item", 2}, {NULL, 0}, }; -const struct UnkTextStruct2 gUnknown_80E60EC = +const UnkTextStruct2 gUnknown_80E60EC = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -42,14 +41,14 @@ const struct UnkTextStruct2 gUnknown_80E60EC = NULL }; -const struct MenuItem gUnknown_80E6104[4] = { +const MenuItem gUnknown_80E6104[4] = { {"Confirm", 3}, {"Info", 4}, {"Cancel", 7}, {NULL, 0}, }; -static const struct UnkTextStruct2 unused = +static const UnkTextStruct2 unused = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -60,13 +59,13 @@ static const struct UnkTextStruct2 unused = }; -const struct MenuItem gUnknown_80E6154[3] = { +const MenuItem gUnknown_80E6154[3] = { {"Yes", 5}, {"No", 6}, {NULL, 0}, }; -const struct UnkTextStruct2 gUnknown_80E6174 = +const UnkTextStruct2 gUnknown_80E6174 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -77,7 +76,7 @@ const struct UnkTextStruct2 gUnknown_80E6174 = }; -const struct MenuItem gUnknown_80E618C[3] = { +const MenuItem gUnknown_80E618C[3] = { {"Yes", 5}, {"Cancel", 0}, {NULL, 0}, @@ -144,7 +143,7 @@ s32 CreateTradeItemsMenu(void) { ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); gTradeItemsMenu = MemoryAlloc(sizeof(struct TradeItemsMenu), 8); MemoryFill8((u8 *)gTradeItemsMenu, 0, sizeof(struct TradeItemsMenu)); sub_8035C1C(); @@ -276,7 +275,7 @@ void sub_80365AC(void) gTradeItemsMenu->itemToSend.quantity = 1; sub_8006518(gTradeItemsMenu->unk1E4); ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); sub_801B3C0(&gTradeItemsMenu->itemToSend); SetTradeItemMenu(TRADE_ITEMS_ITEM_INFO); break; @@ -300,7 +299,7 @@ void sub_8036674(void) gTradeItemsMenu->fallbackState = 0x13; sub_8006518(gTradeItemsMenu->unk1E4); ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); sub_801B3C0(&gTradeItemsMenu->itemToSend); SetTradeItemMenu(TRADE_ITEMS_ITEM_INFO); break; @@ -322,7 +321,7 @@ void sub_8036728(void) case 3: sub_801B450(); ResetUnusedInputStruct(); - sub_800641C(gTradeItemsMenu->unk1E4, 1, 1); + sub_800641C(gTradeItemsMenu->unk1E4, TRUE, TRUE); sub_801CB5C(TRUE); if (gTradeItemsMenu->fallbackState == 0x13) { sub_8035CF4(gTradeItemsMenu->unk44, 3, TRUE); @@ -603,9 +602,9 @@ void sub_8036B28(void) case TRADE_ITEMS_SEND_ITEM_SELECTION: if (sub_801D008() == 0) { ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); { - struct UnkTextStruct2_sub local_10 = {3, 2}; + UnkTextStruct2_sub local_10 = {3, 2}; sub_801C8C4(0,1,&local_10,9); } } @@ -622,7 +621,7 @@ void sub_8036B28(void) break; case TRADE_ITEMS_SEND_ITEM_CONFIRM: gUnknown_202DE30 = gTradeItemsMenu->quantityToSend; - sub_8090DC4(gUnknown_202DE58,gTradeItemsMenu->itemToSend.id,0); + BufferItemName(gUnknown_202DE58,gTradeItemsMenu->itemToSend.id,NULL); sub_8014248(gUnknown_80E61E4,0,5, gUnknown_80E6154,0,4,0,0,0x101); break; case TRADE_ITEMS_RECEIVE_ITEM: @@ -681,17 +680,17 @@ void sub_8036B28(void) case 0xe: if (gTradeItemsMenu->unk24C.quantity == 0) { gUnknown_202DE30 = gTradeItemsMenu->unk244.quantity; - sub_8090DC4(gUnknown_202DE58,gTradeItemsMenu->unk244.itemIdx.id,0); + BufferItemName(gUnknown_202DE58,gTradeItemsMenu->unk244.itemIdx.id,NULL); } else { gUnknown_202DE30 = gTradeItemsMenu->unk24C.quantity; - sub_8090DC4(gUnknown_202DE58,gTradeItemsMenu->unk24C.itemIdx.id,0); + BufferItemName(gUnknown_202DE58,gTradeItemsMenu->unk24C.itemIdx.id,NULL); } sub_80141B4(gUnknown_80E6314,0,0,0x101); break; case 0xd: gUnknown_202DE30 = gTradeItemsMenu->quantityToSend; - sub_8090DC4(gUnknown_202DE58,gTradeItemsMenu->itemToSend.id,0); + BufferItemName(gUnknown_202DE58,gTradeItemsMenu->itemToSend.id,NULL); sub_80141B4(gUnknown_80E6358,0,0,0x101); break; case 0xB: @@ -750,7 +749,7 @@ void sub_8036ECC(u32 index, u32 r1) sub_8013AA0(&gTradeItemsMenu->quantityToSend); gTradeItemsMenu->unk184[index] = gUnknown_80E6174; ResetUnusedInputStruct(); - sub_800641C(gTradeItemsMenu->unk184, 1, 1); + sub_800641C(gTradeItemsMenu->unk184, TRUE, TRUE); } void sub_8036F30(void) diff --git a/src/trap.c b/src/trap.c index 3a5592c39..bfc27c148 100644 --- a/src/trap.c +++ b/src/trap.c @@ -5,7 +5,7 @@ #include "dungeon_util.h" #include "map.h" -bool8 CanLayTrap(struct Position *pos) +bool8 CanLayTrap(Position *pos) { struct Tile *tile = GetTileSafe(pos->x, pos->y); if (tile->terrainType & TERRAIN_TYPE_STAIRS || diff --git a/src/type_effectiveness.c b/src/type_effectiveness.c index 1d50e266b..a2a68eac0 100644 --- a/src/type_effectiveness.c +++ b/src/type_effectiveness.c @@ -13,12 +13,12 @@ u32 gTypeEffectivenessMultipliers[] = {0, 1, 2, 4}; -s32 WeightWeakTypePicker(struct Entity *user, struct Entity *target, u8 moveType) +s32 WeightWeakTypePicker(Entity *user, Entity *target, u8 moveType) { s32 weight = 1; bool8 checkExposed = FALSE; - struct EntityInfo *userData; - struct EntityInfo *targetData; + EntityInfo *userData; + EntityInfo *targetData; u8 *targetTypes; u8 *targetType; u32 moveTypeOffset; diff --git a/src/unk_menu_203B360.c b/src/unk_menu_203B360.c index 46da88de9..057e6aaec 100644 --- a/src/unk_menu_203B360.c +++ b/src/unk_menu_203B360.c @@ -13,14 +13,14 @@ struct unkStruct_203B360 // size: 0x1b4 u32 currMenu; u32 unk4; // state - struct MenuStruct unk8[4]; - struct UnkTextStruct2 unk148[4]; - struct SpriteOAM unk1A8; + MenuStruct unk8[4]; + UnkTextStruct2 unk148[4]; + SpriteOAM unk1A8; u32 unk1B0; // sprite count? }; EWRAM_DATA_2 struct unkStruct_203B360 *gUnknown_203B360 = {0}; -const struct UnkTextStruct2 gUnknown_80E6E7C = { +const UnkTextStruct2 gUnknown_80E6E7C = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, @@ -29,7 +29,7 @@ const struct UnkTextStruct2 gUnknown_80E6E7C = { NULL }; -const struct UnkTextStruct2 gUnknown_80E6E94 = { +const UnkTextStruct2 gUnknown_80E6E94 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x05, 0x09, @@ -42,7 +42,7 @@ const u8 CheckAgain_80E6ECC[]; const u8 StorageEmpty_80E6EE4[]; const u8 Caution_80E6F04[]; -const struct MenuItem gUnknown_80E6EAC[4] = { +const MenuItem gUnknown_80E6EAC[4] = { {Caution_80E6F04, 0x3}, {StorageEmpty_80E6EE4, 0x3}, {CheckAgain_80E6ECC, 0x3}, @@ -69,7 +69,7 @@ void sub_80382E4(s32 currMenu) gUnknown_203B360->unk148[index] = gUnknown_80E6E7C; } ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B360->unk148,1,1); + sub_800641C(gUnknown_203B360->unk148, TRUE, TRUE); if (currMenu == 0x25) { // Caution! // The storage space is empty! @@ -86,7 +86,7 @@ void sub_80382E4(s32 currMenu) void sub_80383A8(void) { ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); if (gUnknown_203B360 != 0) { MemoryFree(gUnknown_203B360); gUnknown_203B360 = 0; @@ -135,7 +135,7 @@ void sub_8038440(void) u32 r1; u32 r4; u32 r5; - struct SpriteOAM *sprite; + SpriteOAM *sprite; r5 = 0; sprite = &gUnknown_203B360->unk1A8; diff --git a/src/unused_vblank.c b/src/unused_vblank.c index 33f5ebfce..d6cfdf5e4 100644 --- a/src/unused_vblank.c +++ b/src/unused_vblank.c @@ -1,14 +1,14 @@ #include "global.h" #include "reg_control.h" -extern struct unkStruct_202D648 gUnknown_202D608[8]; -extern struct unkStruct_202D648 gUnknown_202D648[8]; +extern unkStruct_202D648 gUnknown_202D608[8]; +extern unkStruct_202D648 gUnknown_202D648[8]; // Unused? s32 sub_800B720(s16 a0, IntrCallback a1) { s32 r2; - struct unkStruct_202D648 *r3; + unkStruct_202D648 *r3; s32 r4; bool8 sp4; s32 spC; @@ -70,7 +70,7 @@ s32 sub_800B720(s16 a0, IntrCallback a1) void sub_800B850(s16 a0) { s32 r2; - struct unkStruct_202D648 *r4; + unkStruct_202D648 *r4; bool8 r5; s32 r6; diff --git a/src/weather.c b/src/weather.c index 34408ed59..d1699a4f7 100644 --- a/src/weather.c +++ b/src/weather.c @@ -13,7 +13,7 @@ extern void TriggerWeatherAbilities(void); extern void sub_807EAA0(u32, u32); void sub_807E5E4(u8); -u8 GetApparentWeather(struct Entity *pokemon) +u8 GetApparentWeather(Entity *pokemon) { if (pokemon != NULL && HasHeldItem(pokemon, ITEM_WEATHER_BAND)) { diff --git a/src/wigglytuff_shop.c b/src/wigglytuff_shop.c index 925c4597b..f92931f08 100644 --- a/src/wigglytuff_shop.c +++ b/src/wigglytuff_shop.c @@ -7,7 +7,6 @@ #include "pokemon.h" #include "pokemon_3.h" #include "input.h" -#include "team_inventory.h" #include "text1.h" #include "text2.h" #include "memory.h" @@ -23,14 +22,19 @@ #include "event_flag.h" #include "exclusive_pokemon.h" +// TODO: This file was originally 3 files. Split properly +// 4 files if you count code_8023144.s + +// split1 + struct unkStruct_203B280 { /* 0x0 */ u8 friendAreas[NUM_FRIEND_AREAS]; /* 0x3C */ u32 mode; - struct MenuInputStruct unk40; + MenuInputStruct unk40; s32 unk74; - struct UnkTextStruct2 *unk78; - struct UnkTextStruct2 unk7C[4]; + UnkTextStruct2 *unk78; + UnkTextStruct2 unk7C[4]; u8 unkDC[4]; }; EWRAM_DATA_2 struct unkStruct_203B280 *gUnknown_203B280 = {0}; @@ -38,52 +42,62 @@ EWRAM_DATA_2 u32 gUnknown_203B284 = {0}; EWRAM_DATA_2 u16 gUnknown_203B288 = {0}; EWRAM_DATA_2 u16 gUnknown_203B28A = {0}; +// split2 + struct unkStruct_203B28C { - struct MenuInputStructSub unk0; + MenuInputStructSub unk0; /* 0xC */ u8 friendArea; bool8 unkD; s16 unkE[0x10]; u32 unk30[0x10]; /* 0x70 */ s32 numPokemoninFriendArea; s32 unk74; - struct UnkTextStruct2 *unk78; - struct UnkTextStruct2 unk7C[4]; + UnkTextStruct2 *unk78; + UnkTextStruct2 unk7C[4]; u8 unkDC[4]; }; EWRAM_DATA_2 struct unkStruct_203B28C *gUnknown_203B28C = {0}; -EWRAM_DATA_2 struct WigglytuffShop *gWigglytuffShop = {0}; +// split3 + +EWRAM_DATA_2 WigglytuffShop *gWigglytuffShop = {0}; + +// other stuff + extern u8 *gFriendAreas; - -extern u8 gUnknown_202E628[]; extern u32 gUnknown_202DE30[2]; -extern u8 gUnknown_202E5D8[]; +extern u8 gAvailablePokemonNames[]; // 202DF98 extern u8 gUnknown_202E1C8[]; -extern u8 gAvailablePokemonNames[]; +extern u8 gUnknown_202E5D8[]; +extern u8 gUnknown_202E628[]; -extern const u8 *gWigglytuffDialogue[2][20]; -extern const u8 *gWigglytuffCheck[]; extern const u8 *gUnknown_80D4920[]; extern const u8 *gUnknown_80D4928[]; extern const u8 *gUnknown_80D4934[]; extern const u8 *gUnknown_80D4970[]; extern const u8 *gUnknown_80D4978[]; -extern struct UnkTextStruct2 gUnknown_80DC464; -extern struct UnkTextStruct2 gUnknown_80DC47C; -extern struct UnkTextStruct2 gUnknown_80DC4BC; -extern struct UnkTextStruct2 gUnknown_80DC4D8; -extern struct UnkTextStruct2 gUnknown_80DC534; -extern struct UnkTextStruct2 gUnknown_80DC54C; -extern struct UnkTextStruct2 gUnknown_80DC564; +extern const u8 *gWigglytuffCheck[]; // 80D499C +extern const u8 *gUnknown_80D49BC[]; -extern u8 *gUnknown_80D49BC[]; -extern u8 gUnknown_80DC4A4[]; -extern u8 gUnknown_80DC494[]; -extern u8 gUnknown_80DC4AC[]; -extern u8 gUnknown_80DC4F0[]; -extern u8 gUnknown_80DC518[]; -extern u8 gUnknown_80DC524[]; +extern const u8 *gWigglytuffDialogue[2][20]; // 80D79A4 + +// split1 +extern const UnkTextStruct2 gUnknown_80DC464; +extern const UnkTextStruct2 gUnknown_80DC47C; +extern const u8 gUnknown_80DC494[]; +extern const u8 gUnknown_80DC4A4[]; +extern const u8 gUnknown_80DC4AC[]; +// split2 +extern const UnkTextStruct2 gUnknown_80DC4BC; +extern const UnkTextStruct2 gUnknown_80DC4D8; +extern const u8 gUnknown_80DC4F0[]; +extern const u8 gUnknown_80DC518[]; +extern const u8 gUnknown_80DC524[]; +// split3 +extern const UnkTextStruct2 gUnknown_80DC534; +extern const UnkTextStruct2 gUnknown_80DC54C; +extern const UnkTextStruct2 gUnknown_80DC564; u8 sub_8021700(u32); void sub_8092578(u8 *buffer, u8 index, u8 r2); @@ -92,7 +106,7 @@ extern void sub_803AA34(); extern u8 sub_803ABC8(void); extern u8 sub_802132C(void); extern void sub_8022380(void); -bool8 sub_8023144(s32 param_1, s32 index, struct UnkTextStruct2_sub *sub, u32 param_4); +bool8 sub_8023144(s32 param_1, s32 index, UnkTextStruct2_sub *sub, u32 param_4); void sub_8023354(u8 param_1); extern void CreateWigglytuffConfirmFriendAreaMenu(void); extern u8 sub_8099B94(void); @@ -129,33 +143,33 @@ s32 sub_8021B58(s16 species); extern void PlayMenuSoundEffect(u32); +// split1 + bool8 sub_80211AC(u32 mode, u32 param_2) { - if(sub_8021700(mode)) - { + if (sub_8021700(mode)) return FALSE; + + gUnknown_203B280 = MemoryAlloc(sizeof(struct unkStruct_203B280), 8); + gUnknown_203B280->mode = mode; + gUnknown_203B280->unk74 = param_2; + gUnknown_203B280->unk78 = &gUnknown_203B280->unk7C[gUnknown_203B280->unk74]; + sub_8006518(gUnknown_203B280->unk7C); + gUnknown_203B280->unk7C[gUnknown_203B280->unk74] = gUnknown_80DC47C; + gUnknown_203B280->unk78->unk14 = gUnknown_203B280->unkDC; + ResetUnusedInputStruct(); + sub_800641C(gUnknown_203B280->unk7C, TRUE, TRUE); + sub_8013818(&gUnknown_203B280->unk40, sub_8021664(), 10, param_2); + + if (gUnknown_203B284 == gUnknown_203B280->mode) { + gUnknown_203B280->unk40.menuIndex = gUnknown_203B288; + gUnknown_203B280->unk40.unk1E = gUnknown_203B28A; + sub_8013984(&gUnknown_203B280->unk40); } - else { - gUnknown_203B280 = MemoryAlloc(sizeof(struct unkStruct_203B280), 8); - gUnknown_203B280->mode = mode; - gUnknown_203B280->unk74 = param_2; - gUnknown_203B280->unk78 = &gUnknown_203B280->unk7C[gUnknown_203B280->unk74]; - sub_8006518(gUnknown_203B280->unk7C); - gUnknown_203B280->unk7C[gUnknown_203B280->unk74] = gUnknown_80DC47C; - gUnknown_203B280->unk78->unk14 = gUnknown_203B280->unkDC; - ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B280->unk7C, 1, 1); - sub_8013818(&gUnknown_203B280->unk40, sub_8021664(), 10, param_2); - if(gUnknown_203B284 == gUnknown_203B280->mode) - { - gUnknown_203B280->unk40.menuIndex = gUnknown_203B288; - gUnknown_203B280->unk40.unk1E = gUnknown_203B28A; - sub_8013984(&gUnknown_203B280->unk40); - } - sub_8021410(); - sub_8021494(); - return TRUE; - } + + sub_8021410(); + sub_8021494(); + return TRUE; } u32 sub_8021274(bool8 param_1) @@ -164,20 +178,16 @@ u32 sub_8021274(bool8 param_1) sub_8013660(&gUnknown_203B280->unk40); return 0; } - switch(GetKeyPress(&gUnknown_203B280->unk40)) - { + + switch (GetKeyPress(&gUnknown_203B280->unk40)) { case INPUT_B_BUTTON: PlayMenuSoundEffect(1); return 2; case INPUT_A_BUTTON: - if ((gUnknown_203B280->mode == 2) && (GetFriendAreaPrice(sub_802132C()) > gTeamInventoryRef->teamMoney)) - { + if (gUnknown_203B280->mode == 2 && GetFriendAreaPrice(sub_802132C()) > gTeamInventoryRef->teamMoney) PlayMenuSoundEffect(2); - } else - { PlayMenuSoundEffect(0); - } return 3; case INPUT_START_BUTTON: PlayMenuSoundEffect(4); @@ -188,9 +198,7 @@ u32 sub_8021274(bool8 param_1) sub_8021494(); return 1; } - else { - return 0; - } + return 0; } } @@ -199,35 +207,33 @@ u8 sub_802132C(void) return gUnknown_203B280->friendAreas[gUnknown_203B280->unk40.unk1E * gUnknown_203B280->unk40.unk1C + gUnknown_203B280->unk40.menuIndex]; } -void sub_8021354(bool8 param_1) +void sub_8021354(bool8 a0) { ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B280->unk7C,0,0); + sub_800641C(gUnknown_203B280->unk7C, FALSE, FALSE); gUnknown_203B280->unk40.unk22 = sub_8021664(); sub_8013984(&gUnknown_203B280->unk40); sub_8021410(); sub_8021494(); - if (param_1) { + if (a0) AddMenuCursorSprite(&gUnknown_203B280->unk40); - } } void sub_80213A0(void) { - if(gUnknown_203B280) - { + if (gUnknown_203B280) { gUnknown_203B284 = gUnknown_203B280->mode; gUnknown_203B288 = gUnknown_203B280->unk40.menuIndex; gUnknown_203B28A = gUnknown_203B280->unk40.unk1E; gUnknown_203B280->unk7C[gUnknown_203B280->unk74] = gUnknown_80DC464; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B280->unk7C, 1, 1); + sub_800641C(gUnknown_203B280->unk7C, TRUE, TRUE); MemoryFree(gUnknown_203B280); gUnknown_203B280 = NULL; } } -NAKED +NAKED // sub_80095E4 memes void sub_8021410(void) { asm_unified( @@ -291,24 +297,23 @@ void sub_8021410(void) "\tbx r0\n" "\t.align 2, 0\n" "_08021490: .4byte gUnknown_203B280"); - } void sub_8021494(void) { u8 friendAreaIndex; s32 index; - u8 buffer1 [80]; - u8 buffer2 [80]; + u8 buffer1[80]; + u8 buffer2[80]; sub_8008C54(gUnknown_203B280->unk74); sub_80073B8(gUnknown_203B280->unk74); xxx_call_draw_string(10,0,gUnknown_80DC494,gUnknown_203B280->unk74,0); // Friend Areas sub_8012BC4(gUnknown_203B280->unkDC[2] * 8 + 4,0,(gUnknown_203B280->unk40).unk1E + 1,1,7,gUnknown_203B280->unk74); - for(index = 0; index < (gUnknown_203B280->unk40).unk1A; index++) - { + for (index = 0; index < (gUnknown_203B280->unk40).unk1A; index++) { friendAreaIndex = gUnknown_203B280->friendAreas[(gUnknown_203B280->unk40).unk1E * (gUnknown_203B280->unk40).unk1C + index]; + if (gUnknown_203B280->mode == 2) { sub_8092578(buffer1,friendAreaIndex,TRUE); @@ -386,7 +391,6 @@ s32 sub_8021664(void) return counter; } - u8 sub_8021700(u32 mode) { s32 index; @@ -424,6 +428,8 @@ u8 sub_8021700(u32 mode) return TRUE; } +// split2 + bool8 sub_8021774(u8 friendArea, bool8 param_2, s32 param_3) { gUnknown_203B28C = MemoryAlloc(sizeof(struct unkStruct_203B28C), 8); @@ -466,7 +472,7 @@ void sub_8021830(void) { gUnknown_203B28C->unk7C[gUnknown_203B28C->unk74] = gUnknown_80DC4BC; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B28C->unk7C, 1, 1); + sub_800641C(gUnknown_203B28C->unk7C, TRUE, TRUE); MemoryFree(gUnknown_203B28C); gUnknown_203B28C = NULL; } @@ -475,12 +481,12 @@ void sub_8021830(void) void sub_8021878(void) { ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B28C->unk7C, 1, 1); + sub_800641C(gUnknown_203B28C->unk7C, TRUE, TRUE); } void sub_8021894(void) { - u8 *string; + const u8 *string; u32 y; u32 x; s32 index; @@ -535,7 +541,7 @@ void sub_8021A60(void) s32 sVar4; s32 iVar6; s32 index; - struct PokemonStruct *pokeStruct; + PokemonStruct1 *pokeStruct; gUnknown_203B28C->numPokemoninFriendArea = 0; for(index = 0; index < 0x10; index++) @@ -562,7 +568,7 @@ void sub_8021A60(void) for(index = 0; index < NUM_MONSTERS; index++) { pokeStruct = &gRecruitedPokemonRef->pokemon[index]; - if (((*(u8 *)&pokeStruct->unk0 & 1) != 0) && + if (((u8)pokeStruct->unk0 & 1) && (sVar4 = sub_8021B58(pokeStruct->speciesNum), sVar4 != -1)) { gUnknown_203B28C->unk30[sVar4] = 2; } @@ -582,14 +588,16 @@ s32 sub_8021B58(s16 species) return -1; } +// split3 + bool8 CreateWigglytuffShop(bool32 isAsleep) { - char *string; - struct OpenedFile *file; + u8 *string; + OpenedFile *file; ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); - gWigglytuffShop = MemoryAlloc(sizeof(struct WigglytuffShop), 8); + sub_800641C(NULL, TRUE, TRUE); + gWigglytuffShop = MemoryAlloc(sizeof(WigglytuffShop), 8); gWigglytuffShop->menuAction1 = 0; gWigglytuffShop->menuAction2 = 0; gWigglytuffShop->isAsleep = isAsleep; @@ -697,13 +705,13 @@ void sub_8021D5C(void) } ResetUnusedInputStruct(); - sub_800641C(gWigglytuffShop->unkD0, 1, 1); + sub_800641C(gWigglytuffShop->unkD0, TRUE, TRUE); } void UpdateWigglytuffDialogue(void) { char *string; - struct unkStruct_8092638 uStack_14; + unkStruct_8092638 uStack_14; switch(gWigglytuffShop->state) { diff --git a/src/wonder_mail.c b/src/wonder_mail.c index 9ae061215..1be721c80 100644 --- a/src/wonder_mail.c +++ b/src/wonder_mail.c @@ -1,13 +1,13 @@ #include "global.h" #include "constants/communication_error_codes.h" -#include "save.h" +#include "save_write.h" #include "pokemon.h" -#include "item.h" +#include "items.h" #include "wonder_mail.h" #include "memory.h" #include "text1.h" #include "text2.h" -#include "team_inventory.h" +#include "code_80A26CC.h" #include "rescue_password_menu.h" #include "menu_input.h" #include "code_8094F88.h" @@ -16,8 +16,9 @@ #include "code_801EE10_1.h" #include "cpu.h" #include "code_80118A4.h" +#include "save.h" -extern struct WonderMailStruct_203B2C0 *gUnknown_203B2C0; +extern WonderMailStruct_203B2C0 *gUnknown_203B2C0; extern void sub_8011C28(u32); @@ -25,7 +26,6 @@ extern void sub_809927C(u8); extern bool8 HasNoWonderMailType(u32); extern u32 sub_8031050(); extern void sub_80310B4(); -extern bool8 sub_80A2824(u8); extern char gUnknown_202E5D8[0x50]; extern char gAvailablePokemonNames[0x50]; @@ -42,19 +42,15 @@ extern void sub_8030DE4(void); extern void sub_803092C(void); extern u32 sub_80154F0(); -extern u32 sub_8039068(u32, u8 *r1, struct unkStruct_203B480 *r0); +extern u32 sub_8039068(u32, u8 *r1, unkStruct_203B480 *r0); extern void sub_8095274(u32); extern void sub_80155F0(); -extern void sub_8024458(s16, u32); extern u32 sub_80244E4(); extern void sub_802452C(); -extern void sub_802453C(); extern u8 sub_8024108(u32); extern u32 sub_8031DCC(); extern void sub_8031E10(); extern void sub_8031E00(); -extern s32 sub_8001658(u32, u32); -extern void sub_8099690(u32); extern void sub_8031E10(void); extern void sub_803084C(void); extern void sub_8030DE4(); @@ -123,7 +119,6 @@ extern void sub_803084C(void); extern void sub_80155F0(void); extern void sub_80310B4(void); extern void sub_8030DE4(void); -extern void sub_802453C(void); extern const u8 DontSendPokemon_80DDB80[]; extern const u8 SendPokemon_80DDB98[]; @@ -166,7 +161,7 @@ enum FriendRescueStates { DEFAULT_FALLBACK_STATE = 0x3D }; -const struct MenuItem gUnknown_80DD970[] = +const MenuItem gUnknown_80DD970[] = { {"Receive SOS Mail", 0x0}, {"Leave for Rescue", 0x1}, @@ -176,7 +171,7 @@ const struct MenuItem gUnknown_80DD970[] = {NULL, 0xA} }; -const struct MenuItem gUnknown_80DD9EC[] = +const MenuItem gUnknown_80DD9EC[] = { {"Delete SOS Mail", 0x5}, {"Delete A-OK Mail", 0x6}, @@ -185,21 +180,21 @@ const struct MenuItem gUnknown_80DD9EC[] = {NULL, 0xA} }; -const struct MenuItem gUnknown_80DDA48[] = +const MenuItem gUnknown_80DDA48[] = { {"Yes", 0x8}, {"Cancel", 0xA}, {NULL, 0xA} }; -const struct MenuItem gUnknown_80DDA64[] = +const MenuItem gUnknown_80DDA64[] = { {"Yes", 0x8}, {"No", 0x9}, {NULL, 0xA} }; -const struct MenuItem gUnknown_80DDA80[] = +const MenuItem gUnknown_80DDA80[] = { {"Yes", 0x8}, {"No", 0x9}, @@ -207,7 +202,7 @@ const struct MenuItem gUnknown_80DDA80[] = {NULL, 0xA} }; -const struct MenuItem gUnknown_80DDAA0[] = +const MenuItem gUnknown_80DDAA0[] = { {SendWOPokemon, 0x12}, {"Cancel", 0xA}, @@ -216,7 +211,7 @@ const struct MenuItem gUnknown_80DDAA0[] = ALIGNED(4) const u8 SendWOPokemon[] = _("Send w/o Pokémon"); -const struct UnkTextStruct2 gUnknown_80DDACC = +const UnkTextStruct2 gUnknown_80DDACC = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -226,7 +221,7 @@ const struct UnkTextStruct2 gUnknown_80DDACC = NULL }; -const struct UnkTextStruct2 gUnknown_80DDAE4 = +const UnkTextStruct2 gUnknown_80DDAE4 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -236,14 +231,14 @@ const struct UnkTextStruct2 gUnknown_80DDAE4 = NULL }; -const struct MenuItem gUnknown_80DDAFC[] = +const MenuItem gUnknown_80DDAFC[] = { {"Confirm", 0xB}, {"Info", 0xC}, {NULL, 0xA}, }; -const struct MenuItem gUnknown_80DDB24[] = +const MenuItem gUnknown_80DDB24[] = { {"Game Link cable", 0xD}, {"Password", 0xF}, @@ -251,7 +246,7 @@ const struct MenuItem gUnknown_80DDB24[] = {NULL, 0xA}, }; -const struct MenuItem gUnknown_80DDB60[] = +const MenuItem gUnknown_80DDB60[] = { {SendPokemon_80DDB98, 0x11}, {DontSendPokemon_80DDB80, 0x12}, @@ -268,13 +263,13 @@ ALIGNED(4) const u8 SendPokemon_80DDB98[] = _("Send Pokémon"); u32 sub_8027F88(void) { char *monName; - struct OpenedFile *faceFile; + OpenedFile *faceFile; s32 counter; ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); - gUnknown_203B2C0 = MemoryAlloc(sizeof(struct WonderMailStruct_203B2C0), 8); - MemoryFill8((u8 *)gUnknown_203B2C0, 0, sizeof(struct WonderMailStruct_203B2C0)); + sub_800641C(NULL, TRUE, TRUE); + gUnknown_203B2C0 = MemoryAlloc(sizeof(WonderMailStruct_203B2C0), 8); + MemoryFill8((u8 *)gUnknown_203B2C0, 0, sizeof(WonderMailStruct_203B2C0)); gUnknown_203B2C0->unk53C = 0; gUnknown_203B2C0->mailIndex = -1; gUnknown_203B2C0->speciesNum = -1; @@ -507,7 +502,7 @@ void sub_8028348(void) case 0x3B: sub_8006518(gUnknown_203B2C0->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_8031D70(gUnknown_203B2C0->mailIndex, 0); break; case 0x3C: @@ -542,7 +537,7 @@ void sub_8028348(void) if(sub_8023CE8() == 0) { ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_8023868(3, 0, 0, 9); } break; @@ -568,7 +563,7 @@ void sub_8028348(void) if(sub_8030894() == 0) { ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_80306A8(WONDER_MAIL_TYPE_AOK, 0, 0, 6); } break; @@ -601,13 +596,13 @@ void sub_8028348(void) switch(gUnknown_203B2C0->unk40) { case 3: - MemoryFill8((u8 *)&gUnknown_203B2C0->unk48, 0, sizeof(struct unkStruct_203B480)); - MemoryFill8((u8 *)&gUnknown_203B2C0->unk78, 0, sizeof(struct unkStruct_203B480)); + MemoryFill8((u8 *)&gUnknown_203B2C0->unk48, 0, sizeof(unkStruct_203B480)); + MemoryFill8((u8 *)&gUnknown_203B2C0->unk78, 0, sizeof(unkStruct_203B480)); gUnknown_203B2C0->linkError = sub_8037D64(gUnknown_203B2C0->unk40, &gUnknown_203B2C0->unk48, &gUnknown_203B2C0->unk78); break; case 4: - MemoryFill8((u8 *)&gUnknown_203B2C0->unkA8, 0, sizeof(struct WonderMailStruct_203B2C0_sub)); - MemoryFill8((u8 *)&gUnknown_203B2C0->unk130, 0, sizeof(struct WonderMailStruct_203B2C0_sub)); + MemoryFill8((u8 *)&gUnknown_203B2C0->unkA8, 0, sizeof(WonderMailStruct_203B2C0_sub)); + MemoryFill8((u8 *)&gUnknown_203B2C0->unk130, 0, sizeof(WonderMailStruct_203B2C0_sub)); gUnknown_203B2C0->unkA8.pokemon.speciesNum = 0; gUnknown_203B2C0->unk130.pokemon.speciesNum = 0; gUnknown_203B2C0->unkA8.mail = *GetMailatIndex(gUnknown_203B2C0->mailIndex); @@ -659,7 +654,7 @@ void sub_8028348(void) case 0x27: sub_8006518(gUnknown_203B2C0->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_80151C0(4, gUnknown_203B2C0->passwordBuffer); break; case 8: @@ -695,7 +690,7 @@ void sub_8028348(void) if(sub_8030894() == 0) { ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); // SOS Mail sub_80306A8(2, 0, 0, 6); } @@ -1152,7 +1147,7 @@ void sub_8028FC0() void sub_8028FDC(void) { s32 menuChoice; - struct unkStruct_203B480 *mail; + unkStruct_203B480 *mail; if(sub_80144A4(&menuChoice) != 0) { @@ -1201,7 +1196,7 @@ void sub_8029044(void) gUnknown_203B2C0->mailIndex = sub_80307EC(); sub_8006518(gUnknown_203B2C0->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_8030D40(gUnknown_203B2C0->mailIndex, 0); SetFriendRescueCounterState(0x21); break; @@ -1237,7 +1232,7 @@ void sub_80290F0(void) gUnknown_203B2C0->fallbackState = DEFAULT_FALLBACK_STATE; sub_8006518(gUnknown_203B2C0->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_8030D40(gUnknown_203B2C0->mailIndex, 0); SetFriendRescueCounterState(0x21); break; @@ -1260,7 +1255,7 @@ void sub_80291AC(void) case 3: sub_8030DE4(); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2C0->unk3BC, 1, 1); + sub_800641C(gUnknown_203B2C0->unk3BC, TRUE, TRUE); sub_803092C(); if(gUnknown_203B2C0->fallbackState == DEFAULT_FALLBACK_STATE) { @@ -1439,10 +1434,10 @@ void sub_80293D8(void) void sub_80293F4(void) { u32 return_var; - struct unkStruct_203B480 mail; + unkStruct_203B480 mail; return_var = sub_80154F0(); - MemoryFill8((u8 *)&mail, 0, sizeof(struct unkStruct_203B480)); + MemoryFill8((u8 *)&mail, 0, sizeof(unkStruct_203B480)); switch(return_var) { case 3: @@ -1477,7 +1472,7 @@ void sub_80293F4(void) case 2: sub_80155F0(); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2C0->unk3BC, 1, 1); + sub_800641C(gUnknown_203B2C0->unk3BC, TRUE, TRUE); SetFriendRescueCounterState(FRIEND_RESCUE_MAIN); break; default: @@ -1550,7 +1545,7 @@ void sub_80295D8(void) gUnknown_203B2C0->mailIndex = sub_80307EC(); sub_8006518(gUnknown_203B2C0->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_8030D40(gUnknown_203B2C0->mailIndex, 0); SetFriendRescueCounterState(0x2C); break; @@ -1586,7 +1581,7 @@ void sub_8029684(void) gUnknown_203B2C0->fallbackState = DEFAULT_FALLBACK_STATE; sub_8006518(gUnknown_203B2C0->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_8030D40(gUnknown_203B2C0->mailIndex, 0); SetFriendRescueCounterState(0x2C); break; @@ -1607,7 +1602,7 @@ void sub_8029740(void) case 3: sub_8030DE4(); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2C0->unk3BC, 1, 1); + sub_800641C(gUnknown_203B2C0->unk3BC, TRUE, TRUE); sub_803092C(); if(gUnknown_203B2C0->fallbackState == DEFAULT_FALLBACK_STATE) { @@ -1660,7 +1655,7 @@ void sub_80297D4(void) gUnknown_203B2C0->speciesNum = sub_8023B44(); sub_8006518(gUnknown_203B2C0->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_8024458(gUnknown_203B2C0->speciesNum, 0); SetFriendRescueCounterState(0x35); break; @@ -1686,7 +1681,7 @@ void sub_8029884(void) gUnknown_203B2C0->fallbackState = DEFAULT_FALLBACK_STATE; sub_8006518(gUnknown_203B2C0->unk3BC); ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); sub_8024458(gUnknown_203B2C0->speciesNum, 0); SetFriendRescueCounterState(0x35); break; @@ -1716,7 +1711,7 @@ void sub_8029944(void) case 3: sub_802453C(); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2C0->unk3BC, 1, 1); + sub_800641C(gUnknown_203B2C0->unk3BC, TRUE, TRUE); sub_8023B7C(1); if(gUnknown_203B2C0->fallbackState == DEFAULT_FALLBACK_STATE) { @@ -1856,7 +1851,7 @@ void sub_8029AF4(void) case 3: sub_8031E10(); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2C0->unk3BC, 1, 1); + sub_800641C(gUnknown_203B2C0->unk3BC, TRUE, TRUE); SetFriendRescueCounterState(0x3C); break; case 1: diff --git a/src/wonder_mail_2.c b/src/wonder_mail_2.c index 9f9f235aa..53beed183 100644 --- a/src/wonder_mail_2.c +++ b/src/wonder_mail_2.c @@ -1,25 +1,27 @@ #include "global.h" +#include "code_800D090.h" +#include "code_80130A8.h" +#include "code_8094F88.h" +#include "code_8097670.h" #include "constants/item.h" #include "constants/wonder_mail.h" +#include "event_flag.h" +#include "game_options.h" +#include "memory.h" +#include "menu_input.h" #include "pokemon.h" #include "pokemon_mail.h" -#include "memory.h" -#include "text1.h" #include "save.h" -#include "game_options.h" +#include "save_write.h" +#include "text1.h" #include "wonder_mail.h" -#include "code_800D090.h" -#include "code_8094F88.h" -#include "menu_input.h" -#include "code_80130A8.h" -#include "event_flag.h" struct unkStruct_203B2C8 { // size: 0x140 /* 0x0 */ u8 currState; /* 0x1 */ u8 unk1; - /* 0x4 */ struct OpenedFile *faceFile; + /* 0x4 */ OpenedFile *faceFile; /* 0x8 */ u8 *faceData; /* 0xC */ u16 unkC; /* 0xE */ u16 unkE; @@ -29,14 +31,13 @@ struct unkStruct_203B2C8 /* 0x13 */ u8 unk13; /* 0x14 */ u8 teamName[4]; // Figure out size of this buffer u8 fill18[0x114 - 0x18]; - struct unkStruct_802F204 unk114; + unkStruct_802F204 unk114; u32 fill13C; }; extern struct unkStruct_203B2C8 *gUnknown_203B2C8; extern void sub_80920D8(u8 *buffer); -extern void sub_8097790(void); extern char gUnknown_202E5D8[0x50]; extern char gAvailablePokemonNames[0x50]; extern u32 sub_802F298(void); @@ -50,9 +51,9 @@ extern void sub_802B5B8(void); extern void sub_802B5FC(void); extern void sub_802B624(void); -extern void sub_802F204(struct unkStruct_802F204 *, u32); -extern void sub_803C37C(struct DungeonLocation *, u32, u8 *); -extern u32 GetDungeonTeamRankPts(struct DungeonLocation *, u32); +extern void sub_802F204(unkStruct_802F204 *, u32); +extern void sub_803C37C(DungeonLocation *, u32, u8 *); +extern u32 GetDungeonTeamRankPts(DungeonLocation *, u32); ALIGNED(4) const char gRescueTeamNamePlaceholder[] = "????"; @@ -83,10 +84,10 @@ ALIGNED(4) const char wonder_mail_2_fill[] = "pksdir0"; u32 sub_802B2D4(void) { s32 iVar1; - struct OpenedFile *faceFile; + OpenedFile *faceFile; ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); gUnknown_203B2C8 = MemoryAlloc(sizeof(struct unkStruct_203B2C8),8); MemoryFill8((u8 *)gUnknown_203B2C8,0,sizeof(struct unkStruct_203B2C8)); gUnknown_203B2C8->unk1 = -1; @@ -148,7 +149,7 @@ void nullsub_132(void) void sub_802B3E0(void) { - struct unkStruct_203B480 *mail; + unkStruct_203B480 *mail; char *monName; char teamNameBuffer[40]; @@ -230,7 +231,7 @@ void sub_802B57C(void) void sub_802B5B8(void) { u32 uVar2; - struct unkStruct_203B480 *mail; + unkStruct_203B480 *mail; s32 temp; if (sub_80144A4(&temp) == 0) { diff --git a/src/wonder_mail_2_1.c b/src/wonder_mail_2_1.c index c8344c7b2..213727f6a 100644 --- a/src/wonder_mail_2_1.c +++ b/src/wonder_mail_2_1.c @@ -10,13 +10,14 @@ #include "menu_input.h" #include "wonder_mail_2_1.h" #include "code_80118A4.h" +#include "code_80958E8_1.h" extern struct unkStruct_203B2F0 *gUnknown_203B2F0; extern struct unkStruct_203B2E8* gUnknown_203B2E8; extern struct unkStruct_203B2E8* gUnknown_203B2E0; u16 gUnknown_203B2EC; -const struct UnkTextStruct2 gUnknown_80DFCE4 = +const UnkTextStruct2 gUnknown_80DFCE4 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -26,7 +27,7 @@ const struct UnkTextStruct2 gUnknown_80DFCE4 = NULL }; -const struct UnkTextStruct2 gUnknown_80DFCFC = +const UnkTextStruct2 gUnknown_80DFCFC = { 0x00, 0x00, 0x00, 0x00, 0x06, @@ -39,7 +40,7 @@ const struct UnkTextStruct2 gUnknown_80DFCFC = const u8 gUnknown_80DFD14[] = "Job List"; static const u8 wonder_mail_fill[] = "pksdir0"; -const struct UnkTextStruct2 gUnknown_80DFD28 = +const UnkTextStruct2 gUnknown_80DFD28 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -49,7 +50,7 @@ const struct UnkTextStruct2 gUnknown_80DFD28 = NULL }; -const struct UnkTextStruct2 gUnknown_80DFD40 = +const UnkTextStruct2 gUnknown_80DFD40 = { 0x00, 0x00, 0x00, 0x00, 0x04, @@ -59,7 +60,7 @@ const struct UnkTextStruct2 gUnknown_80DFD40 = NULL }; -const struct UnkTextStruct2 gUnknown_80DFD58 = +const UnkTextStruct2 gUnknown_80DFD58 = { 0x00, 0x00, 0x00, 0x00, 0x04, @@ -73,7 +74,7 @@ const u8 gUnknown_80DFD70[] = "Take Job"; const u8 gUnknown_80DFD7C[] = "Suspend"; static const u8 wonder_mail_fill0[] = "pksdir0"; -const struct UnkTextStruct2 gUnknown_80DFD8C = +const UnkTextStruct2 gUnknown_80DFD8C = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -83,7 +84,7 @@ const struct UnkTextStruct2 gUnknown_80DFD8C = NULL }; -const struct UnkTextStruct2 gUnknown_80DFDA4 = +const UnkTextStruct2 gUnknown_80DFDA4 = { 0x00, 0x00, 0x00, 0x00, 0x06, @@ -98,9 +99,8 @@ static const u8 wonder_mail_fill1[] = "pksdir0"; extern void sub_802CAA4(void); extern u8 IsJobSlotEmpty(u8); -extern struct WonderMail* GetJobSlotInfo(u8); -extern void sub_803B35C(struct WonderMail *, struct unkStruct_802C39C *); -extern void CreateRescueTitle(struct unkStruct_802C39C *); +extern void sub_803B35C(WonderMail *, unkStruct_802C39C *); +extern void CreateRescueTitle(unkStruct_802C39C *); extern void sub_802C6DC(void); extern void DrawJobListMenu(void); @@ -112,7 +112,7 @@ extern void sub_802CD38(void); extern void sub_802CDB8(void); extern void sub_802C928(void); extern void sub_802C9D8(void); -extern void sub_802DE84(struct unkStruct_802C39C *); +extern void sub_802DE84(unkStruct_802C39C *); extern void sub_802CBAC(void); s32 CountAcceptedJobs(void); @@ -144,7 +144,7 @@ bool8 HasNoPelipperBoardJobs(void) return TRUE; } -bool8 sub_802C4C8(int param_1,struct UnkTextStruct2_sub *param_2,u32 param_3) +bool8 sub_802C4C8(int param_1,UnkTextStruct2_sub *param_2,u32 param_3) { if (HasNoAcceptedJobs()) { return FALSE; @@ -165,7 +165,7 @@ bool8 sub_802C4C8(int param_1,struct UnkTextStruct2_sub *param_2,u32 param_3) sub_8012D34(gUnknown_203B2E8->unk40,param_3); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2E8->unk44,1,1); + sub_800641C(gUnknown_203B2E8->unk44, TRUE, TRUE); sub_8013848(&gUnknown_203B2E8->input,CountAcceptedJobs(),param_3,param_1); gUnknown_203B2E8->input.menuIndex = gUnknown_203B2EC; sub_8013984(&gUnknown_203B2E8->input); @@ -213,7 +213,7 @@ u8 GetPelipperBoardSlotIndex(void) void sub_802C640(u8 r0) { ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2E8->unk44, 0, 0); + sub_800641C(gUnknown_203B2E8->unk44, FALSE, FALSE); gUnknown_203B2E8->input.unk22 = CountAcceptedJobs(); sub_8013984(&gUnknown_203B2E8->input); sub_802C6DC(); @@ -229,7 +229,7 @@ void sub_802C688(void) gUnknown_203B2EC = gUnknown_203B2E8->input.menuIndex; gUnknown_203B2E8->unk44[gUnknown_203B2E8->unk3C] = gUnknown_80DFCE4; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2E8->unk44, 1, 1); + sub_800641C(gUnknown_203B2E8->unk44, TRUE, TRUE); MemoryFree(gUnknown_203B2E8); gUnknown_203B2E8 = NULL; } @@ -297,11 +297,11 @@ void sub_802C6DC(void) void DrawJobListMenu(void) { - struct WonderMail *mail; + WonderMail *mail; int index; s32 r4; s32 r5; - struct unkStruct_802C39C local; + unkStruct_802C39C local; sub_8008C54(gUnknown_203B2E8->unk3C); sub_80073B8(gUnknown_203B2E8->unk3C); @@ -428,7 +428,7 @@ void sub_802C928(void) break; } ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2F0->unk19C, 1, 1); + sub_800641C(gUnknown_203B2F0->unk19C, TRUE, TRUE); } void sub_802C9D8(void) diff --git a/src/wonder_mail_2_mid.c b/src/wonder_mail_2_mid.c index 0d72dffec..b1e382dc0 100644 --- a/src/wonder_mail_2_mid.c +++ b/src/wonder_mail_2_mid.c @@ -11,6 +11,8 @@ #include "code_802C39C.h" #include "menu_input.h" #include "code_80118A4.h" +#include "code_803B050.h" +#include "pokemon_mid.h" bool8 IsMailSlotEmpty(u8); extern s32 CountPelipperBoardSlots(void); @@ -18,20 +20,20 @@ extern void sub_802C328(void); extern void DrawPelipperBoardJobMenu(void); extern u8 HasNoPelipperBoardJobs(void); -extern struct WonderMail *GetPelipperBoardSlotInfo(u32); -extern void sub_803B35C(struct WonderMail *, u32 *); +extern WonderMail *GetPelipperBoardSlotInfo(u32); +extern void sub_803B35C(WonderMail *, u32 *); extern u8 gBulletinBoardText[]; -extern bool8 IsMailinJobSlot(struct WonderMail *); -extern void CreateRescueTitle(struct unkStruct_802C39C *); +extern bool8 IsMailinJobSlot(WonderMail *); +extern void CreateRescueTitle(unkStruct_802C39C *); struct unkStruct_203B2D8 { // size: 0xA4 u8 unk0[4]; - struct MenuInputStruct input; + MenuInputStruct input; u32 unk38; - struct UnkTextStruct2 *unk3C; - struct UnkTextStruct2 unk40[4]; + UnkTextStruct2 *unk3C; + UnkTextStruct2 unk40[4]; u8 unkA0[4]; }; @@ -41,32 +43,29 @@ struct unkStruct_203B2E0 { // size: 0xA8 u8 unk0[0x8]; - struct MenuInputStruct input; + MenuInputStruct input; s32 unk3C; - struct UnkTextStruct2 *unk40; - struct UnkTextStruct2 unk44[4]; + UnkTextStruct2 *unk40; + UnkTextStruct2 unk44[4]; u8 unkA4[4]; }; extern struct unkStruct_203B2E0 *gUnknown_203B2E0; -extern struct UnkTextStruct2 gUnknown_80DFCB4; -extern struct UnkTextStruct2 gUnknown_80DFC9C; +extern UnkTextStruct2 gUnknown_80DFCB4; +extern UnkTextStruct2 gUnknown_80DFC9C; extern u16 gUnknown_203B2E4; -extern struct WonderMail *GetMailboxSlotInfo(u8); -extern struct PokemonStruct *GetPlayerPokemonStruct(void); +extern WonderMail *GetMailboxSlotInfo(u8); extern u8 gMailboxText[]; extern u8 gAvailablePokemonNames[]; -extern void PrintPokeNameToBuffer(u8 *buffer, struct PokemonStruct *pokemon); -extern void sub_803B6B0(u32, u32, u32, u32); void CreateMailMenu(void) { - struct WonderMail *mail; + WonderMail *mail; s32 y; s32 index; - struct unkStruct_802C39C local; + unkStruct_802C39C local; u8 buffer [128]; sub_8008C54(gUnknown_203B2D8->unk38); @@ -123,7 +122,7 @@ bool8 HasNoMailinMailbox(void) } -bool8 sub_802C10C(s32 param_1,struct UnkTextStruct2_sub *param_2,s32 param_3) +bool8 sub_802C10C(s32 param_1,UnkTextStruct2_sub *param_2,s32 param_3) { if (HasNoPelipperBoardJobs() != 0) { return FALSE; @@ -145,7 +144,7 @@ bool8 sub_802C10C(s32 param_1,struct UnkTextStruct2_sub *param_2,s32 param_3) sub_8012D34(gUnknown_203B2E0->unk40,param_3); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2E0->unk44,1,1); + sub_800641C(gUnknown_203B2E0->unk44, TRUE, TRUE); sub_8013848(&gUnknown_203B2E0->input,CountPelipperBoardSlots(),param_3,param_1); gUnknown_203B2E0->input.menuIndex = gUnknown_203B2E4; sub_8013984(&gUnknown_203B2E0->input); @@ -194,7 +193,7 @@ u8 sub_802C26C(void) void sub_802C28C(u8 r0) { ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2E0->unk44, 0, 0); + sub_800641C(gUnknown_203B2E0->unk44, FALSE, FALSE); gUnknown_203B2E0->input.unk22 = CountPelipperBoardSlots(); sub_8013984(&gUnknown_203B2E0->input); sub_802C328(); @@ -210,7 +209,7 @@ void sub_802C2D4(void) gUnknown_203B2E4 = gUnknown_203B2E0->input.menuIndex; gUnknown_203B2E0->unk44[gUnknown_203B2E0->unk3C] = gUnknown_80DFC9C; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2E0->unk44, 1, 1); + sub_800641C(gUnknown_203B2E0->unk44, TRUE, TRUE); MemoryFree(gUnknown_203B2E0); gUnknown_203B2E0 = NULL; } @@ -279,11 +278,11 @@ void sub_802C328(void) void DrawPelipperBoardJobMenu(void) { u32 slotIndex; - struct WonderMail *mail; + WonderMail *mail; s32 iVar4; s32 x; s32 index; - struct unkStruct_802C39C local; + unkStruct_802C39C local; sub_8008C54(gUnknown_203B2E0->unk3C); sub_80073B8(gUnknown_203B2E0->unk3C); diff --git a/src/wonder_mail_3.c b/src/wonder_mail_3.c index d4098bbcf..6ef809405 100644 --- a/src/wonder_mail_3.c +++ b/src/wonder_mail_3.c @@ -13,8 +13,10 @@ #include "wonder_mail_2_1.h" #include "code_80130A8.h" #include "code_80118A4.h" +#include "code_80A26CC.h" +#include "code_80958E8_1.h" -const struct UnkTextStruct2 gUnknown_80DFDD4 = +const UnkTextStruct2 gUnknown_80DFDD4 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -25,7 +27,7 @@ const struct UnkTextStruct2 gUnknown_80DFDD4 = }; // Unused -const struct UnkTextStruct2 gUnknown_80DFDEC = +const UnkTextStruct2 gUnknown_80DFDEC = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -35,7 +37,7 @@ const struct UnkTextStruct2 gUnknown_80DFDEC = NULL }; -const struct UnkTextStruct2 gUnknown_80DFE04 = +const UnkTextStruct2 gUnknown_80DFE04 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -44,7 +46,7 @@ const struct UnkTextStruct2 gUnknown_80DFE04 = 0x03, 0x00, NULL }; -const struct UnkTextStruct2 gUnknown_80DFE1C = +const UnkTextStruct2 gUnknown_80DFE1C = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -55,7 +57,7 @@ const struct UnkTextStruct2 gUnknown_80DFE1C = }; // Unused -const struct UnkTextStruct2 gUnknown_80DFE34 = +const UnkTextStruct2 gUnknown_80DFE34 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -127,16 +129,15 @@ extern void sub_802D1B8(); extern void sub_802D2A8(); -extern bool8 IsMailinJobSlot(struct WonderMail *); -extern u8 sub_8096F50(struct WonderMail *); +extern bool8 IsMailinJobSlot(WonderMail *); +extern u8 sub_8096F50(WonderMail *); extern u8 sub_802DAA8(void); extern u8 sub_802DADC(void); extern u8 *sub_8096DD8(void); extern u8 sub_8096C08(u8 *); extern void DrawJobListMenu(void); -extern struct WonderMail* GetJobSlotInfo(u8); -extern void sub_803B35C(struct WonderMail *, struct unkStruct_802C39C*); -extern void sub_802DE84(struct unkStruct_802C39C *); +extern void sub_803B35C(WonderMail *, unkStruct_802C39C*); +extern void sub_802DE84(unkStruct_802C39C *); extern void sub_802D73C(void); extern void sub_802C640(u32); extern void sub_802C4C8(u32, u32, u32); @@ -145,9 +146,9 @@ extern void sub_802D690(void); extern void sub_8096C80(void); extern void sub_8096D24(void); extern u8 *sub_8096DE8(void); -extern void AcceptJob(struct unkSubStruct_203B2F8 *); -struct unkStruct_803B344 *sub_803B344(u8); -extern void CreateRescueTitle(struct unkStruct_802C39C *); +extern void AcceptJob(unkSubStruct_203B2F8 *); +unkStruct_803B344 *sub_803B344(u8); +extern void CreateRescueTitle(unkStruct_802C39C *); extern u8 gUnknown_80DFDBC[]; extern void sub_802CF5C(void); extern void sub_802CFD0(void); @@ -161,8 +162,8 @@ u32 sub_802C598(u8 param_1); extern void sub_802C688(void); extern u8 GetPelipperBoardSlotIndex(void); -extern struct UnkTextStruct2 gUnknown_80DFD8C; -extern struct UnkTextStruct2 gUnknown_80DFDA4; +extern UnkTextStruct2 gUnknown_80DFD8C; +extern UnkTextStruct2 gUnknown_80DFDA4; extern struct unkStruct_203B2F0 *gUnknown_203B2F0; @@ -173,12 +174,11 @@ extern u8 *gUnknown_80D4970[]; extern u8 gUnknown_80DFD70[]; extern u8 gUnknown_80DFD7C[]; -extern bool8 sub_809693C(struct WonderMail *); -extern bool8 sub_80A2824(u8); +extern bool8 sub_809693C(WonderMail *); void sub_802CAA4(void) { s32 loopMax; - struct WonderMail *mail; + WonderMail *mail; s32 index; loopMax = 0; @@ -266,8 +266,8 @@ void sub_802CC00(void) void sub_802CC70(void) { s32 menuAction; - struct WonderMail *mail; - struct WonderMail *mail2; + WonderMail *mail; + WonderMail *mail2; menuAction = 0; sub_802C598(0); @@ -350,7 +350,7 @@ bool8 sub_802CDD4(u32 r0) { if(gUnknown_203B2F4 == NULL) { - gUnknown_203B2F4 = MemoryAlloc(sizeof(struct unkStruct_203B2F4), 8); + gUnknown_203B2F4 = MemoryAlloc(sizeof(unkStruct_203B2F4), 8); } gUnknown_203B2F4->unk34 = r0; gUnknown_203B2F4->unk38 = &gUnknown_203B2F4->unk3C[gUnknown_203B2F4->unk34]; @@ -359,7 +359,7 @@ bool8 sub_802CDD4(u32 r0) gUnknown_203B2F4->unk38->unk14 = gUnknown_203B2F4->unk9C; sub_8012D34(gUnknown_203B2F4->unk38, 4); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2F4->unk3C, 1, 1); + sub_800641C(gUnknown_203B2F4->unk3C, TRUE, TRUE); sub_8013848(&gUnknown_203B2F4->input, 5, 4, r0); sub_802CF5C(); sub_802CFD0(); @@ -405,7 +405,7 @@ u8 sub_802CEBC(void) void sub_802CED8(u8 r0) { ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2F4->unk3C, 0, 0); + sub_800641C(gUnknown_203B2F4->unk3C, FALSE, FALSE); sub_8013984(&gUnknown_203B2F4->input); sub_802CF5C(); sub_802CFD0(); @@ -419,7 +419,7 @@ void sub_802CF14(void) { gUnknown_203B2F4->unk3C[gUnknown_203B2F4->unk34] = gUnknown_80DFD8C; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2F4->unk3C, 1, 1); + sub_800641C(gUnknown_203B2F4->unk3C, TRUE, TRUE); MemoryFree(gUnknown_203B2F4); gUnknown_203B2F4 = NULL; } @@ -488,8 +488,8 @@ void sub_802CF5C(void) void sub_802CFD0(void) { - struct unkStruct_802C39C local; - struct unkStruct_803B344 *iVar1; + unkStruct_802C39C local; + unkStruct_803B344 *iVar1; s32 r5; s32 r4; @@ -514,13 +514,13 @@ void sub_802CFD0(void) sub_80073E0(gUnknown_203B2F4->unk34); } -u32 sub_802D098(struct unkSubStruct_203B2F8 *mail) +u32 sub_802D098(unkSubStruct_203B2F8 *mail) { - gUnknown_203B2F8 = MemoryAlloc(0x208,8); + gUnknown_203B2F8 = MemoryAlloc(sizeof(unkStruct_203B2F8),8); gUnknown_203B2F8->menuAction1 = 0; gUnknown_203B2F8->menuAction2 = 0; gUnknown_203B2F8->menuAction3 = 0; - gUnknown_203B2F8->mail = mail; + gUnknown_203B2F8->mail = mail; gUnknown_203B2F8->wonderMailAccepted = FALSE; gUnknown_203B2F8->unk9 = sub_8099328(&gUnknown_203B2F8->dungeonID); if (sub_8011C1C() != 2) { @@ -613,7 +613,7 @@ void sub_802D1B8(void) break; } ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2F8->unk1A8, 1, 1); + sub_800641C(gUnknown_203B2F8->unk1A8, TRUE, TRUE); } void sub_802D2A8(void) @@ -915,7 +915,7 @@ void sub_802D8CC(void) void sub_802D940(void) { - struct WonderMail *mail; + WonderMail *mail; s32 menuAction; menuAction = 0; @@ -1001,7 +1001,7 @@ void AdvancetoFallbackWonderMailRescueState(void) bool8 sub_802DAA8(void) { - struct WonderMail *mail; + WonderMail *mail; mail = GetJobSlotInfo(gUnknown_203B2F8->jobSlotIndex); if (!gUnknown_203B2F8->unk9) { @@ -1016,7 +1016,7 @@ bool8 sub_802DAA8(void) bool8 sub_802DADC(void) { u8 mailType; - struct WonderMail *mail; + WonderMail *mail; s32 counter; if (!gUnknown_203B2F8->unk9) { diff --git a/src/wonder_mail_3_1.c b/src/wonder_mail_3_1.c index c11df891c..3f84bed0f 100644 --- a/src/wonder_mail_3_1.c +++ b/src/wonder_mail_3_1.c @@ -1,15 +1,14 @@ #include "global.h" +#include "code_80A26CC.h" -u8 sub_80A27CC(s16); - -u8 sub_802FCF0(void) +bool8 sub_802FCF0(void) { - s32 iVar3; - - for(iVar3 = 0; iVar3 < 0x2E; iVar3++){ - if (sub_80A27CC(iVar3) != '\0') { - return 0; + s32 i; + + for (i = 0; i < 0x2E; i++) { + if (sub_80A27CC(i)) + return FALSE; } - } - return 1; -} + + return TRUE; +} \ No newline at end of file diff --git a/src/wonder_mail_3_mid.c b/src/wonder_mail_3_mid.c index 27f6eaf0a..29fd22bc7 100644 --- a/src/wonder_mail_3_mid.c +++ b/src/wonder_mail_3_mid.c @@ -5,35 +5,28 @@ #include "text2.h" #include "wonder_mail.h" #include "pokemon.h" +#include "pokemon_mid.h" #include "rescue_team_info.h" #include "friend_area.h" -#include "item.h" +#include "items.h" #include "menu_input.h" #include "code_802C39C.h" #include "code_80130A8.h" #include "code_80118A4.h" +#include "wonder_mail_3.h" +#include "code_801B60C.h" -struct unkStruct_803B344 -{ - // size: 0xB4 - struct WonderMail mail; - u8* unk14; - u8* unk18; - u8 fill1C[0x3C - 0x1C]; - u8 unk3C[0x78]; -}; - -extern struct unkStruct_803B344 *sub_803B344(u8); +extern unkStruct_803B344 *sub_803B344(u8); struct unkStruct_203B30C { // size: 0x150 s32 state; u8 unk4; - struct unkStruct_802C39C unk8; - struct MenuStruct unk60; - struct MenuItem unkB0[8]; - struct UnkTextStruct2 unkF0[4]; + unkStruct_802C39C unk8; + MenuStruct unk60; + MenuItem unkB0[8]; + UnkTextStruct2 unkF0[4]; }; extern struct unkStruct_203B30C *gUnknown_203B30C; @@ -45,15 +38,15 @@ struct unkStruct_203B310 /* 0x8 */ bool8 displayClientDialogueSprite; // true to display the dialogue sprite for the client /* 0x9 */ u8 currTeamRank; // team rank /* 0xC */ s32 itemRewardIndex; - struct unkStruct_802F204 *unk10; - /* 0x14 */ struct OpenedFile *faceFile; + unkStruct_802F204 *unk10; + /* 0x14 */ OpenedFile *faceFile; /* 0x18 */ u8 *faceData; s16 unk1C; s16 unk1E; u8 unk20; u8 unk21; u8 unk22; - struct UnkTextStruct2 unk24[4]; + UnkTextStruct2 unk24[4]; }; extern struct unkStruct_203B310 *gUnknown_203B310; @@ -70,10 +63,10 @@ struct unkStruct_203B314 u8 unkB9; u8 unkBA; u8 unkBB; - struct MenuInputStruct input; + MenuInputStruct input; u32 unkF0; - struct UnkTextStruct2 *unkF4; - struct UnkTextStruct2 unkF8[4]; + UnkTextStruct2 *unkF4; + UnkTextStruct2 unkF8[4]; u8 unk158[4]; }; @@ -93,7 +86,7 @@ enum FriendRewardStates { REWARD_EXIT = 9, }; -extern u8 sub_802FCF0(u32); +extern bool8 sub_802FCF0(u32); extern void sub_802F9C0(void); extern void sub_802FA50(void); extern s32 sub_802FBF4(void); @@ -105,11 +98,9 @@ extern void sub_802F184(void); extern void sub_802F1E8(void); extern void sub_802F004(); extern void sub_802F088(); -extern void sub_801B72C(void); -extern u32 sub_801B6AC(void); extern void sub_802F108(void); -extern void sub_803B35C(struct WonderMail*, struct unkStruct_802C39C *); -extern void sub_802DE84(struct unkStruct_802C39C *); +extern void sub_803B35C(WonderMail*, unkStruct_802C39C *); +extern void sub_802DE84(unkStruct_802C39C *); extern void sub_802CDD4(u32); extern void sub_802CED8(u32); extern void sub_802CFD0(void); @@ -118,17 +109,22 @@ extern u32 sub_802CE5C(u32); extern void sub_802CF14(void); extern u32 sub_802DEE0(void); extern void sub_802DF24(void); -extern void PrintPokeNameToBuffer(u8 *buffer, struct PokemonStruct *pokemon); -extern struct PokemonStruct *GetPlayerPokemonStruct(void); extern void sub_802F6FC(void); extern void ProceedToNextRewardSceneState(void); extern void sub_802F300(void); -extern s32 sub_808D544(u32); -extern u32 sub_801B60C(u32, u8, u8); void HandleMissionReward(void); const u8 *sub_80974A0(s16 index); -const struct UnkTextStruct2 gUnknown_80E03C4 = { +extern u8 gUnknown_202E038[]; +extern u8 gUnknown_202E088[]; +extern u8 gUnknown_202E628[]; +extern u8 gUnknown_202DEA8[]; +extern u8 gUnknown_202E5D8[]; +extern u8 gAvailablePokemonNames[]; +extern u32 gUnknown_202DE30; +extern const u8 *gUnknown_80D4970[]; + +const UnkTextStruct2 gUnknown_80E03C4 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, @@ -136,7 +132,7 @@ const struct UnkTextStruct2 gUnknown_80E03C4 = { 0x00, 0x00, NULL }; -const struct UnkTextStruct2 gUnknown_80E03DC = { +const UnkTextStruct2 gUnknown_80E03DC = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x03, 0x03, @@ -144,7 +140,7 @@ const struct UnkTextStruct2 gUnknown_80E03DC = { 0x03, 0x00, NULL }; -const struct UnkTextStruct2 gUnknown_80E03F4 = { +const UnkTextStruct2 gUnknown_80E03F4 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x15, 0x06, @@ -155,7 +151,7 @@ const struct UnkTextStruct2 gUnknown_80E03F4 = { const u8 gUnknown_80E040C[] = "Send"; static const u8 wonder_mail_fill[] = "pksdir0"; -const struct UnkTextStruct2 gUnknown_80E041C = { +const UnkTextStruct2 gUnknown_80E041C = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, @@ -216,7 +212,7 @@ ALIGNED(4) const u8 gUnknown_80E06A8[] = _( static const u8 wonder_mail_fill2[] = "pksdir0"; -const struct UnkTextStruct2 gUnknown_80E06FC = { +const UnkTextStruct2 gUnknown_80E06FC = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, @@ -225,7 +221,7 @@ const struct UnkTextStruct2 gUnknown_80E06FC = { NULL }; -const struct UnkTextStruct2 gUnknown_80E0714 = { +const UnkTextStruct2 gUnknown_80E0714 = { 0x00, 0x00, 0x00, 0x00, 0x06, 0x02, 0x02, @@ -233,7 +229,7 @@ const struct UnkTextStruct2 gUnknown_80E0714 = { 0x0E, 0x00, NULL }; -const struct UnkTextStruct2 gUnknown_80E072C = { +const UnkTextStruct2 gUnknown_80E072C = { 0x00, 0x00, 0x00, 0x00, 0x06, 0x02, 0x02, @@ -242,17 +238,10 @@ const struct UnkTextStruct2 gUnknown_80E072C = { NULL }; -extern u8 gUnknown_202E038[]; -extern u8 gUnknown_202E088[]; -extern u8 gUnknown_202E628[]; -extern u8 gUnknown_202DEA8[]; -extern u8 gUnknown_202E5D8[]; -extern u8 gAvailablePokemonNames[]; -extern u32 gUnknown_202DE30; -extern const u8 *gUnknown_80D4970[]; -extern u8 gUnknown_80E0744[]; -extern u8 gUnknown_80E0754[]; -extern u8 gUnknown_80E0750[]; +ALIGNED(4) const u8 gUnknown_80E0744[] = "Dungeons"; +ALIGNED(4) const u8 gUnknown_80E0750[] = {0x83, 0xC2}; +ALIGNED(4) const u8 gUnknown_80E0754[] = {0x83, 0xC0}; +ALIGNED(4) static const u8 sFill1[] = "pksdir0"; u32 sub_802EF48(void) { @@ -324,12 +313,12 @@ void sub_802F004(void) } } ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B30C->unkF0, 1, 1); + sub_800641C(gUnknown_203B30C->unkF0, TRUE, TRUE); } void sub_802F088(void) { - struct unkStruct_803B344 *temp; + unkStruct_803B344 *temp; switch(gUnknown_203B30C->state) { @@ -428,12 +417,12 @@ void sub_802F1E8(void) -u32 sub_802F204(struct unkStruct_802F204 *r0, bool8 displayClientSprite) +u32 sub_802F204(unkStruct_802F204 *r0, bool8 displayClientSprite) { struct unkStruct_203B310 *preload; ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); gUnknown_203B310 = MemoryAlloc(sizeof(struct unkStruct_203B310), 8); gUnknown_203B310->unk10 = r0; gUnknown_203B310->itemRewardIndex = 0; @@ -507,7 +496,7 @@ void sub_802F300(void) gUnknown_203B310->unk24[index] = gUnknown_80E041C; } ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B310->unk24, 1, 1); + sub_800641C(gUnknown_203B310->unk24, TRUE, TRUE); default: break; } @@ -519,7 +508,7 @@ void HandleMissionReward(void) const u8 *rankString; u8 itemID; struct unkStruct_8090F58 local_20; - struct Item item; + Item item; switch(gUnknown_203B310->state) { case PREP_MONEY_REWARD: @@ -696,7 +685,7 @@ void ProceedToNextRewardSceneState(void) } } -u32 sub_802F73C(u32 r0, struct UnkTextStruct2_sub *r1, u32 r2, u8 r3) +u32 sub_802F73C(u32 r0, UnkTextStruct2_sub *r1, u32 r2, u8 r3) { if (sub_802FCF0(r0)) return 0; @@ -721,7 +710,7 @@ u32 sub_802F73C(u32 r0, struct UnkTextStruct2_sub *r1, u32 r2, u8 r3) sub_8012D08(gUnknown_203B314->unkF4, r2); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B314->unkF8, 1, 1); + sub_800641C(gUnknown_203B314->unkF8, TRUE, TRUE); sub_8013818(&gUnknown_203B314->input, sub_802FBF4(), r2, r0); sub_802F9C0(); sub_802FA50(); @@ -801,13 +790,13 @@ void sub_802F974(void) { gUnknown_203B314->unkF8[gUnknown_203B314->unkF0] = gUnknown_80E06FC; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B314->unkF8, 1, 1); + sub_800641C(gUnknown_203B314->unkF8, TRUE, TRUE); MemoryFree(gUnknown_203B314); gUnknown_203B314 = NULL; } } -NAKED +NAKED // sub_80095E4 memes void sub_802F9C0(void) { asm_unified( diff --git a/src/wonder_mail_4.c b/src/wonder_mail_4.c index 85a8dda30..c7fa9db21 100644 --- a/src/wonder_mail_4.c +++ b/src/wonder_mail_4.c @@ -4,7 +4,7 @@ #include "text2.h" #include "input.h" #include "memory.h" -#include "item.h" +#include "items.h" #include "pokemon.h" #include "code_8094F88.h" #include "constants/wonder_mail.h" @@ -17,17 +17,17 @@ struct unkStruct_203B320 // size: 0xC4 u8 unk0[0x20]; u32 wonderMailType; - struct MenuInputStruct input; + MenuInputStruct input; u32 unk58; - struct UnkTextStruct2 *unk5C; - struct UnkTextStruct2 unk60[4]; + UnkTextStruct2 *unk5C; + UnkTextStruct2 unk60[4]; u8 unkC0[4]; }; extern struct unkStruct_203B320 *gUnknown_203B320; -extern struct unkStruct_203B480 *gUnknown_203B480; +extern unkStruct_203B480 *gUnknown_203B480; -const struct UnkTextStruct2 gUnknown_80E083C = { +const UnkTextStruct2 gUnknown_80E083C = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, @@ -36,7 +36,7 @@ const struct UnkTextStruct2 gUnknown_80E083C = { NULL }; -const struct UnkTextStruct2 gUnknown_80E0854 = { +const UnkTextStruct2 gUnknown_80E0854 = { 0x00, 0x00, 0x00, 0x00, 0x06, 0x02, 0x02, @@ -81,9 +81,9 @@ extern s32 sub_8030A74(void); extern void sub_80308A0(void); extern void sub_803092C(void); -extern void CreateRescueTitle(struct unkStruct_802C39C *); +extern void CreateRescueTitle(unkStruct_802C39C *); -u32 sub_80306A8(u32 wonderMailType, u32 r1, struct UnkTextStruct2_sub *r2, u32 r3) +u32 sub_80306A8(u32 wonderMailType, u32 r1, UnkTextStruct2_sub *r2, u32 r3) { if (HasNoWonderMailType(wonderMailType)) return 0; @@ -103,7 +103,7 @@ u32 sub_80306A8(u32 wonderMailType, u32 r1, struct UnkTextStruct2_sub *r2, u32 r sub_8012D08(gUnknown_203B320->unk5C, r3); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B320->unk60, 1, 1); + sub_800641C(gUnknown_203B320->unk60, TRUE, TRUE); sub_8013818(&gUnknown_203B320->input, sub_8030A74(), r3, r1); sub_80308A0(); sub_803092C(); @@ -162,7 +162,7 @@ void sub_803084C() { gUnknown_203B320->unk60[gUnknown_203B320->unk58] = gUnknown_80E083C; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B320->unk60, 1, 1); + sub_800641C(gUnknown_203B320->unk60, TRUE, TRUE); MemoryFree(gUnknown_203B320); gUnknown_203B320 = NULL; } @@ -173,7 +173,7 @@ u8 *sub_8030894() return gUnknown_203B320->unk0; } -NAKED +NAKED // sub_80095E4 memes void sub_80308A0(void) { asm_unified( @@ -245,11 +245,11 @@ void sub_80308A0(void) void sub_803092C(void) { - struct unkStruct_203B480 *mail; + unkStruct_203B480 *mail; s32 r4; s32 r5; s32 index; - struct unkStruct_802C39C local; + unkStruct_802C39C local; sub_8008C54(gUnknown_203B320->unk58); sub_80073B8(gUnknown_203B320->unk58); @@ -306,7 +306,7 @@ s32 sub_8030A74(void) case WONDER_MAIL_TYPE_NONE: for (index = 0; index < 0x20; index++) { - struct unkStruct_203B480 *p = gUnknown_203B480 + index; + unkStruct_203B480 *p = gUnknown_203B480 + index; if (p->mailType != WONDER_MAIL_TYPE_NONE) { gUnknown_203B320->unk0[count] = index; count++; @@ -316,7 +316,7 @@ s32 sub_8030A74(void) case WONDER_MAIL_TYPE_COMPLETED: for (index = 0; index < 0x20; index++) { - struct unkStruct_203B480 *p = gUnknown_203B480 + index; + unkStruct_203B480 *p = gUnknown_203B480 + index; if (p->mailType == WONDER_MAIL_TYPE_COMPLETED) { gUnknown_203B320->unk0[count] = index; count++; @@ -326,7 +326,7 @@ s32 sub_8030A74(void) case 1: for (index = 0; index < 0x20; index++) { - struct unkStruct_203B480 *p = gUnknown_203B480 + index; + unkStruct_203B480 *p = gUnknown_203B480 + index; if (p->mailType == 1) { gUnknown_203B320->unk0[count] = index; count++; @@ -336,7 +336,7 @@ s32 sub_8030A74(void) case 2: for (index = 0; index < 0x20; index++) { - struct unkStruct_203B480 *p = gUnknown_203B480 + index; + unkStruct_203B480 *p = gUnknown_203B480 + index; if (p->mailType == 2) { gUnknown_203B320->unk0[count] = index; count++; @@ -346,7 +346,7 @@ s32 sub_8030A74(void) case WONDER_MAIL_TYPE_AOK: for (index = 0; index < 0x20; index++) { - struct unkStruct_203B480 *p = gUnknown_203B480 + index; + unkStruct_203B480 *p = gUnknown_203B480 + index; if (p->mailType == WONDER_MAIL_TYPE_AOK) { gUnknown_203B320->unk0[count] = index; count++; @@ -356,7 +356,7 @@ s32 sub_8030A74(void) case 3: for (index = 0; index < 0x20; index++) { - struct unkStruct_203B480 *p = gUnknown_203B480 + index; + unkStruct_203B480 *p = gUnknown_203B480 + index; if (p->mailType == 3) { gUnknown_203B320->unk0[count] = index; count++; @@ -366,7 +366,7 @@ s32 sub_8030A74(void) case WONDER_MAIL_TYPE_THANK_YOU: for (index = 0; index < 0x20; index++) { - struct unkStruct_203B480 *p = gUnknown_203B480 + index; + unkStruct_203B480 *p = gUnknown_203B480 + index; if (p->mailType == WONDER_MAIL_TYPE_THANK_YOU) { gUnknown_203B320->unk0[count] = index; count++; @@ -377,7 +377,7 @@ s32 sub_8030A74(void) case WONDER_MAIL_TYPE_OKD: for (index = 0; index < 0x20; index++) { - struct unkStruct_203B480 *p = gUnknown_203B480 + index; + unkStruct_203B480 *p = gUnknown_203B480 + index; if (p->mailType == WONDER_MAIL_TYPE_OKD) { gUnknown_203B320->unk0[count] = index; count++; diff --git a/src/wonder_mail_5.c b/src/wonder_mail_5.c index 79dd8696b..f32e097b6 100644 --- a/src/wonder_mail_5.c +++ b/src/wonder_mail_5.c @@ -15,17 +15,17 @@ struct unkStruct_203B324 { // size: 0x78 - struct MenuInputStructSub unk0; + MenuInputStructSub unk0; u8 mailIndex; u32 unk10; - struct UnkTextStruct2 *unk14; - struct UnkTextStruct2 unk18[4]; + UnkTextStruct2 *unk14; + UnkTextStruct2 unk18[4]; }; extern struct unkStruct_203B324 *gUnknown_203B324; -extern struct unkStruct_203B480 *gUnknown_203B480; +extern unkStruct_203B480 *gUnknown_203B480; -const struct UnkTextStruct2 gUnknown_80E0900 = { +const UnkTextStruct2 gUnknown_80E0900 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, @@ -36,7 +36,7 @@ const struct UnkTextStruct2 gUnknown_80E0900 = { const u8 gUnknown_80E0918[] = {0x01, 0x00, 0x12, 0x00}; -const struct UnkTextStruct2 gUnknown_80E091C = { +const UnkTextStruct2 gUnknown_80E091C = { 0x00, 0x00, 0x00, 0x00, 0x06, 0x02, 0x02, @@ -50,7 +50,7 @@ const u8 gUnknown_80E0938[] = "%-4d"; static const u8 wonder_mail_fill[] = "pksdir0"; extern void sub_8030DD4(void); -extern void CreateRescueDescription(struct unkStruct_802C39C *); +extern void CreateRescueDescription(unkStruct_802C39C *); void sub_8030E2C(void); void sub_8030E48(void); @@ -95,7 +95,7 @@ void sub_8030DE4(void) { gUnknown_203B324->unk18[gUnknown_203B324->unk10] = gUnknown_80E0900; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B324->unk18, 1, 1); + sub_800641C(gUnknown_203B324->unk18, TRUE, TRUE); MemoryFree(gUnknown_203B324); gUnknown_203B324 = NULL; } @@ -104,14 +104,14 @@ void sub_8030DE4(void) void sub_8030E2C(void) { ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B324->unk18, 1, 1); + sub_800641C(gUnknown_203B324->unk18, TRUE, TRUE); } void sub_8030E48(void) { u16 uVar2; - struct unkStruct_203B480 *mail; - struct unkStruct_802C39C stack; + unkStruct_203B480 *mail; + unkStruct_802C39C stack; u8 buffer [256]; mail = &gUnknown_203B480[gUnknown_203B324->mailIndex]; diff --git a/src/wonder_mail_6.c b/src/wonder_mail_6.c index 39647bd67..dd0e47f98 100644 --- a/src/wonder_mail_6.c +++ b/src/wonder_mail_6.c @@ -14,10 +14,10 @@ struct unkStruct_203B328 // size: 0x11C u32 state; u8 mailIndex; - struct MenuStruct unk8; - struct MenuStruct unk58; - struct UnkTextStruct2 unkA8[4]; - /* 0x108 */ struct OpenedFile *faceFile; + MenuStruct unk8; + MenuStruct unk58; + UnkTextStruct2 unkA8[4]; + /* 0x108 */ OpenedFile *faceFile; /* 0x10C */ u8 *faceData; u16 unk110; u16 unk112; @@ -27,23 +27,23 @@ struct unkStruct_203B328 u32 wonderMailType; }; extern struct unkStruct_203B328 *gUnknown_203B328; -extern struct unkStruct_203B480 *gUnknown_203B480; +extern unkStruct_203B480 *gUnknown_203B480; -const struct MenuItem gUnknown_80E0948[] = +const MenuItem gUnknown_80E0948[] = { {"Yes", 0x2}, {"No", 0x3}, {NULL, 0x1} }; -const struct MenuItem gUnknown_80E0968[] = +const MenuItem gUnknown_80E0968[] = { {"Delete", 0x4}, {"Info", 0x5}, {NULL, 0x1} }; -const struct UnkTextStruct2 gUnknown_80E0990 = { +const UnkTextStruct2 gUnknown_80E0990 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, @@ -51,7 +51,7 @@ const struct UnkTextStruct2 gUnknown_80E0990 = { 0x00, 0x00, NULL }; -const struct UnkTextStruct2 gUnknown_80E09A8 = { +const UnkTextStruct2 gUnknown_80E09A8 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x13, 0x0B, @@ -59,7 +59,7 @@ const struct UnkTextStruct2 gUnknown_80E09A8 = { 0x03, 0x00, NULL }; -const struct UnkTextStruct2 gUnknown_80E09C0 = { +const UnkTextStruct2 gUnknown_80E09C0 = { 0x00, 0x00, 0x00, 0x00, 0x03, 0x11, 0x0F, @@ -96,10 +96,10 @@ extern void sub_8030D40(u8, u32); bool8 sub_8030F58(u32 wonderMailType) { - struct OpenedFile *file; + OpenedFile *file; ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); if (gUnknown_203B328 == NULL) { gUnknown_203B328 = MemoryAlloc(sizeof(struct unkStruct_203B328),8); MemoryFill8((u8 *)gUnknown_203B328,0,sizeof(struct unkStruct_203B328)); @@ -207,11 +207,11 @@ void sub_80310FC(void) case 6: default: ResetUnusedInputStruct(); - sub_800641C(0, 1, 1); + sub_800641C(NULL, TRUE, TRUE); break; } ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B328->unkA8, 1, 1); + sub_800641C(gUnknown_203B328->unkA8, TRUE, TRUE); } void sub_8031258(void) @@ -294,7 +294,7 @@ void sub_80313D8(u32 state) { s32 index; s32 local_10; - struct unkStruct_203B480 *unused; + unkStruct_203B480 *unused; local_10 = 0; sub_8030768(0); diff --git a/src/wonder_mail_802DF88.c b/src/wonder_mail_802DF88.c index e5f3e73d5..f6905ef63 100644 --- a/src/wonder_mail_802DF88.c +++ b/src/wonder_mail_802DF88.c @@ -8,16 +8,17 @@ #include "text2.h" #include "code_80130A8.h" #include "code_80118A4.h" +#include "code_80958E8_1.h" struct unkStruct_203B2FC { // size: 0xA8 /* 0x0 */ u32 state; /* 0x4 */ u32 fallbackState; - struct unkStruct_802F204 unk8; + unkStruct_802F204 unk8; u8 jobSlotIndex; - struct WonderMail *jobInfo; - struct OpenedFile *faceFile; + WonderMail *jobInfo; + OpenedFile *faceFile; u8 *faceData; u16 unk40; u16 unk42; @@ -25,7 +26,7 @@ struct unkStruct_203B2FC u8 unk45; u8 unk46; u8 fill47[0x48 - 0x47]; - struct UnkTextStruct2 unk48[4]; + UnkTextStruct2 unk48[4]; }; extern struct unkStruct_203B2FC *gUnknown_203B2FC; @@ -33,11 +34,11 @@ extern struct unkStruct_203B2FC *gUnknown_203B2FC; struct unkStruct_203B300 { // size: 0x7C - struct MenuInputStructSub unk0; - struct unkStruct_802C39C *mail; + MenuInputStructSub unk0; + unkStruct_802C39C *mail; u32 unk10; - struct UnkTextStruct2 *unk14; - struct UnkTextStruct2 unk18[4]; + UnkTextStruct2 *unk14; + UnkTextStruct2 unk18[4]; u8 unk78[4]; }; @@ -46,7 +47,7 @@ extern u8 gUnknown_202E5D8[]; extern u8 gUnknown_202E1C8[]; extern u8 gUnknown_202DE58[]; -const struct UnkTextStruct2 gUnknown_80E016C = +const UnkTextStruct2 gUnknown_80E016C = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -76,7 +77,7 @@ ALIGNED(4) const u8 gWonderMailClientItemDelivered2[] = _( static const u8 wonder_mail_802DF88_fill[] = "pksdir0"; -const struct UnkTextStruct2 gUnknown_80E0248 = +const UnkTextStruct2 gUnknown_80E0248 = { 0x00, 0x00, 0x00, 0x00, 0x03, @@ -88,7 +89,7 @@ const struct UnkTextStruct2 gUnknown_80E0248 = const u8 UnkData_80E0260[] = {0x01, 0x00, 0x12, 0x00}; -const struct UnkTextStruct2 gUnknown_80E0264 = +const UnkTextStruct2 gUnknown_80E0264 = { 0x00, 0x00, 0x00, 0x00, 0x06, @@ -100,18 +101,17 @@ const struct UnkTextStruct2 gUnknown_80E0264 = static const u8 wonder_mail_802DF88_fill1[] = "pksdir0"; -extern void CreateRescueDescription(struct unkStruct_802C39C *); +extern void CreateRescueDescription(unkStruct_802C39C *); extern void sub_802DC28(u32); extern void sub_802F2C0(void); extern void sub_802DC28(u32); extern u32 sub_802F298(void); -extern void sub_802F204(struct unkStruct_802F204*, u32); +extern void sub_802F204(unkStruct_802F204*, u32); extern void sub_802DC40(void); extern void sub_802DC9C(void); -struct WonderMail *GetJobSlotInfo(u8); extern void sub_8096AF8(u8 *, u32, u32); extern void sub_8096EEC(void); -extern void sub_803C21C(struct WonderMail *, struct unkStruct_802F204*); +extern void sub_803C21C(WonderMail *, unkStruct_802F204*); extern u32 sub_802C598(s32); extern void sub_802C688(void); extern void sub_8096C80(void); @@ -137,7 +137,7 @@ bool8 sub_802DB28(u8 jobSlotIndex, u8 dungeon) } else { ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); gUnknown_203B2FC = MemoryAlloc(sizeof(struct unkStruct_203B2FC),8); gUnknown_203B2FC->jobSlotIndex = jobSlotIndex; gUnknown_203B2FC->jobInfo = GetJobSlotInfo(jobSlotIndex); @@ -209,7 +209,7 @@ void sub_802DC40(void) break; } ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B2FC->unk48, 1, 1); + sub_800641C(gUnknown_203B2FC->unk48, TRUE, TRUE); } void sub_802DC9C(void) @@ -226,7 +226,7 @@ void sub_802DC9C(void) speciesText = GetMonSpecies(gUnknown_203B2FC->jobInfo->targetSpecies); strcpy(gUnknown_202E1C8 + 0xfffffe20,speciesText); UnlockExclusivePokemon(gUnknown_203B2FC->jobInfo->clientSpecies); - sub_8090DC4(gUnknown_202DE58,gUnknown_203B2FC->jobInfo->targetItem,0); + BufferItemName(gUnknown_202DE58,gUnknown_203B2FC->jobInfo->targetItem,NULL); gUnknown_203B2FC->fallbackState = 6; switch(gUnknown_203B2FC->jobInfo->missionType) { case WONDER_MAIL_MISSION_TYPE_DELIVER_ITEM: @@ -302,7 +302,7 @@ void sub_802DE60(void) } } -u32 sub_802DE84(struct unkStruct_802C39C *mail) +u32 sub_802DE84(unkStruct_802C39C *mail) { gUnknown_203B300 = MemoryAlloc(sizeof(struct unkStruct_203B300), 8); gUnknown_203B300->mail = mail; @@ -342,7 +342,7 @@ void sub_802DF24(void) { gUnknown_203B300->unk18[gUnknown_203B300->unk10] = gUnknown_80E0248; ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B300->unk18, 1, 1); + sub_800641C(gUnknown_203B300->unk18, TRUE, TRUE); MemoryFree(gUnknown_203B300); gUnknown_203B300 = NULL; } @@ -351,7 +351,7 @@ void sub_802DF24(void) void sub_802DF6C(void) { ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B300->unk18, 1, 1); + sub_800641C(gUnknown_203B300->unk18, TRUE, TRUE); } void sub_802DF88(void) diff --git a/src/wonder_mail_main_menu.c b/src/wonder_mail_main_menu.c index 75bc644fe..c2c9e0170 100644 --- a/src/wonder_mail_main_menu.c +++ b/src/wonder_mail_main_menu.c @@ -1,7 +1,7 @@ #include "global.h" #include "constants/wonder_mail.h" #include "constants/communication_error_codes.h" -#include "save.h" +#include "save_write.h" #include "memory.h" #include "text1.h" #include "text2.h" @@ -13,6 +13,7 @@ #include "code_801B3C0.h" #include "cpu.h" #include "code_80118A4.h" +#include "wonder_mail_3.h" #define SELECT_WONDER_MAIL_MODE_MAIN_SCREEN 0 #define SEND_WONDER_MAIL_MAIN_SCREEN 1 @@ -34,14 +35,14 @@ extern const char Cancel_80E7D24[]; extern const char Yes_80E7D2C[]; -const struct MenuItem gSelectWonderMailModeMainMenuItems[3] = +const MenuItem gSelectWonderMailModeMainMenuItems[3] = { {"Send", WONDER_MAIL_MODE_SEND}, {"Receive", WONDER_MAIL_MODE_RECEIVE}, {NULL, 0} }; -const struct MenuItem gSendWonderMailMainMenuItems[4] = +const MenuItem gSendWonderMailMainMenuItems[4] = { {"Game Link cable", WONDER_MAIL_GAME_LINK}, {"Password", -1}, @@ -50,7 +51,7 @@ const struct MenuItem gSendWonderMailMainMenuItems[4] = }; -const struct MenuItem gReceiveWonderMailMainMenuItems[4] = +const MenuItem gReceiveWonderMailMainMenuItems[4] = { {"Game Link cable", WONDER_MAIL_GAME_LINK}, {"Password", WONDER_MAIL_PASSWORD}, @@ -58,7 +59,7 @@ const struct MenuItem gReceiveWonderMailMainMenuItems[4] = {NULL, 0} }; -const struct MenuItem gUnknown_80E78F8[3] = +const MenuItem gUnknown_80E78F8[3] = { {"Yes", 6}, {"Cancel", 0}, @@ -68,7 +69,7 @@ const struct MenuItem gUnknown_80E78F8[3] = #include "data/wonder_mail_main_menu.h" -const struct MenuItem WonderMailMainUnused[3] = +const MenuItem WonderMailMainUnused[3] = { {Yes_80E7D2C, 1}, {Cancel_80E7D24, 0}, @@ -81,17 +82,6 @@ ALIGNED(4) const char Yes_80E7D2C[] = "Yes"; ALIGNED(4) const char wonder_mail_main_fill1[] = "pksdir0"; ALIGNED(4) const char wonder_mail_main_fill2[] = "pksdir0"; - -struct unkStruct_803B344 -{ - // size: 0xB4 - struct WonderMail mail; - u8* unk14; - u8* unk18; - u8 fill1C[0x3C - 0x1C]; - u8 unk3C[0x78]; -}; - struct unkStruct_203B3E8 { // size: 0x49C @@ -99,23 +89,23 @@ struct unkStruct_203B3E8 u8 PasswordEntryBuffer[PASSWORD_BUFFER_SIZE]; // Wonder Mail Buffer... union UNK38 { - struct WonderMail decodedMail; // 0x14 + WonderMail decodedMail; // 0x14 u8 unk38_u8[0x30]; // idk why it fills to 0x30 instead... } UNK38; u8 fill68[0x1EC - 0x68]; - struct UnkTextStruct2 unk1EC[4]; + UnkTextStruct2 unk1EC[4]; u32 unk24C; u32 wonderMailStatus; - struct unkStruct_803B344 unk254; + unkStruct_803B344 unk254; - struct unkStruct_803B344 unk308; + unkStruct_803B344 unk308; u8 unk3BC; u8 fill3BD[0x3C0 - 0x3BD]; - struct unkStruct_803B344 unk3C0; + unkStruct_803B344 unk3C0; - struct WonderMail unk474; + WonderMail unk474; u8 **unk488; u8 *unk48C; s32 wonderMailMethod; @@ -137,10 +127,9 @@ extern s32 sub_8037D64(u32, void *, void *); extern s32 sub_80381F4(u32, void *, void *); extern void sub_80151C0(u32, u8 *); extern void sub_802EF48(void); -extern void sub_802D098(struct WonderMail *); -extern struct unkStruct_803B344 *sub_803B344(u8); +extern unkStruct_803B344 *sub_803B344(u8); @@ -151,8 +140,8 @@ extern bool8 GetWonderMailAccepted(); extern void sub_802D184(); extern s32 sub_80154F0(); -extern bool8 DecodeWonderMailPassword(u8 *, struct WonderMail *); -extern bool8 IsValidWonderMail(struct WonderMail *WonderMailData); +extern bool8 DecodeWonderMailPassword(u8 *, WonderMail *); +extern bool8 IsValidWonderMail(WonderMail *WonderMailData); void PrintWonderMailMainMenuError(u32); void HandleWonderMailMainScreen(void); @@ -181,7 +170,7 @@ bool8 CreateWonderMailMenu(void) s32 index; ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); gUnknown_203B3E8 = MemoryAlloc(sizeof(struct unkStruct_203B3E8), 8); MemoryFill8((u8 *)gUnknown_203B3E8, 0, sizeof(struct unkStruct_203B3E8)); @@ -417,7 +406,7 @@ void HandlePasswordEntryScreen(void) case 3: sub_80155F0(); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B3E8->unk1EC,1,1); + sub_800641C(gUnknown_203B3E8->unk1EC, TRUE, TRUE); if ( !DecodeWonderMailPassword(gUnknown_203B3E8->PasswordEntryBuffer, &gUnknown_203B3E8->UNK38.decodedMail) || !IsValidWonderMail(&gUnknown_203B3E8->UNK38.decodedMail) ) { // Invalid password @@ -435,7 +424,7 @@ void HandlePasswordEntryScreen(void) case 2: sub_80155F0(); ResetUnusedInputStruct(); - sub_800641C(gUnknown_203B3E8->unk1EC,1,1); + sub_800641C(gUnknown_203B3E8->unk1EC, TRUE, TRUE); SetWonderMailMainMenuState(EXIT_TO_MAIN_MENU); break; } @@ -531,7 +520,7 @@ void nullsub_54(void) void WonderMailMainMenuCallback(void) { int linkStatus; - struct unkStruct_803B344 *temp; + unkStruct_803B344 *temp; switch(gUnknown_203B3E8->state) { case SELECT_WONDER_MAIL_MODE_MAIN_SCREEN: @@ -542,7 +531,7 @@ void WonderMailMainMenuCallback(void) break; case 3: ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); sub_802EF48(); break; case RECEIVE_WONDER_MAIL_MAIN_SCREEN: @@ -560,7 +549,7 @@ void WonderMailMainMenuCallback(void) gUnknown_203B3E8->unk488 = NULL; gUnknown_203B3E8->unk48C = NULL; } - sub_802D098(&gUnknown_203B3E8->unk474); + sub_802D098((unkSubStruct_203B2F8 *)&gUnknown_203B3E8->unk474); break; case PREPARE_SAVE: if(gUnknown_203B3E8->wonderMailAccepted) @@ -646,7 +635,7 @@ void WonderMailMainMenuCallback(void) case PASSWORD_ENTRY_SCREEN: sub_8006518(gUnknown_203B3E8->unk1EC); ResetUnusedInputStruct(); - sub_800641C(0,1,1); + sub_800641C(NULL, TRUE, TRUE); sub_80151C0(5,gUnknown_203B3E8->PasswordEntryBuffer); break; case PASSWORD_INVALID: diff --git a/sym_ewram.txt b/sym_ewram.txt index 21f40d03a..3e502f6f2 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -1,232 +1,168 @@ .include "src/m4a.o" -gUnknown_2000A80: /* 2000A80 */ +gUnknown_2000A80: /* 2000A80 (code_2) */ .space 0x8 -gUnknown_2000A88: /* 2000A88 */ +gUnknown_2000A88: /* 2000A88 (code / event_flag) */ .space 0x400 .include "src/memory.o" - - .align 4 - -gMainHeapDescriptor: /* 2000EB0 */ - .space 0x20 - -gMainHeapFreeList: /* 2000ED0 */ +gMainHeapFreeList: /* 2000ED0 (memory) */ .space 0x300 - -gMainHeap: /* 20011D0 */ +gMainHeap: /* 20011D0 (memory) */ .space 0x24000 .include "src/bg_palette_buffer.o" + .include "src/input.o" + .include "src/sprite.o" -gRealInputs: /* 20255F0 */ - .space 0x10 +gUnknown_2026E38: /* 2026E38 (cpu / code_800558C) */ + .space 0x4 -gUnusedInputsRelated: /* 2025600 */ - .space 0x2C +gUnknown_2026E3C: /* 2026E3C (cpu / code_800558C) */ + .space 0x4 -gUnusedScrambledInputJunk: /* 202562C */ - .space 0xC +gUnknown_2026E40: /* 2026E40 (code_800558C) */ + .space 0x4 -gBufferedInputs: /* 2025638 */ - .space 0x10 +gUnknown_2026E44: /* 2026E44 (code_800558C) */ + .space 0x4 -gCurrentInputs: /* 2025648 */ - .space 0x10 +gUnknown_2026E48: /* 2026E48 (code_800558C) */ + .space 0x4 -gLastInputs: /* 2025658 */ - .space 0x10 - -gInputTimers: /* 2025668 */ - .space 0x8 - -gUnknown_2025670: /* 2025670 */ +gUnknown_2026E4C: /* 2026E4C (code_800558C) */ .space 0x2 -gUnknown_2025672: /* 2025672 */ - .space 0x10 - -gUnknown_2025682: /* 2025682 */ - .space 0x12 - -gUnknown_2025694: /* 2025694 */ - .space 0x4 - -gUnknown_2025698: /* 2025698 */ - .space 0x8 - -gUnknown_20256A0: /* 20256A0 */ - .space 0x808 - -gUnknown_2025EA8: /* 2025EA8 */ - .space 0x400 - -gUnknown_20262A8: /* 20262A8 */ - .space 0x400 - -gSpriteCount: /* 20266A8 */ - .space 0x8 - -gUnknown_20266B0: /* 20266B0 */ - .space 0x780 - -gCharMemCursor: /* 2026E30 */ - .space 0x8 - -gUnknown_2026E38: /* 2026E38 */ - .space 0x4 - -gUnknown_2026E3C: /* 2026E3C */ - .space 0x4 - -gUnknown_2026E40: /* 2026E40 */ - .space 0x4 - -gUnknown_2026E44: /* 2026E44 */ - .space 0x4 - -gUnknown_2026E48: /* 2026E48 */ - .space 0x4 - -gUnknown_2026E4C: /* 2026E4C */ +gUnknown_2026E4E: /* 2026E4E (code_800558C / code_2 / code_800DAC0 / code_8098BDC / code_80428A0 / code_8040094 / code_8098468 / ground_map_1 / code_8041AD0 / ground_map_2) */ .space 0x2 -gUnknown_2026E4E: /* 2026E4E */ - .space 0x2 - -gUnknown_2026E50: /* 2026E50 */ +gUnknown_2026E50: /* 2026E50 (code_800558C) */ .space 0x4 -gUnknown_2026E54: /* 2026E54 */ +gUnknown_2026E54: /* 2026E54 (code_800558C) */ .space 0x4 -gUnknown_2026E58: /* 2026E58 */ +gUnknown_2026E58: /* 2026E58 (code_800558C) */ .space 0x8 -gUnknown_2026E60: /* 2026E60 */ +gUnknown_2026E60: /* 2026E60 (code_800558C) */ .space 0x288 -gUnknown_20270E8: /* 20270E8 */ +gUnknown_20270E8: /* 20270E8 (code_800558C) */ .space 0x288 -gUnknown_2027370: /* 2027370 */ +gUnknown_2027370: /* 2027370 (code_80130A8 / code_805D8C8 / code_80521D0 / code_8272724 / text / menu_input / text1 / text2) */ .space 0x48 -gUnknown_20273B8: /* 20273B8 */ +gUnknown_20273B8: /* 20273B8 (code_80130A8) */ .space 0xD8 -gCharmaps: /* 2027490 */ +gCharmaps: /* 2027490 (text / text1) */ .space 0x8 -gCharacterSpacing: /* 2027498 */ +gCharacterSpacing: /* 2027498 (text / text1 / text2) */ .space 0x2 -gUnknown_202749A: /* 202749A */ +gUnknown_202749A: /* 202749A (text / code_805D8C8) */ .space 0xB -gUnknown_20274A5: /* 20274A5 */ +gUnknown_20274A5: /* 20274A5 (text / text1 / code_803D110) */ .space 0x1 -gUnknown_20274A6: /* 20274A6 */ +gUnknown_20274A6: /* 20274A6 (text) */ .space 0x6 -gCurrentCharmap: /* 20274AC */ +gCurrentCharmap: /* 20274AC (text / text1 / text2) */ .space 0x4 -gUnknown_20274B0: /* 20274B0 */ +gUnknown_20274B0: /* 20274B0 (text1) */ .space 0x4 -gUnknown_20274B4: /* 20274B4 */ +gUnknown_20274B4: /* 20274B4 (text1) */ .space 0x3B00 -gCharmapFiles: /* 202AFB4 */ - .space 0x8 - -gUnknown_202AFBC: /* 202AFBC */ - .space 0x4 - -gUnknown_202AFC0: /* 202AFC0 */ - .space 0x60 - -gUnknown_202B020: /* 202B020 */ - .space 0x4 - -gUnknown_202B024: /* 202B024 */ - .space 0x4 - -gUnknown_202B028: /* 202B028 */ - .space 0x8 - -gUnknown_202B030: /* 202B030 */ - .space 0x4 - -gUnknown_202B034: /* 202B034 */ - .space 0x4 - -gUnknown_202B038: /* 202B038 */ - .space 0x800 - -gUnknown_202B838: /* 202B838 */ - .space 0x800 - -gUnknown_202C038: /* 202C038 */ - .space 0x800 - -gUnknown_202C838: /* 202C838 */ - .space 0x720 - -gUnknown_202CF58: /* 202CF58 */ - .space 0xE0 - -gUnknown_202D038: /* 202D038 */ - .space 0x4 - -gUnknown_202D03C: /* 202D03C */ - .space 0x1C - -gUnknown_202D058: /* 202D058 */ - .space 0x10 - -gUnknown_202D068: /* 202D068 */ - .space 0x4 - -gUnknown_202D06C: /* 202D06C */ +gCharmapFiles: /* 202AFB4 (text1) */ .space 0xC -gUnknown_202D078: /* 202D078 */ - .space 0x20 - -gUnknown_202D098: /* 202D098 */ - .space 0x120 - -gUnknown_202D1B8: /* 202D1B8 */ - .space 0x40 - -gUnknown_202D1F8: /* 202D1F8 */ - .space 0x40 - -gUnknown_202D238: /* 202D238 */ - .space 0x4 - -gUnknown_202D23C: /* 202D23C */ - .space 0x4 - -gUnknown_202D240: /* 202D240 */ +gUnknown_202AFC0: /* 202AFC0 (text1 / text2) */ .space 0x60 -gUnknown_202D2A0: /* 202D2A0 */ +gUnknown_202B020: /* 202B020 (text / text1) */ + .space 0x4 + +gUnknown_202B024: /* 202B024 (text / text1) */ + .space 0x4 + +gUnknown_202B028: /* 202B028 (text1 / text2) */ + .space 0x8 + +gUnknown_202B030: /* 202B030 (text1 / text2) */ + .space 0x4 + +gUnknown_202B034: /* 202B034 (text1 / text2) */ + .space 0x4 + +gUnknown_202B038: /* 202B038 (text1 / text2 / dungeon_map_access_1 / code_8009804 / code_8040094 / code_80521D0 / code_803D110 / code_80A26CC_1 / code_2) */ + .space 0x1000 + +gUnknown_202C038: /* 202C038 (code_800DAC0 / code_80495E4) */ + .space 0x800 + +gUnknown_202C838: /* 202C838 (code_800DAC0 / code_80495E4) */ + .space 0x720 + +gUnknown_202CF58: /* 202CF58 (code_80130A8) */ + .space 0xE0 + +gUnknown_202D038: /* 202D038 (code_8009804 / code_803D110 / code_80521D0) */ + .space 0x4 + +gUnknown_202D03C: /* 202D03C (code_8040094) */ + .space 0x1C + +gUnknown_202D058: /* 202D058 (code_803D110) */ + .space 0x10 + +gUnknown_202D068: /* 202D068 (code_803D110) */ + .space 0x4 + +gUnknown_202D06C: /* 202D06C (code_803D110) */ + .space 0xC + +gUnknown_202D078: /* 202D078 (code_8098BDC) */ + .space 0x20 + +gUnknown_202D098: /* 202D098 (code_8098BDC) */ + .space 0x120 + +gUnknown_202D1B8: /* 202D1B8 (code_8098BDC) */ + .space 0x40 + +gUnknown_202D1F8: /* 202D1F8 (code_8098BDC) */ + .space 0x40 + +gUnknown_202D238: /* 202D238 (code_8009804) */ + .space 0x4 + +gUnknown_202D23C: /* 202D23C (code_8009804) */ + .space 0x4 + +gUnknown_202D240: /* 202D240 (code_8009804) */ + .space 0x60 + +gUnknown_202D2A0: /* 202D2A0 (code_8009804) */ .space 0x4 .include "src/file_system.o" + .include "src/decompress.o" .include "src/main.o" -gUnknown_202D608: /* 202D608 */ +gUnknown_202D608: /* 202D608 (reg_control / unused_vblank) */ .space 0x40 -gUnknown_202D648: /* 202D648 */ +gUnknown_202D648: /* 202D648 (reg_control / unused_vblank) */ .space 0x40 .include "src/music.o" @@ -235,203 +171,204 @@ gUnknown_202D648: /* 202D648 */ .include "src/bg_control.o" .space 0x140 -gBldAlpha: /* 202D7FA */ +gBldAlpha: /* 202D7FA (bg_control / cpu) */ .space 0x2 -gBldCnt: /* 202D7FC */ +gBldCnt: /* 202D7FC (bg_control / cpu / main / reg_control) */ .space 0x2 -gUnknown_202D7FE: /* 202D7FE */ +gUnknown_202D7FE: /* 202D7FE (bg_control / main / reg_control) */ .space 0x2 -gUnknown_202D800: /* 202D800 */ +gUnknown_202D800: /* 202D800 (cpu) */ .space 0x8 -gUnknown_202D808: /* 202D808 */ +gUnknown_202D808: /* 202D808 (code_800D090) */ .space 0x108 -gUnknown_202D910: /* 202D910 */ +gUnknown_202D910: /* 202D910 (code_800D090) */ .space 0x4 -gUnknown_202D914: /* 202D914 */ +gUnknown_202D914: /* 202D914 (code_800D090) */ .space 0x20C -gUnknown_202DB20: /* 202DB20 */ +gUnknown_202DB20: /* 202DB20 (code_800D090) */ .space 0x10 -gUnknown_202DB30: /* 202DB30 */ +gUnknown_202DB30: /* 202DB30 (code_800D090) */ .space 0x20 -gUnknown_202DB50: /* 202DB50 */ +gUnknown_202DB50: /* 202DB50 (code_800D090) */ .space 0x8 -gUnknown_202DB58: /* 202DB58 */ +gUnknown_202DB58: /* 202DB58 (code_800D090) */ .space 0x8 -gUnknown_202DB60: /* 202DB60 */ +gUnknown_202DB60: /* 202DB60 (code_800D090) */ .space 0x8 -gUnknown_202DB68: /* 202DB68 */ +gUnknown_202DB68: /* 202DB68 (code_800D090) */ .space 0x4 -gUnknown_202DB6C: /* 202DB6C */ +gUnknown_202DB6C: /* 202DB6C (code_800D090) */ .space 0x4 -gUnknown_202DB70: /* 202DB70 */ +gUnknown_202DB70: /* 202DB70 (code_800D090) */ .space 0x4 -gUnknown_202DB74: /* 202DB74 */ +gUnknown_202DB74: /* 202DB74 (code_800D090) */ .space 0x4 -gUnknown_202DB78: /* 202DB78 */ +gUnknown_202DB78: /* 202DB78 (code_800D090) */ .space 0x40 -gUnknown_202DBB8: /* 202DBB8 */ +gUnknown_202DBB8: /* 202DBB8 (code_800D090 / data_80B9BB8) */ .space 0x140 -gUnknown_202DCF8: /* 202DCF8 */ +gUnknown_202DCF8: /* 202DCF8 (code_800D090 / arm_func) */ .space 0x120 -gUnknown_202DE18: /* 202DE18 */ +gUnknown_202DE18: /* 202DE18 (code_800DAC0) */ .space 0x1 -gUnknown_202DE19: /* 202DE19 */ +gUnknown_202DE19: /* 202DE19 (code_800DAC0) */ .space 0x3 -gUnknown_202DE1C: /* 202DE1C */ +gUnknown_202DE1C: /* 202DE1C (code_80118A4) */ .space 0x4 -gUnknown_202DE20: /* 202DE20 */ +gUnknown_202DE20: /* 202DE20 (code_80118A4) */ .space 0x2 -gUnknown_202DE22: /* 202DE22 */ +gUnknown_202DE22: /* 202DE22 (code_80118A4) */ .space 0x2 -gUnknown_202DE24: /* 202DE24 */ +gUnknown_202DE24: /* 202DE24 (code_80118A4) */ .space 0x4 -gUnknown_202DE28: /* 202DE28 */ +gUnknown_202DE28: /* 202DE28 (save) */ .space 0x4 .align 4 gUnknown_202DE30: /* 202DE30 */ .space 0x28 +/* Seems to be a general u8 buffer for text, mostly used with item names */ gUnknown_202DE58: /* 202DE58 */ - .space 0x50 + .space 80 gUnknown_202DEA8: /* 202DEA8 */ - .space 0xF0 + .space 240 -gAvailablePokemonNames: /* 202DF98 */ - .space 0x50 +gAvailablePokemonNames: /* 202DF98 gAvailablePokemonNames[80][] */ + .space 80 -gUnknown_202DFE8: /* 202DFE8 */ - .space 0x50 +gUnknown_202DFE8: /* 202DFE8 (code_805D8C8 / code_806CD90 / code_806E8B0 / code_8073CF0 / code_80521D0 / code_8057824 / code_8077274_1 / gulpin_shop_801FB50 / status_actions) */ + .space 80 -gUnknown_202E038: /* 202E038 ({ARG_POKEMON_2}) */ - .space 0x50 +gUnknown_202E038: /* 202E038 (code_8057824_1 / code_8086A3C / code_808417C / wonder_mail_3_mid) ({ARG_POKEMON_2}) */ + .space 80 -gUnknown_202E088: /* 202E088 ({ARG_POKEMON_3})? */ - .space 0xA0 +gUnknown_202E088: /* 202E088 (code_8057824_1 / code_806E8B0 / code_808417C / wonder_mail_3_mid) [{ARG_POKEMON_3}]? */ + .space 160 -gUnknown_202E128: /* 202E128 */ - .space 0xA0 +gUnknown_202E128: /* 202E128 (gulpin_shop_801FB50) */ + .space 160 -gUnknown_202E1C8: /* 202E1C8 */ - .space 0x50 +gUnknown_202E1C8: /* 202E1C8 (code_801AFA4 / felicity_bank / gulpin_shop_801FB50 / kangaskhan_storage / kecleon_bros1 / makuhita_dojo1 / wigglytuff_shop / wonder_mail_802DF88) */ + .space 80 -gUnknown_202E218: /* 202E218 */ - .space 0xA0 +gUnknown_202E218: /* 202E218 (code_801AFA4) */ + .space 160 -gPlayerName: /* 202E2B8 */ - .space 0x320 +gPlayerName: /* 202E2B8 (ground_script / code_8098BDC / luminous_cave / makuhita_dojo1) */ + .space 800 -gUnknown_202E5D8: /* 202E5D8 */ - .space 0x50 +gUnknown_202E5D8: /* 202E5D8 (code_80130A8 / code_8098BDC / code_80521D0 / felicity_bank / friend_rescue / gulpin_shop_801FB50 / kangaskhan_storage / kecleon_bros1 / makuhita_dojo1 / pokemon_news / post_office_guide1 / thank_you_wonder_mail / wigglytuff_shop / wonder_mail_2 / wonder_mail_3_mid / wonder_mail_802DF88 / wonder_mail */ + .space 80 -gUnknown_202E628: /* 202E628 */ +gUnknown_202E628: /* 202E628 (code_80130A8 / code_806E8B0 / ground_script / wigglytuff_shop / wonder_mail_3_mid) */ .space 0xB8 -gUnknown_202E6E0: /* 202E6E0 */ +gUnknown_202E6E0: /* 202E6E0 (code_80130A8) */ .space 0x8 -gTeamName: /* 202E6E8 */ - .space 0x50 +gTeamName: /* 202E6E8 (code_80130A8) */ + .space 80 -gUnknown_202E738: /* 202E738 */ +gUnknown_202E738: /* 202E738 (code_80130A8) */ .space 0x4 -gUnknown_202E73C: /* 202E73C */ +gUnknown_202E73C: /* 202E73C (code_80130A8) */ .space 0x4 -gUnknown_202E740: /* 202E740 */ +gUnknown_202E740: /* 202E740 (code_80130A8) */ .space 0x4 -gUnknown_202E744: /* 202E744 */ +gUnknown_202E744: /* 202E744 (code_80130A8) */ .space 0x4 -gUnknown_202E748: /* 202E748 */ +gUnknown_202E748: /* 202E748 (code_80130A8) */ .space 0x34 -gUnknown_202E77C: /* 202E77C */ +gUnknown_202E77C: /* 202E77C (code_80130A8) */ .space 0x4 -gUnknown_202E780: /* 202E780 */ +gUnknown_202E780: /* 202E780 (code_80130A8) */ .space 0x4 -gUnknown_202E784: /* 202E784 */ +gUnknown_202E784: /* 202E784 (code_80130A8) */ .space 0x4 -gUnknown_202E788: /* 202E788 */ +gUnknown_202E788: /* 202E788 (code_80130A8) */ .space 0x4 -gUnknown_202E78C: /* 202E78C */ +gUnknown_202E78C: /* 202E78C (code_80130A8) */ .space 0x4 -gUnknown_202E790: /* 202E790 */ +gUnknown_202E790: /* 202E790 (code_80130A8) */ .space 0x1 -gUnknown_202E791: /* 202E791 */ +gUnknown_202E791: /* 202E791 (code_80130A8) */ .space 0x3 -gUnknown_202E794: /* 202E794 */ +gUnknown_202E794: /* 202E794 (code_80130A8) */ .space 0x4 -gUnknown_202E798: /* 202E798 (on screen dialogue text) */ +gUnknown_202E798: /* 202E798 (code_80130A8) [on screen dialogue text] */ .space 0x3E8 -gUnknown_202EB80: /* 202EB80 */ +gUnknown_202EB80: /* 202EB80 (code_80130A8) */ .space 0x40 -gUnknown_202EBC0: /* 202EBC0 */ +gUnknown_202EBC0: /* 202EBC0 (code_80130A8) */ .space 0x50 -gUnknown_202EC10: /* 202EC10 */ +gUnknown_202EC10: /* 202EC10 (code_80130A8) */ .space 0x4 -gUnknown_202EC14: /* 202EC14 */ +gUnknown_202EC14: /* 202EC14 (code_80130A8) */ .space 0x4 -gUnknown_202EC18: /* 202EC18 */ +gUnknown_202EC18: /* 202EC18 (code_80130A8) */ .space 0x4 -gUnknown_202EC1C: /* 202EC1C */ +gUnknown_202EC1C: /* 202EC1C (code_80130A8) */ .space 0x4 -gUnknown_202EC20: /* 202EC20 */ +gUnknown_202EC20: /* 202EC20 (code_80130A8) */ .space 0x8 -gUnknown_202EC28: /* 202EC28 */ +gUnknown_202EC28: /* 202EC28 (code_80130A8) */ .space 0x10 -gUnknown_202EC38: /* 202EC38 */ +gUnknown_202EC38: /* 202EC38 (other_menus) */ .space 0x8 -gUnknown_202EC40: /* 202EC40 */ +gUnknown_202EC40: /* 202EC40 (other_menus / other_menus_1) */ .space 0x8 -gUnknown_202EC48: /* 202EC48 */ +gUnknown_202EC48: /* 202EC48 (other_menus_1) */ .space 0x4 .include "src/rescue_password_menu.o" @@ -479,58 +416,58 @@ gUnknown_202EDC8: /* 202EDC8 */ gUnknown_202EDCC: /* 202EDCC */ .space 0x4 -gUnknown_202EDD0: /* 202EDD0 */ +gUnknown_202EDD0: /* 202EDD0 (code_803D110 / code_804AFAC / code_8040094) */ .space 0x4 -gUnknown_202EDD4: /* 202EDD4 */ +gUnknown_202EDD4: /* 202EDD4 (code_803D110) */ .space 0x4 -gUnknown_202EDD8: /* 202EDD8 */ +gUnknown_202EDD8: /* 202EDD8 (code_803D110) */ .space 0x4 -gUnknown_202EDDC: /* 202EDDC */ +gUnknown_202EDDC: /* 202EDDC (code_803D110) */ .space 0xC -gUnknown_202EDE8: /* 202EDE8 */ +gUnknown_202EDE8: /* 202EDE8 (code_803D110) */ .space 0x14 -gUnknown_202EDFC: /* 202EDFC */ +gUnknown_202EDFC: /* 202EDFC (code_803D110) */ .space 0x4 -gUnknown_202EE00: /* 202EE00 */ +gUnknown_202EE00: /* 202EE00 (code_8040094 / code_805D8C8) */ .space 0x1 -gUnknown_202EE01: /* 202EE01 */ +gUnknown_202EE01: /* 202EE01 (code_8040094 / code_80521D0) */ .space 0x1 -gUnknown_202EE02: /* 202EE02 */ +gUnknown_202EE02: /* 202EE02 (code_8040094) */ .space 0x2 -gUnknown_202EE04: /* 202EE04 */ +gUnknown_202EE04: /* 202EE04 (code_8040094) */ .space 0x4 -gUnknown_202EE08: /* 202EE08 */ +gUnknown_202EE08: /* 202EE08 (code_8040094) */ .space 0x4 -gUnknown_202EE0C: /* 202EE0C */ +gUnknown_202EE0C: /* 202EE0C (code_805D8C8_1 / code_8069E0C) */ .space 0x4 gUnknown_202EE10: /* 202EE10 */ .space 0x28 -gUnknown_202EE38: /* 202EE38 */ +gUnknown_202EE38: /* 202EE38 (code_805D8C8) */ .space 0x1 -gUnknown_202EE39: /* 202EE39 */ +gUnknown_202EE39: /* 202EE39 (code_805D8C8) */ .space 0x1 -gUnknown_202EE3A: /* 202EE3A */ +gUnknown_202EE3A: /* 202EE3A (code_805D8C8) */ .space 0xA -gUnknown_202EE44: /* 202EE44 */ +gUnknown_202EE44: /* 202EE44 (code_805D8C8 / code_8044CC8) */ .space 0x28 -gUnknown_202EE6C: /* 202EE6C */ +gUnknown_202EE6C: /* 202EE6C (code_805D8C8 / code_8044CC8) */ .space 0x4 gUnknown_202EE70: /* 202EE70 */ @@ -545,109 +482,109 @@ gDungeonPaletteFile: /* 202EE88 */ gUnknown_202EE8C: /* 202EE8C */ .space 0x300 -gUnknown_202F18C: /* 202F18C */ +gUnknown_202F18C: /* 202F18C (dungeon_map_access) */ .space 0x4 -gUnknown_202F190: /* 202F190 */ +gUnknown_202F190: /* 202F190 (dungeon_map_access) */ .space 0x18 -gUnknown_202F1A8: /* 202F1A8 */ +gUnknown_202F1A8: /* 202F1A8 (code_804AFAC / code_80428A0) */ .space 0x1 -gUnknown_202F1A9: /* 202F1A9 */ +gUnknown_202F1A9: /* 202F1A9 (code_804AFAC) */ .space 0x1 -gUnknown_202F1AA: /* 202F1AA */ +gUnknown_202F1AA: /* 202F1AA (code_804AFAC) */ .space 0x1 -gUnknown_202F1AB: /* 202F1AB */ +gUnknown_202F1AB: /* 202F1AB (code_804AFAC) */ .space 0x1 -gUnknown_202F1AC: /* 202F1AC */ +gUnknown_202F1AC: /* 202F1AC (code_804AFAC) */ .space 0x1 -gUnknown_202F1AD: /* 202F1AD */ +gUnknown_202F1AD: /* 202F1AD (code_804AFAC) */ .space 0x1 -gUnknown_202F1AE: /* 202F1AE */ +gUnknown_202F1AE: /* 202F1AE (code_804AFAC) */ .space 0x2 -gUnknown_202F1B0: /* 202F1B0 */ +gUnknown_202F1B0: /* 202F1B0 (code_804AFAC) */ .space 0x2 -gUnknown_202F1B2: /* 202F1B2 */ +gUnknown_202F1B2: /* 202F1B2 (code_804AFAC) */ .space 0x2 -gUnknown_202F1B4: /* 202F1B4 */ +gUnknown_202F1B4: /* 202F1B4 (code_804AFAC) */ .space 0x4 -gUnknown_202F1B8: /* 202F1B8 */ +gUnknown_202F1B8: /* 202F1B8 (code_804AFAC) */ .space 0x10 -gUnknown_202F1C8: /* 202F1C8 */ +gUnknown_202F1C8: /* 202F1C8 (code_804AFAC) */ .space 0x4 -gUnknown_202F1CC: /* 202F1CC */ +gUnknown_202F1CC: /* 202F1CC (code_804AFAC) */ .space 0x4 -gUnknown_202F1D0: /* 202F1D0 */ +gUnknown_202F1D0: /* 202F1D0 (code_804AFAC) */ .space 0x4 -gUnknown_202F1D4: /* 202F1D4 */ +gUnknown_202F1D4: /* 202F1D4 (code_804AFAC) */ .space 0x4 -gUnknown_202F1D8: /* 202F1D8 */ +gUnknown_202F1D8: /* 202F1D8 (code_804AFAC) */ .space 0x4 -gUnknown_202F1DC: /* 202F1DC */ +gUnknown_202F1DC: /* 202F1DC (code_804AFAC) */ .space 0x4 -gUnknown_202F1E0: /* 202F1E0 */ +gUnknown_202F1E0: /* 202F1E0 (code_804AFAC) */ .space 0x1 -gUnknown_202F1E1: /* 202F1E1 */ +gUnknown_202F1E1: /* 202F1E1 (code_804AFAC) */ .space 0x7 -gUnknown_202F1E8: /* 202F1E8 */ +gUnknown_202F1E8: /* 202F1E8 (code_804AFAC / code_80521D0) */ .space 0x8 -gUnknown_202F1F0: /* 202F1F0 */ +gUnknown_202F1F0: /* 202F1F0 (code_80521D0) */ .space 0x8 -gUnknown_202F1F8: /* 202F1F8 */ +gUnknown_202F1F8: /* 202F1F8 (code_80521D0) */ .space 0x4 -gUnknown_202F1FC: /* 202F1FC */ +gUnknown_202F1FC: /* 202F1FC (code_80521D0) */ .space 0x4 -gUnknown_202F200: /* 202F200 */ +gUnknown_202F200: /* 202F200 (code_80521D0) */ .space 0x8 -gUnknown_202F208: /* 202F208 */ +gUnknown_202F208: /* 202F208 (code_80521D0 / code_805D8C8) */ .space 0x4 -gUnknown_202F20C: /* 202F20C */ +gUnknown_202F20C: /* 202F20C (code_80521D0) */ .space 0x4 -gUnknown_202F210: /* 202F210 */ +gUnknown_202F210: /* 202F210 (code_80521D0 / code_805A120) */ .space 0x4 -gUnknown_202F214: /* 202F214 */ +gUnknown_202F214: /* 202F214 (code_80521D0 / code_805A120) */ .space 0x4 -gUnknown_202F218: /* 202F218 */ +gUnknown_202F218: /* 202F218 (code_80521D0 / code_805A120) */ .space 0x1 -gUnknown_202F219: /* 202F219 */ +gUnknown_202F219: /* 202F219 (code_80521D0 / code_8057824) */ .space 0x1 -gUnknown_202F21A: /* 202F21A */ +gUnknown_202F21A: /* 202F21A (code_80521D0 / code_8057824) */ .space 0x2 -gUnknown_202F21C: /* 202F21C */ +gUnknown_202F21C: /* 202F21C (code_80521D0 / code_8057824) */ .space 0x4 -gUnknown_202F220: /* 202F220 */ +gUnknown_202F220: /* 202F220 (code_80521D0 / code_8057824) */ .space 0x1 gUnknown_202F221: /* 202F221 */ @@ -728,89 +665,77 @@ gUnknown_202F30C: /* 202F30C */ gUnknown_202F310: /* 202F310 */ .space 0x4 -gWalkableTileToCrossableTerrain: /* 202F314 */ +gWalkableTileToCrossableTerrain: /* 202F314 (dungeon_map_access / dungeon_movement) */ .space 0x8 -gUnknown_202F31C: /* 202F31C */ +gUnknown_202F31C: /* 202F31C (code_80718D8) */ .space 0x8 -gUnknown_202F324: /* 202F324 */ +gUnknown_202F324: /* 202F324 (code_80718D8) */ .space 0x8 -gUnknown_202F32C: /* 202F32C */ +gUnknown_202F32C: /* 202F32C (code_8072CF4 / code_80428A0 / code_8069E0C) */ .space 0x1 -gUnknown_202F32D: /* 202F32D */ +gUnknown_202F32D: /* 202F32D (code_8072CF4 / code_8073CF0) */ .space 0x3 -gPotentialItemTargetDirections: /* 202F330 */ +gPotentialItemTargetDirections: /* 202F330 (dungeon_ai_items) */ .space 0x20 -gTargetAhead: /* 202F350 */ +gTargetAhead: /* 202F350 (dungeon_ai_items) */ .space 0x8 -gPotentialItemTargetWeights: /* 202F358 */ +gPotentialItemTargetWeights: /* 202F358 (dungeon_ai_items) */ .space 0x20 -gUnknown_202F378: /* 202F378 */ +gUnknown_202F378: /* 202F378 (code_8073CF0) */ .space 0x8 -gCanAttackInDirection: /* 202F380 */ +gCanAttackInDirection: /* 202F380 (dungeon_ai_attack) */ .space 0x8 -gPotentialAttackTargetDirections: /* 202F388 */ +gPotentialAttackTargetDirections: /* 202F388 (dungeon_ai_attack) */ .space 0x8 -gPotentialAttackTargetWeights: /* 202F390 */ +gPotentialAttackTargetWeights: /* 202F390 (dungeon_ai_attack) */ .space 0x20 -gPotentialTargets: /* 202F3B0 */ +gPotentialTargets: /* 202F3B0 (dungeon_ai_attack) */ .space 0x20 -gUnknown_202F3D0: /* 202F3D0 */ +gUnknown_202F3D0: /* 202F3D0 (code_80869E4) */ .space 0x8 -gUnknown_202F3D8: /* 202F3D8 */ +gUnknown_202F3D8: /* 202F3D8 (code_8085B0C) */ .space 0x8 -gMonsterParameters: /* 202F3E0 */ +gMonsterParameters: /* 202F3E0 (pokemon / pokemon_mid) */ .space 0x4 -gMonsterParametersFile: /* 202F3E4 */ +gMonsterParametersFile: /* 202F3E4 (pokemon) */ .space 0x4 -gUnknown_202F3E8: /* 202F3E8 */ +gUnknown_202F3E8: /* 202F3E8 (pokemon_2 / pokemon_3) */ .space 0x18 gRecruitedPokemon: /* 202F400 */ .space 0x90E8 -gLevelCurrentPokeId: /* 20384E8 */ +gLevelCurrentPokeId: /* 20384E8 (pokemon / pokemon_mid) */ .space 0x8 -gLevelCurrentData: /* 20384F0 */ +gLevelCurrentData: /* 20384F0 (pokemon_mid) */ .space 0x4B0 .include "src/items.o" - .include "src/rescue_team_info.o" .space 0x4 .include "src/friend_area.o" - .space 0x2 - -gWazaParametersFile: /* 2038C64 */ - .space 0x4 - -gMovesData: /* 2038C68 */ - .space 0x4 - -gMoveLearnsets: /* 2038C6C */ - .space 0x4 - + .include "src/moves.o" .include "src/game_options.o" .include "src/play_time.o" - .include "src/code_8094F88.o" .space 0x4 .include "src/code_80958E8.o" @@ -822,104 +747,103 @@ gMoveLearnsets: /* 2038C6C */ .include "src/ground_main.o" .space 0x2 -gUnknown_20398C8: /* 20398C8 */ +gUnknown_20398C8: /* 20398C8 (code_8098BDC) */ .space 0x10 -gUnknown_20398D8: /* 20398D8 */ +gUnknown_20398D8: /* 20398D8 (code_8098BDC) */ .space 0x78 -gUnknown_2039950: /* 2039950 */ +gUnknown_2039950: /* 2039950 (code_8098468 / code_8098BDC) */ .space 0x8 -gUnknown_2039958: /* 2039958 */ +gUnknown_2039958: /* 2039958 (code_8098BDC) */ .space 0x10 -gUnknown_2039968: /* 2039968 */ +gUnknown_2039968: /* 2039968 (code_8098BDC) */ .space 0x10 -gUnknown_2039978: /* 2039978 */ +gUnknown_2039978: /* 2039978 (code_8098BDC) */ .space 0x8 -gUnknown_2039980: /* 2039980 */ +gUnknown_2039980: /* 2039980 (code_8098BDC) */ .space 0x10 -gUnknown_2039990: /* 2039990 */ +gUnknown_2039990: /* 2039990 (code_8098BDC) */ .space 0x2 -gUnknown_2039992: /* 2039992 */ +gUnknown_2039992: /* 2039992 (code_8098BDC) */ .space 0x6 -gUnknown_2039998: /* 2039998 */ +gUnknown_2039998: /* 2039998 (code_8098BDC) */ .space 0x44 -gUnknown_20399DC: /* 20399DC */ +gUnknown_20399DC: /* 20399DC (code_8098BDC) */ .space 0x2 -gUnknown_20399DE: /* 20399DE */ +gUnknown_20399DE: /* 20399DE (code_8098BDC) */ .space 0x2 -gUnknown_20399E0: /* 20399E0 */ +gUnknown_20399E0: /* 20399E0 (code_8098BDC) */ .space 0x8 -gUnknown_20399E8: /* 20399E8 */ +gUnknown_20399E8: /* 20399E8 (code_809D148) */ .space 0x14 -gUnknown_20399FC: /* 20399FC */ +gUnknown_20399FC: /* 20399FC (code_809D148) */ .space 0x34 -gUnknown_2039A30: /* 2039A30 */ +gUnknown_2039A30: /* 2039A30 (code_809D148 / ground_script) */ .space 0x2 -gUnknown_2039A32: /* 2039A32 */ +gUnknown_2039A32: /* 2039A32 (code_809D148 / ground_script) */ .space 0x2 -gUnknown_2039A34: /* 2039A34 */ +gUnknown_2039A34: /* 2039A34 (code_809D148 / ground_script) */ .space 0x2 -gUnknown_2039A36: /* 2039A36 */ +gUnknown_2039A36: /* 2039A36 (code_809D148 / ground_script) */ .space 0x2 -gUnknown_2039A38: /* 2039A38 */ +gUnknown_2039A38: /* 2039A38 (code_809D148 / ground_script) */ .space 0x88 -gUnknown_2039AC0: /* 2039AC0 */ +gUnknown_2039AC0: /* 2039AC0 (code_809D148 / ground_script) */ .space 0x88 -gUnknown_2039B48: /* 2039B48 */ +gUnknown_2039B48: /* 2039B48 (code_809D148 / ground_script) */ .space 0x208 -gUnknown_2039D50: /* 2039D50 */ +gUnknown_2039D50: /* 2039D50 (ground_script) */ .space 0x48 -gUnknown_2039D98: /* 2039D98 (seems to be storage for strings.. used for both Team Name and Player Name) */ +gUnknown_2039D98: /* 2039D98 (ground_script) (seems to be storage for strings.. used for both Team Name and Player Name) */ .space 0xC -gUnknown_2039DA4: /* 2039DA4 */ +gUnknown_2039DA4: /* 2039DA4 (ground_script) */ .space 0x4 -gUnknown_2039DA8: /* 2039DA8 */ +gUnknown_2039DA8: /* 2039DA8 (ground_script) */ .space 0x8 -gUnknown_2039DB0: /* 2039DB0 [struct unkStruct_2039DB0] */ +gUnknown_2039DB0: /* 2039DB0 (ground_sprite) [unkStruct_2039DB0] */ .space 0x10 -gUnknown_2039DC0: /* 2039DC0 [struct unkStruct_2039DB0] */ +gUnknown_2039DC0: /* 2039DC0 (ground_sprite) [unkStruct_2039DB0] */ .space 0xC -gUnknown_2039DCC: /* 2039DCC */ +gUnknown_2039DCC: /* 2039DCC (ground_sprite) */ .space 0x2 -gUnknown_2039DCE: /* 2039DCE */ +gUnknown_2039DCE: /* 2039DCE (ground_sprite) */ .space 0x2 -gUnknown_2039DD0: /* 2039DD0 */ +gUnknown_2039DD0: /* 2039DD0 (ground_sprite) */ .space 0x4 -gUnknown_2039DD4: /* 2039DD4 */ +gUnknown_2039DD4: /* 2039DD4 (ground_sprite) */ .space 0x4 -gUnknown_2039DD8: /* 2039DD8 */ +gUnknown_2039DD8: /* 2039DD8 (ground_sprite) */ .space 0x8 -gUnknown_2039DE0: /* 2039DE0 */ - .space 0x4 + .include "src/code_80A7714.o" diff --git a/sym_ewram2.txt b/sym_ewram2.txt index 1d4ccca02..287475214 100644 --- a/sym_ewram2.txt +++ b/sym_ewram2.txt @@ -6,8 +6,8 @@ errno: /* 203B034 */ .space 0x4 -alt_203B038: - +ewramClearEnd: +ewramClearEnd2: gTitlePaletteFile: /* 203B038 */ .space 0x4 @@ -21,8 +21,7 @@ gUnknown_203B040: /* 203B040 */ .space 0x2 -gUnknown_203B074: /* 203B074 */ - .space 0x4 + .include "src/sprite.o" gUnknown_203B078: /* 203B078 */ .space 0x4 @@ -123,6 +122,10 @@ gUnknown_203B0EC: /* 203B0EC */ .space 0x2B .include "src/save.o" +.include "src/save_read.o" +.include "src/save_write.o" +.include "src/quick_save_read.o" +.include "src/quick_save_write.o" gUnknown_203B198: /* 203B198 */ .space 0x60 @@ -137,40 +140,15 @@ gUnknown_203B200: /* 203B200 */ .space 0x4 .include "src/felicity_bank.o" -.include "src/kangaskhan_storage.o" - -gKecleonBrosWork: /* 203B210 */ - .space 0x4 - -gUnknown_203B214: /* 203B214 */ - .space 0x4 - -gUnknown_203B218: /* 203B218 */ - .space 0x4 - -gUnknown_203B21C: /* 203B21C */ - .space 0x4 - -gUnknown_203B220: /* 203B220 */ - .space 0x4 - -gUnknown_203B224: /* 203B224 */ - .space 0x4 - -gUnknown_203B228: /* 203B228 */ - .space 0x2 - -gUnknown_203B22A: /* 203B22A */ - .space 0x2 - -gUnknown_203B22C: /* 203B22C */ - .space 0x4 - -gUnknown_203B230: /* 203B230 */ - .space 0x4 - -gUnknown_203B234: /* 203B234 */ - .space 0x4 +.include "src/kangaskhan_storage1.o" +.include "src/kangaskhan_storage2.o" +.include "src/kecleon_bros1.o" +.include "src/kecleon_bros2.o" +.include "src/kecleon_bros3.o" +.include "src/kecleon_bros4.o" +.include "src/code_801AFA4.o" +.include "src/code_801B3C0.o" +.include "src/code_801B60C.o" gUnknown_203B238: /* 203B238 */ .space 0x4 @@ -214,8 +192,7 @@ gUnknown_203B264: /* 203B264 */ gUnknown_203B268: /* 203B268 */ .space 0x4 -gGulpinShopWork: /* 203B26C */ - .space 0x4 +.include "src/gulpin_shop.o" gUnknown_203B270: /* 203B270 */ .space 0x4 @@ -226,8 +203,7 @@ gUnknown_203B274: /* 203B274 */ gUnknown_203B278: /* 203B278 */ .space 0x4 -.include "src/gulpin_shop_1.o" - +.include "src/gulpin_shop_801FB50.o" .include "src/wigglytuff_shop.o" gUnknown_203B294: /* 203B294 */ @@ -261,91 +237,89 @@ gUnknown_203B2AC: /* 203B2AC */ .include "src/friend_list_menu.o" .include "src/party_list_menu.o" -gUnknown_203B2BC: /* 203B2BC */ +gUnknown_203B2BC: /* 203B2BC (friend_area_action_menu) */ .space 0x4 -gUnknown_203B2C0: /* 203B2C0 */ +gUnknown_203B2C0: /* 203B2C0 (wonder_mail) */ .space 0x4 -gUnknown_203B2C4: /* 203B2C4 */ +gUnknown_203B2C4: /* 203B2C4 (thank_you_wonder_mail) */ .space 0x4 -gUnknown_203B2C8: /* 203B2C8 */ +gUnknown_203B2C8: /* 203B2C8 (wonder_mail_2) */ .space 0x4 -gUnknown_203B2CC: /* 203B2CC */ +gUnknown_203B2CC: /* 203B2CC (pokemon_news) */ .space 0x4 -gUnknown_203B2D0: /* 203B2D0 */ +gUnknown_203B2D0: /* 203B2D0 (pokemon_news) */ .space 0x2 -gUnknown_203B2D2: /* 203B2D2 */ +gUnknown_203B2D2: /* 203B2D2 (pokemon_news) */ .space 0x2 -gUnknown_203B2D4: /* 203B2D4 */ +gUnknown_203B2D4: /* 203B2D4 (pokemon_news) */ .space 0x4 -gUnknown_203B2D8: /* 203B2D8 */ +gUnknown_203B2D8: /* 203B2D8 (pokemon_news / wonder_mail_2_mid) */ .space 0x4 -gUnknown_203B2DC: /* 203B2DC */ +gUnknown_203B2DC: /* 203B2DC (pokemon_news) */ .space 0x4 -gUnknown_203B2E0: /* 203B2E0 */ +gUnknown_203B2E0: /* 203B2E0 (wonder_mail_2_1 / wonder_mail_2_mid) */ .space 0x4 -gUnknown_203B2E4: /* 203B2E4 */ +gUnknown_203B2E4: /* 203B2E4 (wonder_mail_2_mid) */ .space 0x4 -gUnknown_203B2E8: /* 203B2E8 */ +gUnknown_203B2E8: /* 203B2E8 (wonder_mail_2_1) */ .space 0x4 -gUnknown_203B2EC: /* 203B2EC */ +gUnknown_203B2EC: /* 203B2EC (wonder_mail_2_1) */ .space 0x4 -gUnknown_203B2F0: /* 203B2F0 */ +gUnknown_203B2F0: /* 203B2F0 (wonder_mail_2_1 / wonder_mail_3) */ .space 0x4 -gUnknown_203B2F4: /* 203B2F4 */ +gUnknown_203B2F4: /* 203B2F4 (wonder_mail_4) */ .space 0x4 -gUnknown_203B2F8: /* 203B2F8 */ +gUnknown_203B2F8: /* 203B2F8 (wonder_mail_3) */ .space 0x4 -gUnknown_203B2FC: /* 203B2FC */ +gUnknown_203B2FC: /* 203B2FC (wonder_mail_802DF88) */ .space 0x4 -gUnknown_203B300: /* 203B300 */ +gUnknown_203B300: /* 203B300 (wonder_mail_802DF88) */ .space 0x4 .include "src/mailbox.o" .include "src/pelipper_board.o" -gUnknown_203B30C: /* 203B30C */ +gUnknown_203B30C: /* 203B30C (wonder_mail_3_mid) */ .space 0x4 -gUnknown_203B310: /* 203B310 */ +gUnknown_203B310: /* 203B310 (wonder_mail_3_mid) */ .space 0x4 -gUnknown_203B314: /* 203B314 */ +gUnknown_203B314: /* 203B314 (wonder_mail_3_mid) */ .space 0x4 -gUnknown_203B318: /* 203B318 */ +.include "src/makuhita_dojo1.o" +.include "src/makuhita_dojo2.o" + +gUnknown_203B320: /* 203B320 (wonder_mail_4) */ .space 0x4 -gUnknown_203B31C: /* 203B31C */ +gUnknown_203B324: /* 203B324 (wonder_mail_5) */ .space 0x4 -gUnknown_203B320: /* 203B320 */ +gUnknown_203B328: /* 203B328 (wonder_mail_6) */ .space 0x4 -gUnknown_203B324: /* 203B324 */ - .space 0x4 - -gUnknown_203B328: /* 203B328 */ - .space 0x4 - -.include "src/post_office_guide.o" +.include "src/post_office_guide1.o" +.include "src/post_office_guide2.o" .include "src/code_8031D70.o" .include "src/adventure_log.o" .include "src/friend_rescue.o" @@ -363,13 +337,12 @@ gUnknown_203B328: /* 203B328 */ .include "src/debug_menu3.o" .include "src/debug_menu4.o" -gUnknown_203B3FC: /* 203B3FC */ +gUnknown_203B3FC: /* 203B3FC (code_803B050) */ .space 0x4 - .include "src/personality_test.o" - -gUnknown_203B408: /* 203B408 */ - .space 0x4 +.include "src/personality_test.o" +.include "src/code_803D0D8.o" + .space 0x3 gUnknown_203B40C: /* 203B40C */ .space 0x1 diff --git a/sym_iwram.txt b/sym_iwram.txt index f415157eb..9abe20dbc 100644 --- a/sym_iwram.txt +++ b/sym_iwram.txt @@ -17,8 +17,7 @@ gUnknown_3001018: /* 3001018 */ gUnknown_3001198: /* 3001198 */ .space 0x9C0 -alt_3001B58: - +iwramClearEnd: unk_code_ram: /* 3001B58 */ gUnknown_3001B58: /* 3001B58 */