From 439fa13e9460db41054aa97fe178a4212299ec83 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Mon, 31 Dec 2018 16:09:45 -0600 Subject: [PATCH 1/6] Start porting/decompiling roulette --- asm/roulette.s | 2213 +-------------------------------------- include/menu_helpers.h | 2 +- include/roulette_util.h | 6 + include/strings.h | 3 + ld_script.txt | 1 + src/decoration.c | 10 +- src/menu_helpers.c | 2 +- src/roulette.c | 1053 +++++++++++++++++++ src/roulette_util.c | 2 +- src/secret_base.c | 2 +- 10 files changed, 1073 insertions(+), 2221 deletions(-) create mode 100644 src/roulette.c diff --git a/asm/roulette.s b/asm/roulette.s index 4174924e6..bfd4c7c7f 100644 --- a/asm/roulette.s +++ b/asm/roulette.s @@ -5,2217 +5,6 @@ .text - thumb_func_start sub_8140238 -sub_8140238: @ 8140238 - push {lr} - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - adds r1, r0, 0 - adds r1, 0xB8 - ldrb r0, [r1] - cmp r0, 0 - beq _0814025A - adds r0, r1, 0 - bl task_tutorial_controls_fadein -_0814025A: - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140238 - - thumb_func_start sub_8140264 -sub_8140264: @ 8140264 - push {r4,lr} - sub sp, 0x4 - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - bl sub_8142814 - ldr r4, =gUnknown_0203AB88 - ldr r0, [r4] - ldrh r0, [r0, 0x26] - movs r2, 0x80 - lsls r2, 2 - adds r1, r2, 0 - subs r1, r0 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x14 - bl SetGpuReg - ldr r1, [r4] - ldrb r0, [r1, 0x1] - cmp r0, 0 - beq _081402A0 - ldrh r1, [r1, 0x34] - movs r0, 0x52 - bl SetGpuReg -_081402A0: - ldr r2, [r4] - movs r3, 0x2A - ldrsh r0, [r2, r3] - cmp r0, 0 - beq _081402C0 - ldr r1, =0x040000d4 - ldr r3, =0x0000133c - adds r0, r2, r3 - str r0, [r1] - ldr r0, =0x060021c0 - str r0, [r1, 0x4] - ldr r0, =0x800001a0 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - movs r0, 0 - strh r0, [r2, 0x2A] -_081402C0: - ldr r0, [r4] - movs r2, 0x28 - ldrsh r1, [r0, r2] - cmp r1, 0x1 - beq _081402EC - cmp r1, 0x1 - ble _08140374 - cmp r1, 0x2 - beq _08140324 - cmp r1, 0xFF - beq _08140348 - b _08140374 - .pool -_081402EC: - movs r0, 0 - movs r1, 0x1 - movs r2, 0 - bl SetBgAttribute - movs r0, 0 - bl ShowBg - ldr r1, =0x040000d4 - ldr r2, [r4] - movs r3, 0xCF - lsls r3, 2 - adds r0, r2, r3 - str r0, [r1] - ldr r0, =0x0600f9c0 - str r0, [r1, 0x4] - ldr r0, =0x800001a0 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - movs r0, 0x2 - strh r0, [r2, 0x28] - b _08140374 - .pool -_08140324: - ldr r1, =0x040000d4 - movs r2, 0xCF - lsls r2, 2 - adds r0, r2 - str r0, [r1] - ldr r0, =0x0600f9c0 - str r0, [r1, 0x4] - ldr r0, =0x800001a0 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - b _08140374 - .pool -_08140348: - movs r0, 0 - movs r1, 0x1 - movs r2, 0x2 - bl SetBgAttribute - movs r0, 0 - bl ShowBg - mov r1, sp - movs r0, 0 - strh r0, [r1] - ldr r1, =0x040000d4 - mov r3, sp - str r3, [r1] - ldr r0, =0x0600f9c0 - str r0, [r1, 0x4] - ldr r0, =0x810001a0 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - ldr r1, [r4] - movs r0, 0 - strh r0, [r1, 0x28] -_08140374: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140264 - - thumb_func_start sub_8140388 -sub_8140388: @ 8140388 - push {r4,r5,lr} - sub sp, 0x4 - movs r5, 0 - str r5, [sp] - ldr r4, =gUnknown_0203AB88 - movs r0, 0xE6 - lsls r0, 6 - bl AllocZeroed - str r0, [r4] - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_085B6140 - movs r0, 0x1 - movs r2, 0x3 - bl InitBgsFromTemplates - ldr r1, [r4] - movs r0, 0xBE - lsls r0, 1 - adds r1, r0 - movs r0, 0 - bl SetBgTilemapBuffer - ldr r1, [r4] - ldr r2, =0x0000117c - adds r1, r2 - movs r0, 0x1 - bl SetBgTilemapBuffer - ldr r1, [r4] - ldr r0, =0x0000317c - adds r1, r0 - movs r0, 0x2 - bl SetBgTilemapBuffer - ldr r0, =gUnknown_085B614C - bl InitWindows - bl sub_8197200 - ldr r0, =gUnknown_0203AB8C - strb r5, [r0] - ldr r0, =gUnknown_085B5DFC - mov r1, sp - bl malloc_and_decompress - ldr r1, [r4] - ldr r2, =0x0000397c - adds r1, r2 - str r0, [r1] - add sp, 0x4 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140388 - - thumb_func_start sub_8140418 -sub_8140418: @ 8140418 - push {r4,r5,lr} - ldr r5, =gUnknown_0203AB88 - ldr r0, [r5] - ldr r4, =0x0000397c - adds r0, r4 - ldr r0, [r0] - bl Free - ldr r0, [r5] - adds r0, r4 - movs r4, 0 - str r4, [r0] - bl FreeAllWindowBuffers - movs r0, 0 - bl UnsetBgTilemapBuffer - movs r0, 0x1 - bl UnsetBgTilemapBuffer - movs r0, 0x2 - bl UnsetBgTilemapBuffer - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r0, [r5] - movs r2, 0xE6 - lsls r2, 6 - movs r1, 0 - bl memset - ldr r0, [r5] - bl Free - str r4, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140418 - - thumb_func_start sub_8140470 -sub_8140470: @ 8140470 - push {r4-r6,lr} - sub sp, 0x8 - ldr r1, =gUnknown_085B6418 - mov r0, sp - movs r2, 0x6 - bl memcpy - ldr r5, =gUnknown_0203AB88 - ldr r3, [r5] - ldr r4, =gSpecialVar_0x8004 - ldrb r0, [r4] - movs r1, 0x1 - ands r1, r0 - ldrb r2, [r3, 0x4] - movs r0, 0x4 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x4] - ldrh r1, [r4] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _081404AA - ldr r0, [r5] - ldrb r1, [r0, 0x4] - movs r2, 0x80 - orrs r1, r2 - strb r1, [r0, 0x4] -_081404AA: - ldr r1, [r5] - ldr r2, =gUnknown_085B6348 - ldrb r0, [r1, 0x4] - lsls r0, 30 - lsrs r0, 25 - adds r0, r2 - ldrb r0, [r0, 0x3] - adds r1, 0x22 - strb r0, [r1] - ldr r1, [r5] - ldrb r0, [r1, 0x4] - lsls r0, 30 - lsrs r0, 25 - adds r0, r2 - ldrb r0, [r0, 0x4] - adds r1, 0x23 - strb r0, [r1] - ldr r2, [r5] - ldr r3, =gUnknown_085B6344 - ldrb r1, [r2, 0x4] - lsls r0, r1, 30 - lsrs r0, 30 - lsrs r1, 7 - lsls r1, 1 - adds r0, r1 - adds r0, r3 - ldrb r0, [r0] - strb r0, [r2, 0x19] - ldr r2, [r5] - ldrb r1, [r2, 0x1A] - movs r0, 0xF - ands r0, r1 - movs r1, 0x10 - orrs r0, r1 - strb r0, [r2, 0x1A] - ldr r0, [r5] - ldrb r0, [r0, 0x19] - cmp r0, 0x1 - bne _08140520 - ldr r4, =gPlttBufferUnfaded - ldr r3, =gPlttBufferFaded - mov r0, sp - ldrh r2, [r0] - b _08140528 - .pool -_08140520: - ldr r4, =gPlttBufferUnfaded - ldr r3, =gPlttBufferFaded - mov r0, sp - ldrh r2, [r0, 0x2] -_08140528: - adds r0, r3, 0 - adds r0, 0xA2 - strh r2, [r0] - ldr r1, =0x0000ffff - adds r0, r1, 0 - ands r0, r2 - strh r0, [r3] - ands r0, r1 - adds r2, r4, 0 - adds r2, 0xA2 - strh r0, [r2] - ands r0, r1 - strh r0, [r4] - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - adds r0, 0xB8 - bl sub_8151678 - movs r4, 0 -_0814054E: - ldr r5, =gUnknown_0203AB88 - ldr r0, [r5] - adds r0, 0xB8 - lsls r2, r4, 3 - ldr r1, =gUnknown_085B6388 - adds r2, r1 - adds r1, r4, 0 - bl sub_815168C - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xC - bls _0814054E - movs r4, 0 -_0814056C: - movs r0, 0x64 - muls r0, r4 - ldr r1, =gPlayerParty - adds r0, r1 - movs r1, 0x41 - bl GetMonData - adds r1, r0, 0 - movs r0, 0x98 - lsls r0, 1 - cmp r1, r0 - beq _081405AC - adds r0, 0x2 - cmp r1, r0 - bne _081405B6 - ldr r0, [r5] - ldrb r1, [r0, 0x2] - movs r2, 0x1 - b _081405B2 - .pool -_081405AC: - ldr r0, [r5] - ldrb r1, [r0, 0x2] - movs r2, 0x2 -_081405B2: - orrs r1, r2 - strb r1, [r0, 0x2] -_081405B6: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x5 - bls _0814056C - bl RtcCalcLocalTime - add sp, 0x8 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_8140470 - - thumb_func_start sub_81405CC -sub_81405CC: @ 81405CC - push {r4,r5,lr} - sub sp, 0xC - ldr r0, =gMain - movs r1, 0x87 - lsls r1, 3 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0x8 - bls _081405E0 - b _081407F8 -_081405E0: - lsls r0, 2 - ldr r1, =_081405F4 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081405F4: - .4byte _08140618 - .4byte _08140630 - .4byte _08140650 - .4byte _08140662 - .4byte _0814069C - .4byte _081406C0 - .4byte _081406E0 - .4byte _08140750 - .4byte _0814077A -_08140618: - movs r0, 0 - bl SetVBlankCallback - bl ScanlineEffect_Stop - bl SetVBlankHBlankCallbacksToNull - bl ResetVramOamAndBgCntRegs - bl ResetAllBgsCoordinates - b _081407F8 -_08140630: - bl sub_8140388 - bl DeactivateAllTextPrinters - movs r1, 0x90 - lsls r1, 6 - movs r0, 0x50 - bl SetGpuReg - ldr r1, =0x0000060a - movs r0, 0x52 - bl SetGpuReg - b _081407F8 - .pool -_08140650: - bl ResetPaletteFade - bl ResetSpriteData - bl ResetTasks - bl reset_temp_tile_data_buffers - b _081407F8 -_08140662: - ldr r0, =gUnknown_085B5BFC - movs r2, 0xE0 - lsls r2, 1 - movs r1, 0 - bl LoadPalette - ldr r1, =gRouletteMenuTiles - movs r4, 0 - str r4, [sp] - movs r0, 0x1 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - ldr r1, =gRouletteWheelTiles - str r4, [sp] - movs r0, 0x2 - movs r2, 0 - movs r3, 0 - bl decompress_and_copy_tile_data_to_vram - b _081407F8 - .pool -_0814069C: - bl free_temp_tile_data_buffers_if_possible - lsls r0, 24 - cmp r0, 0 - beq _081406A8 - b _08140806 -_081406A8: - bl sub_8140470 - ldr r1, =gUnknown_085B5FA0 - movs r0, 0x2 - movs r2, 0 - movs r3, 0 - bl CopyToBgTilemapBuffer - b _081407F8 - .pool -_081406C0: - movs r0, 0 - bl sub_8142C0C - bl sub_81439C8 - bl sub_814391C - bl sub_8143314 - bl sub_8142CD0 - bl sub_8142F7C - bl sub_81431E4 - b _081407F8 -_081406E0: - bl AnimateSprites - bl BuildOamBuffer - bl GetCoins - lsls r0, 16 - lsrs r0, 16 - bl sub_8143514 - movs r0, 0x6 - bl sub_814372C - movs r0, 0 - bl sub_81436D0 - movs r0, 0 - bl sub_81424FC - ldr r4, =gUnknown_0203AB8C - ldrb r0, [r4] - movs r1, 0 - bl NewMenuHelpers_DrawStdWindowFrame - ldrb r0, [r4] - ldr r2, =gUnknown_082A5B89 - movs r1, 0x1 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r5, 0 - str r5, [sp, 0x8] - movs r1, 0x1 - movs r3, 0 - bl AddTextPrinterParameterized - ldrb r0, [r4] - movs r1, 0x3 - bl CopyWindowToVram - ldr r1, =gSpriteCoordOffsetX - movs r2, 0x3C - negs r2, r2 - adds r0, r2, 0 - strh r0, [r1] - ldr r0, =gSpriteCoordOffsetY - strh r5, [r0] - b _081407F8 - .pool -_08140750: - movs r1, 0x82 - lsls r1, 5 - movs r0, 0 - bl SetGpuReg - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - movs r0, 0x2 - bl CopyBgTilemapBufferToVram - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - movs r0, 0x2 - bl ShowBg - b _081407F8 -_0814077A: - movs r0, 0x1 - bl EnableInterrupts - ldr r0, =sub_8140264 - bl SetVBlankCallback - movs r0, 0x1 - str r0, [sp] - movs r0, 0xFF - movs r1, 0 - movs r2, 0x10 - movs r3, 0 - bl BeginHardwarePaletteFade - ldr r0, =sub_81408A8 - movs r1, 0 - bl CreateTask - ldr r5, =gUnknown_0203AB88 - ldr r1, [r5] - adds r1, 0xA4 - strb r0, [r1] - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gTasks - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - adds r4, r1 - movs r0, 0x6 - strh r0, [r4, 0x14] - bl GetCoins - strh r0, [r4, 0x22] - bl GetCoins - lsls r0, 16 - lsrs r0, 16 - bl sub_80EDE84 - ldr r0, =sub_8140814 - movs r1, 0x1 - bl CreateTask - ldr r1, [r5] - adds r1, 0xA5 - strb r0, [r1] - ldr r0, =sub_8140238 - bl SetMainCallback2 - b _08140806 - .pool -_081407F8: - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_08140806: - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81405CC - - thumb_func_start sub_8140814 -sub_8140814: @ 8140814 - push {r4-r6,lr} - ldr r3, =gUnknown_0203AB88 - ldr r0, [r3] - adds r0, 0x21 - ldrb r2, [r0] - adds r1, r2, 0x1 - strb r1, [r0] - ldr r1, [r3] - adds r0, r1, 0 - adds r0, 0x23 - lsls r2, 24 - lsrs r2, 24 - adds r6, r3, 0 - ldrb r0, [r0] - cmp r2, r0 - bne _0814085A - adds r1, 0x21 - movs r0, 0 - strb r0, [r1] - ldr r2, [r6] - adds r3, r2, 0 - adds r3, 0x22 - ldrb r1, [r3] - ldrh r0, [r2, 0x24] - subs r0, r1 - strh r0, [r2, 0x24] - lsls r0, 16 - cmp r0, 0 - bge _0814085A - ldrb r1, [r3] - movs r3, 0xB4 - lsls r3, 1 - adds r0, r3, 0 - subs r0, r1 - strh r0, [r2, 0x24] -_0814085A: - adds r4, r6, 0 - ldr r0, [r4] - ldrh r0, [r0, 0x24] - bl Sin2 - lsls r0, 16 - lsrs r5, r0, 16 - ldr r0, [r4] - ldrh r0, [r0, 0x24] - bl Cos2 - lsls r0, 16 - lsrs r1, r0, 16 - lsls r0, r5, 16 - asrs r0, 16 - cmp r0, 0 - bge _0814087E - adds r0, 0xF -_0814087E: - lsls r0, 12 - lsrs r5, r0, 16 - ldr r3, [r6] - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0 - bge _0814088E - adds r0, 0xF -_0814088E: - asrs r0, 4 - strh r0, [r3, 0x32] - strh r0, [r3, 0x2C] - strh r5, [r3, 0x2E] - lsls r0, r5, 16 - asrs r0, 16 - negs r0, r0 - strh r0, [r3, 0x30] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140814 - - thumb_func_start sub_81408A8 -sub_81408A8: @ 81408A8 - push {r4,r5,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl UpdatePaletteFade - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0 - bne _081408FE - movs r1, 0x90 - lsls r1, 6 - movs r0, 0x50 - bl SetGpuReg - ldr r1, =0x00000808 - movs r0, 0x52 - bl SetGpuReg - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - strh r5, [r0, 0x14] - adds r0, r4, 0 - bl sub_8141FF4 - bl sub_8142070 - bl sub_8143A40 - movs r0, 0 - bl sub_81424FC - movs r0, 0x6 - bl sub_814372C - ldr r1, =sub_8140968 - ldr r2, =0x0000ffff - adds r0, r4, 0 - movs r3, 0x3 - bl sub_8141F7C -_081408FE: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81408A8 - - thumb_func_start sub_8140914 -sub_8140914: @ 8140914 - push {r4,r5,lr} - sub sp, 0xC - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl DisplayYesNoMenu - ldr r5, =gUnknown_0203AB8C - ldrb r0, [r5] - movs r1, 0 - bl NewMenuHelpers_DrawStdWindowFrame - ldrb r0, [r5] - ldr r2, =gUnknown_082A5C13 - 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, [r5] - movs r1, 0x3 - bl CopyWindowToVram - ldr r1, =gUnknown_085B6410 - adds r0, r4, 0 - bl sub_8121F68 - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140914 - - thumb_func_start sub_8140968 -sub_8140968: @ 8140968 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r0, 0 - movs r1, 0x1 - bl sub_819746C - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - ldr r1, =sub_8140BD0 - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140968 - - thumb_func_start sub_8140994 -sub_8140994: @ 8140994 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - adds r0, 0xA5 - ldrb r0, [r0] - bl DestroyTask - adds r0, r4, 0 - bl sub_8141DE4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140994 - - thumb_func_start sub_81409B8 -sub_81409B8: @ 81409B8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0xF - bls _081409CA - b _08140AE8 -_081409CA: - lsls r0, r4, 2 - ldr r1, =_081409D8 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_081409D8: - .4byte _08140A18 - .4byte _08140A3C - .4byte _08140A3C - .4byte _08140A3C - .4byte _08140A3C - .4byte _08140A90 - .4byte _08140AE8 - .4byte _08140AE8 - .4byte _08140AE8 - .4byte _08140AE8 - .4byte _08140A90 - .4byte _08140AE8 - .4byte _08140AE8 - .4byte _08140AE8 - .4byte _08140AE8 - .4byte _08140A90 -_08140A18: - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - movs r1, 0xBE - lsls r1, 1 - adds r0, r1 - movs r1, 0x10 - str r1, [sp] - movs r1, 0xD - str r1, [sp, 0x4] - movs r1, 0 - movs r2, 0xE - movs r3, 0x7 - bl sub_8152008 - b _08140B4E - .pool -_08140A3C: - lsls r0, r4, 1 - adds r0, r4 - adds r0, 0xE - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - ldr r5, =gUnknown_0203AB88 - ldr r0, [r5] - movs r4, 0xBE - lsls r4, 1 - adds r0, r4 - movs r1, 0x10 - str r1, [sp] - movs r6, 0xD - str r6, [sp, 0x4] - movs r1, 0 - movs r2, 0xE - movs r3, 0x7 - bl sub_8152008 - ldr r0, [r5] - adds r4, r0, r4 - ldr r1, =0x0000397c - adds r0, r1 - ldr r1, [r0] - ldr r0, =0x00000232 - adds r1, r0 - movs r0, 0x3 - str r0, [sp] - str r6, [sp, 0x4] - adds r0, r4, 0 - mov r2, r8 - movs r3, 0x7 - bl sub_8152058 - b _08140B4E - .pool -_08140A90: - subs r0, r4, 0x1 - movs r1, 0x5 - bl __divsi3 - lsls r1, r0, 1 - adds r1, r0 - adds r1, 0xA - lsls r1, 24 - lsrs r7, r1, 24 - ldr r5, =gUnknown_0203AB88 - ldr r0, [r5] - movs r4, 0xBE - lsls r4, 1 - adds r0, r4 - movs r6, 0x10 - str r6, [sp] - movs r1, 0xD - str r1, [sp, 0x4] - movs r1, 0 - movs r2, 0xE - movs r3, 0x7 - bl sub_8152008 - ldr r0, [r5] - adds r4, r0, r4 - ldr r1, =0x0000397c - adds r0, r1 - ldr r1, [r0] - movs r0, 0xA0 - lsls r0, 2 - adds r1, r0 - str r6, [sp] - movs r0, 0x3 - str r0, [sp, 0x4] - adds r0, r4, 0 - movs r2, 0xE - adds r3, r7, 0 - bl sub_8152058 - b _08140B4E - .pool -_08140AE8: - adds r0, r4, 0 - movs r1, 0x5 - bl __umodsi3 - lsls r0, 24 - lsrs r0, 24 - lsls r1, r0, 1 - adds r1, r0 - adds r1, 0xE - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - subs r0, r4, 0x1 - movs r1, 0x5 - bl __divsi3 - lsls r1, r0, 1 - adds r1, r0 - adds r1, 0x7 - lsls r1, 24 - lsrs r7, r1, 24 - ldr r5, =gUnknown_0203AB88 - ldr r0, [r5] - movs r4, 0xBE - lsls r4, 1 - adds r0, r4 - movs r1, 0x10 - str r1, [sp] - movs r1, 0xD - str r1, [sp, 0x4] - movs r1, 0 - movs r2, 0xE - movs r3, 0x7 - bl sub_8152008 - ldr r0, [r5] - adds r4, r0, r4 - ldr r1, =0x0000397c - adds r0, r1 - ldr r1, [r0] - movs r0, 0x88 - lsls r0, 2 - adds r1, r0 - movs r0, 0x3 - str r0, [sp] - str r0, [sp, 0x4] - adds r0, r4, 0 - mov r2, r8 - adds r3, r7, 0 - bl sub_8152058 -_08140B4E: - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81409B8 - - thumb_func_start sub_8140B64 -sub_8140B64: @ 8140B64 - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gTasks - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - adds r4, r1 - ldrb r0, [r4, 0x10] - bl sub_81436D0 - ldrb r0, [r4, 0x10] - bl sub_81409B8 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140B64 - - thumb_func_start sub_8140B8C -sub_8140B8C: @ 8140B8C - push {r4-r6,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r5, =gUnknown_0203AB88 - ldr r2, [r5] - movs r6, 0 - movs r1, 0x1 - strh r1, [r2, 0x28] - ldr r1, =gTasks - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - adds r4, r1 - ldrb r0, [r4, 0x10] - bl sub_81409B8 - ldr r0, [r5] - adds r0, 0x23 - movs r1, 0x2 - strb r1, [r0] - ldr r0, [r5] - adds r0, 0x21 - strb r6, [r0] - ldr r0, =sub_8141040 - str r0, [r4] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140B8C - - thumb_func_start sub_8140BD0 -sub_8140BD0: @ 8140BD0 - push {r4-r7,lr} - lsls r0, 24 - lsrs r6, r0, 24 - ldr r1, =gUnknown_0203AB88 - ldr r0, [r1] - ldr r2, [r0, 0x8] - movs r0, 0x20 - ands r0, r2 - cmp r0, 0 - beq _08140C30 - movs r3, 0xB - ldr r5, =gUnknown_085B6154 - adds r0, r5, 0 - adds r0, 0xE4 - ldr r0, [r0] - ands r2, r0 - ldr r0, =gTasks - mov r12, r0 - lsls r7, r6, 2 - cmp r2, 0 - beq _08140C6E - adds r4, r1, 0 - adds r5, 0x8 -_08140BFE: - lsls r0, r3, 16 - movs r1, 0x80 - lsls r1, 9 - adds r0, r1 - lsrs r3, r0, 16 - asrs r2, r0, 16 - cmp r2, 0xD - bgt _08140C6E - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 2 - adds r0, r5 - ldr r1, [r1, 0x8] - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - bne _08140BFE - b _08140C6E - .pool -_08140C30: - movs r3, 0x6 - ldr r5, =gUnknown_085B6154 - adds r0, r5, 0 - adds r0, 0x80 - ldr r0, [r0] - ands r2, r0 - ldr r0, =gTasks - mov r12, r0 - lsls r7, r6, 2 - cmp r2, 0 - beq _08140C6E - adds r4, r1, 0 - adds r5, 0x8 -_08140C4A: - lsls r0, r3, 16 - movs r1, 0x80 - lsls r1, 9 - adds r0, r1 - lsrs r3, r0, 16 - asrs r2, r0, 16 - cmp r2, 0x9 - bgt _08140C6E - ldr r1, [r4] - lsls r0, r2, 2 - adds r0, r2 - lsls r0, 2 - adds r0, r5 - ldr r1, [r1, 0x8] - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - bne _08140C4A -_08140C6E: - adds r4, r7, r6 - lsls r4, 3 - add r4, r12 - movs r5, 0 - strh r3, [r4, 0x10] - adds r0, r6, 0 - bl sub_8141FF4 - ldrb r0, [r4, 0x10] - bl sub_81424FC - ldrb r0, [r4, 0x10] - bl sub_81436D0 - ldrb r0, [r4, 0x10] - bl sub_8142284 - strh r5, [r4, 0xA] - ldr r0, =sub_8140B8C - str r0, [r4] - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140BD0 - - thumb_func_start sub_8140CA8 -sub_8140CA8: @ 8140CA8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x4 - adds r4, r0, 0 - lsls r1, 24 - lsrs r5, r1, 24 - movs r6, 0 - movs r7, 0 - ldr r1, =gUnknown_085B641E - mov r0, sp - movs r2, 0x4 - bl memcpy - ldrb r0, [r4] - mov r8, r0 - cmp r5, 0 - blt _08140D1C - cmp r5, 0x1 - bgt _08140CF4 - movs r1, 0 - ldrsh r0, [r4, r1] - movs r1, 0x5 - bl __modsi3 - lsls r0, 24 - lsrs r6, r0, 24 - movs r2, 0xF0 - lsls r2, 20 - adds r1, r0, r2 - lsrs r7, r1, 24 - cmp r0, 0 - bne _08140D1C - movs r6, 0x5 - b _08140D1C - .pool -_08140CF4: - cmp r5, 0x3 - bgt _08140D1C - movs r1, 0 - ldrsh r0, [r4, r1] - movs r1, 0x5 - bl __divsi3 - lsls r0, 16 - asrs r0, 16 - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 24 - lsrs r6, r1, 24 - movs r2, 0x80 - lsls r2, 19 - adds r0, r1, r2 - lsrs r7, r0, 24 - cmp r1, 0 - bne _08140D1C - movs r6, 0x1 -_08140D1C: - mov r1, sp - adds r0, r1, r5 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - ldrh r2, [r4] - adds r0, r2 - strh r0, [r4] - lsls r1, r6, 24 - asrs r3, r1, 24 - lsls r0, 16 - asrs r0, 16 - lsls r2, r7, 24 - cmp r0, r3 - bge _08140D3E - asrs r0, r2, 24 - strh r0, [r4] -_08140D3E: - movs r0, 0 - ldrsh r1, [r4, r0] - asrs r0, r2, 24 - cmp r1, r0 - ble _08140D4A - strh r3, [r4] -_08140D4A: - mov r1, r8 - lsls r0, r1, 24 - movs r2, 0 - ldrsh r1, [r4, r2] - asrs r0, 24 - cmp r1, r0 - bne _08140D5C - movs r0, 0 - b _08140D5E -_08140D5C: - movs r0, 0x1 -_08140D5E: - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_8140CA8 - - thumb_func_start sub_8140D6C -sub_8140D6C: @ 8140D6C - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - lsls r0, 24 - lsrs r7, r0, 24 - movs r0, 0 - mov r9, r0 - movs r5, 0 - ldr r4, =gMain - ldrh r1, [r4, 0x2E] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - beq _08140DA8 - movs r5, 0x1 - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r0, r1 - adds r0, 0x8 - movs r1, 0 - bl sub_8140CA8 - lsls r0, 24 - cmp r0, 0 - bne _08140DA8 - b _08140F3A -_08140DA8: - ldrh r1, [r4, 0x2E] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _08140DCE - movs r5, 0x1 - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r0, r1 - adds r0, 0x8 - movs r1, 0x1 - bl sub_8140CA8 - lsls r0, 24 - cmp r0, 0 - bne _08140DCE - b _08140F3A -_08140DCE: - ldrh r1, [r4, 0x2E] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _08140DF4 - movs r5, 0x1 - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r0, r1 - adds r0, 0x8 - movs r1, 0x2 - bl sub_8140CA8 - lsls r0, 24 - cmp r0, 0 - bne _08140DF4 - b _08140F3A -_08140DF4: - ldrh r1, [r4, 0x2E] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _08140E1A - movs r5, 0x1 - lsls r0, r7, 2 - adds r0, r7 - lsls r0, 3 - ldr r1, =gTasks + 0x8 - adds r0, r1 - adds r0, 0x8 - movs r1, 0x3 - bl sub_8140CA8 - lsls r0, 24 - cmp r0, 0 - bne _08140E1A - b _08140F3A -_08140E1A: - cmp r5, 0 - bne _08140E20 - b _08140F3A -_08140E20: - ldr r0, =gTasks - lsls r6, r7, 2 - adds r4, r6, r7 - lsls r4, 3 - adds r4, r0 - ldrb r0, [r4, 0x10] - bl sub_81424FC - adds r0, r7, 0 - bl sub_8140B64 - mov r1, r9 - strh r1, [r4, 0xA] - movs r0, 0x5 - bl PlaySE - ldr r5, =gUnknown_0203AB88 - ldr r0, [r5] - adds r0, 0xB8 - ldr r1, =0x0000ffff - bl sub_8151A9C - ldr r5, [r5] - movs r2, 0xB8 - lsls r2, 1 - adds r3, r5, r2 - ldrb r2, [r3] - movs r1, 0x7F - adds r0, r1, 0 - ands r0, r2 - strb r0, [r3] - movs r0, 0xB2 - lsls r0, 1 - adds r3, r5, r0 - ldrb r2, [r3] - adds r0, r1, 0 - ands r0, r2 - strb r0, [r3] - movs r0, 0xAC - lsls r0, 1 - adds r2, r5, r0 - ldrb r0, [r2] - ands r1, r0 - strb r1, [r2] - ldrb r0, [r4, 0x10] - bl sub_8142284 - movs r4, 0 - mov r9, r6 - ldr r1, =gSprites - mov r12, r1 - movs r2, 0x8 - add r2, r12 - mov r10, r2 -_08140E8C: - ldr r0, =gUnknown_0203AB88 - ldr r5, [r0] - adds r0, r4, 0 - adds r0, 0x29 - adds r6, r5, 0 - adds r6, 0x3C - adds r0, r6, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - mov r1, r12 - adds r3, r0, r1 - adds r2, r3, 0 - adds r2, 0x40 - add r0, r10 - ldr r0, [r0] - ldr r0, [r0] - ldrh r1, [r0] - ldrh r2, [r2] - adds r1, r2 - ldr r2, =0x000003ff - mov r8, r2 - mov r0, r8 - ands r1, r0 - ldrh r2, [r3, 0x4] - ldr r0, =0xfffffc00 - ands r0, r2 - orrs r0, r1 - strh r0, [r3, 0x4] - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x3 - bls _08140E8C - ldr r0, =gTasks - mov r2, r9 - adds r1, r2, r7 - lsls r1, 3 - adds r1, r0 - ldrh r3, [r1, 0x10] - subs r0, r3, 0x1 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0x3 - bhi _08140F3A - ldr r2, =gUnknown_085B6154 - movs r0, 0x10 - ldrsh r1, [r1, r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 2 - adds r2, 0x8 - adds r0, r2 - ldr r1, [r5, 0x8] - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - bne _08140F3A - subs r0, r3, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r9, r0 - adds r0, 0x29 - adds r0, r6, r0 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r1, =gSprites - adds r3, r0, r1 - adds r2, r3, 0 - adds r2, 0x40 - adds r1, 0x8 - adds r0, r1 - ldr r0, [r0] - ldr r0, [r0] - ldrh r1, [r0, 0x4] - ldrh r2, [r2] - adds r1, r2 - mov r2, r8 - ands r1, r2 - ldrh r2, [r3, 0x4] - ldr r0, =0xfffffc00 - ands r0, r2 - orrs r0, r1 - strh r0, [r3, 0x4] -_08140F3A: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140D6C - - thumb_func_start sub_8140F6C -sub_8140F6C: @ 8140F6C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - bl sub_80EECA4 - ldr r0, =gUnknown_0203AB88 - ldr r1, [r0] - movs r0, 0xFF - strh r0, [r1, 0x28] - ldrb r2, [r1, 0x19] - cmp r2, 0x1 - bne _08140F90 - adds r0, r1, 0 - adds r0, 0x23 - strb r2, [r0] - b _08140F96 - .pool -_08140F90: - adds r1, 0x23 - movs r0, 0 - strb r0, [r1] -_08140F96: - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - adds r0, 0x21 - movs r1, 0 - strb r1, [r0] - ldr r1, =gTasks - lsls r0, r4, 2 - adds r0, r4 - lsls r0, 3 - adds r0, r1 - movs r1, 0x20 - strh r1, [r0, 0xA] - ldr r1, =sub_81410FC - str r1, [r0] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140F6C - - thumb_func_start sub_8140FC4 -sub_8140FC4: @ 8140FC4 - push {r4,r5,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r4, =gUnknown_0203AB88 - ldr r2, [r4] - ldrb r1, [r2, 0x1A] - lsls r1, 28 - lsrs r1, 28 - adds r2, 0x1B - adds r2, r1 - ldr r3, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r5, r1, r3 - ldrh r0, [r5, 0x10] - strb r0, [r2] - ldr r1, [r4] - ldrb r0, [r1, 0x1A] - lsls r0, 28 - lsrs r0, 28 - adds r1, 0x1B - adds r1, r0 - ldrb r0, [r1] - bl sub_8142758 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r5, 0xC] - ldr r1, [r4] - ldrb r0, [r1, 0x1A] - lsls r0, 28 - lsrs r0, 28 - adds r1, 0x1B - adds r1, r0 - ldrb r0, [r1] - bl sub_81436D0 - ldr r0, [r4] - ldrb r1, [r0, 0x19] - ldrh r0, [r5, 0x22] - subs r0, r1 - strh r0, [r5, 0x22] - lsls r0, 16 - cmp r0, 0 - bge _08141024 - movs r0, 0 - strh r0, [r5, 0x22] -_08141024: - ldrh r0, [r5, 0x22] - bl sub_8143514 - ldr r0, =sub_8140F6C - str r0, [r5] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8140FC4 - - thumb_func_start sub_8141040 -sub_8141040: @ 8141040 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - adds r0, r5, 0 - bl sub_8140D6C - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - movs r1, 0xA - ldrsh r0, [r4, r1] - cmp r0, 0x1E - beq _08141076 - cmp r0, 0x1E - bgt _0814106C - cmp r0, 0 - beq _08141072 - b _0814108A - .pool -_0814106C: - cmp r0, 0x3B - beq _08141084 - b _0814108A -_08141072: - ldrb r0, [r4, 0x10] - b _08141078 -_08141076: - movs r0, 0 -_08141078: - bl sub_81409B8 - ldrh r0, [r4, 0xA] - adds r0, 0x1 - strh r0, [r4, 0xA] - b _0814109A -_08141084: - movs r0, 0 - strh r0, [r4, 0xA] - b _0814109A -_0814108A: - ldr r0, =gTasks - lsls r1, r5, 2 - adds r1, r5 - lsls r1, 3 - adds r1, r0 - ldrh r0, [r1, 0xA] - adds r0, 0x1 - strh r0, [r1, 0xA] -_0814109A: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _081410F2 - ldr r0, =gUnknown_0203AB88 - ldr r3, [r0] - ldr r2, =gUnknown_085B6154 - ldr r1, =gTasks - lsls r0, r5, 2 - adds r0, r5 - lsls r0, 3 - adds r4, r0, r1 - movs r0, 0x10 - ldrsh r1, [r4, r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 2 - adds r2, 0x8 - adds r0, r2 - ldr r1, [r3, 0x8] - ldr r0, [r0] - ands r1, r0 - cmp r1, 0 - beq _081410E8 - movs r0, 0x16 - bl PlaySE - b _081410F2 - .pool -_081410E8: - movs r0, 0x5F - bl m4aSongNumStart - ldr r0, =sub_8140FC4 - str r0, [r4] -_081410F2: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8141040 - - thumb_func_start sub_81410FC -sub_81410FC: @ 81410FC - push {r4,lr} - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gTasks - lsls r1, r0, 2 - adds r1, r0 - lsls r1, 3 - adds r4, r1, r2 - ldrh r0, [r4, 0xA] - subs r1, r0, 0x1 - strh r1, [r4, 0xA] - lsls r0, 16 - cmp r0, 0 - ble _08141168 - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0x2 - ble _08141128 - ldr r1, =gSpriteCoordOffsetX - ldrh r0, [r1] - adds r0, 0x2 - strh r0, [r1] -_08141128: - ldr r0, =gUnknown_0203AB88 - ldr r1, [r0] - ldrh r0, [r1, 0x26] - adds r0, 0x4 - strh r0, [r1, 0x26] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x68 - bne _08141180 - 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, =SpriteCallbackDummy - str r1, [r0] - b _08141180 - .pool -_08141168: - movs r0, 0x1 - movs r1, 0xFF - bl sub_8142E70 - movs r0, 0x1 - movs r1, 0xFF - bl sub_8143038 - ldr r0, =sub_8141344 - str r0, [r4] - movs r0, 0 - strh r0, [r4, 0xA] -_08141180: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81410FC - - thumb_func_start sub_814118C -sub_814118C: @ 814118C - push {r4,r5,lr} - lsls r0, 16 - lsrs r4, r0, 16 - lsls r1, 16 - lsrs r1, 16 - ldr r0, =gUnknown_0203AB88 - ldr r3, [r0] - ldrb r2, [r3, 0x2] - adds r5, r0, 0 - cmp r2, 0x2 - bgt _081411AC - cmp r2, 0x1 - bge _081411B2 - b _08141280 - .pool -_081411AC: - cmp r2, 0x3 - beq _08141214 - b _08141280 -_081411B2: - ldr r0, =gLocalTime - ldrb r0, [r0, 0x2] - subs r0, 0x4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x5 - bhi _081411E4 - cmp r4, 0xB - bls _081411CC - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08141296 -_081411CC: - ldr r0, =gUnknown_085B6348 - ldrb r1, [r3, 0x4] - lsls r1, 30 - lsrs r1, 25 - adds r1, r0 - ldrb r0, [r1, 0x2] - lsrs r0, 1 - b _0814133A - .pool -_081411E4: - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - bne _08141200 - ldr r0, =gUnknown_085B6348 - ldrb r1, [r3, 0x4] - lsls r1, 30 - lsrs r1, 25 - adds r1, r0 - ldrb r0, [r1, 0x2] - lsrs r0, 1 - b _0814133A - .pool -_08141200: - ldr r0, =gUnknown_085B6348 - ldrb r1, [r3, 0x4] - lsls r1, 30 - lsrs r1, 25 - adds r1, r0 - ldrb r0, [r1, 0x2] - b _0814133A - .pool -_08141214: - ldr r0, =gLocalTime - ldrb r0, [r0, 0x2] - subs r0, 0x4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x6 - bhi _08141248 - cmp r4, 0x5 - bls _0814122E - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08141296 -_0814122E: - ldr r0, =gUnknown_085B6348 - ldrb r1, [r3, 0x4] - lsls r1, 30 - lsrs r1, 25 - adds r1, r0 - ldrb r0, [r1, 0x2] - lsrs r0, 1 - b _0814133A - .pool -_08141248: - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _08141268 - cmp r4, 0x6 - bls _08141268 - ldr r0, =gUnknown_085B6348 - ldrb r1, [r3, 0x4] - lsls r1, 30 - lsrs r1, 25 - adds r1, r0 - ldrb r0, [r1, 0x2] - lsrs r0, 2 - b _0814133A - .pool -_08141268: - ldr r1, =gUnknown_085B6348 - ldr r0, [r5] - ldrb r0, [r0, 0x4] - lsls r0, 30 - lsrs r0, 25 - adds r0, r1 - ldrb r0, [r0, 0x2] - lsrs r0, 1 - b _0814133A - .pool -_08141280: - ldr r0, =gLocalTime - ldrb r0, [r0, 0x2] - subs r0, 0x4 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x5 - bhi _081412B8 - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - bne _081412A0 -_08141296: - movs r0, 0x1 - b _0814133A - .pool -_081412A0: - ldr r1, =gUnknown_085B6348 - ldr r0, [r5] - ldrb r0, [r0, 0x4] - lsls r0, 30 - lsrs r0, 25 - adds r0, r1 - ldrb r0, [r0, 0x2] - lsrs r0, 1 - b _0814133A - .pool -_081412B8: - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - bne _081412F0 - cmp r4, 0xC - bls _081412DC - ldr r1, =gUnknown_085B6348 - ldr r0, [r5] - ldrb r0, [r0, 0x4] - lsls r0, 30 - lsrs r0, 25 - adds r0, r1 - ldrb r0, [r0, 0x2] - lsrs r0, 1 - b _0814133A - .pool -_081412DC: - ldr r1, =gUnknown_085B6348 - ldr r0, [r5] - ldrb r0, [r0, 0x4] - lsls r0, 30 - lsrs r0, 25 - adds r0, r1 - ldrb r0, [r0, 0x2] - b _0814133A - .pool -_081412F0: - movs r0, 0x80 - lsls r0, 8 - ands r0, r1 - cmp r0, 0 - beq _08141328 - cmp r4, 0xC - bls _08141314 - ldr r1, =gUnknown_085B6348 - ldr r0, [r5] - ldrb r0, [r0, 0x4] - lsls r0, 30 - lsrs r0, 25 - adds r0, r1 - ldrb r0, [r0, 0x2] - b _0814133A - .pool -_08141314: - ldr r1, =gUnknown_085B6348 - ldr r0, [r5] - ldrb r0, [r0, 0x4] - lsls r0, 30 - lsrs r0, 25 - adds r0, r1 - ldrb r0, [r0, 0x1] - b _0814133A - .pool -_08141328: - ldr r1, =gUnknown_085B6348 - ldr r0, [r5] - ldrb r0, [r0, 0x4] - lsls r0, 30 - lsrs r0, 25 - adds r0, r1 - ldrb r0, [r0, 0x1] - lsls r0, 25 - lsrs r0, 24 -_0814133A: - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_814118C - - thumb_func_start sub_8141344 -sub_8141344: @ 8141344 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - movs r4, 0 - ldr r1, =gUnknown_085B6422 - mov r0, sp - movs r2, 0x8 - bl memcpy - bl Random - lsls r0, 16 - lsrs r7, r0, 16 - adds r0, r7, 0 - movs r1, 0x64 - bl __umodsi3 - lsls r0, 16 - lsrs r6, r0, 16 - ldr r3, =gUnknown_0203AB88 - ldr r0, [r3] - ldr r2, =gTasks - mov r5, r10 - lsls r1, r5, 2 - add r1, r10 - lsls r1, 3 - adds r1, r2 - ldrh r2, [r1, 0x14] - adds r0, 0x7C - strb r2, [r0] - ldr r0, [r3] - adds r2, r0, 0 - adds r2, 0x7F - strb r4, [r2] - subs r2, 0x1 - strb r4, [r2] - adds r0, 0x7D - strb r4, [r0] - ldrh r0, [r1, 0x18] - adds r1, r7, 0 - bl sub_814118C - adds r4, r0, 0 - lsls r4, 24 - lsrs r1, r4, 24 - adds r0, r7, 0 - bl __modsi3 - lsrs r4, 25 - subs r0, r4 - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gLocalTime - ldrb r0, [r0, 0x2] - lsls r0, 24 - asrs r0, 24 - movs r5, 0x1 - cmp r0, 0xC - bgt _081413C8 - movs r5, 0 -_081413C8: - cmp r6, 0x4F - bhi _081413E0 - lsls r0, r5, 25 - b _081413EA - .pool -_081413E0: - lsls r1, r5, 24 - asrs r1, 24 - movs r0, 0x1 - subs r0, r1 - lsls r0, 25 -_081413EA: - lsrs r5, r0, 24 - ldr r0, _08141530 @ =gUnknown_0203AB88 - ldr r6, [r0] - ldrb r0, [r6, 0x4] - lsls r0, 30 - lsrs r0, 25 - ldr r1, _08141534 @ =gUnknown_085B6348 - adds r0, r1 - lsls r4, 24 - asrs r4, 24 - ldrh r0, [r0, 0x1A] - adds r4, r0 - adds r0, r6, 0 - adds r0, 0x80 - strh r4, [r0] - lsls r4, 16 - asrs r4, 16 - adds r0, r4, 0 - bl __floatsisf - cmp r4, 0 - bge _0814141C - ldr r1, _08141538 @ =0x47800000 - bl __addsf3 -_0814141C: - ldr r1, _0814153C @ =0x40A00000 - bl __divsf3 - bl __fixunssfsi - lsls r0, 16 - lsrs r4, r0, 16 - lsls r0, r4, 1 - adds r0, r4 - movs r2, 0x82 - adds r2, r6 - mov r8, r2 - strh r0, [r2] - adds r0, r6, 0 - adds r0, 0x84 - strh r4, [r0] - adds r0, 0x2 - strh r4, [r0] - movs r0, 0x88 - adds r0, r6 - mov r9, r0 - movs r0, 0x1 - ands r0, r7 - lsls r1, r5, 24 - asrs r1, 24 - adds r0, r1 - lsls r0, 1 - add r0, sp - movs r1, 0 - ldrsh r4, [r0, r1] - adds r0, r4, 0 - bl __floatsisf - cmp r4, 0 - bge _08141468 - ldr r1, _08141538 @ =0x47800000 - bl __addsf3 -_08141468: - mov r2, r9 - str r0, [r2] - adds r7, r6, 0 - adds r7, 0x8C - ldrb r0, [r6, 0x4] - lsls r0, 30 - lsrs r0, 25 - ldr r5, _08141534 @ =gUnknown_085B6348 - adds r0, r5 - movs r1, 0x18 - ldrsh r4, [r0, r1] - adds r0, r4, 0 - bl __floatsisf - adds r5, r0, 0 - cmp r4, 0 - bge _08141492 - ldr r1, _08141538 @ =0x47800000 - bl __addsf3 - adds r5, r0, 0 -_08141492: - str r5, [r7] - adds r7, r6, 0 - adds r7, 0x90 - ldr r1, _08141540 @ =0x3F000000 - adds r0, r5, 0 - bl __mulsf3 - adds r1, r5, 0 - bl __subsf3 - adds r5, r0, 0 - mov r2, r8 - movs r0, 0 - ldrsh r4, [r2, r0] - adds r0, r4, 0 - bl __floatsisf - adds r2, r0, 0 - cmp r4, 0 - bge _081414C2 - ldr r1, _08141538 @ =0x47800000 - bl __addsf3 - adds r2, r0, 0 -_081414C2: - adds r0, r5, 0 - adds r1, r2, 0 - bl __divsf3 - str r0, [r7] - adds r1, r6, 0 - adds r1, 0x94 - ldr r0, _08141544 @ =0x42880000 - str r0, [r1] - adds r1, 0x8 - ldr r0, _08141548 @ =0x00000000 - str r0, [r1] - adds r5, r6, 0 - adds r5, 0x98 - mov r1, r8 - movs r2, 0 - ldrsh r4, [r1, r2] - adds r0, r4, 0 - bl __floatsisf - adds r2, r0, 0 - cmp r4, 0 - bge _081414F8 - ldr r1, _08141538 @ =0x47800000 - bl __addsf3 - adds r2, r0, 0 -_081414F8: - ldr r0, _0814154C @ =0x41000000 - adds r1, r2, 0 - bl __divsf3 - bl __negsf2 - str r0, [r5] - adds r1, r6, 0 - adds r1, 0xA0 - ldr r0, _08141550 @ =0x42100000 - str r0, [r1] - ldr r1, _08141554 @ =gTasks - mov r5, r10 - lsls r0, r5, 2 - add r0, r10 - lsls r0, 3 - adds r0, r1 - ldr r1, _08141558 @ =sub_814155C - str r1, [r0] - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08141530: - .4byte gUnknown_0203AB88 -_08141534: - .4byte gUnknown_085B6348 -_08141538: - .4byte 0x47800000 -_0814153C: - .4byte 0x40A00000 -_08141540: - .4byte 0x3F000000 -_08141544: - .4byte 0x42880000 -_08141548: - .4byte 0x00000000 -_0814154C: - .4byte 0x41000000 -_08141550: - .4byte 0x42100000 -_08141554: - .4byte gTasks -_08141558: - .4byte sub_814155C - thumb_func_end sub_8141344 - thumb_func_start sub_814155C sub_814155C: @ 814155C push {r4,lr} @@ -4505,7 +2294,7 @@ sub_81428C4: @ 81428C4 bl DisplayYesNoMenu ldr r1, =gUnknown_085B6408 adds r0, r4, 0 - bl sub_8121F68 + bl DoYesNoFuncWithChoice pop {r4} pop {r0} bx r0 diff --git a/include/menu_helpers.h b/include/menu_helpers.h index ee8501d18..63af4c731 100644 --- a/include/menu_helpers.h +++ b/include/menu_helpers.h @@ -20,7 +20,7 @@ void ResetAllBgsCoordinates(void); void SetVBlankHBlankCallbacksToNull(void); void DisplayMessageAndContinueTask(u8 taskId, u8 windowId, u16 arg2, u8 arg3, u8 fontId, u8 textSpeed, const u8 *string, void *taskFunc); bool16 RunTextPrintersRetIsActive(u8 textPrinterId); -void sub_8121F68(u8 taskId, const struct YesNoFuncTable *data); +void DoYesNoFuncWithChoice(u8 taskId, const struct YesNoFuncTable *data); void CreateYesNoMenuWithCallbacks(u8 taskId, const struct WindowTemplate *template, u8 arg2, u8 arg3, u8 arg4, u16 tileStart, u8 palette, const struct YesNoFuncTable *yesNo); bool8 AdjustQuantityAccordingToDPadInput(s16 *arg0, u16 arg1); u8 GetLRKeysState(void); diff --git a/include/roulette_util.h b/include/roulette_util.h index 7f0b9cbf8..4542b73c6 100644 --- a/include/roulette_util.h +++ b/include/roulette_util.h @@ -1,6 +1,8 @@ #ifndef GUARD_ROULETTE_UTIL_H #define GUARD_ROULETTE_UTIL_H +#include "roulette.h" + struct PulseBlendSettings { u16 blendColor; @@ -41,5 +43,9 @@ void UnmarkUsedPulseBlendPalettes(struct PulseBlend *, u16, u8); void UpdatePulseBlend(struct PulseBlend *); void sub_8152008(u16 *dest, u16 src, u8 left, u8 top, u8 width, u8 height); void sub_8152058(u16 *dest, u16 *src, u8 left, u8 top, u8 width, u8 height); +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); #endif // GUARD_ROULETTE_UTIL_H diff --git a/include/strings.h b/include/strings.h index 7c6ca14ba..7a23e2e0f 100644 --- a/include/strings.h +++ b/include/strings.h @@ -1990,4 +1990,7 @@ extern const u8 gText_XSentOverY[]; extern const u8 gText_TakeGoodCareOfX[]; extern const u8 gText_CommunicationStandby5[]; +// roulette +extern const u8 gUnknown_082A5B89[]; + #endif //GUARD_STRINGS_H diff --git a/ld_script.txt b/ld_script.txt index 660c1d60d..d60e18c55 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -206,6 +206,7 @@ SECTIONS { src/battle_records.o(.text); src/pokedex_area_screen.o(.text); src/evolution_scene.o(.text); + src/roulette.o(.text); asm/roulette.o(.text); src/pokedex_cry_screen.o(.text); src/coins.o(.text); diff --git a/src/decoration.c b/src/decoration.c index 438f2cbd1..c4c3d6171 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -1629,7 +1629,7 @@ void sub_8128950(u8 taskId) void sub_81289D0(u8 taskId) { DisplayYesNoMenu(); - sub_8121F68(taskId, &gUnknown_085A72C4); + DoYesNoFuncWithChoice(taskId, &gUnknown_085A72C4); } void sub_81289F0(u8 taskId) @@ -1694,7 +1694,7 @@ void sub_8128AAC(u8 taskId) void sub_8128B80(u8 taskId) { DisplayYesNoMenu(); - sub_8121F68(taskId, &gUnknown_085A72CC); + DoYesNoFuncWithChoice(taskId, &gUnknown_085A72CC); } void sub_8128BA0(u8 taskId) @@ -2589,7 +2589,7 @@ void sub_812A0E8(u8 taskId) void sub_812A1A0(u8 taskId) { DisplayYesNoMenu(); - sub_8121F68(taskId, &gUnknown_085A7348); + DoYesNoFuncWithChoice(taskId, &gUnknown_085A7348); } void sub_812A1C0(u8 taskId) @@ -2602,7 +2602,7 @@ void sub_812A1C0(u8 taskId) void sub_812A1F0(u8 taskId) { DisplayYesNoMenu(); - sub_8121F68(taskId, &gUnknown_085A7350); + DoYesNoFuncWithChoice(taskId, &gUnknown_085A7350); } void sub_812A210(u8 taskId) @@ -2726,7 +2726,7 @@ void sub_812A3D4(u8 taskId) void sub_812A458(u8 taskId) { DisplayYesNoMenu(); - sub_8121F68(taskId, &gUnknown_085A741C); + DoYesNoFuncWithChoice(taskId, &gUnknown_085A741C); } void sub_812A478(u8 taskId) diff --git a/src/menu_helpers.c b/src/menu_helpers.c index 0adc6228e..e6547b300 100644 --- a/src/menu_helpers.c +++ b/src/menu_helpers.c @@ -152,7 +152,7 @@ static void Task_ContinueTaskAfterMessagePrints(u8 taskId) gUnknown_0300117C(taskId); } -void sub_8121F68(u8 taskId, const struct YesNoFuncTable *data) +void DoYesNoFuncWithChoice(u8 taskId, const struct YesNoFuncTable *data) { gUnknown_0203A138 = *data; gTasks[taskId].func = Task_CallYesOrNoCallback; diff --git a/src/roulette.c b/src/roulette.c new file mode 100644 index 000000000..8a483e123 --- /dev/null +++ b/src/roulette.c @@ -0,0 +1,1053 @@ +#include "global.h" +#include "alloc.h" +#include "bg.h" +#include "coins.h" +#include "event_data.h" +#include "gpu_regs.h" +#include "m4a.h" +#include "main.h" +#include "menu.h" +#include "menu_helpers.h" +#include "palette.h" +#include "random.h" +#include "roulette.h" +#include "roulette_util.h" +#include "rtc.h" +#include "scanline_effect.h" +#include "sound.h" +#include "sprite.h" +#include "task.h" +#include "trig.h" +#include "tv.h" +#include "window.h" +#include "constants/species.h" +#include "constants/songs.h" + +struct StructgUnknown_083F8DF4 +{ + u8 var00; + u8 var01; + u8 var02; + u8 var03; + u8 var04; + u8 v[0x3]; + u16 var08; + u16 var0A; + u16 var0C; + u16 v13[0x1]; + u16 var10; + u16 var12; + u16 var14; + u8 v1[0x2]; + u16 var18; + u16 var1A; + float var1C; +}; + +struct StructgUnknown_083F8C00 +{ + u8 var00; + u8 var01_0:4; + u8 var01_4:4; + u8 var02; + u8 var03; + u8 var04; + u8 var05; + u8 var06; + u8 var07; + u32 var08; + u32 var0C; + u16 var10; + u16 var12; +}; + +extern struct Roulette +{ + u8 var00; + u8 var01; + u8 var02; + u8 var03_0:5; + u8 var03_5:1; + u8 var03_6:1; + u8 var03_7:1; + u8 var04_0:2; + u8 var04_2:5; + u8 var04_7:1; + u32 var08; + u8 var0C[0x6]; + u8 var12[0x4]; + u8 var16[0x3]; + u8 var19; + u8 var1A_0:4; + u8 var1A_4:4; + u8 var1B[0x6]; + u8 var21; + u8 var22; + u8 var23; + s16 var24; + s16 var26; + s16 var28; + s16 var2A; + struct OamMatrix var2C; + u16 var34; + struct Sprite *var38; + u8 var3C[0x40]; // Sprite IDs + u8 var7C; + u8 var7D; + u8 var7E; + u8 var7F; + s16 var80; + s16 var82; + s16 var84; + s16 var86; + float var88; + float var8C; + float var90; + float var94; + float var98; + float var9C; + float varA0; + u8 varA4; + u8 varA5; + u8 v51[0x2]; + u16 varA8; + u16 varAA; + TaskFunc varAC; + u8 v46[0x4]; + TaskFunc varB4; + struct UnkStruct0 varB8; + u16 tilemapBuffers[7][0x400]; + u16 *unk_397C; +} *gUnknown_0203AB88; +extern u8 gUnknown_0203AB8C; + +/*static*/ void sub_8140814(u8); +/*static*/ void sub_81408A8(u8); +/*static*/ void sub_8140968(u8); +/*static*/ void sub_8140BD0(u8); +/*static*/ void sub_8141040(u8); +/*static*/ void sub_81410FC(u8); +/*static*/ void sub_8141344(u8); +/*static*/ void sub_814155C(u8); +/*static*/ void sub_8141DE4(u8); +/*static*/ void sub_8141F7C(u8 taskId, TaskFunc r1, u16 r2, u16 r3); +/*static*/ void sub_8141FF4(u8); +/*static*/ void sub_8142070(void); +/*static*/ void sub_8142284(u8); +/*static*/ void sub_81424FC(u8); +/*static*/ u8 sub_8142758(u8); +/*static*/ void sub_8142814(void); +/*static*/ void sub_8142C0C(u8); +/*static*/ void sub_8142CD0(void); +/*static*/ void sub_8142E70(u8, u8); +/*static*/ void sub_8142F7C(void); +/*static*/ void sub_8143038(u8, 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_814391C(void); +/*static*/ void sub_81439C8(void); +/*static*/ void sub_8143A40(void); + +extern const struct BgTemplate gUnknown_085B6140[3]; +extern const struct WindowTemplate gUnknown_085B614C[]; +extern const u32 gUnknown_085B5DFC[]; +extern const u16 gUnknown_085B6418[]; +extern const struct StructgUnknown_083F8DF4 gUnknown_085B6348[]; +extern const u8 gUnknown_085B6344[]; +extern const struct UnkStruct1 gUnknown_085B6388[]; +extern const u16 gUnknown_085B5BFC[]; +extern const u32 gRouletteMenuTiles[]; +extern const u32 gRouletteWheelTiles[]; +extern const u32 gUnknown_085B5FA0[]; +extern const u8 gUnknown_082A5B89[]; +extern const u8 gUnknown_082A5C13[]; +extern const struct YesNoFuncTable gUnknown_085B6410; +extern const struct StructgUnknown_083F8C00 gUnknown_085B6154[]; +extern const u8 gUnknown_085B641E[]; +extern const u16 gUnknown_085B6422; + +void sub_8140238(void) +{ + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + if (gUnknown_0203AB88->varB8.var00) + task_tutorial_controls_fadein(&gUnknown_0203AB88->varB8); +} + +void sub_8140264(void) +{ + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); + sub_8142814(); + SetGpuReg(REG_OFFSET_BG1HOFS, 0x200 - gUnknown_0203AB88->var26); + if (gUnknown_0203AB88->var01) + SetGpuReg(REG_OFFSET_BLDALPHA, gUnknown_0203AB88->var34); + if (gUnknown_0203AB88->var2A != 0) + { + DmaCopy16(3, &gUnknown_0203AB88->tilemapBuffers[2][0xE0], (void *)BG_SCREEN_ADDR(4) + 0x1C0, 0x340); + gUnknown_0203AB88->var2A = 0; + } + switch (gUnknown_0203AB88->var28) + { + case 1: + SetBgAttribute(0, BG_ATTR_CHARBASEINDEX, 0); + ShowBg(0); + DmaCopy16(3, &gUnknown_0203AB88->tilemapBuffers[0][0xE0], (void *)BG_SCREEN_ADDR(31) + 0x1C0, 0x340); + gUnknown_0203AB88->var28 = 2; + break; + case 2: + DmaCopy16(3, &gUnknown_0203AB88->tilemapBuffers[0][0xE0], (void *)BG_SCREEN_ADDR(31) + 0x1C0, 0x340); + break; + case 0xFF: + SetBgAttribute(0, BG_ATTR_CHARBASEINDEX, 2); + ShowBg(0); + DmaFill16(3, 0, (void *)BG_SCREEN_ADDR(31) + 0x1C0, 0x340); + gUnknown_0203AB88->var28 = 0; + case 0: + break; + } +} + +void sub_8140388(void) +{ + u32 size = 0; + + gUnknown_0203AB88 = AllocZeroed(sizeof(*gUnknown_0203AB88)); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(1, gUnknown_085B6140, ARRAY_COUNT(gUnknown_085B6140)); + SetBgTilemapBuffer(0, gUnknown_0203AB88->tilemapBuffers[0]); + SetBgTilemapBuffer(1, gUnknown_0203AB88->tilemapBuffers[2]); + SetBgTilemapBuffer(2, gUnknown_0203AB88->tilemapBuffers[6]); + InitWindows(gUnknown_085B614C); + sub_8197200(); + gUnknown_0203AB8C = 0; + gUnknown_0203AB88->unk_397C = malloc_and_decompress(gUnknown_085B5DFC, &size); +} + +void sub_8140418(void) +{ + FREE_AND_SET_NULL(gUnknown_0203AB88->unk_397C); + FreeAllWindowBuffers(); + UnsetBgTilemapBuffer(0); + UnsetBgTilemapBuffer(1); + UnsetBgTilemapBuffer(2); + ResetBgsAndClearDma3BusyFlags(0); + memset(gUnknown_0203AB88, 0, sizeof(*gUnknown_0203AB88)); + FREE_AND_SET_NULL(gUnknown_0203AB88); +} + +void sub_8140470(void) +{ + u8 i; + u16 arr[3]; // the third is never used ? + + memcpy(arr, &gUnknown_085B6418, sizeof(arr)); + gUnknown_0203AB88->var04_0 = (gSpecialVar_0x8004 & 1); + + if (gSpecialVar_0x8004 & 0x80) + gUnknown_0203AB88->var04_7 = 1; + + gUnknown_0203AB88->var22 = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var03; + gUnknown_0203AB88->var23 = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var04; + gUnknown_0203AB88->var19 = gUnknown_085B6344[gUnknown_0203AB88->var04_0 + gUnknown_0203AB88->var04_7 * 2]; + gUnknown_0203AB88->var1A_4 = 1; + + if (gUnknown_0203AB88->var19 == 1) + gPlttBufferUnfaded[0] = gPlttBufferUnfaded[0x51] = gPlttBufferFaded[0] = gPlttBufferFaded[0x51] = arr[0]; + else + gPlttBufferUnfaded[0] = gPlttBufferUnfaded[0x51] = gPlttBufferFaded[0] = gPlttBufferFaded[0x51] = arr[1]; + + sub_8151678(&gUnknown_0203AB88->varB8); + + for (i = 0; i < 13; i++) + { + sub_815168C(&gUnknown_0203AB88->varB8, i, &gUnknown_085B6388[i]); + } + + for (i = 0; i < PARTY_SIZE; i++) + { + switch (GetMonData(&gPlayerParty[i], MON_DATA_SPECIES2)) + { + case SPECIES_SHROOMISH: + gUnknown_0203AB88->var02 |= 0x1; + break; + case SPECIES_TAILLOW: + gUnknown_0203AB88->var02 |= 0x2; + break; + } + } + RtcCalcLocalTime(); +} + +void sub_81405CC(void) +{ + u8 taskId; + + switch (gMain.state) + { + case 0: + SetVBlankCallback(NULL); + ScanlineEffect_Stop(); + SetVBlankHBlankCallbacksToNull(); + ResetVramOamAndBgCntRegs(); + ResetAllBgsCoordinates(); + break; + case 1: + sub_8140388(); + DeactivateAllTextPrinters(); + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_NONE | + BLDCNT_TGT2_BG2 | + BLDCNT_TGT2_BD); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(10, 6)); + break; + case 2: + ResetPaletteFade(); + ResetSpriteData(); + ResetTasks(); + reset_temp_tile_data_buffers(); + break; + case 3: + LoadPalette(&gUnknown_085B5BFC, 0, 0x1C0); + decompress_and_copy_tile_data_to_vram(1, gRouletteMenuTiles, 0, 0, 0); + decompress_and_copy_tile_data_to_vram(2, gRouletteWheelTiles, 0, 0, 0); + break; + case 4: + if (free_temp_tile_data_buffers_if_possible()) + return; + + sub_8140470(); + CopyToBgTilemapBuffer(2, gUnknown_085B5FA0, 0, 0); + break; + case 5: + sub_8142C0C(0); + sub_81439C8(); + sub_814391C(); + sub_8143314(); + sub_8142CD0(); + sub_8142F7C(); + sub_81431E4(); + break; + case 6: + AnimateSprites(); + BuildOamBuffer(); + sub_8143514(GetCoins()); + sub_814372C(6); + sub_81436D0(0); + sub_81424FC(0); + NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE); + AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5B89, 0, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(gUnknown_0203AB8C, 3); + gSpriteCoordOffsetX = -0x3C; + gSpriteCoordOffsetY = 0x0; + break; + case 7: + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | + DISPCNT_OBJ_1D_MAP | + DISPCNT_OBJ_ON); + CopyBgTilemapBufferToVram(1); + CopyBgTilemapBufferToVram(2); + ShowBg(0); + ShowBg(1); + ShowBg(2); + break; + case 8: + EnableInterrupts(INTR_FLAG_VBLANK); + SetVBlankCallback(sub_8140264); + BeginHardwarePaletteFade(0xFF, 0, 16, 0, 1); + taskId = gUnknown_0203AB88->varA4 = CreateTask(sub_81408A8, 0); + gTasks[taskId].data[6] = 6; + gTasks[taskId].data[13] = GetCoins(); + sub_80EDE84(GetCoins()); + gUnknown_0203AB88->varA5 = CreateTask(sub_8140814, 1); + SetMainCallback2(sub_8140238); + return; + } + gMain.state++; +} + +void sub_8140814(u8 unused) +{ + s16 sin; + s16 cos; + + if (gUnknown_0203AB88->var21++ == gUnknown_0203AB88->var23) + { + gUnknown_0203AB88->var21 = 0; + if ((gUnknown_0203AB88->var24 -= gUnknown_0203AB88->var22) < 0) + gUnknown_0203AB88->var24 = 360 - gUnknown_0203AB88->var22; + } + sin = Sin2(gUnknown_0203AB88->var24); + cos = Cos2(gUnknown_0203AB88->var24); + sin = sin / 16; + gUnknown_0203AB88->var2C.a = gUnknown_0203AB88->var2C.d = cos / 16; + gUnknown_0203AB88->var2C.b = sin; + gUnknown_0203AB88->var2C.c = -sin; +} + +void sub_81408A8(u8 taskId) +{ + if (UpdatePaletteFade() == 0) + { + SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_NONE | + BLDCNT_TGT2_BG2 | + BLDCNT_TGT2_BD); + SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(8, 8)); + gTasks[taskId].data[6] = 0; + sub_8141FF4(taskId); + sub_8142070(); + sub_8143A40(); + sub_81424FC(0); + sub_814372C(6); + sub_8141F7C(taskId, sub_8140968, 0xFFFF, 0x3); + } +} + +void sub_8140914(u8 taskId) +{ + DisplayYesNoMenu(); + NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, 0); + AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5C13, 0, 1, TEXT_SPEED_FF, 0); + CopyWindowToVram(gUnknown_0203AB8C, 3); + DoYesNoFuncWithChoice(taskId, &gUnknown_085B6410); +} + +void sub_8140968(u8 taskId) +{ + sub_819746C(0, TRUE); + gTasks[taskId].func = sub_8140BD0; +} + +void sub_8140994(u8 taskId) +{ + DestroyTask(gUnknown_0203AB88->varA5); + sub_8141DE4(taskId); +} + +void sub_81409B8(u8 r0) +{ + u8 temp0, temp1; + switch (r0) + { + case 0: + sub_8152008(&gUnknown_0203AB88->tilemapBuffers[0][0], 0, 14, 7, 16, 13); + break; + case 1: + case 2: + case 3: + case 4: + temp0 = (r0 * 3 + 14); + sub_8152008(&gUnknown_0203AB88->tilemapBuffers[0][0], 0, 14, 7, 16, 13); + sub_8152058(&gUnknown_0203AB88->tilemapBuffers[0][0], &gUnknown_0203AB88->unk_397C[281], temp0, 7, 3, 13); + break; + case 0x5: + case 0xA: + case 0xF: + temp1 = ((r0 - 1) / 5 * 3 + 10); + sub_8152008(&gUnknown_0203AB88->tilemapBuffers[0][0], 0, 14, 7, 16, 13); + sub_8152058(&gUnknown_0203AB88->tilemapBuffers[0][0], &gUnknown_0203AB88->unk_397C[320], 14, temp1, 16, 3); + break; + default: + temp0 = ((r0 % 5) * 3 + 14); + temp1 = ((r0 - 1) / 5 * 3 + 7); + sub_8152008(&gUnknown_0203AB88->tilemapBuffers[0][0], 0, 14, 7, 16, 13); + sub_8152058(&gUnknown_0203AB88->tilemapBuffers[0][0], &gUnknown_0203AB88->unk_397C[272], temp0, temp1, 3, 3); + break; + } +} + +void sub_8140B64(u8 taskId) +{ + sub_81436D0(gTasks[taskId].data[4]); + sub_81409B8(gTasks[taskId].data[4]); +} + +void sub_8140B8C(u8 taskId) +{ + gUnknown_0203AB88->var28 = 1; + sub_81409B8(gTasks[taskId].data[4]); + gUnknown_0203AB88->var23 = 2; + gUnknown_0203AB88->var21 = 0; + gTasks[taskId].func = sub_8141040; +} + +void sub_8140BD0(u8 taskId) +{ + s16 i; + + if (gUnknown_0203AB88->var08 & 0x20) + { + for (i = 11; i < 14; i++) + { + if ((gUnknown_0203AB88->var08 & gUnknown_085B6154[i].var08) == 0) + break; + } + } + else + { + for (i = 6; i < 10; i++) + { + if ((gUnknown_0203AB88->var08 & gUnknown_085B6154[i].var08) == 0) + break; + } + } + gTasks[taskId].data[4] = i; + sub_8141FF4(taskId); + sub_81424FC(gTasks[taskId].data[4]); + sub_81436D0(gTasks[taskId].data[4]); + sub_8142284(gTasks[taskId].data[4]); + gTasks[taskId].data[1] = 0; + gTasks[taskId].func = sub_8140B8C; +} + +u8 sub_8140CA8(s16 *r0, u8 r1) +{ + s8 temp1 = 0; + s8 temp = 0; + s8 arr[4]; + s8 t; + + memcpy(&arr, gUnknown_085B641E, sizeof(arr)); + t = *r0; + + switch (r1) + { + case 0: + case 1: + temp1 = (*r0 % 5); + temp = temp1 + 15; + if (temp1 == 0) + temp1 = 5; + break; + case 2: + case 3: + temp1 = (*r0 / 5) * 5; + temp = temp1 + 4; + if (temp1 == 0) + temp1 = 1; + break; + } + + *r0 += arr[r1]; + + if (*r0 < temp1) + *r0 = temp; + + if (*r0 > temp) + *r0 = temp1; + + if (*r0 != t) + return TRUE; + + return FALSE; +} + +void sub_8140D6C(u8 r0) +{ + u8 z = 0; + bool8 var0 = FALSE; + if (!(gMain.newKeys & DPAD_UP) || ((var0 = TRUE), sub_8140CA8(&gTasks[r0].data[4], 0))) + if (!(gMain.newKeys & DPAD_DOWN) || ((var0 = TRUE), sub_8140CA8(&gTasks[r0].data[4], 1))) + if (!(gMain.newKeys & DPAD_LEFT) || ((var0 = TRUE), sub_8140CA8(&gTasks[r0].data[4], 2))) + if (!(gMain.newKeys & DPAD_RIGHT) || ((var0 = TRUE), sub_8140CA8(&gTasks[r0].data[4], 3))) + 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; + sub_8142284(gTasks[r0].data[4]); + 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 ((u16)(gTasks[r0].data[4] - 1) < 4 && !(gUnknown_0203AB88->var08 & gUnknown_085B6154[gTasks[r0].data[4]].var08) ) + { + z = gTasks[r0].data[4] - 1; + gSprites[gUnknown_0203AB88->var3C[z + 41]].oam.tileNum = + gSprites[gUnknown_0203AB88->var3C[z + 41]].sheetTileStart + + (*gSprites[gUnknown_0203AB88->var3C[z + 41]].anims + 1)->type; + } + } +} + +void sub_8140F6C(u8 r0) +{ + sub_80EECA4(); + gUnknown_0203AB88->var28 = 0xFF; + if (gUnknown_0203AB88->var19 == 1) + gUnknown_0203AB88->var23 = 1; + else + gUnknown_0203AB88->var23 = 0; + gUnknown_0203AB88->var21 = 0; + gTasks[r0].data[1] = 32; + gTasks[r0].func = sub_81410FC; +} + +void sub_8140FC4(u8 taskId) +{ + gUnknown_0203AB88->var1B[gUnknown_0203AB88->var1A_0] = gTasks[taskId].data[4]; + gTasks[taskId].data[2] = sub_8142758(gUnknown_0203AB88->var1B[gUnknown_0203AB88->var1A_0]); + sub_81436D0(gUnknown_0203AB88->var1B[gUnknown_0203AB88->var1A_0]); + 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; +} + +void sub_8141040(u8 taskId) +{ + sub_8140D6C(taskId); + + switch (gTasks[taskId].data[0x1]) + { + case 0: + sub_81409B8(gTasks[taskId].data[0x4]); + gTasks[taskId].data[0x1]+= 1; + break; + case 30: + sub_81409B8(0); + gTasks[taskId].data[0x1]+= 1; + break; + case 59: + gTasks[taskId].data[0x1] = 0; + break; + default: + gTasks[taskId].data[0x1]++; + } + + if (gMain.newKeys & A_BUTTON) + { + if ((gUnknown_0203AB88->var08 & gUnknown_085B6154[gTasks[taskId].data[0x4]].var08)) + PlaySE(SE_BOO); + else + { + m4aSongNumStart(SE_REGI); + gTasks[taskId].func = sub_8140FC4; + } + } +} + +void sub_81410FC(u8 taskId) +{ + if (gTasks[taskId].data[0x1]-- > 0) + { + if (gTasks[taskId].data[0x1] > 0x2) + gSpriteCoordOffsetX += 0x2; + if ((gUnknown_0203AB88->var26 += 0x4) == 0x68) + gSprites[gUnknown_0203AB88->var3C[0x19]].callback = &SpriteCallbackDummy; + } + else + { + sub_8142E70(1, 0xFF); + sub_8143038(1, 0xFF); + gTasks[taskId].func = sub_8141344; + gTasks[taskId].data[0x1] = 0; + } +} + +u8 sub_814118C(u16 r0, u16 r1) +{ + switch (gUnknown_0203AB88->var02) + { + case 1: // SHROOMISH + case 2: // TAILLOW + // one of the two is in party + if (gLocalTime.hours > 3 && gLocalTime.hours < 10) + { + if (r0 < 0xC || (r1 & 0x1)) + { + return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02 / 2; + } + else + { + return 0x1; + } + } + else if (!(r1 & 0x3)) + { + return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02 / 2; + } + else + { + return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02; + } + break; + case 3: + // both are in party + if (gLocalTime.hours > 3 && gLocalTime.hours < 11) + { + if (r0 < 0x6 || (r1 & 0x1)) + { + return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02 / 2; + } + else + { + return 0x1; + } + } + else if ((r1 & 0x1) && r0 > 6) + { + return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02 / 4; + } + else + { + return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02 / 2; + } + break; + case 0: + default: + // neither is in party + if (gLocalTime.hours > 3 && gLocalTime.hours < 10) + { + if (!(r1 & 0x3)) + { + return 0x1; + } + else + { + return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02 / 2; + } + } + else if (!(r1 & 0x3)) + { + if (r0 > 12) + { + return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02 / 2; + } + else + { + return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02; + } + } + else if (r1 & 0x8000) + { + if (r0 > 12) + { + return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02; + } + else + { + return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var01; + } + } + else + { + return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var01 * 2; + } + break; + } +} + +// r7/r8 swap +#ifdef NONMATCHING +void sub_8141344(u8 taskId) +{ + u8 randf; + s8 randfinal; + s8 r5; + u16 g = 0; + u16 rand; + u16 randmod; + u16 angles[4]; // angles in 90 degree steps + + memcpy(angles, &gUnknown_085B6422, sizeof(angles)); + rand = Random(); + randmod = rand % 100; + gUnknown_0203AB88->var7C = gTasks[taskId].data[6]; + gUnknown_0203AB88->var7D = gUnknown_0203AB88->var7E = gUnknown_0203AB88->var7F = g; + randf = sub_814118C(gTasks[taskId].data[8], rand); + randfinal = (rand % randf) - (randf / 2); + + if (gLocalTime.hours < 13) + r5 = 0; + else + r5 = 1; + + if (randmod < 80) + r5 *= 2; + else + r5 = (1 - r5) * 2; + + gUnknown_0203AB88->var80 = g = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var1A + randfinal; + + g = S16TOPOSFLOAT(g) / 5.0f; + gUnknown_0203AB88->var82 = g * 3; + gUnknown_0203AB88->var84 = g; + gUnknown_0203AB88->var86 = g; + + gUnknown_0203AB88->var88 = S16TOPOSFLOAT(angles[(rand & 1) + r5]); + gUnknown_0203AB88->var8C = S16TOPOSFLOAT(gUnknown_085B6348[gUnknown_0203AB88->var04_0].var18); + gUnknown_0203AB88->var90 = ((gUnknown_0203AB88->var8C * 0.5f) - gUnknown_0203AB88->var8C) / S16TOPOSFLOAT(gUnknown_0203AB88->var82); + gUnknown_0203AB88->var94 = 68.0f; + gUnknown_0203AB88->var9C = 0.0f; + gUnknown_0203AB88->var98 = -(8.0f / S16TOPOSFLOAT(gUnknown_0203AB88->var82)); + gUnknown_0203AB88->varA0 = 36.0f; + gTasks[taskId].func = sub_814155C; +} +#else +NAKED +void sub_8141344(u8 taskId) +{ + asm_unified(" push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0x8\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r10, r0\n\ + movs r4, 0\n\ + ldr r1, =gUnknown_085B6422\n\ + mov r0, sp\n\ + movs r2, 0x8\n\ + bl memcpy\n\ + bl Random\n\ + lsls r0, 16\n\ + lsrs r7, r0, 16\n\ + adds r0, r7, 0\n\ + movs r1, 0x64\n\ + bl __umodsi3\n\ + lsls r0, 16\n\ + lsrs r6, r0, 16\n\ + ldr r3, =gUnknown_0203AB88\n\ + ldr r0, [r3]\n\ + ldr r2, =gTasks\n\ + mov r5, r10\n\ + lsls r1, r5, 2\n\ + add r1, r10\n\ + lsls r1, 3\n\ + adds r1, r2\n\ + ldrh r2, [r1, 0x14]\n\ + adds r0, 0x7C\n\ + strb r2, [r0]\n\ + ldr r0, [r3]\n\ + adds r2, r0, 0\n\ + adds r2, 0x7F\n\ + strb r4, [r2]\n\ + subs r2, 0x1\n\ + strb r4, [r2]\n\ + adds r0, 0x7D\n\ + strb r4, [r0]\n\ + ldrh r0, [r1, 0x18]\n\ + adds r1, r7, 0\n\ + bl sub_814118C\n\ + adds r4, r0, 0\n\ + lsls r4, 24\n\ + lsrs r1, r4, 24\n\ + adds r0, r7, 0\n\ + bl __modsi3\n\ + lsrs r4, 25\n\ + subs r0, r4\n\ + lsls r0, 24\n\ + lsrs r4, r0, 24\n\ + ldr r0, =gLocalTime\n\ + ldrb r0, [r0, 0x2]\n\ + lsls r0, 24\n\ + asrs r0, 24\n\ + movs r5, 0x1\n\ + cmp r0, 0xC\n\ + bgt _081413C8\n\ + movs r5, 0\n\ +_081413C8:\n\ + cmp r6, 0x4F\n\ + bhi _081413E0\n\ + lsls r0, r5, 25\n\ + b _081413EA\n\ + .pool\n\ +_081413E0:\n\ + lsls r1, r5, 24\n\ + asrs r1, 24\n\ + movs r0, 0x1\n\ + subs r0, r1\n\ + lsls r0, 25\n\ +_081413EA:\n\ + lsrs r5, r0, 24\n\ + ldr r0, _08141530 @ =gUnknown_0203AB88\n\ + ldr r6, [r0]\n\ + ldrb r0, [r6, 0x4]\n\ + lsls r0, 30\n\ + lsrs r0, 25\n\ + ldr r1, _08141534 @ =gUnknown_085B6348\n\ + adds r0, r1\n\ + lsls r4, 24\n\ + asrs r4, 24\n\ + ldrh r0, [r0, 0x1A]\n\ + adds r4, r0\n\ + adds r0, r6, 0\n\ + adds r0, 0x80\n\ + strh r4, [r0]\n\ + lsls r4, 16\n\ + asrs r4, 16\n\ + adds r0, r4, 0\n\ + bl __floatsisf\n\ + cmp r4, 0\n\ + bge _0814141C\n\ + ldr r1, _08141538 @ =0x47800000\n\ + bl __addsf3\n\ +_0814141C:\n\ + ldr r1, _0814153C @ =0x40A00000\n\ + bl __divsf3\n\ + bl __fixunssfsi\n\ + lsls r0, 16\n\ + lsrs r4, r0, 16\n\ + lsls r0, r4, 1\n\ + adds r0, r4\n\ + movs r2, 0x82\n\ + adds r2, r6\n\ + mov r8, r2\n\ + strh r0, [r2]\n\ + adds r0, r6, 0\n\ + adds r0, 0x84\n\ + strh r4, [r0]\n\ + adds r0, 0x2\n\ + strh r4, [r0]\n\ + movs r0, 0x88\n\ + adds r0, r6\n\ + mov r9, r0\n\ + movs r0, 0x1\n\ + ands r0, r7\n\ + lsls r1, r5, 24\n\ + asrs r1, 24\n\ + adds r0, r1\n\ + lsls r0, 1\n\ + add r0, sp\n\ + movs r1, 0\n\ + ldrsh r4, [r0, r1]\n\ + adds r0, r4, 0\n\ + bl __floatsisf\n\ + cmp r4, 0\n\ + bge _08141468\n\ + ldr r1, _08141538 @ =0x47800000\n\ + bl __addsf3\n\ +_08141468:\n\ + mov r2, r9\n\ + str r0, [r2]\n\ + adds r7, r6, 0\n\ + adds r7, 0x8C\n\ + ldrb r0, [r6, 0x4]\n\ + lsls r0, 30\n\ + lsrs r0, 25\n\ + ldr r5, _08141534 @ =gUnknown_085B6348\n\ + adds r0, r5\n\ + movs r1, 0x18\n\ + ldrsh r4, [r0, r1]\n\ + adds r0, r4, 0\n\ + bl __floatsisf\n\ + adds r5, r0, 0\n\ + cmp r4, 0\n\ + bge _08141492\n\ + ldr r1, _08141538 @ =0x47800000\n\ + bl __addsf3\n\ + adds r5, r0, 0\n\ +_08141492:\n\ + str r5, [r7]\n\ + adds r7, r6, 0\n\ + adds r7, 0x90\n\ + ldr r1, _08141540 @ =0x3F000000\n\ + adds r0, r5, 0\n\ + bl __mulsf3\n\ + adds r1, r5, 0\n\ + bl __subsf3\n\ + adds r5, r0, 0\n\ + mov r2, r8\n\ + movs r0, 0\n\ + ldrsh r4, [r2, r0]\n\ + adds r0, r4, 0\n\ + bl __floatsisf\n\ + adds r2, r0, 0\n\ + cmp r4, 0\n\ + bge _081414C2\n\ + ldr r1, _08141538 @ =0x47800000\n\ + bl __addsf3\n\ + adds r2, r0, 0\n\ +_081414C2:\n\ + adds r0, r5, 0\n\ + adds r1, r2, 0\n\ + bl __divsf3\n\ + str r0, [r7]\n\ + adds r1, r6, 0\n\ + adds r1, 0x94\n\ + ldr r0, _08141544 @ =0x42880000\n\ + str r0, [r1]\n\ + adds r1, 0x8\n\ + ldr r0, _08141548 @ =0x00000000\n\ + str r0, [r1]\n\ + adds r5, r6, 0\n\ + adds r5, 0x98\n\ + mov r1, r8\n\ + movs r2, 0\n\ + ldrsh r4, [r1, r2]\n\ + adds r0, r4, 0\n\ + bl __floatsisf\n\ + adds r2, r0, 0\n\ + cmp r4, 0\n\ + bge _081414F8\n\ + ldr r1, _08141538 @ =0x47800000\n\ + bl __addsf3\n\ + adds r2, r0, 0\n\ +_081414F8:\n\ + ldr r0, _0814154C @ =0x41000000\n\ + adds r1, r2, 0\n\ + bl __divsf3\n\ + bl __negsf2\n\ + str r0, [r5]\n\ + adds r1, r6, 0\n\ + adds r1, 0xA0\n\ + ldr r0, _08141550 @ =0x42100000\n\ + str r0, [r1]\n\ + ldr r1, _08141554 @ =gTasks\n\ + mov r5, r10\n\ + lsls r0, r5, 2\n\ + add r0, r10\n\ + lsls r0, 3\n\ + adds r0, r1\n\ + ldr r1, _08141558 @ =sub_814155C\n\ + str r1, [r0]\n\ + add sp, 0x8\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .align 2, 0\n\ +_08141530:\n\ + .4byte gUnknown_0203AB88\n\ +_08141534:\n\ + .4byte gUnknown_085B6348\n\ +_08141538:\n\ + .4byte 0x47800000\n\ +_0814153C:\n\ + .4byte 0x40A00000\n\ +_08141540:\n\ + .4byte 0x3F000000\n\ +_08141544:\n\ + .4byte 0x42880000\n\ +_08141548:\n\ + .4byte 0x00000000\n\ +_0814154C:\n\ + .4byte 0x41000000\n\ +_08141550:\n\ + .4byte 0x42100000\n\ +_08141554:\n\ + .4byte gTasks\n\ +_08141558:\n\ + .4byte sub_814155C"); +} +#endif // NONMATCHING diff --git a/src/roulette_util.c b/src/roulette_util.c index c556a4af5..9531302d9 100755 --- a/src/roulette_util.c +++ b/src/roulette_util.c @@ -11,7 +11,7 @@ void sub_8151678(struct UnkStruct0 *r0) memset(&r0->var04, 0, sizeof(r0->var04)); } -u8 sub_815168C(struct UnkStruct0 *r0, u8 r1, struct UnkStruct1 *r2) +u8 sub_815168C(struct UnkStruct0 *r0, u8 r1, const struct UnkStruct1 *r2) { if (!(r1 < 16) || (r0->var04[r1].var00_7)) return 0xFF; diff --git a/src/secret_base.c b/src/secret_base.c index 1f3f9b46a..4bdc49c2e 100644 --- a/src/secret_base.c +++ b/src/secret_base.c @@ -1032,7 +1032,7 @@ void sub_80E9FFC(u8 taskId) void sub_80EA06C(u8 taskId) { DisplayYesNoMenu(); - sub_8121F68(taskId, &gUnknown_0858D058); + DoYesNoFuncWithChoice(taskId, &gUnknown_0858D058); } void sub_80EA08C(u8 taskId) From af1e44befe89102144a5223e56532c33f1a5e242 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Mon, 31 Dec 2018 18:07:29 -0600 Subject: [PATCH 2/6] 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; + } + } +} From d28d8c850d8b31f3ef58dd0e58be82fb39f6febc Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Mon, 31 Dec 2018 19:39:41 -0600 Subject: [PATCH 3/6] Up to sub_81446DC --- asm/roulette.s | 1902 ------------------------------------------------ include/m4a.h | 3 +- src/roulette.c | 547 +++++++++++++- 3 files changed, 544 insertions(+), 1908 deletions(-) diff --git a/asm/roulette.s b/asm/roulette.s index d8ef98bfb..2d3c2a25a 100644 --- a/asm/roulette.s +++ b/asm/roulette.s @@ -5,1908 +5,6 @@ .text - thumb_func_start sub_814390C -sub_814390C: @ 814390C - ldr r1, =gUnknown_0203AB88 - ldr r1, [r1] - ldrh r1, [r1, 0x26] - strh r1, [r0, 0x24] - bx lr - .pool - thumb_func_end sub_814390C - - thumb_func_start sub_814391C -sub_814391C: @ 814391C - push {r4,r5,lr} - sub sp, 0x8 - ldr r4, =gUnknown_085B7948 - ldr r0, [r4] - ldr r5, =gDecompressionBuffer - adds r1, r5, 0 - bl LZ77UnCompWram - str r5, [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 r0, =gSpriteTemplate_85B7950 - movs r1, 0x74 - movs r2, 0x50 - movs r3, 0x51 - bl CreateSprite - lsls r0, 24 - lsrs r0, 24 - ldr r2, =gSprites - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r2 - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - ldrh r0, [r0, 0x24] - movs r2, 0 - strh r0, [r1, 0x2E] - strh r2, [r1, 0x30] - adds r3, r1, 0 - adds r3, 0x2C - ldrb r0, [r3] - movs r2, 0x40 - orrs r0, r2 - movs r2, 0x80 - orrs r0, r2 - strb r0, [r3] - adds r1, 0x3E - ldrb r0, [r1] - movs r2, 0x2 - orrs r0, r2 - strb r0, [r1] - add sp, 0x8 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_814391C - - thumb_func_start sub_814399C -sub_814399C: @ 814399C - ldrb r0, [r0, 0x3] - lsls r0, 26 - lsrs r0, 27 - ldr r1, =gOamMatrices - lsls r0, 3 - adds r0, r1 - ldr r1, =gUnknown_0203AB88 - ldr r2, [r1] - ldrh r1, [r2, 0x2C] - strh r1, [r0, 0x6] - ldrh r1, [r2, 0x2C] - strh r1, [r0] - ldrh r1, [r2, 0x2E] - strh r1, [r0, 0x2] - ldrh r1, [r2, 0x30] - strh r1, [r0, 0x4] - bx lr - .pool - thumb_func_end sub_814399C - - thumb_func_start sub_81439C8 -sub_81439C8: @ 81439C8 - push {r4-r6,lr} - movs r4, 0 - ldr r5, =gUnknown_0203AB88 - ldr r6, =gSprites -_081439D0: - movs r3, 0x39 - subs r3, r4 - lsls r3, 24 - lsrs r3, 24 - ldr r0, =gSpriteTemplate_85B7928 - movs r1, 0x74 - movs r2, 0x50 - bl CreateSprite - ldr r1, [r5] - adds r1, 0x3C - adds r1, r4 - strb r0, [r1] - ldr r0, [r5] - adds r0, 0x3C - adds r1, r0, r4 - ldrb r0, [r1] - cmp r0, 0x40 - beq _08143A24 - adds r1, r0, 0 - 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, [r5] - adds r0, 0x3C - adds r0, r4 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x2 - orrs r1, r2 - strb r1, [r0] -_08143A24: - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x5 - bls _081439D0 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81439C8 - - thumb_func_start sub_8143A40 -sub_8143A40: @ 8143A40 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - adds r0, 0x3C - ldrb r5, [r0] - movs r6, 0 - ldr r7, =gSprites - movs r0, 0x1C - adds r0, r7 - mov r10, r0 - movs r1, 0x2E - adds r1, r7 - mov r9, r1 - mov r8, r6 -_08143A64: - lsls r4, r5, 4 - adds r4, r5 - lsls r4, 2 - adds r0, r4, r7 - adds r3, r0, 0 - adds r3, 0x3E - ldrb r1, [r3] - movs r2, 0x4 - orrs r1, r2 - strb r1, [r3] - mov r1, r10 - adds r2, r4, r1 - ldr r1, =SpriteCallbackDummy - str r1, [r2] - movs r1, 0 - bl StartSpriteAnim - movs r1, 0 - adds r2, r5, 0x1 - adds r3, r6, 0x1 -_08143A8C: - lsls r0, r1, 1 - adds r0, r4 - add r0, r9 - mov r5, r8 - strh r5, [r0] - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x7 - bls _08143A8C - lsls r0, r2, 24 - lsrs r5, r0, 24 - lsls r0, r3, 24 - lsrs r6, r0, 24 - cmp r6, 0x5 - bls _08143A64 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8143A40 - - thumb_func_start sub_8143AC8 -sub_8143AC8: @ 8143AC8 - push {r4,r5,lr} - adds r3, r0, 0 - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - ldrh r4, [r0, 0x24] - movs r2, 0x24 - ldrsh r1, [r0, r2] - ldrh r2, [r3, 0x34] - movs r5, 0x34 - ldrsh r0, [r3, r5] - cmp r1, r0 - ble _08143B04 - movs r1, 0xB4 - lsls r1, 1 - adds r0, r2, r1 - subs r2, r0, r4 - strh r2, [r3, 0x3A] - lsls r1, r2, 16 - ldr r0, =0x01670000 - cmp r1, r0 - ble _08143B08 - ldr r5, =0xfffffe98 - adds r0, r2, r5 - b _08143B06 - .pool -_08143B04: - subs r0, r2, r4 -_08143B06: - strh r0, [r3, 0x3A] -_08143B08: - movs r1, 0x3A - ldrsh r0, [r3, r1] - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8143AC8 - - thumb_func_start sub_8143B14 -sub_8143B14: @ 8143B14 - push {r4,r5,lr} - bl sub_8143AC8 - ldr r5, =gUnknown_0203AB88 - ldr r4, [r5] - lsls r0, 16 - asrs r0, 16 - bl __floatsisf - ldr r1, =0x41f00000 - bl __divsf3 - bl __fixunssfsi - adds r4, 0x7E - strb r0, [r4] - ldr r0, [r5] - adds r0, 0x7E - ldrb r0, [r0] - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_8143B14 - - thumb_func_start sub_8143B48 -sub_8143B48: @ 8143B48 - push {r4,lr} - adds r4, r0, 0 - bl sub_8143AC8 - lsls r0, 16 - asrs r0, 16 - movs r1, 0x1E - bl __modsi3 - lsls r0, 16 - asrs r1, r0, 16 - cmp r1, 0xE - bne _08143B68 - movs r0, 0 - strh r0, [r4, 0x32] - b _08143B7E -_08143B68: - cmp r1, 0xD - bgt _08143B70 - movs r0, 0xE - b _08143B72 -_08143B70: - movs r0, 0x2B -_08143B72: - subs r0, r1 - lsls r0, 16 - lsrs r0, 16 - strh r0, [r4, 0x32] - lsls r0, 16 - asrs r0, 16 -_08143B7E: - pop {r4} - pop {r1} - bx r1 - thumb_func_end sub_8143B48 - - thumb_func_start sub_8143B84 -sub_8143B84: @ 8143B84 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r7, r0, 0 - ldr r5, _08143BCC @ =gUnknown_0203AB88 - ldr r6, [r5] - adds r4, r6, 0 - adds r4, 0x8C - adds r1, r6, 0 - adds r1, 0x90 - ldr r0, [r4] - ldr r1, [r1] - bl __addsf3 - adds r1, r0, 0 - str r1, [r4] - subs r4, 0x4 - ldr r0, [r4] - bl __addsf3 - adds r6, r0, 0 - str r6, [r4] - ldr r0, _08143BD0 @ =0x43B40000 - mov r8, r0 - adds r0, r6, 0 - mov r1, r8 - bl __gesf2 - cmp r0, 0 - blt _08143BD4 - adds r0, r6, 0 - mov r1, r8 - bl __subsf3 - b _08143BE8 - .align 2, 0 -_08143BCC: - .4byte gUnknown_0203AB88 -_08143BD0: - .4byte 0x43B40000 -_08143BD4: - ldr r1, _08143C80 @ =0x00000000 - adds r0, r6, 0 - bl __ltsf2 - cmp r0, 0 - bge _08143BEA - adds r0, r6, 0 - mov r1, r8 - bl __addsf3 -_08143BE8: - str r0, [r4] -_08143BEA: - ldr r5, [r5] - adds r0, r5, 0 - adds r0, 0x88 - ldr r0, [r0] - bl __fixsfsi - strh r0, [r7, 0x34] - adds r4, r5, 0 - adds r4, 0x98 - adds r1, r5, 0 - adds r1, 0x9C - ldr r0, [r4] - ldr r1, [r1] - bl __addsf3 - adds r1, r0, 0 - str r1, [r4] - subs r4, 0x4 - ldr r0, [r4] - bl __addsf3 - str r0, [r4] - bl __fixsfsi - strh r0, [r7, 0x36] - ldrh r0, [r7, 0x34] - bl Sin2 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrh r0, [r7, 0x34] - bl Cos2 - lsls r4, 16 - asrs r4, 16 - movs r2, 0x36 - ldrsh r1, [r7, r2] - muls r1, r4 - asrs r1, 12 - strh r1, [r7, 0x24] - lsls r0, 16 - asrs r0, 16 - negs r0, r0 - movs r2, 0x36 - ldrsh r1, [r7, r2] - muls r0, r1 - asrs r0, 12 - strh r0, [r7, 0x26] - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _08143C74 - ldr r0, _08143C84 @ =gMPlayInfo_SE1 - ldr r4, _08143C88 @ =0x0000FFFF - ldrh r2, [r7, 0x24] - lsls r2, 24 - asrs r2, 24 - adds r1, r4, 0 - bl m4aMPlayPanpotControl - ldr r0, _08143C8C @ =gMPlayInfo_SE2 - ldrh r2, [r7, 0x24] - lsls r2, 24 - asrs r2, 24 - adds r1, r4, 0 - bl m4aMPlayPanpotControl -_08143C74: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08143C80: - .4byte 0x00000000 -_08143C84: - .4byte gMPlayInfo_SE1 -_08143C88: - .4byte 0x0000FFFF -_08143C8C: - .4byte gMPlayInfo_SE2 - thumb_func_end sub_8143B84 - - thumb_func_start sub_8143C90 -sub_8143C90: @ 8143C90 - push {r4,r5,lr} - adds r5, r0, 0 - ldr r0, =gUnknown_0203AB88 - ldr r1, [r0] - ldrh r0, [r5, 0x3A] - ldrh r1, [r1, 0x24] - adds r2, r0, r1 - strh r2, [r5, 0x34] - lsls r1, r2, 16 - ldr r0, =0x01670000 - cmp r1, r0 - ble _08143CAE - ldr r1, =0xfffffe98 - adds r0, r2, r1 - strh r0, [r5, 0x34] -_08143CAE: - ldrh r0, [r5, 0x34] - bl Sin2 - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - ldrh r0, [r5, 0x34] - bl Cos2 - lsls r4, 16 - asrs r4, 16 - movs r2, 0x36 - ldrsh r1, [r5, r2] - muls r1, r4 - asrs r1, 12 - strh r1, [r5, 0x24] - lsls r0, 16 - asrs r0, 16 - negs r0, r0 - movs r2, 0x36 - ldrsh r1, [r5, r2] - muls r0, r1 - ldr r1, =gSpriteCoordOffsetY - asrs r0, 12 - ldrh r1, [r1] - adds r0, r1 - strh r0, [r5, 0x26] - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8143C90 - - thumb_func_start sub_8143CFC -sub_8143CFC: @ 8143CFC - push {r4-r7,lr} - adds r5, r0, 0 - bl sub_8143B84 - ldrh r0, [r5, 0x32] - adds r0, 0x1 - strh r0, [r5, 0x32] - ldrh r0, [r5, 0x36] - adds r0, 0x84 - lsls r0, 16 - lsrs r0, 16 - cmp r0, 0xD4 - bls _08143D22 - adds r2, r5, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - b _08143D2E -_08143D22: - adds r2, r5, 0 - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 -_08143D2E: - strb r0, [r2] - movs r1, 0x32 - ldrsh r0, [r5, r1] - cmp r0, 0x1D - ble _08143DF8 - movs r1, 0x2E - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _08143D6C - ldr r7, _08143D64 @ =gUnknown_0203AB88 - ldr r6, [r7] - adds r4, r6, 0 - adds r4, 0x94 - adds r0, r6, 0 - adds r0, 0xA0 - ldr r0, [r0] - ldr r1, _08143D68 @ =0x40000000 - bl __subsf3 - adds r1, r0, 0 - ldr r0, [r4] - bl __lesf2 - cmp r0, 0 - bgt _08143DF8 - b _08143D8C - .align 2, 0 -_08143D64: - .4byte gUnknown_0203AB88 -_08143D68: - .4byte 0x40000000 -_08143D6C: - ldr r7, _08143E00 @ =gUnknown_0203AB88 - ldr r6, [r7] - adds r4, r6, 0 - adds r4, 0x94 - adds r0, r6, 0 - adds r0, 0xA0 - ldr r0, [r0] - ldr r1, _08143E04 @ =0x40000000 - bl __subsf3 - adds r1, r0, 0 - ldr r0, [r4] - bl __gesf2 - cmp r0, 0 - blt _08143DF8 -_08143D8C: - adds r1, r6, 0 - adds r1, 0x7D - movs r0, 0xFF - strb r0, [r1] - ldr r2, [r7] - ldrb r1, [r2, 0x3] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2, 0x3] - adds r0, r5, 0 - adds r0, 0x2B - ldrb r1, [r0] - adds r1, 0x3 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl StartSpriteAnim - adds r0, r5, 0 - bl sub_8143B14 - movs r0, 0x1E - strh r0, [r5, 0x36] - adds r0, r5, 0 - bl sub_8143AC8 - movs r1, 0x3A - ldrsh r0, [r5, r1] - movs r1, 0x1E - bl __divsi3 - lsls r0, 16 - asrs r0, 16 - lsls r1, r0, 4 - subs r1, r0 - lsls r1, 1 - adds r1, 0xF - strh r1, [r5, 0x3A] - ldr r0, _08143E08 @ =sub_8143C90 - str r0, [r5, 0x1C] - movs r0, 0x47 - bl m4aSongNumStartOrChange - ldr r3, [r7] - adds r2, r3, 0 - adds r2, 0x9C - adds r1, r3, 0 - adds r1, 0x98 - ldr r0, _08143E0C @ =0x00000000 - str r0, [r1] - str r0, [r2] - subs r1, 0xC - ldr r0, _08143E10 @ =0xBF800000 - str r0, [r1] -_08143DF8: - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08143E00: - .4byte gUnknown_0203AB88 -_08143E04: - .4byte 0x40000000 -_08143E08: - .4byte sub_8143C90 -_08143E0C: - .4byte 0x00000000 -_08143E10: - .4byte 0xBF800000 - thumb_func_end sub_8143CFC - - thumb_func_start sub_8143E14 -sub_8143E14: @ 8143E14 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - adds r7, r0, 0 - bl sub_8143B84 - movs r1, 0x34 - ldrsh r0, [r7, r1] - cmp r0, 0 - beq _08143E32 - cmp r0, 0xB4 - beq _08143E9C - b _08143F80 -_08143E32: - movs r1, 0x2E - ldrsh r0, [r7, r1] - cmp r0, 0x1 - bne _08143E3C - b _08143F80 -_08143E3C: - movs r1, 0x3C - ldrsh r0, [r7, r1] - bl __floatsisf - mov r9, r0 - ldr r0, =gUnknown_085B6348 - mov r10, r0 - ldr r1, =gUnknown_0203AB88 - mov r8, r1 - ldr r0, [r1] - ldrb r4, [r0, 0x4] - lsls r4, 30 - lsrs r0, r4, 25 - add r0, r10 - ldrb r0, [r0, 0x1] - bl __floatsisf - adds r1, r0, 0 - mov r0, r9 - bl __mulsf3 - adds r6, r0, 0 - lsrs r0, r4, 25 - add r0, r10 - ldrb r0, [r0, 0x2] - subs r0, 0x1 - bl __floatsisf - adds r1, r0, 0 - adds r0, r6, 0 - bl __addsf3 - adds r5, r0, 0 - lsrs r4, 25 - add r4, r10 - ldrh r0, [r4, 0xC] - bl __floatsisf - adds r1, r0, 0 - mov r0, r9 - bl __divsf3 - b _08143EFC - .pool -_08143E9C: - movs r1, 0x2E - ldrsh r0, [r7, r1] - cmp r0, 0 - beq _08143F80 - movs r1, 0x3C - ldrsh r0, [r7, r1] - bl __floatsisf - mov r9, r0 - ldr r0, _08143F90 @ =gUnknown_085B6348 - mov r10, r0 - ldr r1, _08143F94 @ =gUnknown_0203AB88 - mov r8, r1 - ldr r0, [r1] - ldrb r4, [r0, 0x4] - lsls r4, 30 - lsrs r0, r4, 25 - add r0, r10 - ldrb r0, [r0, 0x1] - bl __floatsisf - adds r1, r0, 0 - mov r0, r9 - bl __mulsf3 - adds r6, r0, 0 - lsrs r0, r4, 25 - add r0, r10 - ldrb r0, [r0, 0x2] - subs r0, 0x1 - bl __floatsisf - adds r1, r0, 0 - adds r0, r6, 0 - bl __addsf3 - adds r5, r0, 0 - lsrs r4, 25 - add r4, r10 - ldrh r0, [r4, 0xC] - bl __floatsisf - adds r1, r0, 0 - mov r0, r9 - bl __divsf3 - bl __negsf2 -_08143EFC: - adds r2, r0, 0 - mov r0, r8 - ldr r6, [r0] - adds r1, r6, 0 - adds r1, 0xA0 - adds r0, r6, 0 - adds r0, 0x94 - ldr r0, [r0] - str r0, [r1] - adds r0, r6, 0 - adds r0, 0x98 - str r2, [r0] - movs r0, 0x9C - adds r0, r6 - mov r8, r0 - adds r0, r2, 0 - adds r1, r2, 0 - bl __addsf3 - adds r1, r5, 0 - bl __divsf3 - adds r4, r0, 0 - adds r0, r5, 0 - adds r1, r5, 0 - bl __mulsf3 - adds r1, r0, 0 - ldr r0, _08143F98 @ =0x40000000 - bl __divsf3 - adds r1, r0, 0 - adds r0, r4, 0 - bl __addsf3 - bl __negsf2 - mov r1, r8 - str r0, [r1] - adds r1, r6, 0 - adds r1, 0x8C - ldr r0, _08143F9C @ =0x00000000 - str r0, [r1] - adds r2, r7, 0 - adds r2, 0x2C - ldrb r1, [r2] - movs r0, 0x41 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - adds r0, r7, 0 - adds r0, 0x2A - movs r2, 0 - strb r2, [r0] - adds r3, r7, 0 - adds r3, 0x3F - ldrb r0, [r3] - movs r1, 0x4 - orrs r0, r1 - movs r1, 0x11 - negs r1, r1 - ands r0, r1 - strb r0, [r3] - ldr r0, _08143FA0 @ =sub_8143CFC - str r0, [r7, 0x1C] - strh r2, [r7, 0x32] -_08143F80: - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08143F90: - .4byte gUnknown_085B6348 -_08143F94: - .4byte gUnknown_0203AB88 -_08143F98: - .4byte 0x40000000 -_08143F9C: - .4byte 0x00000000 -_08143FA0: - .4byte sub_8143CFC - thumb_func_end sub_8143E14 - - thumb_func_start sub_8143FA4 -sub_8143FA4: @ 8143FA4 - push {r4,r5,lr} - adds r5, r0, 0 - movs r1, 0x32 - ldrsh r0, [r5, r1] - bl __floatsisf - adds r4, r0, 0 - ldr r1, =0x3d4ccccd - bl __mulsf3 - adds r1, r4, 0 - bl __mulsf3 - bl __fixsfsi - adds r1, r0, 0 - subs r1, 0x2D - strh r1, [r5, 0x26] - ldrh r0, [r5, 0x32] - adds r0, 0x1 - strh r0, [r5, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x1D - ble _0814403E - lsls r0, r1, 16 - cmp r0, 0 - blt _0814403E - ldr r4, =gUnknown_0203AB88 - ldr r0, [r4] - adds r0, 0x7D - movs r1, 0xFF - strb r1, [r0] - ldr r2, [r4] - ldrb r1, [r2, 0x3] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2, 0x3] - adds r0, r5, 0 - adds r0, 0x2B - ldrb r1, [r0] - adds r1, 0x3 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl StartSpriteAnim - adds r0, r5, 0 - bl sub_8143B14 - movs r0, 0x1E - strh r0, [r5, 0x36] - adds r0, r5, 0 - bl sub_8143AC8 - movs r1, 0x3A - ldrsh r0, [r5, r1] - movs r1, 0x1E - bl __divsi3 - lsls r0, 16 - asrs r0, 16 - lsls r1, r0, 4 - subs r1, r0 - lsls r1, 1 - adds r1, 0xF - strh r1, [r5, 0x3A] - ldr r0, =sub_8143C90 - str r0, [r5, 0x1C] - movs r0, 0x47 - bl m4aSongNumStartOrChange - ldr r2, [r4] - ldrb r0, [r2, 0x3] - movs r1, 0x40 - orrs r0, r1 - strb r0, [r2, 0x3] -_0814403E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8143FA4 - - thumb_func_start sub_8144050 -sub_8144050: @ 8144050 - push {r4,lr} - adds r3, r0, 0 - ldrh r0, [r3, 0x32] - adds r1, r0, 0x1 - strh r1, [r3, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x2C - bgt _08144098 - ldrh r4, [r3, 0x26] - subs r0, r4, 0x1 - strh r0, [r3, 0x26] - lsls r0, r1, 16 - asrs r0, 16 - cmp r0, 0x2D - bne _0814411E - ldr r2, =gSprites - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - adds r0, 0x73 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x2B - ldrb r0, [r0] - cmp r0, 0x1 - bne _0814411E - strh r4, [r3, 0x26] - b _0814411E - .pool -_08144098: - lsls r0, r1, 16 - asrs r0, 16 - movs r2, 0x3C - ldrsh r1, [r3, r2] - cmp r0, r1 - bge _081440E4 - ldr r2, =gSprites - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - adds r0, 0x73 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r0, r2 - adds r0, r1, 0 - adds r0, 0x2C - ldrb r0, [r0] - lsls r0, 26 - cmp r0, 0 - bne _0814411E - adds r0, r1, 0 - adds r0, 0x2B - ldrb r0, [r0] - cmp r0, 0x1 - bne _081440DC - ldrh r0, [r3, 0x26] - adds r0, 0x1 - strh r0, [r3, 0x26] - b _0814411E - .pool -_081440DC: - ldrh r0, [r3, 0x26] - subs r0, 0x1 - strh r0, [r3, 0x26] - b _0814411E -_081440E4: - adds r2, r3, 0 - adds r2, 0x2C - ldrb r1, [r2] - movs r0, 0x41 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - adds r1, r3, 0 - adds r1, 0x2A - movs r2, 0 - movs r0, 0x1 - strb r0, [r1] - movs r0, 0x3F - adds r0, r3 - mov r12, r0 - ldrb r0, [r0] - movs r1, 0x4 - orrs r0, r1 - movs r1, 0x11 - negs r1, r1 - ands r0, r1 - mov r1, r12 - strb r0, [r1] - strh r2, [r3, 0x32] - ldr r0, =sub_8143FA4 - str r0, [r3, 0x1C] - movs r0, 0x3D - bl m4aSongNumStart -_0814411E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8144050 - - thumb_func_start sub_8144128 -sub_8144128: @ 8144128 - push {r4,lr} - adds r4, r0, 0 - bl sub_8143B84 - movs r0, 0x34 - ldrsh r1, [r4, r0] - cmp r1, 0x5A - beq _08144142 - movs r0, 0x87 - lsls r0, 1 - cmp r1, r0 - beq _0814414C - b _0814415C -_08144142: - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0x1 - beq _0814415C - b _08144154 -_0814414C: - movs r1, 0x2E - ldrsh r0, [r4, r1] - cmp r0, 0 - beq _0814415C -_08144154: - ldr r0, =sub_8144050 - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x32] -_0814415C: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8144128 - - thumb_func_start sub_8144168 -sub_8144168: @ 8144168 - push {r4,lr} - adds r4, r0, 0 - bl sub_8143B84 - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - ldrb r0, [r0, 0x3] - lsls r0, 27 - lsrs r0, 27 - cmp r0, 0 - beq _08144182 - cmp r0, 0x1 - beq _08144194 -_08144182: - adds r0, r4, 0 - bl sub_81446DC - ldr r0, =sub_8143E14 - b _0814419C - .pool -_08144194: - adds r0, r4, 0 - bl sub_81448B8 - ldr r0, =sub_8144128 -_0814419C: - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8144168 - - thumb_func_start prev_quest_read_x24_hm_usage -prev_quest_read_x24_hm_usage: @ 81441A8 - push {r4,r5,lr} - adds r5, r0, 0 - bl sub_8143B84 - ldrh r0, [r5, 0x32] - subs r0, 0x1 - strh r0, [r5, 0x32] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0xF - bne _081441CE - ldr r0, =gUnknown_0203AB88 - ldr r4, [r0] - adds r4, 0x98 - ldr r0, [r4] - ldr r1, =0xbf800000 - bl __mulsf3 - str r0, [r4] -_081441CE: - movs r1, 0x32 - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _0814425C - movs r1, 0x2E - ldrsh r0, [r5, r1] - cmp r0, 0 - bne _08144244 - ldr r2, =gUnknown_0203AB88 - ldr r0, [r2] - adds r0, 0x7D - movs r1, 0xFF - strb r1, [r0] - ldr r2, [r2] - ldrb r1, [r2, 0x3] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2, 0x3] - adds r0, r5, 0 - adds r0, 0x2B - ldrb r1, [r0] - adds r1, 0x3 - lsls r1, 24 - lsrs r1, 24 - adds r0, r5, 0 - bl StartSpriteAnim - adds r0, r5, 0 - bl sub_8143B14 - movs r0, 0x1E - strh r0, [r5, 0x36] - adds r0, r5, 0 - bl sub_8143AC8 - movs r1, 0x3A - ldrsh r0, [r5, r1] - movs r1, 0x1E - bl __divsi3 - lsls r0, 16 - asrs r0, 16 - lsls r1, r0, 4 - subs r1, r0 - lsls r1, 1 - adds r1, 0xF - strh r1, [r5, 0x3A] - ldr r0, =sub_8143C90 - str r0, [r5, 0x1C] - movs r0, 0x47 - bl m4aSongNumStartOrChange - b _0814425C - .pool -_08144244: - adds r0, r5, 0 - adds r0, 0x2C - ldrb r1, [r0] - movs r2, 0x40 - orrs r1, r2 - strb r1, [r0] - movs r0, 0x38 - bl m4aSongNumStart - adds r0, r5, 0 - bl sub_8144A24 -_0814425C: - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end prev_quest_read_x24_hm_usage - - thumb_func_start sub_8144264 -sub_8144264: @ 8144264 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r6, r0, 0 - bl sub_8143B84 - movs r0, 0 - strh r0, [r6, 0x32] - adds r0, r6, 0 - bl sub_8143B14 - ldr r1, _081442F0 @ =gUnknown_085B62E4 - ldr r4, _081442F4 @ =gUnknown_0203AB88 - ldr r2, [r4] - adds r0, r2, 0 - adds r0, 0x7E - ldrb r0, [r0] - lsls r0, 3 - adds r1, 0x4 - adds r0, r1 - ldr r0, [r0] - ldr r1, [r2, 0x8] - ands r0, r1 - cmp r0, 0 - bne _081442FC - adds r1, r2, 0 - adds r1, 0x7D - movs r0, 0xFF - strb r0, [r1] - ldr r2, [r4] - ldrb r1, [r2, 0x3] - movs r0, 0x7F - ands r0, r1 - strb r0, [r2, 0x3] - adds r0, r6, 0 - adds r0, 0x2B - ldrb r1, [r0] - adds r1, 0x3 - lsls r1, 24 - lsrs r1, 24 - adds r0, r6, 0 - bl StartSpriteAnim - adds r0, r6, 0 - bl sub_8143B14 - movs r0, 0x1E - strh r0, [r6, 0x36] - adds r0, r6, 0 - bl sub_8143AC8 - movs r1, 0x3A - ldrsh r0, [r6, r1] - movs r1, 0x1E - bl __divsi3 - lsls r0, 16 - asrs r0, 16 - lsls r1, r0, 4 - subs r1, r0 - lsls r1, 1 - adds r1, 0xF - strh r1, [r6, 0x3A] - ldr r0, _081442F8 @ =sub_8143C90 - str r0, [r6, 0x1C] - movs r0, 0x47 - bl m4aSongNumStartOrChange - b _081443F8 - .align 2, 0 -_081442F0: - .4byte gUnknown_085B62E4 -_081442F4: - .4byte gUnknown_0203AB88 -_081442F8: - .4byte sub_8143C90 -_081442FC: - movs r0, 0x38 - bl m4aSongNumStart - bl Random - movs r1, 0x1 - mov r8, r1 - ands r1, r0 - mov r8, r1 - cmp r1, 0 - beq _08144340 - ldr r4, [r4] - adds r1, r4, 0 - adds r1, 0x8C - ldr r0, _08144338 @ =0x00000000 - str r0, [r1] - adds r0, r4, 0 - adds r0, 0x7E - ldrb r0, [r0] - adds r0, 0x1 - movs r1, 0xC - bl __modsi3 - lsls r1, r0, 24 - lsrs r2, r1, 24 - adds r1, r4, 0 - adds r1, 0x7F - strb r0, [r1] - ldr r5, _0814433C @ =gUnknown_085B6348 - b _08144378 -_08144338: - .4byte 0x00000000 -_0814433C: - .4byte gUnknown_085B6348 -_08144340: - ldr r7, [r4] - adds r4, r7, 0 - adds r4, 0x8C - ldr r5, =gUnknown_085B6348 - ldrb r0, [r7, 0x4] - lsls r0, 30 - lsrs r0, 25 - adds r1, r5, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, [r0] - adds r0, r1, 0 - bl __addsf3 - str r0, [r4] - adds r0, r7, 0 - adds r0, 0x7E - ldrb r4, [r0] - adds r0, r4, 0 - adds r0, 0xB - movs r1, 0xC - bl __modsi3 - lsls r0, 24 - lsrs r2, r0, 24 - adds r0, r7, 0 - adds r0, 0x7F - strb r4, [r0] -_08144378: - ldr r0, =gUnknown_085B62E4 - lsls r1, r2, 3 - adds r0, 0x4 - adds r1, r0 - ldr r2, =gUnknown_0203AB88 - ldr r3, [r2] - ldr r1, [r1] - ldr r0, [r3, 0x8] - ands r1, r0 - cmp r1, 0 - beq _081443AC - movs r0, 0x1 - strh r0, [r6, 0x2E] - ldrb r0, [r3, 0x4] - lsls r0, 30 - lsrs r0, 25 - adds r0, r5 - ldrb r0, [r0, 0x2] - strh r0, [r6, 0x32] - b _081443E8 - .pool -_081443AC: - strh r1, [r6, 0x2E] - ldrb r1, [r3, 0x4] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0 - beq _081443C4 - lsls r0, r1, 30 - lsrs r0, 25 - adds r0, r5 - ldrb r0, [r0, 0x1] - strh r0, [r6, 0x32] - b _081443E8 -_081443C4: - lsls r0, r1, 30 - lsrs r0, 25 - adds r0, r5 - ldrb r0, [r0, 0x2] - strh r0, [r6, 0x32] - mov r0, r8 - cmp r0, 0 - beq _081443E0 - adds r1, r3, 0 - adds r1, 0x8C - ldr r0, =0x3f000000 - b _081443E6 - .pool -_081443E0: - adds r1, r3, 0 - adds r1, 0x8C - ldr r0, =0xbfc00000 -_081443E6: - str r0, [r1] -_081443E8: - ldr r0, [r2] - adds r0, 0x98 - ldr r1, =0x3dae147b - str r1, [r0] - ldr r0, =prev_quest_read_x24_hm_usage - str r0, [r6, 0x1C] - movs r0, 0x5 - strh r0, [r6, 0x30] -_081443F8: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8144264 - - thumb_func_start sub_8144410 -sub_8144410: @ 8144410 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - adds r6, r0, 0 - bl sub_8143B84 - ldr r4, _081444A4 @ =gUnknown_0203AB88 - ldr r0, [r4] - adds r0, 0x8C - ldr r0, [r0] - ldr r1, _081444A8 @ =0x3F000000 - bl __gtsf2 - cmp r0, 0 - bgt _081444FA - adds r0, r6, 0 - bl sub_8143B14 - adds r0, r6, 0 - bl sub_8143B48 - lsls r0, 16 - cmp r0, 0 - bne _081444BC - ldr r2, [r4] - adds r1, r2, 0 - adds r1, 0x90 - ldr r0, _081444AC @ =0x00000000 - str r0, [r1] - movs r0, 0x8C - adds r0, r2 - mov r8, r0 - ldr r1, _081444B0 @ =gUnknown_085B6348 - mov r9, r1 - ldrb r0, [r2, 0x4] - lsls r7, r0, 30 - lsrs r0, r7, 25 - add r0, r9 - movs r4, 0x3 - ldrsb r4, [r0, r4] - adds r0, r4, 0 - bl __floatsisf - adds r5, r0, 0 - cmp r4, 0 - bge _08144476 - ldr r1, _081444B4 @ =0x43800000 - bl __addsf3 - adds r5, r0, 0 -_08144476: - lsrs r0, r7, 25 - add r0, r9 - ldrb r0, [r0, 0x4] - adds r0, 0x1 - bl __floatsisf - adds r1, r0, 0 - adds r0, r5, 0 - bl __divsf3 - adds r1, r0, 0 - mov r2, r8 - ldr r0, [r2] - bl __subsf3 - mov r1, r8 - str r0, [r1] - movs r0, 0x4 - strh r0, [r6, 0x30] - ldr r0, _081444B8 @ =sub_8144264 - str r0, [r6, 0x1C] - b _081444FA - .align 2, 0 -_081444A4: - .4byte gUnknown_0203AB88 -_081444A8: - .4byte 0x3F000000 -_081444AC: - .4byte 0x00000000 -_081444B0: - .4byte gUnknown_085B6348 -_081444B4: - .4byte 0x43800000 -_081444B8: - .4byte sub_8144264 -_081444BC: - ldr r4, [r4] - adds r7, r4, 0 - adds r7, 0x90 - ldr r0, [r7] - ldr r6, _08144508 @ =0x00000000 - adds r1, r6, 0 - bl __nesf2 - cmp r0, 0 - beq _081444FA - adds r5, r4, 0 - adds r5, 0x8C - ldr r0, [r5] - adds r1, r6, 0 - bl __ltsf2 - cmp r0, 0 - bge _081444FA - str r6, [r7] - str r6, [r5] - adds r4, 0x98 - ldr r0, [r4] - bl __extendsfdf2 - ldr r2, _0814450C @ =0x3FF33333 - ldr r3, _08144510 @ =0x33333333 - bl __divdf3 - bl __truncdfsf2 - str r0, [r4] -_081444FA: - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .align 2, 0 -_08144508: - .4byte 0x00000000 -_0814450C: - .4byte 0x3FF33333 -_08144510: - .4byte 0x33333333 - thumb_func_end sub_8144410 - - thumb_func_start sub_8144514 -sub_8144514: @ 8144514 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r6, r0, 0 - bl sub_8143B84 - ldr r0, =gUnknown_0203AB88 - ldr r5, [r0] - adds r0, r5, 0 - adds r0, 0x94 - ldr r0, [r0] - ldr r1, =0x42200000 - bl __gtsf2 - cmp r0, 0 - bgt _081445B8 - movs r0, 0x98 - adds r0, r5 - mov r8, r0 - adds r7, r5, 0 - adds r7, 0x86 - movs r1, 0 - ldrsh r4, [r7, r1] - adds r0, r4, 0 - bl __floatsisf - adds r2, r0, 0 - cmp r4, 0 - bge _08144556 - ldr r1, =0x47800000 - bl __addsf3 - adds r2, r0, 0 -_08144556: - ldr r0, =0x40800000 - adds r1, r2, 0 - bl __divsf3 - bl __negsf2 - mov r1, r8 - str r0, [r1] - movs r0, 0x90 - adds r0, r5 - mov r8, r0 - adds r5, 0x8C - movs r1, 0 - ldrsh r4, [r7, r1] - adds r0, r4, 0 - bl __floatsisf - adds r2, r0, 0 - cmp r4, 0 - bge _08144586 - ldr r1, =0x47800000 - bl __addsf3 - adds r2, r0, 0 -_08144586: - ldr r0, [r5] - adds r1, r2, 0 - bl __divsf3 - bl __negsf2 - mov r1, r8 - str r0, [r1] - adds r1, r6, 0 - adds r1, 0x2A - movs r0, 0x2 - strb r0, [r1] - adds r2, r6, 0 - adds r2, 0x3F - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - movs r1, 0x11 - negs r1, r1 - ands r0, r1 - strb r0, [r2] - movs r0, 0x3 - strh r0, [r6, 0x30] - ldr r0, =sub_8144410 - str r0, [r6, 0x1C] -_081445B8: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8144514 - - thumb_func_start sub_81445D8 -sub_81445D8: @ 81445D8 - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r6, r0, 0 - bl sub_8143B84 - ldr r4, =gUnknown_0203AB88 - ldr r0, [r4] - adds r0, 0x94 - ldr r0, [r0] - ldr r1, =0x42700000 - bl __gtsf2 - cmp r0, 0 - bgt _0814468A - movs r0, 0x5D - bl m4aSongNumStartOrChange - ldr r5, [r4] - movs r0, 0x98 - adds r0, r5 - mov r8, r0 - adds r7, r5, 0 - adds r7, 0x84 - movs r1, 0 - ldrsh r4, [r7, r1] - adds r0, r4, 0 - bl __floatsisf - adds r2, r0, 0 - cmp r4, 0 - bge _08144620 - ldr r1, =0x47800000 - bl __addsf3 - adds r2, r0, 0 -_08144620: - ldr r0, =0x41a00000 - adds r1, r2, 0 - bl __divsf3 - bl __negsf2 - mov r1, r8 - str r0, [r1] - movs r0, 0x90 - adds r0, r5 - mov r8, r0 - adds r0, r5, 0 - adds r0, 0x8C - ldr r1, [r0] - ldr r0, =0x3f800000 - bl __subsf3 - adds r5, r0, 0 - movs r1, 0 - ldrsh r4, [r7, r1] - adds r0, r4, 0 - bl __floatsisf - adds r2, r0, 0 - cmp r4, 0 - bge _0814465C - ldr r1, =0x47800000 - bl __addsf3 - adds r2, r0, 0 -_0814465C: - adds r0, r5, 0 - adds r1, r2, 0 - bl __divsf3 - mov r1, r8 - str r0, [r1] - adds r1, r6, 0 - adds r1, 0x2A - movs r0, 0x1 - strb r0, [r1] - adds r2, r6, 0 - adds r2, 0x3F - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - movs r1, 0x11 - negs r1, r1 - ands r0, r1 - strb r0, [r2] - movs r0, 0x2 - strh r0, [r6, 0x30] - ldr r0, =sub_8144514 - str r0, [r6, 0x1C] -_0814468A: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81445D8 - - thumb_func_start sub_81446AC -sub_81446AC: @ 81446AC - push {r4,lr} - adds r4, r0, 0 - movs r1, 0 - movs r0, 0x1 - strh r0, [r4, 0x30] - strh r1, [r4, 0x32] - adds r0, r4, 0 - bl sub_8143B84 - adds r2, r4, 0 - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - ldr r0, =sub_81445D8 - str r0, [r4, 0x1C] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81446AC - - thumb_func_start sub_81446DC -sub_81446DC: @ 81446DC - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x8 - mov r8, r0 - ldr r1, =gUnknown_085B7B0A - mov r0, sp - movs r2, 0x8 - bl memcpy - mov r1, r8 - ldrh r0, [r1, 0x3C] - subs r0, 0x2 - lsls r0, 16 - lsrs r0, 16 - mov r9, r0 - ldr r5, =gUnknown_0203AB88 - ldr r0, =gSpriteTemplate_85B79F8 - movs r2, 0xC - negs r2, r2 - movs r1, 0x24 - movs r3, 0x32 - bl CreateSprite - ldr r1, [r5] - adds r1, 0x73 - strb r0, [r1] - ldr r4, =gSpriteTemplate_85B7ABC - mov r3, r8 - movs r0, 0x2E - ldrsh r2, [r3, r0] - lsls r2, 2 - mov r1, sp - adds r0, r1, r2 - movs r3, 0 - ldrsh r1, [r0, r3] - mov r0, sp - adds r0, 0x2 - adds r0, r2 - movs r3, 0 - ldrsh r2, [r0, r3] - adds r0, r4, 0 - movs r3, 0x3B - bl CreateSprite - ldr r1, [r5] - adds r1, 0x74 - strb r0, [r1] - adds r4, 0x18 - adds r0, r4, 0 - movs r1, 0x24 - movs r2, 0x8C - movs r3, 0x33 - bl CreateSprite - ldr r1, [r5] - adds r1, 0x75 - strb r0, [r1] - ldr r3, =gSprites - ldr r0, [r5] - adds r0, 0x75 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r3 - ldrb r2, [r0, 0x1] - movs r1, 0xD - negs r1, r1 - ands r1, r2 - movs r2, 0x4 - orrs r1, r2 - strb r1, [r0, 0x1] - movs r7, 0 - adds r6, r3, 0 - ldr r0, =gUnknown_085B6348 - mov r12, r0 - mov r10, r5 -_0814477C: - ldr r0, [r5] - adds r3, r7, 0 - adds r3, 0x37 - adds r0, 0x3C - adds r0, r3 - ldrb r0, [r0] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - adds r1, 0x3E - ldrb r2, [r1] - movs r0, 0x3 - negs r0, r0 - ands r0, r2 - strb r0, [r1] - ldr r0, [r5] - adds r0, 0x3C - adds r0, r3 - ldrb r1, [r0] - 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, [r5] - adds r0, 0x3C - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r0, 0x2C - ldrb r1, [r0] - movs r2, 0x40 - orrs r1, r2 - strb r1, [r0] - ldr r0, [r5] - adds r0, 0x3C - adds r0, r3 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r0, 0x2C - ldrb r1, [r0] - movs r2, 0x80 - orrs r1, r2 - strb r1, [r0] - ldr r4, [r5] - adds r2, r4, 0 - adds r2, 0x3C - adds r2, r3 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r1, r4, 0 - adds r1, 0x73 - ldrb r1, [r1] - strh r1, [r0, 0x36] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r1, r4, 0 - adds r1, 0x74 - ldrb r1, [r1] - strh r1, [r0, 0x38] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r1, r4, 0 - adds r1, 0x75 - ldrb r1, [r1] - strh r1, [r0, 0x3A] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - mov r1, r9 - strh r1, [r0, 0x32] - ldrb r0, [r2] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r6 - mov r0, r8 - movs r1, 0x3C - ldrsh r3, [r0, r1] - ldrb r1, [r4, 0x4] - lsls r1, 30 - lsrs r0, r1, 25 - add r0, r12 - ldrb r0, [r0, 0x1] - muls r3, r0 - lsrs r1, 25 - add r1, r12 - ldrb r0, [r1, 0x2] - ldr r1, =0x0000ffff - adds r0, r1 - adds r3, r0 - strh r3, [r2, 0x34] - adds r0, r7, 0x1 - lsls r0, 24 - lsrs r7, r0, 24 - ldr r2, =gSprites - cmp r7, 0x2 - bls _0814477C - mov r3, r10 - ldr r0, [r3] - adds r0, 0x74 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r1, [r0] - movs r2, 0x2 - orrs r1, r2 - strb r1, [r0] - ldr r0, [r3] - mov r1, r8 - str r1, [r0, 0x38] - add sp, 0x8 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81446DC - thumb_func_start sub_81448B8 sub_81448B8: @ 81448B8 push {r4-r7,lr} diff --git a/include/m4a.h b/include/m4a.h index 595379495..4847c12cc 100644 --- a/include/m4a.h +++ b/include/m4a.h @@ -8,7 +8,8 @@ void m4aSoundVSyncOn(void); void m4aSoundInit(void); void m4aSoundMain(void); -void m4aSongNumStart(u16); +void m4aSongNumStart(u16 n); +void m4aSongNumStartOrChange(u16 n); void m4aSongNumStop(u16 n); void m4aMPlayAllStop(void); void m4aMPlayContinue(struct MusicPlayerInfo *mplayInfo); diff --git a/src/roulette.c b/src/roulette.c index fb12b93d0..b471598c6 100644 --- a/src/roulette.c +++ b/src/roulette.c @@ -113,8 +113,8 @@ extern struct Roulette u8 var7F; s16 var80; s16 var82; - s16 var84; - s16 var86; + u16 var84; + u16 var86; float var88; float var8C; float var90; @@ -179,6 +179,9 @@ extern u8 gUnknown_0203AB8C; /*static*/ void sub_81439C8(void); /*static*/ void sub_8143A40(void); /*static*/ void sub_81446AC(struct Sprite *); +/*static*/ void sub_81446DC(struct Sprite *); +/*static*/ void sub_81448B8(struct Sprite *); +/*static*/ void sub_8144A24(struct Sprite *); extern const struct BgTemplate gUnknown_085B6140[3]; extern const struct WindowTemplate gUnknown_085B614C[]; @@ -232,6 +235,11 @@ extern const struct SpriteTemplate gUnknown_085B7814; extern const struct SpriteTemplate gUnknown_085B782C; extern const struct SpriteTemplate gUnknown_085B7844; extern const u8 gUnknown_085B7B04[]; +extern const struct CompressedSpriteSheet gUnknown_085B7948; +extern const struct SpriteTemplate gSpriteTemplate_85B7950; +extern const u16 gUnknown_085B7B0A[][2]; +extern const struct SpriteTemplate gSpriteTemplate_85B79F8; +extern const struct SpriteTemplate gSpriteTemplate_85B7ABC[]; void sub_8140238(void) { @@ -406,8 +414,8 @@ void sub_81405CC(void) NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, FALSE); AddTextPrinterParameterized(gUnknown_0203AB8C, 1, gUnknown_082A5B89, 0, 1, TEXT_SPEED_FF, NULL); CopyWindowToVram(gUnknown_0203AB8C, 3); - gSpriteCoordOffsetX = -0x3C; - gSpriteCoordOffsetY = 0x0; + gSpriteCoordOffsetX = -60; + gSpriteCoordOffsetY = 0; break; case 7: SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_MODE_0 | @@ -1550,7 +1558,7 @@ bool8 sub_81421E8(u8 r0, u8 r1) void sub_8142284(u8 r0) { - u16 var0 = 0x0; + u16 var0 = 0; u8 var2; u16 var3; u8 i; @@ -2184,3 +2192,532 @@ void sub_814372C(u8 r0) } } } + +void sub_814390C(struct Sprite *sprite) +{ + sprite->pos2.x = gUnknown_0203AB88->var26; +} + +void sub_814391C(void) +{ + u8 spriteId; + struct SpriteSheet s; + LZ77UnCompWram(gUnknown_085B7948.data, gDecompressionBuffer); + s.data = gDecompressionBuffer; + s.size = gUnknown_085B7948.size; + s.tag = gUnknown_085B7948.tag; + LoadSpriteSheet(&s); + spriteId = CreateSprite(&gSpriteTemplate_85B7950, 116, 80, 81); + gSprites[spriteId].data[0] = gUnknown_0203AB88->var24; + gSprites[spriteId].data[1] = 0; + gSprites[spriteId].animPaused = TRUE; + gSprites[spriteId].affineAnimPaused = TRUE; + gSprites[spriteId].coordOffsetEnabled = TRUE; +} + +void sub_814399C(struct Sprite *sprite) +{ + u32 t = sprite->oam.matrixNum; + struct OamMatrix *m = &gOamMatrices[0]; + m[t].d = gUnknown_0203AB88->var2C.a; + m[t].a = gUnknown_0203AB88->var2C.a; + m[t].b = gUnknown_0203AB88->var2C.b; + m[t].c = gUnknown_0203AB88->var2C.c; +} + +void sub_81439C8(void) +{ + u8 i; + for (i = 0; i < 6; i++) + { + gUnknown_0203AB88->var3C[i] = CreateSprite(&gSpriteTemplate_85B7928, 116, 80, 57 - i); + if (gUnknown_0203AB88->var3C[i] != MAX_SPRITES) + { + gSprites[gUnknown_0203AB88->var3C[i]].invisible = TRUE; + gSprites[gUnknown_0203AB88->var3C[i]].coordOffsetEnabled = TRUE; + } + } +} + +void sub_8143A40(void) +{ + u8 t = gUnknown_0203AB88->var3C[0]; + u8 i; + for (i = 0; i < 6; i++) + { + u8 j; + gSprites[t].invisible = TRUE; + gSprites[t].callback = &SpriteCallbackDummy; + StartSpriteAnim(&gSprites[t], 0); + for (j = 0; j < 8; j++) + { + gSprites[t].data[j] = 0; + } + t++; + } +} + +s16 sub_8143AC8(struct Sprite *sprite) +{ + if (gUnknown_0203AB88->var24 > sprite->data[3]) + { + sprite->data[6] = 360 - gUnknown_0203AB88->var24 + sprite->data[3]; + if (sprite->data[6] >= 360) + sprite->data[6] -= 360; + } + else + { + sprite->data[6] = sprite->data[3] - gUnknown_0203AB88->var24; + } + + return sprite->data[6]; +} + +u8 sub_8143B14(struct Sprite *sprite) +{ + gUnknown_0203AB88->var7E = sub_8143AC8(sprite) / 30.0f; + return gUnknown_0203AB88->var7E; +} + +s16 sub_8143B48(struct Sprite *sprite) +{ + s16 t = sub_8143AC8(sprite) % 30; + u16 z; + if (t == 14) + { + z = 0; + return sprite->data[2] = z; + } + else if (t > 13) + { + z = 43 - t; + return sprite->data[2] = z; + } + else + { + z = 14 - t; + return sprite->data[2] = z; + } +} + +void sub_8143B84(struct Sprite *sprite) +{ + s16 sin, cos; + + gUnknown_0203AB88->var8C += gUnknown_0203AB88->var90; + gUnknown_0203AB88->var88 += gUnknown_0203AB88->var8C; + + if (gUnknown_0203AB88->var88 >= 360) + gUnknown_0203AB88->var88 -= 360.0f; + else if (gUnknown_0203AB88->var88 < 0.0f) + gUnknown_0203AB88->var88 += 360.0f; + + sprite->data[3] = gUnknown_0203AB88->var88; + gUnknown_0203AB88->var98 += gUnknown_0203AB88->var9C; + gUnknown_0203AB88->var94 += gUnknown_0203AB88->var98; + sprite->data[4] = gUnknown_0203AB88->var94; + sin = Sin2(sprite->data[3]); + cos = Cos2(sprite->data[3]); + sprite->pos2.x = sin * sprite->data[4] >> 12; + sprite->pos2.y = -cos * sprite->data[4] >> 12; + if (IsSEPlaying()) + { + m4aMPlayPanpotControl(&gMPlayInfo_SE1, 0xFFFF, sprite->pos2.x); + m4aMPlayPanpotControl(&gMPlayInfo_SE2, 0xFFFF, sprite->pos2.x); + } +} + +void sub_8143C90(struct Sprite *sprite) +{ + s16 sin, cos; + sprite->data[3] = gUnknown_0203AB88->var24 + sprite->data[6]; + if (sprite->data[3] >= 360) + sprite->data[3] -= 360; + sin = Sin2(sprite->data[3]); + cos = Cos2(sprite->data[3]); + sprite->pos2.x = sin * sprite->data[4] >> 12; + sprite->pos2.y = -cos * sprite->data[4] >> 12; + sprite->pos2.y += gSpriteCoordOffsetY; +} + +void sub_8143CFC(struct Sprite *sprite) +{ + sub_8143B84(sprite); + sprite->data[2]++; + if (sprite->data[4] < -132 || sprite->data[4] > 80) + sprite->invisible = TRUE; + else + sprite->invisible = FALSE; + + if (sprite->data[2] >= 30) + { + if (!sprite->data[0]) + { + if (gUnknown_0203AB88->var94 <= gUnknown_0203AB88->varA0 - 2.0f) + { + gUnknown_0203AB88->var7D = 0xFF; + gUnknown_0203AB88->var03_7 = 0; + StartSpriteAnim(sprite, sprite->animCmdIndex + 0x3); + sub_8143B14(sprite); + sprite->data[4] = 30; + sub_8143AC8(sprite); + sprite->data[6] = (sprite->data[6] / 30) * 30 + 15; + sprite->callback = sub_8143C90; + m4aSongNumStartOrChange(SE_HASHI); + gUnknown_0203AB88->var9C = gUnknown_0203AB88->var98 = 0.0f; + gUnknown_0203AB88->var8C = -1.0f; + } + } + else + { + if (gUnknown_0203AB88->var94 >= gUnknown_0203AB88->varA0 - 2.0f) + { + gUnknown_0203AB88->var7D = 0xFF; + gUnknown_0203AB88->var03_7 = 0; + StartSpriteAnim(sprite, sprite->animCmdIndex + 3); + sub_8143B14(sprite); + sprite->data[4] = 30; + sub_8143AC8(sprite); + sprite->data[6] = (sprite->data[6] / 30) * 30 + 15; + sprite->callback = sub_8143C90; + m4aSongNumStartOrChange(SE_HASHI); + gUnknown_0203AB88->var9C = gUnknown_0203AB88->var98 = 0.0f; + gUnknown_0203AB88->var8C = -1.0f; + } + } + } +} + +void sub_8143E14(struct Sprite *sprite) +{ + float f0, f1, f2; + sub_8143B84(sprite); + + switch (sprite->data[3]) + { + case 0: + if (sprite->data[0] != 1) + { + f0 = sprite->data[7]; + f1 = (f0 * gUnknown_085B6348[gUnknown_0203AB88->var04_0].var01 + (gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02 - 1)); + f2 = (f0 / gUnknown_085B6348[gUnknown_0203AB88->var04_0].var0C); + } + else + { + return; + } + break; + case 180: + if (sprite->data[0] != 0) + { + f0 = sprite->data[7]; + f1 = (f0 * gUnknown_085B6348[gUnknown_0203AB88->var04_0].var01 + (gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02 - 1)); + f2 = -(f0 / gUnknown_085B6348[gUnknown_0203AB88->var04_0].var0C); + } + else + { + return; + } + break; + default: + return; + } + gUnknown_0203AB88->varA0 = gUnknown_0203AB88->var94; + gUnknown_0203AB88->var98 = f2; + gUnknown_0203AB88->var9C = -((f2 * 2.0f) / f1 + (2.0f / (f1 * f1))); + gUnknown_0203AB88->var8C = 0.0f; + sprite->animPaused = FALSE; + sprite->animNum = 0; + sprite->animBeginning = TRUE; + sprite->animEnded = FALSE; + sprite->callback = sub_8143CFC; + sprite->data[2] = 0; +} + +void sub_8143FA4(struct Sprite *sprite) +{ + sprite->pos2.y = (s16)(sprite->data[2] * 0.05f * sprite->data[2]) - 45; + sprite->data[2]++; + if (sprite->data[2] > 29 && sprite->pos2.y >= 0) + { + gUnknown_0203AB88->var7D = 0xFF; + gUnknown_0203AB88->var03_7 = FALSE; + StartSpriteAnim(sprite, sprite->animCmdIndex + 3); + sub_8143B14(sprite); + sprite->data[4] = 30; + sub_8143AC8(sprite); + sprite->data[6] = (sprite->data[6] / 30) * 30 + 15; + sprite->callback = sub_8143C90; + m4aSongNumStartOrChange(SE_HASHI); + gUnknown_0203AB88->var03_6 = TRUE; + } +} + +void sub_8144050(struct Sprite *sprite) +{ + if (sprite->data[2]++ < 45) + { + sprite->pos2.y--; + if (sprite->data[2] == 45) + { + if (gSprites[gUnknown_0203AB88->var3C[55]].animCmdIndex == 1) + sprite->pos2.y++; + } + } + else + { + if (sprite->data[2] < sprite->data[7]) + { + if (gSprites[gUnknown_0203AB88->var3C[55]].animDelayCounter == 0) + { + if (gSprites[gUnknown_0203AB88->var3C[55]].animCmdIndex == 1) + sprite->pos2.y++; + else + sprite->pos2.y--; + } + } + else + { + sprite->animPaused = FALSE; + sprite->animNum = 1; + sprite->animBeginning = TRUE; + sprite->animEnded = FALSE; + sprite->data[2] = 0; + sprite->callback = sub_8143FA4; + m4aSongNumStart(SE_NAGERU); + } + } +} + +void sub_8144128(struct Sprite *sprite) +{ + sub_8143B84(sprite); + switch (sprite->data[3]) + { + case 90: + if (sprite->data[0] != 1) + { + sprite->callback = &sub_8144050; + sprite->data[2] = 0; + } + break; + case 270: + if (sprite->data[0] != 0) + { + sprite->callback = &sub_8144050; + sprite->data[2] = 0; + } + break; + } +} + +void sub_8144168(struct Sprite *sprite) +{ + sub_8143B84(sprite); + switch (gUnknown_0203AB88->var03_0) + { + default: + case 0: + sub_81446DC(sprite); + sprite->callback = sub_8143E14; + break; + case 1: + sub_81448B8(sprite); + sprite->callback = sub_8144128; + break; + } +} + +void prev_quest_read_x24_hm_usage(struct Sprite *sprite) +{ + sub_8143B84(sprite); + if (sprite->data[2]-- == 16) + gUnknown_0203AB88->var98 *= -1.0f; + if (sprite->data[2] == 0) + { + if (!sprite->data[0]) + { + gUnknown_0203AB88->var7D = 0xFF; + gUnknown_0203AB88->var03_7 = 0; + StartSpriteAnim(sprite, sprite->animCmdIndex + 3); + sub_8143B14(sprite); + sprite->data[4] = 30; + sub_8143AC8(sprite); + sprite->data[6] = (sprite->data[6] / 30) * 30 + 15; + sprite->callback = sub_8143C90; + m4aSongNumStartOrChange(SE_HASHI); + } + else + { + sprite->animPaused = TRUE; + m4aSongNumStart(SE_KON); + sub_8144A24(sprite); + } + } +} + +void sub_8144264(struct Sprite *sprite) +{ + sub_8143B84(sprite); + sprite->data[2] = 0; + sub_8143B14(sprite); + if (!(gUnknown_085B62E4[gUnknown_0203AB88->var7E].var04 & gUnknown_0203AB88->var08)) + { + gUnknown_0203AB88->var7D = 0xFF; + gUnknown_0203AB88->var03_7 = 0; + StartSpriteAnim(sprite, sprite->animCmdIndex + 3); + sub_8143B14(sprite); + sprite->data[4] = 30; + sub_8143AC8(sprite); + sprite->data[6] = (sprite->data[6] / 30) * 30 + 15; + sprite->callback = sub_8143C90; + m4aSongNumStartOrChange(SE_HASHI); + } + else + { + u8 t; + u32 z; + m4aSongNumStart(SE_KON); + z = Random() & 1; + if (z) + { + gUnknown_0203AB88->var8C = 0.0f; + gUnknown_0203AB88->var7F = t = (gUnknown_0203AB88->var7E + 1) % 12; + } + else + { + float temp; + gUnknown_0203AB88->var8C = (temp = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var1C) * 2.0f; + t = (gUnknown_0203AB88->var7E + 11) % 12; + gUnknown_0203AB88->var7F = gUnknown_0203AB88->var7E; + } + if (gUnknown_085B62E4[t].var04 & gUnknown_0203AB88->var08) + { + sprite->data[0] = 1; + sprite->data[2] = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02; + } + else + { + sprite->data[0] = gUnknown_085B62E4[t].var04 & gUnknown_0203AB88->var08; + if (gUnknown_0203AB88->var04_0) + { + sprite->data[2] = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var01; + } + else + { + sprite->data[2] = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02; + if (z) + { + gUnknown_0203AB88->var8C = 0.5f; + } + else + { + gUnknown_0203AB88->var8C = -1.5f; + } + } + } + gUnknown_0203AB88->var98 = 0.085f; + sprite->callback = prev_quest_read_x24_hm_usage; + sprite->data[1] = 5; + } +} + +void sub_8144410(struct Sprite *sprite) +{ + sub_8143B84(sprite); + if (gUnknown_0203AB88->var8C > 0.5f) + return; + + sub_8143B14(sprite); + if (!sub_8143B48(sprite)) + { + gUnknown_0203AB88->var90 = 0.0f; + gUnknown_0203AB88->var8C -= (float)(gUnknown_085B6348[gUnknown_0203AB88->var04_0].var03) + / (gUnknown_085B6348[gUnknown_0203AB88->var04_0].var04 + 1); + sprite->data[1] = 4; + sprite->callback = sub_8144264; + } + else + { + if (gUnknown_0203AB88->var90 != 0.0f) + { + if (gUnknown_0203AB88->var8C < 0.0f) + { + gUnknown_0203AB88->var90 = 0.0f; + gUnknown_0203AB88->var8C = 0.0f; + gUnknown_0203AB88->var98 /= 1.2; + } + } + } +} + +void sub_8144514(struct Sprite *sprite) +{ + sub_8143B84(sprite); + if (gUnknown_0203AB88->var94 > 40.f) + return; + + gUnknown_0203AB88->var98 = -(4.0f / (float)gUnknown_0203AB88->var86); + gUnknown_0203AB88->var90 = -(gUnknown_0203AB88->var8C / (float)gUnknown_0203AB88->var86); + sprite->animNum = 2; + sprite->animBeginning = TRUE; + sprite->animEnded = FALSE; + sprite->data[1] = 3; + sprite->callback = sub_8144410; +} + +void sub_81445D8(struct Sprite *sprite) +{ + sub_8143B84(sprite); + if (gUnknown_0203AB88->var94 > 60.0f) + return; + + m4aSongNumStartOrChange(SE_TAMAKORO_E); + gUnknown_0203AB88->var98 = -(20.0f / (float)gUnknown_0203AB88->var84); + gUnknown_0203AB88->var90 = ((1.0f - gUnknown_0203AB88->var8C) / (float)gUnknown_0203AB88->var84); + sprite->animNum = 1; + sprite->animBeginning = TRUE; + sprite->animEnded = FALSE; + sprite->data[1] = 2; + sprite->callback = sub_8144514; +} + +void sub_81446AC(struct Sprite *sprite) +{ + sprite->data[1] = 1; + sprite->data[2] = 0; + sub_8143B84(sprite); + sprite->invisible = FALSE; + sprite->callback = sub_81445D8; +} + +void sub_81446DC(struct Sprite *sprite) +{ + u16 t; + u8 i; + s16 s[2][2]; + struct Roulette *p; + + memcpy(s, gUnknown_085B7B0A, 8); + t = sprite->data[7] - 2; + p = gUnknown_0203AB88; // why??? + gUnknown_0203AB88->var3C[55] = CreateSprite(&gSpriteTemplate_85B79F8, 36, -12, 50); + gUnknown_0203AB88->var3C[56] = CreateSprite(&gSpriteTemplate_85B7ABC[0], s[sprite->data[0]][0], s[sprite->data[0]][1], 59); + gUnknown_0203AB88->var3C[57] = CreateSprite(&gSpriteTemplate_85B7ABC[1], 36, 140, 51); + gSprites[gUnknown_0203AB88->var3C[57]].oam.objMode = 1; + for (i = 0; i < 3; i++) + { + gSprites[gUnknown_0203AB88->var3C[i + 55]].coordOffsetEnabled = FALSE; + gSprites[gUnknown_0203AB88->var3C[i + 55]].invisible = TRUE; + gSprites[gUnknown_0203AB88->var3C[i + 55]].animPaused = TRUE; + gSprites[gUnknown_0203AB88->var3C[i + 55]].affineAnimPaused = TRUE; + gSprites[gUnknown_0203AB88->var3C[i + 55]].data[4] = gUnknown_0203AB88->var3C[55]; + gSprites[gUnknown_0203AB88->var3C[i + 55]].data[5] = gUnknown_0203AB88->var3C[56]; + gSprites[gUnknown_0203AB88->var3C[i + 55]].data[6] = gUnknown_0203AB88->var3C[57]; + gSprites[gUnknown_0203AB88->var3C[i + 55]].data[2] = t; + gSprites[gUnknown_0203AB88->var3C[i + 55]].data[3] = (sprite->data[7] * gUnknown_085B6348[gUnknown_0203AB88->var04_0].var01) + + (gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02 + 0xFFFF); + } + gSprites[gUnknown_0203AB88->var3C[56]].coordOffsetEnabled = TRUE; + gUnknown_0203AB88->var38 = sprite; +} From e7f8190ba37a28dc3f24f950702349236d7c6ba0 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Tue, 1 Jan 2019 15:25:52 -0600 Subject: [PATCH 4/6] Finish roulette port --- asm/roulette.s | 1305 ------------------------------------------------ ld_script.txt | 1 - src/roulette.c | 717 +++++++++++++++++++++++++- 3 files changed, 716 insertions(+), 1307 deletions(-) delete mode 100644 asm/roulette.s diff --git a/asm/roulette.s b/asm/roulette.s deleted file mode 100644 index 2d3c2a25a..000000000 --- a/asm/roulette.s +++ /dev/null @@ -1,1305 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_81448B8 -sub_81448B8: @ 81448B8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - sub sp, 0x8 - adds r7, r0, 0 - movs r0, 0 - mov r8, r0 - ldr r1, =gUnknown_085B7B12 - mov r0, sp - movs r2, 0x8 - bl memcpy - ldrh r0, [r7, 0x3C] - subs r0, 0x2 - lsls r0, 16 - lsrs r0, 16 - mov r9, r0 - ldr r0, =gSpriteTemplate_85B7A10 - movs r1, 0x2E - ldrsh r2, [r7, r1] - lsls r2, 2 - mov r3, sp - adds r1, r3, r2 - movs r3, 0 - ldrsh r1, [r1, r3] - mov r4, sp - adds r4, 0x2 - adds r2, r4, r2 - movs r3, 0 - ldrsh r2, [r2, r3] - movs r3, 0x32 - bl CreateSprite - ldr r5, =gUnknown_0203AB88 - ldr r1, [r5] - adds r1, 0x73 - strb r0, [r1] - ldr r0, [r5] - adds r0, 0x73 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - ldr r6, =gSprites - adds r0, r6 - ldrh r1, [r7, 0x2E] - lsls r1, 24 - lsrs r1, 24 - bl StartSpriteAnim - ldr r0, =gUnknown_085B7AEC - movs r1, 0x2E - ldrsh r2, [r7, r1] - lsls r2, 2 - mov r3, sp - adds r1, r3, r2 - movs r3, 0 - ldrsh r1, [r1, r3] - adds r4, r2 - movs r3, 0 - ldrsh r2, [r4, r3] - movs r3, 0x33 - bl CreateSprite - ldr r1, [r5] - adds r1, 0x74 - strb r0, [r1] - ldr r0, [r5] - adds r0, 0x74 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r0, 0x2C - ldrb r1, [r0] - movs r2, 0x80 - orrs r1, r2 - strb r1, [r0] - ldr r0, [r5] - adds r0, 0x74 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r0, 0x2C - ldrb r1, [r0] - movs r2, 0x40 - orrs r1, r2 - strb r1, [r0] - mov r0, r9 - lsls r2, r0, 16 - asrs r2, 16 - ldr r3, =gUnknown_085B6348 - ldr r0, [r5] - ldrb r1, [r0, 0x4] - lsls r1, 30 - lsrs r0, r1, 25 - adds r0, r3 - ldrb r0, [r0, 0x1] - muls r2, r0 - lsrs r1, 25 - adds r1, r3 - ldrh r0, [r1, 0x10] - adds r0, 0x2D - adds r2, r0 - strh r2, [r7, 0x3C] -_08144992: - ldr r0, =gUnknown_0203AB88 - ldr r4, [r0] - mov r1, r8 - adds r2, r4, r1 - adds r2, 0x73 - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r1, r4, 0 - adds r1, 0x73 - ldrb r1, [r1] - strh r1, [r0, 0x36] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - adds r3, r4, 0 - adds r3, 0x74 - ldrb r1, [r3] - strh r1, [r0, 0x38] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - ldrb r1, [r3] - strh r1, [r0, 0x3A] - ldrb r1, [r2] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r6 - mov r3, r9 - strh r3, [r0, 0x32] - ldrb r0, [r2] - lsls r1, r0, 4 - adds r1, r0 - lsls r1, 2 - adds r1, r6 - ldrh r0, [r7, 0x3C] - subs r0, 0x2D - strh r0, [r1, 0x34] - mov r0, r8 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - cmp r0, 0x1 - bls _08144992 - str r7, [r4, 0x38] - add sp, 0x8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81448B8 - - thumb_func_start sub_8144A24 -sub_8144A24: @ 8144A24 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x14 - adds r7, r0, 0 - movs r0, 0 - mov r9, r0 - movs r1, 0x5 - mov r8, r1 - str r0, [sp, 0xC] - mov r0, sp - movs r1, 0 - movs r2, 0xA - bl memset - bl Random - lsls r0, 16 - lsrs r0, 16 - str r0, [sp, 0x10] - ldr r3, _08144B10 @ =gUnknown_0203AB88 - ldr r0, [r3] - adds r0, 0x7D - movs r5, 0x1 - strb r5, [r0] - ldr r2, [r3] - ldrb r0, [r2, 0x3] - movs r1, 0x20 - orrs 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 r0, [r3] - adds r0, 0x7E - movs r1, 0xFF - strb r1, [r0] - ldr r6, [r3] - adds r4, r6, 0 - adds r4, 0x88 - movs r1, 0x34 - ldrsh r0, [r7, r1] - bl __floatsisf - str r0, [r4] - adds r1, r6, 0 - adds r1, 0x98 - ldr r0, _08144B14 @ =0x00000000 - str r0, [r1] - adds r2, r6, 0 - adds r2, 0x8C - ldr r1, _08144B18 @ =gUnknown_085B6348 - ldrb r0, [r6, 0x4] - lsls r0, 30 - lsrs r0, 25 - adds r1, 0x1C - adds r0, r1 - ldr r0, [r0] - str r0, [r2] - ldrb r0, [r6, 0x4] - lsls r0, 30 - lsrs r0, 30 - lsls r1, r0, 4 - subs r1, r0 - lsls r1, 1 - adds r1, 0x21 - ldrb r0, [r6, 0x3] - lsls r0, 27 - lsrs r0, 27 - subs r5, r0 - lsls r0, r5, 4 - subs r0, r5 - adds r1, r0 - lsls r1, 16 - lsrs r1, 16 - mov r5, r9 - movs r0, 0x34 - ldrsh r2, [r7, r0] -_08144ACA: - cmp r1, r2 - bge _08144AD6 - adds r0, r1, 0 - adds r0, 0x5A - cmp r2, r0 - ble _08144B38 -_08144AD6: - cmp r5, 0x3 - beq _08144B1C - adds r0, r1, 0 - adds r0, 0x5A - lsls r0, 16 - lsrs r1, r0, 16 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, 0x3 - bls _08144ACA -_08144AEC: - ldr r0, _08144B10 @ =gUnknown_0203AB88 - ldr r0, [r0] - ldrb r1, [r0, 0x3] - movs r0, 0x1F - ands r0, r1 - cmp r0, 0 - beq _08144B64 - movs r1, 0x2E - ldrsh r0, [r7, r1] - cmp r0, 0 - beq _08144B58 - movs r0, 0x98 - lsls r0, 1 - movs r1, 0x3F - negs r1, r1 - bl PlayCry1 - b _08144B70 - .align 2, 0 -_08144B10: - .4byte gUnknown_0203AB88 -_08144B14: - .4byte 0x00000000 -_08144B18: - .4byte gUnknown_085B6348 -_08144B1C: - movs r0, 0x1 - strh r0, [r7, 0x2E] - ldr r0, =gUnknown_0203AB88 - ldr r2, [r0] - ldrb r1, [r2, 0x3] - movs r0, 0x20 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x3] - b _08144AEC - .pool -_08144B38: - lsrs r0, r5, 1 - strh r0, [r7, 0x2E] - ldr r0, =gUnknown_0203AB88 - ldr r3, [r0] - movs r1, 0x1 - ands r1, r5 - ldrb r2, [r3, 0x3] - movs r0, 0x20 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x3] - b _08144AEC - .pool -_08144B58: - movs r0, 0x98 - lsls r0, 1 - movs r1, 0x3F - bl PlayCry1 - b _08144B70 -_08144B64: - movs r0, 0x99 - lsls r0, 1 - movs r1, 0x3F - negs r1, r1 - bl PlayCry1 -_08144B70: - movs r0, 0x2 - mov r10, r0 - ldr r4, =gUnknown_0203AB88 - ldr r5, [r4] - adds r0, r5, 0 - adds r0, 0x7F - ldrb r0, [r0] - adds r0, 0x2 - movs r1, 0xC - bl __modsi3 - lsls r0, 24 - lsrs r6, r0, 24 - ldrb r1, [r5, 0x3] - movs r0, 0x1F - ands r0, r1 - cmp r0, 0x1 - bne _08144BA8 - ldrb r1, [r5, 0x4] - movs r0, 0x3 - ands r0, r1 - cmp r0, 0x1 - bne _08144BA8 - mov r0, r8 - adds r0, 0x6 - b _08144BAC - .pool -_08144BA8: - mov r0, r8 - add r0, r10 -_08144BAC: - lsls r0, 24 - lsrs r0, 24 - mov r8, r0 - mov r5, r10 - cmp r5, r8 - bcs _08144C18 - ldr r1, =gUnknown_085B6154+0xC - mov r10, r1 -_08144BBC: - ldr r3, [r4] - lsls r0, r6, 3 - ldr r1, =gUnknown_085B62E4+0x4 - adds r0, r1 - ldr r1, [r3, 0x8] - ldr r2, [r0] - ands r1, r2 - cmp r1, 0 - bne _08144C02 - mov r0, r9 - adds r1, r0, 0x1 - lsls r1, 24 - lsrs r1, 24 - mov r9, r1 - add r0, sp - strb r5, [r0] - ldr r0, [sp, 0xC] - cmp r0, 0 - bne _08144C02 - ldrb r1, [r3, 0x1A] - lsls r1, 28 - lsrs r1, 28 - adds r0, r3, 0 - adds r0, 0x1B - adds r0, r1 - ldrb r1, [r0] - lsls r0, r1, 2 - adds r0, r1 - lsls r0, 2 - add r0, r10 - ldr r0, [r0] - ands r2, r0 - cmp r2, 0 - beq _08144C02 - str r5, [sp, 0xC] -_08144C02: - adds r0, r6, 0x1 - movs r1, 0xC - bl __modsi3 - lsls r0, 24 - lsrs r6, r0, 24 - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r5, r0, 24 - cmp r5, r8 - bcc _08144BBC -_08144C18: - ldr r0, [r4] - ldrb r1, [r0, 0x3] - lsls r1, 27 - lsrs r1, 27 - adds r1, 0x1 - ldrb r0, [r0, 0x2] - ands r1, r0 - cmp r1, 0 - beq _08144C48 - ldr r1, [sp, 0xC] - cmp r1, 0 - beq _08144C48 - movs r0, 0xFF - ldr r1, [sp, 0x10] - ands r0, r1 - cmp r0, 0xBF - bhi _08144C48 - mov r0, sp - ldrh r0, [r0, 0xC] - b _08144C54 - .pool -_08144C48: - ldr r0, [sp, 0x10] - mov r1, r9 - bl __modsi3 - add r0, sp - ldrb r0, [r0] -_08144C54: - strh r0, [r7, 0x3C] - ldr r1, =sub_8144168 - str r1, [r7, 0x1C] - add sp, 0x14 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8144A24 - - thumb_func_start sub_8144C70 -sub_8144C70: @ 8144C70 - push {r4,lr} - adds r2, r0, 0 - ldrh r0, [r2, 0x30] - adds r1, r0, 0x1 - strh r1, [r2, 0x30] - lsls r0, 16 - asrs r0, 16 - movs r3, 0x34 - ldrsh r1, [r2, r3] - cmp r0, r1 - blt _08144CC0 - ldrh r0, [r2, 0x20] - subs r0, 0x2 - strh r0, [r2, 0x20] - lsls r0, 16 - asrs r0, 16 - movs r1, 0x10 - negs r1, r1 - cmp r0, r1 - bge _08144CC0 - ldr r4, =gUnknown_0203AB88 - ldr r3, [r4] - ldrb r1, [r3, 0x3] - movs r0, 0x40 - ands r0, r1 - cmp r0, 0 - bne _08144CAC - movs r0, 0x40 - orrs r0, r1 - strb r0, [r3, 0x3] -_08144CAC: - adds r0, r2, 0 - bl DestroySprite - ldr r1, [r4] - movs r0, 0 - strb r0, [r1, 0x1] - ldr r1, [r4] - ldr r0, =gUnknown_085B7B1A - ldrh r0, [r0] - strh r0, [r1, 0x34] -_08144CC0: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8144C70 - - thumb_func_start sub_8144CD0 -sub_8144CD0: @ 8144CD0 - push {r4,lr} - sub sp, 0x18 - adds r4, r0, 0 - ldr r1, =gUnknown_085B7B2E - mov r0, sp - movs r2, 0x18 - bl memcpy - ldrh r0, [r4, 0x30] - adds r2, r0, 0x1 - strh r2, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - movs r3, 0x34 - ldrsh r1, [r4, r3] - cmp r0, r1 - bge _08144D54 - movs r0, 0x1 - ands r2, r0 - cmp r2, 0 - beq _08144D2E - ldr r3, =gSpriteCoordOffsetY - movs r0, 0x3C - ldrsh r2, [r4, r0] - lsls r2, 1 - movs r1, 0x32 - ldrsh r0, [r4, r1] - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - lsls r0, 3 - adds r2, r0 - mov r1, sp - adds r0, r1, r2 - ldrh r0, [r0] - strh r0, [r3] - movs r3, 0x3C - ldrsh r2, [r4, r3] - adds r1, r2, 0x1 - adds r0, r1, 0 - cmp r1, 0 - bge _08144D26 - adds r0, r2, 0x4 -_08144D26: - asrs r0, 2 - lsls r0, 2 - subs r0, r1, r0 - strh r0, [r4, 0x3C] -_08144D2E: - adds r3, r4, 0 - adds r3, 0x3E - ldrb r2, [r3] - lsls r0, r2, 29 - lsrs r0, 31 - movs r1, 0x1 - eors r1, r0 - lsls r1, 2 - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3] - b _08144D7E - .pool -_08144D54: - ldr r1, =gSpriteCoordOffsetY - movs r0, 0 - strh r0, [r1] - ldr r2, =gSprites - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - adds r0, 0x73 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x2C - ldrb r2, [r0] - movs r1, 0x41 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - adds r0, r4, 0 - bl DestroySprite -_08144D7E: - add sp, 0x18 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8144CD0 - - thumb_func_start sub_8144D94 -sub_8144D94: @ 8144D94 - push {r4,r5,lr} - adds r5, r0, 0 - ldrh r0, [r5, 0x30] - adds r0, 0x1 - strh r0, [r5, 0x30] - movs r1, 0x30 - ldrsh r0, [r5, r1] - bl __floatsisf - adds r4, r0, 0 - ldr r1, =0x3d1fbe77 - bl __mulsf3 - adds r1, r4, 0 - bl __mulsf3 - bl __fixsfsi - strh r0, [r5, 0x26] - ldr r0, =gUnknown_0203AB88 - ldr r3, [r0] - ldr r2, =gUnknown_085B7B1A - ldrb r0, [r3, 0x1] - subs r0, 0x1 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - lsls r0, 1 - adds r0, r2 - ldrh r0, [r0] - strh r0, [r3, 0x34] - ldrb r0, [r3, 0x1] - cmp r0, 0x12 - bhi _08144DDC - adds r0, 0x1 - strb r0, [r3, 0x1] -_08144DDC: - movs r1, 0x30 - ldrsh r0, [r5, r1] - cmp r0, 0x3C - ble _08144E3E - movs r0, 0 - strh r0, [r5, 0x30] - ldr r3, =sub_8144C70 - str r3, [r5, 0x1C] - ldr r2, =gSprites - movs r0, 0x3A - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r4, r2, 0 - adds r4, 0x1C - adds r0, r4 - str r3, [r0] - movs r0, 0x3A - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r1, =0x0000fffe - strh r1, [r0, 0x30] - movs r0, 0x38 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - movs r0, 0x38 - ldrsh r1, [r5, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r4 - ldr r1, =sub_8144CD0 - str r1, [r0] - movs r0, 0xD6 - bl m4aSongNumStart -_08144E3E: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8144D94 - - thumb_func_start sub_8144E60 -sub_8144E60: @ 8144E60 - push {r4,r5,lr} - adds r4, r0, 0 - movs r1, 0x3C - ldrsh r0, [r4, r1] - cmp r0, 0 - bne _08144EE4 - ldr r0, =gUnknown_0203AB88 - ldr r3, [r0] - ldr r1, [r3, 0x38] - movs r2, 0x2E - ldrsh r0, [r1, r2] - cmp r0, 0 - bne _08144E94 - movs r0, 0x34 - ldrsh r2, [r1, r0] - ldr r1, =gUnknown_085B6348 - ldrb r0, [r3, 0x4] - lsls r0, 30 - lsrs r0, 25 - adds r0, r1 - ldrh r0, [r0, 0x8] - b _08144EA6 - .pool -_08144E94: - movs r0, 0x34 - ldrsh r2, [r1, r0] - ldr r1, =gUnknown_085B6348 - ldrb r0, [r3, 0x4] - lsls r0, 30 - lsrs r0, 25 - adds r0, r1 - ldrh r0, [r0, 0x8] - adds r0, 0xB4 -_08144EA6: - cmp r2, r0 - bne _08144F7C - adds r2, r4, 0 - adds r2, 0x3E - ldrb r1, [r2] - movs r0, 0x5 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - ldrh r0, [r4, 0x3C] - adds r0, 0x1 - strh r0, [r4, 0x3C] - movs r0, 0x2B - bl m4aSongNumStart - ldr r2, =gUnknown_0203AB88 - ldr r1, [r2] - movs r0, 0x1 - strb r0, [r1, 0x1] - ldr r1, [r2] - ldr r0, =gUnknown_085B7B1A - ldrh r0, [r0] - strh r0, [r1, 0x34] - b _08144F7C - .pool -_08144EE4: - ldr r5, =gUnknown_0203AB88 - ldr r3, [r5] - ldr r2, =gUnknown_085B7B1A - ldrb r0, [r3, 0x1] - subs r0, 0x1 - lsrs r1, r0, 31 - adds r0, r1 - asrs r0, 1 - lsls r0, 1 - adds r0, r2 - ldrh r0, [r0] - strh r0, [r3, 0x34] - ldrb r0, [r3, 0x1] - cmp r0, 0x12 - bhi _08144F06 - adds r0, 0x1 - strb r0, [r3, 0x1] -_08144F06: - ldr r3, [r5] - ldr r1, [r3, 0x38] - movs r2, 0x2E - ldrsh r0, [r1, r2] - cmp r0, 0 - bne _08144F30 - movs r0, 0x34 - ldrsh r2, [r1, r0] - ldr r1, =gUnknown_085B6348 - ldrb r0, [r3, 0x4] - lsls r0, 30 - lsrs r0, 25 - adds r0, r1 - ldrh r0, [r0, 0xA] - b _08144F42 - .pool -_08144F30: - movs r0, 0x34 - ldrsh r2, [r1, r0] - ldr r1, =gUnknown_085B6348 - ldrb r0, [r3, 0x4] - lsls r0, 30 - lsrs r0, 25 - adds r0, r1 - ldrh r0, [r0, 0xA] - adds r0, 0xB4 -_08144F42: - cmp r2, r0 - bne _08144F7C - ldr r2, =gSprites - movs r0, 0x36 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r1, r2, 0 - adds r1, 0x1C - adds r0, r1 - ldr r1, =sub_8144D94 - str r1, [r0] - movs r0, 0x36 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x3E - ldrb r2, [r0] - movs r1, 0x5 - negs r1, r1 - ands r1, r2 - strb r1, [r0] - ldr r0, =SpriteCallbackDummy - str r0, [r4, 0x1C] - movs r0, 0 - strh r0, [r4, 0x3C] -_08144F7C: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8144E60 - - thumb_func_start sub_8144F94 -sub_8144F94: @ 8144F94 - adds r0, 0x3E - ldrb r3, [r0] - lsls r1, r3, 29 - lsrs r1, 31 - movs r2, 0x1 - eors r2, r1 - lsls r2, 2 - movs r1, 0x5 - negs r1, r1 - ands r1, r3 - orrs r1, r2 - strb r1, [r0] - bx lr - thumb_func_end sub_8144F94 - - thumb_func_start sub_8144FB0 -sub_8144FB0: @ 8144FB0 - push {r4,r5,lr} - adds r4, r0, 0 - ldrh r2, [r4, 0x22] - movs r0, 0x22 - ldrsh r1, [r4, r0] - movs r0, 0x10 - negs r0, r0 - cmp r1, r0 - ble _08144FC8 - subs r0, r2, 0x1 - strh r0, [r4, 0x22] - b _0814501C -_08144FC8: - ldr r0, =SpriteCallbackDummy - str r0, [r4, 0x1C] - adds r2, r4, 0 - adds r2, 0x3E - ldrb r0, [r2] - movs r1, 0x4 - orrs r0, r1 - strb r0, [r2] - subs r2, 0x12 - ldrb r0, [r2] - movs r1, 0x40 - orrs r0, r1 - strb r0, [r2] - movs r0, 0x5E - bl m4aSongNumStop - adds r0, r4, 0 - bl DestroySprite - ldr r5, =gSprites - ldr r4, =gUnknown_0203AB88 - ldr r0, [r4] - adds r0, 0x74 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - ldrb r0, [r0, 0x3] - lsls r0, 26 - lsrs r0, 27 - bl FreeOamMatrix - ldr r0, [r4] - adds r0, 0x74 - ldrb r1, [r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r5 - bl DestroySprite -_0814501C: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8144FB0 - - thumb_func_start sub_8145030 -sub_8145030: @ 8145030 - push {r4,lr} - adds r4, r0, 0 - ldrh r1, [r4, 0x30] - movs r2, 0x30 - ldrsh r0, [r4, r2] - cmp r0, 0 - blt _0814505A - subs r1, 0x1 - strh r1, [r4, 0x30] - ldrh r0, [r4, 0x22] - subs r0, 0x1 - strh r0, [r4, 0x22] - lsls r1, 16 - cmp r1, 0 - bne _081450C6 - adds r0, r4, 0 - adds r0, 0x2B - ldrb r0, [r0] - cmp r0, 0x1 - bne _081450C6 - b _08145080 -_0814505A: - ldrh r1, [r4, 0x34] - movs r2, 0x34 - ldrsh r0, [r4, r2] - cmp r0, 0 - blt _08145090 - subs r0, r1, 0x1 - strh r0, [r4, 0x34] - adds r0, r4, 0 - adds r0, 0x2C - ldrb r1, [r0] - movs r0, 0x3F - ands r0, r1 - cmp r0, 0 - bne _081450C6 - adds r0, r4, 0 - adds r0, 0x2B - ldrb r0, [r0] - cmp r0, 0x1 - bne _08145088 -_08145080: - ldrh r0, [r4, 0x26] - adds r0, 0x1 - strh r0, [r4, 0x26] - b _081450C6 -_08145088: - ldrh r0, [r4, 0x26] - subs r0, 0x1 - strh r0, [r4, 0x26] - b _081450C6 -_08145090: - movs r0, 0x2B - bl m4aSongNumStart - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - ldr r0, [r0, 0x38] - ldrh r1, [r0, 0x2E] - adds r1, 0x4 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl StartSpriteAnim - ldr r0, =sub_8144FB0 - str r0, [r4, 0x1C] - ldr r2, =gSprites - movs r0, 0x3A - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - adds r0, 0x2C - ldrb r2, [r0] - movs r1, 0x7F - ands r1, r2 - strb r1, [r0] -_081450C6: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8145030 - - thumb_func_start sub_81450D8 -sub_81450D8: @ 81450D8 - push {r4,r5,lr} - sub sp, 0x14 - adds r4, r0, 0 - ldr r1, =gUnknown_085B7B46 - mov r0, sp - movs r2, 0x2 - bl memcpy - add r5, sp, 0x4 - ldr r1, =gUnknown_085B7B48 - adds r0, r5, 0 - movs r2, 0x10 - bl memcpy - ldrh r0, [r4, 0x30] - subs r1, r0, 0x1 - strh r1, [r4, 0x30] - lsls r0, 16 - asrs r0, 16 - cmp r0, 0x7 - ble _0814516C - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - ldr r0, [r0, 0x38] - movs r1, 0x2E - ldrsh r0, [r0, r1] - add r0, sp - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - lsls r0, 1 - ldrh r2, [r4, 0x20] - adds r0, r2 - strh r0, [r4, 0x20] - bl IsSEPlaying - lsls r0, 24 - cmp r0, 0 - beq _08145208 - movs r1, 0x20 - ldrsh r0, [r4, r1] - movs r4, 0x74 - subs r4, r0 - lsrs r0, r4, 31 - adds r4, r0 - asrs r4, 1 - negs r4, r4 - ldr r0, =gMPlayInfo_SE1 - ldr r5, =0x0000ffff - lsls r4, 24 - asrs r4, 24 - adds r1, r5, 0 - adds r2, r4, 0 - bl m4aMPlayPanpotControl - ldr r0, =gMPlayInfo_SE2 - adds r1, r5, 0 - adds r2, r4, 0 - bl m4aMPlayPanpotControl - b _08145208 - .pool -_0814516C: - lsls r0, r1, 16 - cmp r0, 0 - blt _081451BC - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - ldr r0, [r0, 0x38] - movs r2, 0x2E - ldrsh r0, [r0, r2] - add r0, sp - movs r2, 0 - ldrsb r2, [r0, r2] - movs r1, 0x30 - ldrsh r0, [r4, r1] - movs r1, 0x7 - subs r0, r1, r0 - lsls r0, 1 - adds r0, r5, r0 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - muls r0, r2 - ldrh r2, [r4, 0x20] - adds r0, r2 - strh r0, [r4, 0x20] - movs r2, 0x30 - ldrsh r0, [r4, r2] - subs r1, r0 - lsls r1, 1 - mov r0, sp - adds r0, 0x5 - adds r0, r1 - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - ldrh r1, [r4, 0x22] - adds r0, r1 - strh r0, [r4, 0x22] - b _08145208 - .pool -_081451BC: - movs r0, 0x5E - bl m4aSongNumStartOrChange - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - ldr r0, [r0, 0x38] - movs r2, 0x2E - ldrsh r0, [r0, r2] - cmp r0, 0 - bne _081451E0 - movs r0, 0x98 - lsls r0, 1 - movs r1, 0x3F - bl PlayCry1 - b _081451EC - .pool -_081451E0: - movs r0, 0x98 - lsls r0, 1 - movs r1, 0x3F - negs r1, r1 - bl PlayCry1 -_081451EC: - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - ldr r0, [r0, 0x38] - ldrh r1, [r0, 0x2E] - adds r1, 0x2 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - bl StartSpriteAnim - movs r0, 0x2D - strh r0, [r4, 0x30] - ldr r0, =sub_8145030 - str r0, [r4, 0x1C] -_08145208: - add sp, 0x14 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81450D8 - - thumb_func_start sub_8145218 -sub_8145218: @ 8145218 - push {r4,lr} - sub sp, 0x4 - adds r4, r0, 0 - ldr r1, =gUnknown_085B7B46 - mov r0, sp - movs r2, 0x2 - bl memcpy - ldrh r0, [r4, 0x30] - subs r1, r0, 0x1 - strh r1, [r4, 0x30] - lsls r0, 16 - cmp r0, 0 - blt _08145284 - ldr r0, =gUnknown_0203AB88 - ldr r0, [r0] - ldr r0, [r0, 0x38] - movs r1, 0x2E - ldrsh r0, [r0, r1] - add r0, sp - ldrb r0, [r0] - lsls r0, 24 - asrs r0, 24 - lsls r0, 1 - ldrh r2, [r4, 0x20] - adds r0, r2 - strh r0, [r4, 0x20] - ldr r1, =gSprites - movs r2, 0x3A - ldrsh r0, [r4, r2] - lsls r2, r0, 4 - adds r2, r0 - lsls r2, 2 - adds r2, r1 - adds r2, 0x3E - ldrb r3, [r2] - lsls r0, r3, 29 - lsrs r0, 31 - movs r1, 0x1 - eors r1, r0 - lsls r1, 2 - movs r0, 0x5 - negs r0, r0 - ands r0, r3 - orrs r0, r1 - strb r0, [r2] - b _08145288 - .pool -_08145284: - ldr r0, =sub_8144F94 - str r0, [r4, 0x1C] -_08145288: - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8145218 - - thumb_func_start sub_8145294 -sub_8145294: @ 8145294 - push {r4,lr} - adds r4, r0, 0 - ldr r0, =gUnknown_0203AB88 - ldr r3, [r0] - ldr r1, [r3, 0x38] - movs r2, 0x2E - ldrsh r0, [r1, r2] - cmp r0, 0 - bne _081452DC - movs r0, 0x34 - ldrsh r2, [r1, r0] - ldr r1, =gUnknown_085B6348 - ldrb r0, [r3, 0x4] - lsls r0, 30 - lsrs r0, 25 - adds r0, r1 - ldrh r0, [r0, 0x12] - adds r0, 0x5A - cmp r2, r0 - bne _0814533E - ldr r2, =gSprites - movs r0, 0x3A - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r3, 0x34 - b _08145306 - .pool -_081452DC: - movs r0, 0x34 - ldrsh r2, [r1, r0] - ldr r1, =gUnknown_085B6348 - ldrb r0, [r3, 0x4] - lsls r0, 30 - lsrs r0, 25 - adds r0, r1 - ldrh r0, [r0, 0x14] - movs r1, 0x87 - lsls r1, 1 - adds r0, r1 - cmp r2, r0 - bne _0814533E - ldr r2, =gSprites - movs r0, 0x3A - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - movs r3, 0x2E -_08145306: - strh r3, [r0, 0x30] - movs r0, 0x36 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - strh r3, [r0, 0x30] - movs r0, 0x3A - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r2, 0x1C - adds r0, r2 - ldr r1, =sub_8145218 - str r1, [r0] - movs r0, 0x36 - ldrsh r1, [r4, r0] - lsls r0, r1, 4 - adds r0, r1 - lsls r0, 2 - adds r0, r2 - ldr r1, =sub_81450D8 - str r1, [r0] - movs r0, 0x2B - bl m4aSongNumStart -_0814533E: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8145294 - - .align 2, 0 @ Don't pad with nop. diff --git a/ld_script.txt b/ld_script.txt index d60e18c55..559b375f5 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -207,7 +207,6 @@ SECTIONS { src/pokedex_area_screen.o(.text); src/evolution_scene.o(.text); src/roulette.o(.text); - asm/roulette.o(.text); src/pokedex_cry_screen.o(.text); src/coins.o(.text); src/landmark.o(.text); diff --git a/src/roulette.c b/src/roulette.c index b471598c6..eab2bcd7a 100644 --- a/src/roulette.c +++ b/src/roulette.c @@ -238,8 +238,16 @@ extern const u8 gUnknown_085B7B04[]; extern const struct CompressedSpriteSheet gUnknown_085B7948; extern const struct SpriteTemplate gSpriteTemplate_85B7950; extern const u16 gUnknown_085B7B0A[][2]; +extern const u16 gUnknown_085B7B12[][2]; extern const struct SpriteTemplate gSpriteTemplate_85B79F8; extern const struct SpriteTemplate gSpriteTemplate_85B7ABC[]; +extern const struct SpriteTemplate gSpriteTemplate_85B7A10; +extern const struct SpriteTemplate gUnknown_085B7AEC; +extern const u16 gUnknown_085B7B1A[]; +extern const u16 gUnknown_085B7B2E[]; +extern const s8 gUnknown_085B7B46[]; +extern const s8 gUnknown_085B7B48[]; +extern const s8 gUnknown_085B7B46[]; void sub_8140238(void) { @@ -2698,7 +2706,7 @@ void sub_81446DC(struct Sprite *sprite) s16 s[2][2]; struct Roulette *p; - memcpy(s, gUnknown_085B7B0A, 8); + memcpy(s, gUnknown_085B7B0A, sizeof(s)); t = sprite->data[7] - 2; p = gUnknown_0203AB88; // why??? gUnknown_0203AB88->var3C[55] = CreateSprite(&gSpriteTemplate_85B79F8, 36, -12, 50); @@ -2721,3 +2729,710 @@ void sub_81446DC(struct Sprite *sprite) gSprites[gUnknown_0203AB88->var3C[56]].coordOffsetEnabled = TRUE; gUnknown_0203AB88->var38 = sprite; } + +void sub_81448B8(struct Sprite *sprite) +{ + u8 i = 0; + s16 t; + s16 s[2][2]; + + memcpy(s, &gUnknown_085B7B12, sizeof(s)); + t = sprite->data[7] - 2; + gUnknown_0203AB88->var3C[55] = CreateSprite(&gSpriteTemplate_85B7A10, s[sprite->data[0]][0], s[sprite->data[0]][1], 50); + StartSpriteAnim(&gSprites[gUnknown_0203AB88->var3C[55]], sprite->data[0]); + gUnknown_0203AB88->var3C[56] = CreateSprite(&gUnknown_085B7AEC, s[sprite->data[0]][0], s[sprite->data[0]][1], 51); + gSprites[gUnknown_0203AB88->var3C[56]].affineAnimPaused = TRUE; + gSprites[gUnknown_0203AB88->var3C[56]].animPaused = TRUE; + sprite->data[7] = (t * gUnknown_085B6348[gUnknown_0203AB88->var04_0].var01) + (gUnknown_085B6348[gUnknown_0203AB88->var04_0].var10 + 45); + for (; i < 2; i++) + { + gSprites[gUnknown_0203AB88->var3C[55 + i]].data[4] = gUnknown_0203AB88->var3C[55]; + gSprites[gUnknown_0203AB88->var3C[55 + i]].data[5] = gUnknown_0203AB88->var3C[56]; + gSprites[gUnknown_0203AB88->var3C[55 + i]].data[6] = gUnknown_0203AB88->var3C[56]; + gSprites[gUnknown_0203AB88->var3C[55 + i]].data[2] = t; + gSprites[gUnknown_0203AB88->var3C[55 + i]].data[3] = sprite->data[7] - 45; + } + gUnknown_0203AB88->var38 = sprite; +} + +#ifdef NONMATCHING +void sub_8144A24(struct Sprite *sprite) +{ + u8 z; + u16 o; + u8 h = 0; // r10 (sp+0xc) + u8 j = 5; // r9 (r9) + u8 p = 0; // sp+0xc (sp+0x10) + u8 i; + u8 s[10] = {}; // sp+0 (sp+0) + u16 t = Random(); // sp+0x10 (r10) + + gUnknown_0203AB88->var7D = 1; + gUnknown_0203AB88->var03_5 = TRUE; + gUnknown_0203AB88->var03_6 = FALSE; + gUnknown_0203AB88->var7E = 0xFF; + gUnknown_0203AB88->var88 = sprite->data[3]; + gUnknown_0203AB88->var98 = 0.0f; + gUnknown_0203AB88->var8C = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var1C; + o = (gUnknown_0203AB88->var04_0 * 30 + 33) + (0x1 - gUnknown_0203AB88->var03_0) * 15; + for (i = 0; i < 4; i++) + { + if (o < sprite->data[3] && sprite->data[3] <= o + 90) + { + sprite->data[0] = i / 2; + gUnknown_0203AB88->var03_0 = i & 1; + break; + } + if (i == 3) + { + sprite->data[0] = 1; + gUnknown_0203AB88->var03_0 = 1; + break; + } + o += 90; + } + if (gUnknown_0203AB88->var03_0) + { + if (sprite->data[0]) + { + PlayCry1(SPECIES_TAILLOW, -63); + } + else + { + PlayCry1(SPECIES_TAILLOW, 63); + } + } + else + { + PlayCry1(SPECIES_SHROOMISH, -63); + } + i = 2; + z = (gUnknown_0203AB88->var7F + 2) % 12; + if (gUnknown_0203AB88->var03_0 == 1 && gUnknown_0203AB88->var04_0 == 1) + j += 6; + else + j += i; + for (; i < j; i++) + { + if (!(gUnknown_0203AB88->var08 & gUnknown_085B62E4[z].var04)) + { + s[h++] = i; + if (!p && (gUnknown_085B62E4[z].var04 & gUnknown_085B6154[gUnknown_0203AB88->var1B[gUnknown_0203AB88->var1A_0]].var00)) + { + p = i; + } + } + z = (z + 1) % 0xC; + } + if ((gUnknown_0203AB88->var03_0 + 1) & gUnknown_0203AB88->var02) + { + if (p && (t & 0xFF) < 0xc0) + { + sprite->data[7] = p; + } + else + { + sprite->data[7] = s[t % h]; + } + } + else + { + sprite->data[7] = s[t % h]; + } + sprite->callback = sub_8144168; +} +#else +NAKED +void sub_8144A24(struct Sprite *sprite) +{ + asm_unified("push {r4-r7,lr}\n\ + mov r7, r10\n\ + mov r6, r9\n\ + mov r5, r8\n\ + push {r5-r7}\n\ + sub sp, 0x14\n\ + adds r7, r0, 0\n\ + movs r0, 0\n\ + mov r9, r0\n\ + movs r1, 0x5\n\ + mov r8, r1\n\ + str r0, [sp, 0xC]\n\ + mov r0, sp\n\ + movs r1, 0\n\ + movs r2, 0xA\n\ + bl memset\n\ + bl Random\n\ + lsls r0, 16\n\ + lsrs r0, 16\n\ + str r0, [sp, 0x10]\n\ + ldr r3, _08144B10 @ =gUnknown_0203AB88\n\ + ldr r0, [r3]\n\ + adds r0, 0x7D\n\ + movs r5, 0x1\n\ + strb r5, [r0]\n\ + ldr r2, [r3]\n\ + ldrb r0, [r2, 0x3]\n\ + movs r1, 0x20\n\ + orrs r0, r1\n\ + strb r0, [r2, 0x3]\n\ + ldr r2, [r3]\n\ + ldrb r1, [r2, 0x3]\n\ + movs r0, 0x41\n\ + negs r0, r0\n\ + ands r0, r1\n\ + strb r0, [r2, 0x3]\n\ + ldr r0, [r3]\n\ + adds r0, 0x7E\n\ + movs r1, 0xFF\n\ + strb r1, [r0]\n\ + ldr r6, [r3]\n\ + adds r4, r6, 0\n\ + adds r4, 0x88\n\ + movs r1, 0x34\n\ + ldrsh r0, [r7, r1]\n\ + bl __floatsisf\n\ + str r0, [r4]\n\ + adds r1, r6, 0\n\ + adds r1, 0x98\n\ + ldr r0, _08144B14 @ =0x00000000\n\ + str r0, [r1]\n\ + adds r2, r6, 0\n\ + adds r2, 0x8C\n\ + ldr r1, _08144B18 @ =gUnknown_085B6348\n\ + ldrb r0, [r6, 0x4]\n\ + lsls r0, 30\n\ + lsrs r0, 25\n\ + adds r1, 0x1C\n\ + adds r0, r1\n\ + ldr r0, [r0]\n\ + str r0, [r2]\n\ + ldrb r0, [r6, 0x4]\n\ + lsls r0, 30\n\ + lsrs r0, 30\n\ + lsls r1, r0, 4\n\ + subs r1, r0\n\ + lsls r1, 1\n\ + adds r1, 0x21\n\ + ldrb r0, [r6, 0x3]\n\ + lsls r0, 27\n\ + lsrs r0, 27\n\ + subs r5, r0\n\ + lsls r0, r5, 4\n\ + subs r0, r5\n\ + adds r1, r0\n\ + lsls r1, 16\n\ + lsrs r1, 16\n\ + mov r5, r9\n\ + movs r0, 0x34\n\ + ldrsh r2, [r7, r0]\n\ +_08144ACA:\n\ + cmp r1, r2\n\ + bge _08144AD6\n\ + adds r0, r1, 0\n\ + adds r0, 0x5A\n\ + cmp r2, r0\n\ + ble _08144B38\n\ +_08144AD6:\n\ + cmp r5, 0x3\n\ + beq _08144B1C\n\ + adds r0, r1, 0\n\ + adds r0, 0x5A\n\ + lsls r0, 16\n\ + lsrs r1, r0, 16\n\ + adds r0, r5, 0x1\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + cmp r5, 0x3\n\ + bls _08144ACA\n\ +_08144AEC:\n\ + ldr r0, _08144B10 @ =gUnknown_0203AB88\n\ + ldr r0, [r0]\n\ + ldrb r1, [r0, 0x3]\n\ + movs r0, 0x1F\n\ + ands r0, r1\n\ + cmp r0, 0\n\ + beq _08144B64\n\ + movs r1, 0x2E\n\ + ldrsh r0, [r7, r1]\n\ + cmp r0, 0\n\ + beq _08144B58\n\ + movs r0, 0x98\n\ + lsls r0, 1\n\ + movs r1, 0x3F\n\ + negs r1, r1\n\ + bl PlayCry1\n\ + b _08144B70\n\ + .align 2, 0\n\ +_08144B10:\n\ + .4byte gUnknown_0203AB88\n\ +_08144B14:\n\ + .4byte 0x00000000\n\ +_08144B18:\n\ + .4byte gUnknown_085B6348\n\ +_08144B1C:\n\ + movs r0, 0x1\n\ + strh r0, [r7, 0x2E]\n\ + ldr r0, =gUnknown_0203AB88\n\ + ldr r2, [r0]\n\ + ldrb r1, [r2, 0x3]\n\ + movs r0, 0x20\n\ + negs r0, r0\n\ + ands r0, r1\n\ + movs r1, 0x1\n\ + orrs r0, r1\n\ + strb r0, [r2, 0x3]\n\ + b _08144AEC\n\ + .pool\n\ +_08144B38:\n\ + lsrs r0, r5, 1\n\ + strh r0, [r7, 0x2E]\n\ + ldr r0, =gUnknown_0203AB88\n\ + ldr r3, [r0]\n\ + movs r1, 0x1\n\ + ands r1, r5\n\ + ldrb r2, [r3, 0x3]\n\ + movs r0, 0x20\n\ + negs r0, r0\n\ + ands r0, r2\n\ + orrs r0, r1\n\ + strb r0, [r3, 0x3]\n\ + b _08144AEC\n\ + .pool\n\ +_08144B58:\n\ + movs r0, 0x98\n\ + lsls r0, 1\n\ + movs r1, 0x3F\n\ + bl PlayCry1\n\ + b _08144B70\n\ +_08144B64:\n\ + movs r0, 0x99\n\ + lsls r0, 1\n\ + movs r1, 0x3F\n\ + negs r1, r1\n\ + bl PlayCry1\n\ +_08144B70:\n\ + movs r0, 0x2\n\ + mov r10, r0\n\ + ldr r4, =gUnknown_0203AB88\n\ + ldr r5, [r4]\n\ + adds r0, r5, 0\n\ + adds r0, 0x7F\n\ + ldrb r0, [r0]\n\ + adds r0, 0x2\n\ + movs r1, 0xC\n\ + bl __modsi3\n\ + lsls r0, 24\n\ + lsrs r6, r0, 24\n\ + ldrb r1, [r5, 0x3]\n\ + movs r0, 0x1F\n\ + ands r0, r1\n\ + cmp r0, 0x1\n\ + bne _08144BA8\n\ + ldrb r1, [r5, 0x4]\n\ + movs r0, 0x3\n\ + ands r0, r1\n\ + cmp r0, 0x1\n\ + bne _08144BA8\n\ + mov r0, r8\n\ + adds r0, 0x6\n\ + b _08144BAC\n\ + .pool\n\ +_08144BA8:\n\ + mov r0, r8\n\ + add r0, r10\n\ +_08144BAC:\n\ + lsls r0, 24\n\ + lsrs r0, 24\n\ + mov r8, r0\n\ + mov r5, r10\n\ + cmp r5, r8\n\ + bcs _08144C18\n\ + ldr r1, =gUnknown_085B6154+0xC\n\ + mov r10, r1\n\ +_08144BBC:\n\ + ldr r3, [r4]\n\ + lsls r0, r6, 3\n\ + ldr r1, =gUnknown_085B62E4+0x4\n\ + adds r0, r1\n\ + ldr r1, [r3, 0x8]\n\ + ldr r2, [r0]\n\ + ands r1, r2\n\ + cmp r1, 0\n\ + bne _08144C02\n\ + mov r0, r9\n\ + adds r1, r0, 0x1\n\ + lsls r1, 24\n\ + lsrs r1, 24\n\ + mov r9, r1\n\ + add r0, sp\n\ + strb r5, [r0]\n\ + ldr r0, [sp, 0xC]\n\ + cmp r0, 0\n\ + bne _08144C02\n\ + ldrb r1, [r3, 0x1A]\n\ + lsls r1, 28\n\ + lsrs r1, 28\n\ + adds r0, r3, 0\n\ + adds r0, 0x1B\n\ + adds r0, r1\n\ + ldrb r1, [r0]\n\ + lsls r0, r1, 2\n\ + adds r0, r1\n\ + lsls r0, 2\n\ + add r0, r10\n\ + ldr r0, [r0]\n\ + ands r2, r0\n\ + cmp r2, 0\n\ + beq _08144C02\n\ + str r5, [sp, 0xC]\n\ +_08144C02:\n\ + adds r0, r6, 0x1\n\ + movs r1, 0xC\n\ + bl __modsi3\n\ + lsls r0, 24\n\ + lsrs r6, r0, 24\n\ + adds r0, r5, 0x1\n\ + lsls r0, 24\n\ + lsrs r5, r0, 24\n\ + cmp r5, r8\n\ + bcc _08144BBC\n\ +_08144C18:\n\ + ldr r0, [r4]\n\ + ldrb r1, [r0, 0x3]\n\ + lsls r1, 27\n\ + lsrs r1, 27\n\ + adds r1, 0x1\n\ + ldrb r0, [r0, 0x2]\n\ + ands r1, r0\n\ + cmp r1, 0\n\ + beq _08144C48\n\ + ldr r1, [sp, 0xC]\n\ + cmp r1, 0\n\ + beq _08144C48\n\ + movs r0, 0xFF\n\ + ldr r1, [sp, 0x10]\n\ + ands r0, r1\n\ + cmp r0, 0xBF\n\ + bhi _08144C48\n\ + mov r0, sp\n\ + ldrh r0, [r0, 0xC]\n\ + b _08144C54\n\ + .pool\n\ +_08144C48:\n\ + ldr r0, [sp, 0x10]\n\ + mov r1, r9\n\ + bl __modsi3\n\ + add r0, sp\n\ + ldrb r0, [r0]\n\ +_08144C54:\n\ + strh r0, [r7, 0x3C]\n\ + ldr r1, =sub_8144168\n\ + str r1, [r7, 0x1C]\n\ + add sp, 0x14\n\ + pop {r3-r5}\n\ + mov r8, r3\n\ + mov r9, r4\n\ + mov r10, r5\n\ + pop {r4-r7}\n\ + pop {r0}\n\ + bx r0\n\ + .pool"); +} +#endif // NONMATCHING + +void sub_8144C70(struct Sprite *sprite) +{ + if (sprite->data[1]++ >= sprite->data[3]) + { + sprite->pos1.x -= 2; + if (sprite->pos1.x < -16) + { + if (!gUnknown_0203AB88->var03_6) + gUnknown_0203AB88->var03_6 = TRUE; + DestroySprite(sprite); + gUnknown_0203AB88->var01 = 0; + gUnknown_0203AB88->var34 = gUnknown_085B7B1A[0]; + } + } +} + +void sub_8144CD0(struct Sprite *sprite) +{ + u16 t[3][4]; + int p; + + memcpy(t, gUnknown_085B7B2E, 24); + if (sprite->data[1]++ < sprite->data[3]) + { + if (sprite->data[1] & 1) + { + gSpriteCoordOffsetY = t[sprite->data[2] / 2][sprite->data[7]]; + p = sprite->data[7] + 1; + sprite->data[7] = p - ((p / 4) * 4); + } + sprite->invisible ^= 1; + } + else + { + gSpriteCoordOffsetY = 0; + gSprites[gUnknown_0203AB88->var3C[55]].animPaused = FALSE; + DestroySprite(sprite); + } +} + +void sub_8144D94(struct Sprite *sprite) +{ + float t; + sprite->data[1]++; + t = sprite->data[1]; + sprite->pos2.y = t * 0.039f * t; + gUnknown_0203AB88->var34 = gUnknown_085B7B1A[(gUnknown_0203AB88->var01 - 1) / 2]; + if (gUnknown_0203AB88->var01 < 19) + gUnknown_0203AB88->var01++; + if (sprite->data[1] > 60) + { + sprite->data[1] = 0; + sprite->callback = sub_8144C70; + gSprites[sprite->data[6]].callback = sub_8144C70; + gSprites[sprite->data[6]].data[1] = -2; + gSprites[sprite->data[5]].invisible = FALSE; + gSprites[sprite->data[5]].callback = sub_8144CD0; + m4aSongNumStart(SE_W070); + } +} + +/*void sub_8144E60(struct Sprite *sprite) +{ + register u32 t asm("r2"); + u32 z; + if (sprite->data[7] == 0) + { + if (gUnknown_0203AB88->var38->data[0] == 0) + { + t = gUnknown_0203AB88->var38->data[3]; + z = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var08; + } + else + { + t = gUnknown_0203AB88->var38->data[3]; + z = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var08; + z += 180; + } + if (t == z) + { + sprite->invisible = FALSE; + sprite->data[7]++; + m4aSongNumStart(SE_RU_HYUU); + gUnknown_0203AB88->var01 = 1; + gUnknown_0203AB88->var34 = gUnknown_085B7B1A[0]; + } + } + else + { + gUnknown_0203AB88->var34 = gUnknown_085B7B1A[(gUnknown_0203AB88->var01 - 1) / 2]; + if (gUnknown_0203AB88->var01 < 19) + gUnknown_0203AB88->var01++; + if (gUnknown_0203AB88->var38->data[0] == 0) + { + t = gUnknown_0203AB88->var38->data[3]; + z = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var0A; + } + else + { + t = gUnknown_0203AB88->var38->data[3]; + z = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var0A; + z += 180; + } + if (t == z) + { + gSprites[sprite->data[4]].callback = sub_8144D94; + gSprites[sprite->data[4]].invisible = FALSE; + sprite->callback = &SpriteCallbackDummy; + sprite->data[7] = 0; + } + } +}*/ + +void sub_8144E60(struct Sprite *sprite) +{ + if (sprite->data[7] == 0) + { + if (gUnknown_0203AB88->var38->data[0] == 0) + { + if (gUnknown_0203AB88->var38->data[3] != gUnknown_085B6348[gUnknown_0203AB88->var04_0].var08) + return; + } + else + { + if (gUnknown_0203AB88->var38->data[3] != gUnknown_085B6348[gUnknown_0203AB88->var04_0].var08 + 180) + return; + } + + sprite->invisible = FALSE; + sprite->data[7]++; + m4aSongNumStart(SE_RU_HYUU); + gUnknown_0203AB88->var01 = 1; + gUnknown_0203AB88->var34 = gUnknown_085B7B1A[0]; + } + else + { + gUnknown_0203AB88->var34 = gUnknown_085B7B1A[(gUnknown_0203AB88->var01 - 1) / 2]; + if (gUnknown_0203AB88->var01 < 19) + gUnknown_0203AB88->var01++; + + if (gUnknown_0203AB88->var38->data[0] == 0) + { + if (gUnknown_0203AB88->var38->data[3] != gUnknown_085B6348[gUnknown_0203AB88->var04_0].var0A) + return; + } + else + { + if (gUnknown_0203AB88->var38->data[3] != gUnknown_085B6348[gUnknown_0203AB88->var04_0].var0A + 180) + return; + } + + gSprites[sprite->data[4]].callback = sub_8144D94; + gSprites[sprite->data[4]].invisible = FALSE; + sprite->callback = &SpriteCallbackDummy; + sprite->data[7] = 0; + } +} + +void sub_8144F94(struct Sprite *sprite) +{ + sprite->invisible ^= 1; +} + +void sub_8144FB0(struct Sprite *sprite) +{ + if (sprite->pos1.y > -16) + { + sprite->pos1.y--; + } + else + { + sprite->callback = SpriteCallbackDummy; + sprite->invisible = TRUE; + sprite->animPaused = TRUE; + m4aSongNumStop(SE_BASABASA); + DestroySprite(sprite); + FreeOamMatrix(gSprites[gUnknown_0203AB88->var3C[56]].oam.matrixNum); + DestroySprite(&gSprites[gUnknown_0203AB88->var3C[56]]); + } +} + +void sub_8145030(struct Sprite *sprite) +{ + if (sprite->data[1] >= 0) + { + sprite->data[1]--; + sprite->pos1.y--; + if (sprite->data[1] == 0 && sprite->animCmdIndex == 1) + sprite->pos2.y++; + } + else + { + if (sprite->data[3] >= 0) + { + sprite->data[3]--; + if (sprite->animDelayCounter == 0) + { + if (sprite->animCmdIndex == 1) + sprite->pos2.y++; + else + sprite->pos2.y--; + } + } + else + { + m4aSongNumStart(SE_RU_HYUU); + StartSpriteAnim(sprite, gUnknown_0203AB88->var38->data[0] + 4); + sprite->callback = sub_8144FB0; + gSprites[sprite->data[6]].affineAnimPaused = FALSE; + } + } +} + +void sub_81450D8(struct Sprite *sprite) +{ + s8 t[2]; //sign + s8 z[8][2]; + + memcpy(t, gUnknown_085B7B46, sizeof(t)); + memcpy(z, gUnknown_085B7B48, sizeof(z)); + if (sprite->data[1]-- > 7) + { + sprite->pos1.x += t[gUnknown_0203AB88->var38->data[0]] * 2; + if (IsSEPlaying()) + { + s8 pan = -((116 - sprite->pos1.x) / 2); + m4aMPlayPanpotControl(&gMPlayInfo_SE1, 0xFFFF, pan); + m4aMPlayPanpotControl(&gMPlayInfo_SE2, 0xFFFF, pan); + } + } + else + { + if (sprite->data[1] >= 0) + { + sprite->pos1.x += t[gUnknown_0203AB88->var38->data[0]] * z[7 - sprite->data[1]][0]; + sprite->pos1.y += z[7 - sprite->data[1]][1]; + } + else + { + m4aSongNumStartOrChange(SE_BASABASA); + if (gUnknown_0203AB88->var38->data[0] == 0) + PlayCry1(SPECIES_TAILLOW, 63); + else + PlayCry1(SPECIES_TAILLOW, -63); + StartSpriteAnim(sprite, gUnknown_0203AB88->var38->data[0] + 2); + sprite->data[1] = 45; + sprite->callback = sub_8145030; + } + } +} + +void sub_8145218(struct Sprite *sprite) +{ + s8 t[2]; //sign + memcpy(t, gUnknown_085B7B46, sizeof(t)); + if (sprite->data[1]-- >= 0) + { + sprite->pos1.x += t[gUnknown_0203AB88->var38->data[0]] * 2; + gSprites[sprite->data[6]].invisible ^= 1; + } + else + { + sprite->callback = sub_8144F94; + } +} + +void sub_8145294(struct Sprite *sprite) +{ + if (gUnknown_0203AB88->var38->data[0] == 0) + { + if (gUnknown_0203AB88->var38->data[3] == gUnknown_085B6348[gUnknown_0203AB88->var04_0].var12 + 90) + { + gSprites[sprite->data[6]].data[1] = 52; + gSprites[sprite->data[4]].data[1] = 52; + } + else + { + return; + } + } + else + { + if (gUnknown_0203AB88->var38->data[3] == gUnknown_085B6348[gUnknown_0203AB88->var04_0].var14 + 270) + { + gSprites[sprite->data[6]].data[1] = 46; + gSprites[sprite->data[4]].data[1] = 46; + } + else + { + return; + } + } + gSprites[sprite->data[6]].callback = sub_8145218; + gSprites[sprite->data[4]].callback = sub_81450D8; + m4aSongNumStart(SE_RU_HYUU); +} From 6202ae1df00b84628d4d444ee05d766b6c75e3a2 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Wed, 2 Jan 2019 16:40:40 -0600 Subject: [PATCH 5/6] Extract rodata from roulette --- data/roulette.s | 928 ----------------------- include/gba/types.h | 4 +- ld_script.txt | 2 +- src/roulette.c | 1731 ++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 1647 insertions(+), 1018 deletions(-) delete mode 100644 data/roulette.s diff --git a/data/roulette.s b/data/roulette.s deleted file mode 100644 index 3cb412084..000000000 --- a/data/roulette.s +++ /dev/null @@ -1,928 +0,0 @@ - - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - - .align 1 -gUnknown_085B5BFC:: @ 85B5BFC - .incbin "graphics/roulette/85B5BFC.gbapal" - - .align 2 -gUnknown_085B5DFC:: @ 85B5DFC - .incbin "graphics/roulette/85B5DFC.bin.lz" - - .align 2 -gUnknown_085B5FA0:: @ 85B5FA0 - .incbin "graphics/roulette/wheel_map.bin.lz" - - .align 2 -gUnknown_085B6140:: @ 85B6140 - .4byte 0x000001f8, 0x00001241, 0x00002a66 - - .align 2 -gUnknown_085B614C:: @ 85B614C - window_template 0x00, 0x03, 0x0f, 0x18, 0x04, 0x0f, 0x00c5 - - .align 2 -gUnknown_085B6154:: @ 85B6154 - .byte 0xFF, 0x00, 0x00, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - .byte 0x0C, 0x14, 0x00, 0x11, 0x07, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x42, 0x08, 0x01, 0x00, 0x00, 0xE0, 0x00, 0x00 - .byte 0x0D, 0x24, 0x00, 0x14, 0x07, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x84, 0x10, 0x02, 0x00, 0x00, 0xE0, 0x00, 0x00 - .byte 0x0E, 0x34, 0x00, 0x17, 0x07, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x21, 0x04, 0x00, 0x00, 0xE0, 0x00, 0x00 - .byte 0x0F, 0x44, 0x00, 0x1A, 0x07, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x42, 0x08, 0x00, 0x00, 0xE0, 0x00, 0x00 - .byte 0x10, 0x03, 0x01, 0x0E, 0x0A, 0x00, 0x0C, 0x00, 0x20, 0x00, 0x00, 0x00, 0xE0, 0x03, 0x00, 0x00, 0x49, 0x02, 0x00, 0x00 - .byte 0x00, 0x1C, 0x01, 0x11, 0x0A, 0x03, 0x03, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x01, 0x20, 0x00, 0x00 - .byte 0x09, 0x2C, 0x01, 0x14, 0x0A, 0x03, 0x03, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x22, 0x00, 0x00 - .byte 0x06, 0x3C, 0x01, 0x17, 0x0A, 0x03, 0x03, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x40, 0x20, 0x00, 0x00 - .byte 0x03, 0x4C, 0x01, 0x1A, 0x0A, 0x03, 0x03, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x08, 0x20, 0x00, 0x00 - .byte 0x11, 0x03, 0x02, 0x0E, 0x0D, 0x03, 0x0F, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x92, 0x04, 0x00, 0x00 - .byte 0x04, 0x1C, 0x02, 0x11, 0x0D, 0x06, 0x06, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x10, 0x20, 0x00, 0x00 - .byte 0x01, 0x2C, 0x02, 0x14, 0x0D, 0x06, 0x06, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x02, 0x20, 0x00, 0x00 - .byte 0x0A, 0x3C, 0x02, 0x17, 0x0D, 0x06, 0x06, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x24, 0x00, 0x00 - .byte 0x07, 0x4C, 0x02, 0x1A, 0x0D, 0x06, 0x06, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x80, 0x20, 0x00, 0x00 - .byte 0x12, 0x03, 0x03, 0x0E, 0x10, 0x06, 0x12, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x0F, 0x00, 0x24, 0x09, 0x00, 0x00 - .byte 0x08, 0x1C, 0x03, 0x11, 0x10, 0x09, 0x09, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x21, 0x00, 0x00 - .byte 0x05, 0x2C, 0x03, 0x14, 0x10, 0x09, 0x09, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x20, 0x20, 0x00, 0x00 - .byte 0x02, 0x3C, 0x03, 0x17, 0x10, 0x09, 0x09, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x20, 0x00, 0x00 - .byte 0x0B, 0x4C, 0x03, 0x1A, 0x10, 0x09, 0x09, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x28, 0x00, 0x00 - - .align 2 -gUnknown_085B62E4:: @ 85B62E4 - .byte 0, 1, 6, 0, 64, 0, 0, 0 - .byte 1, 3, 12, 0, 0, 16, 0, 0 - .byte 2, 5, 18, 0, 0, 0, 4, 0 - .byte 3, 7, 9, 0, 0, 2, 0, 0 - .byte 4, 9, 11, 0, 0, 8, 0, 0 - .byte 5, 11, 17, 0, 0, 0, 2, 0 - .byte 6, 13, 8, 0, 0, 1, 0, 0 - .byte 7, 15, 14, 0, 0, 64, 0, 0 - .byte 8, 17, 16, 0, 0, 0, 1, 0 - .byte 9, 19, 7, 0, 128, 0, 0, 0 - .byte 10, 21, 13, 0, 0, 32, 0, 0 - .byte 11, 23, 19, 0, 0, 0, 8, 0 - -gUnknown_085B6344:: @ 85B6344 - .byte 1, 3 - .byte 1, 6 - - .align 2 -gUnknown_085B6348:: @ 85B6348 - .byte 0x01, 0x3C, 0x1E, 0x01, 0x01, 0x00, 0x00, 0x00, 0x2D, 0x00, 0x1E, 0x00, 0x01, 0x00, 0x00, 0x00, 0x4B, 0x00, 0x1B, 0x00, 0x18, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x68, 0x01, 0x00, 0x00, 0x00, 0xBF - .byte 0x03, 0x1E, 0x0F, 0x01, 0x00, 0x00, 0x00, 0x00, 0x4B, 0x00, 0x3C, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x30, 0x00, 0x00, 0x00, 0x0A, 0x00, 0x0E, 0x01, 0x00, 0x00, 0x80, 0xBF - - .align 2 -gUnknown_085B6388:: @ 85B6388 - .byte 0x00, 0x80, 0x05, 0x00, 0x01, 0x01, 0xFF, 0x48 - .byte 0x00, 0x80, 0x0A, 0x00, 0x01, 0x01, 0xFF, 0x48 - .byte 0x00, 0x80, 0x15, 0x00, 0x01, 0x01, 0xFF, 0x48 - .byte 0x00, 0x80, 0x55, 0x00, 0x01, 0x01, 0xFF, 0x48 - .byte 0x00, 0x80, 0x5A, 0x00, 0x01, 0x01, 0xFF, 0x48 - .byte 0x00, 0x80, 0x65, 0x00, 0x01, 0x01, 0xFF, 0x48 - .byte 0x00, 0x80, 0x75, 0x00, 0x01, 0x01, 0xFF, 0x48 - .byte 0x00, 0x80, 0x7A, 0x00, 0x01, 0x01, 0xFF, 0x48 - .byte 0x00, 0x80, 0x85, 0x00, 0x01, 0x01, 0xFF, 0x48 - .byte 0x00, 0x80, 0x95, 0x00, 0x01, 0x01, 0xFF, 0x48 - .byte 0x00, 0x80, 0x9A, 0x00, 0x01, 0x01, 0xFF, 0x48 - .byte 0x00, 0x80, 0xA5, 0x00, 0x01, 0x01, 0xFF, 0x48 - .byte 0xD6, 0x77, 0x28, 0x00, 0x02, 0x0A, 0xFF, 0x4E - - .align 1 -gUnknown_085B63F0:: @ 85B63F0 - .2byte 0x53FF - .2byte 0x0101 - .2byte 0x1E05 - .2byte 0x4EFF - .2byte 0x7FFB - .2byte 0x0106 - .2byte 0x1E05 - .2byte 0x4EFF - .2byte 0x7F7F - .2byte 0x010B - .2byte 0x1E05 - .2byte 0x4EFF - - .align 2 -gUnknown_085B6408:: @ 85B6408 - .4byte sub_8142918 - .4byte sub_814297C - - .align 2 -gUnknown_085B6410:: @ 85B6410 - .4byte sub_8140968 - .4byte sub_8140994 - - .align 1 -gUnknown_085B6418:: @ 85B6418 - .2byte 0x2898 - .2byte 0x1A6A - .2byte 0x2898 - -gUnknown_085B641E:: @ 85B641E - .byte 0xFB, 0x05, 0xFF, 0x01 - - .align 1 -gUnknown_085B6422:: @ 85B6422 - .2byte 0, 180 - .2byte 90, 270 - - .align 2 -gUnknown_085B642C:: @ 85B642C - .4byte 0x10842 - .4byte 0x21084 - .4byte 0x42108 - .4byte 0x84210 - - .align 2 -gUnknown_085B643C:: @ 85B643C - .4byte 0x3E0 - .4byte 0x7C00 - .4byte 0xF8000 - -gUnknown_085B6448:: @ 85B6448 - .byte 0, 3, 4, 6, 12 - - .align 2 -RouletteSpritePalette_01: @ 85B6450 - .incbin "graphics/roulette/shadow.gbapal" - - .align 2 -RouletteSpritePalette_02: @ 85B6470 - .incbin "graphics/roulette/ball.gbapal" - - .align 2 -RouletteSpritePalette_03: @ 85B6490 - .incbin "graphics/roulette/ball_counter.gbapal" - - .align 2 -RouletteSpritePalette_04: @ 85B64B0 - .incbin "graphics/roulette/cursor.gbapal" - - .align 2 -RouletteSpritePalette_05: @ 85B64D0 - .incbin "graphics/roulette/credit.gbapal" - - .align 2 -RouletteSpritePalette_06: @ 85B64F0 - .incbin "graphics/roulette/shroomish.gbapal" - - .align 2 -RouletteSpritePalette_07: @ 85B6510 - .incbin "graphics/roulette/tailow.gbapal" - - .align 2 -RouletteSpritePalette_08: @ 85B6530 - .incbin "graphics/roulette/poke_icons.gbapal" - - .align 2 -RouletteSpritePalette_09: @ 85B6550 - .incbin "graphics/roulette/wynaut.gbapal" - - .align 2 -RouletteSpritePalette_10: @ 85B6570 - .incbin "graphics/roulette/azurill.gbapal" - - .align 2 -RouletteSpritePalette_11: @ 85B6590 - .incbin "graphics/roulette/skitty.gbapal" - - .align 2 -RouletteSpritePalette_12: @ 85B65B0 - .incbin "graphics/roulette/makuhita.gbapal" - - .align 2 -RouletteSpritePalette_13: @ 85B65D0 - .incbin "graphics/roulette/85B65D0.gbapal" - - .align 2 -RouletteSpritePalette_14: @ 85B65F0 - .incbin "graphics/roulette/85B65F0.gbapal" - - .align 2 -RouletteSpritePalette_15: @ 85B6610 - .incbin "graphics/roulette/85B6610.gbapal" - - .align 2 -RouletteSpritePalette_16: @ 85B6630 - .incbin "graphics/roulette/85B6630.gbapal" - - .align 2 -gUnknown_085B6650:: @ 85B6650 - .incbin "graphics/roulette/ball.4bpp.lz" - - .align 2 -RouletteBallCounterTiles: @ 85B6798 - .incbin "graphics/roulette/ball_counter.4bpp.lz" - - .align 2 -gUnknown_085B67FC:: @ 85B67FC - .incbin "graphics/roulette/roulette_tilt.4bpp.lz" - - .align 2 -RoulettePokeIconsTiles: @ 85B6BEC - .incbin "graphics/roulette/poke_icons.4bpp.lz" - - .align 2 -RoulettePokeIcons2Tiles: @ 85B6D90 - .incbin "graphics/roulette/poke_icons2.4bpp.lz" - - .align 2 -gUnknown_085B7290:: @ 85B7290 - .incbin "graphics/roulette/shadow.4bpp.lz" - - .align 2 -RouletteCursorTiles: @ 85B7328 - .incbin "graphics/roulette/cursor.4bpp.lz" - - .align 2 -gUnknown_085B7384:: @ 85B7384 - obj_pal RouletteSpritePalette_01, 1 - obj_pal RouletteSpritePalette_02, 2 - obj_pal RouletteSpritePalette_03, 3 - obj_pal RouletteSpritePalette_04, 4 - obj_pal RouletteSpritePalette_05, 5 - obj_pal RouletteSpritePalette_06, 6 - obj_pal RouletteSpritePalette_07, 7 - obj_pal RouletteSpritePalette_08, 8 - obj_pal RouletteSpritePalette_09, 9 - obj_pal RouletteSpritePalette_10, 10 - obj_pal RouletteSpritePalette_11, 11 - obj_pal RouletteSpritePalette_12, 12 - null_obj_pal - - .align 2 -gOamData_85B73EC:: @ 85B73EC - .2byte 0x0000 - .2byte 0x8000 - .2byte 0x0400 - - .align 2 -gOamData_85B73F4:: @ 85B73F4 - .2byte 0x0000 - .2byte 0x4000 - .2byte 0x0400 - - .align 2 -gOamData_85B73FC:: @ 85B73FC - .2byte 0x833C - .2byte 0x8000 - .2byte 0x0800 - - .align 2 -gSpriteAnim_85B7404:: @ 85B7404 - obj_image_anim_frame 0, 0 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_85B740C:: @ 85B740C - .4byte gSpriteAnim_85B7404 - - .align 2 -gSpriteAffineAnim_85B7410:: @ 85B7410 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnimTable_85B7418:: @ 85B7418 - .4byte gSpriteAffineAnim_85B7410 - - .align 2 -gUnknown_085B741C:: @ 85B741C - obj_tiles RoulettePokeIcons2Tiles, 0xC00, 0 - - .align 2 -gSpriteAnim_85B7420:: @ 85B7420 - obj_image_anim_frame 0, 0 - obj_image_anim_frame 32, 0 - obj_image_anim_frame 64, 0 - obj_image_anim_frame 72, 0 - obj_image_anim_frame 8, 0 - obj_image_anim_frame 40, 0 - obj_image_anim_frame 48, 0 - obj_image_anim_frame 80, 0 - obj_image_anim_frame 16, 0 - obj_image_anim_frame 24, 0 - obj_image_anim_frame 56, 0 - obj_image_anim_frame 88, 0 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_85B7458:: @ 85B7458 - .4byte gSpriteAnim_85B7420 - - .align 2 -gSpriteAnimTable_85B745C:: @ 85B745C - .4byte gSpriteAnim_85B7420 + 0x4 - - .align 2 -gSpriteAnimTable_85B7460:: @ 85B7460 - .4byte gSpriteAnim_85B7420 + 0x8 - - .align 2 -gSpriteAnimTable_85B7464:: @ 85B7464 - .4byte gSpriteAnim_85B7420 + 0xC - - .align 2 -gSpriteAnimTable_85B7468:: @ 85B7468 - .4byte gSpriteAnim_85B7420 + 0x10 - - .align 2 -gSpriteAnimTable_85B746C:: @ 85B746C - .4byte gSpriteAnim_85B7420 + 0x14 - - .align 2 -gSpriteAnimTable_85B7470:: @ 85B7470 - .4byte gSpriteAnim_85B7420 + 0x18 - - .align 2 -gSpriteAnimTable_85B7474:: @ 85B7474 - .4byte gSpriteAnim_85B7420 + 0x1C - - .align 2 -gSpriteAnimTable_85B7478:: @ 85B7478 - .4byte gSpriteAnim_85B7420 + 0x20 - - .align 2 -gSpriteAnimTable_85B747C:: @ 85B747C - .4byte gSpriteAnim_85B7420 + 0x24 - - .align 2 -gSpriteAnimTable_85B7480:: @ 85B7480 - .4byte gSpriteAnim_85B7420 + 0x28 - - .align 2 -gSpriteAnimTable_85B7484:: @ 85B7484 - .4byte gSpriteAnim_85B7420 + 0x2C - - .align 2 -gUnknown_085B7488:: @ 85B7488 - obj_tiles gRouletteHeadersTiles, 0x1600, 4 - - .align 2 -gUnknown_085B7490:: @ 85B7490 - obj_tiles RoulettePokeIconsTiles, 0x400, 5 - - .align 2 -gSpriteAnim_85B7498:: @ 85B7498 - obj_image_anim_frame 0, 0 - obj_image_anim_frame 16, 0 - obj_image_anim_frame 32, 0 - obj_image_anim_frame 48, 0 - obj_image_anim_frame 64, 0 - obj_image_anim_frame 80, 0 - obj_image_anim_frame 96, 0 - obj_image_anim_frame 112, 0 - obj_image_anim_frame 128, 0 - obj_image_anim_frame 144, 0 - obj_image_anim_frame 160, 0 - obj_image_anim_end - - .align 2 -gSpriteAnim_85B74C8:: @ 85B74C8 - obj_image_anim_frame 0, 0 - obj_image_anim_frame 4, 0 - obj_image_anim_frame 8, 0 - obj_image_anim_frame 12, 0 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_85B74DC:: @ 85B74DC - .4byte gSpriteAnim_85B7498 - - .align 2 -gSpriteAnimTable_85B74E0:: @ 85B74E0 - .4byte gSpriteAnim_85B7498 + 0x8 - - .align 2 -gSpriteAnimTable_85B74E4:: @ 85B74E4 - .4byte gSpriteAnim_85B7498 + 0x10 - - .align 2 -gSpriteAnimTable_85B74E8:: @ 85B74E8 - .4byte gSpriteAnim_85B7498 + 0x18 - - .align 2 -gSpriteAnimTable_85B74EC:: @ 85B74EC - .4byte gSpriteAnim_85B7498 + 0x20 - - .align 2 -gSpriteAnimTable_85B74F0:: @ 85B74F0 - .4byte gSpriteAnim_85B7498 + 0x24 - - .align 2 -gSpriteAnimTable_85B74F4:: @ 85B74F4 - .4byte gSpriteAnim_85B7498 + 0x28 - - .align 2 -gSpriteAnimTable_85B74F8:: @ 85B74F8 - .4byte gSpriteAnim_85B74C8 - - .align 2 -gSpriteAnimTable_85B74FC:: @ 85B74FC - .4byte gSpriteAnim_85B74C8 + 0x4 - - .align 2 -gSpriteAnimTable_85B7500:: @ 85B7500 - .4byte gSpriteAnim_85B74C8 + 0x8 - - .align 2 -gSpriteAnimTable_85B7504:: @ 85B7504 - .4byte gSpriteAnim_85B74C8 + 0xC - - .align 2 -gSpriteTemplate_85B7508:: @ 85B7508 - spr_template 4, 8, gOamData_85B73EC, gSpriteAnimTable_85B74DC, NULL, gDummySpriteAffineAnimTable, sub_814390C - - .align 2 -gSpriteTemplate_85B7520:: @ 85B7520 - spr_template 4, 8, gOamData_85B73EC, gSpriteAnimTable_85B74E0, NULL, gDummySpriteAffineAnimTable, sub_814390C - - .align 2 -gSpriteTemplate_85B7538:: @ 85B7538 - spr_template 4, 8, gOamData_85B73EC, gSpriteAnimTable_85B74E4, NULL, gDummySpriteAffineAnimTable, sub_814390C - - .align 2 -gSpriteTemplate_85B7550:: @ 85B7550 - spr_template 4, 8, gOamData_85B73EC, gSpriteAnimTable_85B74E8, NULL, gDummySpriteAffineAnimTable, sub_814390C - - .align 2 -gSpriteTemplate_85B7568:: @ 85B7568 - spr_template 4, 8, gOamData_85B73EC, gSpriteAnimTable_85B74EC, NULL, gDummySpriteAffineAnimTable, sub_814390C - - .align 2 -gSpriteTemplate_85B7580:: @ 85B7580 - spr_template 4, 8, gOamData_85B73EC, gSpriteAnimTable_85B74F0, NULL, gDummySpriteAffineAnimTable, sub_814390C - - .align 2 -gSpriteTemplate_85B7598:: @ 85B7598 - spr_template 4, 8, gOamData_85B73EC, gSpriteAnimTable_85B74F4, NULL, gDummySpriteAffineAnimTable, sub_814390C - - .align 2 -gSpriteTemplate_85B75B0:: @ 85B75B0 - spr_template 5, 8, gOamData_85B73F4, gSpriteAnimTable_85B74F8, NULL, gDummySpriteAffineAnimTable, sub_814390C - - .align 2 -gSpriteTemplate_85B75C8:: @ 85B75C8 - spr_template 5, 8, gOamData_85B73F4, gSpriteAnimTable_85B74FC, NULL, gDummySpriteAffineAnimTable, sub_814390C - - .align 2 -gSpriteTemplate_85B75E0:: @ 85B75E0 - spr_template 5, 8, gOamData_85B73F4, gSpriteAnimTable_85B7500, NULL, gDummySpriteAffineAnimTable, sub_814390C - - .align 2 -gSpriteTemplate_85B75F8:: @ 85B75F8 - spr_template 5, 8, gOamData_85B73F4, gSpriteAnimTable_85B7504, NULL, gDummySpriteAffineAnimTable, sub_814390C - - .align 2 -gSpriteTemplate_85B7610:: @ 85B7610 - spr_template 0, 9, gOamData_85B73FC, gSpriteAnimTable_85B7458, NULL, gDummySpriteAffineAnimTable, sub_8143280 - - .align 2 -gSpriteTemplate_85B7628:: @ 85B7628 - spr_template 0, 10, gOamData_85B73FC, gSpriteAnimTable_85B745C, NULL, gDummySpriteAffineAnimTable, sub_8143280 - - .align 2 -gSpriteTemplate_85B7640:: @ 85B7640 - spr_template 0, 11, gOamData_85B73FC, gSpriteAnimTable_85B7460, NULL, gDummySpriteAffineAnimTable, sub_8143280 - - .align 2 -gSpriteTemplate_85B7658:: @ 85B7658 - spr_template 0, 12, gOamData_85B73FC, gSpriteAnimTable_85B7464, NULL, gDummySpriteAffineAnimTable, sub_8143280 - - .align 2 -gSpriteTemplate_85B7670:: @ 85B7670 - spr_template 0, 9, gOamData_85B73FC, gSpriteAnimTable_85B7468, NULL, gDummySpriteAffineAnimTable, sub_8143280 - - .align 2 -gSpriteTemplate_85B7688:: @ 85B7688 - spr_template 0, 10, gOamData_85B73FC, gSpriteAnimTable_85B746C, NULL, gDummySpriteAffineAnimTable, sub_8143280 - - .align 2 -gSpriteTemplate_85B76A0:: @ 85B76A0 - spr_template 0, 11, gOamData_85B73FC, gSpriteAnimTable_85B7470, NULL, gDummySpriteAffineAnimTable, sub_8143280 - - .align 2 -gSpriteTemplate_85B76B8:: @ 85B76B8 - spr_template 0, 12, gOamData_85B73FC, gSpriteAnimTable_85B7474, NULL, gDummySpriteAffineAnimTable, sub_8143280 - - .align 2 -gSpriteTemplate_85B76D0:: @ 85B76D0 - spr_template 0, 9, gOamData_85B73FC, gSpriteAnimTable_85B7478, NULL, gDummySpriteAffineAnimTable, sub_8143280 - - .align 2 -gSpriteTemplate_85B76E8:: @ 85B76E8 - spr_template 0, 10, gOamData_85B73FC, gSpriteAnimTable_85B747C, NULL, gDummySpriteAffineAnimTable, sub_8143280 - - .align 2 -gSpriteTemplate_85B7700:: @ 85B7700 - spr_template 0, 11, gOamData_85B73FC, gSpriteAnimTable_85B7480, NULL, gDummySpriteAffineAnimTable, sub_8143280 - - .align 2 -gSpriteTemplate_85B7718:: @ 85B7718 - spr_template 0, 12, gOamData_85B73FC, gSpriteAnimTable_85B7484, NULL, gDummySpriteAffineAnimTable, sub_8143280 - - .align 2 -gOamData_85B7730:: @ 85B7730 - .2byte 0x4000 - .2byte 0xC000 - .2byte 0x0400 - - .align 2 -gOamData_85B7738:: @ 85B7738 - .2byte 0x8000 - .2byte 0x0000 - .2byte 0x0400 - - .align 2 -gOamData_85B7740:: @ 85B7740 - .2byte 0x4000 - .2byte 0x8000 - .2byte 0x0400 - - .align 2 -gOamData_85B7748:: @ 85B7748 - .2byte 0x4000 - .2byte 0x0000 - .2byte 0x0400 - - .align 2 -gUnknown_085B7750:: @ 85B7750 - obj_tiles gRouletteCreditTiles, 0x400, 7 - obj_tiles gRouletteNumbersTiles, 0x280, 8 - obj_tiles gRouletteMultiplierTiles, 0x500, 9 - obj_tiles RouletteBallCounterTiles, 0x140, 10 - obj_tiles RouletteCursorTiles, 0x200, 11 - null_obj_tiles - - .align 2 -gSpriteAnim_85B7780:: @ 85B7780 - obj_image_anim_frame 0, 0 - obj_image_anim_frame 2, 0 - obj_image_anim_frame 4, 0 - obj_image_anim_frame 6, 0 - obj_image_anim_frame 8, 0 - obj_image_anim_frame 10, 0 - obj_image_anim_frame 12, 0 - obj_image_anim_frame 14, 0 - obj_image_anim_frame 16, 0 - obj_image_anim_frame 18, 0 - - .align 2 -gSpriteAnimTable_85B77A8:: @ 85B77A8 - .4byte gSpriteAnim_85B7780 - - .align 2 -gSpriteAnim_85B77AC:: @ 85B77AC - obj_image_anim_frame 0, 0 - obj_image_anim_frame 8, 0 - obj_image_anim_frame 16, 0 - obj_image_anim_frame 24, 0 - obj_image_anim_frame 32, 0 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_85B77C4:: @ 85B77C4 - .4byte gSpriteAnim_85B77AC - - .align 2 -gSpriteAnim_85B77C8:: @ 85B77C8 - obj_image_anim_frame 0, 0 - obj_image_anim_frame 2, 0 - obj_image_anim_frame 4, 0 - obj_image_anim_frame 6, 0 - obj_image_anim_frame 8, 0 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_85B77E0:: @ 85B77E0 - .4byte gSpriteAnim_85B77C8 - - .align 2 -gSpriteTemplate_85B77E4:: @ 85B77E4 - spr_template 7, 5, gOamData_85B7730, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_085B77FC:: @ 85B77FC - spr_template 8, 5, gOamData_85B7738, gSpriteAnimTable_85B77A8, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_085B7814:: @ 85B7814 - spr_template 9, 5, gOamData_85B7740, gSpriteAnimTable_85B77C4, NULL, gDummySpriteAffineAnimTable, sub_814390C - - .align 2 -gUnknown_085B782C:: @ 85B782C - spr_template 10, 3, gOamData_85B7748, gSpriteAnimTable_85B77E0, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gUnknown_085B7844:: @ 85B7844 - spr_template 11, 5, gOamData_85B73EC, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gOamData_85B785C:: @ 85B785C - .2byte 0x0000 - .2byte 0x4000 - .2byte 0x0800 - - .align 2 -gUnknown_085B7864:: @ 85B7864 - obj_tiles gUnknown_085B6650, 0x200, 0xC - - .align 2 -gSpriteAnim_85B786C:: @ 85B786C - obj_image_anim_frame 0, 5 - obj_image_anim_frame 4, 5 - obj_image_anim_frame 8, 5 - obj_image_anim_frame 4, 5 - obj_image_anim_jump 0 - - .align 2 -gSpriteAnim_85B7880:: @ 85B7880 - obj_image_anim_frame 0, 10 - obj_image_anim_frame 4, 10 - obj_image_anim_frame 8, 10 - obj_image_anim_frame 4, 10 - obj_image_anim_jump 0 - - .align 2 -gSpriteAnim_85B7894:: @ 85B7894 - obj_image_anim_frame 0, 15 - obj_image_anim_frame 4, 15 - obj_image_anim_frame 8, 15 - obj_image_anim_frame 4, 15 - obj_image_anim_jump 0 - - .align 2 -gSpriteAnim_85B78A8:: @ 85B78A8 - obj_image_anim_frame 4, 2 - obj_image_anim_frame 8, 5 - obj_image_anim_frame 4, 5 - obj_image_anim_frame 12, 5 - obj_image_anim_end - - .align 2 -gSpriteAnim_85B78BC:: @ 85B78BC - obj_image_anim_frame 4, 2 - obj_image_anim_frame 0, 4 - obj_image_anim_frame 4, 4 - obj_image_anim_frame 8, 4 - obj_image_anim_frame 12, 4 - obj_image_anim_end - - .align 2 -gSpriteAnim_85B78D4:: @ 85B78D4 - obj_image_anim_frame 0, 2 - obj_image_anim_frame 4, 5 - obj_image_anim_frame 8, 5 - obj_image_anim_frame 12, 5 - obj_image_anim_end - - .align 2 -gSpriteAnim_85B78E8:: @ 85B78E8 - obj_image_anim_frame 12, 0 - obj_image_anim_end - - .align 2 -gSpriteAnim_85B78F0:: @ 85B78F0 - obj_image_anim_frame 8, 2 - obj_image_anim_frame 4, 5 - obj_image_anim_frame 0, 5 - obj_image_anim_frame 12, 5 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_85B7904:: @ 85B7904 - .4byte gSpriteAnim_85B786C - .4byte gSpriteAnim_85B7880 - .4byte gSpriteAnim_85B7894 - .4byte gSpriteAnim_85B78A8 - .4byte gSpriteAnim_85B78F0 - .4byte gSpriteAnim_85B78BC - .4byte gSpriteAnim_85B78D4 - .4byte gSpriteAnim_85B78D4 - .4byte gSpriteAnim_85B78E8 - - .align 2 -gSpriteTemplate_85B7928:: @ 85B7928 - spr_template 12, 2, gOamData_85B785C, gSpriteAnimTable_85B7904, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gOamData_85B7940:: @ 85B7940 - .2byte 0x0351 - .2byte 0xC000 - .2byte 0x0800 - - .align 2 -gUnknown_085B7948:: @ 85B7948 - obj_tiles gRouletteCenter_Gfx, 2048, 0x0006 - - .align 2 -gSpriteTemplate_85B7950:: @ 85B7950 - spr_template 6, 2, gOamData_85B7940, gDummySpriteAnimTable, NULL, gDummySpriteAffineAnimTable, sub_814399C - - .align 2 -gOamData_85B7968:: @ 85B7968 - .2byte 0x0000 - .2byte 0x8000 - .2byte 0x0800 - - .align 2 -gOamData_85B7970:: @ 85B7970 - .2byte 0x0000 - .2byte 0x8000 - .2byte 0x0800 - - .align 2 -gUnknown_085B7978:: @ 85B7978 - obj_tiles gUnknown_085B67FC, 0xE00, 0x000D - - .align 2 -gSpriteAnim_85B7980:: @ 85B7980 - obj_image_anim_frame 0x00, 6 - obj_image_anim_frame 0x10, 6 - obj_image_anim_frame 0x20, 6 - obj_image_anim_frame 0x30, 6 - obj_image_anim_frame 0x20, 6 - obj_image_anim_frame 0x40, 6 - obj_image_anim_jump 2 - - .align 2 -gSpriteAnim_85B799C:: @ 85B799C - obj_image_anim_frame 0x50, 10 - obj_image_anim_end - - .align 2 -gSpriteAnim_85B79A4:: @ 85B79A4 - obj_image_anim_frame 0x50, 10, OBJ_IMAGE_ANIM_H_FLIP - obj_image_anim_end - - .align 2 -gSpriteAnim_85B79AC:: @ 85B79AC - obj_image_anim_frame 0x50, 20 - obj_image_anim_frame 0x60, 20 - obj_image_anim_jump 0 - - .align 2 -gSpriteAnim_85B79B8:: @ 85B79B8 - obj_image_anim_frame 0x50, 20, OBJ_IMAGE_ANIM_H_FLIP - obj_image_anim_frame 0x60, 20, OBJ_IMAGE_ANIM_H_FLIP - obj_image_anim_jump 0 - - .align 2 -gSpriteAnim_85B79C4:: @ 85B79C4 - obj_image_anim_frame 0x50, 10 - obj_image_anim_frame 0x60, 10 - obj_image_anim_jump 0 - - .align 2 -gSpriteAnim_85B79D0:: @ 85B79D0 - obj_image_anim_frame 0x50, 10, OBJ_IMAGE_ANIM_H_FLIP - obj_image_anim_frame 0x60, 10, OBJ_IMAGE_ANIM_H_FLIP - obj_image_anim_jump 0 - - .align 2 -gSpriteAnimTable_85B79DC:: @ 85B79DC - .4byte gSpriteAnim_85B7980 - - .align 2 -gSpriteAnimTable_85B79E0:: @ 85B79E0 - .4byte gSpriteAnim_85B799C - .4byte gSpriteAnim_85B79A4 - .4byte gSpriteAnim_85B79AC - .4byte gSpriteAnim_85B79B8 - .4byte gSpriteAnim_85B79C4 - .4byte gSpriteAnim_85B79D0 - - .align 2 -gSpriteTemplate_85B79F8:: @ 85B79F8 - spr_template 13, 6, gOamData_85B7968, gSpriteAnimTable_85B79DC, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gSpriteTemplate_85B7A10:: @ 85B7A10 - spr_template 13, 7, gOamData_85B7970, gSpriteAnimTable_85B79E0, NULL, gDummySpriteAffineAnimTable, sub_8145294 - - .align 2 -gOamData_85B7A28:: @ 85B7A28 - .2byte 0x0000 - .2byte 0x4000 - .2byte 0x0800 - - .align 2 -gOamData_85B7A30:: @ 85B7A30 - .2byte 0x4000 - .2byte 0x8000 - .2byte 0x0800 - - .align 2 -gOamData_85B7A38:: @ 85B7A38 - .2byte 0x4100 - .2byte 0x8000 - .2byte 0x0800 - - .align 2 -gUnknown_085B7A40:: @ 85B7A40 - obj_tiles gUnknown_085B7290, 0x180, 0x000E - - .align 2 -gSpriteAffineAnim_85B7A48:: @ 85B7A48 - obj_rot_scal_anim_frame 0x80, 0x80, 0, 0 - obj_rot_scal_anim_frame 0x2, 0x2, 0, 60 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnim_85B7A60:: @ 85B7A60 - obj_rot_scal_anim_frame 0x100, 0x100, 0, 0 - obj_rot_scal_anim_frame 0xFFFE, 0x0, 0, 15 - obj_rot_scal_anim_frame 0xFFFF, 0xFFFE, 0, 15 - obj_rot_scal_anim_frame 0xFFFF, 0xFFFB, 0, 24 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnimTable_85B7A88:: @ 85B7A88 - .4byte gSpriteAffineAnim_85B7A48 - - .align 2 -gSpriteAffineAnimTable_85B7A8C:: @ 85B7A8C - .4byte gSpriteAffineAnim_85B7A60 - - .align 2 -gSpriteAffineAnim_85B7A90:: @ 85B7A90 - obj_rot_scal_anim_frame 0x100, 0x100, 0, 0 - obj_rot_scal_anim_end - - .align 2 -gSpriteAffineAnimTable_85B7AA0:: @ 85B7AA0 - .4byte gSpriteAffineAnim_85B7A90 - - .align 2 -gSpriteAnim_85B7AA4:: @ 85B7AA4 - obj_image_anim_frame 0, 0 - obj_image_anim_end - - .align 2 -gSpriteAnim_85B7AAC:: @ 85B7AAC - obj_image_anim_frame 4, 0 - obj_image_anim_end - - .align 2 -gSpriteAnimTable_85B7AB4:: @ 85B7AB4 - .4byte gSpriteAnim_85B7AA4 - - .align 2 -gSpriteAnimTable_85B7AB8:: @ 85B7AB8 - .4byte gSpriteAnim_85B7AAC - - .align 2 -gSpriteTemplate_85B7ABC:: @ 85B7ABC - spr_template 14, 1, gOamData_85B7A28, gSpriteAnimTable_85B7AB4, NULL, gDummySpriteAffineAnimTable, SpriteCallbackDummy - - .align 2 -gSpriteTemplate_83FA5D8:: @ 83FA5D8 - spr_template 14, 1, gOamData_85B7A30, gSpriteAnimTable_85B7AB8, NULL, gDummySpriteAffineAnimTable, sub_8144E60 - - .align 2 -gUnknown_085B7AEC:: @ 85B7AEC - spr_template 14, 1, gOamData_85B7A38, gSpriteAnimTable_85B7AB8, NULL, gSpriteAffineAnimTable_85B7A8C, sub_8145294 - -gUnknown_085B7B04:: @ 85B7B04 - .byte 0, 1, 2, 3, 4 - - .align 1 -gUnknown_085B7B0A:: @ 85B7B0A - .2byte 0x74, 0x2C - .2byte 0x74, 0x70 - - .align 1 -gUnknown_085B7B12:: @ 85B7B12 - .2byte 256, 84 - .2byte -16, 84 - - .align 1 -gUnknown_085B7B1A:: @ 85B7B1A - .2byte 0x907 - .2byte 0x808 - .2byte 0x709 - .2byte 0x60A - .2byte 0x50B - .2byte 0x40C - .2byte 0x30D - .2byte 0x20E - .2byte 0x10F - .2byte 0x10 - - .align 1 -gUnknown_085B7B2E:: @ 85B7B2E - .2byte -1, 0, 1, 0 - .2byte -2, 0, 2, 0 - .2byte -3, 0, 3, 0 - -gUnknown_085B7B46:: @ 85B7B46 - .byte -1, 1 - -gUnknown_085B7B48:: @ 85B7B48 - .byte 2, 0 - .byte 2, 0 - .byte 2, -1 - .byte 2, -1 - .byte 2, -1 - .byte 2, -1 - .byte 2, -2 - .byte 2, -2 diff --git a/include/gba/types.h b/include/gba/types.h index fff48d437..3d78b5b5e 100644 --- a/include/gba/types.h +++ b/include/gba/types.h @@ -59,8 +59,8 @@ struct OamData u32 shape:2; // 0x40, 0x80 -> 0xC0 /*0x02*/ u32 x:9; - u32 matrixNum:5; // bits 3/4 are h-flip/v-flip if not in affine mode - u32 size:2; + u32 matrixNum:5; // bits 3/4 are h-flip/v-flip if not in affine mode + u32 size:2; // 0x4000, 0x8000 -> 0xC000 /*0x04*/ u16 tileNum:10; // 0x3FF u16 priority:2; // 0x400, 0x800 -> 0xC00 diff --git a/ld_script.txt b/ld_script.txt index 559b375f5..f675b6a91 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -524,7 +524,7 @@ SECTIONS { src/battle_records.o(.rodata); src/pokedex_area_screen.o(.rodata); src/evolution_scene.o(.rodata); - data/roulette.o(.rodata); + src/roulette.o(.rodata); src/pokedex_cry_screen.o(.rodata); src/landmark.o(.rodata); src/battle_transition.o(.rodata); diff --git a/src/roulette.c b/src/roulette.c index eab2bcd7a..209ddefc9 100644 --- a/src/roulette.c +++ b/src/roulette.c @@ -36,15 +36,15 @@ struct StructgUnknown_083F8DF4 u8 var02; u8 var03; u8 var04; - u8 v[0x3]; + u8 filler_05[3]; u16 var08; u16 var0A; u16 var0C; - u16 v13[0x1]; + u8 filler_0E[2]; u16 var10; u16 var12; u16 var14; - u8 v1[0x2]; + u8 filler_16[2]; u16 var18; u16 var1A; float var1C; @@ -60,11 +60,9 @@ struct StructgUnknown_085B6154 u8 var04; u8 var05; u8 var06; - u8 var07; u32 var08; u32 var0C; u16 var10; - u16 var12; }; struct StructgUnknown_083F8D90 @@ -72,7 +70,6 @@ struct StructgUnknown_083F8D90 u8 var00; u8 var01; u8 var02; - u8 var03; u32 var04; }; @@ -139,6 +136,7 @@ extern u8 gUnknown_0203AB8C; /*static*/ void sub_8140814(u8); /*static*/ void sub_81408A8(u8); /*static*/ void sub_8140968(u8); +/*static*/ void sub_8140994(u8); /*static*/ void sub_8140BD0(u8); /*static*/ void sub_8141040(u8); /*static*/ void sub_81410FC(u8); @@ -157,6 +155,8 @@ extern u8 gUnknown_0203AB8C; /*static*/ void sub_8141F7C(u8 taskId, TaskFunc r1, u16 r2, u16 r3); /*static*/ void sub_8141FF4(u8); /*static*/ void sub_8142070(void); +/*static*/ void sub_8142918(u8); +/*static*/ void sub_814297C(u8); /*static*/ u8 sub_81420D0(u8, u8); /*static*/ bool8 sub_81421E8(u8, u8); /*static*/ void sub_8142284(u8); @@ -170,18 +170,22 @@ extern u8 gUnknown_0203AB8C; /*static*/ void sub_8143038(u8, u8); /*static*/ void sub_8143150(u8); /*static*/ void sub_81431E4(void); +/*static*/ void sub_8143280(struct Sprite *); /*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_814399C(struct Sprite *); /*static*/ void sub_81439C8(void); /*static*/ void sub_8143A40(void); /*static*/ void sub_81446AC(struct Sprite *); /*static*/ void sub_81446DC(struct Sprite *); /*static*/ void sub_81448B8(struct Sprite *); /*static*/ void sub_8144A24(struct Sprite *); +/*static*/ void sub_8144E60(struct Sprite *); +/*static*/ void sub_8145294(struct Sprite *); extern const struct BgTemplate gUnknown_085B6140[3]; extern const struct WindowTemplate gUnknown_085B614C[]; @@ -209,7 +213,7 @@ extern const u8 gUnknown_082A5B4E[]; extern const struct YesNoFuncTable gUnknown_085B6410; extern const struct StructgUnknown_085B6154 gUnknown_085B6154[]; extern const u8 gUnknown_085B641E[]; -extern const u16 gUnknown_085B6422; +extern const u16 gUnknown_085B6422[]; extern const u32 gUnknown_085B642C[]; extern const u32 gUnknown_085B643C[]; extern const struct StructgUnknown_083F8D90 gUnknown_085B62E4[]; @@ -249,6 +253,609 @@ extern const s8 gUnknown_085B7B46[]; extern const s8 gUnknown_085B7B48[]; extern const s8 gUnknown_085B7B46[]; +static const u16 gUnknown_085B5BFC[] = INCBIN_U16("graphics/roulette/85B5BFC.gbapal"); +static const u32 gUnknown_085B5DFC[] = INCBIN_U32("graphics/roulette/85B5DFC.bin.lz"); +static const u32 gUnknown_085B5FA0[] = INCBIN_U32("graphics/roulette/wheel_map.bin.lz"); +static const struct BgTemplate gUnknown_085B6140[] = +{ + { + .bg = 0, + .charBaseIndex = 2, + .mapBaseIndex = 31, + .screenSize = 0, + .paletteMode = 0, + .priority = 0, + .baseTile = 0 + }, + { + .bg = 1, + .charBaseIndex = 0, + .mapBaseIndex = 4, + .screenSize = 1, + .paletteMode = 0, + .priority = 1, + .baseTile = 0 + }, + { + .bg = 2, + .charBaseIndex = 1, + .mapBaseIndex = 6, + .screenSize = 1, + .paletteMode = 1, + .priority = 2, + .baseTile = 0 + } +}; +static const struct WindowTemplate gUnknown_085B614C[] = +{ + { + .bg = 0, + .tilemapLeft = 3, + .tilemapTop = 15, + .width = 24, + .height = 4, + .paletteNum = 15, + .baseBlock = 0xC5 + }, + // BUG: Array not terminated properly + //DUMMY_WIN_TEMPLATE +}; +static const struct StructgUnknown_085B6154 gUnknown_085B6154[] = +{ + { + .var00 = 0xFF, + .var01_0 = 0, + .var01_4 = 0, + .var02 = 0, + .var03 = 7, + .var04 = 7, + .var05 = 0, + .var06 = 0, + .var08 = 0x0, + .var0C = 0x0, + .var10 = 0x0, + }, + { + .var00 = 12, + .var01_0 = 4, + .var01_4 = 1, + .var02 = 0, + .var03 = 17, + .var04 = 7, + .var05 = 0, + .var06 = 0, + .var08 = 0x2, + .var0C = 0x10842, + .var10 = 0xE000, + }, + { + .var00 = 13, + .var01_0 = 4, + .var01_4 = 2, + .var02 = 0, + .var03 = 20, + .var04 = 7, + .var05 = 0, + .var06 = 0, + .var08 = 0x4, + .var0C = 0x21084, + .var10 = 0xE000, + }, + { + .var00 = 14, + .var01_0 = 4, + .var01_4 = 3, + .var02 = 0, + .var03 = 23, + .var04 = 7, + .var05 = 0, + .var06 = 0, + .var08 = 0x8, + .var0C = 0x42108, + .var10 = 0xE000, + }, + { + .var00 = 15, + .var01_0 = 4, + .var01_4 = 4, + .var02 = 0, + .var03 = 26, + .var04 = 7, + .var05 = 0, + .var06 = 0, + .var08 = 0x10, + .var0C = 0x84210, + .var10 = 0xE000, + }, + { + .var00 = 16, + .var01_0 = 3, + .var01_4 = 0, + .var02 = 1, + .var03 = 14, + .var04 = 10, + .var05 = 0, + .var06 = 12, + .var08 = 0x20, + .var0C = 0x3E0, + .var10 = 0x249, + }, + { + .var00 = 0, + .var01_0 = 12, + .var01_4 = 1, + .var02 = 1, + .var03 = 17, + .var04 = 10, + .var05 = 3, + .var06 = 3, + .var08 = 0x40, + .var0C = 0x40, + .var10 = 0x2001, + }, + { + .var00 = 9, + .var01_0 = 12, + .var01_4 = 2, + .var02 = 1, + .var03 = 20, + .var04 = 10, + .var05 = 3, + .var06 = 3, + .var08 = 0x80, + .var0C = 0x80, + .var10 = 0x2200, + }, + { + .var00 = 6, + .var01_0 = 12, + .var01_4 = 3, + .var02 = 1, + .var03 = 23, + .var04 = 10, + .var05 = 3, + .var06 = 3, + .var08 = 0x100, + .var0C = 0x100, + .var10 = 0x2040, + }, + { + .var00 = 3, + .var01_0 = 12, + .var01_4 = 4, + .var02 = 1, + .var03 = 26, + .var04 = 10, + .var05 = 3, + .var06 = 3, + .var08 = 0x200, + .var0C = 0x200, + .var10 = 0x2008, + }, + { + .var00 = 17, + .var01_0 = 3, + .var01_4 = 0, + .var02 = 2, + .var03 = 14, + .var04 = 13, + .var05 = 3, + .var06 = 15, + .var08 = 0x400, + .var0C = 0x7C00, + .var10 = 0x492, + }, + { + .var00 = 4, + .var01_0 = 12, + .var01_4 = 1, + .var02 = 2, + .var03 = 17, + .var04 = 13, + .var05 = 6, + .var06 = 6, + .var08 = 0x800, + .var0C = 0x800, + .var10 = 0x2010, + }, + { + .var00 = 1, + .var01_0 = 12, + .var01_4 = 2, + .var02 = 2, + .var03 = 20, + .var04 = 13, + .var05 = 6, + .var06 = 6, + .var08 = 0x1000, + .var0C = 0x1000, + .var10 = 0x2002, + }, + { + .var00 = 10, + .var01_0 = 12, + .var01_4 = 3, + .var02 = 2, + .var03 = 23, + .var04 = 13, + .var05 = 6, + .var06 = 6, + .var08 = 0x2000, + .var0C = 0x2000, + .var10 = 0x2400, + }, + { + .var00 = 7, + .var01_0 = 12, + .var01_4 = 4, + .var02 = 2, + .var03 = 26, + .var04 = 13, + .var05 = 6, + .var06 = 6, + .var08 = 0x4000, + .var0C = 0x4000, + .var10 = 0x2080, + }, + { + .var00 = 18, + .var01_0 = 3, + .var01_4 = 0, + .var02 = 3, + .var03 = 14, + .var04 = 16, + .var05 = 6, + .var06 = 18, + .var08 = 0x8000, + .var0C = 0xF8000, + .var10 = 0x924, + }, + { + .var00 = 8, + .var01_0 = 12, + .var01_4 = 1, + .var02 = 3, + .var03 = 17, + .var04 = 16, + .var05 = 9, + .var06 = 9, + .var08 = 0x10000, + .var0C = 0x10000, + .var10 = 0x2100, + }, + { + .var00 = 5, + .var01_0 = 12, + .var01_4 = 2, + .var02 = 3, + .var03 = 20, + .var04 = 16, + .var05 = 9, + .var06 = 9, + .var08 = 0x20000, + .var0C = 0x20000, + .var10 = 0x2020, + }, + { + .var00 = 2, + .var01_0 = 12, + .var01_4 = 3, + .var02 = 3, + .var03 = 23, + .var04 = 16, + .var05 = 9, + .var06 = 9, + .var08 = 0x40000, + .var0C = 0x40000, + .var10 = 0x2004, + }, + { + .var00 = 11, + .var01_0 = 12, + .var01_4 = 4, + .var02 = 3, + .var03 = 26, + .var04 = 16, + .var05 = 9, + .var06 = 9, + .var08 = 0x80000, + .var0C = 0x80000, + .var10 = 0x2800, + }, +}; + +static const struct StructgUnknown_083F8D90 gUnknown_085B62E4[] = +{ + { + .var00 = 0, + .var01 = 1, + .var02 = 6, + .var04 = 0x40, + }, + { + .var00 = 1, + .var01 = 3, + .var02 = 12, + .var04 = 0x1000, + }, + { + .var00 = 2, + .var01 = 5, + .var02 = 18, + .var04 = 0x40000, + }, + { + .var00 = 3, + .var01 = 7, + .var02 = 9, + .var04 = 0x200, + }, + { + .var00 = 4, + .var01 = 9, + .var02 = 11, + .var04 = 0x800, + }, + { + .var00 = 5, + .var01 = 11, + .var02 = 17, + .var04 = 0x20000, + }, + { + .var00 = 6, + .var01 = 13, + .var02 = 8, + .var04 = 0x100, + }, + { + .var00 = 7, + .var01 = 15, + .var02 = 14, + .var04 = 0x4000, + }, + { + .var00 = 8, + .var01 = 17, + .var02 = 16, + .var04 = 0x10000, + }, + { + .var00 = 9, + .var01 = 19, + .var02 = 7, + .var04 = 0x80, + }, + { + .var00 = 10, + .var01 = 21, + .var02 = 13, + .var04 = 0x2000, + }, + { + .var00 = 11, + .var01 = 23, + .var02 = 19, + .var04 = 0x80000, + }, +}; +static const u8 gUnknown_085B6344[] = {1, 3, 1, 6}; +static const struct StructgUnknown_083F8DF4 gUnknown_085B6348[] = +{ + { + .var00 = 1, + .var01 = 60, + .var02 = 30, + .var03 = 1, + .var04 = 1, + .var08 = 45, + .var0A = 30, + .var0C = 1, + .var10 = 75, + .var12 = 27, + .var14 = 24, + .var18 = 10, + .var1A = 360, + .var1C = -0.5f + }, + { + .var00 = 3, + .var01 = 30, + .var02 = 15, + .var03 = 1, + .var04 = 0, + .var08 = 75, + .var0A = 60, + .var0C = 2, + .var10 = 0, + .var12 = 54, + .var14 = 48, + .var18 = 10, + .var1A = 270, + .var1C = -1.0f + } +}; + +static const struct UnkStruct1 gUnknown_085B6388[] = +{ + { + .var00 = 0x8000, + .var02 = 0x0005, + .var04 = 1, + .var05 = 1, + .var06 = 0xFF, + .var07_0 = 8, + .var07_5 = 2, + .var07_7 = 0 + }, + { + .var00 = 0x8000, + .var02 = 0x000A, + .var04 = 1, + .var05 = 1, + .var06 = 0xFF, + .var07_0 = 8, + .var07_5 = 2, + .var07_7 = 0 + }, + { + .var00 = 0x8000, + .var02 = 0x0015, + .var04 = 1, + .var05 = 1, + .var06 = 0xFF, + .var07_0 = 8, + .var07_5 = 2, + .var07_7 = 0 + }, + { + .var00 = 0x8000, + .var02 = 0x0055, + .var04 = 1, + .var05 = 1, + .var06 = 0xFF, + .var07_0 = 8, + .var07_5 = 2, + .var07_7 = 0 + }, + { + .var00 = 0x8000, + .var02 = 0x005A, + .var04 = 1, + .var05 = 1, + .var06 = 0xFF, + .var07_0 = 8, + .var07_5 = 2, + .var07_7 = 0 + }, + { + .var00 = 0x8000, + .var02 = 0x0065, + .var04 = 1, + .var05 = 1, + .var06 = 0xFF, + .var07_0 = 8, + .var07_5 = 2, + .var07_7 = 0 + }, + { + .var00 = 0x8000, + .var02 = 0x0075, + .var04 = 1, + .var05 = 1, + .var06 = 0xFF, + .var07_0 = 8, + .var07_5 = 2, + .var07_7 = 0 + }, + { + .var00 = 0x8000, + .var02 = 0x007A, + .var04 = 1, + .var05 = 1, + .var06 = 0xFF, + .var07_0 = 8, + .var07_5 = 2, + .var07_7 = 0 + }, + { + .var00 = 0x8000, + .var02 = 0x0085, + .var04 = 1, + .var05 = 1, + .var06 = 0xFF, + .var07_0 = 8, + .var07_5 = 2, + .var07_7 = 0 + }, + { + .var00 = 0x8000, + .var02 = 0x0095, + .var04 = 1, + .var05 = 1, + .var06 = 0xFF, + .var07_0 = 8, + .var07_5 = 2, + .var07_7 = 0 + }, + { + .var00 = 0x8000, + .var02 = 0x009A, + .var04 = 1, + .var05 = 1, + .var06 = 0xFF, + .var07_0 = 8, + .var07_5 = 2, + .var07_7 = 0 + }, + { + .var00 = 0x8000, + .var02 = 0x00A5, + .var04 = 1, + .var05 = 1, + .var06 = 0xFF, + .var07_0 = 8, + .var07_5 = 2, + .var07_7 = 0 + }, + { + .var00 = 0x77D6, + .var02 = 0x0028, + .var04 = 2, + .var05 = 10, + .var06 = 0xFF, + .var07_0 = 14, + .var07_5 = 2, + .var07_7 = 0 + }, +}; + +static const struct UnkStruct1 gUnknown_085B63F0[] = +{ + { + .var00 = 0x53FF, + .var02 = 0x0101, + .var04 = 5, + .var05 = 30, + .var06 = 0xFF, + .var07_0 = 14, + .var07_5 = 2, + .var07_7 = 0 + }, + { + .var00 = 0x7FFB, + .var02 = 0x0106, + .var04 = 5, + .var05 = 30, + .var06 = 0xFF, + .var07_0 = 14, + .var07_5 = 2, + .var07_7 = 0 + }, + { + .var00 = 0x7F7F, + .var02 = 0x010B, + .var04 = 5, + .var05 = 30, + .var06 = 0xFF, + .var07_0 = 14, + .var07_5 = 2, + .var07_7 = 0 + } +}; + +static const struct YesNoFuncTable gUnknown_085B6408 = +{ + sub_8142918, + sub_814297C +}; + +static const struct YesNoFuncTable gUnknown_085B6410 = +{ + sub_8140968, + sub_8140994 +}; + void sub_8140238(void) { RunTasks(); @@ -324,9 +931,8 @@ void sub_8140418(void) void sub_8140470(void) { u8 i; - u16 arr[3]; // the third is never used ? + u16 arr[3] = {RGB(24, 4, 10), RGB(10, 19, 6), RGB(24, 4, 10)}; // the third is never used ? - memcpy(arr, &gUnknown_085B6418, sizeof(arr)); gUnknown_0203AB88->var04_0 = (gSpecialVar_0x8004 & 1); if (gSpecialVar_0x8004 & 0x80) @@ -588,10 +1194,9 @@ u8 sub_8140CA8(s16 *r0, u8 r1) { s8 temp1 = 0; s8 temp = 0; - s8 arr[4]; + s8 arr[4] = {-5, 5, -1, 1}; s8 t; - memcpy(&arr, gUnknown_085B641E, sizeof(arr)); t = *r0; switch (r1) @@ -838,9 +1443,8 @@ void sub_8141344(u8 taskId) u16 g = 0; u16 rand; u16 randmod; - u16 angles[4]; // angles in 90 degree steps + u16 angles[4] = {0, 180, 90, 270}; // angles in 90 degree steps - memcpy(angles, &gUnknown_085B6422, sizeof(angles)); rand = Random(); randmod = rand % 100; gUnknown_0203AB88->var7C = gTasks[taskId].data[6]; @@ -875,6 +1479,7 @@ void sub_8141344(u8 taskId) gTasks[taskId].func = sub_814155C; } #else +static const u16 gUnknown_085B6422[4] = {0, 180, 90, 270}; NAKED void sub_8141344(u8 taskId) { @@ -1507,12 +2112,9 @@ u8 sub_81420D0(u8 taskId, u8 r1) { u8 i; u8 z; - u32 t0[4]; - u32 t1[3]; + u32 t0[4] = {0x10842, 0x21084, 0x42108, 0x84210}; + u32 t1[3] = {0x3E0, 0x7C00, 0xF8000}; - memcpy(t0, gUnknown_085B642C, sizeof(t0)); - memcpy(t1, gUnknown_085B643C, sizeof(t1)); - if (r1 > 11) return 0; @@ -1694,8 +2296,7 @@ void sub_81424FC(u8 r0) u8 sub_8142758(u8 r0) { - u8 var0[5]; - memcpy(var0, gUnknown_085B6448, sizeof(var0)); + u8 var0[5] = {0, 3, 4, 6, 12}; if (r0 > 19) r0 = 0; @@ -1845,6 +2446,988 @@ void PlayRoulette(void) gTasks[taskId].data[13] = GetCoins(); } +static const u8 sFiller_085B644D[3] = {}; +static const u16 RouletteSpritePalette_01[] = INCBIN_U16("graphics/roulette/shadow.gbapal"); +static const u16 RouletteSpritePalette_02[] = INCBIN_U16("graphics/roulette/ball.gbapal"); +static const u16 RouletteSpritePalette_03[] = INCBIN_U16("graphics/roulette/ball_counter.gbapal"); +static const u16 RouletteSpritePalette_04[] = INCBIN_U16("graphics/roulette/cursor.gbapal"); +static const u16 RouletteSpritePalette_05[] = INCBIN_U16("graphics/roulette/credit.gbapal"); +static const u16 RouletteSpritePalette_06[] = INCBIN_U16("graphics/roulette/shroomish.gbapal"); +static const u16 RouletteSpritePalette_07[] = INCBIN_U16("graphics/roulette/tailow.gbapal"); +static const u16 RouletteSpritePalette_08[] = INCBIN_U16("graphics/roulette/poke_icons.gbapal"); +static const u16 RouletteSpritePalette_09[] = INCBIN_U16("graphics/roulette/wynaut.gbapal"); +static const u16 RouletteSpritePalette_10[] = INCBIN_U16("graphics/roulette/azurill.gbapal"); +static const u16 RouletteSpritePalette_11[] = INCBIN_U16("graphics/roulette/skitty.gbapal"); +static const u16 RouletteSpritePalette_12[] = INCBIN_U16("graphics/roulette/makuhita.gbapal"); +static const u16 RouletteSpritePalette_13[] = INCBIN_U16("graphics/roulette/85B65D0.gbapal"); +static const u16 RouletteSpritePalette_14[] = INCBIN_U16("graphics/roulette/85B65F0.gbapal"); +static const u16 RouletteSpritePalette_15[] = INCBIN_U16("graphics/roulette/85B6610.gbapal"); +static const u16 RouletteSpritePalette_16[] = INCBIN_U16("graphics/roulette/85B6630.gbapal"); +static const u32 gUnknown_085B6650[] = INCBIN_U32("graphics/roulette/ball.4bpp.lz"); +static const u32 RouletteBallCounterTiles[] = INCBIN_U32("graphics/roulette/ball_counter.4bpp.lz"); +static const u32 gUnknown_085B67FC[] = INCBIN_U32("graphics/roulette/roulette_tilt.4bpp.lz"); +static const u32 RoulettePokeIconsTiles[] = INCBIN_U32("graphics/roulette/poke_icons.4bpp.lz"); +static const u32 RoulettePokeIcons2Tiles[] = INCBIN_U32("graphics/roulette/poke_icons2.4bpp.lz"); +static const u32 gUnknown_085B7290[] = INCBIN_U32("graphics/roulette/shadow.4bpp.lz"); +static const u32 RouletteCursorTiles[] = INCBIN_U32("graphics/roulette/cursor.4bpp.lz"); + +static const struct SpritePalette gUnknown_085B7384[] = +{ + { RouletteSpritePalette_01, 1 }, + { RouletteSpritePalette_02, 2 }, + { RouletteSpritePalette_03, 3 }, + { RouletteSpritePalette_04, 4 }, + { RouletteSpritePalette_05, 5 }, + { RouletteSpritePalette_06, 6 }, + { RouletteSpritePalette_07, 7 }, + { RouletteSpritePalette_08, 8 }, + { RouletteSpritePalette_09, 9 }, + { RouletteSpritePalette_10, 10 }, + { RouletteSpritePalette_11, 11 }, + { RouletteSpritePalette_12, 12 }, + {} +}; + +static const struct OamData gOamData_85B73EC = +{ + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .shape = ST_OAM_SQUARE, + .size = 2, + .priority = 1, +}; + +static const struct OamData gOamData_85B73F4 = +{ + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .shape = ST_OAM_SQUARE, + .size = 1, + .priority = 1, +}; + +static const struct OamData gOamData_85B73FC = +{ + .y = 60, + .affineMode = ST_OAM_AFFINE_DOUBLE, + .objMode = ST_OAM_OBJ_NORMAL, + .shape = ST_OAM_V_RECTANGLE, + .size = 2, + .priority = 2, +}; + +static const union AnimCmd gSpriteAnim_85B7404[] = { + ANIMCMD_FRAME(0, 0), + ANIMCMD_END +}; + +static const union AnimCmd *const gSpriteAnimTable_85B740C[] = { + gSpriteAnim_85B7404 +}; + +static const union AffineAnimCmd gSpriteAffineAnim_85B7410[] = { + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd *const gSpriteAffineAnimTable_85B7418[] = { + gSpriteAffineAnim_85B7410 +}; + +extern const u32 RoulettePokeIcons2Tiles[]; +static const struct CompressedSpriteSheet gUnknown_085B741C = { + .data = RoulettePokeIcons2Tiles, + .size = 0xC00, + .tag = 0 +}; + +static const union AnimCmd gSpriteAnim_85B7420[] = { + ANIMCMD_FRAME(0, 0), + ANIMCMD_FRAME(32, 0), + ANIMCMD_FRAME(64, 0), + ANIMCMD_FRAME(72, 0), + ANIMCMD_FRAME(8, 0), + ANIMCMD_FRAME(40, 0), + ANIMCMD_FRAME(48, 0), + ANIMCMD_FRAME(80, 0), + ANIMCMD_FRAME(16, 0), + ANIMCMD_FRAME(24, 0), + ANIMCMD_FRAME(56, 0), + ANIMCMD_FRAME(88, 0), + ANIMCMD_END +}; + +static const union AnimCmd *const gSpriteAnimTable_85B7458[] = { + &gSpriteAnim_85B7420[0] +}; + +static const union AnimCmd *const gSpriteAnimTable_85B745C[] = { + &gSpriteAnim_85B7420[1] +}; + +static const union AnimCmd *const gSpriteAnimTable_85B7460[] = { + &gSpriteAnim_85B7420[2] +}; + +static const union AnimCmd *const gSpriteAnimTable_85B7464[] = { + &gSpriteAnim_85B7420[3] +}; + +static const union AnimCmd *const gSpriteAnimTable_85B7468[] = { + &gSpriteAnim_85B7420[4] +}; + +static const union AnimCmd *const gSpriteAnimTable_85B746C[] = { + &gSpriteAnim_85B7420[5] +}; + +static const union AnimCmd *const gSpriteAnimTable_85B7470[] = { + &gSpriteAnim_85B7420[6] +}; + +static const union AnimCmd *const gSpriteAnimTable_85B7474[] = { + &gSpriteAnim_85B7420[7] +}; + +static const union AnimCmd *const gSpriteAnimTable_85B7478[] = { + &gSpriteAnim_85B7420[8] +}; + +static const union AnimCmd *const gSpriteAnimTable_85B747C[] = { + &gSpriteAnim_85B7420[9] +}; + +static const union AnimCmd *const gSpriteAnimTable_85B7480[] = { + &gSpriteAnim_85B7420[10] +}; + +static const union AnimCmd *const gSpriteAnimTable_85B7484[] = { + &gSpriteAnim_85B7420[11] +}; + +extern const u32 gRouletteHeadersTiles[]; +static const struct CompressedSpriteSheet gUnknown_085B7488 = { + .data = gRouletteHeadersTiles, + .size = 0x1600, + .tag = 4 +}; + +extern const u32 RoulettePokeIconsTiles[]; +static const struct CompressedSpriteSheet gUnknown_085B7490 = { + .data = RoulettePokeIconsTiles, + .size = 0x400, + .tag = 5 +}; + +static const union AnimCmd gSpriteAnim_85B7498[] = { + ANIMCMD_FRAME(0, 0), + ANIMCMD_FRAME(16, 0), + ANIMCMD_FRAME(32, 0), + ANIMCMD_FRAME(48, 0), + ANIMCMD_FRAME(64, 0), + ANIMCMD_FRAME(80, 0), + ANIMCMD_FRAME(96, 0), + ANIMCMD_FRAME(112, 0), + ANIMCMD_FRAME(128, 0), + ANIMCMD_FRAME(144, 0), + ANIMCMD_FRAME(160, 0), + ANIMCMD_END +}; + +static const union AnimCmd gSpriteAnim_85B74C8[] = { + ANIMCMD_FRAME(0, 0), + ANIMCMD_FRAME(4, 0), + ANIMCMD_FRAME(8, 0), + ANIMCMD_FRAME(12, 0), + ANIMCMD_END +}; + +static const union AnimCmd *const gSpriteAnimTable_85B74DC[] = { + &gSpriteAnim_85B7498[0] +}; + +static const union AnimCmd *const gSpriteAnimTable_85B74E0[] = { + &gSpriteAnim_85B7498[2] +}; + +static const union AnimCmd *const gSpriteAnimTable_85B74E4[] = { + &gSpriteAnim_85B7498[4] +}; + +static const union AnimCmd *const gSpriteAnimTable_85B74E8[] = { + &gSpriteAnim_85B7498[6] +}; + +static const union AnimCmd *const gSpriteAnimTable_85B74EC[] = { + &gSpriteAnim_85B7498[8] +}; + +static const union AnimCmd *const gSpriteAnimTable_85B74F0[] = { + &gSpriteAnim_85B7498[9] +}; + +static const union AnimCmd *const gSpriteAnimTable_85B74F4[] = { + &gSpriteAnim_85B7498[10] +}; + +static const union AnimCmd *const gSpriteAnimTable_85B74F8[] = { + &gSpriteAnim_85B74C8[0] +}; + +static const union AnimCmd *const gSpriteAnimTable_85B74FC[] = { + &gSpriteAnim_85B74C8[1] +}; + +static const union AnimCmd *const gSpriteAnimTable_85B7500[] = { + &gSpriteAnim_85B74C8[2] +}; + +static const union AnimCmd *const gSpriteAnimTable_85B7504[] = { + &gSpriteAnim_85B74C8[3] +}; + +static const struct SpriteTemplate gSpriteTemplate_85B7508[] = +{ + { + .tileTag = 4, + .paletteTag = 8, + .oam = &gOamData_85B73EC, + .anims = gSpriteAnimTable_85B74DC, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_814390C + }, + { + .tileTag = 4, + .paletteTag = 8, + .oam = &gOamData_85B73EC, + .anims = gSpriteAnimTable_85B74E0, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_814390C + }, + { + .tileTag = 4, + .paletteTag = 8, + .oam = &gOamData_85B73EC, + .anims = gSpriteAnimTable_85B74E4, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_814390C + }, + { + .tileTag = 4, + .paletteTag = 8, + .oam = &gOamData_85B73EC, + .anims = gSpriteAnimTable_85B74E8, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_814390C + } +}; + +static const struct SpriteTemplate gSpriteTemplate_85B7568[] = +{ + { + .tileTag = 4, + .paletteTag = 8, + .oam = &gOamData_85B73EC, + .anims = gSpriteAnimTable_85B74EC, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_814390C + }, + { + .tileTag = 4, + .paletteTag = 8, + .oam = &gOamData_85B73EC, + .anims = gSpriteAnimTable_85B74F0, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_814390C + }, + { + .tileTag = 4, + .paletteTag = 8, + .oam = &gOamData_85B73EC, + .anims = gSpriteAnimTable_85B74F4, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_814390C + } +}; + +static const struct SpriteTemplate gSpriteTemplate_85B75B0[] = +{ + { + .tileTag = 5, + .paletteTag = 8, + .oam = &gOamData_85B73F4, + .anims = gSpriteAnimTable_85B74F8, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_814390C + }, + { + .tileTag = 5, + .paletteTag = 8, + .oam = &gOamData_85B73F4, + .anims = gSpriteAnimTable_85B74FC, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_814390C + }, + { + .tileTag = 5, + .paletteTag = 8, + .oam = &gOamData_85B73F4, + .anims = gSpriteAnimTable_85B7500, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_814390C + }, + { + .tileTag = 5, + .paletteTag = 8, + .oam = &gOamData_85B73F4, + .anims = gSpriteAnimTable_85B7504, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_814390C + } +}; + +static const struct SpriteTemplate gSpriteTemplate_85B7610[] = +{ + { + .tileTag = 0, + .paletteTag = 9, + .oam = &gOamData_85B73FC, + .anims = gSpriteAnimTable_85B7458, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8143280 + }, + { + .tileTag = 0, + .paletteTag = 10, + .oam = &gOamData_85B73FC, + .anims = gSpriteAnimTable_85B745C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8143280 + }, + { + .tileTag = 0, + .paletteTag = 11, + .oam = &gOamData_85B73FC, + .anims = gSpriteAnimTable_85B7460, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8143280 + }, + { + .tileTag = 0, + .paletteTag = 12, + .oam = &gOamData_85B73FC, + .anims = gSpriteAnimTable_85B7464, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8143280 + }, + { + .tileTag = 0, + .paletteTag = 9, + .oam = &gOamData_85B73FC, + .anims = gSpriteAnimTable_85B7468, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8143280 + }, + { + .tileTag = 0, + .paletteTag = 10, + .oam = &gOamData_85B73FC, + .anims = gSpriteAnimTable_85B746C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8143280 + }, + { + .tileTag = 0, + .paletteTag = 11, + .oam = &gOamData_85B73FC, + .anims = gSpriteAnimTable_85B7470, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8143280 + }, + { + .tileTag = 0, + .paletteTag = 12, + .oam = &gOamData_85B73FC, + .anims = gSpriteAnimTable_85B7474, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8143280 + }, + { + .tileTag = 0, + .paletteTag = 9, + .oam = &gOamData_85B73FC, + .anims = gSpriteAnimTable_85B7478, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8143280 + }, + { + .tileTag = 0, + .paletteTag = 10, + .oam = &gOamData_85B73FC, + .anims = gSpriteAnimTable_85B747C, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8143280 + }, + { + .tileTag = 0, + .paletteTag = 11, + .oam = &gOamData_85B73FC, + .anims = gSpriteAnimTable_85B7480, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8143280 + }, + { + .tileTag = 0, + .paletteTag = 12, + .oam = &gOamData_85B73FC, + .anims = gSpriteAnimTable_85B7484, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8143280 + } +}; + +extern const struct OamData gOamData_85B73EC; +static const struct OamData gOamData_85B7730 = +{ + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .shape = ST_OAM_H_RECTANGLE, + .size = 3, + .priority = 1, +}; + +static const struct OamData gOamData_85B7738 = +{ + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .shape = ST_OAM_V_RECTANGLE, + .size = 0, + .priority = 1, +}; + +static const struct OamData gOamData_85B7740 = +{ + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .shape = ST_OAM_H_RECTANGLE, + .size = 2, + .priority = 1, +}; + +static const struct OamData gOamData_85B7748 = +{ + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .shape = ST_OAM_H_RECTANGLE, + .size = 0, + .priority = 1, +}; + +extern const u32 gRouletteCreditTiles[]; +extern const u32 gRouletteNumbersTiles[]; +extern const u32 gRouletteMultiplierTiles[]; +extern const u32 RouletteBallCounterTiles[]; +extern const u32 RouletteCursorTiles[]; +static const struct CompressedSpriteSheet gUnknown_085B7750[] = +{ + { + .data = gRouletteCreditTiles, + .size = 0x400, + .tag = 7 + }, + { + .data = gRouletteNumbersTiles, + .size = 0x280, + .tag = 8 + }, + { + .data = gRouletteMultiplierTiles, + .size = 0x500, + .tag = 9 + }, + { + .data = RouletteBallCounterTiles, + .size = 0x140, + .tag = 10 + }, + { + .data = RouletteCursorTiles, + .size = 0x200, + .tag = 11 + }, + {} +}; + +static const union AnimCmd gSpriteAnim_85B7780[] = { + ANIMCMD_FRAME(0, 0), + ANIMCMD_FRAME(2, 0), + ANIMCMD_FRAME(4, 0), + ANIMCMD_FRAME(6, 0), + ANIMCMD_FRAME(8, 0), + ANIMCMD_FRAME(10, 0), + ANIMCMD_FRAME(12, 0), + ANIMCMD_FRAME(14, 0), + ANIMCMD_FRAME(16, 0), + ANIMCMD_FRAME(18, 0), + // BUG: Animation not terminated properly + //ANIMCMD_END +}; + +static const union AnimCmd *const gSpriteAnimTable_85B77A8[] = { + gSpriteAnim_85B7780 +}; + +static const union AnimCmd gSpriteAnim_85B77AC[] = { + ANIMCMD_FRAME(0, 0), + ANIMCMD_FRAME(8, 0), + ANIMCMD_FRAME(16, 0), + ANIMCMD_FRAME(24, 0), + ANIMCMD_FRAME(32, 0), + ANIMCMD_END +}; + +static const union AnimCmd *const gSpriteAnimTable_85B77C4[] = { + gSpriteAnim_85B77AC +}; + +static const union AnimCmd gSpriteAnim_85B77C8[] = { + ANIMCMD_FRAME(0, 0), + ANIMCMD_FRAME(2, 0), + ANIMCMD_FRAME(4, 0), + ANIMCMD_FRAME(6, 0), + ANIMCMD_FRAME(8, 0), + ANIMCMD_END +}; + +static const union AnimCmd *const gSpriteAnimTable_85B77E0[] = { + gSpriteAnim_85B77C8 +}; + +static const struct SpriteTemplate gSpriteTemplate_85B77E4 = +{ + .tileTag = 7, + .paletteTag = 5, + .oam = &gOamData_85B7730, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +static const struct SpriteTemplate gUnknown_085B77FC = +{ + .tileTag = 8, + .paletteTag = 5, + .oam = &gOamData_85B7738, + .anims = gSpriteAnimTable_85B77A8, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +static const struct SpriteTemplate gUnknown_085B7814 = +{ + .tileTag = 9, + .paletteTag = 5, + .oam = &gOamData_85B7740, + .anims = gSpriteAnimTable_85B77C4, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_814390C +}; + +static const struct SpriteTemplate gUnknown_085B782C = +{ + .tileTag = 10, + .paletteTag = 3, + .oam = &gOamData_85B7748, + .anims = gSpriteAnimTable_85B77E0, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +static const struct SpriteTemplate gUnknown_085B7844 = +{ + .tileTag = 11, + .paletteTag = 5, + .oam = &gOamData_85B73EC, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +static const struct OamData gOamData_85B785C = +{ + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .shape = ST_OAM_SQUARE, + .size = 1, + .priority = 2, +}; + +extern const u32 gUnknown_085B6650[]; +static const struct CompressedSpriteSheet gUnknown_085B7864 = { + .data = gUnknown_085B6650, + .size = 0x200, + .tag = 12 +}; + +static const union AnimCmd gSpriteAnim_85B786C[] = { + ANIMCMD_FRAME(0, 5), + ANIMCMD_FRAME(4, 5), + ANIMCMD_FRAME(8, 5), + ANIMCMD_FRAME(4, 5), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd gSpriteAnim_85B7880[] = { + ANIMCMD_FRAME(0, 10), + ANIMCMD_FRAME(4, 10), + ANIMCMD_FRAME(8, 10), + ANIMCMD_FRAME(4, 10), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd gSpriteAnim_85B7894[] = { + ANIMCMD_FRAME(0, 15), + ANIMCMD_FRAME(4, 15), + ANIMCMD_FRAME(8, 15), + ANIMCMD_FRAME(4, 15), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd gSpriteAnim_85B78A8[] = { + ANIMCMD_FRAME(4, 2), + ANIMCMD_FRAME(8, 5), + ANIMCMD_FRAME(4, 5), + ANIMCMD_FRAME(12, 5), + ANIMCMD_END +}; + +static const union AnimCmd gSpriteAnim_85B78BC[] = { + ANIMCMD_FRAME(4, 2), + ANIMCMD_FRAME(0, 4), + ANIMCMD_FRAME(4, 4), + ANIMCMD_FRAME(8, 4), + ANIMCMD_FRAME(12, 4), + ANIMCMD_END +}; + +static const union AnimCmd gSpriteAnim_85B78D4[] = { + ANIMCMD_FRAME(0, 2), + ANIMCMD_FRAME(4, 5), + ANIMCMD_FRAME(8, 5), + ANIMCMD_FRAME(12, 5), + ANIMCMD_END +}; + +static const union AnimCmd gSpriteAnim_85B78E8[] = { + ANIMCMD_FRAME(12, 0), + ANIMCMD_END +}; + +static const union AnimCmd gSpriteAnim_85B78F0[] = { + ANIMCMD_FRAME(8, 2), + ANIMCMD_FRAME(4, 5), + ANIMCMD_FRAME(0, 5), + ANIMCMD_FRAME(12, 5), + ANIMCMD_END +}; + +static const union AnimCmd *const gSpriteAnimTable_85B7904[] = { + gSpriteAnim_85B786C, + gSpriteAnim_85B7880, + gSpriteAnim_85B7894, + gSpriteAnim_85B78A8, + gSpriteAnim_85B78F0, + gSpriteAnim_85B78BC, + gSpriteAnim_85B78D4, + gSpriteAnim_85B78D4, + gSpriteAnim_85B78E8 +}; + +static const struct SpriteTemplate gSpriteTemplate_85B7928 = +{ + .tileTag = 12, + .paletteTag = 2, + .oam = &gOamData_85B785C, + .anims = gSpriteAnimTable_85B7904, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +static const struct OamData gOamData_85B7940 = +{ + .y = 81, + .affineMode = ST_OAM_AFFINE_DOUBLE, + .objMode = ST_OAM_OBJ_NORMAL, + .shape = ST_OAM_SQUARE, + .size = 3, + .priority = 2, +}; + +extern const u32 gRouletteCenter_Gfx[]; +static const struct CompressedSpriteSheet gUnknown_085B7948 = { + .data = gRouletteCenter_Gfx, + .size = 0x800, + .tag = 6 +}; + +static const struct SpriteTemplate gSpriteTemplate_85B7950 = +{ + .tileTag = 6, + .paletteTag = 2, + .oam = &gOamData_85B7940, + .anims = gDummySpriteAnimTable, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_814399C +}; + +static const struct OamData gOamData_85B7968 = +{ + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .shape = ST_OAM_SQUARE, + .size = 2, + .priority = 2, +}; + +static const struct OamData gOamData_85B7970 = +{ + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .shape = ST_OAM_SQUARE, + .size = 2, + .priority = 2, +}; + +extern const u32 gUnknown_085B67FC[]; +static const struct CompressedSpriteSheet gUnknown_085B7978 = { + .data = gUnknown_085B67FC, + .size = 0xE00, + .tag = 13 +}; + +static const union AnimCmd gSpriteAnim_85B7980[] = { + ANIMCMD_FRAME(0, 6), + ANIMCMD_FRAME(16, 6), + ANIMCMD_FRAME(32, 6), + ANIMCMD_FRAME(48, 6), + ANIMCMD_FRAME(32, 6), + ANIMCMD_FRAME(64, 6), + ANIMCMD_JUMP(2) +}; + +static const union AnimCmd gSpriteAnim_85B799C[] = { + ANIMCMD_FRAME(80, 10), + ANIMCMD_END +}; + +static const union AnimCmd gSpriteAnim_85B79A4[] = { + ANIMCMD_FRAME(80, 10, .hFlip = TRUE), + ANIMCMD_END +}; + +static const union AnimCmd gSpriteAnim_85B79AC[] = { + ANIMCMD_FRAME(80, 20), + ANIMCMD_FRAME(96, 20), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd gSpriteAnim_85B79B8[] = { + ANIMCMD_FRAME(80, 20, .hFlip = TRUE), + ANIMCMD_FRAME(96, 20, .hFlip = TRUE), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd gSpriteAnim_85B79C4[] = { + ANIMCMD_FRAME(80, 10), + ANIMCMD_FRAME(96, 10), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd gSpriteAnim_85B79D0[] = { + ANIMCMD_FRAME(80, 10, .hFlip = TRUE), + ANIMCMD_FRAME(96, 10, .hFlip = TRUE), + ANIMCMD_JUMP(0) +}; + +static const union AnimCmd *const gSpriteAnimTable_85B79DC[] = { + gSpriteAnim_85B7980 +}; + +static const union AnimCmd *const gSpriteAnimTable_85B79E0[] = { + gSpriteAnim_85B799C, + gSpriteAnim_85B79A4, + gSpriteAnim_85B79AC, + gSpriteAnim_85B79B8, + gSpriteAnim_85B79C4, + gSpriteAnim_85B79D0 +}; + +static const struct SpriteTemplate gSpriteTemplate_85B79F8 = +{ + .tileTag = 13, + .paletteTag = 6, + .oam = &gOamData_85B7968, + .anims = gSpriteAnimTable_85B79DC, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy +}; + +static const struct SpriteTemplate gSpriteTemplate_85B7A10 = +{ + .tileTag = 13, + .paletteTag = 7, + .oam = &gOamData_85B7970, + .anims = gSpriteAnimTable_85B79E0, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8145294 +}; + +static const struct OamData gOamData_85B7A28 = +{ + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .shape = ST_OAM_SQUARE, + .size = 1, + .priority = 2, +}; + +static const struct OamData gOamData_85B7A30 = +{ + .affineMode = ST_OAM_AFFINE_OFF, + .objMode = ST_OAM_OBJ_NORMAL, + .shape = ST_OAM_H_RECTANGLE, + .size = 2, + .priority = 2, +}; + +static const struct OamData gOamData_85B7A38 = +{ + .affineMode = ST_OAM_AFFINE_NORMAL, + .objMode = ST_OAM_OBJ_NORMAL, + .shape = ST_OAM_H_RECTANGLE, + .size = 2, + .priority = 2, +}; +extern const u32 gUnknown_085B7290[]; +static const struct CompressedSpriteSheet gUnknown_085B7A40 = { + .data = gUnknown_085B7290, + .size = 0x180, + .tag = 14 +}; + +static const union AffineAnimCmd gSpriteAffineAnim_85B7A48[] = { + AFFINEANIMCMD_FRAME(0x80, 0x80, 0, 0), + AFFINEANIMCMD_FRAME(2, 2, 0, 60), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd gSpriteAffineAnim_85B7A60[] = { + AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), + AFFINEANIMCMD_FRAME(-2, 0x0, 0, 15), + AFFINEANIMCMD_FRAME(-1, -2, 0, 15), + AFFINEANIMCMD_FRAME(-1, -5, 0, 24), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd *const gSpriteAffineAnimTable_85B7A88[] = { + gSpriteAffineAnim_85B7A48 +}; + +static const union AffineAnimCmd *const gSpriteAffineAnimTable_85B7A8C[] = { + gSpriteAffineAnim_85B7A60 +}; + +static const union AffineAnimCmd gSpriteAffineAnim_85B7A90[] = { + AFFINEANIMCMD_FRAME(0x100, 0x100, 0, 0), + AFFINEANIMCMD_END +}; + +static const union AffineAnimCmd *const gSpriteAffineAnimTable_85B7AA0[] = { + gSpriteAffineAnim_85B7A90 +}; + +static const union AnimCmd gSpriteAnim_85B7AA4[] = { + ANIMCMD_FRAME(0, 0), + ANIMCMD_END +}; + +static const union AnimCmd gSpriteAnim_85B7AAC[] = { + ANIMCMD_FRAME(4, 0), + ANIMCMD_END +}; + +static const union AnimCmd *const gSpriteAnimTable_85B7AB4[] = { + gSpriteAnim_85B7AA4 +}; + +static const union AnimCmd *const gSpriteAnimTable_85B7AB8[] = { + gSpriteAnim_85B7AAC +}; + +static const struct SpriteTemplate gSpriteTemplate_85B7ABC[] = +{ + { + .tileTag = 14, + .paletteTag = 1, + .oam = &gOamData_85B7A28, + .anims = gSpriteAnimTable_85B7AB4, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = SpriteCallbackDummy + }, + { + .tileTag = 14, + .paletteTag = 1, + .oam = &gOamData_85B7A30, + .anims = gSpriteAnimTable_85B7AB8, + .images = NULL, + .affineAnims = gDummySpriteAffineAnimTable, + .callback = sub_8144E60 + } +}; + +static const struct SpriteTemplate gUnknown_085B7AEC = +{ + .tileTag = 14, + .paletteTag = 1, + .oam = &gOamData_85B7A38, + .anims = gSpriteAnimTable_85B7AB8, + .images = NULL, + .affineAnims = gSpriteAffineAnimTable_85B7A8C, + .callback = sub_8145294 +}; + void sub_8142C0C(u8 r0) { if (!r0) @@ -2116,9 +3699,8 @@ void sub_8143514(u16 r0) u8 sub_8143614(u8 r0) { - u8 t[5]; - memcpy(t, gUnknown_085B7B04, sizeof(t)); - + u8 t[5] = {0, 1, 2, 3, 4}; + if (r0 >= 20) r0 = 0; switch (gUnknown_085B6154[r0].var01_0) @@ -2703,10 +4285,12 @@ void sub_81446DC(struct Sprite *sprite) { u16 t; u8 i; - s16 s[2][2]; + s16 s[2][2] = { + {116, 44}, + {116, 112} + }; struct Roulette *p; - memcpy(s, gUnknown_085B7B0A, sizeof(s)); t = sprite->data[7] - 2; p = gUnknown_0203AB88; // why??? gUnknown_0203AB88->var3C[55] = CreateSprite(&gSpriteTemplate_85B79F8, 36, -12, 50); @@ -2734,9 +4318,11 @@ void sub_81448B8(struct Sprite *sprite) { u8 i = 0; s16 t; - s16 s[2][2]; + s16 s[2][2] = { + {256, 84}, + {-16, 84} + }; - memcpy(s, &gUnknown_085B7B12, sizeof(s)); t = sprite->data[7] - 2; gUnknown_0203AB88->var3C[55] = CreateSprite(&gSpriteTemplate_85B7A10, s[sprite->data[0]][0], s[sprite->data[0]][1], 50); StartSpriteAnim(&gSprites[gUnknown_0203AB88->var3C[55]], sprite->data[0]); @@ -3140,6 +4726,19 @@ _08144C54:\n\ } #endif // NONMATCHING +const u16 gUnknown_085B7B1A[] = { + 0x907, + 0x808, + 0x709, + 0x60A, + 0x50B, + 0x40C, + 0x30D, + 0x20E, + 0x10F, + 0x010, +}; + void sub_8144C70(struct Sprite *sprite) { if (sprite->data[1]++ >= sprite->data[3]) @@ -3158,10 +4757,13 @@ void sub_8144C70(struct Sprite *sprite) void sub_8144CD0(struct Sprite *sprite) { - u16 t[3][4]; int p; + u16 t[][4] = { + {-1, 0, 1, 0}, + {-2, 0, 2, 0}, + {-3, 0, 3, 0}, + }; - memcpy(t, gUnknown_085B7B2E, 24); if (sprite->data[1]++ < sprite->data[3]) { if (sprite->data[1] & 1) @@ -3201,58 +4803,6 @@ void sub_8144D94(struct Sprite *sprite) } } -/*void sub_8144E60(struct Sprite *sprite) -{ - register u32 t asm("r2"); - u32 z; - if (sprite->data[7] == 0) - { - if (gUnknown_0203AB88->var38->data[0] == 0) - { - t = gUnknown_0203AB88->var38->data[3]; - z = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var08; - } - else - { - t = gUnknown_0203AB88->var38->data[3]; - z = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var08; - z += 180; - } - if (t == z) - { - sprite->invisible = FALSE; - sprite->data[7]++; - m4aSongNumStart(SE_RU_HYUU); - gUnknown_0203AB88->var01 = 1; - gUnknown_0203AB88->var34 = gUnknown_085B7B1A[0]; - } - } - else - { - gUnknown_0203AB88->var34 = gUnknown_085B7B1A[(gUnknown_0203AB88->var01 - 1) / 2]; - if (gUnknown_0203AB88->var01 < 19) - gUnknown_0203AB88->var01++; - if (gUnknown_0203AB88->var38->data[0] == 0) - { - t = gUnknown_0203AB88->var38->data[3]; - z = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var0A; - } - else - { - t = gUnknown_0203AB88->var38->data[3]; - z = gUnknown_085B6348[gUnknown_0203AB88->var04_0].var0A; - z += 180; - } - if (t == z) - { - gSprites[sprite->data[4]].callback = sub_8144D94; - gSprites[sprite->data[4]].invisible = FALSE; - sprite->callback = &SpriteCallbackDummy; - sprite->data[7] = 0; - } - } -}*/ - void sub_8144E60(struct Sprite *sprite) { if (sprite->data[7] == 0) @@ -3355,11 +4905,18 @@ void sub_8145030(struct Sprite *sprite) void sub_81450D8(struct Sprite *sprite) { - s8 t[2]; //sign - s8 z[8][2]; + s8 t[2] = {-1, 1}; + s8 z[][2] = { + {2, 0}, + {2, 0}, + {2, -1}, + {2, -1}, + {2, -1}, + {2, -1}, + {2, -2}, + {2, -2}, + }; - memcpy(t, gUnknown_085B7B46, sizeof(t)); - memcpy(z, gUnknown_085B7B48, sizeof(z)); if (sprite->data[1]-- > 7) { sprite->pos1.x += t[gUnknown_0203AB88->var38->data[0]] * 2; @@ -3393,8 +4950,8 @@ void sub_81450D8(struct Sprite *sprite) void sub_8145218(struct Sprite *sprite) { - s8 t[2]; //sign - memcpy(t, gUnknown_085B7B46, sizeof(t)); + s8 t[2] = {-1, 1}; + if (sprite->data[1]-- >= 0) { sprite->pos1.x += t[gUnknown_0203AB88->var38->data[0]] * 2; From a0188aac33985a98aa34e23797a86c564214ebd2 Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Wed, 2 Jan 2019 16:55:50 -0600 Subject: [PATCH 6/6] Cleanup and EWRAM --- include/graphics.h | 9 + src/roulette.c | 632 ++++++++++++++++++++------------------------- sym_ewram.txt | 8 +- 3 files changed, 293 insertions(+), 356 deletions(-) diff --git a/include/graphics.h b/include/graphics.h index 8a54ba536..3143eb1fe 100644 --- a/include/graphics.h +++ b/include/graphics.h @@ -4818,4 +4818,13 @@ extern const u32 gStatusPal_Icons[]; extern const u32 gPartyMenuPokeball_Pal[]; extern const u32 gStatusPal_Icons[]; +// Roulette +extern const u32 gRouletteMenuTiles[]; +extern const u32 gRouletteWheelTiles[]; +extern const u32 gRouletteCenter_Gfx[]; +extern const u32 gRouletteHeadersTiles[]; +extern const u32 gRouletteCreditTiles[]; +extern const u32 gRouletteNumbersTiles[]; +extern const u32 gRouletteMultiplierTiles[]; + #endif //GUARD_GRAPHICS_H diff --git a/src/roulette.c b/src/roulette.c index 209ddefc9..a6a020f39 100644 --- a/src/roulette.c +++ b/src/roulette.c @@ -6,6 +6,7 @@ #include "event_data.h" #include "field_screen_effect.h" #include "gpu_regs.h" +#include "graphics.h" #include "m4a.h" #include "main.h" #include "menu.h" @@ -73,7 +74,7 @@ struct StructgUnknown_083F8D90 u32 var04; }; -extern struct Roulette +EWRAM_DATA struct Roulette { u8 var00; u8 var01; @@ -86,13 +87,13 @@ extern struct Roulette u8 var04_2:5; u8 var04_7:1; u32 var08; - u8 var0C[0x6]; - u8 var12[0x4]; - u8 var16[0x3]; + u8 var0C[6]; + u8 var12[4]; + u8 var16[3]; u8 var19; u8 var1A_0:4; u8 var1A_4:4; - u8 var1B[0x6]; + u8 var1B[6]; u8 var21; u8 var22; u8 var23; @@ -103,7 +104,7 @@ extern struct Roulette struct OamMatrix var2C; u16 var34; struct Sprite *var38; - u8 var3C[0x40]; // Sprite IDs + u8 var3C[MAX_SPRITES]; // Sprite IDs u8 var7C; u8 var7D; u8 var7E; @@ -121,83 +122,72 @@ extern struct Roulette float varA0; u8 varA4; u8 varA5; - u8 v51[0x2]; + u8 v51[2]; u16 varA8; u16 varAA; TaskFunc varAC; - u8 v46[0x4]; + u8 v46[4]; TaskFunc varB4; struct UnkStruct0 varB8; u16 tilemapBuffers[7][0x400]; u16 *unk_397C; -} *gUnknown_0203AB88; -extern u8 gUnknown_0203AB8C; +} *gUnknown_0203AB88 = NULL; +EWRAM_DATA u8 gUnknown_0203AB8C = 0; -/*static*/ void sub_8140814(u8); -/*static*/ void sub_81408A8(u8); -/*static*/ void sub_8140968(u8); -/*static*/ void sub_8140994(u8); -/*static*/ void sub_8140BD0(u8); -/*static*/ void sub_8141040(u8); -/*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*/ void sub_8142918(u8); -/*static*/ void sub_814297C(u8); -/*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); -/*static*/ void sub_8142814(void); -/*static*/ void sub_8142C0C(u8); -/*static*/ void sub_8142CD0(void); -/*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_8143280(struct Sprite *); -/*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_814399C(struct Sprite *); -/*static*/ void sub_81439C8(void); -/*static*/ void sub_8143A40(void); -/*static*/ void sub_81446AC(struct Sprite *); -/*static*/ void sub_81446DC(struct Sprite *); -/*static*/ void sub_81448B8(struct Sprite *); -/*static*/ void sub_8144A24(struct Sprite *); -/*static*/ void sub_8144E60(struct Sprite *); -/*static*/ void sub_8145294(struct Sprite *); +static void sub_8140814(u8); +static void sub_81408A8(u8); +static void sub_8140968(u8); +static void sub_8140994(u8); +static void sub_8140BD0(u8); +static void sub_8141040(u8); +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 void sub_8142918(u8); +static void sub_814297C(u8); +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); +static void sub_8142814(void); +static void sub_8142C0C(u8); +static void sub_8142CD0(void); +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_8143280(struct Sprite *); +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_814399C(struct Sprite *); +static void sub_81439C8(void); +static void sub_8143A40(void); +static void sub_81446AC(struct Sprite *); +static void sub_81446DC(struct Sprite *); +static void sub_81448B8(struct Sprite *); +static void sub_8144A24(struct Sprite *); +static void sub_8144E60(struct Sprite *); +static void sub_8145294(struct Sprite *); -extern const struct BgTemplate gUnknown_085B6140[3]; -extern const struct WindowTemplate gUnknown_085B614C[]; -extern const u32 gUnknown_085B5DFC[]; -extern const u16 gUnknown_085B6418[]; -extern const struct StructgUnknown_083F8DF4 gUnknown_085B6348[]; -extern const u8 gUnknown_085B6344[]; -extern const struct UnkStruct1 gUnknown_085B6388[]; -extern const u16 gUnknown_085B5BFC[]; -extern const u32 gRouletteMenuTiles[]; -extern const u32 gRouletteWheelTiles[]; -extern const u32 gUnknown_085B5FA0[]; extern const u8 gUnknown_082A5B89[]; extern const u8 gUnknown_082A5C13[]; extern const u8 gUnknown_082A5BD7[]; @@ -210,48 +200,6 @@ 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_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[]; -extern const struct CompressedSpriteSheet gUnknown_085B7948; -extern const struct SpriteTemplate gSpriteTemplate_85B7950; -extern const u16 gUnknown_085B7B0A[][2]; -extern const u16 gUnknown_085B7B12[][2]; -extern const struct SpriteTemplate gSpriteTemplate_85B79F8; -extern const struct SpriteTemplate gSpriteTemplate_85B7ABC[]; -extern const struct SpriteTemplate gSpriteTemplate_85B7A10; -extern const struct SpriteTemplate gUnknown_085B7AEC; -extern const u16 gUnknown_085B7B1A[]; -extern const u16 gUnknown_085B7B2E[]; -extern const s8 gUnknown_085B7B46[]; -extern const s8 gUnknown_085B7B48[]; -extern const s8 gUnknown_085B7B46[]; static const u16 gUnknown_085B5BFC[] = INCBIN_U16("graphics/roulette/85B5BFC.gbapal"); static const u32 gUnknown_085B5DFC[] = INCBIN_U32("graphics/roulette/85B5DFC.bin.lz"); @@ -856,7 +804,7 @@ static const struct YesNoFuncTable gUnknown_085B6410 = sub_8140994 }; -void sub_8140238(void) +static void sub_8140238(void) { RunTasks(); AnimateSprites(); @@ -865,7 +813,7 @@ void sub_8140238(void) task_tutorial_controls_fadein(&gUnknown_0203AB88->varB8); } -void sub_8140264(void) +static void sub_8140264(void) { LoadOam(); ProcessSpriteCopyRequests(); @@ -900,7 +848,7 @@ void sub_8140264(void) } } -void sub_8140388(void) +static void sub_8140388(void) { u32 size = 0; @@ -916,7 +864,7 @@ void sub_8140388(void) gUnknown_0203AB88->unk_397C = malloc_and_decompress(gUnknown_085B5DFC, &size); } -void sub_8140418(void) +static void sub_8140418(void) { FREE_AND_SET_NULL(gUnknown_0203AB88->unk_397C); FreeAllWindowBuffers(); @@ -928,7 +876,7 @@ void sub_8140418(void) FREE_AND_SET_NULL(gUnknown_0203AB88); } -void sub_8140470(void) +static void sub_8140470(void) { u8 i; u16 arr[3] = {RGB(24, 4, 10), RGB(10, 19, 6), RGB(24, 4, 10)}; // the third is never used ? @@ -970,7 +918,7 @@ void sub_8140470(void) RtcCalcLocalTime(); } -void sub_81405CC(void) +static void sub_81405CC(void) { u8 taskId; @@ -1056,7 +1004,7 @@ void sub_81405CC(void) gMain.state++; } -void sub_8140814(u8 unused) +static void sub_8140814(u8 unused) { s16 sin; s16 cos; @@ -1075,7 +1023,7 @@ void sub_8140814(u8 unused) gUnknown_0203AB88->var2C.c = -sin; } -void sub_81408A8(u8 taskId) +static void sub_81408A8(u8 taskId) { if (UpdatePaletteFade() == 0) { @@ -1093,7 +1041,7 @@ void sub_81408A8(u8 taskId) } } -void sub_8140914(u8 taskId) +static void sub_8140914(u8 taskId) { DisplayYesNoMenu(); NewMenuHelpers_DrawStdWindowFrame(gUnknown_0203AB8C, 0); @@ -1102,19 +1050,19 @@ void sub_8140914(u8 taskId) DoYesNoFuncWithChoice(taskId, &gUnknown_085B6410); } -void sub_8140968(u8 taskId) +static void sub_8140968(u8 taskId) { sub_819746C(0, TRUE); gTasks[taskId].func = sub_8140BD0; } -void sub_8140994(u8 taskId) +static void sub_8140994(u8 taskId) { DestroyTask(gUnknown_0203AB88->varA5); sub_8141DE4(taskId); } -void sub_81409B8(u8 r0) +static void sub_81409B8(u8 r0) { u8 temp0, temp1; switch (r0) @@ -1146,13 +1094,13 @@ void sub_81409B8(u8 r0) } } -void sub_8140B64(u8 taskId) +static void sub_8140B64(u8 taskId) { sub_81436D0(gTasks[taskId].data[4]); sub_81409B8(gTasks[taskId].data[4]); } -void sub_8140B8C(u8 taskId) +static void sub_8140B8C(u8 taskId) { gUnknown_0203AB88->var28 = 1; sub_81409B8(gTasks[taskId].data[4]); @@ -1161,7 +1109,7 @@ void sub_8140B8C(u8 taskId) gTasks[taskId].func = sub_8141040; } -void sub_8140BD0(u8 taskId) +static void sub_8140BD0(u8 taskId) { s16 i; @@ -1190,14 +1138,12 @@ void sub_8140BD0(u8 taskId) gTasks[taskId].func = sub_8140B8C; } -u8 sub_8140CA8(s16 *r0, u8 r1) +static u8 sub_8140CA8(s16 *r0, u8 r1) { s8 temp1 = 0; s8 temp = 0; s8 arr[4] = {-5, 5, -1, 1}; - s8 t; - - t = *r0; + s8 t = *r0; switch (r1) { @@ -1231,7 +1177,7 @@ u8 sub_8140CA8(s16 *r0, u8 r1) return FALSE; } -void sub_8140D6C(u8 r0) +static void sub_8140D6C(u8 r0) { u8 z = 0; bool8 var0 = FALSE; @@ -1265,7 +1211,7 @@ void sub_8140D6C(u8 r0) } } -void sub_8140F6C(u8 r0) +static void sub_8140F6C(u8 r0) { sub_80EECA4(); gUnknown_0203AB88->var28 = 0xFF; @@ -1278,7 +1224,7 @@ void sub_8140F6C(u8 r0) gTasks[r0].func = sub_81410FC; } -void sub_8140FC4(u8 taskId) +static void sub_8140FC4(u8 taskId) { gUnknown_0203AB88->var1B[gUnknown_0203AB88->var1A_0] = gTasks[taskId].data[4]; gTasks[taskId].data[2] = sub_8142758(gUnknown_0203AB88->var1B[gUnknown_0203AB88->var1A_0]); @@ -1289,7 +1235,7 @@ void sub_8140FC4(u8 taskId) gTasks[taskId].func = sub_8140F6C; } -void sub_8141040(u8 taskId) +static void sub_8141040(u8 taskId) { sub_8140D6C(taskId); @@ -1297,11 +1243,11 @@ void sub_8141040(u8 taskId) { case 0: sub_81409B8(gTasks[taskId].data[4]); - gTasks[taskId].data[1]+= 1; + gTasks[taskId].data[1]++; break; case 30: sub_81409B8(0); - gTasks[taskId].data[1]+= 1; + gTasks[taskId].data[1]++; break; case 59: gTasks[taskId].data[1] = 0; @@ -1322,7 +1268,7 @@ void sub_8141040(u8 taskId) } } -void sub_81410FC(u8 taskId) +static void sub_81410FC(u8 taskId) { if (gTasks[taskId].data[1]-- > 0) { @@ -1340,7 +1286,7 @@ void sub_81410FC(u8 taskId) } } -u8 sub_814118C(u16 r0, u16 r1) +static u8 sub_814118C(u16 r0, u16 r1) { switch (gUnknown_0203AB88->var02) { @@ -1349,13 +1295,13 @@ u8 sub_814118C(u16 r0, u16 r1) // one of the two is in party if (gLocalTime.hours > 3 && gLocalTime.hours < 10) { - if (r0 < 0xC || (r1 & 0x1)) + if (r0 < 12 || (r1 & 1)) { return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02 / 2; } else { - return 0x1; + return 1; } } else if (!(r1 & 0x3)) @@ -1371,16 +1317,16 @@ u8 sub_814118C(u16 r0, u16 r1) // both are in party if (gLocalTime.hours > 3 && gLocalTime.hours < 11) { - if (r0 < 0x6 || (r1 & 0x1)) + if (r0 < 6 || (r1 & 1)) { return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02 / 2; } else { - return 0x1; + return 1; } } - else if ((r1 & 0x1) && r0 > 6) + else if ((r1 & 1) && r0 > 6) { return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02 / 4; } @@ -1394,16 +1340,16 @@ u8 sub_814118C(u16 r0, u16 r1) // neither is in party if (gLocalTime.hours > 3 && gLocalTime.hours < 10) { - if (!(r1 & 0x3)) + if (!(r1 & 3)) { - return 0x1; + return 1; } else { return gUnknown_085B6348[gUnknown_0203AB88->var04_0].var02 / 2; } } - else if (!(r1 & 0x3)) + else if (!(r1 & 3)) { if (r0 > 12) { @@ -1435,7 +1381,7 @@ u8 sub_814118C(u16 r0, u16 r1) // r7/r8 swap #ifdef NONMATCHING -void sub_8141344(u8 taskId) +static void sub_8141344(u8 taskId) { u8 randf; s8 randfinal; @@ -1481,7 +1427,7 @@ void sub_8141344(u8 taskId) #else static const u16 gUnknown_085B6422[4] = {0, 180, 90, 270}; NAKED -void sub_8141344(u8 taskId) +static void sub_8141344(u8 taskId) { asm_unified(" push {r4-r7,lr}\n\ mov r7, r10\n\ @@ -1733,7 +1679,7 @@ _08141558:\n\ } #endif // NONMATCHING -void sub_814155C(u8 taskId) +static void sub_814155C(u8 taskId) { u8 index; gUnknown_0203AB88->var03_7 = 1; @@ -1747,7 +1693,7 @@ void sub_814155C(u8 taskId) gTasks[taskId].func = sub_81415D4; } -void sub_81415D4(u8 taskId) +static void sub_81415D4(u8 taskId) { if (gUnknown_0203AB88->var7D) { @@ -1786,7 +1732,7 @@ void sub_81415D4(u8 taskId) } } -void sub_81416D4(u8 taskId) +static void sub_81416D4(u8 taskId) { if (gTasks[taskId].data[1]-- > 0) { @@ -1806,7 +1752,7 @@ void sub_81416D4(u8 taskId) } } -void sub_8141778(u8 taskId) +static void sub_8141778(u8 taskId) { if (gTasks[taskId].data[1]-- > 1) { @@ -1828,7 +1774,7 @@ void sub_8141778(u8 taskId) } } -void sub_8141800(u8 taskId) +static void sub_8141800(u8 taskId) { switch (gTasks[taskId].data[0x5]) { @@ -1853,7 +1799,7 @@ void sub_8141800(u8 taskId) } } -void sub_814189C(u8 taskId) +static void sub_814189C(u8 taskId) { switch (gTasks[taskId].data[5]) { @@ -1886,7 +1832,7 @@ void sub_814189C(u8 taskId) gTasks[taskId].func = sub_8141800; } -void sub_8141984(u8 taskId) +static void sub_8141984(u8 taskId) { s32 r0 = gTasks[taskId].data[7]; switch (r0) @@ -1917,7 +1863,7 @@ void sub_8141984(u8 taskId) sub_8141F7C(taskId, sub_8141AC0, 0xFFFF, 3); } -void sub_8141A18(u8 taskId) +static void sub_8141A18(u8 taskId) { ConvertIntToDecimalStringN(gStringVar1, (gUnknown_0203AB88->var19 * gTasks[taskId].data[2]), STR_CONV_MODE_LEFT_ALIGN, 2); StringExpandPlaceholders(gStringVar4, gUnknown_082A5BEF); @@ -1929,7 +1875,7 @@ void sub_8141A18(u8 taskId) gTasks[taskId].func = sub_8141984; } -void sub_8141AC0(u8 taskId) +static 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; @@ -1937,7 +1883,7 @@ void sub_8141AC0(u8 taskId) gTasks[taskId].func = sub_8141B58; } -void sub_8141B58(u8 taskId) +static void sub_8141B58(u8 taskId) { u8 i = 0; gTasks[taskId].data[4] = i; @@ -1980,7 +1926,7 @@ void sub_8141B58(u8 taskId) } } -void dp01t_12_3_battle_menu(u8 taskId) +static void dp01t_12_3_battle_menu(u8 taskId) { u8 i = 0; @@ -2009,7 +1955,7 @@ void dp01t_12_3_battle_menu(u8 taskId) } } -void sub_8141DE4(u8 taskId) +static void sub_8141DE4(u8 taskId) { sub_8151A9C(&gUnknown_0203AB88->varB8, 0xFFFF); sub_8151678(&gUnknown_0203AB88->varB8); @@ -2023,7 +1969,7 @@ void sub_8141DE4(u8 taskId) gTasks[taskId].func = sub_8141E7C; } -void sub_8141E7C(u8 taskId) // end roulette ? +static void sub_8141E7C(u8 taskId) // end roulette ? { if (UpdatePaletteFade() == 0) { @@ -2044,7 +1990,7 @@ void sub_8141E7C(u8 taskId) // end roulette ? } } -void sub_8141EF8(u8 taskId) +static void sub_8141EF8(u8 taskId) { if (gUnknown_0203AB88->varA8 == 0 || gMain.newKeys & gUnknown_0203AB88->varAA) { @@ -2059,7 +2005,7 @@ void sub_8141EF8(u8 taskId) gUnknown_0203AB88->varA8--; } -void sub_8141F7C(u8 taskId, TaskFunc r1, u16 r2, u16 r3) +static void sub_8141F7C(u8 taskId, TaskFunc r1, u16 r2, u16 r3) { gUnknown_0203AB88->varB4 = gTasks[taskId].func; if (r1 == NULL) @@ -2073,7 +2019,7 @@ void sub_8141F7C(u8 taskId, TaskFunc r1, u16 r2, u16 r3) gTasks[taskId].func = sub_8141EF8; } -void sub_8141FF4(u8 taskId) +static void sub_8141FF4(u8 taskId) { u8 i = 0; gUnknown_0203AB88->var00 = i; @@ -2089,7 +2035,7 @@ void sub_8141FF4(u8 taskId) gTasks[taskId].data[1] = 0; } -void sub_8142070(void) +static void sub_8142070(void) { u8 i; gUnknown_0203AB88->var08 = 0; @@ -2108,7 +2054,7 @@ void sub_8142070(void) sub_8143038(1, -1); } -u8 sub_81420D0(u8 taskId, u8 r1) +static u8 sub_81420D0(u8 taskId, u8 r1) { u8 i; u8 z; @@ -2138,7 +2084,7 @@ u8 sub_81420D0(u8 taskId, u8 r1) return gUnknown_085B62E4[r1].var02; } -bool8 sub_81421E8(u8 r0, u8 r1) +static bool8 sub_81421E8(u8 r0, u8 r1) { u8 t = r0; if (--r0 < 19) @@ -2165,7 +2111,7 @@ bool8 sub_81421E8(u8 r0, u8 r1) return FALSE; } -void sub_8142284(u8 r0) +static void sub_8142284(u8 r0) { u16 var0 = 0; @@ -2244,7 +2190,7 @@ void sub_8142284(u8 r0) } } -void sub_81424FC(u8 r0) +static void sub_81424FC(u8 r0) { vu8 i; vu8 z; @@ -2294,7 +2240,7 @@ void sub_81424FC(u8 r0) } } -u8 sub_8142758(u8 r0) +static u8 sub_8142758(u8 r0) { u8 var0[5] = {0, 3, 4, 6, 12}; @@ -2320,7 +2266,7 @@ u8 sub_8142758(u8 r0) return 0; } -void sub_8142814(void) +static void sub_8142814(void) { s32 x1; s32 x2; @@ -2338,114 +2284,6 @@ void sub_8142814(void) 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(); -} - static const u8 sFiller_085B644D[3] = {}; static const u16 RouletteSpritePalette_01[] = INCBIN_U16("graphics/roulette/shadow.gbapal"); static const u16 RouletteSpritePalette_02[] = INCBIN_U16("graphics/roulette/ball.gbapal"); @@ -2533,7 +2371,6 @@ static const union AffineAnimCmd *const gSpriteAffineAnimTable_85B7418[] = { gSpriteAffineAnim_85B7410 }; -extern const u32 RoulettePokeIcons2Tiles[]; static const struct CompressedSpriteSheet gUnknown_085B741C = { .data = RoulettePokeIcons2Tiles, .size = 0xC00, @@ -2604,14 +2441,12 @@ static const union AnimCmd *const gSpriteAnimTable_85B7484[] = { &gSpriteAnim_85B7420[11] }; -extern const u32 gRouletteHeadersTiles[]; static const struct CompressedSpriteSheet gUnknown_085B7488 = { .data = gRouletteHeadersTiles, .size = 0x1600, .tag = 4 }; -extern const u32 RoulettePokeIconsTiles[]; static const struct CompressedSpriteSheet gUnknown_085B7490 = { .data = RoulettePokeIconsTiles, .size = 0x400, @@ -2908,7 +2743,6 @@ static const struct SpriteTemplate gSpriteTemplate_85B7610[] = } }; -extern const struct OamData gOamData_85B73EC; static const struct OamData gOamData_85B7730 = { .affineMode = ST_OAM_AFFINE_OFF, @@ -2945,11 +2779,6 @@ static const struct OamData gOamData_85B7748 = .priority = 1, }; -extern const u32 gRouletteCreditTiles[]; -extern const u32 gRouletteNumbersTiles[]; -extern const u32 gRouletteMultiplierTiles[]; -extern const u32 RouletteBallCounterTiles[]; -extern const u32 RouletteCursorTiles[]; static const struct CompressedSpriteSheet gUnknown_085B7750[] = { { @@ -3089,7 +2918,6 @@ static const struct OamData gOamData_85B785C = .priority = 2, }; -extern const u32 gUnknown_085B6650[]; static const struct CompressedSpriteSheet gUnknown_085B7864 = { .data = gUnknown_085B6650, .size = 0x200, @@ -3191,7 +3019,6 @@ static const struct OamData gOamData_85B7940 = .priority = 2, }; -extern const u32 gRouletteCenter_Gfx[]; static const struct CompressedSpriteSheet gUnknown_085B7948 = { .data = gRouletteCenter_Gfx, .size = 0x800, @@ -3227,7 +3054,6 @@ static const struct OamData gOamData_85B7970 = .priority = 2, }; -extern const u32 gUnknown_085B67FC[]; static const struct CompressedSpriteSheet gUnknown_085B7978 = { .data = gUnknown_085B67FC, .size = 0xE00, @@ -3339,7 +3165,7 @@ static const struct OamData gOamData_85B7A38 = .size = 2, .priority = 2, }; -extern const u32 gUnknown_085B7290[]; + static const struct CompressedSpriteSheet gUnknown_085B7A40 = { .data = gUnknown_085B7290, .size = 0x180, @@ -3428,7 +3254,115 @@ static const struct SpriteTemplate gUnknown_085B7AEC = .callback = sub_8145294 }; -void sub_8142C0C(u8 r0) +static void sub_81428C4(u8 r0) +{ + DisplayYesNoMenu(); + DoYesNoFuncWithChoice(r0, &gUnknown_085B6408); +} + +static void sub_81428E4(u8 taskId) +{ + if (!gPaletteFade.active) + { + SetVBlankCallback(NULL); + SetMainCallback2(sub_81405CC); + DestroyTask(taskId); + } +} + +static 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; +} + +static void sub_814297C(u8 taskId) +{ + sub_819746C(0, FALSE); + HideCoinsWindow(); + ScriptContext2_Disable(); + DestroyTask(taskId); +} + +static 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); + } +} + +static 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; + } +} + +static 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(); +} + +static void sub_8142C0C(u8 r0) { if (!r0) { @@ -3447,7 +3381,7 @@ void sub_8142C0C(u8 r0) } } -u8 sub_8142C60(const struct SpriteTemplate *r0, u8 r1, u16 *r2) +static u8 sub_8142C60(const struct SpriteTemplate *r0, u8 r1, u16 *r2) { u16 temp; u8 spriteId = CreateSprite(r0, 116, 80, r0->oam->y); @@ -3463,7 +3397,7 @@ u8 sub_8142C60(const struct SpriteTemplate *r0, u8 r1, u16 *r2) return spriteId; } -void sub_8142CD0(void) +static void sub_8142CD0(void) { u8 i, j; u8 spriteId; @@ -3502,7 +3436,7 @@ void sub_8142CD0(void) } } -void unref_sub_8142E3C(void) +static void unref_sub_8142E3C(void) { u8 i; for (i = 0; i < 12; i++) @@ -3511,7 +3445,7 @@ void unref_sub_8142E3C(void) } } -void sub_8142E70(u8 r0, u8 r1) +static void sub_8142E70(u8 r0, u8 r1) { u8 i; switch (r0) @@ -3540,7 +3474,7 @@ void sub_8142E70(u8 r0, u8 r1) } } -void sub_8142F7C(void) +static void sub_8142F7C(void) { u8 i; for (i = 0; i < 6; i++) @@ -3554,7 +3488,7 @@ void sub_8142F7C(void) } } -void sub_8143038(u8 r0, u8 r1) +static void sub_8143038(u8 r0, u8 r1) { u8 i = 0; if (r0) @@ -3582,7 +3516,7 @@ void sub_8143038(u8 r0, u8 r1) } } -void sub_8143150(u8 r0) +static void sub_8143150(u8 r0) { if (!r0) { @@ -3596,7 +3530,7 @@ void sub_8143150(u8 r0) } } -void sub_81431E4(void) +static void sub_81431E4(void) { u8 i, j; u16 k; @@ -3621,7 +3555,7 @@ void sub_81431E4(void) } } -void sub_8143280(struct Sprite *sprite) +static void sub_8143280(struct Sprite *sprite) { s16 cos; s16 sin; @@ -3641,7 +3575,7 @@ void sub_8143280(struct Sprite *sprite) gOamMatrices[matrixNum].c = -sin; } -void sub_8143314(void) +static void sub_8143314(void) { u8 i; for (i = 0; i < 5; i++) @@ -3675,7 +3609,7 @@ void sub_8143314(void) gSprites[gUnknown_0203AB88->var3C[48]].invisible = TRUE; } -void sub_8143514(u16 r0) +static void sub_8143514(u16 r0) { u8 i; u16 d = 1000; @@ -3697,7 +3631,7 @@ void sub_8143514(u16 r0) } } -u8 sub_8143614(u8 r0) +static u8 sub_8143614(u8 r0) { u8 t[5] = {0, 1, 2, 3, 4}; @@ -3723,14 +3657,14 @@ u8 sub_8143614(u8 r0) return 0; } -void sub_81436D0(u8 r0) +static 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) +static void sub_814372C(u8 r0) { u8 i; u8 t = 0; @@ -3783,12 +3717,12 @@ void sub_814372C(u8 r0) } } -void sub_814390C(struct Sprite *sprite) +static void sub_814390C(struct Sprite *sprite) { sprite->pos2.x = gUnknown_0203AB88->var26; } -void sub_814391C(void) +static void sub_814391C(void) { u8 spriteId; struct SpriteSheet s; @@ -3805,7 +3739,7 @@ void sub_814391C(void) gSprites[spriteId].coordOffsetEnabled = TRUE; } -void sub_814399C(struct Sprite *sprite) +static void sub_814399C(struct Sprite *sprite) { u32 t = sprite->oam.matrixNum; struct OamMatrix *m = &gOamMatrices[0]; @@ -3815,7 +3749,7 @@ void sub_814399C(struct Sprite *sprite) m[t].c = gUnknown_0203AB88->var2C.c; } -void sub_81439C8(void) +static void sub_81439C8(void) { u8 i; for (i = 0; i < 6; i++) @@ -3829,7 +3763,7 @@ void sub_81439C8(void) } } -void sub_8143A40(void) +static void sub_8143A40(void) { u8 t = gUnknown_0203AB88->var3C[0]; u8 i; @@ -3847,7 +3781,7 @@ void sub_8143A40(void) } } -s16 sub_8143AC8(struct Sprite *sprite) +static s16 sub_8143AC8(struct Sprite *sprite) { if (gUnknown_0203AB88->var24 > sprite->data[3]) { @@ -3863,13 +3797,13 @@ s16 sub_8143AC8(struct Sprite *sprite) return sprite->data[6]; } -u8 sub_8143B14(struct Sprite *sprite) +static u8 sub_8143B14(struct Sprite *sprite) { gUnknown_0203AB88->var7E = sub_8143AC8(sprite) / 30.0f; return gUnknown_0203AB88->var7E; } -s16 sub_8143B48(struct Sprite *sprite) +static s16 sub_8143B48(struct Sprite *sprite) { s16 t = sub_8143AC8(sprite) % 30; u16 z; @@ -3890,7 +3824,7 @@ s16 sub_8143B48(struct Sprite *sprite) } } -void sub_8143B84(struct Sprite *sprite) +static void sub_8143B84(struct Sprite *sprite) { s16 sin, cos; @@ -3917,7 +3851,7 @@ void sub_8143B84(struct Sprite *sprite) } } -void sub_8143C90(struct Sprite *sprite) +static void sub_8143C90(struct Sprite *sprite) { s16 sin, cos; sprite->data[3] = gUnknown_0203AB88->var24 + sprite->data[6]; @@ -3930,7 +3864,7 @@ void sub_8143C90(struct Sprite *sprite) sprite->pos2.y += gSpriteCoordOffsetY; } -void sub_8143CFC(struct Sprite *sprite) +static void sub_8143CFC(struct Sprite *sprite) { sub_8143B84(sprite); sprite->data[2]++; @@ -3978,7 +3912,7 @@ void sub_8143CFC(struct Sprite *sprite) } } -void sub_8143E14(struct Sprite *sprite) +static void sub_8143E14(struct Sprite *sprite) { float f0, f1, f2; sub_8143B84(sprite); @@ -4024,7 +3958,7 @@ void sub_8143E14(struct Sprite *sprite) sprite->data[2] = 0; } -void sub_8143FA4(struct Sprite *sprite) +static void sub_8143FA4(struct Sprite *sprite) { sprite->pos2.y = (s16)(sprite->data[2] * 0.05f * sprite->data[2]) - 45; sprite->data[2]++; @@ -4043,7 +3977,7 @@ void sub_8143FA4(struct Sprite *sprite) } } -void sub_8144050(struct Sprite *sprite) +static void sub_8144050(struct Sprite *sprite) { if (sprite->data[2]++ < 45) { @@ -4079,7 +4013,7 @@ void sub_8144050(struct Sprite *sprite) } } -void sub_8144128(struct Sprite *sprite) +static void sub_8144128(struct Sprite *sprite) { sub_8143B84(sprite); switch (sprite->data[3]) @@ -4101,7 +4035,7 @@ void sub_8144128(struct Sprite *sprite) } } -void sub_8144168(struct Sprite *sprite) +static void sub_8144168(struct Sprite *sprite) { sub_8143B84(sprite); switch (gUnknown_0203AB88->var03_0) @@ -4118,7 +4052,7 @@ void sub_8144168(struct Sprite *sprite) } } -void prev_quest_read_x24_hm_usage(struct Sprite *sprite) +static void prev_quest_read_x24_hm_usage(struct Sprite *sprite) { sub_8143B84(sprite); if (sprite->data[2]-- == 16) @@ -4146,7 +4080,7 @@ void prev_quest_read_x24_hm_usage(struct Sprite *sprite) } } -void sub_8144264(struct Sprite *sprite) +static void sub_8144264(struct Sprite *sprite) { sub_8143B84(sprite); sprite->data[2] = 0; @@ -4212,7 +4146,7 @@ void sub_8144264(struct Sprite *sprite) } } -void sub_8144410(struct Sprite *sprite) +static void sub_8144410(struct Sprite *sprite) { sub_8143B84(sprite); if (gUnknown_0203AB88->var8C > 0.5f) @@ -4241,7 +4175,7 @@ void sub_8144410(struct Sprite *sprite) } } -void sub_8144514(struct Sprite *sprite) +static void sub_8144514(struct Sprite *sprite) { sub_8143B84(sprite); if (gUnknown_0203AB88->var94 > 40.f) @@ -4256,7 +4190,7 @@ void sub_8144514(struct Sprite *sprite) sprite->callback = sub_8144410; } -void sub_81445D8(struct Sprite *sprite) +static void sub_81445D8(struct Sprite *sprite) { sub_8143B84(sprite); if (gUnknown_0203AB88->var94 > 60.0f) @@ -4272,7 +4206,7 @@ void sub_81445D8(struct Sprite *sprite) sprite->callback = sub_8144514; } -void sub_81446AC(struct Sprite *sprite) +static void sub_81446AC(struct Sprite *sprite) { sprite->data[1] = 1; sprite->data[2] = 0; @@ -4281,7 +4215,7 @@ void sub_81446AC(struct Sprite *sprite) sprite->callback = sub_81445D8; } -void sub_81446DC(struct Sprite *sprite) +static void sub_81446DC(struct Sprite *sprite) { u16 t; u8 i; @@ -4314,7 +4248,7 @@ void sub_81446DC(struct Sprite *sprite) gUnknown_0203AB88->var38 = sprite; } -void sub_81448B8(struct Sprite *sprite) +static void sub_81448B8(struct Sprite *sprite) { u8 i = 0; s16 t; @@ -4342,7 +4276,7 @@ void sub_81448B8(struct Sprite *sprite) } #ifdef NONMATCHING -void sub_8144A24(struct Sprite *sprite) +static void sub_8144A24(struct Sprite *sprite) { u8 z; u16 o; @@ -4429,7 +4363,7 @@ void sub_8144A24(struct Sprite *sprite) } #else NAKED -void sub_8144A24(struct Sprite *sprite) +static void sub_8144A24(struct Sprite *sprite) { asm_unified("push {r4-r7,lr}\n\ mov r7, r10\n\ @@ -4726,7 +4660,7 @@ _08144C54:\n\ } #endif // NONMATCHING -const u16 gUnknown_085B7B1A[] = { +static const u16 gUnknown_085B7B1A[] = { 0x907, 0x808, 0x709, @@ -4739,7 +4673,7 @@ const u16 gUnknown_085B7B1A[] = { 0x010, }; -void sub_8144C70(struct Sprite *sprite) +static void sub_8144C70(struct Sprite *sprite) { if (sprite->data[1]++ >= sprite->data[3]) { @@ -4755,7 +4689,7 @@ void sub_8144C70(struct Sprite *sprite) } } -void sub_8144CD0(struct Sprite *sprite) +static void sub_8144CD0(struct Sprite *sprite) { int p; u16 t[][4] = { @@ -4782,7 +4716,7 @@ void sub_8144CD0(struct Sprite *sprite) } } -void sub_8144D94(struct Sprite *sprite) +static void sub_8144D94(struct Sprite *sprite) { float t; sprite->data[1]++; @@ -4803,7 +4737,7 @@ void sub_8144D94(struct Sprite *sprite) } } -void sub_8144E60(struct Sprite *sprite) +static void sub_8144E60(struct Sprite *sprite) { if (sprite->data[7] == 0) { @@ -4848,12 +4782,12 @@ void sub_8144E60(struct Sprite *sprite) } } -void sub_8144F94(struct Sprite *sprite) +static void sub_8144F94(struct Sprite *sprite) { sprite->invisible ^= 1; } -void sub_8144FB0(struct Sprite *sprite) +static void sub_8144FB0(struct Sprite *sprite) { if (sprite->pos1.y > -16) { @@ -4871,7 +4805,7 @@ void sub_8144FB0(struct Sprite *sprite) } } -void sub_8145030(struct Sprite *sprite) +static void sub_8145030(struct Sprite *sprite) { if (sprite->data[1] >= 0) { @@ -4903,7 +4837,7 @@ void sub_8145030(struct Sprite *sprite) } } -void sub_81450D8(struct Sprite *sprite) +static void sub_81450D8(struct Sprite *sprite) { s8 t[2] = {-1, 1}; s8 z[][2] = { @@ -4948,7 +4882,7 @@ void sub_81450D8(struct Sprite *sprite) } } -void sub_8145218(struct Sprite *sprite) +static void sub_8145218(struct Sprite *sprite) { s8 t[2] = {-1, 1}; @@ -4963,7 +4897,7 @@ void sub_8145218(struct Sprite *sprite) } } -void sub_8145294(struct Sprite *sprite) +static void sub_8145294(struct Sprite *sprite) { if (gUnknown_0203AB88->var38->data[0] == 0) { diff --git a/sym_ewram.txt b/sym_ewram.txt index 96a107711..59048a08e 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -226,13 +226,7 @@ gPlayerFacingPosition: @ 203AB40 .include "src/battle_records.o" .include "src/pokedex_area_screen.o" .include "src/evolution_scene.o" - -gUnknown_0203AB88: @ 203AB88 - .space 0x4 - -gUnknown_0203AB8C: @ 203AB8C - .space 0x4 - + .include "src/roulette.o" .include "src/pokedex_cry_screen.o" .include "src/coins.o" .include "src/battle_transition.o"