diff --git a/asm/easy_chat.s b/asm/easy_chat.s index 0cbe1f1ae..7f2a7ca88 100644 --- a/asm/easy_chat.s +++ b/asm/easy_chat.s @@ -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 diff --git a/asm/mauville_old_man.s b/asm/mauville_old_man.s deleted file mode 100644 index 924e35b89..000000000 --- a/asm/mauville_old_man.s +++ /dev/null @@ -1,2519 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_81200A0 -sub_81200A0: @ 81200A0 - push {r4,lr} - ldr r0, =gSaveBlock1Ptr - ldr r2, [r0] - ldr r1, =0x00002e28 - adds r0, r2, r1 - movs r1, 0 - strb r1, [r0] - ldr r3, =0x00002e51 - adds r0, r2, r3 - strb r1, [r0] - ldr r0, =gGameLanguage - ldrb r1, [r0] - adds r3, 0x1 - adds r0, r2, r3 - strb r1, [r0] - movs r3, 0 - ldr r0, =0x00002e2a - adds r2, r0 - ldr r4, =gUnknown_0859EFE4 -_081200C6: - lsls r0, r3, 1 - adds r1, r2, r0 - adds r0, r4 - ldrh r0, [r0] - strh r0, [r1] - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - cmp r3, 0x5 - bls _081200C6 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81200A0 - - thumb_func_start sub_81200F8 -sub_81200F8: @ 81200F8 - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldr r0, =0x00002e28 - adds r1, r0 - movs r2, 0 - movs r0, 0x1 - strb r0, [r1] - strb r2, [r1, 0x1] - ldr r0, =gGameLanguage - ldrb r0, [r0] - strb r0, [r1, 0x2] - bx lr - .pool - thumb_func_end sub_81200F8 - - thumb_func_start sub_812011C -sub_812011C: @ 812011C - push {lr} - bl sub_8120E08 - pop {r0} - bx r0 - thumb_func_end sub_812011C - - thumb_func_start sub_8120128 -sub_8120128: @ 8120128 - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldr r0, =0x00002e28 - adds r2, r1, r0 - movs r3, 0 - movs r0, 0x4 - strb r0, [r2] - strb r3, [r2, 0x1] - ldr r0, =gGameLanguage - ldrb r0, [r0] - ldr r2, =0x00002e48 - adds r1, r2 - strb r0, [r1] - bx lr - .pool - thumb_func_end sub_8120128 - - thumb_func_start sub_8120154 -sub_8120154: @ 8120154 - push {lr} - bl TraderSetup - pop {r0} - bx r0 - thumb_func_end sub_8120154 - - thumb_func_start SetMauvilleOldMan -SetMauvilleOldMan: @ 8120160 - push {lr} - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r1, [r0, 0xB] - lsls r1, 8 - ldrb r0, [r0, 0xA] - orrs r0, r1 - movs r1, 0xA - bl __umodsi3 - lsls r0, 16 - lsrs r0, 17 - cmp r0, 0x4 - bhi _081201C0 - lsls r0, 2 - ldr r1, =_08120190 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08120190: - .4byte _081201A4 - .4byte _081201AA - .4byte _081201B0 - .4byte _081201B6 - .4byte _081201BC -_081201A4: - bl sub_81200A0 - b _081201C0 -_081201AA: - bl sub_81200F8 - b _081201C0 -_081201B0: - bl sub_8120154 - b _081201C0 -_081201B6: - bl sub_812011C - b _081201C0 -_081201BC: - bl sub_8120128 -_081201C0: - bl sub_8120B5C - pop {r0} - bx r0 - thumb_func_end SetMauvilleOldMan - - thumb_func_start sub_81201C8 -sub_81201C8: @ 81201C8 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00002e28 - adds r0, r1 - ldrb r0, [r0] - bx lr - .pool - thumb_func_end sub_81201C8 - - thumb_func_start sub_81201DC -sub_81201DC: @ 81201DC - push {r4,lr} - ldr r4, =gSpecialVar_Result - bl sub_81201C8 - lsls r0, 24 - lsrs r0, 24 - strh r0, [r4] - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81201DC - - thumb_func_start sub_81201F4 -sub_81201F4: @ 81201F4 - ldr r1, =gSpecialVar_Result - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r2, =0x00002e51 - adds r0, r2 - ldrb r0, [r0] - strh r0, [r1] - bx lr - .pool - thumb_func_end sub_81201F4 - - thumb_func_start sub_8120210 -sub_8120210: @ 8120210 - push {r4-r6,lr} - ldr r0, =gSaveBlock1Ptr - ldr r4, [r0] - ldr r0, =0x00002e28 - adds r6, r4, r0 - ldr r1, =0x00002e42 - adds r0, r4, r1 - ldr r5, =gSaveBlock2Ptr - ldr r1, [r5] - bl StringCopy - movs r2, 0 - ldr r0, =0x00002e4d - adds r4, r0 -_0812022C: - adds r1, r4, r2 - ldr r0, [r5] - adds r0, 0xA - adds r0, r2 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x3 - bls _0812022C - movs r2, 0 - adds r5, r6, 0 - adds r5, 0x29 - adds r3, r6, 0x2 - adds r4, r6, 0 - adds r4, 0xE -_0812024E: - lsls r0, r2, 1 - adds r1, r3, r0 - adds r0, r4, r0 - ldrh r0, [r0] - strh r0, [r1] - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - cmp r2, 0x5 - bls _0812024E - movs r0, 0x1 - strb r0, [r5] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8120210 - - thumb_func_start sub_8120280 -sub_8120280: @ 8120280 - push {r4-r7,lr} - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldr r0, =gSpecialVar_0x8004 - ldrh r0, [r0] - ldr r2, =0x00002e36 - adds r5, r1, r2 - cmp r0, 0 - bne _08120296 - ldr r0, =0x00002e2a - adds r5, r1, r0 -_08120296: - ldr r2, =gStringVar4 - adds r4, r2, 0 - movs r6, 0 -_0812029C: - ldrh r1, [r5] - adds r5, 0x2 - adds r0, r2, 0 - bl CopyEasyChatWord - adds r2, r0, 0 - adds r7, r6, 0x1 - cmp r2, r4 - beq _081202BE - movs r1, 0x37 -_081202B0: - ldrb r0, [r4] - cmp r0, 0 - bne _081202B8 - strb r1, [r4] -_081202B8: - adds r4, 0x1 - cmp r2, r4 - bne _081202B0 -_081202BE: - adds r4, 0x1 - movs r0, 0 - strb r0, [r2] - adds r2, 0x1 - ldrh r1, [r5] - adds r5, 0x2 - adds r0, r2, 0 - bl CopyEasyChatWord - adds r2, r0, 0 - cmp r2, r4 - beq _081202E6 - movs r1, 0x37 -_081202D8: - ldrb r0, [r4] - cmp r0, 0 - bne _081202E0 - strb r1, [r4] -_081202E0: - adds r4, 0x1 - cmp r2, r4 - bne _081202D8 -_081202E6: - adds r4, 0x1 - movs r0, 0xFE - strb r0, [r2] - adds r2, 0x1 - ldrh r1, [r5] - adds r5, 0x2 - adds r0, r2, 0 - bl CopyEasyChatWord - adds r2, r0, 0 - cmp r2, r4 - beq _0812030E - movs r1, 0x37 -_08120300: - ldrb r0, [r4] - cmp r0, 0 - bne _08120308 - strb r1, [r4] -_08120308: - adds r4, 0x1 - cmp r2, r4 - bne _08120300 -_0812030E: - cmp r6, 0 - bne _0812031E - movs r0, 0xFC - strb r0, [r2] - adds r2, 0x1 - movs r0, 0xF - strb r0, [r2] - adds r2, 0x1 -_0812031E: - lsls r0, r7, 16 - lsrs r6, r0, 16 - cmp r6, 0x1 - bls _0812029C - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8120280 - - thumb_func_start sub_8120340 -sub_8120340: @ 8120340 - push {lr} - ldr r0, =gSpecialVar_0x8004 - ldrb r0, [r0] - bl sub_81206C0 - bl ScriptContext1_Stop - pop {r0} - bx r0 - .pool - thumb_func_end sub_8120340 - - thumb_func_start sub_8120358 -sub_8120358: @ 8120358 - ldr r1, =gSpecialVar_Result - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r2, =0x00002e28 - adds r0, r2 - ldrb r0, [r0, 0x1] - strh r0, [r1] - bx lr - .pool - thumb_func_end sub_8120358 - - thumb_func_start sub_8120374 -sub_8120374: @ 8120374 - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00002e28 - adds r0, r1 - movs r1, 0x1 - strb r1, [r0, 0x1] - bx lr - .pool - thumb_func_end sub_8120374 - - thumb_func_start sub_812038C -sub_812038C: @ 812038C - push {lr} - bl sub_811F01C - lsls r0, 16 - lsrs r1, r0, 16 - ldr r0, =0x0000ffff - cmp r1, r0 - bne _081203AC - ldr r1, =gSpecialVar_Result - movs r0, 0 - b _081203B6 - .pool -_081203AC: - ldr r0, =gStringVar1 - bl CopyEasyChatWord - ldr r1, =gSpecialVar_Result - movs r0, 0x1 -_081203B6: - strh r0, [r1] - pop {r0} - bx r0 - .pool - thumb_func_end sub_812038C - - thumb_func_start sub_81203C4 -sub_81203C4: @ 81203C4 - push {lr} - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00002e28 - adds r2, r0, r1 - ldrb r0, [r2, 0x1] - cmp r0, 0xA - bne _081203EC - ldr r1, =gSpecialVar_Result - movs r0, 0 - strh r0, [r1] - strb r0, [r2, 0x1] - b _081203F2 - .pool -_081203EC: - ldr r1, =gSpecialVar_Result - movs r0, 0x1 - strh r0, [r1] -_081203F2: - pop {r0} - bx r0 - .pool - thumb_func_end sub_81203C4 - - thumb_func_start sub_81203FC -sub_81203FC: @ 81203FC - push {r4-r6,lr} - ldr r0, =gSaveBlock1Ptr - ldr r4, [r0] - ldr r0, =0x00002e28 - adds r5, r4, r0 - ldrb r0, [r5, 0x1] - cmp r0, 0 - bne _08120410 - bl sub_81204DC -_08120410: - ldrb r0, [r5, 0x1] - lsls r0, 1 - ldr r1, =0x00002e2c - adds r6, r4, r1 - adds r0, r6, r0 - ldrh r1, [r0] - ldr r0, =0x0000ffff - cmp r1, r0 - beq _08120480 - bl Random - adds r4, r0, 0 - lsls r4, 16 - lsrs r4, 16 - movs r0, 0x7 - ands r4, r0 - ldr r0, =gStringVar4 - ldrb r1, [r5, 0x1] - lsls r1, 1 - adds r1, r6, r1 - ldrh r1, [r1] - bl CopyEasyChatWord - adds r2, r0, 0 - ldr r1, =gUnknown_082942FD - bl StringCopy - adds r2, r0, 0 - ldr r0, =gUnknown_0859EFF0 - lsls r4, 2 - adds r4, r0 - ldr r1, [r4] - adds r0, r2, 0 - bl StringCopy - adds r2, r0, 0 - ldr r1, =gUnknown_08294301 - bl StringCopy - b _081204A2 - .pool -_08120480: - ldr r0, =gStringVar4 - ldr r3, =gUnknown_0859F010 - ldrb r2, [r5, 0x2] - adds r1, r2, 0x1 - strb r1, [r5, 0x2] - lsls r2, 24 - lsrs r2, 24 - movs r6, 0xB9 - lsls r6, 6 - adds r1, r4, r6 - adds r1, r2 - ldrb r1, [r1] - lsls r1, 2 - adds r1, r3 - ldr r1, [r1] - bl StringCopy -_081204A2: - bl Random - lsls r0, 16 - lsrs r0, 16 - movs r1, 0xA - bl __umodsi3 - lsls r0, 16 - cmp r0, 0 - bne _081204C4 - movs r0, 0xA - b _081204C8 - .pool -_081204C4: - ldrb r0, [r5, 0x1] - adds r0, 0x1 -_081204C8: - strb r0, [r5, 0x1] - ldr r1, =gSpecialVar_Result - movs r0, 0x1 - strh r0, [r1] - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81203FC - - 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} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks - adds r5, r0, r1 - ldr r1, =gUnknown_03006130 - adds r0, r5, 0 - bl sub_8120748 - movs r1, 0x8 - ldrsh r0, [r5, r1] - cmp r0, 0x5 - bls _08120966 - b _08120B50 -_08120966: - lsls r0, 2 - ldr r1, =_0812097C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_0812097C: - .4byte _08120994 - .4byte _081209B8 - .4byte _081209C8 - .4byte _08120A7E - .4byte _08120B40 - .4byte _08120A6E -_08120994: - bl sub_8120280 - ldr r0, =gStringVar4 - bl sub_8120708 - movs r0, 0 - strh r0, [r5, 0xA] - strh r0, [r5, 0xC] - strh r0, [r5, 0xE] - strh r0, [r5, 0x10] - movs r0, 0x4 - bl FadeOutBGMTemporarily - movs r0, 0x1 - b _08120B4E - .pool -_081209B8: - bl IsBGMPausedOrStopped - lsls r0, 24 - cmp r0, 0 - bne _081209C4 - b _08120B50 -_081209C4: - movs r0, 0x2 - b _08120B4E -_081209C8: - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r2, =0x00002e28 - adds r4, r0, r2 - movs r0, 0xE - ldrsh r1, [r5, r0] - ldr r0, =gStringVar4 - adds r1, r0 - movs r3, 0 - ldrb r0, [r1] - ldr r7, =gUnknown_03006130 - ldrh r2, [r5, 0x12] - ldr r6, =gUnknown_0203A128 - b _08120A02 - .pool -_081209F8: - adds r1, 0x1 - adds r0, r3, 0x1 - lsls r0, 16 - lsrs r3, r0, 16 - ldrb r0, [r1] -_08120A02: - cmp r0, 0 - beq _08120A12 - cmp r0, 0xFE - beq _08120A12 - cmp r0, 0xFC - beq _08120A12 - cmp r0, 0xFF - bne _081209F8 -_08120A12: - cmp r2, 0 - bne _08120A20 - movs r2, 0x10 - ldrsh r1, [r5, r2] - lsls r1, 1 - adds r0, r4, 0x2 - b _08120A2A -_08120A20: - movs r0, 0x10 - ldrsh r1, [r5, r0] - lsls r1, 1 - adds r0, r4, 0 - adds r0, 0xE -_08120A2A: - adds r0, r1 - ldrh r0, [r0] - movs r1, 0x3 - ands r1, r0 - lsrs r0, 3 - movs r2, 0x1 - ands r0, r2 - adds r1, r0 - strh r1, [r6] - movs r1, 0x4 - ldrsh r0, [r7, r1] - adds r1, r3, 0 - bl __divsi3 - movs r1, 0 - strh r0, [r7, 0x4] - lsls r0, 16 - cmp r0, 0 - bgt _08120A54 - movs r0, 0x1 - strh r0, [r7, 0x4] -_08120A54: - ldrh r0, [r5, 0x10] - adds r0, 0x1 - strh r0, [r5, 0x10] - movs r2, 0xC - ldrsh r0, [r5, r2] - cmp r0, 0 - bne _08120A66 - movs r0, 0x3 - b _08120A68 -_08120A66: - movs r0, 0x5 -_08120A68: - strh r0, [r5, 0x8] - strh r1, [r5, 0xA] - b _08120B50 -_08120A6E: - ldrh r1, [r5, 0xC] - movs r2, 0xC - ldrsh r0, [r5, r2] - cmp r0, 0 - beq _08120B4C - subs r0, r1, 0x1 - strh r0, [r5, 0xC] - b _08120B50 -_08120A7E: - ldr r1, =gStringVar4 - movs r2, 0xE - ldrsh r0, [r5, r2] - adds r0, r1 - ldrb r4, [r0] - cmp r4, 0xFF - bne _08120AB0 - movs r0, 0x6 - bl FadeInBGM - ldr r0, =gMPlayInfo_SE2 - movs r1, 0x2 - bl m4aMPlayFadeOutTemporarily - bl EnableBothScriptContexts - adds r0, r6, 0 - bl DestroyTask - b _08120B50 - .pool -_08120AB0: - cmp r4, 0 - bne _08120AC6 - bl sub_81206F0 - ldrh r0, [r5, 0xE] - adds r0, 0x1 - strh r0, [r5, 0xE] - movs r0, 0x2 - strh r0, [r5, 0x8] - strh r4, [r5, 0xC] - b _08120B50 -_08120AC6: - cmp r4, 0xFE - bne _08120ADA - ldrh r0, [r5, 0xE] - adds r0, 0x1 - movs r1, 0 - strh r0, [r5, 0xE] - movs r0, 0x2 - strh r0, [r5, 0x8] - strh r1, [r5, 0xC] - b _08120B50 -_08120ADA: - cmp r4, 0xFC - bne _08120AEE - ldrh r0, [r5, 0xE] - adds r0, 0x2 - strh r0, [r5, 0xE] - movs r0, 0x2 - strh r0, [r5, 0x8] - movs r0, 0x8 - strh r0, [r5, 0xC] - b _08120B50 -_08120AEE: - cmp r4, 0x37 - bne _08120B04 - movs r4, 0 - strb r4, [r0] - bl sub_81206F0 - ldrh r0, [r5, 0xE] - adds r0, 0x1 - strh r0, [r5, 0xE] - strh r4, [r5, 0xC] - b _08120B50 -_08120B04: - movs r1, 0xA - ldrsh r0, [r5, r1] - cmp r0, 0x1 - beq _08120B20 - cmp r0, 0x1 - bgt _08120B16 - cmp r0, 0 - beq _08120B1C - b _08120B50 -_08120B16: - cmp r0, 0x2 - beq _08120B28 - b _08120B50 -_08120B1C: - bl sub_81206F0 -_08120B20: - ldrh r0, [r5, 0xA] - adds r0, 0x1 - strh r0, [r5, 0xA] - b _08120B50 -_08120B28: - ldrh r0, [r5, 0xE] - adds r0, 0x1 - movs r1, 0 - strh r0, [r5, 0xE] - strh r1, [r5, 0xA] - ldr r0, =gUnknown_03006130 - ldrh r0, [r0, 0x4] - strh r0, [r5, 0xC] - movs r0, 0x4 - b _08120B4E - .pool -_08120B40: - ldrh r0, [r5, 0xC] - subs r0, 0x1 - strh r0, [r5, 0xC] - lsls r0, 16 - cmp r0, 0 - bne _08120B50 -_08120B4C: - movs r0, 0x3 -_08120B4E: - strh r0, [r5, 0x8] -_08120B50: - bl sub_8197224 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8120944 - - thumb_func_start sub_8120B5C -sub_8120B5C: @ 8120B5C - push {lr} - ldr r0, =0x00004010 - movs r1, 0x45 - bl VarSet - pop {r0} - bx r0 - .pool - thumb_func_end sub_8120B5C - - thumb_func_start sub_8120B70 -sub_8120B70: @ 8120B70 - push {r4-r7,lr} - sub sp, 0x8 - ldrb r1, [r0] - cmp r1, 0x2 - beq _08120B80 - cmp r1, 0x3 - beq _08120BA6 - b _08120C00 -_08120B80: - adds r5, r0, 0 - movs r4, 0 -_08120B84: - adds r0, r5, 0 - adds r0, 0x32 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0x1 - bne _08120B9E - movs r0, 0xB - muls r0, r4 - adds r0, 0x5 - adds r0, r5, r0 - movs r1, 0x1 - bl ConvertInternationalString -_08120B9E: - adds r4, 0x1 - cmp r4, 0x3 - ble _08120B84 - b _08120C00 -_08120BA6: - adds r6, r0, 0 - movs r4, 0 - mov r7, sp - adds r5, r6, 0 - adds r5, 0x8 -_08120BB0: - adds r0, r6, 0x4 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - beq _08120BF8 - mov r0, sp - adds r1, r5, 0 - movs r2, 0x7 - bl memcpy - movs r0, 0xFF - strb r0, [r7, 0x7] - mov r0, sp - bl IsStringJapanese - cmp r0, 0 - beq _08120BF8 - mov r0, sp - movs r1, 0 - movs r2, 0x8 - bl memset - mov r0, sp - ldr r1, =gText_Friend - bl StringCopy - adds r0, r5, 0 - mov r1, sp - movs r2, 0x7 - bl memcpy - adds r0, r6, 0 - adds r0, 0x34 - adds r0, r4 - movs r1, 0x2 - strb r1, [r0] -_08120BF8: - adds r5, 0x7 - adds r4, 0x1 - cmp r4, 0x3 - ble _08120BB0 -_08120C00: - add sp, 0x8 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8120B70 - - thumb_func_start sub_8120C0C -sub_8120C0C: @ 8120C0C - push {r4-r7,lr} - mov r7, r8 - push {r7} - adds r5, r0, 0 - mov r8, r1 - adds r7, r2, 0 - ldrb r0, [r5] - cmp r0, 0x4 - bhi _08120CC4 - lsls r0, 2 - ldr r1, =_08120C2C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08120C2C: - .4byte _08120C92 - .4byte _08120CA2 - .4byte _08120C40 - .4byte _08120C6A - .4byte _08120CB0 -_08120C40: - adds r6, r5, 0 - movs r5, 0 - adds r4, r6, 0 - adds r4, 0x32 -_08120C48: - movs r0, 0xB - muls r0, r5 - adds r0, 0x5 - adds r0, r6, r0 - bl IsStringJapanese - cmp r0, 0 - beq _08120C5E - mov r0, r8 - strb r0, [r4] - b _08120C60 -_08120C5E: - strb r7, [r4] -_08120C60: - adds r4, 0x1 - adds r5, 0x1 - cmp r5, 0x3 - ble _08120C48 - b _08120CC4 -_08120C6A: - adds r4, r5, 0 - adds r4, 0x34 - adds r6, r5, 0 - adds r6, 0x8 - movs r5, 0x3 -_08120C74: - adds r0, r6, 0 - bl IsStringJapanese - cmp r0, 0 - beq _08120C84 - mov r1, r8 - strb r1, [r4] - b _08120C86 -_08120C84: - strb r7, [r4] -_08120C86: - adds r4, 0x1 - adds r6, 0x7 - subs r5, 0x1 - cmp r5, 0 - bge _08120C74 - b _08120CC4 -_08120C92: - cmp r3, 0x1 - bne _08120C9C - adds r0, r5, 0 - adds r0, 0x2A - b _08120CB8 -_08120C9C: - adds r0, r5, 0 - adds r0, 0x2A - b _08120CC2 -_08120CA2: - cmp r3, 0x1 - bne _08120CAC - mov r0, r8 - strb r0, [r5, 0x2] - b _08120CC4 -_08120CAC: - strb r7, [r5, 0x2] - b _08120CC4 -_08120CB0: - cmp r3, 0x1 - bne _08120CBE - adds r0, r5, 0 - adds r0, 0x20 -_08120CB8: - mov r1, r8 - strb r1, [r0] - b _08120CC4 -_08120CBE: - adds r0, r5, 0 - adds r0, 0x20 -_08120CC2: - strb r7, [r0] -_08120CC4: - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8120C0C - - thumb_func_start sub_8120CD0 -sub_8120CD0: @ 8120CD0 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x8 - adds r1, r0, 0 - ldrb r0, [r1] - cmp r0, 0x3 - bne _08120D28 - cmp r2, 0x1 - bne _08120D28 - adds r7, r1, 0 - movs r6, 0 - mov r8, sp - adds r4, r7, 0 - adds r4, 0x34 - adds r5, r7, 0 - adds r5, 0x8 -_08120CF2: - adds r0, r7, 0x4 - adds r0, r6 - ldrb r0, [r0] - cmp r0, 0 - beq _08120D1E - mov r0, sp - adds r1, r5, 0 - movs r2, 0x7 - bl memcpy - movs r0, 0xFF - mov r1, r8 - strb r0, [r1, 0x7] - mov r0, sp - bl IsStringJapanese - cmp r0, 0 - beq _08120D1A - movs r0, 0x1 - b _08120D1C -_08120D1A: - movs r0, 0x2 -_08120D1C: - strb r0, [r4] -_08120D1E: - adds r4, 0x1 - adds r5, 0x7 - adds r6, 0x1 - cmp r6, 0x3 - ble _08120CF2 -_08120D28: - add sp, 0x8 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8120CD0 - - thumb_func_start sub_8120D34 -sub_8120D34: @ 8120D34 - push {r4-r7,lr} - adds r3, r0, 0 - adds r6, r2, 0 - movs r2, 0 - subs r1, 0x1 - cmp r1, 0x1 - bhi _08120D44 - movs r2, 0x1 -_08120D44: - ldrb r0, [r3] - cmp r0, 0x4 - bhi _08120E02 - lsls r0, 2 - ldr r1, =_08120D58 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_08120D58: - .4byte _08120DE6 - .4byte _08120DF0 - .4byte _08120D6C - .4byte _08120DC6 - .4byte _08120DF8 -_08120D6C: - adds r7, r3, 0 - cmp r2, 0 - beq _08120DA4 - movs r5, 0 - adds r4, r3, 0 - adds r4, 0x32 -_08120D78: - movs r0, 0xB - muls r0, r5 - adds r0, 0x5 - adds r1, r7, r0 - ldrb r0, [r1] - cmp r0, 0xFC - bne _08120D98 - ldrb r0, [r1, 0x1] - cmp r0, 0x15 - bne _08120D98 - adds r0, r1, 0 - bl StripExtCtrlCodes - movs r0, 0x1 - strb r0, [r4] - b _08120D9A -_08120D98: - strb r6, [r4] -_08120D9A: - adds r4, 0x1 - adds r5, 0x1 - cmp r5, 0x3 - ble _08120D78 - b _08120E02 -_08120DA4: - movs r5, 0 - adds r4, r3, 0 - adds r4, 0x32 -_08120DAA: - adds r0, r4, r5 - ldrb r0, [r0] - cmp r0, 0x1 - bne _08120DBE - movs r0, 0xB - muls r0, r5 - adds r0, 0x5 - adds r0, r7, r0 - bl StripExtCtrlCodes -_08120DBE: - adds r5, 0x1 - cmp r5, 0x3 - ble _08120DAA - b _08120E02 -_08120DC6: - cmp r2, 0 - beq _08120E02 - movs r1, 0 - adds r4, r3, 0x4 - adds r2, r3, 0 - adds r2, 0x34 -_08120DD2: - adds r0, r4, r1 - ldrb r0, [r0] - cmp r0, 0 - beq _08120DDE - adds r0, r2, r1 - strb r6, [r0] -_08120DDE: - adds r1, 0x1 - cmp r1, 0x3 - ble _08120DD2 - b _08120E02 -_08120DE6: - cmp r2, 0 - beq _08120E02 - adds r0, r3, 0 - adds r0, 0x2A - b _08120E00 -_08120DF0: - cmp r2, 0 - beq _08120E02 - strb r6, [r3, 0x2] - b _08120E02 -_08120DF8: - cmp r2, 0 - beq _08120E02 - adds r0, r3, 0 - adds r0, 0x20 -_08120E00: - strb r6, [r0] -_08120E02: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8120D34 - - thumb_func_start sub_8120E08 -sub_8120E08: @ 8120E08 - push {r4,r5,lr} - ldr r2, =gUnknown_0203A12C - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00002e28 - adds r0, r1 - str r0, [r2] - movs r3, 0 - movs r1, 0x3 - strb r1, [r0] - ldr r0, [r2] - strb r3, [r0, 0x1] - movs r5, 0 - movs r4, 0xFF -_08120E24: - ldr r0, [r2] - adds r0, 0x4 - adds r0, r3 - strb r5, [r0] - ldr r1, [r2] - adds r1, 0x8 - adds r1, r3 - ldrb r0, [r1] - orrs r0, r4 - strb r0, [r1] - adds r3, 0x1 - cmp r3, 0x3 - ble _08120E24 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8120E08 - - thumb_func_start sub_8120E50 -sub_8120E50: @ 8120E50 - ldr r3, =gUnknown_0203A12C - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r1, =0x00002e28 - adds r0, r1 - str r0, [r3] - movs r2, 0 - movs r1, 0x3 - strb r1, [r0] - ldr r0, [r3] - strb r2, [r0, 0x1] - bx lr - .pool - thumb_func_end sub_8120E50 - - thumb_func_start sub_8120E74 -sub_8120E74: @ 8120E74 - push {lr} - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x32 - bne _08120E80 - movs r0, 0 -_08120E80: - bl GetGameStat - pop {r1} - bx r1 - thumb_func_end sub_8120E74 - - thumb_func_start sub_8120E88 -sub_8120E88: @ 8120E88 - push {lr} - adds r3, r0, 0 - movs r2, 0 - ldr r1, =gUnknown_0859F048 -_08120E90: - ldrb r0, [r1] - cmp r0, r3 - bne _08120EA0 - adds r0, r1, 0 - b _08120EAA - .pool -_08120EA0: - adds r1, 0x10 - adds r2, 0x1 - cmp r2, 0x23 - ble _08120E90 - ldr r0, =gUnknown_0859F278 -_08120EAA: - pop {r1} - bx r1 - .pool - thumb_func_end sub_8120E88 - - thumb_func_start sub_8120EB4 -sub_8120EB4: @ 8120EB4 - push {lr} - bl sub_8120E88 - ldr r0, [r0, 0x4] - pop {r1} - bx r1 - thumb_func_end sub_8120EB4 - - thumb_func_start sub_8120EC0 -sub_8120EC0: @ 8120EC0 - push {lr} - bl sub_8120E88 - ldr r0, [r0, 0xC] - pop {r1} - bx r1 - thumb_func_end sub_8120EC0 - - thumb_func_start sub_8120ECC -sub_8120ECC: @ 8120ECC - push {lr} - bl sub_8120E88 - ldr r0, [r0, 0x8] - pop {r1} - bx r1 - thumb_func_end sub_8120ECC - - thumb_func_start sub_8120ED8 -sub_8120ED8: @ 8120ED8 - push {lr} - movs r1, 0 - ldr r2, =gUnknown_0203A12C - ldr r0, [r2] - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _08120EFC -_08120EE6: - adds r0, r1, 0x1 - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0x3 - bhi _08120EFC - ldr r0, [r2] - adds r0, 0x4 - adds r0, r1 - ldrb r0, [r0] - cmp r0, 0 - bne _08120EE6 -_08120EFC: - adds r0, r1, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8120ED8 - - thumb_func_start sub_8120F08 -sub_8120F08: @ 8120F08 - ldr r1, =gUnknown_0203A12C - lsls r0, 2 - adds r0, 0x24 - ldr r2, [r1] - adds r2, r0 - ldrb r0, [r2] - ldrb r1, [r2, 0x1] - lsls r1, 8 - orrs r0, r1 - ldrb r1, [r2, 0x2] - lsls r1, 16 - orrs r0, r1 - ldrb r1, [r2, 0x3] - lsls r1, 24 - orrs r0, r1 - bx lr - .pool - thumb_func_end sub_8120F08 - - thumb_func_start sub_8120F2C -sub_8120F2C: @ 8120F2C - ldr r2, =gUnknown_0203A12C - lsls r0, 2 - adds r0, 0x24 - ldr r2, [r2] - adds r2, r0 - strb r1, [r2] - lsrs r0, r1, 8 - strb r0, [r2, 0x1] - lsrs r0, r1, 16 - strb r0, [r2, 0x2] - lsrs r1, 24 - strb r1, [r2, 0x3] - bx lr - .pool - thumb_func_end sub_8120F2C - - thumb_func_start sub_8120F4C -sub_8120F4C: @ 8120F4C - push {r4,r5,lr} - adds r5, r0, 0 - ldr r0, =gUnknown_0203A12C - ldr r0, [r0] - adds r0, 0x4 - adds r0, r5 - ldrb r0, [r0] - bl sub_8120E74 - adds r4, r0, 0 - adds r0, r5, 0 - bl sub_8120F08 - cmp r4, r0 - bhi _08120F74 - movs r0, 0 - b _08120F76 - .pool -_08120F74: - movs r0, 0x1 -_08120F76: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_8120F4C - - thumb_func_start sub_8120F7C -sub_8120F7C: @ 8120F7C - push {r4,r5,lr} - adds r5, r1, 0 - ldr r2, =gUnknown_0203A12C - lsls r1, r0, 3 - subs r1, r0 - adds r1, 0x8 - ldr r4, [r2] - adds r4, r1 - adds r0, r5, 0 - movs r1, 0xFF - movs r2, 0x8 - bl memset - adds r0, r5, 0 - adds r1, r4, 0 - movs r2, 0x7 - bl memcpy - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8120F7C - - thumb_func_start sub_8120FAC -sub_8120FAC: @ 8120FAC - push {r4,r5,lr} - adds r5, r1, 0 - ldr r2, =gUnknown_0203A12C - lsls r1, r0, 3 - subs r1, r0 - adds r1, 0x8 - ldr r4, [r2] - adds r4, r1 - adds r0, r4, 0 - movs r1, 0xFF - movs r2, 0x7 - bl memset - adds r0, r4, 0 - adds r1, r5, 0 - movs r2, 0x7 - bl memcpy - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8120FAC - - thumb_func_start sub_8120FDC -sub_8120FDC: @ 8120FDC - push {r4-r6,lr} - mov r6, r9 - mov r5, r8 - push {r5,r6} - mov r8, r0 - adds r6, r1, 0 - ldr r0, =gUnknown_0203A12C - mov r9, r0 - ldr r0, [r0] - adds r0, 0x4 - add r0, r8 - strb r6, [r0] - ldr r0, =gSaveBlock2Ptr - ldr r1, [r0] - mov r0, r8 - bl sub_8120FAC - lsls r4, r6, 24 - lsrs r4, 24 - adds r0, r4, 0 - bl sub_8120E74 - adds r1, r0, 0 - mov r0, r8 - bl sub_8120F2C - ldr r5, =gStringVar1 - adds r0, r4, 0 - bl sub_8120E74 - adds r1, r0, 0 - adds r0, r5, 0 - movs r2, 0 - movs r3, 0xA - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar2 - adds r0, r6, 0 - bl sub_8120ECC - adds r1, r0, 0 - adds r0, r4, 0 - bl StringCopy - mov r1, r9 - ldr r0, [r1] - adds r0, 0x34 - add r0, r8 - ldr r1, =gGameLanguage - ldrb r1, [r1] - strb r1, [r0] - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8120FDC - - thumb_func_start sub_8121064 -sub_8121064: @ 8121064 - push {r4-r7,lr} - adds r7, r0, 0 - adds r6, r1, 0 - movs r5, 0 - cmp r5, r6 - bge _0812107A -_08121070: - adds r0, r7, r5 - strb r5, [r0] - adds r5, 0x1 - cmp r5, r6 - blt _08121070 -_0812107A: - cmp r6, 0 - ble _081210B0 - adds r5, r6, 0 -_08121080: - bl Random - lsls r0, 16 - lsrs r0, 16 - adds r1, r6, 0 - bl __modsi3 - adds r4, r0, 0 - bl Random - lsls r0, 16 - lsrs r0, 16 - adds r1, r6, 0 - bl __modsi3 - adds r4, r7, r4 - ldrb r2, [r4] - adds r0, r7, r0 - ldrb r1, [r0] - strb r1, [r4] - strb r2, [r0] - subs r5, 0x1 - cmp r5, 0 - bne _08121080 -_081210B0: - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_8121064 - - thumb_func_start sub_81210B8 -sub_81210B8: @ 81210B8 - push {r4-r7,lr} - mov r7, r9 - mov r6, r8 - push {r6,r7} - mov r7, sp - mov r8, sp - ldr r0, =gUnknown_0859F288 - ldr r0, [r0] - lsls r0, 3 - lsrs r0, 3 - adds r0, 0x3 - lsrs r0, 2 - lsls r0, 2 - mov r1, sp - subs r1, r0 - mov sp, r1 - mov r9, sp - mov r0, sp - movs r1, 0x24 - bl sub_8121064 - movs r5, 0 -_081210E4: - ldr r1, =gUnknown_0859F048 - mov r2, r9 - adds r0, r2, r5 - ldrb r0, [r0] - lsls r0, 4 - adds r0, r1 - ldrb r4, [r0] - ldrb r6, [r0, 0x1] - movs r1, 0 - ldr r2, =gUnknown_0203A12C - ldr r0, [r2] - ldrb r0, [r0, 0x4] - cmp r0, r4 - beq _08121112 -_08121100: - adds r1, 0x1 - cmp r1, 0x3 - bgt _08121112 - ldr r0, [r2] - adds r0, 0x4 - adds r0, r1 - ldrb r0, [r0] - cmp r0, r4 - bne _08121100 -_08121112: - cmp r1, 0x4 - bne _08121162 - adds r0, r4, 0 - bl sub_8120E74 - cmp r0, r6 - bcc _08121162 - ldr r0, =gUnknown_0203A12C - ldr r1, [r0] - movs r0, 0x1 - strb r0, [r1, 0x1] - bl sub_8120ED8 - lsls r0, 24 - lsrs r0, 24 - cmp r0, 0x4 - bne _08121150 - ldr r0, =gUnknown_03001178 - ldrb r0, [r0] - adds r1, r4, 0 - bl sub_8120FDC - b _0812115E - .pool -_08121150: - bl sub_8120ED8 - lsls r0, 24 - lsrs r0, 24 - adds r1, r4, 0 - bl sub_8120FDC -_0812115E: - movs r0, 0x1 - b _0812116A -_08121162: - adds r5, 0x1 - cmp r5, 0x23 - ble _081210E4 - movs r0, 0 -_0812116A: - mov sp, r8 - pop {r3,r4} - mov r8, r3 - mov r9, r4 - pop {r4-r7} - pop {r1} - bx r1 - thumb_func_end sub_81210B8 - - thumb_func_start sub_8121178 -sub_8121178: @ 8121178 - push {r4-r6,lr} - mov r6, r8 - push {r6} - adds r5, r0, 0 - ldr r6, =gUnknown_0203A12C - ldr r0, [r6] - adds r0, 0x4 - adds r0, r5 - ldrb r0, [r0] - mov r8, r0 - ldr r4, =gStringVar1 - adds r0, r5, 0 - bl sub_8120F08 - adds r1, r0, 0 - adds r0, r4, 0 - movs r2, 0 - movs r3, 0xA - bl ConvertIntToDecimalStringN - ldr r4, =gStringVar2 - mov r0, r8 - bl sub_8120ECC - adds r1, r0, 0 - adds r0, r4, 0 - bl StringCopy - ldr r4, =gStringVar3 - adds r0, r5, 0 - adds r1, r4, 0 - bl sub_8120F7C - ldr r0, [r6] - adds r0, 0x34 - adds r0, r5 - ldrb r1, [r0] - adds r0, r4, 0 - bl ConvertInternationalString - mov r0, r8 - bl sub_8120EC0 - bl ShowFieldMessage - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8121178 - - thumb_func_start sub_81211EC -sub_81211EC: @ 81211EC - push {r4,r5,lr} - sub sp, 0xC - ldr r1, =gText_Exit - movs r0, 0x1 - movs r2, 0 - bl GetStringWidth - adds r5, r0, 0 - movs r4, 0 - ldr r0, =gUnknown_0203A12C - ldr r0, [r0] - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _08121230 -_08121208: - bl sub_8120EB4 - adds r1, r0, 0 - movs r0, 0x1 - movs r2, 0 - bl GetStringWidth - cmp r0, r5 - ble _0812121C - adds r5, r0, 0 -_0812121C: - adds r4, 0x1 - cmp r4, 0x3 - bgt _08121230 - ldr r0, =gUnknown_0203A12C - ldr r0, [r0] - adds r0, 0x4 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - bne _08121208 -_08121230: - adds r0, r5, 0 - bl convert_pixel_width_to_tile_width - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_8120ED8 - adds r3, r0, 0 - lsls r3, 25 - movs r0, 0x80 - lsls r0, 18 - adds r3, r0 - lsrs r3, 24 - movs r0, 0 - movs r1, 0 - adds r2, r4, 0 - bl CreateWindowFromRect - ldr r1, =gUnknown_0203A130 - strb r0, [r1] - ldrb r0, [r1] - movs r1, 0 - bl SetStandardWindowBorderStyle - movs r4, 0 - ldr r0, =gUnknown_0203A12C - ldr r0, [r0] - ldrb r0, [r0, 0x4] - cmp r0, 0 - beq _081212AA - movs r5, 0x80 - lsls r5, 17 -_08121272: - bl sub_8120EB4 - adds r2, r0, 0 - ldr r0, =gUnknown_0203A130 - ldrb r0, [r0] - lsrs r1, r5, 24 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl PrintTextOnWindow - movs r0, 0x80 - lsls r0, 21 - adds r5, r0 - adds r4, 0x1 - cmp r4, 0x3 - bgt _081212AA - ldr r0, =gUnknown_0203A12C - ldr r0, [r0] - adds r0, 0x4 - adds r0, r4 - ldrb r0, [r0] - cmp r0, 0 - bne _08121272 -_081212AA: - ldr r5, =gUnknown_0203A130 - ldrb r0, [r5] - ldr r2, =gText_Exit - lsls r1, r4, 4 - adds r1, 0x1 - lsls r1, 24 - lsrs r1, 24 - str r1, [sp] - movs r1, 0xFF - str r1, [sp, 0x4] - movs r1, 0 - str r1, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl PrintTextOnWindow - ldrb r4, [r5] - bl sub_8120ED8 - adds r1, r0, 0 - adds r1, 0x1 - lsls r1, 24 - lsrs r1, 24 - adds r0, r4, 0 - movs r2, 0 - bl InitMenuInUpperLeftCornerPlaySoundWhenAPressed - ldrb r0, [r5] - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81211EC - - thumb_func_start sub_81212FC -sub_81212FC: @ 81212FC - push {r4-r6,lr} - lsls r0, 24 - lsrs r6, r0, 24 - lsls r0, r6, 2 - adds r0, r6 - lsls r0, 3 - ldr r1, =gTasks - adds r4, r0, r1 - movs r0, 0x8 - ldrsh r5, [r4, r0] - cmp r5, 0 - beq _08121320 - cmp r5, 0x1 - beq _0812132C - b _08121376 - .pool -_08121320: - bl sub_81211EC - ldrh r0, [r4, 0x8] - adds r0, 0x1 - strh r0, [r4, 0x8] - b _08121376 -_0812132C: - bl ProcessMenuInput - lsls r0, 24 - asrs r4, r0, 24 - movs r0, 0x2 - negs r0, r0 - cmp r4, r0 - beq _08121376 - adds r0, 0x1 - cmp r4, r0 - beq _0812134E - bl sub_8120ED8 - lsls r0, 24 - lsrs r0, 24 - cmp r4, r0 - bne _0812135C -_0812134E: - ldr r1, =gSpecialVar_Result - movs r0, 0 - strh r0, [r1] - b _08121364 - .pool -_0812135C: - ldr r0, =gSpecialVar_Result - strh r5, [r0] - ldr r0, =gUnknown_03001178 - strb r4, [r0] -_08121364: - ldr r0, =gUnknown_0203A130 - ldrb r0, [r0] - bl sub_80E2A78 - adds r0, r6, 0 - bl DestroyTask - bl EnableBothScriptContexts -_08121376: - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81212FC - - thumb_func_start sub_8121388 -sub_8121388: @ 8121388 - push {lr} - ldr r0, =sub_81212FC - movs r1, 0x50 - bl CreateTask - pop {r0} - bx r0 - .pool - thumb_func_end sub_8121388 - - thumb_func_start sub_812139C -sub_812139C: @ 812139C - push {lr} - ldr r0, =gUnknown_03001178 - ldrb r0, [r0] - bl sub_8121178 - pop {r0} - bx r0 - .pool - thumb_func_end sub_812139C - - thumb_func_start sub_81213B0 -sub_81213B0: @ 81213B0 - push {lr} - ldr r1, =gUnknown_0203A12C - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r2, =0x00002e28 - adds r0, r2 - str r0, [r1] - bl sub_8120ED8 - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_81213B0 - - thumb_func_start sub_81213D8 -sub_81213D8: @ 81213D8 - push {r4,r5,lr} - ldr r2, =gUnknown_0203A12C - ldr r0, =gSaveBlock1Ptr - ldr r1, [r0] - ldr r3, =0x00002e28 - adds r0, r1, r3 - str r0, [r2] - ldr r5, =gUnknown_03001178 - ldrb r0, [r5] - ldr r2, =0x00002e2c - adds r1, r2 - adds r1, r0 - ldrb r4, [r1] - bl sub_8120F4C - cmp r0, 0x1 - beq _08121414 - movs r0, 0 - b _0812141E - .pool -_08121414: - ldrb r0, [r5] - adds r1, r4, 0 - bl sub_8120FDC - movs r0, 0x1 -_0812141E: - pop {r4,r5} - pop {r1} - bx r1 - thumb_func_end sub_81213D8 - - thumb_func_start sub_8121424 -sub_8121424: @ 8121424 - push {lr} - ldr r1, =gUnknown_0203A12C - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r2, =0x00002e28 - adds r0, r2 - str r0, [r1] - ldrb r0, [r0, 0x1] - cmp r0, 0 - beq _08121448 - movs r0, 0x1 - b _0812144A - .pool -_08121448: - movs r0, 0 -_0812144A: - pop {r1} - bx r1 - thumb_func_end sub_8121424 - - thumb_func_start sub_8121450 -sub_8121450: @ 8121450 - push {lr} - ldr r1, =gUnknown_0203A12C - ldr r0, =gSaveBlock1Ptr - ldr r0, [r0] - ldr r2, =0x00002e28 - adds r0, r2 - str r0, [r1] - bl sub_81210B8 - lsls r0, 24 - lsrs r0, 24 - pop {r1} - bx r1 - .pool - thumb_func_end sub_8121450 - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/record_mixing.s b/asm/record_mixing.s index 2dab009a5..acfcf48ed 100644 --- a/asm/record_mixing.s +++ b/asm/record_mixing.s @@ -1438,7 +1438,7 @@ _080E791A: add r1, r9 movs r2, 0x40 bl memcpy - bl sub_8120670 + bl ResetMauvilleOldManFlag add sp, 0x10 pop {r3,r4} mov r8, r3 diff --git a/common_syms/mauville_old_man.txt b/common_syms/mauville_old_man.txt new file mode 100644 index 000000000..edb40a31c --- /dev/null +++ b/common_syms/mauville_old_man.txt @@ -0,0 +1 @@ +gBardSong \ No newline at end of file diff --git a/data/event_scripts.s b/data/event_scripts.s index 25b0c7b52..c2906e649 100644 --- a/data/event_scripts.s +++ b/data/event_scripts.s @@ -5887,10 +5887,10 @@ gText_SoAmusing:: @ 82942E3 gText_SoMagical:: @ 82942F0 .string " so magical!$" -gUnknown_082942FD:: @ 82942FD +gOtherText_Is:: @ 82942FD .string " is$" -gUnknown_08294301:: @ 8294301 +gOtherText_DontYouAgree:: @ 8294301 .string "\n" .string "Don’t you agree?$" diff --git a/data/mauville_old_man.s b/data/mauville_old_man.s deleted file mode 100644 index c1b4dd1be..000000000 --- a/data/mauville_old_man.s +++ /dev/null @@ -1,58 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .section .rodata - .align 2, 0 - -gUnknown_0859EFE4:: @ 859EFE4 - .2byte 0x2811, 0x1029, 0x1018, 0xE0D, 0x1A1A, 0x1A1D - -gUnknown_0859EFF0:: @ 859EFF0 - .4byte gText_SoPretty - .4byte gText_SoDarling - .4byte gText_SoRelaxed - .4byte gText_SoSunny - .4byte gText_SoDesirable - .4byte gText_SoExciting - .4byte gText_SoAmusing - .4byte gText_SoMagical - -gUnknown_0859F010:: @ 859F010 - .4byte gUnknown_08294313 - .4byte gUnknown_08294359 - .4byte gUnknown_08294398 - .4byte gUnknown_082943DA - .4byte gUnknown_0829441C - .4byte gUnknown_08294460 - .4byte gUnknown_082944A0 - .4byte gUnknown_082944D5 - -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 - .4byte 0x00000106, MauvilleCity_PokemonCenter_1F_Text_28EBB5, MauvilleCity_PokemonCenter_1F_Text_28EBCD, MauvilleCity_PokemonCenter_1F_Text_28EBDD, 0x00000109, MauvilleCity_PokemonCenter_1F_Text_28EC60, MauvilleCity_PokemonCenter_1F_Text_28EC79, MauvilleCity_PokemonCenter_1F_Text_28EC81 - .4byte 0x0000010b, MauvilleCity_PokemonCenter_1F_Text_28ED04, MauvilleCity_PokemonCenter_1F_Text_28ED21, MauvilleCity_PokemonCenter_1F_Text_28ED30, 0x0000010c, MauvilleCity_PokemonCenter_1F_Text_28EDA1, MauvilleCity_PokemonCenter_1F_Text_28EDB5, MauvilleCity_PokemonCenter_1F_Text_28EDCF - .4byte 0x0000010d, MauvilleCity_PokemonCenter_1F_Text_28EE45, MauvilleCity_PokemonCenter_1F_Text_28EE5D, MauvilleCity_PokemonCenter_1F_Text_28EE6A, 0x0000010e, MauvilleCity_PokemonCenter_1F_Text_28EEDD, MauvilleCity_PokemonCenter_1F_Text_28EEF1, MauvilleCity_PokemonCenter_1F_Text_28EF01 - .4byte 0x0000010f, MauvilleCity_PokemonCenter_1F_Text_28EF73, MauvilleCity_PokemonCenter_1F_Text_28EF95, MauvilleCity_PokemonCenter_1F_Text_28EFAA, 0x00000110, MauvilleCity_PokemonCenter_1F_Text_28F045, MauvilleCity_PokemonCenter_1F_Text_28F05A, MauvilleCity_PokemonCenter_1F_Text_28F071 - .4byte 0x00000111, MauvilleCity_PokemonCenter_1F_Text_28F0F3, MauvilleCity_PokemonCenter_1F_Text_28F10D, MauvilleCity_PokemonCenter_1F_Text_28F125, 0x00000112, MauvilleCity_PokemonCenter_1F_Text_28F1BE, MauvilleCity_PokemonCenter_1F_Text_28F1D5, MauvilleCity_PokemonCenter_1F_Text_28F1DE - .4byte 0x00000113, MauvilleCity_PokemonCenter_1F_Text_28F24F, MauvilleCity_PokemonCenter_1F_Text_28F269, MauvilleCity_PokemonCenter_1F_Text_28F277, 0x00000114, MauvilleCity_PokemonCenter_1F_Text_28F2FC, MauvilleCity_PokemonCenter_1F_Text_28F314, MauvilleCity_PokemonCenter_1F_Text_28F32A - .4byte 0x0000011a, MauvilleCity_PokemonCenter_1F_Text_28F3AD, MauvilleCity_PokemonCenter_1F_Text_28F3C6, MauvilleCity_PokemonCenter_1F_Text_28F3D2, 0x0000011b, MauvilleCity_PokemonCenter_1F_Text_28F44B, MauvilleCity_PokemonCenter_1F_Text_28F461, MauvilleCity_PokemonCenter_1F_Text_28F47C - .4byte 0x0000011c, MauvilleCity_PokemonCenter_1F_Text_28F50C, MauvilleCity_PokemonCenter_1F_Text_28F51B, MauvilleCity_PokemonCenter_1F_Text_28F538, 0x0000021d, MauvilleCity_PokemonCenter_1F_Text_28F5BE, MauvilleCity_PokemonCenter_1F_Text_28F5D1, MauvilleCity_PokemonCenter_1F_Text_28F5F2 - .4byte 0x0000011e, MauvilleCity_PokemonCenter_1F_Text_28F678, MauvilleCity_PokemonCenter_1F_Text_28F694, MauvilleCity_PokemonCenter_1F_Text_28F6B4, 0x00000121, MauvilleCity_PokemonCenter_1F_Text_28F751, MauvilleCity_PokemonCenter_1F_Text_28F76A, MauvilleCity_PokemonCenter_1F_Text_28F776 - .4byte 0x00000124, MauvilleCity_PokemonCenter_1F_Text_28F7F6, MauvilleCity_PokemonCenter_1F_Text_28F811, MauvilleCity_PokemonCenter_1F_Text_28F822, 0x00000125, MauvilleCity_PokemonCenter_1F_Text_28F89C, MauvilleCity_PokemonCenter_1F_Text_28F8AF, MauvilleCity_PokemonCenter_1F_Text_28F8BC - .4byte 0x00000126, MauvilleCity_PokemonCenter_1F_Text_28F92F, MauvilleCity_PokemonCenter_1F_Text_28F941, MauvilleCity_PokemonCenter_1F_Text_28F949, 0x00000127, MauvilleCity_PokemonCenter_1F_Text_28F9D1, MauvilleCity_PokemonCenter_1F_Text_28F9EA, MauvilleCity_PokemonCenter_1F_Text_28F9FD - .4byte 0x00000128, MauvilleCity_PokemonCenter_1F_Text_28FA81, MauvilleCity_PokemonCenter_1F_Text_28FA99, MauvilleCity_PokemonCenter_1F_Text_28FAA7, 0x00000129, MauvilleCity_PokemonCenter_1F_Text_28FB1D, MauvilleCity_PokemonCenter_1F_Text_28FB35, MauvilleCity_PokemonCenter_1F_Text_28FB47 - .4byte 0x0000012a, MauvilleCity_PokemonCenter_1F_Text_28FBC4, MauvilleCity_PokemonCenter_1F_Text_28FBD9, MauvilleCity_PokemonCenter_1F_Text_28FBEA, 0x0000012b, MauvilleCity_PokemonCenter_1F_Text_28FC6B, MauvilleCity_PokemonCenter_1F_Text_28FC85, MauvilleCity_PokemonCenter_1F_Text_28FC98 - .4byte 0x0000012c, MauvilleCity_PokemonCenter_1F_Text_28FD1D, MauvilleCity_PokemonCenter_1F_Text_28FD35, MauvilleCity_PokemonCenter_1F_Text_28FD40, 0x0000012d, MauvilleCity_PokemonCenter_1F_Text_28FDA2, MauvilleCity_PokemonCenter_1F_Text_28FDBD, MauvilleCity_PokemonCenter_1F_Text_28FDCE - .4byte 0x0000012e, MauvilleCity_PokemonCenter_1F_Text_28FE57, MauvilleCity_PokemonCenter_1F_Text_28FE72, MauvilleCity_PokemonCenter_1F_Text_28FE88, 0x0000012f, MauvilleCity_PokemonCenter_1F_Text_28FF0C, MauvilleCity_PokemonCenter_1F_Text_28FF27, MauvilleCity_PokemonCenter_1F_Text_28FF44 - .4byte 0x00000130, MauvilleCity_PokemonCenter_1F_Text_28FFDD, MauvilleCity_PokemonCenter_1F_Text_28FFFA, MauvilleCity_PokemonCenter_1F_Text_29000D - - -gUnknown_0859F278:: @ 859F278 - .4byte 0x00000131, MauvilleCity_PokemonCenter_1F_Text_290097, MauvilleCity_PokemonCenter_1F_Text_2900B5, MauvilleCity_PokemonCenter_1F_Text_2900CB - -gUnknown_0859F288:: @ 859F288 - .4byte 0x00000024, 0x00000008 diff --git a/data/scripts/maps/MauvilleCity_PokemonCenter_1F.inc b/data/scripts/maps/MauvilleCity_PokemonCenter_1F.inc index 9b8561873..03b7928aa 100644 --- a/data/scripts/maps/MauvilleCity_PokemonCenter_1F.inc +++ b/data/scripts/maps/MauvilleCity_PokemonCenter_1F.inc @@ -10,7 +10,7 @@ MauvilleCity_PokemonCenter_1F_MapScript1_210E66: @ 8210E66 end MauvilleCity_PokemonCenter_1F_EventScript_210E74:: @ 8210E74 - special sub_8120B5C + special ScrSpecial_SetMauvilleOldManMapObjGfx end MauvilleCity_PokemonCenter_1F_EventScript_210E78:: @ 8210E78 diff --git a/data/scripts/mauville_man.inc b/data/scripts/mauville_man.inc index 917e2cf89..46be101e1 100644 --- a/data/scripts/mauville_man.inc +++ b/data/scripts/mauville_man.inc @@ -1,5 +1,5 @@ MauvilleCity_PokemonCenter_1F_EventScript_28E066:: @ 828E066 - special sub_81201DC + special ScrSpecial_GetCurrentMauvilleMan switch VAR_RESULT case 0, MauvilleCity_PokemonCenter_1F_EventScript_28E0A6 case 1, MauvilleCity_PokemonCenter_1F_EventScript_28E167 @@ -20,9 +20,9 @@ MauvilleCity_PokemonCenter_1F_EventScript_28E0A6:: @ 828E0A6 MauvilleCity_PokemonCenter_1F_EventScript_28E0C7:: @ 828E0C7 setvar VAR_0x8004, 0 - special sub_8120340 + special ScrSpecial_PlayBardSong delay 60 - special sub_81201F4 + special ScrSpecial_HasBardSongBeenChanged compare VAR_RESULT, 0 goto_eq MauvilleCity_PokemonCenter_1F_EventScript_28E0F4 msgbox MauvilleCity_PokemonCenter_1F_Text_2903E6, 4 @@ -51,12 +51,12 @@ MauvilleCity_PokemonCenter_1F_EventScript_28E113:: @ 828E113 goto_eq MauvilleCity_PokemonCenter_1F_EventScript_28E15D msgbox MauvilleCity_PokemonCenter_1F_Text_2904C1, 4 setvar VAR_0x8004, 1 - special sub_8120340 + special ScrSpecial_PlayBardSong delay 60 msgbox MauvilleCity_PokemonCenter_1F_Text_2904EB, 5 compare VAR_RESULT, 0 goto_eq MauvilleCity_PokemonCenter_1F_EventScript_28E113 - special sub_8120210 + special ScrSpecial_SaveBardSongLyrics msgbox MauvilleCity_PokemonCenter_1F_Text_290514, 4 release end @@ -71,7 +71,7 @@ MauvilleCity_PokemonCenter_1F_EventScript_28E167:: @ 828E167 faceplayer setflag FLAG_SYS_HIPSTER_MEET msgbox MauvilleCity_PokemonCenter_1F_Text_29054C, 4 - special sub_8120358 + special ScrSpecial_GetHipsterSpokenFlag compare VAR_RESULT, 0 goto_eq MauvilleCity_PokemonCenter_1F_EventScript_28E18C msgbox MauvilleCity_PokemonCenter_1F_Text_290598, 4 @@ -79,7 +79,7 @@ MauvilleCity_PokemonCenter_1F_EventScript_28E167:: @ 828E167 end MauvilleCity_PokemonCenter_1F_EventScript_28E18C:: @ 828E18C - special sub_812038C + special ScrSpecial_HipsterTeachWord compare VAR_RESULT, 1 goto_eq MauvilleCity_PokemonCenter_1F_EventScript_28E1A4 msgbox MauvilleCity_PokemonCenter_1F_Text_290602, 4 @@ -88,7 +88,7 @@ MauvilleCity_PokemonCenter_1F_EventScript_28E18C:: @ 828E18C MauvilleCity_PokemonCenter_1F_EventScript_28E1A4:: @ 828E1A4 msgbox MauvilleCity_PokemonCenter_1F_Text_290666, 4 - special sub_8120374 + special ScrSpecial_SetHipsterSpokenFlag release end @@ -813,20 +813,20 @@ MauvilleCity_PokemonCenter_1F_EventScript_29014A:: @ 829014A msgbox MauvilleCity_PokemonCenter_1F_Text_28E5F6, 5 compare VAR_RESULT, 0 goto_eq MauvilleCity_PokemonCenter_1F_EventScript_290219 - specialvar VAR_RESULT, sub_81213B0 + specialvar VAR_RESULT, ScrSpecial_StorytellerGetFreeStorySlot compare VAR_RESULT, 0 goto_eq MauvilleCity_PokemonCenter_1F_EventScript_2901DA message MauvilleCity_PokemonCenter_1F_Text_28E673 waitmessage - special sub_8121388 + special ScrSpecial_StorytellerStoryListMenu waitstate compare VAR_RESULT, 0 goto_eq MauvilleCity_PokemonCenter_1F_EventScript_2901B7 setvar VAR_0x8008, 1 - special sub_812139C + special ScrSpecial_StorytellerDisplayStory waitmessage waitbuttonpress - specialvar VAR_RESULT, sub_81213D8 + specialvar VAR_RESULT, ScrSpecial_StorytellerUpdateStat compare VAR_RESULT, 0 goto_eq MauvilleCity_PokemonCenter_1F_EventScript_2901BD goto MauvilleCity_PokemonCenter_1F_EventScript_29020F @@ -837,7 +837,7 @@ MauvilleCity_PokemonCenter_1F_EventScript_2901B7:: @ 82901B7 MauvilleCity_PokemonCenter_1F_EventScript_2901BD:: @ 82901BD msgbox MauvilleCity_PokemonCenter_1F_Text_28E78A, 4 - specialvar VAR_RESULT, sub_8121424 + specialvar VAR_RESULT, ScrSpecial_HasStorytellerAlreadyRecorded compare VAR_RESULT, 1 goto_eq MauvilleCity_PokemonCenter_1F_EventScript_29022D goto MauvilleCity_PokemonCenter_1F_EventScript_2901E2 @@ -849,7 +849,7 @@ MauvilleCity_PokemonCenter_1F_EventScript_2901E2:: @ 82901E2 msgbox MauvilleCity_PokemonCenter_1F_Text_28E7EE, 5 compare VAR_RESULT, 0 goto_eq MauvilleCity_PokemonCenter_1F_EventScript_290219 - specialvar VAR_RESULT, sub_8121450 + specialvar VAR_RESULT, ScrSpecial_StorytellerInitializeRandomStat compare VAR_RESULT, 1 goto_eq MauvilleCity_PokemonCenter_1F_EventScript_29020F msgbox MauvilleCity_PokemonCenter_1F_Text_28E881, 4 @@ -903,7 +903,7 @@ MauvilleCity_PokemonCenter_1F_EventScript_2902F6:: @ 82902F6 end MauvilleCity_PokemonCenter_1F_EventScript_290317:: @ 8290317 - special sub_81203C4 + special ScrSpecial_GiddyShouldTellAnotherTale compare VAR_RESULT, 1 goto_eq MauvilleCity_PokemonCenter_1F_EventScript_290359 compare VAR_RESULT, 0 @@ -911,7 +911,7 @@ MauvilleCity_PokemonCenter_1F_EventScript_290317:: @ 8290317 end MauvilleCity_PokemonCenter_1F_EventScript_290331:: @ 8290331 - special sub_81203C4 + special ScrSpecial_GiddyShouldTellAnotherTale compare VAR_RESULT, 1 goto_eq MauvilleCity_PokemonCenter_1F_EventScript_29034B compare VAR_RESULT, 0 @@ -924,7 +924,7 @@ MauvilleCity_PokemonCenter_1F_EventScript_29034B:: @ 829034B end MauvilleCity_PokemonCenter_1F_EventScript_290359:: @ 8290359 - special sub_81203FC + special ScrSpecial_GenerateGiddyLine special ShowFieldMessageStringVar4 waitmessage yesnobox 20, 8 diff --git a/data/specials.inc b/data/specials.inc index 740ed3f2e..a056de629 100644 --- a/data/specials.inc +++ b/data/specials.inc @@ -108,22 +108,22 @@ gSpecials:: @ 81DBA64 def_special sub_80FAFF8 def_special easy_chat_input_maybe def_special sub_811EECC - def_special sub_81201DC - def_special sub_81201F4 - def_special sub_8120210 - def_special sub_8120358 - def_special sub_8120374 - def_special sub_812038C - def_special sub_8120340 - def_special sub_8120B5C - def_special sub_81203FC - def_special sub_81203C4 - def_special sub_81213B0 - def_special sub_812139C - def_special sub_8121388 - def_special sub_81213D8 - def_special sub_8121450 - def_special sub_8121424 + def_special ScrSpecial_GetCurrentMauvilleMan + def_special ScrSpecial_HasBardSongBeenChanged + def_special ScrSpecial_SaveBardSongLyrics + def_special ScrSpecial_GetHipsterSpokenFlag + def_special ScrSpecial_SetHipsterSpokenFlag + def_special ScrSpecial_HipsterTeachWord + def_special ScrSpecial_PlayBardSong + def_special ScrSpecial_SetMauvilleOldManMapObjGfx + def_special ScrSpecial_GenerateGiddyLine + def_special ScrSpecial_GiddyShouldTellAnotherTale + def_special ScrSpecial_StorytellerGetFreeStorySlot + def_special ScrSpecial_StorytellerDisplayStory + def_special ScrSpecial_StorytellerStoryListMenu + def_special ScrSpecial_StorytellerUpdateStat + def_special ScrSpecial_StorytellerInitializeRandomStat + def_special ScrSpecial_HasStorytellerAlreadyRecorded def_special ScrSpecial_TraderMenuGetDecoration def_special ScrSpecial_GetTraderTradedFlag def_special ScrSpecial_DoesPlayerHaveNoDecorations diff --git a/include/bard_music.h b/include/bard_music.h index 7d9ca633e..9d3d0ad22 100644 --- a/include/bard_music.h +++ b/include/bard_music.h @@ -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 diff --git a/include/easy_chat.h b/include/easy_chat.h index e5fdc8bea..541fa6c1b 100644 --- a/include/easy_chat.h +++ b/include/easy_chat.h @@ -1,40 +1,16 @@ #ifndef GUARD_EASYCHAT_H #define GUARD_EASYCHAT_H -// Taken from Pokeruby, check if it's correct -enum -{ - EC_GROUP_POKEMON, - EC_GROUP_TRAINER, - EC_GROUP_STATUS, - EC_GROUP_BATTLE, - EC_GROUP_GREETINGS, - EC_GROUP_PEOPLE, - EC_GROUP_VOICES, - EC_GROUP_SPEECH, - EC_GROUP_ENDINGS, - EC_GROUP_FEELINGS, - EC_GROUP_CONDITIONS, - EC_GROUP_ACTIONS, - EC_GROUP_LIFESTYLE, - EC_GROUP_HOBBIES, - EC_GROUP_TIME, - EC_GROUP_MISC, - EC_GROUP_ADJECTIVES, - EC_GROUP_EVENTS, - EC_GROUP_MOVE_1, - EC_GROUP_MOVE_2, - EC_GROUP_TRENDY_SAYING, - EC_GROUP_POKEMON_2, -}; - void InitEasyChatPhrases(void); void easy_chat_input_maybe(void); -void CopyEasyChatWord(u8 *dest, u16 word); +u8 * CopyEasyChatWord(u8 *dest, u16 word); bool32 sub_811F8D8(u16 word); void InitializeEasyChatWordArray(u16 *words, u16 length); void ConvertEasyChatWordsToString(u8 *dest, const u16 *src, u16 length1, u16 length2); 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 diff --git a/include/event_scripts.h b/include/event_scripts.h index eb523a487..c187682b0 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -394,4 +394,134 @@ extern const u8 Route111_EventScript_2907F0[]; extern const u8 LittlerootTown_BrendansHouse_2F_EventScript_1F863F[]; extern const u8 LittlerootTown_MaysHouse_2F_EventScript_1F958F[]; +//mauville_old_man +extern const u8 gOtherText_Is[]; +extern const u8 gOtherText_DontYouAgree[]; +extern const u8 gText_SoPretty[]; +extern const u8 gText_SoDarling[]; +extern const u8 gText_SoRelaxed[]; +extern const u8 gText_SoSunny[]; +extern const u8 gText_SoDesirable[]; +extern const u8 gText_SoExciting[]; +extern const u8 gText_SoAmusing[]; +extern const u8 gText_SoMagical[]; +extern const u8 gUnknown_08294313[]; +extern const u8 gUnknown_08294359[]; +extern const u8 gUnknown_08294398[]; +extern const u8 gUnknown_082943DA[]; +extern const u8 gUnknown_0829441C[]; +extern const u8 gUnknown_08294460[]; +extern const u8 gUnknown_082944A0[]; +extern const u8 gUnknown_082944D5[]; + + +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28E930[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28E947[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28E956[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28E9D7[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28E9EF[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28E9FE[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28EA7D[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28EA98[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28EAA8[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28EB19[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28EB31[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28EB3E[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28EBB5[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28EBCD[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28EBDD[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28EC60[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28EC79[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28EC81[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28ED04[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28ED21[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28ED30[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28EDA1[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28EDB5[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28EDCF[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28EE45[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28EE5D[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28EE6A[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28EEDD[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28EEF1[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28EF01[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28EF73[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28EF95[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28EFAA[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F045[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F05A[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F071[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F0F3[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F10D[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F125[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F1BE[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F1D5[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F1DE[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F24F[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F269[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F277[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F2FC[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F314[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F32A[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F3AD[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F3C6[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F3D2[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F44B[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F461[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F47C[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F50C[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F51B[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F538[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F5BE[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F5D1[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F5F2[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F678[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F694[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F6B4[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F751[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F76A[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F776[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F7F6[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F811[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F822[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F89C[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F8AF[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F8BC[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F92F[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F941[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F949[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F9D1[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F9EA[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28F9FD[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FA81[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FA99[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FAA7[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FB1D[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FB35[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FB47[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FBC4[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FBD9[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FBEA[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FC6B[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FC85[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FC98[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FD1D[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FD35[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FD40[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FDA2[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FDBD[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FDCE[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FE57[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FE72[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FE88[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FF0C[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FF27[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FF44[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FFDD[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_28FFFA[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_29000D[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_290097[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_2900B5[]; +extern const u8 MauvilleCity_PokemonCenter_1F_Text_2900CB[]; + #endif //GUARD_EVENT_SCRIPTS_H diff --git a/include/global.h b/include/global.h index ce9a96b6f..ec636bb07 100644 --- a/include/global.h +++ b/include/global.h @@ -437,42 +437,68 @@ struct MailStruct /*0x20*/ u16 itemId; }; -struct UnkMauvilleOldManStruct +struct MauvilleManCommon { - u8 unk_2D94; - u8 unk_2D95; - /*0x2D96*/ u16 mauvilleOldMan_ecArray[6]; - /*0x2DA2*/ u16 mauvilleOldMan_ecArray2[6]; - /*0x2DAE*/ u8 playerName[8]; - /*0x2DB6*/ u8 filler_2DB6[0x3]; - /*0x2DB9*/ u8 playerTrainerId[4]; - u8 unk_2DBD; + u8 id; +}; + +struct MauvilleManBard +{ + /*0x00*/ u8 id; + /*0x02*/ u16 songLyrics[6]; + /*0x0E*/ u16 temporaryLyrics[6]; + /*0x1A*/ u8 playerName[8]; + /*0x22*/ u8 filler_2DB6[0x3]; + /*0x25*/ u8 playerTrainerId[4]; + /*0x29*/ bool8 hasChangedSong; + /*0x2A*/ u8 language; }; /*size = 0x2C*/ -struct UnkMauvilleOldManStruct2 +struct MauvilleManStoryteller { - u8 filler0; - u8 unk1; - u8 unk2; - u16 mauvilleOldMan_ecArray[10]; - u8 mauvilleOldMan_ecArray2[12]; - u8 fillerF[0x2]; + u8 id; + bool8 alreadyRecorded; + u8 filler2[2]; + u8 gameStatIDs[4]; + u8 trainerNames[4][7]; + u8 statValues[4][4]; + u8 language[4]; +}; + +struct MauvilleManGiddy +{ + /*0x00*/ u8 id; + /*0x01*/ u8 taleCounter; + /*0x02*/ u8 questionNum; + /*0x04*/ u16 randomWords[10]; + /*0x18*/ u8 questionList[8]; + /*0x20*/ u8 language; }; /*size = 0x2C*/ +struct MauvilleManHipster +{ + u8 id; + bool8 alreadySpoken; + u8 language; +}; + struct MauvilleOldManTrader { - /* 0x2E28 */ u8 id; - /* 0x2E29 */ u8 unk1[4]; - /* 0x2E2D */ u8 unk5[4][11]; - /* 0x2E59 */ bool8 alreadyTraded; - /* 0x2E5A */ u8 language[4]; + u8 id; + u8 decorIds[4]; + u8 playerNames[4][11]; + u8 alreadyTraded; + u8 language[4]; }; typedef union OldMan { - struct UnkMauvilleOldManStruct oldMan1; - struct UnkMauvilleOldManStruct2 oldMan2; + struct MauvilleManCommon common; + struct MauvilleManBard bard; + struct MauvilleManGiddy giddy; + struct MauvilleManHipster hipster; struct MauvilleOldManTrader trader; + struct MauvilleManStoryteller storyteller; u8 filler[0x40]; } OldMan; diff --git a/include/mauville_old_man.h b/include/mauville_old_man.h index aefc76083..696f12cc7 100644 --- a/include/mauville_old_man.h +++ b/include/mauville_old_man.h @@ -2,7 +2,18 @@ #ifndef GUARD_MAUVILLE_OLD_MAN_H #define GUARD_MAUVILLE_OLD_MAN_H +enum MauvilleOldManType +{ + MAUVILLE_MAN_BARD, + MAUVILLE_MAN_HIPSTER, + MAUVILLE_MAN_TRADER, + MAUVILLE_MAN_STORYTELLER, + MAUVILLE_MAN_GIDDY +}; + void SetMauvilleOldMan(void); -u8 sub_81201C8(void); +u8 GetCurrentMauvilleOldMan(void); +extern struct BardSong gBardSong; +void ScrSpecial_SetMauvilleOldManMapObjGfx(void); #endif // GUARD_MAUVILLE_OLD_MAN_H diff --git a/include/script_menu.h b/include/script_menu.h index 810e84dcb..0555d0f78 100644 --- a/include/script_menu.h +++ b/include/script_menu.h @@ -9,6 +9,8 @@ bool8 ScriptMenu_YesNo(u8 var1, u8 var2); bool8 ScriptMenu_MultichoiceGrid(u8 left, u8 top, u8 multichoiceId, u8 a4, u8 columnCount); bool8 ScriptMenu_ShowPokemonPic(u16 var1, u8 var2, u8 var3); bool8 (*ScriptMenu_GetPicboxWaitFunc(void))(void); -s32 convert_pixel_width_to_tile_width(s32 pixelWidth); +u8 convert_pixel_width_to_tile_width(s32); +u8 CreateWindowFromRect(u8, u8, u8, u8); +void sub_80E2A78(u8); #endif //GUARD_SCRIPT_MENU_H diff --git a/include/strings.h b/include/strings.h index f61dd5319..f9b752176 100644 --- a/include/strings.h +++ b/include/strings.h @@ -433,6 +433,7 @@ extern const u8 gText_TooImportantToToss[]; extern const u8 gText_ConfirmTossItems[]; extern const u8 gText_MoveVar1Where[]; +extern const u8 gText_Friend[]; extern const u8 gText_Tristan[]; extern const u8 gText_Philip[]; extern const u8 gText_Dennis[]; diff --git a/include/trader.h b/include/trader.h index 71fd1f7c2..c07ea81bd 100644 --- a/include/trader.h +++ b/include/trader.h @@ -7,5 +7,7 @@ void sub_8133DA0(u8 taskId); void sub_8133E1C(u8 taskId); +void TraderSetup(void); +void Trader_ResetFlag(void); #endif //GUARD_TRADER_H diff --git a/ld_script.txt b/ld_script.txt index fc6385cd8..cf218af51 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -161,7 +161,7 @@ SECTIONS { src/bike.o(.text); asm/easy_chat.o(.text); src/mon_markings.o(.text); - asm/mauville_old_man.o(.text); + src/mauville_old_man.o(.text); src/mail.o(.text); asm/menu_helpers.o(.text); src/dewford_trend.o(.text); @@ -454,7 +454,7 @@ SECTIONS { src/bike.o(.rodata); data/easy_chat.o(.rodata); src/mon_markings.o(.rodata); - data/mauville_old_man.o(.rodata); + src/mauville_old_man.o(.rodata); src/mail.o(.rodata); data/menu_helpers.o(.rodata); src/heal_location.o(.rodata); diff --git a/src/bard_music.c b/src/bard_music.c index 6fb1496e5..6c2578071 100644 --- a/src/bard_music.c +++ b/src/bard_music.c @@ -2,6 +2,7 @@ // Includes #include "global.h" #include "bard_music.h" +#include "constants/easy_chat.h" #include "easy_chat.h" #include "data/bard_music/bard_sounds.h" diff --git a/src/field_map_obj.c b/src/field_map_obj.c index a5be62442..81cbe5210 100644 --- a/src/field_map_obj.c +++ b/src/field_map_obj.c @@ -1146,7 +1146,7 @@ const struct MapObjectGraphicsInfo *GetFieldObjectGraphicsInfo(u8 graphicsId) } if (graphicsId == 0x45) { - bard = sub_81201C8(); + bard = GetCurrentMauvilleOldMan(); return gMauvilleOldManGraphicsInfoPointers[bard]; } if (graphicsId >= NUM_OBJECT_GRAPHICS_INFO) diff --git a/src/mail.c b/src/mail.c index 85ba86974..8fddc7045 100644 --- a/src/mail.c +++ b/src/mail.c @@ -101,7 +101,7 @@ struct MailRead /*0x021c*/ u8 monIconSprite; /*0x021d*/ u8 language; /*0x021e*/ bool8 playerIsSender; - /*0x0220*/ void (*parserSingle)(u8 *dest, u16 word); + /*0x0220*/ u8 * (*parserSingle)(u8 *dest, u16 word); /*0x0224*/ void (*parserMultiple)(u8 *dest, const u16 *src, u16 length1, u16 length2); /*0x0228*/ const struct MailLayout *layout; /*0x022c*/ u8 bg1TilemapBuffer[0x1000]; diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c new file mode 100644 index 000000000..ea466b2ec --- /dev/null +++ b/src/mauville_old_man.c @@ -0,0 +1,1247 @@ +#include "global.h" +#include "main.h" +#include "constants/songs.h" +#include "constants/easy_chat.h" +#include "constants/map_objects.h" +#include "constants/vars.h" +#include "mauville_old_man.h" +#include "event_data.h" +#include "string_util.h" +#include "text.h" +#include "easy_chat.h" +#include "script.h" +#include "random.h" +#include "event_scripts.h" +#include "task.h" +#include "menu.h" +#include "m4a.h" +#include "bard_music.h" +#include "sound.h" +#include "strings.h" +#include "overworld.h" +#include "field_message_box.h" +#include "script_menu.h" +#include "trader.h" + +#define CHAR_SONG_WORD_SEPARATOR 0x37 + +extern struct MusicPlayerInfo gMPlayInfo_SE2; + +static void InitGiddyTaleList(void); +static void StartBardSong(bool8 useTemporaryLyrics); +static void Task_BardSong(u8 taskId); +static void StorytellerSetup(void); +static void Storyteller_ResetFlag(void); + +IWRAM_DATA u8 sSelectedStory; + +struct BardSong gBardSong; + +static EWRAM_DATA u16 sUnknownBardRelated = 0; +static EWRAM_DATA struct MauvilleManStoryteller * sStorytellerPtr = NULL; +static EWRAM_DATA u8 sStorytellerWindowId = 0; + +static const u16 sDefaultBardSongLyrics[6] = { + EC_WORD_SHAKE, + EC_WORD_IT, + EC_WORD_DO, + EC_WORD_THE, + EC_WORD_DIET, + EC_WORD_DANCE +}; + +static const u8 * const sGiddyAdjectives[] = { + gText_SoPretty, + gText_SoDarling, + gText_SoRelaxed, + gText_SoSunny, + gText_SoDesirable, + gText_SoExciting, + gText_SoAmusing, + gText_SoMagical +}; + +static const u8 * const sGiddyQuestions[] = { + gUnknown_08294313, + gUnknown_08294359, + gUnknown_08294398, + gUnknown_082943DA, + gUnknown_0829441C, + gUnknown_08294460, + gUnknown_082944A0, + gUnknown_082944D5 +}; + +static void SetupBard(void) +{ + u16 i; + struct MauvilleManBard *bard = &gSaveBlock1Ptr->oldMan.bard; + + bard->id = MAUVILLE_MAN_BARD; + bard->hasChangedSong = FALSE; + bard->language = gGameLanguage; + for (i = 0; i < 6; i++) + bard->songLyrics[i] = sDefaultBardSongLyrics[i]; +} + +static void SetupHipster(void) +{ + struct MauvilleManHipster *hipster = &gSaveBlock1Ptr->oldMan.hipster; + + hipster->id = MAUVILLE_MAN_HIPSTER; + hipster->alreadySpoken = FALSE; + hipster->language = gGameLanguage; +} + +static void SetupStoryteller(void) +{ + StorytellerSetup(); +} + +static void SetupGiddy(void) +{ + struct MauvilleManGiddy *giddy = &gSaveBlock1Ptr->oldMan.giddy; + + giddy->id = MAUVILLE_MAN_GIDDY; + giddy->taleCounter = 0; + giddy->language = gGameLanguage; +} + +static void SetupTrader(void) +{ + TraderSetup(); +} + +void SetMauvilleOldMan(void) +{ + u16 trainerId = (gSaveBlock2Ptr->playerTrainerId[1] << 8) | gSaveBlock2Ptr->playerTrainerId[0]; + + + // Determine man based on the last digit of the player's trainer ID. + switch ((trainerId % 10) / 2) + { + case MAUVILLE_MAN_BARD: + SetupBard(); + break; + case MAUVILLE_MAN_HIPSTER: + SetupHipster(); + break; + case MAUVILLE_MAN_TRADER: + SetupTrader(); + break; + case MAUVILLE_MAN_STORYTELLER: + SetupStoryteller(); + break; + case MAUVILLE_MAN_GIDDY: + SetupGiddy(); + break; + } + ScrSpecial_SetMauvilleOldManMapObjGfx(); +} + +u8 GetCurrentMauvilleOldMan(void) +{ + struct MauvilleManCommon *common = &gSaveBlock1Ptr->oldMan.common; + + return common->id; +} + +void ScrSpecial_GetCurrentMauvilleMan(void) +{ + gSpecialVar_Result = GetCurrentMauvilleOldMan(); +} + +void ScrSpecial_HasBardSongBeenChanged(void) +{ + u16 *scriptResult = &gSpecialVar_Result; // why?? + struct MauvilleManBard *bard = &gSaveBlock1Ptr->oldMan.bard; + + *scriptResult = bard->hasChangedSong; +} + +void ScrSpecial_SaveBardSongLyrics(void) +{ + u16 i; + struct MauvilleManBard *bard = &gSaveBlock1Ptr->oldMan.bard; + + StringCopy(bard->playerName, gSaveBlock2Ptr->playerName); + + for (i = 0; i < 4; i++) + bard->playerTrainerId[i] = gSaveBlock2Ptr->playerTrainerId[i]; + + for (i = 0; i < 6; i++) + bard->songLyrics[i] = bard->temporaryLyrics[i]; + + bard->hasChangedSong = TRUE; +} + +// Copies lyrics into gStringVar4 +static void PrepareSongText(void) +{ + struct MauvilleManBard *bard = &gSaveBlock1Ptr->oldMan.bard; + u16 * lyrics = gSpecialVar_0x8004 == 0 ? bard->songLyrics : bard->temporaryLyrics; + u8 * wordEnd = gStringVar4; + u8 * str = wordEnd; + u16 lineNum; + + // Put three words on each line + for (lineNum = 0; lineNum < 2; lineNum++) + { + wordEnd = CopyEasyChatWord(wordEnd, *(lyrics++)); + while (wordEnd != str) + { + if (*str == CHAR_SPACE) + *str = CHAR_SONG_WORD_SEPARATOR; + str++; + } + + str++; + *(wordEnd++) = CHAR_SPACE; + + wordEnd = CopyEasyChatWord(wordEnd, *(lyrics++)); + while (wordEnd != str) + { + if (*str == CHAR_SPACE) + *str = CHAR_SONG_WORD_SEPARATOR; + str++; + } + + str++; + *(wordEnd++) = CHAR_NEWLINE; + + wordEnd = CopyEasyChatWord(wordEnd, *(lyrics++)); + while (wordEnd != str) + { + if (*str == CHAR_SPACE) + *str = CHAR_SONG_WORD_SEPARATOR; + str++; + } + + if (lineNum == 0) + { + *(wordEnd++) = EXT_CTRL_CODE_BEGIN; + *(wordEnd++) = 15; + } + } +} + +void ScrSpecial_PlayBardSong(void) +{ + StartBardSong(gSpecialVar_0x8004); + ScriptContext1_Stop(); +} + +void ScrSpecial_GetHipsterSpokenFlag(void) +{ + u16 *scriptResult = &gSpecialVar_Result; // again?? + struct MauvilleManHipster *hipster = &gSaveBlock1Ptr->oldMan.hipster; + + *scriptResult = hipster->alreadySpoken; +} + +void ScrSpecial_SetHipsterSpokenFlag(void) +{ + struct MauvilleManHipster *hipster = &gSaveBlock1Ptr->oldMan.hipster; + + hipster->alreadySpoken = TRUE; +} + +void ScrSpecial_HipsterTeachWord(void) +{ + u16 var = sub_811F01C(); + + if (var == 0xFFFF) + { + gSpecialVar_Result = FALSE; + } + else + { + CopyEasyChatWord(gStringVar1, var); + gSpecialVar_Result = TRUE; + } +} + +void ScrSpecial_GiddyShouldTellAnotherTale(void) +{ + struct MauvilleManGiddy *giddy = &gSaveBlock1Ptr->oldMan.giddy; + + if (giddy->taleCounter == 10) + { + gSpecialVar_Result = FALSE; + giddy->taleCounter = 0; + } + else + { + gSpecialVar_Result = TRUE; + } +} + +void ScrSpecial_GenerateGiddyLine(void) +{ + struct MauvilleManGiddy *giddy = &gSaveBlock1Ptr->oldMan.giddy; + + if (giddy->taleCounter == 0) + InitGiddyTaleList(); + + if (giddy->randomWords[giddy->taleCounter] != 0xFFFF) // is not the last element of the array? + { + u8 *stringPtr; + u32 adjective = Random(); + + adjective %= 8; + stringPtr = CopyEasyChatWord(gStringVar4, giddy->randomWords[giddy->taleCounter]); + stringPtr = StringCopy(stringPtr, gOtherText_Is); + stringPtr = StringCopy(stringPtr, sGiddyAdjectives[adjective]); + StringCopy(stringPtr, gOtherText_DontYouAgree); + } + else + { + StringCopy(gStringVar4, sGiddyQuestions[giddy->questionList[giddy->questionNum++]]); + } + + if (!(Random() % 10)) + giddy->taleCounter = 10; + else + giddy->taleCounter++; + + gSpecialVar_Result = TRUE; +} + +static void InitGiddyTaleList(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]); + } + } +} +static void ResetBardFlag(void) +{ + struct MauvilleManBard *bard = &gSaveBlock1Ptr->oldMan.bard; + + bard->hasChangedSong = FALSE; +} + +static void ResetHipsterFlag(void) +{ + struct MauvilleManHipster *hipster = &gSaveBlock1Ptr->oldMan.hipster; + + hipster->alreadySpoken = FALSE; +} + +static void ResetTraderFlag(void) +{ + Trader_ResetFlag(); +} + +static void ResetStorytellerFlag(void) +{ + Storyteller_ResetFlag(); +} + +void ResetMauvilleOldManFlag(void) // ResetMauvilleOldManFlag +{ + switch (GetCurrentMauvilleOldMan()) + { + case MAUVILLE_MAN_BARD: + ResetBardFlag(); + break; + case MAUVILLE_MAN_HIPSTER: + ResetHipsterFlag(); + break; + case MAUVILLE_MAN_STORYTELLER: + ResetStorytellerFlag(); + break; + case MAUVILLE_MAN_TRADER: + ResetTraderFlag(); + break; + case MAUVILLE_MAN_GIDDY: + break; + } + ScrSpecial_SetMauvilleOldManMapObjGfx(); +} + + +#define tState data[0] +#define tCharIndex data[3] +#define tCurrWord data[4] +#define tUseTemporaryLyrics data[5] + +#define MACRO1(a) (((a) & 3) + (((a) / 8) & 1)) +#define MACRO2(a) (((a) % 4) + (((a) / 8) & 1)) + +static void StartBardSong(bool8 useTemporaryLyrics) +{ + u8 taskId = CreateTask(Task_BardSong, 80); + + gTasks[taskId].tUseTemporaryLyrics = useTemporaryLyrics; +} + +static void sub_81206F0(void) +{ + gUnknown_03002F84 = FALSE; +} + +static void BardSong_TextSubPrinter(struct TextSubPrinter * printer, u16 a1) +{ + gUnknown_03002F84 = TRUE; +} + +static void sub_8120708(const u8 * src) +{ + NewMenuHelpers_DrawDialogueFrame(0, 0); + PrintTextOnWindow(0, 1, src, 0, 1, 1, BardSong_TextSubPrinter); + gUnknown_03002F84 = TRUE; + CopyWindowToVram(0, 3); +} + +static void BardSing(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; + } +} + +static void Task_BardSong(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; // r5 + + BardSing(task, &gBardSong); + switch (task->tState) + { + case 0: // Initialize song + PrepareSongText(); + sub_8120708(gStringVar4); + task->data[1] = 0; + task->data[2] = 0; + task->tCharIndex = 0; + task->tCurrWord = 0; + FadeOutBGMTemporarily(4); + task->tState = 1; + break; + case 1: // Wait for BGM to end + if (IsBGMPausedOrStopped()) + task->tState = 2; + break; + case 2: // Initialize word + { + struct MauvilleManBard *bard = &gSaveBlock1Ptr->oldMan.bard; + u8 *str = gStringVar4 + task->tCharIndex; + u16 wordLen = 0; + // Can't get it to match without hacking + u32 temp; + register s16 zero asm("r1"); + + while (*str != CHAR_SPACE + && *str != CHAR_NEWLINE + && *str != EXT_CTRL_CODE_BEGIN + && *str != EOS) + { + str++; + wordLen++; + } + if (!task->tUseTemporaryLyrics) + sUnknownBardRelated = MACRO2(bard->songLyrics[task->tCurrWord]); + else + sUnknownBardRelated = MACRO2(bard->temporaryLyrics[task->tCurrWord]); + temp = gBardSong.length / wordLen; + zero = 0; + gBardSong.length = temp; + if (gBardSong.length <= 0) + gBardSong.length = 1; + task->tCurrWord++; + if (task->data[2] == 0) + task->tState = 3; + else + task->tState = 5; + task->data[1] = zero; + } + break; + case 5: + if (task->data[2] == 0) + task->tState = 3; + else + task->data[2]--; + break; + case 3: + if (gStringVar4[task->tCharIndex] == EOS) + { + FadeInBGM(6); + m4aMPlayFadeOutTemporarily(&gMPlayInfo_SE2, 2); + EnableBothScriptContexts(); + DestroyTask(taskId); + } + else if (gStringVar4[task->tCharIndex] == CHAR_SPACE) + { + + sub_81206F0(); + task->tCharIndex++; + task->tState = 2; + task->data[2] = 0; + } + else if (gStringVar4[task->tCharIndex] == CHAR_NEWLINE) + { + task->tCharIndex++; + task->tState = 2; + task->data[2] = 0; + } + else if (gStringVar4[task->tCharIndex] == EXT_CTRL_CODE_BEGIN) + { + task->tCharIndex += 2; // skip over control codes + task->tState = 2; + task->data[2] = 8; + } + else if (gStringVar4[task->tCharIndex] == CHAR_SONG_WORD_SEPARATOR) + { + gStringVar4[task->tCharIndex] = CHAR_SPACE; // restore it back to a space + sub_81206F0(); + task->tCharIndex++; + task->data[2] = 0; + } + else + { + switch (task->data[1]) + { + case 0: + sub_81206F0(); + task->data[1]++; + break; + case 1: + task->data[1]++; + break; + case 2: + task->tCharIndex++; + task->data[1] = 0; + task->data[2] = gBardSong.length; + task->tState = 4; + break; + } + } + break; + case 4: + task->data[2]--; + if (task->data[2] == 0) + task->tState = 3; + break; + } + sub_8197224(); +} + +void ScrSpecial_SetMauvilleOldManMapObjGfx(void) +{ + VarSet(VAR_0x4010, MAP_OBJ_GFX_BARD); +} + +// Language fixers? + +void sub_8120B70(union OldMan * oldMan) +{ + s32 i; + u8 sp00[8]; + + switch (oldMan->common.id) + { + case MAUVILLE_MAN_TRADER: + { + struct MauvilleOldManTrader * trader = &oldMan->trader; + for (i = 0; i < 4; i++) + { + if (trader->language[i] == LANGUAGE_JAPANESE) + { + ConvertInternationalString(trader->playerNames[i], LANGUAGE_JAPANESE); + } + } + } + break; + case MAUVILLE_MAN_STORYTELLER: + { + struct MauvilleManStoryteller * storyteller = &oldMan->storyteller; + for (i = 0; i < 4; i++) + { + if (storyteller->gameStatIDs[i] != 0) + { + memcpy(sp00, storyteller->trainerNames[i], 7); + sp00[7] = EOS; + if (IsStringJapanese(sp00)) + { + memset(sp00, CHAR_SPACE, 8); + StringCopy(sp00, gText_Friend); + memcpy(storyteller->trainerNames[i], sp00, 7); + storyteller->language[i] = GAME_LANGUAGE; + } + } + } + } + break; + } +} + +void sub_8120C0C(union OldMan * oldMan, u32 r8, u32 r7, u32 r3) +{ + s32 i; + + switch (oldMan->common.id) + { + case MAUVILLE_MAN_TRADER: + { + struct MauvilleOldManTrader * trader = &oldMan->trader; + + for (i = 0; i < 4; i++) + { + if (IsStringJapanese(trader->playerNames[i])) + { + trader->language[i] = r8; + } + else + { + trader->language[i] = r7; + } + } + } + break; + case MAUVILLE_MAN_STORYTELLER: + { + struct MauvilleManStoryteller * storyteller = &oldMan->storyteller; + + for (i = 0; i < 4; i++) + { + if (IsStringJapanese(storyteller->trainerNames[i])) + { + storyteller->language[i] = r8; + } + else + { + storyteller->language[i] = r7; + } + } + } + break; + case MAUVILLE_MAN_BARD: + { + struct MauvilleManBard * bard = &oldMan->bard; + + if (r3 == LANGUAGE_JAPANESE) + bard->language = r8; + else + bard->language = r7; + } + break; + case MAUVILLE_MAN_HIPSTER: + { + struct MauvilleManHipster * hipster = &oldMan->hipster; + + if (r3 == LANGUAGE_JAPANESE) + hipster->language = r8; + else + hipster->language = r7; + } + break; + case MAUVILLE_MAN_GIDDY: + { + struct MauvilleManGiddy * giddy = &oldMan->giddy; + + if (r3 == LANGUAGE_JAPANESE) + giddy->language = r8; + else + giddy->language = r7; + } + break; + } +} + +void sub_8120CD0(union OldMan * oldMan, u32 unused, u32 a2) +{ + u8 sp00[8]; + s32 i; + if (oldMan->common.id == MAUVILLE_MAN_STORYTELLER && a2 == LANGUAGE_JAPANESE) + { + struct MauvilleManStoryteller * storyteller = &oldMan->storyteller; + + for (i = 0; i < 4; i++) + { + if (storyteller->gameStatIDs[i] != 0) + { + memcpy(sp00, storyteller->trainerNames[i], 7); + sp00[7] = EOS; + if (IsStringJapanese(sp00)) + storyteller->language[i] = LANGUAGE_JAPANESE; + else + storyteller->language[i] = GAME_LANGUAGE; + } + } + } +} + +void sub_8120D34(union OldMan * oldMan, u32 r1, u32 r6) +{ + u32 r2 = (r1 == LANGUAGE_JAPANESE || r1 == LANGUAGE_ENGLISH) ? 1 : 0; + switch (oldMan->common.id) + { + case MAUVILLE_MAN_TRADER: + { + struct MauvilleOldManTrader * trader = &oldMan->trader; + s32 i; + + if (r2) + { + for (i = 0; i < 4; i++) + { + u8 * str = trader->playerNames[i]; + if (str[0] == EXT_CTRL_CODE_BEGIN && str[1] == EXT_CTRL_CODE_JPN) + { + StripExtCtrlCodes(str); + trader->language[i] = LANGUAGE_JAPANESE; + } + else + trader->language[i] = r6; + } + } + else + { + for (i = 0; i < 4; i++) + { + if (trader->language[i] == LANGUAGE_JAPANESE) + { + StripExtCtrlCodes(trader->playerNames[i]); + } + } + } + } + break; + case MAUVILLE_MAN_STORYTELLER: + { + + struct MauvilleManStoryteller * storyteller = &oldMan->storyteller; + s32 i; + + if (r2) + { + for (i = 0; i < 4; i++) + { + if (storyteller->gameStatIDs[i] != 0) + storyteller->language[i] = r6; + } + } + } + break; + case MAUVILLE_MAN_BARD: + { + struct MauvilleManBard * bard = &oldMan->bard; + + if (r2) + { + bard->language = r6; + } + } + break; + case MAUVILLE_MAN_HIPSTER: + { + struct MauvilleManHipster * hipster = &oldMan->hipster; + + if (r2) + { + hipster->language = r6; + } + } + break; + case MAUVILLE_MAN_GIDDY: + { + struct MauvilleManGiddy * giddy = &oldMan->giddy; + + if (r2) + { + giddy->language = r6; + } + } + break; + } +} + +struct Story +{ + u8 stat; + u8 minVal; + const u8 *title; + const u8 *action; + const u8 *fullText; +}; + +static const struct Story sStorytellerStories[] = { + {GAME_STAT_50, 1, MauvilleCity_PokemonCenter_1F_Text_28E930, MauvilleCity_PokemonCenter_1F_Text_28E947, MauvilleCity_PokemonCenter_1F_Text_28E956}, + {GAME_STAT_STARTED_TRENDS, 1, MauvilleCity_PokemonCenter_1F_Text_28E9D7, MauvilleCity_PokemonCenter_1F_Text_28E9EF, MauvilleCity_PokemonCenter_1F_Text_28E9FE}, + {GAME_STAT_PLANTED_BERRIES, 1, MauvilleCity_PokemonCenter_1F_Text_28EA7D, MauvilleCity_PokemonCenter_1F_Text_28EA98, MauvilleCity_PokemonCenter_1F_Text_28EAA8}, + {GAME_STAT_TRADED_BIKES, 1, MauvilleCity_PokemonCenter_1F_Text_28EB19, MauvilleCity_PokemonCenter_1F_Text_28EB31, MauvilleCity_PokemonCenter_1F_Text_28EB3E}, + {GAME_STAT_GOT_INTERVIEWED, 1, MauvilleCity_PokemonCenter_1F_Text_28EBB5, MauvilleCity_PokemonCenter_1F_Text_28EBCD, MauvilleCity_PokemonCenter_1F_Text_28EBDD}, + {GAME_STAT_TRAINER_BATTLES, 1, MauvilleCity_PokemonCenter_1F_Text_28EC60, MauvilleCity_PokemonCenter_1F_Text_28EC79, MauvilleCity_PokemonCenter_1F_Text_28EC81}, + {GAME_STAT_POKEMON_CAPTURES, 1, MauvilleCity_PokemonCenter_1F_Text_28ED04, MauvilleCity_PokemonCenter_1F_Text_28ED21, MauvilleCity_PokemonCenter_1F_Text_28ED30}, + {GAME_STAT_FISHING_CAPTURES, 1, MauvilleCity_PokemonCenter_1F_Text_28EDA1, MauvilleCity_PokemonCenter_1F_Text_28EDB5, MauvilleCity_PokemonCenter_1F_Text_28EDCF}, + {GAME_STAT_HATCHED_EGGS, 1, MauvilleCity_PokemonCenter_1F_Text_28EE45, MauvilleCity_PokemonCenter_1F_Text_28EE5D, MauvilleCity_PokemonCenter_1F_Text_28EE6A}, + {GAME_STAT_EVOLVED_POKEMON, 1, MauvilleCity_PokemonCenter_1F_Text_28EEDD, MauvilleCity_PokemonCenter_1F_Text_28EEF1, MauvilleCity_PokemonCenter_1F_Text_28EF01}, + {GAME_STAT_USED_POKECENTER, 1, MauvilleCity_PokemonCenter_1F_Text_28EF73, MauvilleCity_PokemonCenter_1F_Text_28EF95, MauvilleCity_PokemonCenter_1F_Text_28EFAA}, + {GAME_STAT_RESTED_AT_HOME, 1, MauvilleCity_PokemonCenter_1F_Text_28F045, MauvilleCity_PokemonCenter_1F_Text_28F05A, MauvilleCity_PokemonCenter_1F_Text_28F071}, + {GAME_STAT_ENTERED_SAFARI_ZONE, 1, MauvilleCity_PokemonCenter_1F_Text_28F0F3, MauvilleCity_PokemonCenter_1F_Text_28F10D, MauvilleCity_PokemonCenter_1F_Text_28F125}, + {GAME_STAT_USED_CUT, 1, MauvilleCity_PokemonCenter_1F_Text_28F1BE, MauvilleCity_PokemonCenter_1F_Text_28F1D5, MauvilleCity_PokemonCenter_1F_Text_28F1DE}, + {GAME_STAT_USED_ROCK_SMASH, 1, MauvilleCity_PokemonCenter_1F_Text_28F24F, MauvilleCity_PokemonCenter_1F_Text_28F269, MauvilleCity_PokemonCenter_1F_Text_28F277}, + {GAME_STAT_MOVED_SECRET_BASE, 1, MauvilleCity_PokemonCenter_1F_Text_28F2FC, MauvilleCity_PokemonCenter_1F_Text_28F314, MauvilleCity_PokemonCenter_1F_Text_28F32A}, + {GAME_STAT_USED_SPLASH, 1, MauvilleCity_PokemonCenter_1F_Text_28F3AD, MauvilleCity_PokemonCenter_1F_Text_28F3C6, MauvilleCity_PokemonCenter_1F_Text_28F3D2}, + {GAME_STAT_USED_STRUGGLE, 1, MauvilleCity_PokemonCenter_1F_Text_28F44B, MauvilleCity_PokemonCenter_1F_Text_28F461, MauvilleCity_PokemonCenter_1F_Text_28F47C}, + {GAME_STAT_SLOT_JACKPOTS, 1, MauvilleCity_PokemonCenter_1F_Text_28F50C, MauvilleCity_PokemonCenter_1F_Text_28F51B, MauvilleCity_PokemonCenter_1F_Text_28F538}, + {GAME_STAT_CONSECUTIVE_ROULETTE_WINS, 2, MauvilleCity_PokemonCenter_1F_Text_28F5BE, MauvilleCity_PokemonCenter_1F_Text_28F5D1, MauvilleCity_PokemonCenter_1F_Text_28F5F2}, + {GAME_STAT_ENTERED_BATTLE_TOWER, 1, MauvilleCity_PokemonCenter_1F_Text_28F678, MauvilleCity_PokemonCenter_1F_Text_28F694, MauvilleCity_PokemonCenter_1F_Text_28F6B4}, + {GAME_STAT_POKEBLOCKS, 1, MauvilleCity_PokemonCenter_1F_Text_28F751, MauvilleCity_PokemonCenter_1F_Text_28F76A, MauvilleCity_PokemonCenter_1F_Text_28F776}, + {GAME_STAT_ENTERED_CONTEST, 1, MauvilleCity_PokemonCenter_1F_Text_28F7F6, MauvilleCity_PokemonCenter_1F_Text_28F811, MauvilleCity_PokemonCenter_1F_Text_28F822}, + {GAME_STAT_WON_CONTEST, 1, MauvilleCity_PokemonCenter_1F_Text_28F89C, MauvilleCity_PokemonCenter_1F_Text_28F8AF, MauvilleCity_PokemonCenter_1F_Text_28F8BC}, + {GAME_STAT_SHOPPED, 1, MauvilleCity_PokemonCenter_1F_Text_28F92F, MauvilleCity_PokemonCenter_1F_Text_28F941, MauvilleCity_PokemonCenter_1F_Text_28F949}, + {GAME_STAT_USED_ITEMFINDER, 1, MauvilleCity_PokemonCenter_1F_Text_28F9D1, MauvilleCity_PokemonCenter_1F_Text_28F9EA, MauvilleCity_PokemonCenter_1F_Text_28F9FD}, + {GAME_STAT_GOT_RAINED_ON, 1, MauvilleCity_PokemonCenter_1F_Text_28FA81, MauvilleCity_PokemonCenter_1F_Text_28FA99, MauvilleCity_PokemonCenter_1F_Text_28FAA7}, + {GAME_STAT_CHECKED_POKEDEX, 1, MauvilleCity_PokemonCenter_1F_Text_28FB1D, MauvilleCity_PokemonCenter_1F_Text_28FB35, MauvilleCity_PokemonCenter_1F_Text_28FB47}, + {GAME_STAT_RECEIVED_RIBBONS, 1, MauvilleCity_PokemonCenter_1F_Text_28FBC4, MauvilleCity_PokemonCenter_1F_Text_28FBD9, MauvilleCity_PokemonCenter_1F_Text_28FBEA}, + {GAME_STAT_JUMPED_DOWN_LEDGES, 1, MauvilleCity_PokemonCenter_1F_Text_28FC6B, MauvilleCity_PokemonCenter_1F_Text_28FC85, MauvilleCity_PokemonCenter_1F_Text_28FC98}, + {GAME_STAT_WATCHED_TV, 1, MauvilleCity_PokemonCenter_1F_Text_28FD1D, MauvilleCity_PokemonCenter_1F_Text_28FD35, MauvilleCity_PokemonCenter_1F_Text_28FD40}, + {GAME_STAT_CHECKED_CLOCK, 1, MauvilleCity_PokemonCenter_1F_Text_28FDA2, MauvilleCity_PokemonCenter_1F_Text_28FDBD, MauvilleCity_PokemonCenter_1F_Text_28FDCE}, + {GAME_STAT_WON_POKEMON_LOTTERY, 1, MauvilleCity_PokemonCenter_1F_Text_28FE57, MauvilleCity_PokemonCenter_1F_Text_28FE72, MauvilleCity_PokemonCenter_1F_Text_28FE88}, + {GAME_STAT_USED_DAYCARE, 1, MauvilleCity_PokemonCenter_1F_Text_28FF0C, MauvilleCity_PokemonCenter_1F_Text_28FF27, MauvilleCity_PokemonCenter_1F_Text_28FF44}, + {GAME_STAT_RODE_CABLE_CAR, 1, MauvilleCity_PokemonCenter_1F_Text_28FFDD, MauvilleCity_PokemonCenter_1F_Text_28FFFA, MauvilleCity_PokemonCenter_1F_Text_29000D}, + {GAME_STAT_ENTERED_HOT_SPRINGS, 1, MauvilleCity_PokemonCenter_1F_Text_290097, MauvilleCity_PokemonCenter_1F_Text_2900B5, MauvilleCity_PokemonCenter_1F_Text_2900CB} +}; + +static void StorytellerSetup(void) +{ + s32 i; + sStorytellerPtr = &gSaveBlock1Ptr->oldMan.storyteller; + + sStorytellerPtr->id = MAUVILLE_MAN_STORYTELLER; + sStorytellerPtr->alreadyRecorded = FALSE; + for (i = 0; i < 4; i++) + { + sStorytellerPtr->gameStatIDs[i] = 0; + sStorytellerPtr->trainerNames[0][i] = EOS; // Maybe they meant storyteller->trainerNames[i][0] instead? + } +} + +static void Storyteller_ResetFlag(void) +{ + sStorytellerPtr = &gSaveBlock1Ptr->oldMan.storyteller; + + sStorytellerPtr->id = MAUVILLE_MAN_STORYTELLER; + sStorytellerPtr->alreadyRecorded = FALSE; +} + +static u32 StorytellerGetGameStat(u8 stat) +{ + if (stat == 50) + stat = 0; + return GetGameStat(stat); +} + +static const struct Story *GetStoryByStat(u32 stat) +{ + s32 i; + + for (i = 0; i < 36; i++) + { + if (sStorytellerStories[i].stat == stat) + return &sStorytellerStories[i]; + } + return &sStorytellerStories[35]; +} + +static const u8 *GetStoryTitleByStat(u32 stat) +{ + return GetStoryByStat(stat)->title; +} + +static const u8 *GetStoryTextByStat(u32 stat) +{ + return GetStoryByStat(stat)->fullText; +} + +static const u8 *GetStoryActionByStat(u32 stat) +{ + return GetStoryByStat(stat)->action; +} + +static u8 GetFreeStorySlot(void) +{ + u8 i; + + for (i = 0; i < 4; i++) + { + if (sStorytellerPtr->gameStatIDs[i] == 0) + break; + } + return i; +} + +static u32 StorytellerGetRecordedTrainerStat(u32 trainer) +{ + u8 *ptr = sStorytellerPtr->statValues[trainer]; + + return ptr[0] | (ptr[1] << 8) | (ptr[2] << 16) | (ptr[3] << 24); +} + +static void StorytellerSetRecordedTrainerStat(u32 trainer, u32 val) +{ + u8 *ptr = sStorytellerPtr->statValues[trainer]; + + ptr[0] = val; + ptr[1] = val >> 8; + ptr[2] = val >> 16; + ptr[3] = val >> 24; +} + +static bool32 HasTrainerStatIncreased(u32 trainer) +{ + if (StorytellerGetGameStat(sStorytellerPtr->gameStatIDs[trainer]) > StorytellerGetRecordedTrainerStat(trainer)) + return TRUE; + else + return FALSE; +} + +static void GetStoryByStattellerPlayerName(u32 player, void *dst) +{ + u8 *name = sStorytellerPtr->trainerNames[player]; + + memset(dst, EOS, 8); + memcpy(dst, name, 7); +} + +static void StorytellerSetPlayerName(u32 player, const u8 * src) +{ + u8 * name = sStorytellerPtr->trainerNames[player]; + memset(name, EOS, 7); + memcpy(name, src, 7); +} + + +static void StorytellerRecordNewStat(u32 player, u32 stat) +{ + sStorytellerPtr->gameStatIDs[player] = stat; + StorytellerSetPlayerName(player, gSaveBlock2Ptr->playerName); + StorytellerSetRecordedTrainerStat(player, StorytellerGetGameStat(stat)); + ConvertIntToDecimalStringN(gStringVar1, StorytellerGetGameStat(stat), STR_CONV_MODE_LEFT_ALIGN, 10); + StringCopy(gStringVar2, GetStoryActionByStat(stat)); + sStorytellerPtr->language[player] = gGameLanguage; +} + +static void ScrambleStatList(u8 * arr, s32 count) +{ + s32 i; + + for (i = 0; i < count; i++) + arr[i] = i; + for (i = 0; i < count; i++) + { + u32 a = Random() % count; + u32 b = Random() % count; + u8 temp = arr[a]; + arr[a] = arr[b]; + arr[b] = temp; + } +} + +struct UnknownStruct_0859F288 +{ + s32 length; + u32 unused2; +}; + +static const struct UnknownStruct_0859F288 sStorytellerStuff = { + ARRAY_COUNT(sStorytellerStories), + sizeof(sStorytellerStuff) +}; + +static bool8 StorytellerInitializeRandomStat(void) +{ + u8 arr[sStorytellerStuff.length]; + s32 i; + s32 j; + + ScrambleStatList(arr, ARRAY_COUNT(sStorytellerStories)); + for (i = 0; i < (s32)ARRAY_COUNT(sStorytellerStories); i++) + { + u8 stat = sStorytellerStories[arr[i]].stat; + u8 minVal = sStorytellerStories[arr[i]].minVal; + + for (j = 0; j < 4; j++) + { + if (sStorytellerPtr->gameStatIDs[j] == stat) + break; + } + if (j == 4 && StorytellerGetGameStat(stat) >= minVal) + { + sStorytellerPtr->alreadyRecorded = TRUE; + if (GetFreeStorySlot() == 4) + StorytellerRecordNewStat(sSelectedStory, stat); + else + StorytellerRecordNewStat(GetFreeStorySlot(), stat); + return TRUE; + } + } + return FALSE; +} + +static void StorytellerDisplayStory(u32 player) +{ + u8 stat = sStorytellerPtr->gameStatIDs[player]; + + ConvertIntToDecimalStringN(gStringVar1, StorytellerGetRecordedTrainerStat(player), 0, 10); + StringCopy(gStringVar2, GetStoryActionByStat(stat)); + GetStoryByStattellerPlayerName(player, gStringVar3); + ConvertInternationalString(gStringVar3, sStorytellerPtr->language[player]); + ShowFieldMessage(GetStoryTextByStat(stat)); +} + +static void PrintStoryList(void) +{ + s32 i; + s32 width = GetStringWidth(1, gText_Exit, 0); + u8 tileWidth; + for (i = 0; i < 4; i++) + { + s32 curWidth; + u16 gameStatID = sStorytellerPtr->gameStatIDs[i]; + + if (gameStatID == 0) + break; + curWidth = GetStringWidth(1, GetStoryTitleByStat(gameStatID), 0); + if (curWidth > width) + width = curWidth; + } + sStorytellerWindowId = CreateWindowFromRect(0, 0, convert_pixel_width_to_tile_width(width), GetFreeStorySlot() * 2 + 2); + SetStandardWindowBorderStyle(sStorytellerWindowId, 0); + for (i = 0; i < 4; i++) + { + u16 gameStatID = sStorytellerPtr->gameStatIDs[i]; + if (gameStatID == 0) + break; + PrintTextOnWindow(sStorytellerWindowId, 1, GetStoryTitleByStat(gameStatID), 8, 16 * i + 1, 0xFF, NULL); + } + PrintTextOnWindow(sStorytellerWindowId, 1, gText_Exit, 8, 16 * i + 1, 0xFF, NULL); + InitMenuInUpperLeftCornerPlaySoundWhenAPressed(sStorytellerWindowId, GetFreeStorySlot() + 1, 0); + CopyWindowToVram(sStorytellerWindowId, 3); +} + +static void Task_StoryListMenu(u8 taskId) // Task_StoryListMenu +{ + struct Task *task = &gTasks[taskId]; + s32 selection; + + switch (task->data[0]) + { + case 0: + PrintStoryList(); + task->data[0]++; + break; + case 1: + selection = ProcessMenuInput(); + if (selection == -2) + break; + if (selection == -1 || selection == GetFreeStorySlot()) + { + gSpecialVar_Result = 0; + } + else + { + gSpecialVar_Result = 1; + sSelectedStory = selection; + } + sub_80E2A78(sStorytellerWindowId); + DestroyTask(taskId); + EnableBothScriptContexts(); + break; + } +} + +// Sets gSpecialVar_Result to TRUE if player selected a story +void ScrSpecial_StorytellerStoryListMenu(void) +{ + CreateTask(Task_StoryListMenu, 80); +} + +void ScrSpecial_StorytellerDisplayStory(void) +{ + StorytellerDisplayStory(sSelectedStory); +} + +u8 ScrSpecial_StorytellerGetFreeStorySlot(void) +{ + sStorytellerPtr = &gSaveBlock1Ptr->oldMan.storyteller; + return GetFreeStorySlot(); +} + +// Returns TRUE if stat has increased +bool8 ScrSpecial_StorytellerUpdateStat(void) +{ + u8 r4; + sStorytellerPtr = &gSaveBlock1Ptr->oldMan.storyteller; + r4 = sStorytellerPtr->gameStatIDs[sSelectedStory]; + + if (HasTrainerStatIncreased(sSelectedStory) == TRUE) + { + StorytellerRecordNewStat(sSelectedStory, r4); + return TRUE; + } + return FALSE; +} + +bool8 ScrSpecial_HasStorytellerAlreadyRecorded(void) +{ + sStorytellerPtr = &gSaveBlock1Ptr->oldMan.storyteller; + + if (sStorytellerPtr->alreadyRecorded == FALSE) + return FALSE; + else + return TRUE; +} + +bool8 ScrSpecial_StorytellerInitializeRandomStat(void) +{ + sStorytellerPtr = &gSaveBlock1Ptr->oldMan.storyteller; + return StorytellerInitializeRandomStat(); +} + diff --git a/src/trader.c b/src/trader.c index 4914f8140..c4d70ac9a 100644 --- a/src/trader.c +++ b/src/trader.c @@ -15,7 +15,7 @@ #include "task.h" #include "script_menu.h" -static const u8 * const gUnknown_085B09E4[] = +static const u8 * const sDefaultTraderNames[] = { gText_Tristan, gText_Philip, @@ -23,7 +23,7 @@ static const u8 * const gUnknown_085B09E4[] = gText_Roberto, }; -static const u8 gTraderDecorations[] = +static const u8 sDefaultTraderDecorations[] = { DECOR_DUSKULL_DOLL, DECOR_BALL_CUSHION, @@ -41,13 +41,13 @@ void TraderSetup(void) for (i = 0; i < 4; i++) { - StringCopy(trader->unk5[i], gUnknown_085B09E4[i]); - trader->unk1[i] = gTraderDecorations[i]; + StringCopy(trader->playerNames[i], sDefaultTraderNames[i]); + trader->decorIds[i] = sDefaultTraderDecorations[i]; trader->language[i] = GAME_LANGUAGE; } } -void sub_8133A60(void) +void Trader_ResetFlag(void) { struct MauvilleOldManTrader *trader = &gSaveBlock1Ptr->oldMan.trader; trader->alreadyTraded = FALSE; @@ -64,10 +64,10 @@ void CreateAvailableDecorationsMenu(u8 taskId) for (i = 0; i < 4; i++) { s32 curWidth; - if (trader->unk1[i] > NUM_DECORATIONS) + if (trader->decorIds[i] > NUM_DECORATIONS) curWidth = fiveMarksWidth; else - curWidth = GetStringWidth(1, gDecorations[trader->unk1[i]].name, 0); + curWidth = GetStringWidth(1, gDecorations[trader->decorIds[i]].name, 0); if (curWidth > windowWidth) windowWidth = curWidth; } @@ -76,10 +76,10 @@ void CreateAvailableDecorationsMenu(u8 taskId) SetWindowBorderStyle(data[3], FALSE, 0x214, 14); for (i = 0; i < 4; i++) { - if (trader->unk1[i] > NUM_DECORATIONS) + if (trader->decorIds[i] > NUM_DECORATIONS) PrintTextOnWindow(data[3], 1, gText_FiveMarks, 8, 16 * i + 1, 255, NULL); else - PrintTextOnWindow(data[3], 1, gDecorations[trader->unk1[i]].name, 8, 16 * i + 1, 255, NULL); + PrintTextOnWindow(data[3], 1, gDecorations[trader->decorIds[i]].name, 8, 16 * i + 1, 255, NULL); } PrintTextOnWindow(data[3], 1, gText_Exit, 8, 16 * i + 1, 255, NULL); InitMenuInUpperLeftCornerPlaySoundWhenAPressed(data[3], 5, 0); @@ -123,9 +123,9 @@ void Task_HandleGetDecorationMenuInput(u8 taskId) default: PlaySE(SE_SELECT); gSpecialVar_0x8005 = input; - StringCopy(gStringVar1, trader->unk5[input]); + StringCopy(gStringVar1, trader->playerNames[input]); ConvertInternationalString(gStringVar1, trader->language[input]); - sub_8133BE4(taskId, trader->unk1[input]); + sub_8133BE4(taskId, trader->decorIds[input]); break; } } @@ -196,8 +196,8 @@ void ScrSpecial_TraderDoDecorationTrade(void) DecorationRemove(gSpecialVar_0x8006); DecorationAdd(gSpecialVar_0x8004); - StringCopy(trader->unk5[gSpecialVar_0x8005], gSaveBlock2Ptr->playerName); - trader->unk1[gSpecialVar_0x8005] = gSpecialVar_0x8006; + StringCopy(trader->playerNames[gSpecialVar_0x8005], gSaveBlock2Ptr->playerName); + trader->decorIds[gSpecialVar_0x8005] = gSpecialVar_0x8006; trader->language[gSpecialVar_0x8005] = GAME_LANGUAGE; trader->alreadyTraded = TRUE; } diff --git a/sym_bss.txt b/sym_bss.txt index 24e6afa3b..186ff8ced 100644 --- a/sym_bss.txt +++ b/sym_bss.txt @@ -28,11 +28,9 @@ .include "src/script_menu.o" .include "src/record_mixing.o" .include "src/tv.o" + .include "src/mauville_old_man.o" - .space 1 @ TODO: define this u32 in mauville_old_man -gUnknown_03001178: @ 3001178 - .space 0x4 - + .align 2 gUnknown_0300117C: @ 300117C .space 0x4 diff --git a/sym_common.txt b/sym_common.txt index aabef2873..bbb29fd42 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -47,9 +47,7 @@ gUnknown_030060B8: @ 30060B8 .space 0x4 .include "tv.o" - -gUnknown_03006130: @ 3006130 - .space 0x34 + .include "mauville_old_man.o" gUnknown_03006164: @ 3006164 .space 0x4 diff --git a/sym_ewram.txt b/sym_ewram.txt index 4420ce70e..dd41ff5ac 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -531,16 +531,7 @@ gUnknown_0203A11C: @ 203A11C gUnknown_0203A120: @ 203A120 .space 0x4 .include "src/mon_markings.o" - -gUnknown_0203A128: @ 203A128 - .space 0x4 - -gUnknown_0203A12C: @ 203A12C - .space 0x4 - -gUnknown_0203A130: @ 203A130 - .space 0x4 - + .include "src/mauville_old_man.o" .include "src/mail.o" gUnknown_0203A138: @ 203A138