From 53bc1bd0d196ff5975c76be474d033db778aa6e2 Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 30 Sep 2019 00:09:29 -0400 Subject: [PATCH 1/2] Document text input strings --- data/text_input_strings.s | 92 +++++++++++++-------------- include/naming_screen.h | 16 +++-- include/strings.h | 93 +++++++++++++-------------- include/union_room_chat.h | 11 ++++ src/easy_chat.c | 21 ++++--- src/naming_screen.c | 116 ++++++++++++++++++---------------- src/union_room_chat.c | 128 +++++++++++++++++++++++++------------- 7 files changed, 273 insertions(+), 204 deletions(-) diff --git a/data/text_input_strings.s b/data/text_input_strings.s index 919b49416d..bb4006a1fc 100644 --- a/data/text_input_strings.s +++ b/data/text_input_strings.s @@ -5,142 +5,142 @@ .align 2 -gUnknown_862B810:: @ 862B810 +gText_EasyChatKeyboard_ABCDEFothers:: @ 862B810 .string "{CLEAR 11}A{CLEAR 6}B{CLEAR 6}C{CLEAR 26}D{CLEAR 6}E{CLEAR 6}F{CLEAR 26}others$" -gUnknown_862B832:: @ 862B832 +gText_EasyChatKeyboard_GHIJKL:: @ 862B832 .string "{CLEAR 11}G{CLEAR 6}H{CLEAR 6}I{CLEAR 26}J{CLEAR 6}K{CLEAR 6}L$" -gUnknown_862B84B:: @ 862B84B +gText_EasyChatKeyboard_MNOPQRS:: @ 862B84B .string "{CLEAR 11}M{CLEAR 6}N{CLEAR 6}O{CLEAR 26}P{CLEAR 6}Q{CLEAR 6}R{CLEAR 6}S{CLEAR 26} $" -gUnknown_862B86C:: @ 862B86C +gText_EasyChatKeyboard_TUVWXYZ:: @ 862B86C .string "{CLEAR 11}T{CLEAR 6}U{CLEAR 6}V{CLEAR 26}W{CLEAR 6}X{CLEAR 6}Y{CLEAR 6}Z{CLEAR 26} $" -gUnknown_0862B88D:: @ 862B88D +gText_NamingScreenKeyboard_abcdef:: @ 862B88D .string "{CLEAR 11}a{CLEAR 6}b{CLEAR 6}c{CLEAR 26}d{CLEAR 6}e{CLEAR 6}f{CLEAR 6} {CLEAR 30}.$" -gUnknown_0862B8AE:: @ 862B8AE +gText_NamingScreenKeyboard_ghijkl:: @ 862B8AE .string "{CLEAR 11}g{CLEAR 6}h{CLEAR 7}i{CLEAR 27}j{CLEAR 7}k{CLEAR 7}l{CLEAR 7} {CLEAR 30},$" -gUnknown_0862B8CF:: @ 862B8CF +gText_NamingScreenKeyboard_mnopqrs:: @ 862B8CF .string "{CLEAR 11}m{CLEAR 6}n{CLEAR 6}o{CLEAR 26}p{CLEAR 6}q{CLEAR 7}r{CLEAR 6}s{CLEAR 27} $" -gUnknown_0862B8F0:: @ 862B8F0 +gText_NamingScreenKeyboard_tuvwxyz:: @ 862B8F0 .string "{CLEAR 11}t{CLEAR 6}u{CLEAR 6}v{CLEAR 26}w{CLEAR 6}x{CLEAR 6}y{CLEAR 6}z{CLEAR 26} $" -gUnknown_0862B911:: @ 862B911 +gText_NamingScreenKeyboard_ABCDEF:: @ 862B911 .string "{CLEAR 11}A{CLEAR 6}B{CLEAR 6}C{CLEAR 26}D{CLEAR 6}E{CLEAR 6}F{CLEAR 6} {CLEAR 30}.$" -gUnknown_0862B932:: @ 862B932 +gText_NamingScreenKeyboard_GHIJKL:: @ 862B932 .string "{CLEAR 11}G{CLEAR 6}H{CLEAR 6}I{CLEAR 26}J{CLEAR 6}K{CLEAR 6}L{CLEAR 6} {CLEAR 30},$" -gUnknown_0862B953:: @ 862B953 +gText_NamingScreenKeyboard_MNOPQRS:: @ 862B953 .string "{CLEAR 11}M{CLEAR 6}N{CLEAR 6}O{CLEAR 26}P{CLEAR 6}Q{CLEAR 6}R{CLEAR 6}S{CLEAR 26} $" -gUnknown_0862B974:: @ 862B974 +gText_NamingScreenKeyboard_TUVWXYZ:: @ 862B974 .string "{CLEAR 11}T{CLEAR 6}U{CLEAR 6}V{CLEAR 26}W{CLEAR 6}X{CLEAR 6}Y{CLEAR 6}Z{CLEAR 26} $" -gUnknown_0862B995:: @ 862B995 +gText_NamingScreenKeyboard_01234:: @ 862B995 .string "{CLEAR 11}0{CLEAR 16}1{CLEAR 16}2{CLEAR 16}3{CLEAR 16}4{CLEAR 16} $" -gUnknown_0862B9AE:: @ 862B9AE +gText_NamingScreenKeyboard_56789:: @ 862B9AE .string "{CLEAR 11}5{CLEAR 16}6{CLEAR 16}7{CLEAR 16}8{CLEAR 16}9{CLEAR 16} $" -gUnknown_0862B9C7:: @ 862B9C7 +gText_NamingScreenKeyboard_Symbols1:: @ 862B9C7 .string "{CLEAR 12}!{CLEAR 17}?{CLEAR 16}♂{CLEAR 16}♀{CLEAR 16}/{CLEAR 17}-$" -gUnknown_0862B9E0:: @ 862B9E0 +gText_NamingScreenKeyboard_Symbols2:: @ 862B9E0 .string "{CLEAR 11}…{CLEAR 16}“{CLEAR 16}”{CLEAR 18}‘{CLEAR 19}'{CLEAR 18} $" -gUnknown_0862B9F9:: @ 862B9F9 +gText_UnionRoomChatKeyboard_ABCDE:: @ 862B9F9 .string "ABCDE$" -gUnknown_0862B9FF:: @ 862B9FF +gText_UnionRoomChatKeyboard_FGHIJ:: @ 862B9FF .string "FGHIJ$" -gUnknown_0862BA05:: @ 862BA05 +gText_UnionRoomChatKeyboard_KLMNO:: @ 862BA05 .string "KLMNO$" -gUnknown_0862BA0B:: @ 862BA0B +gText_UnionRoomChatKeyboard_PQRST:: @ 862BA0B .string "PQRST$" -gUnknown_0862BA11:: @ 862BA11 +gText_UnionRoomChatKeyboard_UVWXY:: @ 862BA11 .string "UVWXY$" -gUnknown_0862BA17:: @ 862BA17 +gText_UnionRoomChatKeyboard_Z:: @ 862BA17 .string "Z $" -gUnknown_0862BA1D:: @ 862BA1D +gText_UnionRoomChatKeyboard_01234Upper:: @ 862BA1D .string "01234$" -gUnknown_0862BA23:: @ 862BA23 +gText_UnionRoomChatKeyboard_56789Upper:: @ 862BA23 .string "56789$" -gUnknown_0862BA29:: @ 862BA29 +gText_UnionRoomChatKeyboard_PunctuationUpper:: @ 862BA29 .string ".,!? $" -gUnknown_0862BA2F:: @ 862BA2F +gText_UnionRoomChatKeyboard_SymbolsUpper:: @ 862BA2F .string "-/&… $" -gUnknown_0862BA35:: @ 862BA35 +gText_UnionRoomChatKeyboard_abcde:: @ 862BA35 .string "abcde$" -gUnknown_0862BA3B:: @ 862BA3B +gText_UnionRoomChatKeyboard_fghij:: @ 862BA3B .string "fghij$" -gUnknown_0862BA41:: @ 862BA41 +gText_UnionRoomChatKeyboard_klmno:: @ 862BA41 .string "klmno$" -gUnknown_0862BA47:: @ 862BA47 +gText_UnionRoomChatKeyboard_pqrst:: @ 862BA47 .string "pqrst$" -gUnknown_0862BA4D:: @ 862BA4D +gText_UnionRoomChatKeyboard_uvwxy:: @ 862BA4D .string "uvwxy$" -gUnknown_0862BA53:: @ 862BA53 +gText_UnionRoomChatKeyboard_z:: @ 862BA53 .string "z $" -gUnknown_0862BA59:: @ 862BA59 +gText_UnionRoomChatKeyboard_01234Lower:: @ 862BA59 .string "01234$" -gUnknown_0862BA5F:: @ 862BA5F +gText_UnionRoomChatKeyboard_56789Lower:: @ 862BA5F .string "56789$" -gUnknown_0862BA65:: @ 862BA65 +gText_UnionRoomChatKeyboard_PunctuationLower:: @ 862BA65 .string ".,!? $" -gUnknown_0862BA6B:: @ 862BA6B +gText_UnionRoomChatKeyboard_SymbolsLower:: @ 862BA6B .string "-/&… $" .string "$$$$$$$$" -gUnknown_0862BA79:: @ 862BA79 +gText_UnionRoomChatKeyboard_Emoji1:: @ 862BA79 .string "{EMOJI_MISCHIEVOUS}{EMOJI_HAPPY}{EMOJI_ANGRY}{EMOJI_SURPRISED}{EMOJI_BIGANGER}$" -gUnknown_0862BA84:: @ 862BA84 +gText_UnionRoomChatKeyboard_Emoji2:: @ 862BA84 .string "{EMOJI_BIGSMILE}{EMOJI_EVIL}{EMOJI_NEUTRAL}{EMOJI_TIRED}{EMOJI_SHOCKED}$" -gUnknown_0862BA8F:: @ 862BA8F +gText_UnionRoomChatKeyboard_Emoji3:: @ 862BA8F .string "{EMOJI_LEAF}{EMOJI_FIRE}{EMOJI_WATER}{EMOJI_BOLT}{EMOJI_BALL}$" -gUnknown_0862BA9A:: @ 862BA9A +gText_UnionRoomChatKeyboard_Emoji4:: @ 862BA9A .string "♂♀{EMOJI_LEFT_PAREN}{EMOJI_RIGHT_PAREN}{EMOJI_TILDE}$" -gUnknown_0862BAA3:: @ 862BAA3 +gText_UnionRoomChatKeyboard_Emoji5:: @ 862BAA3 .string "{EMOJI_LEFT_EYE}{EMOJI_RIGHT_EYE}{EMOJI_SMALLWHEEL}{EMOJI_SPHERE}{EMOJI_IRRITATED}$" -gUnknown_0862BAAE:: @ 862BAAE +gText_UnionRoomChatKeyboard_Emoji6:: @ 862BAAE .string "{EMOJI_AT}{EMOJI_BIGWHEEL}{EMOJI_TONGUE}{EMOJI_ACUTE}{EMOJI_GRAVE}$" -gUnknown_0862BAB9:: @ 862BAB9 +gText_UnionRoomChatKeyboard_Emoji7:: @ 862BAB9 .string "{EMOJI_RIGHT_FIST}{EMOJI_LEFT_FIST}{EMOJI_TRIANGLE_OUTLINE}{EMOJI_UNION}{EMOJI_GREATER_THAN}$" -gUnknown_0862BAC4:: @ 862BAC4 +gText_UnionRoomChatKeyboard_Emoji8:: @ 862BAC4 .string "{EMOJI_CIRCLE}{EMOJI_TRIANGLE}{EMOJI_SQUARE}{EMOJI_HEART}{EMOJI_MOON}$" -gUnknown_0862BACF:: @ 862BACF +gText_UnionRoomChatKeyboard_Emoji9:: @ 862BACF .string "{EMOJI_NOTE}{EMOJI_PLUS}{EMOJI_MINUS}{EMOJI_EQUALS}{EMOJI_PIPE}$" -gUnknown_0862BADA:: @ 862BADA +gText_UnionRoomChatKeyboard_Emoji10:: @ 862BADA .string "{EMOJI_HIGHBAR}{EMOJI_UNDERSCORE};: $" diff --git a/include/naming_screen.h b/include/naming_screen.h index 611f53ef2e..7d32abcd31 100644 --- a/include/naming_screen.h +++ b/include/naming_screen.h @@ -9,6 +9,16 @@ #define KBEVENT_PRESSED_SELECT 8 #define KBEVENT_PRESSED_START 9 +#define KBROW_COUNT 4 + +enum +{ + KBPAGE_LETTERS_LOWER, + KBPAGE_LETTERS_UPPER, + KBPAGE_SYMBOLS, + KBPAGE_COUNT, +}; + enum { NAMING_SCREEN_PLAYER, @@ -57,12 +67,6 @@ struct NamingScreenData { /*0x1E3C*/ MainCallback returnCallback; }; -enum -{ - PAGE_OTHERS, - PAGE_UPPER, - PAGE_LOWER, -}; enum { diff --git a/include/strings.h b/include/strings.h index c1414269a5..0b678f2f5d 100644 --- a/include/strings.h +++ b/include/strings.h @@ -2512,52 +2512,53 @@ extern const u8 gEasyChatGroupName_Move2[]; extern const u8 gEasyChatGroupName_TrendySaying[]; extern const u8 gEasyChatGroupName_Pokemon2[]; -extern const u8 gUnknown_862B810[]; -extern const u8 gUnknown_862B832[]; -extern const u8 gUnknown_862B84B[]; -extern const u8 gUnknown_862B86C[]; -extern const u8 gUnknown_0862B88D[]; -extern const u8 gUnknown_0862B8AE[]; -extern const u8 gUnknown_0862B8CF[]; -extern const u8 gUnknown_0862B8F0[]; -extern const u8 gUnknown_0862B911[]; -extern const u8 gUnknown_0862B932[]; -extern const u8 gUnknown_0862B953[]; -extern const u8 gUnknown_0862B974[]; -extern const u8 gUnknown_0862B995[]; -extern const u8 gUnknown_0862B9AE[]; -extern const u8 gUnknown_0862B9C7[]; -extern const u8 gUnknown_0862B9E0[]; -extern const u8 gUnknown_0862B9F9[]; -extern const u8 gUnknown_0862B9FF[]; -extern const u8 gUnknown_0862BA05[]; -extern const u8 gUnknown_0862BA0B[]; -extern const u8 gUnknown_0862BA11[]; -extern const u8 gUnknown_0862BA17[]; -extern const u8 gUnknown_0862BA1D[]; -extern const u8 gUnknown_0862BA23[]; -extern const u8 gUnknown_0862BA29[]; -extern const u8 gUnknown_0862BA2F[]; -extern const u8 gUnknown_0862BA35[]; -extern const u8 gUnknown_0862BA3B[]; -extern const u8 gUnknown_0862BA41[]; -extern const u8 gUnknown_0862BA47[]; -extern const u8 gUnknown_0862BA4D[]; -extern const u8 gUnknown_0862BA53[]; -extern const u8 gUnknown_0862BA59[]; -extern const u8 gUnknown_0862BA5F[]; -extern const u8 gUnknown_0862BA65[]; -extern const u8 gUnknown_0862BA6B[]; -extern const u8 gUnknown_0862BA79[]; -extern const u8 gUnknown_0862BA84[]; -extern const u8 gUnknown_0862BA8F[]; -extern const u8 gUnknown_0862BA9A[]; -extern const u8 gUnknown_0862BAA3[]; -extern const u8 gUnknown_0862BAAE[]; -extern const u8 gUnknown_0862BAB9[]; -extern const u8 gUnknown_0862BAC4[]; -extern const u8 gUnknown_0862BACF[]; -extern const u8 gUnknown_0862BADA[]; +// Text Input Strings +extern const u8 gText_EasyChatKeyboard_ABCDEFothers[]; +extern const u8 gText_EasyChatKeyboard_GHIJKL[]; +extern const u8 gText_EasyChatKeyboard_MNOPQRS[]; +extern const u8 gText_EasyChatKeyboard_TUVWXYZ[]; +extern const u8 gText_NamingScreenKeyboard_abcdef[]; +extern const u8 gText_NamingScreenKeyboard_ghijkl[]; +extern const u8 gText_NamingScreenKeyboard_mnopqrs[]; +extern const u8 gText_NamingScreenKeyboard_tuvwxyz[]; +extern const u8 gText_NamingScreenKeyboard_ABCDEF[]; +extern const u8 gText_NamingScreenKeyboard_GHIJKL[]; +extern const u8 gText_NamingScreenKeyboard_MNOPQRS[]; +extern const u8 gText_NamingScreenKeyboard_TUVWXYZ[]; +extern const u8 gText_NamingScreenKeyboard_01234[]; +extern const u8 gText_NamingScreenKeyboard_56789[]; +extern const u8 gText_NamingScreenKeyboard_Symbols1[]; +extern const u8 gText_NamingScreenKeyboard_Symbols2[]; +extern const u8 gText_UnionRoomChatKeyboard_ABCDE[]; +extern const u8 gText_UnionRoomChatKeyboard_FGHIJ[]; +extern const u8 gText_UnionRoomChatKeyboard_KLMNO[]; +extern const u8 gText_UnionRoomChatKeyboard_PQRST[]; +extern const u8 gText_UnionRoomChatKeyboard_UVWXY[]; +extern const u8 gText_UnionRoomChatKeyboard_Z[]; +extern const u8 gText_UnionRoomChatKeyboard_01234Upper[]; +extern const u8 gText_UnionRoomChatKeyboard_56789Upper[]; +extern const u8 gText_UnionRoomChatKeyboard_PunctuationUpper[]; +extern const u8 gText_UnionRoomChatKeyboard_SymbolsUpper[]; +extern const u8 gText_UnionRoomChatKeyboard_abcde[]; +extern const u8 gText_UnionRoomChatKeyboard_fghij[]; +extern const u8 gText_UnionRoomChatKeyboard_klmno[]; +extern const u8 gText_UnionRoomChatKeyboard_pqrst[]; +extern const u8 gText_UnionRoomChatKeyboard_uvwxy[]; +extern const u8 gText_UnionRoomChatKeyboard_z[]; +extern const u8 gText_UnionRoomChatKeyboard_01234Lower[]; +extern const u8 gText_UnionRoomChatKeyboard_56789Lower[]; +extern const u8 gText_UnionRoomChatKeyboard_PunctuationLower[]; +extern const u8 gText_UnionRoomChatKeyboard_SymbolsLower[]; +extern const u8 gText_UnionRoomChatKeyboard_Emoji1[]; +extern const u8 gText_UnionRoomChatKeyboard_Emoji2[]; +extern const u8 gText_UnionRoomChatKeyboard_Emoji3[]; +extern const u8 gText_UnionRoomChatKeyboard_Emoji4[]; +extern const u8 gText_UnionRoomChatKeyboard_Emoji5[]; +extern const u8 gText_UnionRoomChatKeyboard_Emoji6[]; +extern const u8 gText_UnionRoomChatKeyboard_Emoji7[]; +extern const u8 gText_UnionRoomChatKeyboard_Emoji8[]; +extern const u8 gText_UnionRoomChatKeyboard_Emoji9[]; +extern const u8 gText_UnionRoomChatKeyboard_Emoji10[]; // E-Reader extern const u8 gUnknown_085EDFD6[]; diff --git a/include/union_room_chat.h b/include/union_room_chat.h index 17e4825251..e7ca9d46ec 100755 --- a/include/union_room_chat.h +++ b/include/union_room_chat.h @@ -1,6 +1,17 @@ #ifndef GUARD_UNION_ROOM_CHAT_H #define GUARD_UNION_ROOM_CHAT_H +enum +{ + UNION_ROOM_KB_PAGE_UPPER, + UNION_ROOM_KB_PAGE_LOWER, + UNION_ROOM_KB_PAGE_EMOJI, + UNION_ROOM_KB_PAGE_COUNT +}; + +#define UNION_ROOM_KB_ROW_COUNT 10 + + void sub_801DD98(void); void copy_strings_to_sav1(void); diff --git a/src/easy_chat.c b/src/easy_chat.c index ba54de783b..a25616e5ba 100644 --- a/src/easy_chat.c +++ b/src/easy_chat.c @@ -209,7 +209,7 @@ static void sub_811D830(void); static void sub_811D058(u8, u8, const u8 *, u8, u8, u8, u8, u8, u8); static void sub_811DD84(void); static void sub_811D6F4(void); -static void sub_811D758(void); +static void PrintEasyChatKeyboardText(void); static void sub_811D794(void); static const u8 *GetEasyChatWordGroupName(u8); static void sub_811D864(u8, u8); @@ -698,11 +698,12 @@ static const struct WindowTemplate sEasyChatYesNoWindowTemplate = { static const u8 sText_Clear17[] = _("{CLEAR 17}"); -static const u8 *const sUnknown_08597C90[] = { - gUnknown_862B810, - gUnknown_862B832, - gUnknown_862B84B, - gUnknown_862B86C, +static const u8 *const sEasyChatKeyboardText[] = +{ + gText_EasyChatKeyboard_ABCDEFothers, + gText_EasyChatKeyboard_GHIJKL, + gText_EasyChatKeyboard_MNOPQRS, + gText_EasyChatKeyboard_TUVWXYZ, }; static const struct SpriteSheet sEasyChatSpriteSheets[] = { @@ -3967,7 +3968,7 @@ static void sub_811D698(u32 arg0) sub_811D6F4(); break; case 1: - sub_811D758(); + PrintEasyChatKeyboardText(); break; case 2: sub_811D794(); @@ -4010,12 +4011,12 @@ static void sub_811D6F4(void) } } -static void sub_811D758(void) +static void PrintEasyChatKeyboardText(void) { u32 i; - for (i = 0; i < ARRAY_COUNT(sUnknown_08597C90); i++) - sub_811D028(2, 1, sUnknown_08597C90[i], 10, 97 + i * 16, 0xFF, NULL); + for (i = 0; i < ARRAY_COUNT(sEasyChatKeyboardText); i++) + sub_811D028(2, 1, sEasyChatKeyboardText[i], 10, 97 + i * 16, 0xFF, NULL); } static void sub_811D794(void) diff --git a/src/naming_screen.c b/src/naming_screen.c index 472489a269..c4dbe2bdab 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -43,18 +43,6 @@ extern const u8 gText_YourName[]; extern const u8 gText_BoxName[]; extern const u8 gText_PkmnsNickname[]; extern const u8 gText_TellHimTheWords[]; -extern const u8 gUnknown_0862B88D[]; -extern const u8 gUnknown_0862B8AE[]; -extern const u8 gUnknown_0862B8CF[]; -extern const u8 gUnknown_0862B8F0[]; -extern const u8 gUnknown_0862B911[]; -extern const u8 gUnknown_0862B932[]; -extern const u8 gUnknown_0862B953[]; -extern const u8 gUnknown_0862B974[]; -extern const u8 gUnknown_0862B995[]; -extern const u8 gUnknown_0862B9AE[]; -extern const u8 gUnknown_0862B9C7[]; -extern const u8 gUnknown_0862B9E0[]; // start of .rodata @@ -171,7 +159,7 @@ static const struct SpriteTemplate gUnknown_0858C138; static const struct SpriteTemplate sSpriteTemplate_InputArrow; static const struct SpriteTemplate sSpriteTemplate_Underscore; static const struct SpriteTemplate gUnknown_0858C180; -static const u8* const gUnknown_0858C198[][4]; +static const u8* const sNamingScreenKeyboardText[KBPAGE_COUNT][KBROW_COUNT]; static const struct SpriteSheet gUnknown_0858C1C8[]; static const struct SpritePalette gUnknown_0858C230[]; @@ -428,35 +416,52 @@ static void sub_80E31B0(u8 taskId) } } -static const u8 gUnknown_0858BEBB[] = { 0, 2, 1 }; -static const u8 gUnknown_0858BEBE[] = { 1, 0, 2 }; -static const u8 gUnknown_0858BEC1[] = { 2, 1, 0 }; +static const u8 sPageOrderLowerFirst[] = +{ + KBPAGE_LETTERS_LOWER, + KBPAGE_SYMBOLS, + KBPAGE_LETTERS_UPPER +}; + +static const u8 sPageOrderUpperFirst[] = +{ + KBPAGE_LETTERS_UPPER, + KBPAGE_LETTERS_LOWER, + KBPAGE_SYMBOLS +}; + +static const u8 sPageOrderSymbolsFirst[] = +{ + KBPAGE_SYMBOLS, + KBPAGE_LETTERS_UPPER, + KBPAGE_LETTERS_LOWER +}; static u8 sub_80E3244(u8 a1) { - return gUnknown_0858BEBB[a1]; + return sPageOrderLowerFirst[a1]; } static u8 sub_80E3254(void) { - return gUnknown_0858BEBE[gNamingScreenData->currentPage]; + return sPageOrderUpperFirst[gNamingScreenData->currentPage]; } static u8 sub_80E3274(void) { - return gUnknown_0858BEC1[gNamingScreenData->currentPage]; + return sPageOrderSymbolsFirst[gNamingScreenData->currentPage]; } static bool8 MainState_BeginFadeIn(void) { sub_80E4CF8(3, gUnknown_08DD4544); - gNamingScreenData->currentPage = PAGE_UPPER; + gNamingScreenData->currentPage = KBPAGE_LETTERS_UPPER; sub_80E4CF8(2, gUnknown_08DD46E0); sub_80E4CF8(1, gUnknown_08DD4620); - sub_80E4DE4(gNamingScreenData->windows[1], 0); - sub_80E4DE4(gNamingScreenData->windows[0], 1); - nullsub_10(2, 0); - nullsub_10(1, 1); + sub_80E4DE4(gNamingScreenData->windows[1], KBPAGE_LETTERS_LOWER); + sub_80E4DE4(gNamingScreenData->windows[0], KBPAGE_LETTERS_UPPER); + nullsub_10(2, KBPAGE_LETTERS_LOWER); + nullsub_10(1, KBPAGE_LETTERS_UPPER); sub_80E4D10(); sub_80E4964(); sub_80E4EF0(); @@ -1660,7 +1665,7 @@ static void sub_80E4CF8(u8 bg, const void *src) CopyToBgTilemapBuffer(bg, src, 0, 0); } -static void nullsub_10(u8 a1, u8 a2) +static void nullsub_10(u8 a1, u8 page) { } @@ -1703,29 +1708,29 @@ static const struct TextColorThing sUnkColorStruct = } }; -static const u8 sFillValues[3] = +static const u8 sFillValues[KBPAGE_COUNT] = { - PIXEL_FILL(0xE), - PIXEL_FILL(0xD), - PIXEL_FILL(0xF) + [KBPAGE_LETTERS_LOWER] = PIXEL_FILL(0xE), + [KBPAGE_LETTERS_UPPER] = PIXEL_FILL(0xD), + [KBPAGE_SYMBOLS] = PIXEL_FILL(0xF) }; -static const u8 *const sUnkColors[3] = +static const u8 *const sUnkColors[KBPAGE_COUNT] = { - sUnkColorStruct.colors[1], - sUnkColorStruct.colors[0], - sUnkColorStruct.colors[2] + [KBPAGE_LETTERS_LOWER] = sUnkColorStruct.colors[1], + [KBPAGE_LETTERS_UPPER] = sUnkColorStruct.colors[0], + [KBPAGE_SYMBOLS] = sUnkColorStruct.colors[2] }; -static void sub_80E4DE4(u8 window, u8 a1) +static void sub_80E4DE4(u8 window, u8 page) { u8 i; - FillWindowPixelBuffer(window, sFillValues[a1]); + FillWindowPixelBuffer(window, sFillValues[page]); - for (i = 0; i < 4; i++) + for (i = 0; i < KBROW_COUNT; i++) { - AddTextPrinterParameterized3(window, 1, 0, i * 16 + 1, sUnkColors[a1], 0, gUnknown_0858C198[a1][i]); + AddTextPrinterParameterized3(window, 1, 0, i * 16 + 1, sUnkColors[page], 0, sNamingScreenKeyboardText[page][i]); } PutWindowTilemap(window); @@ -1857,7 +1862,7 @@ static const struct NamingScreenTemplate playerNamingScreenTemplate = .maxChars = 7, .iconFunction = 1, .addGenderIcon = 0, - .initialPage = PAGE_UPPER, + .initialPage = KBPAGE_LETTERS_UPPER, .unused = 35, .title = gText_YourName, }; @@ -1868,7 +1873,7 @@ static const struct NamingScreenTemplate pcBoxNamingTemplate = .maxChars = 8, .iconFunction = 2, .addGenderIcon = 0, - .initialPage = PAGE_UPPER, + .initialPage = KBPAGE_LETTERS_UPPER, .unused = 19, .title = gText_BoxName, }; @@ -1879,7 +1884,7 @@ static const struct NamingScreenTemplate monNamingScreenTemplate = .maxChars = 10, .iconFunction = 3, .addGenderIcon = 1, - .initialPage = PAGE_UPPER, + .initialPage = KBPAGE_LETTERS_UPPER, .unused = 35, .title = gText_PkmnsNickname, }; @@ -1890,7 +1895,7 @@ static const struct NamingScreenTemplate wandaWordsScreenTemplate = .maxChars = 15, .iconFunction = 4, .addGenderIcon = 0, - .initialPage = PAGE_UPPER, + .initialPage = KBPAGE_LETTERS_UPPER, .unused = 11, .title = gText_TellHimTheWords, }; @@ -2144,25 +2149,28 @@ static const struct SpriteTemplate gUnknown_0858C180 = .callback = SpriteCallbackDummy }; -static const u8* const gUnknown_0858C198[][4] = +static const u8* const sNamingScreenKeyboardText[KBPAGE_COUNT][KBROW_COUNT] = { + [KBPAGE_LETTERS_LOWER] = { - gUnknown_0862B88D, - gUnknown_0862B8AE, - gUnknown_0862B8CF, - gUnknown_0862B8F0 + gText_NamingScreenKeyboard_abcdef, + gText_NamingScreenKeyboard_ghijkl, + gText_NamingScreenKeyboard_mnopqrs, + gText_NamingScreenKeyboard_tuvwxyz }, + [KBPAGE_LETTERS_UPPER] = { - gUnknown_0862B911, - gUnknown_0862B932, - gUnknown_0862B953, - gUnknown_0862B974 + gText_NamingScreenKeyboard_ABCDEF, + gText_NamingScreenKeyboard_GHIJKL, + gText_NamingScreenKeyboard_MNOPQRS, + gText_NamingScreenKeyboard_TUVWXYZ }, + [KBPAGE_SYMBOLS] = { - gUnknown_0862B995, - gUnknown_0862B9AE, - gUnknown_0862B9C7, - gUnknown_0862B9E0 + gText_NamingScreenKeyboard_01234, + gText_NamingScreenKeyboard_56789, + gText_NamingScreenKeyboard_Symbols1, + gText_NamingScreenKeyboard_Symbols2 }, }; diff --git a/src/union_room_chat.c b/src/union_room_chat.c index 4afeb99cfd..eaf24fc02e 100755 --- a/src/union_room_chat.c +++ b/src/union_room_chat.c @@ -22,6 +22,7 @@ #include "task.h" #include "text.h" #include "text_window.h" +#include "union_room_chat.h" #include "window.h" #include "constants/rgb.h" #include "constants/songs.h" @@ -37,9 +38,9 @@ struct UnionRoomChat u8 unkD; u8 unkE; u8 unkF; - u8 unk10; + u8 currentPage; u8 unk11; - u8 unk12; + u8 currentRow; u8 unk13; u8 unk14; u8 unk15; @@ -50,7 +51,7 @@ struct UnionRoomChat u8 unk1A[0x1F]; u8 unk39[0x40]; u8 unk79[0x40]; - u8 unkB9[10][21]; + u8 unkB9[UNION_ROOM_KB_ROW_COUNT][21]; u8 filler18B[0x5]; u8 unk190[0x28]; u16 unk1B8; @@ -232,7 +233,13 @@ void (*const gUnknown_082F2A7C[])(void) = sub_801E978, }; -static const u8 sUnknown_082F2AA4[] = {9, 9, 9, 9}; +static const u8 sKeyboardPageMaxRow[] = +{ + [UNION_ROOM_KB_PAGE_UPPER] = 9, + [UNION_ROOM_KB_PAGE_LOWER] = 9, + [UNION_ROOM_KB_PAGE_EMOJI] = 9, + 9 +}; static const u8 gUnknown_082F2AA8[] = { CHAR_SPACE, 0x16, 0x17, 0x68, 0x19, 0x1A, 0x1B, 0x1C, @@ -269,10 +276,47 @@ static const u8 gUnknown_082F2AA8[] = { CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE, CHAR_SPACE }; -const u8 *const gUnknown_082F2BA8[][10] = { - {gUnknown_0862B9F9, gUnknown_0862B9FF, gUnknown_0862BA05, gUnknown_0862BA0B, gUnknown_0862BA11, gUnknown_0862BA17, gUnknown_0862BA1D, gUnknown_0862BA23, gUnknown_0862BA29, gUnknown_0862BA2F}, - {gUnknown_0862BA35, gUnknown_0862BA3B, gUnknown_0862BA41, gUnknown_0862BA47, gUnknown_0862BA4D, gUnknown_0862BA53, gUnknown_0862BA59, gUnknown_0862BA5F, gUnknown_0862BA65, gUnknown_0862BA6B}, - {gUnknown_0862BA79, gUnknown_0862BA84, gUnknown_0862BA8F, gUnknown_0862BA9A, gUnknown_0862BAA3, gUnknown_0862BAAE, gUnknown_0862BAB9, gUnknown_0862BAC4, gUnknown_0862BACF, gUnknown_0862BADA} +static const u8 *const sUnionRoomKeyboardText[UNION_ROOM_KB_PAGE_COUNT][UNION_ROOM_KB_ROW_COUNT] = +{ + [UNION_ROOM_KB_PAGE_UPPER] = + { + gText_UnionRoomChatKeyboard_ABCDE, + gText_UnionRoomChatKeyboard_FGHIJ, + gText_UnionRoomChatKeyboard_KLMNO, + gText_UnionRoomChatKeyboard_PQRST, + gText_UnionRoomChatKeyboard_UVWXY, + gText_UnionRoomChatKeyboard_Z, + gText_UnionRoomChatKeyboard_01234Upper, + gText_UnionRoomChatKeyboard_56789Upper, + gText_UnionRoomChatKeyboard_PunctuationUpper, + gText_UnionRoomChatKeyboard_SymbolsUpper + }, + [UNION_ROOM_KB_PAGE_LOWER] = + { + gText_UnionRoomChatKeyboard_abcde, + gText_UnionRoomChatKeyboard_fghij, + gText_UnionRoomChatKeyboard_klmno, + gText_UnionRoomChatKeyboard_pqrst, + gText_UnionRoomChatKeyboard_uvwxy, + gText_UnionRoomChatKeyboard_z, + gText_UnionRoomChatKeyboard_01234Lower, + gText_UnionRoomChatKeyboard_56789Lower, + gText_UnionRoomChatKeyboard_PunctuationLower, + gText_UnionRoomChatKeyboard_SymbolsLower + }, + [UNION_ROOM_KB_PAGE_EMOJI] = + { + gText_UnionRoomChatKeyboard_Emoji1, + gText_UnionRoomChatKeyboard_Emoji2, + gText_UnionRoomChatKeyboard_Emoji3, + gText_UnionRoomChatKeyboard_Emoji4, + gText_UnionRoomChatKeyboard_Emoji5, + gText_UnionRoomChatKeyboard_Emoji6, + gText_UnionRoomChatKeyboard_Emoji7, + gText_UnionRoomChatKeyboard_Emoji8, + gText_UnionRoomChatKeyboard_Emoji9, + gText_UnionRoomChatKeyboard_Emoji10 + } }; const u16 gUnknown_082F2C20[] = INCBIN_U16("graphics/interface/unk_palette1.gbapal"); @@ -559,9 +603,9 @@ static void sub_801DDD0(struct UnionRoomChat *unionRoomChat) unionRoomChat->unk4 = 0; unionRoomChat->unk6 = 0; - unionRoomChat->unk10 = 0; + unionRoomChat->currentPage = 0; unionRoomChat->unk11 = 0; - unionRoomChat->unk12 = 0; + unionRoomChat->currentRow = 0; unionRoomChat->unk14 = 0; unionRoomChat->unk15 = 0; unionRoomChat->unk16 = 0; @@ -571,7 +615,7 @@ static void sub_801DDD0(struct UnionRoomChat *unionRoomChat) unionRoomChat->unk17 = 0; unionRoomChat->unk18 = 0; sub_801EF1C(unionRoomChat->unk190); - for (i = 0; i < 10; i++) + for (i = 0; i < UNION_ROOM_KB_ROW_COUNT; i++) StringCopy(unionRoomChat->unkB9[i], gSaveBlock1Ptr->unk3C88[i]); } @@ -715,7 +759,7 @@ static void sub_801E030(void) } else if (gMain.newKeys & R_BUTTON) { - if (gUnknown_02022C84->unk10 != 3) + if (gUnknown_02022C84->currentPage != UNION_ROOM_KB_PAGE_COUNT) { sub_801ED94(); sub_801F5EC(8, 0); @@ -763,7 +807,7 @@ static void sub_801E120(void) default: sub_801F5EC(4, 0); var0 = 1; - if (gUnknown_02022C84->unk10 == input || input > 3) + if (gUnknown_02022C84->currentPage == input || input > UNION_ROOM_KB_PAGE_COUNT) var0 = 0; break; case MENU_NOTHING_CHOSEN: @@ -786,9 +830,9 @@ static void sub_801E120(void) } gUnknown_02022C84->unk11 = 0; - gUnknown_02022C84->unk12 = 0; + gUnknown_02022C84->currentRow = 0; sub_801F5EC(5, 1); - gUnknown_02022C84->unk10 = input; + gUnknown_02022C84->currentPage = input; gUnknown_02022C84->unk6 = 4; break; case 3: @@ -1260,15 +1304,15 @@ static bool32 sub_801EBE4(void) { if (gMain.newAndRepeatedKeys & DPAD_DOWN) { - if (gUnknown_02022C84->unk12 < sUnknown_082F2AA4[gUnknown_02022C84->unk10]) - gUnknown_02022C84->unk12++; + if (gUnknown_02022C84->currentRow < sKeyboardPageMaxRow[gUnknown_02022C84->currentPage]) + gUnknown_02022C84->currentRow++; else - gUnknown_02022C84->unk12 = 0; + gUnknown_02022C84->currentRow = 0; return TRUE; } - if (gUnknown_02022C84->unk10 != 3) + if (gUnknown_02022C84->currentPage != UNION_ROOM_KB_PAGE_COUNT) { if (gMain.newAndRepeatedKeys & DPAD_LEFT) { @@ -1296,10 +1340,10 @@ static bool32 sub_801EBE4(void) } else { - if (gUnknown_02022C84->unk12) - gUnknown_02022C84->unk12--; + if (gUnknown_02022C84->currentRow) + gUnknown_02022C84->currentRow--; else - gUnknown_02022C84->unk12 = sUnknown_082F2AA4[gUnknown_02022C84->unk10]; + gUnknown_02022C84->currentRow = sKeyboardPageMaxRow[gUnknown_02022C84->currentPage]; return TRUE; } @@ -1313,9 +1357,9 @@ static void sub_801EC94(void) u8 *str; u8 buffer[21]; - if (gUnknown_02022C84->unk10 != 3) + if (gUnknown_02022C84->currentPage != UNION_ROOM_KB_PAGE_COUNT) { - charsStr = gUnknown_082F2BA8[gUnknown_02022C84->unk10][gUnknown_02022C84->unk12]; + charsStr = sUnionRoomKeyboardText[gUnknown_02022C84->currentPage][gUnknown_02022C84->currentRow]; for (i = 0; i < gUnknown_02022C84->unk11; i++) { if (*charsStr == CHAR_SPECIAL_F9) @@ -1327,7 +1371,7 @@ static void sub_801EC94(void) } else { - u8 *tempStr = StringCopy(buffer, gUnknown_02022C84->unkB9[gUnknown_02022C84->unk12]); + u8 *tempStr = StringCopy(buffer, gUnknown_02022C84->unkB9[gUnknown_02022C84->currentRow]); tempStr[0] = CHAR_SPACE; tempStr[1] = EOS; charsStr = buffer; @@ -1395,7 +1439,7 @@ static bool32 sub_801EDC4(void) static void sub_801EDE0(void) { u8 *src = sub_801F114(); - StringCopy(gUnknown_02022C84->unkB9[gUnknown_02022C84->unk12], src); + StringCopy(gUnknown_02022C84->unkB9[gUnknown_02022C84->currentRow], src); gUnknown_02022C84->unk18 = 1; } @@ -1409,7 +1453,7 @@ static void sub_801EE10(void) static void sub_801EE2C(void) { int i; - for (i = 0; i < 10; i++) + for (i = 0; i < UNION_ROOM_KB_ROW_COUNT; i++) StringCopy(gSaveBlock1Ptr->unk3C88[i], gUnknown_02022C84->unkB9[i]); } @@ -1551,15 +1595,15 @@ static bool32 sub_801EFF8(u8 *arg0, u8 *arg1) return FALSE; } -static u8 sub_801F0B0(void) +static u8 GetCurrentKeyboardPage(void) { - return gUnknown_02022C84->unk10; + return gUnknown_02022C84->currentPage; } static void sub_801F0BC(u8 *arg0, u8 *arg1) { *arg0 = gUnknown_02022C84->unk11; - *arg1 = gUnknown_02022C84->unk12; + *arg1 = gUnknown_02022C84->currentRow; } static u8 *sub_801F0D0(void) @@ -2528,7 +2572,7 @@ static void sub_8020118(u16 x, u8 *str, u8 fillValue, u8 arg3, u8 arg4) static void sub_80201A4(void) { - u8 var0; + u8 page; int i; int var1; u16 left; @@ -2538,11 +2582,11 @@ static void sub_80201A4(void) u8 *str2; FillWindowPixelBuffer(2, PIXEL_FILL(15)); - var0 = sub_801F0B0(); + page = GetCurrentKeyboardPage(); sp[0] = 0; sp[1] = 14; sp[2] = 13; - if (var0 != 3) + if (page != UNION_ROOM_KB_PAGE_COUNT) { str = &sp[4]; str[0] = EXT_CTRL_CODE_BEGIN; @@ -2550,15 +2594,15 @@ static void sub_80201A4(void) var1 = 8; str[2] = var1; left = var1; - if (var0 == 2) + if (page == UNION_ROOM_KB_PAGE_EMOJI) left = 6; - for (i = 0, top = 0; i < 10; i++, top += 12) + for (i = 0, top = 0; i < UNION_ROOM_KB_ROW_COUNT; i++, top += 12) { - if (!gUnknown_082F2BA8[var0][i]) + if (!sUnionRoomKeyboardText[page][i]) return; - StringCopy(&sp[7], gUnknown_082F2BA8[var0][i]); + StringCopy(&sp[7], sUnionRoomKeyboardText[page][i]); AddTextPrinterParameterized3(2, 0, left, top, sp, TEXT_SPEED_FF, &sp[4]); } } @@ -2631,7 +2675,7 @@ static void sub_80203B0(void) FillWindowPixelBuffer(3, PIXEL_FILL(1)); DrawTextBorderOuter(3, 1, 13); PrintTextArray(3, 2, 8, 1, 14, 5, gUnknown_082F2DC8); - sub_81983AC(3, 2, 0, 1, 14, 5, sub_801F0B0()); + sub_81983AC(3, 2, 0, 1, 14, 5, GetCurrentKeyboardPage()); PutWindowTilemap(3); } @@ -2820,7 +2864,7 @@ static void sub_802091C(bool32 invisible) static void sub_802093C(void) { u8 x, y; - u8 var2 = sub_801F0B0(); + u8 var2 = GetCurrentKeyboardPage(); sub_801F0BC(&x, &y); if (var2 != 3) { @@ -2845,7 +2889,7 @@ static void sub_80209AC(int arg0) static void sub_80209E0(void) { - if (sub_801F0B0() != 3) + if (GetCurrentKeyboardPage() != 3) StartSpriteAnim(gUnknown_02022C8C->unk0, 1); else StartSpriteAnim(gUnknown_02022C8C->unk0, 3); @@ -2860,7 +2904,7 @@ static bool32 sub_8020A1C(void) if (++gUnknown_02022C8C->unk14 > 3) { - if (sub_801F0B0() != 3) + if (GetCurrentKeyboardPage() != 3) StartSpriteAnim(gUnknown_02022C8C->unk0, 0); else StartSpriteAnim(gUnknown_02022C8C->unk0, 2); @@ -2914,7 +2958,7 @@ static void sub_8020B20(void) static void sub_8020B80(void) { - if (sub_801F0B0() == 3) + if (GetCurrentKeyboardPage() == UNION_ROOM_KB_PAGE_COUNT) { if (sub_801F0DC() != 0) { From a923ae78c3dbfd711dd0f1168a340abb0eb2dc8c Mon Sep 17 00:00:00 2001 From: GriffinR Date: Mon, 30 Sep 2019 00:13:08 -0400 Subject: [PATCH 2/2] Add missing page num usage --- src/union_room_chat.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/union_room_chat.c b/src/union_room_chat.c index eaf24fc02e..c68a2c0a94 100755 --- a/src/union_room_chat.c +++ b/src/union_room_chat.c @@ -2864,9 +2864,9 @@ static void sub_802091C(bool32 invisible) static void sub_802093C(void) { u8 x, y; - u8 var2 = GetCurrentKeyboardPage(); + u8 page = GetCurrentKeyboardPage(); sub_801F0BC(&x, &y); - if (var2 != 3) + if (page != UNION_ROOM_KB_PAGE_COUNT) { StartSpriteAnim(gUnknown_02022C8C->unk0, 0); gUnknown_02022C8C->unk0->pos1.x = x * 8 + 10; @@ -2889,7 +2889,7 @@ static void sub_80209AC(int arg0) static void sub_80209E0(void) { - if (GetCurrentKeyboardPage() != 3) + if (GetCurrentKeyboardPage() != UNION_ROOM_KB_PAGE_COUNT) StartSpriteAnim(gUnknown_02022C8C->unk0, 1); else StartSpriteAnim(gUnknown_02022C8C->unk0, 3); @@ -2904,7 +2904,7 @@ static bool32 sub_8020A1C(void) if (++gUnknown_02022C8C->unk14 > 3) { - if (GetCurrentKeyboardPage() != 3) + if (GetCurrentKeyboardPage() != UNION_ROOM_KB_PAGE_COUNT) StartSpriteAnim(gUnknown_02022C8C->unk0, 0); else StartSpriteAnim(gUnknown_02022C8C->unk0, 2);