From e6cca1523286e9f730db0ed36b9945047bde7bc6 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Fri, 4 May 2018 18:59:59 -0400 Subject: [PATCH] sub_80D8B38 --- asm/contest.s | 2472 -------------------------------- include/constants/moves.h | 1 + include/contest_link_80FC4F4.h | 7 + src/contest.c | 757 +++++++++- 4 files changed, 764 insertions(+), 2473 deletions(-) create mode 100644 include/contest_link_80FC4F4.h diff --git a/asm/contest.s b/asm/contest.s index f233849a75..8292760b80 100644 --- a/asm/contest.s +++ b/asm/contest.s @@ -5,2478 +5,6 @@ .text - thumb_func_start sub_80D8B38 -sub_80D8B38: @ 80D8B38 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r2, =gContestResources - ldr r0, [r2] - ldr r0, [r0] - ldrb r6, [r0, 0x11] - ldr r1, =gTasks - mov r3, r8 - lsls r0, r3, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r4, 0x8 - ldrsh r0, [r0, r4] - mov r9, r2 - adds r4, r1, 0 - cmp r0, 0x3B - bls _080D8B6E - bl _080DA100 -_080D8B6E: - lsls r0, 2 - ldr r1, =_080D8B84 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080D8B84: - .4byte _080D8C74 - .4byte _080D8D30 - .4byte _080D8D56 - .4byte _080D8DC4 - .4byte _080D8E7C - .4byte _080D8EC8 - .4byte _080D8F84 - .4byte _080D8FB8 - .4byte _080D9010 - .4byte _080D908C - .4byte _080D9FC0 - .4byte _080D9FEC - .4byte _080D9238 - .4byte _080D926C - .4byte _080D9774 - .4byte _080D9864 - .4byte _080D98D4 - .4byte _080D9904 - .4byte _080D99EC - .4byte _080D999E - .4byte _080DA024 - .4byte _080DA0A0 - .4byte _080DA0C2 - .4byte _080D90B4 - .4byte _080D9180 - .4byte _080D9388 - .4byte _080D939E - .4byte _080D947C - .4byte _080D94A0 - .4byte _080D9508 - .4byte _080D95EC - .4byte _080DA038 - .4byte _080DA080 - .4byte _080D9EBC - .4byte _080D9F48 - .4byte _080D929A - .4byte _080D92D0 - .4byte _080D92F6 - .4byte _080D9334 - .4byte _080D955C - .4byte _080D95C4 - .4byte _080D9A2C - .4byte _080DA100 - .4byte _080D9DAC - .4byte _080DA100 - .4byte _080D9830 - .4byte _080D997C - .4byte _080D921A - .4byte _080D91A4 - .4byte _080D91F4 - .4byte _080D935C - .4byte _080D9690 - .4byte _080D971C - .4byte _080D9BAA - .4byte _080D9C68 - .4byte _080D9F68 - .4byte _080D9F84 - .4byte _080D9DD4 - .4byte _080D9E60 - .4byte _080D9EA0 -_080D8C74: - bl sub_80DCD48 - movs r7, 0 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0] - ldr r0, [r0, 0x8] - ldrb r1, [r1, 0x10] - mov r5, r8 - lsls r5, 2 - mov r10, r5 - ldrb r2, [r0] - cmp r1, r2 - beq _080D8C9C - adds r2, r0, 0 -_080D8C92: - adds r7, 0x1 - adds r0, r2, r7 - ldrb r0, [r0] - cmp r1, r0 - bne _080D8C92 -_080D8C9C: - ldr r4, =gContestResources - ldr r0, [r4] - ldr r0, [r0] - strb r7, [r0, 0x11] - ldr r0, [r4] - ldr r2, [r0] - ldrb r6, [r2, 0x11] - ldr r0, =gIsLinkContest - ldrb r1, [r0] - movs r5, 0x1 - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - beq _080D8D14 - ldrb r0, [r2, 0x7] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2, 0x7] - bl sub_80DA8A4 - lsls r0, 24 - cmp r0, 0 - beq _080D8CD4 - ldr r0, [r4] - ldr r0, [r0] - ldrb r0, [r0, 0x11] - bl sub_80DD080 -_080D8CD4: - ldr r4, =sub_80FCC88 - adds r0, r4, 0 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =sub_80DA110 - adds r1, r4, 0 - bl SetTaskFuncWithFollowupFunc - bl sub_80DBF68 - ldr r1, =gTasks - mov r0, r10 - add r0, r8 - lsls r0, 3 - adds r0, r1 - strh r5, [r0, 0x8] - bl _080DA100 - .pool -_080D8D14: - adds r0, r6, 0 - bl sub_80DD080 - ldr r0, =gTasks - mov r1, r10 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x2 - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D8D30: - mov r3, r9 - ldr r0, [r3] - ldr r0, [r0] - ldrb r1, [r0, 0x7] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080D8D44 - bl _080DA100 -_080D8D44: - mov r5, r8 - lsls r0, r5, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - movs r1, 0x2 - strh r1, [r0, 0x8] - bl _080DA100 -_080D8D56: - adds r0, r6, 0 - bl sub_80DF080 - bl sub_80DF750 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r0, 2 - adds r2, r0, r1 - ldrb r1, [r2, 0xC] - movs r0, 0x6 - ands r0, r1 - cmp r0, 0 - bne _080D8D86 - ldrb r1, [r2, 0xB] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0 - beq _080D8DA4 -_080D8D86: - ldr r0, =gTasks - mov r2, r8 - lsls r1, r2, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x1F - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D8DA4: - bl sub_80DB89C - ldr r0, =gTasks - mov r3, r8 - lsls r1, r3, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - strh r6, [r1, 0x1C] - movs r0, 0x3 - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D8DC4: - mov r4, r8 - lsls r4, 2 - mov r10, r4 - ldr r1, =gBattleMonForms - movs r2, 0 - adds r0, r1, 0x3 -_080D8DD0: - strb r2, [r0] - subs r0, 0x1 - cmp r0, r1 - bge _080D8DD0 - movs r7, 0x4 - mov r5, r9 - ldr r0, [r5] - ldr r0, [r0, 0x18] - movs r1, 0 - movs r2, 0x14 - bl memset - ldr r0, [r5] - ldr r0, [r0] - ldrb r0, [r0, 0x11] - bl sub_80DE9DC - ldr r4, =gContestMons - ldr r0, [r5] - ldr r0, [r0] - ldrb r3, [r0, 0x11] - lsls r2, r3, 6 - adds r0, r2, r4 - ldrh r0, [r0] - adds r1, r4, 0 - adds r1, 0x3C - adds r1, r2, r1 - ldr r1, [r1] - adds r4, 0x38 - adds r2, r4 - ldr r2, [r2] - bl sub_80DB174 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r2, =gSprites - lsls r0, r5, 4 - adds r0, r5 - lsls r0, 2 - adds r3, r0, r2 - movs r1, 0x78 - strh r1, [r3, 0x24] - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_80DA134 - str r1, [r0] - ldr r0, =gTasks - mov r4, r10 - add r4, r8 - lsls r4, 3 - adds r4, r0 - strh r5, [r4, 0xC] - ldr r1, =gBattlerSpriteIds - ldr r0, =gBattlerAttacker - ldrb r0, [r0] - adds r0, r1 - strb r5, [r0] - mov r1, r9 - ldr r0, [r1] - ldr r0, [r0] - ldrb r0, [r0, 0x11] - bl sub_80DC9EC - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl sub_80DCBE8 - strh r7, [r4, 0x8] - bl _080DA100 - .pool -_080D8E7C: - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 3 - adds r2, r0, r4 - ldrb r5, [r2, 0xC] - ldr r1, =gSprites - lsls r0, r5, 4 - adds r0, r5 - lsls r0, 2 - adds r1, 0x1C - adds r0, r1 - ldr r1, [r0] - ldr r0, =SpriteCallbackDummy - cmp r1, r0 - beq _080D8EA0 - bl _080DA100 -_080D8EA0: - mov r3, r9 - ldr r0, [r3] - ldr r1, [r0, 0x14] - lsls r0, r6, 2 - adds r0, r1 - ldrb r1, [r0, 0x2] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080D8EB8 - bl _080DA100 -_080D8EB8: - movs r0, 0x5 - strh r0, [r2, 0x8] - bl _080DA100 - .pool -_080D8EC8: - mov r5, r9 - ldr r0, [r5] - ldr r1, [r0, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r5, r0, 2 - adds r1, r5, r1 - ldrb r1, [r1, 0xC] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080D8EF2 - mov r1, r8 - lsls r0, r1, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - movs r1, 0x21 - strh r1, [r0, 0x8] - bl _080DA100 -_080D8EF2: - bl sub_80DB89C - ldr r0, =gStringVar1 - lsls r1, r6, 6 - ldr r2, =gContestMons + 2 - adds r1, r2 - bl StringCopy - mov r2, r9 - ldr r0, [r2] - ldr r0, [r0, 0x4] - adds r3, r5, r0 - ldrh r1, [r3, 0x6] - movs r0, 0xB1 - lsls r0, 1 - cmp r1, r0 - bhi _080D8F38 - ldr r0, =gStringVar2 - adds r2, r1, 0 - movs r1, 0xD - muls r1, r2 - ldr r2, =gMoveNames - adds r1, r2 - bl StringCopy - b _080D8F48 - .pool -_080D8F38: - ldr r0, =gStringVar2 - ldr r2, =gUnknown_08587F1C - ldrb r1, [r3, 0xA] - lsls r1, 2 - adds r1, r2 - ldr r1, [r1] - bl StringCopy -_080D8F48: - ldr r4, =gStringVar4 - ldr r1, =gText_0827D55A - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_80DEC30 - ldr r1, =gTasks - mov r3, r8 - lsls r0, r3, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0x6 - strh r1, [r0, 0x8] - bl _080DA100 - .pool -_080D8F84: - bl sub_80DED4C - adds r1, r0, 0 - cmp r1, 0 - beq _080D8F92 - bl _080DA100 -_080D8F92: - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0] - adds r0, 0x5A - strb r1, [r0] - ldr r1, =gTasks - mov r4, r8 - lsls r0, r4, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0x7 - strh r1, [r0, 0x8] - bl _080DA100 - .pool -_080D8FB8: - mov r5, r9 - ldr r1, [r5] - ldr r0, [r1] - ldrb r2, [r0, 0x11] - ldr r1, [r1, 0x4] - lsls r0, r2, 3 - subs r0, r2 - lsls r0, 2 - adds r0, r1 - ldrh r0, [r0, 0x6] - bl sub_80DE834 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldr r0, [r5] - ldr r0, [r0] - ldrb r0, [r0, 0x11] - bl sub_80DE864 - ldr r0, [r5] - ldr r0, [r0] - ldrb r0, [r0, 0x11] - bl sub_80DE9DC - adds r0, r4, 0 - bl sub_80DEAA8 - adds r0, r4, 0 - bl DoMoveAnim - ldr r1, =gTasks - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0x8 - strh r1, [r0, 0x8] - bl _080DA100 - .pool -_080D9010: - ldr r0, =gAnimScriptCallback - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gAnimScriptActive - ldrb r4, [r0] - cmp r4, 0 - beq _080D9024 - bl _080DA100 -_080D9024: - adds r0, r6, 0 - bl sub_80DE9B0 - ldr r0, =gContestResources - ldr r1, [r0] - ldr r0, [r1] - adds r0, 0x5A - ldrb r0, [r0] - cmp r0, 0 - beq _080D9060 - ldr r0, =gTasks - mov r3, r8 - lsls r1, r3, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - strh r4, [r1, 0x1C] - movs r0, 0x9 - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D9060: - ldr r1, [r1, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x15] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - bne _080D907A - adds r0, r6, 0 - bl sub_80DC674 -_080D907A: - bl sub_80DE12C - ldr r0, =gTasks - mov r4, r8 - lsls r1, r4, 2 - b _080D9192 - .pool -_080D908C: - mov r5, r8 - lsls r0, r5, 2 - add r0, r8 - lsls r0, 3 - adds r2, r0, r4 - ldrh r0, [r2, 0x1C] - adds r1, r0, 0x1 - strh r1, [r2, 0x1C] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1E - bgt _080D90A8 - bl _080DA100 -_080D90A8: - movs r0, 0 - strh r0, [r2, 0x1C] - movs r0, 0x7 - strh r0, [r2, 0x8] - bl _080DA100 -_080D90B4: - mov r0, r8 - lsls r2, r0, 2 - adds r0, r2, r0 - lsls r0, 3 - adds r7, r0, r4 - movs r0, 0 - strh r0, [r7, 0xA] - mov r1, r9 - ldr r0, [r1] - ldr r0, [r0, 0x4] - mov r12, r0 - lsls r1, r6, 3 - subs r0, r1, r6 - lsls r5, r0, 2 - mov r0, r12 - adds r3, r5, r0 - ldrb r0, [r3, 0x13] - mov r10, r2 - str r1, [sp, 0x4] - cmp r0, 0xFF - beq _080D90FA - ldrb r1, [r3, 0x13] - adds r0, r6, 0 - bl sub_80DD45C - mov r1, r9 - ldr r0, [r1] - ldr r0, [r0, 0x4] - adds r0, r5, r0 - movs r1, 0xFF - strb r1, [r0, 0x13] - movs r0, 0x18 - strh r0, [r7, 0x8] - bl _080DA100 -_080D90FA: - ldrb r0, [r3, 0x14] - cmp r0, 0xFF - beq _080D9178 - movs r7, 0 - cmp r7, r6 - beq _080D910E - mov r2, r12 - ldrb r0, [r2, 0x13] - cmp r0, 0xFF - bne _080D912C -_080D910E: - adds r7, 0x1 - cmp r7, 0x3 - bgt _080D912C - cmp r7, r6 - beq _080D910E - mov r3, r9 - ldr r0, [r3] - ldr r1, [r0, 0x4] - lsls r0, r7, 3 - subs r0, r7 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x13] - cmp r0, 0xFF - beq _080D910E -_080D912C: - cmp r7, 0x4 - bne _080D9168 - mov r4, r9 - ldr r0, [r4] - ldr r0, [r0, 0x4] - ldr r5, [sp, 0x4] - subs r4, r5, r6 - lsls r4, 2 - adds r0, r4, r0 - ldrb r1, [r0, 0x14] - adds r0, r6, 0 - bl sub_80DD45C - mov r1, r9 - ldr r0, [r1] - ldr r0, [r0, 0x4] - adds r4, r0 - movs r0, 0xFF - strb r0, [r4, 0x14] - ldr r1, =gTasks - mov r0, r10 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0x18 - strh r1, [r0, 0x8] - bl _080DA100 - .pool -_080D9168: - mov r0, r10 - add r0, r8 - lsls r0, 3 - adds r0, r4 - movs r1, 0x30 - strh r1, [r0, 0x8] - bl _080DA100 -_080D9178: - movs r0, 0x30 - strh r0, [r7, 0x8] - bl _080DA100 -_080D9180: - bl sub_80DED4C - cmp r0, 0 - beq _080D918C - bl _080DA100 -_080D918C: - ldr r0, =gTasks - mov r2, r8 - lsls r1, r2, 2 -_080D9192: - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x17 - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D91A4: - mov r3, r9 - ldr r0, [r3] - ldr r1, [r0, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x11] - movs r3, 0x3 - ands r3, r0 - cmp r3, 0x1 - bne _080D91C4 - movs r0, 0x5 - bl sub_80DD720 - b _080D91DA -_080D91C4: - cmp r3, 0x2 - bne _080D91D0 - movs r0, 0x6 - bl sub_80DD720 - b _080D91DA -_080D91D0: - cmp r3, 0x3 - bne _080D9208 - movs r0, 0x7 - bl sub_80DD720 -_080D91DA: - ldr r0, =gTasks - mov r2, r8 - lsls r1, r2, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x31 - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D91F4: - mov r3, r9 - ldr r0, [r3] - ldr r0, [r0] - ldrb r1, [r0, 0x6] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080D9208 - bl _080DA100 -_080D9208: - mov r5, r8 - lsls r0, r5, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - movs r1, 0x2F - strh r1, [r0, 0x8] - bl _080DA100 -_080D921A: - movs r0, 0x1 - bl sub_80DE008 - ldr r0, =gTasks - mov r2, r8 - lsls r1, r2, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0xC - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D9238: - mov r3, r9 - ldr r0, [r3] - ldr r1, [r0, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r0, 2 - adds r0, r1 - movs r4, 0x2 - ldrsh r1, [r0, r4] - movs r0, 0 - adds r2, r6, 0 - bl sub_80DC028 - ldr r1, =gTasks - mov r5, r8 - lsls r0, r5, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0xD - strh r1, [r0, 0x8] - bl _080DA100 - .pool -_080D926C: - mov r0, r9 - ldr r1, [r0] - ldr r0, [r1] - ldrb r0, [r0, 0x11] - ldr r1, [r1, 0x14] - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x2] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080D9288 - bl _080DA100 -_080D9288: - mov r1, r8 - lsls r0, r1, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - movs r1, 0x23 - strh r1, [r0, 0x8] - bl _080DA100 -_080D929A: - mov r2, r9 - ldr r0, [r2] - ldr r1, [r0, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x10] - movs r0, 0x30 - ands r0, r1 - cmp r0, 0x10 - bne _080D92B8 - movs r0, 0x8 - bl sub_80DD720 -_080D92B8: - ldr r0, =gTasks - mov r3, r8 - lsls r1, r3, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x24 - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D92D0: - mov r5, r9 - ldr r0, [r5] - ldr r0, [r0] - ldrb r1, [r0, 0x6] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080D92E4 - bl _080DA100 -_080D92E4: - mov r1, r8 - lsls r0, r1, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - movs r1, 0x25 - strh r1, [r0, 0x8] - bl _080DA100 -_080D92F6: - adds r0, r6, 0 - movs r1, 0x1 - bl sub_80DB5B8 - lsls r0, 24 - cmp r0, 0 - beq _080D9320 - ldr r1, =gTasks - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0x1C] - movs r1, 0x26 - strh r1, [r0, 0x8] - bl _080DA100 - .pool -_080D9320: - ldr r0, =gTasks - mov r3, r8 - lsls r1, r3, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - b _080D9354 - .pool -_080D9334: - mov r5, r8 - lsls r0, r5, 2 - add r0, r8 - lsls r0, 3 - adds r1, r0, r4 - ldrh r0, [r1, 0x1C] - adds r0, 0x1 - strh r0, [r1, 0x1C] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x14 - bgt _080D9350 - bl _080DA100 -_080D9350: - movs r0, 0 - strh r0, [r1, 0x1C] -_080D9354: - movs r0, 0x32 - strh r0, [r1, 0x8] - bl _080DA100 -_080D935C: - adds r0, r6, 0 - bl sub_80DB798 - lsls r0, 24 - cmp r0, 0 - beq _080D936E - movs r0, 0x63 - bl PlaySE -_080D936E: - ldr r0, =gTasks - mov r2, r8 - lsls r1, r2, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x19 - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D9388: - mov r3, r8 - lsls r0, r3, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - movs r1, 0 - strh r1, [r0, 0xA] - movs r1, 0x1A - strh r1, [r0, 0x8] - bl _080DA100 -_080D939E: - movs r3, 0 - movs r5, 0 - str r5, [sp] - mov r0, r8 - lsls r1, r0, 2 - adds r0, r1, r0 - lsls r0, 3 - adds r0, r4 - movs r2, 0xA - ldrsh r7, [r0, r2] - mov r10, r1 - cmp r7, 0x3 - bgt _080D9418 - ldr r5, =gUnknown_02039F26 - ldr r2, =gContestResources -_080D93BC: - movs r3, 0 - str r3, [sp] - adds r0, r3, 0 - cmp r0, r6 - beq _080D93E4 - ldrb r0, [r5] - cmp r0, r7 - bne _080D93E4 - ldr r0, [r2] - ldr r0, [r0, 0x4] - ldrb r0, [r0, 0x13] - cmp r0, 0xFF - beq _080D93E4 - movs r1, 0x1 - str r1, [sp] - b _080D940C - .pool -_080D93E4: - adds r3, 0x1 - cmp r3, 0x3 - bgt _080D940C - cmp r3, r6 - beq _080D93E4 - adds r0, r3, r5 - ldrb r0, [r0] - cmp r0, r7 - bne _080D93E4 - ldr r0, [r2] - ldr r1, [r0, 0x4] - lsls r0, r3, 3 - subs r0, r3 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x13] - cmp r0, 0xFF - beq _080D93E4 - movs r0, 0x1 - str r0, [sp] -_080D940C: - ldr r1, [sp] - cmp r1, 0 - bne _080D9422 - adds r7, 0x1 - cmp r7, 0x3 - ble _080D93BC -_080D9418: - ldr r2, [sp] - lsls r0, r2, 24 - asrs r2, r0, 24 - cmp r2, 0 - beq _080D9464 -_080D9422: - mov r5, r10 - add r5, r8 - lsls r5, 3 - adds r5, r4 - ldr r0, =gUnknown_02039F26 - adds r0, r3, r0 - ldrb r0, [r0] - strh r0, [r5, 0xA] - lsls r0, r3, 24 - lsrs r0, 24 - mov r4, r9 - ldr r1, [r4] - ldr r1, [r1, 0x4] - lsls r4, r3, 3 - subs r4, r3 - lsls r4, 2 - adds r1, r4, r1 - ldrb r1, [r1, 0x13] - bl sub_80DD45C - mov r1, r9 - ldr r0, [r1] - ldr r0, [r0, 0x4] - adds r4, r0 - movs r0, 0xFF - strb r0, [r4, 0x13] - movs r0, 0x1B - strh r0, [r5, 0x8] - bl _080DA100 - .pool -_080D9464: - mov r0, r10 - add r0, r8 - lsls r0, 3 - adds r0, r4 - strh r2, [r0, 0xA] - strh r2, [r0, 0x1C] - movs r1, 0x33 - strh r1, [r0, 0x8] - bl sub_80DB884 - bl _080DA100 -_080D947C: - bl sub_80DED4C - cmp r0, 0 - beq _080D9488 - bl _080DA100 -_080D9488: - ldr r0, =gTasks - mov r2, r8 - lsls r1, r2, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x1C - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D94A0: - movs r7, 0 - mov r3, r8 - lsls r0, r3, 2 - adds r1, r0, r3 - lsls r1, 3 - adds r1, r4 - movs r4, 0xA - ldrsh r2, [r1, r4] - ldr r1, =gUnknown_02039F26 - mov r10, r0 - adds r5, r1, 0 - ldrb r0, [r5] - cmp r2, r0 - beq _080D94CA - adds r1, r2, 0 - adds r2, r5, 0 -_080D94C0: - adds r7, 0x1 - adds r0, r7, r2 - ldrb r0, [r0] - cmp r1, r0 - bne _080D94C0 -_080D94CA: - mov r1, r9 - ldr r0, [r1] - ldr r1, [r0, 0x4] - lsls r0, r7, 3 - subs r0, r7 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0xE] - ldrh r0, [r0, 0x2] - adds r0, r1 - lsls r0, 16 - asrs r0, 16 - negs r1, r1 - lsls r2, r7, 24 - lsrs r2, 24 - bl sub_80DC028 - ldr r1, =gTasks - mov r0, r10 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0x1D - strh r1, [r0, 0x8] - bl _080DA100 - .pool -_080D9508: - movs r7, 0 - mov r2, r8 - lsls r0, r2, 2 - adds r1, r0, r2 - lsls r1, 3 - adds r1, r4 - movs r5, 0xA - ldrsh r3, [r1, r5] - ldr r1, =gUnknown_02039F26 - mov r10, r0 - adds r5, r1, 0 - ldrb r0, [r5] - cmp r3, r0 - beq _080D952E -_080D9524: - adds r7, 0x1 - adds r0, r7, r1 - ldrb r0, [r0] - cmp r3, r0 - bne _080D9524 -_080D952E: - mov r1, r9 - ldr r0, [r1] - ldr r1, [r0, 0x14] - lsls r0, r7, 2 - adds r0, r1 - ldrb r1, [r0, 0x2] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080D9546 - bl _080DA100 -_080D9546: - mov r0, r10 - add r0, r8 - lsls r0, 3 - adds r0, r4 - movs r1, 0x27 - strh r1, [r0, 0x8] - bl _080DA100 - .pool -_080D955C: - movs r7, 0 - mov r2, r8 - lsls r0, r2, 2 - adds r1, r0, r2 - lsls r1, 3 - adds r1, r4 - movs r3, 0xA - ldrsh r2, [r1, r3] - ldr r1, =gUnknown_02039F26 - mov r10, r0 - adds r5, r1, 0 - ldrb r4, [r5] - cmp r2, r4 - beq _080D9586 - adds r1, r2, 0 - adds r2, r5, 0 -_080D957C: - adds r7, 0x1 - adds r0, r7, r2 - ldrb r0, [r0] - cmp r1, r0 - bne _080D957C -_080D9586: - lsls r0, r7, 24 - lsrs r0, 24 - movs r1, 0x1 - bl sub_80DB5B8 - lsls r0, 24 - cmp r0, 0 - beq _080D95B4 - ldr r1, =gTasks - mov r0, r10 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0x1C] - movs r1, 0x28 - strh r1, [r0, 0x8] - bl _080DA100 - .pool -_080D95B4: - ldr r0, =gTasks - mov r1, r10 - add r1, r8 - lsls r1, 3 - adds r1, r0 - b _080D95E4 - .pool -_080D95C4: - mov r5, r8 - lsls r0, r5, 2 - add r0, r8 - lsls r0, 3 - adds r1, r0, r4 - ldrh r0, [r1, 0x1C] - adds r0, 0x1 - strh r0, [r1, 0x1C] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x14 - bgt _080D95E0 - bl _080DA100 -_080D95E0: - movs r0, 0 - strh r0, [r1, 0x1C] -_080D95E4: - movs r0, 0x1E - strh r0, [r1, 0x8] - bl _080DA100 -_080D95EC: - movs r7, 0 - ldr r2, =gUnknown_02039F26 - ldrb r3, [r2] - mov r0, r8 - lsls r1, r0, 2 - adds r0, r1, r0 - lsls r0, 3 - adds r4, r0, r4 - movs r5, 0xA - ldrsh r0, [r4, r5] - mov r10, r1 - adds r5, r2, 0 - cmp r3, r0 - beq _080D961E - adds r3, r5, 0 - adds r2, r4, 0 -_080D960C: - adds r7, 0x1 - cmp r7, 0x3 - bgt _080D961E - adds r0, r7, r3 - ldrb r1, [r0] - movs r4, 0xA - ldrsh r0, [r2, r4] - cmp r1, r0 - bne _080D960C -_080D961E: - lsls r4, r7, 24 - lsrs r0, r4, 24 - bl sub_80DB798 - lsls r0, 24 - adds r6, r4, 0 - cmp r0, 0 - beq _080D963C - movs r0, 0x63 - bl PlaySE - b _080D9642 - .pool -_080D963C: - movs r0, 0x64 - bl PlaySE -_080D9642: - ldr r5, =gContestResources - ldr r0, [r5] - ldr r1, [r0, 0x4] - lsls r0, r7, 3 - subs r0, r7 - lsls r4, r0, 2 - adds r1, r4, r1 - ldrb r1, [r1, 0x15] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080D9670 - lsrs r0, r6, 24 - bl sub_80DC674 - ldr r0, [r5] - ldr r1, [r0, 0x4] - adds r1, r4, r1 - ldrb r2, [r1, 0x15] - movs r0, 0x21 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x15] -_080D9670: - ldr r0, =gTasks - mov r1, r10 - add r1, r8 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0xA] - adds r0, 0x1 - strh r0, [r1, 0xA] - movs r0, 0x1A - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D9690: - mov r5, r8 - lsls r2, r5, 2 - adds r0, r2, r5 - lsls r0, 3 - adds r4, r0, r4 - ldrh r0, [r4, 0x1C] - adds r1, r0, 0x1 - strh r1, [r4, 0x1C] - lsls r0, 16 - asrs r0, 16 - mov r10, r2 - cmp r0, 0x9 - bgt _080D96AE - bl _080DA100 -_080D96AE: - movs r0, 0 - strh r0, [r4, 0x1C] - mov r1, r9 - ldr r0, [r1] - ldr r1, [r0, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r0, 2 - adds r2, r0, r1 - ldrb r1, [r2, 0xC] - movs r0, 0x6 - ands r0, r1 - cmp r0, 0 - bne _080D96D4 - ldrb r1, [r2, 0x11] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080D96F6 -_080D96D4: - bl sub_80DB89C - ldr r0, =gStringVar1 - lsls r1, r6, 6 - ldr r2, =gContestMons + 2 - adds r1, r2 - bl StringCopy - ldr r4, =gStringVar4 - ldr r1, =gText_0827E793 - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_80DEC30 -_080D96F6: - ldr r0, =gTasks - mov r1, r10 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x34 - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D971C: - bl sub_80DED4C - cmp r0, 0 - beq _080D9728 - bl _080DA100 -_080D9728: - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x15] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _080D975C - ldr r0, =gTasks - mov r2, r8 - lsls r1, r2, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x11 - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D975C: - ldr r0, =gTasks - mov r3, r8 - lsls r1, r3, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0xE - strh r0, [r1, 0x8] - bl _080DA100 - .pool -_080D9774: - mov r4, r9 - ldr r0, [r4] - ldr r1, [r0, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x16] - lsls r4, r0, 24 - lsrs r5, r4, 24 - cmp r5, 0 - beq _080D97DC - bl sub_80DB89C - asrs r0, r4, 24 - cmp r0, 0x1 - bne _080D97A0 - ldr r0, =gText_0827E32E - b _080D97A6 - .pool -_080D97A0: - cmp r0, 0x2 - bne _080D97B4 - ldr r0, =gText_0827E35B -_080D97A6: - movs r1, 0x1 - bl sub_80DEC30 - b _080D97BC - .pool -_080D97B4: - ldr r0, =gText_0827E38D - movs r1, 0x1 - bl sub_80DEC30 -_080D97BC: - movs r0, 0x3 - bl sub_80DD720 - ldr r1, =gTasks - mov r5, r8 - lsls r0, r5, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0x1C] - b _080D9812 - .pool -_080D97DC: - bl sub_80DB89C - ldr r0, =gStringVar1 - lsls r1, r6, 6 - ldr r2, =gContestMons + 2 - adds r1, r2 - bl StringCopy - ldr r4, =gStringVar4 - ldr r1, =gText_0827E2FE - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_80DEC30 - movs r0, 0x2 - bl sub_80DD720 - ldr r1, =gTasks - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - strh r5, [r0, 0x1C] -_080D9812: - movs r1, 0x2D - strh r1, [r0, 0x8] - bl _080DA100 - .pool -_080D9830: - mov r3, r9 - ldr r0, [r3] - ldr r2, [r0] - ldrb r1, [r2, 0x6] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080D9844 - bl _080DA100 -_080D9844: - ldrb r0, [r2, 0x11] - bl sub_80DC9B4 - ldr r1, =gTasks - mov r4, r8 - lsls r0, r4, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0xF - strh r1, [r0, 0x8] - bl _080DA100 - .pool -_080D9864: - bl sub_80DED4C - cmp r0, 0 - beq _080D9870 - bl _080DA100 -_080D9870: - ldr r1, =gTasks - mov r5, r8 - lsls r0, r5, 2 - add r0, r8 - lsls r0, 3 - adds r4, r0, r1 - ldrh r0, [r4, 0x1C] - adds r0, 0x1 - strh r0, [r4, 0x1C] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x32 - bgt _080D988E - bl _080DA100 -_080D988E: - ldr r7, =gContestResources - ldr r0, [r7] - ldr r1, [r0, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r5, r0, 2 - adds r2, r5, r1 - ldrb r1, [r2, 0x15] - movs r0, 0x10 - mov r8, r0 - ands r0, r1 - cmp r0, 0 - bne _080D98C2 - movs r1, 0x2 - ldrsh r0, [r2, r1] - ldrb r1, [r2, 0x17] - adds r2, r6, 0 - bl sub_80DC028 - ldr r0, [r7] - ldr r1, [r0, 0x4] - adds r1, r5, r1 - ldrh r0, [r1, 0x2] - ldrb r2, [r1, 0x17] - adds r0, r2 - strh r0, [r1, 0x2] -_080D98C2: - mov r3, r8 - strh r3, [r4, 0x8] - bl _080DA100 - .pool -_080D98D4: - mov r5, r9 - ldr r0, [r5] - ldr r1, [r0, 0x14] - lsls r0, r6, 2 - adds r0, r1 - ldrb r1, [r0, 0x2] - movs r0, 0x4 - ands r0, r1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - beq _080D98F0 - bl _080DA100 -_080D98F0: - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - strh r1, [r0, 0x1C] - movs r1, 0x11 - strh r1, [r0, 0x8] - bl _080DA100 -_080D9904: - mov r3, r9 - ldr r0, [r3] - ldr r1, [r0, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x15] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080D996C - bl sub_80DB89C - ldr r0, =gStringVar1 - lsls r1, r6, 6 - ldr r2, =gContestMons + 2 - adds r1, r2 - bl StringCopy - ldr r4, =gStringVar4 - ldr r1, =gText_0827E6E3 - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_80DEC30 - ldr r0, =gTasks - mov r5, r8 - lsls r4, r5, 2 - add r4, r8 - lsls r4, 3 - adds r4, r0 - movs r0, 0 - strh r0, [r4, 0x1C] - bl sub_80DD720 - movs r0, 0x2E - strh r0, [r4, 0x8] - b _080DA100 - .pool -_080D996C: - mov r1, r8 - lsls r0, r1, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - movs r1, 0x29 - strh r1, [r0, 0x8] - b _080DA100 -_080D997C: - mov r2, r9 - ldr r0, [r2] - ldr r0, [r0] - ldrb r1, [r0, 0x6] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080D998E - b _080DA100 -_080D998E: - mov r3, r8 - lsls r0, r3, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - movs r1, 0x13 - strh r1, [r0, 0x8] - b _080DA100 -_080D999E: - bl sub_80DED4C - cmp r0, 0 - beq _080D99A8 - b _080DA100 -_080D99A8: - ldr r5, =gContestResources - ldr r0, [r5] - ldr r1, [r0, 0x4] - lsls r4, r6, 3 - subs r4, r6 - lsls r4, 2 - adds r1, r4, r1 - movs r2, 0x2 - ldrsh r0, [r1, r2] - ldrb r1, [r1, 0x18] - negs r1, r1 - adds r2, r6, 0 - bl sub_80DC028 - ldr r0, [r5] - ldr r0, [r0, 0x4] - adds r4, r0 - ldrb r1, [r4, 0x18] - ldrh r0, [r4, 0x2] - subs r0, r1 - strh r0, [r4, 0x2] - ldr r1, =gTasks - mov r3, r8 - lsls r0, r3, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0x12 - strh r1, [r0, 0x8] - b _080DA100 - .pool -_080D99EC: - bl sub_80DCD48 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0x14] - lsls r0, r6, 2 - adds r0, r1 - ldrb r1, [r0, 0x2] - movs r0, 0x4 - ands r0, r1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _080D9A0A - b _080DA100 -_080D9A0A: - ldr r0, =gTasks - mov r5, r8 - lsls r4, r5, 2 - add r4, r8 - lsls r4, 3 - adds r4, r0 - strh r3, [r4, 0x1C] - bl sub_80DB89C - movs r0, 0x29 - strh r0, [r4, 0x8] - b _080DA100 - .pool -_080D9A2C: - mov r1, r9 - ldr r0, [r1] - ldr r2, [r0, 0x10] - ldrb r1, [r2, 0x1] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080D9A56 - ldr r0, [r2] - lsls r0, 20 - lsrs r0, 29 - cmp r6, r0 - beq _080D9A56 - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - movs r1, 0x39 - strh r1, [r0, 0x8] - b _080DA100 -_080D9A56: - mov r3, r9 - ldr r1, [r3] - ldr r0, [r1, 0x10] - ldrb r0, [r0] - str r0, [sp] - ldr r1, [r1, 0x4] - lsls r2, r6, 3 - subs r0, r2, r6 - lsls r0, 2 - adds r5, r0, r1 - ldrb r1, [r5, 0x11] - movs r0, 0x10 - ands r0, r1 - str r2, [sp, 0x4] - cmp r0, 0 - beq _080D9A94 - movs r4, 0x1 - str r4, [sp] - ldr r0, =gStringVar3 - ldrh r2, [r5, 0x6] - movs r1, 0xD - muls r1, r2 - ldr r2, =gMoveNames - adds r1, r2 - bl StringCopy - b _080D9AAE - .pool -_080D9A94: - ldr r0, =gStringVar3 - ldr r3, =gUnknown_08587F08 - ldr r2, =gContestMoves - ldrh r1, [r5, 0x6] - lsls r1, 3 - adds r1, r2 - ldrb r1, [r1, 0x1] - lsls r1, 29 - lsrs r1, 27 - adds r1, r3 - ldr r1, [r1] - bl StringCopy -_080D9AAE: - ldr r5, [sp] - lsls r0, r5, 24 - cmp r0, 0 - ble _080D9AD2 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0x4] - ldr r2, [sp, 0x4] - subs r0, r2, r6 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x15] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080D9AD2 - movs r3, 0 - str r3, [sp] -_080D9AD2: - bl sub_80DB89C - ldr r0, =gStringVar1 - lsls r1, r6, 6 - ldr r2, =gContestMons + 2 - adds r1, r2 - bl StringCopy - ldr r4, =gContestResources - ldr r0, [r4] - ldr r1, [r0] - ldrb r0, [r1, 0x13] - ldr r5, [sp] - lsls r2, r5, 24 - asrs r3, r2, 24 - adds r0, r3, r0 - strb r0, [r1, 0x13] - ldr r0, [r4] - ldr r1, [r0] - movs r0, 0x13 - ldrsb r0, [r1, r0] - adds r5, r2, 0 - cmp r0, 0 - bge _080D9B06 - movs r0, 0 - strb r0, [r1, 0x13] -_080D9B06: - cmp r3, 0 - bne _080D9B30 - ldr r0, =gTasks - mov r2, r8 - lsls r1, r2, 2 - b _080D9F58 - .pool -_080D9B30: - cmp r3, 0 - bge _080D9B48 - ldr r0, =gStringVar4 - ldr r1, =gText_0827E73C - bl StringExpandPlaceholders - b _080D9B74 - .pool -_080D9B48: - cmp r3, 0 - ble _080D9B6C - ldr r0, [r4] - ldr r0, [r0] - ldrb r0, [r0, 0x13] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x4 - bgt _080D9B6C - ldr r0, =gStringVar4 - ldr r1, =gText_0827E717 - bl StringExpandPlaceholders - b _080D9B74 - .pool -_080D9B6C: - ldr r0, =gStringVar4 - ldr r1, =gText_0827E76A - bl StringExpandPlaceholders -_080D9B74: - ldr r0, =gStringVar4 - movs r1, 0x1 - bl sub_80DEC30 - ldr r1, =gTasks - mov r3, r8 - lsls r0, r3, 2 - add r0, r8 - lsls r0, 3 - adds r1, r0, r1 - movs r0, 0 - strh r0, [r1, 0x1C] - strh r0, [r1, 0x1E] - cmp r5, 0 - bge _080D9BA4 - movs r0, 0x35 - strh r0, [r1, 0x8] - b _080DA100 - .pool -_080D9BA4: - movs r0, 0x36 - strh r0, [r1, 0x8] - b _080DA100 -_080D9BAA: - mov r5, r8 - lsls r0, r5, 2 - add r0, r8 - lsls r0, 3 - adds r4, r0, r4 - movs r0, 0x1C - ldrsh r3, [r4, r0] - cmp r3, 0x1 - beq _080D9BE8 - cmp r3, 0x1 - bgt _080D9BC6 - cmp r3, 0 - beq _080D9BD0 - b _080DA100 -_080D9BC6: - cmp r3, 0x2 - beq _080D9C0C - cmp r3, 0x3 - beq _080D9C46 - b _080DA100 -_080D9BD0: - movs r0, 0x1 - negs r0, r0 - movs r1, 0x1 - bl sub_80DDED0 - ldr r0, =0x00000187 - bl PlayFanfare - b _080D9C3E - .pool -_080D9BE8: - mov r1, r9 - ldr r0, [r1] - ldr r0, [r0] - ldrb r0, [r0, 0x7] - ands r3, r0 - cmp r3, 0 - beq _080D9BF8 - b _080DA100 -_080D9BF8: - bl sub_80DED4C - cmp r0, 0 - beq _080D9C02 - b _080DA100 -_080D9C02: - movs r0, 0x1 - negs r0, r0 - bl sub_80DDCDC - b _080D9C3E -_080D9C0C: - mov r2, r9 - ldr r0, [r2] - ldr r0, [r0] - ldrb r1, [r0, 0x6] - movs r0, 0x20 - ands r0, r1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0 - beq _080D9C22 - b _080DA100 -_080D9C22: - ldrh r0, [r4, 0x1E] - adds r1, r0, 0x1 - strh r1, [r4, 0x1E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1D - bgt _080D9C32 - b _080DA100 -_080D9C32: - strh r2, [r4, 0x1E] - movs r1, 0x1 - negs r1, r1 - adds r0, r1, 0 - bl sub_80DDED0 -_080D9C3E: - ldrh r0, [r4, 0x1C] - adds r0, 0x1 - strh r0, [r4, 0x1C] - b _080DA100 -_080D9C46: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0 - beq _080D9C58 - b _080DA100 -_080D9C58: - strh r0, [r4, 0x1C] - strh r0, [r4, 0x1E] - movs r0, 0x2B - strh r0, [r4, 0x8] - b _080DA100 - .pool -_080D9C68: - mov r3, r8 - lsls r1, r3, 2 - adds r0, r1, r3 - lsls r0, 3 - adds r0, r4 - movs r5, 0x1C - ldrsh r0, [r0, r5] - mov r10, r1 - cmp r0, 0x4 - bls _080D9C7E - b _080DA100 -_080D9C7E: - lsls r0, 2 - ldr r1, =_080D9C8C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080D9C8C: - .4byte _080D9CA0 - .4byte _080D9CB0 - .4byte _080D9CD4 - .4byte _080D9D3E - .4byte _080D9D84 -_080D9CA0: - bl sub_80DED4C - cmp r0, 0 - beq _080D9CAA - b _080DA100 -_080D9CAA: - movs r0, 0x1 - movs r1, 0x1 - b _080D9D68 -_080D9CB0: - mov r1, r9 - ldr r0, [r1] - ldr r0, [r0] - ldrb r1, [r0, 0x7] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080D9CC2 - b _080DA100 -_080D9CC2: - bl sub_80DDE0C - movs r0, 0xDF - bl PlaySE - movs r0, 0x1 - bl sub_80DDCDC - b _080D9D6C -_080D9CD4: - mov r3, r9 - ldr r2, [r3] - ldr r0, [r2] - ldrb r1, [r0, 0x6] - movs r0, 0x20 - ands r0, r1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _080D9CEA - b _080DA100 -_080D9CEA: - mov r0, r10 - add r0, r8 - lsls r0, 3 - adds r5, r0, r4 - ldrh r0, [r5, 0x1E] - adds r1, r0, 0x1 - strh r1, [r5, 0x1E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1D - bgt _080D9D02 - b _080DA100 -_080D9D02: - strh r3, [r5, 0x1E] - ldr r0, [r2, 0x4] - lsls r4, r6, 3 - subs r4, r6 - lsls r4, 2 - adds r0, r4, r0 - movs r1, 0x2 - ldrsh r0, [r0, r1] - ldr r1, [r2, 0x10] - ldrb r1, [r1, 0x2] - lsls r1, 24 - asrs r1, 24 - adds r2, r6, 0 - bl sub_80DC028 - mov r2, r9 - ldr r1, [r2] - ldr r0, [r1, 0x4] - adds r4, r0 - ldr r0, [r1, 0x10] - ldrb r0, [r0, 0x2] - lsls r0, 24 - asrs r0, 24 - ldrh r3, [r4, 0x2] - adds r0, r3 - strh r0, [r4, 0x2] - ldrh r0, [r5, 0x1C] - adds r0, 0x1 - strh r0, [r5, 0x1C] - b _080DA100 -_080D9D3E: - mov r4, r9 - ldr r2, [r4] - ldr r1, [r2, 0x14] - lsls r0, r6, 2 - adds r0, r1 - ldrb r1, [r0, 0x2] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080D9D54 - b _080DA100 -_080D9D54: - ldr r0, [r2] - ldrb r1, [r0, 0x6] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _080D9D62 - b _080DA100 -_080D9D62: - movs r1, 0x1 - negs r1, r1 - movs r0, 0x1 -_080D9D68: - bl sub_80DDED0 -_080D9D6C: - ldr r0, =gTasks - mov r1, r10 - add r1, r8 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0x1C] - adds r0, 0x1 - strh r0, [r1, 0x1C] - b _080DA100 - .pool -_080D9D84: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _080D9D96 - b _080DA100 -_080D9D96: - mov r0, r10 - add r0, r8 - lsls r0, 3 - adds r0, r4 - strh r3, [r0, 0x1C] - strh r3, [r0, 0x1E] - movs r1, 0x2B - strh r1, [r0, 0x8] - b _080DA100 - .pool -_080D9DAC: - mov r5, r9 - ldr r0, [r5] - ldr r1, [r0, 0x14] - lsls r0, r6, 2 - adds r0, r1 - ldrb r1, [r0, 0x2] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080D9DC2 - b _080DA100 -_080D9DC2: - bl sub_80DB89C - ldr r0, =gTasks - mov r2, r8 - lsls r1, r2, 2 - b _080D9F58 - .pool -_080D9DD4: - bl sub_80DB89C - ldr r0, =gStringVar3 - ldr r5, =gContestResources - ldr r1, [r5] - ldr r1, [r1, 0x10] - ldr r1, [r1] - lsls r1, 20 - lsrs r1, 29 - lsls r1, 6 - ldr r4, =gContestMons + 2 - adds r1, r4 - bl StringCopy - ldr r0, =gStringVar1 - lsls r1, r6, 6 - adds r1, r4 - bl StringCopy - ldr r0, =gStringVar2 - ldr r1, [r5] - ldr r2, [r1, 0x4] - lsls r1, r6, 3 - subs r1, r6 - lsls r1, 2 - adds r1, r2 - ldrh r2, [r1, 0x6] - movs r1, 0xD - muls r1, r2 - ldr r2, =gMoveNames - adds r1, r2 - bl StringCopy - ldr r4, =gStringVar4 - ldr r1, =gText_0827E7EA - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_80DEC30 - ldr r1, =gTasks - mov r3, r8 - lsls r0, r3, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0x3A - strh r1, [r0, 0x8] - b _080DA100 - .pool -_080D9E60: - bl sub_80DED4C - cmp r0, 0 - beq _080D9E6A - b _080DA100 -_080D9E6A: - bl sub_80DB89C - ldr r4, =gStringVar4 - ldr r1, =gText_0827E817 - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_80DEC30 - ldr r1, =gTasks - mov r4, r8 - lsls r0, r4, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0x3B - strh r1, [r0, 0x8] - b _080DA100 - .pool -_080D9EA0: - bl sub_80DED4C - cmp r0, 0 - beq _080D9EAA - b _080DA100 -_080D9EAA: - bl sub_80DB89C - ldr r0, =gTasks - mov r5, r8 - lsls r1, r5, 2 - b _080D9F58 - .pool -_080D9EBC: - mov r1, r9 - ldr r0, [r1] - ldr r1, [r0, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r4, r0, 2 - adds r2, r4, r1 - ldrb r1, [r2, 0x15] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080D9EDC - movs r0, 0x11 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x15] -_080D9EDC: - adds r0, r6, 0 - bl sub_80DC9B4 - ldr r0, =gStringVar1 - lsls r1, r6, 6 - ldr r2, =gContestMons + 2 - adds r1, r2 - bl StringCopy - ldr r0, =gStringVar2 - mov r2, r9 - ldr r1, [r2] - ldr r1, [r1, 0x4] - adds r1, r4, r1 - ldrh r2, [r1, 0x6] - movs r1, 0xD - muls r1, r2 - ldr r2, =gMoveNames - adds r1, r2 - bl StringCopy - ldr r4, =gStringVar4 - ldr r1, =gText_0827E58A - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_80DEC30 - ldr r1, =gTasks - mov r3, r8 - lsls r0, r3, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0x22 - strh r1, [r0, 0x8] - b _080DA100 - .pool -_080D9F48: - bl sub_80DED4C - cmp r0, 0 - beq _080D9F52 - b _080DA100 -_080D9F52: - ldr r0, =gTasks - mov r4, r8 - lsls r1, r4, 2 -_080D9F58: - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x37 - strh r0, [r1, 0x8] - b _080DA100 - .pool -_080D9F68: - bl sub_80DDBE8 - ldr r0, =gTasks - mov r5, r8 - lsls r1, r5, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x38 - strh r0, [r1, 0x8] - b _080DA100 - .pool -_080D9F84: - mov r1, r9 - ldr r0, [r1] - ldr r2, [r0] - ldrb r1, [r2, 0x6] - movs r0, 0x40 - ands r0, r1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0 - beq _080D9F9A - b _080DA100 -_080D9F9A: - movs r0, 0x13 - ldrsb r0, [r2, r0] - cmp r0, 0x4 - ble _080D9FA8 - strb r1, [r2, 0x13] - bl sub_80DD940 -_080D9FA8: - ldr r0, =gTasks - mov r2, r8 - lsls r1, r2, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0xA - strh r0, [r1, 0x8] - b _080DA100 - .pool -_080D9FC0: - mov r3, r8 - lsls r2, r3, 2 - add r2, r8 - lsls r2, 3 - adds r2, r4 - ldrb r5, [r2, 0xC] - ldr r1, =gSprites - lsls r0, r5, 4 - adds r0, r5 - lsls r0, 2 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80DA164 - str r1, [r0] - movs r0, 0xB - strh r0, [r2, 0x8] - b _080DA100 - .pool -_080D9FEC: - mov r5, r8 - lsls r0, r5, 2 - add r0, r8 - lsls r0, 3 - adds r4, r0, r4 - ldrb r5, [r4, 0xC] - ldr r1, =gSprites - lsls r0, r5, 4 - adds r0, r5 - lsls r0, 2 - adds r6, r0, r1 - adds r0, r6, 0 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - bge _080DA100 - adds r0, r6, 0 - bl FreeSpriteOamMatrix - adds r0, r6, 0 - bl DestroySprite - movs r0, 0x14 - strh r0, [r4, 0x8] - b _080DA100 - .pool -_080DA024: - mov r1, r8 - lsls r0, r1, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - movs r1, 0 - strh r1, [r0, 0x1C] - movs r1, 0x15 - strh r1, [r0, 0x8] - b _080DA100 -_080DA038: - bl sub_80DB89C - ldr r0, =gStringVar1 - lsls r1, r6, 6 - ldr r2, =gContestMons + 2 - adds r1, r2 - bl StringCopy - ldr r4, =gStringVar4 - ldr r1, =gText_0827D56F - adds r0, r4, 0 - bl StringExpandPlaceholders - adds r0, r4, 0 - movs r1, 0x1 - bl sub_80DEC30 - ldr r1, =gTasks - mov r2, r8 - lsls r0, r2, 2 - add r0, r8 - lsls r0, 3 - adds r0, r1 - movs r1, 0x20 - strh r1, [r0, 0x8] - b _080DA100 - .pool -_080DA080: - bl sub_80DED4C - cmp r0, 0 - bne _080DA100 - ldr r0, =gTasks - mov r3, r8 - lsls r1, r3, 2 - add r1, r8 - lsls r1, 3 - adds r1, r0 - movs r0, 0x15 - strh r0, [r1, 0x8] - b _080DA100 - .pool -_080DA0A0: - mov r5, r8 - lsls r0, r5, 2 - add r0, r8 - lsls r0, 3 - adds r1, r0, r4 - ldrh r0, [r1, 0x1C] - adds r0, 0x1 - strh r0, [r1, 0x1C] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1D - ble _080DA100 - movs r0, 0 - strh r0, [r1, 0x1C] - movs r0, 0x16 - strh r0, [r1, 0x8] - b _080DA100 -_080DA0C2: - mov r1, r9 - ldr r0, [r1] - ldr r1, [r0] - ldrb r0, [r1, 0x10] - adds r0, 0x1 - movs r2, 0 - strb r0, [r1, 0x10] - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bne _080DA0F4 - mov r3, r8 - lsls r0, r3, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - strh r2, [r0, 0x8] - strh r2, [r0, 0xA] - strh r2, [r0, 0xC] - ldr r1, =sub_80DA198 - str r1, [r0] - b _080DA100 - .pool -_080DA0F4: - mov r5, r8 - lsls r0, r5, 2 - add r0, r8 - lsls r0, 3 - adds r0, r4 - strh r2, [r0, 0x8] -_080DA100: - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80D8B38 - thumb_func_start sub_80DA110 sub_80DA110: @ 80DA110 push {lr} diff --git a/include/constants/moves.h b/include/constants/moves.h index f3a3acb902..aaa5c3ab9a 100644 --- a/include/constants/moves.h +++ b/include/constants/moves.h @@ -358,5 +358,6 @@ #define MOVE_PSYCHO_BOOST 354 #define LAST_MOVE_INDEX MOVE_PSYCHO_BOOST +#define NUM_MOVES LAST_MOVE_INDEX + 1 #endif // GUARD_CONSTANTS_MOVES_H diff --git a/include/contest_link_80FC4F4.h b/include/contest_link_80FC4F4.h new file mode 100644 index 0000000000..16ec1fbd20 --- /dev/null +++ b/include/contest_link_80FC4F4.h @@ -0,0 +1,7 @@ +#ifndef GUARD_CONTEST_LINK_80FC4F4_H +#define GUARD_CONTEST_LINK_80FC4F4_H + +void sub_80FCC88(u8); +void sub_80FCC88(u8); + +#endif //GUARD_CONTEST_LINK_80FC4F4_H diff --git a/src/contest.c b/src/contest.c index 6d4fbae4f9..7ac548a9c4 100644 --- a/src/contest.c +++ b/src/contest.c @@ -36,6 +36,7 @@ #include "event_scripts.h" #include "strings.h" #include "contest_effect.h" +#include "contest_link_80FC4F4.h" #define DESTROY_POINTER(ptr) \ free(ptr); \ @@ -93,7 +94,7 @@ void sub_80DE350(void); void sub_80DE69C(u8); void sub_80DEA20(void); void sub_80DEBD0(u32, u8 *, u8, u8, u8); -void sub_80DEC30(u8 *, u8); +void sub_80DEC30(const u8 *, u8); void sub_80DECB8(u8, u16, u8, u8, u8, u8, u8, u8); bool32 sub_80DED4C(void); void sub_80DED60(u32); @@ -102,6 +103,36 @@ bool8 AreMovesContestCombo(u16, u16); void prints_contest_move_description(u16); +void sub_80DD080(u8); +void sub_80DA110(u8); +void sub_80DF080(u8); +void sub_80DF750(void); +void sub_80DE9DC(u8); +u8 sub_80DB174(u16, u32, u32, u32); +void sub_80DA134(struct Sprite *); +void sub_80DCBE8(u8, u8); +u8 sub_80DC9EC(u8); +u16 sub_80DE834(u16); +void sub_80DE864(u8); +void sub_80DEAA8(u16); +void sub_80DE9B0(u8); +void sub_80DC674(u8); +void sub_80DE12C(void); +void sub_80DD45C(u8, u8); +void sub_80DD720(u8); +void sub_80DE008(bool8); +void sub_80DC028(s16, s16, u8); +bool8 sub_80DB5B8(u8, u8); +bool8 sub_80DB798(u8); +void sub_80DB884(void); +void sub_80DC9B4(u8); +void sub_80DDED0(s8, s8); +void sub_80DDCDC(s8); +void sub_80DDE0C(void); +void sub_80DD940(void); +void sub_80DA164(struct Sprite *); +void sub_80DA198(u8); + EWRAM_DATA struct ContestPokemon gContestMons[4] = {0}; EWRAM_DATA s16 gUnknown_02039F00[4] = {0}; EWRAM_DATA s16 gUnknown_02039F08[4] = {0}; @@ -147,6 +178,24 @@ extern const u16 gUnknown_08587C30[]; extern const struct BgTemplate gUnknown_08587F34[4]; extern const struct WindowTemplate gUnknown_08587F44[]; +extern const u8 *const gUnknown_08587F08[]; +extern const u8 *const gUnknown_08587F1C[]; +extern const u8 gText_0827D55A[]; +extern const u8 gText_0827E793[]; +extern const u8 gText_0827E32E[]; +extern const u8 gText_0827E35B[]; +extern const u8 gText_0827E38D[]; +extern const u8 gText_0827E2FE[]; +extern const u8 gText_0827E6E3[]; +extern const u8 gText_0827E73C[]; +extern const u8 gText_0827E717[]; +extern const u8 gText_0827E76A[]; +extern const u8 gText_0827E7EA[]; +extern const u8 gText_0827E817[]; +extern const u8 gText_0827E58A[]; +extern const u8 gText_0827D56F[]; + + void TaskDummy1(u8 taskId) { } @@ -862,3 +911,709 @@ void sub_80D8A88(u8 taskId) gTasks[taskId].func = sub_80D8B38; } } + +void sub_80D8B38(u8 taskId) +{ + u8 spriteId; + s32 i; + u8 r6 = gContestResources->field_0->unk19215; + s8 r3; + + switch (gTasks[taskId].data[0]) + { + case 0: + sub_80DCD48(); + for (i = 0; gContestResources->field_0->unk19214 != gContestResources->field_8->turnOrder[i]; i++) + ; + gContestResources->field_0->unk19215 = i; + r6 = gContestResources->field_0->unk19215; + if (gIsLinkContest & 1) + { + u8 taskId2; + + gContestResources->field_0->unk1920B_2 = 1; + if (sub_80DA8A4()) + sub_80DD080(gContestResources->field_0->unk19215); + taskId2 = CreateTask(sub_80FCC88, 0); + SetTaskFuncWithFollowupFunc(taskId2, sub_80FCC88, sub_80DA110); + sub_80DBF68(); + gTasks[taskId].data[0] = 1; + } + else + { + sub_80DD080(gContestResources->field_0->unk19215); + gTasks[taskId].data[0] = 2; + } + return; + case 1: + if (!gContestResources->field_0->unk1920B_2) + gTasks[taskId].data[0] = 2; + return; + case 2: + sub_80DF080(r6); + sub_80DF750(); + if (gContestResources->field_4[r6].numTurnsSkipped != 0 + || gContestResources->field_4[r6].noMoreTurns) + { + gTasks[taskId].data[0] = 31; + } + else + { + sub_80DB89C(); + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 3; + } + return; + case 3: + for (i = 0; i < 4; i++) + gBattleMonForms[i] = 0; + memset(gContestResources->field_18, 0, sizeof(*gContestResources->field_18)); + sub_80DE9DC(gContestResources->field_0->unk19215); + spriteId = sub_80DB174( + gContestMons[gContestResources->field_0->unk19215].species, + gContestMons[gContestResources->field_0->unk19215].otId, + gContestMons[gContestResources->field_0->unk19215].personality, + gContestResources->field_0->unk19215); + gSprites[spriteId].pos2.x = 120; + gSprites[spriteId].callback = sub_80DA134; + gTasks[taskId].data[2] = spriteId; + gBattlerSpriteIds[gBattlerAttacker] = spriteId; + sub_80DCBE8(sub_80DC9EC(gContestResources->field_0->unk19215), FALSE); + gTasks[taskId].data[0] = 4; + return; + case 4: + spriteId = gTasks[taskId].data[2]; + if (gSprites[spriteId].callback == SpriteCallbackDummy) + { + if (!gContestResources->field_14[r6].unk2_1) + gTasks[taskId].data[0] = 5; + } + return; + case 5: + if (gContestResources->field_4[r6].nervous) + { + gTasks[taskId].data[0] = 33; + } + else + { + sub_80DB89C(); + StringCopy(gStringVar1, gContestMons[r6].nickname); + if (gContestResources->field_4[r6].currMove < NUM_MOVES) + StringCopy(gStringVar2, gMoveNames[gContestResources->field_4[r6].currMove]); + else + StringCopy(gStringVar2, gUnknown_08587F1C[gContestResources->field_4[r6].moveCategory]); + StringExpandPlaceholders(gStringVar4, gText_0827D55A); + sub_80DEC30(gStringVar4, 1); + gTasks[taskId].data[0] = 6; + } + return; + case 6: + if (!sub_80DED4C()) + { + gContestResources->field_0->unk1925E = 0; + gTasks[taskId].data[0] = 7; + } + return; + case 7: + { + u16 move = sub_80DE834(gContestResources->field_4[gContestResources->field_0->unk19215].currMove); + + sub_80DE864(gContestResources->field_0->unk19215); + sub_80DE9DC(gContestResources->field_0->unk19215); + sub_80DEAA8(move); + DoMoveAnim(move); + gTasks[taskId].data[0] = 8; + } + return; + case 8: + gAnimScriptCallback(); + if (!gAnimScriptActive) + { + sub_80DE9B0(r6); + if (gContestResources->field_0->unk1925E != 0) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 9; + } + else + { + if (!gContestResources->field_4[r6].hasJudgesAttention) + sub_80DC674(r6); + sub_80DE12C(); + gTasks[taskId].data[0] = 23; + } + } + return; + case 9: + if (gTasks[taskId].data[10]++ > 30) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 7; + } + return; + case 23: + gTasks[taskId].data[1] = 0; + if (gContestResources->field_4[r6].effectStringId != CONTEST_STRING_NONE) + { + sub_80DD45C(r6, gContestResources->field_4[r6].effectStringId); + gContestResources->field_4[r6].effectStringId = CONTEST_STRING_NONE; + gTasks[taskId].data[0] = 24; + } + else + { + if (gContestResources->field_4[r6].effectStringId2 != CONTEST_STRING_NONE) + { + for (i = 0; i < 4; i++) + { + if (i != r6 && gContestResources->field_4[i].effectStringId != CONTEST_STRING_NONE) + break; + } + if (i == 4) + { + sub_80DD45C(r6, gContestResources->field_4[r6].effectStringId2); + gContestResources->field_4[r6].effectStringId2 = CONTEST_STRING_NONE; + gTasks[taskId].data[0] = 24; + } + else + { + gTasks[taskId].data[0] = 48; + } + } + else + { + gTasks[taskId].data[0] = 48; + } + } + return; + case 24: + if (!sub_80DED4C()) + gTasks[taskId].data[0] = 23; + return; + case 48: + if (gContestResources->field_4[r6].turnOrderModAction == 1) + { + sub_80DD720(5); + } + else if (gContestResources->field_4[r6].turnOrderModAction == 2) + { + sub_80DD720(6); + } + else if (gContestResources->field_4[r6].turnOrderModAction == 3) + { + sub_80DD720(7); + } + else + { + gTasks[taskId].data[0] = 47; + return; + } + gTasks[taskId].data[0] = 49; + return; + case 49: + if (!gContestResources->field_0->unk1920A_4) + gTasks[taskId].data[0] = 47; + return; + case 47: + sub_80DE008(TRUE); + gTasks[taskId].data[0] = 12; + return; + case 12: + sub_80DC028(0, gContestResources->field_4[r6].appeal2, r6); + gTasks[taskId].data[0] = 13; + return; + case 13: + if (!gContestResources->field_14[gContestResources->field_0->unk19215].unk2_2) + gTasks[taskId].data[0] = 35; + return; + case 35: + if (gContestResources->field_4[r6].conditionMod == 1) + sub_80DD720(8); + gTasks[taskId].data[0] = 36; + return; + case 36: + if (!gContestResources->field_0->unk1920A_4) + gTasks[taskId].data[0] = 37; + return; + case 37: + if (sub_80DB5B8(r6, 1)) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 38; + } + else + { + gTasks[taskId].data[0] = 50; + } + return; + case 38: + if (++gTasks[taskId].data[10] > 20) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 50; + } + return; + case 50: + if (sub_80DB798(r6)) + PlaySE(SE_C_PASI); + gTasks[taskId].data[0] = 25; + return; + case 25: + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[0] = 26; + return; + case 26: + { + s32 r2 = 0; + + r3 = 0; + for (i = gTasks[taskId].data[1]; i < 4; i++) + { + r3 = 0; + for (r2 = 0; r2 < 4; r2++) + { + if (r2 != r6 && gUnknown_02039F26[r2] == i + && gContestResources->field_4[r2].effectStringId != CONTEST_STRING_NONE) + { + r3 = 1; + break; + } + } + if (r3 != 0) + break; + } + if (r3) + { + gTasks[taskId].data[1] = gUnknown_02039F26[r2]; + sub_80DD45C(r2, gContestResources->field_4[r2].effectStringId); + gContestResources->field_4[r2].effectStringId = CONTEST_STRING_NONE; + gTasks[taskId].data[0] = 27; + } + else + { + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 51; + sub_80DB884(); + } + } + return; + case 27: + if (!sub_80DED4C()) + gTasks[taskId].data[0] = 28; + return; + case 28: + for (i = 0; gTasks[taskId].data[1] != gUnknown_02039F26[i]; i++) + ; + sub_80DC028(gContestResources->field_4[i].appeal2 + gContestResources->field_4[i].jam, -gContestResources->field_4[i].jam, i); + gTasks[taskId].data[0] = 29; + return; + case 29: + for (i = 0; gTasks[taskId].data[1] != gUnknown_02039F26[i]; i++) + ; + if (!gContestResources->field_14[i].unk2_2) + gTasks[taskId].data[0] = 39; + return; + case 39: + for (i = 0; gTasks[taskId].data[1] != gUnknown_02039F26[i]; i++) + ; + if (sub_80DB5B8(i, 1)) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 40; + } + else + { + gTasks[taskId].data[0] = 30; + } + return; + case 40: + if (++gTasks[taskId].data[10] > 20) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 30; + } + return; + case 30: + for (i = 0; i < 4; i++) + { + if (gUnknown_02039F26[i] == gTasks[taskId].data[1]) + break; + } + if (sub_80DB798(i)) + PlaySE(SE_C_PASI); + else + PlaySE(SE_C_SYU); + if (gContestResources->field_4[i].judgesAttentionWasRemoved) + { + sub_80DC674(i); + gContestResources->field_4[i].judgesAttentionWasRemoved = 0; + } + gTasks[taskId].data[1]++; + gTasks[taskId].data[0] = 26; + return; + case 51: + if (gTasks[taskId].data[10]++ > 9) + { + gTasks[taskId].data[10] = 0; + if (gContestResources->field_4[r6].numTurnsSkipped != 0 + || gContestResources->field_4[r6].turnSkipped) + { + sub_80DB89C(); + StringCopy(gStringVar1, gContestMons[r6].nickname); + StringExpandPlaceholders(gStringVar4, gText_0827E793); + sub_80DEC30(gStringVar4, 1); + } + gTasks[taskId].data[0] = 52; + } + return; + case 52: + if (!sub_80DED4C()) + { + if (!gContestResources->field_4[r6].unk15_6) + gTasks[taskId].data[0] = 17; + else + gTasks[taskId].data[0] = 14; + } + return; + case 14: + r3 = gContestResources->field_4[r6].unk16; + if (gContestResources->field_4[r6].unk16 != 0) + { + sub_80DB89C(); + if (r3 == 1) + sub_80DEC30(gText_0827E32E, 1); + else if (r3 == 2) + sub_80DEC30(gText_0827E35B, 1); + else + sub_80DEC30(gText_0827E38D, 1); + sub_80DD720(3); + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 45; + } + else + { + sub_80DB89C(); + StringCopy(gStringVar1, gContestMons[r6].nickname); + StringExpandPlaceholders(gStringVar4, gText_0827E2FE); + sub_80DEC30(gStringVar4, 1); + sub_80DD720(2); + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 45; + } + return; + case 45: + if (!gContestResources->field_0->unk1920A_4) + { + sub_80DC9B4(gContestResources->field_0->unk19215); + gTasks[taskId].data[0] = 15; + } + return; + case 15: + if (!sub_80DED4C()) + { + if (++gTasks[taskId].data[10] > 50) + { + if (!gContestResources->field_4[r6].hasJudgesAttention) + { + sub_80DC028( + gContestResources->field_4[r6].appeal2, + gContestResources->field_4[r6].unk17, + r6); + gContestResources->field_4[r6].appeal2 += gContestResources->field_4[r6].unk17; + } + gTasks[taskId].data[0] = 16; + } + } + return; + case 16: + if (!gContestResources->field_14[r6].unk2_2) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 17; + } + return; + case 17: + if (gContestResources->field_4[r6].disappointedRepeat) + { + sub_80DB89C(); + StringCopy(gStringVar1, gContestMons[r6].nickname); + StringExpandPlaceholders(gStringVar4, gText_0827E6E3); + sub_80DEC30(gStringVar4, 1); + gTasks[taskId].data[10] = 0; + sub_80DD720(0); + gTasks[taskId].data[0] = 46; + } + else + { + gTasks[taskId].data[0] = 41; + } + return; + case 46: + if (!gContestResources->field_0->unk1920A_4) + gTasks[taskId].data[0] = 19; + return; + case 19: + if (!sub_80DED4C()) + { + sub_80DC028(gContestResources->field_4[r6].appeal2, -gContestResources->field_4[r6].unk18, r6); + gContestResources->field_4[r6].appeal2 -= gContestResources->field_4[r6].unk18; + gTasks[taskId].data[0] = 18; + } + return; + case 18: + sub_80DCD48(); + if (!gContestResources->field_14[r6].unk2_2) + { + gTasks[taskId].data[10] = 0; + sub_80DB89C(); + gTasks[taskId].data[0] = 41; + } + return; + case 41: + if (gContestResources->field_10->excitementFrozen && r6 != gContestResources->field_10->excitementFreezer) + { + gTasks[taskId].data[0] = 57; + } + else + { + r3 = gContestResources->field_10->bits_0; + if (gContestResources->field_4[r6].overrideCategoryExcitementMod) + { + r3 = 1; + StringCopy(gStringVar3, gMoveNames[gContestResources->field_4[r6].currMove]); + } + else + { + StringCopy(gStringVar3, gUnknown_08587F08[gContestMoves[gContestResources->field_4[r6].currMove].contestCategory]); + } + if (r3 > 0) + { + if (gContestResources->field_4[r6].disappointedRepeat) + r3 = 0; + } + sub_80DB89C(); + StringCopy(gStringVar1, gContestMons[r6].nickname); + gContestResources->field_0->applauseLevel += r3; + if (gContestResources->field_0->applauseLevel < 0) + gContestResources->field_0->applauseLevel = 0; + if (r3 == 0) + { + gTasks[taskId].data[0] = 55; + } + else + { + if (r3 < 0) + StringExpandPlaceholders(gStringVar4, gText_0827E73C); + else if (r3 > 0 && gContestResources->field_0->applauseLevel <= 4) + StringExpandPlaceholders(gStringVar4, gText_0827E717); + else + StringExpandPlaceholders(gStringVar4, gText_0827E76A); + sub_80DEC30(gStringVar4, 1); + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[11] = 0; + if (r3 < 0) + gTasks[taskId].data[0] = 53; + else + gTasks[taskId].data[0] = 54; + } + } + return; + case 53: + switch (gTasks[taskId].data[10]) + { + case 0: + sub_80DDED0(-1, 1); + PlayFanfare(MUS_ME_ZANNEN); + gTasks[taskId].data[10]++; + break; + case 1: + if (!gContestResources->field_0->unk1920B_0 && !sub_80DED4C()) + { + sub_80DDCDC(-1); + gTasks[taskId].data[10]++; + } + break; + case 2: + if (!gContestResources->field_0->unk1920A_5) + { + if (gTasks[taskId].data[11]++ > 29) + { + gTasks[taskId].data[11] = 0; + sub_80DDED0(-1, -1); + gTasks[taskId].data[10]++; + } + } + break; + case 3: + if (!gPaletteFade.active) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[11] = 0; + gTasks[taskId].data[0] = 43; + } + break; + } + return; + case 54: + switch (gTasks[taskId].data[10]) + { + case 0: + if (!sub_80DED4C()) + { + sub_80DDED0(1, 1); + gTasks[taskId].data[10]++; + } + break; + case 1: + if (!gContestResources->field_0->unk1920B_0) + { + sub_80DDE0C(); + PlaySE(SE_W227B); + sub_80DDCDC(1); + gTasks[taskId].data[10]++; + } + break; + case 2: + if (!gContestResources->field_0->unk1920A_5) + { + if (gTasks[taskId].data[11]++ > 29) + { + gTasks[taskId].data[11] = 0; + sub_80DC028(gContestResources->field_4[r6].appeal2, gContestResources->field_10->unk2, r6); + gContestResources->field_4[r6].appeal2 += gContestResources->field_10->unk2; + gTasks[taskId].data[10]++; + } + } + break; + case 3: + if (!gContestResources->field_14[r6].unk2_2) + { + if (!gContestResources->field_0->unk1920A_7) + { + sub_80DDED0(1, -1); + gTasks[taskId].data[10]++; + } + } + break; + case 4: + if (!gPaletteFade.active) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[11] = 0; + gTasks[taskId].data[0] = 43; + } + break; + } + return; + case 43: + if (!gContestResources->field_14[r6].unk2_2) + { + sub_80DB89C(); + gTasks[taskId].data[0] = 55; + } + return; + case 57: + sub_80DB89C(); + StringCopy(gStringVar3, gContestMons[gContestResources->field_10->excitementFreezer].nickname); + StringCopy(gStringVar1, gContestMons[r6].nickname); + StringCopy(gStringVar2, gMoveNames[gContestResources->field_4[r6].currMove]); + StringExpandPlaceholders(gStringVar4, gText_0827E7EA); + sub_80DEC30(gStringVar4, 1); + gTasks[taskId].data[0] = 58; + return; + case 58: + if (!sub_80DED4C()) + { + sub_80DB89C(); + StringExpandPlaceholders(gStringVar4, gText_0827E817); + sub_80DEC30(gStringVar4, 1); + gTasks[taskId].data[0] = 59; + } + return; + case 59: + if (!sub_80DED4C()) + { + sub_80DB89C(); + gTasks[taskId].data[0] = 55; + } + return; + case 33: + if (gContestResources->field_4[r6].hasJudgesAttention) + gContestResources->field_4[r6].hasJudgesAttention = 0; + sub_80DC9B4(r6); + StringCopy(gStringVar1, gContestMons[r6].nickname); + StringCopy(gStringVar2, gMoveNames[gContestResources->field_4[r6].currMove]); + StringExpandPlaceholders(gStringVar4, gText_0827E58A); + sub_80DEC30(gStringVar4, 1); + gTasks[taskId].data[0] = 34; + return; + case 34: + if (!sub_80DED4C()) + gTasks[taskId].data[0] = 55; + return; + case 55: + sub_80DDBE8(); + gTasks[taskId].data[0] = 56; + return; + case 56: + if (!gContestResources->field_0->unk1920A_6) + { + if (gContestResources->field_0->applauseLevel > 4) + { + gContestResources->field_0->applauseLevel = 0; + sub_80DD940(); + } + gTasks[taskId].data[0] = 10; + } + return; + case 10: + spriteId = gTasks[taskId].data[2]; + gSprites[spriteId].callback = sub_80DA164; + gTasks[taskId].data[0] = 11; + return; + case 11: + spriteId = gTasks[taskId].data[2]; + if (gSprites[spriteId].invisible) + { + FreeSpriteOamMatrix(&gSprites[spriteId]); + DestroySprite(&gSprites[spriteId]); + gTasks[taskId].data[0] = 20; + } + return; + case 20: + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 21; + return; + case 31: + sub_80DB89C(); + StringCopy(gStringVar1, gContestMons[r6].nickname); + StringExpandPlaceholders(gStringVar4, gText_0827D56F); + sub_80DEC30(gStringVar4, 1); + gTasks[taskId].data[0] = 32; + return; + case 32: + if (!sub_80DED4C()) + gTasks[taskId].data[0] = 21; + return; + case 21: + if (++gTasks[taskId].data[10] > 29) + { + gTasks[taskId].data[10] = 0; + gTasks[taskId].data[0] = 22; + } + return; + case 22: + if (++gContestResources->field_0->unk19214 == 4) + { + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[2] = 0; + gTasks[taskId].func = sub_80DA198; + } + else + { + gTasks[taskId].data[0] = 0; + } + return; + } +}