From c6115a2fec2955803e65eedf5e8de1b8a134c188 Mon Sep 17 00:00:00 2001 From: PikalaxALT Date: Thu, 3 May 2018 17:03:52 -0400 Subject: [PATCH] through sub_8120C0C --- asm/mauville_old_man.s | 467 +------------------------------ common_syms/mauville_old_man.txt | 1 + data/mauville_old_man.s | 24 -- include/event_scripts.h | 110 ++++++++ include/global.h | 3 + include/mauville_old_man.h | 1 + include/strings.h | 2 + src/mauville_old_man.c | 310 +++++++++++++++++++- sym_common.txt | 4 +- sym_ewram.txt | 11 +- 10 files changed, 427 insertions(+), 506 deletions(-) create mode 100644 common_syms/mauville_old_man.txt diff --git a/asm/mauville_old_man.s b/asm/mauville_old_man.s index 4ab632aff..e9f543fb0 100644 --- a/asm/mauville_old_man.s +++ b/asm/mauville_old_man.s @@ -5,471 +5,6 @@ .text - 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} @@ -732,7 +267,7 @@ _08120EA0: adds r2, 0x1 cmp r2, 0x23 ble _08120E90 - ldr r0, =gUnknown_0859F278 + ldr r0, =gUnknown_0859F048+0x230 _08120EAA: pop {r1} bx r1 diff --git a/common_syms/mauville_old_man.txt b/common_syms/mauville_old_man.txt new file mode 100644 index 000000000..cc2c037c3 --- /dev/null +++ b/common_syms/mauville_old_man.txt @@ -0,0 +1 @@ +gUnknown_03006130 \ No newline at end of file diff --git a/data/mauville_old_man.s b/data/mauville_old_man.s index f58909390..fe7056541 100644 --- a/data/mauville_old_man.s +++ b/data/mauville_old_man.s @@ -4,29 +4,5 @@ .section .rodata .align 2, 0 -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/include/event_scripts.h b/include/event_scripts.h index a964b1a67..c187682b0 100644 --- a/include/event_scripts.h +++ b/include/event_scripts.h @@ -414,4 +414,114 @@ 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 d3506d345..083ed3e9f 100644 --- a/include/global.h +++ b/include/global.h @@ -453,6 +453,7 @@ struct MauvilleManStoryteller u8 gameStatIDs[4]; u8 trainerNames[4][7]; u8 statValues[4][4]; + u8 unk34[4]; }; struct MauvilleManGiddy @@ -478,6 +479,7 @@ struct MauvilleOldManTrader u8 unk1[4]; u8 unk5[4][11]; u8 unk31; + u8 unk32[4]; }; typedef union OldMan @@ -487,6 +489,7 @@ typedef union OldMan 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 0fc9fd6eb..28cd5589e 100644 --- a/include/mauville_old_man.h +++ b/include/mauville_old_man.h @@ -13,5 +13,6 @@ enum MauvilleOldManType void SetMauvilleOldMan(void); u8 sub_81201C8(void); +extern struct BardSong gUnknown_03006130; #endif // GUARD_MAUVILLE_OLD_MAN_H diff --git a/include/strings.h b/include/strings.h index 7c81dbcfb..604437d32 100644 --- a/include/strings.h +++ b/include/strings.h @@ -429,5 +429,7 @@ extern const u8 gText_TooImportantToToss[]; extern const u8 gText_ConfirmTossItems[]; extern const u8 gText_MoveVar1Where[]; +extern const u8 gText_Friend[]; + #endif //GUARD_STRINGS_H diff --git a/src/mauville_old_man.c b/src/mauville_old_man.c index fa486748b..b0e7fb491 100644 --- a/src/mauville_old_man.c +++ b/src/mauville_old_man.c @@ -1,6 +1,9 @@ #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" @@ -13,7 +16,8 @@ #include "menu.h" #include "m4a.h" #include "bard_music.h" -#include "constants/songs.h" +#include "sound.h" +#include "strings.h" #define CHAR_SONG_WORD_SEPARATOR 0x37 @@ -28,6 +32,12 @@ void sub_8120E50(void); void sub_81339F8(void); // TraderSetup void sub_8133A60(void); +struct BardSong gUnknown_03006130; + +EWRAM_DATA u16 gUnknown_0203A128 = 0; +EWRAM_DATA struct MauvilleOldMan * gUnknown_0203A12C = NULL; +EWRAM_DATA u8 gUnknown_0203A130 = 0; + static const u16 sDefaultBardSongLyrics[6] = { EC_WORD_SHAKE, EC_WORD_IT, @@ -409,6 +419,7 @@ void sub_8120670(void) // ResetMauvilleOldManFlag #define tUseTemporaryLyrics data[5] #define MACRO1(a) (((a) & 3) + (((a) / 8) & 1)) +#define MACRO2(a) (((a) % 4) + (((a) / 8) & 1)) void sub_81206C0(bool8 useTemporaryLyrics) { @@ -417,7 +428,7 @@ void sub_81206C0(bool8 useTemporaryLyrics) gTasks[taskId].tUseTemporaryLyrics = useTemporaryLyrics; } -void sub_81206F0(struct TextSubPrinter * printer, u16 a1) +void sub_81206F0(void) { gUnknown_03002F84 = FALSE; } @@ -435,7 +446,7 @@ void sub_8120708(const u8 * src) CopyWindowToVram(0, 3); } -void sub_8120748(struct Task *task, struct BardSong *song) +void sub_8120748(struct Task *task, struct BardSong *song) // BardSing { switch (task->tState) { @@ -537,3 +548,296 @@ void sub_8120748(struct Task *task, struct BardSong *song) break; } } + +void sub_8120944(u8 taskId) +{ + struct Task *task = &gTasks[taskId]; // r5 + + sub_8120748(task, &gUnknown_03006130); + switch (task->tState) + { + case 0: // Initialize song + sub_8120280(); + 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) + gUnknown_0203A128 = MACRO2(bard->songLyrics[task->tCurrWord]); + else + gUnknown_0203A128 = MACRO2(bard->temporaryLyrics[task->tCurrWord]); + temp = gUnknown_03006130.length / wordLen; + zero = 0; + gUnknown_03006130.length = temp; + if (gUnknown_03006130.length <= 0) + gUnknown_03006130.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] = gUnknown_03006130.length; + task->tState = 4; + break; + } + } + break; + case 4: + task->data[2]--; + if (task->data[2] == 0) + task->tState = 3; + break; + } + sub_8197224(); +} + +void sub_8120B5C(void) +{ + VarSet(VAR_0x4010, MAP_OBJ_GFX_BARD); +} + +struct Story +{ + u8 stat; + u8 minVal; + const u8 *title; + const u8 *action; + const u8 *fullText; +}; + +const struct Story gUnknown_0859F048[] = { + {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} +}; + +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->unk32[i] == LANGUAGE_JAPANESE) + { + ConvertInternationalString(trader->unk5[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->unk34[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->unk5[i])) + { + trader->unk32[i] = r8; + } + else + { + trader->unk32[i] = r7; + } + } + } + break; + case MAUVILLE_MAN_STORYTELLER: + { + struct MauvilleManStoryteller * storyteller = &oldMan->storyteller; + + for (i = 0; i < 4; i++) + { + if (IsStringJapanese(storyteller->trainerNames[i])) + { + storyteller->unk34[i] = r8; + } + else + { + storyteller->unk34[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; + } +} diff --git a/sym_common.txt b/sym_common.txt index b0548a84c..a9987b0e6 100644 --- a/sym_common.txt +++ b/sym_common.txt @@ -87,9 +87,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 9bf04d201..a77825605 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -549,16 +549,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