mirror of
https://github.com/Ninjdai1/pokeemerald.git
synced 2024-12-24 10:44:16 +01:00
through sub_8120748
This commit is contained in:
parent
cae0fb8ec2
commit
0bc7759f9b
@ -9243,8 +9243,8 @@ _0811EA68:
|
||||
bx r1
|
||||
thumb_func_end sub_811EA28
|
||||
|
||||
thumb_func_start start_menu_is_selected_item_valid
|
||||
start_menu_is_selected_item_valid: @ 811EA6C
|
||||
thumb_func_start EasyChat_GetNumWordsInGroup
|
||||
EasyChat_GetNumWordsInGroup: @ 811EA6C
|
||||
push {r4,lr}
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
@ -9273,7 +9273,7 @@ _0811EA9A:
|
||||
pop {r1}
|
||||
bx r1
|
||||
.pool
|
||||
thumb_func_end start_menu_is_selected_item_valid
|
||||
thumb_func_end EasyChat_GetNumWordsInGroup
|
||||
|
||||
thumb_func_start sub_811EAA4
|
||||
sub_811EAA4: @ 811EAA4
|
||||
@ -10145,7 +10145,7 @@ sub_811F0F8: @ 811F0F8
|
||||
sub_811F108: @ 811F108
|
||||
push {r4-r7,lr}
|
||||
movs r0, 0
|
||||
bl start_menu_is_selected_item_valid
|
||||
bl EasyChat_GetNumWordsInGroup
|
||||
lsls r0, 16
|
||||
lsrs r4, r0, 16
|
||||
cmp r4, 0
|
||||
|
@ -5,565 +5,6 @@
|
||||
|
||||
.text
|
||||
|
||||
thumb_func_start sub_81204DC
|
||||
sub_81204DC: @ 81204DC
|
||||
push {r4-r7,lr}
|
||||
mov r7, r10
|
||||
mov r6, r9
|
||||
mov r5, r8
|
||||
push {r5-r7}
|
||||
sub sp, 0x1C
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r4, [r0]
|
||||
ldr r0, =0x00002e28
|
||||
adds r0, r4, r0
|
||||
str r0, [sp, 0x18]
|
||||
ldr r1, =gUnknown_0859F030
|
||||
mov r0, sp
|
||||
movs r2, 0x18
|
||||
bl memcpy
|
||||
movs r5, 0
|
||||
movs r1, 0x2
|
||||
add r1, sp
|
||||
mov r8, r1
|
||||
movs r2, 0xB9
|
||||
lsls r2, 6
|
||||
adds r3, r4, r2
|
||||
adds r1, r3, 0
|
||||
_0812050C:
|
||||
adds r0, r3, r5
|
||||
strb r5, [r0]
|
||||
adds r0, r5, 0x1
|
||||
lsls r0, 16
|
||||
lsrs r5, r0, 16
|
||||
cmp r5, 0x7
|
||||
bls _0812050C
|
||||
movs r5, 0
|
||||
ldr r3, [sp, 0x18]
|
||||
adds r3, 0x4
|
||||
mov r9, r3
|
||||
adds r6, r1, 0
|
||||
_08120524:
|
||||
bl Random
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
adds r4, r5, 0x1
|
||||
adds r1, r4, 0
|
||||
bl __modsi3
|
||||
lsls r0, 16
|
||||
lsrs r1, r0, 16
|
||||
adds r2, r6, r5
|
||||
ldrb r7, [r2]
|
||||
adds r1, r6, r1
|
||||
ldrb r0, [r1]
|
||||
strb r0, [r2]
|
||||
strb r7, [r1]
|
||||
lsls r4, 16
|
||||
lsrs r5, r4, 16
|
||||
cmp r5, 0x7
|
||||
bls _08120524
|
||||
movs r0, 0
|
||||
mov r10, r0
|
||||
movs r5, 0
|
||||
_08120552:
|
||||
lsls r4, r5, 2
|
||||
mov r1, sp
|
||||
adds r0, r1, r4
|
||||
ldrb r0, [r0]
|
||||
bl start_menu_is_selected_item_valid
|
||||
add r4, r8
|
||||
strh r0, [r4]
|
||||
add r0, r10
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
mov r10, r0
|
||||
adds r0, r5, 0x1
|
||||
lsls r0, 16
|
||||
lsrs r5, r0, 16
|
||||
cmp r5, 0x5
|
||||
bls _08120552
|
||||
movs r0, 0
|
||||
ldr r2, [sp, 0x18]
|
||||
strb r0, [r2, 0x2]
|
||||
movs r7, 0
|
||||
movs r5, 0
|
||||
_0812057E:
|
||||
bl Random
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
movs r1, 0xA
|
||||
bl __umodsi3
|
||||
lsls r0, 16
|
||||
lsrs r1, r0, 16
|
||||
cmp r1, 0x2
|
||||
bhi _081205BC
|
||||
cmp r7, 0x7
|
||||
bhi _081205BC
|
||||
lsls r0, r5, 1
|
||||
add r0, r9
|
||||
ldr r1, =0x0000ffff
|
||||
strh r1, [r0]
|
||||
adds r0, r7, 0x1
|
||||
lsls r0, 16
|
||||
lsrs r7, r0, 16
|
||||
adds r4, r5, 0x1
|
||||
b _0812060E
|
||||
.pool
|
||||
_081205BC:
|
||||
bl Random
|
||||
lsls r0, 16
|
||||
lsrs r0, 16
|
||||
mov r1, r10
|
||||
bl __umodsi3
|
||||
lsls r0, 16
|
||||
lsrs r2, r0, 16
|
||||
movs r1, 0
|
||||
adds r4, r5, 0x1
|
||||
lsls r6, r5, 1
|
||||
cmp r5, 0x5
|
||||
bhi _081205F8
|
||||
mov r3, r8
|
||||
ldrh r0, [r3]
|
||||
b _081205EE
|
||||
_081205DE:
|
||||
adds r0, r1, 0x1
|
||||
lsls r0, 16
|
||||
lsrs r1, r0, 16
|
||||
cmp r5, 0x5
|
||||
bhi _081205F8
|
||||
lsls r0, r1, 2
|
||||
adds r0, r3, r0
|
||||
ldrh r0, [r0]
|
||||
_081205EE:
|
||||
subs r0, r2, r0
|
||||
lsls r0, 16
|
||||
lsrs r2, r0, 16
|
||||
cmp r0, 0
|
||||
bgt _081205DE
|
||||
_081205F8:
|
||||
cmp r1, 0x6
|
||||
bne _081205FE
|
||||
movs r1, 0
|
||||
_081205FE:
|
||||
lsls r0, r1, 2
|
||||
add r0, sp
|
||||
ldrh r0, [r0]
|
||||
bl sub_811EE90
|
||||
mov r2, r9
|
||||
adds r1, r2, r6
|
||||
strh r0, [r1]
|
||||
_0812060E:
|
||||
lsls r0, r4, 16
|
||||
lsrs r5, r0, 16
|
||||
cmp r5, 0x9
|
||||
bls _0812057E
|
||||
add sp, 0x1C
|
||||
pop {r3-r5}
|
||||
mov r8, r3
|
||||
mov r9, r4
|
||||
mov r10, r5
|
||||
pop {r4-r7}
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_81204DC
|
||||
|
||||
thumb_func_start sub_8120628
|
||||
sub_8120628: @ 8120628
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r0, [r0]
|
||||
ldr r1, =0x00002e51
|
||||
adds r0, r1
|
||||
movs r1, 0
|
||||
strb r1, [r0]
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end sub_8120628
|
||||
|
||||
thumb_func_start sub_8120640
|
||||
sub_8120640: @ 8120640
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r0, [r0]
|
||||
ldr r1, =0x00002e28
|
||||
adds r0, r1
|
||||
movs r1, 0
|
||||
strb r1, [r0, 0x1]
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end sub_8120640
|
||||
|
||||
thumb_func_start sub_8120658
|
||||
sub_8120658: @ 8120658
|
||||
push {lr}
|
||||
bl sub_8133A60
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_8120658
|
||||
|
||||
thumb_func_start sub_8120664
|
||||
sub_8120664: @ 8120664
|
||||
push {lr}
|
||||
bl sub_8120E50
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_8120664
|
||||
|
||||
thumb_func_start sub_8120670
|
||||
sub_8120670: @ 8120670
|
||||
push {lr}
|
||||
bl sub_81201C8
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x4
|
||||
bhi _081206B6
|
||||
lsls r0, 2
|
||||
ldr r1, =_0812068C
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
mov pc, r0
|
||||
.pool
|
||||
.align 2, 0
|
||||
_0812068C:
|
||||
.4byte _081206A0
|
||||
.4byte _081206A6
|
||||
.4byte _081206B2
|
||||
.4byte _081206AC
|
||||
.4byte _081206B6
|
||||
_081206A0:
|
||||
bl sub_8120628
|
||||
b _081206B6
|
||||
_081206A6:
|
||||
bl sub_8120640
|
||||
b _081206B6
|
||||
_081206AC:
|
||||
bl sub_8120664
|
||||
b _081206B6
|
||||
_081206B2:
|
||||
bl sub_8120658
|
||||
_081206B6:
|
||||
bl sub_8120B5C
|
||||
pop {r0}
|
||||
bx r0
|
||||
thumb_func_end sub_8120670
|
||||
|
||||
thumb_func_start sub_81206C0
|
||||
sub_81206C0: @ 81206C0
|
||||
push {r4,lr}
|
||||
adds r4, r0, 0
|
||||
lsls r4, 24
|
||||
lsrs r4, 24
|
||||
ldr r0, =sub_8120944
|
||||
movs r1, 0x50
|
||||
bl CreateTask
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
ldr r2, =gTasks
|
||||
lsls r1, r0, 2
|
||||
adds r1, r0
|
||||
lsls r1, 3
|
||||
adds r1, r2
|
||||
strh r4, [r1, 0x12]
|
||||
pop {r4}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_81206C0
|
||||
|
||||
thumb_func_start sub_81206F0
|
||||
sub_81206F0: @ 81206F0
|
||||
ldr r1, =gUnknown_03002F84
|
||||
movs r0, 0
|
||||
strb r0, [r1]
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end sub_81206F0
|
||||
|
||||
thumb_func_start sub_81206FC
|
||||
sub_81206FC: @ 81206FC
|
||||
ldr r1, =gUnknown_03002F84
|
||||
movs r0, 0x1
|
||||
strb r0, [r1]
|
||||
bx lr
|
||||
.pool
|
||||
thumb_func_end sub_81206FC
|
||||
|
||||
thumb_func_start sub_8120708
|
||||
sub_8120708: @ 8120708
|
||||
push {r4,r5,lr}
|
||||
sub sp, 0xC
|
||||
adds r5, r0, 0
|
||||
movs r0, 0
|
||||
movs r1, 0
|
||||
bl NewMenuHelpers_DrawDialogueFrame
|
||||
movs r4, 0x1
|
||||
str r4, [sp]
|
||||
str r4, [sp, 0x4]
|
||||
ldr r0, =sub_81206FC
|
||||
str r0, [sp, 0x8]
|
||||
movs r0, 0
|
||||
movs r1, 0x1
|
||||
adds r2, r5, 0
|
||||
movs r3, 0
|
||||
bl PrintTextOnWindow
|
||||
ldr r0, =gUnknown_03002F84
|
||||
strb r4, [r0]
|
||||
movs r0, 0
|
||||
movs r1, 0x3
|
||||
bl CopyWindowToVram
|
||||
add sp, 0xC
|
||||
pop {r4,r5}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_8120708
|
||||
|
||||
thumb_func_start sub_8120748
|
||||
sub_8120748: @ 8120748
|
||||
push {r4-r6,lr}
|
||||
adds r6, r1, 0
|
||||
movs r1, 0x8
|
||||
ldrsh r0, [r0, r1]
|
||||
cmp r0, 0x5
|
||||
bls _08120756
|
||||
b _08120938
|
||||
_08120756:
|
||||
lsls r0, 2
|
||||
ldr r1, =_08120764
|
||||
adds r0, r1
|
||||
ldr r0, [r0]
|
||||
mov pc, r0
|
||||
.pool
|
||||
.align 2, 0
|
||||
_08120764:
|
||||
.4byte _0812077C
|
||||
.4byte _08120938
|
||||
.4byte _081207BC
|
||||
.4byte _081207F8
|
||||
.4byte _081207F8
|
||||
.4byte _08120938
|
||||
_0812077C:
|
||||
ldr r0, =gSaveBlock1Ptr
|
||||
ldr r2, [r0]
|
||||
ldr r0, =gSpecialVar_0x8004
|
||||
ldrh r0, [r0]
|
||||
ldr r3, =0x00002e36
|
||||
adds r1, r2, r3
|
||||
cmp r0, 0
|
||||
bne _08120790
|
||||
ldr r0, =0x00002e2a
|
||||
adds r1, r2, r0
|
||||
_08120790:
|
||||
adds r2, r1, 0
|
||||
adds r1, r6, 0
|
||||
adds r1, 0xC
|
||||
movs r3, 0x5
|
||||
_08120798:
|
||||
ldrh r0, [r2]
|
||||
strh r0, [r1]
|
||||
adds r2, 0x2
|
||||
adds r1, 0x2
|
||||
subs r3, 0x1
|
||||
cmp r3, 0
|
||||
bge _08120798
|
||||
movs r0, 0
|
||||
strb r0, [r6]
|
||||
b _08120938
|
||||
.pool
|
||||
_081207BC:
|
||||
ldrb r1, [r6]
|
||||
lsls r1, 1
|
||||
adds r0, r6, 0
|
||||
adds r0, 0xC
|
||||
adds r0, r1
|
||||
ldrh r4, [r0]
|
||||
adds r0, r4, 0
|
||||
bl GetWordSounds
|
||||
str r0, [r6, 0x30]
|
||||
movs r1, 0x3
|
||||
ands r1, r4
|
||||
lsrs r4, 3
|
||||
movs r0, 0x1
|
||||
ands r4, r0
|
||||
adds r1, r4
|
||||
adds r0, r6, 0
|
||||
bl GetWordPhonemes
|
||||
ldrb r0, [r6]
|
||||
adds r0, 0x1
|
||||
strb r0, [r6]
|
||||
ldr r0, [r6, 0x30]
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0xFF
|
||||
beq _081207F4
|
||||
movs r0, 0
|
||||
b _08120936
|
||||
_081207F4:
|
||||
movs r0, 0x3
|
||||
b _0812091A
|
||||
_081207F8:
|
||||
ldrb r3, [r6, 0x1]
|
||||
lsls r1, r3, 3
|
||||
ldr r0, [r6, 0x30]
|
||||
adds r2, r0, r1
|
||||
ldrb r1, [r6, 0x3]
|
||||
cmp r1, 0x1
|
||||
beq _081208A0
|
||||
cmp r1, 0x1
|
||||
bgt _08120810
|
||||
cmp r1, 0
|
||||
beq _0812081C
|
||||
b _08120938
|
||||
_08120810:
|
||||
cmp r1, 0x2
|
||||
beq _08120850
|
||||
cmp r1, 0x3
|
||||
bne _0812081A
|
||||
b _08120922
|
||||
_0812081A:
|
||||
b _08120938
|
||||
_0812081C:
|
||||
lsls r0, r3, 2
|
||||
adds r0, r6, r0
|
||||
ldrh r0, [r0, 0x18]
|
||||
strb r0, [r6, 0x2]
|
||||
ldrb r0, [r2]
|
||||
cmp r0, 0x32
|
||||
bhi _08120844
|
||||
movs r1, 0x3
|
||||
bl __udivsi3
|
||||
adds r1, r0, 0
|
||||
lsls r1, 24
|
||||
lsrs r1, 24
|
||||
lsls r0, r1, 1
|
||||
adds r0, r1
|
||||
movs r1, 0x8C
|
||||
lsls r1, 2
|
||||
adds r0, r1
|
||||
bl m4aSongNumStart
|
||||
_08120844:
|
||||
movs r0, 0x2
|
||||
strb r0, [r6, 0x3]
|
||||
ldrb r0, [r6, 0x2]
|
||||
subs r0, 0x1
|
||||
strb r0, [r6, 0x2]
|
||||
b _08120938
|
||||
_08120850:
|
||||
movs r0, 0x1
|
||||
strb r0, [r6, 0x3]
|
||||
ldrb r0, [r2]
|
||||
cmp r0, 0x32
|
||||
bhi _08120938
|
||||
movs r3, 0x4
|
||||
ldrsh r0, [r2, r3]
|
||||
lsls r0, 4
|
||||
movs r1, 0x80
|
||||
lsls r1, 1
|
||||
adds r0, r1
|
||||
strh r0, [r6, 0x6]
|
||||
ldr r4, =gMPlayInfo_SE2
|
||||
ldr r5, =0x0000ffff
|
||||
ldrh r2, [r6, 0x6]
|
||||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
bl m4aMPlayVolumeControl
|
||||
ldrb r1, [r6, 0x1]
|
||||
lsls r1, 2
|
||||
adds r1, r6, r1
|
||||
movs r2, 0x80
|
||||
lsls r2, 2
|
||||
adds r0, r2, 0
|
||||
ldrh r1, [r1, 0x1A]
|
||||
adds r0, r1
|
||||
strh r0, [r6, 0x8]
|
||||
movs r3, 0x8
|
||||
ldrsh r2, [r6, r3]
|
||||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
bl m4aMPlayPitchControl
|
||||
b _08120938
|
||||
.pool
|
||||
_081208A0:
|
||||
ldrh r2, [r6, 0xA]
|
||||
movs r3, 0xA
|
||||
ldrsh r0, [r6, r3]
|
||||
cmp r0, 0xA
|
||||
ble _081208B0
|
||||
ldrh r0, [r6, 0x6]
|
||||
subs r0, 0x2
|
||||
strh r0, [r6, 0x6]
|
||||
_081208B0:
|
||||
ands r1, r2
|
||||
cmp r1, 0
|
||||
beq _081208BC
|
||||
ldrh r0, [r6, 0x8]
|
||||
adds r0, 0x40
|
||||
b _081208C0
|
||||
_081208BC:
|
||||
ldrh r0, [r6, 0x8]
|
||||
subs r0, 0x40
|
||||
_081208C0:
|
||||
strh r0, [r6, 0x8]
|
||||
ldr r4, =gMPlayInfo_SE2
|
||||
ldr r5, =0x0000ffff
|
||||
ldrh r2, [r6, 0x6]
|
||||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
bl m4aMPlayVolumeControl
|
||||
movs r0, 0x8
|
||||
ldrsh r2, [r6, r0]
|
||||
adds r0, r4, 0
|
||||
adds r1, r5, 0
|
||||
bl m4aMPlayPitchControl
|
||||
ldrh r0, [r6, 0xA]
|
||||
adds r0, 0x1
|
||||
strh r0, [r6, 0xA]
|
||||
ldrb r0, [r6, 0x2]
|
||||
subs r0, 0x1
|
||||
strb r0, [r6, 0x2]
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08120938
|
||||
ldrb r0, [r6, 0x1]
|
||||
adds r0, 0x1
|
||||
strb r0, [r6, 0x1]
|
||||
lsls r0, 24
|
||||
lsrs r0, 24
|
||||
cmp r0, 0x6
|
||||
beq _08120918
|
||||
ldrb r0, [r6, 0x1]
|
||||
ldr r1, [r6, 0x30]
|
||||
lsls r0, 3
|
||||
adds r0, r1
|
||||
ldrb r0, [r0]
|
||||
cmp r0, 0xFF
|
||||
beq _08120918
|
||||
movs r0, 0
|
||||
b _08120936
|
||||
.pool
|
||||
_08120918:
|
||||
movs r0, 0x3
|
||||
_0812091A:
|
||||
strb r0, [r6, 0x3]
|
||||
movs r0, 0x2
|
||||
strb r0, [r6, 0x2]
|
||||
b _08120938
|
||||
_08120922:
|
||||
ldrb r0, [r6, 0x2]
|
||||
subs r0, 0x1
|
||||
strb r0, [r6, 0x2]
|
||||
lsls r0, 24
|
||||
cmp r0, 0
|
||||
bne _08120938
|
||||
ldr r0, =gMPlayInfo_SE2
|
||||
bl m4aMPlayStop
|
||||
movs r0, 0x4
|
||||
_08120936:
|
||||
strb r0, [r6, 0x3]
|
||||
_08120938:
|
||||
pop {r4-r6}
|
||||
pop {r0}
|
||||
bx r0
|
||||
.pool
|
||||
thumb_func_end sub_8120748
|
||||
|
||||
thumb_func_start sub_8120944
|
||||
sub_8120944: @ 8120944
|
||||
push {r4-r7,lr}
|
||||
|
@ -4,9 +4,6 @@
|
||||
.section .rodata
|
||||
.align 2, 0
|
||||
|
||||
gUnknown_0859F030:: @ 859F030
|
||||
.4byte 0, 12, 13, 18, 19, 21
|
||||
|
||||
gUnknown_0859F048:: @ 859F048
|
||||
.4byte 0x00000132, MauvilleCity_PokemonCenter_1F_Text_28E930, MauvilleCity_PokemonCenter_1F_Text_28E947, MauvilleCity_PokemonCenter_1F_Text_28E956, 0x00000102, MauvilleCity_PokemonCenter_1F_Text_28E9D7, MauvilleCity_PokemonCenter_1F_Text_28E9EF, MauvilleCity_PokemonCenter_1F_Text_28E9FE
|
||||
.4byte 0x00000103, MauvilleCity_PokemonCenter_1F_Text_28EA7D, MauvilleCity_PokemonCenter_1F_Text_28EA98, MauvilleCity_PokemonCenter_1F_Text_28EAA8, 0x00000104, MauvilleCity_PokemonCenter_1F_Text_28EB19, MauvilleCity_PokemonCenter_1F_Text_28EB31, MauvilleCity_PokemonCenter_1F_Text_28EB3E
|
||||
|
@ -9,7 +9,7 @@ struct BardSound
|
||||
/*0x00*/ u8 var00;
|
||||
/*0x01*/ s8 var01;
|
||||
/*0x02*/ u16 var02;
|
||||
/*0x04*/ u16 volume;
|
||||
/*0x04*/ s16 volume;
|
||||
/*0x06*/ u16 var06;
|
||||
};
|
||||
|
||||
@ -39,5 +39,7 @@ struct BardSong
|
||||
// Exported ROM declarations
|
||||
|
||||
extern const u16 gUnknown_085F5490;
|
||||
const struct BardSound *GetWordSounds(u16 word);
|
||||
void GetWordPhonemes(struct BardSong *song, u16 word);
|
||||
|
||||
#endif //GUARD_BARD_MUSIC_H
|
||||
|
@ -10,5 +10,7 @@ void ConvertEasyChatWordsToString(u8 *dest, const u16 *src, u16 length1, u16 len
|
||||
bool8 ECWord_CheckIfOutsideOfValidRange(u16 word);
|
||||
u16 sub_811EE38(u16 group);
|
||||
u16 sub_811F01C(void);
|
||||
bool16 EasyChat_GetNumWordsInGroup(u8);
|
||||
u16 sub_811EE90(u16);
|
||||
|
||||
#endif // GUARD_EASYCHAT_H
|
||||
|
@ -9,14 +9,24 @@
|
||||
#include "script.h"
|
||||
#include "random.h"
|
||||
#include "event_scripts.h"
|
||||
#include "task.h"
|
||||
#include "menu.h"
|
||||
#include "m4a.h"
|
||||
#include "bard_music.h"
|
||||
#include "constants/songs.h"
|
||||
|
||||
#define CHAR_SONG_WORD_SEPARATOR 0x37
|
||||
|
||||
void sub_8120E08(void); // StorytellerSetup
|
||||
void sub_81339F8(void); // TraderSetup
|
||||
void sub_8120B5C(void);
|
||||
void sub_81206C0(u8 a0); // StartBardSong
|
||||
extern struct MusicPlayerInfo gMPlayInfo_SE2;
|
||||
|
||||
void sub_81204DC(void);
|
||||
void sub_81206C0(bool8 useTemporaryLyrics); // StartBardSong
|
||||
void sub_8120944(u8 taskId);
|
||||
void sub_8120B5C(void);
|
||||
void sub_8120E08(void); // StorytellerSetup
|
||||
void sub_8120E50(void);
|
||||
void sub_81339F8(void); // TraderSetup
|
||||
void sub_8133A60(void);
|
||||
|
||||
static const u16 sDefaultBardSongLyrics[6] = {
|
||||
EC_WORD_SHAKE,
|
||||
@ -289,3 +299,241 @@ void sub_81203FC(void) // ScrSpecial_GenerateGiddyLine
|
||||
|
||||
gSpecialVar_Result = TRUE;
|
||||
}
|
||||
|
||||
void sub_81204DC(void)
|
||||
{
|
||||
struct MauvilleManGiddy *giddy = &gSaveBlock1Ptr->oldMan.giddy;
|
||||
u16 arr[][2] = {
|
||||
{EC_GROUP_POKEMON, 0},
|
||||
{EC_GROUP_LIFESTYLE, 0},
|
||||
{EC_GROUP_HOBBIES, 0},
|
||||
{EC_GROUP_MOVE_1, 0},
|
||||
{EC_GROUP_MOVE_2, 0},
|
||||
{EC_GROUP_POKEMON_2, 0}
|
||||
};
|
||||
u16 i;
|
||||
u16 r10;
|
||||
u16 r7;
|
||||
u16 r1;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
giddy->questionList[i] = i;
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
{
|
||||
r1 = Random() % (i + 1);
|
||||
r7 = giddy->questionList[i];
|
||||
giddy->questionList[i] = giddy->questionList[r1];
|
||||
giddy->questionList[r1] = r7;
|
||||
}
|
||||
|
||||
r10 = 0;
|
||||
for (i = 0; i < 6; i++)
|
||||
{
|
||||
arr[i][1] = EasyChat_GetNumWordsInGroup(arr[i][0]);
|
||||
r10 += arr[i][1];
|
||||
}
|
||||
|
||||
giddy->questionNum = 0;
|
||||
r7 = 0;
|
||||
for (i = 0; i < 10; i++)
|
||||
{
|
||||
r1 = Random() % 10;
|
||||
if (r1 < 3 && r7 < 8)
|
||||
{
|
||||
giddy->randomWords[i] = 0xFFFF;
|
||||
r7++;
|
||||
}
|
||||
else
|
||||
{
|
||||
s16 r2 = Random() % r10;
|
||||
for (r1 = 0; i < 6; r1++)
|
||||
if ((r2 -= arr[r1][1]) <= 0)
|
||||
break;
|
||||
if (r1 == 6)
|
||||
r1 = 0;
|
||||
giddy->randomWords[i] = sub_811EE90(arr[r1][0]);
|
||||
}
|
||||
}
|
||||
}
|
||||
void sub_8120628(void)
|
||||
{
|
||||
struct MauvilleManBard *bard = &gSaveBlock1Ptr->oldMan.bard;
|
||||
|
||||
bard->hasChangedSong = FALSE;
|
||||
}
|
||||
|
||||
void sub_8120640(void)
|
||||
{
|
||||
struct MauvilleManHipster *hipster = &gSaveBlock1Ptr->oldMan.hipster;
|
||||
|
||||
hipster->alreadySpoken = FALSE;
|
||||
}
|
||||
|
||||
void sub_8120658(void)
|
||||
{
|
||||
sub_8133A60();
|
||||
}
|
||||
|
||||
void sub_8120664(void)
|
||||
{
|
||||
sub_8120E50();
|
||||
}
|
||||
|
||||
void sub_8120670(void) // ResetMauvilleOldManFlag
|
||||
{
|
||||
switch (sub_81201C8())
|
||||
{
|
||||
case MAUVILLE_MAN_BARD:
|
||||
sub_8120628();
|
||||
break;
|
||||
case MAUVILLE_MAN_HIPSTER:
|
||||
sub_8120640();
|
||||
break;
|
||||
case MAUVILLE_MAN_STORYTELLER:
|
||||
sub_8120664();
|
||||
break;
|
||||
case MAUVILLE_MAN_TRADER:
|
||||
sub_8120658();
|
||||
break;
|
||||
case MAUVILLE_MAN_GIDDY:
|
||||
break;
|
||||
}
|
||||
sub_8120B5C();
|
||||
}
|
||||
|
||||
|
||||
#define tState data[0]
|
||||
#define tCharIndex data[3]
|
||||
#define tCurrWord data[4]
|
||||
#define tUseTemporaryLyrics data[5]
|
||||
|
||||
#define MACRO1(a) (((a) & 3) + (((a) / 8) & 1))
|
||||
|
||||
void sub_81206C0(bool8 useTemporaryLyrics)
|
||||
{
|
||||
u8 taskId = CreateTask(sub_8120944, 80);
|
||||
|
||||
gTasks[taskId].tUseTemporaryLyrics = useTemporaryLyrics;
|
||||
}
|
||||
|
||||
void sub_81206F0(struct TextSubPrinter * printer, u16 a1)
|
||||
{
|
||||
gUnknown_03002F84 = FALSE;
|
||||
}
|
||||
|
||||
void sub_81206FC(struct TextSubPrinter * printer, u16 a1)
|
||||
{
|
||||
gUnknown_03002F84 = TRUE;
|
||||
}
|
||||
|
||||
void sub_8120708(const u8 * src)
|
||||
{
|
||||
NewMenuHelpers_DrawDialogueFrame(0, 0);
|
||||
PrintTextOnWindow(0, 1, src, 0, 1, 1, sub_81206FC);
|
||||
gUnknown_03002F84 = TRUE;
|
||||
CopyWindowToVram(0, 3);
|
||||
}
|
||||
|
||||
void sub_8120748(struct Task *task, struct BardSong *song)
|
||||
{
|
||||
switch (task->tState)
|
||||
{
|
||||
case 0: // Initialize song
|
||||
{
|
||||
struct MauvilleManBard *bard = &gSaveBlock1Ptr->oldMan.bard;
|
||||
u16 *lyrics;
|
||||
s32 i;
|
||||
|
||||
// Copy lyrics
|
||||
if (gSpecialVar_0x8004 == 0)
|
||||
lyrics = bard->songLyrics;
|
||||
else
|
||||
lyrics = bard->temporaryLyrics;
|
||||
for (i = 0; i < 6; i++)
|
||||
song->lyrics[i] = lyrics[i];
|
||||
song->currWord = 0;
|
||||
}
|
||||
break;
|
||||
case 1: // Wait for BGM to end
|
||||
break;
|
||||
case 2: // Initialize word
|
||||
{
|
||||
u16 word = song->lyrics[song->currWord];
|
||||
song->sound = GetWordSounds(word);
|
||||
GetWordPhonemes(song, MACRO1(word));
|
||||
song->currWord++;
|
||||
if (song->sound->var00 != 0xFF)
|
||||
song->state = 0;
|
||||
else
|
||||
{
|
||||
song->state = 3;
|
||||
song->phonemeTimer = 2;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case 3:
|
||||
case 4:
|
||||
{
|
||||
const struct BardSound *sound = &song->sound[song->currPhoneme];
|
||||
|
||||
switch (song->state)
|
||||
{
|
||||
case 0:
|
||||
song->phonemeTimer = song->phonemes[song->currPhoneme].length;
|
||||
if (sound->var00 <= 50)
|
||||
{
|
||||
u8 num = sound->var00 / 3;
|
||||
m4aSongNumStart(PH_TRAP_HELD + 3 * num);
|
||||
}
|
||||
song->state = 2;
|
||||
song->phonemeTimer--;
|
||||
break;
|
||||
case 2:
|
||||
song->state = 1;
|
||||
if (sound->var00 <= 50)
|
||||
{
|
||||
song->volume = 0x100 + sound->volume * 16;
|
||||
m4aMPlayVolumeControl(&gMPlayInfo_SE2, 0xFFFF, song->volume);
|
||||
song->pitch = 0x200 + song->phonemes[song->currPhoneme].pitch;
|
||||
m4aMPlayPitchControl(&gMPlayInfo_SE2, 0xFFFF, song->pitch);
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
if (song->voiceInflection > 10)
|
||||
song->volume -= 2;
|
||||
if (song->voiceInflection & 1)
|
||||
song->pitch += 64;
|
||||
else
|
||||
song->pitch -= 64;
|
||||
m4aMPlayVolumeControl(&gMPlayInfo_SE2, 0xFFFF, song->volume);
|
||||
m4aMPlayPitchControl(&gMPlayInfo_SE2, 0xFFFF, song->pitch);
|
||||
song->voiceInflection++;
|
||||
song->phonemeTimer--;
|
||||
if (song->phonemeTimer == 0)
|
||||
{
|
||||
song->currPhoneme++;
|
||||
if (song->currPhoneme != 6 && song->sound[song->currPhoneme].var00 != 0xFF)
|
||||
song->state = 0;
|
||||
else
|
||||
{
|
||||
song->state = 3;
|
||||
song->phonemeTimer = 2;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
song->phonemeTimer--;
|
||||
if (song->phonemeTimer == 0)
|
||||
{
|
||||
m4aMPlayStop(&gMPlayInfo_SE2);
|
||||
song->state = 4;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user