From 76510d58bb66a2e0fb0909330ac0d3ac97c083e1 Mon Sep 17 00:00:00 2001 From: ultima-soul Date: Wed, 19 Dec 2018 08:53:43 -0800 Subject: [PATCH 1/8] Matched up to sub_80DBF68, sub_80DBF90 WIP. --- asm/contest.s | 974 ---------------------------------------------- include/contest.h | 8 + src/contest.c | 308 ++++++++++++++- 3 files changed, 313 insertions(+), 977 deletions(-) diff --git a/asm/contest.s b/asm/contest.s index a9abd94302..8a148e529a 100644 --- a/asm/contest.s +++ b/asm/contest.s @@ -5,980 +5,6 @@ .text - thumb_func_start sub_80DB884 -sub_80DB884: @ 80DB884 - push {r4,lr} - movs r4, 0 -_080DB888: - lsls r0, r4, 24 - lsrs r0, 24 - bl sub_80DB798 - adds r4, 0x1 - cmp r4, 0x3 - ble _080DB888 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80DB884 - - thumb_func_start sub_80DB89C -sub_80DB89C: @ 80DB89C - push {lr} - movs r0, 0x4 - movs r1, 0 - bl FillWindowPixelBuffer - movs r0, 0x4 - movs r1, 0x2 - bl CopyWindowToVram - movs r0, 0 - bl Contest_SetBgCopyFlags - pop {r0} - bx r0 - thumb_func_end sub_80DB89C - - thumb_func_start sub_80DB8B8 -sub_80DB8B8: @ 80DB8B8 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - adds r5, r4, 0 - adds r0, r4, 0 - bl Contest_IsMonsTurnDisabled - lsls r0, 24 - cmp r0, 0 - beq _080DB8D0 - movs r0, 0 - b _080DB90A -_080DB8D0: - ldr r0, =gContestPlayerMonIndex - ldrb r0, [r0] - cmp r4, r0 - beq _080DB8F4 - adds r0, r4, 0 - bl ContestAI_ResetAI - bl ContestAI_GetActionToUse - lsls r0, 24 - ldr r2, =gContestMons - lsrs r0, 23 - lsls r1, r4, 6 - b _080DB902 - .pool -_080DB8F4: - ldr r2, =gContestMons - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0] - ldrb r0, [r0] - lsls r0, 1 - lsls r1, r5, 6 -_080DB902: - adds r0, r1 - adds r2, 0x1E - adds r0, r2 - ldrh r0, [r0] -_080DB90A: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80DB8B8 - - thumb_func_start sub_80DB918 -sub_80DB918: @ 80DB918 - push {r4,r5,lr} - movs r4, 0 - movs r5, 0 -_080DB91E: - lsls r0, r4, 24 - lsrs r0, 24 - bl sub_80DB8B8 - ldr r1, =gContestResources - ldr r1, [r1] - ldr r1, [r1, 0x4] - adds r1, r5, r1 - strh r0, [r1, 0x6] - adds r5, 0x1C - adds r4, 0x1 - cmp r4, 0x3 - ble _080DB91E - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DB918 - - thumb_func_start sub_80DB944 -sub_80DB944: @ 80DB944 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x8 - ldr r5, =gContestResources - mov r4, sp - movs r3, 0 - movs r6, 0x3 -_080DB956: - ldr r2, [r5] - ldr r1, [r2, 0x4] - adds r1, r3, r1 - ldrh r0, [r1, 0x2] - ldrh r7, [r1, 0x4] - adds r0, r7 - strh r0, [r1, 0x4] - ldr r0, [r2, 0x4] - adds r0, r3, r0 - ldrh r0, [r0, 0x4] - strh r0, [r4] - adds r4, 0x2 - adds r3, 0x1C - subs r6, 0x1 - cmp r6, 0 - bge _080DB956 - movs r6, 0 -_080DB978: - movs r4, 0x3 - cmp r4, r6 - ble _080DB9A4 -_080DB97E: - subs r5, r4, 0x1 - lsls r0, r5, 1 - mov r1, sp - adds r3, r1, r0 - lsls r0, r4, 1 - adds r2, r1, r0 - ldrh r4, [r3] - movs r7, 0 - ldrsh r1, [r3, r7] - movs r7, 0 - ldrsh r0, [r2, r7] - cmp r1, r0 - bge _080DB99E - ldrh r0, [r2] - strh r4, [r2] - strh r0, [r3] -_080DB99E: - adds r4, r5, 0 - cmp r4, r6 - bgt _080DB97E -_080DB9A4: - adds r6, 0x1 - cmp r6, 0x2 - ble _080DB978 - movs r6, 0 - movs r0, 0x4 - negs r0, r0 - mov r9, r0 - ldr r1, =gContestResources - mov r8, r1 - movs r7, 0x3 - mov r12, r7 -_080DB9BA: - movs r4, 0 - lsls r0, r6, 3 - adds r7, r6, 0x1 - subs r0, r6 - lsls r5, r0, 2 - mov r3, sp -_080DB9C6: - mov r1, r8 - ldr r0, [r1] - ldr r0, [r0, 0x4] - adds r2, r5, r0 - movs r6, 0x4 - ldrsh r1, [r2, r6] - movs r6, 0 - ldrsh r0, [r3, r6] - cmp r1, r0 - bne _080DB9F0 - mov r0, r12 - ands r4, r0 - ldrb r1, [r2, 0xB] - mov r0, r9 - ands r0, r1 - orrs r0, r4 - strb r0, [r2, 0xB] - b _080DB9F8 - .pool -_080DB9F0: - adds r3, 0x2 - adds r4, 0x1 - cmp r4, 0x3 - ble _080DB9C6 -_080DB9F8: - adds r6, r7, 0 - cmp r6, 0x3 - ble _080DB9BA - movs r0, 0x1 - bl sub_80DCE58 - bl sub_80DD590 - add sp, 0x8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80DB944 - - thumb_func_start sub_80DBA18 -sub_80DBA18: @ 80DBA18 - push {r4,r5,lr} - ldr r4, =gContestResources - movs r2, 0 - movs r3, 0x3 -_080DBA20: - ldr r0, [r4] - ldr r0, [r0, 0x4] - adds r1, r2, r0 - ldrh r0, [r1, 0x6] - cmp r0, 0 - bne _080DBA34 - movs r1, 0x5 - b _080DBA52 - .pool -_080DBA34: - movs r5, 0x2 - ldrsh r0, [r1, r5] - movs r1, 0 - cmp r0, 0 - ble _080DBA52 - movs r1, 0x1 - cmp r0, 0x1D - ble _080DBA52 - movs r1, 0x2 - cmp r0, 0x3B - ble _080DBA52 - movs r1, 0x4 - cmp r0, 0x4F - bgt _080DBA52 - movs r1, 0x3 -_080DBA52: - ldr r0, [r4] - ldr r0, [r0, 0x4] - adds r0, r2, r0 - strb r1, [r0, 0x1A] - adds r2, 0x1C - subs r3, 0x1 - cmp r3, 0 - bge _080DBA20 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80DBA18 - - thumb_func_start sub_80DBA68 -sub_80DBA68: @ 80DBA68 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gContestResources - ldr r1, [r1] - ldr r2, [r1, 0x4] - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r2, r1, r2 - ldrb r1, [r2, 0xC] - movs r0, 0x6 - ands r0, r1 - cmp r0, 0 - bne _080DBA90 - ldrb r1, [r2, 0xB] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _080DBA98 -_080DBA90: - movs r0, 0 - b _080DBA9A - .pool -_080DBA98: - movs r0, 0x1 -_080DBA9A: - pop {r1} - bx r1 - thumb_func_end sub_80DBA68 - - thumb_func_start sub_80DBAA0 -sub_80DBAA0: @ 80DBAA0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r5, =gContestResources - movs r0, 0 - mov r8, r0 - movs r1, 0x7 - negs r1, r1 - mov r10, r1 - movs r0, 0x2 - negs r0, r0 - mov r9, r0 - movs r4, 0 - movs r6, 0x3 -_080DBAC0: - ldr r1, [r5] - ldr r0, [r1, 0x4] - adds r0, r4, r0 - movs r2, 0 - strh r2, [r0, 0x2] - ldr r0, [r1, 0x4] - adds r0, r4, r0 - strh r2, [r0] - ldr r0, [r1, 0x4] - adds r0, r4, r0 - mov r1, r8 - strb r1, [r0, 0x12] - ldr r0, [r5] - ldr r0, [r0, 0x4] - adds r3, r4, r0 - ldrb r2, [r3, 0xC] - movs r0, 0x6 - ands r0, r2 - cmp r0, 0 - beq _080DBAFC - lsls r0, r2, 29 - lsrs r0, 30 - subs r0, 0x1 - movs r1, 0x3 - ands r0, r1 - lsls r0, 1 - mov r1, r10 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0xC] -_080DBAFC: - ldr r0, [r5] - ldr r0, [r0, 0x4] - adds r0, r4, r0 - mov r1, r8 - strb r1, [r0, 0xE] - ldr r0, [r5] - ldr r1, [r0, 0x4] - adds r1, r4, r1 - ldrb r2, [r1, 0x10] - mov r0, r9 - ands r0, r2 - strb r0, [r1, 0x10] - ldr r0, [r5] - ldr r0, [r0, 0x4] - adds r0, r4, r0 - mov r1, r8 - strb r1, [r0, 0xF] - ldr r0, [r5] - ldr r1, [r0, 0x4] - adds r1, r4, r1 - ldrb r2, [r1, 0x10] - movs r0, 0x3 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x10] - ldr r0, [r5] - ldr r1, [r0, 0x4] - adds r1, r4, r1 - ldrb r2, [r1, 0x10] - movs r7, 0x5 - negs r7, r7 - adds r0, r7, 0 - ands r0, r2 - strb r0, [r1, 0x10] - ldr r0, [r5] - ldr r1, [r0, 0x4] - adds r1, r4, r1 - ldrb r2, [r1, 0x10] - movs r0, 0x9 - negs r0, r0 - mov r12, r0 - ands r0, r2 - strb r0, [r1, 0x10] - ldr r0, [r5] - ldr r1, [r0, 0x4] - adds r1, r4, r1 - ldrb r2, [r1, 0xC] - mov r0, r9 - ands r0, r2 - strb r0, [r1, 0xC] - ldr r0, [r5] - ldr r0, [r0, 0x4] - adds r0, r4, r0 - movs r1, 0xFF - strb r1, [r0, 0x13] - ldr r0, [r5] - ldr r0, [r0, 0x4] - adds r0, r4, r0 - movs r1, 0x1 - negs r1, r1 - strb r1, [r0, 0x14] - ldr r0, [r5] - ldr r1, [r0, 0x4] - adds r1, r4, r1 - ldrb r2, [r1, 0x10] - movs r0, 0x31 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x10] - ldr r0, [r5] - ldr r2, [r0, 0x4] - adds r2, r4, r2 - ldrb r3, [r2, 0x15] - lsls r1, r3, 31 - lsrs r1, 31 - lsls r1, 2 - adds r0, r7, 0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0x15] - ldr r0, [r5] - ldr r1, [r0, 0x4] - adds r1, r4, r1 - ldrb r2, [r1, 0x15] - mov r0, r9 - ands r0, r2 - strb r0, [r1, 0x15] - ldr r0, [r5] - ldr r1, [r0, 0x4] - adds r1, r4, r1 - ldrb r2, [r1, 0x11] - movs r0, 0x4 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x11] - ldr r0, [r5] - ldr r1, [r0, 0x4] - adds r1, r4, r1 - ldrb r2, [r1, 0x11] - movs r0, 0x21 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x11] - ldr r0, [r5] - ldr r0, [r0, 0x4] - adds r2, r4, r0 - ldrb r1, [r2, 0x11] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _080DBBF4 - ldrb r1, [r2, 0xC] - mov r0, r10 - ands r0, r1 - movs r1, 0x2 - orrs r0, r1 - strb r0, [r2, 0xC] - ldr r0, [r5] - ldr r1, [r0, 0x4] - adds r1, r4, r1 - ldrb r2, [r1, 0x11] - adds r0, r7, 0 - ands r0, r2 - strb r0, [r1, 0x11] -_080DBBF4: - ldr r0, [r5] - ldr r0, [r0, 0x4] - adds r2, r4, r0 - ldrb r1, [r2, 0x11] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - beq _080DBC1A - ldrb r0, [r2, 0xB] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2, 0xB] - ldr r0, [r5] - ldr r1, [r0, 0x4] - adds r1, r4, r1 - ldrb r2, [r1, 0x11] - mov r0, r12 - ands r0, r2 - strb r0, [r1, 0x11] -_080DBC1A: - ldr r0, [r5] - ldr r1, [r0, 0x4] - adds r1, r4, r1 - ldrb r2, [r1, 0x11] - movs r0, 0x11 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x11] - adds r4, 0x1C - subs r6, 0x1 - cmp r6, 0 - blt _080DBC34 - b _080DBAC0 -_080DBC34: - movs r6, 0 - ldr r5, =gContestResources - movs r7, 0 - movs r4, 0 -_080DBC3C: - ldr r3, [r5] - ldr r0, [r3, 0x4] - adds r0, r4, r0 - ldrh r1, [r0, 0x6] - strh r1, [r0, 0x8] - ldr r2, [r3] - lsls r1, r6, 1 - ldrb r0, [r2, 0x1] - lsls r0, 3 - adds r1, r0 - adds r2, 0x1C - adds r2, r1 - ldr r0, [r3, 0x4] - adds r0, r4, r0 - ldrh r0, [r0, 0x6] - strh r0, [r2] - ldr r0, [r3, 0x4] - adds r0, r4, r0 - ldrh r0, [r0, 0x6] - bl Contest_GetMoveExcitement - ldr r1, [r5] - ldr r2, [r1] - ldrb r1, [r2, 0x1] - lsls r1, 2 - adds r1, r6, r1 - adds r2, 0x44 - adds r2, r1 - strb r0, [r2] - ldr r0, [r5] - ldr r0, [r0, 0x4] - adds r0, r4, r0 - strh r7, [r0, 0x6] - adds r4, 0x1C - adds r6, 0x1 - cmp r6, 0x3 - ble _080DBC3C - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0, 0x10] - ldrb r1, [r2, 0x1] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x1] - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DBAA0 - - thumb_func_start Contest_IsMonsTurnDisabled -Contest_IsMonsTurnDisabled: @ 80DBCA8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gContestResources - ldr r1, [r1] - ldr r2, [r1, 0x4] - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r2, r1, r2 - ldrb r1, [r2, 0xC] - movs r0, 0x6 - ands r0, r1 - cmp r0, 0 - bne _080DBCD0 - ldrb r1, [r2, 0xB] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _080DBCD8 -_080DBCD0: - movs r0, 0x1 - b _080DBCDA - .pool -_080DBCD8: - movs r0, 0 -_080DBCDA: - pop {r1} - bx r1 - thumb_func_end Contest_IsMonsTurnDisabled - - thumb_func_start sub_80DBCE0 -sub_80DBCE0: @ 80DBCE0 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl sub_80DBD34 - ldr r1, =gUnknown_02039F18 - lsls r4, 1 - adds r1, r4, r1 - strh r0, [r1] - ldr r2, =gUnknown_02039F08 - adds r2, r4, r2 - ldr r1, =gContestMonConditions - adds r4, r1 - ldrh r4, [r4] - adds r0, r4 - strh r0, [r2] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DBCE0 - - thumb_func_start sub_80DBD18 -sub_80DBD18: @ 80DBD18 - push {r4,lr} - movs r4, 0 -_080DBD1C: - lsls r0, r4, 24 - lsrs r0, 24 - bl sub_80DBCE0 - adds r4, 0x1 - cmp r4, 0x3 - ble _080DBD1C - bl sub_80DBD4C - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80DBD18 - - thumb_func_start sub_80DBD34 -sub_80DBD34: @ 80DBD34 - lsls r0, 24 - ldr r1, =gUnknown_02039F10 - lsrs r0, 23 - adds r0, r1 - movs r1, 0 - ldrsh r0, [r0, r1] - lsls r0, 17 - asrs r0, 16 - bx lr - .pool - thumb_func_end sub_80DBD34 - - thumb_func_start sub_80DBD4C -sub_80DBD4C: @ 80DBD4C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x70 - mov r0, sp - movs r1, 0 - movs r2, 0x8 - bl memset - movs r0, 0 - mov r9, r0 - mov r1, sp - adds r1, 0x8 - str r1, [sp, 0x64] - mov r3, sp - adds r3, 0xC - str r3, [sp, 0x68] - mov r6, sp - adds r6, 0x14 - str r6, [sp, 0x6C] - mov r4, sp -_080DBD7A: - bl Random - strh r0, [r4] - movs r2, 0 - cmp r2, r9 - bge _080DBDB8 - mov r1, sp - lsls r0, 16 - lsrs r0, 16 - ldrh r1, [r1] - cmp r0, r1 - bne _080DBD9C - subs r4, 0x2 - movs r7, 0x1 - negs r7, r7 - add r9, r7 - b _080DBDB8 -_080DBD9C: - adds r2, 0x1 - cmp r2, r9 - bge _080DBDB8 - lsls r0, r2, 1 - mov r3, sp - adds r1, r3, r0 - ldrh r0, [r4] - ldrh r1, [r1] - cmp r0, r1 - bne _080DBD9C - subs r4, 0x2 - movs r6, 0x1 - negs r6, r6 - add r9, r6 -_080DBDB8: - adds r4, 0x2 - movs r7, 0x1 - add r9, r7 - mov r0, r9 - cmp r0, 0x3 - ble _080DBD7A - movs r1, 0 - mov r9, r1 - mov r4, sp - ldr r6, =gUnknown_02039F08 - ldr r2, [sp, 0x64] - ldr r5, =gContestMonConditions - ldr r3, [sp, 0x68] -_080DBDD2: - mov r7, r9 - lsls r1, r7, 4 - movs r7, 0 - ldrsh r0, [r6, r7] - str r0, [r2] - movs r7, 0 - ldrsh r0, [r5, r7] - str r0, [r3] - ldrh r0, [r4] - str r0, [r2, 0x8] - ldr r0, [sp, 0x6C] - adds r1, r0, r1 - mov r7, r9 - str r7, [r1] - adds r4, 0x2 - adds r6, 0x2 - adds r2, 0x10 - adds r5, 0x2 - adds r3, 0x10 - movs r0, 0x1 - add r9, r0 - mov r1, r9 - cmp r1, 0x3 - ble _080DBDD2 - movs r3, 0 - mov r9, r3 -_080DBE06: - movs r4, 0x3 - cmp r4, r9 - ble _080DBE90 - add r7, sp, 0x48 - ldr r6, [sp, 0x68] - str r6, [sp, 0x58] - ldr r0, [sp, 0x64] - adds r0, 0x8 - str r0, [sp, 0x5C] - ldr r1, [sp, 0x6C] - str r1, [sp, 0x60] -_080DBE1C: - subs r3, r4, 0x1 - mov r10, r3 - mov r0, r10 - adds r1, r4, 0 - ldr r2, [sp, 0x64] - bl sub_80DBF30 - lsls r0, 24 - cmp r0, 0 - beq _080DBE8A - mov r6, r10 - lsls r2, r6, 4 - ldr r0, [sp, 0x64] - adds r3, r0, r2 - ldr r0, [r3] - str r0, [sp, 0x48] - ldr r1, [sp, 0x58] - adds r6, r1, r2 - ldr r0, [r6] - str r0, [r7, 0x4] - ldr r0, [sp, 0x5C] - adds r0, r2 - mov r8, r0 - ldr r0, [r0] - str r0, [r7, 0x8] - ldr r1, [sp, 0x60] - adds r2, r1, r2 - ldr r0, [r2] - str r0, [r7, 0xC] - lsls r1, r4, 4 - ldr r0, [sp, 0x64] - adds r5, r0, r1 - ldr r0, [r5] - str r0, [r3] - ldr r3, [sp, 0x58] - adds r4, r3, r1 - ldr r0, [r4] - str r0, [r6] - ldr r6, [sp, 0x5C] - adds r3, r6, r1 - ldr r0, [r3] - mov r6, r8 - str r0, [r6] - ldr r0, [sp, 0x60] - adds r1, r0, r1 - ldr r0, [r1] - str r0, [r2] - ldr r0, [sp, 0x48] - str r0, [r5] - ldr r0, [r7, 0x4] - str r0, [r4] - ldr r0, [r7, 0x8] - str r0, [r3] - ldr r0, [r7, 0xC] - str r0, [r1] -_080DBE8A: - mov r4, r10 - cmp r4, r9 - bgt _080DBE1C -_080DBE90: - movs r1, 0x1 - add r9, r1 - mov r3, r9 - cmp r3, 0x2 - ble _080DBE06 - movs r6, 0 - mov r9, r6 - ldr r2, =gContestFinalStandings - ldr r1, [sp, 0x6C] -_080DBEA2: - ldr r0, [r1] - adds r0, r2 - mov r7, r9 - strb r7, [r0] - adds r1, 0x10 - movs r0, 0x1 - add r9, r0 - mov r3, r9 - cmp r3, 0x3 - ble _080DBEA2 - add sp, 0x70 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DBD4C - - thumb_func_start sub_80DBED4 -sub_80DBED4: @ 80DBED4 - push {lr} - ldr r0, =gIsLinkContest - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080DBF0E - ldr r0, =gSaveBlock2Ptr - ldr r2, [r0] - ldr r1, =gContestFinalStandings - ldr r0, =gContestPlayerMonIndex - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r1, 1 - ldr r0, =gSpecialVar_ContestCategory - ldrh r0, [r0] - lsls r0, 3 - adds r1, r0 - ldr r0, =0x00000624 - adds r2, r0 - adds r2, r1 - ldrh r0, [r2] - adds r0, 0x1 - ldr r1, =0x0000270f - cmp r0, r1 - ble _080DBF0C - adds r0, r1, 0 -_080DBF0C: - strh r0, [r2] -_080DBF0E: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DBED4 - - thumb_func_start sub_80DBF30 -sub_80DBF30: @ 80DBF30 - push {lr} - lsls r0, 4 - adds r0, r2 - lsls r1, 4 - adds r3, r1, r2 - ldr r2, [r0] - ldr r1, [r3] - cmp r2, r1 - blt _080DBF60 - cmp r2, r1 - bgt _080DBF52 - ldr r2, [r0, 0x4] - ldr r1, [r3, 0x4] - cmp r2, r1 - blt _080DBF60 - cmp r2, r1 - ble _080DBF56 -_080DBF52: - movs r2, 0 - b _080DBF62 -_080DBF56: - ldr r1, [r0, 0x8] - ldr r0, [r3, 0x8] - movs r2, 0 - cmp r1, r0 - bge _080DBF62 -_080DBF60: - movs r2, 0x1 -_080DBF62: - adds r0, r2, 0 - pop {r1} - bx r1 - thumb_func_end sub_80DBF30 - - thumb_func_start sub_80DBF68 -sub_80DBF68: @ 80DBF68 - push {lr} - ldr r0, =gBattle_BG0_Y - movs r1, 0 - strh r1, [r0] - ldr r0, =gBattle_BG2_Y - strh r1, [r0] - bl sub_80DB89C - ldr r0, =gUnknown_0827E8DA - movs r1, 0 - bl Contest_StartTextPrinter - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DBF68 - - thumb_func_start sub_80DBF90 -sub_80DBF90: @ 80DBF90 - push {r4,r5,lr} - sub sp, 0xC - movs r5, 0x80 - lsls r5, 18 - movs r4, 0x3 -_080DBF9A: - lsrs r3, r5, 24 - movs r0, 0x8 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0 - movs r2, 0x16 - bl ContestBG_FillBoxWithTile - movs r0, 0xA0 - lsls r0, 19 - adds r5, r0 - subs r4, 0x1 - cmp r4, 0 - bge _080DBF9A - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_80DBF90 - thumb_func_start sub_80DBFC8 sub_80DBFC8: @ 80DBFC8 push {lr} diff --git a/include/contest.h b/include/contest.h index 73ebb79fa1..4ab4d350c5 100644 --- a/include/contest.h +++ b/include/contest.h @@ -385,6 +385,14 @@ struct UnknownContestStruct4 u8 unk2_2:1; }; +struct UnknownContestStruct6 +{ + s32 unk0; + s32 unk4; + s32 unk8; + s32 unkC; +}; + struct ContestResourcesField1C { u8 filler_00[0x40]; diff --git a/src/contest.c b/src/contest.c index 7decf88fc8..da4fdb3e03 100644 --- a/src/contest.c +++ b/src/contest.c @@ -42,6 +42,7 @@ #include "international_string_util.h" #include "data2.h" #include "constants/rgb.h" +#include "contest_ai.h" extern void (*gFieldCallback)(void); @@ -104,7 +105,7 @@ void sub_80DB2BC(void); void prints_contest_move_description(u16); u16 sub_80DE84C(u16); void sub_80DB89C(void); -u16 sub_80DB8B8(u8); +u16 GetChosenMove(u8); void sub_80DB918(void); bool8 Contest_IsMonsTurnDisabled(u8); void sub_80DBF68(void); @@ -169,6 +170,9 @@ void sub_80DF9D4(u8 *); void sub_80DF9E0(u8 *, s32); void ContestBG_FillBoxWithTile(u8, u16, u8, u8, u8, u8, u8); void Contest_PrintTextToBg0WindowStd(u8, const u8 *); +s16 sub_80DBD34(u8); +void DetermineFinalStandings(void); +bool8 sub_80DBF30(s32, s32, struct UnknownContestStruct6 *); EWRAM_DATA struct ContestPokemon gContestMons[4] = {0}; EWRAM_DATA s16 gContestMonConditions[4] = {0}; @@ -199,6 +203,7 @@ extern const struct WindowTemplate gUnknown_08587F44[]; extern const u8 *const gUnknown_08587D90[]; extern const u8 *const gUnknown_08587F08[]; extern const u8 *const gUnknown_08587F1C[]; +extern const u8 *const gUnknown_0827E8DA[]; extern const u8 gText_0827D55A[]; extern const u8 gText_0827E793[]; extern const u8 gText_0827E32E[]; @@ -855,7 +860,7 @@ void sub_80D8894(u8 taskId) { if (gIsLinkContest & 1) { - u16 var = sub_80DB8B8(gContestPlayerMonIndex); + u16 var = GetChosenMove(gContestPlayerMonIndex); u8 taskId2; gContestResources->field_4[gContestPlayerMonIndex].currMove = var; @@ -934,7 +939,7 @@ void sub_80D8A88(u8 taskId) for (i = 0; i + gNumLinkContestPlayers < 4; i++) { - gContestResources->field_4[gNumLinkContestPlayers + i].currMove = sub_80DB8B8(gNumLinkContestPlayers + i); + gContestResources->field_4[gNumLinkContestPlayers + i].currMove = GetChosenMove(gNumLinkContestPlayers + i); } } gTasks[taskId].data[0] = 0; @@ -2740,3 +2745,300 @@ bool8 sub_80DB798(u8 a) } return r9; } + +void sub_80DB884(void) +{ + s32 i; + + for (i = 0; i < 4; i++) + sub_80DB798(i); +} + +void sub_80DB89C(void) +{ + FillWindowPixelBuffer(4, 0); + CopyWindowToVram(4, 2); + Contest_SetBgCopyFlags(0); +} + +u16 GetChosenMove(u8 a) +{ + if (Contest_IsMonsTurnDisabled(a)) + return 0; + if (a == gContestPlayerMonIndex) + { + return gContestMons[a].moves[sContest.playerMoveChoice]; + } + else + { + u8 moveChoice; + + ContestAI_ResetAI(a); + moveChoice = ContestAI_GetActionToUse(); + return gContestMons[a].moves[moveChoice]; + } +} + +void sub_80DB918(void) +{ + s32 i; + + for (i = 0; i < 4; i++) + sContestantStatus[i].currMove = GetChosenMove(i); +} + +void sub_80DB944(void) +{ + s32 i; + s32 j; + s16 arr[4]; + + for (i = 0; i < 4; i++) + { + sContestantStatus[i].unk4 += sContestantStatus[i].appeal2; + arr[i] = sContestantStatus[i].unk4; + } + for (i = 0; i < 3; i++) + { + for (j = 3; j > i; j--) + { + if (arr[j - 1] < arr[j]) + { + u16 temp = arr[j]; + + arr[j] = arr[j - 1]; + arr[j - 1] = temp; + } + } + } + for (i = 0; i < 4; i++) + { + for (j = 0; j < 4; j++) + { + if (sContestantStatus[i].unk4 == arr[j]) + { + sContestantStatus[i].unkB_0 = j; + break; + } + } + } + sub_80DCE58(1); + sub_80DD590(); +} + +void sub_80DBA18(void) +{ + s32 i; + + for (i = 0; i < 4; i++) + { + u8 attentionLevel; + + if (sContestantStatus[i].currMove == MOVE_NONE) + attentionLevel = 5; + else if (sContestantStatus[i].appeal2 <= 0) + attentionLevel = 0; + else if (sContestantStatus[i].appeal2 < 30) + attentionLevel = 1; + else if (sContestantStatus[i].appeal2 < 60) + attentionLevel = 2; + else if (sContestantStatus[i].appeal2 < 80) + attentionLevel = 3; + else + attentionLevel = 4; + + sContestantStatus[i].attentionLevel = attentionLevel; + } +} + +bool8 sub_80DBA68(u8 a) +{ + if (sContestantStatus[a].numTurnsSkipped != 0 || sContestantStatus[a].noMoreTurns) + return FALSE; + else + return TRUE; +} + +void sub_80DBAA0(void) +{ + s32 i; + + for (i = 0; i < 4; i++) + { + sContestantStatus[i].appeal2 = 0; + sContestantStatus[i].appeal1 = 0; + sContestantStatus[i].jamSafetyCount = 0; + if (sContestantStatus[i].numTurnsSkipped > 0) + sContestantStatus[i].numTurnsSkipped--; + sContestantStatus[i].jam = 0; + sContestantStatus[i].resistant = 0; + sContestantStatus[i].jamReduction = 0; + sContestantStatus[i].immune = 0; + sContestantStatus[i].moreEasilyStartled = 0; + sContestantStatus[i].usedRepeatableMove = 0; + sContestantStatus[i].nervous = 0; + sContestantStatus[i].effectStringId = CONTEST_STRING_NONE; + sContestantStatus[i].effectStringId2 = CONTEST_STRING_NONE; + sContestantStatus[i].conditionMod = 0; + sContestantStatus[i].unk15_2 = sContestantStatus[i].disappointedRepeat; + sContestantStatus[i].disappointedRepeat = FALSE; + sContestantStatus[i].turnOrderModAction = 0; + sContestantStatus[i].appealTripleCondition = 0; + if (sContestantStatus[i].turnSkipped) + { + sContestantStatus[i].numTurnsSkipped = 1; + sContestantStatus[i].turnSkipped = 0; + } + if (sContestantStatus[i].exploded) + { + sContestantStatus[i].noMoreTurns = 1; + sContestantStatus[i].exploded = 0; + } + sContestantStatus[i].overrideCategoryExcitementMod = 0; + } + for (i = 0; i < 4; i++) + { + sContestantStatus[i].prevMove = sContestantStatus[i].currMove; + sContest.unk19220[sContest.turnNumber][i] = sContestantStatus[i].currMove; + sContest.unk19248[sContest.turnNumber][i] = Contest_GetMoveExcitement(sContestantStatus[i].currMove); + sContestantStatus[i].currMove = MOVE_NONE; + } + shared19328.excitementFrozen = 0; +} + +bool8 Contest_IsMonsTurnDisabled(u8 a) +{ + if (sContestantStatus[a].numTurnsSkipped != 0 || sContestantStatus[a].noMoreTurns) + return TRUE; + else + return FALSE; +} + +void sub_80DBCE0(u8 a) +{ + gUnknown_02039F18[a] = sub_80DBD34(a); + gUnknown_02039F08[a] = gContestMonConditions[a] + gUnknown_02039F18[a]; +} + +void sub_80DBD18(void) +{ + s32 i; + + for (i = 0; i < 4; i++) + sub_80DBCE0(i); + DetermineFinalStandings(); +} + +s16 sub_80DBD34(u8 a) +{ + return gUnknown_02039F10[a] * 2; +} + +void DetermineFinalStandings(void) +{ + u16 sp0[4] = {0}; + struct UnknownContestStruct6 sp8[4]; + s32 i; + s32 j; + + for (i = 0; i < 4; i++) + { + s32 r2; + + sp0[i] = Random(); + for (r2 = 0; r2 < i; r2++) + { + if (sp0[i] == sp0[r2]) + { + i--; + break; + } + } + } + + for (i = 0; i < 4; i++) + { + sp8[i].unk0 = gUnknown_02039F08[i]; + sp8[i].unk4 = gContestMonConditions[i]; + sp8[i].unk8 = sp0[i]; + sp8[i].unkC = i; + } + + for (i = 0; i < 3; i++) + { + for (j = 3; j > i; j--) + { + if (sub_80DBF30(j - 1, j, sp8)) + { + struct UnknownContestStruct6 temp; + + temp.unk0 = sp8[j - 1].unk0; + temp.unk4 = sp8[j - 1].unk4; + temp.unk8 = sp8[j - 1].unk8; + temp.unkC = sp8[j - 1].unkC; + + sp8[j - 1].unk0 = sp8[j].unk0; + sp8[j - 1].unk4 = sp8[j].unk4; + sp8[j - 1].unk8 = sp8[j].unk8; + sp8[j - 1].unkC = sp8[j].unkC; + + sp8[j].unk0 = temp.unk0; + sp8[j].unk4 = temp.unk4; + sp8[j].unk8 = temp.unk8; + sp8[j].unkC = temp.unkC; + } + } + } + + for (i = 0; i < 4; i++) + gContestFinalStandings[sp8[i].unkC] = i; +} + +void sub_80DBED4(void) +{ + if ((gIsLinkContest & 1)) + { + gSaveBlock2Ptr->contestLinkResults[gSpecialVar_ContestCategory][gContestFinalStandings[gContestPlayerMonIndex]] = + ((gSaveBlock2Ptr->contestLinkResults[gSpecialVar_ContestCategory][gContestFinalStandings[gContestPlayerMonIndex]] + 1) > 0x270F) ? 0x270F : + (gSaveBlock2Ptr->contestLinkResults[gSpecialVar_ContestCategory][gContestFinalStandings[gContestPlayerMonIndex]] + 1); + + } +} + +bool8 sub_80DBF30(s32 a, s32 b, struct UnknownContestStruct6 *c) +{ + bool8 retVal; + + if (c[a].unk0 < c[b].unk0) + retVal = TRUE; + else if (c[a].unk0 > c[b].unk0) + retVal = FALSE; + else if (c[a].unk4 < c[b].unk4) + retVal = TRUE; + else if (c[a].unk4 > c[b].unk4) + retVal = FALSE; + else if (c[a].unk8 < c[b].unk8) + retVal = TRUE; + else + retVal = FALSE; + return retVal; +} + +void sub_80DBF68(void) +{ + gBattle_BG0_Y = 0; + gBattle_BG2_Y = 0; + sub_80DB89C(); + Contest_StartTextPrinter((u8*) &gUnknown_0827E8DA, 0); +} + +void sub_80DBF90(void) +{ + u16 temp = BGCNT_WRAP; + s32 i; + for(i = 3; i >= 0; i--) + { + ContestBG_FillBoxWithIncrementingTile(0, temp, 0, 0x16, 0, 0, 0, 0); + } +} + From f966b6584924531bd4470b98c38ec52cd0004197 Mon Sep 17 00:00:00 2001 From: ultima-soul Date: Thu, 20 Dec 2018 11:39:00 -0800 Subject: [PATCH 2/8] Through sub_80DC028, sub_80DC0F4 non-matching. --- asm/contest.s | 372 ------------------------------------------------ src/contest.c | 383 +++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 376 insertions(+), 379 deletions(-) diff --git a/asm/contest.s b/asm/contest.s index 8a148e529a..ebded2d2fc 100644 --- a/asm/contest.s +++ b/asm/contest.s @@ -5,378 +5,6 @@ .text - thumb_func_start sub_80DBFC8 -sub_80DBFC8: @ 80DBFC8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =0x00005011 - cmp r0, 0 - beq _080DBFE2 - ldr r1, =0x00006011 - cmp r0, 0x1 - beq _080DBFE2 - ldr r1, =0x00008011 - cmp r0, 0x2 - bne _080DBFE2 - ldr r1, =0x00007011 -_080DBFE2: - adds r0, r1, 0x1 - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80DBFC8 - - thumb_func_start sub_80DBFFC -sub_80DBFFC: @ 80DBFFC - push {lr} - lsls r0, 16 - asrs r0, 16 - movs r1, 0xA - bl __divsi3 - lsls r0, 24 - lsrs r1, r0, 24 - asrs r2, r0, 24 - cmp r2, 0x10 - ble _080DC016 - movs r1, 0x10 - b _080DC020 -_080DC016: - movs r0, 0x10 - negs r0, r0 - cmp r2, r0 - bge _080DC020 - movs r1, 0xF0 -_080DC020: - lsls r0, r1, 24 - asrs r0, 24 - pop {r1} - bx r1 - thumb_func_end sub_80DBFFC - - thumb_func_start sub_80DC028 -sub_80DC028: @ 80DC028 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r5, r0, 0 - adds r6, r1, 0 - lsls r5, 16 - lsrs r5, 16 - lsls r6, 16 - lsrs r6, 16 - lsls r2, 24 - lsrs r2, 24 - mov r8, r2 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0x14] - lsls r1, r2, 2 - adds r1, r0 - ldrb r0, [r1, 0x2] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r1, 0x2] - ldr r0, =sub_80DC0F4 - movs r1, 0x14 - bl CreateTask - lsls r0, 24 - lsrs r7, r0, 24 - lsls r5, 16 - asrs r5, 16 - adds r0, r5, 0 - bl sub_80DBFFC - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r6, 16 - asrs r6, 16 - adds r5, r6 - lsls r5, 16 - asrs r5, 16 - adds r0, r5, 0 - bl sub_80DBFFC - lsls r4, 24 - asrs r4, 24 - subs r0, r4 - lsls r0, 24 - lsrs r5, r0, 24 - mov r0, r8 - bl sub_80DBFC8 - ldr r2, =gTasks - lsls r3, r7, 2 - adds r0, r3, r7 - lsls r0, 3 - adds r1, r0, r2 - adds r0, r4, 0 - cmp r4, 0 - bge _080DC0A0 - negs r0, r4 -_080DC0A0: - strh r0, [r1, 0x8] - lsls r0, r5, 24 - asrs r0, 24 - strh r0, [r1, 0xA] - cmp r4, 0 - bgt _080DC0B4 - cmp r4, 0 - bne _080DC0C8 - cmp r0, 0 - ble _080DC0C8 -_080DC0B4: - movs r0, 0x1 - strh r0, [r1, 0xC] - b _080DC0D6 - .pool -_080DC0C8: - ldr r2, =gTasks - lsls r3, r7, 2 - adds r0, r3, r7 - lsls r0, 3 - adds r0, r2 - ldr r1, =0x0000ffff - strh r1, [r0, 0xC] -_080DC0D6: - adds r0, r3, r7 - lsls r0, 3 - adds r0, r2 - mov r1, r8 - strh r1, [r0, 0xE] - adds r0, r7, 0 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80DC028 - - thumb_func_start sub_80DC0F4 -sub_80DC0F4: @ 80DC0F4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r4, r0, r1 - ldrb r0, [r4, 0xE] - mov r9, r0 - ldrh r3, [r4, 0x8] - ldrh r1, [r4, 0xA] - ldrh r0, [r4, 0x1C] - adds r0, 0x1 - strh r0, [r4, 0x1C] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xE - bgt _080DC126 - b _080DC2A8 -_080DC126: - movs r0, 0 - strh r0, [r4, 0x1C] - ldrh r2, [r4, 0xA] - movs r5, 0xA - ldrsh r0, [r4, r5] - cmp r0, 0 - bne _080DC15C - adds r0, r7, 0 - bl DestroyTask - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0x14] - mov r2, r9 - lsls r1, r2, 2 - adds r1, r0 - ldrb r2, [r1, 0x2] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x2] - b _080DC2A8 - .pool -_080DC15C: - cmp r3, 0 - bne _080DC1A4 - lsls r0, r1, 16 - mov r8, r0 - cmp r0, 0 - bge _080DC17A - mov r0, r9 - bl sub_80DBFC8 - adds r0, 0x2 - lsls r0, 16 - lsrs r6, r0, 16 - ldrh r0, [r4, 0xA] - adds r0, 0x1 - b _080DC188 -_080DC17A: - mov r0, r9 - bl sub_80DBFC8 - lsls r0, 16 - lsrs r6, r0, 16 - ldrh r0, [r4, 0xA] - subs r0, 0x1 -_080DC188: - strh r0, [r4, 0xA] - ldr r1, =gTasks - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x8] - adds r2, r1, 0x1 - strh r2, [r0, 0x8] - lsls r1, 24 - lsrs r5, r1, 24 - b _080DC210 - .pool -_080DC1A4: - movs r3, 0xC - ldrsh r0, [r4, r3] - cmp r0, 0 - bge _080DC1DE - lsls r0, r1, 16 - mov r8, r0 - cmp r0, 0 - bge _080DC1CC - ldrh r0, [r4, 0x8] - adds r1, r0, 0x1 - strh r1, [r4, 0x8] - lsls r0, 24 - lsrs r5, r0, 24 - adds r0, r2, 0x1 - strh r0, [r4, 0xA] - mov r0, r9 - bl sub_80DBFC8 - adds r0, 0x2 - b _080DC20C -_080DC1CC: - ldrh r0, [r4, 0x8] - subs r0, 0x1 - strh r0, [r4, 0x8] - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - subs r0, r2, 0x1 - strh r0, [r4, 0xA] - b _080DC210 -_080DC1DE: - lsls r0, r1, 16 - mov r8, r0 - cmp r0, 0 - bge _080DC1F8 - ldrh r0, [r4, 0x8] - subs r0, 0x1 - strh r0, [r4, 0x8] - lsls r0, 24 - lsrs r5, r0, 24 - movs r6, 0 - adds r0, r2, 0x1 - strh r0, [r4, 0xA] - b _080DC210 -_080DC1F8: - ldrh r0, [r4, 0x8] - adds r1, r0, 0x1 - strh r1, [r4, 0x8] - lsls r0, 24 - lsrs r5, r0, 24 - subs r0, r2, 0x1 - strh r0, [r4, 0xA] - mov r0, r9 - bl sub_80DBFC8 -_080DC20C: - lsls r0, 16 - lsrs r6, r0, 16 -_080DC210: - str r5, [sp, 0xC] - movs r0, 0 - mov r10, r0 - cmp r5, 0x7 - bls _080DC226 - movs r2, 0x1 - mov r10, r2 - adds r0, r5, 0 - subs r0, 0x8 - lsls r0, 24 - lsrs r5, r0, 24 -_080DC226: - adds r2, r5, 0 - adds r2, 0x16 - lsls r2, 24 - lsrs r2, 24 - ldr r0, =gUnknown_02039F26 - add r0, r9 - ldrb r0, [r0] - lsls r3, r0, 2 - adds r3, r0 - adds r3, 0x2 - add r3, r10 - lsls r3, 24 - lsrs r3, 24 - movs r0, 0x1 - str r0, [sp] - str r0, [sp, 0x4] - movs r0, 0x11 - str r0, [sp, 0x8] - movs r0, 0 - adds r1, r6, 0 - bl ContestBG_FillBoxWithTile - mov r3, r8 - cmp r3, 0 - ble _080DC284 - movs r0, 0x60 - bl PlaySE - ldr r4, =gMPlayInfo_SE1 - adds r0, r4, 0 - bl m4aMPlayImmInit - ldr r1, =0x0000ffff - ldr r0, [sp, 0xC] - lsls r2, r0, 24 - asrs r2, 16 - adds r0, r4, 0 - bl m4aMPlayPitchControl - b _080DC28A - .pool -_080DC284: - movs r0, 0x16 - bl PlaySE -_080DC28A: - mov r2, r10 - cmp r2, 0 - bne _080DC2A8 - cmp r5, 0 - bne _080DC2A8 - cmp r6, 0 - bne _080DC2A8 - ldr r0, =gTasks - lsls r1, r7, 2 - adds r1, r7 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0xC] - negs r0, r0 - strh r0, [r1, 0xC] -_080DC2A8: - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DC0F4 - thumb_func_start sub_80DC2BC sub_80DC2BC: @ 80DC2BC push {r4,r5,lr} diff --git a/src/contest.c b/src/contest.c index da4fdb3e03..4fb5f76c57 100644 --- a/src/contest.c +++ b/src/contest.c @@ -153,7 +153,7 @@ void sub_80DE12C(void); void sub_80DD45C(u8, u8); void sub_80DD720(u8); void sub_80DE008(bool8); -void sub_80DC028(s16, s16, u8); +u8 sub_80DC028(s16, s16, u8); bool8 sub_80DB5B8(u8, u8); bool8 sub_80DB798(u8); void sub_80DB884(void); @@ -173,6 +173,7 @@ void Contest_PrintTextToBg0WindowStd(u8, const u8 *); s16 sub_80DBD34(u8); void DetermineFinalStandings(void); bool8 sub_80DBF30(s32, s32, struct UnknownContestStruct6 *); +void sub_80DC0F4(u8); EWRAM_DATA struct ContestPokemon gContestMons[4] = {0}; EWRAM_DATA s16 gContestMonConditions[4] = {0}; @@ -3034,11 +3035,379 @@ void sub_80DBF68(void) void sub_80DBF90(void) { - u16 temp = BGCNT_WRAP; - s32 i; - for(i = 3; i >= 0; i--) - { - ContestBG_FillBoxWithIncrementingTile(0, temp, 0, 0x16, 0, 0, 0, 0); - } + int i; + + for(i = 0; i < 4; i++) + { + ContestBG_FillBoxWithTile(0, 0, 0x16, 2 + i * 5, 8, 2, 0x11); + } } +u16 sub_80DBFC8(u8 a) +{ + u16 var; + + if (a == 0) + var = 0x5011; + else if (a == 1) + var = 0x6011; + else if (a == 2) + var = 0x7011; + else + var = 0x8011; + return var + 1; +} + +s8 sub_80DBFFC(s16 a) +{ + s8 retVal = a / 10; + + if (retVal > 16) + retVal = 16; + else if (retVal < -16) + retVal = -16; + return retVal; +} + +u8 sub_80DC028(s16 a, s16 b, u8 c) +{ + u8 taskId; + s8 r4; + s8 r5; + + gContestResources->field_14[c].unk2_2 = 1; + taskId = CreateTask(sub_80DC0F4, 20); + r4 = sub_80DBFFC(a); + r5 = sub_80DBFFC(a + b) - r4; + sub_80DBFC8(c); // unused return value + gTasks[taskId].data[0] = abs(r4); + gTasks[taskId].data[1] = r5; + if (r4 > 0 || (r4 == 0 && r5 > 0)) + gTasks[taskId].data[2] = 1; + else + gTasks[taskId].data[2] = -1; + gTasks[taskId].data[3] = c; + return taskId; +} + +#ifdef NONMATCHING + +void sub_80DC0F4(u8 taskId) +{ + u8 r7 = gTasks[taskId].data[3]; + s16 r3 = gTasks[taskId].data[0]; + s16 r1 = gTasks[taskId].data[1]; + + if (++gTasks[taskId].data[10] > 14) + { + u16 r6; + u8 r5; + u8 r10; + + gTasks[taskId].data[10] = 0; + if (gTasks[taskId].data[1] == 0) + { + DestroyTask(taskId); + gContestResources->field_14[r7].unk2_2 = 0; + return; + } + else if (r3 == 0) + { + if (r1 < 0) + { + r6 = sub_80DBFC8(r7) + 2; + gTasks[taskId].data[1]++; + } + else + { + r6 = sub_80DBFC8(r7); + gTasks[taskId].data[1]--; + } + r5 = gTasks[taskId].data[0]++; + } + else + { + if (gTasks[taskId].data[2] < 0) + { + if (r1 < 0) + { + r5 = gTasks[taskId].data[0]++; + gTasks[taskId].data[1]++; + r6 = sub_80DBFC8(r7) + 2; + } + else + { + r5 = --gTasks[taskId].data[0]; + r6 = 0; + gTasks[taskId].data[1]--; + } + } + else + { + if (r1 < 0) + { + r5 = --gTasks[taskId].data[0]; + r6 = 0; + gTasks[taskId].data[1]++; + } + else + { + r5 = gTasks[taskId].data[0]++; + gTasks[taskId].data[1]--; + r6 = sub_80DBFC8(r7); + } + } + } + + r10 = r5; + r1 = 0; + if (r5 > 7) + { + r1 = 1; + r5 -= 8; + } + + ContestBG_FillBoxWithTile(0, r6, r5 + 0x16, (gUnknown_02039F26[r7] * 5) + 2 + r3, 1, 1, 0x11); + if (r1 > 0) + { + PlaySE(SE_C_GAJI); + m4aMPlayImmInit(&gMPlayInfo_SE1); + m4aMPlayPitchControl(&gMPlayInfo_SE1, 0xFFFF, r10 * 256); + } + else + { + PlaySE(SE_BOO); + } + + if (r10 == 0 && r5 == 0 && r6 == 0) + gTasks[taskId].data[2] = -gTasks[taskId].data[2]; + } +} +#else +NAKED +void sub_80DC0F4(u8 taskId) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0x10\n\ + lsls r0, 24\n\ + lsrs r7, r0, 24\n\ + ldr r1, =gTasks\n\ + lsls r0, r7, 2\n\ + adds r0, r7\n\ + lsls r0, 3\n\ + adds r4, r0, r1\n\ + ldrb r0, [r4, 0xE]\n\ + mov r9, r0\n\ + ldrh r3, [r4, 0x8]\n\ + ldrh r1, [r4, 0xA]\n\ + ldrh r0, [r4, 0x1C]\n\ + adds r0, 0x1\n\ + strh r0, [r4, 0x1C]\n\ + lsls r0, 16\n\ + asrs r0, 16\n\ + cmp r0, 0xE\n\ + bgt _080DC126\n\ + b _080DC2A8\n\ +_080DC126:\n\ + movs r0, 0\n\ + strh r0, [r4, 0x1C]\n\ + ldrh r2, [r4, 0xA]\n\ + movs r5, 0xA\n\ + ldrsh r0, [r4, r5]\n\ + cmp r0, 0\n\ + bne _080DC15C\n\ + adds r0, r7, 0\n\ + bl DestroyTask\n\ + ldr r0, =gContestResources\n\ + ldr r0, [r0]\n\ + ldr r0, [r0, 0x14]\n\ + mov r2, r9\n\ + lsls r1, r2, 2\n\ + adds r1, r0\n\ + ldrb r2, [r1, 0x2]\n\ + movs r0, 0x5\n\ + negs r0, r0\n\ + ands r0, r2\n\ + strb r0, [r1, 0x2]\n\ + b _080DC2A8\n\ + .pool\n\ +_080DC15C:\n\ + cmp r3, 0\n\ + bne _080DC1A4\n\ + lsls r0, r1, 16\n\ + mov r8, r0\n\ + cmp r0, 0\n\ + bge _080DC17A\n\ + mov r0, r9\n\ + bl sub_80DBFC8\n\ + adds r0, 0x2\n\ + lsls r0, 16\n\ + lsrs r6, r0, 16\n\ + ldrh r0, [r4, 0xA]\n\ + adds r0, 0x1\n\ + b _080DC188\n\ +_080DC17A:\n\ + mov r0, r9\n\ + bl sub_80DBFC8\n\ + lsls r0, 16\n\ + lsrs r6, r0, 16\n\ + ldrh r0, [r4, 0xA]\n\ + subs r0, 0x1\n\ +_080DC188:\n\ + strh r0, [r4, 0xA]\n\ + ldr r1, =gTasks\n\ + lsls r0, r7, 2\n\ + adds r0, r7\n\ + lsls r0, 3\n\ + adds r0, r1\n\ + ldrh r1, [r0, 0x8]\n\ + adds r2, r1, 0x1\n\ + strh r2, [r0, 0x8]\n\ + lsls r1, 24\n\ + lsrs r5, r1, 24\n\ + b _080DC210\n\ + .pool\n\ +_080DC1A4:\n\ + movs r3, 0xC\n\ + ldrsh r0, [r4, r3]\n\ + cmp r0, 0\n\ + bge _080DC1DE\n\ + lsls r0, r1, 16\n\ + mov r8, r0\n\ + cmp r0, 0\n\ + bge _080DC1CC\n\ + ldrh r0, [r4, 0x8]\n\ + adds r1, r0, 0x1\n\ + strh r1, [r4, 0x8]\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + adds r0, r2, 0x1\n\ + strh r0, [r4, 0xA]\n\ + mov r0, r9\n\ + bl sub_80DBFC8\n\ + adds r0, 0x2\n\ + b _080DC20C\n\ +_080DC1CC:\n\ + ldrh r0, [r4, 0x8]\n\ + subs r0, 0x1\n\ + strh r0, [r4, 0x8]\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + movs r6, 0\n\ + subs r0, r2, 0x1\n\ + strh r0, [r4, 0xA]\n\ + b _080DC210\n\ +_080DC1DE:\n\ + lsls r0, r1, 16\n\ + mov r8, r0\n\ + cmp r0, 0\n\ + bge _080DC1F8\n\ + ldrh r0, [r4, 0x8]\n\ + subs r0, 0x1\n\ + strh r0, [r4, 0x8]\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + movs r6, 0\n\ + adds r0, r2, 0x1\n\ + strh r0, [r4, 0xA]\n\ + b _080DC210\n\ +_080DC1F8:\n\ + ldrh r0, [r4, 0x8]\n\ + adds r1, r0, 0x1\n\ + strh r1, [r4, 0x8]\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + subs r0, r2, 0x1\n\ + strh r0, [r4, 0xA]\n\ + mov r0, r9\n\ + bl sub_80DBFC8\n\ +_080DC20C:\n\ + lsls r0, 16\n\ + lsrs r6, r0, 16\n\ +_080DC210:\n\ + str r5, [sp, 0xC]\n\ + movs r0, 0\n\ + mov r10, r0\n\ + cmp r5, 0x7\n\ + bls _080DC226\n\ + movs r2, 0x1\n\ + mov r10, r2\n\ + adds r0, r5, 0\n\ + subs r0, 0x8\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ +_080DC226:\n\ + adds r2, r5, 0\n\ + adds r2, 0x16\n\ + lsls r2, 24\n\ + lsrs r2, 24\n\ + ldr r0, =gUnknown_02039F26\n\ + add r0, r9\n\ + ldrb r0, [r0]\n\ + lsls r3, r0, 2\n\ + adds r3, r0\n\ + adds r3, 0x2\n\ + add r3, r10\n\ + lsls r3, 24\n\ + lsrs r3, 24\n\ + movs r0, 0x1\n\ + str r0, [sp]\n\ + str r0, [sp, 0x4]\n\ + movs r0, 0x11\n\ + str r0, [sp, 0x8]\n\ + movs r0, 0\n\ + adds r1, r6, 0\n\ + bl ContestBG_FillBoxWithTile\n\ + mov r3, r8\n\ + cmp r3, 0\n\ + ble _080DC284\n\ + movs r0, 0x60\n\ + bl PlaySE\n\ + ldr r4, =gMPlayInfo_SE1\n\ + adds r0, r4, 0\n\ + bl m4aMPlayImmInit\n\ + ldr r1, =0x0000ffff\n\ + ldr r0, [sp, 0xC]\n\ + lsls r2, r0, 24\n\ + asrs r2, 16\n\ + adds r0, r4, 0\n\ + bl m4aMPlayPitchControl\n\ + b _080DC28A\n\ + .pool\n\ +_080DC284:\n\ + movs r0, 0x16\n\ + bl PlaySE\n\ +_080DC28A:\n\ + mov r2, r10\n\ + cmp r2, 0\n\ + bne _080DC2A8\n\ + cmp r5, 0\n\ + bne _080DC2A8\n\ + cmp r6, 0\n\ + bne _080DC2A8\n\ + ldr r0, =gTasks\n\ + lsls r1, r7, 2\n\ + adds r1, r7\n\ + lsls r1, 3\n\ + adds r1, r0\n\ + ldrh r0, [r1, 0xC]\n\ + negs r0, r0\n\ + strh r0, [r1, 0xC]\n\ +_080DC2A8:\n\ + add sp, 0x10\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided\n"); +} +#endif \ No newline at end of file From 2ca482dc24accca6bbb808f2c4b847e1d2c2dfac Mon Sep 17 00:00:00 2001 From: ultima-soul Date: Mon, 24 Dec 2018 15:10:36 -0800 Subject: [PATCH 3/8] Committing progress so far. --- asm/contest.s | 1078 ------------------------------------------------ include/util.h | 2 + src/contest.c | 582 +++++++++++++++----------- 3 files changed, 341 insertions(+), 1321 deletions(-) diff --git a/asm/contest.s b/asm/contest.s index ebded2d2fc..f5ca016df1 100644 --- a/asm/contest.s +++ b/asm/contest.s @@ -5,1084 +5,6 @@ .text - thumb_func_start sub_80DC2BC -sub_80DC2BC: @ 80DC2BC - push {r4,r5,lr} - ldr r0, =gUnknown_08587A74 - bl LoadSpriteSheet - movs r4, 0 - ldr r5, =gUnknown_08587A6C -_080DC2C8: - ldr r0, =gUnknown_02039F26 - adds r0, r4, r0 - ldrb r0, [r0] - adds r0, r5 - ldrb r2, [r0] - ldr r0, =gSpriteTemplate_8587AD0 - movs r1, 0xB4 - movs r3, 0x1 - bl CreateSprite - ldr r1, =gContestResources - ldr r1, [r1] - ldr r2, [r1, 0x14] - lsls r1, r4, 2 - adds r1, r2 - strb r0, [r1] - adds r4, 0x1 - cmp r4, 0x3 - ble _080DC2C8 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DC2BC - - thumb_func_start sub_80DC308 -sub_80DC308: @ 80DC308 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r4, =gContestResources - ldr r0, [r4] - ldr r2, [r0, 0x14] - lsls r3, r6, 2 - adds r2, r3, r2 - ldrb r0, [r2, 0x2] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x2] - ldr r1, [r4] - ldr r0, [r1, 0x14] - adds r3, r0 - ldrb r7, [r3] - ldr r1, [r1, 0x4] - lsls r0, r6, 3 - subs r0, r6 - lsls r0, 2 - adds r0, r1 - movs r1, 0x4 - ldrsh r0, [r0, r1] - movs r1, 0xA - bl __divsi3 - lsls r0, 17 - lsrs r5, r0, 16 - asrs r0, 16 - cmp r0, 0x38 - ble _080DC350 - movs r5, 0x38 - b _080DC356 - .pool -_080DC350: - cmp r0, 0 - bge _080DC356 - movs r5, 0 -_080DC356: - ldr r2, =gSprites - lsls r3, r7, 4 - adds r0, r3, r7 - lsls r0, 2 - adds r4, r0, r2 - movs r0, 0x3E - adds r0, r4 - mov r12, r0 - ldrb r1, [r0] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - mov r1, r12 - strb r0, [r1] - strh r6, [r4, 0x2E] - strh r5, [r4, 0x30] - lsls r0, r5, 16 - asrs r0, 16 - movs r5, 0x24 - ldrsh r1, [r4, r5] - cmp r0, r1 - ble _080DC38C - movs r0, 0x1 - b _080DC38E - .pool -_080DC38C: - ldr r0, =0x0000ffff -_080DC38E: - strh r0, [r4, 0x32] - adds r0, r3, r7 - lsls r0, 2 - adds r1, r2, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_80DC408 - str r1, [r0] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DC308 - - thumb_func_start sub_80DC3AC -sub_80DC3AC: @ 80DC3AC - push {r4,lr} - movs r4, 0 -_080DC3B0: - lsls r0, r4, 24 - lsrs r0, 24 - bl sub_80DC308 - adds r4, 0x1 - cmp r4, 0x3 - ble _080DC3B0 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80DC3AC - - thumb_func_start sub_80DC3C4 -sub_80DC3C4: @ 80DC3C4 - push {r4,lr} - movs r2, 0 - ldr r3, =gContestResources - ldr r0, [r3] - ldr r0, [r0, 0x14] - ldrb r1, [r0, 0x2] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - bne _080DC3F2 - movs r4, 0x1 -_080DC3DA: - adds r2, 0x1 - cmp r2, 0x3 - bgt _080DC3F2 - ldr r0, [r3] - ldr r1, [r0, 0x14] - lsls r0, r2, 2 - adds r0, r1 - ldrb r1, [r0, 0x2] - adds r0, r4, 0 - ands r0, r1 - cmp r0, 0 - beq _080DC3DA -_080DC3F2: - cmp r2, 0x4 - beq _080DC400 - movs r0, 0 - b _080DC402 - .pool -_080DC400: - movs r0, 0x1 -_080DC402: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_80DC3C4 - - thumb_func_start sub_80DC408 -sub_80DC408: @ 80DC408 - push {r4,lr} - adds r3, r0, 0 - ldrh r2, [r3, 0x24] - movs r0, 0x24 - ldrsh r1, [r3, r0] - movs r4, 0x30 - ldrsh r0, [r3, r4] - cmp r1, r0 - bne _080DC440 - ldr r0, =gContestResources - ldr r0, [r0] - movs r2, 0x2E - ldrsh r1, [r3, r2] - ldr r0, [r0, 0x14] - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0x2] - movs r0, 0x2 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x2] - ldr r0, =SpriteCallbackDummy - str r0, [r3, 0x1C] - b _080DC446 - .pool -_080DC440: - ldrh r0, [r3, 0x32] - adds r0, r2, r0 - strh r0, [r3, 0x24] -_080DC446: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80DC408 - - thumb_func_start sub_80DC44C -sub_80DC44C: @ 80DC44C - push {r4-r6,lr} - movs r2, 0 - ldr r6, =gSprites - ldr r5, =gContestResources - ldr r4, =gUnknown_08587A6C - ldr r3, =gUnknown_02039F26 -_080DC458: - ldr r0, [r5] - ldr r1, [r0, 0x14] - lsls r0, r2, 2 - adds r0, r1 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - adds r0, r2, r3 - ldrb r0, [r0] - adds r0, r4 - ldrb r0, [r0] - strh r0, [r1, 0x22] - adds r2, 0x1 - cmp r2, 0x3 - ble _080DC458 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DC44C - - thumb_func_start sub_80DC490 -sub_80DC490: @ 80DC490 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - movs r3, 0 - ldr r7, =gUnknown_02039F26 - ldr r5, =gSprites - ldr r4, =gContestResources - movs r2, 0 -_080DC4A0: - adds r0, r3, r7 - ldrb r0, [r0] - cmp r0, 0x1 - bls _080DC4E2 - cmp r6, 0 - bne _080DC4CC - ldr r0, [r4] - ldr r0, [r0, 0x14] - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0xB4 - b _080DC4E0 - .pool -_080DC4CC: - ldr r0, [r4] - ldr r0, [r0, 0x14] - adds r0, r2, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0x80 - lsls r1, 1 -_080DC4E0: - strh r1, [r0, 0x20] -_080DC4E2: - adds r2, 0x4 - adds r3, 0x1 - cmp r3, 0x3 - ble _080DC4A0 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80DC490 - - thumb_func_start sub_80DC4F0 -sub_80DC4F0: @ 80DC4F0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - ldr r0, =gUnknown_08587B08 - bl LoadSpritePalette - movs r5, 0 - ldr r7, =gContestResources - ldr r0, =gSprites - mov r8, r0 - movs r6, 0 -_080DC506: - lsls r0, r5, 3 - ldr r1, =gUnknown_08587AE8 - adds r0, r1 - bl LoadCompressedSpriteSheet - ldr r0, =gSpriteTemplate_8587B18 - adds r0, r6, r0 - ldr r2, =gUnknown_08587A70 - ldr r1, =gUnknown_02039F26 - adds r1, r5, r1 - ldrb r1, [r1] - adds r1, r2 - ldrb r2, [r1] - movs r1, 0xCC - movs r3, 0 - bl CreateSprite - ldr r1, [r7] - ldr r1, [r1, 0x14] - lsls r4, r5, 2 - adds r1, r4, r1 - strb r0, [r1, 0x1] - ldr r0, [r7] - ldr r0, [r0, 0x14] - adds r0, r4, r0 - ldrb r1, [r0, 0x1] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r8 - ldr r1, =gSubspriteTables_8587B80 - bl SetSubspriteTables - ldr r0, [r7] - ldr r0, [r0, 0x14] - adds r4, r0 - ldrb r1, [r4, 0x1] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r8 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - adds r6, 0x18 - adds r5, 0x1 - cmp r5, 0x3 - ble _080DC506 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DC4F0 - - thumb_func_start sub_80DC594 -sub_80DC594: @ 80DC594 - push {lr} - ldr r0, =gUnknown_08587BB0 - bl LoadCompressedSpriteSheet - ldr r0, =gUnknown_08587BB8 - bl LoadSpritePalette - ldr r0, =gSpriteTemplate_8587BC8 - movs r1, 0x1E - movs r2, 0x2C - movs r3, 0x1 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gSprites - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - adds r1, 0x3E - ldrb r2, [r1] - movs r3, 0x4 - orrs r2, r3 - strb r2, [r1] - ldr r1, =gContestResources - ldr r1, [r1] - ldr r1, [r1] - adds r1, 0x58 - strb r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DC594 - - thumb_func_start sub_80DC5E8 -sub_80DC5E8: @ 80DC5E8 - push {r4,lr} - ldr r0, =sub_80DC728 - movs r1, 0x1E - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gContestResources - ldr r1, [r1] - ldr r1, [r1] - strb r0, [r1, 0xD] - movs r2, 0 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - ldr r4, =gTasks + 0x8 - movs r3, 0xFF -_080DC60A: - lsls r0, r2, 3 - adds r0, r1 - adds r0, r4 - strh r3, [r0] - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0x3 - bls _080DC60A - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DC5E8 - - thumb_func_start sub_80DC630 -sub_80DC630: @ 80DC630 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r3, =gTasks - ldr r1, =gContestResources - ldr r5, [r1] - ldr r1, [r5] - ldrb r2, [r1, 0xD] - lsls r1, r2, 2 - adds r1, r2 - adds r1, r0 - lsls r1, 3 - adds r3, 0x8 - adds r1, r3 - movs r4, 0 - strh r4, [r1] - lsls r0, 2 - adds r0, 0x1 - lsls r0, 1 - ldr r1, [r5] - ldrb r2, [r1, 0xD] - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 3 - adds r0, r1 - adds r0, r3 - strh r4, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DC630 - - thumb_func_start sub_80DC674 -sub_80DC674: @ 80DC674 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =sub_80DC6A4 - movs r1, 0x1F - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - strh r4, [r1, 0x8] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DC674 - - thumb_func_start sub_80DC6A4 -sub_80DC6A4: @ 80DC6A4 - push {r4-r7,lr} - lsls r0, 24 - lsrs r0, 24 - adds r6, r0, 0 - ldr r2, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r2 - ldrb r0, [r0, 0x8] - adds r5, r0, 0 - ldr r0, =gContestResources - ldr r4, [r0] - ldr r0, [r4] - ldrb r1, [r0, 0xD] - lsls r0, r1, 2 - adds r0, r1 - adds r0, r5 - lsls r0, 3 - adds r7, r2, 0 - adds r7, 0x8 - adds r1, r0, r7 - movs r2, 0 - ldrsh r0, [r1, r2] - cmp r0, 0 - beq _080DC6DC - cmp r0, 0xFF - bne _080DC716 -_080DC6DC: - movs r3, 0 - movs r0, 0xFF - strh r0, [r1] - lsls r1, r5, 2 - adds r1, 0x1 - lsls r1, 1 - ldr r0, [r4] - ldrb r2, [r0, 0xD] - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r1, r0 - adds r1, r7 - strh r3, [r1] - ldr r0, [r4] - adds r0, 0x14 - adds r0, r5 - ldrb r0, [r0] - adds r0, 0x5 - lsls r0, 4 - adds r0, 0x6 - ldr r3, =0x00004bff - movs r1, 0x2 - movs r2, 0 - bl BlendPalette - adds r0, r6, 0 - bl DestroyTask -_080DC716: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DC6A4 - - thumb_func_start sub_80DC728 -sub_80DC728: @ 80DC728 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsrs r0, 24 - movs r6, 0 - lsls r1, r0, 2 - adds r1, r0 - mov r9, r1 - lsls r7, r1, 3 - ldr r0, =gTasks + 0x8 - mov r8, r0 - movs r1, 0x8 - negs r1, r1 - add r1, r8 - mov r10, r1 -_080DC74C: - lsls r0, r6, 26 - lsrs r3, r0, 24 - lsls r0, r3, 1 - adds r0, r7 - mov r4, r8 - adds r2, r0, r4 - ldrh r4, [r2] - movs r5, 0 - ldrsh r0, [r2, r5] - cmp r0, 0xFF - beq _080DC7CA - adds r0, r3, 0x1 - lsls r1, r0, 1 - adds r1, r7 - add r1, r8 - movs r5, 0 - ldrsh r1, [r1, r5] - adds r5, r0, 0 - cmp r1, 0 - bne _080DC77C - adds r0, r4, 0x1 - b _080DC77E - .pool -_080DC77C: - subs r0, r4, 0x1 -_080DC77E: - strh r0, [r2] - lsls r1, r3, 1 - mov r0, r9 - lsls r2, r0, 3 - adds r0, r1, r2 - mov r3, r10 - adds r3, 0x8 - adds r0, r3 - movs r4, 0 - ldrsh r0, [r0, r4] - adds r4, r1, 0 - cmp r0, 0x10 - beq _080DC79C - cmp r0, 0 - bne _080DC7AA -_080DC79C: - lsls r0, r5, 1 - adds r0, r2 - adds r0, r3 - ldrh r1, [r0] - movs r2, 0x1 - eors r1, r2 - strh r1, [r0] -_080DC7AA: - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0] - adds r0, 0x14 - adds r0, r6 - ldrb r0, [r0] - adds r0, 0x5 - lsls r0, 4 - adds r0, 0x6 - adds r1, r4, r7 - add r1, r8 - ldrb r2, [r1] - movs r1, 0x2 - ldr r3, =0x00004bff - bl BlendPalette -_080DC7CA: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x3 - bls _080DC74C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DC728 - - thumb_func_start sub_80DC7EC -sub_80DC7EC: @ 80DC7EC - push {r4,lr} - ldr r0, =sub_80DC8D0 - movs r1, 0x1E - bl CreateTask - ldr r1, =gContestResources - ldr r1, [r1] - ldr r1, [r1] - strb r0, [r1, 0xE] - movs r4, 0 -_080DC800: - lsls r0, r4, 24 - lsrs r0, 24 - bl sub_80DC81C - adds r4, 0x1 - cmp r4, 0x3 - ble _080DC800 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DC7EC - - thumb_func_start sub_80DC81C -sub_80DC81C: @ 80DC81C - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r3, =gTasks - ldr r1, =gContestResources - ldr r4, [r1] - ldr r1, [r4] - ldrb r2, [r1, 0xE] - lsls r1, r2, 2 - adds r1, r2 - adds r1, r0 - lsls r1, 3 - adds r3, 0x8 - adds r1, r3 - movs r5, 0 - movs r2, 0xFF - strh r2, [r1] - lsls r0, 2 - adds r0, 0x1 - lsls r0, 1 - ldr r1, [r4] - ldrb r2, [r1, 0xE] - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 3 - adds r0, r1 - adds r0, r3 - strh r5, [r0] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DC81C - - thumb_func_start sub_80DC864 -sub_80DC864: @ 80DC864 - push {r4,lr} - movs r4, 0 -_080DC868: - lsls r0, r4, 24 - lsrs r0, 24 - bl sub_80DC87C - adds r4, 0x1 - cmp r4, 0x3 - ble _080DC868 - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80DC864 - - thumb_func_start sub_80DC87C -sub_80DC87C: @ 80DC87C - push {r4-r6,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl sub_80DC81C - adds r0, r4, 0x5 - lsls r2, r0, 5 - ldr r3, =gPlttBufferUnfaded + 0x14 - adds r6, r2, r3 - ldr r5, =gPlttBufferFaded + 0x14 - adds r2, r5 - ldr r1, =0x040000d4 - str r6, [r1] - str r2, [r1, 0x4] - ldr r2, =0x80000001 - str r2, [r1, 0x8] - ldr r6, [r1, 0x8] - lsls r0, 4 - adds r4, 0xC - adds r0, r4 - lsls r0, 1 - subs r3, 0x14 - adds r3, r0, r3 - subs r5, 0x14 - adds r0, r5 - str r3, [r1] - str r0, [r1, 0x4] - str r2, [r1, 0x8] - ldr r0, [r1, 0x8] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DC87C - - thumb_func_start sub_80DC8D0 -sub_80DC8D0: @ 80DC8D0 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsrs r0, 24 - movs r7, 0 - lsls r1, r0, 2 - adds r1, r0 - mov r9, r1 - lsls r6, r1, 3 - ldr r0, =gTasks + 0x8 - mov r8, r0 - ldr r1, =0x00004bff - mov r10, r1 -_080DC8F0: - lsls r0, r7, 26 - lsrs r3, r0, 24 - lsls r0, r3, 1 - adds r0, r6 - mov r4, r8 - adds r2, r0, r4 - movs r5, 0 - ldrsh r0, [r2, r5] - cmp r0, 0xFF - beq _080DC996 - adds r0, r3, 0x2 - lsls r0, 1 - adds r0, r6 - adds r1, r0, r4 - ldrh r0, [r1] - adds r0, 0x1 - movs r4, 0 - strh r0, [r1] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x2 - ble _080DC996 - strh r4, [r1] - adds r0, r3, 0x1 - lsls r1, r0, 1 - adds r1, r6 - add r1, r8 - movs r4, 0 - ldrsh r1, [r1, r4] - adds r4, r0, 0 - cmp r1, 0 - bne _080DC940 - ldrh r0, [r2] - adds r0, 0x1 - b _080DC944 - .pool -_080DC940: - ldrh r0, [r2] - subs r0, 0x1 -_080DC944: - strh r0, [r2] - lsls r1, r3, 1 - mov r5, r9 - lsls r2, r5, 3 - adds r0, r1, r2 - ldr r3, =gTasks - adds r3, 0x8 - adds r0, r3 - movs r5, 0 - ldrsh r0, [r0, r5] - adds r5, r1, 0 - cmp r0, 0x10 - beq _080DC962 - cmp r0, 0 - bne _080DC970 -_080DC962: - lsls r0, r4, 1 - adds r0, r2 - adds r0, r3 - ldrh r1, [r0] - movs r2, 0x1 - eors r1, r2 - strh r1, [r0] -_080DC970: - adds r4, r7, 0x5 - lsls r4, 4 - adds r0, r4, 0 - adds r0, 0xA - adds r5, r6 - add r5, r8 - ldrb r2, [r5] - movs r1, 0x1 - mov r3, r10 - bl BlendPalette - adds r4, 0xC - adds r4, r7 - ldrb r2, [r5] - adds r0, r4, 0 - movs r1, 0x1 - mov r3, r10 - bl BlendPalette -_080DC996: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0x3 - bls _080DC8F0 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DC8D0 - - thumb_func_start sub_80DC9B4 -sub_80DC9B4: @ 80DC9B4 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r2, 3 - subs r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r1, [r0, 0x15] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080DC9E0 - adds r0, r2, 0 - bl sub_80DC630 - b _080DC9E6 - .pool -_080DC9E0: - adds r0, r2, 0 - bl sub_80DC674 -_080DC9E6: - pop {r0} - bx r0 - thumb_func_end sub_80DC9B4 - - thumb_func_start sub_80DC9EC -sub_80DC9EC: @ 80DC9EC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0xC] - ldr r6, =gUnknown_02039F26 - adds r6, r0, r6 - ldrb r0, [r6] - lsls r5, r0, 2 - adds r5, r0 - lsls r5, 27 - movs r0, 0x80 - lsls r0, 22 - adds r5, r0 - lsrs r5, 24 - ldr r1, [sp, 0xC] - lsls r4, r1, 3 - ldr r0, =gUnknown_08589904 - adds r0, r4, r0 - bl LoadCompressedSpriteSheet - ldr r0, =gUnknown_08589924 - adds r4, r0 - adds r0, r4, 0 - bl LoadSpritePalette - ldr r2, [sp, 0xC] - lsls r4, r2, 1 - adds r4, r2 - lsls r4, 3 - ldr r0, =gSpriteTemplate_858998C - adds r4, r0 - adds r0, r4, 0 - movs r1, 0xB8 - adds r2, r5, 0 - movs r3, 0x1D - bl CreateSprite - mov r9, r0 - mov r3, r9 - lsls r3, 24 - lsrs r3, 24 - mov r9, r3 - adds r0, r4, 0 - movs r1, 0xF8 - adds r2, r5, 0 - movs r3, 0x1D - bl CreateSprite - mov r8, r0 - mov r0, r8 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - lsls r5, r0, 4 - add r5, r8 - lsls r5, 2 - ldr r1, =gSprites - adds r5, r1 - ldrh r2, [r5, 0x4] - lsls r1, r2, 22 - lsrs r1, 22 - adds r1, 0x40 - ldr r3, =0x000003ff - adds r0, r3, 0 - ands r1, r0 - ldr r0, =0xfffffc00 - ands r0, r2 - orrs r0, r1 - strh r0, [r5, 0x4] - movs r4, 0xC0 - lsls r4, 19 - ldrb r0, [r6] - lsls r3, r0, 2 - adds r3, r0 - lsls r3, 6 - ldr r0, =0x0600e026 - adds r3, r0 - ldr r7, =gContestResources - ldr r0, [r7] - ldr r0, [r0, 0x34] - str r0, [sp] - movs r0, 0 - movs r1, 0x3 - adds r2, r4, 0 - bl CopySpriteTiles - ldrb r0, [r6] - lsls r3, r0, 2 - adds r3, r0 - lsls r3, 6 - ldr r1, =0x0600e036 - adds r3, r1 - ldr r0, [r7] - ldr r0, [r0, 0x38] - str r0, [sp] - movs r0, 0 - movs r1, 0x3 - adds r2, r4, 0 - bl CopySpriteTiles - movs r4, 0 - str r4, [sp, 0x4] - ldr r0, [r7] - ldr r1, [r0, 0x34] - movs r6, 0xA0 - lsls r6, 3 - adds r1, r6 - ldr r2, =0x050000c0 - mov r10, r2 - add r0, sp, 0x4 - bl CpuSet - str r4, [sp, 0x8] - add r0, sp, 0x8 - ldr r1, [r7] - ldr r1, [r1, 0x38] - adds r1, r6 - mov r2, r10 - bl CpuSet - ldr r0, [r7] - ldr r0, [r0, 0x34] - mov r3, r9 - lsls r4, r3, 4 - add r4, r9 - lsls r4, 2 - ldr r1, =gSprites - adds r4, r1 - ldrh r1, [r4, 0x4] - lsls r1, 22 - lsrs r1, 17 - ldr r6, =0x06010000 - adds r1, r6 - movs r2, 0x80 - lsls r2, 4 - mov r10, r2 - movs r3, 0x1 - bl RequestDma3Copy - ldr r0, [r7] - ldr r0, [r0, 0x38] - ldrh r1, [r5, 0x4] - lsls r1, 22 - lsrs r1, 17 - adds r1, r6 - mov r2, r10 - movs r3, 0x1 - bl RequestDma3Copy - mov r3, r8 - strh r3, [r4, 0x2E] - mov r0, r9 - strh r0, [r5, 0x2E] - mov r1, sp - ldrh r1, [r1, 0xC] - strh r1, [r4, 0x30] - mov r2, sp - ldrh r2, [r2, 0xC] - strh r2, [r5, 0x30] - mov r0, r9 - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80DC9EC - thumb_func_start sub_80DCB78 sub_80DCB78: @ 80DCB78 push {r4,r5,lr} diff --git a/include/util.h b/include/util.h index 9d13453c20..56c89359aa 100644 --- a/include/util.h +++ b/include/util.h @@ -15,5 +15,7 @@ u16 CalcCRC16WithTable(u8 *data, u32 length); u32 CalcByteArraySum(const u8* data, u32 length); void BlendPalette(u16 palOffset, u16 numEntries, u8 coeff, u16 blendColor); void DoBgAffineSet(struct BgAffineDstData *dest, u32 texX, u32 texY, s16 scrX, s16 scrY, s16 sx, s16 sy, u16 alpha); +void CopySpriteTiles(u8 shape, u8 size, u8 *tiles, u16 *tilemap, u8 *output); + #endif // GUARD_UTIL_H diff --git a/src/contest.c b/src/contest.c index 4fb5f76c57..a0b44e331e 100644 --- a/src/contest.c +++ b/src/contest.c @@ -113,7 +113,7 @@ void sub_80DBF90(void); void sub_80DC2BC(void); void sub_80DC490(bool8); void sub_80DC4F0(void); -void sub_80DC594(void); +void CreateApplauseMeterSprite(void); void sub_80DC5E8(void); void sub_80DC7EC(void); void sub_80DCD48(void); @@ -174,6 +174,14 @@ s16 sub_80DBD34(u8); void DetermineFinalStandings(void); bool8 sub_80DBF30(s32, s32, struct UnknownContestStruct6 *); void sub_80DC0F4(u8); +void sub_80DC408(struct Sprite *); +void sub_80DC728(u8); +void sub_80DC6A4(u8); +void sub_80DC8D0(u8); +void sub_80DC81C(u8); +void sub_80DC87C(u8); + + EWRAM_DATA struct ContestPokemon gContestMons[4] = {0}; EWRAM_DATA s16 gContestMonConditions[4] = {0}; @@ -230,6 +238,17 @@ extern const struct SpriteTemplate gSpriteTemplate_8587C18; extern const union AffineAnimCmd *const gUnknown_082FF6C0[]; extern const union AffineAnimCmd *const gUnknown_082FF694[]; extern const u8 *const gContestEffectDescriptionPointers[]; +extern const struct SpriteSheet gUnknown_08587A74; +extern const u8 gUnknown_08587A6C[]; +extern const struct SpriteTemplate gSpriteTemplate_8587AD0; +extern const struct SpritePalette gUnknown_08587B08; +extern const struct CompressedSpriteSheet gUnknown_08587AE8[]; +extern const struct SpriteTemplate gSpriteTemplate_8587B18[]; +extern const u8 gUnknown_08587A70[]; +extern const struct SubspriteTable gSubspriteTables_8587B80[]; +extern const struct CompressedSpriteSheet gUnknown_08587BB0; +extern const struct SpritePalette gUnknown_08587BB8; +extern const struct SpriteTemplate gSpriteTemplate_8587BC8; void TaskDummy1(u8 taskId) { @@ -577,7 +596,7 @@ u8 sub_80D7E44(u8 *a) gContestResources->field_0->unk19216 = sub_80DB120(); sub_80DC2BC(); sub_80DC4F0(); - sub_80DC594(); + CreateApplauseMeterSprite(); sub_80DC5E8(); sub_80DC7EC(); gBattlerPositions[0] = 0; @@ -3090,8 +3109,6 @@ u8 sub_80DC028(s16 a, s16 b, u8 c) return taskId; } -#ifdef NONMATCHING - void sub_80DC0F4(u8 taskId) { u8 r7 = gTasks[taskId].data[3]; @@ -3103,7 +3120,8 @@ void sub_80DC0F4(u8 taskId) u16 r6; u8 r5; u8 r10; - + u8 r11; + gTasks[taskId].data[10] = 0; if (gTasks[taskId].data[1] == 0) { @@ -3158,16 +3176,15 @@ void sub_80DC0F4(u8 taskId) } } } - - r10 = r5; - r1 = 0; + r10 = r5; + r11 = 0; + if (r5 > 7) - { - r1 = 1; - r5 -= 8; + { + r11 = 1; + r5-= 8; } - - ContestBG_FillBoxWithTile(0, r6, r5 + 0x16, (gUnknown_02039F26[r7] * 5) + 2 + r3, 1, 1, 0x11); + ContestBG_FillBoxWithTile(0, r6, r5 + 22, gUnknown_02039F26[r7] * 5 + 2 + r11, 1, 1, 17); if (r1 > 0) { PlaySE(SE_C_GAJI); @@ -3175,239 +3192,318 @@ void sub_80DC0F4(u8 taskId) m4aMPlayPitchControl(&gMPlayInfo_SE1, 0xFFFF, r10 * 256); } else - { PlaySE(SE_BOO); - } - - if (r10 == 0 && r5 == 0 && r6 == 0) + + if (!r11 && !r5 && !r6) gTasks[taskId].data[2] = -gTasks[taskId].data[2]; } } -#else -NAKED -void sub_80DC0F4(u8 taskId) + +void sub_80DC2BC(void) { - asm(".syntax unified\n\ - push {r4-r7,lr}\n\ - mov r7, r10\n\ - mov r6, r9\n\ - mov r5, r8\n\ - push {r5-r7}\n\ - sub sp, 0x10\n\ - lsls r0, 24\n\ - lsrs r7, r0, 24\n\ - ldr r1, =gTasks\n\ - lsls r0, r7, 2\n\ - adds r0, r7\n\ - lsls r0, 3\n\ - adds r4, r0, r1\n\ - ldrb r0, [r4, 0xE]\n\ - mov r9, r0\n\ - ldrh r3, [r4, 0x8]\n\ - ldrh r1, [r4, 0xA]\n\ - ldrh r0, [r4, 0x1C]\n\ - adds r0, 0x1\n\ - strh r0, [r4, 0x1C]\n\ - lsls r0, 16\n\ - asrs r0, 16\n\ - cmp r0, 0xE\n\ - bgt _080DC126\n\ - b _080DC2A8\n\ -_080DC126:\n\ - movs r0, 0\n\ - strh r0, [r4, 0x1C]\n\ - ldrh r2, [r4, 0xA]\n\ - movs r5, 0xA\n\ - ldrsh r0, [r4, r5]\n\ - cmp r0, 0\n\ - bne _080DC15C\n\ - adds r0, r7, 0\n\ - bl DestroyTask\n\ - ldr r0, =gContestResources\n\ - ldr r0, [r0]\n\ - ldr r0, [r0, 0x14]\n\ - mov r2, r9\n\ - lsls r1, r2, 2\n\ - adds r1, r0\n\ - ldrb r2, [r1, 0x2]\n\ - movs r0, 0x5\n\ - negs r0, r0\n\ - ands r0, r2\n\ - strb r0, [r1, 0x2]\n\ - b _080DC2A8\n\ - .pool\n\ -_080DC15C:\n\ - cmp r3, 0\n\ - bne _080DC1A4\n\ - lsls r0, r1, 16\n\ - mov r8, r0\n\ - cmp r0, 0\n\ - bge _080DC17A\n\ - mov r0, r9\n\ - bl sub_80DBFC8\n\ - adds r0, 0x2\n\ - lsls r0, 16\n\ - lsrs r6, r0, 16\n\ - ldrh r0, [r4, 0xA]\n\ - adds r0, 0x1\n\ - b _080DC188\n\ -_080DC17A:\n\ - mov r0, r9\n\ - bl sub_80DBFC8\n\ - lsls r0, 16\n\ - lsrs r6, r0, 16\n\ - ldrh r0, [r4, 0xA]\n\ - subs r0, 0x1\n\ -_080DC188:\n\ - strh r0, [r4, 0xA]\n\ - ldr r1, =gTasks\n\ - lsls r0, r7, 2\n\ - adds r0, r7\n\ - lsls r0, 3\n\ - adds r0, r1\n\ - ldrh r1, [r0, 0x8]\n\ - adds r2, r1, 0x1\n\ - strh r2, [r0, 0x8]\n\ - lsls r1, 24\n\ - lsrs r5, r1, 24\n\ - b _080DC210\n\ - .pool\n\ -_080DC1A4:\n\ - movs r3, 0xC\n\ - ldrsh r0, [r4, r3]\n\ - cmp r0, 0\n\ - bge _080DC1DE\n\ - lsls r0, r1, 16\n\ - mov r8, r0\n\ - cmp r0, 0\n\ - bge _080DC1CC\n\ - ldrh r0, [r4, 0x8]\n\ - adds r1, r0, 0x1\n\ - strh r1, [r4, 0x8]\n\ - lsls r0, 24\n\ - lsrs r5, r0, 24\n\ - adds r0, r2, 0x1\n\ - strh r0, [r4, 0xA]\n\ - mov r0, r9\n\ - bl sub_80DBFC8\n\ - adds r0, 0x2\n\ - b _080DC20C\n\ -_080DC1CC:\n\ - ldrh r0, [r4, 0x8]\n\ - subs r0, 0x1\n\ - strh r0, [r4, 0x8]\n\ - lsls r0, 24\n\ - lsrs r5, r0, 24\n\ - movs r6, 0\n\ - subs r0, r2, 0x1\n\ - strh r0, [r4, 0xA]\n\ - b _080DC210\n\ -_080DC1DE:\n\ - lsls r0, r1, 16\n\ - mov r8, r0\n\ - cmp r0, 0\n\ - bge _080DC1F8\n\ - ldrh r0, [r4, 0x8]\n\ - subs r0, 0x1\n\ - strh r0, [r4, 0x8]\n\ - lsls r0, 24\n\ - lsrs r5, r0, 24\n\ - movs r6, 0\n\ - adds r0, r2, 0x1\n\ - strh r0, [r4, 0xA]\n\ - b _080DC210\n\ -_080DC1F8:\n\ - ldrh r0, [r4, 0x8]\n\ - adds r1, r0, 0x1\n\ - strh r1, [r4, 0x8]\n\ - lsls r0, 24\n\ - lsrs r5, r0, 24\n\ - subs r0, r2, 0x1\n\ - strh r0, [r4, 0xA]\n\ - mov r0, r9\n\ - bl sub_80DBFC8\n\ -_080DC20C:\n\ - lsls r0, 16\n\ - lsrs r6, r0, 16\n\ -_080DC210:\n\ - str r5, [sp, 0xC]\n\ - movs r0, 0\n\ - mov r10, r0\n\ - cmp r5, 0x7\n\ - bls _080DC226\n\ - movs r2, 0x1\n\ - mov r10, r2\n\ - adds r0, r5, 0\n\ - subs r0, 0x8\n\ - lsls r0, 24\n\ - lsrs r5, r0, 24\n\ -_080DC226:\n\ - adds r2, r5, 0\n\ - adds r2, 0x16\n\ - lsls r2, 24\n\ - lsrs r2, 24\n\ - ldr r0, =gUnknown_02039F26\n\ - add r0, r9\n\ - ldrb r0, [r0]\n\ - lsls r3, r0, 2\n\ - adds r3, r0\n\ - adds r3, 0x2\n\ - add r3, r10\n\ - lsls r3, 24\n\ - lsrs r3, 24\n\ - movs r0, 0x1\n\ - str r0, [sp]\n\ - str r0, [sp, 0x4]\n\ - movs r0, 0x11\n\ - str r0, [sp, 0x8]\n\ - movs r0, 0\n\ - adds r1, r6, 0\n\ - bl ContestBG_FillBoxWithTile\n\ - mov r3, r8\n\ - cmp r3, 0\n\ - ble _080DC284\n\ - movs r0, 0x60\n\ - bl PlaySE\n\ - ldr r4, =gMPlayInfo_SE1\n\ - adds r0, r4, 0\n\ - bl m4aMPlayImmInit\n\ - ldr r1, =0x0000ffff\n\ - ldr r0, [sp, 0xC]\n\ - lsls r2, r0, 24\n\ - asrs r2, 16\n\ - adds r0, r4, 0\n\ - bl m4aMPlayPitchControl\n\ - b _080DC28A\n\ - .pool\n\ -_080DC284:\n\ - movs r0, 0x16\n\ - bl PlaySE\n\ -_080DC28A:\n\ - mov r2, r10\n\ - cmp r2, 0\n\ - bne _080DC2A8\n\ - cmp r5, 0\n\ - bne _080DC2A8\n\ - cmp r6, 0\n\ - bne _080DC2A8\n\ - ldr r0, =gTasks\n\ - lsls r1, r7, 2\n\ - adds r1, r7\n\ - lsls r1, 3\n\ - adds r1, r0\n\ - ldrh r0, [r1, 0xC]\n\ - negs r0, r0\n\ - strh r0, [r1, 0xC]\n\ -_080DC2A8:\n\ - add sp, 0x10\n\ - pop {r3-r5}\n\ - mov r8, r3\n\ - mov r9, r4\n\ - mov r10, r5\n\ - pop {r4-r7}\n\ - pop {r0}\n\ - bx r0\n\ - .pool\n\ - .syntax divided\n"); + s32 i; + + LoadSpriteSheet(&gUnknown_08587A74); + for (i = 0; i < 4; i++) + { + u8 y = gUnknown_08587A6C[gUnknown_02039F26[i]]; + + gContestResources->field_14[i].unk0 = CreateSprite(&gSpriteTemplate_8587AD0, 180, y, 1); + } } -#endif \ No newline at end of file + +void sub_80DC308(u8 a) +{ + u8 spriteId; + s16 r5; + + gContestResources->field_14[a].unk2_0 = 1; + spriteId = gContestResources->field_14[a].unk0; + r5 = sContestantStatus[a].unk4 / 10 * 2; + if (r5 > 56) + r5 = 56; + else if (r5 < 0) + r5 = 0; + gSprites[spriteId].invisible = FALSE; + gSprites[spriteId].data[0] = a; + gSprites[spriteId].data[1] = r5; + if (gSprites[spriteId].data[1] > gSprites[spriteId].pos2.x) + gSprites[spriteId].data[2] = 1; + else + gSprites[spriteId].data[2] = -1; + gSprites[spriteId].callback = sub_80DC408; +} + +void sub_80DC3AC(void) +{ + s32 i; + + for (i = 0; i < 4; i++) + sub_80DC308(i); +} + +bool8 sub_80DC3C4(void) +{ + s32 i; + + for (i = 0; i < 4; i++) + { + if (gContestResources->field_14[i].unk2_0) + break; + } + if (i == 4) + return TRUE; + else + return FALSE; +} + +void sub_80DC408(struct Sprite *sprite) +{ + if (sprite->pos2.x == sprite->data[1]) + { + gContestResources->field_14[sprite->data[0]].unk2_0 = 0; + sprite->callback = SpriteCallbackDummy; + } + else + { + sprite->pos2.x += sprite->data[2]; + } +} + +void sub_80DC44C(void) +{ + s32 i; + + for (i = 0; i < 4; i++) + gSprites[gContestResources->field_14[i].unk0].pos1.y = gUnknown_08587A6C[gUnknown_02039F26[i]]; +} + +void sub_80DC490(bool8 a) +{ + s32 i; + + for (i = 0; i < 4; i++) + { + if (gUnknown_02039F26[i] > 1) + { + if (!a) + gSprites[gContestResources->field_14[i].unk0].pos1.x = 180; + else + gSprites[gContestResources->field_14[i].unk0].pos1.x = 256; + } + } +} + +void sub_80DC4F0(void) +{ + s32 i; + + LoadSpritePalette(&gUnknown_08587B08); + for (i = 0; i < 4; i++) + { + LoadCompressedObjectPic(&gUnknown_08587AE8[i]); + gContestResources->field_14[i].unk1 = CreateSprite( + &gSpriteTemplate_8587B18[i], + 204, gUnknown_08587A70[gUnknown_02039F26[i]], + 0); + SetSubspriteTables(&gSprites[gContestResources->field_14[i].unk1], gSubspriteTables_8587B80); + gSprites[gContestResources->field_14[i].unk1].invisible = TRUE; + } +} + +void CreateApplauseMeterSprite(void) +{ + u8 spriteId; + + LoadCompressedObjectPic(&gUnknown_08587BB0); + LoadSpritePalette(&gUnknown_08587BB8); + spriteId = CreateSprite(&gSpriteTemplate_8587BC8, 30, 44, 1); + gSprites[spriteId].invisible = TRUE; + sContest.applauseMeterSpriteId = spriteId; +} + +void sub_80DC5E8(void) +{ + u8 i; + u8 taskId = CreateTask(sub_80DC728, 30); + + sContest.unk19211 = taskId; + for (i = 0; i < 4; i++) + gTasks[taskId].data[i * 4] = 0xFF; +} + +void sub_80DC630(u8 a) +{ + gTasks[sContest.unk19211].data[a * 4 + 0] = 0; + gTasks[sContest.unk19211].data[a * 4 + 1] = 0; +} + +void sub_80DC674(u8 a) +{ + u8 taskId = CreateTask(sub_80DC6A4, 31); + + gTasks[taskId].data[0] = a; +} + +void sub_80DC6A4(u8 taskId) +{ + u8 r4 = gTasks[taskId].data[0]; + + if (gTasks[sContest.unk19211].data[r4 * 4 + 0] == 0 + || gTasks[sContest.unk19211].data[r4 * 4 + 0] == 0xFF) + { + gTasks[sContest.unk19211].data[r4 * 4 + 0] = 0xFF; + gTasks[sContest.unk19211].data[r4 * 4 + 1] = 0; + BlendPalette((sContest.unk19218[r4] + 5) * 16 + 6, 2, 0, RGB(31, 31, 18)); + DestroyTask(taskId); + } +} + +void sub_80DC728(u8 taskId) +{ + u8 i; + + for (i = 0; i < 4; i++) + { + u8 r3 = i * 4; + + if (gTasks[taskId].data[r3 + 0] != 0xFF) + { + if (gTasks[taskId].data[r3 + 1] == 0) + gTasks[taskId].data[r3 + 0]++; + else + gTasks[taskId].data[r3 + 0]--; + + if (gTasks[taskId].data[r3 + 0] == 16 + || gTasks[taskId].data[r3 + 0] == 0) + gTasks[taskId].data[r3 + 1] ^= 1; + + BlendPalette( + (sContest.unk19218[i] + 5) * 16 + 6, + 2, + gTasks[taskId].data[r3 + 0], + RGB(31, 31, 18)); + } + } +} + +void sub_80DC7EC(void) +{ + s32 i; + + sContest.unk19212 = CreateTask(sub_80DC8D0, 30); + for (i = 0; i < 4; i++) + sub_80DC81C(i); +} + +void sub_80DC81C(u8 a) +{ + gTasks[sContest.unk19212].data[a * 4 + 0] = 0xFF; + gTasks[sContest.unk19212].data[a * 4 + 1] = 0; +} + +void sub_80DC864(void) +{ + s32 i; + + for (i = 0; i < 4; i++) + sub_80DC87C(i); +} + +void sub_80DC87C(u8 a) +{ + u32 var; + u32 r0; + + sub_80DC81C(a); + + r0 = a + 5; + DmaCopy16Defvars( + 3, + gPlttBufferUnfaded + r0 * 16 + 10, + gPlttBufferFaded + r0 * 16 + 10, + 2); + + var = (a + 5) * 16 + 12 + a; + DmaCopy16Defvars( + 3, + gPlttBufferUnfaded + var, + gPlttBufferFaded + var, + 2); +} + +void sub_80DC8D0(u8 taskId) +{ + u8 i; + + for (i = 0; i < 4; i++) + { + u8 r3 = i * 4; + + if (gTasks[taskId].data[r3 + 0] != 0xFF) + { + if (++gTasks[taskId].data[r3 + 2] > 2) + { + gTasks[taskId].data[r3 + 2] = 0; + + if (gTasks[taskId].data[r3 + 1] == 0) + gTasks[taskId].data[r3 + 0]++; + else + gTasks[taskId].data[r3 + 0]--; + + if (gTasks[taskId].data[r3 + 0] == 16 + || gTasks[taskId].data[r3 + 0] == 0) + gTasks[taskId].data[r3 + 1] ^= 1; + + BlendPalette((i + 5) * 16 + 10, 1, gTasks[taskId].data[r3 + 0], RGB(31, 31, 18)); + BlendPalette((i + 5) * 16 + 12 + i, 1, gTasks[taskId].data[r3 + 0], RGB(31, 31, 18)); + } + } + } +} + +void sub_80DC9B4(u8 a) +{ + if (sContestantStatus[a].hasJudgesAttention) + sub_80DC630(a); + else + sub_80DC674(a); +} + +extern const struct CompressedSpriteSheet gUnknown_08589904[]; +extern const struct SpritePalette gUnknown_08589924[]; +extern const struct SpriteTemplate gSpriteTemplate_858998C[]; + +u8 sub_80DC9EC(u8 a) +{ + u8 r5 = gUnknown_02039F26[a] * 40 + 32; + u8 r8; + u8 r6; + volatile u8 zero; + + + LoadCompressedObjectPic(&gUnknown_08589904[a]); + LoadSpritePalette(&gUnknown_08589924[a]); + r6 = CreateSprite(&gSpriteTemplate_858998C[a], 184, r5, 29); + gSprites[r8].oam.tileNum += 64; + r8 = CreateSprite(&gSpriteTemplate_858998C[a], 248, r5, 29); + + + CopySpriteTiles(0, 3, (void *)VRAM, (u16 *)(VRAM + 0xE000 + gUnknown_02039F26[a] * 5 * 64 + 0x26), (u8 *)(VRAM + 0x10000 + gSprites[r6].oam.tileNum * 32)); + CopySpriteTiles(0, 3, (void *)VRAM, (u16 *)(VRAM + 0xE000 + gUnknown_02039F26[a] * 5 * 64 + 0x36), (u8 *)(VRAM + 0x10000 + gSprites[r8].oam.tileNum * 32)); + CpuSet(&r8, (u16 *)(VRAM + 0xE000 + gUnknown_02039F26[a] * 5 * 64 + 0x36), 0x050000c0); + + RequestDma3Copy((void *)(VRAM + 0x10000 + (0x28 + gSprites[r6].oam.tileNum) * 32), (u8 *)(VRAM + 0x10000 + gSprites[r8].oam.tileNum * 32), 0x80, 1); + + // What is this? + zero = 0; + zero = 0; + + RequestDma3Copy((void *)(VRAM + 0x10000 + (0x28 + gSprites[r6].oam.tileNum) * 32), (u8 *)(VRAM + 0x10000 + gSprites[r6].oam.tileNum * 32), 0x80, 1); + + + gSprites[r6].data[0] = r8; + gSprites[r8].data[0] = r6; + + return r6; +} \ No newline at end of file From 284751e7610f5e9cf266bd0a8bb148464753afa1 Mon Sep 17 00:00:00 2001 From: ultima-soul Date: Sat, 5 Jan 2019 23:02:28 -0800 Subject: [PATCH 4/8] Decompile through ClearContestWinnerPicsInContestHall, 10 NONMATCHINGs present. --- asm/contest.s | 4542 --------------------------------- data/contest.s | 2 +- data/text/contest_strings.inc | 10 +- include/contest.h | 6 +- include/graphics.h | 4 + src/contest.c | 2742 +++++++++++++++++++- src/graphics.c | 4 +- 7 files changed, 2730 insertions(+), 4580 deletions(-) diff --git a/asm/contest.s b/asm/contest.s index f5ca016df1..f30eb32613 100644 --- a/asm/contest.s +++ b/asm/contest.s @@ -5,4548 +5,6 @@ .text - thumb_func_start sub_80DCB78 -sub_80DCB78: @ 80DCB78 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gSprites - lsls r5, r0, 4 - adds r5, r0 - lsls r5, 2 - adds r5, r1 - ldrh r0, [r5, 0x2E] - lsls r0, 24 - lsrs r0, 24 - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - adds r4, r1 - adds r0, r4, 0 - bl FreeSpriteOamMatrix - adds r0, r4, 0 - bl DestroySprite - adds r0, r5, 0 - bl DestroySpriteAndFreeResources - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DCB78 - - thumb_func_start sub_80DCBB4 -sub_80DCBB4: @ 80DCBB4 - push {lr} - movs r1, 0xFD - lsls r1, 6 - movs r0, 0x50 - bl SetGpuReg - ldr r1, =0x00000907 - movs r0, 0x52 - bl SetGpuReg - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DCBB4 - - thumb_func_start sub_80DCBD0 -sub_80DCBD0: @ 80DCBD0 - push {lr} - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - pop {r0} - bx r0 - thumb_func_end sub_80DCBD0 - - thumb_func_start sub_80DCBE8 -sub_80DCBE8: @ 80DCBE8 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - adds r4, r0, 0 - mov r9, r1 - lsls r4, 24 - lsrs r4, 24 - mov r0, r9 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - bl sub_80DCBB4 - ldr r0, =gContestResources - ldr r1, [r0] - ldr r2, =gSprites - mov r8, r2 - lsls r6, r4, 4 - adds r6, r4 - lsls r6, 2 - adds r0, r6, r2 - movs r3, 0x30 - ldrsh r2, [r0, r3] - ldr r1, [r1, 0x14] - lsls r2, 2 - adds r2, r1 - ldrb r1, [r2, 0x2] - movs r3, 0x2 - orrs r1, r3 - strb r1, [r2, 0x2] - ldrh r5, [r0, 0x2E] - lsls r5, 24 - lsrs r5, 24 - movs r1, 0x1 - bl StartSpriteAffineAnim - lsls r4, r5, 4 - adds r4, r5 - lsls r4, 2 - mov r1, r8 - adds r0, r4, r1 - movs r1, 0x1 - bl StartSpriteAffineAnim - movs r2, 0x1C - add r8, r2 - add r6, r8 - ldr r0, =sub_80DCC84 - str r0, [r6] - add r4, r8 - ldr r0, =SpriteCallbackDummy - str r0, [r4] - mov r3, r9 - cmp r3, 0 - bne _080DCC70 - movs r0, 0x65 - bl PlaySE - b _080DCC76 - .pool -_080DCC70: - movs r0, 0x2 - bl PlaySE -_080DCC76: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80DCBE8 - - thumb_func_start sub_80DCC84 -sub_80DCC84: @ 80DCC84 - push {lr} - mov r12, r0 - adds r0, 0x3F - ldrb r1, [r0] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080DCCCC - mov r0, r12 - ldrh r1, [r0, 0x2E] - lsls r1, 24 - lsrs r1, 24 - ldr r2, =gSprites - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r2 - adds r0, r1, 0 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 26 - cmp r0, 0 - bge _080DCCCC - mov r3, r12 - adds r3, 0x3E - ldrb r0, [r3] - movs r2, 0x4 - orrs r0, r2 - strb r0, [r3] - adds r1, 0x3E - ldrb r0, [r1] - orrs r0, r2 - strb r0, [r1] - ldr r0, =sub_80DCCD8 - mov r1, r12 - str r0, [r1, 0x1C] -_080DCCCC: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DCC84 - - thumb_func_start sub_80DCCD8 -sub_80DCCD8: @ 80DCCD8 - push {lr} - ldr r1, =gContestResources - ldr r1, [r1] - movs r3, 0x30 - ldrsh r2, [r0, r3] - ldr r1, [r1, 0x14] - lsls r2, 2 - adds r2, r1 - ldrb r3, [r2, 0x2] - movs r1, 0x3 - negs r1, r1 - ands r1, r3 - strb r1, [r2, 0x2] - ldrh r0, [r0, 0x2E] - lsls r0, 24 - lsrs r0, 24 - bl sub_80DCB78 - bl sub_80DCBD0 - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DCCD8 - - thumb_func_start sub_80DCD08 -sub_80DCD08: @ 80DCD08 - push {lr} - ldr r0, =gHeap - movs r1, 0xD0 - lsls r1, 9 - adds r2, r0, r1 - ldrb r1, [r2] - adds r3, r0, 0 - cmp r1, 0x1 - bne _080DCD24 - movs r0, 0 - b _080DCD26 - .pool -_080DCD24: - movs r0, 0x1 -_080DCD26: - strb r0, [r2] - movs r1, 0xD0 - lsls r1, 9 - adds r0, r3, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080DCD3E - bl sub_80DAEA4 - bl sub_80DB2BC - b _080DCD42 -_080DCD3E: - bl sub_80DCD48 -_080DCD42: - pop {r0} - bx r0 - thumb_func_end sub_80DCD08 - - thumb_func_start sub_80DCD48 -sub_80DCD48: @ 80DCD48 - push {r4,r5,lr} - sub sp, 0xC - ldr r0, =gUnknown_020322D5 - ldrb r0, [r0] - cmp r0, 0 - beq _080DCE44 - ldr r0, =gHeap - movs r1, 0xD0 - lsls r1, 9 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _080DCE44 - cmp r0, 0 - blt _080DCD7C - cmp r0, 0x3 - bgt _080DCD7C - cmp r0, 0x2 - blt _080DCD7C - bl sub_80DF750 - b _080DCE44 - .pool -_080DCD7C: - movs r5, 0 -_080DCD7E: - adds r0, r5, 0 - movs r1, 0 - bl FillWindowPixelBuffer - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x3 - bls _080DCD7E - movs r5, 0 -_080DCD92: - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r5, 3 - subs r0, r5 - lsls r0, 2 - adds r0, r1 - add r2, sp, 0x4 - ldrh r4, [r0, 0x4] - movs r1, 0x4 - ldrsh r0, [r0, r1] - cmp r0, 0 - bge _080DCDBC - negs r0, r0 - lsls r0, 16 - lsrs r4, r0, 16 - adds r0, r2, 0 - ldr r1, =gText_OneDash - bl StringCopy - adds r2, r0, 0 -_080DCDBC: - lsls r1, r4, 16 - asrs r1, 16 - adds r0, r2, 0 - movs r2, 0 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - ldr r0, =gUnknown_02039F26 - adds r0, r5, r0 - ldrb r0, [r0] - movs r1, 0x7 - str r1, [sp] - add r1, sp, 0x4 - movs r2, 0x37 - movs r3, 0x1 - bl Contest_PrintTextToBg0WindowAt - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x3 - bls _080DCD92 - movs r5, 0 -_080DCDEA: - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0x4] - lsls r0, r5, 3 - subs r0, r5 - lsls r0, 2 - adds r0, r1 - add r2, sp, 0x4 - ldrh r4, [r0, 0x2] - movs r1, 0x2 - ldrsh r0, [r0, r1] - cmp r0, 0 - bge _080DCE14 - negs r0, r0 - lsls r0, 16 - lsrs r4, r0, 16 - adds r0, r2, 0 - ldr r1, =gText_OneDash - bl StringCopy - adds r2, r0, 0 -_080DCE14: - lsls r1, r4, 16 - asrs r1, 16 - adds r0, r2, 0 - movs r2, 0 - movs r3, 0x4 - bl ConvertIntToDecimalStringN - ldr r0, =gUnknown_02039F26 - adds r0, r5, r0 - ldrb r0, [r0] - movs r1, 0x7 - str r1, [sp] - add r1, sp, 0x4 - movs r2, 0x5 - movs r3, 0x1 - bl Contest_PrintTextToBg0WindowAt - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x3 - bls _080DCDEA - bl sub_80DB2BC -_080DCE44: - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DCD48 - - thumb_func_start sub_80DCE58 -sub_80DCE58: @ 80DCE58 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - add r4, sp, 0x4 - adds r0, r4, 0 - movs r1, 0 - movs r2, 0x8 - bl memset - movs r5, 0 - add r4, sp, 0x4 - adds r6, r4, 0 - movs r7, 0 -_080DCE7E: - bl Random - adds r1, r0, 0 - mov r0, sp - adds r0, r7 - adds r0, 0x4 - strh r1, [r0] - movs r2, 0 - cmp r2, r5 - bge _080DCEB6 - lsls r0, r1, 16 - lsrs r0, 16 - mov r1, sp - ldrh r1, [r1, 0x4] - cmp r0, r1 - beq _080DCEB0 -_080DCE9E: - adds r2, 0x1 - cmp r2, r5 - bge _080DCEB6 - lsls r0, r2, 1 - adds r0, r4, r0 - ldrh r1, [r6] - ldrh r0, [r0] - cmp r1, r0 - bne _080DCE9E -_080DCEB0: - subs r6, 0x2 - subs r7, 0x2 - subs r5, 0x1 -_080DCEB6: - adds r6, 0x2 - adds r7, 0x2 - adds r5, 0x1 - cmp r5, 0x3 - ble _080DCE7E - mov r2, r8 - cmp r2, 0 - bne _080DCF80 - movs r5, 0 - ldr r3, =gUnknown_02039F26 - mov r8, r3 -_080DCECC: - mov r6, r8 - strb r5, [r6] - movs r4, 0 - cmp r4, r5 - bge _080DCF48 - ldr r7, =gContestMonConditions - mov r9, r7 - lsls r0, r5, 1 - adds r1, r0, 0 - add r1, r9 - mov r12, r1 - mov r2, sp - adds r2, 0x4 - str r2, [sp, 0xC] - add r0, sp - adds r0, 0x4 - str r0, [sp, 0x10] - ldr r3, =gUnknown_02039F26 - adds r6, r3, 0 - mov r10, r6 -_080DCEF4: - ldrb r0, [r3] - lsls r2, r0, 1 - mov r7, r9 - adds r0, r2, r7 - movs r6, 0 - ldrsh r1, [r0, r6] - mov r7, r12 - movs r6, 0 - ldrsh r0, [r7, r6] - cmp r1, r0 - blt _080DCF1C - cmp r1, r0 - bne _080DCF40 - ldr r7, [sp, 0xC] - adds r0, r7, r2 - ldrh r0, [r0] - ldr r1, [sp, 0x10] - ldrh r1, [r1] - cmp r0, r1 - bcs _080DCF40 -_080DCF1C: - adds r2, r5, 0 - cmp r5, r4 - ble _080DCF34 - subs r0, r5, 0x1 - mov r6, r10 - adds r1, r0, r6 -_080DCF28: - ldrb r0, [r1] - strb r0, [r1, 0x1] - subs r1, 0x1 - subs r2, 0x1 - cmp r2, r4 - bgt _080DCF28 -_080DCF34: - strb r5, [r3] - b _080DCF48 - .pool -_080DCF40: - adds r3, 0x1 - adds r4, 0x1 - cmp r4, r5 - blt _080DCEF4 -_080DCF48: - cmp r4, r5 - bne _080DCF50 - mov r7, r8 - strb r5, [r7] -_080DCF50: - movs r0, 0x1 - add r8, r0 - adds r5, 0x1 - cmp r5, 0x3 - ble _080DCECC - ldr r4, =gUnknown_02039F26 - mov r0, sp - adds r1, r4, 0 - movs r2, 0x4 - bl memcpy - movs r5, 0 -_080DCF68: - mov r1, sp - adds r0, r1, r5 - ldrb r0, [r0] - adds r0, r4 - strb r5, [r0] - adds r5, 0x1 - cmp r5, 0x3 - ble _080DCF68 - b _080DD034 - .pool -_080DCF80: - mov r0, sp - movs r1, 0xFF - movs r2, 0x4 - bl memset - movs r5, 0 - ldr r3, =gUnknown_02039F26 - movs r6, 0 -_080DCF90: - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0x4] - adds r0, r6, r0 - ldrb r0, [r0, 0xB] - lsls r0, 30 - lsrs r2, r0, 30 - mov r7, sp - adds r1, r7, r2 - b _080DCFB6 - .pool -_080DCFAC: - adds r0, r2, 0x1 - lsls r0, 24 - lsrs r2, r0, 24 - mov r0, sp - adds r1, r0, r2 -_080DCFB6: - ldrb r0, [r1] - cmp r0, 0xFF - bne _080DCFAC - strb r5, [r1] - strb r2, [r3] - adds r3, 0x1 - adds r6, 0x1C - adds r5, 0x1 - cmp r5, 0x3 - ble _080DCF90 - movs r5, 0 -_080DCFCC: - movs r4, 0x3 - adds r1, r5, 0x1 - mov r10, r1 - cmp r4, r5 - ble _080DD02E - mov r9, r4 - ldr r2, =gUnknown_02039F26 - mov r8, r2 - add r3, sp, 0x4 - mov r12, r3 -_080DCFE0: - ldr r6, =gContestResources - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r0, r4, 3 - subs r0, r4 - lsls r0, 2 - adds r0, r1 - adds r1, r0, 0 - subs r1, 0x1C - ldrb r2, [r1, 0xB] - ldrb r3, [r0, 0xB] - mov r1, r9 - ands r1, r2 - mov r0, r9 - ands r0, r3 - subs r3, r4, 0x1 - cmp r1, r0 - bne _080DD028 - mov r0, r8 - adds r7, r3, r0 - adds r2, r4, r0 - ldrb r6, [r7] - ldrb r1, [r2] - cmp r6, r1 - bcs _080DD028 - lsls r0, r3, 1 - add r0, r12 - lsls r1, r4, 1 - add r1, r12 - ldrh r0, [r0] - ldrh r1, [r1] - cmp r0, r1 - bcs _080DD028 - ldrb r0, [r2] - strb r6, [r2] - strb r0, [r7] -_080DD028: - adds r4, r3, 0 - cmp r4, r5 - bgt _080DCFE0 -_080DD02E: - mov r5, r10 - cmp r5, 0x2 - ble _080DCFCC -_080DD034: - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DCE58 - - thumb_func_start sub_80DD04C -sub_80DD04C: @ 80DD04C - push {r4,r5,lr} - movs r4, 0 - movs r5, 0xA0 -_080DD052: - ldr r0, =gHeap+0x1A004 - adds r0, r5, r0 - ldr r1, =gUnknown_02039F26 - adds r1, r4, r1 - ldrb r1, [r1] - adds r1, 0x5 - lsls r1, 4 - movs r2, 0x20 - bl LoadPalette - adds r5, 0x20 - adds r4, 0x1 - cmp r4, 0x3 - ble _080DD052 - bl sub_80DAEA4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DD04C - - thumb_func_start sub_80DD080 -sub_80DD080: @ 80DD080 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r4, =gContestResources - ldr r3, [r4] - ldr r1, [r3, 0x4] - lsls r7, r6, 3 - subs r0, r7, r6 - lsls r5, r0, 2 - adds r1, r5, r1 - movs r2, 0 - strh r2, [r1, 0x2] - ldr r0, [r3, 0x4] - adds r0, r5, r0 - strh r2, [r0] - adds r0, r6, 0 - bl sub_80DBA68 - lsls r0, 24 - mov r8, r4 - cmp r0, 0 - bne _080DD0B4 - b _080DD3C4 -_080DD0B4: - ldr r0, [r4] - ldr r1, [r0, 0x4] - adds r1, r5, r1 - ldrh r0, [r1, 0x6] - ldr r2, =gContestMoves - lsls r0, 3 - adds r0, r2 - ldrb r2, [r0] - mov r9, r2 - ldrb r0, [r0, 0x1] - lsls r0, 29 - lsrs r0, 29 - strb r0, [r1, 0xA] - ldr r0, [r4] - ldr r0, [r0, 0x4] - adds r2, r5, r0 - ldrh r0, [r2, 0x6] - ldrh r1, [r2, 0x8] - cmp r0, r1 - bne _080DD110 - cmp r0, 0 - beq _080DD110 - ldrb r0, [r2, 0x15] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x15] - ldr r0, [r4] - ldr r2, [r0, 0x4] - adds r2, r5, r2 - ldrb r3, [r2, 0xB] - lsls r1, r3, 25 - lsrs r1, 29 - adds r1, 0x1 - movs r0, 0x7 - ands r1, r0 - lsls r1, 4 - movs r0, 0x71 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0xB] - b _080DD12C - .pool -_080DD110: - ldr r4, =gContestResources - ldr r0, [r4] - ldr r0, [r0, 0x4] - lsls r3, r6, 3 - subs r1, r3, r6 - lsls r1, 2 - adds r1, r0 - ldrb r2, [r1, 0xB] - movs r0, 0x71 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0xB] - mov r8, r4 - adds r7, r3, 0 -_080DD12C: - mov r2, r8 - ldr r4, [r2] - ldr r2, [r4, 0x4] - subs r0, r7, r6 - lsls r0, 2 - adds r2, r0, r2 - ldr r3, =gContestEffects - mov r1, r9 - lsls r5, r1, 2 - adds r3, r5, r3 - ldrb r1, [r3, 0x1] - strh r1, [r2] - ldr r1, [r4, 0x4] - adds r0, r1 - ldrh r1, [r0] - strh r1, [r0, 0x2] - ldr r1, [r4, 0x8] - ldrb r0, [r3, 0x2] - strh r0, [r1, 0x4] - ldr r1, [r4, 0x8] - ldrh r0, [r1, 0x4] - strh r0, [r1, 0x6] - ldr r0, [r4, 0x8] - strb r6, [r0, 0x11] - movs r2, 0 - mov r9, r5 - mov r4, r8 - movs r3, 0 - movs r1, 0 -_080DD166: - ldr r0, [r4] - ldr r0, [r0, 0x4] - adds r0, r1, r0 - strb r3, [r0, 0xE] - ldr r0, [r4] - ldr r0, [r0, 0x8] - adds r0, 0xD - adds r0, r2 - strb r3, [r0] - adds r1, 0x1C - adds r2, 0x1 - cmp r2, 0x3 - ble _080DD166 - ldr r5, =gContestResources - ldr r0, [r5] - ldr r1, [r0, 0x4] - subs r0, r7, r6 - lsls r4, r0, 2 - adds r2, r4, r1 - ldrb r1, [r2, 0x15] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080DD1B4 - ldrh r0, [r2, 0x8] - ldrh r1, [r2, 0x6] - bl AreMovesContestCombo - lsls r0, 24 - cmp r0, 0 - bne _080DD1B4 - ldr r0, [r5] - ldr r1, [r0, 0x4] - adds r1, r4, r1 - ldrb r2, [r1, 0x15] - movs r0, 0x11 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x15] -_080DD1B4: - ldr r0, =gContestEffectFuncs - add r0, r9 - ldr r0, [r0] - bl _call_via_r0 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0x4] - subs r0, r7, r6 - lsls r0, 2 - adds r2, r0, r1 - ldrb r1, [r2, 0x10] - movs r0, 0x30 - ands r0, r1 - cmp r0, 0x10 - bne _080DD1EC - ldrh r1, [r2, 0x2] - subs r1, 0xA - movs r0, 0xD - ldrsb r0, [r2, r0] - b _080DD206 - .pool -_080DD1EC: - ldrb r1, [r2, 0x11] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080DD200 - movs r1, 0xD - ldrsb r1, [r2, r1] - lsls r0, r1, 1 - adds r0, r1 - b _080DD204 -_080DD200: - movs r0, 0xD - ldrsb r0, [r2, r0] -_080DD204: - ldrh r1, [r2, 0x2] -_080DD206: - adds r0, r1 - strh r0, [r2, 0x2] - ldr r5, =gContestResources - ldr r0, [r5] - ldr r1, [r0, 0x4] - subs r0, r7, r6 - lsls r4, r0, 2 - adds r1, r4, r1 - movs r0, 0 - strb r0, [r1, 0x16] - ldr r0, [r5] - ldr r1, [r0, 0x4] - adds r1, r4, r1 - ldrb r2, [r1, 0x15] - movs r0, 0x41 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x15] - adds r0, r6, 0 - bl sub_80DE1E8 - lsls r0, 24 - cmp r0, 0 - beq _080DD2E2 - ldr r0, [r5] - ldr r1, [r0, 0x4] - adds r1, r4, r1 - ldrh r0, [r1, 0x8] - ldrh r1, [r1, 0x6] - bl AreMovesContestCombo - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0 - beq _080DD29C - ldr r0, [r5] - ldr r0, [r0, 0x4] - adds r2, r4, r0 - ldrb r1, [r2, 0x15] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080DD29C - strb r3, [r2, 0x16] - ldr r0, [r5] - ldr r1, [r0, 0x4] - adds r1, r4, r1 - ldrb r0, [r1, 0x15] - movs r2, 0x40 - orrs r0, r2 - strb r0, [r1, 0x15] - ldr r0, [r5] - ldr r1, [r0, 0x4] - adds r1, r4, r1 - ldrb r2, [r1, 0x15] - movs r0, 0x11 - negs r0, r0 - ands r0, r2 - strb r0, [r1, 0x15] - ldr r0, [r5] - ldr r0, [r0, 0x4] - adds r0, r4, r0 - movs r1, 0 - ldrsh r2, [r0, r1] - ldrb r1, [r0, 0x16] - muls r1, r2 - strb r1, [r0, 0x17] - ldr r0, [r5] - ldr r1, [r0, 0x4] - adds r1, r4, r1 - ldrb r0, [r1, 0x15] - movs r2, 0x8 - b _080DD2C8 - .pool -_080DD29C: - ldr r2, =gContestMoves - ldr r5, =gContestResources - ldr r0, [r5] - ldr r1, [r0, 0x4] - subs r0, r7, r6 - lsls r4, r0, 2 - adds r3, r4, r1 - ldrh r0, [r3, 0x6] - lsls r0, 3 - adds r0, r2 - ldrb r0, [r0, 0x2] - cmp r0, 0 - beq _080DD2D8 - ldrb r0, [r3, 0x15] - movs r1, 0x10 - orrs r0, r1 - strb r0, [r3, 0x15] - ldr r0, [r5] - ldr r1, [r0, 0x4] - adds r1, r4, r1 - ldrb r0, [r1, 0x15] - movs r2, 0x40 -_080DD2C8: - orrs r0, r2 - strb r0, [r1, 0x15] - b _080DD2E2 - .pool -_080DD2D8: - ldrb r1, [r3, 0x15] - movs r0, 0x11 - negs r0, r0 - ands r0, r1 - strb r0, [r3, 0x15] -_080DD2E2: - ldr r5, =gContestResources - ldr r0, [r5] - ldr r1, [r0, 0x4] - subs r0, r7, r6 - lsls r4, r0, 2 - adds r2, r4, r1 - ldrb r1, [r2, 0x15] - movs r0, 0x1 - mov r8, r0 - ands r0, r1 - cmp r0, 0 - beq _080DD30A - ldrb r0, [r2, 0xB] - lsls r0, 25 - lsrs r0, 29 - adds r0, 0x1 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 1 - strb r1, [r2, 0x18] -_080DD30A: - ldr r0, [r5] - ldr r0, [r0, 0x4] - adds r2, r4, r0 - ldrb r1, [r2, 0xC] - mov r0, r8 - ands r0, r1 - cmp r0, 0 - beq _080DD334 - ldrb r1, [r2, 0x15] - movs r0, 0x11 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x15] - ldr r2, [r5] - ldr r0, [r2, 0x4] - adds r0, r4, r0 - movs r1, 0 - strh r1, [r0, 0x2] - ldr r0, [r2, 0x4] - adds r0, r4, r0 - strh r1, [r0] -_080DD334: - ldr r0, [r5] - ldr r0, [r0, 0x4] - adds r0, r4, r0 - ldrh r0, [r0, 0x6] - bl Contest_GetMoveExcitement - ldr r1, [r5] - ldr r1, [r1, 0x10] - strb r0, [r1] - ldr r2, [r5] - ldr r0, [r2, 0x4] - adds r0, r4, r0 - ldrb r1, [r0, 0x11] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080DD35C - ldr r0, [r2, 0x10] - mov r1, r8 - strb r1, [r0] -_080DD35C: - ldr r1, [r5] - ldr r3, [r1, 0x10] - movs r0, 0 - ldrsb r0, [r3, r0] - cmp r0, 0 - ble _080DD388 - ldr r0, [r1] - ldrb r0, [r0, 0x13] - lsls r0, 24 - asrs r0, 24 - movs r1, 0 - ldrsb r1, [r3, r1] - adds r0, r1 - cmp r0, 0x4 - ble _080DD384 - movs r0, 0x3C - b _080DD38A - .pool -_080DD384: - movs r0, 0xA - b _080DD38A -_080DD388: - movs r0, 0 -_080DD38A: - strb r0, [r3, 0x2] - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3 - bl __umodsi3 - lsls r0, 24 - lsrs r0, 24 - movs r2, 0 - b _080DD3AE -_080DD3A2: - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 -_080DD3A8: - adds r2, 0x1 - cmp r2, 0x3 - bgt _080DD3B6 -_080DD3AE: - cmp r2, r6 - beq _080DD3A8 - cmp r0, 0 - bne _080DD3A2 -_080DD3B6: - ldr r0, =gContestResources - ldr r0, [r0] - ldr r1, [r0, 0x4] - subs r0, r7, r6 - lsls r0, 2 - adds r0, r1 - strb r2, [r0, 0x1B] -_080DD3C4: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DD080 - - thumb_func_start SetContestantEffectStringID -SetContestantEffectStringID: @ 80DD3D4 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gContestResources - ldr r2, [r2] - ldr r3, [r2, 0x4] - lsls r2, r0, 3 - subs r2, r0 - lsls r2, 2 - adds r2, r3 - strb r1, [r2, 0x13] - bx lr - .pool - thumb_func_end SetContestantEffectStringID - - thumb_func_start SetContestantEffectStringID2 -SetContestantEffectStringID2: @ 80DD3F0 - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gContestResources - ldr r2, [r2] - ldr r3, [r2, 0x4] - lsls r2, r0, 3 - subs r2, r0 - lsls r2, 2 - adds r2, r3 - strb r1, [r2, 0x14] - bx lr - .pool - thumb_func_end SetContestantEffectStringID2 - - thumb_func_start SetStartledString -SetStartledString: @ 80DD40C - push {lr} - lsls r0, 24 - lsrs r0, 24 - adds r3, r0, 0 - lsls r1, 24 - lsrs r1, 24 - adds r2, r1, 0 - cmp r1, 0x3B - bls _080DD426 - movs r1, 0x35 - bl SetContestantEffectStringID - b _080DD456 -_080DD426: - cmp r1, 0x27 - bls _080DD432 - movs r1, 0x34 - bl SetContestantEffectStringID - b _080DD456 -_080DD432: - cmp r1, 0x1D - bls _080DD43E - movs r1, 0x33 - bl SetContestantEffectStringID - b _080DD456 -_080DD43E: - cmp r1, 0x13 - bls _080DD44A - movs r1, 0x32 - bl SetContestantEffectStringID - b _080DD456 -_080DD44A: - cmp r2, 0x9 - bls _080DD456 - adds r0, r3, 0 - movs r1, 0x31 - bl SetContestantEffectStringID -_080DD456: - pop {r0} - bx r0 - thumb_func_end SetStartledString - - thumb_func_start sub_80DD45C -sub_80DD45C: @ 80DD45C - push {r4-r6,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r1, 24 - lsrs r6, r1, 24 - ldr r0, =gStringVar1 - lsls r1, r4, 6 - ldr r2, =gContestMons + 2 - adds r1, r2 - bl StringCopy - ldr r0, =gStringVar2 - ldr r5, =gContestResources - ldr r1, [r5] - ldr r2, [r1, 0x4] - lsls r1, r4, 3 - subs r1, r4 - 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 r3, =gContestMoves - ldr r1, [r5] - ldr r0, [r1, 0x8] - 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] - lsls r0, 3 - adds r0, r3 - ldrb r0, [r0, 0x1] - lsls r1, r0, 29 - cmp r1, 0 - bne _080DD4DC - ldr r0, =gStringVar3 - ldr r1, =gText_0827E837 - bl StringCopy - b _080DD52C - .pool -_080DD4DC: - lsrs r0, r1, 29 - cmp r0, 0x1 - bne _080DD4F4 - ldr r0, =gStringVar3 - ldr r1, =gText_0827E83F - bl StringCopy - b _080DD52C - .pool -_080DD4F4: - lsrs r0, r1, 29 - cmp r0, 0x2 - bne _080DD50C - ldr r0, =gStringVar3 - ldr r1, =gText_0827E847 - bl StringCopy - b _080DD52C - .pool -_080DD50C: - lsrs r0, r1, 29 - cmp r0, 0x3 - bne _080DD524 - ldr r0, =gStringVar3 - ldr r1, =gText_0827E850 - bl StringCopy - b _080DD52C - .pool -_080DD524: - ldr r0, =gStringVar3 - ldr r1, =gText_0827E85A - bl StringCopy -_080DD52C: - ldr r4, =gStringVar4 - ldr r1, =gUnknown_08587E10 - lsls r0, r6, 2 - adds r0, r1 - ldr r1, [r0] - adds r0, r4, 0 - bl StringExpandPlaceholders - bl sub_80DB89C - adds r0, r4, 0 - movs r1, 0x1 - bl Contest_StartTextPrinter - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DD45C - - thumb_func_start MakeContestantNervous -MakeContestantNervous: @ 80DD560 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gContestResources - ldr r1, [r4] - ldr r3, [r1, 0x4] - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r3, r1, r3 - ldrb r0, [r3, 0xC] - movs r2, 0x1 - orrs r0, r2 - strb r0, [r3, 0xC] - ldr r0, [r4] - ldr r0, [r0, 0x4] - adds r1, r0 - movs r0, 0 - strh r0, [r1, 0x6] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end MakeContestantNervous - - thumb_func_start sub_80DD590 -sub_80DD590: @ 80DD590 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x8 - movs r0, 0 - mov r12, r0 - movs r4, 0 - ldr r1, =gUnknown_02039F26 - mov r9, r1 - add r2, sp, 0x4 - mov r6, r9 - movs r5, 0 - adds r3, r2, 0 -_080DD5AC: - mov r0, sp - adds r1, r0, r4 - adds r0, r4, r6 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r3, r4 - strb r5, [r0] - adds r4, 0x1 - cmp r4, 0x3 - ble _080DD5AC - movs r4, 0 - ldr r7, =gContestResources - ldr r1, [r7] - mov r8, r1 - adds r5, r2, 0 -_080DD5CA: - movs r2, 0 - mov r0, r8 - ldr r1, [r0, 0x4] -_080DD5D0: - ldrb r0, [r1, 0x19] - cmp r0, r4 - beq _080DD604 - adds r1, 0x1C - adds r2, 0x1 - cmp r2, 0x3 - ble _080DD5D0 -_080DD5DE: - cmp r2, 0x4 - bne _080DD684 - movs r2, 0 - ldrb r0, [r5] - cmp r0, 0 - bne _080DD612 - ldr r0, [r7] - ldr r0, [r0, 0x4] - ldrb r0, [r0, 0x19] - cmp r0, 0xFF - bne _080DD612 - mov r12, r2 - movs r2, 0x1 - b _080DD63A - .pool -_080DD604: - mov r1, sp - adds r0, r1, r2 - strb r4, [r0] - adds r1, r5, r2 - movs r0, 0x1 - strb r0, [r1] - b _080DD5DE -_080DD612: - adds r2, 0x1 - cmp r2, 0x3 - bgt _080DD676 - adds r0, r5, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080DD612 - ldr r0, [r7] - ldr r1, [r0, 0x4] - lsls r0, r2, 3 - subs r0, r2 - lsls r0, 2 - adds r0, r1 - ldrb r0, [r0, 0x19] - cmp r0, 0xFF - bne _080DD612 - lsls r0, r2, 24 - lsrs r0, 24 - mov r12, r0 - adds r2, 0x1 -_080DD63A: - cmp r2, 0x3 - bgt _080DD676 - ldr r6, =gUnknown_02039F26 - lsls r0, r2, 3 - subs r0, r2 - lsls r3, r0, 2 -_080DD646: - adds r0, r5, r2 - ldrb r0, [r0] - cmp r0, 0 - bne _080DD66E - ldr r0, [r7] - ldr r0, [r0, 0x4] - adds r0, r3, r0 - ldrb r0, [r0, 0x19] - cmp r0, 0xFF - bne _080DD66E - mov r1, r12 - adds r0, r1, r6 - adds r1, r2, r6 - ldrb r0, [r0] - ldrb r1, [r1] - cmp r0, r1 - bls _080DD66E - lsls r0, r2, 24 - lsrs r0, 24 - mov r12, r0 -_080DD66E: - adds r3, 0x1C - adds r2, 0x1 - cmp r2, 0x3 - ble _080DD646 -_080DD676: - mov r0, sp - add r0, r12 - strb r4, [r0] - mov r0, r12 - adds r1, r5, r0 - movs r0, 0x1 - strb r0, [r1] -_080DD684: - adds r4, 0x1 - cmp r4, 0x3 - ble _080DD5CA - movs r4, 0 - ldr r6, =gContestResources - movs r5, 0 -_080DD690: - ldr r0, [r6] - ldr r1, [r0, 0x8] - adds r1, r4 - mov r0, sp - adds r3, r0, r4 - ldrb r0, [r3] - strb r0, [r1] - ldr r0, [r6] - ldr r0, [r0, 0x4] - adds r0, r5, r0 - movs r1, 0xFF - strb r1, [r0, 0x19] - ldr r0, [r6] - ldr r1, [r0, 0x4] - adds r1, r5, r1 - ldrb r2, [r1, 0x10] - movs r0, 0x3F - ands r0, r2 - strb r0, [r1, 0x10] - mov r0, r9 - adds r1, r4, r0 - ldrb r0, [r3] - strb r0, [r1] - adds r5, 0x1C - adds r4, 0x1 - cmp r4, 0x3 - ble _080DD690 - add sp, 0x8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DD590 - - thumb_func_start sub_80DD6DC -sub_80DD6DC: @ 80DD6DC - push {lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x30] - adds r1, r0, 0x1 - strh r1, [r2, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x54 - ble _080DD712 - movs r0, 0 - strh r0, [r2, 0x30] - adds r3, r2, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r3] - ldr r0, =SpriteCallbackDummy - str r0, [r2, 0x1C] - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0] - ldrb r1, [r2, 0x6] - movs r0, 0x11 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x6] -_080DD712: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DD6DC - - thumb_func_start sub_80DD720 -sub_80DD720: @ 80DD720 - push {r4,r5,lr} - lsls r0, 24 - lsrs r1, r0, 24 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0] - ldrb r5, [r0, 0x12] - cmp r1, 0x8 - bls _080DD734 - b _080DD8D4 -_080DD734: - lsls r0, r1, 2 - ldr r1, =_080DD748 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080DD748: - .4byte _080DD76C - .4byte _080DD76C - .4byte _080DD79C - .4byte _080DD7D0 - .4byte _080DD804 - .4byte _080DD838 - .4byte _080DD86C - .4byte _080DD8D4 - .4byte _080DD8A0 -_080DD76C: - ldr r0, =gSprites - lsls r4, r5, 4 - adds r1, r4, r5 - lsls r1, 2 - adds r1, r0 - ldrh r0, [r1, 0x2E] - ldr r2, =0x000003ff - ands r2, r0 - ldrh r3, [r1, 0x4] - ldr r0, =0xfffffc00 - ands r0, r3 - orrs r0, r2 - strh r0, [r1, 0x4] - movs r0, 0x20 - bl PlaySE - b _080DD8F8 - .pool -_080DD79C: - ldr r0, =gSprites - lsls r4, r5, 4 - adds r1, r4, r5 - lsls r1, 2 - adds r1, r0 - ldrh r2, [r1, 0x2E] - adds r2, 0x4 - ldr r3, =0x000003ff - adds r0, r3, 0 - ands r2, r0 - ldrh r3, [r1, 0x4] - ldr r0, =0xfffffc00 - ands r0, r3 - orrs r0, r2 - strh r0, [r1, 0x4] - movs r0, 0x1F - bl PlaySE - b _080DD8F8 - .pool -_080DD7D0: - ldr r0, =gSprites - lsls r4, r5, 4 - adds r1, r4, r5 - lsls r1, 2 - adds r1, r0 - ldrh r2, [r1, 0x2E] - adds r2, 0x8 - ldr r3, =0x000003ff - adds r0, r3, 0 - ands r2, r0 - ldrh r3, [r1, 0x4] - ldr r0, =0xfffffc00 - ands r0, r3 - orrs r0, r2 - strh r0, [r1, 0x4] - movs r0, 0x1F - bl PlaySE - b _080DD8F8 - .pool -_080DD804: - ldr r0, =gSprites - lsls r4, r5, 4 - adds r1, r4, r5 - lsls r1, 2 - adds r1, r0 - ldrh r2, [r1, 0x2E] - adds r2, 0xC - ldr r3, =0x000003ff - adds r0, r3, 0 - ands r2, r0 - ldrh r3, [r1, 0x4] - ldr r0, =0xfffffc00 - ands r0, r3 - orrs r0, r2 - strh r0, [r1, 0x4] - movs r0, 0x2D - bl PlaySE - b _080DD8F8 - .pool -_080DD838: - ldr r0, =gSprites - lsls r4, r5, 4 - adds r1, r4, r5 - lsls r1, 2 - adds r1, r0 - ldrh r2, [r1, 0x2E] - adds r2, 0xC - ldr r3, =0x000003ff - adds r0, r3, 0 - ands r2, r0 - ldrh r3, [r1, 0x4] - ldr r0, =0xfffffc00 - ands r0, r3 - orrs r0, r2 - strh r0, [r1, 0x4] - movs r0, 0x2D - bl PlaySE - b _080DD8F8 - .pool -_080DD86C: - ldr r0, =gSprites - lsls r4, r5, 4 - adds r1, r4, r5 - lsls r1, 2 - adds r1, r0 - ldrh r2, [r1, 0x2E] - adds r2, 0x10 - ldr r3, =0x000003ff - adds r0, r3, 0 - ands r2, r0 - ldrh r3, [r1, 0x4] - ldr r0, =0xfffffc00 - ands r0, r3 - orrs r0, r2 - strh r0, [r1, 0x4] - movs r0, 0x2D - bl PlaySE - b _080DD8F8 - .pool -_080DD8A0: - ldr r0, =gSprites - lsls r4, r5, 4 - adds r1, r4, r5 - lsls r1, 2 - adds r1, r0 - ldrh r2, [r1, 0x2E] - adds r2, 0x18 - ldr r3, =0x000003ff - adds r0, r3, 0 - ands r2, r0 - ldrh r3, [r1, 0x4] - ldr r0, =0xfffffc00 - ands r0, r3 - orrs r0, r2 - strh r0, [r1, 0x4] - movs r0, 0xC3 - bl PlaySE - b _080DD8F8 - .pool -_080DD8D4: - ldr r0, =gSprites - lsls r4, r5, 4 - adds r1, r4, r5 - lsls r1, 2 - adds r1, r0 - ldrh r2, [r1, 0x2E] - adds r2, 0x14 - ldr r3, =0x000003ff - adds r0, r3, 0 - ands r2, r0 - ldrh r3, [r1, 0x4] - ldr r0, =0xfffffc00 - ands r0, r3 - orrs r0, r2 - strh r0, [r1, 0x4] - movs r0, 0x2D - bl PlaySE -_080DD8F8: - adds r2, r4, 0 - ldr r4, =gSprites - adds r2, r5 - lsls r2, 2 - adds r1, r2, r4 - movs r0, 0 - strh r0, [r1, 0x30] - adds r1, 0x3E - ldrb r3, [r1] - subs r0, 0x5 - ands r0, r3 - strb r0, [r1] - adds r4, 0x1C - adds r2, r4 - ldr r0, =sub_80DD6DC - str r0, [r2] - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0] - ldrb r0, [r2, 0x6] - movs r1, 0x10 - orrs r0, r1 - strb r0, [r2, 0x6] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DD720 - - thumb_func_start sub_80DD940 -sub_80DD940: @ 80DD940 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - movs r5, 0 - ldr r6, =gContestResources - ldr r0, =gSprites - mov r9, r0 - ldr r0, =0x06010000 - mov r8, r0 - ldr r7, =0x04000008 -_080DD956: - ldr r0, [r6] - ldr r1, [r0] - movs r0, 0x13 - ldrsb r0, [r1, r0] - ldr r4, =gContestApplauseMeterGfx - cmp r5, r0 - bge _080DD966 - adds r4, 0x40 -_080DD966: - adds r0, r1, 0 - adds r0, 0x58 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r9 - ldrh r1, [r0, 0x4] - lsls r1, 22 - lsrs r1, 22 - adds r0, r5, 0 - adds r0, 0x11 - adds r1, r0 - lsls r1, 5 - add r1, r8 - adds r0, r4, 0 - adds r2, r7, 0 - bl CpuSet - adds r0, r4, 0 - adds r0, 0x20 - ldr r1, [r6] - ldr r1, [r1] - adds r1, 0x58 - ldrb r2, [r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - add r1, r9 - ldrh r1, [r1, 0x4] - lsls r1, 22 - lsrs r1, 22 - adds r2, r5, 0 - adds r2, 0x19 - adds r1, r2 - lsls r1, 5 - add r1, r8 - adds r2, r7, 0 - bl CpuSet - ldr r0, [r6] - ldr r0, [r0] - ldrb r0, [r0, 0x13] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x4 - ble _080DD9C8 - bl sub_80DDA20 -_080DD9C8: - adds r5, 0x1 - cmp r5, 0x4 - ble _080DD956 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DD940 - - thumb_func_start Contest_GetMoveExcitement -Contest_GetMoveExcitement: @ 80DD9F0 - lsls r0, 16 - ldr r3, =gUnknown_085899EC - ldr r1, =gContestMoves - lsrs r0, 13 - adds r0, r1 - ldrb r1, [r0, 0x1] - lsls r1, 29 - lsrs r1, 29 - ldr r0, =gSpecialVar_ContestCategory - ldrh r2, [r0] - lsls r0, r2, 2 - adds r0, r2 - adds r1, r0 - adds r1, r3 - movs r0, 0 - ldrsb r0, [r1, r0] - bx lr - .pool - thumb_func_end Contest_GetMoveExcitement - - thumb_func_start sub_80DDA20 -sub_80DDA20: @ 80DDA20 - push {r4,r5,lr} - ldr r0, =c3_08130B10 - movs r1, 0xA - bl CreateTask - adds r5, r0, 0 - lsls r5, 24 - lsrs r5, 24 - ldr r0, =gTasks - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - adds r4, r0 - movs r0, 0x1 - strh r0, [r4, 0xA] - ldr r0, =0x0000abe2 - bl IndexOfSpritePaletteTag - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0xC] - adds r0, r5, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80DDA20 - - thumb_func_start c3_08130B10 -c3_08130B10: @ 80DDA60 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r2, r0, r1 - ldrh r0, [r2, 0x8] - adds r0, 0x1 - strh r0, [r2, 0x8] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - bne _080DDAFE - movs r0, 0 - strh r0, [r2, 0x8] - movs r3, 0xE - ldrsh r0, [r2, r3] - cmp r0, 0 - bne _080DDA94 - ldrh r0, [r2, 0x10] - adds r0, 0x1 - b _080DDA98 - .pool -_080DDA94: - ldrh r0, [r2, 0x10] - subs r0, 0x1 -_080DDA98: - strh r0, [r2, 0x10] - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - movs r1, 0xC - ldrsh r0, [r4, r1] - lsls r0, 4 - movs r3, 0x84 - lsls r3, 1 - adds r6, r3, 0 - adds r0, r6 - lsls r0, 16 - lsrs r0, 16 - ldrb r2, [r4, 0x10] - ldr r3, =0x00007fff - movs r1, 0x1 - bl BlendPalette - movs r1, 0x10 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _080DDACA - cmp r0, 0x10 - bne _080DDAFE -_080DDACA: - ldrh r0, [r4, 0xE] - movs r1, 0x1 - eors r0, r1 - strh r0, [r4, 0xE] - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0] - ldrb r0, [r0, 0x13] - lsls r0, 24 - asrs r0, 24 - cmp r0, 0x4 - bgt _080DDAFE - movs r3, 0xC - ldrsh r0, [r4, r3] - lsls r0, 4 - adds r0, r6 - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1 - movs r2, 0 - movs r3, 0x1F - bl BlendPalette - adds r0, r5, 0 - bl DestroyTask -_080DDAFE: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end c3_08130B10 - - thumb_func_start sub_80DDB0C -sub_80DDB0C: @ 80DDB0C - push {r4,lr} - ldr r0, =sub_80DDB6C - movs r1, 0xA - bl CreateTask - ldr r3, =gSprites - ldr r4, =gContestResources - ldr r2, [r4] - ldr r0, [r2] - adds r0, 0x58 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldr r1, =0x0000ffba - strh r1, [r0, 0x24] - ldr r0, [r2] - adds r0, 0x58 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - ldr r0, [r4] - ldr r2, [r0] - ldrb r0, [r2, 0x6] - movs r1, 0x40 - orrs r0, r1 - strb r0, [r2, 0x6] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DDB0C - - thumb_func_start sub_80DDB6C -sub_80DDB6C: @ 80DDB6C - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - adds r3, r0, 0 - ldr r4, =gContestResources - ldr r0, [r4] - ldr r0, [r0] - adds r0, 0x58 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r2, r0, r1 - ldr r0, =gTasks - lsls r1, r3, 2 - adds r1, r3 - lsls r1, 3 - adds r1, r0 - movs r5, 0xD0 - lsls r5, 3 - adds r0, r5, 0 - ldrh r5, [r1, 0x1C] - adds r0, r5 - strh r0, [r1, 0x1C] - lsls r0, 16 - asrs r0, 24 - ldrh r5, [r2, 0x24] - adds r0, r5 - strh r0, [r2, 0x24] - ldrb r0, [r1, 0x1C] - strh r0, [r1, 0x1C] - movs r1, 0x24 - ldrsh r0, [r2, r1] - cmp r0, 0 - ble _080DDBB8 - movs r0, 0 - strh r0, [r2, 0x24] -_080DDBB8: - movs r5, 0x24 - ldrsh r0, [r2, r5] - cmp r0, 0 - bne _080DDBD4 - ldr r0, [r4] - ldr r2, [r0] - ldrb r1, [r2, 0x6] - movs r0, 0x41 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x6] - adds r0, r3, 0 - bl DestroyTask -_080DDBD4: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DDB6C - - thumb_func_start sub_80DDBE8 -sub_80DDBE8: @ 80DDBE8 - push {r4,r5,lr} - ldr r5, =gSprites - ldr r4, =gContestResources - ldr r0, [r4] - ldr r2, [r0] - adds r0, r2, 0 - adds r0, 0x58 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3E - ldrb r0, [r0] - lsls r0, 29 - cmp r0, 0 - bge _080DDC1C - ldrb r1, [r2, 0x6] - movs r0, 0x41 - negs r0, r0 - ands r0, r1 - b _080DDC40 - .pool -_080DDC1C: - ldr r0, =task08_080CD1CC - movs r1, 0xA - bl CreateTask - ldr r2, [r4] - ldr r0, [r2] - adds r0, 0x58 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - movs r1, 0 - strh r1, [r0, 0x24] - ldr r2, [r2] - ldrb r0, [r2, 0x6] - movs r1, 0x40 - orrs r0, r1 -_080DDC40: - strb r0, [r2, 0x6] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DDBE8 - - thumb_func_start task08_080CD1CC -task08_080CD1CC: @ 80DDC4C - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - adds r4, r0, 0 - ldr r5, =gContestResources - ldr r0, [r5] - ldr r0, [r0] - adds r0, 0x58 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r3, r0, r1 - ldr r0, =gTasks - lsls r2, r4, 2 - adds r2, r4 - lsls r2, 3 - adds r2, r0 - movs r1, 0xD0 - lsls r1, 3 - adds r0, r1, 0 - ldrh r1, [r2, 0x1C] - adds r0, r1 - strh r0, [r2, 0x1C] - lsls r0, 16 - asrs r0, 24 - ldrh r1, [r3, 0x24] - subs r1, r0 - strh r1, [r3, 0x24] - ldrb r0, [r2, 0x1C] - strh r0, [r2, 0x1C] - movs r2, 0x24 - ldrsh r0, [r3, r2] - movs r1, 0x46 - negs r1, r1 - cmp r0, r1 - bge _080DDC9C - ldr r0, =0x0000ffba - strh r0, [r3, 0x24] -_080DDC9C: - movs r2, 0x24 - ldrsh r0, [r3, r2] - cmp r0, r1 - bne _080DDCC4 - adds r2, r3, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - ldr r0, [r5] - ldr r2, [r0] - ldrb r1, [r2, 0x6] - movs r0, 0x41 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x6] - adds r0, r4, 0 - bl DestroyTask -_080DDCC4: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end task08_080CD1CC - - thumb_func_start sub_80DDCDC -sub_80DDCDC: @ 80DDCDC - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =sub_80DDD20 - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - lsls r4, 24 - asrs r4, 24 - strh r4, [r1, 0x8] - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0] - ldrb r0, [r2, 0x6] - movs r1, 0x20 - orrs r0, r1 - strb r0, [r2, 0x6] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DDCDC - - thumb_func_start sub_80DDD20 -sub_80DDD20: @ 80DDD20 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - movs r1, 0x1C - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _080DDD54 - cmp r0, 0x1 - bgt _080DDD48 - cmp r0, 0 - beq _080DDD4E - b _080DDD9C - .pool -_080DDD48: - cmp r0, 0x2 - beq _080DDD70 - b _080DDD9C -_080DDD4E: - bl sub_80DDB0C - b _080DDD64 -_080DDD54: - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0] - ldrb r1, [r0, 0x6] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _080DDD9C -_080DDD64: - ldrh r0, [r4, 0x1C] - adds r0, 0x1 - strh r0, [r4, 0x1C] - b _080DDD9C - .pool -_080DDD70: - ldrh r0, [r4, 0x1E] - adds r1, r0, 0x1 - strh r1, [r4, 0x1E] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x14 - ble _080DDD9C - movs r0, 0 - strh r0, [r4, 0x1E] - bl sub_80DD940 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0] - ldrb r1, [r2, 0x6] - movs r0, 0x21 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x6] - adds r0, r5, 0 - bl DestroyTask -_080DDD9C: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DDD20 - - thumb_func_start sub_80DDDA8 -sub_80DDDA8: @ 80DDDA8 - ldr r3, =gSprites - ldr r0, =gContestResources - ldr r2, [r0] - ldr r0, [r2] - adds r0, 0x58 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - movs r1, 0 - strh r1, [r0, 0x24] - ldr r0, [r2] - adds r0, 0x58 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - bx lr - .pool - thumb_func_end sub_80DDDA8 - - thumb_func_start sub_80DDDE4 -sub_80DDDE4: @ 80DDDE4 - ldr r2, =gSprites - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0] - adds r0, 0x58 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - bx lr - .pool - thumb_func_end sub_80DDDE4 - - thumb_func_start sub_80DDE0C -sub_80DDE0C: @ 80DDE0C - push {lr} - ldr r0, =sub_80DDE30 - movs r1, 0xF - bl CreateTask - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0] - ldrb r0, [r2, 0x6] - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2, 0x6] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DDE0C - - thumb_func_start sub_80DDE30 -sub_80DDE30: @ 80DDE30 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - ldrh r0, [r4, 0x1C] - adds r1, r0, 0x1 - strh r1, [r4, 0x1C] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x6 - ble _080DDEBA - movs r0, 0 - strh r0, [r4, 0x1C] - movs r1, 0x1E - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _080DDE78 - ldr r0, =gHeap+0x19000 - ldr r1, =0x06002000 - movs r2, 0x80 - lsls r2, 5 - movs r3, 0x1 - bl RequestDma3Copy - b _080DDE8C - .pool -_080DDE78: - ldr r0, =gHeap+0x18000 - ldr r1, =0x06002000 - movs r2, 0x80 - lsls r2, 5 - movs r3, 0x1 - bl RequestDma3Copy - ldrh r0, [r4, 0x20] - adds r0, 0x1 - strh r0, [r4, 0x20] -_080DDE8C: - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x1E] - movs r2, 0x1 - eors r1, r2 - strh r1, [r0, 0x1E] - movs r1, 0x20 - ldrsh r0, [r0, r1] - cmp r0, 0x9 - bne _080DDEBA - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0] - ldrb r1, [r2, 0x6] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2, 0x6] - adds r0, r5, 0 - bl DestroyTask -_080DDEBA: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DDE30 - - thumb_func_start sub_80DDED0 -sub_80DDED0: @ 80DDED0 - push {r4-r7,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r1, 24 - lsrs r5, r1, 24 - ldr r0, =sub_80DDF80 - movs r1, 0xA - bl CreateTask - lsls r0, 24 - lsrs r6, r0, 24 - lsls r4, 24 - cmp r4, 0 - ble _080DDF38 - ldr r7, =0x0000237e - lsls r0, r5, 24 - adds r4, r0, 0 - cmp r4, 0 - ble _080DDF1C - movs r5, 0 - ldr r2, =gContestResources - ldr r0, [r2] - ldr r0, [r0] - movs r1, 0x13 - ldrsb r1, [r0, r1] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 24 - lsrs r3, r0, 24 - b _080DDF4E - .pool -_080DDF1C: - ldr r2, =gContestResources - ldr r0, [r2] - ldr r0, [r0] - movs r1, 0x13 - ldrsb r1, [r0, r1] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 24 - lsrs r5, r0, 24 - movs r3, 0 - b _080DDF4E - .pool -_080DDF38: - movs r7, 0 - lsls r0, r5, 24 - adds r4, r0, 0 - cmp r4, 0 - ble _080DDF48 - movs r5, 0 - movs r3, 0xC - b _080DDF4C -_080DDF48: - movs r5, 0xC - movs r3, 0 -_080DDF4C: - ldr r2, =gContestResources -_080DDF4E: - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - strh r7, [r0, 0x8] - strh r5, [r0, 0xA] - asrs r1, r4, 24 - strh r1, [r0, 0xC] - strh r3, [r0, 0xE] - ldr r0, [r2] - ldr r2, [r0] - ldrb r1, [r2, 0x7] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x7] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DDED0 - - thumb_func_start sub_80DDF80 -sub_80DDF80: @ 80DDF80 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r2, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r3, r0, r2 - ldrh r0, [r3, 0x1C] - adds r1, r0, 0x1 - strh r1, [r3, 0x1C] - lsls r0, 16 - cmp r0, 0 - blt _080DDFFC - movs r0, 0 - strh r0, [r3, 0x1C] - movs r1, 0xC - ldrsh r0, [r3, r1] - cmp r0, 0 - ble _080DDFB4 - ldrh r0, [r3, 0xA] - adds r0, 0x1 - b _080DDFB8 - .pool -_080DDFB4: - ldrh r0, [r3, 0xA] - subs r0, 0x1 -_080DDFB8: - strh r0, [r3, 0xA] - lsls r4, r5, 2 - adds r4, r5 - lsls r4, 3 - adds r4, r2 - ldrb r2, [r4, 0xA] - ldrh r3, [r4, 0x8] - movs r0, 0x11 - movs r1, 0x1 - bl BlendPalette - ldrb r2, [r4, 0xA] - ldrh r3, [r4, 0x8] - movs r0, 0x1A - movs r1, 0x1 - bl BlendPalette - movs r2, 0xA - ldrsh r1, [r4, r2] - movs r2, 0xE - ldrsh r0, [r4, r2] - cmp r1, r0 - bne _080DDFFC - adds r0, r5, 0 - bl DestroyTask - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0] - ldrb r1, [r2, 0x7] - movs r0, 0x2 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x7] -_080DDFFC: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DDF80 - - thumb_func_start sub_80DE008 -sub_80DE008: @ 80DE008 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - movs r5, 0 - ldr r0, =gContestResources - mov r9, r0 - mov r8, r9 - ldr r6, =gSprites - movs r4, 0 - movs r7, 0 -_080DE026: - mov r1, r8 - ldr r0, [r1] - ldr r0, [r0, 0x4] - adds r0, r7, r0 - ldrb r1, [r0, 0x10] - movs r0, 0xC0 - ands r0, r1 - cmp r0, 0 - beq _080DE0BC - mov r2, r10 - cmp r2, 0 - beq _080DE0BC - lsls r0, r5, 24 - lsrs r0, 24 - bl sub_80DE0F0 - mov r3, r8 - ldr r1, [r3] - ldr r1, [r1, 0x14] - adds r1, r4, r1 - ldrb r2, [r1, 0x1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - adds r1, r6 - ldrh r1, [r1, 0x4] - lsls r1, 22 - lsrs r1, 17 - ldr r2, =0x060100c0 - adds r1, r2 - ldr r2, =0x04000008 - bl CpuSet - mov r0, r8 - ldr r3, [r0] - ldr r0, [r3, 0x14] - adds r0, r4, r0 - ldrb r0, [r0, 0x1] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - ldr r2, =gUnknown_08587A70 - ldr r0, =gUnknown_02039F26 - adds r0, r5, r0 - ldrb r0, [r0] - adds r0, r2 - ldrb r0, [r0] - strh r0, [r1, 0x22] - ldr r0, [r3, 0x14] - adds r0, r4, r0 - ldrb r1, [r0, 0x1] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r0, 0x3E - ldrb r1, [r0] - movs r3, 0x5 - negs r3, r3 - adds r2, r3, 0 - ands r1, r2 - b _080DE0D6 - .pool -_080DE0BC: - mov r1, r9 - ldr r0, [r1] - ldr r0, [r0, 0x14] - adds r0, r4, r0 - ldrb r1, [r0, 0x1] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 -_080DE0D6: - strb r1, [r0] - adds r4, 0x4 - adds r7, 0x1C - adds r5, 0x1 - cmp r5, 0x3 - ble _080DE026 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80DE008 - - thumb_func_start sub_80DE0F0 -sub_80DE0F0: @ 80DE0F0 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gContestResources - ldr r1, [r1] - ldr r2, [r1, 0x4] - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r2, r1, r2 - ldrb r1, [r2, 0x10] - movs r0, 0xC0 - ands r0, r1 - cmp r0, 0x40 - bne _080DE120 - ldrb r0, [r2, 0x19] - lsls r0, 5 - ldr r1, =gUnknown_08D8E9B4 - adds r0, r1 - b _080DE122 - .pool -_080DE120: - ldr r0, =gUnknown_08D8EA34 -_080DE122: - pop {r1} - bx r1 - .pool - thumb_func_end sub_80DE0F0 - - thumb_func_start sub_80DE12C -sub_80DE12C: @ 80DE12C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x10 - movs r7, 0 - movs r0, 0x2 - mov r10, r0 - movs r0, 0x1 - mov r8, r0 - movs r0, 0x11 - mov r9, r0 -_080DE146: - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0, 0x8] - adds r0, 0xD - adds r0, r7 - ldrb r0, [r0] - cmp r0, 0 - beq _080DE1CA - lsls r0, r7, 24 - lsrs r0, 24 - bl Contest_IsMonsTurnDisabled - lsls r0, 24 - cmp r0, 0 - bne _080DE1CA - ldr r0, =gUnknown_02039F26 - adds r0, r7, r0 - ldrb r0, [r0] - lsls r5, r0, 2 - adds r5, r0 - adds r6, r5, 0x2 - movs r0, 0x3 - bl sub_80DB748 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - lsls r6, 24 - lsrs r6, 24 - mov r0, r10 - str r0, [sp] - mov r0, r8 - str r0, [sp, 0x4] - mov r0, r9 - str r0, [sp, 0x8] - mov r0, r8 - str r0, [sp, 0xC] - movs r0, 0 - adds r1, r4, 0 - movs r2, 0x14 - adds r3, r6, 0 - bl ContestBG_FillBoxWithIncrementingTile - adds r4, 0x10 - lsls r4, 16 - lsrs r4, 16 - adds r5, 0x3 - lsls r5, 24 - lsrs r5, 24 - mov r0, r10 - str r0, [sp] - mov r0, r8 - str r0, [sp, 0x4] - mov r0, r9 - str r0, [sp, 0x8] - mov r0, r8 - str r0, [sp, 0xC] - movs r0, 0 - adds r1, r4, 0 - movs r2, 0x14 - adds r3, r5, 0 - bl ContestBG_FillBoxWithIncrementingTile - movs r0, 0x63 - bl PlaySE -_080DE1CA: - adds r7, 0x1 - cmp r7, 0x3 - ble _080DE146 - add sp, 0x10 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DE12C - - thumb_func_start sub_80DE1E8 -sub_80DE1E8: @ 80DE1E8 - push {lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gContestResources - ldr r1, [r1] - ldr r2, [r1, 0x4] - lsls r1, r0, 3 - subs r1, r0 - lsls r1, 2 - adds r2, r1, r2 - ldrb r1, [r2, 0x15] - movs r3, 0x1 - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - bne _080DE212 - ldrb r1, [r2, 0xC] - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _080DE21C -_080DE212: - movs r0, 0 - b _080DE21E - .pool -_080DE21C: - movs r0, 0x1 -_080DE21E: - pop {r1} - bx r1 - thumb_func_end sub_80DE1E8 - - thumb_func_start sub_80DE224 -sub_80DE224: @ 80DE224 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - movs r0, 0xA - bl GetGpuReg - mov r1, sp - strh r0, [r1] - mov r2, sp - ldrb r1, [r2] - movs r4, 0x4 - negs r4, r4 - adds r0, r4, 0 - ands r0, r1 - strb r0, [r2] - ldrb r1, [r2, 0x1] - movs r0, 0x3F - ands r0, r1 - movs r1, 0x80 - orrs r0, r1 - strb r0, [r2, 0x1] - ldrb r1, [r2, 0x1] - movs r0, 0x21 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x1] - ldrb r1, [r2] - movs r0, 0xD - negs r0, r0 - mov r8, r0 - ands r0, r1 - strb r0, [r2] - mov r0, sp - ldrh r1, [r0] - movs r0, 0xA - bl SetGpuReg - movs r0, 0x8 - bl GetGpuReg - mov r6, sp - adds r6, 0x2 - strh r0, [r6] - movs r0, 0xC - bl GetGpuReg - add r5, sp, 0x4 - strh r0, [r5] - ldrb r1, [r6] - adds r0, r4, 0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r6] - ldrb r0, [r5] - ands r4, r0 - orrs r4, r1 - strb r4, [r5] - ldrh r1, [r6] - movs r0, 0x8 - bl SetGpuReg - ldrh r1, [r5] - movs r0, 0xC - bl SetGpuReg - ldr r1, =gBattle_BG1_X - movs r0, 0xF0 - strh r0, [r1] - ldr r4, =gBattle_BG1_Y - movs r0, 0xA0 - strh r0, [r4] - movs r0, 0x14 - movs r1, 0xF0 - bl SetGpuReg - ldrh r1, [r4] - movs r0, 0x16 - bl SetGpuReg - movs r0, 0 - str r0, [sp, 0x8] - add r0, sp, 0x8 - ldr r4, =gContestResources - ldr r1, [r4] - ldr r1, [r1, 0x28] - ldr r2, =0x05000400 - bl CpuSet - ldr r1, =gUnknown_08C17980 - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - movs r0, 0x1 - bl Contest_SetBgCopyFlags - movs r5, 0 - ldr r7, =gSprites - movs r6, 0x4 -_080DE2F0: - ldr r0, [r4] - ldr r0, [r0, 0x14] - lsls r3, r5, 2 - adds r0, r3, r0 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r7 - ldrb r2, [r1, 0x5] - mov r0, r8 - ands r0, r2 - orrs r0, r6 - strb r0, [r1, 0x5] - ldr r0, [r4] - ldr r0, [r0, 0x14] - adds r3, r0 - ldrb r0, [r3, 0x1] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r7 - ldrb r2, [r1, 0x5] - mov r0, r8 - ands r0, r2 - orrs r0, r6 - strb r0, [r1, 0x5] - adds r5, 0x1 - cmp r5, 0x3 - ble _080DE2F0 - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DE224 - - thumb_func_start sub_80DE350 -sub_80DE350: @ 80DE350 - push {r4-r7,lr} - sub sp, 0x8 - ldr r1, =0x06008000 - movs r2, 0x80 - lsls r2, 6 - movs r0, 0 - movs r3, 0x1 - bl RequestDma3Fill - movs r5, 0 - str r5, [sp] - ldr r6, =gContestResources - ldr r0, [r6] - ldr r1, [r0, 0x28] - ldr r2, =0x05000400 - mov r0, sp - bl CpuSet - movs r0, 0x1 - bl Contest_SetBgCopyFlags - movs r0, 0xA - bl GetGpuReg - add r3, sp, 0x4 - strh r0, [r3] - ldrb r1, [r3] - movs r0, 0x4 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r3] - mov r1, sp - adds r1, 0x5 - ldrb r2, [r1] - movs r0, 0x3F - ands r0, r2 - strb r0, [r1] - ldrb r2, [r1] - movs r0, 0x21 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldrb r1, [r3] - movs r4, 0xD - negs r4, r4 - adds r0, r4, 0 - ands r0, r1 - movs r1, 0x8 - orrs r0, r1 - strb r0, [r3] - ldrh r1, [r3] - movs r0, 0xA - bl SetGpuReg - ldr r0, =gBattle_BG1_X - strh r5, [r0] - ldr r0, =gBattle_BG1_Y - strh r5, [r0] - ldr r7, =gSprites -_080DE3CA: - ldr r0, [r6] - ldr r0, [r0, 0x14] - lsls r3, r5, 2 - adds r0, r3, r0 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r7 - ldrb r2, [r1, 0x5] - adds r0, r4, 0 - ands r0, r2 - strb r0, [r1, 0x5] - ldr r0, [r6] - ldr r0, [r0, 0x14] - adds r3, r0 - ldrb r0, [r3, 0x1] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r7 - ldrb r2, [r1, 0x5] - adds r0, r4, 0 - ands r0, r2 - strb r0, [r1, 0x5] - adds r5, 0x1 - cmp r5, 0x3 - ble _080DE3CA - add sp, 0x8 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DE350 - - thumb_func_start sub_80DE424 -sub_80DE424: @ 80DE424 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r1, =gBattle_BG1_X - movs r0, 0 - strh r0, [r1] - ldr r1, =gBattle_BG1_Y - movs r0, 0xA0 - strh r0, [r1] - movs r0, 0x62 - movs r1, 0 - bl PlaySE12WithPanning - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_80DE464 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DE424 - - thumb_func_start sub_80DE464 -sub_80DE464: @ 80DE464 - push {lr} - lsls r0, 24 - lsrs r3, r0, 24 - ldr r1, =gBattle_BG1_Y - ldrh r0, [r1] - subs r0, 0x7 - strh r0, [r1] - lsls r0, 16 - cmp r0, 0 - bge _080DE47C - movs r0, 0 - strh r0, [r1] -_080DE47C: - ldrh r2, [r1] - cmp r2, 0 - bne _080DE496 - ldr r0, =gTasks - lsls r1, r3, 2 - adds r1, r3 - lsls r1, 3 - adds r1, r0 - strh r2, [r1, 0x8] - strh r2, [r1, 0xA] - strh r2, [r1, 0xC] - ldr r0, =sub_80DE4A8 - str r0, [r1] -_080DE496: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DE464 - - thumb_func_start sub_80DE4A8 -sub_80DE4A8: @ 80DE4A8 - push {r4-r6,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gTasks - lsls r3, r4, 2 - adds r0, r3, r4 - lsls r0, 3 - adds r5, r0, r1 - movs r0, 0x8 - ldrsh r1, [r5, r0] - cmp r1, 0x1 - beq _080DE52C - cmp r1, 0x1 - bgt _080DE4D0 - cmp r1, 0 - beq _080DE4DA - b _080DE5B4 - .pool -_080DE4D0: - cmp r1, 0x2 - beq _080DE58A - cmp r1, 0x3 - beq _080DE5A4 - b _080DE5B4 -_080DE4DA: - movs r2, 0 - adds r6, r3, 0 - ldr r5, =gContestResources - ldr r3, =gUnknown_02039F26 -_080DE4E2: - ldr r0, [r5] - ldr r1, [r0] - adds r1, 0x14 - adds r1, r2 - adds r0, r2, r3 - ldrb r0, [r0] - strb r0, [r1] - adds r2, 0x1 - cmp r2, 0x3 - ble _080DE4E2 - bl sub_80DBF90 - bl sub_80DC864 - bl sub_80DB69C - bl sub_80DD04C - movs r0, 0x1 - bl sub_80DE008 - bl sub_80DC44C - ldr r0, =gTasks - adds r1, r6, r4 - lsls r1, 3 - adds r1, r0 - movs r0, 0x1 - strh r0, [r1, 0x8] - b _080DE5B4 - .pool -_080DE52C: - ldr r0, =gIsLinkContest - ldrb r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _080DE584 - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0] - ldrb r0, [r2, 0x7] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2, 0x7] - bl sub_80DA8A4 - lsls r0, 24 - cmp r0, 0 - beq _080DE552 - bl sub_80DBAA0 -_080DE552: - 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 - movs r0, 0x2 - strh r0, [r5, 0x8] - b _080DE5B4 - .pool -_080DE584: - bl sub_80DBAA0 - b _080DE59A -_080DE58A: - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0] - ldrb r1, [r0, 0x7] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - bne _080DE5B4 -_080DE59A: - movs r0, 0x3 - strh r0, [r5, 0x8] - b _080DE5B4 - .pool -_080DE5A4: - bl sub_80DB884 - bl sub_80DB2BC - movs r0, 0 - strh r0, [r5, 0x8] - ldr r0, =sub_80DE5F4 - str r0, [r5] -_080DE5B4: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DE4A8 - - thumb_func_start sub_80DE5C0 -sub_80DE5C0: @ 80DE5C0 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r1, =gBattle_BG1_Y - ldrh r0, [r1] - adds r0, 0x7 - strh r0, [r1] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xA0 - ble _080DE5E4 - ldr r0, =gTasks - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_80DA4F4 - str r0, [r1] -_080DE5E4: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DE5C0 - - thumb_func_start sub_80DE5F4 -sub_80DE5F4: @ 80DE5F4 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - ldrh r2, [r1, 0xC] - movs r3, 0xC - ldrsh r0, [r1, r3] - cmp r0, 0x9 - bgt _080DE618 - adds r0, r2, 0x1 - strh r0, [r1, 0xC] - b _080DE654 - .pool -_080DE618: - ldrh r3, [r1, 0xA] - movs r4, 0xA - ldrsh r0, [r1, r4] - cmp r0, 0 - bne _080DE636 - ldrh r2, [r1, 0x8] - movs r4, 0x8 - ldrsh r0, [r1, r4] - cmp r0, 0x10 - bne _080DE632 - adds r0, r3, 0x1 - strh r0, [r1, 0xA] - b _080DE654 -_080DE632: - adds r0, r2, 0x1 - b _080DE652 -_080DE636: - ldrh r0, [r1, 0x8] - movs r3, 0x8 - ldrsh r2, [r1, r3] - cmp r2, 0 - bne _080DE650 - strh r2, [r1, 0xA] - strh r2, [r1, 0xC] - ldr r0, =sub_80DE65C - str r0, [r1] - b _080DE654 - .pool -_080DE650: - subs r0, 0x1 -_080DE652: - strh r0, [r1, 0x8] -_080DE654: - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80DE5F4 - - thumb_func_start sub_80DE65C -sub_80DE65C: @ 80DE65C - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 - ldrh r1, [r4, 0xC] - movs r2, 0xC - ldrsh r0, [r4, r2] - cmp r0, 0x9 - bgt _080DE680 - adds r0, r1, 0x1 - strh r0, [r4, 0xC] - b _080DE690 - .pool -_080DE680: - movs r0, 0 - strh r0, [r4, 0xC] - movs r0, 0x61 - movs r1, 0 - bl PlaySE12WithPanning - ldr r0, =sub_80DE5C0 - str r0, [r4] -_080DE690: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DE65C - - thumb_func_start sub_80DE69C -sub_80DE69C: @ 80DE69C - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - movs r7, 0 - ldr r6, =gSprites - ldr r5, =gContestResources -_080DE6AE: - bl AllocOamMatrix - ldr r1, [r5] - ldr r1, [r1, 0x14] - lsls r4, r7, 2 - adds r1, r4, r1 - ldrb r1, [r1] - lsls r3, r1, 4 - adds r3, r1 - lsls r3, 2 - adds r3, r6 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1F - ands r0, r1 - lsls r0, 1 - ldrb r1, [r3, 0x3] - movs r2, 0x3F - negs r2, r2 - mov r12, r2 - mov r2, r12 - ands r1, r2 - orrs r1, r0 - strb r1, [r3, 0x3] - ldr r0, [r5] - ldr r0, [r0, 0x14] - adds r0, r4, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - ldrb r2, [r0, 0x1] - movs r3, 0x4 - negs r3, r3 - adds r1, r3, 0 - ands r2, r1 - movs r1, 0x1 - orrs r2, r1 - strb r2, [r0, 0x1] - ldr r0, [r5] - ldr r0, [r0, 0x14] - adds r0, r4, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - mov r1, r8 - bl StartSpriteAffineAnim - mov r0, r8 - cmp r0, 0x2 - bne _080DE74C - ldr r0, [r5] - ldr r0, [r0, 0x14] - adds r0, r4, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - bl AnimateSprite - ldr r0, [r5] - ldr r0, [r0, 0x14] - adds r0, r4, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r0, 0x3E - ldrb r1, [r0] - movs r3, 0x5 - negs r3, r3 - adds r2, r3, 0 - ands r1, r2 - strb r1, [r0] -_080DE74C: - adds r7, 0x1 - cmp r7, 0x3 - ble _080DE6AE - ldr r0, =sub_80DE794 - movs r1, 0x5 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - mov r0, r8 - strh r0, [r1, 0x8] - ldr r0, =gContestResources - ldr r0, [r0] - ldr r2, [r0] - ldrb r0, [r2, 0x7] - movs r1, 0x2 - orrs r0, r1 - strb r0, [r2, 0x7] - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DE69C - - thumb_func_start sub_80DE794 -sub_80DE794: @ 80DE794 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r2, =gSprites - ldr r3, =gContestResources - ldr r0, [r3] - ldr r0, [r0, 0x14] - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3F - ldrb r0, [r0] - lsls r0, 26 - cmp r0, 0 - bge _080DE822 - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - ldrb r0, [r1, 0x8] - cmp r0, 0x1 - bne _080DE7EC - movs r4, 0 - adds r5, r2, 0 - movs r2, 0x4 -_080DE7CC: - ldr r0, [r3] - ldr r1, [r0, 0x14] - lsls r0, r4, 2 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3E - ldrb r1, [r0] - orrs r1, r2 - strb r1, [r0] - adds r4, 0x1 - cmp r4, 0x3 - ble _080DE7CC -_080DE7EC: - movs r4, 0 -_080DE7EE: - ldr r5, =gContestResources - ldr r0, [r5] - ldr r1, [r0, 0x14] - lsls r0, r4, 2 - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl FreeSpriteOamMatrix - adds r4, 0x1 - cmp r4, 0x3 - ble _080DE7EE - ldr r0, [r5] - ldr r2, [r0] - ldrb r1, [r2, 0x7] - movs r0, 0x3 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x7] - adds r0, r6, 0 - bl DestroyTask -_080DE822: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DE794 - - thumb_func_start sub_80DE834 -sub_80DE834: @ 80DE834 - push {lr} - lsls r0, 16 - lsrs r1, r0, 16 - movs r0, 0xB1 - lsls r0, 1 - cmp r1, r0 - bls _080DE844 - movs r1, 0x1 -_080DE844: - adds r0, r1, 0 - pop {r1} - bx r1 - thumb_func_end sub_80DE834 - - thumb_func_start sub_80DE84C -sub_80DE84C: @ 80DE84C - push {lr} - lsls r0, 16 - lsrs r1, r0, 16 - ldr r0, =0x0000019b - cmp r1, r0 - bls _080DE85A - movs r1, 0 -_080DE85A: - adds r0, r1, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80DE84C - - thumb_func_start sub_80DE864 -sub_80DE864: @ 80DE864 - push {r4-r7,lr} - lsls r0, 24 - lsrs r7, r0, 24 - ldr r4, =gContestResources - ldr r0, [r4] - ldr r1, [r0, 0x4] - lsls r0, r7, 3 - subs r0, r7 - lsls r0, 2 - adds r0, r1 - ldrh r0, [r0, 0x6] - bl sub_80DE834 - lsls r0, 16 - lsrs r5, r0, 16 - ldr r1, =gContestMons - lsls r0, r7, 6 - adds r0, r1 - ldrh r0, [r0] - bl sub_80DE84C - lsls r0, 16 - lsrs r6, r0, 16 - ldr r0, [r4] - ldr r0, [r0, 0x18] - movs r1, 0 - movs r2, 0x14 - bl memset - bl ClearBattleAnimationVars - ldr r1, =gBattleMonForms - movs r2, 0 - adds r0, r1, 0x3 -_080DE8A8: - strb r2, [r0] - subs r0, 0x1 - cmp r0, r1 - bge _080DE8A8 - cmp r5, 0x90 - beq _080DE920 - cmp r5, 0x90 - bgt _080DE8DE - cmp r5, 0x4C - beq _080DE978 - cmp r5, 0x4C - bgt _080DE8D4 - cmp r5, 0xD - beq _080DE978 - b _080DE9A2 - .pool -_080DE8D4: - cmp r5, 0x82 - beq _080DE978 - cmp r5, 0x8F - beq _080DE978 - b _080DE9A2 -_080DE8DE: - cmp r5, 0xD8 - beq _080DE960 - cmp r5, 0xD8 - bgt _080DE8EC - cmp r5, 0xAE - beq _080DE8FA - b _080DE9A2 -_080DE8EC: - cmp r5, 0xDA - beq _080DE96C - movs r0, 0x88 - lsls r0, 1 - cmp r5, r0 - beq _080DE920 - b _080DE9A2 -_080DE8FA: - ldr r0, =gBaseStats - lsls r1, r6, 3 - subs r1, r6 - lsls r1, 2 - adds r1, r0 - ldrb r0, [r1, 0x6] - cmp r0, 0x7 - beq _080DE910 - ldrb r0, [r1, 0x7] - cmp r0, 0x7 - bne _080DE99C -_080DE910: - ldr r1, =gAnimMoveTurn - movs r0, 0 - b _080DE9A0 - .pool -_080DE920: - ldr r6, =gContestResources - ldr r0, [r6] - ldr r1, [r0, 0x4] - lsls r0, r7, 3 - subs r0, r7 - lsls r0, 2 - adds r0, r1 - ldrb r4, [r0, 0x1B] - ldr r5, =gContestMons - lsls r4, 6 - adds r0, r4, r5 - ldrh r0, [r0] - bl sub_80DE84C - ldr r2, [r6] - ldr r1, [r2, 0x18] - strh r0, [r1, 0x2] - ldr r2, [r2, 0x18] - adds r5, 0x38 - adds r4, r5 - ldr r0, [r4] - str r0, [r2, 0x10] - ldrb r0, [r2, 0x4] - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x4] - b _080DE9A2 - .pool -_080DE960: - ldr r1, =gAnimFriendship - movs r0, 0xFF - b _080DE9A0 - .pool -_080DE96C: - ldr r1, =gAnimFriendship - movs r0, 0 - b _080DE9A0 - .pool -_080DE978: - ldr r0, =gContestResources - ldr r0, [r0] - ldr r0, [r0] - adds r2, r0, 0 - adds r2, 0x5A - ldrb r1, [r2] - cmp r1, 0 - bne _080DE99C - movs r0, 0x2 - strb r0, [r2] - ldr r0, =gAnimMoveTurn - strb r1, [r0] - b _080DE9A2 - .pool -_080DE99C: - ldr r1, =gAnimMoveTurn - movs r0, 0x1 -_080DE9A0: - strb r0, [r1] -_080DE9A2: - bl sub_80DEA5C - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DE864 - - thumb_func_start sub_80DE9B0 -sub_80DE9B0: @ 80DE9B0 - push {r4,lr} - ldr r4, =gContestResources - ldr r0, [r4] - ldr r0, [r0, 0x18] - movs r1, 0 - movs r2, 0x14 - bl memset - ldr r0, [r4] - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0x5A - ldrb r0, [r1] - cmp r0, 0 - beq _080DE9D2 - subs r0, 0x1 - strb r0, [r1] -_080DE9D2: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DE9B0 - - thumb_func_start sub_80DE9DC -sub_80DE9DC: @ 80DE9DC - push {r4-r6,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r6, =gContestResources - ldr r0, [r6] - ldr r0, [r0, 0x18] - strb r4, [r0, 0x5] - ldr r5, =gContestMons - lsls r4, 6 - adds r0, r4, r5 - ldrh r0, [r0] - bl sub_80DE84C - ldr r2, [r6] - ldr r1, [r2, 0x18] - strh r0, [r1] - ldr r1, [r2, 0x18] - adds r0, r5, 0 - adds r0, 0x38 - adds r0, r4, r0 - ldr r0, [r0] - str r0, [r1, 0x8] - adds r5, 0x3C - adds r4, r5 - ldr r0, [r4] - str r0, [r1, 0xC] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DE9DC - - thumb_func_start sub_80DEA20 -sub_80DEA20: @ 80DEA20 - push {lr} - ldr r0, =SpriteCallbackDummy - bl CreateInvisibleSpriteWithCallback - ldr r1, =gBattlerSpriteIds - strb r0, [r1, 0x3] - ldr r0, =gBattlerTarget - ldrb r0, [r0] - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl InitSpriteAffineAnim - bl sub_80DEA5C - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DEA20 - - thumb_func_start sub_80DEA5C -sub_80DEA5C: @ 80DEA5C - push {r4,lr} - ldr r0, =gBattlerSpriteIds - ldrb r0, [r0, 0x3] - lsls r4, r0, 4 - adds r4, r0 - lsls r4, 2 - ldr r0, =gSprites - adds r4, r0 - movs r0, 0 - strh r0, [r4, 0x24] - strh r0, [r4, 0x26] - movs r0, 0x3 - movs r1, 0 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x20] - movs r0, 0x3 - movs r1, 0x1 - bl GetBattlerSpriteCoord - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4, 0x22] - adds r4, 0x3E - ldrb r0, [r4] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r4] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DEA5C - - thumb_func_start sub_80DEAA8 -sub_80DEAA8: @ 80DEAA8 - push {lr} - lsls r0, 16 - lsrs r0, 16 - ldr r2, =gBattleMoves - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldrb r0, [r1, 0x6] - cmp r0, 0x20 - bhi _080DEB60 - lsls r0, 2 - ldr r1, =_080DEAD0 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080DEAD0: - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB54 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB54 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 - .4byte _080DEB60 -_080DEB54: - ldr r1, =gBattlerTarget - movs r0, 0x2 - b _080DEB64 - .pool -_080DEB60: - ldr r1, =gBattlerTarget - movs r0, 0x3 -_080DEB64: - strb r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_80DEAA8 - - thumb_func_start Contest_PrintTextToBg0WindowStd -Contest_PrintTextToBg0WindowStd: @ 80DEB70 - push {r4,lr} - sub sp, 0x10 - adds r4, r0, 0 - str r1, [sp] - mov r0, sp - movs r2, 0 - strb r4, [r0, 0x4] - movs r1, 0x1 - strb r1, [r0, 0x5] - strb r2, [r0, 0x6] - strb r1, [r0, 0x7] - strb r2, [r0, 0x8] - strb r1, [r0, 0x9] - strb r2, [r0, 0xA] - strb r2, [r0, 0xB] - mov r3, sp - ldrb r2, [r3, 0xC] - subs r1, 0x11 - adds r0, r1, 0 - ands r0, r2 - strb r0, [r3, 0xC] - mov r2, sp - movs r0, 0xF0 - strb r0, [r2, 0xC] - ldrb r0, [r2, 0xD] - ands r1, r0 - strb r1, [r2, 0xD] - mov r1, sp - movs r0, 0x80 - strb r0, [r1, 0xD] - mov r0, sp - movs r1, 0 - movs r2, 0 - bl AddTextPrinter - lsls r4, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl PutWindowTilemap - movs r0, 0 - bl Contest_SetBgCopyFlags - add sp, 0x10 - pop {r4} - pop {r0} - bx r0 - thumb_func_end Contest_PrintTextToBg0WindowStd - - thumb_func_start Contest_PrintTextToBg0WindowAt -Contest_PrintTextToBg0WindowAt: @ 80DEBD0 - push {r4,r5,lr} - sub sp, 0x10 - adds r5, r0, 0 - ldr r4, [sp, 0x1C] - str r1, [sp] - mov r0, sp - movs r1, 0 - strb r5, [r0, 0x4] - strb r4, [r0, 0x5] - strb r2, [r0, 0x6] - strb r3, [r0, 0x7] - strb r2, [r0, 0x8] - strb r3, [r0, 0x9] - strb r1, [r0, 0xA] - strb r1, [r0, 0xB] - mov r3, sp - ldrb r2, [r3, 0xC] - subs r1, 0x10 - adds r0, r1, 0 - ands r0, r2 - strb r0, [r3, 0xC] - mov r2, sp - movs r0, 0xF0 - strb r0, [r2, 0xC] - ldrb r0, [r2, 0xD] - ands r1, r0 - strb r1, [r2, 0xD] - mov r1, sp - movs r0, 0x80 - strb r0, [r1, 0xD] - mov r0, sp - movs r1, 0 - movs r2, 0 - bl AddTextPrinter - lsls r5, 24 - lsrs r5, 24 - adds r0, r5, 0 - bl PutWindowTilemap - movs r0, 0 - bl Contest_SetBgCopyFlags - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end Contest_PrintTextToBg0WindowAt - - thumb_func_start Contest_StartTextPrinter -Contest_StartTextPrinter: @ 80DEC30 - push {r4,r5,lr} - sub sp, 0x10 - str r0, [sp] - mov r2, sp - movs r3, 0 - movs r0, 0x4 - strb r0, [r2, 0x4] - mov r0, sp - movs r5, 0x1 - strb r5, [r0, 0x5] - strb r3, [r0, 0x6] - strb r5, [r0, 0x7] - strb r3, [r0, 0x8] - strb r5, [r0, 0x9] - strb r3, [r0, 0xA] - strb r3, [r0, 0xB] - mov r4, sp - ldrb r3, [r4, 0xC] - movs r2, 0x10 - negs r2, r2 - adds r0, r2, 0 - ands r0, r3 - strb r0, [r4, 0xC] - mov r3, sp - movs r0, 0x10 - strb r0, [r3, 0xC] - ldrb r0, [r3, 0xD] - ands r2, r0 - strb r2, [r3, 0xD] - mov r2, sp - movs r0, 0x80 - strb r0, [r2, 0xD] - cmp r1, 0 - bne _080DEC80 - mov r0, sp - movs r1, 0 - movs r2, 0 - bl AddTextPrinter - b _080DECA4 -_080DEC80: - ldr r0, =gIsLinkContest - ldrb r1, [r0] - adds r0, r5, 0 - ands r0, r1 - cmp r0, 0 - beq _080DEC94 - movs r1, 0x4 - b _080DEC9C - .pool -_080DEC94: - bl GetPlayerTextSpeedDelay - lsls r0, 24 - lsrs r1, r0, 24 -_080DEC9C: - mov r0, sp - movs r2, 0 - bl AddTextPrinter -_080DECA4: - movs r0, 0x4 - bl PutWindowTilemap - movs r0, 0 - bl Contest_SetBgCopyFlags - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end Contest_StartTextPrinter - - thumb_func_start ContestBG_FillBoxWithIncrementingTile -ContestBG_FillBoxWithIncrementingTile: @ 80DECB8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x10 - mov r8, r0 - ldr r0, [sp, 0x28] - ldr r4, [sp, 0x2C] - ldr r5, [sp, 0x30] - ldr r6, [sp, 0x34] - mov r7, r8 - lsls r7, 24 - lsrs r7, 24 - mov r8, r7 - lsls r1, 16 - lsrs r1, 16 - lsls r2, 24 - lsrs r2, 24 - lsls r3, 24 - lsrs r3, 24 - lsls r0, 24 - lsrs r0, 24 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - str r0, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - lsls r6, 16 - asrs r6, 16 - str r6, [sp, 0xC] - mov r0, r8 - bl WriteSequenceToBgTilemapBuffer - mov r0, r8 - bl Contest_SetBgCopyFlags - add sp, 0x10 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end ContestBG_FillBoxWithIncrementingTile - - thumb_func_start ContestBG_FillBoxWithTile -ContestBG_FillBoxWithTile: @ 80DED10 - push {r4-r6,lr} - sub sp, 0x10 - ldr r4, [sp, 0x20] - ldr r5, [sp, 0x24] - ldr r6, [sp, 0x28] - lsls r0, 24 - lsrs r0, 24 - lsls r1, 16 - lsrs r1, 16 - lsls r2, 24 - lsrs r2, 24 - lsls r3, 24 - lsrs r3, 24 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - lsls r6, 24 - lsrs r6, 24 - str r4, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - movs r4, 0 - str r4, [sp, 0xC] - bl ContestBG_FillBoxWithIncrementingTile - add sp, 0x10 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end ContestBG_FillBoxWithTile - - thumb_func_start Contest_RunTextPrinters -Contest_RunTextPrinters: @ 80DED4C - push {lr} - bl RunTextPrinters - movs r0, 0x4 - bl IsTextPrinterActive - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end Contest_RunTextPrinters - - thumb_func_start Contest_SetBgCopyFlags -Contest_SetBgCopyFlags: @ 80DED60 - ldr r2, =sContestBgCopyFlags - movs r1, 0x1 - lsls r1, r0 - ldrb r0, [r2] - orrs r1, r0 - strb r1, [r2] - bx lr - .pool - thumb_func_end Contest_SetBgCopyFlags - - thumb_func_start ResetContestLinkResults -ResetContestLinkResults: @ 80DED74 - push {r4-r6,lr} - movs r0, 0 - ldr r6, =gSaveBlock2Ptr - ldr r5, =0x00000624 - movs r4, 0 -_080DED7E: - adds r3, r0, 0x1 - lsls r1, r0, 3 - movs r2, 0x3 -_080DED84: - ldr r0, [r6] - adds r0, r5 - adds r0, r1 - strh r4, [r0] - adds r1, 0x2 - subs r2, 0x1 - cmp r2, 0 - bge _080DED84 - adds r0, r3, 0 - cmp r0, 0x4 - ble _080DED7E - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end ResetContestLinkResults - - thumb_func_start sub_80DEDA8 -sub_80DEDA8: @ 80DEDA8 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x3 - bl __umodsi3 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - movs r5, 0 - ldr r1, =gContestFinalStandings - ldrb r0, [r1] - cmp r0, 0 - beq _080DEDE6 -_080DEDD8: - adds r5, 0x1 - cmp r5, 0x2 - bgt _080DEDE6 - adds r0, r5, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _080DEDD8 -_080DEDE6: - ldr r0, [sp] - cmp r0, 0xFF - bne _080DEE00 - ldr r0, =gContestPlayerMonIndex - ldrb r0, [r0] - cmp r5, r0 - beq _080DEE00 - movs r0, 0 - b _080DEF90 - .pool -_080DEE00: - ldr r0, =gSpecialVar_ContestCategory - ldrh r0, [r0] - cmp r0, 0x4 - bhi _080DEE4C - lsls r0, 2 - ldr r1, =_080DEE1C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080DEE1C: - .4byte _080DEE4C - .4byte _080DEE30 - .4byte _080DEE36 - .4byte _080DEE3C - .4byte _080DEE42 -_080DEE30: - mov r0, r8 - adds r0, 0x3 - b _080DEE46 -_080DEE36: - mov r0, r8 - adds r0, 0x6 - b _080DEE46 -_080DEE3C: - mov r0, r8 - adds r0, 0x9 - b _080DEE46 -_080DEE42: - mov r0, r8 - adds r0, 0xC -_080DEE46: - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 -_080DEE4C: - ldr r1, [sp] - cmp r1, 0xFE - bne _080DEE54 - b _080DEF50 -_080DEE54: - adds r0, r1, 0 - movs r1, 0x1 - bl sub_80DEFA8 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - ldr r2, =gSaveBlock1Ptr - mov r10, r2 - ldr r0, [r2] - mov r3, r9 - lsls r7, r3, 5 - ldr r6, =0x00002e90 - adds r2, r0, r6 - adds r2, r7 - ldr r4, =gContestMons - lsls r5, 6 - adds r1, r4, 0 - adds r1, 0x38 - adds r1, r5, r1 - ldr r1, [r1] - str r1, [r2] - adds r1, r0, r7 - adds r2, r5, r4 - ldrh r2, [r2] - ldr r3, =0x00002e98 - adds r1, r3 - strh r2, [r1] - ldr r1, =0x00002e94 - adds r2, r0, r1 - adds r2, r7 - adds r1, r4, 0 - adds r1, 0x3C - adds r1, r5, r1 - ldr r1, [r1] - str r1, [r2] - adds r6, r7, r6 - adds r0, r6 - adds r0, 0xB - adds r1, r4, 0x2 - adds r1, r5, r1 - bl StringCopy - mov r2, r10 - ldr r0, [r2] - adds r0, r6 - adds r0, 0x16 - adds r4, 0xD - adds r5, r4 - adds r1, r5, 0 - bl StringCopy - ldr r0, =gIsLinkContest - ldrb r1, [r0] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080DEEF4 - mov r3, r10 - ldr r0, [r3] - adds r0, r7 - ldr r1, =0x00002eae - adds r0, r1 - movs r1, 0x4 - b _080DEF02 - .pool -_080DEEF4: - mov r2, r10 - ldr r0, [r2] - adds r0, r7 - ldr r1, =gSpecialVar_ContestRank - ldrh r1, [r1] - ldr r3, =0x00002eae - adds r0, r3 -_080DEF02: - strb r1, [r0] - ldr r0, [sp] - cmp r0, 0xFF - beq _080DEF34 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - mov r2, r9 - lsls r1, r2, 5 - adds r0, r1 - ldr r1, =gSpecialVar_ContestCategory - ldrh r1, [r1] - ldr r3, =0x00002e9a - adds r0, r3 - strb r1, [r0] - b _080DEF8E - .pool -_080DEF34: - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - mov r2, r9 - lsls r1, r2, 5 - adds r0, r1 - ldr r3, =0x00002e9a - adds r0, r3 - mov r1, r8 - strb r1, [r0] - b _080DEF8E - .pool -_080DEF50: - ldr r6, =gUnknown_02039F3C - ldr r4, =gContestMons - lsls r5, 6 - adds r0, r4, 0 - adds r0, 0x38 - adds r0, r5, r0 - ldr r0, [r0] - str r0, [r6] - adds r0, r4, 0 - adds r0, 0x3C - adds r0, r5, r0 - ldr r0, [r0] - str r0, [r6, 0x4] - adds r0, r5, r4 - ldrh r0, [r0] - strh r0, [r6, 0x8] - adds r0, r6, 0 - adds r0, 0xB - adds r1, r4, 0x2 - adds r1, r5, r1 - bl StringCopy - adds r0, r6, 0 - adds r0, 0x16 - adds r4, 0xD - adds r5, r4 - adds r1, r5, 0 - bl StringCopy - mov r2, r8 - strb r2, [r6, 0xA] -_080DEF8E: - movs r0, 0x1 -_080DEF90: - add sp, 0x4 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80DEDA8 - - thumb_func_start sub_80DEFA8 -sub_80DEFA8: @ 80DEFA8 - push {r4-r7,lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - cmp r0, 0x3 - bgt _080DEFF8 - cmp r0, 0 - blt _080DEFF8 - cmp r1, 0 - beq _080DEFE6 - movs r2, 0x5 - ldr r0, =gSaveBlock1Ptr - mov r12, r0 - ldr r4, =0x00002e90 - ldr r3, =0x00002e70 -_080DEFC8: - mov r1, r12 - ldr r0, [r1] - lsls r1, r2, 5 - adds r1, r0 - adds r0, r1, r4 - adds r1, r3 - ldm r1!, {r5-r7} - stm r0!, {r5-r7} - ldm r1!, {r5-r7} - stm r0!, {r5-r7} - ldm r1!, {r5,r6} - stm r0!, {r5,r6} - subs r2, 0x1 - cmp r2, 0 - bgt _080DEFC8 -_080DEFE6: - movs r0, 0 - b _080DF03A - .pool -_080DEFF8: - ldr r0, =gSpecialVar_ContestCategory - ldrh r0, [r0] - cmp r0, 0x4 - bhi _080DF038 - lsls r0, 2 - ldr r1, =_080DF014 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080DF014: - .4byte _080DF028 - .4byte _080DF02C - .4byte _080DF030 - .4byte _080DF034 - .4byte _080DF038 -_080DF028: - movs r0, 0x8 - b _080DF03A -_080DF02C: - movs r0, 0x9 - b _080DF03A -_080DF030: - movs r0, 0xA - b _080DF03A -_080DF034: - movs r0, 0xB - b _080DF03A -_080DF038: - movs r0, 0xC -_080DF03A: - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_80DEFA8 - - thumb_func_start ClearContestWinnerPicsInContestHall -ClearContestWinnerPicsInContestHall: @ 80DF040 - push {r4-r7,lr} - movs r2, 0 - ldr r0, =gSaveBlock1Ptr - mov r12, r0 - ldr r4, =0x00002e90 - ldr r3, =gUnknown_08587FA4 -_080DF04C: - mov r1, r12 - ldr r0, [r1] - lsls r1, r2, 5 - adds r0, r1 - adds r0, r4 - adds r1, r3, 0 - ldm r1!, {r5-r7} - stm r0!, {r5-r7} - ldm r1!, {r5-r7} - stm r0!, {r5-r7} - ldm r1!, {r5,r6} - stm r0!, {r5,r6} - adds r3, 0x20 - adds r2, 0x1 - cmp r2, 0x7 - ble _080DF04C - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end ClearContestWinnerPicsInContestHall - thumb_func_start sub_80DF080 sub_80DF080: @ 80DF080 push {r4-r7,lr} diff --git a/data/contest.s b/data/contest.s index eaf3f8c951..48bfa10803 100644 --- a/data/contest.s +++ b/data/contest.s @@ -406,7 +406,7 @@ gSpriteTemplate_858998C:: @ 858998C spr_template 0x80eb, 0x80eb, gOamData_8589944, gDummySpriteAnimTable, NULL, gSpriteAffineAnimTable_8589984, SpriteCallbackDummy .align 2 -gUnknown_085899EC:: @ 85899EC +gContestExcitementTable:: @ 85899EC .2byte 0x0001, 0xffff, 0x0000, 0x0001, 0xffff, 0x00ff, 0x0001, 0xffff, 0x00ff, 0x0001, 0xff00, 0x00ff, 0x0001, 0x0000 diff --git a/data/text/contest_strings.inc b/data/text/contest_strings.inc index 737e4b8625..1406ba3cbf 100644 --- a/data/text/contest_strings.inc +++ b/data/text/contest_strings.inc @@ -665,19 +665,19 @@ gText_0827E817:: @ 827E817 .string "{STR_VAR_1}'s\n" .string "{STR_VAR_2} is ignored.{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}{PAUSE 0x0F}$" -gText_0827E837:: @ 827E837 +gText_Contest_Shyness:: @ 827E837 .string "shyness$" -gText_0827E83F:: @ 827E83F +gText_Contest_Anxiety:: @ 827E83F .string "anxiety$" -gText_0827E847:: @ 827E847 +gText_Contest_Laziness:: @ 827E847 .string "laziness$" -gText_0827E850:: @ 827E850 +gText_Contest_Hesitancy:: @ 827E850 .string "hesitancy$" -gText_0827E85A:: @ 827E85A +gText_Contest_Fear:: @ 827E85A .string "fear$" gText_0827E85F:: @ 827E85F diff --git a/include/contest.h b/include/contest.h index 4ab4d350c5..65db7b0bc5 100644 --- a/include/contest.h +++ b/include/contest.h @@ -429,9 +429,13 @@ extern struct ContestResources *gContestResources; #define shared19328 (*gContestResources->field_10) #define shared19338 (*gContestResources->field_14) + + #define shared15800 (gHeap + 0x18000) +#define shared16800 (gHeap + 0x19000) #define shared18000 (*(struct Shared18000 *)(gHeap + 0x1a000)) + extern u32 gContestRngValue; extern u8 gUnknown_02039F26[4]; @@ -445,7 +449,7 @@ bool8 sub_80DE1E8(u8 a); void SetStartledString(u8 a, u8 b); s8 Contest_GetMoveExcitement(u16); u8 sub_80DAE0C(struct Pokemon *); -void sub_80DEDA8(u8); +bool8 sub_80DEDA8(u8); void sub_80DACBC(u8 contestType, u8 rank, bool32 isPostgame); void sub_80DB09C(u8 contestCategory); void sub_80DCE58(u8); diff --git a/include/graphics.h b/include/graphics.h index 29719d1a06..4615facf95 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4745,9 +4745,13 @@ extern const u32 gBattleStatMask8_Pal[]; extern const u32 gUnknown_08D9A88C[]; extern const u32 gContestMiscGfx[]; extern const u32 gContestAudienceGfx[]; +extern const u8 gContestApplauseMeterGfx[]; +extern const u8 gContestNextTurnNumbersGfx[]; +extern const u8 gContestNextTurnRandomGfx[]; extern const u32 gUnknown_08C16FA8[]; extern const u32 gUnknown_08C16E90[]; extern const u32 gUnknown_08C17170[]; +extern const u32 gUnknown_08C17980[]; extern const u32 gUnknown_08D95E00[]; extern const u32 gUnknown_08D960D0[]; diff --git a/src/contest.c b/src/contest.c index a0b44e331e..a74e2c96b6 100644 --- a/src/contest.c +++ b/src/contest.c @@ -103,7 +103,7 @@ u8 sub_80DB120(void); u8 sub_80DB174(u16, u32, u32, u32); void sub_80DB2BC(void); void prints_contest_move_description(u16); -u16 sub_80DE84C(u16); +u16 SanitizeSpecies(u16); void sub_80DB89C(void); u16 GetChosenMove(u8); void sub_80DB918(void); @@ -129,7 +129,7 @@ void sub_80DE424(u8); void sub_80DE69C(u8); void sub_80DEA20(void); void Contest_PrintTextToBg0WindowAt(u32, u8 *, s32, u8, u8); -void Contest_StartTextPrinter(const u8 *, u8); +void Contest_StartTextPrinter(const u8 *, u32); void ContestBG_FillBoxWithIncrementingTile(u8, u16, u8, u8, u8, u8, u8, u8); bool32 Contest_RunTextPrinters(void); void Contest_SetBgCopyFlags(u32); @@ -144,9 +144,9 @@ void sub_80DF750(void); void sub_80DE9DC(u8); void sub_80DCBE8(u8, u8); u8 sub_80DC9EC(u8); -u16 sub_80DE834(u16); +u16 SanitizeMove(u16); void sub_80DE864(u8); -void sub_80DEAA8(u16); +void SelectContestMoveBankTarget(u16); void sub_80DE9B0(u8); void sub_80DC674(u8); void sub_80DE12C(void); @@ -169,7 +169,7 @@ bool8 sub_80DC3C4(void); void sub_80DF9D4(u8 *); void sub_80DF9E0(u8 *, s32); void ContestBG_FillBoxWithTile(u8, u16, u8, u8, u8, u8, u8); -void Contest_PrintTextToBg0WindowStd(u8, const u8 *); +void Contest_PrintTextToBg0WindowStd(u32, const u8 *); s16 sub_80DBD34(u8); void DetermineFinalStandings(void); bool8 sub_80DBF30(s32, s32, struct UnknownContestStruct6 *); @@ -180,7 +180,23 @@ void sub_80DC6A4(u8); void sub_80DC8D0(u8); void sub_80DC81C(u8); void sub_80DC87C(u8); - +void sub_80DCC84(struct Sprite *); +void sub_80DCCD8(struct Sprite *sprite); +u8 sub_80DDA20(void); +void c3_08130B10(u8); +void sub_80DDB6C(u8); +void task08_080CD1CC(u8); +void sub_80DDD20(u8); +void sub_80DDE30(u8); +void sub_80DDF80(u8); +const u8 *GetTurnOrderNumberGfx(u8); +void sub_80DE464(u8); +void sub_80DE4A8(u8); +void sub_80DE5F4(u8); +void sub_80DE65C(u8); +void sub_80DE794(u8); +void sub_80DEA5C(void); +u8 sub_80DEFA8(u8, u8); EWRAM_DATA struct ContestPokemon gContestMons[4] = {0}; @@ -228,6 +244,12 @@ extern const u8 gText_0827E817[]; extern const u8 gText_0827E58A[]; extern const u8 gText_0827D56F[]; extern const u8 gText_0827D597[]; +extern const u8 gText_Contest_Shyness[]; +extern const u8 gText_Contest_Anxiety[]; +extern const u8 gText_Contest_Laziness[]; +extern const u8 gText_Contest_Hesitancy[]; +extern const u8 gText_Contest_Fear[]; +extern const u8 *const gUnknown_08587E10[]; extern const struct ContestPokemon gContestOpponents[96]; extern const u8 gUnknown_085898A4[96]; extern const struct CompressedSpriteSheet gUnknown_08587C00; @@ -249,6 +271,10 @@ extern const struct SubspriteTable gSubspriteTables_8587B80[]; extern const struct CompressedSpriteSheet gUnknown_08587BB0; extern const struct SpritePalette gUnknown_08587BB8; extern const struct SpriteTemplate gSpriteTemplate_8587BC8; +extern bool8 gUnknown_020322D5; +extern void (*const gContestEffectFuncs[])(void); +extern const s8 gContestExcitementTable[][5]; +extern const struct ContestWinner gUnknown_08587FA4[]; void TaskDummy1(u8 taskId) { @@ -1071,11 +1097,11 @@ void sub_80D8B38(u8 taskId) return; case 7: { - u16 move = sub_80DE834(gContestResources->field_4[gContestResources->field_0->unk19215].currMove); + u16 move = SanitizeMove(gContestResources->field_4[gContestResources->field_0->unk19215].currMove); sub_80DE864(gContestResources->field_0->unk19215); sub_80DE9DC(gContestResources->field_0->unk19215); - sub_80DEAA8(move); + SelectContestMoveBankTarget(move); DoMoveAnim(move); gTasks[taskId].data[0] = 8; } @@ -2531,7 +2557,7 @@ u8 sub_80DB120(void) u8 sub_80DB174(u16 species, u32 otId, u32 personality, u32 index) { u8 spriteId; - species = sub_80DE84C(species); + species = SanitizeSpecies(species); if (index == gContestPlayerMonIndex) HandleLoadSpecialPokePic_2(gMonBackPicTable + species, gMonSpritesGfxPtr->sprites[0], species, personality); @@ -2776,9 +2802,9 @@ void sub_80DB884(void) void sub_80DB89C(void) { - FillWindowPixelBuffer(4, 0); - CopyWindowToVram(4, 2); - Contest_SetBgCopyFlags(0); + FillWindowPixelBuffer(4, 0); + CopyWindowToVram(4, 2); + Contest_SetBgCopyFlags(0); } u16 GetChosenMove(u8 a) @@ -2796,20 +2822,20 @@ u16 GetChosenMove(u8 a) ContestAI_ResetAI(a); moveChoice = ContestAI_GetActionToUse(); return gContestMons[a].moves[moveChoice]; - } + } } void sub_80DB918(void) { - s32 i; + s32 i; for (i = 0; i < 4; i++) - sContestantStatus[i].currMove = GetChosenMove(i); + sContestantStatus[i].currMove = GetChosenMove(i); } void sub_80DB944(void) { - s32 i; + s32 i; s32 j; s16 arr[4]; @@ -3016,7 +3042,7 @@ void DetermineFinalStandings(void) void sub_80DBED4(void) { - if ((gIsLinkContest & 1)) + if ((gIsLinkContest & 1)) { gSaveBlock2Ptr->contestLinkResults[gSpecialVar_ContestCategory][gContestFinalStandings[gContestPlayerMonIndex]] = ((gSaveBlock2Ptr->contestLinkResults[gSpecialVar_ContestCategory][gContestFinalStandings[gContestPlayerMonIndex]] + 1) > 0x270F) ? 0x270F : @@ -3027,7 +3053,7 @@ void sub_80DBED4(void) bool8 sub_80DBF30(s32 a, s32 b, struct UnknownContestStruct6 *c) { - bool8 retVal; + bool8 retVal; if (c[a].unk0 < c[b].unk0) retVal = TRUE; @@ -3046,15 +3072,15 @@ bool8 sub_80DBF30(s32 a, s32 b, struct UnknownContestStruct6 *c) void sub_80DBF68(void) { - gBattle_BG0_Y = 0; - gBattle_BG2_Y = 0; - sub_80DB89C(); - Contest_StartTextPrinter((u8*) &gUnknown_0827E8DA, 0); + gBattle_BG0_Y = 0; + gBattle_BG2_Y = 0; + sub_80DB89C(); + Contest_StartTextPrinter((u8*) &gUnknown_0827E8DA, 0); } void sub_80DBF90(void) { - int i; + int i; for(i = 0; i < 4; i++) { @@ -3106,7 +3132,7 @@ u8 sub_80DC028(s16 a, s16 b, u8 c) else gTasks[taskId].data[2] = -1; gTasks[taskId].data[3] = c; - return taskId; + return taskId; } void sub_80DC0F4(u8 taskId) @@ -3474,24 +3500,25 @@ extern const struct CompressedSpriteSheet gUnknown_08589904[]; extern const struct SpritePalette gUnknown_08589924[]; extern const struct SpriteTemplate gSpriteTemplate_858998C[]; +#ifdef NONMATCHING u8 sub_80DC9EC(u8 a) { - u8 r5 = gUnknown_02039F26[a] * 40 + 32; + u8 r5 = gUnknown_02039F26[a] * 40 + 32; u8 r8; u8 r6; volatile u8 zero; - + LoadCompressedObjectPic(&gUnknown_08589904[a]); LoadSpritePalette(&gUnknown_08589924[a]); r6 = CreateSprite(&gSpriteTemplate_858998C[a], 184, r5, 29); - gSprites[r8].oam.tileNum += 64; + gSprites[r8].oam.tileNum += 64; r8 = CreateSprite(&gSpriteTemplate_858998C[a], 248, r5, 29); CopySpriteTiles(0, 3, (void *)VRAM, (u16 *)(VRAM + 0xE000 + gUnknown_02039F26[a] * 5 * 64 + 0x26), (u8 *)(VRAM + 0x10000 + gSprites[r6].oam.tileNum * 32)); CopySpriteTiles(0, 3, (void *)VRAM, (u16 *)(VRAM + 0xE000 + gUnknown_02039F26[a] * 5 * 64 + 0x36), (u8 *)(VRAM + 0x10000 + gSprites[r8].oam.tileNum * 32)); - CpuSet(&r8, (u16 *)(VRAM + 0xE000 + gUnknown_02039F26[a] * 5 * 64 + 0x36), 0x050000c0); + CpuSet(&r8, (u16 *)(VRAM + 0xE000 + gUnknown_02039F26[a] * 5 * 64 + 0x36), 0x050000c0); RequestDma3Copy((void *)(VRAM + 0x10000 + (0x28 + gSprites[r6].oam.tileNum) * 32), (u8 *)(VRAM + 0x10000 + gSprites[r8].oam.tileNum * 32), 0x80, 1); @@ -3506,4 +3533,2661 @@ u8 sub_80DC9EC(u8 a) gSprites[r8].data[0] = r6; return r6; -} \ No newline at end of file +} +#else +NAKED +u8 sub_80DC9EC(u8 a) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0x10\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + str r0, [sp, 0xC]\n\ + ldr r6, =gUnknown_02039F26\n\ + adds r6, r0, r6\n\ + ldrb r0, [r6]\n\ + lsls r5, r0, 2\n\ + adds r5, r0\n\ + lsls r5, 27\n\ + movs r0, 0x80\n\ + lsls r0, 22\n\ + adds r5, r0\n\ + lsrs r5, 24\n\ + ldr r1, [sp, 0xC]\n\ + lsls r4, r1, 3\n\ + ldr r0, =gUnknown_08589904\n\ + adds r0, r4, r0\n\ + bl LoadCompressedObjectPic\n\ + ldr r0, =gUnknown_08589924\n\ + adds r4, r0\n\ + adds r0, r4, 0\n\ + bl LoadSpritePalette\n\ + ldr r2, [sp, 0xC]\n\ + lsls r4, r2, 1\n\ + adds r4, r2\n\ + lsls r4, 3\n\ + ldr r0, =gSpriteTemplate_858998C\n\ + adds r4, r0\n\ + adds r0, r4, 0\n\ + movs r1, 0xB8\n\ + adds r2, r5, 0\n\ + movs r3, 0x1D\n\ + bl CreateSprite\n\ + mov r9, r0\n\ + mov r3, r9\n\ + lsls r3, 24\n\ + lsrs r3, 24\n\ + mov r9, r3\n\ + adds r0, r4, 0\n\ + movs r1, 0xF8\n\ + adds r2, r5, 0\n\ + movs r3, 0x1D\n\ + bl CreateSprite\n\ + mov r8, r0\n\ + mov r0, r8\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r8, r0\n\ + lsls r5, r0, 4\n\ + add r5, r8\n\ + lsls r5, 2\n\ + ldr r1, =gSprites\n\ + adds r5, r1\n\ + ldrh r2, [r5, 0x4]\n\ + lsls r1, r2, 22\n\ + lsrs r1, 22\n\ + adds r1, 0x40\n\ + ldr r3, =0x000003ff\n\ + adds r0, r3, 0\n\ + ands r1, r0\n\ + ldr r0, =0xfffffc00\n\ + ands r0, r2\n\ + orrs r0, r1\n\ + strh r0, [r5, 0x4]\n\ + movs r4, 0xC0\n\ + lsls r4, 19\n\ + ldrb r0, [r6]\n\ + lsls r3, r0, 2\n\ + adds r3, r0\n\ + lsls r3, 6\n\ + ldr r0, =0x0600e026\n\ + adds r3, r0\n\ + ldr r7, =gContestResources\n\ + ldr r0, [r7]\n\ + ldr r0, [r0, 0x34]\n\ + str r0, [sp]\n\ + movs r0, 0\n\ + movs r1, 0x3\n\ + adds r2, r4, 0\n\ + bl CopySpriteTiles\n\ + ldrb r0, [r6]\n\ + lsls r3, r0, 2\n\ + adds r3, r0\n\ + lsls r3, 6\n\ + ldr r1, =0x0600e036\n\ + adds r3, r1\n\ + ldr r0, [r7]\n\ + ldr r0, [r0, 0x38]\n\ + str r0, [sp]\n\ + movs r0, 0\n\ + movs r1, 0x3\n\ + adds r2, r4, 0\n\ + bl CopySpriteTiles\n\ + movs r4, 0\n\ + str r4, [sp, 0x4]\n\ + ldr r0, [r7]\n\ + ldr r1, [r0, 0x34]\n\ + movs r6, 0xA0\n\ + lsls r6, 3\n\ + adds r1, r6\n\ + ldr r2, =0x050000c0\n\ + mov r10, r2\n\ + add r0, sp, 0x4\n\ + bl CpuSet\n\ + str r4, [sp, 0x8]\n\ + add r0, sp, 0x8\n\ + ldr r1, [r7]\n\ + ldr r1, [r1, 0x38]\n\ + adds r1, r6\n\ + mov r2, r10\n\ + bl CpuSet\n\ + ldr r0, [r7]\n\ + ldr r0, [r0, 0x34]\n\ + mov r3, r9\n\ + lsls r4, r3, 4\n\ + add r4, r9\n\ + lsls r4, 2\n\ + ldr r1, =gSprites\n\ + adds r4, r1\n\ + ldrh r1, [r4, 0x4]\n\ + lsls r1, 22\n\ + lsrs r1, 17\n\ + ldr r6, =0x06010000\n\ + adds r1, r6\n\ + movs r2, 0x80\n\ + lsls r2, 4\n\ + mov r10, r2\n\ + movs r3, 0x1\n\ + bl RequestDma3Copy\n\ + ldr r0, [r7]\n\ + ldr r0, [r0, 0x38]\n\ + ldrh r1, [r5, 0x4]\n\ + lsls r1, 22\n\ + lsrs r1, 17\n\ + adds r1, r6\n\ + mov r2, r10\n\ + movs r3, 0x1\n\ + bl RequestDma3Copy\n\ + mov r3, r8\n\ + strh r3, [r4, 0x2E]\n\ + mov r0, r9\n\ + strh r0, [r5, 0x2E]\n\ + mov r1, sp\n\ + ldrh r1, [r1, 0xC]\n\ + strh r1, [r4, 0x30]\n\ + mov r2, sp\n\ + ldrh r2, [r2, 0xC]\n\ + strh r2, [r5, 0x30]\n\ + mov r0, r9\n\ + add sp, 0x10\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r1}\n\ + bx r1\n\ + .pool\n\ + .syntax divided\n"); +} +#endif + +void sub_80DCB78(u8 spriteId) +{ + u8 spriteId2 = gSprites[spriteId].data[0]; + + FreeSpriteOamMatrix(&gSprites[spriteId2]); + DestroySprite(&gSprites[spriteId2]); + DestroySpriteAndFreeResources(&gSprites[spriteId]); +} + +void sub_80DCBB4(void) +{ + SetGpuReg(REG_OFFSET_BLDCNT, 0x3F40); + SetGpuReg(REG_OFFSET_BLDALPHA, 0x0907); +} + +void sub_80DCBD0(void) +{ + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); +} + +void sub_80DCBE8(u8 a, bool8 b) +{ + u8 r5; + + sub_80DCBB4(); + gContestResources->field_14[gSprites[a].data[1]].unk2_1 = 1; + r5 = gSprites[a].data[0]; + StartSpriteAffineAnim(&gSprites[a], 1); + StartSpriteAffineAnim(&gSprites[r5], 1); + gSprites[a].callback = sub_80DCC84; + gSprites[r5].callback = SpriteCallbackDummy; + if (b == FALSE) + PlaySE(SE_C_PIKON); + else + PlaySE(SE_PC_LOGIN); +} + +void sub_80DCC84(struct Sprite *sprite) +{ + if (sprite->affineAnimEnded) + { + u8 r1 = sprite->data[0]; + + if (gSprites[r1].affineAnimEnded) + { + sprite->invisible = TRUE; + gSprites[r1].invisible = TRUE; + sprite->callback = sub_80DCCD8; + } + } +} + +void sub_80DCCD8(struct Sprite *sprite) +{ + gContestResources->field_14[sprite->data[1]].unk2_1 = 0; + sub_80DCB78(sprite->data[0]); + sub_80DCBD0(); +} + +void sub_80DCD08(void) +{ + if(gHeap[0x1A000] == 1) + gHeap[0x1A000] = 0; + else + gHeap[0x1A000] = 1; + + if(gHeap[0x1A000] == 0) + { + sub_80DAEA4(); + sub_80DB2BC(); + } + else + sub_80DCD48(); +} + +#ifdef NONMATCHING +void sub_80DCD48(void) +{ + u8 r5 = 0; + u8 sp8[8]; + + if (gUnknown_020322D5 != 0) + { + u8 i; + s16 r2; + + + for (i = 0; i < 4; i++) + { + r2 = sContestantStatus[i].unk4; + if (r2 < 0) + { + r2 = -r2; + sp8[0] = CHAR_HYPHEN; + r5++; + } + ConvertIntToDecimalStringN(sp8 + r5, r2, 0, 4); + Text_InitWindowAndPrintText( + &gUnknown_03004210, + sp8, + 592 + gUnknown_02039F26[i] * 22, + gUnknown_083CA310[gUnknown_02039F26[i]][0], + gUnknown_083CA310[gUnknown_02039F26[i]][1]); + r5 = 0; + } + for (i = 0; i < 4; i++) + { + r2 = sContestantStatus[i].appeal2; + if (r2 < 0) + { + r2 = -r2; + sp8[0] = CHAR_HYPHEN; + r5++; + } + ConvertIntToDecimalStringN(sp8 + r5, r2, 0, 4); + Text_InitWindowAndPrintText( + &gUnknown_03004210, + sp8, + 512 + gUnknown_02039F26[i] * 20, + gUnknown_083CA308[gUnknown_02039F26[i]][0], + gUnknown_083CA308[gUnknown_02039F26[i]][1]); + r5 = 0; + } + sub_80AEB30(); + } +} +#else +NAKED +void sub_80DCD48(void) +{ + asm(".syntax unified\n\ + push {r4,r5,lr}\n\ + sub sp, 0xC\n\ + ldr r0, =gUnknown_020322D5\n\ + ldrb r0, [r0]\n\ + cmp r0, 0\n\ + beq _080DCE44\n\ + ldr r0, =gHeap\n\ + movs r1, 0xD0\n\ + lsls r1, 9\n\ + adds r0, r1\n\ + ldrb r0, [r0]\n\ + cmp r0, 0\n\ + beq _080DCE44\n\ + cmp r0, 0\n\ + blt _080DCD7C\n\ + cmp r0, 0x3\n\ + bgt _080DCD7C\n\ + cmp r0, 0x2\n\ + blt _080DCD7C\n\ + bl sub_80DF750\n\ + b _080DCE44\n\ + .pool\n\ +_080DCD7C:\n\ + movs r5, 0\n\ +_080DCD7E:\n\ + adds r0, r5, 0\n\ + movs r1, 0\n\ + bl FillWindowPixelBuffer\n\ + adds r0, r5, 0x1\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + cmp r5, 0x3\n\ + bls _080DCD7E\n\ + movs r5, 0\n\ +_080DCD92:\n\ + ldr r0, =gContestResources\n\ + ldr r0, [r0]\n\ + ldr r1, [r0, 0x4]\n\ + lsls r0, r5, 3\n\ + subs r0, r5\n\ + lsls r0, 2\n\ + adds r0, r1\n\ + add r2, sp, 0x4\n\ + ldrh r4, [r0, 0x4]\n\ + movs r1, 0x4\n\ + ldrsh r0, [r0, r1]\n\ + cmp r0, 0\n\ + bge _080DCDBC\n\ + negs r0, r0\n\ + lsls r0, 16\n\ + lsrs r4, r0, 16\n\ + adds r0, r2, 0\n\ + ldr r1, =gText_OneDash\n\ + bl StringCopy\n\ + adds r2, r0, 0\n\ +_080DCDBC:\n\ + lsls r1, r4, 16\n\ + asrs r1, 16\n\ + adds r0, r2, 0\n\ + movs r2, 0\n\ + movs r3, 0x4\n\ + bl ConvertIntToDecimalStringN\n\ + ldr r0, =gUnknown_02039F26\n\ + adds r0, r5, r0\n\ + ldrb r0, [r0]\n\ + movs r1, 0x7\n\ + str r1, [sp]\n\ + add r1, sp, 0x4\n\ + movs r2, 0x37\n\ + movs r3, 0x1\n\ + bl Contest_PrintTextToBg0WindowAt\n\ + adds r0, r5, 0x1\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + cmp r5, 0x3\n\ + bls _080DCD92\n\ + movs r5, 0\n\ +_080DCDEA:\n\ + ldr r0, =gContestResources\n\ + ldr r0, [r0]\n\ + ldr r1, [r0, 0x4]\n\ + lsls r0, r5, 3\n\ + subs r0, r5\n\ + lsls r0, 2\n\ + adds r0, r1\n\ + add r2, sp, 0x4\n\ + ldrh r4, [r0, 0x2]\n\ + movs r1, 0x2\n\ + ldrsh r0, [r0, r1]\n\ + cmp r0, 0\n\ + bge _080DCE14\n\ + negs r0, r0\n\ + lsls r0, 16\n\ + lsrs r4, r0, 16\n\ + adds r0, r2, 0\n\ + ldr r1, =gText_OneDash\n\ + bl StringCopy\n\ + adds r2, r0, 0\n\ +_080DCE14:\n\ + lsls r1, r4, 16\n\ + asrs r1, 16\n\ + adds r0, r2, 0\n\ + movs r2, 0\n\ + movs r3, 0x4\n\ + bl ConvertIntToDecimalStringN\n\ + ldr r0, =gUnknown_02039F26\n\ + adds r0, r5, r0\n\ + ldrb r0, [r0]\n\ + movs r1, 0x7\n\ + str r1, [sp]\n\ + add r1, sp, 0x4\n\ + movs r2, 0x5\n\ + movs r3, 0x1\n\ + bl Contest_PrintTextToBg0WindowAt\n\ + adds r0, r5, 0x1\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + cmp r5, 0x3\n\ + bls _080DCDEA\n\ + bl sub_80DB2BC\n\ +_080DCE44:\n\ + add sp, 0xC\n\ + pop {r4,r5}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided\n"); +} +#endif + +void sub_80DCE58(u8 a) +{ + u8 sp0[4]; + u16 sp4[4] = {0}; + s32 i; + s32 r2; + s32 r4; + + for (i = 0; i < 4; i++) + { + sp4[i] = Random(); + for (r2 = 0; r2 < i; r2++) + { + if (sp4[i] == sp4[r2]) + { + i--; + break; + } + } + } + + if (a == 0) + { + for (i = 0; i < 4; i++) + { + gUnknown_02039F26[i] = i; + for (r4 = 0; r4 < i; r4++) + { + if (gContestMonConditions[gUnknown_02039F26[r4]] < gContestMonConditions[i] + || (gContestMonConditions[gUnknown_02039F26[r4]] == gContestMonConditions[i] && sp4[gUnknown_02039F26[r4]] < sp4[i])) + { + for (r2 = i; r2 > r4; r2--) + gUnknown_02039F26[r2] = gUnknown_02039F26[r2 - 1]; + gUnknown_02039F26[r4] = i; + break; + } + } + if (r4 == i) + gUnknown_02039F26[i] = i; + } + memcpy(sp0, gUnknown_02039F26, sizeof(sp0)); + for (i = 0; i < 4; i++) + gUnknown_02039F26[sp0[i]] = i; + } + else + { + memset(sp0, 0xFF, sizeof(sp0)); + for (i = 0; i < 4; i++) + { + u8 r2 = sContestantStatus[i].unkB_0; + + while (1) + { + u8 *ptr = &sp0[r2]; + if (*ptr == 0xFF) + { + *ptr = i; + gUnknown_02039F26[i] = r2; + break; + } + r2++; + } + } + for (i = 0; i < 3; i++) + { + for (r4 = 3; r4 > i; r4--) + { + if (sContestantStatus[r4 - 1].unkB_0 == sContestantStatus[r4].unkB_0 + && gUnknown_02039F26[r4 - 1] < gUnknown_02039F26[r4] + && sp4[r4 - 1] < sp4[r4]) + { + u8 temp = gUnknown_02039F26[r4]; + + gUnknown_02039F26[r4] = gUnknown_02039F26[r4 - 1]; + gUnknown_02039F26[r4 - 1] = temp; + } + } + } + } +} + +void sub_80DD04C(void) +{ + s32 i; + + for (i = 0; i < 4; i++) + { + LoadPalette(&gHeap[0x1A004] + (i + 5) * 32, (gUnknown_02039F26[i] + 5) * 16, 32); + } + sub_80DAEA4(); +} + +#ifdef NONMATCHING +void sub_80DD080(u8 contestant) +{ + bool8 r8; + s32 i; + + sContestantStatus[contestant].appeal2 = 0; + sContestantStatus[contestant].appeal1 = 0; + r8 = sub_80DBA68(contestant); + if (r8) + { + u16 move = sContestantStatus[contestant].currMove; + u8 effect = gContestMoves[move].effect; + u8 rnd; + + sContestantStatus[contestant].moveCategory = gContestMoves[sContestantStatus[contestant].currMove].contestCategory; + if (sContestantStatus[contestant].currMove == sContestantStatus[contestant].prevMove && sContestantStatus[contestant].currMove != MOVE_NONE) + { + sContestantStatus[contestant].disappointedRepeat = TRUE; + sContestantStatus[contestant].moveRepeatCount++; + } + else + { + sContestantStatus[contestant].moveRepeatCount = 0; + } + sContestantStatus[contestant].appeal1 = gContestEffects[effect].appeal; + sContestantStatus[contestant].appeal2 = gContestEffects[effect].appeal; + shared192D0.jam = gContestEffects[effect].jam; + shared192D0.jam2 = shared192D0.jam; + shared192D0.jam2 = gContestEffects[effect].jam; + + shared192D0.contestant = contestant; + for (i = 0; i < 4; i++) + { + sContestantStatus[i].jam = 0; + shared192D0.unnervedPokes[i] = 0; + } + if (sContestantStatus[contestant].hasJudgesAttention && AreMovesContestCombo(sContestantStatus[contestant].prevMove, sContestantStatus[contestant].currMove) == 0) + sContestantStatus[contestant].hasJudgesAttention = 0; + sContestantStatus[contestant].appeal2 += sContestantStatus[contestant].condition; + gContestEffectFuncs[effect](); + if (sContestantStatus[contestant].conditionMod == 1) + sContestantStatus[contestant].appeal2 += sContestantStatus[contestant].condition - 10; + else if (sContestantStatus[contestant].appealTripleCondition) + sContestantStatus[contestant].appeal2 += sContestantStatus[contestant].condition * 3; + + + sContestantStatus[contestant].unk16 = 0; + sContestantStatus[contestant].unk15_6 = 0; + if (sub_80DE1E8(contestant)) + { + u8 r2 = AreMovesContestCombo(sContestantStatus[contestant].prevMove, sContestantStatus[contestant].currMove); + + if (r2 != 0 && sContestantStatus[contestant].hasJudgesAttention) + { + sContestantStatus[contestant].unk16 = r2; + sContestantStatus[contestant].unk15_6 = 1; + sContestantStatus[contestant].hasJudgesAttention = 0; + sContestantStatus[contestant].unk17 = sContestantStatus[contestant].appeal1 * sContestantStatus[contestant].unk16; + sContestantStatus[contestant].unk15_3 = 1; + } + else + { + if (gContestMoves[sContestantStatus[contestant].currMove].comboStarterId != 0) + { + sContestantStatus[contestant].hasJudgesAttention = 1; + sContestantStatus[contestant].unk15_6 = 1; + } + else + { + sContestantStatus[contestant].hasJudgesAttention = 0; + } + } + } + if (sContestantStatus[contestant].disappointedRepeat) + sContestantStatus[contestant].unk18 = (sContestantStatus[contestant].moveRepeatCount + 1) * 10; + if (sContestantStatus[contestant].nervous) + { + sContestantStatus[contestant].hasJudgesAttention = 0; + sContestantStatus[contestant].appeal2 = 0; + sContestantStatus[contestant].appeal1 = 0; + } + shared19328.bits_0 = Contest_GetMoveExcitement(sContestantStatus[contestant].currMove); + if (sContestantStatus[contestant].overrideCategoryExcitementMod) + shared19328.bits_0 = 1; + if (shared19328.bits_0 > 0) + { + if (sContest.applauseLevel + shared19328.bits_0 > 4) + shared19328.unk2 = 60; + else + shared19328.unk2 = 10; + } + else + { + shared19328.unk2 = 0; + } + + rnd = Random() % 3; + for (i = 0; i < 4; i++) + { + if (i != contestant) + { + if (rnd == 0) + break; + rnd--; + } + } + sContestantStatus[contestant].unk1B = i; + } +} + +#else +NAKED +void sub_80DD080(u8 contestant) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + mov r7, r9\n\ + mov r6, r8\n\ + push {r6,r7}\n\ + lsls r0, 24\n\ + lsrs r6, r0, 24\n\ + ldr r4, =gContestResources\n\ + ldr r3, [r4]\n\ + ldr r1, [r3, 0x4]\n\ + lsls r7, r6, 3\n\ + subs r0, r7, r6\n\ + lsls r5, r0, 2\n\ + adds r1, r5, r1\n\ + movs r2, 0\n\ + strh r2, [r1, 0x2]\n\ + ldr r0, [r3, 0x4]\n\ + adds r0, r5, r0\n\ + strh r2, [r0]\n\ + adds r0, r6, 0\n\ + bl sub_80DBA68\n\ + lsls r0, 24\n\ + mov r8, r4\n\ + cmp r0, 0\n\ + bne _080DD0B4\n\ + b _080DD3C4\n\ +_080DD0B4:\n\ + ldr r0, [r4]\n\ + ldr r1, [r0, 0x4]\n\ + adds r1, r5, r1\n\ + ldrh r0, [r1, 0x6]\n\ + ldr r2, =gContestMoves\n\ + lsls r0, 3\n\ + adds r0, r2\n\ + ldrb r2, [r0]\n\ + mov r9, r2\n\ + ldrb r0, [r0, 0x1]\n\ + lsls r0, 29\n\ + lsrs r0, 29\n\ + strb r0, [r1, 0xA]\n\ + ldr r0, [r4]\n\ + ldr r0, [r0, 0x4]\n\ + adds r2, r5, r0\n\ + ldrh r0, [r2, 0x6]\n\ + ldrh r1, [r2, 0x8]\n\ + cmp r0, r1\n\ + bne _080DD110\n\ + cmp r0, 0\n\ + beq _080DD110\n\ + ldrb r0, [r2, 0x15]\n\ + movs r1, 0x1\n\ + orrs r0, r1\n\ + strb r0, [r2, 0x15]\n\ + ldr r0, [r4]\n\ + ldr r2, [r0, 0x4]\n\ + adds r2, r5, r2\n\ + ldrb r3, [r2, 0xB]\n\ + lsls r1, r3, 25\n\ + lsrs r1, 29\n\ + adds r1, 0x1\n\ + movs r0, 0x7\n\ + ands r1, r0\n\ + lsls r1, 4\n\ + movs r0, 0x71\n\ + negs r0, r0\n\ + ands r0, r3\n\ + orrs r0, r1\n\ + strb r0, [r2, 0xB]\n\ + b _080DD12C\n\ + .pool\n\ +_080DD110:\n\ + ldr r4, =gContestResources\n\ + ldr r0, [r4]\n\ + ldr r0, [r0, 0x4]\n\ + lsls r3, r6, 3\n\ + subs r1, r3, r6\n\ + lsls r1, 2\n\ + adds r1, r0\n\ + ldrb r2, [r1, 0xB]\n\ + movs r0, 0x71\n\ + negs r0, r0\n\ + ands r0, r2\n\ + strb r0, [r1, 0xB]\n\ + mov r8, r4\n\ + adds r7, r3, 0\n\ +_080DD12C:\n\ + mov r2, r8\n\ + ldr r4, [r2]\n\ + ldr r2, [r4, 0x4]\n\ + subs r0, r7, r6\n\ + lsls r0, 2\n\ + adds r2, r0, r2\n\ + ldr r3, =gContestEffects\n\ + mov r1, r9\n\ + lsls r5, r1, 2\n\ + adds r3, r5, r3\n\ + ldrb r1, [r3, 0x1]\n\ + strh r1, [r2]\n\ + ldr r1, [r4, 0x4]\n\ + adds r0, r1\n\ + ldrh r1, [r0]\n\ + strh r1, [r0, 0x2]\n\ + ldr r1, [r4, 0x8]\n\ + ldrb r0, [r3, 0x2]\n\ + strh r0, [r1, 0x4]\n\ + ldr r1, [r4, 0x8]\n\ + ldrh r0, [r1, 0x4]\n\ + strh r0, [r1, 0x6]\n\ + ldr r0, [r4, 0x8]\n\ + strb r6, [r0, 0x11]\n\ + movs r2, 0\n\ + mov r9, r5\n\ + mov r4, r8\n\ + movs r3, 0\n\ + movs r1, 0\n\ +_080DD166:\n\ + ldr r0, [r4]\n\ + ldr r0, [r0, 0x4]\n\ + adds r0, r1, r0\n\ + strb r3, [r0, 0xE]\n\ + ldr r0, [r4]\n\ + ldr r0, [r0, 0x8]\n\ + adds r0, 0xD\n\ + adds r0, r2\n\ + strb r3, [r0]\n\ + adds r1, 0x1C\n\ + adds r2, 0x1\n\ + cmp r2, 0x3\n\ + ble _080DD166\n\ + ldr r5, =gContestResources\n\ + ldr r0, [r5]\n\ + ldr r1, [r0, 0x4]\n\ + subs r0, r7, r6\n\ + lsls r4, r0, 2\n\ + adds r2, r4, r1\n\ + ldrb r1, [r2, 0x15]\n\ + movs r0, 0x10\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080DD1B4\n\ + ldrh r0, [r2, 0x8]\n\ + ldrh r1, [r2, 0x6]\n\ + bl AreMovesContestCombo\n\ + lsls r0, 24\n\ + cmp r0, 0\n\ + bne _080DD1B4\n\ + ldr r0, [r5]\n\ + ldr r1, [r0, 0x4]\n\ + adds r1, r4, r1\n\ + ldrb r2, [r1, 0x15]\n\ + movs r0, 0x11\n\ + negs r0, r0\n\ + ands r0, r2\n\ + strb r0, [r1, 0x15]\n\ +_080DD1B4:\n\ + ldr r0, =gContestEffectFuncs\n\ + add r0, r9\n\ + ldr r0, [r0]\n\ + bl _call_via_r0\n\ + ldr r0, =gContestResources\n\ + ldr r0, [r0]\n\ + ldr r1, [r0, 0x4]\n\ + subs r0, r7, r6\n\ + lsls r0, 2\n\ + adds r2, r0, r1\n\ + ldrb r1, [r2, 0x10]\n\ + movs r0, 0x30\n\ + ands r0, r1\n\ + cmp r0, 0x10\n\ + bne _080DD1EC\n\ + ldrh r1, [r2, 0x2]\n\ + subs r1, 0xA\n\ + movs r0, 0xD\n\ + ldrsb r0, [r2, r0]\n\ + b _080DD206\n\ + .pool\n\ +_080DD1EC:\n\ + ldrb r1, [r2, 0x11]\n\ + movs r0, 0x20\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080DD200\n\ + movs r1, 0xD\n\ + ldrsb r1, [r2, r1]\n\ + lsls r0, r1, 1\n\ + adds r0, r1\n\ + b _080DD204\n\ +_080DD200:\n\ + movs r0, 0xD\n\ + ldrsb r0, [r2, r0]\n\ +_080DD204:\n\ + ldrh r1, [r2, 0x2]\n\ +_080DD206:\n\ + adds r0, r1\n\ + strh r0, [r2, 0x2]\n\ + ldr r5, =gContestResources\n\ + ldr r0, [r5]\n\ + ldr r1, [r0, 0x4]\n\ + subs r0, r7, r6\n\ + lsls r4, r0, 2\n\ + adds r1, r4, r1\n\ + movs r0, 0\n\ + strb r0, [r1, 0x16]\n\ + ldr r0, [r5]\n\ + ldr r1, [r0, 0x4]\n\ + adds r1, r4, r1\n\ + ldrb r2, [r1, 0x15]\n\ + movs r0, 0x41\n\ + negs r0, r0\n\ + ands r0, r2\n\ + strb r0, [r1, 0x15]\n\ + adds r0, r6, 0\n\ + bl sub_80DE1E8\n\ + lsls r0, 24\n\ + cmp r0, 0\n\ + beq _080DD2E2\n\ + ldr r0, [r5]\n\ + ldr r1, [r0, 0x4]\n\ + adds r1, r4, r1\n\ + ldrh r0, [r1, 0x8]\n\ + ldrh r1, [r1, 0x6]\n\ + bl AreMovesContestCombo\n\ + lsls r0, 24\n\ + lsrs r3, r0, 24\n\ + cmp r3, 0\n\ + beq _080DD29C\n\ + ldr r0, [r5]\n\ + ldr r0, [r0, 0x4]\n\ + adds r2, r4, r0\n\ + ldrb r1, [r2, 0x15]\n\ + movs r0, 0x10\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080DD29C\n\ + strb r3, [r2, 0x16]\n\ + ldr r0, [r5]\n\ + ldr r1, [r0, 0x4]\n\ + adds r1, r4, r1\n\ + ldrb r0, [r1, 0x15]\n\ + movs r2, 0x40\n\ + orrs r0, r2\n\ + strb r0, [r1, 0x15]\n\ + ldr r0, [r5]\n\ + ldr r1, [r0, 0x4]\n\ + adds r1, r4, r1\n\ + ldrb r2, [r1, 0x15]\n\ + movs r0, 0x11\n\ + negs r0, r0\n\ + ands r0, r2\n\ + strb r0, [r1, 0x15]\n\ + ldr r0, [r5]\n\ + ldr r0, [r0, 0x4]\n\ + adds r0, r4, r0\n\ + movs r1, 0\n\ + ldrsh r2, [r0, r1]\n\ + ldrb r1, [r0, 0x16]\n\ + muls r1, r2\n\ + strb r1, [r0, 0x17]\n\ + ldr r0, [r5]\n\ + ldr r1, [r0, 0x4]\n\ + adds r1, r4, r1\n\ + ldrb r0, [r1, 0x15]\n\ + movs r2, 0x8\n\ + b _080DD2C8\n\ + .pool\n\ +_080DD29C:\n\ + ldr r2, =gContestMoves\n\ + ldr r5, =gContestResources\n\ + ldr r0, [r5]\n\ + ldr r1, [r0, 0x4]\n\ + subs r0, r7, r6\n\ + lsls r4, r0, 2\n\ + adds r3, r4, r1\n\ + ldrh r0, [r3, 0x6]\n\ + lsls r0, 3\n\ + adds r0, r2\n\ + ldrb r0, [r0, 0x2]\n\ + cmp r0, 0\n\ + beq _080DD2D8\n\ + ldrb r0, [r3, 0x15]\n\ + movs r1, 0x10\n\ + orrs r0, r1\n\ + strb r0, [r3, 0x15]\n\ + ldr r0, [r5]\n\ + ldr r1, [r0, 0x4]\n\ + adds r1, r4, r1\n\ + ldrb r0, [r1, 0x15]\n\ + movs r2, 0x40\n\ +_080DD2C8:\n\ + orrs r0, r2\n\ + strb r0, [r1, 0x15]\n\ + b _080DD2E2\n\ + .pool\n\ +_080DD2D8:\n\ + ldrb r1, [r3, 0x15]\n\ + movs r0, 0x11\n\ + negs r0, r0\n\ + ands r0, r1\n\ + strb r0, [r3, 0x15]\n\ +_080DD2E2:\n\ + ldr r5, =gContestResources\n\ + ldr r0, [r5]\n\ + ldr r1, [r0, 0x4]\n\ + subs r0, r7, r6\n\ + lsls r4, r0, 2\n\ + adds r2, r4, r1\n\ + ldrb r1, [r2, 0x15]\n\ + movs r0, 0x1\n\ + mov r8, r0\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080DD30A\n\ + ldrb r0, [r2, 0xB]\n\ + lsls r0, 25\n\ + lsrs r0, 29\n\ + adds r0, 0x1\n\ + lsls r1, r0, 2\n\ + adds r1, r0\n\ + lsls r1, 1\n\ + strb r1, [r2, 0x18]\n\ +_080DD30A:\n\ + ldr r0, [r5]\n\ + ldr r0, [r0, 0x4]\n\ + adds r2, r4, r0\n\ + ldrb r1, [r2, 0xC]\n\ + mov r0, r8\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080DD334\n\ + ldrb r1, [r2, 0x15]\n\ + movs r0, 0x11\n\ + negs r0, r0\n\ + ands r0, r1\n\ + strb r0, [r2, 0x15]\n\ + ldr r2, [r5]\n\ + ldr r0, [r2, 0x4]\n\ + adds r0, r4, r0\n\ + movs r1, 0\n\ + strh r1, [r0, 0x2]\n\ + ldr r0, [r2, 0x4]\n\ + adds r0, r4, r0\n\ + strh r1, [r0]\n\ +_080DD334:\n\ + ldr r0, [r5]\n\ + ldr r0, [r0, 0x4]\n\ + adds r0, r4, r0\n\ + ldrh r0, [r0, 0x6]\n\ + bl Contest_GetMoveExcitement\n\ + ldr r1, [r5]\n\ + ldr r1, [r1, 0x10]\n\ + strb r0, [r1]\n\ + ldr r2, [r5]\n\ + ldr r0, [r2, 0x4]\n\ + adds r0, r4, r0\n\ + ldrb r1, [r0, 0x11]\n\ + movs r0, 0x10\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080DD35C\n\ + ldr r0, [r2, 0x10]\n\ + mov r1, r8\n\ + strb r1, [r0]\n\ +_080DD35C:\n\ + ldr r1, [r5]\n\ + ldr r3, [r1, 0x10]\n\ + movs r0, 0\n\ + ldrsb r0, [r3, r0]\n\ + cmp r0, 0\n\ + ble _080DD388\n\ + ldr r0, [r1]\n\ + ldrb r0, [r0, 0x13]\n\ + lsls r0, 24\n\ + asrs r0, 24\n\ + movs r1, 0\n\ + ldrsb r1, [r3, r1]\n\ + adds r0, r1\n\ + cmp r0, 0x4\n\ + ble _080DD384\n\ + movs r0, 0x3C\n\ + b _080DD38A\n\ + .pool\n\ +_080DD384:\n\ + movs r0, 0xA\n\ + b _080DD38A\n\ +_080DD388:\n\ + movs r0, 0\n\ +_080DD38A:\n\ + strb r0, [r3, 0x2]\n\ + bl Random\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + movs r1, 0x3\n\ + bl __umodsi3\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + movs r2, 0\n\ + b _080DD3AE\n\ +_080DD3A2:\n\ + subs r0, 0x1\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ +_080DD3A8:\n\ + adds r2, 0x1\n\ + cmp r2, 0x3\n\ + bgt _080DD3B6\n\ +_080DD3AE:\n\ + cmp r2, r6\n\ + beq _080DD3A8\n\ + cmp r0, 0\n\ + bne _080DD3A2\n\ +_080DD3B6:\n\ + ldr r0, =gContestResources\n\ + ldr r0, [r0]\n\ + ldr r1, [r0, 0x4]\n\ + subs r0, r7, r6\n\ + lsls r0, 2\n\ + adds r0, r1\n\ + strb r2, [r0, 0x1B]\n\ +_080DD3C4:\n\ + pop {r3,r4}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided\n"); +} +#endif + +void SetContestantEffectStringID(u8 a, u8 b) +{ + sContestantStatus[a].effectStringId = b; +} + +void SetContestantEffectStringID2(u8 a, u8 b) +{ + sContestantStatus[a].effectStringId2 = b; +} + +void SetStartledString(u8 contestant, u8 jam) +{ + if (jam >= 60) + SetContestantEffectStringID(contestant, CONTEST_STRING_TRIPPED_OVER); + else if (jam >= 40) + SetContestantEffectStringID(contestant, CONTEST_STRING_LEAPT_UP); + else if (jam >= 30) + SetContestantEffectStringID(contestant, CONTEST_STRING_UTTER_CRY); + else if (jam >= 20) + SetContestantEffectStringID(contestant, CONTEST_STRING_TURNED_BACK); + else if (jam >= 10) + SetContestantEffectStringID(contestant, CONTEST_STRING_LOOKED_DOWN); +} + +void sub_80DD45C(u8 contestant, u8 stringId) +{ + StringCopy(gStringVar1, gContestMons[contestant].nickname); + StringCopy(gStringVar2, gMoveNames[sContestantStatus[contestant].currMove]); + if (gContestMoves[sContestantStatus[shared192D0.contestant].currMove].contestCategory == CONTEST_CATEGORY_COOL) + StringCopy(gStringVar3, gText_Contest_Shyness); + else if (gContestMoves[sContestantStatus[shared192D0.contestant].currMove].contestCategory == CONTEST_CATEGORY_BEAUTY) + StringCopy(gStringVar3, gText_Contest_Anxiety); + else if (gContestMoves[sContestantStatus[shared192D0.contestant].currMove].contestCategory == CONTEST_CATEGORY_CUTE) + StringCopy(gStringVar3, gText_Contest_Laziness); + else if (gContestMoves[sContestantStatus[shared192D0.contestant].currMove].contestCategory == CONTEST_CATEGORY_SMART) + StringCopy(gStringVar3, gText_Contest_Hesitancy); + else + StringCopy(gStringVar3, gText_Contest_Fear); + StringExpandPlaceholders(gStringVar4, gUnknown_08587E10[stringId]); + sub_80DB89C(); + Contest_StartTextPrinter(gStringVar4, 1); +} + +void MakeContestantNervous(u8 p) +{ + sContestantStatus[p].nervous = 1; + sContestantStatus[p].currMove = MOVE_NONE; +} + +void sub_80DD590(void) +{ + u8 r12 = 0; + s32 i; + s32 j; + u8 sp0[4]; + u8 sp4[4]; + + for (i = 0; i < 4; i++) + { + sp0[i] = gUnknown_02039F26[i]; + sp4[i] = 0; + } + + for (i = 0; i < 4; i++) + { + for (j = 0; j < 4; j++) + { + if (sContestantStatus[j].nextTurnOrder == i) + { + sp0[j] = i; + sp4[j] = 1; + break; + } + } + if (j == 4) + { + for (j = 0; j < 4; j++) + { + if (sp4[j] == 0 && sContestantStatus[j].nextTurnOrder == 0xFF) + { + r12 = j; + j++; + break; + } + } + for (; j < 4; j++) + { + if (sp4[j] == 0 && sContestantStatus[j].nextTurnOrder == 0xFF + && gUnknown_02039F26[r12] > gUnknown_02039F26[j]) + r12 = j; + } + sp0[r12] = i; + sp4[r12] = 1; + } + } + + for (i = 0; i < 4; i++) + { + shared192D0.turnOrder[i] = sp0[i]; + sContestantStatus[i].nextTurnOrder = 0xFF; + sContestantStatus[i].turnOrderMod = 0; + gUnknown_02039F26[i] = sp0[i]; + } +} + +void sub_80DD6DC(struct Sprite *sprite) +{ + if (sprite->data[1]++ > 84) + { + sprite->data[1] = 0; + sprite->invisible = TRUE; + sprite->callback = SpriteCallbackDummy; + sContest.unk1920A_4 = 0; + } +} + +void sub_80DD720(u8 a) +{ + u8 spriteId = sContest.unk19216; + + switch (a) + { + case 0: + case 1: + gSprites[spriteId].oam.tileNum = gSprites[spriteId].data[0]; + PlaySE(SE_HAZURE); + break; + case 2: + gSprites[spriteId].oam.tileNum = gSprites[spriteId].data[0] + 4; + PlaySE(SE_SEIKAI); + break; + case 3: + gSprites[spriteId].oam.tileNum = gSprites[spriteId].data[0] + 8; + PlaySE(SE_SEIKAI); + break; + case 4: + gSprites[spriteId].oam.tileNum = gSprites[spriteId].data[0] + 12; + PlaySE(SE_TK_WARPIN); + break; + case 5: // exactly the same as case 4 + gSprites[spriteId].oam.tileNum = gSprites[spriteId].data[0] + 12; + PlaySE(SE_TK_WARPIN); + break; + case 6: + gSprites[spriteId].oam.tileNum = gSprites[spriteId].data[0] + 16; + PlaySE(SE_TK_WARPIN); + break; + case 8: + gSprites[spriteId].oam.tileNum = gSprites[spriteId].data[0] + 24; + PlaySE(SE_W215); + break; + case 7: + default: + gSprites[spriteId].oam.tileNum = gSprites[spriteId].data[0] + 20; + PlaySE(SE_TK_WARPIN); + break; + } + gSprites[spriteId].data[1] = 0; + gSprites[spriteId].invisible = FALSE; + gSprites[spriteId].callback = sub_80DD6DC; + sContest.unk1920A_4 = 1; +} + +void sub_80DD940(void) +{ + s32 i; + + for (i = 0; i < 5; i++) + { + const u8 *src; + + if (i < sContest.applauseLevel) + src = gContestApplauseMeterGfx + 64; + else + src = gContestApplauseMeterGfx; + CpuSet(src, (void *)(VRAM + 0x10000 + (gSprites[sContest.applauseMeterSpriteId].oam.tileNum + 17 + i) * 32), 0x04000008); + CpuSet(src + 32, (void *)(VRAM + 0x10000 + (gSprites[sContest.applauseMeterSpriteId].oam.tileNum + 25 + i) * 32), 0x04000008); + + if (sContest.applauseLevel > 4) + sub_80DDA20(); + } +} + +s8 Contest_GetMoveExcitement(u16 move) +{ + return gContestExcitementTable[gSpecialVar_ContestCategory][gContestMoves[move].contestCategory]; +} + +u8 sub_80DDA20(void) +{ + u8 taskId = CreateTask(c3_08130B10, 10); + + gTasks[taskId].data[1] = 1; + gTasks[taskId].data[2] = IndexOfSpritePaletteTag(0x0ABE2); + return taskId; +} + +void c3_08130B10(u8 taskId) +{ + if (++gTasks[taskId].data[0] == 1) + { + gTasks[taskId].data[0] = 0; + if (gTasks[taskId].data[3] == 0) + gTasks[taskId].data[4]++; + else + gTasks[taskId].data[4]--; + BlendPalette(264 + gTasks[taskId].data[2] * 16, 1, gTasks[taskId].data[4], RGB(31, 31, 31)); + if (gTasks[taskId].data[4] == 0 || gTasks[taskId].data[4] == 16) + { + gTasks[taskId].data[3] ^= 1; + if (sContest.applauseLevel < 5) + { + BlendPalette(264 + gTasks[taskId].data[2] * 16, 1, 0, RGB(31, 0, 0)); + DestroyTask(taskId); + } + } + } +} + +void sub_80DDB0C(void) +{ + CreateTask(sub_80DDB6C, 10); + gSprites[sContest.applauseMeterSpriteId].pos2.x = -70; + gSprites[sContest.applauseMeterSpriteId].invisible = FALSE; + sContest.unk1920A_6 = 1; +} + +void sub_80DDB6C(u8 taskId) +{ + struct Sprite *sprite = &gSprites[sContest.applauseMeterSpriteId]; + + gTasks[taskId].data[10] += 1664; + sprite->pos2.x += gTasks[taskId].data[10] >> 8; + gTasks[taskId].data[10] = gTasks[taskId].data[10] & 0xFF; + if (sprite->pos2.x > 0) + sprite->pos2.x = 0; + if (sprite->pos2.x == 0) + { + sContest.unk1920A_6 = 0; + DestroyTask(taskId); + } +} + +void sub_80DDBE8(void) +{ + if (gSprites[sContest.applauseMeterSpriteId].invisible == TRUE) + { + sContest.unk1920A_6 = 0; + } + else + { + CreateTask(task08_080CD1CC, 10); + gSprites[sContest.applauseMeterSpriteId].pos2.x = 0; + sContest.unk1920A_6 = 1; + } +} + +void task08_080CD1CC(u8 taskId) +{ + struct Sprite *sprite = &gSprites[sContest.applauseMeterSpriteId]; + + gTasks[taskId].data[10] += 1664; + sprite->pos2.x -= gTasks[taskId].data[10] >> 8; + gTasks[taskId].data[10] = gTasks[taskId].data[10] & 0xFF; + if (sprite->pos2.x < -70) + sprite->pos2.x = -70; + if (sprite->pos2.x == -70) + { + sprite->invisible = TRUE; + sContest.unk1920A_6 = 0; + DestroyTask(taskId); + } +} + +void sub_80DDCDC(s8 a) +{ + u8 taskId = CreateTask(sub_80DDD20, 5); + + gTasks[taskId].data[0] = a; + sContest.unk1920A_5 = 1; +} + +void sub_80DDD20(u8 taskId) +{ + switch (gTasks[taskId].data[10]) + { + case 0: + sub_80DDB0C(); + gTasks[taskId].data[10]++; + break; + case 1: + if (!sContest.unk1920A_6) + { + gTasks[taskId].data[10]++; + } + break; + case 2: + if (gTasks[taskId].data[11]++ > 20) + { + gTasks[taskId].data[11] = 0; + sub_80DD940(); + sContest.unk1920A_5 = 0; + DestroyTask(taskId); + } + break; + } +} + +void unref_sub_80DDDA8(void) +{ + gSprites[sContest.applauseMeterSpriteId].pos2.x = 0; + gSprites[sContest.applauseMeterSpriteId].invisible = FALSE; +} + +void unref_sub_80DDDE4(void) +{ + gSprites[sContest.applauseMeterSpriteId].invisible = TRUE; +} + +void sub_80DDE0C(void) +{ + CreateTask(sub_80DDE30, 15); + sContest.unk1920A_7 = 1; +} + +void sub_80DDE30(u8 taskId) +{ + if (gTasks[taskId].data[10]++ > 6) + { + gTasks[taskId].data[10] = 0; + if (gTasks[taskId].data[11] == 0) + { + RequestDma3Copy(shared16800, (void *)(VRAM + 0x2000), 0x1000, 1); + } + else + { + RequestDma3Copy(shared15800, (void *)(VRAM + 0x2000), 0x1000, 1); + gTasks[taskId].data[12]++; + } + + gTasks[taskId].data[11] ^= 1; + + if (gTasks[taskId].data[12] == 9) + { + sContest.unk1920A_7 = 0; + DestroyTask(taskId); + } + } +} + +#define tBlendColor data[0] +#define tBlendCoeff data[1] + +void sub_80DDED0(s8 a, s8 b) +{ + u8 taskId = CreateTask(sub_80DDF80, 10); + u16 blendColor; + u8 blendCoeff; + u8 r3; + + if (a > 0) + { + blendColor = RGB(30, 27, 8); + if (b > 0) + { + blendCoeff = 0; + r3 = sContest.applauseLevel * 3; + } + else + { + blendCoeff = sContest.applauseLevel * 3; + r3 = 0; + } + } + else + { + blendColor = 0; + if (b > 0) + { + blendCoeff = 0; + r3 = 12; + } + else + { + blendCoeff = 12; + r3 = 0; + } + } + gTasks[taskId].tBlendColor = blendColor; + gTasks[taskId].tBlendCoeff = blendCoeff; + gTasks[taskId].data[2] = b; + gTasks[taskId].data[3] = r3; + sContest.unk1920B_0 = 0; +} + +void sub_80DDF80(u8 taskId) +{ + if (gTasks[taskId].data[10]++ >= 0) + { + gTasks[taskId].data[10] = 0; + if (gTasks[taskId].data[2] > 0) + gTasks[taskId].tBlendCoeff++; + else + gTasks[taskId].tBlendCoeff--; + BlendPalette(17, 1, gTasks[taskId].tBlendCoeff, gTasks[taskId].tBlendColor); + BlendPalette(26, 1, gTasks[taskId].tBlendCoeff, gTasks[taskId].tBlendColor); + if (gTasks[taskId].tBlendCoeff == gTasks[taskId].data[3]) + { + DestroyTask(taskId); + sContest.unk1920B_0 = 0; + } + } +} + +#undef tBlendColor +#undef tBlendCoeff + +void sub_80DE008(bool8 a) +{ + s32 i; + + for (i = 0; i < 4; i++) + { + if (sContestantStatus[i].turnOrderMod != 0 && a) + { + CpuSet( + GetTurnOrderNumberGfx(i), + (void *)(VRAM + 0x10000 + (gSprites[gContestResources->field_14[i].unk1].oam.tileNum + 6) * 32), + 0x04000008); + gSprites[gContestResources->field_14[i].unk1].pos1.y = gUnknown_08587A70[gUnknown_02039F26[i]]; + gSprites[gContestResources->field_14[i].unk1].invisible = FALSE; + } + else + { + gSprites[gContestResources->field_14[i].unk1].invisible = TRUE; + } + } +} + +const u8 *GetTurnOrderNumberGfx(u8 contestant) +{ + if (sContestantStatus[contestant].turnOrderMod != 1) + return gContestNextTurnRandomGfx; + else + return gContestNextTurnNumbersGfx + sContestantStatus[contestant].nextTurnOrder * 32; +} + +void sub_80DE12C(void) +{ + s32 r7 = 0; + u32 r10 = 2; + u32 r8 = 1; + u32 r9 = 0x11; + + for(r7 = 0; r7 < 4; r7++) + { + u32 r6; + u16 var; + if(shared192D0.unnervedPokes[r7] != 0) + if(Contest_IsMonsTurnDisabled(r7) == FALSE) + { + r6 = gUnknown_02039F26[r7] * 5 + 2; + var = sub_80DB748(3); + ContestBG_FillBoxWithIncrementingTile(0, var, 0x14, r6, r10, r8, r9, r8); + var += 16; + ContestBG_FillBoxWithIncrementingTile(0, var, 0x14, r6 + 1, r10, r8, r9, r8); + PlaySE(SE_C_PASI); + } + } +} + +bool8 sub_80DE1E8(u8 a) +{ + if (sContestantStatus[a].disappointedRepeat || sContestantStatus[a].nervous) + return FALSE; + else + return TRUE; +} + +#ifdef NONMATCHING +void sub_80DE224(void) +{ + s32 i; + u16 bg0Cnt; + u16 bg1Cnt; + u16 bg2Cnt; + u16 var; + + bg1Cnt = GetGpuReg(REG_OFFSET_BG1CNT); + ((struct BgCnt *)&bg1Cnt)->priority = 0; + ((struct BgCnt *)&bg1Cnt)->screenSize = 2; + ((struct BgCnt *)&bg1Cnt)->areaOverflowMode = 0; + ((struct BgCnt *)&bg1Cnt)->charBaseBlock = 0; + + + SetGpuReg(REG_OFFSET_BG1CNT, bg1Cnt); + + bg0Cnt = GetGpuReg(REG_OFFSET_BG0CNT); + ((struct BgCnt *)&bg0Cnt)->priority = 0; + + bg2Cnt = GetGpuReg(REG_OFFSET_BG2CNT); + ((struct BgCnt *)&bg2Cnt)->priority = 0; + + SetGpuReg(REG_OFFSET_BG0CNT, bg0Cnt); + SetGpuReg(REG_OFFSET_BG2CNT, bg2Cnt); + + gBattle_BG1_X = DISPLAY_WIDTH; + gBattle_BG1_Y = DISPLAY_HEIGHT; + SetGpuReg(REG_OFFSET_BG1HOFS, DISPLAY_WIDTH); + SetGpuReg(REG_OFFSET_BG1VOFS, DISPLAY_HEIGHT); + var = 0; + + CpuSet(&var, &sContest.unk19214, 0x05000400); + + CopyToBgTilemapBuffer(1, gUnknown_08C17980, 0, 0); + Contest_SetBgCopyFlags(1); + + for (i = 0; i < 4; i++) + { + gSprites[gContestResources->field_14[i].unk0].oam.priority = 1; + gSprites[gContestResources->field_14[i].unk1].oam.priority = 1; + } + + /* ((vBgCnt *)®_BG1CNT)->priority = 0; + ((vBgCnt *)®_BG1CNT)->screenSize = 1; + ((vBgCnt *)®_BG1CNT)->areaOverflowMode = 0; + + + + DmaClear32(3, (void *)(VRAM + 0xF000), 0x1000); + LZDecompressVram(gUnknown_08D17C3C, (void *)(VRAM + 0xF000)); + + ((vBgCnt *)®_BG1CNT)->charBaseBlock = 0; + + for (i = 0; i < 4; i++) + { + gSprites[shared19338[i].unk0].oam.priority = 1; + gSprites[shared19338[i].unk1].oam.priority = 1; + } + + ((vBgCnt *)®_BG2CNT)->priority = 1; + ((vBgCnt *)®_BG0CNT)->priority = 1; + ((vBgCnt *)®_BG1CNT)->screenSize = 2; */ +} +#else +NAKED +void sub_80DE224(void) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + mov r7, r8\n\ + push {r7}\n\ + sub sp, 0xC\n\ + movs r0, 0xA\n\ + bl GetGpuReg\n\ + mov r1, sp\n\ + strh r0, [r1]\n\ + mov r2, sp\n\ + ldrb r1, [r2]\n\ + movs r4, 0x4\n\ + negs r4, r4\n\ + adds r0, r4, 0\n\ + ands r0, r1\n\ + strb r0, [r2]\n\ + ldrb r1, [r2, 0x1]\n\ + movs r0, 0x3F\n\ + ands r0, r1\n\ + movs r1, 0x80\n\ + orrs r0, r1\n\ + strb r0, [r2, 0x1]\n\ + ldrb r1, [r2, 0x1]\n\ + movs r0, 0x21\n\ + negs r0, r0\n\ + ands r0, r1\n\ + strb r0, [r2, 0x1]\n\ + ldrb r1, [r2]\n\ + movs r0, 0xD\n\ + negs r0, r0\n\ + mov r8, r0\n\ + ands r0, r1\n\ + strb r0, [r2]\n\ + mov r0, sp\n\ + ldrh r1, [r0]\n\ + movs r0, 0xA\n\ + bl SetGpuReg\n\ + movs r0, 0x8\n\ + bl GetGpuReg\n\ + mov r6, sp\n\ + adds r6, 0x2\n\ + strh r0, [r6]\n\ + movs r0, 0xC\n\ + bl GetGpuReg\n\ + add r5, sp, 0x4\n\ + strh r0, [r5]\n\ + ldrb r1, [r6]\n\ + adds r0, r4, 0\n\ + ands r0, r1\n\ + movs r1, 0x1\n\ + orrs r0, r1\n\ + strb r0, [r6]\n\ + ldrb r0, [r5]\n\ + ands r4, r0\n\ + orrs r4, r1\n\ + strb r4, [r5]\n\ + ldrh r1, [r6]\n\ + movs r0, 0x8\n\ + bl SetGpuReg\n\ + ldrh r1, [r5]\n\ + movs r0, 0xC\n\ + bl SetGpuReg\n\ + ldr r1, =gBattle_BG1_X\n\ + movs r0, 0xF0\n\ + strh r0, [r1]\n\ + ldr r4, =gBattle_BG1_Y\n\ + movs r0, 0xA0\n\ + strh r0, [r4]\n\ + movs r0, 0x14\n\ + movs r1, 0xF0\n\ + bl SetGpuReg\n\ + ldrh r1, [r4]\n\ + movs r0, 0x16\n\ + bl SetGpuReg\n\ + movs r0, 0\n\ + str r0, [sp, 0x8]\n\ + add r0, sp, 0x8\n\ + ldr r4, =gContestResources\n\ + ldr r1, [r4]\n\ + ldr r1, [r1, 0x28]\n\ + ldr r2, =0x05000400\n\ + bl CpuSet\n\ + ldr r1, =gUnknown_08C17980\n\ + movs r0, 0x1\n\ + movs r2, 0\n\ + movs r3, 0\n\ + bl CopyToBgTilemapBuffer\n\ + movs r0, 0x1\n\ + bl Contest_SetBgCopyFlags\n\ + movs r5, 0\n\ + ldr r7, =gSprites\n\ + movs r6, 0x4\n\ +_080DE2F0:\n\ + ldr r0, [r4]\n\ + ldr r0, [r0, 0x14]\n\ + lsls r3, r5, 2\n\ + adds r0, r3, r0\n\ + ldrb r0, [r0]\n\ + lsls r1, r0, 4\n\ + adds r1, r0\n\ + lsls r1, 2\n\ + adds r1, r7\n\ + ldrb r2, [r1, 0x5]\n\ + mov r0, r8\n\ + ands r0, r2\n\ + orrs r0, r6\n\ + strb r0, [r1, 0x5]\n\ + ldr r0, [r4]\n\ + ldr r0, [r0, 0x14]\n\ + adds r3, r0\n\ + ldrb r0, [r3, 0x1]\n\ + lsls r1, r0, 4\n\ + adds r1, r0\n\ + lsls r1, 2\n\ + adds r1, r7\n\ + ldrb r2, [r1, 0x5]\n\ + mov r0, r8\n\ + ands r0, r2\n\ + orrs r0, r6\n\ + strb r0, [r1, 0x5]\n\ + adds r5, 0x1\n\ + cmp r5, 0x3\n\ + ble _080DE2F0\n\ + add sp, 0xC\n\ + pop {r3}\n\ + mov r8, r3\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided\n"); +} +#endif + +#ifdef NONMATCHING +void sub_80DE350(void) +{ + s32 i; + s16 var; + u16 bg1Cnt; + u8 *spriteID; + u16 something; + + RequestDma3Fill(0,(void *)(VRAM + 0x8000), 0x2000, 0x1); + //DmaClearLarge32(3, (void *)(VRAM + 0x8000), 0x2000, 0x1000); + + /*bg1Cnt = 0; + something = 0; + var = bg1Cnt; + spriteID = (u8 *)&gContestResources;*/ + + var = 0; + + + CpuSet(&var, &gContestResources->field_24[1], 0x05000400); + //CpuSet(src, (void *)(VRAM + 0x10000 + (gSprites[sContest.applauseMeterSpriteId].oam.tileNum + 17 + i) + Contest_SetBgCopyFlags(1); + + //DmaClear32(3, (void *)(VRAM + 0xF000), 0x1000); + + bg1Cnt = GetGpuReg(REG_OFFSET_BG1CNT); + something = bg1Cnt; + ((struct BgCnt *) &bg1Cnt)->priority = 1; + ((struct BgCnt *) &bg1Cnt)->screenSize = 1; + ((struct BgCnt *) &bg1Cnt)->areaOverflowMode = 0; + ((struct BgCnt *) &bg1Cnt)->charBaseBlock = 2; + + SetGpuReg(REG_OFFSET_BG1CNT, bg1Cnt); + + gBattle_BG1_X = 0; + gBattle_BG1_Y = 0; + + for (i = 0; i < 4; i++) + { + gSprites[gContestResources->field_14[i].unk0].oam.priority = 0; + gSprites[gContestResources->field_14[i].unk1].oam.priority = 0; + } +} +#else +NAKED +void sub_80DE350(void) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + sub sp, 0x8\n\ + ldr r1, =0x06008000\n\ + movs r2, 0x80\n\ + lsls r2, 6\n\ + movs r0, 0\n\ + movs r3, 0x1\n\ + bl RequestDma3Fill\n\ + movs r5, 0\n\ + str r5, [sp]\n\ + ldr r6, =gContestResources\n\ + ldr r0, [r6]\n\ + ldr r1, [r0, 0x28]\n\ + ldr r2, =0x05000400\n\ + mov r0, sp\n\ + bl CpuSet\n\ + movs r0, 0x1\n\ + bl Contest_SetBgCopyFlags\n\ + movs r0, 0xA\n\ + bl GetGpuReg\n\ + add r3, sp, 0x4\n\ + strh r0, [r3]\n\ + ldrb r1, [r3]\n\ + movs r0, 0x4\n\ + negs r0, r0\n\ + ands r0, r1\n\ + movs r1, 0x1\n\ + orrs r0, r1\n\ + strb r0, [r3]\n\ + mov r1, sp\n\ + adds r1, 0x5\n\ + ldrb r2, [r1]\n\ + movs r0, 0x3F\n\ + ands r0, r2\n\ + strb r0, [r1]\n\ + ldrb r2, [r1]\n\ + movs r0, 0x21\n\ + negs r0, r0\n\ + ands r0, r2\n\ + strb r0, [r1]\n\ + ldrb r1, [r3]\n\ + movs r4, 0xD\n\ + negs r4, r4\n\ + adds r0, r4, 0\n\ + ands r0, r1\n\ + movs r1, 0x8\n\ + orrs r0, r1\n\ + strb r0, [r3]\n\ + ldrh r1, [r3]\n\ + movs r0, 0xA\n\ + bl SetGpuReg\n\ + ldr r0, =gBattle_BG1_X\n\ + strh r5, [r0]\n\ + ldr r0, =gBattle_BG1_Y\n\ + strh r5, [r0]\n\ + ldr r7, =gSprites\n\ +_080DE3CA:\n\ + ldr r0, [r6]\n\ + ldr r0, [r0, 0x14]\n\ + lsls r3, r5, 2\n\ + adds r0, r3, r0\n\ + ldrb r0, [r0]\n\ + lsls r1, r0, 4\n\ + adds r1, r0\n\ + lsls r1, 2\n\ + adds r1, r7\n\ + ldrb r2, [r1, 0x5]\n\ + adds r0, r4, 0\n\ + ands r0, r2\n\ + strb r0, [r1, 0x5]\n\ + ldr r0, [r6]\n\ + ldr r0, [r0, 0x14]\n\ + adds r3, r0\n\ + ldrb r0, [r3, 0x1]\n\ + lsls r1, r0, 4\n\ + adds r1, r0\n\ + lsls r1, 2\n\ + adds r1, r7\n\ + ldrb r2, [r1, 0x5]\n\ + adds r0, r4, 0\n\ + ands r0, r2\n\ + strb r0, [r1, 0x5]\n\ + adds r5, 0x1\n\ + cmp r5, 0x3\n\ + ble _080DE3CA\n\ + add sp, 0x8\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool\n\ + .syntax divided\n"); +} +#endif + +void sub_80DE424(u8 taskId) +{ + gBattle_BG1_X = 0; + gBattle_BG1_Y = DISPLAY_HEIGHT; + PlaySE12WithPanning(SE_C_MAKU_D, 0); + gTasks[taskId].func = sub_80DE464; +} + +void sub_80DE464(u8 taskId) +{ + if ((s16)(gBattle_BG1_Y -= 7) < 0) + gBattle_BG1_Y = 0; + if (gBattle_BG1_Y == 0) + { + gTasks[taskId].data[0] = 0; + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[2] = 0; + gTasks[taskId].func = sub_80DE4A8; + } +} + +void sub_80DE4A8(u8 taskId) +{ + s32 i; + + switch (gTasks[taskId].data[0]) + { + case 0: + for (i = 0; i < 4; i++) + sContest.unk19218[i] = gUnknown_02039F26[i]; + sub_80DBF90(); + sub_80DC864(); + sub_80DB69C(); + sub_80DD04C(); + sub_80DE008(TRUE); + sub_80DC44C(); + gTasks[taskId].data[0] = 1; + break; + case 1: + if (gIsLinkContest & 1) + { + u8 taskId2; + + sContest.unk1920B_2 = 1; + if (sub_80DA8A4()) + sub_80DBAA0(); + taskId2 = CreateTask(sub_80FCC88, 0); + SetTaskFuncWithFollowupFunc(taskId2, sub_80FCC88, sub_80DA110); + sub_80DBF68(); + gTasks[taskId].data[0] = 2; + } + else + { + sub_80DBAA0(); + gTasks[taskId].data[0] = 3; + } + break; + case 2: + if (!sContest.unk1920B_2) + gTasks[taskId].data[0] = 3; + break; + case 3: + sub_80DB884(); + sub_80DB2BC(); + gTasks[taskId].data[0] = 0; + gTasks[taskId].func = sub_80DE5F4; + break; + } +} + +void sub_80DE5C0(u8 taskId) +{ + if ((s16)(gBattle_BG1_Y += 7) > DISPLAY_HEIGHT) + gTasks[taskId].func = sub_80DA4F4; +} + +void sub_80DE5F4(u8 taskId) +{ + if (gTasks[taskId].data[2] < 10) + { + gTasks[taskId].data[2]++; + } + else + { + if (gTasks[taskId].data[1] == 0) + { + if (gTasks[taskId].data[0] == 16) + gTasks[taskId].data[1]++; + else + gTasks[taskId].data[0]++; + } + else + { + if (gTasks[taskId].data[0] == 0) + { + gTasks[taskId].data[1] = 0; + gTasks[taskId].data[2] = 0; + gTasks[taskId].func = sub_80DE65C; + } + else + { + gTasks[taskId].data[0]--; + } + } + } +} + +void sub_80DE65C(u8 taskId) +{ + if (gTasks[taskId].data[2] < 10) + { + gTasks[taskId].data[2]++; + } + else + { + gTasks[taskId].data[2] = 0; + PlaySE12WithPanning(SE_C_MAKU_U, 0); + gTasks[taskId].func = sub_80DE5C0; + } +} + +void sub_80DE69C(u8 a) +{ + s32 i; + u8 taskId; + + for (i = 0; i < 4; i++) + { + gSprites[gContestResources->field_14[i].unk0].oam.matrixNum = AllocOamMatrix(); + gSprites[gContestResources->field_14[i].unk0].oam.affineMode = 1; + StartSpriteAffineAnim(&gSprites[gContestResources->field_14[i].unk0], a); + if (a == 2) + { + AnimateSprite(&gSprites[gContestResources->field_14[i].unk0]); + gSprites[gContestResources->field_14[i].unk0].invisible = FALSE; + } + } + taskId = CreateTask(sub_80DE794, 5); + gTasks[taskId].data[0] = a; + sContest.unk1920B_1 = 1; +} + +void sub_80DE794(u8 taskId) +{ + s32 i; + + if (gSprites[gContestResources->field_14[0].unk0].affineAnimEnded) + { + if ((u8)gTasks[taskId].data[0] == 1) + { + for (i = 0; i < 4; i++) + gSprites[gContestResources->field_14[i].unk0].invisible = TRUE; + } + for (i = 0; i < 4; i++) + FreeSpriteOamMatrix(&gSprites[gContestResources->field_14[i].unk0]); + sContest.unk1920B_1 = 0; + DestroyTask(taskId); + } +} + +u16 SanitizeMove(u16 move) +{ + if (move >= MOVES_COUNT) + move = MOVE_POUND; + return move; +} + +u16 SanitizeSpecies(u16 species) +{ + if (species >= NUM_SPECIES) + species = SPECIES_NONE; + return species; +} + +void sub_80DE864(u8 a) +{ + s32 i; + u16 move = SanitizeMove(sContestantStatus[a].currMove); + u16 species = SanitizeSpecies(gContestMons[a].species); + u8 r5_2; + + memset(&gContestResources->field_18->species, 0, 0x14); + ClearBattleAnimationVars(); + for (i = 0; i < 4; i++) + gBattleMonForms[i] = 0; + switch (move) + { + case MOVE_CURSE: + if (gBaseStats[species].type1 == TYPE_GHOST || gBaseStats[species].type2 == TYPE_GHOST) + gAnimMoveTurn = 0; + else + gAnimMoveTurn = 1; + break; + case MOVE_TRANSFORM: + case MOVE_ROLE_PLAY: + r5_2 = sContestantStatus[a].unk1B; + gContestResources->field_18->unk2 = SanitizeSpecies(gContestMons[r5_2].species); + gContestResources->field_18->unk10 = gContestMons[r5_2].personality; + gContestResources->field_18->unk4_0 = 1; + break; + case MOVE_RETURN: + gAnimFriendship = 0xFF; + break; + case MOVE_FRUSTRATION: + gAnimFriendship = 0; + break; + case MOVE_SOLAR_BEAM: + case MOVE_RAZOR_WIND: + case MOVE_SKULL_BASH: + case MOVE_SKY_ATTACK: + if (sContest.unk1925E == 0) + { + sContest.unk1925E = 2; + gAnimMoveTurn = 0; + } + else + { + gAnimMoveTurn = 1; + } + break; + } + sub_80DEA5C(); +} + +void sub_80DE9B0(u8 unused) +{ + memset(&gContestResources->field_18->species, 0, 0x14); + if (sContest.unk1925E != 0) + sContest.unk1925E--; +} + +void sub_80DE9DC(u8 a) +{ + gContestResources->field_18->unk5 = a; + gContestResources->field_18->species = SanitizeSpecies(gContestMons[a].species); + gContestResources->field_18->unk8 = gContestMons[a].personality; + gContestResources->field_18->unkC = gContestMons[a].otId; +} + +void sub_80DEA20(void) +{ + gBattlerSpriteIds[3] = CreateInvisibleSpriteWithCallback(SpriteCallbackDummy); + InitSpriteAffineAnim(&gSprites[gBattlerSpriteIds[gBattlerTarget]]); + sub_80DEA5C(); +} + +void sub_80DEA5C(void) +{ + struct Sprite *sprite = &gSprites[gBattlerSpriteIds[3]]; + + sprite->pos2.x = 0; + sprite->pos2.y = 0; + sprite->pos1.x = GetBattlerSpriteCoord(3, 0); + sprite->pos1.y = GetBattlerSpriteCoord(3, 1); + sprite->invisible = TRUE; +} + +void SelectContestMoveBankTarget(u16 move) +{ + switch (gBattleMoves[move].target) + { + case MOVE_TARGET_USER_OR_SELECTED: + case MOVE_TARGET_USER: + gBattlerTarget = 2; + break; + case MOVE_TARGET_SELECTED: + case MOVE_TARGET_RANDOM: + case MOVE_TARGET_BOTH: + case MOVE_TARGET_FOES_AND_ALLY: + default: + gBattlerTarget = 3; + break; + } +} + +#ifdef NONMATCHING +void Contest_PrintTextToBg0WindowStd(u32 a, const u8 *b) +{ + struct TextPrinterTemplate printerTemplate; + + printerTemplate.currentChar = b; + printerTemplate.windowId = a; + printerTemplate.fontId = 1; + printerTemplate.x = 0; + printerTemplate.y = 1; + printerTemplate.currentX = 0; + printerTemplate.currentY = 1; + printerTemplate.letterSpacing = 0; + printerTemplate.lineSpacing = 0; + + printerTemplate.unk = a & (1 - 0x11); + printerTemplate.unk = 0xF0; + printerTemplate.bgColor = a & (1 - 0x11) & 0x80; + + + + + AddTextPrinter(&printerTemplate, 0, 0); + PutWindowTilemap(a); + Contest_SetBgCopyFlags(0); +} +#else +NAKED +void Contest_PrintTextToBg0WindowStd(u32 a, const u8 *b) +{ + asm(".syntax unified\n\ + push {r4,lr}\n\ + sub sp, 0x10\n\ + adds r4, r0, 0\n\ + str r1, [sp]\n\ + mov r0, sp\n\ + movs r2, 0\n\ + strb r4, [r0, 0x4]\n\ + movs r1, 0x1\n\ + strb r1, [r0, 0x5]\n\ + strb r2, [r0, 0x6]\n\ + strb r1, [r0, 0x7]\n\ + strb r2, [r0, 0x8]\n\ + strb r1, [r0, 0x9]\n\ + strb r2, [r0, 0xA]\n\ + strb r2, [r0, 0xB]\n\ + mov r3, sp\n\ + ldrb r2, [r3, 0xC]\n\ + subs r1, 0x11\n\ + adds r0, r1, 0\n\ + ands r0, r2\n\ + strb r0, [r3, 0xC]\n\ + mov r2, sp\n\ + movs r0, 0xF0\n\ + strb r0, [r2, 0xC]\n\ + ldrb r0, [r2, 0xD]\n\ + ands r1, r0\n\ + strb r1, [r2, 0xD]\n\ + mov r1, sp\n\ + movs r0, 0x80\n\ + strb r0, [r1, 0xD]\n\ + mov r0, sp\n\ + movs r1, 0\n\ + movs r2, 0\n\ + bl AddTextPrinter\n\ + lsls r4, 24\n\ + lsrs r4, 24\n\ + adds r0, r4, 0\n\ + bl PutWindowTilemap\n\ + movs r0, 0\n\ + bl Contest_SetBgCopyFlags\n\ + add sp, 0x10\n\ + pop {r4}\n\ + pop {r0}\n\ + bx r0\n\ + .syntax divided\n"); +} +#endif + +#ifdef NONMATCHING +void Contest_PrintTextToBg0WindowAt(u32 a, u8 *b, s32 c, u8 d, u8 e) +{ + struct TextPrinterTemplate printerTemplate; + + printerTemplate.currentChar = b; + printerTemplate.windowId = a; + printerTemplate.fontId = 1; + printerTemplate.x = c; + printerTemplate.y = d; + printerTemplate.currentX = c; + printerTemplate.currentY = d; + printerTemplate.letterSpacing = 0; + printerTemplate.lineSpacing = 0; + + printerTemplate.unk = a & (1 - 0x10); + printerTemplate.unk = 0xF0; + printerTemplate.bgColor = a & (1 - 0x11) & 0x80; + + + + + AddTextPrinter(&printerTemplate, 0, 0); + PutWindowTilemap(a); + Contest_SetBgCopyFlags(0); +} +#else +NAKED +void Contest_PrintTextToBg0WindowAt(u32 a, u8 *b, s32 c, u8 d, u8 e) +{ + asm(".syntax unified\n\ + push {r4,r5,lr}\n\ + sub sp, 0x10\n\ + adds r5, r0, 0\n\ + ldr r4, [sp, 0x1C]\n\ + str r1, [sp]\n\ + mov r0, sp\n\ + movs r1, 0\n\ + strb r5, [r0, 0x4]\n\ + strb r4, [r0, 0x5]\n\ + strb r2, [r0, 0x6]\n\ + strb r3, [r0, 0x7]\n\ + strb r2, [r0, 0x8]\n\ + strb r3, [r0, 0x9]\n\ + strb r1, [r0, 0xA]\n\ + strb r1, [r0, 0xB]\n\ + mov r3, sp\n\ + ldrb r2, [r3, 0xC]\n\ + subs r1, 0x10\n\ + adds r0, r1, 0\n\ + ands r0, r2\n\ + strb r0, [r3, 0xC]\n\ + mov r2, sp\n\ + movs r0, 0xF0\n\ + strb r0, [r2, 0xC]\n\ + ldrb r0, [r2, 0xD]\n\ + ands r1, r0\n\ + strb r1, [r2, 0xD]\n\ + mov r1, sp\n\ + movs r0, 0x80\n\ + strb r0, [r1, 0xD]\n\ + mov r0, sp\n\ + movs r1, 0\n\ + movs r2, 0\n\ + bl AddTextPrinter\n\ + lsls r5, 24\n\ + lsrs r5, 24\n\ + adds r0, r5, 0\n\ + bl PutWindowTilemap\n\ + movs r0, 0\n\ + bl Contest_SetBgCopyFlags\n\ + add sp, 0x10\n\ + pop {r4,r5}\n\ + pop {r0}\n\ + bx r0\n\ + .syntax divided\n"); +} +#endif + +#ifdef NONMATCHING +void Contest_StartTextPrinter(const u8 *a, u32 b) +{ + struct TextPrinterTemplate printerTemplate; + u8 var; + + printerTemplate.currentChar = a; + printerTemplate.windowId = b; + printerTemplate.fontId = 1; + printerTemplate.x = 0; + printerTemplate.y = 1; + printerTemplate.currentX = 0; + printerTemplate.currentY = 1; + printerTemplate.letterSpacing = 0; + printerTemplate.lineSpacing = 0; + + printerTemplate.unk = b & -0x10; + printerTemplate.unk = 0x10; + printerTemplate.bgColor = b & (1 - 0x10) & 0x80; + + if(!b) + { + var = 0; + AddTextPrinter(&printerTemplate, var, 0); + } + else + { + if(gIsLinkContest & 1) + { + var = 4; + AddTextPrinter(&printerTemplate, var, 0); + } + else + { + var = GetPlayerTextSpeedDelay(); + AddTextPrinter(&printerTemplate, var, 0); + } + } + + PutWindowTilemap(4); + Contest_SetBgCopyFlags(0); + +} +} +#else +NAKED +void Contest_StartTextPrinter(const u8 *a, u32 b) +{ + asm(".syntax unified\n\ + push {r4,r5,lr}\n\ + sub sp, 0x10\n\ + str r0, [sp]\n\ + mov r2, sp\n\ + movs r3, 0\n\ + movs r0, 0x4\n\ + strb r0, [r2, 0x4]\n\ + mov r0, sp\n\ + movs r5, 0x1\n\ + strb r5, [r0, 0x5]\n\ + strb r3, [r0, 0x6]\n\ + strb r5, [r0, 0x7]\n\ + strb r3, [r0, 0x8]\n\ + strb r5, [r0, 0x9]\n\ + strb r3, [r0, 0xA]\n\ + strb r3, [r0, 0xB]\n\ + mov r4, sp\n\ + ldrb r3, [r4, 0xC]\n\ + movs r2, 0x10\n\ + negs r2, r2\n\ + adds r0, r2, 0\n\ + ands r0, r3\n\ + strb r0, [r4, 0xC]\n\ + mov r3, sp\n\ + movs r0, 0x10\n\ + strb r0, [r3, 0xC]\n\ + ldrb r0, [r3, 0xD]\n\ + ands r2, r0\n\ + strb r2, [r3, 0xD]\n\ + mov r2, sp\n\ + movs r0, 0x80\n\ + strb r0, [r2, 0xD]\n\ + cmp r1, 0\n\ + bne _080DEC80\n\ + mov r0, sp\n\ + movs r1, 0\n\ + movs r2, 0\n\ + bl AddTextPrinter\n\ + b _080DECA4\n\ +_080DEC80:\n\ + ldr r0, =gIsLinkContest\n\ + ldrb r1, [r0]\n\ + adds r0, r5, 0\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _080DEC94\n\ + movs r1, 0x4\n\ + b _080DEC9C\n\ + .pool\n\ +_080DEC94:\n\ + bl GetPlayerTextSpeedDelay\n\ + lsls r0, 24\n\ + lsrs r1, r0, 24\n\ +_080DEC9C:\n\ + mov r0, sp\n\ + movs r2, 0\n\ + bl AddTextPrinter\n\ +_080DECA4:\n\ + movs r0, 0x4\n\ + bl PutWindowTilemap\n\ + movs r0, 0\n\ + bl Contest_SetBgCopyFlags\n\ + add sp, 0x10\n\ + pop {r4,r5}\n\ + pop {r0}\n\ + bx r0\n\ + .syntax divided\n"); +} +#endif + +#ifdef NONMATCHING +void ContestBG_FillBoxWithIncrementingTile(u8 a, u16 b, u8 c, u8 d, u8 e, u8 f, u8 g, u8 h) +{ + s16 var = h; + WriteSequenceToBgTilemapBuffer(a, b, c, d, e, f, g, var); + Contest_SetBgCopyFlags(a); +} +#else +NAKED +void ContestBG_FillBoxWithIncrementingTile(u8 a, u16 b, u8 c, u8 d, u8 e, u8 f, u8 g, u8 h) +{ + asm(".syntax unified\n\ + push {r4-r7,lr}\n\ + mov r7, r8\n\ + push {r7}\n\ + sub sp, 0x10\n\ + mov r8, r0\n\ + ldr r0, [sp, 0x28]\n\ + ldr r4, [sp, 0x2C]\n\ + ldr r5, [sp, 0x30]\n\ + ldr r6, [sp, 0x34]\n\ + mov r7, r8\n\ + lsls r7, 24\n\ + lsrs r7, 24\n\ + mov r8, r7\n\ + lsls r1, 16\n\ + lsrs r1, 16\n\ + lsls r2, 24\n\ + lsrs r2, 24\n\ + lsls r3, 24\n\ + lsrs r3, 24\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + lsls r4, 24\n\ + lsrs r4, 24\n\ + lsls r5, 24\n\ + lsrs r5, 24\n\ + str r0, [sp]\n\ + str r4, [sp, 0x4]\n\ + str r5, [sp, 0x8]\n\ + lsls r6, 16\n\ + asrs r6, 16\n\ + str r6, [sp, 0xC]\n\ + mov r0, r8\n\ + bl WriteSequenceToBgTilemapBuffer\n\ + mov r0, r8\n\ + bl Contest_SetBgCopyFlags\n\ + add sp, 0x10\n\ + pop {r3}\n\ + mov r8, r3\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .syntax divided\n"); +} +#endif + +void ContestBG_FillBoxWithTile(u8 a, u16 b, u8 c, u8 d, u8 e, u8 f, u8 g) +{ + ContestBG_FillBoxWithIncrementingTile(a, b, c, d, e, f, g, 0); +} + +bool32 Contest_RunTextPrinters(void) +{ + RunTextPrinters(); + return IsTextPrinterActive(4); +} + +void Contest_SetBgCopyFlags(u32 var) +{ + sContestBgCopyFlags |= 1 << var; +} + +void ResetContestLinkResults(void) +{ + s32 i; + s32 j; + + for(i = 0; i < 5; i++) + for(j = 0; j < 4; j++) + gSaveBlock2Ptr->contestLinkResults[i][j] = 0; +} + +bool8 sub_80DEDA8(u8 a) +{ + s32 i; + u8 r7 = Random() % 3; + + for (i = 0; i < 3; i++) + { + if (gContestFinalStandings[i] == 0) + break; + } + if (a == 0xFF && i != gContestPlayerMonIndex) + return FALSE; + switch (gSpecialVar_ContestCategory) + { + case CONTEST_CATEGORY_COOL: + r7 += 0; + break; + case CONTEST_CATEGORY_BEAUTY: + r7 += 3; + break; + case CONTEST_CATEGORY_CUTE: + r7 += 6; + break; + case CONTEST_CATEGORY_SMART: + r7 += 9; + break; + case CONTEST_CATEGORY_TOUGH: + r7 += 12; + break; + } + if (a != 0xFE) + { + u8 r4 = sub_80DEFA8(a, 1); + + gSaveBlock1Ptr->contestWinners[r4].personality = gContestMons[i].personality; + gSaveBlock1Ptr->contestWinners[r4].species = gContestMons[i].species; + gSaveBlock1Ptr->contestWinners[r4].trainerId = gContestMons[i].otId; + StringCopy(gSaveBlock1Ptr->contestWinners[r4].monName, gContestMons[i].nickname); + StringCopy(gSaveBlock1Ptr->contestWinners[r4].trainerName, gContestMons[i].trainerName); + if(gIsLinkContest & 1) + gSaveBlock1Ptr->contestWinners[r4].contestRank = 4; + else + gSaveBlock1Ptr->contestWinners[r4].contestRank = gSpecialVar_ContestRank; + + if (a != 0xFF) + gSaveBlock1Ptr->contestWinners[r4].contestCategory = gSpecialVar_ContestCategory; + else + gSaveBlock1Ptr->contestWinners[r4].contestCategory = r7; + } + else + { + gUnknown_02039F3C.personality = gContestMons[i].personality; + gUnknown_02039F3C.trainerId = gContestMons[i].otId; + gUnknown_02039F3C.species = gContestMons[i].species; + StringCopy(gUnknown_02039F3C.monName, gContestMons[i].nickname); + StringCopy(gUnknown_02039F3C.trainerName, gContestMons[i].trainerName); + gUnknown_02039F3C.contestCategory = r7; + } + return TRUE; +} + +u8 sub_80DEFA8(u8 a, u8 b) +{ + s32 i; + + switch (a) + { + case 0: + case 1: + case 2: + case 3: + if (b != 0) + { + for (i = 5; i >= 1; i--) + memcpy(&gSaveBlock1Ptr->contestWinners[i], &gSaveBlock1Ptr->contestWinners[i - 1], sizeof(struct ContestWinner)); + } + return 0; + default: + switch (gSpecialVar_ContestCategory) + { + case CONTEST_CATEGORY_COOL: + return 8; + case CONTEST_CATEGORY_BEAUTY: + return 9; + case CONTEST_CATEGORY_CUTE: + return 10; + case CONTEST_CATEGORY_SMART: + return 11; + case CONTEST_CATEGORY_TOUGH: + default: + return 12; + } + } +} + +void ClearContestWinnerPicsInContestHall(void) +{ + s32 i; + + for (i = 0; i < 8; i++) + gSaveBlock1Ptr->contestWinners[i] = gUnknown_08587FA4[i]; +} + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/graphics.c b/src/graphics.c index 10efd50437..4786f1f226 100644 --- a/src/graphics.c +++ b/src/graphics.c @@ -1023,8 +1023,8 @@ const u32 gBattleAnimSpriteSheet_262[] = INCBIN_U32("graphics/battle_anims/sprit const u32 gBattleAnimSpritePalette_262[] = INCBIN_U32("graphics/battle_anims/sprites/262.gbapal.lz"); const u32 gContestNextTurnGfx[] = INCBIN_U32("graphics/contest/nextturn.4bpp.lz"); -const u8 gUnknown_08D8E9B4[] = INCBIN_U8("graphics/contest/nextturn_numbers.4bpp"); -const u8 gUnknown_08D8EA34[] = INCBIN_U8("graphics/contest/nextturn_random.4bpp"); +const u8 gContestNextTurnNumbersGfx[] = INCBIN_U8("graphics/contest/nextturn_numbers.4bpp"); +const u8 gContestNextTurnRandomGfx[] = INCBIN_U8("graphics/contest/nextturn_random.4bpp"); const u32 gBattleAnimSpriteSheet_264[] = INCBIN_U32("graphics/battle_anims/sprites/264.4bpp.lz"); const u32 gBattleAnimSpritePalette_264[] = INCBIN_U32("graphics/battle_anims/sprites/264.gbapal.lz"); From b8ff71e65e6eae5e57e5ef53894f233f57a0c14d Mon Sep 17 00:00:00 2001 From: ultima-soul Date: Sun, 6 Jan 2019 14:11:31 -0800 Subject: [PATCH 5/8] Fix build conflicts. --- src/contest.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/contest.c b/src/contest.c index a74e2c96b6..ccd8740a51 100644 --- a/src/contest.c +++ b/src/contest.c @@ -3327,7 +3327,7 @@ void sub_80DC4F0(void) LoadSpritePalette(&gUnknown_08587B08); for (i = 0; i < 4; i++) { - LoadCompressedObjectPic(&gUnknown_08587AE8[i]); + LoadCompressedSpriteSheet(&gUnknown_08587AE8[i]); gContestResources->field_14[i].unk1 = CreateSprite( &gSpriteTemplate_8587B18[i], 204, gUnknown_08587A70[gUnknown_02039F26[i]], @@ -3341,7 +3341,7 @@ void CreateApplauseMeterSprite(void) { u8 spriteId; - LoadCompressedObjectPic(&gUnknown_08587BB0); + LoadCompressedSpriteSheet(&gUnknown_08587BB0); LoadSpritePalette(&gUnknown_08587BB8); spriteId = CreateSprite(&gSpriteTemplate_8587BC8, 30, 44, 1); gSprites[spriteId].invisible = TRUE; @@ -3509,7 +3509,7 @@ u8 sub_80DC9EC(u8 a) volatile u8 zero; - LoadCompressedObjectPic(&gUnknown_08589904[a]); + LoadCompressedSpriteSheet(&gUnknown_08589904[a]); LoadSpritePalette(&gUnknown_08589924[a]); r6 = CreateSprite(&gSpriteTemplate_858998C[a], 184, r5, 29); gSprites[r8].oam.tileNum += 64; @@ -3562,7 +3562,7 @@ u8 sub_80DC9EC(u8 a) lsls r4, r1, 3\n\ ldr r0, =gUnknown_08589904\n\ adds r0, r4, r0\n\ - bl LoadCompressedObjectPic\n\ + bl LoadCompressedSpriteSheet\n\ ldr r0, =gUnknown_08589924\n\ adds r4, r0\n\ adds r0, r4, 0\n\ From f828823bf0a959e39659d4e125bbd0937169a4bc Mon Sep 17 00:00:00 2001 From: ultima-soul Date: Sun, 27 Jan 2019 20:21:30 -0800 Subject: [PATCH 6/8] Make changes --- src/contest.c | 62 ++++++++++++--------------------------------------- 1 file changed, 14 insertions(+), 48 deletions(-) diff --git a/src/contest.c b/src/contest.c index ccd8740a51..9b69df98bc 100644 --- a/src/contest.c +++ b/src/contest.c @@ -3045,7 +3045,7 @@ void sub_80DBED4(void) if ((gIsLinkContest & 1)) { gSaveBlock2Ptr->contestLinkResults[gSpecialVar_ContestCategory][gContestFinalStandings[gContestPlayerMonIndex]] = - ((gSaveBlock2Ptr->contestLinkResults[gSpecialVar_ContestCategory][gContestFinalStandings[gContestPlayerMonIndex]] + 1) > 0x270F) ? 0x270F : + ((gSaveBlock2Ptr->contestLinkResults[gSpecialVar_ContestCategory][gContestFinalStandings[gContestPlayerMonIndex]] + 1) > 9999) ? 9999 : (gSaveBlock2Ptr->contestLinkResults[gSpecialVar_ContestCategory][gContestFinalStandings[gContestPlayerMonIndex]] + 1); } @@ -3218,7 +3218,9 @@ void sub_80DC0F4(u8 taskId) m4aMPlayPitchControl(&gMPlayInfo_SE1, 0xFFFF, r10 * 256); } else + { PlaySE(SE_BOO); + } if (!r11 && !r5 && !r6) gTasks[taskId].data[2] = -gTasks[taskId].data[2]; @@ -3328,10 +3330,7 @@ void sub_80DC4F0(void) for (i = 0; i < 4; i++) { LoadCompressedSpriteSheet(&gUnknown_08587AE8[i]); - gContestResources->field_14[i].unk1 = CreateSprite( - &gSpriteTemplate_8587B18[i], - 204, gUnknown_08587A70[gUnknown_02039F26[i]], - 0); + gContestResources->field_14[i].unk1 = CreateSprite(&gSpriteTemplate_8587B18[i], 204, gUnknown_08587A70[gUnknown_02039F26[i]], 0); SetSubspriteTables(&gSprites[gContestResources->field_14[i].unk1], gSubspriteTables_8587B80); gSprites[gContestResources->field_14[i].unk1].invisible = TRUE; } @@ -3444,18 +3443,9 @@ void sub_80DC87C(u8 a) sub_80DC81C(a); r0 = a + 5; - DmaCopy16Defvars( - 3, - gPlttBufferUnfaded + r0 * 16 + 10, - gPlttBufferFaded + r0 * 16 + 10, - 2); - + DmaCopy16Defvars(3, gPlttBufferUnfaded + r0 * 16 + 10, gPlttBufferFaded + r0 * 16 + 10, 2); var = (a + 5) * 16 + 12 + a; - DmaCopy16Defvars( - 3, - gPlttBufferUnfaded + var, - gPlttBufferFaded + var, - 2); + DmaCopy16Defvars(3, gPlttBufferUnfaded + var, gPlttBufferFaded + var, 2); } void sub_80DC8D0(u8 taskId) @@ -3718,8 +3708,8 @@ void sub_80DCB78(u8 spriteId) void sub_80DCBB4(void) { - SetGpuReg(REG_OFFSET_BLDCNT, 0x3F40); - SetGpuReg(REG_OFFSET_BLDALPHA, 0x0907); + SetGpuReg(REG_OFFSET_BLDCNT, BLDALPHA_BLEND(BLDCNT_EFFECT_BLEND, BLDCNT_TGT1_ALL)); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(BLDCNT_TGT1_BG0 | BLDCNT_TGT1_BG1| BLDCNT_TGT1_BG2, BLDCNT_TGT1_BG0 | BLDCNT_TGT1_BG3)); } void sub_80DCBD0(void) @@ -3780,7 +3770,9 @@ void sub_80DCD08(void) sub_80DB2BC(); } else + { sub_80DCD48(); + } } #ifdef NONMATCHING @@ -4781,8 +4773,8 @@ void sub_80DD940(void) src = gContestApplauseMeterGfx + 64; else src = gContestApplauseMeterGfx; - CpuSet(src, (void *)(VRAM + 0x10000 + (gSprites[sContest.applauseMeterSpriteId].oam.tileNum + 17 + i) * 32), 0x04000008); - CpuSet(src + 32, (void *)(VRAM + 0x10000 + (gSprites[sContest.applauseMeterSpriteId].oam.tileNum + 25 + i) * 32), 0x04000008); + CpuCopy32(src, (void *)(VRAM + 0x10000 + (gSprites[sContest.applauseMeterSpriteId].oam.tileNum + 17 + i) * 32), 32); + CpuCopy32(src + 32, (void *)(VRAM + 0x10000 + (gSprites[sContest.applauseMeterSpriteId].oam.tileNum + 25 + i) * 32), 32); if (sContest.applauseLevel > 4) sub_80DDA20(); @@ -5031,10 +5023,7 @@ void sub_80DE008(bool8 a) { if (sContestantStatus[i].turnOrderMod != 0 && a) { - CpuSet( - GetTurnOrderNumberGfx(i), - (void *)(VRAM + 0x10000 + (gSprites[gContestResources->field_14[i].unk1].oam.tileNum + 6) * 32), - 0x04000008); + CpuCopy32(GetTurnOrderNumberGfx(i), (void *)(VRAM + 0x10000 + (gSprites[gContestResources->field_14[i].unk1].oam.tileNum + 6) * 32), 32); gSprites[gContestResources->field_14[i].unk1].pos1.y = gUnknown_08587A70[gUnknown_02039F26[i]]; gSprites[gContestResources->field_14[i].unk1].invisible = FALSE; } @@ -6167,27 +6156,4 @@ void ClearContestWinnerPicsInContestHall(void) for (i = 0; i < 8; i++) gSaveBlock1Ptr->contestWinners[i] = gUnknown_08587FA4[i]; -} - - - - - - - - - - - - - - - - - - - - - - - +} \ No newline at end of file From d633ee6f585d4d0f1b7af806a7b72ffc1719844a Mon Sep 17 00:00:00 2001 From: ultima-soul Date: Sun, 27 Jan 2019 20:48:18 -0800 Subject: [PATCH 7/8] Minor changes --- src/contest.c | 25 +++++++++++++++++-------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/contest.c b/src/contest.c index 9b69df98bc..95a09ba586 100644 --- a/src/contest.c +++ b/src/contest.c @@ -3218,9 +3218,9 @@ void sub_80DC0F4(u8 taskId) m4aMPlayPitchControl(&gMPlayInfo_SE1, 0xFFFF, r10 * 256); } else - { + { PlaySE(SE_BOO); - } + } if (!r11 && !r5 && !r6) gTasks[taskId].data[2] = -gTasks[taskId].data[2]; @@ -3330,7 +3330,10 @@ void sub_80DC4F0(void) for (i = 0; i < 4; i++) { LoadCompressedSpriteSheet(&gUnknown_08587AE8[i]); - gContestResources->field_14[i].unk1 = CreateSprite(&gSpriteTemplate_8587B18[i], 204, gUnknown_08587A70[gUnknown_02039F26[i]], 0); + gContestResources->field_14[i].unk1 = CreateSprite(&gSpriteTemplate_8587B18[i], + 204, + gUnknown_08587A70[gUnknown_02039F26[i]], + 0); SetSubspriteTables(&gSprites[gContestResources->field_14[i].unk1], gSubspriteTables_8587B80); gSprites[gContestResources->field_14[i].unk1].invisible = TRUE; } @@ -3443,9 +3446,15 @@ void sub_80DC87C(u8 a) sub_80DC81C(a); r0 = a + 5; - DmaCopy16Defvars(3, gPlttBufferUnfaded + r0 * 16 + 10, gPlttBufferFaded + r0 * 16 + 10, 2); + DmaCopy16Defvars(3, + gPlttBufferUnfaded + r0 * 16 + 10, + gPlttBufferFaded + r0 * 16 + 10, + 2); var = (a + 5) * 16 + 12 + a; - DmaCopy16Defvars(3, gPlttBufferUnfaded + var, gPlttBufferFaded + var, 2); + DmaCopy16Defvars(3, + gPlttBufferUnfaded + var, + gPlttBufferFaded + var, + 2); } void sub_80DC8D0(u8 taskId) @@ -3708,7 +3717,7 @@ void sub_80DCB78(u8 spriteId) void sub_80DCBB4(void) { - SetGpuReg(REG_OFFSET_BLDCNT, BLDALPHA_BLEND(BLDCNT_EFFECT_BLEND, BLDCNT_TGT1_ALL)); + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND); SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(BLDCNT_TGT1_BG0 | BLDCNT_TGT1_BG1| BLDCNT_TGT1_BG2, BLDCNT_TGT1_BG0 | BLDCNT_TGT1_BG3)); } @@ -3770,9 +3779,9 @@ void sub_80DCD08(void) sub_80DB2BC(); } else - { + { sub_80DCD48(); - } + } } #ifdef NONMATCHING From 72720204da48a77132ce17c2429aaa9854497e2c Mon Sep 17 00:00:00 2001 From: ultima-soul Date: Sun, 27 Jan 2019 20:54:21 -0800 Subject: [PATCH 8/8] Fix stuff --- src/contest.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/contest.c b/src/contest.c index 95a09ba586..04c64d709b 100644 --- a/src/contest.c +++ b/src/contest.c @@ -3718,7 +3718,7 @@ void sub_80DCB78(u8 spriteId) void sub_80DCBB4(void) { SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_ALL | BLDCNT_EFFECT_BLEND); - SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(BLDCNT_TGT1_BG0 | BLDCNT_TGT1_BG1| BLDCNT_TGT1_BG2, BLDCNT_TGT1_BG0 | BLDCNT_TGT1_BG3)); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(7, 9)); } void sub_80DCBD0(void)