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; +}