From 7d8a2ae7f0d9edaca7770cf472909bf9197acf2a Mon Sep 17 00:00:00 2001 From: Diegoisawesome Date: Thu, 25 Jan 2018 15:25:35 -0600 Subject: [PATCH] Decompile new_menu_helpers.s --- asm/battle_frontier_2.s | 20 +- asm/battle_records.s | 2 +- asm/field_message_box.s | 4 +- asm/link.s | 26 +- asm/mauville_old_man.s | 2 +- asm/new_menu_helpers.s | 1178 ---------------------------------- asm/player_pc.s | 6 +- asm/pokemon_storage_system.s | 4 +- asm/record_mixing.s | 2 +- asm/roulette.s | 28 +- asm/slot_machine.s | 8 +- asm/start_menu.s | 4 +- asm/trainer_card.s | 2 +- include/gba/defines.h | 3 + include/menu.h | 1 + include/new_menu_helpers.h | 6 +- include/text.h | 4 +- ld_script.txt | 2 +- src/battle_message.c | 2 +- src/battle_script_commands.c | 2 +- src/berry_blender.c | 2 +- src/daycare.c | 6 +- src/decoration.c | 4 +- src/hall_of_fame.c | 8 +- src/naming_screen.c | 2 +- src/new_menu_helpers.c | 442 +++++++++++++ src/scrcmd.c | 6 +- src/start_menu.c | 6 +- src/text.c | 6 +- src/unk_text_util_2.c | 12 +- 30 files changed, 534 insertions(+), 1266 deletions(-) delete mode 100644 asm/new_menu_helpers.s create mode 100644 src/new_menu_helpers.c diff --git a/asm/battle_frontier_2.s b/asm/battle_frontier_2.s index 98b5187c2..eece3988a 100644 --- a/asm/battle_frontier_2.s +++ b/asm/battle_frontier_2.s @@ -12385,7 +12385,7 @@ sub_81A0C9C: @ 81A0C9C bl sub_808BCF4 movs r0, 0 movs r1, 0x1 - bl sub_81973C4 + bl NewMenuHelpers_DrawDialogueFrame bl sub_81A0A70 pop {r0} bx r0 @@ -14586,7 +14586,7 @@ sub_81A1EA8: @ 81A1EA8 strb r0, [r4] ldrb r0, [r4] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldrb r0, [r4] movs r1, 0x11 bl FillWindowPixelBuffer @@ -14874,7 +14874,7 @@ sub_81A2134: @ 81A2134 strb r0, [r4] ldrb r0, [r4] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldrb r0, [r4] movs r1, 0x11 bl FillWindowPixelBuffer @@ -15227,7 +15227,7 @@ sub_81A2460: @ 81A2460 strb r0, [r4] ldrb r0, [r4] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldrb r0, [r4] movs r1, 0x11 bl FillWindowPixelBuffer @@ -15475,7 +15475,7 @@ sub_81A2698: @ 81A2698 strb r0, [r6] ldrb r0, [r6] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldrb r0, [r6] movs r1, 0x11 bl FillWindowPixelBuffer @@ -15778,7 +15778,7 @@ sub_81A2968: @ 81A2968 strb r0, [r5] ldrb r0, [r5] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldrb r0, [r5] movs r1, 0x11 bl FillWindowPixelBuffer @@ -16153,7 +16153,7 @@ sub_81A2C94: @ 81A2C94 strb r0, [r4] ldrb r0, [r4] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldrb r0, [r4] movs r1, 0x11 bl FillWindowPixelBuffer @@ -16448,7 +16448,7 @@ sub_81A2F38: @ 81A2F38 strb r0, [r5] ldrb r0, [r5] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldrb r0, [r5] movs r1, 0x11 bl FillWindowPixelBuffer @@ -16526,7 +16526,7 @@ sub_81A2FF8: @ 81A2FF8 strb r0, [r4] ldrb r0, [r4] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldrb r0, [r4] movs r1, 0x11 bl FillWindowPixelBuffer @@ -19573,7 +19573,7 @@ sub_81A4AA0: @ 81A4AA0 strb r0, [r4] ldrb r0, [r4] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldrb r0, [r4] movs r1, 0x11 bl FillWindowPixelBuffer diff --git a/asm/battle_records.s b/asm/battle_records.s index bcf82dbb8..f688144d9 100644 --- a/asm/battle_records.s +++ b/asm/battle_records.s @@ -667,7 +667,7 @@ sub_813C4BC: @ 813C4BC strb r0, [r6] ldrb r0, [r6] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldrb r0, [r6] movs r1, 0x11 bl FillWindowPixelBuffer diff --git a/asm/field_message_box.s b/asm/field_message_box.s index 0c1fae6de..44272603c 100644 --- a/asm/field_message_box.s +++ b/asm/field_message_box.s @@ -57,7 +57,7 @@ _08098182: _08098188: movs r0, 0 movs r1, 0x1 - bl sub_81973C4 + bl NewMenuHelpers_DrawDialogueFrame _08098190: ldrh r0, [r4, 0x8] adds r0, 0x1 @@ -313,7 +313,7 @@ sub_8098358: @ 8098358 bl task_del_textbox movs r0, 0 movs r1, 0x1 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldr r1, =gUnknown_020375BC movs r0, 0 strb r0, [r1] diff --git a/asm/link.s b/asm/link.s index 1ad160340..0d143f0f3 100644 --- a/asm/link.s +++ b/asm/link.s @@ -18242,7 +18242,7 @@ _08012938: bl CopyWindowToVram ldrb r0, [r6, 0xF] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldr r0, =gMultiuseListMenuTemplate adds r2, r0, 0 ldr r1, =gUnknown_082F015C @@ -18258,7 +18258,7 @@ _08012938: strb r0, [r6, 0x12] ldrb r0, [r6, 0x11] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldrb r0, [r6, 0x11] bl PutWindowTilemap ldrb r0, [r6, 0x11] @@ -19723,7 +19723,7 @@ _0801360C: bl CopyWindowToVram ldrb r0, [r6, 0xB] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldr r0, =gMultiuseListMenuTemplate adds r2, r0, 0 ldr r1, =gUnknown_082F0204 @@ -19739,7 +19739,7 @@ _0801360C: strb r0, [r6, 0xE] ldrb r0, [r6, 0xD] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldrb r0, [r6, 0xD] bl PutWindowTilemap ldrb r0, [r6, 0xD] @@ -26036,7 +26036,7 @@ sub_8017020: @ 8017020 bl sub_81973A4 movs r0, 0 movs r1, 0x1 - bl sub_81973C4 + bl NewMenuHelpers_DrawDialogueFrame ldr r0, =gStringVar4 adds r1, r4, 0 bl StringExpandPlaceholders @@ -26081,7 +26081,7 @@ _08017076: bl sub_81973A4 movs r0, 0 movs r1, 0x1 - bl sub_81973C4 + bl NewMenuHelpers_DrawDialogueFrame ldr r0, =gStringVar4 adds r1, r5, 0 bl StringExpandPlaceholders @@ -26173,7 +26173,7 @@ sub_8017118: @ 8017118 lsrs r4, 24 adds r0, r4, 0 movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame adds r0, r4, 0 movs r1, 0xFF bl FillWindowPixelBuffer @@ -26269,7 +26269,7 @@ _080171DC: strb r0, [r5] ldrb r0, [r5] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldr r0, =gMultiuseListMenuTemplate adds r2, r0, 0 ldr r1, [sp, 0x24] @@ -26382,7 +26382,7 @@ _080172C8: strb r0, [r6] ldrb r0, [r6] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldr r0, =gMultiuseListMenuTemplate adds r2, r0, 0 ldr r1, [sp, 0x24] @@ -49423,7 +49423,7 @@ _08022D38: _08022D42: movs r0, 0 movs r1, 0 - bl sub_81973C4 + bl NewMenuHelpers_DrawDialogueFrame ldrb r1, [r5, 0x1] movs r0, 0x2 mov r8, r0 @@ -52021,7 +52021,7 @@ _080241A6: beq _0802421E movs r0, 0 movs r1, 0 - bl sub_81973C4 + bl NewMenuHelpers_DrawDialogueFrame ldr r2, =gText_SavingDontTurnOffPower movs r0, 0 str r0, [sp] @@ -52378,7 +52378,7 @@ _0802445A: _08024460: movs r0, 0 movs r1, 0 - bl sub_81973C4 + bl NewMenuHelpers_DrawDialogueFrame ldrh r1, [r5, 0x14] cmp r1, 0x3 bne _08024490 @@ -64111,7 +64111,7 @@ _0802A3A4: _0802A3AE: movs r0, 0 movs r1, 0 - bl sub_81973C4 + bl NewMenuHelpers_DrawDialogueFrame ldr r2, =gText_SavingDontTurnOffPower str r4, [sp] movs r0, 0x2 diff --git a/asm/mauville_old_man.s b/asm/mauville_old_man.s index 49a502d5c..af4764d76 100644 --- a/asm/mauville_old_man.s +++ b/asm/mauville_old_man.s @@ -800,7 +800,7 @@ sub_8120708: @ 8120708 adds r5, r0, 0 movs r0, 0 movs r1, 0 - bl sub_81973C4 + bl NewMenuHelpers_DrawDialogueFrame movs r4, 0x1 str r4, [sp] str r4, [sp, 0x4] diff --git a/asm/new_menu_helpers.s b/asm/new_menu_helpers.s deleted file mode 100644 index 5089ae909..000000000 --- a/asm/new_menu_helpers.s +++ /dev/null @@ -1,1178 +0,0 @@ - .include "asm/macros.inc" - .include "constants/constants.inc" - - .syntax unified - - .text - - thumb_func_start sub_8197184 -sub_8197184: @ 8197184 - push {r4,r5,lr} - adds r4, r1, 0 - adds r5, r2, 0 - lsls r0, 24 - lsrs r0, 24 - movs r1, 0 - bl GetWindowAttribute - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gUnknown_0860EA6C - movs r2, 0x80 - lsls r2, 1 - lsls r4, 16 - lsrs r4, 16 - adds r3, r4, 0 - bl LoadBgTiles - ldr r0, =gUnknown_0860EA4C - lsls r5, 20 - lsrs r5, 16 - adds r1, r5, 0 - movs r2, 0x20 - bl LoadPalette - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8197184 - - thumb_func_start sub_81971C4 -sub_81971C4: @ 81971C4 - push {lr} - bl sub_819645C - pop {r0} - bx r0 - thumb_func_end sub_81971C4 - - thumb_func_start sub_81971D0 -sub_81971D0: @ 81971D0 - push {lr} - ldr r0, =gUnknown_0860F098 - bl InitWindows - ldr r0, =gUnknown_0203CD8C - movs r1, 0xFF - strb r1, [r0] - ldr r0, =gUnknown_0203CD8D - strb r1, [r0] - pop {r0} - bx r0 - .pool - thumb_func_end sub_81971D0 - - thumb_func_start sub_81971F4 -sub_81971F4: @ 81971F4 - push {lr} - bl FreeAllWindowBuffers - pop {r0} - bx r0 - thumb_func_end sub_81971F4 - - thumb_func_start sub_8197200 -sub_8197200: @ 8197200 - push {lr} - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - bl DeactivateAllTextPrinters - bl sub_81973A4 - pop {r0} - bx r0 - thumb_func_end sub_8197200 - - thumb_func_start sub_8197224 -sub_8197224: @ 8197224 - push {lr} - bl RunTextPrinters - movs r0, 0 - bl IsTextPrinterActive - lsls r0, 16 - lsrs r0, 16 - pop {r1} - bx r1 - thumb_func_end sub_8197224 - - thumb_func_start AddTextPrinterParameterized -@ u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, u8 *str, u8 speed, void ( *callback)(u16, struct TextPrinter *), u8 fgColor, u8 bgColor, u8 shadowColor) -AddTextPrinterParameterized: @ 8197238 - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0x10 - ldr r7, [sp, 0x28] - ldr r4, [sp, 0x2C] - mov r8, r4 - ldr r5, [sp, 0x30] - ldr r6, [sp, 0x34] - lsls r3, 24 - lsrs r3, 24 - lsls r5, 24 - lsrs r5, 24 - lsls r6, 24 - str r2, [sp] - mov r2, sp - movs r4, 0 - strb r0, [r2, 0x4] - mov r0, sp - strb r1, [r0, 0x5] - strb r4, [r0, 0x6] - movs r1, 0x1 - strb r1, [r0, 0x7] - strb r4, [r0, 0x8] - strb r1, [r0, 0x9] - strb r4, [r0, 0xA] - strb r4, [r0, 0xB] - mov r4, sp - ldrb r2, [r4, 0xC] - subs r1, 0x11 - adds r0, r1, 0 - ands r0, r2 - strb r0, [r4, 0xC] - mov r0, sp - mov r2, r8 - lsls r2, 4 - movs r4, 0xF - strb r2, [r0, 0xC] - mov r2, sp - ands r5, r4 - ldrb r0, [r2, 0xD] - ands r1, r0 - orrs r1, r5 - strb r1, [r2, 0xD] - mov r0, sp - lsrs r6, 20 - ands r1, r4 - orrs r1, r6 - strb r1, [r0, 0xD] - ldr r2, =gTextFlags - ldrb r1, [r2] - movs r0, 0x3 - negs r0, r0 - ands r0, r1 - strb r0, [r2] - mov r0, sp - adds r1, r3, 0 - adds r2, r7, 0 - bl AddTextPrinter - lsls r0, 16 - lsrs r0, 16 - add sp, 0x10 - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r1} - bx r1 - .pool - thumb_func_end AddTextPrinterParameterized - - thumb_func_start AddTextPrinterForMessage -@ void AddTextPrinterForMessage(u8 allowSkippingDelayWithButtonPress) -AddTextPrinterForMessage: @ 81972C4 - push {r4,r5,lr} - sub sp, 0x10 - lsls r0, 24 - lsrs r0, 24 - movs r5, 0 - ldr r3, =gTextFlags - movs r4, 0x1 - ands r0, r4 - ldrb r2, [r3] - movs r1, 0x2 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3] - bl GetPlayerTextSpeed - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - ldr r2, =gStringVar4 - str r5, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x3 - str r0, [sp, 0xC] - movs r0, 0 - movs r1, 0x1 - bl AddTextPrinterParameterized - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end AddTextPrinterForMessage - - thumb_func_start AddTextPrinterForMessage_2 -@ void AddTextPrinterForMessage_2(u8 allowSkippingDelayWithButtonPress) -AddTextPrinterForMessage_2: @ 8197310 - push {r4,lr} - sub sp, 0x10 - lsls r0, 24 - lsrs r0, 24 - ldr r3, =gTextFlags - movs r4, 0x1 - ands r0, r4 - ldrb r2, [r3] - movs r1, 0x2 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r3] - bl GetPlayerTextSpeed - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - ldr r2, =gStringVar4 - movs r0, 0 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - str r4, [sp, 0x8] - movs r0, 0x3 - str r0, [sp, 0xC] - movs r0, 0 - movs r1, 0x1 - bl AddTextPrinterParameterized - add sp, 0x10 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end AddTextPrinterForMessage_2 - - thumb_func_start AddTextPrinterWithCustomSpeedForMessage -@ void AddTextPrinterWithCustomSpeedForMessage(u8 allowSkippingDelayWithButtonPress, u8 speed) -AddTextPrinterWithCustomSpeedForMessage: @ 819735C - push {r4,r5,lr} - sub sp, 0x10 - adds r3, r1, 0 - lsls r0, 24 - lsrs r0, 24 - lsls r3, 24 - lsrs r3, 24 - ldr r4, =gTextFlags - movs r5, 0x1 - ands r0, r5 - ldrb r2, [r4] - movs r1, 0x2 - negs r1, r1 - ands r1, r2 - orrs r1, r0 - strb r1, [r4] - ldr r2, =gStringVar4 - movs r0, 0 - str r0, [sp] - movs r0, 0x2 - str r0, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x3 - str r0, [sp, 0xC] - movs r0, 0 - movs r1, 0x1 - bl AddTextPrinterParameterized - add sp, 0x10 - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end AddTextPrinterWithCustomSpeedForMessage - - thumb_func_start sub_81973A4 -sub_81973A4: @ 81973A4 - push {lr} - movs r1, 0x80 - lsls r1, 2 - movs r0, 0 - movs r2, 0xF0 - bl copy_textbox_border_tile_patterns_to_vram - movs r1, 0x85 - lsls r1, 2 - movs r0, 0 - movs r2, 0xE0 - bl sub_809882C - pop {r0} - bx r0 - thumb_func_end sub_81973A4 - - thumb_func_start sub_81973C4 -sub_81973C4: @ 81973C4 - push {r4,r5,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r4, 24 - lsrs r4, 24 - ldr r1, =sub_81975F4 - adds r0, r5, 0 - bl CallWindowFunction - adds r0, r5, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - adds r0, r5, 0 - bl PutWindowTilemap - cmp r4, 0x1 - bne _081973F2 - adds r0, r5, 0 - movs r1, 0x3 - bl CopyWindowToVram -_081973F2: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81973C4 - - thumb_func_start sub_81973FC -sub_81973FC: @ 81973FC - push {r4,r5,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r4, 24 - lsrs r4, 24 - ldr r1, =sub_81974A4 - adds r0, r5, 0 - bl CallWindowFunction - adds r0, r5, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - adds r0, r5, 0 - bl PutWindowTilemap - cmp r4, 0x1 - bne _0819742A - adds r0, r5, 0 - movs r1, 0x3 - bl CopyWindowToVram -_0819742A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81973FC - - thumb_func_start sub_8197434 -sub_8197434: @ 8197434 - push {r4,r5,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r4, 24 - lsrs r4, 24 - ldr r1, =sub_8197804 - adds r0, r5, 0 - bl CallWindowFunction - adds r0, r5, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - adds r0, r5, 0 - bl ClearWindowTilemap - cmp r4, 0x1 - bne _08197462 - adds r0, r5, 0 - movs r1, 0x3 - bl CopyWindowToVram -_08197462: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_8197434 - - thumb_func_start sub_819746C -sub_819746C: @ 819746C - push {r4,r5,lr} - adds r4, r1, 0 - lsls r0, 24 - lsrs r5, r0, 24 - lsls r4, 24 - lsrs r4, 24 - ldr r1, =sub_81977BC - adds r0, r5, 0 - bl CallWindowFunction - adds r0, r5, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - adds r0, r5, 0 - bl ClearWindowTilemap - cmp r4, 0x1 - bne _0819749A - adds r0, r5, 0 - movs r1, 0x3 - bl CopyWindowToVram -_0819749A: - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_819746C - - thumb_func_start sub_81974A4 -sub_81974A4: @ 81974A4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x1C - adds r4, r2, 0 - ldr r2, [sp, 0x3C] - lsls r0, 24 - lsrs r7, r0, 24 - lsls r1, 24 - lsls r4, 24 - lsls r3, 24 - lsrs r3, 24 - str r3, [sp, 0x10] - lsls r2, 24 - lsrs r2, 24 - str r2, [sp, 0x14] - movs r3, 0x85 - lsls r3, 2 - lsrs r0, r1, 24 - str r0, [sp, 0xC] - movs r2, 0xFF - lsls r2, 24 - adds r2, r1 - mov r8, r2 - lsrs r2, 24 - lsrs r0, r4, 24 - mov r9, r0 - movs r0, 0xFF - lsls r0, 24 - adds r4, r0 - lsrs r4, 24 - movs r5, 0x1 - str r5, [sp] - str r5, [sp, 0x4] - movs r6, 0xE - str r6, [sp, 0x8] - adds r0, r7, 0 - adds r1, r3, 0 - adds r3, r4, 0 - bl FillBgTilemapBufferRect - ldr r1, =0x00000215 - ldr r2, [sp, 0x10] - str r2, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - adds r0, r7, 0 - ldr r2, [sp, 0xC] - adds r3, r4, 0 - bl FillBgTilemapBufferRect - ldr r1, =0x00000216 - ldr r3, [sp, 0xC] - ldr r2, [sp, 0x10] - adds r0, r3, r2 - lsls r0, 24 - mov r10, r0 - lsrs r2, r0, 24 - str r5, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - adds r0, r7, 0 - adds r3, r4, 0 - bl FillBgTilemapBufferRect - mov r5, r9 - ldr r0, [sp, 0x14] - add r0, r9 - cmp r9, r0 - bge _08197578 - mov r3, r8 - str r3, [sp, 0x18] - movs r6, 0x1 - movs r0, 0xE - mov r8, r0 -_0819753E: - lsls r4, r5, 24 - lsrs r4, 24 - str r6, [sp] - str r6, [sp, 0x4] - mov r2, r8 - str r2, [sp, 0x8] - adds r0, r7, 0 - ldr r1, =0x00000217 - ldr r3, [sp, 0x18] - lsrs r2, r3, 24 - adds r3, r4, 0 - bl FillBgTilemapBufferRect - str r6, [sp] - str r6, [sp, 0x4] - mov r0, r8 - str r0, [sp, 0x8] - adds r0, r7, 0 - ldr r1, =0x00000219 - mov r3, r10 - lsrs r2, r3, 24 - adds r3, r4, 0 - bl FillBgTilemapBufferRect - adds r5, 0x1 - ldr r0, [sp, 0x14] - add r0, r9 - cmp r5, r0 - blt _0819753E -_08197578: - ldr r1, =0x0000021a - ldr r2, [sp, 0xC] - subs r2, 0x1 - lsls r2, 24 - lsrs r2, 24 - ldr r4, [sp, 0x14] - add r4, r9 - lsls r4, 24 - lsrs r4, 24 - movs r5, 0x1 - str r5, [sp] - str r5, [sp, 0x4] - movs r6, 0xE - str r6, [sp, 0x8] - adds r0, r7, 0 - adds r3, r4, 0 - bl FillBgTilemapBufferRect - ldr r1, =0x0000021b - ldr r0, [sp, 0x10] - str r0, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - adds r0, r7, 0 - ldr r2, [sp, 0xC] - adds r3, r4, 0 - bl FillBgTilemapBufferRect - movs r1, 0x87 - lsls r1, 2 - ldr r3, [sp, 0xC] - ldr r0, [sp, 0x10] - adds r2, r3, r0 - lsls r2, 24 - lsrs r2, 24 - str r5, [sp] - str r5, [sp, 0x4] - str r6, [sp, 0x8] - adds r0, r7, 0 - adds r3, r4, 0 - bl FillBgTilemapBufferRect - add sp, 0x1C - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81974A4 - - thumb_func_start sub_81975F4 -sub_81975F4: @ 81975F4 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0x24 - adds r6, r0, 0 - adds r5, r2, 0 - mov r8, r3 - ldr r2, [sp, 0x44] - lsls r6, 24 - lsrs r6, 24 - lsls r0, r1, 24 - lsls r5, 24 - mov r1, r8 - lsls r1, 24 - lsrs r1, 24 - mov r8, r1 - lsls r1, r2, 24 - lsrs r1, 24 - str r1, [sp, 0x10] - ldr r1, =0x00000201 - lsrs r2, r0, 24 - str r2, [sp, 0xC] - movs r3, 0xFE - lsls r3, 24 - adds r2, r0, r3 - lsrs r2, 24 - str r2, [sp, 0x14] - lsrs r0, r5, 24 - mov r10, r0 - movs r2, 0xFF - lsls r2, 24 - adds r5, r2 - lsrs r5, 24 - movs r4, 0x1 - str r4, [sp] - str r4, [sp, 0x4] - movs r3, 0xF - mov r9, r3 - str r3, [sp, 0x8] - adds r0, r6, 0 - ldr r2, [sp, 0x14] - adds r3, r5, 0 - bl FillBgTilemapBufferRect - ldr r1, =0x00000203 - ldr r0, [sp, 0xC] - subs r0, 0x1 - lsls r2, r0, 24 - lsrs r2, 24 - str r2, [sp, 0x18] - str r4, [sp] - str r4, [sp, 0x4] - mov r0, r9 - str r0, [sp, 0x8] - adds r0, r6, 0 - adds r3, r5, 0 - bl FillBgTilemapBufferRect - movs r1, 0x81 - lsls r1, 2 - mov r0, r8 - subs r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp, 0x1C] - str r0, [sp] - str r4, [sp, 0x4] - mov r2, r9 - str r2, [sp, 0x8] - adds r0, r6, 0 - ldr r2, [sp, 0xC] - adds r3, r5, 0 - bl FillBgTilemapBufferRect - ldr r1, =0x00000205 - ldr r7, [sp, 0xC] - add r7, r8 - subs r0, r7, 0x1 - lsls r2, r0, 24 - lsrs r2, 24 - str r2, [sp, 0x20] - str r4, [sp] - str r4, [sp, 0x4] - mov r3, r9 - str r3, [sp, 0x8] - adds r0, r6, 0 - adds r3, r5, 0 - bl FillBgTilemapBufferRect - ldr r1, =0x00000206 - lsls r2, r7, 24 - lsrs r7, r2, 24 - str r4, [sp] - str r4, [sp, 0x4] - mov r0, r9 - str r0, [sp, 0x8] - adds r0, r6, 0 - adds r2, r7, 0 - adds r3, r5, 0 - bl FillBgTilemapBufferRect - ldr r1, =0x00000207 - str r4, [sp] - movs r5, 0x5 - str r5, [sp, 0x4] - mov r2, r9 - str r2, [sp, 0x8] - adds r0, r6, 0 - ldr r2, [sp, 0x14] - mov r3, r10 - bl FillBgTilemapBufferRect - ldr r1, =0x00000209 - add r8, r4 - mov r3, r8 - lsls r3, 24 - lsrs r3, 24 - str r3, [sp] - str r5, [sp, 0x4] - mov r0, r9 - str r0, [sp, 0x8] - adds r0, r6, 0 - ldr r2, [sp, 0x18] - mov r3, r10 - bl FillBgTilemapBufferRect - ldr r1, =0x0000020a - str r4, [sp] - str r5, [sp, 0x4] - mov r2, r9 - str r2, [sp, 0x8] - adds r0, r6, 0 - adds r2, r7, 0 - mov r3, r10 - bl FillBgTilemapBufferRect - ldr r1, =0x00000a01 - ldr r3, [sp, 0x10] - add r10, r3 - mov r0, r10 - lsls r0, 24 - lsrs r0, 24 - mov r10, r0 - str r4, [sp] - str r4, [sp, 0x4] - mov r2, r9 - str r2, [sp, 0x8] - adds r0, r6, 0 - ldr r2, [sp, 0x14] - mov r3, r10 - bl FillBgTilemapBufferRect - ldr r1, =0x00000a03 - str r4, [sp] - str r4, [sp, 0x4] - mov r3, r9 - str r3, [sp, 0x8] - adds r0, r6, 0 - ldr r2, [sp, 0x18] - mov r3, r10 - bl FillBgTilemapBufferRect - ldr r1, =0x00000a04 - ldr r0, [sp, 0x1C] - str r0, [sp] - str r4, [sp, 0x4] - mov r2, r9 - str r2, [sp, 0x8] - adds r0, r6, 0 - ldr r2, [sp, 0xC] - mov r3, r10 - bl FillBgTilemapBufferRect - ldr r1, =0x00000a05 - str r4, [sp] - str r4, [sp, 0x4] - mov r3, r9 - str r3, [sp, 0x8] - adds r0, r6, 0 - ldr r2, [sp, 0x20] - mov r3, r10 - bl FillBgTilemapBufferRect - ldr r1, =0x00000a06 - str r4, [sp] - str r4, [sp, 0x4] - mov r0, r9 - str r0, [sp, 0x8] - adds r0, r6, 0 - adds r2, r7, 0 - mov r3, r10 - bl FillBgTilemapBufferRect - add sp, 0x24 - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_81975F4 - - thumb_func_start sub_81977BC -sub_81977BC: @ 81977BC - push {r4,r5,lr} - sub sp, 0xC - adds r4, r1, 0 - adds r5, r2, 0 - ldr r1, [sp, 0x18] - lsls r0, 24 - lsrs r0, 24 - lsls r4, 24 - lsls r5, 24 - lsls r3, 24 - lsls r1, 24 - movs r2, 0xFF - lsls r2, 24 - adds r4, r2 - lsrs r4, 24 - adds r5, r2 - lsrs r5, 24 - movs r2, 0x80 - lsls r2, 18 - adds r3, r2 - lsrs r3, 24 - str r3, [sp] - adds r1, r2 - lsrs r1, 24 - str r1, [sp, 0x4] - movs r1, 0xE - str r1, [sp, 0x8] - movs r1, 0 - adds r2, r4, 0 - adds r3, r5, 0 - bl FillBgTilemapBufferRect - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_81977BC - - thumb_func_start sub_8197804 -sub_8197804: @ 8197804 - push {r4,r5,lr} - sub sp, 0xC - adds r4, r1, 0 - adds r5, r2, 0 - ldr r1, [sp, 0x18] - lsls r0, 24 - lsrs r0, 24 - lsls r4, 24 - lsls r5, 24 - lsls r3, 24 - lsls r1, 24 - movs r2, 0xFD - lsls r2, 24 - adds r4, r2 - lsrs r4, 24 - movs r2, 0xFF - lsls r2, 24 - adds r5, r2 - lsrs r5, 24 - movs r2, 0xC0 - lsls r2, 19 - adds r3, r2 - lsrs r3, 24 - str r3, [sp] - movs r2, 0x80 - lsls r2, 18 - adds r1, r2 - lsrs r1, 24 - str r1, [sp, 0x4] - movs r1, 0xE - str r1, [sp, 0x8] - movs r1, 0 - adds r2, r4, 0 - adds r3, r5, 0 - bl FillBgTilemapBufferRect - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - thumb_func_end sub_8197804 - - thumb_func_start SetStandardWindowBorderStyle -@ void SetStandardWindowBorderStyle(u8 windowId, bool copyToVram) -SetStandardWindowBorderStyle: @ 8197854 - push {lr} - lsls r0, 24 - lsrs r0, 24 - lsls r1, 24 - lsrs r1, 24 - movs r2, 0x85 - lsls r2, 2 - movs r3, 0xE - bl SetWindowBorderStyle - pop {r0} - bx r0 - thumb_func_end SetStandardWindowBorderStyle - - thumb_func_start sub_819786C -sub_819786C: @ 819786C - push {r4-r6,lr} - adds r4, r0, 0 - adds r5, r1, 0 - lsls r4, 24 - lsrs r4, 24 - lsls r5, 24 - lsrs r5, 24 - movs r6, 0x80 - lsls r6, 2 - adds r0, r4, 0 - adds r1, r6, 0 - movs r2, 0xF0 - bl copy_textbox_border_tile_patterns_to_vram - adds r0, r4, 0 - adds r1, r5, 0 - adds r2, r6, 0 - movs r3, 0xF - bl sub_8197B1C - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_819786C - - thumb_func_start sub_819789C -sub_819789C: @ 819789C - push {lr} - ldr r0, =gUnknown_0860F074 - movs r1, 0xE0 - movs r2, 0x14 - bl LoadPalette - pop {r0} - bx r0 - .pool - thumb_func_end sub_819789C - - thumb_func_start sub_81978B0 -sub_81978B0: @ 81978B0 - push {lr} - adds r1, r0, 0 - lsls r1, 16 - lsrs r1, 16 - ldr r0, =gUnknown_0860F074 - movs r2, 0x14 - bl LoadPalette - pop {r0} - bx r0 - .pool - thumb_func_end sub_81978B0 - - thumb_func_start sub_81978C8 -sub_81978C8: @ 81978C8 - ldr r0, =gUnknown_0860F074 - bx lr - .pool - thumb_func_end sub_81978C8 - - thumb_func_start sub_81978D0 -sub_81978D0: @ 81978D0 - push {lr} - lsls r0, 24 - lsrs r1, r0, 24 - cmp r1, 0xF - bls _081978DC - movs r1, 0 -_081978DC: - ldr r0, =gUnknown_0860F074 - lsls r1, 1 - adds r1, r0 - ldrh r0, [r1] - pop {r1} - bx r1 - .pool - thumb_func_end sub_81978D0 - - thumb_func_start DisplayItemMessageOnField -@ void DisplayItemMessageOnField(u8 taskId, u8 *str, void ( *callback)(u8 taskId)) -DisplayItemMessageOnField: @ 81978EC - push {r4-r6,lr} - sub sp, 0x10 - adds r4, r0, 0 - adds r5, r1, 0 - adds r6, r2, 0 - lsls r4, 24 - lsrs r4, 24 - bl sub_81973A4 - bl GetPlayerTextSpeed - lsls r0, 24 - lsrs r0, 24 - movs r2, 0x80 - lsls r2, 2 - movs r1, 0x1 - str r1, [sp] - str r0, [sp, 0x4] - str r5, [sp, 0x8] - str r6, [sp, 0xC] - adds r0, r4, 0 - movs r1, 0 - movs r3, 0xF - bl DisplayMessageAndContinueTask - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0x10 - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end DisplayItemMessageOnField - - thumb_func_start sub_8197930 -sub_8197930: @ 8197930 - push {lr} - ldr r0, =gUnknown_0860F0A8 - movs r1, 0x85 - lsls r1, 2 - movs r2, 0xE - movs r3, 0 - bl CreateYesNoMenu - pop {r0} - bx r0 - .pool - thumb_func_end sub_8197930 - - thumb_func_start sub_8197948 -sub_8197948: @ 8197948 - push {lr} - adds r3, r0, 0 - lsls r3, 24 - lsrs r3, 24 - ldr r0, =gUnknown_0860F0A8 - movs r1, 0x85 - lsls r1, 2 - movs r2, 0xE - bl CreateYesNoMenu - pop {r0} - bx r0 - .pool - thumb_func_end sub_8197948 - - thumb_func_start sub_8197964 -sub_8197964: @ 8197964 - push {lr} - ldr r0, =gTextFlags - ldrb r1, [r0] - movs r0, 0x8 - ands r0, r1 - cmp r0, 0 - bne _08197988 - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x14] - lsls r0, 29 - lsrs r0, 29 - b _0819798A - .pool -_08197988: - movs r0, 0x1 -_0819798A: - pop {r1} - bx r1 - thumb_func_end sub_8197964 - - thumb_func_start GetPlayerTextSpeed -GetPlayerTextSpeed: @ 8197990 - push {lr} - ldr r0, =gSaveBlock2Ptr - ldr r2, [r0] - ldrb r1, [r2, 0x14] - lsls r0, r1, 29 - lsrs r0, 29 - cmp r0, 0x2 - bls _081979AC - movs r0, 0x8 - negs r0, r0 - ands r0, r1 - movs r1, 0x1 - orrs r0, r1 - strb r0, [r2, 0x14] -_081979AC: - bl sub_8197964 - ldr r1, =gUnknown_0860F094 - adds r0, r1 - ldrb r0, [r0] - pop {r1} - bx r1 - .pool - thumb_func_end GetPlayerTextSpeed - - thumb_func_start sub_81979C4 -sub_81979C4: @ 81979C4 - push {r4,lr} - sub sp, 0xC - lsls r0, 24 - lsrs r1, r0, 24 - ldr r4, =gUnknown_0203CD8C - ldrb r0, [r4] - cmp r0, 0xFF - bne _081979F6 - lsls r0, r1, 25 - movs r1, 0x80 - lsls r1, 18 - adds r0, r1 - lsrs r0, 24 - str r0, [sp] - movs r0, 0xF - str r0, [sp, 0x4] - ldr r0, =0x00000139 - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0x16 - movs r2, 0x1 - movs r3, 0x7 - bl sub_8198AA4 - strb r0, [r4] -_081979F6: - ldrb r0, [r4] - add sp, 0xC - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_81979C4 - - thumb_func_start GetStartMenuWindowId -GetStartMenuWindowId: @ 8197A08 - ldr r0, =gUnknown_0203CD8C - ldrb r0, [r0] - bx lr - .pool - thumb_func_end GetStartMenuWindowId - - thumb_func_start remove_start_menu_window_maybe -remove_start_menu_window_maybe: @ 8197A14 - push {r4,lr} - ldr r4, =gUnknown_0203CD8C - ldrb r0, [r4] - cmp r0, 0xFF - beq _08197A26 - bl RemoveWindow - movs r0, 0xFF - strb r0, [r4] -_08197A26: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end remove_start_menu_window_maybe - - thumb_func_start sub_8197A30 -sub_8197A30: @ 8197A30 - movs r0, 0x80 - lsls r0, 2 - bx lr - thumb_func_end sub_8197A30 - - thumb_func_start sub_8197A38 -sub_8197A38: @ 8197A38 - movs r0, 0x85 - lsls r0, 2 - bx lr - thumb_func_end sub_8197A38 - - thumb_func_start AddMapNamePopUpWindow -AddMapNamePopUpWindow: @ 8197A40 - push {r4,lr} - sub sp, 0xC - ldr r4, =gUnknown_0203CD8D - ldrb r0, [r4] - cmp r0, 0xFF - bne _08197A66 - movs r0, 0x3 - str r0, [sp] - movs r0, 0xE - str r0, [sp, 0x4] - adds r0, 0xF9 - str r0, [sp, 0x8] - movs r0, 0 - movs r1, 0x1 - movs r2, 0x1 - movs r3, 0xA - bl sub_8198AA4 - strb r0, [r4] -_08197A66: - ldrb r0, [r4] - add sp, 0xC - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end AddMapNamePopUpWindow - - thumb_func_start GetMapNamePopUpWindowId -GetMapNamePopUpWindowId: @ 8197A74 - ldr r0, =gUnknown_0203CD8D - ldrb r0, [r0] - bx lr - .pool - thumb_func_end GetMapNamePopUpWindowId - - thumb_func_start RemoveMapNamePopUpWindow -RemoveMapNamePopUpWindow: @ 8197A80 - push {r4,lr} - ldr r4, =gUnknown_0203CD8D - ldrb r0, [r4] - cmp r0, 0xFF - beq _08197A92 - bl RemoveWindow - movs r0, 0xFF - strb r0, [r4] -_08197A92: - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end RemoveMapNamePopUpWindow - - .align 2, 0 @ Don't pad with nop. diff --git a/asm/player_pc.s b/asm/player_pc.s index 3f08d3f5c..090552b93 100644 --- a/asm/player_pc.s +++ b/asm/player_pc.s @@ -463,7 +463,7 @@ sub_816B21C: @ 816B21C adds r4, r0, 0 movs r0, 0 movs r1, 0 - bl sub_81973C4 + bl NewMenuHelpers_DrawDialogueFrame movs r0, 0x1 str r0, [sp] movs r0, 0 @@ -599,7 +599,7 @@ mapldr_080EBC0C: @ 816B33C bl sub_81973A4 movs r0, 0 movs r1, 0x1 - bl sub_81973C4 + bl NewMenuHelpers_DrawDialogueFrame ldr r0, =sub_816B368 movs r1, 0 bl CreateTask @@ -2540,7 +2540,7 @@ bx_battle_menu_t3: @ 816C3A4 bne _0816C3F2 movs r0, 0 movs r1, 0 - bl sub_81973C4 + bl NewMenuHelpers_DrawDialogueFrame movs r1, 0x6 ldrsh r0, [r5, r1] cmp r0, 0 diff --git a/asm/pokemon_storage_system.s b/asm/pokemon_storage_system.s index c105c7781..e103ebb5e 100644 --- a/asm/pokemon_storage_system.s +++ b/asm/pokemon_storage_system.s @@ -211,7 +211,7 @@ _080C72AC: bl sub_81973A4 movs r0, 0 movs r1, 0 - bl sub_81973C4 + bl NewMenuHelpers_DrawDialogueFrame movs r0, 0 movs r1, 0x11 bl FillWindowPixelBuffer @@ -627,7 +627,7 @@ sub_80C75FC: @ 80C75FC lsrs r4, 24 adds r0, r4, 0 movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame adds r0, r4, 0 movs r1, 0x5 mov r2, r8 diff --git a/asm/record_mixing.s b/asm/record_mixing.s index b7bcca4a8..799348326 100644 --- a/asm/record_mixing.s +++ b/asm/record_mixing.s @@ -461,7 +461,7 @@ sub_80E70F4: @ 80E70F4 adds r4, r0, 0 movs r0, 0 movs r1, 0 - bl sub_81973C4 + bl NewMenuHelpers_DrawDialogueFrame movs r0, 0x1 str r0, [sp] movs r0, 0 diff --git a/asm/roulette.s b/asm/roulette.s index 3568c1911..e03bbea91 100644 --- a/asm/roulette.s +++ b/asm/roulette.s @@ -508,7 +508,7 @@ _081406E0: ldr r4, =gUnknown_0203AB8C ldrb r0, [r4] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldrb r0, [r4] ldr r2, =gUnknown_082A5B89 movs r1, 0x1 @@ -740,7 +740,7 @@ sub_8140914: @ 8140914 ldr r5, =gUnknown_0203AB8C ldrb r0, [r5] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldrb r0, [r5] ldr r2, =gUnknown_082A5C13 movs r1, 0x1 @@ -2631,7 +2631,7 @@ sub_814189C: @ 814189C ldr r4, =gUnknown_0203AB8C ldrb r0, [r4] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldrb r0, [r4] ldr r2, =gUnknown_082A5BD7 b _08141902 @@ -2643,7 +2643,7 @@ _081418EC: ldr r4, =gUnknown_0203AB8C ldrb r0, [r4] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldrb r0, [r4] ldr r2, =gUnknown_082A5BCB _08141902: @@ -2667,7 +2667,7 @@ _08141928: ldr r4, =gUnknown_0203AB8C ldrb r0, [r4] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldrb r0, [r4] ldr r2, =gUnknown_082A5BE0 movs r1, 0x1 @@ -2805,7 +2805,7 @@ sub_8141A18: @ 8141A18 ldr r5, =gUnknown_0203AB8C ldrb r0, [r5] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldrb r0, [r5] movs r1, 0x1 str r1, [sp] @@ -3001,7 +3001,7 @@ _08141BB0: ldr r4, =gUnknown_0203AB8C ldrb r0, [r4] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldrb r0, [r4] ldr r2, =gUnknown_082A5C21 movs r1, 0x1 @@ -3028,7 +3028,7 @@ _08141C58: ldr r4, =gUnknown_0203AB8C ldrb r0, [r4] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldrb r0, [r4] ldr r2, =gUnknown_082A5C61 movs r1, 0x1 @@ -3060,7 +3060,7 @@ _08141CBC: ldr r4, =gUnknown_0203AB8C ldrb r0, [r4] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldrb r0, [r4] ldr r2, =gUnknown_082A5C04 movs r1, 0x1 @@ -3147,7 +3147,7 @@ _08141D44: ldr r4, =gUnknown_0203AB8C ldrb r0, [r4] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldrb r0, [r4] ldr r2, =gUnknown_082A5C61 movs r1, 0x1 @@ -4667,7 +4667,7 @@ sub_81429F0: @ 81429F0 bl StringExpandPlaceholders movs r0, 0 movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame str r5, [sp] movs r0, 0xFF str r0, [sp, 0x4] @@ -4744,7 +4744,7 @@ sub_8142A88: @ 8142A88 beq _08142B28 movs r0, 0 movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldr r2, =gUnknown_082A5B6B str r7, [sp] movs r0, 0xFF @@ -4768,7 +4768,7 @@ _08142B28: bl StringExpandPlaceholders movs r0, 0 movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame movs r0, 0x1 str r0, [sp] movs r0, 0xFF @@ -4798,7 +4798,7 @@ _08142B78: bl StringExpandPlaceholders movs r0, 0 movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame str r7, [sp] movs r0, 0xFF str r0, [sp, 0x4] diff --git a/asm/slot_machine.s b/asm/slot_machine.s index 4a331b313..88f73fe2c 100644 --- a/asm/slot_machine.s +++ b/asm/slot_machine.s @@ -975,7 +975,7 @@ sub_812ACF4: @ 812ACF4 sub sp, 0xC movs r0, 0 movs r1, 0 - bl sub_81973C4 + bl NewMenuHelpers_DrawDialogueFrame ldr r2, =gText_YouDontHaveThreeCoins movs r0, 0x1 str r0, [sp] @@ -1543,7 +1543,7 @@ sub_812B158: @ 812B158 sub sp, 0xC movs r0, 0 movs r1, 0 - bl sub_81973C4 + bl NewMenuHelpers_DrawDialogueFrame ldr r2, =gText_QuitTheGame movs r0, 0x1 str r0, [sp] @@ -1633,7 +1633,7 @@ sub_812B214: @ 812B214 sub sp, 0xC movs r0, 0 movs r1, 0 - bl sub_81973C4 + bl NewMenuHelpers_DrawDialogueFrame ldr r2, =gText_YouveGot9999Coins movs r0, 0x1 str r0, [sp] @@ -1686,7 +1686,7 @@ sub_812B280: @ 812B280 sub sp, 0xC movs r0, 0 movs r1, 0 - bl sub_81973C4 + bl NewMenuHelpers_DrawDialogueFrame ldr r2, =gText_YouveRunOutOfCoins movs r0, 0x1 str r0, [sp] diff --git a/asm/start_menu.s b/asm/start_menu.s index 518b46f76..e7d70faf3 100644 --- a/asm/start_menu.s +++ b/asm/start_menu.s @@ -148,7 +148,7 @@ _0809F8E4: lsls r0, 24 lsrs r0, 24 movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldr r1, =gUnknown_02037619 movs r0, 0 strb r0, [r1, 0x1] @@ -1832,7 +1832,7 @@ _080A06EC: strb r0, [r6] ldrb r0, [r6] movs r1, 0 - bl sub_81973FC + bl NewMenuHelpers_DrawStdWindowFrame ldr r0, =gSaveBlock2Ptr ldr r0, [r0] ldrb r0, [r0, 0x8] diff --git a/asm/trainer_card.s b/asm/trainer_card.s index f1679d04e..1adb35370 100644 --- a/asm/trainer_card.s +++ b/asm/trainer_card.s @@ -409,7 +409,7 @@ _080C2A2C: bl sub_800AC34 movs r0, 0 movs r1, 0x1 - bl sub_81973C4 + bl NewMenuHelpers_DrawDialogueFrame ldr r2, =gText_WaitingTrainerFinishReading movs r0, 0x1 str r0, [sp] diff --git a/include/gba/defines.h b/include/gba/defines.h index 41cc84f4a..702d4a352 100644 --- a/include/gba/defines.h +++ b/include/gba/defines.h @@ -39,6 +39,9 @@ #define BG_CHAR_ADDR(n) (BG_VRAM + (BG_CHAR_SIZE * (n))) #define BG_SCREEN_ADDR(n) (BG_VRAM + (BG_SCREEN_SIZE * (n))) +#define BG_TILE_H_FLIP(n) (0x400 | (n)) +#define BG_TILE_V_FLIP(n) (0x800 | (n)) + // text-mode BG #define OBJ_VRAM0 (VRAM + 0x10000) #define OBJ_VRAM0_SIZE 0x8000 diff --git a/include/menu.h b/include/menu.h index e5f705cae..425908aea 100644 --- a/include/menu.h +++ b/include/menu.h @@ -39,5 +39,6 @@ void AddTextPrinterParameterized2(u8 windowId, u8 fontId, u8 x, u8 y, u8 letterS void sub_8197B1C(u8 windowId, bool8 copyToVram, u16 a2, u16 a3); void sub_81995E4(u8 windowId, u8 optionsNo, const struct MenuAction *actions, const u8 *actionIds); void sub_8197DF8(u8 windowId, bool8 copyToVram); +u8 sub_8198AA4(u8, u8, u8, u8, u8, u8, u16); #endif // GUARD_MENU_H diff --git a/include/new_menu_helpers.h b/include/new_menu_helpers.h index 4b1e372c2..fb9a727dc 100644 --- a/include/new_menu_helpers.h +++ b/include/new_menu_helpers.h @@ -7,10 +7,10 @@ void sub_81971D0(void); void sub_8197200(void); void sub_81973A4(void); -void sub_81973C4(u8, u8); +void NewMenuHelpers_DrawDialogueFrame(u8, u8); void sub_819746C(u8 windowId, bool8 copyToVram); -void sub_81973FC(u8, u8); -u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 speed, void ( *callback)(u16, struct TextPrinter *), u8 fgColor, u8 bgColor, u8 shadowColor); +void NewMenuHelpers_DrawStdWindowFrame(u8, u8); +u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 speed, void (*callback)(struct TextSubPrinter *, u16), u8 fgColor, u8 bgColor, u8 shadowColor); void DisplayItemMessageOnField(u8 taskId, const u8 *src, TaskFunc callback); void sub_8197434(u8 a0, u8 a1); void SetStandardWindowBorderStyle(u8 a0, u8 a1); diff --git a/include/text.h b/include/text.h index b5fc5b58a..b10b27f1e 100644 --- a/include/text.h +++ b/include/text.h @@ -116,7 +116,7 @@ struct TextSubPrinter // TODO: Better name u8 letterSpacing; u8 lineSpacing; u8 fontColor_l:4; // 0xC - u8 fontColor_h:4; + u8 fgColor:4; u8 bgColor:4; u8 shadowColor:4; }; @@ -149,7 +149,7 @@ struct FontInfo u8 letterSpacing; u8 lineSpacing; u8 fontColor_l:4; - u8 fontColor_h:4; + u8 fgColor:4; u8 bgColor:4; u8 shadowColor:4; }; diff --git a/ld_script.txt b/ld_script.txt index f2a9d8196..ab9a456d0 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -247,7 +247,7 @@ SECTIONS { src/battle_dome_cards.o(.text); src/lilycove_lady.o(.text); asm/battle_frontier_1.o(.text); - asm/new_menu_helpers.o(.text); + src/new_menu_helpers.o(.text); asm/menu.o(.text); asm/battle_frontier_2.o(.text); asm/item_menu.o(.text); diff --git a/src/battle_message.c b/src/battle_message.c index 3fa3d0563..32de3df27 100644 --- a/src/battle_message.c +++ b/src/battle_message.c @@ -2440,7 +2440,7 @@ void BattleHandleAddTextPrinter(const u8 *text, u8 arg1) textSubPrinter.letterSpacing = r8[(12 * arg1) + 4]; textSubPrinter.lineSpacing = r8[(12 * arg1) + 5]; textSubPrinter.fontColor_l = 0; - textSubPrinter.fontColor_h = r8[(12 * arg1) + 7]; + textSubPrinter.fgColor = r8[(12 * arg1) + 7]; textSubPrinter.bgColor = r8[(12 * arg1) + 8]; textSubPrinter.shadowColor = r8[(12 * arg1) + 9]; diff --git a/src/battle_script_commands.c b/src/battle_script_commands.c index c7976fc2a..72c637849 100644 --- a/src/battle_script_commands.c +++ b/src/battle_script_commands.c @@ -6730,7 +6730,7 @@ static void PutLevelAndGenderOnLvlUpBox(void) subPrinter.letterSpacing = 0; subPrinter.lineSpacing = 0; subPrinter.fontColor_l = TEXT_COLOR_TRANSPARENT; - subPrinter.fontColor_h = TEXT_COLOR_WHITE; + subPrinter.fgColor = TEXT_COLOR_WHITE; subPrinter.bgColor = TEXT_COLOR_TRANSPARENT; subPrinter.shadowColor = TEXT_COLOR_DARK_GREY; diff --git a/src/berry_blender.c b/src/berry_blender.c index c7f465967..3494492de 100644 --- a/src/berry_blender.c +++ b/src/berry_blender.c @@ -3489,7 +3489,7 @@ void ShowBerryBlenderRecordWindow(void) winTemplate = sBlenderRecordWindowTemplate; gResultsWindowId = AddWindow(&winTemplate); - sub_81973FC(gResultsWindowId, 0); + NewMenuHelpers_DrawStdWindowFrame(gResultsWindowId, 0); FillWindowPixelBuffer(gResultsWindowId, 0x11); xPos = GetStringCenterAlignXOffset(1, gText_BlenderMaxSpeedRecord, 0x90); diff --git a/src/daycare.c b/src/daycare.c index 59ee562bd..f7d1825fd 100644 --- a/src/daycare.c +++ b/src/daycare.c @@ -43,7 +43,7 @@ extern u16 ItemIdToBattleMoveId(u16); extern s32 ListMenuHandleInputGetItemId(u8); extern void sub_81AE6C8(u8, u16*, u16*); extern void sub_819746C(u8, bool8); -extern void sub_81973FC(u8, bool8); +extern void NewMenuHelpers_DrawStdWindowFrame(u8, bool8); extern void sub_81B9328(void); extern void sub_81AF078(u32, bool8, struct ListMenu *); extern void c2_exit_to_overworld_2_switch(void); @@ -1212,7 +1212,7 @@ static void DaycareAddTextPrinter(u8 windowId, const u8 *text, u32 x, u32 y) gTextFlags.flag_1 = 0; printer.letterSpacing = 0; printer.lineSpacing = 1; - printer.fontColor_h = 2; + printer.fgColor = 2; printer.bgColor = 1; printer.shadowColor = 3; @@ -1296,7 +1296,7 @@ void ShowDaycareLevelMenu(void) u8 daycareMenuTaskId; windowId = AddWindow(&sDaycareLevelMenuWindowTemplate); - sub_81973FC(windowId, FALSE); + NewMenuHelpers_DrawStdWindowFrame(windowId, FALSE); menuTemplate = sDaycareListMenuLevelTemplate; menuTemplate.unk_10 = windowId; diff --git a/src/decoration.c b/src/decoration.c index a9777c86f..8fb620b36 100644 --- a/src/decoration.c +++ b/src/decoration.c @@ -727,7 +727,7 @@ void sub_81271CC(u8 taskId) { sub_8126A58(1); sub_8126A88(); - sub_81973C4(0, 0); + NewMenuHelpers_DrawDialogueFrame(0, 0); sub_8126C08(); gTasks[taskId].func = sub_8126B80; } @@ -2712,7 +2712,7 @@ void sub_812A334(void) u8 taskId; pal_fill_black(); - sub_81973C4(0, 1); + NewMenuHelpers_DrawDialogueFrame(0, 1); sub_8126ABC(); taskId = CreateTask(sub_812A2C4, 8); gTasks[taskId].data[2] = 0; diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index 5390814eb..85fb518b5 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -81,7 +81,7 @@ extern const u8 gText_MainMenuTime[]; extern const u8 gContestConfetti_Gfx[]; extern const u8 gContestConfetti_Pal[]; -extern void sub_81973C4(u8, u8); +extern void NewMenuHelpers_DrawDialogueFrame(u8, u8); extern u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 speed, void ( *callback)(u16, struct TextPrinter *), u8 fgColor, u8 bgColor, u8 shadowColor); extern void sub_8175620(void); extern u8 TrySavingData(u8); @@ -539,7 +539,7 @@ static void Task_Hof_InitTeamSaveData(u8 taskId) } *lastSavedTeam = *sHofMonPtr; - sub_81973C4(0, 0); + NewMenuHelpers_DrawDialogueFrame(0, 0); AddTextPrinterParameterized(0, 1, gText_SavingDontTurnOffPower, 0, NULL, 2, 1, 3); CopyWindowToVram(0, 3); gTasks[taskId].func = Task_Hof_TrySaveData; @@ -746,7 +746,7 @@ static void Task_Hof_WaitAndPrintPlayerInfo(u8 taskId) { FillBgTilemapBufferRect_Palette0(0, 0, 0, 0, 0x20, 0x20); HallOfFame_PrintPlayerInfo(1, 2); - sub_81973C4(0, 0); + NewMenuHelpers_DrawDialogueFrame(0, 0); AddTextPrinterParameterized(0, 1, gText_LeagueChamp, 0, NULL, 2, 1, 3); CopyWindowToVram(0, 3); gTasks[taskId].func = Task_Hof_ExitOnKeyPressed; @@ -1115,7 +1115,7 @@ static void Task_HofPC_HandleExit(u8 taskId) static void Task_HofPC_PrintDataIsCorrupted(u8 taskId) { sub_8198180(gText_UnkCtrlF800Exit, 8, 1); - sub_81973C4(0, 0); + NewMenuHelpers_DrawDialogueFrame(0, 0); AddTextPrinterParameterized(0, 1, gText_HOFCorrupted, 0, NULL, 2, 1, 3); CopyWindowToVram(0, 3); gTasks[taskId].func = Task_HofPC_ExitOnButtonPress; diff --git a/src/naming_screen.c b/src/naming_screen.c index 7139b5c90..9a5cec1e0 100644 --- a/src/naming_screen.c +++ b/src/naming_screen.c @@ -530,7 +530,7 @@ static void DisplaySentToPCMessage(void) stringToDisplay++; StringExpandPlaceholders(gStringVar4, gUnknown_0858BDB8[stringToDisplay]); - sub_81973C4(0, 0); + NewMenuHelpers_DrawDialogueFrame(0, 0); gTextFlags.flag_0 = TRUE; AddTextPrinterParameterized(0, 1, gStringVar4, GetPlayerTextSpeed(), 0, 2, 1, 3); CopyWindowToVram(0, 3); diff --git a/src/new_menu_helpers.c b/src/new_menu_helpers.c new file mode 100644 index 000000000..baa053a22 --- /dev/null +++ b/src/new_menu_helpers.c @@ -0,0 +1,442 @@ +#include "global.h" +#include "bg.h" +#include "palette.h" +#include "window.h" +#include "text.h" +#include "new_menu_helpers.h" +#include "text_window.h" +#include "menu.h" +#include "menu_helpers.h" + +#define STD_WINDOW_PALETTE_NUM 14 +#define STD_WINDOW_BASE_TILE_NUM 0x214 +#define DLG_WINDOW_PALETTE_NUM 15 +#define DLG_WINDOW_BASE_TILE_NUM 0x200 + +extern EWRAM_DATA u8 gUnknown_0203CD8C; +extern EWRAM_DATA u8 gUnknown_0203CD8D; + +extern const u8 gUnknown_0860EA6C[]; +extern const u16 gUnknown_0860EA4C[]; +extern const u16 gUnknown_0860F074[]; +extern const u8 gUnknown_0860F094[]; +extern const struct WindowTemplate gUnknown_0860F098[]; +extern const struct WindowTemplate gUnknown_0860F0A8; + +extern void sub_819645C(void); +// Forward declarations +extern void sub_81973A4(void); +extern void DrawStandardFrame(u8, u8, u8, u8, u8, u8); +extern void DrawDialogueFrame(u8, u8, u8, u8, u8, u8); +extern void sub_81977BC(u8, u8, u8, u8, u8, u8); +extern void sub_8197804(u8, u8, u8, u8, u8, u8); + +void sub_8197184(u8 window, u32 destTile, u32 destPalette) +{ + LoadBgTiles(GetWindowAttribute(window, WINDOW_PRIORITY), gUnknown_0860EA6C, 0x100, destTile); + LoadPalette(gUnknown_0860EA4C, destPalette * 16, 32); +} + +void sub_81971C4(void) +{ + sub_819645C(); +} + +void sub_81971D0(void) +{ + InitWindows(gUnknown_0860F098); + gUnknown_0203CD8C = 0xFF; + gUnknown_0203CD8D = 0xFF; +} + +void sub_81971F4(void) +{ + FreeAllWindowBuffers(); +} + +void sub_8197200(void) +{ + ChangeBgX(0, 0, 0); + ChangeBgY(0, 0, 0); + DeactivateAllTextPrinters(); + sub_81973A4(); +} + +u16 sub_8197224(void) +{ + RunTextPrinters(); + return IsTextPrinterActive(0); +} + +u16 AddTextPrinterParameterized(u8 windowId, u8 fontId, const u8 *str, u8 speed, void (*callback)(struct TextSubPrinter *, u16), u8 fgColor, u8 bgColor, u8 shadowColor) +{ + struct TextSubPrinter printer; + + printer.current_text_offset = str; + printer.windowId = windowId; + printer.fontId = fontId; + printer.x = 0; + printer.y = 1; + printer.currentX = 0; + printer.currentY = 1; + printer.letterSpacing = 0; + printer.lineSpacing = 0; + printer.fontColor_l = 0; + printer.fgColor = fgColor; + printer.bgColor = bgColor; + printer.shadowColor = shadowColor; + + gTextFlags.flag_1 = 0; + return AddTextPrinter(&printer, speed, callback); +} + +void AddTextPrinterForMessage(bool8 allowSkippingDelayWithButtonPress) +{ + void (*callback)(struct TextSubPrinter *, u16) = NULL; + gTextFlags.flag_0 = allowSkippingDelayWithButtonPress; + AddTextPrinterParameterized(0, 1, gStringVar4, GetPlayerTextSpeed(), callback, 2, 1, 3); +} + +void AddTextPrinterForMessage_2(bool8 allowSkippingDelayWithButtonPress) +{ + gTextFlags.flag_0 = allowSkippingDelayWithButtonPress; + AddTextPrinterParameterized(0, 1, gStringVar4, GetPlayerTextSpeed(), NULL, 2, 1, 3); +} + +void AddTextPrinterWithCustomSpeedForMessage(bool8 allowSkippingDelayWithButtonPress, u8 speed) +{ + gTextFlags.flag_0 = allowSkippingDelayWithButtonPress; + AddTextPrinterParameterized(0, 1, gStringVar4, speed, NULL, 2, 1, 3); +} + +void sub_81973A4(void) +{ + copy_textbox_border_tile_patterns_to_vram(0, DLG_WINDOW_BASE_TILE_NUM, 0xF0); + sub_809882C(0, STD_WINDOW_BASE_TILE_NUM, 0xE0); +} + +void NewMenuHelpers_DrawDialogueFrame(u8 windowId, bool8 copyToVram) +{ + CallWindowFunction(windowId, DrawDialogueFrame); + FillWindowPixelBuffer(windowId, 0x11); + PutWindowTilemap(windowId); + if (copyToVram == TRUE) + CopyWindowToVram(windowId, 3); +} + +void NewMenuHelpers_DrawStdWindowFrame(u8 windowId, bool8 copyToVram) +{ + CallWindowFunction(windowId, DrawStandardFrame); + FillWindowPixelBuffer(windowId, 0x11); + PutWindowTilemap(windowId); + if (copyToVram == TRUE) + CopyWindowToVram(windowId, 3); +} + +void sub_8197434(u8 windowId, bool8 copyToVram) +{ + CallWindowFunction(windowId, sub_8197804); + FillWindowPixelBuffer(windowId, 0x11); + ClearWindowTilemap(windowId); + if (copyToVram == TRUE) + CopyWindowToVram(windowId, 3); +} + +void sub_819746C(u8 windowId, bool8 copyToVram) +{ + CallWindowFunction(windowId, sub_81977BC); + FillWindowPixelBuffer(windowId, 0x11); + ClearWindowTilemap(windowId); + if (copyToVram == TRUE) + CopyWindowToVram(windowId, 3); +} + +void DrawStandardFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) +{ + int i; + + FillBgTilemapBufferRect(bg, + STD_WINDOW_BASE_TILE_NUM + 0, + tilemapLeft - 1, + tilemapTop - 1, + 1, + 1, + STD_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + STD_WINDOW_BASE_TILE_NUM + 1, + tilemapLeft, + tilemapTop - 1, + width, + 1, + STD_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + STD_WINDOW_BASE_TILE_NUM + 2, + tilemapLeft + width, + tilemapTop - 1, + 1, + 1, + STD_WINDOW_PALETTE_NUM); + + for (i = tilemapTop; i < tilemapTop + height; i++) + { + FillBgTilemapBufferRect(bg, + STD_WINDOW_BASE_TILE_NUM + 3, + tilemapLeft - 1, + i, + 1, + 1, + STD_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + STD_WINDOW_BASE_TILE_NUM + 5, + tilemapLeft + width, + i, + 1, + 1, + STD_WINDOW_PALETTE_NUM); + } + + FillBgTilemapBufferRect(bg, + STD_WINDOW_BASE_TILE_NUM + 6, + tilemapLeft - 1, + tilemapTop + height, + 1, + 1, + STD_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + STD_WINDOW_BASE_TILE_NUM + 7, + tilemapLeft, + tilemapTop + height, + width, + 1, + STD_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + STD_WINDOW_BASE_TILE_NUM + 8, + tilemapLeft + width, + tilemapTop + height, + 1, + 1, + STD_WINDOW_PALETTE_NUM); +} + +void DrawDialogueFrame(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) +{ + FillBgTilemapBufferRect(bg, + DLG_WINDOW_BASE_TILE_NUM + 1, + tilemapLeft - 2, + tilemapTop - 1, + 1, + 1, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + DLG_WINDOW_BASE_TILE_NUM + 3, + tilemapLeft - 1, + tilemapTop - 1, + 1, + 1, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + DLG_WINDOW_BASE_TILE_NUM + 4, + tilemapLeft, + tilemapTop - 1, + width - 1, + 1, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + DLG_WINDOW_BASE_TILE_NUM + 5, + tilemapLeft + width - 1, + tilemapTop - 1, + 1, + 1, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + DLG_WINDOW_BASE_TILE_NUM + 6, + tilemapLeft + width, + tilemapTop - 1, + 1, + 1, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + DLG_WINDOW_BASE_TILE_NUM + 7, + tilemapLeft - 2, + tilemapTop, + 1, + 5, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + DLG_WINDOW_BASE_TILE_NUM + 9, + tilemapLeft - 1, + tilemapTop, + width + 1, + 5, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + DLG_WINDOW_BASE_TILE_NUM + 10, + tilemapLeft + width, + tilemapTop, + 1, + 5, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 1), + tilemapLeft - 2, + tilemapTop + height, + 1, + 1, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 3), + tilemapLeft - 1, + tilemapTop + height, + 1, + 1, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 4), + tilemapLeft, + tilemapTop + height, + width - 1, + 1, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 5), + tilemapLeft + width - 1, + tilemapTop + height, + 1, + 1, + DLG_WINDOW_PALETTE_NUM); + FillBgTilemapBufferRect(bg, + BG_TILE_V_FLIP(DLG_WINDOW_BASE_TILE_NUM + 6), + tilemapLeft + width, + tilemapTop + height, + 1, + 1, + DLG_WINDOW_PALETTE_NUM); +} + +void sub_81977BC(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) +{ + FillBgTilemapBufferRect(bg, 0, tilemapLeft - 1, tilemapTop - 1, width + 2, height + 2, STD_WINDOW_PALETTE_NUM); +} + +void sub_8197804(u8 bg, u8 tilemapLeft, u8 tilemapTop, u8 width, u8 height, u8 paletteNum) +{ + FillBgTilemapBufferRect(bg, 0, tilemapLeft - 3, tilemapTop - 1, width + 6, height + 2, STD_WINDOW_PALETTE_NUM); +} + +void SetStandardWindowBorderStyle(u8 windowId, bool8 copyToVram) +{ + SetWindowBorderStyle(windowId, copyToVram, STD_WINDOW_BASE_TILE_NUM, STD_WINDOW_PALETTE_NUM); +} + +void sub_819786C(u8 windowId, bool8 copyToVram) +{ + copy_textbox_border_tile_patterns_to_vram(windowId, DLG_WINDOW_BASE_TILE_NUM, 0xF0); + sub_8197B1C(windowId, copyToVram, DLG_WINDOW_BASE_TILE_NUM, 0xF); +} + +void sub_819789C(void) +{ + LoadPalette(gUnknown_0860F074, 0xE0, 0x14); +} + +void sub_81978B0(u16 offset) +{ + LoadPalette(gUnknown_0860F074, offset, 0x14); +} + +const u16 *sub_81978C8(void) +{ + return gUnknown_0860F074; +} + +u16 sub_81978D0(u8 colorNum) +{ + if (colorNum > 15) + colorNum = 0; + return gUnknown_0860F074[colorNum]; +} + +void DisplayItemMessageOnField(u8 taskId, const u8 *string, TaskFunc callback) +{ + sub_81973A4(); + DisplayMessageAndContinueTask(taskId, 0, DLG_WINDOW_BASE_TILE_NUM, DLG_WINDOW_PALETTE_NUM, 1, GetPlayerTextSpeed(), string, callback); + CopyWindowToVram(0, 3); +} + +void sub_8197930(void) +{ + CreateYesNoMenu(&gUnknown_0860F0A8, STD_WINDOW_BASE_TILE_NUM, STD_WINDOW_PALETTE_NUM, 0); +} + +void sub_8197948(u8 initialCursorPos) +{ + CreateYesNoMenu(&gUnknown_0860F0A8, STD_WINDOW_BASE_TILE_NUM, STD_WINDOW_PALETTE_NUM, initialCursorPos); +} + +u32 sub_8197964(void) +{ + if (gTextFlags.flag_3) + return 1; + return gSaveBlock2Ptr->optionsTextSpeed; +} + +u8 GetPlayerTextSpeed(void) +{ + u32 speed; + if (gSaveBlock2Ptr->optionsTextSpeed > 2) + gSaveBlock2Ptr->optionsTextSpeed = 1; + speed = sub_8197964(); + return gUnknown_0860F094[speed]; +} + +u8 sub_81979C4(u8 a1) +{ + if (gUnknown_0203CD8C == 0xFF) + gUnknown_0203CD8C = sub_8198AA4(0, 0x16, 1, 7, (a1 * 2) + 2, 0xF, 0x139); + return gUnknown_0203CD8C; +} + +u8 GetStartMenuWindowId(void) +{ + return gUnknown_0203CD8C; +} + +void remove_start_menu_window_maybe(void) +{ + if (gUnknown_0203CD8C != 0xFF) + { + RemoveWindow(gUnknown_0203CD8C); + gUnknown_0203CD8C = 0xFF; + } +} + +u16 sub_8197A30(void) +{ + return DLG_WINDOW_BASE_TILE_NUM; +} + +u16 sub_8197A38(void) +{ + return STD_WINDOW_BASE_TILE_NUM; +} + +u8 AddMapNamePopUpWindow(void) +{ + if (gUnknown_0203CD8D == 0xFF) + gUnknown_0203CD8D = sub_8198AA4(0, 1, 1, 10, 3, 14, 0x107); + return gUnknown_0203CD8D; +} + +u8 GetMapNamePopUpWindowId(void) +{ + return gUnknown_0203CD8D; +} + +void RemoveMapNamePopUpWindow(void) +{ + if (gUnknown_0203CD8D != 0xFF) + { + RemoveWindow(gUnknown_0203CD8D); + gUnknown_0203CD8D = 0xFF; + } +} diff --git a/src/scrcmd.c b/src/scrcmd.c index 0557cd95e..5a4cc4591 100644 --- a/src/scrcmd.c +++ b/src/scrcmd.c @@ -1313,7 +1313,7 @@ bool8 ScrCmd_cmdDB(struct ScriptContext *ctx) if (msg == NULL) msg = (const u8 *)ctx->data[0]; sub_81973A4(); - sub_81973C4(0, 1); + NewMenuHelpers_DrawDialogueFrame(0, 1); PrintTextOnWindow(0, 1, msg, 0, 1, 0, 0); return FALSE; } @@ -1530,7 +1530,7 @@ bool8 ScrCmd_braillemessage(struct ScriptContext *ctx) template2 = template1; gUnknown_03000F30 = AddWindow(&template2); sub_809882C(gUnknown_03000F30, 0x214, 0xE0); - sub_81973FC(gUnknown_03000F30, 0); + NewMenuHelpers_DrawStdWindowFrame(gUnknown_03000F30, 0); PutWindowTilemap(gUnknown_03000F30); FillWindowPixelBuffer(gUnknown_03000F30, 0x11); PrintTextOnWindow(gUnknown_03000F30, 6, gStringVar4, temp1, temp2, 0xFF, 0x0); @@ -1651,7 +1651,7 @@ _0809AEC6:\n\ bl sub_809882C\n\ ldrb r0, [r5]\n\ mov r1, #0\n\ - bl sub_81973FC\n\ + bl NewMenuHelpers_DrawStdWindowFrame\n\ ldrb r0, [r5]\n\ bl PutWindowTilemap\n\ ldrb r0, [r5]\n\ diff --git a/src/start_menu.c b/src/start_menu.c index a820cd992..36d249078 100644 --- a/src/start_menu.c +++ b/src/start_menu.c @@ -32,7 +32,7 @@ extern bool32 InUnionRoom(void); extern bool8 InBattlePike(void); extern bool8 InBattlePyramid(void); extern bool8 InMultiBattleRoom(void); -extern void sub_81973FC(u8 windowId, u8 a1); +extern void NewMenuHelpers_DrawStdWindowFrame(u8 windowId, u8 a1); extern void sub_8198070(u8 windowId, u8 a1); // this file's functions @@ -224,7 +224,7 @@ void DisplaySafariBallsWindow(void) { sSafariBallsWindowId = AddWindow(&gSafariBallsWindowTemplate); PutWindowTilemap(sSafariBallsWindowId); - sub_81973FC(sSafariBallsWindowId, 0); + NewMenuHelpers_DrawStdWindowFrame(sSafariBallsWindowId, 0); ConvertIntToDecimalStringN(gStringVar1, gNumSafariBalls, STR_CONV_MODE_RIGHT_ALIGN, 2); StringExpandPlaceholders(gStringVar4, gText_SafariBallStock); PrintTextOnWindow(sSafariBallsWindowId, 1, gStringVar4, 0, 1, 0xFF, NULL); @@ -239,7 +239,7 @@ void DisplayPyramidFloorWindow(void) else sBattlePyramidFloorWindowId = AddWindow(&gPyramidFloorWindowTemplate_2); PutWindowTilemap(sBattlePyramidFloorWindowId); - sub_81973FC(sBattlePyramidFloorWindowId, 0); + NewMenuHelpers_DrawStdWindowFrame(sBattlePyramidFloorWindowId, 0); StringCopy(gStringVar1, sPyramindFloorNames[gSaveBlock2Ptr->field_CAA[4]]); StringExpandPlaceholders(gStringVar4, gText_BattlePyramidFloor); PrintTextOnWindow(sBattlePyramidFloorWindowId, 1, gStringVar4, 0, 1, 0xFF, NULL); diff --git a/src/text.c b/src/text.c index 5db3ba308..50e39ab0c 100644 --- a/src/text.c +++ b/src/text.c @@ -159,7 +159,7 @@ u16 PrintTextOnWindow(u8 windowId, u8 fontId, const u8 *str, u8 x, u8 y, u8 spee subPrinter.letterSpacing = gFonts[fontId].letterSpacing; subPrinter.lineSpacing = gFonts[fontId].lineSpacing; subPrinter.fontColor_l = gFonts[fontId].fontColor_l; - subPrinter.fontColor_h = gFonts[fontId].fontColor_h; + subPrinter.fgColor = gFonts[fontId].fgColor; subPrinter.bgColor = gFonts[fontId].bgColor; subPrinter.shadowColor = gFonts[fontId].shadowColor; return AddTextPrinter(&subPrinter, speed, callback); @@ -189,7 +189,7 @@ bool16 AddTextPrinter(struct TextSubPrinter *textSubPrinter, u8 speed, void (*ca gTempTextPrinter.minLetterSpacing = 0; gTempTextPrinter.japanese = 0; - GenerateFontHalfRowLookupTable(textSubPrinter->fontColor_h, textSubPrinter->bgColor, textSubPrinter->shadowColor); + GenerateFontHalfRowLookupTable(textSubPrinter->fgColor, textSubPrinter->bgColor, textSubPrinter->shadowColor); if (speed != TEXT_SPEED_FF && speed != 0x0) { --gTempTextPrinter.text_speed; @@ -3218,7 +3218,7 @@ u8 GetFontAttribute(u8 fontId, u8 attributeId) result = gFontInfos[fontId].fontColor_l; break; case 5: - result = gFontInfos[fontId].fontColor_h; + result = gFontInfos[fontId].fgColor; break; case 6: result = gFontInfos[fontId].bgColor; diff --git a/src/unk_text_util_2.c b/src/unk_text_util_2.c index 8eaab32b6..ca8246128 100644 --- a/src/unk_text_util_2.c +++ b/src/unk_text_util_2.c @@ -57,24 +57,24 @@ u16 Font6Func(struct TextPrinter *textPrinter) switch (char_) { case 1: - textPrinter->subPrinter.fontColor_h = *textPrinter->subPrinter.current_text_offset ++; - GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); + textPrinter->subPrinter.fgColor = *textPrinter->subPrinter.current_text_offset ++; + GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); return 2; case 2: textPrinter->subPrinter.bgColor = *textPrinter->subPrinter.current_text_offset ++; - GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); + GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); return 2; case 3: textPrinter->subPrinter.shadowColor = *textPrinter->subPrinter.current_text_offset ++; - GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); + GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); return 2; case 4: - textPrinter->subPrinter.fontColor_h = *textPrinter->subPrinter.current_text_offset; + textPrinter->subPrinter.fgColor = *textPrinter->subPrinter.current_text_offset; textPrinter->subPrinter.bgColor = *++ textPrinter->subPrinter.current_text_offset; textPrinter->subPrinter.shadowColor = *++ textPrinter->subPrinter.current_text_offset; textPrinter->subPrinter.current_text_offset ++; - GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fontColor_h, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); + GenerateFontHalfRowLookupTable(textPrinter->subPrinter.fgColor, textPrinter->subPrinter.bgColor, textPrinter->subPrinter.shadowColor); return 2; case 5: textPrinter->subPrinter.current_text_offset ++;