diff --git a/asm/contest.s b/asm/contest.s index ebded2d2f..f5ca016df 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 9d13453c2..56c89359a 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 4fb5f76c5..a0b44e331 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