mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-25 19:24:16 +01:00
Continue work on menu.c
This commit is contained in:
parent
2da7bdbb11
commit
a3ed94dc69
916
asm/menu.s
916
asm/menu.s
@ -5,922 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_8198FD4
|
||||
sub_8198FD4: @ 8198FD4
|
||||
push {r4-r6,lr}
|
||||
mov r6, r10
|
||||
mov r5, r9
|
||||
mov r4, r8
|
||||
push {r4-r6}
|
||||
sub sp, 0x20
|
||||
mov r9, r0
|
||||
mov r8, r1
|
||||
mov r10, r2
|
||||
ldr r6, [sp, 0x3C]
|
||||
ldr r4, [sp, 0x40]
|
||||
ldr r5, [sp, 0x44]
|
||||
ldr r2, [sp, 0x48]
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
mov r9, r0
|
||||
mov r0, r8
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
mov r8, r0
|
||||
mov r0, r10
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
mov r10, r0
|
||||
lsls r3, 24
|
||||
lsrs r3, 24
|
||||
lsls r6, 24
|
||||
lsrs r6, 24
|
||||
lsls r4, 24
|
||||
lsrs r4, 24
|
||||
lsls r5, 24
|
||||
lsrs r5, 24
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
mov r0, r8
|
||||
movs r1, 0x1
|
||||
str r2, [sp, 0x18]
|
||||
str r3, [sp, 0x1C]
|
||||
bl GetMenuCursorDimensionByFont
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
adds r1, r4, 0
|
||||
muls r1, r5
|
||||
lsls r1, 24
|
||||
lsrs r1, 24
|
||||
str r6, [sp]
|
||||
str r0, [sp, 0x4]
|
||||
str r4, [sp, 0x8]
|
||||
str r5, [sp, 0xC]
|
||||
str r1, [sp, 0x10]
|
||||
ldr r2, [sp, 0x18]
|
||||
str r2, [sp, 0x14]
|
||||
mov r0, r9
|
||||
mov r1, r8
|
||||
mov r2, r10
|
||||
ldr r3, [sp, 0x1C]
|
||||
bl sub_8198F58
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
add sp, 0x20
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8198FD4
|
||||
|
||||
thumb_func_start sub_8199060
|
||||
sub_8199060: @ 8199060
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0xC
|
||||
mov r8, r0
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
mov r8, r0
|
||||
lsls r0, r1, 24
|
||||
lsrs r7, r0, 24
|
||||
ldr r5, =gUnknown_0203CD90
|
||||
ldrb r0, [r5, 0x6]
|
||||
movs r1, 0
|
||||
bl GetMenuCursorDimensionByFont
|
||||
mov r9, r0
|
||||
mov r1, r9
|
||||
lsls r1, 24
|
||||
lsrs r1, 24
|
||||
mov r9, r1
|
||||
ldrb r0, [r5, 0x6]
|
||||
movs r1, 0x1
|
||||
bl GetMenuCursorDimensionByFont
|
||||
adds r6, r0, 0
|
||||
lsls r6, 24
|
||||
lsrs r6, 24
|
||||
ldrb r0, [r5, 0x9]
|
||||
mov r10, r0
|
||||
mov r0, r8
|
||||
mov r1, r10
|
||||
bl __umodsi3
|
||||
ldrb r1, [r5, 0x7]
|
||||
adds r4, r1, 0
|
||||
muls r4, r0
|
||||
ldrb r1, [r5]
|
||||
adds r4, r1
|
||||
lsls r4, 24
|
||||
lsrs r4, 24
|
||||
mov r0, r8
|
||||
mov r1, r10
|
||||
bl __udivsi3
|
||||
ldrb r1, [r5, 0x8]
|
||||
adds r3, r1, 0
|
||||
muls r3, r0
|
||||
ldrb r0, [r5, 0x1]
|
||||
adds r3, r0
|
||||
lsls r3, 24
|
||||
lsrs r3, 24
|
||||
ldrb r0, [r5, 0x5]
|
||||
mov r1, r9
|
||||
str r1, [sp]
|
||||
str r6, [sp, 0x4]
|
||||
movs r1, 0x11
|
||||
adds r2, r4, 0
|
||||
bl FillWindowPixelRect
|
||||
ldrb r6, [r5, 0x9]
|
||||
adds r0, r7, 0
|
||||
adds r1, r6, 0
|
||||
bl __umodsi3
|
||||
ldrb r1, [r5, 0x7]
|
||||
adds r4, r1, 0
|
||||
muls r4, r0
|
||||
ldrb r0, [r5]
|
||||
adds r4, r0
|
||||
lsls r4, 24
|
||||
lsrs r4, 24
|
||||
adds r0, r7, 0
|
||||
adds r1, r6, 0
|
||||
bl __udivsi3
|
||||
ldrb r1, [r5, 0x8]
|
||||
adds r3, r1, 0
|
||||
muls r3, r0
|
||||
ldrb r1, [r5, 0x1]
|
||||
adds r3, r1
|
||||
lsls r3, 24
|
||||
lsrs r3, 24
|
||||
ldrb r0, [r5, 0x5]
|
||||
ldrb r1, [r5, 0x6]
|
||||
ldr r2, =gText_SelectorArrow3
|
||||
str r3, [sp]
|
||||
movs r3, 0
|
||||
str r3, [sp, 0x4]
|
||||
str r3, [sp, 0x8]
|
||||
adds r3, r4, 0
|
||||
bl PrintTextOnWindow
|
||||
add sp, 0xC
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_8199060
|
||||
|
||||
thumb_func_start sub_8199134
|
||||
sub_8199134: @ 8199134
|
||||
push {r4-r7,lr}
|
||||
mov r7, r9
|
||||
mov r6, r8
|
||||
push {r6,r7}
|
||||
lsls r1, 24
|
||||
lsrs r1, 24
|
||||
mov r9, r1
|
||||
ldr r1, =gUnknown_0203CD90
|
||||
ldrb r2, [r1, 0x2]
|
||||
mov r8, r2
|
||||
lsls r0, 24
|
||||
asrs r6, r0, 24
|
||||
adds r5, r1, 0
|
||||
cmp r6, 0
|
||||
beq _0819918A
|
||||
movs r7, 0x2
|
||||
ldrsb r7, [r5, r7]
|
||||
ldrb r4, [r5, 0x9]
|
||||
adds r0, r7, 0
|
||||
adds r1, r4, 0
|
||||
bl __modsi3
|
||||
adds r0, r6
|
||||
cmp r0, 0
|
||||
bge _08199174
|
||||
adds r0, r4, 0
|
||||
adds r0, 0xFF
|
||||
add r0, r8
|
||||
b _08199188
|
||||
.pool
|
||||
_08199174:
|
||||
cmp r0, r4
|
||||
blt _08199184
|
||||
adds r0, r7, 0
|
||||
adds r1, r4, 0
|
||||
bl __divsi3
|
||||
muls r0, r4
|
||||
b _08199188
|
||||
_08199184:
|
||||
mov r1, r8
|
||||
adds r0, r6, r1
|
||||
_08199188:
|
||||
strb r0, [r5, 0x2]
|
||||
_0819918A:
|
||||
mov r2, r9
|
||||
lsls r0, r2, 24
|
||||
asrs r6, r0, 24
|
||||
cmp r6, 0
|
||||
beq _081991CE
|
||||
movs r0, 0x2
|
||||
ldrsb r0, [r5, r0]
|
||||
ldrb r4, [r5, 0x9]
|
||||
adds r1, r4, 0
|
||||
bl __divsi3
|
||||
adds r1, r0, r6
|
||||
cmp r1, 0
|
||||
bge _081991B2
|
||||
ldrb r0, [r5, 0xA]
|
||||
subs r0, 0x1
|
||||
muls r0, r4
|
||||
ldrb r1, [r5, 0x2]
|
||||
adds r0, r1
|
||||
b _081991CC
|
||||
_081991B2:
|
||||
ldrb r0, [r5, 0xA]
|
||||
cmp r1, r0
|
||||
blt _081991C4
|
||||
subs r0, 0x1
|
||||
adds r1, r4, 0
|
||||
muls r1, r0
|
||||
ldrb r0, [r5, 0x2]
|
||||
subs r0, r1
|
||||
b _081991CC
|
||||
_081991C4:
|
||||
adds r0, r4, 0
|
||||
muls r0, r6
|
||||
ldrb r2, [r5, 0x2]
|
||||
adds r0, r2
|
||||
_081991CC:
|
||||
strb r0, [r5, 0x2]
|
||||
_081991CE:
|
||||
movs r1, 0x2
|
||||
ldrsb r1, [r5, r1]
|
||||
movs r0, 0x4
|
||||
ldrsb r0, [r5, r0]
|
||||
cmp r1, r0
|
||||
bgt _081991E4
|
||||
ldrb r1, [r5, 0x2]
|
||||
mov r0, r8
|
||||
bl sub_8199060
|
||||
b _081991E8
|
||||
_081991E4:
|
||||
mov r0, r8
|
||||
strb r0, [r5, 0x2]
|
||||
_081991E8:
|
||||
ldrb r0, [r5, 0x2]
|
||||
pop {r3,r4}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8199134
|
||||
|
||||
thumb_func_start sub_81991F8
|
||||
sub_81991F8: @ 81991F8
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
lsls r1, 24
|
||||
lsrs r1, 24
|
||||
mov r8, r1
|
||||
ldr r1, =gUnknown_0203CD90
|
||||
ldrb r7, [r1, 0x2]
|
||||
lsls r0, 24
|
||||
asrs r4, r0, 24
|
||||
adds r5, r1, 0
|
||||
cmp r4, 0
|
||||
beq _0819922C
|
||||
movs r0, 0x2
|
||||
ldrsb r0, [r5, r0]
|
||||
ldrb r6, [r5, 0x9]
|
||||
adds r1, r6, 0
|
||||
bl __modsi3
|
||||
adds r0, r4
|
||||
cmp r0, 0
|
||||
blt _0819922C
|
||||
cmp r0, r6
|
||||
bge _0819922C
|
||||
adds r0, r4, r7
|
||||
strb r0, [r5, 0x2]
|
||||
_0819922C:
|
||||
mov r1, r8
|
||||
lsls r0, r1, 24
|
||||
asrs r4, r0, 24
|
||||
cmp r4, 0
|
||||
beq _08199258
|
||||
movs r0, 0x2
|
||||
ldrsb r0, [r5, r0]
|
||||
ldrb r6, [r5, 0x9]
|
||||
adds r1, r6, 0
|
||||
bl __divsi3
|
||||
adds r0, r4
|
||||
cmp r0, 0
|
||||
blt _08199258
|
||||
ldrb r1, [r5, 0xA]
|
||||
cmp r0, r1
|
||||
bge _08199258
|
||||
adds r0, r6, 0
|
||||
muls r0, r4
|
||||
ldrb r1, [r5, 0x2]
|
||||
adds r0, r1
|
||||
strb r0, [r5, 0x2]
|
||||
_08199258:
|
||||
movs r1, 0x2
|
||||
ldrsb r1, [r5, r1]
|
||||
movs r0, 0x4
|
||||
ldrsb r0, [r5, r0]
|
||||
cmp r1, r0
|
||||
bgt _08199274
|
||||
ldrb r1, [r5, 0x2]
|
||||
adds r0, r7, 0
|
||||
bl sub_8199060
|
||||
b _08199276
|
||||
.pool
|
||||
_08199274:
|
||||
strb r7, [r5, 0x2]
|
||||
_08199276:
|
||||
ldrb r0, [r5, 0x2]
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_81991F8
|
||||
|
||||
thumb_func_start sub_8199284
|
||||
sub_8199284: @ 8199284
|
||||
push {r4,lr}
|
||||
ldr r4, =gMain
|
||||
ldrh r1, [r4, 0x2E]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _081992AC
|
||||
movs r0, 0x5
|
||||
bl PlaySE
|
||||
ldr r0, =gUnknown_0203CD90
|
||||
ldrb r0, [r0, 0x2]
|
||||
lsls r0, 24
|
||||
asrs r0, 24
|
||||
b _0819932C
|
||||
.pool
|
||||
_081992AC:
|
||||
movs r0, 0x2
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _081992BA
|
||||
movs r0, 0x1
|
||||
negs r0, r0
|
||||
b _0819932C
|
||||
_081992BA:
|
||||
movs r0, 0x40
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _081992D0
|
||||
movs r0, 0x5
|
||||
bl PlaySE
|
||||
movs r1, 0x1
|
||||
negs r1, r1
|
||||
movs r0, 0
|
||||
b _08199324
|
||||
_081992D0:
|
||||
movs r0, 0x80
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _081992E4
|
||||
movs r0, 0x5
|
||||
bl PlaySE
|
||||
movs r0, 0
|
||||
movs r1, 0x1
|
||||
b _08199324
|
||||
_081992E4:
|
||||
movs r0, 0x20
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _081992F8
|
||||
bl GetLRKeysState
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x1
|
||||
bne _08199304
|
||||
_081992F8:
|
||||
movs r0, 0x5
|
||||
bl PlaySE
|
||||
movs r0, 0x1
|
||||
negs r0, r0
|
||||
b _08199322
|
||||
_08199304:
|
||||
ldrh r1, [r4, 0x2E]
|
||||
movs r0, 0x10
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _0819931A
|
||||
bl GetLRKeysState
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x2
|
||||
bne _08199328
|
||||
_0819931A:
|
||||
movs r0, 0x5
|
||||
bl PlaySE
|
||||
movs r0, 0x1
|
||||
_08199322:
|
||||
movs r1, 0
|
||||
_08199324:
|
||||
bl sub_8199134
|
||||
_08199328:
|
||||
movs r0, 0x2
|
||||
negs r0, r0
|
||||
_0819932C:
|
||||
pop {r4}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8199284
|
||||
|
||||
thumb_func_start sub_8199334
|
||||
sub_8199334: @ 8199334
|
||||
push {r4-r6,lr}
|
||||
ldr r5, =gUnknown_0203CD90
|
||||
ldrb r4, [r5, 0x2]
|
||||
ldr r6, =gMain
|
||||
ldrh r1, [r6, 0x2E]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _0819935C
|
||||
movs r0, 0x5
|
||||
bl PlaySE
|
||||
movs r0, 0x2
|
||||
ldrsb r0, [r5, r0]
|
||||
b _081993D2
|
||||
.pool
|
||||
_0819935C:
|
||||
movs r0, 0x2
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _0819936A
|
||||
movs r0, 0x1
|
||||
negs r0, r0
|
||||
b _081993D2
|
||||
_0819936A:
|
||||
movs r0, 0x40
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _0819937A
|
||||
movs r1, 0x1
|
||||
negs r1, r1
|
||||
movs r0, 0
|
||||
b _081993BC
|
||||
_0819937A:
|
||||
movs r0, 0x80
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08199388
|
||||
movs r0, 0
|
||||
movs r1, 0x1
|
||||
b _081993BC
|
||||
_08199388:
|
||||
movs r0, 0x20
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _0819939C
|
||||
bl GetLRKeysState
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x1
|
||||
bne _081993A2
|
||||
_0819939C:
|
||||
movs r0, 0x1
|
||||
negs r0, r0
|
||||
b _081993BA
|
||||
_081993A2:
|
||||
ldrh r1, [r6, 0x2E]
|
||||
movs r0, 0x10
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
bne _081993B8
|
||||
bl GetLRKeysState
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x2
|
||||
bne _081993CE
|
||||
_081993B8:
|
||||
movs r0, 0x1
|
||||
_081993BA:
|
||||
movs r1, 0
|
||||
_081993BC:
|
||||
bl sub_81991F8
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r4, r0
|
||||
beq _081993CE
|
||||
movs r0, 0x5
|
||||
bl PlaySE
|
||||
_081993CE:
|
||||
movs r0, 0x2
|
||||
negs r0, r0
|
||||
_081993D2:
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8199334
|
||||
|
||||
thumb_func_start sub_81993D8
|
||||
sub_81993D8: @ 81993D8
|
||||
push {r4,r5,lr}
|
||||
ldr r4, =gMain
|
||||
ldrh r1, [r4, 0x2E]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _08199400
|
||||
movs r0, 0x5
|
||||
bl PlaySE
|
||||
ldr r0, =gUnknown_0203CD90
|
||||
ldrb r0, [r0, 0x2]
|
||||
lsls r0, 24
|
||||
asrs r0, 24
|
||||
b _0819947C
|
||||
.pool
|
||||
_08199400:
|
||||
movs r0, 0x2
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _0819940E
|
||||
movs r0, 0x1
|
||||
negs r0, r0
|
||||
b _0819947C
|
||||
_0819940E:
|
||||
ldrh r0, [r4, 0x30]
|
||||
movs r5, 0xF0
|
||||
adds r1, r5, 0
|
||||
ands r1, r0
|
||||
cmp r1, 0x40
|
||||
bne _08199428
|
||||
movs r0, 0x5
|
||||
bl PlaySE
|
||||
movs r1, 0x1
|
||||
negs r1, r1
|
||||
movs r0, 0
|
||||
b _08199474
|
||||
_08199428:
|
||||
cmp r1, 0x80
|
||||
bne _08199438
|
||||
movs r0, 0x5
|
||||
bl PlaySE
|
||||
movs r0, 0
|
||||
movs r1, 0x1
|
||||
b _08199474
|
||||
_08199438:
|
||||
cmp r1, 0x20
|
||||
beq _08199448
|
||||
bl sub_812210C
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x1
|
||||
bne _08199454
|
||||
_08199448:
|
||||
movs r0, 0x5
|
||||
bl PlaySE
|
||||
movs r0, 0x1
|
||||
negs r0, r0
|
||||
b _08199472
|
||||
_08199454:
|
||||
ldrh r1, [r4, 0x30]
|
||||
adds r0, r5, 0
|
||||
ands r0, r1
|
||||
cmp r0, 0x10
|
||||
beq _0819946A
|
||||
bl sub_812210C
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x2
|
||||
bne _08199478
|
||||
_0819946A:
|
||||
movs r0, 0x5
|
||||
bl PlaySE
|
||||
movs r0, 0x1
|
||||
_08199472:
|
||||
movs r1, 0
|
||||
_08199474:
|
||||
bl sub_8199134
|
||||
_08199478:
|
||||
movs r0, 0x2
|
||||
negs r0, r0
|
||||
_0819947C:
|
||||
pop {r4,r5}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_81993D8
|
||||
|
||||
thumb_func_start sub_8199484
|
||||
sub_8199484: @ 8199484
|
||||
push {r4-r6,lr}
|
||||
ldr r6, =gUnknown_0203CD90
|
||||
ldrb r4, [r6, 0x2]
|
||||
ldr r5, =gMain
|
||||
ldrh r1, [r5, 0x2E]
|
||||
movs r0, 0x1
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _081994AC
|
||||
movs r0, 0x5
|
||||
bl PlaySE
|
||||
movs r0, 0x2
|
||||
ldrsb r0, [r6, r0]
|
||||
b _0819951E
|
||||
.pool
|
||||
_081994AC:
|
||||
movs r0, 0x2
|
||||
ands r0, r1
|
||||
cmp r0, 0
|
||||
beq _081994BA
|
||||
movs r0, 0x1
|
||||
negs r0, r0
|
||||
b _0819951E
|
||||
_081994BA:
|
||||
ldrh r0, [r5, 0x30]
|
||||
movs r6, 0xF0
|
||||
adds r1, r6, 0
|
||||
ands r1, r0
|
||||
cmp r1, 0x40
|
||||
bne _081994CE
|
||||
movs r1, 0x1
|
||||
negs r1, r1
|
||||
movs r0, 0
|
||||
b _08199508
|
||||
_081994CE:
|
||||
cmp r1, 0x80
|
||||
bne _081994D8
|
||||
movs r0, 0
|
||||
movs r1, 0x1
|
||||
b _08199508
|
||||
_081994D8:
|
||||
cmp r1, 0x20
|
||||
beq _081994E8
|
||||
bl sub_812210C
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x1
|
||||
bne _081994EE
|
||||
_081994E8:
|
||||
movs r0, 0x1
|
||||
negs r0, r0
|
||||
b _08199506
|
||||
_081994EE:
|
||||
ldrh r1, [r5, 0x30]
|
||||
adds r0, r6, 0
|
||||
ands r0, r1
|
||||
cmp r0, 0x10
|
||||
beq _08199504
|
||||
bl sub_812210C
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x2
|
||||
bne _0819951A
|
||||
_08199504:
|
||||
movs r0, 0x1
|
||||
_08199506:
|
||||
movs r1, 0
|
||||
_08199508:
|
||||
bl sub_81991F8
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r4, r0
|
||||
beq _0819951A
|
||||
movs r0, 0x5
|
||||
bl PlaySE
|
||||
_0819951A:
|
||||
movs r0, 0x2
|
||||
negs r0, r0
|
||||
_0819951E:
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end sub_8199484
|
||||
|
||||
thumb_func_start InitMenuInUpperLeftCorner
|
||||
@ int InitMenuInUpperLeftCorner(s8 windowId, s8 numItems, u8 initialCursorPos, bool doNotPlaySoundWhenAPressed)
|
||||
InitMenuInUpperLeftCorner: @ 8199524
|
||||
push {r4-r6,lr}
|
||||
lsls r1, 24
|
||||
lsrs r1, 24
|
||||
lsls r2, 24
|
||||
lsrs r5, r2, 24
|
||||
ldr r4, =gUnknown_0203CD90
|
||||
movs r6, 0
|
||||
strb r6, [r4]
|
||||
movs r2, 0x1
|
||||
strb r2, [r4, 0x1]
|
||||
strb r6, [r4, 0x3]
|
||||
subs r1, 0x1
|
||||
strb r1, [r4, 0x4]
|
||||
strb r0, [r4, 0x5]
|
||||
strb r2, [r4, 0x6]
|
||||
movs r0, 0x10
|
||||
strb r0, [r4, 0x8]
|
||||
strb r3, [r4, 0xB]
|
||||
cmp r5, 0
|
||||
blt _08199554
|
||||
movs r0, 0x4
|
||||
ldrsb r0, [r4, r0]
|
||||
cmp r5, r0
|
||||
ble _0819955C
|
||||
_08199554:
|
||||
strb r6, [r4, 0x2]
|
||||
b _0819955E
|
||||
.pool
|
||||
_0819955C:
|
||||
strb r5, [r4, 0x2]
|
||||
_0819955E:
|
||||
movs r0, 0
|
||||
bl MoveMenuCursor
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
pop {r4-r6}
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end InitMenuInUpperLeftCorner
|
||||
|
||||
thumb_func_start InitMenuInUpperLeftCornerPlaySoundWhenAPressed
|
||||
InitMenuInUpperLeftCornerPlaySoundWhenAPressed: @ 8199570
|
||||
push {lr}
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
lsls r1, 24
|
||||
lsrs r1, 24
|
||||
lsls r2, 24
|
||||
lsrs r2, 24
|
||||
movs r3, 0
|
||||
bl InitMenuInUpperLeftCorner
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
pop {r1}
|
||||
bx r1
|
||||
thumb_func_end InitMenuInUpperLeftCornerPlaySoundWhenAPressed
|
||||
|
||||
thumb_func_start PrintMenuTable
|
||||
PrintMenuTable: @ 819958C
|
||||
push {r4-r7,lr}
|
||||
mov r7, r8
|
||||
push {r7}
|
||||
sub sp, 0xC
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
mov r8, r0
|
||||
lsls r1, 24
|
||||
lsrs r7, r1, 24
|
||||
movs r5, 0
|
||||
cmp r5, r7
|
||||
bcs _081995D0
|
||||
movs r6, 0x80
|
||||
lsls r6, 17
|
||||
adds r4, r2, 0
|
||||
_081995AA:
|
||||
ldr r2, [r4]
|
||||
lsrs r0, r6, 24
|
||||
str r0, [sp]
|
||||
movs r0, 0xFF
|
||||
str r0, [sp, 0x4]
|
||||
movs r0, 0
|
||||
str r0, [sp, 0x8]
|
||||
mov r0, r8
|
||||
movs r1, 0x1
|
||||
movs r3, 0x8
|
||||
bl PrintTextOnWindow
|
||||
movs r0, 0x80
|
||||
lsls r0, 21
|
||||
adds r6, r0
|
||||
adds r4, 0x8
|
||||
adds r5, 0x1
|
||||
cmp r5, r7
|
||||
bcc _081995AA
|
||||
_081995D0:
|
||||
mov r0, r8
|
||||
movs r1, 0x2
|
||||
bl CopyWindowToVram
|
||||
add sp, 0xC
|
||||
pop {r3}
|
||||
mov r8, r3
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end PrintMenuTable
|
||||
|
||||
thumb_func_start sub_81995E4
|
||||
sub_81995E4: @ 81995E4
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0x10
|
||||
mov r9, r2
|
||||
mov r8, r3
|
||||
lsls r0, 24
|
||||
lsrs r6, r0, 24
|
||||
lsls r1, 24
|
||||
lsrs r7, r1, 24
|
||||
mov r0, sp
|
||||
movs r1, 0
|
||||
mov r10, r1
|
||||
strb r6, [r0, 0x4]
|
||||
mov r1, sp
|
||||
movs r0, 0x1
|
||||
strb r0, [r1, 0x5]
|
||||
movs r1, 0x5
|
||||
bl GetFontAttribute
|
||||
mov r3, sp
|
||||
lsls r0, 4
|
||||
ldrb r2, [r3, 0xC]
|
||||
movs r5, 0xF
|
||||
adds r1, r5, 0
|
||||
ands r1, r2
|
||||
orrs r1, r0
|
||||
strb r1, [r3, 0xC]
|
||||
movs r0, 0x1
|
||||
movs r1, 0x6
|
||||
bl GetFontAttribute
|
||||
mov r3, sp
|
||||
adds r1, r5, 0
|
||||
ands r1, r0
|
||||
ldrb r2, [r3, 0xD]
|
||||
movs r4, 0x10
|
||||
negs r4, r4
|
||||
adds r0, r4, 0
|
||||
ands r0, r2
|
||||
orrs r0, r1
|
||||
strb r0, [r3, 0xD]
|
||||
movs r0, 0x1
|
||||
movs r1, 0x7
|
||||
bl GetFontAttribute
|
||||
mov r3, sp
|
||||
lsls r0, 4
|
||||
ldrb r2, [r3, 0xD]
|
||||
adds r1, r5, 0
|
||||
ands r1, r2
|
||||
orrs r1, r0
|
||||
strb r1, [r3, 0xD]
|
||||
movs r0, 0x1
|
||||
movs r1, 0x4
|
||||
bl GetFontAttribute
|
||||
mov r1, sp
|
||||
ands r5, r0
|
||||
ldrb r0, [r1, 0xC]
|
||||
ands r4, r0
|
||||
orrs r4, r5
|
||||
strb r4, [r1, 0xC]
|
||||
mov r0, sp
|
||||
mov r1, r10
|
||||
strb r1, [r0, 0xA]
|
||||
strb r1, [r0, 0xB]
|
||||
movs r1, 0x8
|
||||
strb r1, [r0, 0x6]
|
||||
strb r1, [r0, 0x8]
|
||||
movs r4, 0
|
||||
cmp r4, r7
|
||||
bcs _081996A6
|
||||
mov r5, sp
|
||||
_0819967C:
|
||||
mov r1, r8
|
||||
adds r0, r1, r4
|
||||
ldrb r0, [r0]
|
||||
lsls r0, 3
|
||||
add r0, r9
|
||||
ldr r0, [r0]
|
||||
str r0, [sp]
|
||||
lsls r0, r4, 4
|
||||
adds r0, 0x1
|
||||
strb r0, [r5, 0x7]
|
||||
strb r0, [r5, 0x9]
|
||||
mov r0, sp
|
||||
movs r1, 0xFF
|
||||
movs r2, 0
|
||||
bl AddTextPrinter
|
||||
adds r0, r4, 0x1
|
||||
lsls r0, 24
|
||||
lsrs r4, r0, 24
|
||||
cmp r4, r7
|
||||
bcc _0819967C
|
||||
_081996A6:
|
||||
adds r0, r6, 0
|
||||
movs r1, 0x2
|
||||
bl CopyWindowToVram
|
||||
add sp, 0x10
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_81995E4
|
||||
|
||||
thumb_func_start CreateYesNoMenu
|
||||
@ void CreateYesNoMenu(struct WindowTemplate *windowTemplate, u16 borderFirstTileNum, u8 borderPalette, u8 initialCursorPos)
|
||||
CreateYesNoMenu: @ 81996C0
|
||||
|
@ -21,8 +21,8 @@ void sub_8198070(u8 windowId, bool8 copyToVram);
|
||||
void SetWindowTemplateFields(struct WindowTemplate* template, u8 priority, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 palNum, u16 baseBlock);
|
||||
void SetWindowBorderStyle(u8 windowId, bool8 copyToVram, u16 tileStart, u8 palette);
|
||||
void schedule_bg_copy_tilemap_to_vram(u8 bgNum);
|
||||
void PrintMenuTable(u8 idx, u8 nstrs, const struct MenuAction *strs);
|
||||
void InitMenuInUpperLeftCornerPlaySoundWhenAPressed(u8 idx, u8 nstrs,u8);
|
||||
void PrintMenuTable(u8 windowId, u8 itemCount, const struct MenuAction *strs);
|
||||
u8 InitMenuInUpperLeftCornerPlaySoundWhenAPressed(u8 windowId, u8 numItems, u8 initialCursorPos);
|
||||
u8 GetMenuCursorPos(void);
|
||||
s8 ProcessMenuInput(void);
|
||||
s8 ProcessMenuInputNoWrapAround(void);
|
||||
|
@ -27,5 +27,7 @@ void sub_81223FC(u8 *a0, u8 count, u8 a2);
|
||||
void sub_8122448(u8 *a0, u8 count, u16 x, u16 y);
|
||||
void DisplayMessageAndContinueTask(u8 taskId, u8 arg1, u16 arg2, u8 arg3, u8 arg4, u8 textSpeed, const u8 *string, void *taskFunc);
|
||||
void CreateYesNoMenuWithCallbacks(u8 taskId, const struct WindowTemplate *template, u8 arg2, u8 arg3, u8 arg4, u16 tileStart, u8 palette, const struct YesNoFuncTable *yesNo);
|
||||
u8 GetLRKeysState(void);
|
||||
u8 sub_812210C(void);
|
||||
|
||||
#endif //GUARD_MENU_HELPERS_H
|
||||
|
427
src/menu.c
427
src/menu.c
@ -7,6 +7,7 @@
|
||||
#include "constants/songs.h"
|
||||
#include "main.h"
|
||||
#include "sound.h"
|
||||
#include "menu_helpers.h"
|
||||
|
||||
struct SomeUnkStruct
|
||||
{
|
||||
@ -24,11 +25,11 @@ struct Menu
|
||||
s8 maxCursorPos;
|
||||
u8 windowId;
|
||||
u8 fontId;
|
||||
u8 menu_field_7;
|
||||
u8 cursorHeight;
|
||||
u8 menu_field_9;
|
||||
u8 menu_field_A;
|
||||
u8 menu_field_B;
|
||||
u8 optionWidth;
|
||||
u8 optionHeight;
|
||||
u8 horizontalCount;
|
||||
u8 verticalCount;
|
||||
bool8 APressMuted;
|
||||
};
|
||||
|
||||
extern EWRAM_DATA struct Menu gUnknown_0203CD90;
|
||||
@ -435,7 +436,7 @@ void sub_8198314(void)
|
||||
}
|
||||
}
|
||||
|
||||
u8 sub_8198348(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numChoices, u8 cursorPos, u8 a7)
|
||||
u8 sub_8198348(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numChoices, u8 initialCursorPos, u8 a7)
|
||||
{
|
||||
s32 pos;
|
||||
|
||||
@ -445,10 +446,10 @@ u8 sub_8198348(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numC
|
||||
gUnknown_0203CD90.maxCursorPos = numChoices - 1;
|
||||
gUnknown_0203CD90.windowId = windowId;
|
||||
gUnknown_0203CD90.fontId = fontId;
|
||||
gUnknown_0203CD90.cursorHeight = cursorHeight;
|
||||
gUnknown_0203CD90.menu_field_B = a7;
|
||||
gUnknown_0203CD90.optionHeight = cursorHeight;
|
||||
gUnknown_0203CD90.APressMuted = a7;
|
||||
|
||||
pos = cursorPos;
|
||||
pos = initialCursorPos;
|
||||
|
||||
if (pos < 0 || pos > gUnknown_0203CD90.maxCursorPos)
|
||||
gUnknown_0203CD90.cursorPos = 0;
|
||||
@ -459,14 +460,15 @@ u8 sub_8198348(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numC
|
||||
return gUnknown_0203CD90.cursorPos;
|
||||
}
|
||||
|
||||
u8 sub_81983AC(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numChoices, u8 cursorPos)
|
||||
u8 sub_81983AC(u8 windowId, u8 fontId, u8 left, u8 top, u8 cursorHeight, u8 numChoices, u8 initialCursorPos)
|
||||
{
|
||||
return sub_8198348(windowId, fontId, left, top, cursorHeight, numChoices, cursorPos, 0);
|
||||
return sub_8198348(windowId, fontId, left, top, cursorHeight, numChoices, initialCursorPos, 0);
|
||||
}
|
||||
|
||||
u8 sub_81983EC(u8 windowId, u8 fontId, u8 left, u8 top, u8 numChoices, u8 cursorPos)
|
||||
u8 sub_81983EC(u8 windowId, u8 fontId, u8 left, u8 top, u8 numChoices, u8 initialCursorPos)
|
||||
{
|
||||
return sub_81983AC(windowId, fontId, left, top, GetMenuCursorDimensionByFont(fontId, 1), numChoices, cursorPos);
|
||||
u8 cursorHeight = GetMenuCursorDimensionByFont(fontId, 1);
|
||||
return sub_81983AC(windowId, fontId, left, top, cursorHeight, numChoices, initialCursorPos);
|
||||
}
|
||||
|
||||
void RedrawMenuCursor(u8 oldPos, u8 newPos)
|
||||
@ -475,8 +477,8 @@ void RedrawMenuCursor(u8 oldPos, u8 newPos)
|
||||
|
||||
width = GetMenuCursorDimensionByFont(gUnknown_0203CD90.fontId, 0);
|
||||
height = GetMenuCursorDimensionByFont(gUnknown_0203CD90.fontId, 1);
|
||||
FillWindowPixelRect(gUnknown_0203CD90.windowId, 0x11, gUnknown_0203CD90.left, gUnknown_0203CD90.cursorHeight * oldPos + gUnknown_0203CD90.top, width, height);
|
||||
PrintTextOnWindow(gUnknown_0203CD90.windowId, gUnknown_0203CD90.fontId, gText_SelectorArrow3, gUnknown_0203CD90.left, gUnknown_0203CD90.cursorHeight * newPos + gUnknown_0203CD90.top, 0, 0);
|
||||
FillWindowPixelRect(gUnknown_0203CD90.windowId, 0x11, gUnknown_0203CD90.left, gUnknown_0203CD90.optionHeight * oldPos + gUnknown_0203CD90.top, width, height);
|
||||
PrintTextOnWindow(gUnknown_0203CD90.windowId, gUnknown_0203CD90.fontId, gText_SelectorArrow3, gUnknown_0203CD90.left, gUnknown_0203CD90.optionHeight * newPos + gUnknown_0203CD90.top, 0, 0);
|
||||
}
|
||||
|
||||
u8 MoveMenuCursor(s8 cursorDelta)
|
||||
@ -520,17 +522,15 @@ s8 ProcessMenuInput(void)
|
||||
{
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
if (!gUnknown_0203CD90.menu_field_B)
|
||||
if (!gUnknown_0203CD90.APressMuted)
|
||||
PlaySE(SE_SELECT);
|
||||
return gUnknown_0203CD90.cursorPos;
|
||||
}
|
||||
|
||||
if (gMain.newKeys & B_BUTTON)
|
||||
else if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (gMain.newKeys & DPAD_UP)
|
||||
else if (gMain.newKeys & DPAD_UP)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
MoveMenuCursor(-1);
|
||||
@ -552,17 +552,15 @@ s8 ProcessMenuInputNoWrapAround(void)
|
||||
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
if (!gUnknown_0203CD90.menu_field_B)
|
||||
if (!gUnknown_0203CD90.APressMuted)
|
||||
PlaySE(SE_SELECT);
|
||||
return gUnknown_0203CD90.cursorPos;
|
||||
}
|
||||
|
||||
if (gMain.newKeys & B_BUTTON)
|
||||
else if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (gMain.newKeys & DPAD_UP)
|
||||
else if (gMain.newKeys & DPAD_UP)
|
||||
{
|
||||
if (oldPos != MoveMenuCursorNoWrapAround(-1))
|
||||
PlaySE(SE_SELECT);
|
||||
@ -582,17 +580,15 @@ s8 ProcessMenuInput_other(void)
|
||||
{
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
if (!gUnknown_0203CD90.menu_field_B)
|
||||
if (!gUnknown_0203CD90.APressMuted)
|
||||
PlaySE(SE_SELECT);
|
||||
return gUnknown_0203CD90.cursorPos;
|
||||
}
|
||||
|
||||
if (gMain.newKeys & B_BUTTON)
|
||||
else if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP)
|
||||
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
MoveMenuCursor(-1);
|
||||
@ -614,17 +610,15 @@ s8 ProcessMenuInputNoWrapAround_other(void)
|
||||
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
if (!gUnknown_0203CD90.menu_field_B)
|
||||
if (!gUnknown_0203CD90.APressMuted)
|
||||
PlaySE(SE_SELECT);
|
||||
return gUnknown_0203CD90.cursorPos;
|
||||
}
|
||||
|
||||
if (gMain.newKeys & B_BUTTON)
|
||||
else if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP)
|
||||
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP)
|
||||
{
|
||||
if (oldPos != MoveMenuCursorNoWrapAround(-1))
|
||||
PlaySE(SE_SELECT);
|
||||
@ -722,7 +716,7 @@ u16 sub_8198AA4(u8 bg, u8 left, u8 top, u8 width, u8 height, u8 paletteNum, u16
|
||||
return AddWindow(&template);
|
||||
}
|
||||
|
||||
void sub_8198AF8(struct WindowTemplate *window, u8 fontId, u8 left, u8 top, u16 baseTileNum, u8 paletteNum, u8 cursorPos)
|
||||
void sub_8198AF8(struct WindowTemplate *window, u8 fontId, u8 left, u8 top, u16 baseTileNum, u8 paletteNum, u8 initialCursorPos)
|
||||
{
|
||||
struct TextSubPrinter printer;
|
||||
|
||||
@ -745,7 +739,7 @@ void sub_8198AF8(struct WindowTemplate *window, u8 fontId, u8 left, u8 top, u16
|
||||
|
||||
AddTextPrinter(&printer, 0xFF, 0);
|
||||
|
||||
sub_81983AC(gUnknown_0203CD9F, fontId, left, top, GetFontAttribute(fontId, 1), 2, cursorPos);
|
||||
sub_81983AC(gUnknown_0203CD9F, fontId, left, top, GetFontAttribute(fontId, 1), 2, initialCursorPos);
|
||||
}
|
||||
|
||||
void sub_8198C34(struct WindowTemplate *window, u8 fontId, u16 baseTileNum, u8 paletteNum)
|
||||
@ -822,20 +816,20 @@ void sub_8198EF8(u8 windowId, u8 fontId, u8 a2, u8 a3, u8 a4, u8 a5, const struc
|
||||
sub_8198DBC(windowId, fontId, GetFontAttribute(fontId, 0), 0, a2, a4, a5, strs, a8);
|
||||
}
|
||||
|
||||
u8 sub_8198F58(u8 a0, u8 a1, s8 a2, s8 a3, u8 a4, u8 a5, u8 a6, u8 a7, u8 a8, u8 a9)
|
||||
u8 sub_8198F58(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 cursorHeight, u8 a6, u8 a7, u8 numChoices, u8 a9)
|
||||
{
|
||||
s32 pos;
|
||||
|
||||
gUnknown_0203CD90.left = a2;
|
||||
gUnknown_0203CD90.top = a3;
|
||||
gUnknown_0203CD90.left = left;
|
||||
gUnknown_0203CD90.top = top;
|
||||
gUnknown_0203CD90.minCursorPos = 0;
|
||||
gUnknown_0203CD90.maxCursorPos = a8 - 1;
|
||||
gUnknown_0203CD90.windowId = a0;
|
||||
gUnknown_0203CD90.fontId = a1;
|
||||
gUnknown_0203CD90.menu_field_7 = a4;
|
||||
gUnknown_0203CD90.cursorHeight = a5;
|
||||
gUnknown_0203CD90.menu_field_9 = a6;
|
||||
gUnknown_0203CD90.menu_field_A = a7;
|
||||
gUnknown_0203CD90.maxCursorPos = numChoices - 1;
|
||||
gUnknown_0203CD90.windowId = windowId;
|
||||
gUnknown_0203CD90.fontId = fontId;
|
||||
gUnknown_0203CD90.optionWidth = a4;
|
||||
gUnknown_0203CD90.optionHeight = cursorHeight;
|
||||
gUnknown_0203CD90.horizontalCount = a6;
|
||||
gUnknown_0203CD90.verticalCount = a7;
|
||||
|
||||
pos = a9;
|
||||
|
||||
@ -847,3 +841,342 @@ u8 sub_8198F58(u8 a0, u8 a1, s8 a2, s8 a3, u8 a4, u8 a5, u8 a6, u8 a7, u8 a8, u8
|
||||
sub_8199134(0, 0);
|
||||
return gUnknown_0203CD90.cursorPos;
|
||||
}
|
||||
|
||||
u8 sub_8198FD4(u8 windowId, u8 fontId, u8 left, u8 top, u8 a4, u8 a5, u8 a6, u8 a7)
|
||||
{
|
||||
u8 cursorHeight = GetMenuCursorDimensionByFont(fontId, 1);
|
||||
u8 numChoices = a5 * a6;
|
||||
return sub_8198F58(windowId, fontId, left, top, a4, cursorHeight, a5, a6, numChoices, a7);
|
||||
}
|
||||
|
||||
void sub_8199060(u8 oldCursorPos, u8 newCursorPos)
|
||||
{
|
||||
u8 cursorWidth = GetMenuCursorDimensionByFont(gUnknown_0203CD90.fontId, 0);
|
||||
u8 cursorHeight = GetMenuCursorDimensionByFont(gUnknown_0203CD90.fontId, 1);
|
||||
u8 xPos = (oldCursorPos % gUnknown_0203CD90.horizontalCount) * gUnknown_0203CD90.optionWidth + gUnknown_0203CD90.left;
|
||||
u8 yPos = (oldCursorPos / gUnknown_0203CD90.horizontalCount) * gUnknown_0203CD90.optionHeight + gUnknown_0203CD90.top;
|
||||
FillWindowPixelRect(gUnknown_0203CD90.windowId,
|
||||
0x11,
|
||||
xPos,
|
||||
yPos,
|
||||
cursorWidth,
|
||||
cursorHeight);
|
||||
xPos = (newCursorPos % gUnknown_0203CD90.horizontalCount) * gUnknown_0203CD90.optionWidth + gUnknown_0203CD90.left;
|
||||
yPos = (newCursorPos / gUnknown_0203CD90.horizontalCount) * gUnknown_0203CD90.optionHeight + gUnknown_0203CD90.top;
|
||||
PrintTextOnWindow(gUnknown_0203CD90.windowId,
|
||||
gUnknown_0203CD90.fontId,
|
||||
gText_SelectorArrow3,
|
||||
xPos,
|
||||
yPos,
|
||||
0,
|
||||
0);
|
||||
}
|
||||
|
||||
u8 sub_8199134(s8 deltaX, s8 deltaY)
|
||||
{
|
||||
u8 oldPos = gUnknown_0203CD90.cursorPos;
|
||||
|
||||
if (deltaX != 0)
|
||||
{
|
||||
if ((gUnknown_0203CD90.cursorPos % gUnknown_0203CD90.horizontalCount) + deltaX < 0)
|
||||
{
|
||||
gUnknown_0203CD90.cursorPos += gUnknown_0203CD90.horizontalCount - 1;
|
||||
}
|
||||
else if ((gUnknown_0203CD90.cursorPos % gUnknown_0203CD90.horizontalCount) + deltaX >= gUnknown_0203CD90.horizontalCount)
|
||||
{
|
||||
gUnknown_0203CD90.cursorPos = (gUnknown_0203CD90.cursorPos / gUnknown_0203CD90.horizontalCount) * gUnknown_0203CD90.horizontalCount;
|
||||
}
|
||||
else
|
||||
{
|
||||
gUnknown_0203CD90.cursorPos += deltaX;
|
||||
}
|
||||
}
|
||||
|
||||
if (deltaY != 0)
|
||||
{
|
||||
if ((gUnknown_0203CD90.cursorPos / gUnknown_0203CD90.horizontalCount) + deltaY < 0)
|
||||
{
|
||||
gUnknown_0203CD90.cursorPos += gUnknown_0203CD90.horizontalCount * (gUnknown_0203CD90.verticalCount - 1);
|
||||
}
|
||||
else if ((gUnknown_0203CD90.cursorPos / gUnknown_0203CD90.horizontalCount) + deltaY >= gUnknown_0203CD90.verticalCount)
|
||||
{
|
||||
gUnknown_0203CD90.cursorPos -= gUnknown_0203CD90.horizontalCount * (gUnknown_0203CD90.verticalCount - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
gUnknown_0203CD90.cursorPos += (gUnknown_0203CD90.horizontalCount * deltaY);
|
||||
}
|
||||
}
|
||||
|
||||
if (gUnknown_0203CD90.cursorPos > gUnknown_0203CD90.maxCursorPos)
|
||||
{
|
||||
gUnknown_0203CD90.cursorPos = oldPos;
|
||||
return gUnknown_0203CD90.cursorPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_8199060(oldPos, gUnknown_0203CD90.cursorPos);
|
||||
return gUnknown_0203CD90.cursorPos;
|
||||
}
|
||||
}
|
||||
|
||||
u8 sub_81991F8(s8 deltaX, s8 deltaY)
|
||||
{
|
||||
u8 oldPos = gUnknown_0203CD90.cursorPos;
|
||||
|
||||
if (deltaX != 0)
|
||||
{
|
||||
if (((gUnknown_0203CD90.cursorPos % gUnknown_0203CD90.horizontalCount) + deltaX >= 0) &&
|
||||
((gUnknown_0203CD90.cursorPos % gUnknown_0203CD90.horizontalCount) + deltaX < gUnknown_0203CD90.horizontalCount))
|
||||
{
|
||||
gUnknown_0203CD90.cursorPos += deltaX;
|
||||
}
|
||||
}
|
||||
|
||||
if (deltaY != 0)
|
||||
{
|
||||
if (((gUnknown_0203CD90.cursorPos / gUnknown_0203CD90.horizontalCount) + deltaY >= 0) &&
|
||||
((gUnknown_0203CD90.cursorPos / gUnknown_0203CD90.horizontalCount) + deltaY < gUnknown_0203CD90.verticalCount))
|
||||
{
|
||||
gUnknown_0203CD90.cursorPos += (gUnknown_0203CD90.horizontalCount * deltaY);
|
||||
}
|
||||
}
|
||||
|
||||
if (gUnknown_0203CD90.cursorPos > gUnknown_0203CD90.maxCursorPos)
|
||||
{
|
||||
gUnknown_0203CD90.cursorPos = oldPos;
|
||||
return gUnknown_0203CD90.cursorPos;
|
||||
}
|
||||
else
|
||||
{
|
||||
sub_8199060(oldPos, gUnknown_0203CD90.cursorPos);
|
||||
return gUnknown_0203CD90.cursorPos;
|
||||
}
|
||||
}
|
||||
|
||||
s8 sub_8199284(void)
|
||||
{
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
return gUnknown_0203CD90.cursorPos;
|
||||
}
|
||||
else if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else if (gMain.newKeys & DPAD_UP)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
sub_8199134(0, -1);
|
||||
return -2;
|
||||
}
|
||||
else if (gMain.newKeys & DPAD_DOWN)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
sub_8199134(0, 1);
|
||||
return -2;
|
||||
}
|
||||
else if (gMain.newKeys & DPAD_LEFT || GetLRKeysState() == 1)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
sub_8199134(-1, 0);
|
||||
return -2;
|
||||
}
|
||||
else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysState() == 2)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
sub_8199134(1, 0);
|
||||
return -2;
|
||||
}
|
||||
|
||||
return -2;
|
||||
}
|
||||
|
||||
s8 sub_8199334(void)
|
||||
{
|
||||
u8 oldPos = gUnknown_0203CD90.cursorPos;
|
||||
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
return gUnknown_0203CD90.cursorPos;
|
||||
}
|
||||
else if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else if (gMain.newKeys & DPAD_UP)
|
||||
{
|
||||
if (oldPos != sub_81991F8(0, -1))
|
||||
PlaySE(SE_SELECT);
|
||||
return -2;
|
||||
}
|
||||
else if (gMain.newKeys & DPAD_DOWN)
|
||||
{
|
||||
if (oldPos != sub_81991F8(0, 1))
|
||||
PlaySE(SE_SELECT);
|
||||
return -2;
|
||||
}
|
||||
else if (gMain.newKeys & DPAD_LEFT || GetLRKeysState() == 1)
|
||||
{
|
||||
if (oldPos != sub_81991F8(-1, 0))
|
||||
PlaySE(SE_SELECT);
|
||||
return -2;
|
||||
}
|
||||
else if (gMain.newKeys & DPAD_RIGHT || GetLRKeysState() == 2)
|
||||
{
|
||||
if (oldPos != sub_81991F8(1, 0))
|
||||
PlaySE(SE_SELECT);
|
||||
return -2;
|
||||
}
|
||||
|
||||
return -2;
|
||||
}
|
||||
|
||||
s8 sub_81993D8(void)
|
||||
{
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
return gUnknown_0203CD90.cursorPos;
|
||||
}
|
||||
else if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
sub_8199134(0, -1);
|
||||
return -2;
|
||||
}
|
||||
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
sub_8199134(0, 1);
|
||||
return -2;
|
||||
}
|
||||
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_LEFT || sub_812210C() == 1)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
sub_8199134(-1, 0);
|
||||
return -2;
|
||||
}
|
||||
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_RIGHT || sub_812210C() == 2)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
sub_8199134(1, 0);
|
||||
return -2;
|
||||
}
|
||||
|
||||
return -2;
|
||||
}
|
||||
|
||||
s8 sub_8199484(void)
|
||||
{
|
||||
u8 oldPos = gUnknown_0203CD90.cursorPos;
|
||||
|
||||
if (gMain.newKeys & A_BUTTON)
|
||||
{
|
||||
PlaySE(SE_SELECT);
|
||||
return gUnknown_0203CD90.cursorPos;
|
||||
}
|
||||
else if (gMain.newKeys & B_BUTTON)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_UP)
|
||||
{
|
||||
if (oldPos != sub_81991F8(0, -1))
|
||||
PlaySE(SE_SELECT);
|
||||
return -2;
|
||||
}
|
||||
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_DOWN)
|
||||
{
|
||||
if (oldPos != sub_81991F8(0, 1))
|
||||
PlaySE(SE_SELECT);
|
||||
return -2;
|
||||
}
|
||||
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_LEFT || sub_812210C() == 1)
|
||||
{
|
||||
if (oldPos != sub_81991F8(-1, 0))
|
||||
PlaySE(SE_SELECT);
|
||||
return -2;
|
||||
}
|
||||
else if ((gMain.newAndRepeatedKeys & DPAD_ANY) == DPAD_RIGHT || sub_812210C() == 2)
|
||||
{
|
||||
if (oldPos != sub_81991F8(1, 0))
|
||||
PlaySE(SE_SELECT);
|
||||
return -2;
|
||||
}
|
||||
|
||||
return -2;
|
||||
}
|
||||
|
||||
u8 InitMenuInUpperLeftCorner(u8 windowId, u8 itemCount, u8 initialCursorPos, bool8 APressMuted)
|
||||
{
|
||||
s32 pos;
|
||||
|
||||
gUnknown_0203CD90.left = 0;
|
||||
gUnknown_0203CD90.top = 1;
|
||||
gUnknown_0203CD90.minCursorPos = 0;
|
||||
gUnknown_0203CD90.maxCursorPos = itemCount - 1;
|
||||
gUnknown_0203CD90.windowId = windowId;
|
||||
gUnknown_0203CD90.fontId = 1;
|
||||
gUnknown_0203CD90.optionHeight = 16;
|
||||
gUnknown_0203CD90.APressMuted = APressMuted;
|
||||
|
||||
pos = initialCursorPos;
|
||||
|
||||
if (pos < 0 || pos > gUnknown_0203CD90.maxCursorPos)
|
||||
gUnknown_0203CD90.cursorPos = 0;
|
||||
else
|
||||
gUnknown_0203CD90.cursorPos = pos;
|
||||
|
||||
return MoveMenuCursor(0);
|
||||
}
|
||||
|
||||
u8 InitMenuInUpperLeftCornerPlaySoundWhenAPressed(u8 windowId, u8 itemCount, u8 initialCursorPos)
|
||||
{
|
||||
return InitMenuInUpperLeftCorner(windowId, itemCount, initialCursorPos, FALSE);
|
||||
}
|
||||
|
||||
void PrintMenuTable(u8 windowId, u8 itemCount, const struct MenuAction *strs)
|
||||
{
|
||||
u32 i;
|
||||
|
||||
for (i = 0; i < itemCount; i++)
|
||||
{
|
||||
PrintTextOnWindow(windowId, 1, strs[i].text, 8, (i * 16) + 1, 0xFF, NULL);
|
||||
}
|
||||
|
||||
CopyWindowToVram(windowId, 2);
|
||||
}
|
||||
|
||||
void sub_81995E4(u8 windowId, u8 itemCount, const struct MenuAction *strs, const u8 *a8)
|
||||
{
|
||||
u8 i;
|
||||
struct TextSubPrinter printer;
|
||||
|
||||
printer.windowId = windowId;
|
||||
printer.fontId = 1;
|
||||
printer.fgColor = GetFontAttribute(1, 5);
|
||||
printer.bgColor = GetFontAttribute(1, 6);
|
||||
printer.shadowColor = GetFontAttribute(1, 7);
|
||||
printer.fontColor_l = GetFontAttribute(1, 4);
|
||||
printer.letterSpacing = 0;
|
||||
printer.lineSpacing = 0;
|
||||
printer.x = 8;
|
||||
printer.currentX = 8;
|
||||
|
||||
for (i = 0; i < itemCount; i++)
|
||||
{
|
||||
printer.current_text_offset = strs[a8[i]].text;
|
||||
printer.y = (i * 16) + 1;
|
||||
printer.currentY = (i * 16) + 1;
|
||||
AddTextPrinter(&printer, 0xFF, 0);
|
||||
}
|
||||
|
||||
CopyWindowToVram(windowId, 2);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user