diff --git a/asm/slot_machine.s b/asm/slot_machine.s index 4f76d1b69..066663c42 100644 --- a/asm/slot_machine.s +++ b/asm/slot_machine.s @@ -5,1432 +5,7 @@ .text - thumb_func_start sub_812A4DC -sub_812A4DC: @ 812A4DC - push {r4,r5,lr} - sub sp, 0x4 - 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 r0, 0x8 - ldrsh r1, [r4, r0] - cmp r1, 0 - beq _0812A500 - cmp r1, 0x1 - beq _0812A518 - b _0812A530 - .pool -_0812A500: - movs r0, 0x1 - negs r0, r0 - str r1, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _0812A530 -_0812A518: - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0812A530 - ldr r0, =sub_812A588 - bl SetMainCallback2 - adds r0, r5, 0 - bl DestroyTask -_0812A530: - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A4DC - thumb_func_start PlaySlotMachine -PlaySlotMachine: @ 812A540 - push {r4-r6,lr} - adds r4, r0, 0 - adds r6, r1, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r5, =gUnknown_0203AB34 - movs r0, 0x68 - bl AllocZeroed - str r0, [r5] - adds r0, r4, 0 - adds r1, r6, 0 - bl sub_812A6D4 - ldr r0, =sub_812A4DC - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r1, r2 - movs r0, 0 - strh r0, [r1, 0x8] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end PlaySlotMachine - - thumb_func_start sub_812A588 -sub_812A588: @ 812A588 - push {lr} - sub sp, 0x4 - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0xB - bhi _0812A666 - lsls r0, 2 - ldr r1, =_0812A5AC - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0812A5AC: - .4byte _0812A5DC - .4byte _0812A5E6 - .4byte _0812A5EC - .4byte _0812A5F6 - .4byte _0812A5FC - .4byte _0812A602 - .4byte _0812A608 - .4byte _0812A60E - .4byte _0812A638 - .4byte _0812A63E - .4byte _0812A644 - .4byte _0812A660 -_0812A5DC: - bl sub_812A750 - bl sub_812A8C4 - b _0812A64C -_0812A5E6: - bl sub_812A7BC - b _0812A64C -_0812A5EC: - bl sub_812A810 - bl sub_812A834 - b _0812A64C -_0812A5F6: - bl sub_812A9AC - b _0812A64C -_0812A5FC: - bl sub_812A9CC - b _0812A64C -_0812A602: - bl sub_812AA48 - b _0812A64C -_0812A608: - bl sub_812A79C - b _0812A64C -_0812A60E: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - movs r0, 0x3 - bl ShowBg - b _0812A64C -_0812A638: - bl sub_812FBC4 - b _0812A64C -_0812A63E: - bl sub_812FB14 - b _0812A64C -_0812A644: - bl sub_812AA78 - bl sub_812AA90 -_0812A64C: - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _0812A666 - .pool -_0812A660: - ldr r0, =sub_812A670 - bl SetMainCallback2 -_0812A666: - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A588 - - thumb_func_start sub_812A670 -sub_812A670: @ 812A670 - push {lr} - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - pop {r0} - bx r0 - thumb_func_end sub_812A670 - - thumb_func_start sub_812A688 -sub_812A688: @ 812A688 - push {r4,lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - ldr r4, =gUnknown_0203AB34 - ldr r0, [r4] - adds r0, 0x58 - ldrh r1, [r0] - movs r0, 0x40 - bl SetGpuReg - ldr r0, [r4] - adds r0, 0x5A - ldrh r1, [r0] - movs r0, 0x44 - bl SetGpuReg - ldr r0, [r4] - adds r0, 0x5C - ldrh r1, [r0] - movs r0, 0x48 - bl SetGpuReg - ldr r0, [r4] - adds r0, 0x5E - ldrh r1, [r0] - movs r0, 0x4A - bl SetGpuReg - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A688 - - thumb_func_start sub_812A6D4 -sub_812A6D4: @ 812A6D4 - push {r4,r5,lr} - adds r4, r0, 0 - adds r5, r1, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =TaskDummy9 - movs r1, 0xFF - bl CreateTask - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 3 - ldr r1, =gTasks - adds r0, r1 - strh r4, [r0, 0x8] - adds r0, 0xA - adds r1, r5, 0 - bl StoreWordInTwoHalfwords - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A6D4 - - thumb_func_start sub_812A710 -sub_812A710: @ 812A710 - push {lr} - ldr r0, =TaskDummy9 - bl FindTaskIdByFunc - lsls r0, 24 - lsrs r0, 24 - lsls r2, r0, 2 - adds r2, r0 - lsls r2, 3 - ldr r0, =gTasks - adds r2, r0 - ldr r3, =gUnknown_0203AB34 - ldr r1, [r3] - ldrh r0, [r2, 0x8] - strb r0, [r1, 0x1] - adds r2, 0xA - ldr r1, [r3] - adds r1, 0x64 - adds r0, r2, 0 - bl LoadWordFromTwoHalfwords - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A710 - - thumb_func_start TaskDummy9 -TaskDummy9: @ 812A74C - bx lr - thumb_func_end TaskDummy9 - - thumb_func_start sub_812A750 -sub_812A750: @ 812A750 - push {lr} - sub sp, 0x4 - movs r0, 0 - bl SetVBlankCallback - movs r0, 0 - bl SetHBlankCallback - movs r0, 0 - str r0, [sp] - movs r1, 0xC0 - lsls r1, 19 - ldr r2, =0x05006000 - mov r0, sp - bl CpuSet - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_085A7424 - movs r0, 0 - movs r2, 0x4 - bl InitBgsFromTemplates - ldr r0, =gUnknown_085A7434 - bl InitWindows - bl DeactivateAllTextPrinters - add sp, 0x4 - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A750 - - thumb_func_start sub_812A79C -sub_812A79C: @ 812A79C - push {lr} - ldr r0, =sub_812A688 - bl SetVBlankCallback - movs r0, 0x1 - bl EnableInterrupts - movs r1, 0xC1 - lsls r1, 6 - movs r0, 0 - bl SetGpuReg - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A79C - - thumb_func_start sub_812A7BC -sub_812A7BC: @ 812A7BC - push {r4-r7,lr} - sub sp, 0x4 - movs r2, 0xC0 - lsls r2, 19 - movs r3, 0x80 - lsls r3, 9 - mov r4, sp - movs r6, 0 - ldr r1, =0x040000d4 - movs r5, 0x80 - lsls r5, 5 - ldr r7, =0x81000800 - movs r0, 0x81 - lsls r0, 24 - mov r12, r0 -_0812A7DA: - strh r6, [r4] - mov r0, sp - str r0, [r1] - str r2, [r1, 0x4] - str r7, [r1, 0x8] - ldr r0, [r1, 0x8] - adds r2, r5 - subs r3, r5 - cmp r3, r5 - bhi _0812A7DA - strh r6, [r4] - mov r0, sp - str r0, [r1] - str r2, [r1, 0x4] - lsrs r0, r3, 1 - mov r2, r12 - orrs r0, r2 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - add sp, 0x4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A7BC - - thumb_func_start sub_812A810 -sub_812A810: @ 812A810 - sub sp, 0x4 - movs r2, 0xE0 - lsls r2, 19 - mov r1, sp - movs r0, 0 - strh r0, [r1] - ldr r0, =0x040000d4 - str r1, [r0] - str r2, [r0, 0x4] - ldr r1, =0x81000200 - str r1, [r0, 0x8] - ldr r0, [r0, 0x8] - add sp, 0x4 - bx lr - .pool - thumb_func_end sub_812A810 - - thumb_func_start sub_812A834 -sub_812A834: @ 812A834 - push {lr} - movs r0, 0x8 - movs r1, 0 - bl SetGpuReg - movs r0, 0xA - movs r1, 0 - bl SetGpuReg - movs r0, 0xC - movs r1, 0 - bl SetGpuReg - movs r0, 0xE - movs r1, 0 - bl SetGpuReg - movs r0, 0x10 - movs r1, 0 - bl SetGpuReg - movs r0, 0x12 - movs r1, 0 - bl SetGpuReg - movs r0, 0x14 - movs r1, 0 - bl SetGpuReg - movs r0, 0x16 - movs r1, 0 - bl SetGpuReg - movs r0, 0x18 - movs r1, 0 - bl SetGpuReg - movs r0, 0x1A - movs r1, 0 - bl SetGpuReg - movs r0, 0x1C - movs r1, 0 - bl SetGpuReg - movs r0, 0x1E - movs r1, 0 - bl SetGpuReg - movs r0, 0x48 - movs r1, 0x3F - bl SetGpuReg - movs r0, 0x4A - movs r1, 0x3F - bl SetGpuReg - ldr r1, =0x00001048 - movs r0, 0x50 - bl SetGpuReg - ldr r1, =0x00000809 - movs r0, 0x52 - bl SetGpuReg - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A834 - - thumb_func_start sub_812A8C4 -sub_812A8C4: @ 812A8C4 - push {r4-r7,lr} - mov r7, r8 - push {r7} - bl sub_812A710 - ldr r5, =gUnknown_0203AB34 - ldr r0, [r5] - movs r4, 0 - strb r4, [r0] - ldr r0, [r5] - strb r4, [r0, 0x2] - bl Random - ldr r2, [r5] - movs r1, 0x1 - ands r1, r0 - strb r1, [r2, 0x3] - ldr r0, [r5] - strb r4, [r0, 0x4] - ldr r0, [r5] - movs r1, 0 - strh r4, [r0, 0x8] - strb r1, [r0, 0xA] - ldr r0, [r5] - strb r1, [r0, 0xB] - bl GetCoins - ldr r2, [r5] - strh r0, [r2, 0xC] - strh r4, [r2, 0xE] - strh r4, [r2, 0x10] - strh r4, [r2, 0x12] - strh r4, [r2, 0x18] - movs r0, 0x8 - strh r0, [r2, 0x1A] - adds r1, r2, 0 - adds r1, 0x58 - movs r0, 0xF0 - strh r0, [r1] - adds r1, 0x2 - movs r0, 0xA0 - strh r0, [r1] - adds r0, r2, 0 - adds r0, 0x5C - movs r1, 0x3F - strh r1, [r0] - adds r0, 0x2 - strh r1, [r0] - bl GetCurrentMapMusic - ldr r1, [r5] - adds r1, 0x60 - strh r0, [r1] - movs r7, 0 - ldr r0, =gUnknown_085A76B4 - mov r8, r0 -_0812A934: - ldr r0, =gUnknown_0203AB34 - ldr r4, [r0] - lsls r6, r7, 1 - adds r0, r4, 0 - adds r0, 0x22 - adds r0, r6 - movs r1, 0 - strh r1, [r0] - adds r5, r4, 0 - adds r5, 0x28 - adds r5, r6 - ldrb r0, [r4, 0x3] - lsls r0, 1 - lsls r1, r7, 2 - adds r0, r1 - add r0, r8 - movs r1, 0 - ldrsh r0, [r0, r1] - movs r1, 0x15 - bl __modsi3 - strh r0, [r5] - adds r4, 0x1C - adds r4, r6 - movs r2, 0 - ldrsh r0, [r5, r2] - lsls r1, r0, 1 - adds r1, r0 - lsls r1, 3 - movs r2, 0xFC - lsls r2, 1 - adds r0, r2, 0 - subs r0, r1 - strh r0, [r4] - movs r1, 0 - ldrsh r0, [r4, r1] - adds r1, r2, 0 - bl __modsi3 - strh r0, [r4] - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - cmp r7, 0x2 - bls _0812A934 - bl GetCoins - lsls r0, 16 - lsrs r0, 16 - bl sub_80EDE70 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A8C4 - - thumb_func_start sub_812A9AC -sub_812A9AC: @ 812A9AC - push {lr} - bl ResetPaletteFade - bl ResetSpriteData - ldr r1, =gOamLimit - movs r0, 0x80 - strb r0, [r1] - bl FreeAllSpritePalettes - bl ResetTasks - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A9AC - - thumb_func_start sub_812A9CC -sub_812A9CC: @ 812A9CC - push {r4,r5,lr} - ldr r4, =gUnknown_0203AACC - movs r0, 0x8 - bl Alloc - str r0, [r4] - ldr r4, =gUnknown_0203AAD0 - movs r0, 0xE - bl AllocZeroed - str r0, [r4] - ldr r5, =gUnknown_0203AADC - movs r0, 0x8 - bl AllocZeroed - str r0, [r5] - ldr r1, [r4] - ldr r2, =0x00002051 - adds r0, r2, 0 - strh r0, [r1] - ldr r1, [r4] - ldr r2, =0x00002851 - adds r0, r2, 0 - strh r0, [r1, 0x2] - ldr r2, =0x00002061 - adds r0, r2, 0 - strh r0, [r1, 0x4] - ldr r2, =0x00002861 - adds r0, r2, 0 - strh r0, [r1, 0x6] - ldr r2, =0x000020be - adds r0, r2, 0 - strh r0, [r1, 0x8] - ldr r2, =0x000028be - adds r0, r2, 0 - strh r0, [r1, 0xA] - ldr r2, =0x000020bf - adds r0, r2, 0 - strh r0, [r1, 0xC] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812A9CC - - thumb_func_start sub_812AA48 -sub_812AA48: @ 812AA48 - push {lr} - bl sub_812F908 - bl sub_812F958 - bl sub_812F7E4 - movs r1, 0x80 - lsls r1, 2 - movs r0, 0 - movs r2, 0xF0 - bl LoadMessageBoxGfx - movs r1, 0x85 - lsls r1, 2 - movs r0, 0 - movs r2, 0xE0 - bl LoadUserWindowBorderGfx - movs r0, 0 - bl PutWindowTilemap - pop {r0} - bx r0 - thumb_func_end sub_812AA48 - - thumb_func_start sub_812AA78 -sub_812AA78: @ 812AA78 - push {lr} - bl sub_812E0E4 - bl sub_812E1C8 - bl sub_812CEF4 - bl sub_812E300 - pop {r0} - bx r0 - thumb_func_end sub_812AA78 - - thumb_func_start sub_812AA90 -sub_812AA90: @ 812AA90 - push {lr} - bl sub_812D188 - bl sub_812BE5C - bl sub_812DE94 - bl sub_812AAA8 - pop {r0} - bx r0 - thumb_func_end sub_812AA90 - - thumb_func_start sub_812AAA8 -sub_812AAA8: @ 812AAA8 - push {r4,lr} - ldr r4, =sub_812AAC8 - adds r0, r4, 0 - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - bl _call_via_r4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812AAA8 - - thumb_func_start sub_812AAC8 -sub_812AAC8: @ 812AAC8 - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r6, =gUnknown_085A7450 - lsls r1, r0, 2 - adds r1, r0 - lsls r4, r1, 3 - ldr r5, =gTasks -_0812AAD8: - ldr r0, =gUnknown_0203AB34 - ldr r0, [r0] - ldrb r0, [r0] - lsls r0, 2 - adds r0, r6 - ldr r1, [r0] - adds r0, r4, r5 - bl _call_via_r1 - lsls r0, 24 - cmp r0, 0 - bne _0812AAD8 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_812AAC8 - - thumb_func_start sub_812AB04 -sub_812AB04: @ 812AB04 - push {r4,lr} - sub sp, 0x4 - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r4, =gUnknown_0203AB34 - ldr r0, [r4] - ldrb r0, [r0, 0x2] - bl sub_812D3B4 - ldr r1, [r4] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - movs r0, 0 - add sp, 0x4 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_812AB04 - - thumb_func_start sub_812AB38 -sub_812AB38: @ 812AB38 - push {lr} - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _0812AB50 - ldr r0, =gUnknown_0203AB34 - ldr r1, [r0] - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_0812AB50: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_812AB38 - - thumb_func_start sub_812AB60 -sub_812AB60: @ 812AB60 - push {lr} - ldr r3, =gUnknown_0203AB34 - ldr r1, [r3] - movs r0, 0 - strh r0, [r1, 0xE] - strh r0, [r1, 0x12] - strh r0, [r1, 0x18] - ldrb r2, [r1, 0x4] - movs r0, 0xC0 - ands r0, r2 - strb r0, [r1, 0x4] - ldr r1, [r3] - movs r0, 0x4 - strb r0, [r1] - ldr r3, [r3] - movs r1, 0xC - ldrsh r0, [r3, r1] - cmp r0, 0 - bgt _0812AB90 - movs r0, 0x19 - strb r0, [r3] - b _0812ABA0 - .pool -_0812AB90: - ldrb r0, [r3, 0xA] - cmp r0, 0 - beq _0812ABA0 - movs r0, 0x3 - strb r0, [r3] - movs r0, 0x4 - bl sub_812DEE4 -_0812ABA0: - movs r0, 0x1 - pop {r1} - bx r1 - thumb_func_end sub_812AB60 - - thumb_func_start sub_812ABA8 -sub_812ABA8: @ 812ABA8 - push {lr} - bl sub_812E054 - lsls r0, 24 - cmp r0, 0 - beq _0812ABBC - ldr r0, =gUnknown_0203AB34 - ldr r1, [r0] - movs r0, 0x4 - strb r0, [r1] -_0812ABBC: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_812ABA8 - - thumb_func_start sub_812ABC8 -sub_812ABC8: @ 812ABC8 - push {lr} - movs r0, 0 - bl sub_812DEE4 - ldr r2, =gUnknown_0203AB34 - ldr r1, [r2] - movs r0, 0x5 - strb r0, [r1] - ldr r2, [r2] - movs r0, 0xC - ldrsh r1, [r2, r0] - ldr r0, =0x0000270e - cmp r1, r0 - ble _0812ABE8 - movs r0, 0x17 - strb r0, [r2] -_0812ABE8: - movs r0, 0x1 - pop {r1} - bx r1 - .pool - thumb_func_end sub_812ABC8 - - thumb_func_start sub_812ABF8 -sub_812ABF8: @ 812ABF8 - push {r4,r5,lr} - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x4 - ands r0, r1 - cmp r0, 0 - beq _0812AC1C - movs r0, 0 - bl sub_812DC80 - ldr r0, =gUnknown_0203AB34 - ldr r1, [r0] - movs r0, 0x8 - b _0812ACE2 - .pool -_0812AC1C: - movs r0, 0x80 - lsls r0, 1 - ands r0, r1 - cmp r0, 0 - beq _0812AC82 - ldr r0, =gUnknown_0203AB34 - ldr r2, [r0] - movs r1, 0xC - ldrsh r0, [r2, r1] - subs r0, 0x3 - movs r3, 0x12 - ldrsh r1, [r2, r3] - adds r0, r1 - cmp r0, 0 - blt _0812AC7C - ldrh r4, [r2, 0x12] - adds r0, r1, 0 - cmp r0, 0x2 - bgt _0812AC5A -_0812AC42: - lsls r0, r4, 24 - lsrs r0, 24 - bl sub_812CE7C - lsls r0, r4, 16 - movs r2, 0x80 - lsls r2, 9 - adds r0, r2 - lsrs r4, r0, 16 - asrs r0, 16 - cmp r0, 0x2 - ble _0812AC42 -_0812AC5A: - ldr r0, =gUnknown_0203AB34 - ldr r1, [r0] - ldrh r0, [r1, 0xC] - subs r0, 0x3 - ldrh r3, [r1, 0x12] - adds r0, r3 - strh r0, [r1, 0xC] - movs r0, 0x3 - strh r0, [r1, 0x12] - movs r0, 0x9 - strb r0, [r1] - movs r0, 0x5F - bl PlaySE - b _0812ACE4 - .pool -_0812AC7C: - movs r0, 0x6 - strb r0, [r2] - b _0812ACE4 -_0812AC82: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _0812ACB2 - ldr r4, =gUnknown_0203AB34 - ldr r0, [r4] - movs r1, 0xC - ldrsh r0, [r0, r1] - cmp r0, 0 - beq _0812ACB2 - movs r0, 0x5F - bl PlaySE - ldr r0, [r4] - ldrb r0, [r0, 0x12] - bl sub_812CE7C - ldr r1, [r4] - ldrh r0, [r1, 0xC] - subs r0, 0x1 - strh r0, [r1, 0xC] - ldrh r0, [r1, 0x12] - adds r0, 0x1 - strh r0, [r1, 0x12] -_0812ACB2: - ldr r0, =gUnknown_0203AB34 - ldr r3, [r0] - movs r1, 0x12 - ldrsh r2, [r3, r1] - ldr r4, =gMain - adds r5, r0, 0 - cmp r2, 0x2 - bgt _0812ACD0 - cmp r2, 0 - beq _0812ACD4 - ldrh r1, [r4, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0812ACD4 -_0812ACD0: - movs r0, 0x9 - strb r0, [r3] -_0812ACD4: - ldrh r1, [r4, 0x2E] - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _0812ACE4 - ldr r1, [r5] - movs r0, 0x15 -_0812ACE2: - strb r0, [r1] -_0812ACE4: - movs r0, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_812ABF8 - - thumb_func_start sub_812ACF4 -sub_812ACF4: @ 812ACF4 - push {lr} - sub sp, 0xC - movs r0, 0 - movs r1, 0 - bl NewMenuHelpers_DrawDialogueFrame - ldr r2, =gText_YouDontHaveThreeCoins - movs r0, 0x1 - str r0, [sp] - movs r0, 0 - str r0, [sp, 0x4] - str r0, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl PrintTextOnWindow - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - ldr r0, =gUnknown_0203AB34 - ldr r1, [r0] - movs r0, 0x7 - strb r0, [r1] - movs r0, 0 - add sp, 0xC - pop {r1} - bx r1 - .pool - thumb_func_end sub_812ACF4 - - thumb_func_start sub_812AD34 -sub_812AD34: @ 812AD34 - push {lr} - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _0812AD52 - movs r0, 0 - movs r1, 0x1 - bl sub_8197434 - ldr r0, =gUnknown_0203AB34 - ldr r1, [r0] - movs r0, 0x5 - strb r0, [r1] -_0812AD52: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_812AD34 - - thumb_func_start sub_812AD60 -sub_812AD60: @ 812AD60 - push {lr} - bl sub_812DCB4 - lsls r0, 24 - cmp r0, 0 - beq _0812AD74 - ldr r0, =gUnknown_0203AB34 - ldr r1, [r0] - movs r0, 0x5 - strb r0, [r1] -_0812AD74: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_812AD60 - - thumb_func_start sub_812AD80 -sub_812AD80: @ 812AD80 - push {r4,lr} - adds r4, r0, 0 - bl sub_812B4EC - bl sub_812DFDC - movs r0, 0 - bl sub_812BEA4 - movs r0, 0x1 - bl sub_812BEA4 - movs r0, 0x2 - bl sub_812BEA4 - bl sub_80EEC80 - movs r0, 0 - strh r0, [r4, 0x8] - ldr r4, =gUnknown_0203AB34 - ldr r0, [r4] - ldrb r1, [r0, 0x4] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _0812ADC4 - bl sub_812D4AC - ldr r1, [r4] - movs r0, 0xA - b _0812ADCE - .pool -_0812ADC4: - movs r0, 0x1 - bl sub_812DEE4 - ldr r1, [r4] - movs r0, 0xB -_0812ADCE: - strb r0, [r1] - ldr r4, =gUnknown_0203AB34 - ldr r0, [r4] - movs r1, 0x8 - strh r1, [r0, 0x1A] - ldrb r0, [r0, 0xA] - cmp r0, 0 - beq _0812ADE6 - bl dp15_jump_random_unknown - ldr r1, [r4] - strh r0, [r1, 0x1A] -_0812ADE6: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_812AD80 - - thumb_func_start sub_812ADF4 -sub_812ADF4: @ 812ADF4 - push {lr} - bl sub_812D4CC - lsls r0, 24 - cmp r0, 0 - beq _0812AE18 - movs r0, 0x1 - bl sub_812DEE4 - ldr r3, =gUnknown_0203AB34 - ldr r2, [r3] - ldrb r1, [r2, 0x4] - movs r0, 0xDF - ands r0, r1 - strb r0, [r2, 0x4] - ldr r1, [r3] - movs r0, 0xB - strb r0, [r1] -_0812AE18: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_812ADF4 - - thumb_func_start sub_812AE24 -sub_812AE24: @ 812AE24 - push {lr} - ldrh r1, [r0, 0x8] - adds r1, 0x1 - strh r1, [r0, 0x8] - lsls r1, 16 - asrs r1, 16 - cmp r1, 0x1D - ble _0812AE40 - bl sub_812B55C - ldr r0, =gUnknown_0203AB34 - ldr r1, [r0] - movs r0, 0xC - strb r0, [r1] -_0812AE40: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_812AE24 - - thumb_func_start sub_812AE4C -sub_812AE4C: @ 812AE4C - push {r4,lr} - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _0812AE78 - movs r0, 0x18 - bl PlaySE - ldr r4, =gUnknown_0203AB34 - ldr r0, [r4] - ldrb r0, [r0, 0x18] - bl sub_812BEDC - ldr r0, [r4] - ldrb r0, [r0, 0x18] - bl sub_812CD40 - ldr r1, [r4] - movs r0, 0xD - strb r0, [r1] -_0812AE78: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_812AE4C - - thumb_func_start sub_812AE88 -sub_812AE88: @ 812AE88 - push {r4,lr} - ldr r4, =gUnknown_0203AB34 - ldr r0, [r4] - ldrb r0, [r0, 0x18] - bl sub_812BF04 - lsls r0, 24 - cmp r0, 0 - bne _0812AEBC - ldr r1, [r4] - ldrh r0, [r1, 0x18] - adds r0, 0x1 - strh r0, [r1, 0x18] - movs r0, 0xC - strb r0, [r1] - ldr r1, [r4] - movs r2, 0x18 - ldrsh r0, [r1, r2] - cmp r0, 0x2 - ble _0812AEB4 - movs r0, 0xE - strb r0, [r1] -_0812AEB4: - movs r0, 0x1 - b _0812AEBE - .pool -_0812AEBC: - movs r0, 0 -_0812AEBE: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_812AE88 - - thumb_func_start sub_812AEC4 -sub_812AEC4: @ 812AEC4 - push {r4,lr} - ldr r4, =gUnknown_0203AB34 - ldr r2, [r4] - ldrb r1, [r2, 0x4] - movs r0, 0xC0 - ands r0, r1 - strb r0, [r2, 0x4] - bl sub_812B828 - ldr r1, [r4] - ldrb r0, [r1, 0xA] - cmp r0, 0 - beq _0812AEEA - subs r0, 0x1 - strb r0, [r1, 0xA] - ldr r1, [r4] - ldrb r0, [r1, 0xB] - adds r0, 0x1 - strb r0, [r1, 0xB] -_0812AEEA: - ldr r1, [r4] - ldrh r0, [r1, 0x8] - cmp r0, 0 - beq _0812AFCC - movs r0, 0xF - strb r0, [r1] - bl sub_812BABC - bl sub_812D0B0 - ldr r2, [r4] - ldrh r0, [r2, 0x10] - ldrh r1, [r2, 0xE] - subs r0, r1 - strh r0, [r2, 0x10] - lsls r0, 16 - cmp r0, 0 - bge _0812AF12 - movs r0, 0 - strh r0, [r2, 0x10] -_0812AF12: - ldr r0, [r4] - ldrh r1, [r0, 0x8] - movs r0, 0xC0 - lsls r0, 1 - ands r0, r1 - cmp r0, 0 - beq _0812AF38 - ldr r0, =0x00000185 - bl PlayFanfare - movs r0, 0x6 - bl sub_812DEE4 - b _0812AF62 - .pool -_0812AF38: - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _0812AF54 - ldr r0, =0x00000185 - bl PlayFanfare - movs r0, 0x5 - bl sub_812DEE4 - b _0812AF62 - .pool -_0812AF54: - movs r0, 0xC3 - lsls r0, 1 - bl PlayFanfare - movs r0, 0x2 - bl sub_812DEE4 -_0812AF62: - ldr r2, =gUnknown_0203AB34 - ldr r3, [r2] - ldrh r1, [r3, 0x8] - movs r0, 0xE0 - lsls r0, 1 - ands r0, r1 - cmp r0, 0 - beq _0812AFA6 - ldrb r1, [r3, 0x4] - movs r0, 0x3F - ands r0, r1 - movs r4, 0 - strb r0, [r3, 0x4] - ldr r3, [r2] - ldrh r1, [r3, 0x8] - movs r0, 0xC0 - lsls r0, 1 - ands r0, r1 - cmp r0, 0 - beq _0812AFA6 - strb r4, [r3, 0xA] - ldr r0, [r2] - strb r4, [r0, 0xB] - ldr r0, [r2] - strb r4, [r0, 0x3] - ldr r3, [r2] - ldrh r1, [r3, 0x8] - movs r0, 0x80 - lsls r0, 1 - ands r0, r1 - cmp r0, 0 - beq _0812AFA6 - movs r0, 0x1 - strb r0, [r3, 0x3] -_0812AFA6: - ldr r3, [r2] - ldrh r1, [r3, 0x8] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _0812AFEE - ldrb r0, [r3, 0x2] - cmp r0, 0xF - bhi _0812AFEE - adds r0, 0x1 - strb r0, [r3, 0x2] - ldr r0, [r2] - ldrb r0, [r0, 0x2] - bl sub_812D1A8 - b _0812AFEE - .pool -_0812AFCC: - movs r0, 0x3 - bl sub_812DEE4 - ldr r1, [r4] - movs r0, 0x14 - strb r0, [r1] - ldr r1, [r4] - ldrh r0, [r1, 0x12] - ldrh r2, [r1, 0x10] - adds r0, r2 - strh r0, [r1, 0x10] - lsls r0, 16 - asrs r0, 16 - ldr r2, =0x0000270f - cmp r0, r2 - ble _0812AFEE - strh r2, [r1, 0x10] -_0812AFEE: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_812AEC4 - - thumb_func_start sub_812AFFC -sub_812AFFC: @ 812AFFC - push {lr} - bl sub_812BADC - lsls r0, 24 - cmp r0, 0 - beq _0812B010 - ldr r0, =gUnknown_0203AB34 - ldr r1, [r0] - movs r0, 0x10 - strb r0, [r1] -_0812B010: - movs r0, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_812AFFC - - thumb_func_start sub_812B01C -sub_812B01C: @ 812B01C - push {r4,lr} - bl sub_812D0E0 - lsls r0, 24 - cmp r0, 0 - beq _0812B088 - ldr r4, =gUnknown_0203AB34 - ldr r1, [r4] - movs r0, 0x13 - strb r0, [r1] - ldr r0, [r4] - ldrh r1, [r0, 0x8] - movs r0, 0xC0 - lsls r0, 1 - ands r0, r1 - cmp r0, 0 - beq _0812B044 - movs r0, 0x1C - bl IncrementGameStat -_0812B044: - ldr r2, [r4] - ldrh r1, [r2, 0x8] - movs r3, 0x4 - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _0812B05A - movs r0, 0 - strh r0, [r2, 0x18] - movs r0, 0x9 - strb r0, [r2] -_0812B05A: - ldr r2, [r4] - ldrh r1, [r2, 0x8] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _0812B06A - movs r0, 0x11 - strb r0, [r2] -_0812B06A: - ldr r1, [r4] - ldrb r0, [r1, 0xA] - cmp r0, 0 - beq _0812B088 - ldrh r1, [r1, 0x8] - adds r0, r3, 0 - ands r0, r1 - cmp r0, 0 - beq _0812B088 - movs r0, 0x4 - bl sub_812DEE4 - ldr r1, [r4] - movs r0, 0x12 - strb r0, [r1] -_0812B088: - movs r0, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_812B01C thumb_func_start sub_812B094 sub_812B094: @ 812B094 @@ -1439,7 +14,7 @@ sub_812B094: @ 812B094 lsls r0, 24 cmp r0, 0 bne _0812B0CC - ldr r4, =gUnknown_0203AB34 + ldr r4, =sSlotMachine ldr r1, [r4] movs r0, 0x13 strb r0, [r1] @@ -1456,7 +31,7 @@ sub_812B094: @ 812B094 cmp r0, 0 beq _0812B0CC movs r0, 0x4 - bl sub_812DEE4 + bl sub_8104CAC ldr r1, [r4] movs r0, 0x12 strb r0, [r1] @@ -1471,11 +46,11 @@ _0812B0CC: thumb_func_start sub_812B0D8 sub_812B0D8: @ 812B0D8 push {lr} - bl sub_812E054 + bl sub_8104E18 lsls r0, 24 cmp r0, 0 beq _0812B0FC - ldr r2, =gUnknown_0203AB34 + ldr r2, =sSlotMachine ldr r1, [r2] movs r0, 0x13 strb r0, [r1] @@ -1503,7 +78,7 @@ sub_812B108: @ 812B108 bl sub_812CEB8 movs r0, 0x2 bl sub_812CEB8 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r1, [r0] movs r0, 0x2 strb r0, [r1] @@ -1526,7 +101,7 @@ sub_812B130: @ 812B130 ble _0812B14E movs r0, 0 strh r0, [r1, 0xA] - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r1, [r0] movs r0, 0x13 strb r0, [r1] @@ -1567,7 +142,7 @@ sub_812B158: @ 812B158 movs r0, 0x15 movs r1, 0x7 bl sub_80323CC - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r1, [r0] movs r0, 0x16 strb r0, [r1] @@ -1595,7 +170,7 @@ sub_812B1B0: @ 812B1B0 bl sub_812CEB8 movs r0, 0x2 bl sub_812CEB8 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r1, [r0] ldrh r0, [r1, 0x12] ldrh r2, [r1, 0xC] @@ -1615,7 +190,7 @@ _0812B1F8: movs r0, 0 movs r1, 0x1 bl sub_8197434 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r1, [r0] movs r0, 0x5 _0812B206: @@ -1646,7 +221,7 @@ sub_812B214: @ 812B214 movs r0, 0 movs r1, 0x3 bl CopyWindowToVram - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r1, [r0] movs r0, 0x18 strb r0, [r1] @@ -1669,7 +244,7 @@ sub_812B254: @ 812B254 movs r0, 0 movs r1, 0x1 bl sub_8197434 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r1, [r0] movs r0, 0x5 strb r0, [r1] @@ -1699,7 +274,7 @@ sub_812B280: @ 812B280 movs r0, 0 movs r1, 0x3 bl CopyWindowToVram - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r1, [r0] movs r0, 0x1A strb r0, [r1] @@ -1722,7 +297,7 @@ sub_812B2C0: @ 812B2C0 movs r0, 0 movs r1, 0x1 bl sub_8197434 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r1, [r0] movs r0, 0x1B strb r0, [r1] @@ -1737,7 +312,7 @@ _0812B2DE: sub_812B2EC: @ 812B2EC push {r4,lr} sub sp, 0x4 - ldr r4, =gUnknown_0203AB34 + ldr r4, =sSlotMachine ldr r0, [r4] ldrh r0, [r0, 0xC] bl SetCoins @@ -1777,7 +352,7 @@ sub_812B32C: @ 812B32C beq _0812B340 b _0812B470 _0812B340: - ldr r6, =gUnknown_0203AB34 + ldr r6, =sSlotMachine ldr r0, [r6] ldr r0, [r0, 0x64] bl SetMainCallback2 @@ -1912,10 +487,10 @@ _0812B470: .pool thumb_func_end sub_812B32C - thumb_func_start sub_812B4EC -sub_812B4EC: @ 812B4EC + thumb_func_start sub_8102484 +sub_8102484: @ 812B4EC push {r4,lr} - ldr r4, =gUnknown_0203AB34 + ldr r4, =sSlotMachine ldr r1, [r4] ldrb r0, [r1, 0xA] cmp r0, 0 @@ -1950,7 +525,7 @@ _0812B52C: lsrs r3, r0, 24 cmp r3, 0x5 beq _0812B54A - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r2, [r0] ldr r1, =gUnknown_085A7804 lsls r0, r3, 1 @@ -1964,12 +539,12 @@ _0812B54A: pop {r0} bx r0 .pool - thumb_func_end sub_812B4EC + thumb_func_end sub_8102484 - thumb_func_start sub_812B55C -sub_812B55C: @ 812B55C + thumb_func_start sub_81024F0 +sub_81024F0: @ 812B55C push {lr} - ldr r2, =gUnknown_0203AB34 + ldr r2, =sSlotMachine ldr r1, [r2] movs r0, 0 strb r0, [r1, 0x6] @@ -1983,7 +558,7 @@ _0812B572: pop {r0} bx r0 .pool - thumb_func_end sub_812B55C + thumb_func_end sub_81024F0 thumb_func_start sub_812B57C sub_812B57C: @ 812B57C @@ -2023,7 +598,7 @@ sub_812B5B0: @ 812B5B0 lsls r0, 24 lsrs r0, 24 ldr r4, =gUnknown_085A76C0 - ldr r1, =gUnknown_0203AB34 + ldr r1, =sSlotMachine ldr r1, [r1] movs r3, 0x12 ldrsh r2, [r1, r3] @@ -2055,7 +630,7 @@ sub_812B5EC: @ 812B5EC _0812B5F2: bl Random movs r2, 0xFF - ldr r1, =gUnknown_0203AB34 + ldr r1, =sSlotMachine ldr r3, [r1] lsls r1, r5, 16 asrs r4, r1, 16 @@ -2098,7 +673,7 @@ _0812B644: bl Random movs r5, 0xFF ands r5, r0 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r4, [r0] lsls r2, r6, 16 asrs r1, r2, 16 @@ -2125,7 +700,7 @@ _0812B680: asrs r0, r2, 16 cmp r0, 0x4 bne _0812B69E - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] ldrb r0, [r0, 0x3] cmp r0, 0x1 @@ -2165,7 +740,7 @@ sub_812B6CC: @ 812B6CC push {lr} lsls r0, 24 lsrs r3, r0, 24 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r2, [r0] ldrb r0, [r2, 0x3] cmp r0, 0 @@ -2190,7 +765,7 @@ _0812B6EA: thumb_func_start sub_812B700 sub_812B700: @ 812B700 push {r4-r6,lr} - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r1, [r0] movs r0, 0 strb r0, [r1, 0x5] @@ -2226,7 +801,7 @@ _0812B72E: cmp r4, r0 bcs _0812B728 _0812B74E: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] strb r6, [r0, 0x5] _0812B754: @@ -2266,7 +841,7 @@ _0812B786: dp15_jump_random_unknown: @ 812B78C push {r4,r5,lr} movs r4, 0 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] movs r2, 0x10 ldrsh r1, [r0, r2] @@ -2317,7 +892,7 @@ _0812B7E8: adds r2, r5, 0x2 adds r2, r4, r2 ldr r3, =gUnknown_085A77EC - ldr r1, =gUnknown_0203AB34 + ldr r1, =sSlotMachine ldr r1, [r1] ldrb r1, [r1, 0xB] lsls r1, 1 @@ -2339,10 +914,10 @@ _0812B822: bx r1 thumb_func_end dp15_jump_random_unknown - thumb_func_start sub_812B828 -sub_812B828: @ 812B828 + thumb_func_start CheckMatch +CheckMatch: @ 812B828 push {r4,lr} - ldr r4, =gUnknown_0203AB34 + ldr r4, =sSlotMachine ldr r1, [r4] movs r0, 0 strh r0, [r1, 0x8] @@ -2365,7 +940,7 @@ _0812B852: pop {r0} bx r0 .pool - thumb_func_end sub_812B828 + thumb_func_end CheckMatch thumb_func_start sub_812B85C sub_812B85C: @ 812B85C @@ -2395,7 +970,7 @@ sub_812B85C: @ 812B85C lsrs r1, r0, 24 cmp r1, 0x9 beq _0812B8BC - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r2, [r0] ldr r0, =gUnknown_085A7828 lsls r1, 1 @@ -2448,7 +1023,7 @@ sub_812B8D0: @ 812B8D0 bne _0812B90C movs r1, 0x1 _0812B90C: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r2, [r0] ldr r0, =gUnknown_085A7828 lsls r1, 1 @@ -2492,7 +1067,7 @@ _0812B930: bne _0812B96A movs r1, 0x1 _0812B96A: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r2, [r0] ldr r0, =gUnknown_085A7828 lsls r1, 1 @@ -2543,7 +1118,7 @@ sub_812B9A0: @ 812B9A0 beq _0812B9FE cmp r1, 0 beq _0812B9F8 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r2, [r0] ldr r0, =gUnknown_085A7828 lsls r1, 1 @@ -2586,7 +1161,7 @@ _0812B9FE: beq _0812BA5A cmp r1, 0 beq _0812BA54 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r2, [r0] ldr r0, =gUnknown_085A7828 lsls r1, 1 @@ -2658,8 +1233,8 @@ _0812BAB6: bx r1 thumb_func_end sub_812BA6C - thumb_func_start sub_812BABC -sub_812BABC: @ 812BABC + thumb_func_start sub_8102A24 +sub_8102A24: @ 812BABC push {r4,lr} ldr r4, =sub_812BAFC adds r0, r4, 0 @@ -2672,10 +1247,10 @@ sub_812BABC: @ 812BABC pop {r0} bx r0 .pool - thumb_func_end sub_812BABC + thumb_func_end sub_8102A24 - thumb_func_start sub_812BADC -sub_812BADC: @ 812BADC + thumb_func_start sub_8102A44 +sub_8102A44: @ 812BADC push {lr} ldr r0, =sub_812BAFC bl FindTaskIdByFunc @@ -2691,7 +1266,7 @@ _0812BAF4: _0812BAF6: pop {r1} bx r1 - thumb_func_end sub_812BADC + thumb_func_end sub_8102A44 thumb_func_start sub_812BAFC sub_812BAFC: @ 812BAFC @@ -2732,7 +1307,7 @@ sub_812BB34: @ 812BB34 ldrh r0, [r4, 0x8] adds r0, 0x1 strh r0, [r4, 0x8] - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] movs r1, 0xE ldrsh r0, [r0, r1] @@ -2771,7 +1346,7 @@ sub_812BB68: @ 812BB68 movs r0, 0x15 bl PlaySE _0812BB8E: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r2, [r0] ldrh r0, [r2, 0xE] subs r0, 0x1 @@ -2808,7 +1383,7 @@ _0812BBBC: beq _0812BBF6 movs r0, 0x15 bl PlaySE - ldr r1, =gUnknown_0203AB34 + ldr r1, =sSlotMachine ldr r2, [r1] ldrh r0, [r2, 0xE] ldrh r3, [r2, 0xC] @@ -2825,7 +1400,7 @@ _0812BBF0: movs r0, 0 strh r0, [r1, 0xE] _0812BBF6: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] movs r1, 0xE ldrsh r0, [r0, r1] @@ -2867,7 +1442,7 @@ sub_812BC44: @ 812BC44 lsls r0, 24 lsrs r0, 24 adds r4, r0, 0 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] lsls r2, r4, 1 adds r0, 0x28 @@ -2913,7 +1488,7 @@ sub_812BC98: @ 812BC98 lsls r1, 16 lsrs r5, r1, 16 movs r6, 0 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] lsls r1, r4, 1 adds r0, 0x1C @@ -2947,7 +1522,7 @@ _0812BCC2: thumb_func_start sub_812BCE8 sub_812BCE8: @ 812BCE8 push {lr} - ldr r1, =gUnknown_0203AB34 + ldr r1, =sSlotMachine ldr r1, [r1] movs r2, 0x16 ldrsh r1, [r1, r2] @@ -2981,7 +1556,7 @@ sub_812BD28: @ 812BD28 push {r4-r6,lr} adds r5, r0, 0 lsls r5, 24 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r6, [r0] lsrs r5, 23 adds r4, r6, 0 @@ -3021,7 +1596,7 @@ sub_812BD70: @ 812BD70 adds r5, r0, 0 lsls r1, 16 lsrs r4, r1, 16 - ldr r7, =gUnknown_0203AB34 + ldr r7, =sSlotMachine ldr r0, [r7] lsls r6, r5, 1 adds r0, 0x1C @@ -3067,7 +1642,7 @@ _0812BDC4: thumb_func_start sub_812BDD4 sub_812BDD4: @ 812BDD4 push {r4,lr} - ldr r1, =gUnknown_0203AB34 + ldr r1, =sSlotMachine ldr r4, [r1] lsls r0, 16 asrs r0, 16 @@ -3097,7 +1672,7 @@ sub_812BE0C: @ 812BE0C push {r4,r5,lr} lsls r0, 16 lsrs r4, r0, 16 - ldr r5, =gUnknown_0203AB34 + ldr r5, =sSlotMachine ldr r0, [r5] movs r1, 0x14 ldrsh r0, [r0, r1] @@ -3134,8 +1709,8 @@ _0812BE4E: .pool thumb_func_end sub_812BE0C - thumb_func_start sub_812BE5C -sub_812BE5C: @ 812BE5C + thumb_func_start sub_8102DA8 +sub_8102DA8: @ 812BE5C push {r4-r6,lr} movs r4, 0 ldr r5, =sub_812BF2C @@ -3151,7 +1726,7 @@ _0812BE64: lsls r1, 3 adds r1, r6 strh r4, [r1, 0x26] - ldr r1, =gUnknown_0203AB34 + ldr r1, =sSlotMachine ldr r1, [r1] adds r1, 0x3A adds r1, r4 @@ -3166,15 +1741,15 @@ _0812BE64: pop {r0} bx r0 .pool - thumb_func_end sub_812BE5C + thumb_func_end sub_8102DA8 - thumb_func_start sub_812BEA4 -sub_812BEA4: @ 812BEA4 + thumb_func_start sub_8102DEC +sub_8102DEC: @ 812BEA4 push {r4,lr} lsls r0, 24 lsrs r0, 24 ldr r4, =gTasks - ldr r1, =gUnknown_0203AB34 + ldr r1, =sSlotMachine ldr r2, [r1] adds r2, 0x3A adds r2, r0 @@ -3195,14 +1770,14 @@ sub_812BEA4: @ 812BEA4 pop {r0} bx r0 .pool - thumb_func_end sub_812BEA4 + thumb_func_end sub_8102DEC - thumb_func_start sub_812BEDC -sub_812BEDC: @ 812BEDC + thumb_func_start sub_8102E1C +sub_8102E1C: @ 812BEDC lsls r0, 24 lsrs r0, 24 ldr r2, =gTasks - ldr r1, =gUnknown_0203AB34 + ldr r1, =sSlotMachine ldr r1, [r1] adds r1, 0x3A adds r1, r0 @@ -3215,14 +1790,14 @@ sub_812BEDC: @ 812BEDC strh r1, [r0, 0x8] bx lr .pool - thumb_func_end sub_812BEDC + thumb_func_end sub_8102E1C - thumb_func_start sub_812BF04 -sub_812BF04: @ 812BF04 + thumb_func_start sub_8102E40 +sub_8102E40: @ 812BF04 lsls r0, 24 lsrs r0, 24 ldr r2, =gTasks - ldr r1, =gUnknown_0203AB34 + ldr r1, =sSlotMachine ldr r1, [r1] adds r1, 0x3A adds r1, r0 @@ -3236,7 +1811,7 @@ sub_812BF04: @ 812BF04 lsrs r0, 24 bx lr .pool - thumb_func_end sub_812BF04 + thumb_func_end sub_8102E40 thumb_func_start sub_812BF2C sub_812BF2C: @ 812BF2C @@ -3278,7 +1853,7 @@ sub_812BF68: @ 812BF68 ldrh r0, [r0, 0x26] lsls r0, 24 lsrs r0, 24 - ldr r1, =gUnknown_0203AB34 + ldr r1, =sSlotMachine ldr r1, [r1] movs r2, 0x1A ldrsh r1, [r1, r2] @@ -3297,7 +1872,7 @@ sub_812BF88: @ 812BF88 adds r0, 0x1 movs r2, 0 strh r0, [r4, 0x8] - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r3, [r0] movs r0, 0x26 ldrsh r1, [r4, r0] @@ -3333,7 +1908,7 @@ sub_812BF88: @ 812BF88 cmp r0, 0 bne _0812BFF4 _0812BFDC: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r1, [r0] movs r0, 0 strb r0, [r1, 0x6] @@ -3345,7 +1920,7 @@ _0812BFDC: ldr r0, [r0] bl _call_via_r0 _0812BFF4: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r1, [r0] movs r2, 0x26 ldrsh r0, [r4, r2] @@ -3370,7 +1945,7 @@ sub_812C01C: @ 812C01C mov r0, sp movs r2, 0xA bl memcpy - ldr r7, =gUnknown_0203AB34 + ldr r7, =sSlotMachine ldr r5, [r7] movs r1, 0x26 ldrsh r0, [r4, r1] @@ -3427,7 +2002,7 @@ _0812C0A0: _0812C0A4: cmp r2, 0 bne _0812C0D2 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r1, [r0] movs r6, 0x26 ldrsh r0, [r4, r6] @@ -3461,7 +2036,7 @@ _0812C0D2: sub_812C0E0: @ 812C0E0 push {r4,lr} adds r2, r0, 0 - ldr r4, =gUnknown_0203AB34 + ldr r4, =sSlotMachine ldr r1, [r4] movs r3, 0x26 ldrsh r0, [r2, r3] @@ -3508,7 +2083,7 @@ _0812C12A: thumb_func_start sub_812C138 sub_812C138: @ 812C138 push {r4,r5,lr} - ldr r4, =gUnknown_0203AB34 + ldr r4, =sSlotMachine ldr r0, [r4] ldrb r0, [r0, 0x4] bl sub_812B57C @@ -3564,7 +2139,7 @@ sub_812C184: @ 812C184 cmp r0, r5 bne _0812C1BC _0812C1AC: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] strb r1, [r0, 0x7] movs r0, 0x1 @@ -3627,7 +2202,7 @@ _0812C212: thumb_func_start sub_812C218 sub_812C218: @ 812C218 push {lr} - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] ldrb r1, [r0, 0x4] movs r0, 0xC2 @@ -3669,7 +2244,7 @@ _0812C24C: lsls r0, 24 cmp r0, 0 beq _0812C278 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r1, [r0] movs r0, 0x2 strh r0, [r1, 0x34] @@ -3729,7 +2304,7 @@ _0812C2C2: lsls r0, 24 cmp r0, 0 beq _0812C2E8 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] strh r7, [r0, 0x34] strh r6, [r0, 0x2E] @@ -3746,7 +2321,7 @@ _0812C2E8: _0812C2F4: movs r7, 0x1 adds r6, r5, 0 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine mov r10, r0 _0812C2FC: lsls r5, r7, 16 @@ -3838,7 +2413,7 @@ _0812C390: sub_812C3A0: @ 812C3A0 push {lr} ldr r1, =gUnknown_085A7514 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] movs r2, 0x12 ldrsh r0, [r0, r2] @@ -3857,7 +2432,7 @@ sub_812C3A0: @ 812C3A0 thumb_func_start sub_812C3C8 sub_812C3C8: @ 812C3C8 push {r4-r7,lr} - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] movs r5, 0 ldrh r7, [r0, 0x34] @@ -3871,7 +2446,7 @@ _0812C3D6: asrs r1, 16 movs r0, 0x1 bl sub_812BC98 - ldr r1, =gUnknown_0203AB34 + ldr r1, =sSlotMachine ldr r1, [r1] lsls r0, 24 lsrs r0, 24 @@ -3904,7 +2479,7 @@ sub_812C414: @ 812C414 lsls r0, 24 cmp r0, 0 beq _0812C476 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r1, [r0] movs r2, 0x34 ldrsh r0, [r1, r2] @@ -3926,7 +2501,7 @@ _0812C43C: asrs r1, 16 movs r0, 0x1 bl sub_812BC98 - ldr r1, =gUnknown_0203AB34 + ldr r1, =sSlotMachine ldr r1, [r1] lsls r0, 24 lsrs r0, 24 @@ -3949,7 +2524,7 @@ _0812C472: movs r0, 0x1 b _0812C4B2 _0812C476: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] movs r1, 0x34 ldrsh r0, [r0, r1] @@ -3965,7 +2540,7 @@ _0812C486: asrs r1, 16 movs r0, 0x1 bl sub_812BC98 - ldr r1, =gUnknown_0203AB34 + ldr r1, =sSlotMachine ldr r1, [r1] lsls r0, 24 lsrs r0, 24 @@ -3990,7 +2565,7 @@ _0812C4B2: thumb_func_start sub_812C4BC sub_812C4BC: @ 812C4BC push {r4,lr} - ldr r2, =gUnknown_0203AB34 + ldr r2, =sSlotMachine ldr r0, [r2] ldrb r3, [r0, 0x7] adds r4, r3, 0 @@ -4029,7 +2604,7 @@ sub_812C500: @ 812C500 push {r7} lsls r0, 24 lsrs r7, r0, 24 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] movs r5, 0 ldrh r1, [r0, 0x36] @@ -4048,7 +2623,7 @@ _0812C518: lsrs r0, 24 cmp r0, r7 bne _0812C544 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] mov r1, r8 strh r1, [r0, 0x38] @@ -4079,7 +2654,7 @@ sub_812C55C: @ 812C55C push {r7} lsls r0, 24 lsrs r6, r0, 24 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] movs r2, 0x34 ldrsh r1, [r0, r2] @@ -4094,7 +2669,7 @@ sub_812C55C: @ 812C55C b _0812C5D2 .pool _0812C588: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] strh r5, [r0, 0x32] mov r1, r8 @@ -4156,7 +2731,7 @@ _0812C5E8: lsls r0, 24 cmp r0, 0 bne _0812C5E2 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] strh r5, [r0, 0x2E] pop {r4,r5} @@ -4193,7 +2768,7 @@ _0812C624: sub_812C628: @ 812C628 push {lr} ldr r1, =gUnknown_085A752C - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] movs r2, 0x12 ldrsh r0, [r0, r2] @@ -4211,7 +2786,7 @@ sub_812C628: @ 812C628 sub_812C64C: @ 812C64C push {r4-r7,lr} sub sp, 0x4 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r2, [r0] movs r1, 0x34 ldrsh r0, [r2, r1] @@ -4252,7 +2827,7 @@ _0812C68C: lsrs r0, 24 cmp r1, r0 bne _0812C6B8 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r1, [r0] movs r0, 0x2 strh r0, [r1, 0x36] @@ -4277,7 +2852,7 @@ _0812C6C4: j5_08111E84: @ 812C6CC push {r4-r7,lr} sub sp, 0x4 - ldr r4, =gUnknown_0203AB34 + ldr r4, =sSlotMachine ldr r2, [r4] ldrh r3, [r2, 0x34] movs r1, 0x34 @@ -4344,7 +2919,7 @@ _0812C744: sub_812C74C: @ 812C74C push {r4-r7,lr} sub sp, 0x4 - ldr r6, =gUnknown_0203AB34 + ldr r6, =sSlotMachine ldr r2, [r6] ldrh r4, [r2, 0x34] movs r0, 0x34 @@ -4362,7 +2937,7 @@ sub_812C74C: @ 812C74C b _0812C84A .pool _0812C778: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] movs r1, 0 strh r5, [r0, 0x36] @@ -4426,7 +3001,7 @@ _0812C7C6: ble _0812C7C6 movs r5, 0x1 mov r7, sp - ldr r6, =gUnknown_0203AB34 + ldr r6, =sSlotMachine _0812C7F8: ldr r0, [r6] ldrh r1, [r0, 0x34] @@ -4590,7 +3165,7 @@ _0812C8F8: sub_812C8FC: @ 812C8FC push {lr} ldr r1, =gUnknown_085A7538 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] movs r2, 0x12 ldrsh r0, [r0, r2] @@ -4608,7 +3183,7 @@ sub_812C8FC: @ 812C8FC sub_812C920: @ 812C920 push {r4-r7,lr} movs r6, 0 - ldr r7, =gUnknown_0203AB34 + ldr r7, =sSlotMachine ldr r0, [r7] ldrh r1, [r0, 0x2E] movs r4, 0x2 @@ -4714,7 +3289,7 @@ _0812C9DE: cmp r5, r0 beq _0812C9D8 _0812C9F6: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] strh r6, [r0, 0x32] pop {r4-r7} @@ -4733,7 +3308,7 @@ sub_812CA08: @ 812CA08 sub sp, 0x4 movs r0, 0 str r0, [sp] - ldr r4, =gUnknown_0203AB34 + ldr r4, =sSlotMachine ldr r2, [r4] movs r5, 0x36 ldrsh r1, [r2, r5] @@ -4785,7 +3360,7 @@ _0812CA7E: asrs r5, r6, 16 cmp r5, 0x4 bgt _0812CAA4 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] ldrh r1, [r0, 0x36] subs r1, r5 @@ -4800,7 +3375,7 @@ _0812CA7E: lsrs r6, 16 str r6, [sp] _0812CAA4: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine mov r9, r0 _0812CAA8: movs r5, 0x1 @@ -4894,7 +3469,7 @@ _0812CB4A: str r0, [sp] b _0812CAA8 _0812CB60: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] mov r5, sp ldrh r5, [r5] @@ -4916,7 +3491,7 @@ sub_812CB80: @ 812CB80 mov r7, r8 push {r7} bl sub_812CA08 - ldr r4, =gUnknown_0203AB34 + ldr r4, =sSlotMachine ldr r2, [r4] movs r0, 0x36 ldrsh r1, [r2, r0] @@ -4999,7 +3574,7 @@ _0812CC28: cmp r0, 0x4 ble _0812CBF6 _0812CC34: - ldr r7, =gUnknown_0203AB34 + ldr r7, =sSlotMachine _0812CC36: ldr r0, [r7] ldrh r0, [r0, 0x2E] @@ -5059,7 +3634,7 @@ _0812CCA4: b _0812CC36 .pool _0812CCB4: - ldr r7, =gUnknown_0203AB34 + ldr r7, =sSlotMachine _0812CCB6: ldr r0, [r7] ldrh r0, [r0, 0x2E] @@ -5126,8 +3701,8 @@ _0812CD34: bx r0 thumb_func_end sub_812CB80 - thumb_func_start sub_812CD40 -sub_812CD40: @ 812CD40 + thumb_func_start sub_8103C14 +sub_8103C14: @ 812CD40 push {r4,r5,lr} adds r4, r0, 0 lsls r4, 24 @@ -5149,7 +3724,7 @@ sub_812CD40: @ 812CD40 pop {r0} bx r0 .pool - thumb_func_end sub_812CD40 + thumb_func_end sub_8103C14 thumb_func_start sub_812CD74 sub_812CD74: @ 812CD74 @@ -5290,8 +3865,8 @@ sub_812CE54: @ 812CE54 .pool thumb_func_end sub_812CE54 - thumb_func_start sub_812CE7C -sub_812CE7C: @ 812CE7C + thumb_func_start sub_8103D50 +sub_8103D50: @ 812CE7C push {r4-r7,lr} lsls r0, 24 lsrs r1, r0, 24 @@ -5319,7 +3894,7 @@ _0812CEA8: pop {r0} bx r0 .pool - thumb_func_end sub_812CE7C + thumb_func_end sub_8103D50 thumb_func_start sub_812CEB8 sub_812CEB8: @ 812CEB8 @@ -5352,8 +3927,8 @@ _0812CEE4: .pool thumb_func_end sub_812CEB8 - thumb_func_start sub_812CEF4 -sub_812CEF4: @ 812CEF4 + thumb_func_start sub_8103DC8 +sub_8103DC8: @ 812CEF4 push {r4,r5,lr} movs r4, 0 ldr r5, =gSprites @@ -5367,7 +3942,7 @@ _0812CEFA: lsls r1, 2 adds r1, r5 strh r4, [r1, 0x2E] - ldr r1, =gUnknown_0203AB34 + ldr r1, =sSlotMachine ldr r1, [r1] adds r1, 0x44 adds r1, r4 @@ -5381,13 +3956,13 @@ _0812CEFA: pop {r0} bx r0 .pool - thumb_func_end sub_812CEF4 + thumb_func_end sub_8103DC8 thumb_func_start sub_812CF34 sub_812CF34: @ 812CF34 lsls r0, 24 lsrs r0, 24 - ldr r1, =gUnknown_0203AB34 + ldr r1, =sSlotMachine ldr r1, [r1] adds r1, 0x44 adds r1, r0 @@ -5415,7 +3990,7 @@ sub_812CF34: @ 812CF34 sub_812CF6C: @ 812CF6C push {r4,r5,lr} movs r2, 0 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r3, r0, 0 adds r3, 0x44 @@ -5456,7 +4031,7 @@ sub_812CFB8: @ 812CFB8 push {r4,lr} movs r4, 0 _0812CFBC: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x44 adds r0, r4 @@ -5591,8 +4166,8 @@ _0812D0A6: .pool thumb_func_end sub_812D024 - thumb_func_start sub_812D0B0 -sub_812D0B0: @ 812D0B0 + thumb_func_start sub_8103F70 +sub_8103F70: @ 812D0B0 push {r4,lr} ldr r4, =sub_812D128 adds r0, r4, 0 @@ -5612,10 +4187,10 @@ sub_812D0B0: @ 812D0B0 pop {r0} bx r0 .pool - thumb_func_end sub_812D0B0 + thumb_func_end sub_8103F70 - thumb_func_start sub_812D0E0 -sub_812D0E0: @ 812D0E0 + thumb_func_start sub_8103FA0 +sub_8103FA0: @ 812D0E0 push {lr} ldr r0, =sub_812D128 bl FindTaskIdByFunc @@ -5646,7 +4221,7 @@ _0812D120: pop {r1} bx r1 .pool - thumb_func_end sub_812D0E0 + thumb_func_end sub_8103FA0 thumb_func_start sub_812D128 sub_812D128: @ 812D128 @@ -5697,25 +4272,25 @@ _0812D166: .pool thumb_func_end sub_812D128 - thumb_func_start sub_812D188 -sub_812D188: @ 812D188 + thumb_func_start sub_8104048 +sub_8104048: @ 812D188 push {lr} ldr r0, =sub_812D230 movs r1, 0x8 bl CreateTask - ldr r1, =gUnknown_0203AB34 + ldr r1, =sSlotMachine ldr r1, [r1] adds r1, 0x3E strb r0, [r1] pop {r0} bx r0 .pool - thumb_func_end sub_812D188 + thumb_func_end sub_8104048 - thumb_func_start sub_812D1A8 -sub_812D1A8: @ 812D1A8 + thumb_func_start sub_8104064 +sub_8104064: @ 812D1A8 push {r4,lr} - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x3E ldrb r0, [r0] @@ -5736,12 +4311,12 @@ sub_812D1A8: @ 812D1A8 pop {r0} bx r0 .pool - thumb_func_end sub_812D1A8 + thumb_func_end sub_8104064 thumb_func_start sub_812D1DC sub_812D1DC: @ 812D1DC push {r4,lr} - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x3E ldrb r0, [r0] @@ -5765,7 +4340,7 @@ sub_812D1DC: @ 812D1DC thumb_func_start sub_812D20C sub_812D20C: @ 812D20C ldr r2, =gTasks - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x3E ldrb r1, [r0] @@ -5987,8 +4562,8 @@ _0812D39E: bx r0 thumb_func_end sub_812D394 - thumb_func_start sub_812D3B4 -sub_812D3B4: @ 812D3B4 + thumb_func_start sub_810423C +sub_810423C: @ 812D3B4 push {r4-r7,lr} lsls r0, 24 lsrs r6, r0, 24 @@ -6095,7 +4670,7 @@ _0812D448: ble _0812D428 _0812D484: ldr r2, =gTasks - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x3E ldrb r1, [r0] @@ -6108,10 +4683,10 @@ _0812D484: pop {r0} bx r0 .pool - thumb_func_end sub_812D3B4 + thumb_func_end sub_810423C - thumb_func_start sub_812D4AC -sub_812D4AC: @ 812D4AC + thumb_func_start sub_810430C +sub_810430C: @ 812D4AC push {r4,lr} ldr r4, =sub_812D4EC adds r0, r4, 0 @@ -6124,10 +4699,10 @@ sub_812D4AC: @ 812D4AC pop {r0} bx r0 .pool - thumb_func_end sub_812D4AC + thumb_func_end sub_810430C - thumb_func_start sub_812D4CC -sub_812D4CC: @ 812D4CC + thumb_func_start sub_810432C +sub_810432C: @ 812D4CC push {lr} ldr r0, =sub_812D4EC bl FindTaskIdByFunc @@ -6143,7 +4718,7 @@ _0812D4E4: _0812D4E6: pop {r1} bx r1 - thumb_func_end sub_812D4CC + thumb_func_end sub_810432C thumb_func_start sub_812D4EC sub_812D4EC: @ 812D4EC @@ -6171,7 +4746,7 @@ sub_812D4EC: @ 812D4EC thumb_func_start sub_812D51C sub_812D51C: @ 812D51C push {lr} - ldr r3, =gUnknown_0203AB34 + ldr r3, =sSlotMachine ldr r1, [r3] movs r2, 0 strb r2, [r1, 0xA] @@ -6343,7 +4918,7 @@ sub_812D63C: @ 812D63C movs r1, 0 ldrsh r0, [r6, r1] bl sub_812EBAC - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x3F ldrb r1, [r0] @@ -6400,7 +4975,7 @@ sub_812D6EC: @ 812D6EC strh r0, [r4, 0x12] movs r0, 0x2 bl sub_812EBAC - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x3F ldrb r1, [r0] @@ -6467,7 +5042,7 @@ sub_812D774: @ 812D774 ble _0812D7DC movs r0, 0 strh r0, [r4, 0x12] - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r1, [r0] ldrb r0, [r1, 0x5] cmp r0, 0 @@ -6512,7 +5087,7 @@ _0812D7DC: sub_812D7E4: @ 812D7E4 push {r4-r6,lr} adds r4, r0, 0 - ldr r6, =gUnknown_0203AB34 + ldr r6, =sSlotMachine ldr r0, [r6] movs r1, 0x14 ldrsh r0, [r0, r1] @@ -6559,7 +5134,7 @@ _0812D842: bne _0812D866 movs r0, 0x1 bl sub_812BCE8 - ldr r1, =gUnknown_0203AB34 + ldr r1, =sSlotMachine ldr r1, [r1] lsls r0, 24 lsrs r0, 24 @@ -6595,7 +5170,7 @@ sub_812D870: @ 812D870 ldrh r0, [r4, 0x8] adds r0, 0x1 strh r0, [r4, 0x8] - ldr r5, =gUnknown_0203AB34 + ldr r5, =sSlotMachine ldr r1, [r5] ldrb r0, [r1, 0x5] cmp r0, 0 @@ -6731,7 +5306,7 @@ _0812D99E: sub_812D9A4: @ 812D9A4 push {r4-r6,lr} adds r5, r0, 0 - ldr r4, =gUnknown_0203AB34 + ldr r4, =sSlotMachine ldr r0, [r4] movs r6, 0 strb r6, [r0, 0xB] @@ -6766,7 +5341,7 @@ sub_812D9A4: @ 812D9A4 .pool _0812DA04: movs r0, 0x4 - bl sub_812DEE4 + bl sub_8104CAC bl dp15_jump_random_unknown strh r0, [r5, 0xA] strh r6, [r5, 0xC] @@ -6784,7 +5359,7 @@ _0812DA1A: sub_812DA20: @ 812DA20 push {r4,r5,lr} adds r4, r0, 0 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r5, [r0] movs r0, 0x1A ldrsh r1, [r5, r0] @@ -6825,7 +5400,7 @@ _0812DA66: thumb_func_start sub_812DA6C sub_812DA6C: @ 812DA6C push {lr} - bl sub_812E054 + bl sub_8104E18 lsls r0, 24 cmp r0, 0 beq _0812DA86 @@ -6849,7 +5424,7 @@ sub_812DA90: @ 812DA90 bl sub_812EBCC bl sub_812EC20 ldr r5, =gSprites - ldr r3, =gUnknown_0203AB34 + ldr r3, =sSlotMachine ldr r0, [r3] adds r0, 0x4E ldrb r1, [r0] @@ -6929,7 +5504,7 @@ _0812DB3C: bl sub_812E5A8 bl sub_812EDC0 ldr r2, =gSprites - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x4E ldrb r1, [r0] @@ -6988,7 +5563,7 @@ sub_812DBBC: @ 812DBBC movs r0, 0x14 movs r1, 0 bl SetGpuReg - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x60 ldrh r0, [r0] @@ -7071,8 +5646,8 @@ _0812DC58: .pool thumb_func_end sub_812DC50 - thumb_func_start sub_812DC80 -sub_812DC80: @ 812DC80 + thumb_func_start sub_8104AB8 +sub_8104AB8: @ 812DC80 push {r4,r5,lr} adds r4, r0, 0 lsls r4, 24 @@ -7094,10 +5669,10 @@ sub_812DC80: @ 812DC80 pop {r0} bx r0 .pool - thumb_func_end sub_812DC80 + thumb_func_end sub_8104AB8 - thumb_func_start sub_812DCB4 -sub_812DCB4: @ 812DCB4 + thumb_func_start sub_8104AEC +sub_8104AEC: @ 812DCB4 push {lr} ldr r0, =sub_812DCD4 bl FindTaskIdByFunc @@ -7113,7 +5688,7 @@ _0812DCCC: _0812DCCE: pop {r1} bx r1 - thumb_func_end sub_812DCB4 + thumb_func_end sub_8104AEC thumb_func_start sub_812DCD4 sub_812DCD4: @ 812DCD4 @@ -7182,7 +5757,7 @@ _0812DD3E: sub_812DD48: @ 812DD48 push {r4,lr} adds r4, r0, 0 - bl sub_812DFDC + bl sub_8104DA4 bl sub_812FAF4 ldr r0, =gUnknown_085A7444 bl AddWindow @@ -7295,7 +5870,7 @@ sub_812DE30: @ 812DE30 push {r4,lr} adds r4, r0, 0 ldrb r0, [r4, 0xA] - bl sub_812DEE4 + bl sub_8104CAC ldrh r0, [r4, 0x8] adds r0, 0x1 strh r0, [r4, 0x8] @@ -7309,10 +5884,10 @@ sub_812DE48: @ 812DE48 push {r4,lr} sub sp, 0x4 adds r4, r0, 0 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] ldrb r0, [r0, 0x2] - bl sub_812D3B4 + bl sub_810423C movs r0, 0x1 negs r0, r0 movs r1, 0 @@ -7343,15 +5918,15 @@ sub_812DE7C: @ 812DE7C .pool thumb_func_end sub_812DE7C - thumb_func_start sub_812DE94 -sub_812DE94: @ 812DE94 + thumb_func_start sub_8104C5C +sub_8104C5C: @ 812DE94 push {lr} ldr r0, =sub_812E0B0 movs r1, 0x3 bl CreateTask lsls r0, 24 lsrs r1, r0, 24 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x3D strb r1, [r0] @@ -7378,18 +5953,18 @@ _0812DEC0: pop {r0} bx r0 .pool - thumb_func_end sub_812DE94 + thumb_func_end sub_8104C5C - thumb_func_start sub_812DEE4 -sub_812DEE4: @ 812DEE4 + thumb_func_start sub_8104CAC +sub_8104CAC: @ 812DEE4 push {r4-r7,lr} mov r7, r8 push {r7} adds r4, r0, 0 lsls r4, 24 lsrs r4, 24 - bl sub_812DFDC - ldr r0, =gUnknown_0203AB34 + bl sub_8104DA4 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x3D ldrb r1, [r0] @@ -7443,7 +6018,7 @@ _0812DF52: pop {r0} bx r0 .pool - thumb_func_end sub_812DEE4 + thumb_func_end sub_8104CAC thumb_func_start sub_812DF68 sub_812DF68: @ 812DF68 @@ -7455,7 +6030,7 @@ sub_812DF68: @ 812DF68 ldr r4, [sp, 0x1C] lsls r0, 24 lsrs r7, r0, 24 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x3D ldrb r1, [r0] @@ -7505,10 +6080,10 @@ _0812DFCE: bx r0 thumb_func_end sub_812DF68 - thumb_func_start sub_812DFDC -sub_812DFDC: @ 812DFDC + thumb_func_start sub_8104DA4 +sub_8104DA4: @ 812DFDC push {r4-r6,lr} - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x3D ldrb r1, [r0] @@ -7558,12 +6133,12 @@ _0812E02E: pop {r0} bx r0 .pool - thumb_func_end sub_812DFDC + thumb_func_end sub_8104DA4 - thumb_func_start sub_812E054 -sub_812E054: @ 812E054 + thumb_func_start sub_8104E18 +sub_8104E18: @ 812E054 push {r4,r5,lr} - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x3D ldrb r1, [r0] @@ -7605,7 +6180,7 @@ _0812E0A8: pop {r4,r5} pop {r1} bx r1 - thumb_func_end sub_812E054 + thumb_func_end sub_8104E18 thumb_func_start sub_812E0B0 sub_812E0B0: @ 812E0B0 @@ -7635,8 +6210,8 @@ nullsub_51: @ 812E0E0 bx lr thumb_func_end nullsub_51 - thumb_func_start sub_812E0E4 -sub_812E0E4: @ 812E0E4 + thumb_func_start sub_8104EA8 +sub_8104EA8: @ 812E0E4 push {r4-r7,lr} movs r6, 0 movs r0, 0x30 @@ -7688,13 +6263,13 @@ _0812E0F0: pop {r0} bx r0 .pool - thumb_func_end sub_812E0E4 + thumb_func_end sub_8104EA8 thumb_func_start sub_812E154 sub_812E154: @ 812E154 push {r4,r5,lr} adds r5, r0, 0 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r4, [r0] movs r1, 0x2E ldrsh r0, [r5, r1] @@ -7746,8 +6321,8 @@ sub_812E154: @ 812E154 .pool thumb_func_end sub_812E154 - thumb_func_start sub_812E1C8 -sub_812E1C8: @ 812E1C8 + thumb_func_start sub_8104F8C +sub_8104F8C: @ 812E1C8 push {r4-r6,lr} movs r4, 0xCB movs r5, 0x1 @@ -7799,7 +6374,7 @@ _0812E1FE: pop {r0} bx r0 .pool - thumb_func_end sub_812E1C8 + thumb_func_end sub_8104F8C thumb_func_start sub_812E230 sub_812E230: @ 812E230 @@ -7862,7 +6437,7 @@ sub_812E230: @ 812E230 sub_812E2A8: @ 812E2A8 push {r4,lr} adds r4, r0, 0 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r1, [r0] ldrh r2, [r1, 0xC] movs r3, 0x2E @@ -7903,8 +6478,8 @@ _0812E2F6: .pool thumb_func_end sub_812E2A8 - thumb_func_start sub_812E300 -sub_812E300: @ 812E300 + thumb_func_start sub_81050C4 +sub_81050C4: @ 812E300 push {lr} ldr r0, =gUnknown_085A7D10 movs r1, 0x58 @@ -7928,7 +6503,7 @@ sub_812E300: @ 812E300 pop {r0} bx r0 .pool - thumb_func_end sub_812E300 + thumb_func_end sub_81050C4 thumb_func_start sub_812E33C sub_812E33C: @ 812E33C @@ -7999,7 +6574,7 @@ _0812E350: movs r3, 0x2 orrs r1, r3 strb r1, [r2] - ldr r1, =gUnknown_0203AB34 + ldr r1, =sSlotMachine ldr r1, [r1] adds r1, 0x3F strb r0, [r1] @@ -8013,7 +6588,7 @@ _0812E350: thumb_func_start sub_812E3E8 sub_812E3E8: @ 812E3E8 push {r4,lr} - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x3F ldrb r1, [r0] @@ -8148,7 +6723,7 @@ _0812E490: ldr r1, =gUnknown_085A7FE0 adds r0, r2, 0 bl SetSubspriteTables - ldr r5, =gUnknown_0203AB34 + ldr r5, =sSlotMachine ldr r0, [r5] adds r0, 0x49 strb r4, [r0] @@ -8280,7 +6855,7 @@ _0812E5BC: strb r1, [r3] ldr r1, =gUnknown_085A8010 bl SetSubspriteTables - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x42 strb r4, [r0] @@ -8327,7 +6902,7 @@ _0812E656: mov r2, r12 strb r1, [r2] strh r5, [r3, 0x3C] - ldr r1, =gUnknown_0203AB34 + ldr r1, =sSlotMachine ldr r1, [r1] adds r1, 0x4B adds r1, r4 @@ -8352,7 +6927,7 @@ _0812E656: sub_812E6C4: @ 812E6C4 push {r4,lr} adds r4, r0, 0 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r1, [r0] ldrh r0, [r4, 0x3C] ldrh r1, [r1, 0x14] @@ -8426,7 +7001,7 @@ sub_812E70C: @ 812E70C adds r0, r2, 0 mov r1, r9 bl SetSubspriteTables - ldr r6, =gUnknown_0203AB34 + ldr r6, =sSlotMachine ldr r0, [r6] adds r0, 0x4E strb r4, [r0] @@ -8502,7 +7077,7 @@ sub_812E7CC: @ 812E7CC strb r1, [r0, 0x5] ldr r1, =gUnknown_085A803C bl SetSubspriteTables - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x40 strb r4, [r0] @@ -8515,7 +7090,7 @@ sub_812E7CC: @ 812E7CC thumb_func_start sub_812E82C sub_812E82C: @ 812E82C push {r4,lr} - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x40 ldrb r1, [r0] @@ -8527,7 +7102,7 @@ sub_812E82C: @ 812E82C bl DestroySprite movs r4, 0 _0812E846: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x49 adds r0, r4 @@ -8561,7 +7136,7 @@ _0812E878: _0812E888: movs r4, 0 _0812E88A: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x4B adds r0, r4 @@ -8588,7 +7163,7 @@ sub_812E8C4: @ 812E8C4 push {r4,lr} movs r4, 0 _0812E8C8: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x4E adds r0, r4 @@ -8613,7 +7188,7 @@ _0812E8C8: thumb_func_start sub_812E8F8 sub_812E8F8: @ 812E8F8 push {r4,lr} - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x42 ldrb r1, [r0] @@ -8674,7 +7249,7 @@ sub_812E934: @ 812E934 movs r2, 0x1 orrs r1, r2 strb r1, [r5] - ldr r6, =gUnknown_0203AB34 + ldr r6, =sSlotMachine ldr r1, [r6] adds r1, 0x50 strb r0, [r1] @@ -8780,7 +7355,7 @@ sub_812EA44: @ 812EA44 lsls r0, 16 lsrs r0, 16 ldr r4, =gSprites - ldr r1, =gUnknown_0203AB34 + ldr r1, =sSlotMachine ldr r3, [r1] adds r1, r3, 0 adds r1, 0x50 @@ -8808,7 +7383,7 @@ sub_812EA7C: @ 812EA7C push {r4,lr} movs r4, 0 _0812EA80: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x50 adds r0, r4 @@ -8866,7 +7441,7 @@ sub_812EAB0: @ 812EAB0 strh r1, [r2, 0x3A] movs r1, 0x8 strh r1, [r2, 0x3C] - ldr r5, =gUnknown_0203AB34 + ldr r5, =sSlotMachine ldr r1, [r5] adds r1, 0x52 strb r0, [r1] @@ -8953,7 +7528,7 @@ _0812EB9A: thumb_func_start sub_812EBAC sub_812EBAC: @ 812EBAC ldr r3, =gSprites - ldr r1, =gUnknown_0203AB34 + ldr r1, =sSlotMachine ldr r1, [r1] adds r1, 0x52 ldrb r2, [r1] @@ -8982,7 +7557,7 @@ sub_812EBCC: @ 812EBCC bl MultiplyInvertedPaletteRGBComponents movs r4, 0 _0812EBEA: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x52 adds r0, r4 @@ -9026,7 +7601,7 @@ sub_812EC20: @ 812EC20 movs r3, 0x4 orrs r2, r3 strb r2, [r1, 0x5] - ldr r1, =gUnknown_0203AB34 + ldr r1, =sSlotMachine ldr r1, [r1] adds r1, 0x41 strb r0, [r1] @@ -9047,7 +7622,7 @@ sub_812EC64: @ 812EC64 thumb_func_start sub_812EC70 sub_812EC70: @ 812EC70 push {lr} - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x41 ldrb r1, [r0] @@ -9109,7 +7684,7 @@ _0812ECA4: add r1, sp ldrh r1, [r1] strh r1, [r3, 0x2E] - ldr r1, =gUnknown_0203AB34 + ldr r1, =sSlotMachine ldr r1, [r1] adds r1, 0x54 adds r1, r4 @@ -9188,7 +7763,7 @@ sub_812ED8C: @ 812ED8C push {r4,lr} movs r4, 0 _0812ED90: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x54 adds r0, r4 @@ -9238,7 +7813,7 @@ sub_812EDC0: @ 812EDC0 orrs r1, r2 strb r1, [r0, 0x1] bl InitSpriteAffineAnim - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x43 strb r4, [r0] @@ -9331,7 +7906,7 @@ _0812EE90: thumb_func_start sub_812EEA8 sub_812EEA8: @ 812EEA8 ldr r2, =gSprites - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x43 ldrb r1, [r0] @@ -9349,7 +7924,7 @@ sub_812EEA8: @ 812EEA8 thumb_func_start sub_812EECC sub_812EECC: @ 812EECC push {r4,lr} - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] adds r0, 0x43 ldrb r0, [r0] @@ -9817,7 +8392,7 @@ _0812F238: .4byte _0812F2AC .4byte _0812F2C2 _0812F250: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r0, [r0] ldrb r1, [r0, 0xA] subs r1, 0x1 @@ -10378,7 +8953,7 @@ _0812F660: beq _0812F71C b _0812F76C _0812F66A: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r2, [r0] adds r1, r2, 0 adds r1, 0x5C @@ -10422,7 +8997,7 @@ _0812F6B0: movs r0, 0xD0 strh r0, [r5, 0x34] _0812F6BC: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r2, [r0] ldrh r0, [r5, 0x32] lsls r0, 8 @@ -10438,7 +9013,7 @@ _0812F6BC: b _0812F75E .pool _0812F6E0: - ldr r6, =gUnknown_0203AB34 + ldr r6, =sSlotMachine ldr r0, [r6] movs r1, 0x12 ldrsh r0, [r0, r1] @@ -10490,7 +9065,7 @@ _0812F738: movs r0, 0xD0 strh r0, [r5, 0x34] _0812F744: - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r2, [r0] ldrh r0, [r5, 0x32] lsls r0, 8 @@ -10559,7 +9134,7 @@ sub_812F794: @ 812F794 thumb_func_start sub_812F7C0 sub_812F7C0: @ 812F7C0 - ldr r0, =gUnknown_0203AB34 + ldr r0, =sSlotMachine ldr r2, [r0] adds r1, r2, 0 adds r1, 0x58 @@ -10955,8 +9530,8 @@ sub_812FAF4: @ 812FAF4 .pool thumb_func_end sub_812FAF4 - thumb_func_start sub_812FB14 -sub_812FB14: @ 812FB14 + thumb_func_start SlotMachineSetup_9_0 +SlotMachineSetup_9_0: @ 812FB14 ldr r1, =gUnknown_03001188 ldr r0, =gUnknown_0203AAF4 ldr r0, [r0] @@ -11015,10 +9590,10 @@ sub_812FB14: @ 812FB14 str r0, [r1, 0x64] bx lr .pool - thumb_func_end sub_812FB14 + thumb_func_end SlotMachineSetup_9_0 - thumb_func_start sub_812FBC4 -sub_812FBC4: @ 812FBC4 + thumb_func_start SlotMachineSetup_8_0 +SlotMachineSetup_8_0: @ 812FBC4 push {r4-r6,lr} mov r6, r8 push {r6} @@ -11218,6 +9793,6 @@ sub_812FBC4: @ 812FBC4 pop {r0} bx r0 .pool - thumb_func_end sub_812FBC4 + thumb_func_end SlotMachineSetup_8_0 .align 2, 0 @ Don't pad with nop. diff --git a/include/slot_machine.h b/include/slot_machine.h index 8334e56fc..88bbbd91b 100644 --- a/include/slot_machine.h +++ b/include/slot_machine.h @@ -1,6 +1,6 @@ #ifndef GUARD_SLOT_MACHINE_H #define GUARD_SLOT_MACHINE_H -void PlaySlotMachine(u8, void *); +void PlaySlotMachine(u8, void (callback)(void)); #endif // GUARD_SLOT_MACHINE_H diff --git a/ld_script.txt b/ld_script.txt index f5bfdd598..c7be8bd4c 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -167,6 +167,7 @@ SECTIONS { src/region_map.o(.text); asm/cute_sketch.o(.text); src/decoration.o(.text); + src/slot_machine.o(.text); asm/slot_machine.o(.text); asm/contest_painting.o(.text); src/battle_ai_script_commands.o(.text); @@ -460,6 +461,7 @@ SECTIONS { src/region_map.o(.rodata); data/cute_sketch.o(.rodata); src/decoration.o(.rodata); + src/slot_machine.o(.rodata); data/slot_machine.o(.rodata); data/contest_painting.o(.rodata); src/battle_ai_script_commands.o(.rodata); diff --git a/src/slot_machine.c b/src/slot_machine.c new file mode 100644 index 000000000..02e842ce9 --- /dev/null +++ b/src/slot_machine.c @@ -0,0 +1,887 @@ +#include "global.h" +#include "constants/songs.h" +#include "overworld.h" +#include "field_effect.h" +#include "random.h" +#include "sound.h" +#include "main.h" +#include "slot_machine.h" +#include "string_util.h" +#include "decompress.h" +#include "trig.h" +#include "graphics.h" +#include "palette.h" +#include "util.h" +#include "text.h" +#include "menu.h" +#include "malloc.h" +#include "bg.h" +#include "gpu_regs.h" +#include "coins.h" +#include "tv.h" +#include "text_window.h" +#include "constants/rgb.h" +#include "menu.h" + +enum +{ + SLOT_MACHINE_TAG_7_RED, + SLOT_MACHINE_TAG_7_BLUE, + SLOT_MACHINE_TAG_AZURILL, + SLOT_MACHINE_TAG_LOTAD, + SLOT_MACHINE_TAG_CHERRY, + SLOT_MACHINE_TAG_POWER, + SLOT_MACHINE_TAG_REPLAY +}; + +enum +{ + SLOT_MACHINE_MATCHED_1CHERRY, + SLOT_MACHINE_MATCHED_2CHERRY, + SLOT_MACHINE_MATCHED_REPLAY, + SLOT_MACHINE_MATCHED_LOTAD, + SLOT_MACHINE_MATCHED_AZURILL, + SLOT_MACHINE_MATCHED_POWER, + SLOT_MACHINE_MATCHED_777_MIXED, + SLOT_MACHINE_MATCHED_777_RED, + SLOT_MACHINE_MATCHED_777_BLUE, + SLOT_MACHINE_MATCHED_NONE +}; + +struct SlotMachineEwramStruct +{ + /*0x00*/ u8 state; + /*0x01*/ u8 unk01; + /*0x02*/ u8 pikaPower; + /*0x03*/ u8 unk03; + /*0x04*/ u8 unk04; + /*0x05*/ u8 unk05; + /*0x06*/ u8 unk06; + /*0x07*/ u8 unk07; + /*0x08*/ u16 matchedSymbols; + /*0x0A*/ u8 unk0A; + /*0x0B*/ u8 unk0B; + /*0x0C*/ s16 coins; + /*0x0E*/ s16 payout; + /*0x10*/ s16 unk10; + /*0x12*/ s16 bet; + /*0x14*/ s16 unk14; + /*0x16*/ s16 unk16; + /*0x18*/ s16 unk18; + /*0x1A*/ s16 unk1A; + /*0x1C*/ s16 unk1C[3]; + /*0x22*/ u16 unk22[3]; + /*0x28*/ s16 reelPositions[3]; + /*0x2E*/ s16 unk2E[3]; + /*0x34*/ s16 unk34[3]; + /*0x3A*/ u8 reelTasks[3]; + /*0x3D*/ u8 unk3D; + /*0x3E*/ u8 unk3E; + /*0x3F*/ u8 unk3F; + /*0x40*/ u8 unk40; + /*0x41*/ u8 unk41; + /*0x42*/ u8 unk42; + /*0x43*/ u8 unk43; + /*0x44*/ u8 unk44[5]; + /*0x49*/ u8 unk49[2]; + /*0x49*/ u8 unk4B[3]; + /*0x4E*/ u8 unk4E[2]; + /*0x50*/ u8 unk50[2]; + /*0x52*/ u8 unk52[2]; + /*0x54*/ u8 unk54[4]; + /*0x58*/ u16 win0h; + /*0x5a*/ u16 win0v; + /*0x5c*/ u16 winIn; + /*0x5e*/ u16 winOut; + /*0x60*/ u16 backupMapMusic; + /*0x64*/ MainCallback prevMainCb; +}; + +extern struct SlotMachineEwramStruct *sSlotMachine; + +struct UnkStruct1 +{ + /*0x00*/ u8 unk00; + /*0x01*/ u8 unk01; + /*0x02*/ s16 unk02; +}; + +#define SLOTMACHINE_GFX_TILES 233 + +/*static*/void CB2_SlotMachineSetup(void); +/*static*/void CB2_SlotMachineLoop(void); +/*static*/void PlaySlotMachine_Internal(u8 arg0, MainCallback cb); +/*static*/void SlotMachineDummyTask(u8 taskId); +/*static*/void SlotMachineSetup_0_0(void); +/*static*/void SlotMachineSetup_6_2(void); +/*static*/void SlotMachineSetup_1_0(void); +/*static*/void SlotMachineSetup_2_0(void); +/*static*/void SlotMachineSetup_2_1(void); +/*static*/void SlotMachineSetup_0_1(void); +/*static*/void SlotMachineSetup_3_0(void); +/*static*/void SlotMachineSetup_4_0(void); +/*static*/void SlotMachineSetup_5_0(void); +/*static*/void SlotMachineSetup_6_0(void); +/*static*/void SlotMachineSetup_6_1(void); +/*static*/void SlotMachineSetup_8_0(void); +/*static*/void SlotMachineSetup_9_0(void); +/*static*/void SlotMachineSetup_10_0(void); +/*static*/void SlotMachineSetup_10_1(void); +/*static*/void sub_8101D04(void); +/*static*/void sub_8104DA4(void); +/*static*/void sub_8101D24(u8 taskId); +/*static*/bool8 sub_8101D5C(struct Task *task); +/*static*/bool8 sub_8101D8C(struct Task *task); +/*static*/bool8 sub_8101DB0(struct Task *task); +/*static*/bool8 sub_8101DF4(struct Task *task); +/*static*/bool8 sub_8101E10(struct Task *task); +/*static*/bool8 sub_8101E3C(struct Task *task); +/*static*/bool8 sub_8101F44(struct Task *task); +/*static*/bool8 sub_8101F60(struct Task *task); +/*static*/bool8 sub_8101F88(struct Task *task); +/*static*/bool8 sub_8101FA4(struct Task *task); +/*static*/bool8 sub_8102008(struct Task *task); +/*static*/bool8 sub_8102034(struct Task *task); +/*static*/bool8 sub_8102058(struct Task *task); +/*static*/bool8 sub_8102090(struct Task *task); +bool8 sub_81020C8(struct Task *task); +/*static*/bool8 sub_81021E0(struct Task *task); +/*static*/bool8 sub_81021FC(struct Task *task); +/*static*/bool8 sub_8102264(struct Task *task); +/*static*/bool8 sub_81022A0(struct Task *task); +/*static*/bool8 sub_81022CC(struct Task *task); +/*static*/bool8 sub_81022F0(struct Task *task); +/*static*/bool8 sub_8102318(struct Task *task); +/*static*/bool8 sub_8102344(struct Task *task); +/*static*/bool8 sub_810239C(struct Task *task); +/*static*/bool8 sub_81023B8(struct Task *task); +/*static*/bool8 sub_81023E0(struct Task *task); +/*static*/bool8 sub_81023FC(struct Task *task); +/*static*/bool8 sub_8102424(struct Task *task); +/*static*/bool8 sub_8102460(struct Task *task); +/*static*/void sub_8102484(void); +/*static*/void sub_81024F0(void); +/*static*/bool8 sub_8102540(void); +/*static*/u8 sub_8102578(void); +/*static*/u16 dp15_jump_random_unknown(void); +/*static*/u8 sub_81025BC(void); +/*static*/void CheckMatch(void); +/*static*/void CheckMatch_CenterRow(void); +/*static*/void CheckMatch_TopAndBottom(void); +/*static*/void CheckMatch_Diagonals(void); +/*static*/u8 GetMatchFromSymbolsInRow(u8 c1, u8 c2, u8 c3); +/*static*/void sub_8102A24(void); +/*static*/void sub_8102A64(u8 taskId); +/*static*/bool8 sub_8102A44(void); +/*static*/bool8 sub_8102A9C(struct Task *task); +/*static*/bool8 sub_8102AD0(struct Task *task); +/*static*/bool8 sub_8102B80(struct Task *task); +/*static*/u8 GetTagOfReelSymbolOnScreenAtPos(u8 x, s16 y); +/*static*/void sub_8102DA8(void); +/*static*/void sub_8102DEC(u8 a0); +/*static*/void sub_8102E1C(u8 a0); +/*static*/bool8 sub_8102E40(u8 a0); +/*static*/void sub_8102E68(u8 taskId); +/*static*/bool8 sub_8102EA0(struct Task *task); +/*static*/bool8 sub_8102EA4(struct Task *task); +/*static*/bool8 sub_8102EC0(struct Task *task); +/*static*/bool8 sub_8102F4C(struct Task *task); +/*static*/bool8 sub_8103008(struct Task *task); +/*static*/bool8 sub_810305C(void); +/*static*/bool8 sub_8103154(u8 a0, u8 a1); +/*static*/bool8 sub_81031B4(u8 a0, u8 a1); +/*static*/bool8 sub_81032C0(void); +/*static*/bool8 sub_81032E8(void); +/*static*/bool8 sub_810333C(void); +/*static*/bool8 sub_81033DC(void); +/*static*/bool8 sub_810341C(u8 a0); +/*static*/bool8 sub_810347C(u8 a0); +/*static*/void sub_81034F4(void); +/*static*/void sub_8103540(void); +/*static*/void sub_8103564(void); +/*static*/void j5_08111E84(void); +/*static*/void sub_8103668(void); +/*static*/void sub_810380C(void); +/*static*/void sub_8103830(void); +/*static*/void sub_8103910(void); +/*static*/void sub_8103A78(void); +/*static*/void sub_8103C14(u8 a0); +/*static*/void sub_8103C48(u8 taskId); +/*static*/void sub_8103D50(u8 a0); +/*static*/void sub_8103C78(struct Task *task, u8 taskId); +/*static*/void sub_8103CAC(struct Task *task, u8 taskId); +/*static*/void sub_8103CC8(struct Task *task, u8 taskId); +/*static*/void sub_8103D8C(u8 a0); +/*static*/void sub_8103DC8(void); +/*static*/void sub_8103E04(u8 a0); +/*static*/bool8 sub_8103E38(void); +/*static*/bool8 sub_8103E7C(void); +/*static*/bool8 sub_8103EAC(u8 spriteId); +/*static*/void sub_8103EE4(struct Sprite *sprite); +/*static*/void sub_8103F70(void); +/*static*/bool8 sub_8103FA0(void); +/*static*/void sub_8103FE8(u8 taskId); +/*static*/void sub_8104048(void); +/*static*/void sub_8104064(u8 pikaPower); +/*static*/bool8 sub_81040C8(void); +/*static*/void sub_81040E8(u8 taskId); +/*static*/void nullsub_68(struct Task *task); +/*static*/void sub_810411C(struct Task *task); +/*static*/void sub_8104144(struct Task *task); +/*static*/void sub_81041AC(struct Task *task); +/*static*/void sub_810421C(struct Task *task); +/*static*/void sub_810423C(u8 pikaPower); +/*static*/void sub_810430C(void); +/*static*/bool8 sub_810432C(void); +/*static*/void sub_810434C(u8 taskId); +/*static*/void sub_810437C(struct Task *task); +/*static*/void sub_81043EC(struct Task *task); +/*static*/void sub_8104468(struct Task *task); +/*static*/void sub_8104498(struct Task *task); +/*static*/void sub_8104548(struct Task *task); +/*static*/void sub_8104598(struct Task *task); +/*static*/void sub_81045CC(struct Task *task); +/*static*/void sub_810463C(struct Task *task); +/*static*/void sub_81046C0(struct Task *task); +/*static*/void sub_8104764(struct Task *task); +/*static*/void sub_8104794(struct Task *task); +/*static*/void sub_81047EC(struct Task *task); +/*static*/void sub_8104860(struct Task *task); +/*static*/void sub_81048A8(struct Task *task); +/*static*/void sub_81048CC(struct Task *task); +/*static*/void sub_8104940(struct Task *task); +/*static*/void sub_81049C8(struct Task *task); +/*static*/void sub_81049F8(struct Task *task); +/*static*/void sub_8104A40(s16 a0, s16 a1); +/*static*/void sub_8104A88(s16 a0); +/*static*/void sub_8104AB8(u8 a0); +/*static*/bool8 sub_8104AEC(void); +/*static*/void sub_8104B0C(u8 taskId); +/*static*/void sub_8104B3C(struct Task *task); +/*static*/void sub_8104B60(struct Task *task); +/*static*/void sub_8104B80(struct Task *task); +/*static*/void sub_8104BC8(struct Task *task); +/*static*/void sub_8104BFC(struct Task *task); +/*static*/void sub_8104C44(struct Task *task); +/*static*/void sub_8104C5C(void); +/*static*/void sub_8104CAC(u8 arg0); +/*static*/bool8 sub_8104E18(void); +/*static*/void nullsub_69(struct Task *task); +/*static*/void sub_8104E74(u8 taskId); +/*static*/void sub_8104EA8(void); +/*static*/void sub_8104F8C(void); +/*static*/void sub_8104FF4(s16 x, s16 y, u8 a2, s16 a3); +/*static*/void sub_81050C4(void); +/*static*/void sub_8105100(void); +/*static*/void sub_810514C(void); +/*static*/void sub_81051C0(void); +/*static*/void sub_8105284(void); +/*static*/void sub_81052EC(void); +/*static*/void sub_81053A0(void); +/*static*/void sub_810545C(void); +/*static*/void sub_81054B8(void); +/*static*/void sub_8105524(void); +/*static*/void sub_8105554(void); +/*static*/void sub_8105578(void); +/*static*/void sub_8105688(s16 a0); +/*static*/void sub_81056C0(void); +/*static*/void sub_81056F0(void); +/*static*/void sub_81057E8(s16 a0); +/*static*/void sub_8105804(void); +/*static*/void sub_8105854(void); +/*static*/void sub_81058A0(void); +/*static*/void sub_81058C4(void); +/*static*/void sub_81059B8(void); +/*static*/void sub_81059E8(void); +/*static*/bool8 sub_8105ACC(void); +/*static*/void sub_8105AEC(void); +/*static*/u8 sub_8105B1C(s16 x, s16 y); +/*static*/void sub_8105B88(u8 spriteId); +/*static*/u8 sub_8105BF8(u8 templateIdx, void (*callback)(struct Sprite*), s16 x, s16 y, s16 a4); +/*static*/void sub_81063C0(void); +/*static*/void sub_8106404(void); +/*static*/void sub_8106448(void); +/*static*/void sub_81064B8(void); +/*static*/void sub_81065A8(s16 arg0, u16 arg1, u16 arg2, u16 arg3, u16 arg4); +/*static*/void sub_81065DC(void); +/*static*/extern const struct UnkStruct1 *const gUnknown_083ED048[]; +/*static*/extern const u16 gPalette_83EDE24[]; +/*static*/extern const u8 gUnknown_083ECD04[][3]; +/*static*/extern const u8 gUnknown_083ECE3A[]; +/*static*/extern const u16 gUnknown_083ECE42[]; +/*static*/extern const u16 gUnknown_083ECE48[]; + +// code +#define tState data[0] + +void Task_FadeToSlotMachine(u8 taskId) +{ + switch (gTasks[taskId].tState) + { + case 0: + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + gTasks[taskId].tState++; + break; + case 1: + if (!gPaletteFade.active) + { + SetMainCallback2(CB2_SlotMachineSetup); + DestroyTask(taskId); + } + break; + } +} + +void PlaySlotMachine(u8 arg0, MainCallback cb) +{ + u8 taskId; + + sSlotMachine = AllocZeroed(sizeof(*sSlotMachine)); + PlaySlotMachine_Internal(arg0, cb); + taskId = CreateTask(Task_FadeToSlotMachine, 0); + gTasks[taskId].tState = 0; +} + +#undef tState + +void CB2_SlotMachineSetup(void) +{ + switch (gMain.state) + { + case 0: + SlotMachineSetup_0_0(); + SlotMachineSetup_0_1(); + gMain.state++; + break; + case 1: + SlotMachineSetup_1_0(); + gMain.state++; + break; + case 2: + SlotMachineSetup_2_0(); + SlotMachineSetup_2_1(); + gMain.state++; + break; + case 3: + SlotMachineSetup_3_0(); + gMain.state++; + break; + case 4: + SlotMachineSetup_4_0(); + gMain.state++; + break; + case 5: + SlotMachineSetup_5_0(); + gMain.state++; + break; + case 6: + SlotMachineSetup_6_0(); + gMain.state++; + break; + case 7: + BeginNormalPaletteFade(-1, 0, 0x10, 0, 0); + ShowBg(0); + ShowBg(1); + ShowBg(2); + ShowBg(3); + gMain.state++; + break; + case 8: + SlotMachineSetup_8_0(); + gMain.state++; + break; + case 9: + SlotMachineSetup_9_0(); + gMain.state++; + break; + case 10: + SlotMachineSetup_10_0(); + SlotMachineSetup_10_1(); + gMain.state++; + break; + case 11: + SetMainCallback2(CB2_SlotMachineLoop); + break; + } +} + +void CB2_SlotMachineLoop(void) +{ + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +void SlotMachine_VBlankCallback(void) +{ + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); + SetGpuReg(REG_OFFSET_WIN0H, sSlotMachine->win0h); + SetGpuReg(REG_OFFSET_WIN0V, sSlotMachine->win0v); + SetGpuReg(REG_OFFSET_WININ, sSlotMachine->winIn); + SetGpuReg(REG_OFFSET_WINOUT, sSlotMachine->winOut); +} + +void PlaySlotMachine_Internal(u8 arg0, MainCallback cb) +{ + struct Task *task = gTasks + CreateTask(SlotMachineDummyTask, 0xFF); + task->data[0] = arg0; + StoreWordInTwoHalfwords(task->data + 1, (intptr_t)cb); +} + +void sub_81019EC(void) +{ + struct Task *task = gTasks + FindTaskIdByFunc(SlotMachineDummyTask); + sSlotMachine->unk01 = task->data[0]; + LoadWordFromTwoHalfwords((u16 *)(task->data + 1), (u32 *)&sSlotMachine->prevMainCb); +} + +void SlotMachineDummyTask(u8 taskId) +{ +} + +extern const struct BgTemplate gUnknown_085A7424[4]; +extern const struct WindowTemplate gUnknown_085A7434[]; + +void SlotMachineSetup_0_0(void) +{ + SetVBlankCallback(NULL); + SetHBlankCallback(NULL); + CpuFill32(0, (void *)VRAM, VRAM_SIZE); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_085A7424, ARRAY_COUNT(gUnknown_085A7424)); + InitWindows(gUnknown_085A7434); + DeactivateAllTextPrinters(); +} + +void SlotMachineSetup_6_0(void) +{ + SetVBlankCallback(SlotMachine_VBlankCallback); + EnableInterrupts(INTR_FLAG_VBLANK); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_1D_MAP | DISPCNT_OBJ_ON | DISPCNT_WIN0_ON); +} + +void SlotMachineSetup_1_0(void) +{ + DmaClearLarge16(3, (u16 *)(BG_VRAM), BG_VRAM_SIZE, 0x1000); +} + +void SlotMachineSetup_2_0(void) +{ + DmaClear16(3, (u16 *)OAM, OAM_SIZE); +} + +void SlotMachineSetup_2_1(void) +{ + SetGpuReg(REG_OFFSET_BG0CNT, 0); + SetGpuReg(REG_OFFSET_BG1CNT, 0); + SetGpuReg(REG_OFFSET_BG2CNT, 0); + SetGpuReg(REG_OFFSET_BG3CNT, 0); + SetGpuReg(REG_OFFSET_BG0HOFS, 0); + SetGpuReg(REG_OFFSET_BG0VOFS, 0); + SetGpuReg(REG_OFFSET_BG1HOFS, 0); + SetGpuReg(REG_OFFSET_BG1VOFS, 0); + SetGpuReg(REG_OFFSET_BG2HOFS, 0); + SetGpuReg(REG_OFFSET_BG2VOFS, 0); + SetGpuReg(REG_OFFSET_BG3HOFS, 0); + SetGpuReg(REG_OFFSET_BG3VOFS, 0); + SetGpuReg(REG_OFFSET_WININ, 0x3f); + SetGpuReg(REG_OFFSET_WINOUT, 0x3f); + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT1_BG3 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT2_OBJ); + SetGpuReg(REG_OFFSET_BLDALPHA, 0x809); +} + +extern const s16 gUnknown_083ECCF8[][2]; + +void SlotMachineSetup_0_1(void) +{ + u8 i; + + sub_81019EC(); + sSlotMachine->state = 0; + sSlotMachine->pikaPower = 0; + sSlotMachine->unk03 = Random() & 1; + sSlotMachine->unk04 = 0; + sSlotMachine->matchedSymbols = 0; + sSlotMachine->unk0A = 0; + sSlotMachine->unk0B = 0; + sSlotMachine->coins = GetCoins(); + sSlotMachine->payout = 0; + sSlotMachine->unk10 = 0; + sSlotMachine->bet = 0; + sSlotMachine->unk18 = 0; + sSlotMachine->unk1A = 8; + sSlotMachine->win0h = 0xf0; + sSlotMachine->win0v = 0xa0; + sSlotMachine->winIn = 0x3f; + sSlotMachine->winOut = 0x3f; + sSlotMachine->backupMapMusic = GetCurrentMapMusic(); + for (i = 0; i < 3; i++) + { + sSlotMachine->unk22[i] = 0; + sSlotMachine->reelPositions[i] = gUnknown_083ECCF8[i][sSlotMachine->unk03] % 21; + sSlotMachine->unk1C[i] = 0x1f8 - sSlotMachine->reelPositions[i] * 24; + sSlotMachine->unk1C[i] %= 0x1f8; + } + sub_80EDE70(GetCoins()); +} + +extern u8 gOamLimit; + +void SlotMachineSetup_3_0(void) +{ + ResetPaletteFade(); + ResetSpriteData(); + gOamLimit = 0x80; + FreeAllSpritePalettes(); + ResetTasks(); +} + +extern u16 *gUnknown_0203AACC; +extern u16 *gUnknown_0203AAD0; +extern u16 *gUnknown_0203AADC; + +void SlotMachineSetup_4_0(void) +{ + gUnknown_0203AACC = Alloc(8); + gUnknown_0203AAD0 = AllocZeroed(0xE); + gUnknown_0203AADC = AllocZeroed(8); + + gUnknown_0203AAD0[0] = 0x2051; + gUnknown_0203AAD0[1] = 0x2851; + gUnknown_0203AAD0[2] = 0x2061; + gUnknown_0203AAD0[3] = 0x2861; + gUnknown_0203AAD0[4] = 0x20BE; + gUnknown_0203AAD0[5] = 0x28BE; + gUnknown_0203AAD0[6] = 0x20BF; +} + +/*static*/void sub_812F908(void); +/*static*/void sub_812F958(void); +/*static*/void sub_812F7E4(void); + +void SlotMachineSetup_5_0(void) +{ + sub_812F908(); + sub_812F958(); + sub_812F7E4(); + LoadMessageBoxGfx(0, 0x200, 0xF0); + LoadUserWindowBorderGfx(0, 0x214, 0xE0); + PutWindowTilemap(0); +} + +void SlotMachineSetup_10_0(void) +{ + sub_8104EA8(); + sub_8104F8C(); + sub_8103DC8(); + sub_81050C4(); +} + +void SlotMachineSetup_10_1(void) +{ + sub_8104048(); + sub_8102DA8(); + sub_8104C5C(); + sub_8101D04(); +} + +void sub_8101D04(void) +{ + sub_8101D24(CreateTask(sub_8101D24, 0)); +} + +extern bool8 (*const gUnknown_083ECAAC[])(struct Task *task); + +void sub_8101D24(u8 taskId) +{ + while (gUnknown_083ECAAC[sSlotMachine->state](gTasks + taskId)) + ; +} + +bool8 sub_8101D5C(struct Task *task) +{ + BeginNormalPaletteFade(0xFFFFFFFF, 0, 16, 0, RGB(0, 0, 0)); + sub_810423C(sSlotMachine->pikaPower); + sSlotMachine->state++; + return FALSE; +} + +bool8 sub_8101D8C(struct Task *task) +{ + if (!gPaletteFade.active) + sSlotMachine->state++; + return FALSE; +} + +bool8 sub_8101DB0(struct Task *task) +{ + sSlotMachine->payout = 0; + sSlotMachine->bet = 0; + sSlotMachine->unk18 = 0; + sSlotMachine->unk04 &= 0xc0; + sSlotMachine->state = 4; + if (sSlotMachine->coins <= 0) + { + sSlotMachine->state = 25; + } + else if (sSlotMachine->unk0A) + { + sSlotMachine->state = 3; + sub_8104CAC(4); + } + return TRUE; +} + +bool8 sub_8101DF4(struct Task *task) +{ + if (sub_8104E18()) + sSlotMachine->state = 4; + return FALSE; +} + +bool8 sub_8101E10(struct Task *task) +{ + sub_8104CAC(0); + sSlotMachine->state = 5; + if (sSlotMachine->coins >= 9999) + sSlotMachine->state = 23; + return TRUE; +} + +bool8 sub_8101E3C(struct Task *task) +{ + s16 i; + + if (gMain.newKeys & SELECT_BUTTON) + { + sub_8104AB8(0); + sSlotMachine->state = 8; + } + else if (gMain.newKeys & R_BUTTON) + { + if (sSlotMachine->coins - (3 - sSlotMachine->bet) >= 0) + { + for (i = sSlotMachine->bet; i < 3; i++) + sub_8103D50(i); + sSlotMachine->coins -= (3 - sSlotMachine->bet); + sSlotMachine->bet = 3; + sSlotMachine->state = 9; + PlaySE(SE_REGI); + } + else + { + sSlotMachine->state = 6; + } + } + else + { + if (gMain.newKeys & DPAD_DOWN && sSlotMachine->coins != 0) + { + PlaySE(SE_REGI); + sub_8103D50(sSlotMachine->bet); + sSlotMachine->coins--; + sSlotMachine->bet++; + } + if (sSlotMachine->bet >= 3 || (sSlotMachine->bet != 0 && gMain.newKeys & A_BUTTON)) + sSlotMachine->state = 9; + if (gMain.newKeys & B_BUTTON) + sSlotMachine->state = 21; + } + return FALSE; +} + +extern const u8 gText_YouDontHaveThreeCoins[]; + +bool8 sub_8101F44(struct Task *task) +{ + NewMenuHelpers_DrawDialogueFrame(0, 0); + PrintTextOnWindow(0, 1, gText_YouDontHaveThreeCoins, 0, 1, 0, 0); + CopyWindowToVram(0, 3); + sSlotMachine->state = 7; + return FALSE; +} + +bool8 sub_8101F60(struct Task *task) +{ + if (gMain.newKeys & (A_BUTTON | B_BUTTON)) + { + sub_8197434(0, TRUE); + sSlotMachine->state = 5; + } + return FALSE; +} + +bool8 sub_8101F88(struct Task *task) +{ + if (sub_8104AEC()) + sSlotMachine->state = 5; + return FALSE; +} + +bool8 sub_8101FA4(struct Task *task) +{ + sub_8102484(); + sub_8104DA4(); + sub_8102DEC(0); + sub_8102DEC(1); + sub_8102DEC(2); + sub_80EEC80(); + task->data[0] = 0; + if (sSlotMachine->unk04 & 0x20) + { + sub_810430C(); + sSlotMachine->state = 10; + } + else + { + sub_8104CAC(1); + sSlotMachine->state = 11; + } + sSlotMachine->unk1A = 8; + if (sSlotMachine->unk0A) + sSlotMachine->unk1A = dp15_jump_random_unknown(); + return FALSE; +} + +bool8 sub_8102008(struct Task *task) +{ + if (sub_810432C()) + { + sub_8104CAC(1); + sSlotMachine->unk04 &= 0xDF; + sSlotMachine->state = 11; + } + return FALSE; +} + +bool8 sub_8102034(struct Task *task) +{ + if (++task->data[0] >= 30) + { + sub_81024F0(); + sSlotMachine->state = 12; + } + return FALSE; +} + +bool8 sub_8102058(struct Task *task) +{ + if (gMain.newKeys & A_BUTTON) + { + PlaySE(SE_JYUNI); + sub_8102E1C(sSlotMachine->unk18); + sub_8103C14(sSlotMachine->unk18); + sSlotMachine->state = 13; + } + return FALSE; +} + +bool8 sub_8102090(struct Task *task) +{ + if (!sub_8102E40(sSlotMachine->unk18)) + { + sSlotMachine->unk18++; + sSlotMachine->state = 12; + if (sSlotMachine->unk18 > 2) + { + sSlotMachine->state = 14; + } + return TRUE; + } + return FALSE; +} + +bool8 sub_81020C8(struct Task *task) +{ + sSlotMachine->unk04 &= 0xc0; + CheckMatch(); + if (sSlotMachine->unk0A) + { + sSlotMachine->unk0A--; + sSlotMachine->unk0B++; + } + + if (sSlotMachine->matchedSymbols) + { + sSlotMachine->state = 15; + sub_8102A24(); + sub_8103F70(); + if ((sSlotMachine->unk10 -= sSlotMachine->payout) < 0) + { + sSlotMachine->unk10 = 0; + } + if (sSlotMachine->matchedSymbols & ((1 << SLOT_MACHINE_MATCHED_777_BLUE) | (1 << SLOT_MACHINE_MATCHED_777_RED))) + { + PlayFanfare(MUS_ME_B_BIG); + sub_8104CAC(6); + } + else if (sSlotMachine->matchedSymbols & (1 << SLOT_MACHINE_MATCHED_777_MIXED)) + { + PlayFanfare(MUS_ME_B_BIG); + sub_8104CAC(5); + } + else + { + PlayFanfare(MUS_ME_B_SMALL); + sub_8104CAC(2); + } + if (sSlotMachine->matchedSymbols & ((1 << SLOT_MACHINE_MATCHED_777_MIXED) | (1 << SLOT_MACHINE_MATCHED_777_BLUE) | (1 << SLOT_MACHINE_MATCHED_777_RED))) + { + sSlotMachine->unk04 &= 0x3f; + if (sSlotMachine->matchedSymbols & ((1 << SLOT_MACHINE_MATCHED_777_BLUE) | (1 << SLOT_MACHINE_MATCHED_777_RED))) + { + sSlotMachine->unk0A = 0; + sSlotMachine->unk0B = 0; + sSlotMachine->unk03 = 0; + if (sSlotMachine->matchedSymbols & (1 << SLOT_MACHINE_MATCHED_777_BLUE)) + sSlotMachine->unk03 = 1; + } + } + if (sSlotMachine->matchedSymbols & (1 << SLOT_MACHINE_MATCHED_POWER) && sSlotMachine->pikaPower < 16) + { + sSlotMachine->pikaPower++; + sub_8104064(sSlotMachine->pikaPower); + } + } + else + { + sub_8104CAC(3); + sSlotMachine->state = 20; + if ((sSlotMachine->unk10 += sSlotMachine->bet) > 9999) + sSlotMachine->unk10 = 9999; + } + return FALSE; +} + +bool8 sub_81021E0(struct Task *task) +{ + if (sub_8102A44()) + sSlotMachine->state = 16; + return FALSE; +} + +bool8 sub_81021FC(struct Task *task) +{ + if (sub_8103FA0()) + { + sSlotMachine->state = 19; + if (sSlotMachine->matchedSymbols & ((1 << SLOT_MACHINE_MATCHED_777_RED) | (1 << SLOT_MACHINE_MATCHED_777_BLUE))) + IncrementGameStat(GAME_STAT_SLOT_JACKPOTS); + if (sSlotMachine->matchedSymbols & (1 << SLOT_MACHINE_MATCHED_REPLAY)) + { + sSlotMachine->unk18 = 0; + sSlotMachine->state = 9; + } + if (sSlotMachine->matchedSymbols & (1 << SLOT_MACHINE_MATCHED_POWER)) + sSlotMachine->state = 17; + if (sSlotMachine->unk0A && sSlotMachine->matchedSymbols & (1 << SLOT_MACHINE_MATCHED_REPLAY)) + { + sub_8104CAC(4); + sSlotMachine->state = 18; + } + } + return FALSE; +}