From f06c0749bcebc10fe146ca038a6a8597952a0f21 Mon Sep 17 00:00:00 2001 From: shinny456 Date: Sat, 19 Jan 2019 12:14:59 -0500 Subject: [PATCH] trainer_card up to sub_80C4998 --- asm/trainer_card.s | 3356 ---------------------------------------- include/trainer_card.h | 22 +- src/pokedex.c | 2 +- src/trainer_card.c | 1626 ++++++++++++++++++- 4 files changed, 1626 insertions(+), 3380 deletions(-) diff --git a/asm/trainer_card.s b/asm/trainer_card.s index 090b396ce2..e78b2fec21 100644 --- a/asm/trainer_card.s +++ b/asm/trainer_card.s @@ -6,3362 +6,6 @@ .text - thumb_func_start sub_80C2C80 -sub_80C2C80: @ 80C2C80 - push {lr} - sub sp, 0x8 - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r1, r2 - ldrb r0, [r0] - adds r3, r1, 0 - cmp r0, 0xA - bls _080C2C96 - b _080C2DD8 -_080C2C96: - lsls r0, 2 - ldr r1, =_080C2CA8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C2CA8: - .4byte _080C2CD4 - .4byte _080C2CEC - .4byte _080C2D14 - .4byte _080C2D50 - .4byte _080C2D6A - .4byte _080C2D74 - .4byte _080C2D88 - .4byte _080C2D8E - .4byte _080C2DA0 - .4byte _080C2DA6 - .4byte _080C2DB8 -_080C2CD4: - bl sub_80C334C - bl sub_80C3414 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _080C2DCC - .pool -_080C2CEC: - movs r1, 0xE0 - lsls r1, 19 - movs r0, 0 - str r0, [sp] - ldr r0, =0x040000d4 - mov r2, sp - str r2, [r0] - str r1, [r0, 0x4] - ldr r1, =0x85000100 - str r1, [r0, 0x8] - ldr r0, [r0, 0x8] - movs r0, 0x87 - lsls r0, 3 - adds r1, r3, r0 - b _080C2DCC - .pool -_080C2D14: - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldr r1, =0x0000052c - adds r0, r1 - ldrh r0, [r0] - cmp r0, 0 - bne _080C2D36 - movs r2, 0xA0 - lsls r2, 19 - add r1, sp, 0x4 - strh r0, [r1] - ldr r0, =0x040000d4 - str r1, [r0] - str r2, [r0, 0x4] - ldr r1, =0x81000200 - str r1, [r0, 0x8] - ldr r0, [r0, 0x8] -_080C2D36: - movs r2, 0x87 - lsls r2, 3 - adds r1, r3, r2 - b _080C2DCC - .pool -_080C2D50: - bl ResetSpriteData - bl FreeAllSpritePalettes - bl ResetPaletteFade - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080C2D6A: - bl sub_80C3388 - b _080C2DC4 - .pool -_080C2D74: - bl sub_80C41D8 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _080C2DCC - .pool -_080C2D88: - bl sub_80C2AD8 - b _080C2DBC -_080C2D8E: - bl sub_80C4330 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _080C2DCC - .pool -_080C2DA0: - bl sub_80C3278 - b _080C2DC4 -_080C2DA6: - bl sub_80C3548 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _080C2DCC - .pool -_080C2DB8: - bl sub_80C43A8 -_080C2DBC: - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - bne _080C2DDC -_080C2DC4: - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 -_080C2DCC: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080C2DDC - .pool -_080C2DD8: - bl sub_80C3404 -_080C2DDC: - add sp, 0x8 - pop {r0} - bx r0 - thumb_func_end sub_80C2C80 - - thumb_func_start sav12_xor_get_clamped_above -sav12_xor_get_clamped_above: @ 80C2DE4 - push {r4,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r0, 24 - bl GetGameStat - cmp r0, r4 - bls _080C2DF6 - adds r0, r4, 0 -_080C2DF6: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sav12_xor_get_clamped_above - - thumb_func_start sub_80C2DFC -sub_80C2DFC: @ 80C2DFC - push {r4,r5,lr} - movs r5, 0 -_080C2E00: - lsls r4, r5, 1 - ldr r1, =0x000008c4 - adds r0, r4, r1 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _080C2E1E - ldr r1, =0x000008c5 - adds r0, r4, r1 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - bne _080C2E2C -_080C2E1E: - movs r0, 0 - b _080C2E38 - .pool -_080C2E2C: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x6 - bls _080C2E00 - movs r0, 0x1 -_080C2E38: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_80C2DFC - - thumb_func_start sub_80C2E40 -sub_80C2E40: @ 80C2E40 - push {r4,lr} - movs r0, 0xA - bl GetGameStat - negs r1, r0 - orrs r1, r0 - lsrs r4, r1, 31 - bl sub_80C08E4 - lsls r0, 16 - cmp r0, 0 - beq _080C2E5A - adds r4, 0x1 -_080C2E5A: - bl sub_80F8940 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bls _080C2E6C - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 -_080C2E6C: - bl sub_80C2DFC - lsls r0, 24 - cmp r0, 0 - beq _080C2E7C - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 -_080C2E7C: - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80C2E40 - - thumb_func_start sub_80C2E84 -sub_80C2E84: @ 80C2E84 - push {lr} - adds r1, r0, 0 - movs r2, 0 - ldrh r0, [r1, 0x6] - cmp r0, 0 - bne _080C2E96 - ldr r0, [r1, 0x8] - cmp r0, 0 - beq _080C2E98 -_080C2E96: - movs r2, 0x1 -_080C2E98: - ldrb r0, [r1, 0x3] - cmp r0, 0 - beq _080C2EA4 - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 -_080C2EA4: - ldrh r0, [r1, 0x1A] - cmp r0, 0x31 - bls _080C2EB0 - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 -_080C2EB0: - ldrb r0, [r1, 0x4] - cmp r0, 0 - beq _080C2EBC - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 -_080C2EBC: - adds r0, r2, 0 - pop {r1} - bx r1 - thumb_func_end sub_80C2E84 - - thumb_func_start sub_80C2EC4 -sub_80C2EC4: @ 80C2EC4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r5, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - ldr r6, =gSaveBlock2Ptr - ldr r1, [r6] - ldrb r0, [r1, 0x8] - strb r0, [r5] - ldrh r0, [r1, 0xE] - strh r0, [r5, 0x10] - ldrb r0, [r1, 0x10] - strh r0, [r5, 0x12] - movs r0, 0x1 - bl GetGameStat - adds r4, r0, 0 - movs r0, 0xA - bl GetGameStat - cmp r0, 0 - bne _080C2EF6 - movs r4, 0 -_080C2EF6: - lsrs r0, r4, 16 - strh r0, [r5, 0x6] - lsrs r1, r4, 8 - movs r2, 0xFF - ands r1, r2 - strh r1, [r5, 0x8] - ands r4, r2 - strh r4, [r5, 0xA] - ldr r1, =0x000003e7 - cmp r0, r1 - bls _080C2F14 - strh r1, [r5, 0x6] - movs r0, 0x3B - strh r0, [r5, 0x8] - strh r0, [r5, 0xA] -_080C2F14: - ldr r0, =0x00000861 - bl FlagGet - strb r0, [r5, 0x2] - bl sub_80C08E4 - strb r0, [r5, 0x3] - bl sub_80C376C - strh r0, [r5, 0xC] - ldr r0, [r6] - ldrb r1, [r0, 0xB] - lsls r1, 8 - ldrb r0, [r0, 0xA] - orrs r0, r1 - strh r0, [r5, 0xE] - ldr r4, =0x0000270f - movs r0, 0x17 - adds r1, r4, 0 - bl sav12_xor_get_clamped_above - strh r0, [r5, 0x14] - movs r0, 0x18 - adds r1, r4, 0 - bl sav12_xor_get_clamped_above - strh r0, [r5, 0x16] - ldr r1, =0x0000ffff - movs r0, 0x15 - bl sav12_xor_get_clamped_above - strh r0, [r5, 0x20] - ldr r4, =gSaveBlock1Ptr - ldr r0, [r4] - movs r1, 0x92 - lsls r1, 3 - adds r0, r1 - bl GetMoney - str r0, [r5, 0x24] - movs r2, 0 - adds r7, r5, 0 - adds r7, 0x30 - adds r6, r5, 0 - adds r6, 0x28 - ldr r0, [r4] - ldr r1, =0x00002bb0 - adds r3, r0, r1 -_080C2F74: - lsls r0, r2, 1 - adds r1, r6, r0 - adds r0, r3, r0 - ldrh r0, [r0] - strh r0, [r1] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _080C2F74 - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - adds r0, r7, 0 - bl StringCopy - mov r0, r8 - cmp r0, 0x1 - beq _080C3004 - cmp r0, 0x1 - bgt _080C2FC0 - cmp r0, 0 - beq _080C2FCC - b _080C3014 - .pool -_080C2FC0: - mov r1, r8 - cmp r1, 0x2 - bne _080C3014 - movs r0, 0 - strh r0, [r5, 0x18] - strh r0, [r5, 0x1A] -_080C2FCC: - ldr r1, =0x000003e7 - movs r0, 0x23 - bl sav12_xor_get_clamped_above - strh r0, [r5, 0x1C] - ldr r1, =0x0000ffff - movs r0, 0x22 - bl sav12_xor_get_clamped_above - strh r0, [r5, 0x1E] - bl sub_80F8940 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bls _080C2FF0 - movs r0, 0x1 - strb r0, [r5, 0x4] -_080C2FF0: - adds r0, r5, 0 - bl sub_80C2E84 - strb r0, [r5, 0x1] - b _080C3014 - .pool -_080C3004: - movs r1, 0 - movs r0, 0 - strh r0, [r5, 0x18] - strh r0, [r5, 0x1A] - strh r0, [r5, 0x1C] - strh r0, [r5, 0x1E] - strb r1, [r5, 0x4] - strb r1, [r5, 0x1] -_080C3014: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80C2EC4 - - thumb_func_start sub_80C3020 -sub_80C3020: @ 80C3020 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0 - movs r2, 0x64 - bl memset - adds r1, r4, 0 - adds r1, 0x38 - movs r0, 0x3 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2 - bl sub_80C2EC4 - bl sub_80C2DFC - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - adds r1, 0x60 - strh r0, [r1] - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldr r2, =0x00000eba - adds r0, r2 - ldrh r0, [r0] - adds r2, r4, 0 - adds r2, 0x62 - strh r0, [r2] - ldrh r0, [r1] - cmp r0, 0 - beq _080C3066 - ldrb r0, [r4, 0x1] - adds r0, 0x1 - strb r0, [r4, 0x1] -_080C3066: - ldrb r0, [r4] - cmp r0, 0x1 - bne _080C3084 - ldr r2, =gUnknown_08329D54 - ldrh r0, [r4, 0xE] - movs r1, 0x7 - ands r0, r1 - adds r0, 0x8 - b _080C308C - .pool -_080C3084: - ldr r2, =gUnknown_08329D54 - ldrh r0, [r4, 0xE] - movs r1, 0x7 - ands r0, r1 -_080C308C: - lsls r0, 1 - adds r0, r2 - ldrh r1, [r0] - adds r0, r4, 0 - adds r0, 0x4F - strb r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3020 - - thumb_func_start TrainerCard_GenerateCardForPlayer -TrainerCard_GenerateCardForPlayer: @ 80C30A4 - push {r4,lr} - adds r4, r0, 0 - movs r1, 0 - movs r2, 0x60 - bl memset - adds r1, r4, 0 - adds r1, 0x38 - movs r0, 0x3 - strb r0, [r1] - adds r0, r4, 0 - movs r1, 0x2 - bl sub_80C2EC4 - bl sub_80C2DFC - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x3A] - ldr r1, =gSaveBlock2Ptr - ldr r1, [r1] - ldr r2, =0x00000eba - adds r1, r2 - ldrh r1, [r1] - strh r1, [r4, 0x3C] - cmp r0, 0 - beq _080C30E0 - ldrb r0, [r4, 0x1] - adds r0, 0x1 - strb r0, [r4, 0x1] -_080C30E0: - ldrb r0, [r4] - cmp r0, 0x1 - bne _080C3100 - ldr r2, =gUnknown_08329D54 - ldrh r0, [r4, 0xE] - movs r1, 0x7 - ands r0, r1 - adds r0, 0x8 - b _080C3108 - .pool -_080C3100: - ldr r2, =gUnknown_08329D54 - ldrh r0, [r4, 0xE] - movs r1, 0x7 - ands r0, r1 -_080C3108: - lsls r0, 1 - adds r0, r2 - ldrh r1, [r0] - adds r0, r4, 0 - adds r0, 0x4F - strb r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end TrainerCard_GenerateCardForPlayer - - thumb_func_start sub_80C3120 -sub_80C3120: @ 80C3120 - push {r4-r6,lr} - adds r5, r0, 0 - adds r6, r1, 0 - lsls r4, r2, 24 - lsrs r4, 24 - movs r1, 0 - movs r2, 0x64 - bl memset - adds r0, r5, 0 - adds r0, 0x38 - strb r4, [r0] - adds r0, r4, 0 - bl sub_80C4FCC - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x1 - beq _080C3162 - cmp r0, 0x1 - bgt _080C3150 - cmp r0, 0 - beq _080C3156 - b _080C318A -_080C3150: - cmp r0, 0x2 - beq _080C316E - b _080C318A -_080C3156: - adds r0, r5, 0 - adds r1, r6, 0 - movs r2, 0x60 - bl memcpy - b _080C318A -_080C3162: - adds r0, r5, 0 - adds r1, r6, 0 - movs r2, 0x38 - bl memcpy - b _080C318A -_080C316E: - adds r0, r5, 0 - adds r1, r6, 0 - movs r2, 0x60 - bl memcpy - movs r0, 0 - str r0, [r5, 0x3C] - ldrh r1, [r6, 0x3A] - adds r0, r5, 0 - adds r0, 0x60 - strh r1, [r0] - ldrh r1, [r6, 0x3C] - adds r0, 0x2 - strh r1, [r0] -_080C318A: - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80C3120 - - thumb_func_start sub_80C3190 -sub_80C3190: @ 80C3190 - push {r4,r5,lr} - ldr r4, =gUnknown_02039CE8 - ldr r0, [r4] - movs r1, 0 - strb r1, [r0, 0xA] - ldr r0, [r4] - strb r1, [r0, 0xB] - ldr r0, [r4] - strb r1, [r0, 0xC] - ldr r0, [r4] - strb r1, [r0, 0xD] - ldr r0, [r4] - strb r1, [r0, 0xE] - ldr r0, [r4] - strb r1, [r0, 0xF] - ldr r0, [r4] - strb r1, [r0, 0x10] - ldr r0, [r4] - adds r0, 0x11 - movs r2, 0x8 - bl memset - ldr r1, [r4] - ldr r2, =0x00000536 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080C31CE - ldrb r0, [r1, 0xA] - adds r0, 0x1 - strb r0, [r1, 0xA] -_080C31CE: - ldr r1, [r4] - ldr r3, =0x0000053a - adds r0, r1, r3 - ldrh r0, [r0] - cmp r0, 0 - bne _080C31E4 - ldr r2, =0x0000053c - adds r0, r1, r2 - ldr r0, [r0] - cmp r0, 0 - beq _080C31EA -_080C31E4: - ldrb r0, [r1, 0xB] - adds r0, 0x1 - strb r0, [r1, 0xB] -_080C31EA: - ldr r2, =gUnknown_02039CE8 - ldr r1, [r2] - movs r3, 0xA9 - lsls r3, 3 - adds r0, r1, r3 - ldr r0, [r0] - cmp r0, 0 - beq _080C3200 - ldrb r0, [r1, 0xC] - adds r0, 0x1 - strb r0, [r1, 0xC] -_080C3200: - ldr r1, [r2] - ldr r3, =0x00000554 - adds r0, r1, r3 - ldrh r0, [r0] - cmp r0, 0 - beq _080C3212 - ldrb r0, [r1, 0x10] - adds r0, 0x1 - strb r0, [r1, 0x10] -_080C3212: - ldr r1, [r2] - ldr r2, =0x0000054c - adds r0, r1, r2 - ldr r0, [r0] - cmp r0, 0 - beq _080C3224 - ldrb r0, [r1, 0xD] - adds r0, 0x1 - strb r0, [r1, 0xD] -_080C3224: - movs r5, 0 - ldr r4, =0x00000867 -_080C3228: - lsls r0, r4, 16 - lsrs r0, 16 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _080C3244 - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - adds r1, 0x11 - adds r1, r5 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080C3244: - adds r4, 0x1 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =0x0000086e - cmp r4, r0 - bls _080C3228 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3190 - - thumb_func_start sub_80C3278 -sub_80C3278: @ 80C3278 - push {lr} - movs r1, 0xC1 - lsls r1, 6 - movs r0, 0 - bl SetGpuReg - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x3 - bl ShowBg - movs r0, 0x50 - movs r1, 0xC1 - bl SetGpuReg - movs r0, 0x54 - movs r1, 0 - bl SetGpuReg - movs r0, 0x48 - movs r1, 0x3F - bl SetGpuReg - movs r0, 0x4A - movs r1, 0x1E - bl SetGpuReg - movs r0, 0x44 - movs r1, 0xA0 - bl SetGpuReg - movs r0, 0x40 - movs r1, 0xF0 - bl SetGpuReg - ldr r0, =gReceivedRemoteLinkPlayers - ldrb r0, [r0] - cmp r0, 0 - beq _080C32E0 - movs r0, 0xC7 - bl EnableInterrupts - b _080C32E6 - .pool -_080C32E0: - movs r0, 0x3 - bl EnableInterrupts -_080C32E6: - pop {r0} - bx r0 - thumb_func_end sub_80C3278 - - thumb_func_start sub_80C32EC -sub_80C32EC: @ 80C32EC - push {r4,lr} - lsls r0, 16 - lsrs r0, 16 - adds r0, 0x28 - movs r1, 0xA - bl __divsi3 - lsls r0, 24 - lsrs r2, r0, 24 - asrs r0, 24 - cmp r0, 0x4 - bgt _080C3306 - movs r2, 0 -_080C3306: - ldr r4, =gUnknown_02039CE8 - ldr r0, [r4] - movs r1, 0xA5 - lsls r1, 3 - adds r0, r1 - strb r2, [r0] - ldr r0, [r4] - adds r0, r1 - movs r1, 0 - ldrsb r1, [r0, r1] - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x54 - bl SetGpuReg - ldr r0, [r4] - ldr r1, =0x00007ca8 - adds r0, r1 - ldrh r2, [r0] - lsls r1, r2, 8 - movs r0, 0xA0 - subs r0, r2 - orrs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x44 - bl SetGpuReg - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C32EC - - thumb_func_start sub_80C334C -sub_80C334C: @ 80C334C - push {lr} - movs r0, 0 - bl SetVBlankCallback - movs r0, 0 - bl SetHBlankCallback - movs r0, 0 - movs r1, 0 - bl SetGpuReg - movs r0, 0x8 - movs r1, 0 - bl SetGpuReg - movs r0, 0xA - movs r1, 0 - bl SetGpuReg - movs r0, 0xC - movs r1, 0 - bl SetGpuReg - movs r0, 0xE - movs r1, 0 - bl SetGpuReg - pop {r0} - bx r0 - thumb_func_end sub_80C334C - - thumb_func_start sub_80C3388 -sub_80C3388: @ 80C3388 - push {lr} - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_0856FAB4 - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - ldr r0, =gUnknown_0856FAC4 - bl InitWindows - bl DeactivateAllTextPrinters - bl sub_81973A4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3388 - - thumb_func_start sub_80C3404 -sub_80C3404: @ 80C3404 - push {lr} - ldr r0, =sub_80C2710 - bl SetMainCallback2 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3404 - - thumb_func_start sub_80C3414 -sub_80C3414: @ 80C3414 - push {lr} - bl ResetTasks - bl ScanlineEffect_Stop - ldr r0, =sub_80C2760 - movs r1, 0 - bl CreateTask - bl sub_80C4EE4 - bl sub_80C3190 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3414 - - thumb_func_start sub_80C3438 -sub_80C3438: @ 80C3438 - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldrb r0, [r1, 0x1] - cmp r0, 0x5 - bhi _080C3494 - lsls r0, 2 - ldr r1, =_080C3458 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C3458: - .4byte _080C3470 - .4byte _080C3476 - .4byte _080C347C - .4byte _080C3482 - .4byte _080C3488 - .4byte _080C348E -_080C3470: - bl sub_80C3574 - b _080C349C -_080C3476: - bl sub_80C3608 - b _080C349C -_080C347C: - bl sub_80C3684 - b _080C349C -_080C3482: - bl sub_80C378C - b _080C349C -_080C3488: - bl sub_80C3880 - b _080C349C -_080C348E: - bl sub_80C3A18 - b _080C349C -_080C3494: - movs r0, 0 - strb r0, [r1, 0x1] - movs r0, 0x1 - b _080C34A8 -_080C349C: - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldrb r0, [r1, 0x1] - adds r0, 0x1 - strb r0, [r1, 0x1] - movs r0, 0 -_080C34A8: - pop {r1} - bx r1 - .pool - thumb_func_end sub_80C3438 - - thumb_func_start sub_80C34B0 -sub_80C34B0: @ 80C34B0 - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldrb r0, [r1, 0x1] - cmp r0, 0x7 - bhi _080C352C - lsls r0, 2 - ldr r1, =_080C34D0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C34D0: - .4byte _080C34F0 - .4byte _080C34F6 - .4byte _080C34FC - .4byte _080C3502 - .4byte _080C3508 - .4byte _080C3512 - .4byte _080C351C - .4byte _080C3526 -_080C34F0: - bl sub_80C3B50 - b _080C3534 -_080C34F6: - bl sub_80C3CCC - b _080C3534 -_080C34FC: - bl sub_80C3D60 - b _080C3534 -_080C3502: - bl sub_80C3DF0 - b _080C3534 -_080C3508: - bl sub_80C3E58 - bl sub_80C3F64 - b _080C3534 -_080C3512: - bl sub_80C3ED4 - bl sub_80C3FE0 - b _080C3534 -_080C351C: - bl sub_80C4140 - bl sub_80C40CC - b _080C3534 -_080C3526: - bl sub_80C42A4 - b _080C3534 -_080C352C: - movs r0, 0 - strb r0, [r1, 0x1] - movs r0, 0x1 - b _080C3540 -_080C3534: - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldrb r0, [r1, 0x1] - adds r0, 0x1 - strb r0, [r1, 0x1] - movs r0, 0 -_080C3540: - pop {r1} - bx r1 - .pool - thumb_func_end sub_80C34B0 - - thumb_func_start sub_80C3548 -sub_80C3548: @ 80C3548 - push {lr} - bl sub_80C3AF0 - bl sub_80C3BC4 - bl sub_80C3CF4 - bl sub_80C3DC0 - bl sub_80C3E20 - bl sub_80C3E98 - bl sub_80C3F14 - bl sub_80C3FA4 - bl sub_80C4020 - pop {r0} - bx r0 - thumb_func_end sub_80C3548 - - thumb_func_start sub_80C3574 -sub_80C3574: @ 80C3574 - push {r4,r5,lr} - sub sp, 0x2C - ldr r1, =gText_TrainerCardName - add r0, sp, 0xC - bl StringCopy - adds r5, r0, 0 - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - ldr r0, =0x00000564 - adds r1, r0 - adds r0, r5, 0 - bl StringCopy - ldr r0, [r4] - ldr r1, =0x00007caa - adds r0, r1 - ldrb r1, [r0] - adds r0, r5, 0 - bl ConvertInternationalString - ldr r0, [r4] - ldr r1, =0x0000052a - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080C35E0 - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - add r0, sp, 0xC - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x14 - movs r3, 0x1C - bl AddTextPrinterParameterized3 - b _080C35FA - .pool -_080C35E0: - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - add r1, sp, 0xC - str r1, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x10 - movs r3, 0x21 - bl AddTextPrinterParameterized3 -_080C35FA: - add sp, 0x2C - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3574 - - thumb_func_start sub_80C3608 -sub_80C3608: @ 80C3608 - push {r4,lr} - sub sp, 0x2C - ldr r1, =gText_TrainerCardIDNo - add r0, sp, 0xC - bl StringCopy - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - ldr r2, =0x00000542 - adds r1, r2 - ldrh r1, [r1] - movs r2, 0x2 - movs r3, 0x5 - bl ConvertIntToDecimalStringN - ldr r0, [r4] - ldr r1, =0x0000052a - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080C3650 - movs r0, 0x1 - add r1, sp, 0xC - movs r2, 0x50 - bl GetStringCenterAlignXOffset - adds r0, 0x84 - b _080C365C - .pool -_080C3650: - movs r0, 0x1 - add r1, sp, 0xC - movs r2, 0x60 - bl GetStringCenterAlignXOffset - adds r0, 0x78 -_080C365C: - movs r3, 0x9 - lsls r2, r0, 24 - lsrs r2, 24 - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - add r0, sp, 0xC - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - bl AddTextPrinterParameterized3 - add sp, 0x2C - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3608 - - thumb_func_start sub_80C3684 -sub_80C3684: @ 80C3684 - push {r4,r5,lr} - sub sp, 0xC - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldr r1, =0x0000052b - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080C36C4 - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - ldr r0, =gText_TrainerCardMoney - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x14 - movs r3, 0x38 - bl AddTextPrinterParameterized3 - b _080C36DE - .pool -_080C36C4: - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - ldr r0, =gText_TrainerCardMoney - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x10 - movs r3, 0x39 - bl AddTextPrinterParameterized3 -_080C36DE: - ldr r0, =gStringVar1 - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - movs r2, 0xAB - lsls r2, 3 - adds r1, r2 - ldr r1, [r1] - movs r2, 0 - movs r3, 0x6 - bl ConvertIntToDecimalStringN - ldr r5, =gStringVar4 - ldr r1, =gText_PokedollarVar1 - adds r0, r5, 0 - bl StringExpandPlaceholders - ldr r0, [r4] - ldr r1, =0x0000052b - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080C3734 - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x90 - bl GetStringRightAlignXOffset - movs r3, 0x38 - b _080C3740 - .pool -_080C3734: - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x80 - bl GetStringRightAlignXOffset - movs r3, 0x39 -_080C3740: - lsls r2, r0, 24 - lsrs r2, 24 - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - ldr r0, =gStringVar4 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - bl AddTextPrinterParameterized3 - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3684 - - thumb_func_start sub_80C376C -sub_80C376C: @ 80C376C - push {lr} - bl IsNationalPokedexEnabled - cmp r0, 0 - bne _080C377E - movs r0, 0x1 - bl GetHoennPokedexCount - b _080C3784 -_080C377E: - movs r0, 0x1 - bl GetNationalPokedexCount -_080C3784: - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end sub_80C376C - - thumb_func_start sub_80C378C -sub_80C378C: @ 80C378C - push {r4,r5,lr} - sub sp, 0xC - ldr r0, =0x00000861 - bl FlagGet - lsls r0, 24 - cmp r0, 0 - beq _080C386E - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldr r1, =0x0000052b - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080C37DC - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - ldr r0, =gText_TrainerCardPokedex - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x14 - movs r3, 0x48 - bl AddTextPrinterParameterized3 - b _080C37F6 - .pool -_080C37DC: - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - ldr r0, =gText_TrainerCardPokedex - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x10 - movs r3, 0x49 - bl AddTextPrinterParameterized3 -_080C37F6: - ldr r5, =gStringVar4 - ldr r4, =gUnknown_02039CE8 - ldr r0, [r4] - movs r1, 0xA8 - lsls r1, 3 - adds r0, r1 - ldrh r1, [r0] - adds r0, r5, 0 - movs r2, 0 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r1, =gText_EmptyString6 - bl StringCopy - ldr r0, [r4] - ldr r1, =0x0000052b - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080C3848 - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x90 - bl GetStringRightAlignXOffset - movs r3, 0x48 - b _080C3854 - .pool -_080C3848: - movs r0, 0x1 - adds r1, r5, 0 - movs r2, 0x80 - bl GetStringRightAlignXOffset - movs r3, 0x49 -_080C3854: - lsls r2, r0, 24 - lsrs r2, 24 - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - ldr r0, =gStringVar4 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - bl AddTextPrinterParameterized3 -_080C386E: - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C378C - - thumb_func_start sub_80C3880 -sub_80C3880: @ 80C3880 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldr r1, =0x0000052b - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080C38C8 - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - ldr r0, =gText_TrainerCardTime - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x14 - movs r3, 0x58 - bl AddTextPrinterParameterized3 - b _080C38E2 - .pool -_080C38C8: - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - ldr r0, =gText_TrainerCardTime - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x10 - movs r3, 0x59 - bl AddTextPrinterParameterized3 -_080C38E2: - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldrb r0, [r1, 0x5] - cmp r0, 0 - beq _080C390C - ldr r2, =0x00000544 - adds r0, r1, r2 - ldrh r5, [r0] - adds r2, 0x2 - adds r0, r1, r2 - ldrh r6, [r0] - b _080C3914 - .pool -_080C390C: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrh r5, [r0, 0xE] - ldrb r6, [r0, 0x10] -_080C3914: - ldr r0, =0x000003e7 - cmp r5, r0 - bls _080C391C - adds r5, r0, 0 -_080C391C: - cmp r6, 0x3B - bls _080C3922 - movs r6, 0x3B -_080C3922: - ldr r1, =gText_Colon2 - movs r0, 0x1 - movs r2, 0 - bl GetStringWidth - mov r10, r0 - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldr r1, =0x0000052b - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080C3958 - movs r7, 0x90 - movs r4, 0x58 - b _080C395C - .pool -_080C3958: - movs r7, 0x80 - movs r4, 0x59 -_080C395C: - mov r0, r10 - adds r0, 0x1E - subs r7, r0 - lsls r2, r7, 16 - lsrs r2, 16 - lsls r0, 16 - lsrs r0, 16 - str r0, [sp] - movs r0, 0xF - str r0, [sp, 0x4] - movs r0, 0x1 - movs r1, 0 - adds r3, r4, 0 - bl FillWindowPixelRect - ldr r2, =gStringVar4 - mov r9, r2 - mov r0, r9 - adds r1, r5, 0 - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - lsls r2, r7, 24 - lsrs r2, 24 - ldr r0, =gUnknown_0856FB0C - mov r8, r0 - str r0, [sp] - movs r5, 0x1 - negs r5, r5 - str r5, [sp, 0x4] - mov r1, r9 - str r1, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - adds r3, r4, 0 - bl AddTextPrinterParameterized3 - adds r7, 0x12 - lsls r2, r7, 24 - lsrs r2, 24 - ldr r1, =gUnknown_0856FB40 - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldrb r0, [r0, 0x7] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - str r0, [sp] - str r5, [sp, 0x4] - ldr r0, =gText_Colon2 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - adds r3, r4, 0 - bl AddTextPrinterParameterized3 - add r7, r10 - mov r0, r9 - adds r1, r6, 0 - movs r2, 0x2 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - lsls r2, r7, 24 - lsrs r2, 24 - mov r0, r8 - str r0, [sp] - str r5, [sp, 0x4] - mov r1, r9 - str r1, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - adds r3, r4, 0 - bl AddTextPrinterParameterized3 - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3880 - - thumb_func_start sub_80C3A18 -sub_80C3A18: @ 80C3A18 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - ldr r7, =gUnknown_02039CE8 - ldr r1, [r7] - ldrb r0, [r1, 0x5] - cmp r0, 0 - beq _080C3ACE - ldr r0, =gUnknown_0856FB48 - mov r8, r0 - ldr r4, =0x0000052b - adds r0, r1, r4 - ldrb r0, [r0] - add r0, r8 - ldrb r3, [r0] - ldr r6, =gUnknown_0856FB0C - str r6, [sp] - movs r5, 0x1 - negs r5, r5 - str r5, [sp, 0x4] - adds r0, r1, 0 - adds r0, 0x19 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x8 - bl AddTextPrinterParameterized3 - ldr r1, [r7] - adds r1, 0x19 - movs r0, 0x1 - movs r2, 0 - bl GetStringWidth - adds r2, r0, 0 - adds r2, 0xE - lsls r2, 24 - lsrs r2, 24 - ldr r1, [r7] - adds r0, r1, r4 - ldrb r0, [r0] - add r0, r8 - ldrb r3, [r0] - str r6, [sp] - str r5, [sp, 0x4] - adds r1, 0x26 - str r1, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - bl AddTextPrinterParameterized3 - ldr r0, =gUnknown_0856FB4A - mov r8, r0 - ldr r1, [r7] - adds r0, r1, r4 - ldrb r0, [r0] - add r0, r8 - ldrb r3, [r0] - str r6, [sp] - str r5, [sp, 0x4] - adds r1, 0x33 - str r1, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x8 - bl AddTextPrinterParameterized3 - ldr r1, [r7] - adds r1, 0x33 - movs r0, 0x1 - movs r2, 0 - bl GetStringWidth - adds r2, r0, 0 - adds r2, 0xE - lsls r2, 24 - lsrs r2, 24 - ldr r1, [r7] - adds r4, r1, r4 - ldrb r0, [r4] - add r0, r8 - ldrb r3, [r0] - str r6, [sp] - str r5, [sp, 0x4] - adds r1, 0x40 - str r1, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - bl AddTextPrinterParameterized3 -_080C3ACE: - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3A18 - - thumb_func_start sub_80C3AF0 -sub_80C3AF0: @ 80C3AF0 - push {r4,lr} - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - adds r0, r1, 0 - adds r0, 0x4D - ldr r2, =0x00000564 - adds r1, r2 - bl StringCopy - ldr r1, [r4] - adds r0, r1, 0 - adds r0, 0x4D - ldr r2, =0x00007caa - adds r1, r2 - ldrb r1, [r1] - bl ConvertInternationalString - ldr r1, [r4] - ldr r2, =0x0000052a - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080C3B30 - ldr r0, =gStringVar1 - adds r1, 0x4D - bl StringCopy - ldr r0, [r4] - adds r0, 0x4D - ldr r1, =gText_Var1sTrainerCard - bl StringExpandPlaceholders -_080C3B30: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3AF0 - - thumb_func_start sub_80C3B50 -sub_80C3B50: @ 80C3B50 - push {r4,lr} - sub sp, 0xC - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - ldr r2, =0x0000052b - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080C3B8C - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - adds r0, r1, 0 - adds r0, 0x4D - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r2, 0x88 - movs r3, 0x9 - bl AddTextPrinterParameterized3 - b _080C3BB6 - .pool -_080C3B8C: - adds r1, 0x4D - movs r0, 0x1 - movs r2, 0xD8 - bl GetStringRightAlignXOffset - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - str r0, [sp, 0x4] - ldr r0, [r4] - adds r0, 0x4D - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r3, 0x9 - bl AddTextPrinterParameterized3 -_080C3BB6: - add sp, 0xC - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3B50 - - thumb_func_start sub_80C3BC4 -sub_80C3BC4: @ 80C3BC4 - push {r4,lr} - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - ldrb r0, [r1, 0xB] - cmp r0, 0 - beq _080C3C0E - ldr r0, =gStringVar1 - ldr r2, =0x0000053a - adds r1, r2 - ldrh r1, [r1] - movs r2, 0x1 - movs r3, 0x3 - bl ConvertIntToDecimalStringN - ldr r0, =gStringVar2 - ldr r1, [r4] - ldr r2, =0x0000053c - adds r1, r2 - ldrh r1, [r1] - movs r2, 0x2 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r0, =gStringVar3 - ldr r1, [r4] - ldr r2, =0x0000053e - adds r1, r2 - ldrh r1, [r1] - movs r2, 0x2 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r0, [r4] - adds r0, 0x93 - ldr r1, =gUnknown_0856FB4C - bl StringExpandPlaceholders -_080C3C0E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3BC4 - - thumb_func_start sub_80C3C34 -sub_80C3C34: @ 80C3C34 - push {r4-r6,lr} - mov r6, r10 - mov r5, r9 - mov r4, r8 - push {r4-r6} - sub sp, 0xC - adds r4, r0, 0 - mov r9, r2 - mov r10, r3 - ldr r2, =gUnknown_0856FB55 - ldr r6, =gUnknown_02039CE8 - ldr r0, [r6] - ldr r5, =0x0000052b - adds r0, r5 - ldrb r0, [r0] - adds r0, r2 - ldrb r2, [r0] - lsls r4, 28 - movs r0, 0x84 - lsls r0, 22 - adds r4, r0 - lsrs r4, 24 - ldr r0, =gUnknown_0856FB0C - str r0, [sp] - movs r0, 0x1 - negs r0, r0 - mov r8, r0 - str r0, [sp, 0x4] - str r1, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - adds r3, r4, 0 - bl AddTextPrinterParameterized3 - ldr r1, =gUnknown_0856FB57 - ldr r0, [r6] - adds r0, r5 - ldrb r0, [r0] - adds r0, r1 - ldrb r2, [r0] - movs r0, 0x1 - mov r1, r9 - bl GetStringRightAlignXOffset - adds r2, r0, 0 - lsls r2, 24 - lsrs r2, 24 - mov r0, r10 - str r0, [sp] - mov r0, r8 - str r0, [sp, 0x4] - mov r0, r9 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - adds r3, r4, 0 - bl AddTextPrinterParameterized3 - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3C34 - - thumb_func_start sub_80C3CCC -sub_80C3CCC: @ 80C3CCC - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r2, [r0] - ldrb r0, [r2, 0xB] - cmp r0, 0 - beq _080C3CE4 - ldr r1, =gText_HallOfFameDebut - adds r2, 0x93 - ldr r3, =gUnknown_0856FB0F - movs r0, 0 - bl sub_80C3C34 -_080C3CE4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3CCC - - thumb_func_start sub_80C3CF4 -sub_80C3CF4: @ 80C3CF4 - push {r4,lr} - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - ldrb r0, [r1, 0xC] - cmp r0, 0 - beq _080C3D40 - adds r0, r1, 0 - adds r0, 0xD9 - ldr r2, =gUnknown_0856FB5C - ldr r3, =0x0000052a - adds r1, r3 - ldrb r1, [r1] - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] - bl StringCopy - ldr r1, [r4] - ldr r2, =0x00000165 - adds r0, r1, r2 - movs r3, 0xA9 - lsls r3, 3 - adds r1, r3 - ldrh r1, [r1] - movs r2, 0 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - ldr r1, [r4] - ldr r2, =0x000001ab - adds r0, r1, r2 - ldr r3, =0x0000054a - adds r1, r3 - ldrh r1, [r1] - movs r2, 0 - movs r3, 0x4 - bl ConvertIntToDecimalStringN -_080C3D40: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3CF4 - - thumb_func_start sub_80C3D60 -sub_80C3D60: @ 80C3D60 - push {r4,r5,lr} - ldr r5, =gUnknown_02039CE8 - ldr r1, [r5] - ldrb r0, [r1, 0xC] - cmp r0, 0 - beq _080C3D9A - ldr r0, =gStringVar1 - ldr r2, =0x00000165 - adds r1, r2 - bl StringCopy - ldr r0, =gStringVar2 - ldr r1, [r5] - ldr r2, =0x000001ab - adds r1, r2 - bl StringCopy - ldr r4, =gStringVar4 - ldr r1, =gText_WinsLosses - adds r0, r4, 0 - bl StringExpandPlaceholders - ldr r1, [r5] - adds r1, 0xD9 - ldr r3, =gUnknown_0856FB0C - movs r0, 0x1 - adds r2, r4, 0 - bl sub_80C3C34 -_080C3D9A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3D60 - - thumb_func_start sub_80C3DC0 -sub_80C3DC0: @ 80C3DC0 - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldrb r0, [r1, 0x10] - cmp r0, 0 - beq _080C3DDE - ldr r2, =0x00000237 - adds r0, r1, r2 - ldr r2, =0x00000554 - adds r1, r2 - ldrh r1, [r1] - movs r2, 0x1 - movs r3, 0x5 - bl ConvertIntToDecimalStringN -_080C3DDE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3DC0 - - thumb_func_start sub_80C3DF0 -sub_80C3DF0: @ 80C3DF0 - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r2, [r0] - ldrb r0, [r2, 0x10] - cmp r0, 0 - beq _080C3E0A - ldr r1, =gText_PokemonTrades - ldr r0, =0x00000237 - adds r2, r0 - ldr r3, =gUnknown_0856FB0F - movs r0, 0x2 - bl sub_80C3C34 -_080C3E0A: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3DF0 - - thumb_func_start sub_80C3E20 -sub_80C3E20: @ 80C3E20 - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r2, [r0] - ldr r1, =0x0000052a - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080C3E48 - movs r3, 0xAE - lsls r3, 3 - adds r0, r2, r3 - ldr r1, [r0] - cmp r1, 0 - beq _080C3E48 - ldr r3, =0x000002c3 - adds r0, r2, r3 - movs r2, 0x1 - movs r3, 0x5 - bl ConvertIntToDecimalStringN -_080C3E48: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3E20 - - thumb_func_start sub_80C3E58 -sub_80C3E58: @ 80C3E58 - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r2, [r0] - ldr r1, =0x0000052a - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080C3E80 - adds r1, 0x46 - adds r0, r2, r1 - ldr r0, [r0] - cmp r0, 0 - beq _080C3E80 - ldr r1, =gText_BerryCrush - ldr r0, =0x000002c3 - adds r2, r0 - ldr r3, =gUnknown_0856FB0F - movs r0, 0x4 - bl sub_80C3C34 -_080C3E80: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3E58 - - thumb_func_start sub_80C3E98 -sub_80C3E98: @ 80C3E98 - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r2, [r0] - ldr r1, =0x0000052a - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080C3EBE - ldr r3, =0x00000574 - adds r0, r2, r3 - ldr r1, [r0] - cmp r1, 0 - beq _080C3EBE - ldr r3, =0x0000034f - adds r0, r2, r3 - movs r2, 0x1 - movs r3, 0x5 - bl ConvertIntToDecimalStringN -_080C3EBE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3E98 - - thumb_func_start sub_80C3ED4 -sub_80C3ED4: @ 80C3ED4 - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r2, [r0] - ldr r1, =0x0000052a - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080C3EFC - adds r1, 0x4A - adds r0, r2, r1 - ldr r0, [r0] - cmp r0, 0 - beq _080C3EFC - ldr r1, =gText_UnionTradesAndBattles - ldr r0, =0x0000034f - adds r2, r0 - ldr r3, =gUnknown_0856FB0F - movs r0, 0x3 - bl sub_80C3C34 -_080C3EFC: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3ED4 - - thumb_func_start sub_80C3F14 -sub_80C3F14: @ 80C3F14 - push {r4,lr} - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - ldr r2, =0x0000052a - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080C3F46 - ldr r0, =0x00000552 - adds r1, r0 - ldrh r0, [r1] - cmp r0, 0 - beq _080C3F46 - ldr r0, =gStringVar1 - ldrh r1, [r1] - movs r2, 0x1 - movs r3, 0x5 - bl ConvertIntToDecimalStringN - ldr r0, [r4] - ldr r1, =0x00000395 - adds r0, r1 - ldr r1, =gText_Var1DarkGreyShadowLightGrey - bl StringExpandPlaceholders -_080C3F46: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3F14 - - thumb_func_start sub_80C3F64 -sub_80C3F64: @ 80C3F64 - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r2, [r0] - ldr r1, =0x0000052a - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _080C3F8C - adds r1, 0x28 - adds r0, r2, r1 - ldrh r0, [r0] - cmp r0, 0 - beq _080C3F8C - ldr r1, =gText_PokeblocksWithFriends - ldr r0, =0x00000395 - adds r2, r0 - ldr r3, =gUnknown_0856FB0F - movs r0, 0x3 - bl sub_80C3C34 -_080C3F8C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3F64 - - thumb_func_start sub_80C3FA4 -sub_80C3FA4: @ 80C3FA4 - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldr r2, =0x0000052a - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - beq _080C3FCE - movs r3, 0xAA - lsls r3, 3 - adds r2, r1, r3 - ldrh r0, [r2] - cmp r0, 0 - beq _080C3FCE - ldr r3, =0x000003db - adds r0, r1, r3 - ldrh r1, [r2] - movs r2, 0x1 - movs r3, 0x5 - bl ConvertIntToDecimalStringN -_080C3FCE: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3FA4 - - thumb_func_start sub_80C3FE0 -sub_80C3FE0: @ 80C3FE0 - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r2, [r0] - ldr r1, =0x0000052a - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _080C4008 - adds r1, 0x26 - adds r0, r2, r1 - ldrh r0, [r0] - cmp r0, 0 - beq _080C4008 - ldr r1, =gText_WonContestsWFriends - ldr r0, =0x000003db - adds r2, r0 - ldr r3, =gUnknown_0856FB0F - movs r0, 0x4 - bl sub_80C3C34 -_080C4008: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C3FE0 - - thumb_func_start sub_80C4020 -sub_80C4020: @ 80C4020 - push {r4,lr} - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - ldr r2, =0x0000052a - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x1 - beq _080C4044 - cmp r0, 0x1 - ble _080C40B6 - cmp r0, 0x2 - beq _080C4094 - b _080C40B6 - .pool -_080C4044: - ldrb r0, [r1, 0xD] - cmp r0, 0 - beq _080C40B6 - ldr r0, =gStringVar1 - ldr r2, =0x0000054c - adds r1, r2 - ldrh r1, [r1] - movs r2, 0x1 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - ldr r0, =gStringVar2 - ldr r1, [r4] - ldr r2, =0x0000054e - adds r1, r2 - ldrh r1, [r1] - movs r2, 0x1 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - ldr r0, [r4] - ldr r1, =0x00000421 - adds r0, r1 - ldr r1, =gText_WSlashStraightSlash - bl StringExpandPlaceholders - b _080C40B6 - .pool -_080C4094: - ldr r2, =0x00000596 - adds r1, r2 - ldrh r0, [r1] - cmp r0, 0 - beq _080C40B6 - ldr r0, =gStringVar1 - ldrh r1, [r1] - movs r2, 0x1 - movs r3, 0x5 - bl ConvertIntToDecimalStringN - ldr r0, [r4] - ldr r1, =0x00000421 - adds r0, r1 - ldr r1, =gText_Var1DarkLightGreyBP - bl StringExpandPlaceholders -_080C40B6: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C4020 - - thumb_func_start sub_80C40CC -sub_80C40CC: @ 80C40CC - push {lr} - ldr r0, =gUnknown_02039CE8 - ldr r2, [r0] - ldr r1, =0x0000052a - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _080C40F0 - cmp r0, 0x1 - ble _080C412C - cmp r0, 0x2 - beq _080C4114 - b _080C412C - .pool -_080C40F0: - ldrb r0, [r2, 0xD] - cmp r0, 0 - beq _080C412C - ldr r1, =gText_BattleTower - ldr r0, =0x00000421 - adds r2, r0 - ldr r3, =gUnknown_0856FB0C - movs r0, 0x5 - bl sub_80C3C34 - b _080C412C - .pool -_080C4114: - ldr r1, =0x00000596 - adds r0, r2, r1 - ldrh r0, [r0] - cmp r0, 0 - beq _080C412C - ldr r1, =gText_BattlePtsWon - ldr r0, =0x00000421 - adds r2, r0 - ldr r3, =gUnknown_0856FB0F - movs r0, 0x5 - bl sub_80C3C34 -_080C412C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C40CC - - thumb_func_start sub_80C4140 -sub_80C4140: @ 80C4140 - push {r4,r5,lr} - sub sp, 0x20 - ldr r1, =gUnknown_0856FB68 - add r0, sp, 0x10 - movs r2, 0x6 - bl memcpy - add r4, sp, 0x18 - ldr r1, =gUnknown_0856FB6E - adds r0, r4, 0 - movs r2, 0x6 - bl memcpy - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldr r1, =0x0000052a - adds r0, r1 - ldrb r0, [r0] - adds r5, r4, 0 - cmp r0, 0 - bne _080C41C0 - movs r4, 0 -_080C416C: - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - lsls r1, r4, 1 - movs r2, 0xB1 - lsls r2, 3 - adds r0, r2 - adds r1, r0, r1 - ldrh r0, [r1] - cmp r0, 0 - beq _080C41B6 - bl sub_80D30A0 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r4, 20 - movs r2, 0xE0 - lsls r2, 16 - adds r1, r2 - lsrs r1, 16 - adds r2, r5, r4 - ldrb r2, [r2] - adds r2, 0x3 - lsls r2, 24 - lsrs r2, 24 - movs r3, 0x4 - str r3, [sp] - str r3, [sp, 0x4] - add r0, sp - adds r0, 0x10 - ldrb r0, [r0] - str r0, [sp, 0x8] - movs r0, 0x1 - str r0, [sp, 0xC] - movs r0, 0x3 - movs r3, 0xF - bl WriteSequenceToBgTilemapBuffer -_080C41B6: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x5 - bls _080C416C -_080C41C0: - add sp, 0x20 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C4140 - - thumb_func_start sub_80C41D8 -sub_80C41D8: @ 80C41D8 - push {r4,r5,lr} - sub sp, 0x4 - ldr r0, =gMonIconPalettes - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - movs r5, 0x8D - lsls r5, 3 - adds r1, r5 - movs r2, 0x60 - bl CpuSet - ldr r4, [r4] - ldr r1, =0x00000582 - adds r0, r4, r1 - ldrb r0, [r0] - cmp r0, 0x1 - beq _080C4214 - cmp r0, 0x1 - ble _080C424A - cmp r0, 0x2 - beq _080C422A - cmp r0, 0x3 - beq _080C4242 - b _080C424A - .pool -_080C4214: - movs r2, 0x8D - lsls r2, 3 - adds r0, r4, r2 - movs r1, 0 - str r1, [sp] - movs r1, 0x60 - movs r2, 0 - movs r3, 0 - bl TintPalette_CustomTone - b _080C424A -_080C422A: - adds r0, r4, r5 - movs r2, 0xFA - lsls r2, 1 - movs r3, 0xA5 - lsls r3, 1 - movs r1, 0x9B - lsls r1, 1 - str r1, [sp] - movs r1, 0x60 - bl TintPalette_CustomTone - b _080C424A -_080C4242: - adds r0, r4, r5 - movs r1, 0x60 - bl TintPalette_SepiaTone -_080C424A: - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - movs r1, 0x8D - lsls r1, 3 - adds r0, r1 - movs r1, 0x50 - movs r2, 0xC0 - bl LoadPalette - movs r4, 0 -_080C425E: - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - lsls r1, r4, 1 - movs r2, 0xB1 - lsls r2, 3 - adds r0, r2 - adds r1, r0, r1 - ldrh r0, [r1] - cmp r0, 0 - beq _080C428E - movs r1, 0 - bl GetMonIconTiles - adds r1, r0, 0 - lsls r3, r4, 20 - movs r0, 0x80 - lsls r0, 14 - adds r3, r0 - lsrs r3, 16 - movs r0, 0x3 - movs r2, 0x80 - lsls r2, 2 - bl LoadBgTiles -_080C428E: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x5 - bls _080C425E - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C41D8 - - thumb_func_start sub_80C42A4 -sub_80C42A4: @ 80C42A4 - push {r4,lr} - sub sp, 0x14 - ldr r1, =gUnknown_0856FB74 - add r0, sp, 0x10 - movs r2, 0x4 - bl memcpy - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldr r2, =0x0000052a - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080C4316 - adds r2, 0x56 - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0x1 - bne _080C4316 - movs r4, 0 -_080C42CC: - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldr r1, =0x00000584 - adds r0, r1 - adds r0, r4 - ldrb r3, [r0] - cmp r3, 0 - beq _080C430C - lsls r1, r4, 18 - movs r2, 0xA0 - lsls r2, 17 - adds r1, r2 - lsrs r1, 16 - lsls r2, r4, 1 - adds r2, r4 - adds r2, 0x2 - lsls r2, 24 - lsrs r2, 24 - movs r0, 0x2 - str r0, [sp] - str r0, [sp, 0x4] - subs r0, r3, 0x1 - add r0, sp - adds r0, 0x10 - ldrb r0, [r0] - str r0, [sp, 0x8] - movs r0, 0x1 - str r0, [sp, 0xC] - movs r0, 0x3 - movs r3, 0x2 - bl WriteSequenceToBgTilemapBuffer -_080C430C: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x2 - bls _080C42CC -_080C4316: - add sp, 0x14 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C42A4 - - thumb_func_start sub_80C4330 -sub_80C4330: @ 80C4330 - push {lr} - ldr r0, =gUnknown_0856F54C - movs r1, 0xB0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_0856F56C - movs r1, 0xC0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_0856F58C - movs r1, 0xD0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_0856F5AC - movs r1, 0xE0 - movs r2, 0x20 - bl LoadPalette - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldr r0, =0x000017a8 - adds r1, r0 - movs r2, 0x80 - lsls r2, 3 - movs r0, 0x3 - movs r3, 0x80 - bl LoadBgTiles - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C4330 - - thumb_func_start sub_80C438C -sub_80C438C: @ 80C438C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl PutWindowTilemap - adds r0, r4, 0 - movs r1, 0x3 - bl CopyWindowToVram - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80C438C - - thumb_func_start sub_80C43A8 -sub_80C43A8: @ 80C43A8 - push {r4,lr} - sub sp, 0x8 - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldrb r0, [r0, 0x3] - cmp r0, 0x4 - bls _080C43B8 - b _080C4532 -_080C43B8: - lsls r0, 2 - ldr r1, =_080C43CC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080C43CC: - .4byte _080C43E0 - .4byte _080C43F8 - .4byte _080C4418 - .4byte _080C44D8 - .4byte _080C4500 -_080C43E0: - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldr r0, =0x000013a8 - adds r1, r0 - movs r2, 0x80 - lsls r2, 3 - movs r0, 0x3 - b _080C4406 - .pool -_080C43F8: - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldr r3, =0x000019a8 - adds r1, r3 - movs r2, 0xC0 - lsls r2, 5 - movs r0, 0 -_080C4406: - movs r3, 0 - bl LoadBgTiles - b _080C4536 - .pool -_080C4418: - ldr r4, =gUnknown_02039CE8 - ldr r2, [r4] - ldr r1, =0x0000052a - adds r0, r2, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _080C447C - ldr r1, =gEmeraldTrainerCardStarPals - ldr r3, =0x00000535 - adds r0, r2, r3 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - movs r1, 0 - movs r2, 0x60 - bl LoadPalette - ldr r0, =gUnknown_0856F4EC - movs r1, 0x30 - movs r2, 0x20 - bl LoadPalette - ldr r0, [r4] - ldr r1, =0x00000534 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _080C44B2 - ldr r0, =gUnknown_0856F4AC - movs r1, 0x10 - movs r2, 0x20 - bl LoadPalette - b _080C44B2 - .pool -_080C447C: - ldr r1, =gFireRedTrainerCardStarPals - ldr r3, =0x00000535 - adds r0, r2, r3 - ldrb r0, [r0] - lsls r0, 2 - adds r0, r1 - ldr r0, [r0] - movs r1, 0 - movs r2, 0x60 - bl LoadPalette - ldr r0, =gUnknown_0856F50C - movs r1, 0x30 - movs r2, 0x20 - bl LoadPalette - ldr r0, [r4] - ldr r1, =0x00000534 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _080C44B2 - ldr r0, =gUnknown_0856F4CC - movs r1, 0x10 - movs r2, 0x20 - bl LoadPalette -_080C44B2: - ldr r0, =gUnknown_0856F52C - movs r1, 0x40 - movs r2, 0x20 - bl LoadPalette - b _080C4536 - .pool -_080C44D8: - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - ldr r3, =0x00003ca8 - adds r1, r3 - movs r0, 0 - bl SetBgTilemapBuffer - ldr r1, [r4] - ldr r0, =0x00005ca8 - adds r1, r0 - movs r0, 0x2 - bl SetBgTilemapBuffer - b _080C4536 - .pool -_080C4500: - movs r4, 0x20 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 - str r4, [sp] - str r4, [sp, 0x4] - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - movs r3, 0 - bl FillBgTilemapBufferRect_Palette0 -_080C4532: - movs r0, 0x1 - b _080C4542 -_080C4536: - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - ldrb r0, [r1, 0x3] - adds r0, 0x1 - strb r0, [r1, 0x3] - movs r0, 0 -_080C4542: - add sp, 0x8 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80C43A8 - - thumb_func_start sub_80C4550 -sub_80C4550: @ 80C4550 - push {r4-r7,lr} - adds r7, r0, 0 - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldr r1, =0x00005ca8 - adds r6, r0, r1 - movs r1, 0 -_080C455E: - movs r2, 0 - lsls r5, r1, 16 - asrs r1, r5, 16 - lsls r3, r1, 5 - lsls r0, r1, 4 - subs r0, r1 - lsls r4, r0, 1 -_080C456C: - lsls r0, r2, 16 - asrs r1, r0, 16 - adds r2, r0, 0 - cmp r1, 0x1D - bgt _080C4590 - adds r0, r3, r1 - lsls r0, 1 - adds r0, r6 - adds r1, r4, r1 - lsls r1, 1 - adds r1, r7 - ldrh r1, [r1] - b _080C4598 - .pool -_080C4590: - adds r0, r3, r1 - lsls r0, 1 - adds r0, r6 - ldrh r1, [r7] -_080C4598: - strh r1, [r0] - movs r1, 0x80 - lsls r1, 9 - adds r0, r2, r1 - lsrs r2, r0, 16 - asrs r0, 16 - cmp r0, 0x1F - ble _080C456C - adds r0, r5, r1 - lsrs r1, r0, 16 - asrs r0, 16 - cmp r0, 0x13 - ble _080C455E - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80C4550 - - thumb_func_start sub_80C45C0 -sub_80C45C0: @ 80C45C0 - push {r4-r7,lr} - adds r7, r0, 0 - ldr r0, =gUnknown_02039CE8 - ldr r0, [r0] - ldr r1, =0x00003ca8 - adds r6, r0, r1 - movs r1, 0 -_080C45CE: - movs r2, 0 - lsls r5, r1, 16 - asrs r1, r5, 16 - lsls r3, r1, 5 - lsls r0, r1, 4 - subs r0, r1 - lsls r4, r0, 1 -_080C45DC: - lsls r0, r2, 16 - asrs r1, r0, 16 - adds r2, r0, 0 - cmp r1, 0x1D - bgt _080C4600 - adds r0, r3, r1 - lsls r0, 1 - adds r0, r6 - adds r1, r4, r1 - lsls r1, 1 - adds r1, r7 - ldrh r1, [r1] - b _080C4608 - .pool -_080C4600: - adds r0, r3, r1 - lsls r0, 1 - adds r0, r6 - ldrh r1, [r7] -_080C4608: - strh r1, [r0] - movs r1, 0x80 - lsls r1, 9 - adds r0, r2, r1 - lsrs r2, r0, 16 - asrs r0, 16 - cmp r0, 0x1F - ble _080C45DC - adds r0, r5, r1 - lsrs r1, r0, 16 - asrs r0, 16 - cmp r0, 0x13 - ble _080C45CE - movs r0, 0 - bl CopyBgTilemapBufferToVram - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80C45C0 - - thumb_func_start sub_80C4630 -sub_80C4630: @ 80C4630 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - movs r0, 0xC0 - mov r8, r0 - movs r2, 0x3 - mov r10, r2 - ldr r2, =gUnknown_0856FB78 - ldr r4, =gUnknown_02039CE8 - ldr r1, [r4] - ldr r3, =0x0000052b - adds r0, r1, r3 - ldrb r0, [r0] - adds r0, r2 - ldrb r3, [r0] - ldr r0, =0x00000535 - adds r1, r0 - ldrb r0, [r1] - str r0, [sp] - movs r0, 0x1 - str r0, [sp, 0x4] - movs r0, 0x4 - str r0, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x8F - movs r2, 0xF - bl FillBgTilemapBufferRect - ldr r0, [r4] - ldrb r0, [r0, 0x5] - cmp r0, 0 - bne _080C4724 - movs r2, 0x4 - mov r9, r2 - movs r2, 0 - movs r6, 0x1 -_080C467E: - ldr r0, =gUnknown_02039CE8 - ldr r1, [r0] - lsls r0, r2, 16 - asrs r7, r0, 16 - adds r1, 0x11 - adds r1, r7 - ldrb r0, [r1] - cmp r0, 0 - beq _080C4700 - mov r3, r9 - lsls r5, r3, 24 - lsrs r5, 24 - str r6, [sp] - str r6, [sp, 0x4] - mov r0, r10 - str r0, [sp, 0x8] - movs r0, 0x3 - mov r1, r8 - adds r2, r5, 0 - movs r3, 0xF - bl FillBgTilemapBufferRect - mov r1, r8 - adds r1, 0x1 - lsls r1, 16 - lsrs r1, 16 - mov r4, r9 - adds r4, 0x1 - lsls r4, 24 - lsrs r4, 24 - str r6, [sp] - str r6, [sp, 0x4] - mov r2, r10 - str r2, [sp, 0x8] - movs r0, 0x3 - adds r2, r4, 0 - movs r3, 0xF - bl FillBgTilemapBufferRect - mov r1, r8 - adds r1, 0x10 - lsls r1, 16 - lsrs r1, 16 - str r6, [sp] - str r6, [sp, 0x4] - mov r3, r10 - str r3, [sp, 0x8] - movs r0, 0x3 - adds r2, r5, 0 - movs r3, 0x10 - bl FillBgTilemapBufferRect - mov r1, r8 - adds r1, 0x11 - lsls r1, 16 - lsrs r1, 16 - str r6, [sp] - str r6, [sp, 0x4] - mov r0, r10 - str r0, [sp, 0x8] - movs r0, 0x3 - adds r2, r4, 0 - movs r3, 0x10 - bl FillBgTilemapBufferRect -_080C4700: - adds r0, r7, 0x1 - lsls r0, 16 - mov r1, r8 - adds r1, 0x2 - lsls r1, 16 - lsrs r1, 16 - mov r8, r1 - mov r2, r9 - lsls r1, r2, 16 - movs r3, 0xC0 - lsls r3, 10 - adds r1, r3 - lsrs r1, 16 - mov r9, r1 - lsrs r2, r0, 16 - asrs r0, 16 - cmp r0, 0x7 - ble _080C467E -_080C4724: - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C4630 - - thumb_func_start sub_80C474C -sub_80C474C: @ 80C474C - push {r4-r6,lr} - sub sp, 0xC - ldr r6, =gUnknown_02039CE8 - ldr r1, [r6] - ldr r2, =0x0000052a - adds r0, r1, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080C4800 - ldrb r0, [r1, 0x10] - cmp r0, 0 - beq _080C478A - movs r4, 0x1 - str r4, [sp] - str r4, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x8D - movs r2, 0x1B - movs r3, 0x9 - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x9D - movs r2, 0x1B - movs r3, 0xA - bl FillBgTilemapBufferRect -_080C478A: - ldr r0, [r6] - movs r1, 0xAE - lsls r1, 3 - adds r0, r1 - ldr r0, [r0] - cmp r0, 0 - beq _080C47BE - movs r4, 0x1 - str r4, [sp] - str r4, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x8D - movs r2, 0x15 - movs r3, 0xD - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x9D - movs r2, 0x15 - movs r3, 0xE - bl FillBgTilemapBufferRect -_080C47BE: - ldr r0, [r6] - ldr r2, =0x00000574 - adds r0, r2 - ldr r0, [r0] - cmp r0, 0 - beq _080C48B8 - movs r4, 0x1 - str r4, [sp] - str r4, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x8D - movs r2, 0x1B - movs r3, 0xB - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x9D - movs r2, 0x1B - movs r3, 0xC - bl FillBgTilemapBufferRect - b _080C48B8 - .pool -_080C4800: - ldrb r0, [r1, 0x10] - cmp r0, 0 - beq _080C482E - movs r4, 0x1 - str r4, [sp] - str r4, [sp, 0x4] - movs r5, 0 - str r5, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x8D - movs r2, 0x1B - movs r3, 0x9 - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x9D - movs r2, 0x1B - movs r3, 0xA - bl FillBgTilemapBufferRect -_080C482E: - ldr r0, [r6] - movs r1, 0xAA - lsls r1, 3 - adds r0, r1 - ldrh r0, [r0] - cmp r0, 0 - beq _080C4864 - movs r4, 0x1 - str r4, [sp] - str r4, [sp, 0x4] - movs r5, 0 - str r5, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x8D - movs r2, 0x1B - movs r3, 0xD - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x9D - movs r2, 0x1B - movs r3, 0xE - bl FillBgTilemapBufferRect -_080C4864: - ldr r0, [r6] - ldrb r0, [r0, 0xD] - cmp r0, 0 - beq _080C48B8 - movs r4, 0x1 - str r4, [sp] - str r4, [sp, 0x4] - movs r5, 0 - str r5, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x8D - movs r2, 0x11 - movs r3, 0xF - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x9D - movs r2, 0x11 - movs r3, 0x10 - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x8C - movs r2, 0x1B - movs r3, 0xF - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x3 - movs r1, 0x9C - movs r2, 0x1B - movs r3, 0x10 - bl FillBgTilemapBufferRect -_080C48B8: - movs r0, 0x3 - bl CopyBgTilemapBufferToVram - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80C474C - - thumb_func_start sub_80C48C8 -sub_80C48C8: @ 80C48C8 - push {lr} - ldr r3, =gUnknown_02039CE8 - ldr r1, [r3] - ldrb r0, [r1, 0x6] - adds r0, 0x1 - strb r0, [r1, 0x6] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x3C - bls _080C48F6 - ldr r1, [r3] - movs r0, 0 - strb r0, [r1, 0x6] - ldr r2, [r3] - ldrb r0, [r2, 0x7] - movs r1, 0x1 - eors r0, r1 - strb r0, [r2, 0x7] - ldr r0, [r3] - ldr r1, =0x00000529 - adds r0, r1 - movs r1, 0x1 - strb r1, [r0] -_080C48F6: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C48C8 - - thumb_func_start sub_80C4904 -sub_80C4904: @ 80C4904 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTrainerCards - movs r1, 0x64 - muls r0, r1 - adds r0, r2 - ldrb r0, [r0, 0x1] - bx lr - .pool - thumb_func_end sub_80C4904 - - thumb_func_start sub_80C4918 -sub_80C4918: @ 80C4918 - push {r4,lr} - ldr r4, =sub_80C4960 - adds r0, r4, 0 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - bl _call_via_r4 - ldr r0, =sub_80C26D4 - bl SetHBlankCallback - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C4918 - - thumb_func_start sub_80C4940 -sub_80C4940: @ 80C4940 - push {lr} - ldr r0, =sub_80C4960 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0xFF - beq _080C4958 - movs r0, 0 - b _080C495A - .pool -_080C4958: - movs r0, 0x1 -_080C495A: - pop {r1} - bx r1 - thumb_func_end sub_80C4940 - - thumb_func_start sub_80C4960 -sub_80C4960: @ 80C4960 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_0856FB28 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 -_080C4972: - movs r1, 0x8 - ldrsh r0, [r4, r1] - lsls r0, 2 - adds r0, r5 - ldr r1, [r0] - adds r0, r4, 0 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _080C4972 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80C4960 - - thumb_func_start sub_80C4998 -sub_80C4998: @ 80C4998 - push {r4,lr} - adds r4, r0, 0 - movs r0, 0x1 - bl HideBg - movs r0, 0x3 - bl HideBg - bl ScanlineEffect_Stop - bl ScanlineEffect_Clear - movs r1, 0 - ldr r0, =gScanlineEffectRegBuffers - movs r2, 0 - movs r3, 0xF0 - lsls r3, 3 - adds r0, r3 -_080C49BC: - strh r2, [r0] - adds r0, 0x2 - adds r1, 0x1 - cmp r1, 0x9F - bls _080C49BC - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80C4998 thumb_func_start sub_80C49D8 sub_80C49D8: @ 80C49D8 diff --git a/include/trainer_card.h b/include/trainer_card.h index 1af247d8a8..a3d9160e03 100644 --- a/include/trainer_card.h +++ b/include/trainer_card.h @@ -12,7 +12,7 @@ struct TrainerCard /*0x06*/ u16 firstHallOfFameA; /*0x08*/ u16 firstHallOfFameB; /*0x0A*/ u16 firstHallOfFameC; - /*0x0C*/ u16 pokedexSeen; + /*0x0C*/ u16 pokedexCaught; /*0x0E*/ u16 trainerId; /*0x10*/ u16 playTimeHours; /*0x12*/ u16 playTimeMinutes; @@ -27,14 +27,26 @@ struct TrainerCard /*0x24*/ u32 money; /*0x28*/ u16 var_28[4]; /*0x30*/ u8 playerName[8]; - /*0x38*/ u8 emeraldAddedUnknownFields[0x54-0x38]; - /*0x54*/ u16 monSpecies[2]; - /*0x58*/ u8 emeraldAddedUnknownFields2[0x64-0x58]; + /*0x38*/ u8 var_38; + /*0x39*/ u8 var_39; + /*0x3A*/ u16 var_3A; + /*0x3C*/ u32 var_3C; + /*0x40*/ u32 var_40; + /*0x44*/ u8 filler44[0x8]; + /*0x4C*/ u8 var_4C; + /*0x4D*/ u8 var_4D; + /*0x4E*/ u8 var_4E; + /*0x4F*/ u8 var_4F; + /*0x50*/ u8 var_50[0x4]; + /*0x54*/ u16 monSpecies[6]; + /*0x60*/ u16 var_60; + /*0x62*/ u16 var_62; }; + extern struct TrainerCard gTrainerCards[4]; -void sub_80C3120(struct TrainerCard *arg0, u16 *arg1, u8 gameVersion); +void sub_80C3120(struct TrainerCard *arg0, u16 *src, u8 gameVersion); void TrainerCard_ShowLinkCard(u8 arg0, void (*callback)(void)); void TrainerCard_GenerateCardForPlayer(struct TrainerCard *); u8 sub_80C4904(u8); diff --git a/src/pokedex.c b/src/pokedex.c index 8c6ed3159d..3d294e9e9e 100644 --- a/src/pokedex.c +++ b/src/pokedex.c @@ -4381,7 +4381,7 @@ u16 sub_80C089C(u8 caseID) return count; } -bool8 sub_80C08E4(void) +bool16 sub_80C08E4(void) { u16 i; diff --git a/src/trainer_card.c b/src/trainer_card.c index d23413a267..51ef20ddc7 100755 --- a/src/trainer_card.c +++ b/src/trainer_card.c @@ -12,8 +12,26 @@ #include "overworld.h" #include "menu.h" #include "text.h" +#include "constants/flags.h" +#include "event_data.h" +#include "constants/game_stat.h" +#include "money.h" +#include "string_util.h" +#include "trainer_card.h" +#include "gpu_regs.h" +#include "international_string_util.h" +#include "pokedex.h" +#include "graphics.h" +#include "pokemon_icon.h" -extern const u8 gText_WaitingTrainerFinishReading[]; +//external functions +extern u8 sub_80F8940(void); +extern bool16 sub_80C08E4(void); +extern u8 sub_80D30A0(u16); +extern void TintPalette_CustomTone(u16 *palette, u16 count, u16 rTone, u16 gTone, u16 bTone); +extern void TintPalette_SepiaTone(u16 *palette, u16 count); + +//gfx extern const u32 gUnknown_08DD2AE0[]; extern const u32 gUnknown_08DD21B0[]; extern const u32 gUnknown_08DD2D30[]; @@ -28,6 +46,60 @@ extern const u32 gFireRedTrainerCard_Gfx[]; extern const u32 gUnknown_0856F018[]; extern const u32 gUnknown_08DD1F78[]; +//strings +extern const u8 gText_WaitingTrainerFinishReading[]; +extern const u8 gText_TrainerCardName[]; +extern const u8 gText_TrainerCardIDNo[]; +extern const u8 gText_TrainerCardMoney[]; +extern const u8 gText_PokedollarVar1[]; +extern const u8 gText_EmptyString6[]; +extern const u8 gText_TrainerCardPokedex[]; +extern const u8 gText_TrainerCardTime[]; +extern const u8 gText_Colon2[]; +extern const u8 gText_Var1sTrainerCard[]; +extern const u8 gText_HallOfFameDebut[]; +extern const u8 gText_WinsLosses[]; +extern const u8 gText_PokemonTrades[]; +extern const u8 gText_BerryCrush[]; +extern const u8 gText_UnionTradesAndBattles[]; +extern const u8 gText_Var1DarkGreyShadowLightGrey[]; +extern const u8 gText_PokeblocksWithFriends[]; +extern const u8 gText_WonContestsWFriends[]; +extern const u8 gText_WSlashStraightSlash[]; +extern const u8 gText_Var1DarkLightGreyBP[]; +extern const u8 gText_BattleTower[]; +extern const u8 gText_BattlePtsWon[]; + +//const rom data to be moved from data/trainer_card.s to this file +extern const struct BgTemplate gUnknown_0856FAB4[4]; +extern const struct WindowTemplate gUnknown_0856FAC4[]; +extern const u8 gUnknown_0856FB0C[]; +extern const u8* gUnknown_0856FB40[]; +extern const u8 gUnknown_0856FB48[]; +extern const u8 gUnknown_0856FB4A[]; +extern const u8 gUnknown_0856FB4C[]; +extern const u8 gUnknown_0856FB55[]; +extern const u8 gUnknown_0856FB57[]; +extern const u8 gUnknown_0856FB0F[]; +extern const u8* gUnknown_0856FB5C[]; +extern const u8 gUnknown_0856FB68[6]; +extern const u8 gUnknown_0856FB6E[6]; +extern const u8 gUnknown_0856FB74[4]; +extern const u8 gUnknown_0856F54C[]; +extern const u8 gUnknown_0856F56C[]; +extern const u8 gUnknown_0856F58C[]; +extern const u8 gUnknown_0856F5AC[]; +extern const u8 gUnknown_0856F4EC[]; +extern const u8 gUnknown_0856F4AC[]; +extern const u8 gUnknown_0856F50C[]; +extern const u8 gUnknown_0856F4CC[]; +extern const u8 gUnknown_0856F52C[]; +extern const u8* gEmeraldTrainerCardStarPals[]; +extern const u8* gFireRedTrainerCardStarPals[]; +extern const u8 gUnknown_0856FB78[]; +extern bool8 (*const gUnknown_0856FB28[])(struct Task *); + +//this file's functions /*static*/ void sub_80C2690(void); /*static*/ void sub_80C26D4(void); /*static*/ void sub_80C48C8(void); @@ -44,28 +116,109 @@ extern const u32 gUnknown_08DD1F78[]; /*static*/ bool8 sub_80C4940(void); /*static*/ bool8 sub_80C2AD8(void); /*static*/ void sub_80C2C80(void); +/*static*/ u32 sav12_xor_get_clamped_above(u8 stat, u32 max); +/*static*/ bool8 sub_80C2DFC(void); +/*static*/ u32 sub_80C2E40(void); +/*static*/ u8 TrainerCard_GetStarCount(struct TrainerCard*); +/*static*/ u16 sub_80C376C(void); +/*static*/ void sub_80C2EC4(struct TrainerCard*, u8); +/*static*/ void sub_80C3020(struct TrainerCard*); +/*static*/ u8 sub_80C4FCC(u8); +/*static*/ void sub_80C3190(void); +/*static*/ void sub_80C3278(void); +/*static*/ void sub_80C334C(void); +/*static*/ void sub_80C3388(void); +/*static*/ void sub_80C3404(void); +/*static*/ void sub_80C3414(void); +/*static*/ void sub_80C4EE4(void); +/*static*/ void sub_80C3574(void); +/*static*/ void sub_80C3608(void); +/*static*/ void sub_80C3684(void); +/*static*/ void sub_80C378C(void); +/*static*/ void sub_80C3A18(void); +/*static*/ bool8 sub_80C34B0(void); +/*static*/ void sub_80C3B50(void); +/*static*/ void sub_80C3CCC(void); +/*static*/ void sub_80C3D60(void); +/*static*/ void sub_80C3DF0(void); +/*static*/ void sub_80C3E58(void); +/*static*/ void sub_80C3F64(void); +/*static*/ void sub_80C3ED4(void); +/*static*/ void sub_80C3FE0(void); +/*static*/ void sub_80C4140(void); +/*static*/ void sub_80C40CC(void); +/*static*/ void sub_80C42A4(void); +/*static*/ void sub_80C3548(void); +/*static*/ void sub_80C3AF0(void); +/*static*/ void sub_80C3BC4(void); +/*static*/ void sub_80C3CF4(void); +/*static*/ void sub_80C3DC0(void); +/*static*/ void sub_80C3E20(void); +/*static*/ void sub_80C3E98(void); +/*static*/ void sub_80C3F14(void); +/*static*/ void sub_80C3FA4(void); +/*static*/ void sub_80C4020(void); +/*static*/ void sub_80C3C34(u8 top, const u8* str1, u8* str2, const u8* color); +/*static*/ void sub_80C4330(void); +/*static*/ u8 sub_80C43A8(void); +/*static*/ void sub_80C474C(void); +/*static*/ void sub_80C4960(u8); +/*static*/ bool8 sub_80C4998(struct Task* task); +/*static*/ bool8 sub_80C49D8(struct Task* task); +/*static*/ void sub_80C32EC(u16); extern struct UnknownStruct{ u8 var_0; u8 var_1; u8 var_2; - u8 filler3[2]; + u8 var_3; + u8 var_4; u8 var_5; - u8 filler6[3]; + u8 var_6; + u8 var_7; + u8 var_8; u8 var_9; - u8 fillerA[0x51F]; + u8 var_A; + u8 var_B; + u8 var_C; + u8 var_D; + u8 var_E; + u8 var_F; + u8 var_10; + u8 badgeCount[8]; + u8 var_19[0xD]; + u8 var_26[0xD]; + u8 var_33[0xD]; + u8 var_40[0xD]; + u8 var_4D[0x46]; + u8 var_93[0x46]; + u8 var_D9[0x8C]; + u8 var_165[0x46]; + u8 var_1AB[0x8C]; + u8 var_237[0x8C]; + u8 var_2C3[0x8C]; + u8 var_34F[0x46]; + u8 var_395[0x46]; + u8 var_3DB[0x46]; + u8 var_421[0x47]; + u16 var_468[0x60]; + s8 var_528; u8 var_529; u8 var_52A; u8 var_52B; u16 var_52C; void (*callback2)(void); - u8 filler531[0x64]; + struct TrainerCard var_534; u8 var_598[0x4B0]; u8 var_A48[0x4B0]; u8 var_EF8[0x4B0]; u8 var_13A8[0x400]; u8 var_17A8[0x200]; - u8 var_19A8[0x200]; + u8 var_19A8[0x2300]; + u8 var_3CA8[0x2000]; + u8 var_5CA8[0x2000]; + u16 var_7CA8; + u8 var_7CAA; }* gUnknown_02039CE8; void sub_80C2690(void) @@ -93,9 +246,9 @@ void sub_80C26D4(void) void sub_80C2710(void) { RunTasks(); - AnimateSprites(); - BuildOamBuffer(); - UpdatePaletteFade(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); } void sub_80C2728(u8 taskId) @@ -145,13 +298,13 @@ void sub_80C2760(u8 taskId) gUnknown_02039CE8->var_0++; break; case 7: - if(gWirelessCommType == TRUE && gReceivedRemoteLinkPlayers == TRUE) + if(gWirelessCommType == 1 && gReceivedRemoteLinkPlayers == TRUE) { sub_800E0E8(); CreateWirelessStatusIndicatorSprite(230, 150); } - BlendPalettes(-1, 16, gUnknown_02039CE8->var_52C); - BeginNormalPaletteFade(- 1, 0, 16, 0, gUnknown_02039CE8->var_52C); + BlendPalettes(0xFFFFFFFF, 16, gUnknown_02039CE8->var_52C); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, gUnknown_02039CE8->var_52C); SetVBlankCallback(sub_80C2690); gUnknown_02039CE8->var_0++; break; @@ -185,7 +338,7 @@ void sub_80C2760(u8 taskId) gUnknown_02039CE8->var_0 = 15; else { - BeginNormalPaletteFade(-1, 0, 0, 16, gUnknown_02039CE8->var_52C); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, gUnknown_02039CE8->var_52C); gUnknown_02039CE8->var_0 = 14; } } @@ -204,7 +357,7 @@ void sub_80C2760(u8 taskId) gUnknown_02039CE8->var_0 = 15; else if(gReceivedRemoteLinkPlayers) { - BeginNormalPaletteFade(-1, 0, 0, 16, gUnknown_02039CE8->var_52C); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, gUnknown_02039CE8->var_52C); gUnknown_02039CE8->var_0 = 14; } else @@ -220,7 +373,7 @@ void sub_80C2760(u8 taskId) gUnknown_02039CE8->var_0 = 15; else { - BeginNormalPaletteFade(-1, 0, 0, 16, gUnknown_02039CE8->var_52C); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, gUnknown_02039CE8->var_52C); gUnknown_02039CE8->var_0 = 14; } } @@ -235,7 +388,7 @@ void sub_80C2760(u8 taskId) case 16: if(!gReceivedRemoteLinkPlayers) { - BeginNormalPaletteFade(-1, 0, 0, 16, gUnknown_02039CE8->var_52C); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, gUnknown_02039CE8->var_52C); gUnknown_02039CE8->var_0 = 14; } break; @@ -249,7 +402,6 @@ void sub_80C2760(u8 taskId) gUnknown_02039CE8->var_0 = 10; PlaySE(SE_RG_CARD3); } - break; } } @@ -303,9 +455,1447 @@ bool8 sub_80C2AD8(void) break; default: gUnknown_02039CE8->var_2 = 0; - return 1; + return TRUE; } gUnknown_02039CE8->var_2++; + return FALSE; +} + +NAKED +void sub_80C2C80(void) //not really a nonmatching, skipped it because of DMA macros +{ + asm("\n\ + .syntax unified\n\ + push {lr}\n\ + sub sp, 0x8\n\ + ldr r1, =gMain\n\ + movs r2, 0x87\n\ + lsls r2, 3\n\ + adds r0, r1, r2\n\ + ldrb r0, [r0]\n\ + adds r3, r1, 0\n\ + cmp r0, 0xA\n\ + bls _080C2C96\n\ + b _080C2DD8\n\ +_080C2C96:\n\ + lsls r0, 2\n\ + ldr r1, =_080C2CA8\n\ + adds r0, r1\n\ + ldr r0, [r0]\n\ + mov pc, r0\n\ + .pool\n\ + .align 2, 0\n\ +_080C2CA8:\n\ + .4byte _080C2CD4\n\ + .4byte _080C2CEC\n\ + .4byte _080C2D14\n\ + .4byte _080C2D50\n\ + .4byte _080C2D6A\n\ + .4byte _080C2D74\n\ + .4byte _080C2D88\n\ + .4byte _080C2D8E\n\ + .4byte _080C2DA0\n\ + .4byte _080C2DA6\n\ + .4byte _080C2DB8\n\ +_080C2CD4:\n\ + bl sub_80C334C\n\ + bl sub_80C3414\n\ + ldr r1, =gMain\n\ + movs r0, 0x87\n\ + lsls r0, 3\n\ + adds r1, r0\n\ + b _080C2DCC\n\ + .pool\n\ +_080C2CEC:\n\ + movs r1, 0xE0\n\ + lsls r1, 19\n\ + movs r0, 0\n\ + str r0, [sp]\n\ + ldr r0, =0x040000d4\n\ + mov r2, sp\n\ + str r2, [r0]\n\ + str r1, [r0, 0x4]\n\ + ldr r1, =0x85000100\n\ + str r1, [r0, 0x8]\n\ + ldr r0, [r0, 0x8]\n\ + movs r0, 0x87\n\ + lsls r0, 3\n\ + adds r1, r3, r0\n\ + b _080C2DCC\n\ + .pool\n\ +_080C2D14:\n\ + ldr r0, =gUnknown_02039CE8\n\ + ldr r0, [r0]\n\ + ldr r1, =0x0000052c\n\ + adds r0, r1\n\ + ldrh r0, [r0]\n\ + cmp r0, 0\n\ + bne _080C2D36\n\ + movs r2, 0xA0\n\ + lsls r2, 19\n\ + add r1, sp, 0x4\n\ + strh r0, [r1]\n\ + ldr r0, =0x040000d4\n\ + str r1, [r0]\n\ + str r2, [r0, 0x4]\n\ + ldr r1, =0x81000200\n\ + str r1, [r0, 0x8]\n\ + ldr r0, [r0, 0x8]\n\ +_080C2D36:\n\ + movs r2, 0x87\n\ + lsls r2, 3\n\ + adds r1, r3, r2\n\ + b _080C2DCC\n\ + .pool\n\ +_080C2D50:\n\ + bl ResetSpriteData\n\ + bl FreeAllSpritePalettes\n\ + bl ResetPaletteFade\n\ + ldr r1, =gMain\n\ + movs r0, 0x87\n\ + lsls r0, 3\n\ + adds r1, r0\n\ + ldrb r0, [r1]\n\ + adds r0, 0x1\n\ + strb r0, [r1]\n\ +_080C2D6A:\n\ + bl sub_80C3388\n\ + b _080C2DC4\n\ + .pool\n\ +_080C2D74:\n\ + bl sub_80C41D8\n\ + ldr r1, =gMain\n\ + movs r0, 0x87\n\ + lsls r0, 3\n\ + adds r1, r0\n\ + b _080C2DCC\n\ + .pool\n\ +_080C2D88:\n\ + bl sub_80C2AD8\n\ + b _080C2DBC\n\ +_080C2D8E:\n\ + bl sub_80C4330\n\ + ldr r1, =gMain\n\ + movs r0, 0x87\n\ + lsls r0, 3\n\ + adds r1, r0\n\ + b _080C2DCC\n\ + .pool\n\ +_080C2DA0:\n\ + bl sub_80C3278\n\ + b _080C2DC4\n\ +_080C2DA6:\n\ + bl sub_80C3548\n\ + ldr r1, =gMain\n\ + movs r0, 0x87\n\ + lsls r0, 3\n\ + adds r1, r0\n\ + b _080C2DCC\n\ + .pool\n\ +_080C2DB8:\n\ + bl sub_80C43A8\n\ +_080C2DBC:\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + cmp r0, 0x1\n\ + bne _080C2DDC\n\ +_080C2DC4:\n\ + ldr r1, =gMain\n\ + movs r2, 0x87\n\ + lsls r2, 3\n\ + adds r1, r2\n\ +_080C2DCC:\n\ + ldrb r0, [r1]\n\ + adds r0, 0x1\n\ + strb r0, [r1]\n\ + b _080C2DDC\n\ + .pool\n\ +_080C2DD8:\n\ + bl sub_80C3404\n\ +_080C2DDC:\n\ + add sp, 0x8\n\ + pop {r0}\n\ + bx r0\n\ + .syntax divided"); +} + +u32 sav12_xor_get_clamped_above(u8 stat, u32 max) +{ + u32 retStat = GetGameStat(stat); + return (retStat > max) ? max : retStat; +} + +bool8 sub_80C2DFC(void) +{ + u8 i; + for(i = 0; i <= 6; i++) + { + if(!FlagGet(FLAG_SYS_TOWER_SILVER + 2 * i) || !FlagGet(FLAG_SYS_TOWER_GOLD + 2 * i)) + return FALSE; + } + return TRUE; +} + +u32 sub_80C2E40(void) +{ + u32 stat = GetGameStat(GAME_STAT_ENTERED_HOF); + u8 r4 = (stat | -stat) >> 31; + + if(sub_80C08E4()) + r4++; + if(sub_80F8940() > 4) + r4++; + if(sub_80C2DFC()) + r4++; + return r4; +} + +u8 TrainerCard_GetStarCount(struct TrainerCard *trainerCard) +{ + u8 value = 0; + + if (trainerCard->firstHallOfFameA || trainerCard->firstHallOfFameB || trainerCard->firstHallOfFameC) + value++; + if (trainerCard->var_3) + value++; + if (trainerCard->battleTowerLosses > 49) + value++; + if (trainerCard->var_4) + value++; + + return value; +} + +void sub_80C2EC4(struct TrainerCard *trainerCard, u8 arg1) +{ + u32 playTime; + bool32 enteredHallOfFame; + u8 i; + + trainerCard->gender = gSaveBlock2Ptr->playerGender; + trainerCard->playTimeHours = gSaveBlock2Ptr->playTimeHours; + trainerCard->playTimeMinutes = gSaveBlock2Ptr->playTimeMinutes; + + playTime = GetGameStat(GAME_STAT_FIRST_HOF_PLAY_TIME); + enteredHallOfFame = GetGameStat(GAME_STAT_ENTERED_HOF); + if (!enteredHallOfFame) + playTime = 0; + + trainerCard->firstHallOfFameA = playTime >> 16; + trainerCard->firstHallOfFameB = (playTime >> 8) & 0xFF; + trainerCard->firstHallOfFameC = playTime & 0xFF; + if((playTime >> 16) > 999) + { + trainerCard->firstHallOfFameA = 999; + trainerCard->firstHallOfFameB = 59; + trainerCard->firstHallOfFameC = 59; + } + + trainerCard->hasPokedex = FlagGet(FLAG_SYS_POKEDEX_GET); + trainerCard->var_3 = sub_80C08E4(); + trainerCard->pokedexCaught = sub_80C376C(); + + trainerCard->trainerId = (gSaveBlock2Ptr->playerTrainerId[1] << 8) | gSaveBlock2Ptr->playerTrainerId[0]; + + trainerCard->linkBattleWins = sav12_xor_get_clamped_above(GAME_STAT_LINK_BATTLE_WINS, 9999); + trainerCard->linkBattleLosses = sav12_xor_get_clamped_above(GAME_STAT_LINK_BATTLE_LOSSES, 9999); + + trainerCard->pokemonTrades = sav12_xor_get_clamped_above(GAME_STAT_POKEMON_TRADES, 0xFFFF); + + trainerCard->money = GetMoney(&gSaveBlock1Ptr->money); + + for (i = 0; i < 4; i++) + trainerCard->var_28[i] = gSaveBlock1Ptr->unk2BB0[i]; + + StringCopy(trainerCard->playerName, gSaveBlock2Ptr->playerName); + + switch(arg1) + { + case 2: + trainerCard->battleTowerWins = 0; + trainerCard->battleTowerLosses = 0; + case 0: + trainerCard->contestsWithFriends = sav12_xor_get_clamped_above(GAME_STAT_WON_LINK_CONTEST, 999); + trainerCard->pokeblocksWithFriends = sav12_xor_get_clamped_above(GAME_STAT_POKEBLOCKS_WITH_FRIENDS, 0xFFFF); + if(sub_80F8940() > 4) + trainerCard->var_4 = TRUE; + trainerCard->stars = TrainerCard_GetStarCount(trainerCard); + break; + case 1: + trainerCard->battleTowerWins = 0; + trainerCard->battleTowerLosses = 0; + trainerCard->contestsWithFriends = 0; + trainerCard->pokeblocksWithFriends = 0; + trainerCard->var_4 = 0; + trainerCard->stars = 0; + } +} + +#ifdef NONMATCHING //r0 and r1 swapped +void sub_80C3020(struct TrainerCard *trainerCard) +{ + memset(trainerCard, 0, sizeof(struct TrainerCard)); + trainerCard->var_38 = 3; + sub_80C2EC4(trainerCard, 2); + trainerCard->var_60 = sub_80C2DFC(); + trainerCard->var_62 = gSaveBlock2Ptr->frontier.field_EBA; + if(trainerCard->var_60) + trainerCard->stars++; + if(trainerCard->gender == FEMALE) + trainerCard->var_4F = gUnknown_08329D54[(trainerCard->trainerId & 7) + 8]; + else + trainerCard->var_4F = gUnknown_08329D54[trainerCard->trainerId & 7]; +} +#else +NAKED +void sub_80C3020(struct TrainerCard *trainerCard) +{ + asm("\n\ + .syntax unified\n\ + push {r4,lr}\n\ + adds r4, r0, 0\n\ + movs r1, 0\n\ + movs r2, 0x64\n\ + bl memset\n\ + adds r1, r4, 0\n\ + adds r1, 0x38\n\ + movs r0, 0x3\n\ + strb r0, [r1]\n\ + adds r0, r4, 0\n\ + movs r1, 0x2\n\ + bl sub_80C2EC4\n\ + bl sub_80C2DFC\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + adds r1, r4, 0\n\ + adds r1, 0x60\n\ + strh r0, [r1]\n\ + ldr r0, =gSaveBlock2Ptr\n\ + ldr r0, [r0]\n\ + ldr r2, =0x00000eba\n\ + adds r0, r2\n\ + ldrh r0, [r0]\n\ + adds r2, r4, 0\n\ + adds r2, 0x62\n\ + strh r0, [r2]\n\ + ldrh r0, [r1]\n\ + cmp r0, 0\n\ + beq _080C3066\n\ + ldrb r0, [r4, 0x1]\n\ + adds r0, 0x1\n\ + strb r0, [r4, 0x1]\n\ +_080C3066:\n\ + ldrb r0, [r4]\n\ + cmp r0, 0x1\n\ + bne _080C3084\n\ + ldr r2, =gUnknown_08329D54\n\ + ldrh r0, [r4, 0xE]\n\ + movs r1, 0x7\n\ + ands r0, r1\n\ + adds r0, 0x8\n\ + b _080C308C\n\ + .pool\n\ +_080C3084:\n\ + ldr r2, =gUnknown_08329D54\n\ + ldrh r0, [r4, 0xE]\n\ + movs r1, 0x7\n\ + ands r0, r1\n\ +_080C308C:\n\ + lsls r0, 1\n\ + adds r0, r2\n\ + ldrh r1, [r0]\n\ + adds r0, r4, 0\n\ + adds r0, 0x4F\n\ + strb r1, [r0]\n\ + pop {r4}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided"); +} +#endif // NONMATCHING + +#ifdef NONMATCHING //r0 and r1 swapped +void TrainerCard_GenerateCardForPlayer(struct TrainerCard *trainerCard) +{ + u8 temp; + memset(trainerCard, 0, 0x60); + trainerCard->var_38 = 3; + sub_80C2EC4(trainerCard, 2); + temp = sub_80C2DFC(); + trainerCard->var_3A = temp; + *((u16*)&trainerCard->var_3C) = gSaveBlock2Ptr->frontier.field_EBA; + if(temp) + trainerCard->stars++; + if(trainerCard->gender == FEMALE) + trainerCard->var_4F = gUnknown_08329D54[(trainerCard->trainerId & 7) + 8]; + else + trainerCard->var_4F = gUnknown_08329D54[trainerCard->trainerId & 7]; +} +#else +NAKED +void TrainerCard_GenerateCardForPlayer(struct TrainerCard *trainerCard) +{ + asm("\n\ + .syntax unified\n\ + push {r4,lr}\n\ + adds r4, r0, 0\n\ + movs r1, 0\n\ + movs r2, 0x60\n\ + bl memset\n\ + adds r1, r4, 0\n\ + adds r1, 0x38\n\ + movs r0, 0x3\n\ + strb r0, [r1]\n\ + adds r0, r4, 0\n\ + movs r1, 0x2\n\ + bl sub_80C2EC4\n\ + bl sub_80C2DFC\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + strh r0, [r4, 0x3A]\n\ + ldr r1, =gSaveBlock2Ptr\n\ + ldr r1, [r1]\n\ + ldr r2, =0x00000eba\n\ + adds r1, r2\n\ + ldrh r1, [r1]\n\ + strh r1, [r4, 0x3C]\n\ + cmp r0, 0\n\ + beq _080C30E0\n\ + ldrb r0, [r4, 0x1]\n\ + adds r0, 0x1\n\ + strb r0, [r4, 0x1]\n\ +_080C30E0:\n\ + ldrb r0, [r4]\n\ + cmp r0, 0x1\n\ + bne _080C3100\n\ + ldr r2, =gUnknown_08329D54\n\ + ldrh r0, [r4, 0xE]\n\ + movs r1, 0x7\n\ + ands r0, r1\n\ + adds r0, 0x8\n\ + b _080C3108\n\ + .pool\n\ +_080C3100:\n\ + ldr r2, =gUnknown_08329D54\n\ + ldrh r0, [r4, 0xE]\n\ + movs r1, 0x7\n\ + ands r0, r1\n\ +_080C3108:\n\ + lsls r0, 1\n\ + adds r0, r2\n\ + ldrh r1, [r0]\n\ + adds r0, r4, 0\n\ + adds r0, 0x4F\n\ + strb r1, [r0]\n\ + pop {r4}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided"); +} +#endif // NONMATCHING + +void sub_80C3120(struct TrainerCard *trainerCard, u16 *src, u8 gameVersion) +{ + memset(trainerCard, 0, sizeof(struct TrainerCard)); + trainerCard->var_38 = gameVersion; + switch(sub_80C4FCC(gameVersion)) + { + case 0: + memcpy(trainerCard, src, 0x60); + break; + case 1: + memcpy(trainerCard, src, 0x38); + break; + case 2: + memcpy(trainerCard, src, 0x60); + trainerCard->var_3C = 0; + trainerCard->var_60 = src[29]; + trainerCard->var_62 = src[30]; + } +} + +void sub_80C3190(void) +{ + u8 i; + u32 badgeFlag; + + gUnknown_02039CE8->var_A = 0; + gUnknown_02039CE8->var_B = 0; + gUnknown_02039CE8->var_C = 0; + gUnknown_02039CE8->var_D = 0; + gUnknown_02039CE8->var_E = 0; + gUnknown_02039CE8->var_F = 0; + gUnknown_02039CE8->var_10 = 0; + memset(gUnknown_02039CE8->badgeCount, 0, 8); + if(gUnknown_02039CE8->var_534.hasPokedex) + gUnknown_02039CE8->var_A++; + + if(gUnknown_02039CE8->var_534.firstHallOfFameA + ||gUnknown_02039CE8->var_534.firstHallOfFameB + ||gUnknown_02039CE8->var_534.firstHallOfFameC) + gUnknown_02039CE8->var_B++; + + if(gUnknown_02039CE8->var_534.linkBattleWins || gUnknown_02039CE8->var_534.linkBattleLosses) + gUnknown_02039CE8->var_C++; + if(gUnknown_02039CE8->var_534.pokemonTrades) + gUnknown_02039CE8->var_10++; + if(gUnknown_02039CE8->var_534.battleTowerWins || gUnknown_02039CE8->var_534.battleTowerLosses) + gUnknown_02039CE8->var_D++; + + i = 0; + badgeFlag = FLAG_BADGE01_GET; + while (1) + { + if(FlagGet(badgeFlag)) + gUnknown_02039CE8->badgeCount[i]++; + badgeFlag++; + i++; + if (badgeFlag > FLAG_BADGE08_GET) + break; + } +} + +void sub_80C3278(void) +{ + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); + ShowBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG0 | BLDCNT_EFFECT_DARKEN); + SetGpuReg(REG_OFFSET_BLDY, 0); + SetGpuReg(REG_OFFSET_WININ, WININ_WIN0_BG_ALL | WININ_WIN0_OBJ | WININ_WIN0_CLR); + SetGpuReg(REG_OFFSET_WINOUT, WINOUT_WIN01_BG1 | WINOUT_WIN01_BG2 | WINOUT_WIN01_BG3 | WINOUT_WIN01_OBJ); + SetGpuReg(REG_OFFSET_WIN0V, 160); + SetGpuReg(REG_OFFSET_WIN0H, 240); + if(gReceivedRemoteLinkPlayers) + EnableInterrupts(INTR_FLAG_VBLANK | INTR_FLAG_HBLANK | INTR_FLAG_VCOUNT | INTR_FLAG_TIMER3 | INTR_FLAG_SERIAL); + else + EnableInterrupts(INTR_FLAG_VBLANK | INTR_FLAG_HBLANK); +} + +void sub_80C32EC(u16 arg0) +{ + u8 quotient = (arg0 + 40) / 10; + + if((s8)quotient <= 4) + quotient = 0; + gUnknown_02039CE8->var_528 = quotient; + SetGpuReg(REG_OFFSET_BLDY, gUnknown_02039CE8->var_528); + SetGpuReg(REG_OFFSET_WIN0V, (gUnknown_02039CE8->var_7CA8 * 256) | (160 - gUnknown_02039CE8->var_7CA8)); +} + +void sub_80C334C(void) +{ + SetVBlankCallback(NULL); + SetHBlankCallback(NULL); + SetGpuReg(REG_OFFSET_DISPCNT, 0); + SetGpuReg(REG_OFFSET_BG0CNT, 0); + SetGpuReg(REG_OFFSET_BG1CNT, 0); + SetGpuReg(REG_OFFSET_BG2CNT, 0); + SetGpuReg(REG_OFFSET_BG3CNT, 0); +} + +void sub_80C3388(void) +{ + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_0856FAB4, ARRAY_COUNT(gUnknown_0856FAB4)); + ChangeBgX(0, 0, 0); + ChangeBgY(0, 0, 0); + ChangeBgX(1, 0, 0); + ChangeBgY(1, 0, 0); + ChangeBgX(2, 0, 0); + ChangeBgY(2, 0, 0); + ChangeBgX(3, 0, 0); + ChangeBgY(3, 0, 0); + InitWindows(gUnknown_0856FAC4); + DeactivateAllTextPrinters(); + sub_81973A4(); +} + +void sub_80C3404(void) +{ + SetMainCallback2(sub_80C2710); +} + +void sub_80C3414(void) +{ + ResetTasks(); + ScanlineEffect_Stop(); + CreateTask(sub_80C2760, 0); + sub_80C4EE4(); + sub_80C3190(); +} + +bool8 sub_80C3438(void) +{ + switch(gUnknown_02039CE8->var_1) + { + case 0: + sub_80C3574(); + break; + case 1: + sub_80C3608(); + break; + case 2: + sub_80C3684(); + break; + case 3: + sub_80C378C(); + break; + case 4: + sub_80C3880(); + break; + case 5: + sub_80C3A18(); + break; + default: + gUnknown_02039CE8->var_1 = 0; + return TRUE; + } + gUnknown_02039CE8->var_1++; + return FALSE; +} + +bool8 sub_80C34B0(void) +{ + switch(gUnknown_02039CE8->var_1) + { + case 0: + sub_80C3B50(); + break; + case 1: + sub_80C3CCC(); + break; + case 2: + sub_80C3D60(); + break; + case 3: + sub_80C3DF0(); + break; + case 4: + sub_80C3E58(); + sub_80C3F64(); + break; + case 5: + sub_80C3ED4(); + sub_80C3FE0(); + break; + case 6: + sub_80C4140(); + sub_80C40CC(); + break; + case 7: + sub_80C42A4(); + break; + default: + gUnknown_02039CE8->var_1 = 0; + return TRUE; + } + gUnknown_02039CE8->var_1++; + return FALSE; +} + +void sub_80C3548(void) +{ + sub_80C3AF0(); + sub_80C3BC4(); + sub_80C3CF4(); + sub_80C3DC0(); + sub_80C3E20(); + sub_80C3E98(); + sub_80C3F14(); + sub_80C3FA4(); + sub_80C4020(); +} + +void sub_80C3574(void) +{ + u8 buffer[32]; + u8* txtPtr; + txtPtr = StringCopy(buffer, gText_TrainerCardName); + StringCopy(txtPtr, gUnknown_02039CE8->var_534.playerName); + ConvertInternationalString(txtPtr, gUnknown_02039CE8->var_7CAA); + if(!gUnknown_02039CE8->var_52A) + AddTextPrinterParameterized3(1, 1, 20, 28, gUnknown_0856FB0C, -1, buffer); + else + AddTextPrinterParameterized3(1, 1, 16, 33, gUnknown_0856FB0C, -1, buffer); +} + +void sub_80C3608(void) +{ + u8 buffer[32]; + u8* txtPtr; + s32 xPos; + u32 top; + txtPtr = StringCopy(buffer, gText_TrainerCardIDNo); + ConvertIntToDecimalStringN(txtPtr, gUnknown_02039CE8->var_534.trainerId, STR_CONV_MODE_LEADING_ZEROS, 5); + if(!gUnknown_02039CE8->var_52A) + { + xPos = GetStringCenterAlignXOffset(1, buffer, 80) + 132; + top = 9; + } + else + { + xPos = GetStringCenterAlignXOffset(1, buffer, 96) + 120; + top = 9; + } + + AddTextPrinterParameterized3(1, 1, xPos, top, gUnknown_0856FB0C, -1, buffer); +} + +void sub_80C3684(void) +{ + s32 xOffset; + u8 top; + if(!gUnknown_02039CE8->var_52B) + AddTextPrinterParameterized3(1, 1, 20, 56, gUnknown_0856FB0C, -1, gText_TrainerCardMoney); + else + AddTextPrinterParameterized3(1, 1, 16, 57, gUnknown_0856FB0C, -1, gText_TrainerCardMoney); + ConvertIntToDecimalStringN(gStringVar1, gUnknown_02039CE8->var_534.money, 0, 6); + StringExpandPlaceholders(gStringVar4, gText_PokedollarVar1); + if(!gUnknown_02039CE8->var_52B) + { + xOffset = GetStringRightAlignXOffset(1, gStringVar4, 144); + top = 56; + } + else + { + xOffset = GetStringRightAlignXOffset(1, gStringVar4, 128); + top = 57; + } + AddTextPrinterParameterized3(1, 1, xOffset, top, gUnknown_0856FB0C, -1, gStringVar4); +} + +u16 sub_80C376C(void) +{ + if(IsNationalPokedexEnabled()) + return GetNationalPokedexCount(FLAG_GET_CAUGHT); + + return GetHoennPokedexCount(FLAG_GET_CAUGHT); +} + +void sub_80C378C(void) +{ + s32 xOffset; + u8 top; + if(FlagGet(FLAG_SYS_POKEDEX_GET)) + { + if(!gUnknown_02039CE8->var_52B) + AddTextPrinterParameterized3(1, 1, 20, 72, gUnknown_0856FB0C, -1, gText_TrainerCardPokedex); + else + AddTextPrinterParameterized3(1, 1, 16, 73, gUnknown_0856FB0C, -1,gText_TrainerCardPokedex); + StringCopy(ConvertIntToDecimalStringN(gStringVar4, gUnknown_02039CE8->var_534.pokedexCaught, 0, 3), gText_EmptyString6); + if(!gUnknown_02039CE8->var_52B) + { + xOffset = GetStringRightAlignXOffset(1, gStringVar4, 144); + top = 72; + } + else + { + xOffset = GetStringRightAlignXOffset(1, gStringVar4, 128); + top = 73; + } + AddTextPrinterParameterized3(1, 1, xOffset, top, gUnknown_0856FB0C, -1, gStringVar4); + } +} + +void sub_80C3880(void) +{ + u16 hours; + u16 minutes; + s32 width; + u32 r7, r4, r10; + if(!gUnknown_02039CE8->var_52B) + AddTextPrinterParameterized3(1, 1, 20, 88, gUnknown_0856FB0C, -1, gText_TrainerCardTime); + else + AddTextPrinterParameterized3(1, 1, 16, 89, gUnknown_0856FB0C, -1, gText_TrainerCardTime); + if(gUnknown_02039CE8->var_5) + { + hours = gUnknown_02039CE8->var_534.playTimeHours; + minutes = gUnknown_02039CE8->var_534.playTimeMinutes; + } + else + { + hours = gSaveBlock2Ptr->playTimeHours; + minutes = gSaveBlock2Ptr->playTimeMinutes; + } + if(hours > 999) + hours = 999; + if(minutes > 59) + minutes = 59; + width = GetStringWidth(1, gText_Colon2, 0); + + if(!gUnknown_02039CE8->var_52B) + { + r7 = 144; + r4 = 88; + } + else + { + r7 = 128; + r4 = 89; + } + r10 = width + 30; + r7 -= r10; + + FillWindowPixelRect(1, 0, r7, r4, r10, 15); + ConvertIntToDecimalStringN(gStringVar4, hours, 1, 3); + AddTextPrinterParameterized3(1, 1, r7, r4, gUnknown_0856FB0C, -1, gStringVar4); + r7 += 18; + AddTextPrinterParameterized3(1, 1, r7, r4, gUnknown_0856FB40[gUnknown_02039CE8->var_7], -1, gText_Colon2); + r7 += width; + ConvertIntToDecimalStringN(gStringVar4, minutes, 2, 2); + AddTextPrinterParameterized3(1, 1, r7, r4, gUnknown_0856FB0C, -1, gStringVar4); +} + +void sub_80C3A18(void) +{ + if(gUnknown_02039CE8->var_5) + { + AddTextPrinterParameterized3(1, 1, 8, gUnknown_0856FB48[gUnknown_02039CE8->var_52B], gUnknown_0856FB0C, -1, gUnknown_02039CE8->var_19); + AddTextPrinterParameterized3(1, 1, GetStringWidth(1, gUnknown_02039CE8->var_19, 0) + 14, gUnknown_0856FB48[gUnknown_02039CE8->var_52B], gUnknown_0856FB0C, -1, gUnknown_02039CE8->var_26); + AddTextPrinterParameterized3(1, 1, 8, gUnknown_0856FB4A[gUnknown_02039CE8->var_52B], gUnknown_0856FB0C, -1, gUnknown_02039CE8->var_33); + AddTextPrinterParameterized3(1, 1, GetStringWidth(1, gUnknown_02039CE8->var_33, 0) + 14, gUnknown_0856FB4A[gUnknown_02039CE8->var_52B], gUnknown_0856FB0C, -1, gUnknown_02039CE8->var_40); + } +} + +void sub_80C3AF0(void) +{ + StringCopy(gUnknown_02039CE8->var_4D, gUnknown_02039CE8->var_534.playerName); + ConvertInternationalString(gUnknown_02039CE8->var_4D, gUnknown_02039CE8->var_7CAA); + if(gUnknown_02039CE8->var_52A) + { + StringCopy(gStringVar1, gUnknown_02039CE8->var_4D); + StringExpandPlaceholders(gUnknown_02039CE8->var_4D, gText_Var1sTrainerCard); + } +} + +void sub_80C3B50(void) +{ + if(!gUnknown_02039CE8->var_52B) + AddTextPrinterParameterized3(1, 1, 136, 9, gUnknown_0856FB0C, -1, gUnknown_02039CE8->var_4D); + else + AddTextPrinterParameterized3(1, 1, GetStringRightAlignXOffset(1, gUnknown_02039CE8->var_4D, 216), 9, gUnknown_0856FB0C, -1, gUnknown_02039CE8->var_4D); +} + +void sub_80C3BC4(void) +{ + if(gUnknown_02039CE8->var_B) + { + ConvertIntToDecimalStringN(gStringVar1, gUnknown_02039CE8->var_534.firstHallOfFameA, 1, 3); + ConvertIntToDecimalStringN(gStringVar2, gUnknown_02039CE8->var_534.firstHallOfFameB, 2, 2); + ConvertIntToDecimalStringN(gStringVar3, gUnknown_02039CE8->var_534.firstHallOfFameC, 2, 2); + StringExpandPlaceholders(gUnknown_02039CE8->var_93, gUnknown_0856FB4C); + } +} + +void sub_80C3C34(u8 top, const u8* str1, u8* str2, const u8* color) +{ + AddTextPrinterParameterized3(1, 1, gUnknown_0856FB55[gUnknown_02039CE8->var_52B], top * 16 + 33, gUnknown_0856FB0C, -1, str1); + AddTextPrinterParameterized3(1, 1, GetStringRightAlignXOffset(1, str2, gUnknown_0856FB57[gUnknown_02039CE8->var_52B]), top * 16 + 33, color, -1, str2); +} + +void sub_80C3CCC(void) +{ + if(gUnknown_02039CE8->var_B) + sub_80C3C34(0, gText_HallOfFameDebut, gUnknown_02039CE8->var_93, gUnknown_0856FB0F); +} + +void sub_80C3CF4(void) +{ + if(gUnknown_02039CE8->var_C) + { + StringCopy(gUnknown_02039CE8->var_D9, gUnknown_0856FB5C[gUnknown_02039CE8->var_52A]); + ConvertIntToDecimalStringN(gUnknown_02039CE8->var_165, gUnknown_02039CE8->var_534.linkBattleWins, 0, 4); + ConvertIntToDecimalStringN(gUnknown_02039CE8->var_1AB, gUnknown_02039CE8->var_534.linkBattleLosses, 0, 4); + } +} + +void sub_80C3D60(void) +{ + if(gUnknown_02039CE8->var_C) + { + StringCopy(gStringVar1, gUnknown_02039CE8->var_165); + StringCopy(gStringVar2, gUnknown_02039CE8->var_1AB); + StringExpandPlaceholders(gStringVar4, gText_WinsLosses); + sub_80C3C34(1, gUnknown_02039CE8->var_D9, gStringVar4, gUnknown_0856FB0C); + } +} + +void sub_80C3DC0(void) +{ + if(gUnknown_02039CE8->var_10) + ConvertIntToDecimalStringN(gUnknown_02039CE8->var_237, gUnknown_02039CE8->var_534.pokemonTrades, 1, 5); +} + +void sub_80C3DF0(void) +{ + if(gUnknown_02039CE8->var_10) + sub_80C3C34(2, gText_PokemonTrades, gUnknown_02039CE8->var_237, gUnknown_0856FB0F); +} + +void sub_80C3E20(void) +{ + if(!gUnknown_02039CE8->var_52A && gUnknown_02039CE8->var_534.var_3C) + ConvertIntToDecimalStringN(gUnknown_02039CE8->var_2C3, gUnknown_02039CE8->var_534.var_3C, 1, 5); +} + +void sub_80C3E58(void) +{ + if(!gUnknown_02039CE8->var_52A && gUnknown_02039CE8->var_534.var_3C) + sub_80C3C34(4, gText_BerryCrush, gUnknown_02039CE8->var_2C3, gUnknown_0856FB0F); +} + +void sub_80C3E98(void) +{ + if(!gUnknown_02039CE8->var_52A && gUnknown_02039CE8->var_534.var_40) + ConvertIntToDecimalStringN(gUnknown_02039CE8->var_34F, gUnknown_02039CE8->var_534.var_40, 1, 5); +} + +void sub_80C3ED4(void) +{ + if(!gUnknown_02039CE8->var_52A && gUnknown_02039CE8->var_534.var_40) + sub_80C3C34(3, gText_UnionTradesAndBattles, gUnknown_02039CE8->var_34F, gUnknown_0856FB0F); +} + +void sub_80C3F14(void) +{ + if(gUnknown_02039CE8->var_52A && gUnknown_02039CE8->var_534.pokeblocksWithFriends) + { + ConvertIntToDecimalStringN(gStringVar1, gUnknown_02039CE8->var_534.pokeblocksWithFriends, 1, 5); + StringExpandPlaceholders(gUnknown_02039CE8->var_395, gText_Var1DarkGreyShadowLightGrey); + } +} + +void sub_80C3F64(void) +{ + if(gUnknown_02039CE8->var_52A && gUnknown_02039CE8->var_534.pokeblocksWithFriends) + sub_80C3C34(3, gText_PokeblocksWithFriends, gUnknown_02039CE8->var_395, gUnknown_0856FB0F); +} + +void sub_80C3FA4(void) +{ + if(gUnknown_02039CE8->var_52A && gUnknown_02039CE8->var_534.contestsWithFriends) + ConvertIntToDecimalStringN(gUnknown_02039CE8->var_3DB, gUnknown_02039CE8->var_534.contestsWithFriends, 1, 5); +} + +void sub_80C3FE0(void) +{ + if(gUnknown_02039CE8->var_52A && gUnknown_02039CE8->var_534.contestsWithFriends) + sub_80C3C34(4, gText_WonContestsWFriends, gUnknown_02039CE8->var_3DB, gUnknown_0856FB0F); +} + +void sub_80C4020(void) +{ + switch(gUnknown_02039CE8->var_52A) + { + case 1: + if(gUnknown_02039CE8->var_D) + { + ConvertIntToDecimalStringN(gStringVar1, gUnknown_02039CE8->var_534.battleTowerWins, 1, 4); + ConvertIntToDecimalStringN(gStringVar2, gUnknown_02039CE8->var_534.battleTowerLosses, 1, 4); + StringExpandPlaceholders(gUnknown_02039CE8->var_421, gText_WSlashStraightSlash); + } + break; + + case 2: + if(gUnknown_02039CE8->var_534.var_62) + { + ConvertIntToDecimalStringN(gStringVar1, gUnknown_02039CE8->var_534.var_62, 1, 5); + StringExpandPlaceholders(gUnknown_02039CE8->var_421, gText_Var1DarkLightGreyBP); + } + case 0: + } +} + +void sub_80C40CC(void) +{ + switch(gUnknown_02039CE8->var_52A) + { + case 1: + if(gUnknown_02039CE8->var_D) + sub_80C3C34(5, gText_BattleTower, gUnknown_02039CE8->var_421, gUnknown_0856FB0C); + break; + case 2: + if(gUnknown_02039CE8->var_534.var_62) + sub_80C3C34(5, gText_BattlePtsWon, gUnknown_02039CE8->var_421, gUnknown_0856FB0F); + case 0: + } +} + +void sub_80C4140(void) +{ + u8 i; + u8 buffer[8]; + u8 buffer2[8]; + memcpy(buffer, gUnknown_0856FB68, sizeof(gUnknown_0856FB68)); + memcpy(buffer2, gUnknown_0856FB6E, sizeof(gUnknown_0856FB6E)); + + if(!gUnknown_02039CE8->var_52A) + { + for(i = 0; i < 6; i++) + { + if(gUnknown_02039CE8->var_534.monSpecies[i]) + { + u8 monSpecies = sub_80D30A0(gUnknown_02039CE8->var_534.monSpecies[i]); + WriteSequenceToBgTilemapBuffer(3, 16 * i + 224, buffer2[i] + 3, 15, 4, 4, buffer[monSpecies], 1); + } + } + } +} + +void sub_80C41D8(void) +{ + u8 i; + CpuSet(gMonIconPalettes, gUnknown_02039CE8->var_468, 0x60); + switch(gUnknown_02039CE8->var_534.var_4E) + { + case 1: + TintPalette_CustomTone(gUnknown_02039CE8->var_468, 96, 0, 0, 0); + break; + case 2: + TintPalette_CustomTone(gUnknown_02039CE8->var_468, 96, 500, 330, 310); + break; + case 3: + TintPalette_SepiaTone(gUnknown_02039CE8->var_468, 96); + case 0: + } + LoadPalette(gUnknown_02039CE8->var_468, 80, 192); + + for(i = 0; i < 6; i++) + { + if(gUnknown_02039CE8->var_534.monSpecies[i]) + LoadBgTiles(3, GetMonIconTiles(gUnknown_02039CE8->var_534.monSpecies[i], 0), 512, 16 * i + 32); + } +} + +void sub_80C42A4(void) +{ + u8 i; + u8 buffer[4]; + memcpy(buffer, gUnknown_0856FB74, sizeof(gUnknown_0856FB74)); + if(!gUnknown_02039CE8->var_52A && gUnknown_02039CE8->var_534.var_4C == 1) + { + for(i = 0; i < 3; i++) + { + u8 var_50 = gUnknown_02039CE8->var_534.var_50[i]; + if(gUnknown_02039CE8->var_534.var_50[i]) + WriteSequenceToBgTilemapBuffer(3, i * 4 + 320, i * 3 + 2, 2, 2, 2, buffer[var_50 - 1], 1); + } + } +} + +void sub_80C4330(void) +{ + LoadPalette(gUnknown_0856F54C, 176, 32); + LoadPalette(gUnknown_0856F56C, 192, 32); + LoadPalette(gUnknown_0856F58C, 208, 32); + LoadPalette(gUnknown_0856F5AC, 224, 32); + LoadBgTiles(3, gUnknown_02039CE8->var_17A8, 1024, 128); +} + +void sub_80C438C(u8 windowId) +{ + PutWindowTilemap(windowId); + CopyWindowToVram(windowId, 3); +} + +u8 sub_80C43A8(void) +{ + switch(gUnknown_02039CE8->var_3) + { + case 0: + LoadBgTiles(3, gUnknown_02039CE8->var_13A8, 1024, 0); + break; + case 1: + LoadBgTiles(0, gUnknown_02039CE8->var_19A8, 6144, 0); + break; + case 2: + if(gUnknown_02039CE8->var_52A) + { + LoadPalette(gEmeraldTrainerCardStarPals[gUnknown_02039CE8->var_534.stars], 0, 96); + LoadPalette(gUnknown_0856F4EC, 48, 32); + if(gUnknown_02039CE8->var_534.gender) + LoadPalette(gUnknown_0856F4AC, 16, 32); + } + else + { + LoadPalette(gFireRedTrainerCardStarPals[gUnknown_02039CE8->var_534.stars], 0, 96); + LoadPalette(gUnknown_0856F50C, 48, 32); + if(gUnknown_02039CE8->var_534.gender) + LoadPalette(gUnknown_0856F4CC, 16, 32); + } + LoadPalette(gUnknown_0856F52C, 64, 32); + break; + case 3: + SetBgTilemapBuffer(0, gUnknown_02039CE8->var_3CA8); + SetBgTilemapBuffer(2, gUnknown_02039CE8->var_5CA8); + break; + case 4: + FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 32, 32); + FillBgTilemapBufferRect_Palette0(2, 0, 0, 0, 32, 32); + FillBgTilemapBufferRect_Palette0(3, 0, 0, 0, 32, 32); + default: + return 1; + } + gUnknown_02039CE8->var_3++; return 0; } +NAKED +void sub_80C4550(u8* ptr) //nested loop +{ + asm("\n\ + .syntax unified\n\ + push {r4-r7,lr}\n\ + adds r7, r0, 0\n\ + ldr r0, =gUnknown_02039CE8\n\ + ldr r0, [r0]\n\ + ldr r1, =0x00005ca8\n\ + adds r6, r0, r1\n\ + movs r1, 0\n\ +_080C455E:\n\ + movs r2, 0\n\ + lsls r5, r1, 16\n\ + asrs r1, r5, 16\n\ + lsls r3, r1, 5\n\ + lsls r0, r1, 4\n\ + subs r0, r1\n\ + lsls r4, r0, 1\n\ +_080C456C:\n\ + lsls r0, r2, 16\n\ + asrs r1, r0, 16\n\ + adds r2, r0, 0\n\ + cmp r1, 0x1D\n\ + bgt _080C4590\n\ + adds r0, r3, r1\n\ + lsls r0, 1\n\ + adds r0, r6\n\ + adds r1, r4, r1\n\ + lsls r1, 1\n\ + adds r1, r7\n\ + ldrh r1, [r1]\n\ + b _080C4598\n\ + .pool\n\ +_080C4590:\n\ + adds r0, r3, r1\n\ + lsls r0, 1\n\ + adds r0, r6\n\ + ldrh r1, [r7]\n\ +_080C4598:\n\ + strh r1, [r0]\n\ + movs r1, 0x80\n\ + lsls r1, 9\n\ + adds r0, r2, r1\n\ + lsrs r2, r0, 16\n\ + asrs r0, 16\n\ + cmp r0, 0x1F\n\ + ble _080C456C\n\ + adds r0, r5, r1\n\ + lsrs r1, r0, 16\n\ + asrs r0, 16\n\ + cmp r0, 0x13\n\ + ble _080C455E\n\ + movs r0, 0x2\n\ + bl CopyBgTilemapBufferToVram\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .syntax divided"); +} + +NAKED +void sub_80C45C0(u8* ptr) //nested loop +{ + asm("\n\ + .syntax unified\n\ + push {r4-r7,lr}\n\ + adds r7, r0, 0\n\ + ldr r0, =gUnknown_02039CE8\n\ + ldr r0, [r0]\n\ + ldr r1, =0x00003ca8\n\ + adds r6, r0, r1\n\ + movs r1, 0\n\ +_080C45CE:\n\ + movs r2, 0\n\ + lsls r5, r1, 16\n\ + asrs r1, r5, 16\n\ + lsls r3, r1, 5\n\ + lsls r0, r1, 4\n\ + subs r0, r1\n\ + lsls r4, r0, 1\n\ +_080C45DC:\n\ + lsls r0, r2, 16\n\ + asrs r1, r0, 16\n\ + adds r2, r0, 0\n\ + cmp r1, 0x1D\n\ + bgt _080C4600\n\ + adds r0, r3, r1\n\ + lsls r0, 1\n\ + adds r0, r6\n\ + adds r1, r4, r1\n\ + lsls r1, 1\n\ + adds r1, r7\n\ + ldrh r1, [r1]\n\ + b _080C4608\n\ + .pool\n\ +_080C4600:\n\ + adds r0, r3, r1\n\ + lsls r0, 1\n\ + adds r0, r6\n\ + ldrh r1, [r7]\n\ +_080C4608:\n\ + strh r1, [r0]\n\ + movs r1, 0x80\n\ + lsls r1, 9\n\ + adds r0, r2, r1\n\ + lsrs r2, r0, 16\n\ + asrs r0, 16\n\ + cmp r0, 0x1F\n\ + ble _080C45DC\n\ + adds r0, r5, r1\n\ + lsrs r1, r0, 16\n\ + asrs r0, 16\n\ + cmp r0, 0x13\n\ + ble _080C45CE\n\ + movs r0, 0\n\ + bl CopyBgTilemapBufferToVram\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .syntax divided"); +} + +NAKED +void sub_80C4630(void) +{ + asm("\n\ + .syntax unified\n\ + push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0xC\n\ + movs r0, 0xC0\n\ + mov r8, r0\n\ + movs r2, 0x3\n\ + mov r10, r2\n\ + ldr r2, =gUnknown_0856FB78\n\ + ldr r4, =gUnknown_02039CE8\n\ + ldr r1, [r4]\n\ + ldr r3, =0x0000052b\n\ + adds r0, r1, r3\n\ + ldrb r0, [r0]\n\ + adds r0, r2\n\ + ldrb r3, [r0]\n\ + ldr r0, =0x00000535\n\ + adds r1, r0\n\ + ldrb r0, [r1]\n\ + str r0, [sp]\n\ + movs r0, 0x1\n\ + str r0, [sp, 0x4]\n\ + movs r0, 0x4\n\ + str r0, [sp, 0x8]\n\ + movs r0, 0x3\n\ + movs r1, 0x8F\n\ + movs r2, 0xF\n\ + bl FillBgTilemapBufferRect\n\ + ldr r0, [r4]\n\ + ldrb r0, [r0, 0x5]\n\ + cmp r0, 0\n\ + bne _080C4724\n\ + movs r2, 0x4\n\ + mov r9, r2\n\ + movs r2, 0\n\ + movs r6, 0x1\n\ +_080C467E:\n\ + ldr r0, =gUnknown_02039CE8\n\ + ldr r1, [r0]\n\ + lsls r0, r2, 16\n\ + asrs r7, r0, 16\n\ + adds r1, 0x11\n\ + adds r1, r7\n\ + ldrb r0, [r1]\n\ + cmp r0, 0\n\ + beq _080C4700\n\ + mov r3, r9\n\ + lsls r5, r3, 24\n\ + lsrs r5, 24\n\ + str r6, [sp]\n\ + str r6, [sp, 0x4]\n\ + mov r0, r10\n\ + str r0, [sp, 0x8]\n\ + movs r0, 0x3\n\ + mov r1, r8\n\ + adds r2, r5, 0\n\ + movs r3, 0xF\n\ + bl FillBgTilemapBufferRect\n\ + mov r1, r8\n\ + adds r1, 0x1\n\ + lsls r1, 16\n\ + lsrs r1, 16\n\ + mov r4, r9\n\ + adds r4, 0x1\n\ + lsls r4, 24\n\ + lsrs r4, 24\n\ + str r6, [sp]\n\ + str r6, [sp, 0x4]\n\ + mov r2, r10\n\ + str r2, [sp, 0x8]\n\ + movs r0, 0x3\n\ + adds r2, r4, 0\n\ + movs r3, 0xF\n\ + bl FillBgTilemapBufferRect\n\ + mov r1, r8\n\ + adds r1, 0x10\n\ + lsls r1, 16\n\ + lsrs r1, 16\n\ + str r6, [sp]\n\ + str r6, [sp, 0x4]\n\ + mov r3, r10\n\ + str r3, [sp, 0x8]\n\ + movs r0, 0x3\n\ + adds r2, r5, 0\n\ + movs r3, 0x10\n\ + bl FillBgTilemapBufferRect\n\ + mov r1, r8\n\ + adds r1, 0x11\n\ + lsls r1, 16\n\ + lsrs r1, 16\n\ + str r6, [sp]\n\ + str r6, [sp, 0x4]\n\ + mov r0, r10\n\ + str r0, [sp, 0x8]\n\ + movs r0, 0x3\n\ + adds r2, r4, 0\n\ + movs r3, 0x10\n\ + bl FillBgTilemapBufferRect\n\ +_080C4700:\n\ + adds r0, r7, 0x1\n\ + lsls r0, 16\n\ + mov r1, r8\n\ + adds r1, 0x2\n\ + lsls r1, 16\n\ + lsrs r1, 16\n\ + mov r8, r1\n\ + mov r2, r9\n\ + lsls r1, r2, 16\n\ + movs r3, 0xC0\n\ + lsls r3, 10\n\ + adds r1, r3\n\ + lsrs r1, 16\n\ + mov r9, r1\n\ + lsrs r2, r0, 16\n\ + asrs r0, 16\n\ + cmp r0, 0x7\n\ + ble _080C467E\n\ +_080C4724:\n\ + movs r0, 0x3\n\ + bl CopyBgTilemapBufferToVram\n\ + add sp, 0xC\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided"); +} + +void sub_80C474C(void) +{ + if(!gUnknown_02039CE8->var_52A) + { + if(gUnknown_02039CE8->var_10) + { + FillBgTilemapBufferRect(3, 141, 27, 9, 1, 1, 1); + FillBgTilemapBufferRect(3, 157, 27, 10, 1, 1, 1); + } + if(gUnknown_02039CE8->var_534.var_3C) + { + FillBgTilemapBufferRect(3, 141, 21, 13, 1, 1, 1); + FillBgTilemapBufferRect(3, 157, 21, 14, 1, 1, 1); + } + if(gUnknown_02039CE8->var_534.var_40) + { + FillBgTilemapBufferRect(3, 141, 27, 11, 1, 1, 1); + FillBgTilemapBufferRect(3, 157, 27, 12, 1, 1, 1); + } + } + else + { + if(gUnknown_02039CE8->var_10) + { + FillBgTilemapBufferRect(3, 141, 27, 9, 1, 1, 0); + FillBgTilemapBufferRect(3, 157, 27, 10, 1, 1, 0); + } + if(gUnknown_02039CE8->var_534.contestsWithFriends) + { + FillBgTilemapBufferRect(3, 141, 27, 13, 1, 1, 0); + FillBgTilemapBufferRect(3, 157, 27, 14, 1, 1, 0); + } + if(gUnknown_02039CE8->var_D) + { + FillBgTilemapBufferRect(3, 141, 17, 15, 1, 1, 0); + FillBgTilemapBufferRect(3, 157, 17, 16, 1, 1, 0); + FillBgTilemapBufferRect(3, 140, 27, 15, 1, 1, 0); + FillBgTilemapBufferRect(3, 156, 27, 16, 1, 1, 0); + } + } + CopyBgTilemapBufferToVram(3); +} + +void sub_80C48C8(void) +{ + if(++gUnknown_02039CE8->var_6 > 60) + { + gUnknown_02039CE8->var_6 = 0; + gUnknown_02039CE8->var_7 ^= 1; + gUnknown_02039CE8->var_529 = 1; + } +} + +u8 sub_80C4904(u8 cardId) +{ + struct TrainerCard* trainerCards = gTrainerCards; + return trainerCards[cardId].stars; +} + +void sub_80C4918(void) +{ + u8 taskId = CreateTask(sub_80C4960, 0); + sub_80C4960(taskId); + SetHBlankCallback(sub_80C26D4); +} + +bool8 sub_80C4940(void) +{ + if(FindTaskIdByFunc(sub_80C4960) == 0xFF) + return TRUE; + return FALSE; +} + +void sub_80C4960(u8 taskId) +{ + while(gUnknown_0856FB28[gTasks[taskId].data[0]](&gTasks[taskId])) + ; +} + +bool8 sub_80C4998(struct Task* task) +{ + u32 i; + HideBg(1); + HideBg(3); + ScanlineEffect_Stop(); + ScanlineEffect_Clear(); + for(i = 0; i < 160; i++) + gScanlineEffectRegBuffers[1][i] = 0; + task->data[0]++; + return FALSE; +}