From af1e44befe89102144a5223e56532c33f1a5e242 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Mon, 31 Dec 2018 18:07:29 -0600 Subject: [PATCH] Continue porting roulette --- asm/roulette.s | 4216 --------------------------------------- data/event_scripts.s | 2 +- data/specials.inc | 2 +- include/roulette_util.h | 1 + src/roulette.c | 1179 ++++++++++- 5 files changed, 1159 insertions(+), 4241 deletions(-) diff --git a/asm/roulette.s b/asm/roulette.s index bfd4c7c7f..d8ef98bfb 100644 --- a/asm/roulette.s +++ b/asm/roulette.s @@ -5,4222 +5,6 @@ .text - thumb_func_start sub_814155C -sub_814155C: @ 814155C - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gUnknown_0203AB88 - ldr r3, [r4] - ldrb r1, [r3, 0x3] - movs r2, 0x80 - orrs r1, r2 - strb r1, [r3, 0x3] - ldr r3, [r4] - adds r2, r3, 0 - adds r2, 0x7C - adds r1, r3, 0 - adds r1, 0x3C - ldrb r2, [r2] - adds r1, r2 - ldrb r2, [r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - ldr r2, =gSprites - adds r1, r2 - str r1, [r3, 0x38] - ldr r2, =sub_81446AC - str r2, [r1, 0x1C] - ldr r1, =gTasks - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - adds r4, r1 - ldrh r1, [r4, 0x14] - adds r1, 0x1 - strh r1, [r4, 0x14] - ldrh r0, [r4, 0x18] - adds r0, 0x1 - strh r0, [r4, 0x18] - movs r0, 0x6 - subs r0, r1 - lsls r0, 24 - lsrs r0, 24 - bl sub_814372C - movs r0, 0x5C - bl m4aSongNumStart - ldr r0, =sub_81415D4 - str r0, [r4] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814155C - - thumb_func_start sub_81415D4 -sub_81415D4: @ 81415D4 - push {r4-r7,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r6, =gUnknown_0203AB88 - ldr r3, [r6] - adds r0, r3, 0 - adds r0, 0x7D - ldrb r0, [r0] - cmp r0, 0 - beq _081416C6 - ldrb r1, [r3, 0x3] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _08141614 - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _081416C6 - movs r0, 0x41 - negs r0, r0 - ands r0, r1 - strb r0, [r3, 0x3] - ldr r2, [r6] - ldrb r1, [r2, 0x3] - movs r0, 0x21 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x3] - b _081416C6 - .pool -_08141614: - ldr r2, =gTasks - lsls r1, r4, 2 - adds r0, r1, r4 - lsls r0, 3 - adds r5, r0, r2 - movs r2, 0xA - ldrsh r0, [r5, r2] - adds r7, r1, 0 - cmp r0, 0 - bne _08141660 - adds r0, r3, 0 - adds r0, 0x7E - ldrb r1, [r0] - adds r0, r4, 0 - bl sub_81420D0 - lsls r0, 24 - lsrs r0, 24 - ldr r2, [r6] - ldrb r1, [r2, 0x1A] - lsls r1, 28 - lsrs r1, 28 - adds r2, 0x1B - adds r2, r1 - ldrb r1, [r2] - bl sub_81421E8 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0x12] - cmp r0, 0x1 - bne _08141660 - ldr r0, [r6] - adds r0, 0xB8 - movs r1, 0x80 - lsls r1, 5 - bl sub_8151A48 -_08141660: - ldr r0, =gTasks - adds r1, r7, r4 - lsls r1, 3 - adds r4, r1, r0 - movs r1, 0xA - ldrsh r0, [r4, r1] - cmp r0, 0x3C - bgt _08141690 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08141680 - movs r0, 0x3C - strh r0, [r4, 0xA] -_08141680: - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - b _081416C6 - .pool -_08141690: - ldr r0, =gUnknown_0203AB88 - ldr r1, [r0] - ldrb r0, [r1, 0x1A] - lsls r0, 28 - lsrs r0, 28 - adds r1, 0x1B - adds r1, r0 - ldrb r0, [r1] - bl sub_81424FC - ldrh r1, [r4, 0x20] - lsls r1, 24 - lsrs r1, 24 - movs r0, 0 - bl sub_8142E70 - ldrb r1, [r4, 0x14] - subs r1, 0x1 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0 - bl sub_8143038 - movs r0, 0x20 - strh r0, [r4, 0xA] - ldr r0, =sub_81416D4 - str r0, [r4] -_081416C6: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81415D4 - - thumb_func_start sub_81416D4 -sub_81416D4: @ 81416D4 - 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, 0xA] - subs r1, r0, 0x1 - strh r1, [r4, 0xA] - lsls r0, 16 - cmp r0, 0 - ble _08141740 - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0x2 - ble _08141700 - ldr r1, =gSpriteCoordOffsetX - ldrh r0, [r1] - subs r0, 0x2 - strh r0, [r1] -_08141700: - ldr r0, =gUnknown_0203AB88 - ldr r1, [r0] - ldrh r0, [r1, 0x26] - subs r0, 0x4 - strh r0, [r1, 0x26] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x68 - bne _08141768 - ldr r2, =gSprites - adds r0, r1, 0 - adds r0, 0x55 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_814390C - str r1, [r0] - b _08141768 - .pool -_08141740: - ldrh r0, [r4, 0x20] - lsls r0, 24 - lsrs r0, 24 - bl sub_8143150 - movs r1, 0x12 - ldrsh r0, [r4, r1] - cmp r0, 0x1 - bne _08141756 - movs r0, 0x79 - b _08141758 -_08141756: - movs r0, 0x3D -_08141758: - strh r0, [r4, 0xA] - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_8141778 - str r0, [r1] -_08141768: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81416D4 - - thumb_func_start sub_8141778 -sub_8141778: @ 8141778 - push {r4,lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r1, =gTasks - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 3 - adds r4, r0, r1 - ldrh r0, [r4, 0xA] - subs r1, r0, 0x1 - strh r1, [r4, 0xA] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1 - ble _081417E8 - movs r0, 0xA - ldrsh r1, [r4, r0] - adds r0, r1, 0 - cmp r1, 0 - bge _081417A2 - adds r0, 0xF -_081417A2: - asrs r0, 4 - lsls r0, 4 - subs r0, r1, r0 - lsls r0, 16 - asrs r0, 16 - cmp r0, 0 - beq _081417CC - cmp r0, 0x8 - bne _081417F4 - movs r0, 0 - movs r1, 0xFF - bl sub_8142E70 - movs r0, 0 - movs r1, 0xFF - bl sub_8143038 - b _081417F4 - .pool -_081417CC: - ldrh r1, [r4, 0x20] - lsls r1, 24 - lsrs r1, 24 - movs r0, 0 - bl sub_8142E70 - ldrb r1, [r4, 0x14] - subs r1, 0x1 - lsls r1, 24 - lsrs r1, 24 - movs r0, 0 - bl sub_8143038 - b _081417F4 -_081417E8: - ldr r1, =sub_814189C - adds r0, r2, 0 - movs r2, 0x1E - movs r3, 0 - bl sub_8141F7C -_081417F4: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8141778 - - thumb_func_start sub_8141800 -sub_8141800: @ 8141800 - 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, 0x12 - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _08141864 - cmp r0, 0 - blt _08141864 - cmp r0, 0x2 - bgt _08141864 - bl IsFanfareTaskInactive - lsls r0, 24 - cmp r0, 0 - beq _08141888 - movs r0, 0x1D - bl GetGameStat - ldrh r1, [r4, 0x1E] - adds r1, 0x1 - strh r1, [r4, 0x1E] - lsls r1, 16 - asrs r1, 16 - cmp r0, r1 - bcs _08141848 - movs r0, 0x1E - ldrsh r1, [r4, r0] - movs r0, 0x1D - bl SetGameStat -_08141848: - ldr r1, =sub_8141A18 - ldr r2, =0x0000ffff - adds r0, r5, 0 - movs r3, 0x3 - bl sub_8141F7C - b _08141888 - .pool -_08141864: - bl IsSEPlaying - lsls r0, 24 - lsrs r2, r0, 24 - cmp r2, 0 - bne _08141888 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - strh r2, [r0, 0x1E] - ldr r1, =sub_8141AC0 - ldr r2, =0x0000ffff - adds r0, r5, 0 - movs r3, 0x3 - bl sub_8141F7C -_08141888: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8141800 - - thumb_func_start sub_814189C -sub_814189C: @ 814189C - push {r4,r5,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r2, 0x12 - ldrsh r1, [r0, r2] - cmp r1, 0 - beq _08141928 - cmp r1, 0 - blt _08141928 - cmp r1, 0x2 - bgt _08141928 - movs r1, 0xC - ldrsh r0, [r0, r1] - cmp r0, 0xC - bne _081418EC - ldr r0, =0x00000185 - bl PlayFanfare - ldr r4, =gUnknown_0203AB8C - ldrb r0, [r4] - movs r1, 0 - bl NewMenuHelpers_DrawStdWindowFrame - ldrb r0, [r4] - ldr r2, =gUnknown_082A5BD7 - b _08141902 - .pool -_081418EC: - movs r0, 0xC3 - lsls r0, 1 - bl PlayFanfare - ldr r4, =gUnknown_0203AB8C - ldrb r0, [r4] - movs r1, 0 - bl NewMenuHelpers_DrawStdWindowFrame - ldrb r0, [r4] - ldr r2, =gUnknown_082A5BCB -_08141902: - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldrb r0, [r4] - movs r1, 0x3 - bl CopyWindowToVram - b _08141958 - .pool -_08141928: - movs r0, 0x20 - bl m4aSongNumStart - ldr r4, =gUnknown_0203AB8C - ldrb r0, [r4] - movs r1, 0 - bl NewMenuHelpers_DrawStdWindowFrame - ldrb r0, [r4] - ldr r2, =gUnknown_082A5BE0 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldrb r0, [r4] - movs r1, 0x3 - bl CopyWindowToVram -_08141958: - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - movs r1, 0 - strh r1, [r0, 0xA] - ldr r1, =sub_8141800 - str r1, [r0] - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814189C - - thumb_func_start sub_8141984 -sub_8141984: @ 8141984 - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r4, r0, r1 - movs r0, 0x16 - ldrsh r5, [r4, r0] - cmp r5, 0 - beq _081419AC - cmp r5, 0x3 - beq _081419DC - ldrh r0, [r4, 0x16] - adds r0, 0x1 - b _081419E4 - .pool -_081419AC: - ldrh r0, [r4, 0x22] - adds r0, 0x1 - strh r0, [r4, 0x22] - movs r0, 0x15 - bl m4aSongNumStart - ldrh r0, [r4, 0x22] - bl sub_8143514 - movs r2, 0x22 - ldrsh r1, [r4, r2] - ldr r0, =0x0000270e - cmp r1, r0 - ble _081419D0 - strh r5, [r4, 0xA] - b _081419E6 - .pool -_081419D0: - ldrh r0, [r4, 0xA] - subs r0, 0x1 - strh r0, [r4, 0xA] - ldrh r0, [r4, 0x16] - adds r0, 0x1 - b _081419E4 -_081419DC: - movs r0, 0x15 - bl m4aSongNumStop - movs r0, 0 -_081419E4: - strh r0, [r4, 0x16] -_081419E6: - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r1, r0 - movs r2, 0xA - ldrsh r0, [r1, r2] - cmp r0, 0 - bne _08141A04 - ldr r1, =sub_8141AC0 - ldr r2, =0x0000ffff - adds r0, r6, 0 - movs r3, 0x3 - bl sub_8141F7C -_08141A04: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8141984 - - thumb_func_start sub_8141A18 -sub_8141A18: @ 8141A18 - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - sub sp, 0xC - lsls r0, 24 - lsrs r0, 24 - ldr r3, =gStringVar1 - ldr r1, =gUnknown_0203AB88 - mov r9, r1 - ldr r1, [r1] - ldrb r2, [r1, 0x19] - ldr r1, =gTasks - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - adds r4, r1 - movs r1, 0xC - ldrsh r0, [r4, r1] - adds r1, r2, 0 - muls r1, r0 - adds r0, r3, 0 - movs r2, 0 - movs r3, 0x2 - bl ConvertIntToDecimalStringN - ldr r2, =gStringVar4 - mov r8, r2 - ldr r1, =gUnknown_082A5BEF - mov r0, r8 - bl StringExpandPlaceholders - ldr r5, =gUnknown_0203AB8C - ldrb r0, [r5] - movs r1, 0 - bl NewMenuHelpers_DrawStdWindowFrame - ldrb r0, [r5] - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r6, 0 - str r6, [sp, 0x8] - movs r1, 0x1 - mov r2, r8 - movs r3, 0 - bl AddTextPrinterParameterized - ldrb r0, [r5] - movs r1, 0x3 - bl CopyWindowToVram - mov r1, r9 - ldr r0, [r1] - ldrb r1, [r0, 0x19] - movs r2, 0xC - ldrsh r0, [r4, r2] - muls r0, r1 - strh r0, [r4, 0xA] - strh r6, [r4, 0x16] - ldr r0, =sub_8141984 - str r0, [r4] - add sp, 0xC - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8141A18 - - thumb_func_start sub_8141AC0 -sub_8141AC0: @ 8141AC0 - push {r4-r6,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r5, =gUnknown_0203AB88 - ldr r0, [r5] - adds r0, 0xB8 - ldr r1, =0x0000ffff - bl sub_8151A9C - ldr r6, [r5] - movs r0, 0xB8 - lsls r0, 1 - adds r3, r6, r0 - ldrb r2, [r3] - movs r1, 0x7F - adds r0, r1, 0 - ands r0, r2 - strb r0, [r3] - movs r0, 0xB2 - lsls r0, 1 - adds r3, r6, r0 - ldrb r2, [r3] - adds r0, r1, 0 - ands r0, r2 - strb r0, [r3] - movs r0, 0xAC - lsls r0, 1 - adds r2, r6, r0 - ldrb r0, [r2] - ands r1, r0 - strb r1, [r2] - ldr r6, =gSprites - ldr r2, [r5] - ldr r5, =gUnknown_085B6154 - ldr r0, =gTasks - lsls r3, r4, 2 - adds r3, r4 - lsls r3, 3 - adds r3, r0 - movs r0, 0x20 - ldrsh r1, [r3, r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r0, [r0] - adds r2, r0 - adds r2, 0x43 - ldrb r1, [r2] - 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 - strb r1, [r0] - ldr r0, =sub_8141B58 - str r0, [r3] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8141AC0 - - thumb_func_start sub_8141B58 -sub_8141B58: @ 8141B58 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - lsls r0, 24 - lsrs r6, r0, 24 - movs r5, 0 - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - movs r2, 0 - strh r5, [r0, 0x10] - ldr r4, =gUnknown_0203AB88 - ldr r1, [r4] - ldrb r0, [r1, 0x1A] - lsls r0, 28 - lsrs r0, 28 - adds r1, 0x1B - adds r1, r0 - strb r2, [r1] - movs r0, 0 - bl sub_81424FC - ldr r3, =gSprites - ldr r0, [r4] - adds r0, 0x6C - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - adds r7, r3, 0 - movs r0, 0x8 - adds r0, r7 - mov r12, r0 - ldr r1, =0xfffffc00 - mov r8, r1 -_08141BB0: - ldr r0, =gUnknown_0203AB88 - ldr r4, [r0] - adds r0, r4, r5 - adds r0, 0x65 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r3, r0, r7 - adds r2, r3, 0 - adds r2, 0x40 - add r0, r12 - ldr r0, [r0] - ldr r0, [r0] - ldrh r1, [r0] - ldrh r2, [r2] - adds r1, r2 - ldr r2, =0x000003ff - adds r0, r2, 0 - ands r1, r0 - ldrh r2, [r3, 0x4] - mov r0, r8 - ands r0, r2 - orrs r0, r1 - strh r0, [r3, 0x4] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x3 - bls _08141BB0 - ldr r0, =gTasks - lsls r1, r6, 2 - adds r1, r6 - lsls r1, 3 - adds r2, r1, r0 - movs r1, 0x22 - ldrsh r0, [r2, r1] - ldrb r4, [r4, 0x19] - cmp r0, r4 - blt _08141CBC - movs r1, 0x14 - ldrsh r0, [r2, r1] - cmp r0, 0x6 - bne _08141C58 - ldr r4, =gUnknown_0203AB8C - ldrb r0, [r4] - movs r1, 0 - bl NewMenuHelpers_DrawStdWindowFrame - ldrb r0, [r4] - ldr r2, =gUnknown_082A5C21 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldrb r0, [r4] - movs r1, 0x3 - bl CopyWindowToVram - ldr r1, =dp01t_12_3_battle_menu - b _08141C8E - .pool -_08141C58: - movs r0, 0x22 - ldrsh r1, [r2, r0] - ldr r0, =0x0000270f - cmp r1, r0 - bne _08141CB0 - ldr r4, =gUnknown_0203AB8C - ldrb r0, [r4] - movs r1, 0 - bl NewMenuHelpers_DrawStdWindowFrame - ldrb r0, [r4] - ldr r2, =gUnknown_082A5C61 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldrb r0, [r4] - movs r1, 0x3 - bl CopyWindowToVram - ldr r1, =sub_8140914 -_08141C8E: - ldr r2, =0x0000ffff - adds r0, r6, 0 - movs r3, 0x3 - bl sub_8141F7C - b _08141CF2 - .pool -_08141CB0: - ldr r0, =sub_8140914 - str r0, [r2] - b _08141CF2 - .pool -_08141CBC: - ldr r4, =gUnknown_0203AB8C - ldrb r0, [r4] - movs r1, 0 - bl NewMenuHelpers_DrawStdWindowFrame - ldrb r0, [r4] - ldr r2, =gUnknown_082A5C04 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldrb r0, [r4] - movs r1, 0x3 - bl CopyWindowToVram - ldr r1, =sub_8140994 - adds r0, r6, 0 - movs r2, 0x3C - movs r3, 0x3 - bl sub_8141F7C -_08141CF2: - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8141B58 - - thumb_func_start dp01t_12_3_battle_menu -dp01t_12_3_battle_menu: @ 8141D0C - push {r4-r7,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - strh r4, [r0, 0x14] - adds r0, r5, 0 - bl sub_8141FF4 - bl sub_8142070 - bl sub_8143A40 - movs r0, 0 - bl sub_81424FC - movs r0, 0x6 - bl sub_814372C - ldr r7, =gSprites - ldr r3, =gUnknown_0203AB88 - movs r6, 0x5 - negs r6, r6 -_08141D44: - ldr r0, [r3] - adds r0, r4 - adds r0, 0x43 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r7 - adds r1, 0x3E - ldrb r2, [r1] - adds r0, r6, 0 - ands r0, r2 - strb r0, [r1] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xB - bls _08141D44 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r2, r0, r1 - movs r0, 0x22 - ldrsh r1, [r2, r0] - ldr r0, =0x0000270f - cmp r1, r0 - bne _08141DD4 - ldr r4, =gUnknown_0203AB8C - ldrb r0, [r4] - movs r1, 0 - bl NewMenuHelpers_DrawStdWindowFrame - ldrb r0, [r4] - ldr r2, =gUnknown_082A5C61 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldrb r0, [r4] - movs r1, 0x3 - bl CopyWindowToVram - ldr r1, =sub_8140914 - ldr r2, =0x0000ffff - adds r0, r5, 0 - movs r3, 0x3 - bl sub_8141F7C - b _08141DD8 - .pool -_08141DD4: - ldr r0, =sub_8140914 - str r0, [r2] -_08141DD8: - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end dp01t_12_3_battle_menu - - thumb_func_start sub_8141DE4 -sub_8141DE4: @ 8141DE4 - push {r4,r5,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gUnknown_0203AB88 - ldr r0, [r4] - adds r0, 0xB8 - ldr r1, =0x0000ffff - bl sub_8151A9C - ldr r0, [r4] - adds r0, 0xB8 - bl sub_8151678 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldrh r0, [r0, 0x22] - bl SetCoins - bl GetCoins - ldr r1, [r4] - lsls r0, 16 - lsrs r0, 16 - ldrb r1, [r1, 0x19] - cmp r0, r1 - bcs _08141E38 - ldr r1, =gSpecialVar_0x8004 - movs r0, 0x1 - b _08141E3C - .pool -_08141E38: - ldr r1, =gSpecialVar_0x8004 - movs r0, 0 -_08141E3C: - strh r0, [r1] - bl GetCoins - lsls r0, 16 - lsrs r0, 16 - bl sub_80EDD78 - movs r0, 0 - str r0, [sp] - movs r0, 0xFF - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginHardwarePaletteFade - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_8141E7C - str r1, [r0] - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8141DE4 - - thumb_func_start sub_8141E7C -sub_8141E7C: @ 8141E7C - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - bl UpdatePaletteFade - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0 - bne _08141EDE - movs r0, 0 - bl SetVBlankCallback - ldr r1, =gSpriteCoordOffsetX - ldr r0, =gSpriteCoordOffsetY - strh r4, [r0] - strh r4, [r1] - bl ResetVramOamAndBgCntRegs - bl ResetAllBgsCoordinates - movs r0, 0x50 - movs r1, 0 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - movs r0, 0x54 - movs r1, 0 - bl SetGpuReg - bl FreeAllSpritePalettes - bl ResetPaletteFade - bl ResetSpriteData - bl sub_8140418 - ldr r1, =gFieldCallback - ldr r0, =sub_80AF168 - str r0, [r1] - ldr r0, =CB2_ReturnToField - bl SetMainCallback2 - adds r0, r5, 0 - bl DestroyTask -_08141EDE: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8141E7C - - thumb_func_start sub_8141EF8 -sub_8141EF8: @ 8141EF8 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gUnknown_0203AB88 - ldr r3, [r1] - adds r0, r3, 0 - adds r0, 0xA8 - ldrh r0, [r0] - adds r5, r1, 0 - cmp r0, 0 - beq _08141F1E - ldr r0, =gMain - adds r2, r3, 0 - adds r2, 0xAA - ldrh r1, [r0, 0x2E] - ldrh r0, [r2] - ands r0, r1 - cmp r0, 0 - beq _08141F52 -_08141F1E: - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - adds r1, r3, 0 - adds r1, 0xAC - ldr r1, [r1] - str r1, [r0] - adds r0, r3, 0 - adds r0, 0xAA - ldrh r0, [r0] - cmp r0, 0 - beq _08141F40 - movs r0, 0x5 - bl PlaySE -_08141F40: - ldr r2, [r5] - adds r0, r2, 0 - adds r0, 0xAC - movs r1, 0 - str r1, [r0] - subs r0, 0x2 - strh r1, [r0] - subs r0, 0x2 - strh r1, [r0] -_08141F52: - ldr r0, [r5] - adds r1, r0, 0 - adds r1, 0xA8 - ldrh r2, [r1] - ldr r0, =0x0000ffff - cmp r2, r0 - beq _08141F64 - subs r0, r2, 0x1 - strh r0, [r1] -_08141F64: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8141EF8 - - thumb_func_start sub_8141F7C -sub_8141F7C: @ 8141F7C - push {r4-r7,lr} - adds r5, r1, 0 - lsls r0, 24 - lsrs r6, r0, 24 - lsls r2, 16 - lsrs r4, r2, 16 - lsls r3, 16 - lsrs r7, r3, 16 - ldr r2, =gUnknown_0203AB88 - ldr r0, [r2] - mov r12, r0 - mov r3, r12 - adds r3, 0xB4 - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - ldr r0, [r0] - str r0, [r3] - adds r3, r1, 0 - cmp r5, 0 - bne _08141FAC - adds r5, r0, 0 -_08141FAC: - mov r0, r12 - adds r0, 0xAC - str r5, [r0] - subs r0, 0x4 - strh r4, [r0] - ldr r0, =0x0000ffff - cmp r4, r0 - bne _08141FD8 - cmp r7, 0 - bne _08141FD8 - mov r1, r12 - adds r1, 0xAA - ldrh r0, [r1] - orrs r4, r0 - strh r4, [r1] - b _08141FDE - .pool -_08141FD8: - ldr r0, [r2] - adds r0, 0xAA - strh r7, [r0] -_08141FDE: - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r3 - ldr r1, =sub_8141EF8 - str r1, [r0] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8141F7C - - thumb_func_start sub_8141FF4 -sub_8141FF4: @ 8141FF4 - push {r4-r6,lr} - lsls r0, 24 - lsrs r5, r0, 24 - movs r4, 0 - ldr r3, =gUnknown_0203AB88 - ldr r0, [r3] - strb r4, [r0] - ldr r2, [r3] - ldrb r1, [r2, 0x3] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2, 0x3] - ldr r2, [r3] - ldrb r1, [r2, 0x3] - movs r0, 0x21 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x3] - ldr r2, [r3] - ldrb r1, [r2, 0x3] - movs r0, 0x41 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x3] - ldr r2, [r3] - ldrb r1, [r2, 0x3] - movs r0, 0x20 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x3] - ldr r6, =gTasks - adds r2, r3, 0 - movs r1, 0 -_08142036: - ldr r0, [r2] - adds r0, 0x1B - adds r0, r4 - strb r1, [r0] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x5 - bls _08142036 - ldr r2, [r3] - ldrb r1, [r2, 0x1A] - movs r0, 0x10 - negs r0, r0 - ands r0, r1 - strb r0, [r2, 0x1A] - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r6 - movs r1, 0 - strh r1, [r0, 0xA] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8141FF4 - - thumb_func_start sub_8142070 -sub_8142070: @ 8142070 - push {lr} - ldr r2, =gUnknown_0203AB88 - ldr r1, [r2] - movs r0, 0 - str r0, [r1, 0x8] - movs r1, 0 - movs r3, 0 -_0814207E: - ldr r0, [r2] - adds r0, 0xC - adds r0, r1 - strb r3, [r0] - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x5 - bls _0814207E - movs r1, 0 - ldr r3, =gUnknown_0203AB88 - movs r2, 0 -_08142096: - ldr r0, [r3] - adds r0, 0x12 - adds r0, r1 - strb r2, [r0] - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x3 - bls _08142096 - movs r1, 0 - ldr r3, =gUnknown_0203AB88 - movs r2, 0 -_081420AE: - ldr r0, [r3] - adds r0, 0x16 - adds r0, r1 - strb r2, [r0] - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x2 - bls _081420AE - movs r0, 0x1 - movs r1, 0xFF - bl sub_8143038 - pop {r0} - bx r0 - .pool - thumb_func_end sub_8142070 - - thumb_func_start sub_81420D0 -sub_81420D0: @ 81420D0 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x1C - lsls r0, 24 - lsrs r4, r0, 24 - lsls r1, 24 - lsrs r5, r1, 24 - mov r1, sp - ldr r0, =gUnknown_085B642C - ldm r0!, {r2,r3,r6} - stm r1!, {r2,r3,r6} - ldr r0, [r0] - str r0, [r1] - add r2, sp, 0x10 - adds r1, r2, 0 - ldr r0, =gUnknown_085B643C - ldm r0!, {r3,r6,r7} - stm r1!, {r3,r6,r7} - mov r8, r2 - cmp r5, 0xB - bls _0814210C - movs r0, 0 - b _081421C8 - .pool -_0814210C: - ldr r6, =gUnknown_0203AB88 - ldr r3, [r6] - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r7, 0x14 - ldrsh r1, [r0, r7] - adds r3, r1 - ldr r4, =gUnknown_085B62E4 - lsls r5, 3 - adds r2, r5, r4 - ldrb r1, [r2, 0x2] - strb r1, [r3, 0xB] - ldrb r1, [r2, 0x2] - strh r1, [r0, 0x20] - ldr r2, [r6] - adds r0, r4, 0x4 - adds r0, r5, r0 - ldr r1, [r2, 0x8] - ldr r0, [r0] - orrs r1, r0 - str r1, [r2, 0x8] - movs r3, 0 - mov r9, r4 - mov r12, r5 - adds r5, r0, 0 -_08142144: - lsls r0, r3, 2 - mov r1, sp - adds r4, r1, r0 - ldr r0, [r4] - ands r0, r5 - cmp r0, 0 - beq _0814215E - ldr r1, [r6] - adds r1, 0x12 - adds r1, r3 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_0814215E: - ldr r2, [r6] - adds r0, r2, 0 - adds r0, 0x12 - adds r0, r3 - ldrb r0, [r0] - cmp r0, 0x2 - bls _08142174 - ldr r0, [r2, 0x8] - ldr r1, [r4] - orrs r0, r1 - str r0, [r2, 0x8] -_08142174: - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - cmp r3, 0x3 - bls _08142144 - movs r6, 0 - ldr r0, =gUnknown_085B62E4+0x4 - add r0, r12 - ldr r7, [r0] - ldr r4, =gUnknown_0203AB88 - mov r5, r8 -_0814218A: - lsls r0, r6, 2 - adds r2, r5, r0 - ldr r0, [r2] - ands r0, r7 - cmp r0, 0 - beq _081421A2 - ldr r1, [r4] - adds r1, 0x16 - adds r1, r6 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_081421A2: - ldr r3, [r4] - adds r0, r3, 0 - adds r0, 0x16 - adds r0, r6 - ldrb r0, [r0] - cmp r0, 0x3 - bls _081421B8 - ldr r0, [r3, 0x8] - ldr r1, [r2] - orrs r0, r1 - str r0, [r3, 0x8] -_081421B8: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x2 - bls _0814218A - mov r0, r12 - add r0, r9 - ldrb r0, [r0, 0x2] -_081421C8: - add sp, 0x1C - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81420D0 - - thumb_func_start sub_81421E8 -sub_81421E8: @ 81421E8 - push {lr} - lsls r0, 24 - lsls r1, 24 - lsrs r2, r1, 24 - lsrs r3, r0, 24 - movs r1, 0xFF - lsls r1, 24 - adds r0, r1 - lsrs r0, 24 - cmp r0, 0x12 - bhi _0814227C - cmp r2, 0xF - bhi _08142278 - lsls r0, r2, 2 - ldr r1, =_08142210 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08142210: - .4byte _08142250 - .4byte _08142254 - .4byte _08142254 - .4byte _08142254 - .4byte _08142254 - .4byte _08142268 - .4byte _08142278 - .4byte _08142278 - .4byte _08142278 - .4byte _08142278 - .4byte _08142268 - .4byte _08142278 - .4byte _08142278 - .4byte _08142278 - .4byte _08142278 - .4byte _08142268 -_08142250: - movs r0, 0x3 - b _0814227E -_08142254: - adds r0, r2, 0x5 - cmp r3, r0 - beq _08142274 - adds r0, 0x5 - cmp r3, r0 - beq _08142274 - adds r0, 0x5 - cmp r3, r0 - bne _0814227C - b _08142274 -_08142268: - adds r0, r2, 0x1 - cmp r3, r0 - blt _0814227C - adds r0, r2, 0x4 - cmp r3, r0 - bgt _0814227C -_08142274: - movs r0, 0x1 - b _0814227E -_08142278: - cmp r3, r2 - beq _08142274 -_0814227C: - movs r0, 0 -_0814227E: - pop {r1} - bx r1 - thumb_func_end sub_81421E8 - - thumb_func_start sub_8142284 -sub_8142284: @ 8142284 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x20 - lsls r0, 24 - lsrs r7, r0, 24 - movs r0, 0 - str r0, [sp, 0x18] - cmp r7, 0xA - beq _081422AA - cmp r7, 0xA - bgt _081422A6 - cmp r7, 0x5 - beq _081422AA - b _0814230C -_081422A6: - cmp r7, 0xF - bne _0814230C -_081422AA: - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - adds r2, r7, 0x5 - ldr r1, =gUnknown_0203AB88 - mov r12, r1 - cmp r4, r2 - bge _081422E8 - ldr r0, [r1] - ldr r3, =gUnknown_085B6154 - ldr r5, [r0, 0x8] - adds r6, r3, 0 - adds r6, 0x8 -_081422C4: - lsls r0, r4, 2 - adds r0, r4 - lsls r1, r0, 2 - adds r0, r1, r6 - ldr r0, [r0] - ands r0, r5 - cmp r0, 0 - bne _081422DE - adds r0, r1, r3 - ldrh r0, [r0, 0x10] - ldr r1, [sp, 0x18] - orrs r1, r0 - str r1, [sp, 0x18] -_081422DE: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, r2 - blt _081422C4 -_081422E8: - mov r2, r12 - ldr r0, [r2] - adds r0, 0xB8 - ldr r1, =0x0000dfff - ldr r3, [sp, 0x18] - ands r3, r1 - str r3, [sp, 0x18] - adds r1, r3, 0 - bl sub_8151A48 - b _081424E2 - .pool -_0814230C: - mov r0, sp - ldr r1, =gUnknown_085B63F0 - ldm r1!, {r2,r4,r5} - stm r0!, {r2,r4,r5} - ldm r1!, {r3-r5} - stm r0!, {r3-r5} - subs r0, r7, 0x1 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0x1 - mov r9, r1 - cmp r0, 0x3 - bhi _0814232A - movs r2, 0x3 - mov r9, r2 -_0814232A: - adds r0, r7, 0 - movs r1, 0x5 - bl __udivsi3 - lsls r0, 24 - lsrs r0, 8 - ldr r3, =0xffff0000 - adds r0, r3 - lsrs r0, 16 - mov r8, r0 - adds r0, r7, 0 - movs r1, 0x5 - bl __umodsi3 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x2 - beq _08142390 - cmp r0, 0x2 - bgt _08142368 - cmp r0, 0x1 - beq _0814237C - ldr r4, =gUnknown_0203AB88 - mov r12, r4 - b _081423D4 - .pool -_08142368: - cmp r0, 0x3 - beq _081423A4 - cmp r0, 0x4 - beq _081423B8 - ldr r5, =gUnknown_0203AB88 - mov r12, r5 - b _081423D4 - .pool -_0814237C: - ldr r3, =gSprites - ldr r2, =gUnknown_0203AB88 - ldr r0, [r2] - adds r0, 0x43 - b _081423C0 - .pool -_08142390: - ldr r3, =gSprites - ldr r2, =gUnknown_0203AB88 - ldr r0, [r2] - adds r0, 0x44 - b _081423C0 - .pool -_081423A4: - ldr r3, =gSprites - ldr r2, =gUnknown_0203AB88 - ldr r0, [r2] - adds r0, 0x45 - b _081423C0 - .pool -_081423B8: - ldr r3, =gSprites - ldr r2, =gUnknown_0203AB88 - ldr r0, [r2] - adds r0, 0x46 -_081423C0: - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r0, [r0, 0x5] - lsrs r0, 4 - lsls r0, 4 - mov r8, r0 - mov r12, r2 -_081423D4: - mov r0, r9 - cmp r0, 0x1 - bne _08142430 - mov r1, r12 - ldr r4, [r1] - ldr r1, =gUnknown_085B6154 - lsls r2, r7, 2 - adds r0, r2, r7 - lsls r0, 2 - adds r1, 0x8 - adds r0, r1 - ldr r1, [r4, 0x8] - ldr r0, [r0] - ands r1, r0 - str r2, [sp, 0x1C] - cmp r1, 0 - bne _081424E2 - adds r0, r7, 0 - movs r1, 0x5 - bl __udivsi3 - lsls r0, 24 - lsrs r0, 24 - subs r1, r0, 0x1 - lsls r1, 3 - mov r3, sp - adds r2, r3, r1 - ldrh r1, [r2, 0x2] - add r1, r8 - strh r1, [r2, 0x2] - adds r1, r4, 0 - adds r1, 0xB8 - lsls r0, 3 - subs r0, 0x8 - adds r2, r3, r0 - adds r0, r1, 0 - movs r1, 0xD - bl sub_815168C - b _081424C4 - .pool -_08142430: - movs r4, 0 - lsls r5, r7, 2 - str r5, [sp, 0x1C] - ldr r0, =gUnknown_085B6154 - mov r10, r0 -_0814243A: - lsls r0, r4, 2 - adds r0, r4 - adds r0, r7, r0 - adds r0, 0x5 - lsls r0, 24 - lsrs r3, r0, 24 - mov r1, r12 - ldr r5, [r1] - lsls r0, r3, 2 - adds r0, r3 - lsls r6, r0, 2 - mov r0, r10 - adds r0, 0x8 - adds r0, r6, r0 - ldr r1, [r5, 0x8] - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - bne _081424B0 - adds r0, r3, 0 - movs r1, 0x5 - bl __udivsi3 - lsls r0, 24 - lsrs r0, 24 - subs r1, r0, 0x1 - lsls r1, 3 - mov r3, sp - adds r2, r3, r1 - ldrh r1, [r2, 0x2] - add r1, r8 - strh r1, [r2, 0x2] - adds r3, r5, 0 - adds r3, 0xB8 - adds r1, r4, 0 - adds r1, 0xD - lsls r1, 24 - lsrs r1, 24 - lsls r0, 3 - subs r0, 0x8 - mov r5, sp - adds r2, r5, r0 - adds r0, r3, 0 - bl sub_815168C - mov r0, r9 - cmp r0, 0x3 - bne _081424A2 - mov r1, r10 - adds r0, r6, r1 - ldrh r0, [r0, 0x10] - str r0, [sp, 0x18] -_081424A2: - mov r0, r9 - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - ldr r2, =gUnknown_0203AB88 - mov r12, r2 -_081424B0: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x2 - bls _0814243A - mov r3, r9 - cmp r3, 0x2 - beq _081424C4 - movs r4, 0 - str r4, [sp, 0x18] -_081424C4: - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - adds r0, 0xB8 - ldr r2, =gUnknown_085B6154 - ldr r5, [sp, 0x1C] - adds r1, r5, r7 - lsls r1, 2 - adds r1, r2 - ldrh r1, [r1, 0x10] - ldr r2, [sp, 0x18] - orrs r2, r1 - str r2, [sp, 0x18] - adds r1, r2, 0 - bl sub_8151A48 -_081424E2: - add sp, 0x20 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8142284 - - thumb_func_start sub_81424FC -sub_81424FC: @ 81424FC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x2C - lsls r0, 24 - lsrs r5, r0, 24 - ldr r4, =gUnknown_0203AB88 - ldr r1, [r4] - movs r0, 0x1 - strh r0, [r1, 0x2A] - movs r0, 0 - movs r1, 0 - bl sub_8142E70 - ldr r1, [r4] - ldr r2, =0x0000117c - adds r0, r1, r2 - ldr r2, =0x0000397c - adds r1, r2 - ldr r1, [r1] - movs r2, 0x10 - str r2, [sp] - movs r2, 0xD - str r2, [sp, 0x4] - movs r2, 0xE - movs r3, 0x7 - bl sub_8152058 - cmp r5, 0xF - bhi _081425FC - lsls r0, r5, 2 - ldr r1, =_08142558 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08142558: - .4byte _08142738 - .4byte _08142598 - .4byte _08142598 - .4byte _08142598 - .4byte _08142598 - .4byte _081425CC - .4byte _081425FC - .4byte _081425FC - .4byte _081425FC - .4byte _081425FC - .4byte _081425CC - .4byte _081425FC - .4byte _081425FC - .4byte _081425FC - .4byte _081425FC - .4byte _081425CC -_08142598: - movs r0, 0x4 - str r0, [sp, 0x18] - add r1, sp, 0x8 - movs r0, 0 - strb r0, [r1] - adds r0, r1, 0 - ldrb r0, [r0] - cmp r0, 0x3 - bhi _08142604 - add r4, sp, 0x10 - adds r3, r1, 0 -_081425AE: - ldrb r2, [r3] - adds r2, r4 - ldrb r1, [r3] - lsls r0, r1, 2 - adds r0, r1 - adds r0, r5, r0 - strb r0, [r2] - ldrb r0, [r3] - adds r0, 0x1 - strb r0, [r3] - ldrb r0, [r3] - ldr r1, [sp, 0x18] - cmp r0, r1 - bcc _081425AE - b _08142604 -_081425CC: - movs r2, 0x5 - str r2, [sp, 0x18] - add r1, sp, 0x8 - movs r0, 0 - strb r0, [r1] - adds r0, r1, 0 - ldrb r0, [r0] - cmp r0, 0x4 - bhi _08142604 - add r3, sp, 0x10 - adds r2, r1, 0 -_081425E2: - ldrb r1, [r2] - adds r1, r3 - ldrb r0, [r2] - adds r0, r5, r0 - strb r0, [r1] - ldrb r0, [r2] - adds r0, 0x1 - strb r0, [r2] - ldrb r0, [r2] - ldr r1, [sp, 0x18] - cmp r0, r1 - bcc _081425E2 - b _08142604 -_081425FC: - movs r2, 0x1 - str r2, [sp, 0x18] - add r0, sp, 0x10 - strb r5, [r0] -_08142604: - add r1, sp, 0x8 - movs r0, 0 - strb r0, [r1] - adds r0, r1, 0 - ldrb r0, [r0] - ldr r1, [sp, 0x18] - cmp r0, r1 - bcc _08142616 - b _08142738 -_08142616: - mov r2, sp - adds r2, 0xE - str r2, [sp, 0x1C] - add r0, sp, 0x10 - mov r10, r0 - add r1, sp, 0x8 - mov r9, r1 - subs r2, 0x4 - str r2, [sp, 0x20] -_08142628: - mov r1, r9 - ldrb r0, [r1] - add r0, r10 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 2 - ldr r2, =gUnknown_085B6154 - adds r0, r2 - ldrb r0, [r0, 0x6] - ldr r1, [sp, 0x1C] - strb r0, [r1] - mov r2, r9 - ldrb r0, [r2] - add r0, r10 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 2 - ldr r1, =gUnknown_085B6154 - adds r0, r1 - ldrb r0, [r0, 0x3] - ldr r2, [sp, 0x20] - strh r0, [r2] - mov r7, sp - adds r7, 0x9 - movs r0, 0 - strb r0, [r7] - ldrb r0, [r7] - cmp r0, 0x2 - bhi _08142726 - add r6, sp, 0xC - mov r8, r2 - ldr r0, [sp, 0x1C] - mov r12, r0 - ldr r1, =gUnknown_0203AB88 - str r1, [sp, 0x28] -_08142672: - mov r2, r9 - ldrb r0, [r2] - add r0, r10 - ldrb r0, [r0] - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 2 - ldr r0, =gUnknown_085B6154 - adds r1, r0 - str r7, [sp, 0x24] - ldrb r0, [r7] - ldrb r1, [r1, 0x4] - adds r0, r1 - lsls r0, 5 - strh r0, [r6] - ldr r1, [sp, 0x28] - ldr r4, [r1] - mov r2, r8 - ldrh r0, [r2] - ldrh r2, [r6] - adds r2, r0 - lsls r2, 1 - ldr r0, =0x0000117c - adds r5, r4, r0 - adds r2, r5, r2 - mov r1, r12 - ldrb r0, [r1] - ldrb r1, [r7] - adds r1, r0 - ldr r0, =0x0000397c - adds r4, r0 - ldr r3, [r4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 1 - adds r0, r3 - movs r1, 0xD0 - lsls r1, 1 - adds r0, r1 - ldrh r0, [r0] - strh r0, [r2] - mov r2, r8 - ldrh r0, [r2] - ldrh r2, [r6] - adds r2, r0 - adds r2, 0x1 - lsls r2, 1 - adds r2, r5, r2 - mov r1, r12 - ldrb r0, [r1] - ldrb r1, [r7] - adds r1, r0 - ldr r3, [r4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 1 - adds r0, r3 - movs r1, 0xD1 - lsls r1, 1 - adds r0, r1 - ldrh r0, [r0] - strh r0, [r2] - mov r2, r8 - ldrh r1, [r2] - ldrh r0, [r6] - adds r0, r1 - adds r0, 0x2 - lsls r0, 1 - adds r5, r0 - mov r1, r12 - ldrb r0, [r1] - ldrb r1, [r7] - adds r1, r0 - ldr r2, [r4] - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 1 - adds r0, r2 - movs r2, 0xD2 - lsls r2, 1 - adds r0, r2 - ldrh r0, [r0] - strh r0, [r5] - ldrb r0, [r7] - adds r0, 0x1 - strb r0, [r7] - ldr r1, [sp, 0x24] - ldrb r0, [r1] - cmp r0, 0x2 - bls _08142672 -_08142726: - mov r2, r9 - ldrb r0, [r2] - adds r0, 0x1 - strb r0, [r2] - ldrb r0, [r2] - ldr r1, [sp, 0x18] - cmp r0, r1 - bcs _08142738 - b _08142628 -_08142738: - add sp, 0x2C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81424FC - - thumb_func_start sub_8142758 -sub_8142758: @ 8142758 - push {r4,lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gUnknown_085B6448 - mov r0, sp - movs r2, 0x5 - bl memcpy - cmp r4, 0x13 - bls _08142770 - movs r4, 0 -_08142770: - ldr r3, =gUnknown_085B6154 - lsls r0, r4, 2 - adds r0, r4 - lsls r2, r0, 2 - adds r0, r2, r3 - ldrb r0, [r0, 0x1] - lsls r0, 28 - lsrs r0, 28 - cmp r0, 0x4 - beq _081427C4 - cmp r0, 0x4 - bgt _08142798 - cmp r0, 0x3 - beq _0814279E - b _08142808 - .pool -_08142798: - cmp r0, 0xC - beq _081427E8 - b _08142808 -_0814279E: - adds r0, r4, 0 - movs r1, 0x5 - bl __udivsi3 - subs r0, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - adds r0, 0x16 - adds r1, r0, r4 - ldrb r0, [r1] - cmp r0, 0x3 - bhi _08142808 - ldrb r0, [r1] - adds r0, 0x1 - b _081427DC - .pool -_081427C4: - subs r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - adds r0, 0x12 - adds r1, r0, r4 - ldrb r0, [r1] - cmp r0, 0x2 - bhi _08142808 - ldrb r0, [r1] - adds r0, 0x2 -_081427DC: - add r0, sp - ldrb r0, [r0] - b _0814280A - .pool -_081427E8: - ldr r0, =gUnknown_0203AB88 - ldr r1, [r0] - adds r0, r3, 0 - adds r0, 0x8 - adds r0, r2, r0 - ldr r1, [r1, 0x8] - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - bne _08142808 - mov r0, sp - ldrb r0, [r0, 0x4] - b _0814280A - .pool -_08142808: - movs r0, 0 -_0814280A: - add sp, 0x8 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8142758 - - thumb_func_start sub_8142814 -sub_8142814: @ 8142814 - push {r4-r6,lr} - ldr r4, =gUnknown_0203AB88 - ldr r0, [r4] - ldrh r1, [r0, 0x2C] - movs r0, 0x20 - bl SetGpuReg - ldr r0, [r4] - ldrh r1, [r0, 0x2E] - movs r0, 0x22 - bl SetGpuReg - ldr r0, [r4] - ldrh r1, [r0, 0x30] - movs r0, 0x24 - bl SetGpuReg - ldr r0, [r4] - ldrh r1, [r0, 0x32] - movs r0, 0x26 - bl SetGpuReg - ldr r3, [r4] - movs r0, 0x2E - ldrsh r1, [r3, r0] - ldr r0, =gSpriteCoordOffsetY - movs r4, 0 - ldrsh r2, [r0, r4] - adds r2, 0x50 - adds r0, r1, 0 - muls r0, r2 - movs r4, 0xE8 - lsls r4, 7 - subs r4, r0 - movs r6, 0x2C - ldrsh r5, [r3, r6] - ldr r0, =gSpriteCoordOffsetX - movs r6, 0 - ldrsh r1, [r0, r6] - adds r1, 0x74 - adds r0, r5, 0 - muls r0, r1 - subs r4, r0 - movs r5, 0x32 - ldrsh r0, [r3, r5] - muls r0, r2 - movs r5, 0xA8 - lsls r5, 7 - subs r5, r0 - movs r6, 0x30 - ldrsh r0, [r3, r6] - muls r0, r1 - subs r5, r0 - lsls r1, r4, 16 - lsrs r1, 16 - movs r0, 0x28 - bl SetGpuReg - ldr r6, =0x0fff0000 - ands r4, r6 - lsrs r4, 16 - movs r0, 0x2A - adds r1, r4, 0 - bl SetGpuReg - lsls r1, r5, 16 - lsrs r1, 16 - movs r0, 0x2C - bl SetGpuReg - ands r5, r6 - lsrs r5, 16 - movs r0, 0x2E - adds r1, r5, 0 - bl SetGpuReg - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8142814 - - thumb_func_start sub_81428C4 -sub_81428C4: @ 81428C4 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl DisplayYesNoMenu - ldr r1, =gUnknown_085B6408 - adds r0, r4, 0 - bl DoYesNoFuncWithChoice - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81428C4 - - thumb_func_start sub_81428E4 -sub_81428E4: @ 81428E4 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _08142908 - movs r0, 0 - bl SetVBlankCallback - ldr r0, =sub_81405CC - bl SetMainCallback2 - adds r0, r4, 0 - bl DestroyTask -_08142908: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81428E4 - - thumb_func_start sub_8142918 -sub_8142918: @ 8142918 - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - movs r1, 0x1 - bl sub_819746C - bl HideCoinsWindow - bl FreeAllWindowBuffers - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r2, =gPaletteFade - ldrb r1, [r2, 0x8] - lsls r1, 26 - lsrs r1, 26 - ldrb r3, [r2, 0x4] - movs r0, 0x40 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2, 0x4] - bl UpdatePaletteFade - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81428E4 - str r1, [r0] - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8142918 - - thumb_func_start sub_814297C -sub_814297C: @ 814297C - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - movs r1, 0 - bl sub_819746C - bl HideCoinsWindow - bl ScriptContext2_Disable - adds r0, r4, 0 - bl DestroyTask - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_814297C - - thumb_func_start sub_81429A0 -sub_81429A0: @ 81429A0 - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _081429DE - ldr r1, =gSpecialVar_0x8004 - movs r0, 0x1 - strh r0, [r1] - bl HideCoinsWindow - movs r0, 0 - movs r1, 0x1 - bl sub_819746C - bl ScriptContext2_Disable - adds r0, r4, 0 - bl DestroyTask -_081429DE: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81429A0 - - thumb_func_start sub_81429F0 -sub_81429F0: @ 81429F0 - push {r4-r6,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r6, r0, 24 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _08142A60 - ldr r2, =gUnknown_085B6344 - ldr r0, =gSpecialVar_0x8004 - ldrh r1, [r0] - movs r5, 0x1 - adds r0, r5, 0 - ands r0, r1 - lsrs r1, 7 - lsls r1, 1 - adds r0, r1 - adds r0, r2 - ldrb r1, [r0] - ldr r0, =gStringVar1 - movs r2, 0x2 - movs r3, 0x1 - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar4 - ldr r1, =gUnknown_082A5B12 - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - movs r1, 0 - bl NewMenuHelpers_DrawStdWindowFrame - str r5, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0 - bl AddTextPrinterParameterized - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - ldr r1, =gTasks - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81428C4 - str r1, [r0] -_08142A60: - add sp, 0xC - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81429F0 - - thumb_func_start sub_8142A88 -sub_8142A88: @ 8142A88 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r6, r0, r1 - movs r1, 0x22 - ldrsh r0, [r6, r1] - bl PrintCoinsString - ldr r2, =gUnknown_085B6344 - ldr r0, =gSpecialVar_0x8004 - mov r8, r0 - ldrh r1, [r0] - movs r7, 0x1 - adds r0, r7, 0 - ands r0, r1 - lsrs r1, 7 - lsls r1, 1 - adds r0, r1 - adds r0, r2 - ldrb r4, [r0] - ldr r0, =gStringVar1 - adds r1, r4, 0 - movs r2, 0x2 - movs r3, 0x1 - bl ConvertIntToDecimalStringN - movs r1, 0x22 - ldrsh r0, [r6, r1] - cmp r0, r4 - blt _08142B78 - mov r0, r8 - ldrh r1, [r0] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _08142B28 - adds r0, r7, 0 - ands r0, r1 - cmp r0, 0 - beq _08142B28 - movs r0, 0 - movs r1, 0 - bl NewMenuHelpers_DrawStdWindowFrame - ldr r2, =gUnknown_082A5B6B - str r7, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - ldr r0, =sub_81429F0 - str r0, [r6] - b _08142BB0 - .pool -_08142B28: - ldr r4, =gStringVar4 - ldr r1, =gUnknown_082A5B12 - adds r0, r4, 0 - bl StringExpandPlaceholders - movs r0, 0 - movs r1, 0 - bl NewMenuHelpers_DrawStdWindowFrame - movs r0, 0x1 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - movs r1, 0x1 - adds r2, r4, 0 - movs r3, 0 - bl AddTextPrinterParameterized - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_81428C4 - str r1, [r0] - b _08142BB0 - .pool -_08142B78: - ldr r5, =gStringVar4 - ldr r1, =gUnknown_082A5B4E - adds r0, r5, 0 - bl StringExpandPlaceholders - movs r0, 0 - movs r1, 0 - bl NewMenuHelpers_DrawStdWindowFrame - str r7, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r4, 0 - str r4, [sp, 0x8] - movs r0, 0 - movs r1, 0x1 - adds r2, r5, 0 - movs r3, 0 - bl AddTextPrinterParameterized - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - ldr r0, =sub_81429A0 - str r0, [r6] - strh r4, [r6, 0x22] - strh r4, [r6, 0x8] -_08142BB0: - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8142A88 - - thumb_func_start sub_8142BC8 -sub_8142BC8: @ 8142BC8 - push {r4,lr} - bl ScriptContext2_Enable - bl GetCoins - lsls r0, 16 - lsrs r0, 16 - movs r1, 0x1 - movs r2, 0x1 - bl ShowCoinsWindow - ldr r0, =sub_8142A88 - movs r1, 0 - bl CreateTask - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl GetCoins - ldr r2, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r2 - strh r0, [r1, 0x22] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8142BC8 - - thumb_func_start sub_8142C0C -sub_8142C0C: @ 8142C0C - push {lr} - lsls r0, 24 - cmp r0, 0 - bne _08142C44 - bl FreeAllSpritePalettes - ldr r0, =gUnknown_085B7384 - bl LoadSpritePalettes - ldr r0, =gUnknown_085B7864 - bl LoadCompressedSpriteSheet - ldr r0, =gUnknown_085B7978 - bl LoadCompressedSpriteSheet - ldr r0, =gUnknown_085B7A40 - bl LoadCompressedSpriteSheet - b _08142C5A - .pool -_08142C44: - movs r0, 0xE - bl FreeSpriteTilesByTag - movs r0, 0xD - bl FreeSpriteTilesByTag - movs r0, 0xC - bl FreeSpriteTilesByTag - bl FreeAllSpritePalettes -_08142C5A: - pop {r0} - bx r0 - thumb_func_end sub_8142C0C - - thumb_func_start sub_8142C60 -sub_8142C60: @ 8142C60 - push {r4-r6,lr} - adds r4, r1, 0 - adds r6, r2, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r1, [r0, 0x4] - ldrb r3, [r1] - movs r1, 0x74 - movs r2, 0x50 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - adds r5, r0, 0 - ldr r0, =gSprites - lsls r1, r5, 4 - adds r1, r5 - lsls r1, 2 - adds r1, r0 - ldrh r0, [r6] - strh r0, [r1, 0x2E] - strh r4, [r1, 0x30] - adds r3, r1, 0 - adds r3, 0x3E - ldrb r0, [r3] - movs r2, 0x2 - orrs r0, r2 - strb r0, [r3] - adds r1, 0x2C - ldrb r0, [r1] - movs r2, 0x40 - orrs r0, r2 - movs r2, 0x80 - orrs r0, r2 - strb r0, [r1] - ldrh r2, [r6] - adds r0, r2, 0 - adds r0, 0x1E - strh r0, [r6] - lsls r0, 16 - ldr r1, =0x01670000 - cmp r0, r1 - bls _08142CBC - ldr r1, =0xfffffeb6 - adds r0, r2, r1 - strh r0, [r6] -_08142CBC: - adds r0, r5, 0 - pop {r4-r6} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8142C60 - - thumb_func_start sub_8142CD0 -sub_8142CD0: @ 8142CD0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - ldr r4, =gUnknown_085B7488 - ldr r0, [r4] - ldr r5, =gDecompressionBuffer - adds r1, r5, 0 - bl LZ77UnCompWram - str r5, [sp] - mov r6, sp - ldrh r1, [r4, 0x6] - lsls r1, 16 - ldrh r0, [r4, 0x4] - orrs r0, r1 - str r0, [sp, 0x4] - mov r0, sp - bl LoadSpriteSheet - ldr r4, =gUnknown_085B7490 - ldr r0, [r4] - adds r1, r5, 0 - bl LZ77UnCompWram - str r5, [sp] - ldrh r0, [r4, 0x4] - strh r0, [r6, 0x4] - ldrh r0, [r4, 0x6] - strh r0, [r6, 0x6] - mov r0, sp - bl LoadSpriteSheet - movs r6, 0 - ldr r0, =gSprites - mov r8, r0 -_08142D18: - lsls r0, r6, 1 - adds r0, r6 - lsls r0, 27 - lsrs r4, r0, 24 - movs r5, 0 - lsls r7, r6, 2 -_08142D24: - lsls r1, r5, 1 - adds r1, r5 - lsls r1, 3 - ldr r0, =gSpriteTemplate_85B75B0 - adds r0, r1, r0 - adds r1, 0x94 - adds r2, r4, 0 - adds r2, 0x5C - movs r3, 0x1E - bl CreateSprite - ldr r1, =gUnknown_0203AB88 - ldr r1, [r1] - adds r2, r5, 0 - adds r2, 0x1D - adds r2, r7, r2 - adds r1, 0x3C - adds r1, r2 - strb r0, [r1] - lsls r0, 24 - lsrs r1, r0, 24 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r8 - adds r0, 0x2C - ldrb r1, [r0] - movs r2, 0x40 - orrs r1, r2 - strb r1, [r0] - adds r0, r4, 0 - adds r0, 0x18 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x47 - bls _08142D6E - movs r4, 0 -_08142D6E: - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x3 - bls _08142D24 - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x2 - bls _08142D18 - movs r6, 0 - ldr r4, =gSprites -_08142D86: - lsls r1, r6, 1 - adds r1, r6 - lsls r1, 3 - ldr r0, =gSpriteTemplate_85B7508 - adds r0, r1, r0 - adds r1, 0x94 - lsls r1, 16 - asrs r1, 16 - movs r2, 0x46 - movs r3, 0x1E - bl CreateSprite - ldr r1, =gUnknown_0203AB88 - ldr r1, [r1] - adds r1, r6 - adds r1, 0x65 - strb r0, [r1] - lsls r0, 24 - lsrs r1, r0, 24 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x2C - ldrb r1, [r0] - movs r2, 0x40 - orrs r1, r2 - strb r1, [r0] - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x3 - bls _08142D86 - movs r6, 0 - ldr r4, =gSprites -_08142DCC: - lsls r2, r6, 1 - adds r2, r6 - lsls r2, 3 - ldr r0, =gSpriteTemplate_85B7568 - adds r0, r2, r0 - adds r2, 0x5C - lsls r2, 16 - asrs r2, 16 - movs r1, 0x7E - movs r3, 0x1E - bl CreateSprite - ldr r1, =gUnknown_0203AB88 - ldr r1, [r1] - adds r1, r6 - adds r1, 0x69 - strb r0, [r1] - lsls r0, 24 - lsrs r1, r0, 24 - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x2C - ldrb r1, [r0] - movs r2, 0x40 - orrs r1, r2 - strb r1, [r0] - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x2 - bls _08142DCC - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8142CD0 - - thumb_func_start sub_8142E3C -sub_8142E3C: @ 8142E3C - push {r4,lr} - movs r4, 0 -_08142E40: - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - adds r0, r4 - adds r0, 0x59 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - bl DestroySprite - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xB - bls _08142E40 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8142E3C - - thumb_func_start sub_8142E70 -sub_8142E70: @ 8142E70 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - mov r12, r1 - cmp r0, 0 - beq _08142EC0 - cmp r0, 0x1 - bne _08142F66 - movs r4, 0 - ldr r5, =gSprites - ldr r3, =gUnknown_0203AB88 - movs r2, 0x4 -_08142E92: - ldr r0, [r3] - adds r0, r4 - adds r0, 0x59 - 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 r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x12 - bls _08142E92 - b _08142F66 - .pool -_08142EC0: - movs r4, 0 - ldr r0, =gUnknown_0203AB88 - mov r9, r0 - ldr r7, =gUnknown_085B62E4 - adds r1, r7, 0x4 - mov r8, r1 - ldr r5, =gSprites - movs r6, 0x5 - negs r6, r6 -_08142ED2: - mov r0, r9 - ldr r2, [r0] - lsls r3, r4, 3 - mov r1, r8 - adds r0, r3, r1 - ldr r1, [r2, 0x8] - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _08142F14 - adds r0, r3, r7 - ldrb r0, [r0, 0x2] - cmp r0, r12 - beq _08142F14 - adds r0, r2, r4 - adds r0, 0x59 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - b _08142F2C - .pool -_08142F14: - adds r0, r2, r4 - adds r0, 0x59 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - adds r1, 0x3E - ldrb r2, [r1] - adds r0, r6, 0 - ands r0, r2 - strb r0, [r1] -_08142F2C: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xB - bls _08142ED2 - cmp r4, 0x12 - bhi _08142F66 - ldr r6, =gSprites - ldr r3, =gUnknown_0203AB88 - movs r5, 0x5 - negs r5, r5 -_08142F42: - ldr r0, [r3] - adds r0, r4 - adds r0, 0x59 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - adds r1, 0x3E - ldrb r2, [r1] - adds r0, r5, 0 - ands r0, r2 - strb r0, [r1] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x12 - bls _08142F42 -_08142F66: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8142E70 - - thumb_func_start sub_8142F7C -sub_8142F7C: @ 8142F7C - push {r4-r7,lr} - mov r7, r8 - push {r7} - movs r5, 0 - ldr r6, =gUnknown_0203AB88 - ldr r4, =gSprites - movs r0, 0x4 - mov r8, r0 -_08142F8C: - ldr r0, =gSpriteTemplate_85B7928 - movs r1, 0x74 - movs r2, 0x14 - movs r3, 0xA - bl CreateSprite - ldr r1, [r6] - adds r3, r5, 0 - adds r3, 0x31 - adds r1, 0x3C - adds r1, r3 - strb r0, [r1] - ldr r0, [r6] - adds r0, 0x3C - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3E - ldrb r1, [r0] - mov r2, r8 - orrs r1, r2 - strb r1, [r0] - ldr r2, [r6] - adds r2, 0x3C - adds r2, r3 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x1 - strh r1, [r0, 0x2E] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r4, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_814390C - str r1, [r0] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldrb r1, [r0, 0x5] - movs r7, 0xD - negs r7, r7 - adds r2, r7, 0 - ands r1, r2 - mov r2, r8 - orrs r1, r2 - strb r1, [r0, 0x5] - ldr r0, [r6] - adds r0, 0x3C - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - movs r1, 0x8 - bl StartSpriteAnim - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x5 - bls _08142F8C - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8142F7C - - thumb_func_start sub_8143038 -sub_8143038: @ 8143038 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsls r1, 24 - lsrs r1, 24 - mov r9, r1 - movs r6, 0 - cmp r0, 0 - beq _08143084 - ldr r4, =gSprites - ldr r3, =gUnknown_0203AB88 - movs r2, 0x4 -_08143056: - ldr r0, [r3] - adds r0, r6 - adds r0, 0x6D - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3E - ldrb r1, [r0] - orrs r1, r2 - strb r1, [r0] - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x5 - bls _08143056 - b _08143142 - .pool -_08143084: - ldr r0, =gUnknown_0203AB88 - mov r8, r0 - ldr r7, =gSprites - ldr r0, =gUnknown_085B6154 - mov r12, r0 - movs r0, 0x5 - negs r0, r0 - mov r10, r0 -_08143094: - mov r0, r8 - ldr r1, [r0] - adds r0, r1, 0 - adds r0, 0xC - adds r0, r6 - ldrb r0, [r0] - cmp r0, 0 - beq _081430A8 - cmp r6, r9 - bne _081430D0 -_081430A8: - adds r0, r1, r6 - adds r0, 0x6D - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - b _08143138 - .pool -_081430D0: - adds r5, r6, 0 - adds r5, 0x31 - adds r0, r1, 0 - adds r0, 0x3C - adds r0, r5 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r7 - adds r1, 0x3E - ldrb r2, [r1] - mov r0, r10 - ands r0, r2 - strb r0, [r1] - mov r0, r8 - ldr r3, [r0] - adds r4, r3, 0 - adds r4, 0x3C - adds r4, r5 - ldrb r0, [r4] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r7 - adds r3, 0xC - adds r3, r6 - ldrb r1, [r3] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 2 - add r0, r12 - ldrb r0, [r0, 0x3] - adds r0, 0x1 - lsls r0, 3 - adds r0, 0x4 - strh r0, [r2, 0x20] - ldrb r0, [r4] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r7 - ldrb r1, [r3] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 2 - add r0, r12 - ldrb r0, [r0, 0x4] - adds r0, 0x1 - lsls r0, 3 - adds r0, 0x3 - strh r0, [r2, 0x22] -_08143138: - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x5 - bls _08143094 -_08143142: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8143038 - - thumb_func_start sub_8143150 -sub_8143150: @ 8143150 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - bne _08143180 - ldr r2, =gSprites - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - adds r0, 0x6C - 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] - b _081431D0 - .pool -_08143180: - ldr r4, =gSprites - ldr r3, =gUnknown_0203AB88 - ldr r0, [r3] - adds r0, 0x6C - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - ldr r3, [r3] - adds r3, 0x6C - ldrb r0, [r3] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - ldr r0, =gUnknown_085B6154 - lsls r2, r5, 2 - adds r2, r5 - lsls r2, 2 - adds r2, r0 - ldrb r0, [r2, 0x3] - adds r0, 0x2 - lsls r0, 3 - strh r0, [r1, 0x20] - ldrb r0, [r3] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - ldrb r0, [r2, 0x4] - adds r0, 0x2 - lsls r0, 3 - strh r0, [r1, 0x22] -_081431D0: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8143150 - - thumb_func_start sub_81431E4 -sub_81431E4: @ 81431E4 - push {r4-r7,lr} - sub sp, 0xC - ldr r4, =gUnknown_085B741C - ldr r0, [r4] - ldr r5, =gDecompressionBuffer - adds r1, r5, 0 - bl LZ77UnCompWram - str r5, [sp, 0x4] - add r0, sp, 0x4 - ldrh r2, [r4, 0x6] - lsls r2, 16 - ldrh r1, [r4, 0x4] - orrs r1, r2 - str r1, [r0, 0x4] - bl LoadSpriteSheet - movs r1, 0xF - mov r0, sp - strh r1, [r0] - movs r0, 0 - ldr r7, =gSprites -_08143210: - movs r4, 0 - adds r6, r0, 0x1 - lsls r5, r0, 2 -_08143216: - adds r1, r5, r4 - lsls r0, r1, 1 - adds r0, r1 - lsls r0, 3 - ldr r1, =gSpriteTemplate_85B7610 - adds r0, r1 - movs r1, 0x28 - mov r2, sp - bl sub_8142C60 - ldr r1, =gUnknown_0203AB88 - ldr r1, [r1] - adds r2, r4, 0x7 - adds r2, r5, r2 - adds r1, 0x3C - adds r1, r2 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r7 - adds r1, 0x2C - ldrb r0, [r1] - movs r2, 0x40 - orrs r0, r2 - movs r2, 0x80 - orrs r0, r2 - strb r0, [r1] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _08143216 - lsls r0, r6, 24 - lsrs r0, 24 - cmp r0, 0x2 - bls _08143210 - add sp, 0xC - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81431E4 - - thumb_func_start sub_8143280 -sub_8143280: @ 8143280 - push {r4-r6,lr} - adds r6, r0, 0 - ldr r0, =gUnknown_0203AB88 - ldr r1, [r0] - ldrh r0, [r6, 0x2E] - ldrh r1, [r1, 0x24] - adds r0, r1 - lsls r0, 16 - lsrs r4, r0, 16 - asrs r1, r0, 16 - ldr r0, =0x00000167 - cmp r1, r0 - ble _081432A2 - ldr r2, =0xfffffe98 - adds r0, r1, r2 - lsls r0, 16 - lsrs r4, r0, 16 -_081432A2: - adds r0, r4, 0 - bl Sin2 - lsls r0, 16 - lsrs r5, r0, 16 - adds r0, r4, 0 - bl Cos2 - lsls r2, r5, 16 - asrs r2, 16 - movs r3, 0x30 - ldrsh r1, [r6, r3] - muls r1, r2 - asrs r1, 12 - strh r1, [r6, 0x24] - lsls r0, 16 - asrs r4, r0, 16 - negs r1, r4 - movs r3, 0x30 - ldrsh r0, [r6, r3] - muls r0, r1 - asrs r0, 12 - strh r0, [r6, 0x26] - ldrb r0, [r6, 0x3] - lsls r0, 26 - lsrs r3, r0, 27 - cmp r2, 0 - bge _081432DC - adds r2, 0xF -_081432DC: - lsls r0, r2, 12 - lsrs r5, r0, 16 - ldr r1, =gOamMatrices - lsls r0, r3, 3 - adds r1, r0, r1 - adds r0, r4, 0 - cmp r0, 0 - bge _081432EE - adds r0, 0xF -_081432EE: - asrs r0, 4 - strh r0, [r1, 0x6] - strh r0, [r1] - strh r5, [r1, 0x2] - lsls r0, r5, 16 - asrs r0, 16 - negs r0, r0 - strh r0, [r1, 0x4] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8143280 - - thumb_func_start sub_8143314 -sub_8143314: @ 8143314 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - movs r5, 0 - ldr r7, =gDecompressionBuffer - mov r6, sp -_08143322: - ldr r0, =gUnknown_085B7750 - lsls r4, r5, 3 - adds r4, r0 - ldr r0, [r4] - adds r1, r7, 0 - bl LZ77UnCompWram - str r7, [sp] - ldrh r2, [r4, 0x4] - ldr r0, =0xffff0000 - ldr r1, [r6, 0x4] - ands r1, r0 - orrs r1, r2 - str r1, [r6, 0x4] - ldrh r2, [r4, 0x6] - lsls r2, 16 - ldr r0, =0x0000ffff - ands r0, r1 - orrs r0, r2 - str r0, [r6, 0x4] - mov r0, sp - bl LoadSpriteSheet - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x4 - bls _08143322 - ldr r0, =gSpriteTemplate_85B77E4 - movs r1, 0xD0 - movs r2, 0x10 - movs r3, 0x4 - bl CreateSprite - ldr r3, =gUnknown_0203AB88 - ldr r1, [r3] - adds r1, 0x50 - strb r0, [r1] - ldr r4, =gSprites - ldr r0, [r3] - adds r0, 0x50 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x2C - ldrb r1, [r0] - movs r2, 0x40 - orrs r1, r2 - strb r1, [r0] - movs r5, 0 - adds r7, r3, 0 -_0814338C: - lsls r1, r5, 19 - movs r0, 0xC4 - lsls r0, 16 - adds r1, r0 - asrs r1, 16 - ldr r0, =gUnknown_085B77FC - movs r2, 0x18 - movs r3, 0 - bl CreateSprite - ldr r1, [r7] - adds r3, r5, 0 - adds r3, 0x15 - adds r1, 0x3C - adds r1, r3 - strb r0, [r1] - ldr r0, [r7] - adds r0, 0x3C - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - ldr r0, [r7] - adds r0, 0x3C - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x2C - ldrb r1, [r0] - movs r6, 0x40 - orrs r1, r6 - strb r1, [r0] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x3 - bls _0814338C - ldr r0, =gUnknown_085B7814 - movs r1, 0x78 - movs r2, 0x44 - movs r3, 0x4 - bl CreateSprite - ldr r2, =gUnknown_0203AB88 - ldr r1, [r2] - adds r1, 0x55 - strb r0, [r1] - ldr r3, =gSprites - ldr r0, [r2] - adds r0, 0x55 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - adds r0, 0x2C - ldrb r1, [r0] - orrs r1, r6 - strb r1, [r0] - movs r5, 0 - adds r4, r2, 0 - adds r7, r3, 0 -_0814341C: - lsls r1, r5, 20 - movs r2, 0xC0 - lsls r2, 16 - adds r1, r2 - asrs r1, 16 - ldr r0, =gUnknown_085B782C - movs r2, 0x24 - movs r3, 0x4 - bl CreateSprite - ldr r1, [r4] - adds r2, r5, 0 - adds r2, 0x1A - adds r1, 0x3C - adds r1, r2 - strb r0, [r1] - ldr r0, [r4] - adds r0, 0x3C - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - adds r0, 0x3E - ldrb r1, [r0] - movs r3, 0x4 - mov r8, r3 - mov r3, r8 - orrs r1, r3 - strb r1, [r0] - ldr r0, [r4] - adds r0, 0x3C - adds r0, r2 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r7 - adds r0, 0x2C - ldrb r1, [r0] - movs r6, 0x40 - orrs r1, r6 - strb r1, [r0] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x2 - bls _0814341C - ldr r0, =gUnknown_085B7844 - movs r1, 0x98 - movs r2, 0x60 - movs r3, 0x9 - bl CreateSprite - ldr r3, =gUnknown_0203AB88 - ldr r1, [r3] - adds r1, 0x6C - strb r0, [r1] - ldr r4, =gSprites - ldr r0, [r3] - adds r0, 0x6C - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r4 - ldrb r2, [r1, 0x5] - movs r0, 0xD - negs r0, r0 - ands r0, r2 - mov r2, r8 - orrs r0, r2 - strb r0, [r1, 0x5] - ldr r0, [r3] - adds r0, 0x6C - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x2C - ldrb r1, [r0] - orrs r1, r6 - strb r1, [r0] - ldr r0, [r3] - adds r0, 0x6C - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - adds r0, 0x3E - ldrb r1, [r0] - orrs r1, r2 - strb r1, [r0] - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8143314 - - thumb_func_start sub_8143514 -sub_8143514: @ 8143514 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 16 - lsrs r7, r0, 16 - movs r0, 0xFA - lsls r0, 2 - mov r8, r0 - movs r4, 0 - movs r6, 0 - ldr r1, =gSprites - mov r9, r1 - ldr r0, =gUnknown_0203AB88 - mov r10, r0 -_08143534: - adds r0, r7, 0 - mov r1, r8 - bl __udivsi3 - lsls r0, 24 - lsrs r5, r0, 24 - ldr r1, =gUnknown_0203AB88 - ldr r0, [r1] - adds r3, r6, 0 - adds r3, 0x15 - adds r0, 0x3C - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r0, r1 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0] - cmp r5, 0 - bne _0814356E - cmp r4, 0 - bne _0814356E - cmp r6, 0x3 - bne _081435CC -_0814356E: - mov r4, r10 - ldr r0, [r4] - adds r0, 0x3C - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - add r0, r9 - adds r0, 0x3E - ldrb r1, [r0] - movs r4, 0x5 - negs r4, r4 - adds r2, r4, 0 - ands r1, r2 - strb r1, [r0] - mov r1, r10 - ldr r0, [r1] - adds r0, 0x3C - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - mov r4, r9 - adds r3, r0, r4 - adds r4, r3, 0 - adds r4, 0x40 - ldr r1, =gSprites + 8 - adds r0, r1 - ldr r0, [r0] - ldr r1, [r0] - lsls r0, r5, 2 - adds r0, r1 - ldrh r2, [r0] - ldrh r4, [r4] - adds r2, r4 - ldr r4, =0x000003ff - adds r0, r4, 0 - ands r2, r0 - ldrh r0, [r3, 0x4] - ldr r4, =0xfffffc00 - adds r1, r4, 0 - ands r0, r1 - orrs r0, r2 - strh r0, [r3, 0x4] - movs r4, 0x1 -_081435CC: - adds r0, r7, 0 - mov r1, r8 - bl __umodsi3 - lsls r0, 16 - lsrs r7, r0, 16 - mov r0, r8 - movs r1, 0xA - bl __udivsi3 - lsls r0, 16 - lsrs r0, 16 - mov r8, r0 - adds r0, r6, 0x1 - lsls r0, 24 - lsrs r6, r0, 24 - cmp r6, 0x3 - bls _08143534 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8143514 - - thumb_func_start sub_8143614 -sub_8143614: @ 8143614 - push {r4,lr} - sub sp, 0x8 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r1, =gUnknown_085B7B04 - mov r0, sp - movs r2, 0x5 - bl memcpy - cmp r4, 0x13 - bls _0814362C - movs r4, 0 -_0814362C: - ldr r3, =gUnknown_085B6154 - lsls r0, r4, 2 - adds r0, r4 - lsls r2, r0, 2 - adds r0, r2, r3 - ldrb r0, [r0, 0x1] - lsls r0, 28 - lsrs r0, 28 - cmp r0, 0x4 - beq _08143680 - cmp r0, 0x4 - bgt _08143654 - cmp r0, 0x3 - beq _0814365A - b _081436C4 - .pool -_08143654: - cmp r0, 0xC - beq _081436A4 - b _081436C4 -_0814365A: - adds r0, r4, 0 - movs r1, 0x5 - bl __udivsi3 - subs r0, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - adds r0, 0x16 - adds r1, r0, r4 - ldrb r0, [r1] - cmp r0, 0x3 - bhi _081436C4 - ldrb r0, [r1] - adds r0, 0x1 - b _08143698 - .pool -_08143680: - subs r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - adds r0, 0x12 - adds r1, r0, r4 - ldrb r0, [r1] - cmp r0, 0x2 - bhi _081436C4 - ldrb r0, [r1] - adds r0, 0x2 -_08143698: - add r0, sp - ldrb r0, [r0] - b _081436C6 - .pool -_081436A4: - ldr r0, =gUnknown_0203AB88 - ldr r1, [r0] - adds r0, r3, 0 - adds r0, 0x8 - adds r0, r2, r0 - ldr r1, [r1, 0x8] - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - bne _081436C4 - mov r0, sp - ldrb r0, [r0, 0x4] - b _081436C6 - .pool -_081436C4: - movs r0, 0 -_081436C6: - add sp, 0x8 - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8143614 - - thumb_func_start sub_81436D0 -sub_81436D0: @ 81436D0 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0203AB88 - ldr r1, [r1] - adds r1, 0x55 - ldrb r2, [r1] - lsls r1, r2, 4 - adds r1, r2 - lsls r1, 2 - ldr r2, =gSprites - adds r4, r1, r2 - bl sub_8143614 - adds r3, r4, 0 - adds r3, 0x2B - strb r0, [r3] - adds r2, r4, 0 - adds r2, 0x40 - ldr r1, [r4, 0x8] - ldrb r0, [r3] - ldr r1, [r1] - lsls r0, 2 - adds r0, r1 - ldrh r1, [r0] - ldrh r2, [r2] - adds r1, r2 - ldr r2, =0x000003ff - adds r0, r2, 0 - ands r1, r0 - ldrh r2, [r4, 0x4] - ldr r0, =0xfffffc00 - ands r0, r2 - orrs r0, r1 - strh r0, [r4, 0x4] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81436D0 - - thumb_func_start sub_814372C -sub_814372C: @ 814372C - push {r4-r7,lr} - mov r7, r8 - push {r7} - lsls r0, 24 - lsrs r2, r0, 24 - movs r6, 0 - ldr r1, =gUnknown_0203AB88 - ldr r0, [r1] - ldrb r0, [r0, 0x19] - adds r5, r1, 0 - cmp r0, 0x1 - bne _08143746 - movs r6, 0x2 -_08143746: - cmp r2, 0x6 - bls _0814374C - b _081438A8 -_0814374C: - lsls r0, r2, 2 - ldr r1, =_08143760 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08143760: - .4byte _081438A8 - .4byte _08143864 - .4byte _0814383C - .4byte _08143830 - .4byte _08143808 - .4byte _081437FC - .4byte _0814377C -_0814377C: - movs r4, 0 - ldr r5, =gSprites - ldr r6, =gUnknown_0203AB88 - movs r0, 0x5 - negs r0, r0 - mov r12, r0 - adds r7, r5, 0 - adds r7, 0x8 - ldr r2, =0xfffffc00 - mov r8, r2 -_08143790: - ldr r0, [r6] - adds r3, r4, 0 - adds r3, 0x1A - adds r0, 0x3C - adds r0, r3 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r5 - adds r1, 0x3E - ldrb r2, [r1] - mov r0, r12 - ands r0, r2 - strb r0, [r1] - ldr r0, [r6] - adds r0, 0x3C - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r3, r0, r5 - adds r2, r3, 0 - adds r2, 0x40 - adds r0, r7 - ldr r0, [r0] - ldr r0, [r0] - ldrh r1, [r0] - ldrh r2, [r2] - adds r1, r2 - ldr r2, =0x000003ff - adds r0, r2, 0 - ands r1, r0 - ldrh r2, [r3, 0x4] - mov r0, r8 - ands r0, r2 - orrs r0, r1 - strh r0, [r3, 0x4] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x2 - bls _08143790 - b _081438F4 - .pool -_081437FC: - ldr r2, =gSprites - ldr r0, [r5] - adds r0, 0x58 - b _0814386A - .pool -_08143808: - ldr r2, =gSprites - ldr r0, [r5] - adds r0, 0x58 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r3, r0, r2 - adds r4, r3, 0 - adds r4, 0x40 - adds r2, 0x8 - adds r0, r2 - ldr r0, [r0] - ldr r1, [r0] - lsls r0, r6, 2 - adds r0, r1 - ldrh r1, [r0, 0x8] - b _08143886 - .pool -_08143830: - ldr r2, =gSprites - ldr r0, [r5] - adds r0, 0x57 - b _0814386A - .pool -_0814383C: - ldr r2, =gSprites - ldr r0, [r5] - adds r0, 0x57 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r3, r0, r2 - adds r4, r3, 0 - adds r4, 0x40 - adds r2, 0x8 - adds r0, r2 - ldr r0, [r0] - ldr r1, [r0] - lsls r0, r6, 2 - adds r0, r1 - ldrh r1, [r0, 0x8] - b _08143886 - .pool -_08143864: - ldr r2, =gSprites - ldr r0, [r5] - adds r0, 0x56 -_0814386A: - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r3, r0, r2 - adds r4, r3, 0 - adds r4, 0x40 - adds r2, 0x8 - adds r0, r2 - ldr r0, [r0] - ldr r1, [r0] - lsls r0, r6, 2 - adds r0, r1 - ldrh r1, [r0, 0x4] -_08143886: - ldrh r4, [r4] - adds r1, r4 - ldr r2, =0x000003ff - adds r0, r2, 0 - ands r1, r0 - ldrh r2, [r3, 0x4] - ldr r0, =0xfffffc00 - ands r0, r2 - orrs r0, r1 - strh r0, [r3, 0x4] - b _081438F4 - .pool -_081438A8: - movs r4, 0 - lsls r7, r6, 2 - ldr r6, =gSprites - movs r0, 0x8 - adds r0, r6 - mov r12, r0 - ldr r2, =0xfffffc00 - mov r8, r2 -_081438B8: - ldr r0, [r5] - adds r0, r4 - adds r0, 0x56 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r3, r0, r6 - adds r2, r3, 0 - adds r2, 0x40 - add r0, r12 - ldr r0, [r0] - ldr r0, [r0] - adds r0, r7, r0 - ldrh r1, [r0, 0x8] - ldrh r2, [r2] - adds r1, r2 - ldr r2, =0x000003ff - adds r0, r2, 0 - ands r1, r0 - ldrh r2, [r3, 0x4] - mov r0, r8 - ands r0, r2 - orrs r0, r1 - strh r0, [r3, 0x4] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x2 - bls _081438B8 -_081438F4: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814372C - thumb_func_start sub_814390C sub_814390C: @ 814390C ldr r1, =gUnknown_0203AB88 diff --git a/data/event_scripts.s b/data/event_scripts.s index 5d847719e..99b6f4dcf 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -4695,7 +4695,7 @@ MauvilleCity_GameCorner_EventScript_2A5ADF:: @ 82A5ADF end MauvilleCity_GameCorner_EventScript_2A5B0D:: @ 82A5B0D - special sub_8142BC8 + special PlayRoulette waitstate end diff --git a/data/specials.inc b/data/specials.inc index dd8a51b34..5ac4930c7 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -173,7 +173,7 @@ gSpecials:: @ 81DBA64 def_special sub_81B94B0 def_special GetFirstFreePokeblockSlot def_special DoBerryBlending - def_special sub_8142BC8 + def_special PlayRoulette def_special ShouldMoveLilycoveFanClubMember def_special GetNumMovedLilycoveFanClubMembers def_special BufferStreakTrainerText diff --git a/include/roulette_util.h b/include/roulette_util.h index 4542b73c6..76752fe74 100644 --- a/include/roulette_util.h +++ b/include/roulette_util.h @@ -47,5 +47,6 @@ void task_tutorial_controls_fadein(struct UnkStruct0 *r0); void sub_8151678(struct UnkStruct0 *r0); u8 sub_815168C(struct UnkStruct0 *r0, u8 r1, const struct UnkStruct1 *r2); void sub_8151A9C(struct UnkStruct0 *r0, u16 r1); +void sub_8151A48(struct UnkStruct0 *r0, u16 r1); #endif // GUARD_ROULETTE_UTIL_H diff --git a/src/roulette.c b/src/roulette.c index 8a483e123..fb12b93d0 100644 --- a/src/roulette.c +++ b/src/roulette.c @@ -2,24 +2,30 @@ #include "alloc.h" #include "bg.h" #include "coins.h" +#include "decompress.h" #include "event_data.h" +#include "field_screen_effect.h" #include "gpu_regs.h" #include "m4a.h" #include "main.h" #include "menu.h" #include "menu_helpers.h" +#include "overworld.h" #include "palette.h" #include "random.h" #include "roulette.h" #include "roulette_util.h" #include "rtc.h" #include "scanline_effect.h" +#include "script.h" #include "sound.h" #include "sprite.h" +#include "string_util.h" #include "task.h" #include "trig.h" #include "tv.h" #include "window.h" +#include "constants/rgb.h" #include "constants/species.h" #include "constants/songs.h" @@ -44,7 +50,7 @@ struct StructgUnknown_083F8DF4 float var1C; }; -struct StructgUnknown_083F8C00 +struct StructgUnknown_085B6154 { u8 var00; u8 var01_0:4; @@ -61,6 +67,15 @@ struct StructgUnknown_083F8C00 u16 var12; }; +struct StructgUnknown_083F8D90 +{ + u8 var00; + u8 var01; + u8 var02; + u8 var03; + u32 var04; +}; + extern struct Roulette { u8 var00; @@ -129,10 +144,21 @@ extern u8 gUnknown_0203AB8C; /*static*/ void sub_81410FC(u8); /*static*/ void sub_8141344(u8); /*static*/ void sub_814155C(u8); +/*static*/ void sub_81415D4(u8); +/*static*/ void sub_81416D4(u8); +/*static*/ void sub_8141778(u8); +/*static*/ void sub_814189C(u8); +/*static*/ void sub_8141A18(u8); +/*static*/ void sub_8141AC0(u8); +/*static*/ void sub_8141B58(u8); +/*static*/ void dp01t_12_3_battle_menu(u8); /*static*/ void sub_8141DE4(u8); +/*static*/ void sub_8141E7C(u8); /*static*/ void sub_8141F7C(u8 taskId, TaskFunc r1, u16 r2, u16 r3); /*static*/ void sub_8141FF4(u8); /*static*/ void sub_8142070(void); +/*static*/ u8 sub_81420D0(u8, u8); +/*static*/ bool8 sub_81421E8(u8, u8); /*static*/ void sub_8142284(u8); /*static*/ void sub_81424FC(u8); /*static*/ u8 sub_8142758(u8); @@ -142,14 +168,17 @@ extern u8 gUnknown_0203AB8C; /*static*/ void sub_8142E70(u8, u8); /*static*/ void sub_8142F7C(void); /*static*/ void sub_8143038(u8, u8); +/*static*/ void sub_8143150(u8); /*static*/ void sub_81431E4(void); /*static*/ void sub_8143314(void); /*static*/ void sub_8143514(u16); /*static*/ void sub_81436D0(u8); /*static*/ void sub_814372C(u8); +/*static*/ void sub_814390C(struct Sprite *); /*static*/ void sub_814391C(void); /*static*/ void sub_81439C8(void); /*static*/ void sub_8143A40(void); +/*static*/ void sub_81446AC(struct Sprite *); extern const struct BgTemplate gUnknown_085B6140[3]; extern const struct WindowTemplate gUnknown_085B614C[]; @@ -164,10 +193,45 @@ extern const u32 gRouletteWheelTiles[]; extern const u32 gUnknown_085B5FA0[]; extern const u8 gUnknown_082A5B89[]; extern const u8 gUnknown_082A5C13[]; +extern const u8 gUnknown_082A5BD7[]; +extern const u8 gUnknown_082A5BCB[]; +extern const u8 gUnknown_082A5BE0[]; +extern const u8 gUnknown_082A5BEF[]; +extern const u8 gUnknown_082A5C21[]; +extern const u8 gUnknown_082A5C61[]; +extern const u8 gUnknown_082A5C04[]; +extern const u8 gUnknown_082A5B12[]; +extern const u8 gUnknown_082A5B6B[]; +extern const u8 gUnknown_082A5B4E[]; extern const struct YesNoFuncTable gUnknown_085B6410; -extern const struct StructgUnknown_083F8C00 gUnknown_085B6154[]; +extern const struct StructgUnknown_085B6154 gUnknown_085B6154[]; extern const u8 gUnknown_085B641E[]; extern const u16 gUnknown_085B6422; +extern const u32 gUnknown_085B642C[]; +extern const u32 gUnknown_085B643C[]; +extern const struct StructgUnknown_083F8D90 gUnknown_085B62E4[]; +extern const struct UnkStruct1 gUnknown_085B63F0[]; +extern const u8 gUnknown_085B6448[]; +extern const struct YesNoFuncTable gUnknown_085B6408; +extern const struct SpritePalette gUnknown_085B7384[]; +extern const struct CompressedSpriteSheet gUnknown_085B7864; +extern const struct CompressedSpriteSheet gUnknown_085B7978; +extern const struct CompressedSpriteSheet gUnknown_085B7A40; +extern const struct CompressedSpriteSheet gUnknown_085B7488; +extern const struct CompressedSpriteSheet gUnknown_085B7490; +extern const struct SpriteTemplate gSpriteTemplate_85B75B0[]; +extern const struct SpriteTemplate gSpriteTemplate_85B7508[]; +extern const struct SpriteTemplate gSpriteTemplate_85B7568[]; +extern const struct SpriteTemplate gSpriteTemplate_85B7928; +extern const struct CompressedSpriteSheet gUnknown_085B741C; +extern const struct SpriteTemplate gSpriteTemplate_85B7610[]; +extern const struct CompressedSpriteSheet gUnknown_085B7750[]; +extern const struct SpriteTemplate gSpriteTemplate_85B77E4; +extern const struct SpriteTemplate gUnknown_085B77FC; +extern const struct SpriteTemplate gUnknown_085B7814; +extern const struct SpriteTemplate gUnknown_085B782C; +extern const struct SpriteTemplate gUnknown_085B7844; +extern const u8 gUnknown_085B7B04[]; void sub_8140238(void) { @@ -557,16 +621,12 @@ void sub_8140D6C(u8 r0) if (var0) { u8 i; - struct Roulette *roulette; sub_81424FC(gTasks[r0].data[4]); sub_8140B64(r0); gTasks[r0].data[1] = z; PlaySE(SE_SELECT); sub_8151A9C(&gUnknown_0203AB88->varB8, 0xFFFF); - roulette = gUnknown_0203AB88; - roulette->varB8.var04[15].var00_7 = 0; - roulette->varB8.var04[14].var00_7 = 0; - roulette->varB8.var04[13].var00_7 = 0; + gUnknown_0203AB88->varB8.var04[13].var00_7 = gUnknown_0203AB88->varB8.var04[14].var00_7 = gUnknown_0203AB88->varB8.var04[15].var00_7 = 0; sub_8142284(gTasks[r0].data[4]); for (i = 0; i < 4; i++) { @@ -605,33 +665,33 @@ void sub_8140FC4(u8 taskId) if ((gTasks[taskId].data[13] -= gUnknown_0203AB88->var19) < 0) gTasks[taskId].data[13] = 0; sub_8143514(gTasks[taskId].data[13]); - gTasks[taskId].func = &sub_8140F6C; + gTasks[taskId].func = sub_8140F6C; } void sub_8141040(u8 taskId) { sub_8140D6C(taskId); - switch (gTasks[taskId].data[0x1]) + switch (gTasks[taskId].data[1]) { case 0: - sub_81409B8(gTasks[taskId].data[0x4]); - gTasks[taskId].data[0x1]+= 1; + sub_81409B8(gTasks[taskId].data[4]); + gTasks[taskId].data[1]+= 1; break; case 30: sub_81409B8(0); - gTasks[taskId].data[0x1]+= 1; + gTasks[taskId].data[1]+= 1; break; case 59: - gTasks[taskId].data[0x1] = 0; + gTasks[taskId].data[1] = 0; break; default: - gTasks[taskId].data[0x1]++; + gTasks[taskId].data[1]++; } if (gMain.newKeys & A_BUTTON) { - if ((gUnknown_0203AB88->var08 & gUnknown_085B6154[gTasks[taskId].data[0x4]].var08)) + if ((gUnknown_0203AB88->var08 & gUnknown_085B6154[gTasks[taskId].data[4]].var08)) PlaySE(SE_BOO); else { @@ -643,19 +703,19 @@ void sub_8141040(u8 taskId) void sub_81410FC(u8 taskId) { - if (gTasks[taskId].data[0x1]-- > 0) + if (gTasks[taskId].data[1]-- > 0) { - if (gTasks[taskId].data[0x1] > 0x2) - gSpriteCoordOffsetX += 0x2; - if ((gUnknown_0203AB88->var26 += 0x4) == 0x68) - gSprites[gUnknown_0203AB88->var3C[0x19]].callback = &SpriteCallbackDummy; + if (gTasks[taskId].data[1] > 2) + gSpriteCoordOffsetX += 2; + if ((gUnknown_0203AB88->var26 += 4) == 104) + gSprites[gUnknown_0203AB88->var3C[25]].callback = &SpriteCallbackDummy; } else { - sub_8142E70(1, 0xFF); - sub_8143038(1, 0xFF); + sub_8142E70(1, -1); + sub_8143038(1, -1); gTasks[taskId].func = sub_8141344; - gTasks[taskId].data[0x1] = 0; + gTasks[taskId].data[1] = 0; } } @@ -1051,3 +1111,1076 @@ _08141558:\n\ .4byte sub_814155C"); } #endif // NONMATCHING + +void sub_814155C(u8 taskId) +{ + u8 index; + gUnknown_0203AB88->var03_7 = 1; + index = gUnknown_0203AB88->var3C[gUnknown_0203AB88->var7C]; + gUnknown_0203AB88->var38 = &gSprites[index]; + gUnknown_0203AB88->var38->callback = sub_81446AC; + gTasks[taskId].data[6]++; + gTasks[taskId].data[0x8]++; + sub_814372C(6 - gTasks[taskId].data[6]); + m4aSongNumStart(SE_TAMAKORO); + gTasks[taskId].func = sub_81415D4; +} + +void sub_81415D4(u8 taskId) +{ + if (gUnknown_0203AB88->var7D) + { + if (gUnknown_0203AB88->var03_5) + { + if (gUnknown_0203AB88->var03_6) + { + gUnknown_0203AB88->var03_6 = FALSE; + gUnknown_0203AB88->var03_5 = FALSE; + } + } + else + { + if (!gTasks[taskId].data[1]) + { + bool8 temp = sub_81421E8(sub_81420D0(taskId, gUnknown_0203AB88->var7E), gUnknown_0203AB88->var1B[gUnknown_0203AB88->var1A_0]); + gTasks[taskId].data[5] = temp; + if (temp == TRUE) + sub_8151A48(&gUnknown_0203AB88->varB8, 0x1000); + } + if (gTasks[taskId].data[1] <= 60) + { + if (gMain.newKeys & A_BUTTON) + gTasks[taskId].data[1] = 60; + gTasks[taskId].data[1]++; + } + else + { + sub_81424FC(gUnknown_0203AB88->var1B[gUnknown_0203AB88->var1A_0]); + sub_8142E70(0, gTasks[taskId].data[12]); + sub_8143038(0, gTasks[taskId].data[6] - 1); + gTasks[taskId].data[1] = 32; + gTasks[taskId].func = sub_81416D4; + } + } + } +} + +void sub_81416D4(u8 taskId) +{ + if (gTasks[taskId].data[1]-- > 0) + { + if (gTasks[taskId].data[1] > 2) + gSpriteCoordOffsetX -= 2; + if ((gUnknown_0203AB88->var26 -= 4) == 104) + gSprites[gUnknown_0203AB88->var3C[25]].callback = sub_814390C; + } + else + { + sub_8143150(gTasks[taskId].data[12]); + if (gTasks[taskId].data[5] == 1) + gTasks[taskId].data[1] = 121; + else + gTasks[taskId].data[1] = 61; + gTasks[taskId].func = sub_8141778; + } +} + +void sub_8141778(u8 taskId) +{ + if (gTasks[taskId].data[1]-- > 1) + { + switch (gTasks[taskId].data[1] % 16) + { + case 8: + sub_8142E70(0, -1); + sub_8143038(0, -1); + break; + case 0: + sub_8142E70(0, gTasks[taskId].data[12]); + sub_8143038(0, gTasks[taskId].data[6] - 1); + break; + } + } + else + { + sub_8141F7C(taskId, sub_814189C, 30, 0); + } +} + +void sub_8141800(u8 taskId) +{ + switch (gTasks[taskId].data[0x5]) + { + case 1: + case 2: + if (IsFanfareTaskInactive()) + { + u32 wins = GetGameStat(GAME_STAT_CONSECUTIVE_ROULETTE_WINS); + if (wins < ++gTasks[taskId].data[11]) + SetGameStat(GAME_STAT_CONSECUTIVE_ROULETTE_WINS, gTasks[taskId].data[11]); + sub_8141F7C(taskId, sub_8141A18, 0xFFFF, 3); + } + break; + case 0: + default: + if (!IsSEPlaying()) + { + gTasks[taskId].data[11] = FALSE; + sub_8141F7C(taskId, sub_8141AC0, 0xFFFF, 3); + } + break; + } +} + +void sub_814189C(u8 taskId) +{ + switch (gTasks[taskId].data[5]) + { + case 1: + case 2: + if (gTasks[taskId].data[2] == 12) + { + PlayFanfare(MUS_ME_B_BIG); + NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE); + AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5BD7, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(gUnknown_0203AB8C, 3); + } + else + { + PlayFanfare(MUS_ME_B_SMALL); + NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE); + AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5BCB, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(gUnknown_0203AB8C, 3); + } + break; + case 0: + default: + m4aSongNumStart(SE_HAZURE); + NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE); + AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5BE0, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(gUnknown_0203AB8C, 3); + break; + } + gTasks[taskId].data[1] = 0; + gTasks[taskId].func = sub_8141800; +} + +void sub_8141984(u8 taskId) +{ + s32 r0 = gTasks[taskId].data[7]; + switch (r0) + { + case 0: + gTasks[taskId].data[13]++; + m4aSongNumStart(SE_PIN); + sub_8143514(gTasks[taskId].data[13]); + if (gTasks[taskId].data[13] >= 9999) + { + gTasks[taskId].data[1] = r0; + } + else + { + gTasks[taskId].data[1]--; + gTasks[taskId].data[7]++; + } + break; + case 3: + m4aSongNumStop(SE_PIN); + gTasks[taskId].data[7] = 0; + break; + default: + gTasks[taskId].data[7]++; + break; + } + if (gTasks[taskId].data[1] == 0) + sub_8141F7C(taskId, sub_8141AC0, 0xFFFF, 3); +} + +void sub_8141A18(u8 taskId) +{ + ConvertIntToDecimalStringN(gStringVar1, (gUnknown_0203AB88->var19 * gTasks[taskId].data[2]), STR_CONV_MODE_LEFT_ALIGN, 2); + StringExpandPlaceholders(gStringVar4, gUnknown_082A5BEF); + NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE); + AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(gUnknown_0203AB8C, 3); + gTasks[taskId].data[1] = (gUnknown_0203AB88->var19 * gTasks[taskId].data[2]); + gTasks[taskId].data[7] = 0; + gTasks[taskId].func = sub_8141984; +} + +void sub_8141AC0(u8 taskId) +{ + sub_8151A9C(&gUnknown_0203AB88->varB8, 0xFFFF); + gUnknown_0203AB88->varB8.var04[13].var00_7 = gUnknown_0203AB88->varB8.var04[14].var00_7 = gUnknown_0203AB88->varB8.var04[15].var00_7 = 0; + gSprites[gUnknown_0203AB88->var3C[7 + gUnknown_085B6154[gTasks[taskId].data[12]].var00]].invisible = TRUE; + gTasks[taskId].func = sub_8141B58; +} + +void sub_8141B58(u8 taskId) +{ + u8 i = 0; + gTasks[taskId].data[4] = i; + gUnknown_0203AB88->var1B[gUnknown_0203AB88->var1A_0] = 0; + sub_81424FC(0); + gSprites[gUnknown_0203AB88->var3C[48]].invisible = TRUE; + for (i = 0; i < 4; i++) + { + gSprites[gUnknown_0203AB88->var3C[i + 41]].oam.tileNum = + gSprites[gUnknown_0203AB88->var3C[i + 41]].sheetTileStart + + (*gSprites[gUnknown_0203AB88->var3C[i + 41]].anims)->type; + } + if (gTasks[taskId].data[13] >= gUnknown_0203AB88->var19) + { + if (gTasks[taskId].data[6] == 6) + { + NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE); + AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5C21, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(gUnknown_0203AB8C, 3); + sub_8141F7C(taskId, dp01t_12_3_battle_menu, 0xFFFF, 3); + } + else if (gTasks[taskId].data[13] == 9999) + { + NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE); + AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5C61, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(gUnknown_0203AB8C, 3); + sub_8141F7C(taskId, sub_8140914, 0xFFFF, 0x3); + } + else + { + gTasks[taskId].func = sub_8140914; + } + } + else + { + NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE); + AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5C04, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(gUnknown_0203AB8C, 3); + sub_8141F7C(taskId, sub_8140994, 0x3C, 0x3); + } +} + +void dp01t_12_3_battle_menu(u8 taskId) +{ + u8 i = 0; + + gTasks[taskId].data[6] = 0; + sub_8141FF4(taskId); + sub_8142070(); + sub_8143A40(); + sub_81424FC(0); + sub_814372C(6); + + for (i = 0; i < 12; i++) + { + gSprites[gUnknown_0203AB88->var3C[i + 7]].invisible = FALSE; + } + + if (gTasks[taskId].data[13] == 9999) + { + NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE); + AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5C61, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(gUnknown_0203AB8C, 3); + sub_8141F7C(taskId, sub_8140914, 0xFFFF, 3); + } + else + { + gTasks[taskId].func = sub_8140914; + } +} + +void sub_8141DE4(u8 taskId) +{ + sub_8151A9C(&gUnknown_0203AB88->varB8, 0xFFFF); + sub_8151678(&gUnknown_0203AB88->varB8); + SetCoins(gTasks[taskId].data[13]); + if (GetCoins() < gUnknown_0203AB88->var19) + gSpecialVar_0x8004 = TRUE; + else + gSpecialVar_0x8004 = FALSE; + sub_80EDD78(GetCoins()); + BeginHardwarePaletteFade(0xFF, 0, 0, 16, 0); + gTasks[taskId].func = sub_8141E7C; +} + +void sub_8141E7C(u8 taskId) // end roulette ? +{ + if (UpdatePaletteFade() == 0) + { + SetVBlankCallback(NULL); + gSpriteCoordOffsetX = gSpriteCoordOffsetY = 0; + ResetVramOamAndBgCntRegs(); + ResetAllBgsCoordinates(); + SetGpuReg(REG_OFFSET_BLDCNT, 0); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDY, 0); + FreeAllSpritePalettes(); + ResetPaletteFade(); + ResetSpriteData(); + sub_8140418(); + gFieldCallback = sub_80AF168; + SetMainCallback2(CB2_ReturnToField); + DestroyTask(taskId); + } +} + +void sub_8141EF8(u8 taskId) +{ + if (gUnknown_0203AB88->varA8 == 0 || gMain.newKeys & gUnknown_0203AB88->varAA) + { + gTasks[taskId].func = gUnknown_0203AB88->varAC; + if (gUnknown_0203AB88->varAA > 0) + PlaySE(SE_SELECT); + gUnknown_0203AB88->varAC = NULL; + gUnknown_0203AB88->varAA = 0; + gUnknown_0203AB88->varA8 = 0; + } + if (gUnknown_0203AB88->varA8 != 0xFFFF) + gUnknown_0203AB88->varA8--; +} + +void sub_8141F7C(u8 taskId, TaskFunc r1, u16 r2, u16 r3) +{ + gUnknown_0203AB88->varB4 = gTasks[taskId].func; + if (r1 == NULL) + r1 = gUnknown_0203AB88->varB4; + gUnknown_0203AB88->varAC = r1; + gUnknown_0203AB88->varA8 = r2; + if (r2 == 0xFFFF && r3 == 0) + gUnknown_0203AB88->varAA = 0xFFFF; + else + gUnknown_0203AB88->varAA = r3; + gTasks[taskId].func = sub_8141EF8; +} + +void sub_8141FF4(u8 taskId) +{ + u8 i = 0; + gUnknown_0203AB88->var00 = i; + gUnknown_0203AB88->var03_7 = 0; + gUnknown_0203AB88->var03_5 = 0; + gUnknown_0203AB88->var03_6 = 0; + gUnknown_0203AB88->var03_0 = 0; + for (i = 0; i < 6; i++) + { + gUnknown_0203AB88->var1B[i] = 0; + } + gUnknown_0203AB88->var1A_0 = 0; + gTasks[taskId].data[1] = 0; +} + +void sub_8142070(void) +{ + u8 i; + gUnknown_0203AB88->var08 = 0; + for (i = 0; i < 6; i++) + { + gUnknown_0203AB88->var0C[i] = 0; + } + for (i = 0; i < 4; i++) + { + gUnknown_0203AB88->var12[i] = 0; + } + for (i = 0; i < 3; i++) + { + gUnknown_0203AB88->var16[i] = 0; + } + sub_8143038(1, -1); +} + +u8 sub_81420D0(u8 taskId, u8 r1) +{ + u8 i; + u8 z; + u32 t0[4]; + u32 t1[3]; + + memcpy(t0, gUnknown_085B642C, sizeof(t0)); + memcpy(t1, gUnknown_085B643C, sizeof(t1)); + + if (r1 > 11) + return 0; + + gUnknown_0203AB88->var0C[gTasks[taskId].data[6] - 1] = gUnknown_085B62E4[r1].var02; + gTasks[taskId].data[12] = gUnknown_085B62E4[r1].var02; + gUnknown_0203AB88->var08 |= gUnknown_085B62E4[r1].var04; + for (i = 0; i < 4; i++) + { + if (gUnknown_085B62E4[r1].var04 & t0[i]) + gUnknown_0203AB88->var12[i]++; + if (gUnknown_0203AB88->var12[i] > 2) + gUnknown_0203AB88->var08 |= t0[i]; + } + for (z = 0; z < 3; z++) + { + if (gUnknown_085B62E4[r1].var04 & t1[z]) + gUnknown_0203AB88->var16[z]++; + if (gUnknown_0203AB88->var16[z] > 3) + gUnknown_0203AB88->var08 |= t1[z]; + } + return gUnknown_085B62E4[r1].var02; +} + +bool8 sub_81421E8(u8 r0, u8 r1) +{ + u8 t = r0; + if (--r0 < 19) + { + switch (r1) + { + case 0: + return 3; + case 1 ... 4: + if (t == r1 + 5 || t == r1 + 10 || t == r1 + 15) + return TRUE; + break; + case 5: + case 10: + case 15: + if (t >= (r1 + 1) && t <= (r1 + 4)) + return TRUE; + break; + default: + if (t == r1) + return TRUE; + } + } + return FALSE; +} + +void sub_8142284(u8 r0) +{ + + u16 var0 = 0x0; + u8 var2; + u16 var3; + u8 i; + + switch (r0) + { + case 5: + case 10: + case 15: + for (i = (r0 + 1); i < (r0 + 5); i++) + { + if (!(gUnknown_0203AB88->var08 & gUnknown_085B6154[i].var08)) + var0 |= gUnknown_085B6154[i].var10; + } + sub_8151A48(&gUnknown_0203AB88->varB8, var0 &= 0xDFFF); + break; + default: + { + struct UnkStruct1 var1[3]; + memcpy(var1, gUnknown_085B63F0, sizeof(var1)); + if (r0 > 0 && r0 < 5) + var2 = 3; + else + var2 = 1; + var3 = r0 / 5 - 1; + switch (r0 % 5) + { + case 1: + var3 = gSprites[gUnknown_0203AB88->var3C[7]].oam.paletteNum * 16; + break; + case 2: + var3 = gSprites[gUnknown_0203AB88->var3C[8]].oam.paletteNum * 16; + break; + case 3: + var3 = gSprites[gUnknown_0203AB88->var3C[9]].oam.paletteNum * 16; + break; + case 4: + var3 = gSprites[gUnknown_0203AB88->var3C[10]].oam.paletteNum * 16; + break; + } + if (var2 == 1) + { + if (!(gUnknown_0203AB88->var08 & gUnknown_085B6154[r0].var08)) + { + var1[r0 / 5 - 1].var02 += var3; + sub_815168C(&gUnknown_0203AB88->varB8, 13, &var1[r0 / 5 - 1]); + } + else + { + break; + } + } + else + { + for (i = 0; i < 3; i++) + { + u8 var4 = i * 5 + r0 + 5; + if (!(gUnknown_0203AB88->var08 & gUnknown_085B6154[var4].var08)) + { + var1[var4 / 5 - 1].var02 += var3; + sub_815168C(&gUnknown_0203AB88->varB8, i + 13, &var1[var4 / 5 - 1]); + if (var2 == 3) + var0 = gUnknown_085B6154[var4].var10; + var2--; + } + } + if (var2 != 2) + var0 = 0; + } + sub_8151A48(&gUnknown_0203AB88->varB8, var0 |= gUnknown_085B6154[r0].var10); + break; + } + } +} + +void sub_81424FC(u8 r0) +{ + vu8 i; + vu8 z; + vu16 var1; + vu16 var2; + vu8 var0; + u8 v[5]; + u8 l; + gUnknown_0203AB88->var2A = 1; + sub_8142E70(0, 0); + sub_8152058(gUnknown_0203AB88->tilemapBuffers[2], gUnknown_0203AB88->unk_397C, 14, 7, 16, 13); + switch (r0) + { + case 0: + return; + case 1 ... 4: + l = 4; + for (i = 0; i < l; i++) + { + v[i] = i * 5 + r0; + } + break; + case 5: + case 10: + case 15: + l = 5; + for (i = 0; i < l; i++) + { + v[i] = i + r0; + } + break; + default: + l = 1; + v[0] = r0; + } + for (i = 0; i < l; i++) + { + var0 = gUnknown_085B6154[v[i]].var06; + var1 = gUnknown_085B6154[v[i]].var03; + for (z = 0; z < 3; z++) + { + var2 = (gUnknown_085B6154[v[i]].var04 + z) * 32; + gUnknown_0203AB88->tilemapBuffers[2][var1 + var2 + 0] = gUnknown_0203AB88->unk_397C[(var0 + z) * 3 + 208]; + gUnknown_0203AB88->tilemapBuffers[2][var1 + var2 + 1] = gUnknown_0203AB88->unk_397C[(var0 + z) * 3 + 209]; + gUnknown_0203AB88->tilemapBuffers[2][var1 + var2 + 2] = gUnknown_0203AB88->unk_397C[(var0 + z) * 3 + 210]; + } + } +} + +u8 sub_8142758(u8 r0) +{ + u8 var0[5]; + memcpy(var0, gUnknown_085B6448, sizeof(var0)); + + if (r0 > 19) + r0 = 0; + switch (gUnknown_085B6154[r0].var01_0) + { + case 3: + r0 = r0 / 5 - 1; + if (gUnknown_0203AB88->var16[r0] > 3) + return 0; + return var0[gUnknown_0203AB88->var16[r0] + 1]; + case 4: + r0--; + if (gUnknown_0203AB88->var12[r0] > 2) + return 0; + return var0[gUnknown_0203AB88->var12[r0] + 2]; + case 12: + if (gUnknown_0203AB88->var08 & gUnknown_085B6154[r0].var08) + return 0; + return var0[4]; + } + return 0; +} + +void sub_8142814(void) +{ + s32 x1; + s32 x2; + SetGpuReg(REG_OFFSET_BG2PA, gUnknown_0203AB88->var2C.a); + SetGpuReg(REG_OFFSET_BG2PB, gUnknown_0203AB88->var2C.b); + SetGpuReg(REG_OFFSET_BG2PC, gUnknown_0203AB88->var2C.c); + SetGpuReg(REG_OFFSET_BG2PD, gUnknown_0203AB88->var2C.d); + x1 = 0x7400 - gUnknown_0203AB88->var2C.a * (gSpriteCoordOffsetX + 116) + - gUnknown_0203AB88->var2C.b * (gSpriteCoordOffsetY + 80); + x2 = 0x5400 - gUnknown_0203AB88->var2C.c * (gSpriteCoordOffsetX + 116) + - gUnknown_0203AB88->var2C.d * (gSpriteCoordOffsetY + 80); + SetGpuReg(REG_OFFSET_BG2X_L, x1); + SetGpuReg(REG_OFFSET_BG2X_H, (x1 & 0x0fff0000) >> 16); + SetGpuReg(REG_OFFSET_BG2Y_L, x2); + SetGpuReg(REG_OFFSET_BG2Y_H, (x2 & 0x0fff0000) >> 16); +} + +void sub_81428C4(u8 r0) +{ + DisplayYesNoMenu(); + DoYesNoFuncWithChoice(r0, &gUnknown_085B6408); +} + +void sub_81428E4(u8 taskId) +{ + if (!gPaletteFade.active) + { + SetVBlankCallback(NULL); + SetMainCallback2(sub_81405CC); + DestroyTask(taskId); + } +} + +void sub_8142918(u8 taskId) +{ + sub_819746C(0, TRUE); + HideCoinsWindow(); + FreeAllWindowBuffers(); + BeginNormalPaletteFade(0xFFFFFFFF, 0, 0, 16, RGB_BLACK); + gPaletteFade.delayCounter = gPaletteFade.multipurpose2; + UpdatePaletteFade(); + gTasks[taskId].func = sub_81428E4; +} + +void sub_814297C(u8 taskId) +{ + sub_819746C(0, FALSE); + HideCoinsWindow(); + ScriptContext2_Disable(); + DestroyTask(taskId); +} + +void sub_81429A0(u8 taskId) +{ + gTasks[taskId].data[0]++; + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + gSpecialVar_0x8004 = 1; + HideCoinsWindow(); + sub_819746C(0, TRUE); + ScriptContext2_Disable(); + DestroyTask(taskId); + } +} + +void sub_81429F0(u8 taskId) +{ + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + u32 temp = gUnknown_085B6344[(gSpecialVar_0x8004 & 1) + (gSpecialVar_0x8004 >> 7 << 1)]; + ConvertIntToDecimalStringN(gStringVar1, temp, STR_CONV_MODE_LEADING_ZEROS, 1); + StringExpandPlaceholders(gStringVar4, gUnknown_082A5B12); + NewMenuHelpers_DrawStdWindowFrame(0, FALSE); + AddTextPrinterParameterized(0, 1, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(0, 3); + gTasks[taskId].func = sub_81428C4; + } +} + +void Task_Roulette_0(u8 taskId) +{ + s32 temp; + PrintCoinsString(gTasks[taskId].data[13]); + temp = gUnknown_085B6344[(gSpecialVar_0x8004 & 1) + (gSpecialVar_0x8004 >> 7 << 1)]; + ConvertIntToDecimalStringN(gStringVar1, temp, 2, 1); + if (gTasks[taskId].data[13] >= temp) + { + if ((gSpecialVar_0x8004 & 0x80) && (gSpecialVar_0x8004 & 1)) + { + NewMenuHelpers_DrawStdWindowFrame(0, FALSE); + AddTextPrinterParameterized(0, 1, gUnknown_082A5B6B, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(0, 3); + gTasks[taskId].func = sub_81429F0; + } + else + { + StringExpandPlaceholders(gStringVar4, gUnknown_082A5B12); + NewMenuHelpers_DrawStdWindowFrame(0, FALSE); + AddTextPrinterParameterized(0, 1, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(0, 3); + gTasks[taskId].func = sub_81428C4; + } + } + else + { + StringExpandPlaceholders(gStringVar4, gUnknown_082A5B4E); + NewMenuHelpers_DrawStdWindowFrame(0, FALSE); + AddTextPrinterParameterized(0, 1, gStringVar4, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(0, 3); + gTasks[taskId].func = sub_81429A0; + gTasks[taskId].data[13] = 0; + gTasks[taskId].data[0] = 0; + } +} + +void PlayRoulette(void) +{ + u8 taskId; + + ScriptContext2_Enable(); + ShowCoinsWindow(GetCoins(), 1, 1); + taskId = CreateTask(Task_Roulette_0, 0); + gTasks[taskId].data[13] = GetCoins(); +} + +void sub_8142C0C(u8 r0) +{ + if (!r0) + { + FreeAllSpritePalettes(); + LoadSpritePalettes(gUnknown_085B7384); + LoadCompressedSpriteSheet(&gUnknown_085B7864); + LoadCompressedSpriteSheet(&gUnknown_085B7978); + LoadCompressedSpriteSheet(&gUnknown_085B7A40); + } + else + { + FreeSpriteTilesByTag(14); + FreeSpriteTilesByTag(13); + FreeSpriteTilesByTag(12); + FreeAllSpritePalettes(); + } +} + +u8 sub_8142C60(const struct SpriteTemplate *r0, u8 r1, u16 *r2) +{ + u16 temp; + u8 spriteId = CreateSprite(r0, 116, 80, r0->oam->y); + gSprites[spriteId].data[0] = *r2; + gSprites[spriteId].data[1] = r1; + gSprites[spriteId].coordOffsetEnabled = TRUE; + gSprites[spriteId].animPaused = TRUE; + gSprites[spriteId].affineAnimPaused = TRUE; + temp = *r2; + *r2 += 30; + if (*r2 >= 360) + *r2 = temp - 330; + return spriteId; +} + +void sub_8142CD0(void) +{ + u8 i, j; + u8 spriteId; + struct SpriteSheet s; + LZ77UnCompWram(gUnknown_085B7488.data, gDecompressionBuffer); + s.data = gDecompressionBuffer; + s.size = gUnknown_085B7488.size; + s.tag = gUnknown_085B7488.tag; + LoadSpriteSheet(&s); + LZ77UnCompWram(gUnknown_085B7490.data, gDecompressionBuffer); + s.data = gDecompressionBuffer; + s.size = gUnknown_085B7490.size; + s.tag = gUnknown_085B7490.tag; + LoadSpriteSheet(&s); + for (i = 0; i < 3; i++) + { + u8 o = i * 24; + for (j = 0; j < 4; j++) + { + spriteId = gUnknown_0203AB88->var3C[(i * 4) + 29 + j] = CreateSprite(&gSpriteTemplate_85B75B0[j], (j * 24) + 148, o + 92, 30); + gSprites[spriteId].animPaused = TRUE; + o += 24; + if (o >= 72) + o = 0; + } + } + for (i = 0; i < 4; i++) + { + spriteId = gUnknown_0203AB88->var3C[i + 41] = CreateSprite(&gSpriteTemplate_85B7508[i], (i * 24) + 148, 70, 30); + gSprites[spriteId].animPaused = TRUE; + } + for (i = 0; i < 3; i++) + { + spriteId = gUnknown_0203AB88->var3C[i + 45] = CreateSprite(&gSpriteTemplate_85B7568[i], 126, (i * 24) + 92, 30); + gSprites[spriteId].animPaused = TRUE; + } +} + +void unref_sub_8142E3C(void) +{ + u8 i; + for (i = 0; i < 12; i++) + { + DestroySprite(&gSprites[gUnknown_0203AB88->var3C[i + 29]]); + } +} + +void sub_8142E70(u8 r0, u8 r1) +{ + u8 i; + switch (r0) + { + case 1: + for (i = 0; i < 19; i++) + { + gSprites[gUnknown_0203AB88->var3C[i + 29]].invisible = TRUE; + } + break; + case 0: + for (i = 0; i < 12; i++) + { + if (!(gUnknown_0203AB88->var08 & gUnknown_085B62E4[i].var04)) + gSprites[gUnknown_0203AB88->var3C[i + 29]].invisible = FALSE; + else if (gUnknown_085B62E4[i].var02 != r1) + gSprites[gUnknown_0203AB88->var3C[i + 29]].invisible = TRUE; + else + gSprites[gUnknown_0203AB88->var3C[i + 29]].invisible = FALSE; + } + for (; i < 19; i++) + { + gSprites[gUnknown_0203AB88->var3C[i + 29]].invisible = FALSE; + } + break; + } +} + +void sub_8142F7C(void) +{ + u8 i; + for (i = 0; i < 6; i++) + { + gUnknown_0203AB88->var3C[i + 49] = CreateSprite(&gSpriteTemplate_85B7928, 116, 20, 10); + gSprites[gUnknown_0203AB88->var3C[i + 49]].invisible = TRUE; + gSprites[gUnknown_0203AB88->var3C[i + 49]].data[0] = 1; + gSprites[gUnknown_0203AB88->var3C[i + 49]].callback = sub_814390C; + gSprites[gUnknown_0203AB88->var3C[i + 49]].oam.priority = 1; + StartSpriteAnim(&gSprites[gUnknown_0203AB88->var3C[i + 49]], 8); + } +} + +void sub_8143038(u8 r0, u8 r1) +{ + u8 i = 0; + if (r0) + { + for ( ; i < 6; i++) + { + gSprites[gUnknown_0203AB88->var3C[i + 49]].invisible = TRUE; + } + } + else + { + for ( ; i < 6; i++) + { + if (!gUnknown_0203AB88->var0C[i] || i == r1) + { + gSprites[gUnknown_0203AB88->var3C[i + 49]].invisible = TRUE; + } + else + { + gSprites[gUnknown_0203AB88->var3C[i + 49]].invisible = FALSE; + gSprites[gUnknown_0203AB88->var3C[i + 49]].pos1.x = (gUnknown_085B6154[gUnknown_0203AB88->var0C[i]].var03 + 1) * 8 + 4; + gSprites[gUnknown_0203AB88->var3C[i + 49]].pos1.y = (gUnknown_085B6154[gUnknown_0203AB88->var0C[i]].var04 + 1) * 8 + 3; + } + } + } +} + +void sub_8143150(u8 r0) +{ + if (!r0) + { + gSprites[gUnknown_0203AB88->var3C[48]].invisible = TRUE; + } + else + { + gSprites[gUnknown_0203AB88->var3C[48]].invisible = FALSE; + gSprites[gUnknown_0203AB88->var3C[48]].pos1.x = (gUnknown_085B6154[r0].var03 + 2) * 8; + gSprites[gUnknown_0203AB88->var3C[48]].pos1.y = (gUnknown_085B6154[r0].var04 + 2) * 8; + } +} + +void sub_81431E4(void) +{ + u8 i, j; + u16 k; + struct SpriteSheet s; + + LZ77UnCompWram(gUnknown_085B741C.data, gDecompressionBuffer); + s.data = gDecompressionBuffer; + s.size = gUnknown_085B741C.size; + s.tag = gUnknown_085B741C.tag; + LoadSpriteSheet(&s); + + k = 15; + for (i = 0; i < 3; i++) + { + for (j = 0; j < 4; j++) + { + u8 spriteId; + spriteId = gUnknown_0203AB88->var3C[(i * 4) + 7 + j] = sub_8142C60(&gSpriteTemplate_85B7610[i * 4 + j], 40, &k); + gSprites[spriteId].animPaused = TRUE; + gSprites[spriteId].affineAnimPaused = TRUE; + } + } +} + +void sub_8143280(struct Sprite *sprite) +{ + s16 cos; + s16 sin; + u32 matrixNum; + s16 angle = gUnknown_0203AB88->var24 + sprite->data[0]; + if (angle >= 360) + angle -= 360; + sin = Sin2(angle); + cos = Cos2(angle); + sprite->pos2.x = sin * sprite->data[1] >> 12; + sprite->pos2.y = -cos * sprite->data[1] >> 12; + matrixNum = sprite->oam.matrixNum; + sin /= 16; + gOamMatrices[matrixNum].d = cos /= 16; + gOamMatrices[matrixNum].a = cos; + gOamMatrices[matrixNum].b = sin; + gOamMatrices[matrixNum].c = -sin; +} + +void sub_8143314(void) +{ + u8 i; + for (i = 0; i < 5; i++) + { + struct SpriteSheet s; + LZ77UnCompWram(gUnknown_085B7750[i].data, gDecompressionBuffer); + s.data = gDecompressionBuffer; + s.size = gUnknown_085B7750[i].size; + s.tag = gUnknown_085B7750[i].tag; + LoadSpriteSheet(&s); + } + gUnknown_0203AB88->var3C[20] = CreateSprite(&gSpriteTemplate_85B77E4, 208, 16, 4); + gSprites[gUnknown_0203AB88->var3C[20]].animPaused = TRUE; + for (i = 0; i < 4; i++) + { + gUnknown_0203AB88->var3C[i + 21] = CreateSprite(&gUnknown_085B77FC, i * 8 + 196, 24, 0); + gSprites[gUnknown_0203AB88->var3C[i + 21]].invisible = TRUE; + gSprites[gUnknown_0203AB88->var3C[i + 21]].animPaused = TRUE; + } + gUnknown_0203AB88->var3C[25] = CreateSprite(&gUnknown_085B7814, 120, 68, 4); + gSprites[gUnknown_0203AB88->var3C[25]].animPaused = TRUE; + for (i = 0; i < 3; i++) + { + gUnknown_0203AB88->var3C[i + 26] = CreateSprite(&gUnknown_085B782C, i * 16 + 192, 36, 4); + gSprites[gUnknown_0203AB88->var3C[i + 26]].invisible = TRUE; + gSprites[gUnknown_0203AB88->var3C[i + 26]].animPaused = TRUE; + } + gUnknown_0203AB88->var3C[48] = CreateSprite(&gUnknown_085B7844, 152, 96, 9); + gSprites[gUnknown_0203AB88->var3C[48]].oam.priority = 1; + gSprites[gUnknown_0203AB88->var3C[48]].animPaused = TRUE; + gSprites[gUnknown_0203AB88->var3C[48]].invisible = TRUE; +} + +void sub_8143514(u16 r0) +{ + u8 i; + u16 d = 1000; + bool8 v = FALSE; + for (i = 0; i < 4; i++) + { + u8 t = r0 / d; + gSprites[gUnknown_0203AB88->var3C[i + 21]].invisible = TRUE; + if (t > 0 || v || i == 3) + { + gSprites[gUnknown_0203AB88->var3C[i + 21]].invisible = FALSE; + gSprites[gUnknown_0203AB88->var3C[i + 21]].oam.tileNum = + gSprites[gUnknown_0203AB88->var3C[i + 21]].sheetTileStart + + (*gSprites[gUnknown_0203AB88->var3C[i + 21]].anims + t)->type; + v = TRUE; + } + r0 = r0 % d; + d = d / 10; + } +} + +u8 sub_8143614(u8 r0) +{ + u8 t[5]; + memcpy(t, gUnknown_085B7B04, sizeof(t)); + + if (r0 >= 20) + r0 = 0; + switch (gUnknown_085B6154[r0].var01_0) + { + case 3: + r0 = r0 / 5 - 1; + if (gUnknown_0203AB88->var16[r0] > 3) + return 0; + return t[gUnknown_0203AB88->var16[r0] + 1]; + case 4: + r0--; + if (gUnknown_0203AB88->var12[r0] > 2) + return 0; + return t[gUnknown_0203AB88->var12[r0] + 2]; + case 12: + if (gUnknown_0203AB88->var08 & gUnknown_085B6154[r0].var08) + return 0; + return t[4]; + } + return 0; +} + +void sub_81436D0(u8 r0) +{ + struct Sprite *s = &gSprites[gUnknown_0203AB88->var3C[25]]; + s->animCmdIndex = sub_8143614(r0); + s->oam.tileNum = s->sheetTileStart + (*s->anims + s->animCmdIndex)->type; +} + +void sub_814372C(u8 r0) +{ + u8 i; + u8 t = 0; + if (gUnknown_0203AB88->var19 == 1) + t = 2; + switch (r0) + { + case 6: + for (i = 0; i < 3; i++) + { + gSprites[gUnknown_0203AB88->var3C[i + 26]].invisible = FALSE; + gSprites[gUnknown_0203AB88->var3C[i + 26]].oam.tileNum = + gSprites[gUnknown_0203AB88->var3C[i + 26]].sheetTileStart + + (*gSprites[gUnknown_0203AB88->var3C[i + 26]].anims)->type; + } + break; + case 5: + gSprites[gUnknown_0203AB88->var3C[28]].oam.tileNum = + gSprites[gUnknown_0203AB88->var3C[28]].sheetTileStart + + (*gSprites[gUnknown_0203AB88->var3C[28]].anims + t + 1)->type; + break; + case 4: + gSprites[gUnknown_0203AB88->var3C[28]].oam.tileNum = + gSprites[gUnknown_0203AB88->var3C[28]].sheetTileStart + + (*gSprites[gUnknown_0203AB88->var3C[28]].anims + t + 2)->type; + break; + case 3: + gSprites[gUnknown_0203AB88->var3C[27]].oam.tileNum = + gSprites[gUnknown_0203AB88->var3C[27]].sheetTileStart + + (*gSprites[gUnknown_0203AB88->var3C[27]].anims + t + 1)->type; + break; + case 2: + gSprites[gUnknown_0203AB88->var3C[27]].oam.tileNum = + gSprites[gUnknown_0203AB88->var3C[27]].sheetTileStart + + (*gSprites[gUnknown_0203AB88->var3C[27]].anims + t + 2)->type; + break; + case 1: + gSprites[gUnknown_0203AB88->var3C[26]].oam.tileNum = + gSprites[gUnknown_0203AB88->var3C[26]].sheetTileStart + + (*gSprites[gUnknown_0203AB88->var3C[26]].anims + t + 1)->type; + break; + case 0: + default: + for (i = 0; i < 3; i++) + { + gSprites[gUnknown_0203AB88->var3C[i + 26]].oam.tileNum = + gSprites[gUnknown_0203AB88->var3C[i + 26]].sheetTileStart + + (*gSprites[gUnknown_0203AB88->var3C[i + 26]].anims + t + 2)->type; + } + } +}