From a6072ae293b0c0c3577b280274a2fd755033ab9f Mon Sep 17 00:00:00 2001 From: DizzyEggg Date: Tue, 16 Jan 2018 18:59:06 +0100 Subject: [PATCH] decompile option menu --- asm/battle_anim_80FE840.s | 2 +- asm/battle_frontier_1.s | 6 +- asm/battle_records.s | 2 +- asm/berry_tag_screen.s | 2 +- asm/cable_car.s | 2 +- asm/contest_painting.s | 2 +- asm/field_screen.s | 4 +- asm/intro.s | 2 +- asm/item_menu.s | 2 +- asm/link.s | 12 +- asm/main_menu.s | 12 +- asm/mon_markings.s | 2 +- asm/option_menu.s | 1684 ---------------------------------- asm/overworld.s | 2 +- asm/party_menu.s | 2 +- asm/pokedex.s | 2 +- asm/pokemon_summary_screen.s | 2 +- asm/pokenav.s | 4 +- asm/rayquaza_scene.s | 6 +- asm/reset_rtc_screen.s | 2 +- asm/roulette.s | 2 +- asm/shop.s | 2 +- asm/start_menu.s | 4 +- asm/title_screen.s | 2 +- asm/trainer_card.s | 12 +- asm/unknown_task.s | 6 +- include/option_menu.h | 6 + include/strings.h | 17 + include/text_window.h | 2 +- include/unknown_task.h | 2 +- ld_script.txt | 3 +- src/berry_fix_program.c | 2 +- src/diploma.c | 2 +- src/egg_hatch.c | 4 +- src/evolution_scene.c | 2 +- src/hall_of_fame.c | 2 +- src/mail.c | 2 +- src/main.c | 4 +- src/option_menu.c | 630 +++++++++++++ src/pokeblock.c | 2 +- src/pokemon_summary_screen.c | 4 +- src/starter_choose.c | 4 +- src/text_window.c | 8 +- src/wallclock.c | 2 +- sym_ewram.txt | 5 +- 45 files changed, 728 insertions(+), 1757 deletions(-) create mode 100644 include/option_menu.h create mode 100644 src/option_menu.c diff --git a/asm/battle_anim_80FE840.s b/asm/battle_anim_80FE840.s index e51dcedb7..d2f3c9dfa 100644 --- a/asm/battle_anim_80FE840.s +++ b/asm/battle_anim_80FE840.s @@ -18852,7 +18852,7 @@ _0810800C: negs r0, r0 cmp r1, r0 bne _08108022 - bl remove_some_task + bl ScanlineEffect_Stop adds r0, r7, 0 bl DestroyTask _08108022: diff --git a/asm/battle_frontier_1.s b/asm/battle_frontier_1.s index 8e82de6c6..c2517586e 100755 --- a/asm/battle_frontier_1.s +++ b/asm/battle_frontier_1.s @@ -9449,7 +9449,7 @@ _08193AA8: b _08193BC2 _08193ABA: bl FreeAllWindowBuffers - bl remove_some_task + bl ScanlineEffect_Stop ldr r4, =gUnknown_0203CD7C ldr r0, [r4] bl Free @@ -9494,7 +9494,7 @@ _08193B20: cmp r6, 0 bne _08193BC2 bl FreeAllWindowBuffers - bl remove_some_task + bl ScanlineEffect_Stop ldr r4, =gUnknown_0203CD7C ldr r0, [r4] bl Free @@ -9534,7 +9534,7 @@ _08193B84: cmp r6, 0 bne _08193BC2 bl FreeAllWindowBuffers - bl remove_some_task + bl ScanlineEffect_Stop ldr r4, =gUnknown_0203CD7C ldr r0, [r4] bl Free diff --git a/asm/battle_records.s b/asm/battle_records.s index c441adc74..bcf82dbb8 100644 --- a/asm/battle_records.s +++ b/asm/battle_records.s @@ -1034,7 +1034,7 @@ _0813C6FA: thumb_func_start sub_813C80C sub_813C80C: @ 813C80C push {lr} - bl remove_some_task + bl ScanlineEffect_Stop bl ResetTasks bl ResetSpriteData bl ResetPaletteFade diff --git a/asm/berry_tag_screen.s b/asm/berry_tag_screen.s index 75e50f88d..2a87fbf18 100644 --- a/asm/berry_tag_screen.s +++ b/asm/berry_tag_screen.s @@ -119,7 +119,7 @@ _08177D18: bl clear_scheduled_bg_copies_to_vram b _08177DDC _08177D26: - bl remove_some_task + bl ScanlineEffect_Stop b _08177DDC _08177D2C: bl ResetPaletteFade diff --git a/asm/cable_car.s b/asm/cable_car.s index 092e9a75e..6fd44dd9f 100644 --- a/asm/cable_car.s +++ b/asm/cable_car.s @@ -88,7 +88,7 @@ _0814FD20: bl SetVBlankCallback movs r0, 0 bl sub_8150B6C - bl remove_some_task + bl ScanlineEffect_Stop movs r3, 0xC0 lsls r3, 19 movs r4, 0xC0 diff --git a/asm/contest_painting.s b/asm/contest_painting.s index 4e58b4cc3..8bb38eeed 100644 --- a/asm/contest_painting.s +++ b/asm/contest_painting.s @@ -107,7 +107,7 @@ _0812FE80: .4byte _0812FF2A .4byte _0812FF54 _0812FE94: - bl remove_some_task + bl ScanlineEffect_Stop movs r0, 0 bl SetVBlankCallback bl AllocateMonSpritesGfx diff --git a/asm/field_screen.s b/asm/field_screen.s index c16068a15..7437811d3 100644 --- a/asm/field_screen.s +++ b/asm/field_screen.s @@ -9621,7 +9621,7 @@ _080AFE64: ldrsh r0, [r4, r3] cmp r0, 0x1 bne _080AFEB4 - bl remove_some_task + bl ScanlineEffect_Stop movs r0, 0x2 strh r0, [r4] b _080AFEC6 @@ -9714,7 +9714,7 @@ _080AFF28: ldrsh r0, [r4, r3] cmp r0, 0x1 bne _080AFF78 - bl remove_some_task + bl ScanlineEffect_Stop movs r0, 0x2 strh r0, [r4] b _080AFF8A diff --git a/asm/intro.s b/asm/intro.s index d9f6e558f..efc36e7d9 100644 --- a/asm/intro.s +++ b/asm/intro.s @@ -184,7 +184,7 @@ _0816CCF4: movs r0, 0 movs r2, 0 bl load_copyright_graphics - bl remove_some_task + bl ScanlineEffect_Stop bl ResetTasks bl ResetSpriteData bl FreeAllSpritePalettes diff --git a/asm/item_menu.s b/asm/item_menu.s index db3d38668..1d79852fe 100755 --- a/asm/item_menu.s +++ b/asm/item_menu.s @@ -343,7 +343,7 @@ _081AAE34: bl clear_scheduled_bg_copies_to_vram b _081AB012 _081AAE3E: - bl remove_some_task + bl ScanlineEffect_Stop ldr r1, =gMain movs r2, 0x87 lsls r2, 3 diff --git a/asm/link.s b/asm/link.s index 05dda2cb7..bb1904ae1 100644 --- a/asm/link.s +++ b/asm/link.s @@ -3360,7 +3360,7 @@ c2_800ACD4: @ 800AF30 movs r2, 0x2 bl FillPalette bl ResetTasks - bl remove_some_task + bl ScanlineEffect_Stop ldr r1, =gLinkVSyncDisabled ldrb r0, [r1] cmp r0, 0 @@ -28637,7 +28637,7 @@ _08018482: bl ResetSpriteData bl FreeAllSpritePalettes bl ResetTasks - bl remove_some_task + bl ScanlineEffect_Stop movs r0, 0 bl ResetBgsAndClearDma3BusyFlags ldr r1, =gUnknown_082F0598 @@ -32620,7 +32620,7 @@ sub_801A43C: @ 801A43C bl ResetPaletteFade bl ResetSpriteData bl ResetTasks - bl remove_some_task + bl ScanlineEffect_Stop bl m4aSoundVSyncOn ldr r0, =sub_801A418 bl SetVBlankCallback @@ -45999,7 +45999,7 @@ _080210A0: movs r0, 0 movs r1, 0 bl SetGpuReg - bl remove_some_task + bl ScanlineEffect_Stop bl reset_temp_tile_data_buffers b _080212FC _080210BE: @@ -61951,7 +61951,7 @@ sub_8028FF8: @ 8028FF8 lsls r4, 24 lsrs r4, 24 adds r0, r4, 0 - bl sub_8098758 + bl GetWindowFrameTilesPal ldr r1, [r0] movs r2, 0x90 lsls r2, 1 @@ -61959,7 +61959,7 @@ sub_8028FF8: @ 8028FF8 movs r3, 0x1 bl LoadBgTiles adds r0, r4, 0 - bl sub_8098758 + bl GetWindowFrameTilesPal ldr r0, [r0, 0x4] movs r1, 0xA0 movs r2, 0x20 diff --git a/asm/main_menu.s b/asm/main_menu.s index 52afc783e..ef2f5a9a1 100644 --- a/asm/main_menu.s +++ b/asm/main_menu.s @@ -127,7 +127,7 @@ InitMainMenu: @ 802F6F4 movs r1, 0xF0 movs r2, 0x20 bl LoadPalette - bl remove_some_task + bl ScanlineEffect_Stop bl ResetTasks bl ResetSpriteData bl FreeAllSpritePalettes @@ -1487,7 +1487,7 @@ _08030460: ldr r0, =gMain ldr r1, =CB2_ReinitMainMenu str r1, [r0, 0x8] - ldr r0, =CB2_OptionsMenu + ldr r0, =CB2_InitOptionMenu b _0803048A .pool _08030478: @@ -1929,7 +1929,7 @@ task_new_game_prof_birch_speech_1: @ 80307B0 movs r1, 0x1 movs r2, 0x10 bl LoadPalette - bl remove_some_task + bl ScanlineEffect_Stop bl ResetSpriteData bl FreeAllSpritePalettes bl dp13_810BB8C @@ -3708,7 +3708,7 @@ new_game_prof_birch_speech_part2_start: @ 8031678 strh r0, [r4, 0x16] ldr r0, =0x0000ffc4 strh r0, [r4, 0x10] - bl remove_some_task + bl ScanlineEffect_Stop bl ResetSpriteData bl FreeAllSpritePalettes bl dp13_810BB8C @@ -4783,7 +4783,7 @@ LoadMainMenuWindowFrameTiles: @ 80320A4 ldr r0, [r6] ldrb r0, [r0, 0x14] lsrs r0, 3 - bl sub_8098758 + bl GetWindowFrameTilesPal ldr r1, [r0] movs r2, 0x90 lsls r2, 1 @@ -4793,7 +4793,7 @@ LoadMainMenuWindowFrameTiles: @ 80320A4 ldr r0, [r6] ldrb r0, [r0, 0x14] lsrs r0, 3 - bl sub_8098758 + bl GetWindowFrameTilesPal ldr r0, [r0, 0x4] movs r1, 0x20 movs r2, 0x20 diff --git a/asm/mon_markings.s b/asm/mon_markings.s index 1624fddca..dfc375fdf 100644 --- a/asm/mon_markings.s +++ b/asm/mon_markings.s @@ -21,7 +21,7 @@ sub_811F918: @ 811F918 ldr r0, [r0] ldrb r0, [r0, 0x14] lsrs r0, 3 - bl sub_8098758 + bl GetWindowFrameTilesPal ldr r3, =gUnknown_0203A124 ldr r2, [r3] ldr r1, [r0] diff --git a/asm/option_menu.s b/asm/option_menu.s index 1c554e26f..c3fc4d140 100644 --- a/asm/option_menu.s +++ b/asm/option_menu.s @@ -5,1690 +5,6 @@ .text - thumb_func_start sub_80BA4B0 -sub_80BA4B0: @ 80BA4B0 - push {lr} - bl RunTasks - bl AnimateSprites - bl BuildOamBuffer - bl UpdatePaletteFade - pop {r0} - bx r0 - thumb_func_end sub_80BA4B0 - thumb_func_start sub_80BA4C8 -sub_80BA4C8: @ 80BA4C8 - push {lr} - bl LoadOam - bl ProcessSpriteCopyRequests - bl TransferPlttBuffer - pop {r0} - bx r0 - thumb_func_end sub_80BA4C8 - - thumb_func_start CB2_OptionsMenu -CB2_OptionsMenu: @ 80BA4DC - push {r4-r7,lr} - mov r7, r8 - push {r7} - sub sp, 0xC - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r0, r1, r2 - ldrb r0, [r0] - adds r2, r1, 0 - cmp r0, 0xB - bhi _080BA538 - lsls r0, 2 - ldr r1, =_080BA508 - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080BA508: - .4byte _080BA538 - .4byte _080BA54C - .4byte _080BA69C - .4byte _080BA6BC - .4byte _080BA6E0 - .4byte _080BA718 - .4byte _080BA728 - .4byte _080BA740 - .4byte _080BA748 - .4byte _080BA760 - .4byte _080BA774 - .4byte _080BA80C -_080BA538: - movs r0, 0 - bl SetVBlankCallback - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _080BA7F4 - .pool -_080BA54C: - movs r3, 0xC0 - lsls r3, 19 - movs r4, 0xC0 - lsls r4, 9 - add r1, sp, 0x8 - mov r8, r1 - add r2, sp, 0x4 - movs r6, 0 - ldr r1, =0x040000d4 - movs r5, 0x80 - lsls r5, 5 - ldr r7, =0x81000800 - movs r0, 0x81 - lsls r0, 24 - mov r12, r0 -_080BA56A: - strh r6, [r2] - add r0, sp, 0x4 - str r0, [r1] - str r3, [r1, 0x4] - str r7, [r1, 0x8] - ldr r0, [r1, 0x8] - adds r3, r5 - subs r4, r5 - cmp r4, r5 - bhi _080BA56A - strh r6, [r2] - add r2, sp, 0x4 - str r2, [r1] - str r3, [r1, 0x4] - lsrs r0, r4, 1 - mov r2, r12 - orrs r0, r2 - str r0, [r1, 0x8] - ldr r0, [r1, 0x8] - movs r0, 0xE0 - lsls r0, 19 - movs r3, 0x80 - lsls r3, 3 - movs r4, 0 - str r4, [sp, 0x8] - ldr r2, =0x040000d4 - mov r1, r8 - str r1, [r2] - str r0, [r2, 0x4] - lsrs r0, r3, 2 - movs r1, 0x85 - lsls r1, 24 - orrs r0, r1 - str r0, [r2, 0x8] - ldr r0, [r2, 0x8] - movs r1, 0xA0 - lsls r1, 19 - add r0, sp, 0x4 - strh r4, [r0] - str r0, [r2] - str r1, [r2, 0x4] - lsrs r3, 1 - movs r0, 0x81 - lsls r0, 24 - orrs r3, r0 - str r3, [r2, 0x8] - ldr r0, [r2, 0x8] - movs r0, 0 - movs r1, 0 - bl SetGpuReg - movs r0, 0 - bl ResetBgsAndClearDma3BusyFlags - ldr r1, =gUnknown_0855C698 - movs r0, 0 - movs r2, 0x2 - bl InitBgsFromTemplates - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x1 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x2 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgX - movs r0, 0x3 - movs r1, 0 - movs r2, 0 - bl ChangeBgY - ldr r0, =gUnknown_0855C680 - bl InitWindows - bl DeactivateAllTextPrinters - movs r0, 0x40 - movs r1, 0 - bl SetGpuReg - movs r0, 0x44 - movs r1, 0 - bl SetGpuReg - movs r0, 0x48 - movs r1, 0x1 - bl SetGpuReg - movs r0, 0x4A - movs r1, 0x23 - bl SetGpuReg - movs r0, 0x50 - movs r1, 0xC1 - bl SetGpuReg - movs r0, 0x52 - movs r1, 0 - bl SetGpuReg - movs r0, 0x54 - movs r1, 0x4 - bl SetGpuReg - movs r1, 0xC1 - lsls r1, 6 - movs r0, 0 - bl SetGpuReg - movs r0, 0 - bl ShowBg - movs r0, 0x1 - bl ShowBg - b _080BA7EC - .pool -_080BA69C: - bl ResetPaletteFade - bl remove_some_task - bl ResetTasks - bl ResetSpriteData - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _080BA7F4 - .pool -_080BA6BC: - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x14] - lsrs r0, 3 - bl sub_8098758 - ldr r1, [r0] - movs r2, 0x90 - lsls r2, 1 - movs r3, 0xD1 - lsls r3, 1 - movs r0, 0x1 - bl LoadBgTiles - b _080BA7EC - .pool -_080BA6E0: - ldr r0, =gUnknown_0855C6A0 - movs r1, 0 - movs r2, 0x2 - bl LoadPalette - ldr r0, =gSaveBlock2Ptr - ldr r0, [r0] - ldrb r0, [r0, 0x14] - lsrs r0, 3 - bl sub_8098758 - ldr r0, [r0, 0x4] - movs r1, 0x70 - movs r2, 0x20 - bl LoadPalette - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _080BA7F4 - .pool -_080BA718: - ldr r0, =gUnknown_0855C604 - movs r1, 0x10 - movs r2, 0x20 - bl LoadPalette - b _080BA7EC - .pool -_080BA728: - movs r0, 0 - bl PutWindowTilemap - bl sub_80BB0D0 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _080BA7F4 - .pool -_080BA740: - movs r0, 0x87 - lsls r0, 3 - adds r1, r2, r0 - b _080BA7F4 -_080BA748: - movs r0, 0x1 - bl PutWindowTilemap - bl sub_80BB104 - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] -_080BA760: - bl sub_80BB154 - ldr r1, =gMain - movs r0, 0x87 - lsls r0, 3 - adds r1, r0 - b _080BA7F4 - .pool -_080BA774: - ldr r0, =sub_80BA83C - movs r1, 0 - bl CreateTask - lsls r0, 24 - lsrs r0, 24 - ldr r1, =gTasks - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - adds r4, r1 - movs r0, 0 - strh r0, [r4, 0x8] - ldr r0, =gSaveBlock2Ptr - ldr r2, [r0] - ldrb r0, [r2, 0x14] - lsls r0, 29 - lsrs r0, 29 - strh r0, [r4, 0xA] - ldrb r1, [r2, 0x15] - lsls r1, 29 - lsrs r1, 31 - strh r1, [r4, 0xC] - ldrb r1, [r2, 0x15] - lsls r1, 30 - lsrs r1, 31 - strh r1, [r4, 0xE] - ldrb r1, [r2, 0x15] - lsls r1, 31 - lsrs r1, 31 - strh r1, [r4, 0x10] - ldrb r1, [r2, 0x13] - strh r1, [r4, 0x12] - ldrb r1, [r2, 0x14] - lsrs r1, 3 - strh r1, [r4, 0x14] - bl sub_80BAC38 - ldrb r0, [r4, 0xC] - bl sub_80BAD08 - ldrb r0, [r4, 0xE] - bl sub_80BAD84 - ldrb r0, [r4, 0x10] - bl sub_80BAE08 - ldrb r0, [r4, 0x12] - bl sub_80BB028 - ldrb r0, [r4, 0x14] - bl sub_80BAF0C - ldrb r0, [r4, 0x8] - bl sub_80BAB38 - movs r0, 0x1 - movs r1, 0x3 - bl CopyWindowToVram -_080BA7EC: - ldr r1, =gMain - movs r2, 0x87 - lsls r2, 3 - adds r1, r2 -_080BA7F4: - ldrb r0, [r1] - adds r0, 0x1 - strb r0, [r1] - b _080BA828 - .pool -_080BA80C: - movs r0, 0x1 - negs r0, r0 - movs r1, 0 - str r1, [sp] - movs r2, 0x10 - movs r3, 0 - bl BeginNormalPaletteFade - ldr r0, =sub_80BA4C8 - bl SetVBlankCallback - ldr r0, =sub_80BA4B0 - bl SetMainCallback2 -_080BA828: - add sp, 0xC - pop {r3} - mov r8, r3 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end CB2_OptionsMenu - - thumb_func_start sub_80BA83C -sub_80BA83C: @ 80BA83C - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _080BA85C - ldr r0, =gTasks - lsls r1, r2, 2 - adds r1, r2 - lsls r1, 3 - adds r1, r0 - ldr r0, =sub_80BA86C - str r0, [r1] -_080BA85C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80BA83C - - thumb_func_start sub_80BA86C -sub_80BA86C: @ 80BA86C - push {r4-r7,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x1 - ands r0, r1 - cmp r0, 0 - beq _080BA89C - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 - movs r2, 0x8 - ldrsh r0, [r1, r2] - cmp r0, 0x6 - beq _080BA892 - b _080BAA5A -_080BA892: - b _080BA8AE - .pool -_080BA89C: - movs r0, 0x2 - ands r0, r1 - cmp r0, 0 - beq _080BA8BC - ldr r0, =gTasks - lsls r1, r4, 2 - adds r1, r4 - lsls r1, 3 - adds r1, r0 -_080BA8AE: - ldr r0, =sub_80BAA64 - str r0, [r1] - b _080BAA5A - .pool -_080BA8BC: - movs r0, 0x40 - ands r0, r1 - lsls r0, 16 - lsrs r6, r0, 16 - cmp r6, 0 - beq _080BA8EC - ldr r1, =gTasks - lsls r2, r4, 2 - adds r0, r2, r4 - lsls r0, 3 - adds r3, r0, r1 - ldrh r5, [r3, 0x8] - movs r6, 0x8 - ldrsh r0, [r3, r6] - adds r7, r1, 0 - cmp r0, 0 - ble _080BA8E8 - subs r0, r5, 0x1 - b _080BA90C - .pool -_080BA8E8: - movs r0, 0x6 - b _080BA90C -_080BA8EC: - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - beq _080BA924 - ldr r1, =gTasks - lsls r2, r4, 2 - adds r0, r2, r4 - lsls r0, 3 - adds r3, r0, r1 - ldrh r5, [r3, 0x8] - movs r7, 0x8 - ldrsh r0, [r3, r7] - adds r7, r1, 0 - cmp r0, 0x5 - bgt _080BA914 - adds r0, r5, 0x1 -_080BA90C: - strh r0, [r3, 0x8] - b _080BA916 - .pool -_080BA914: - strh r6, [r3, 0x8] -_080BA916: - adds r0, r2, r4 - lsls r0, 3 - adds r0, r7 - ldrb r0, [r0, 0x8] - bl sub_80BAB38 - b _080BAA5A -_080BA924: - ldr r0, =gTasks - lsls r2, r4, 2 - adds r1, r2, r4 - lsls r1, 3 - adds r1, r0 - movs r3, 0x8 - ldrsh r1, [r1, r3] - adds r7, r0, 0 - cmp r1, 0x5 - bls _080BA93A - b _080BAA5A -_080BA93A: - lsls r0, r1, 2 - ldr r1, =_080BA94C - adds r0, r1 - ldr r0, [r0] - mov pc, r0 - .pool - .align 2, 0 -_080BA94C: - .4byte _080BA964 - .4byte _080BA98A - .4byte _080BA9B0 - .4byte _080BA9D6 - .4byte _080BA9FC - .4byte _080BAA22 -_080BA964: - adds r4, r2, r4 - lsls r4, 3 - adds r4, r7 - ldrb r5, [r4, 0xA] - adds r0, r5, 0 - bl sub_80BABDC - lsls r0, 24 - lsrs r0, 24 - adds r1, r0, 0 - strh r0, [r4, 0xA] - movs r6, 0xA - ldrsh r0, [r4, r6] - cmp r5, r0 - beq _080BAA46 - adds r0, r1, 0 - bl sub_80BAC38 - b _080BAA46 -_080BA98A: - adds r4, r2, r4 - lsls r4, 3 - adds r4, r7 - ldrb r5, [r4, 0xC] - adds r0, r5, 0 - bl sub_80BACE0 - lsls r0, 24 - lsrs r0, 24 - adds r1, r0, 0 - strh r0, [r4, 0xC] - movs r7, 0xC - ldrsh r0, [r4, r7] - cmp r5, r0 - beq _080BAA46 - adds r0, r1, 0 - bl sub_80BAD08 - b _080BAA46 -_080BA9B0: - adds r4, r2, r4 - lsls r4, 3 - adds r4, r7 - ldrb r5, [r4, 0xE] - adds r0, r5, 0 - bl sub_80BAD5C - lsls r0, 24 - lsrs r0, 24 - adds r1, r0, 0 - strh r0, [r4, 0xE] - movs r2, 0xE - ldrsh r0, [r4, r2] - cmp r5, r0 - beq _080BAA46 - adds r0, r1, 0 - bl sub_80BAD84 - b _080BAA46 -_080BA9D6: - adds r4, r2, r4 - lsls r4, 3 - adds r4, r7 - ldrb r5, [r4, 0x10] - adds r0, r5, 0 - bl sub_80BADD8 - lsls r0, 24 - lsrs r0, 24 - adds r1, r0, 0 - strh r0, [r4, 0x10] - movs r3, 0x10 - ldrsh r0, [r4, r3] - cmp r5, r0 - beq _080BAA46 - adds r0, r1, 0 - bl sub_80BAE08 - b _080BAA46 -_080BA9FC: - adds r4, r2, r4 - lsls r4, 3 - adds r4, r7 - ldrb r5, [r4, 0x12] - adds r0, r5, 0 - bl sub_80BAFCC - lsls r0, 24 - lsrs r0, 24 - adds r1, r0, 0 - strh r0, [r4, 0x12] - movs r6, 0x12 - ldrsh r0, [r4, r6] - cmp r5, r0 - beq _080BAA46 - adds r0, r1, 0 - bl sub_80BB028 - b _080BAA46 -_080BAA22: - adds r4, r2, r4 - lsls r4, 3 - adds r4, r7 - ldrb r5, [r4, 0x14] - adds r0, r5, 0 - bl sub_80BAE5C - lsls r0, 24 - lsrs r0, 24 - adds r1, r0, 0 - strh r0, [r4, 0x14] - movs r7, 0x14 - ldrsh r0, [r4, r7] - cmp r5, r0 - beq _080BAA46 - adds r0, r1, 0 - bl sub_80BAF0C -_080BAA46: - ldr r1, =gUnknown_02039B48 - ldrb r0, [r1] - cmp r0, 0 - beq _080BAA5A - movs r0, 0 - strb r0, [r1] - movs r0, 0x1 - movs r1, 0x2 - bl CopyWindowToVram -_080BAA5A: - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80BA86C - - thumb_func_start sub_80BAA64 -sub_80BAA64: @ 80BAA64 - push {r4-r6,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - ldr r6, =gSaveBlock2Ptr - ldr r3, [r6] - ldr r1, =gTasks - lsls r4, r0, 2 - adds r4, r0 - lsls r4, 3 - adds r4, r1 - movs r0, 0x7 - ldrb r1, [r4, 0xA] - ands r1, r0 - ldrb r2, [r3, 0x14] - movs r0, 0x8 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x14] - ldr r3, [r6] - movs r5, 0x1 - ldrb r1, [r4, 0xC] - ands r1, r5 - lsls r1, 2 - ldrb r2, [r3, 0x15] - movs r0, 0x5 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x15] - ldr r3, [r6] - ldrb r1, [r4, 0xE] - ands r1, r5 - lsls r1, 1 - ldrb r2, [r3, 0x15] - movs r0, 0x3 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x15] - ldr r3, [r6] - ldrb r1, [r4, 0x10] - ands r1, r5 - ldrb r2, [r3, 0x15] - movs r0, 0x2 - negs r0, r0 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x15] - ldr r1, [r6] - ldrh r0, [r4, 0x12] - movs r5, 0 - strb r0, [r1, 0x13] - ldr r3, [r6] - ldrb r1, [r4, 0x14] - lsls r1, 3 - ldrb r2, [r3, 0x14] - movs r0, 0x7 - ands r0, r2 - orrs r0, r1 - strb r0, [r3, 0x14] - movs r0, 0x1 - negs r0, r0 - str r5, [sp] - movs r1, 0 - movs r2, 0 - movs r3, 0x10 - bl BeginNormalPaletteFade - ldr r0, =sub_80BAB08 - str r0, [r4] - add sp, 0x4 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80BAA64 - - thumb_func_start sub_80BAB08 -sub_80BAB08: @ 80BAB08 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gPaletteFade - ldrb r1, [r0, 0x7] - movs r0, 0x80 - ands r0, r1 - cmp r0, 0 - bne _080BAB2C - adds r0, r2, 0 - bl DestroyTask - bl FreeAllWindowBuffers - ldr r0, =gMain - ldr r0, [r0, 0x8] - bl SetMainCallback2 -_080BAB2C: - pop {r0} - bx r0 - .pool - thumb_func_end sub_80BAB08 - - thumb_func_start sub_80BAB38 -sub_80BAB38: @ 80BAB38 - push {r4,lr} - adds r4, r0, 0 - lsls r4, 24 - lsrs r4, 24 - movs r1, 0x87 - lsls r1, 5 - movs r0, 0x40 - bl SetGpuReg - lsls r4, 4 - adds r1, r4, 0 - adds r1, 0x28 - lsls r1, 8 - adds r4, 0x38 - orrs r1, r4 - lsls r1, 16 - lsrs r1, 16 - movs r0, 0x44 - bl SetGpuReg - pop {r4} - pop {r0} - bx r0 - thumb_func_end sub_80BAB38 - - thumb_func_start sub_80BAB68 -sub_80BAB68: @ 80BAB68 - push {r4-r6,lr} - sub sp, 0x1C - adds r4, r0, 0 - lsls r1, 24 - lsrs r6, r1, 24 - lsls r2, 24 - lsrs r5, r2, 24 - lsls r3, 24 - lsrs r3, 24 - movs r2, 0 - ldrb r1, [r4] - adds r0, r1, 0 - cmp r0, 0xFF - beq _080BABA0 -_080BAB84: - mov r0, sp - adds r0, r2 - adds r0, 0xC - strb r1, [r0] - adds r4, 0x1 - adds r0, r2, 0x1 - lsls r0, 16 - lsrs r2, r0, 16 - ldrb r1, [r4] - adds r0, r1, 0 - cmp r0, 0xFF - beq _080BABA0 - cmp r2, 0xE - bls _080BAB84 -_080BABA0: - cmp r3, 0 - beq _080BABAE - add r1, sp, 0xC - movs r0, 0x4 - strb r0, [r1, 0x2] - movs r0, 0x5 - strb r0, [r1, 0x5] -_080BABAE: - mov r1, sp - adds r1, r2 - adds r1, 0xC - movs r0, 0xFF - strb r0, [r1] - adds r0, r5, 0x1 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - add r2, sp, 0xC - adds r3, r6, 0 - bl PrintTextOnWindow - add sp, 0x1C - pop {r4-r6} - pop {r0} - bx r0 - thumb_func_end sub_80BAB68 - - thumb_func_start sub_80BABDC -sub_80BABDC: @ 80BABDC - push {lr} - lsls r0, 24 - lsrs r3, r0, 24 - ldr r2, =gMain - ldrh r1, [r2, 0x2E] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080BAC08 - cmp r3, 0x1 - bhi _080BAC00 - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - b _080BAC02 - .pool -_080BAC00: - movs r3, 0 -_080BAC02: - ldr r1, =gUnknown_02039B48 - movs r0, 0x1 - strb r0, [r1] -_080BAC08: - ldrh r1, [r2, 0x2E] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080BAC2C - cmp r3, 0 - beq _080BAC24 - subs r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - b _080BAC26 - .pool -_080BAC24: - movs r3, 0x2 -_080BAC26: - ldr r1, =gUnknown_02039B48 - movs r0, 0x1 - strb r0, [r1] -_080BAC2C: - adds r0, r3, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80BABDC - - thumb_func_start sub_80BAC38 -sub_80BAC38: @ 80BAC38 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - mov r1, sp - movs r2, 0 - strb r2, [r1] - strb r2, [r1, 0x1] - strb r2, [r1, 0x2] - adds r1, r0 - movs r0, 0x1 - strb r0, [r1] - ldr r4, =gText_TextSpeedSlow - mov r0, sp - ldrb r3, [r0] - adds r0, r4, 0 - movs r1, 0x68 - bl sub_80BAB68 - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0 - bl GetStringWidth - adds r4, r0, 0 - ldr r0, =gText_TextSpeedMid - mov r8, r0 - movs r0, 0x1 - mov r1, r8 - movs r2, 0 - bl GetStringWidth - adds r5, r0, 0 - ldr r6, =gText_TextSpeedFast - movs r0, 0x1 - adds r1, r6, 0 - movs r2, 0 - bl GetStringWidth - subs r5, 0x5E - subs r4, r5 - subs r4, r0 - lsrs r0, r4, 31 - adds r4, r0 - asrs r4, 1 - adds r4, 0x68 - lsls r4, 24 - lsrs r4, 24 - mov r0, sp - ldrb r3, [r0, 0x1] - mov r0, r8 - adds r1, r4, 0 - movs r2, 0 - bl sub_80BAB68 - movs r0, 0x1 - adds r1, r6, 0 - movs r2, 0xC6 - bl GetStringRightAlignXOffset - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, sp - ldrb r3, [r0, 0x2] - adds r0, r6, 0 - movs r2, 0 - bl sub_80BAB68 - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80BAC38 - - thumb_func_start sub_80BACE0 -sub_80BACE0: @ 80BACE0 - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x30 - ands r0, r1 - cmp r0, 0 - beq _080BACFA - movs r1, 0x1 - eors r2, r1 - ldr r0, =gUnknown_02039B48 - strb r1, [r0] -_080BACFA: - adds r0, r2, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80BACE0 - - thumb_func_start sub_80BAD08 -sub_80BAD08: @ 80BAD08 - push {r4,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - mov r1, sp - movs r2, 0 - strb r2, [r1] - strb r2, [r1, 0x1] - adds r1, r0 - movs r0, 0x1 - strb r0, [r1] - ldr r0, =gText_BattleSceneOn - mov r1, sp - ldrb r3, [r1] - movs r1, 0x68 - movs r2, 0x10 - bl sub_80BAB68 - ldr r4, =gText_BattleSceneOff - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0xC6 - bl GetStringRightAlignXOffset - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, sp - ldrb r3, [r0, 0x1] - adds r0, r4, 0 - movs r2, 0x10 - bl sub_80BAB68 - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80BAD08 - - thumb_func_start sub_80BAD5C -sub_80BAD5C: @ 80BAD5C - push {lr} - lsls r0, 24 - lsrs r2, r0, 24 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x30 - ands r0, r1 - cmp r0, 0 - beq _080BAD76 - movs r1, 0x1 - eors r2, r1 - ldr r0, =gUnknown_02039B48 - strb r1, [r0] -_080BAD76: - adds r0, r2, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80BAD5C - - thumb_func_start sub_80BAD84 -sub_80BAD84: @ 80BAD84 - push {r4,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - mov r1, sp - movs r2, 0 - strb r2, [r1] - strb r2, [r1, 0x1] - adds r1, r0 - movs r0, 0x1 - strb r0, [r1] - ldr r0, =gText_BattleStyleShift - mov r1, sp - ldrb r3, [r1] - movs r1, 0x68 - movs r2, 0x20 - bl sub_80BAB68 - ldr r4, =gText_BattleStyleSet - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0xC6 - bl GetStringRightAlignXOffset - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, sp - ldrb r3, [r0, 0x1] - adds r0, r4, 0 - movs r2, 0x20 - bl sub_80BAB68 - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80BAD84 - - thumb_func_start sub_80BADD8 -sub_80BADD8: @ 80BADD8 - push {r4,r5,lr} - lsls r0, 24 - lsrs r5, r0, 24 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x30 - ands r0, r1 - cmp r0, 0 - beq _080BADF8 - movs r4, 0x1 - eors r5, r4 - adds r0, r5, 0 - bl SetPokemonCryStereo - ldr r0, =gUnknown_02039B48 - strb r4, [r0] -_080BADF8: - adds r0, r5, 0 - pop {r4,r5} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80BADD8 - - thumb_func_start sub_80BAE08 -sub_80BAE08: @ 80BAE08 - push {r4,lr} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - mov r1, sp - movs r2, 0 - strb r2, [r1] - strb r2, [r1, 0x1] - adds r1, r0 - movs r0, 0x1 - strb r0, [r1] - ldr r0, =gText_SoundMono - mov r1, sp - ldrb r3, [r1] - movs r1, 0x68 - movs r2, 0x30 - bl sub_80BAB68 - ldr r4, =gText_SoundStereo - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0xC6 - bl GetStringRightAlignXOffset - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, sp - ldrb r3, [r0, 0x1] - adds r0, r4, 0 - movs r2, 0x30 - bl sub_80BAB68 - add sp, 0x4 - pop {r4} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80BAE08 - - thumb_func_start sub_80BAE5C -sub_80BAE5C: @ 80BAE5C - push {r4,lr} - lsls r0, 24 - lsrs r4, r0, 24 - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080BAEAE - cmp r4, 0x12 - bhi _080BAE80 - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - b _080BAE82 - .pool -_080BAE80: - movs r4, 0 -_080BAE82: - adds r0, r4, 0 - bl sub_8098758 - ldr r1, [r0] - movs r2, 0x90 - lsls r2, 1 - movs r3, 0xD1 - lsls r3, 1 - movs r0, 0x1 - bl LoadBgTiles - adds r0, r4, 0 - bl sub_8098758 - ldr r0, [r0, 0x4] - movs r1, 0x70 - movs r2, 0x20 - bl LoadPalette - ldr r1, =gUnknown_02039B48 - movs r0, 0x1 - strb r0, [r1] -_080BAEAE: - ldr r0, =gMain - ldrh r1, [r0, 0x2E] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080BAEFE - cmp r4, 0 - beq _080BAED0 - subs r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - b _080BAED2 - .pool -_080BAED0: - movs r4, 0x13 -_080BAED2: - adds r0, r4, 0 - bl sub_8098758 - ldr r1, [r0] - movs r2, 0x90 - lsls r2, 1 - movs r3, 0xD1 - lsls r3, 1 - movs r0, 0x1 - bl LoadBgTiles - adds r0, r4, 0 - bl sub_8098758 - ldr r0, [r0, 0x4] - movs r1, 0x70 - movs r2, 0x20 - bl LoadPalette - ldr r1, =gUnknown_02039B48 - movs r0, 0x1 - strb r0, [r1] -_080BAEFE: - adds r0, r4, 0 - pop {r4} - pop {r1} - bx r1 - .pool - thumb_func_end sub_80BAE5C - - thumb_func_start sub_80BAF0C -sub_80BAF0C: @ 80BAF0C - push {r4-r7,lr} - sub sp, 0x10 - lsls r0, 24 - movs r1, 0x80 - lsls r1, 17 - adds r0, r1 - lsrs r6, r0, 24 - movs r5, 0 - ldr r1, =gText_FrameTypeNumber - ldrb r0, [r1] - ldr r7, =gText_FrameType - cmp r0, 0xFF - beq _080BAF44 - adds r2, r1, 0 -_080BAF28: - mov r0, sp - adds r1, r0, r5 - adds r0, r5, r2 - ldrb r0, [r0] - strb r0, [r1] - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - adds r0, r5, r2 - ldrb r0, [r0] - cmp r0, 0xFF - beq _080BAF44 - cmp r5, 0x5 - bls _080BAF28 -_080BAF44: - adds r0, r6, 0 - movs r1, 0xA - bl __udivsi3 - adds r2, r0, 0 - lsls r0, r2, 24 - cmp r0, 0 - beq _080BAF80 - mov r0, sp - adds r1, r0, r5 - adds r0, r2, 0 - adds r0, 0xA1 - strb r0, [r1] - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - mov r1, sp - adds r4, r1, r5 - adds r0, r6, 0 - movs r1, 0xA - bl __umodsi3 - adds r0, 0xA1 - strb r0, [r4] - b _080BAF9E - .pool -_080BAF80: - mov r0, sp - adds r4, r0, r5 - adds r0, r6, 0 - movs r1, 0xA - bl __umodsi3 - adds r0, 0xA1 - strb r0, [r4] - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - mov r0, sp - adds r1, r0, r5 - movs r0, 0x77 - strb r0, [r1] -_080BAF9E: - adds r0, r5, 0x1 - lsls r0, 16 - lsrs r5, r0, 16 - mov r0, sp - adds r1, r0, r5 - movs r0, 0xFF - strb r0, [r1] - adds r0, r7, 0 - movs r1, 0x68 - movs r2, 0x50 - movs r3, 0 - bl sub_80BAB68 - mov r0, sp - movs r1, 0x80 - movs r2, 0x50 - movs r3, 0x1 - bl sub_80BAB68 - add sp, 0x10 - pop {r4-r7} - pop {r0} - bx r0 - thumb_func_end sub_80BAF0C - - thumb_func_start sub_80BAFCC -sub_80BAFCC: @ 80BAFCC - push {lr} - lsls r0, 24 - lsrs r3, r0, 24 - ldr r2, =gMain - ldrh r1, [r2, 0x2E] - movs r0, 0x10 - ands r0, r1 - cmp r0, 0 - beq _080BAFF8 - cmp r3, 0x1 - bhi _080BAFF0 - adds r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - b _080BAFF2 - .pool -_080BAFF0: - movs r3, 0 -_080BAFF2: - ldr r1, =gUnknown_02039B48 - movs r0, 0x1 - strb r0, [r1] -_080BAFF8: - ldrh r1, [r2, 0x2E] - movs r0, 0x20 - ands r0, r1 - cmp r0, 0 - beq _080BB01C - cmp r3, 0 - beq _080BB014 - subs r0, r3, 0x1 - lsls r0, 24 - lsrs r3, r0, 24 - b _080BB016 - .pool -_080BB014: - movs r3, 0x2 -_080BB016: - ldr r1, =gUnknown_02039B48 - movs r0, 0x1 - strb r0, [r1] -_080BB01C: - adds r0, r3, 0 - pop {r1} - bx r1 - .pool - thumb_func_end sub_80BAFCC - - thumb_func_start sub_80BB028 -sub_80BB028: @ 80BB028 - push {r4-r6,lr} - mov r6, r8 - push {r6} - sub sp, 0x4 - lsls r0, 24 - lsrs r0, 24 - mov r1, sp - movs r2, 0 - strb r2, [r1] - strb r2, [r1, 0x1] - strb r2, [r1, 0x2] - adds r1, r0 - movs r0, 0x1 - strb r0, [r1] - ldr r4, =gText_ButtonTypeNormal - mov r0, sp - ldrb r3, [r0] - adds r0, r4, 0 - movs r1, 0x68 - movs r2, 0x40 - bl sub_80BAB68 - movs r0, 0x1 - adds r1, r4, 0 - movs r2, 0 - bl GetStringWidth - adds r4, r0, 0 - ldr r0, =gText_ButtonTypeLR - mov r8, r0 - movs r0, 0x1 - mov r1, r8 - movs r2, 0 - bl GetStringWidth - adds r5, r0, 0 - ldr r6, =gText_ButtonTypeLEqualsA - movs r0, 0x1 - adds r1, r6, 0 - movs r2, 0 - bl GetStringWidth - subs r5, 0x5E - subs r4, r5 - subs r4, r0 - lsrs r0, r4, 31 - adds r4, r0 - asrs r4, 1 - adds r4, 0x68 - lsls r4, 24 - lsrs r4, 24 - mov r0, sp - ldrb r3, [r0, 0x1] - mov r0, r8 - adds r1, r4, 0 - movs r2, 0x40 - bl sub_80BAB68 - movs r0, 0x1 - adds r1, r6, 0 - movs r2, 0xC6 - bl GetStringRightAlignXOffset - adds r1, r0, 0 - lsls r1, 24 - lsrs r1, 24 - mov r0, sp - ldrb r3, [r0, 0x2] - adds r0, r6, 0 - movs r2, 0x40 - bl sub_80BAB68 - add sp, 0x4 - pop {r3} - mov r8, r3 - pop {r4-r6} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80BB028 - - thumb_func_start sub_80BB0D0 -sub_80BB0D0: @ 80BB0D0 - push {lr} - sub sp, 0xC - movs r0, 0 - movs r1, 0x11 - bl FillWindowPixelBuffer - ldr r2, =gText_Option - movs r0, 0x1 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - movs r1, 0x1 - movs r3, 0x8 - bl PrintTextOnWindow - movs r0, 0 - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0xC - pop {r0} - bx r0 - .pool - thumb_func_end sub_80BB0D0 - - thumb_func_start sub_80BB104 -sub_80BB104: @ 80BB104 - push {r4,r5,lr} - sub sp, 0xC - movs r0, 0x1 - movs r1, 0x11 - bl FillWindowPixelBuffer - movs r4, 0 - ldr r5, =gUnknown_0855C664 -_080BB114: - lsls r0, r4, 2 - adds r0, r5 - ldr r2, [r0] - lsls r0, r4, 4 - adds r0, 0x1 - lsls r0, 24 - lsrs r0, 24 - str r0, [sp] - movs r0, 0xFF - str r0, [sp, 0x4] - movs r0, 0 - str r0, [sp, 0x8] - movs r0, 0x1 - movs r1, 0x1 - movs r3, 0x8 - bl PrintTextOnWindow - adds r0, r4, 0x1 - lsls r0, 24 - lsrs r4, r0, 24 - cmp r4, 0x6 - bls _080BB114 - movs r0, 0x1 - movs r1, 0x3 - bl CopyWindowToVram - add sp, 0xC - pop {r4,r5} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80BB104 - - thumb_func_start sub_80BB154 -sub_80BB154: @ 80BB154 - push {r4-r7,lr} - mov r7, r10 - mov r6, r9 - mov r5, r8 - push {r5-r7} - sub sp, 0xC - movs r4, 0x1 - str r4, [sp] - str r4, [sp, 0x4] - movs r5, 0x7 - str r5, [sp, 0x8] - movs r0, 0x1 - movs r1, 0xD1 - lsls r1, 1 - movs r2, 0x1 - movs r3, 0 - bl FillBgTilemapBufferRect - movs r0, 0x1B - mov r8, r0 - str r0, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x1 - ldr r1, =0x000001a3 - movs r2, 0x2 - movs r3, 0 - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x1 - movs r1, 0xD2 - lsls r1, 1 - movs r2, 0x1C - movs r3, 0 - bl FillBgTilemapBufferRect - str r4, [sp] - movs r6, 0x2 - str r6, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x1 - ldr r1, =0x000001a5 - movs r2, 0x1 - movs r3, 0x1 - bl FillBgTilemapBufferRect - str r4, [sp] - str r6, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x1 - ldr r1, =0x000001a7 - movs r2, 0x1C - movs r3, 0x1 - bl FillBgTilemapBufferRect - movs r7, 0xD4 - lsls r7, 1 - str r4, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x1 - adds r1, r7, 0 - movs r2, 0x1 - movs r3, 0x3 - bl FillBgTilemapBufferRect - ldr r0, =0x000001a9 - mov r10, r0 - mov r0, r8 - str r0, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x1 - mov r1, r10 - movs r2, 0x2 - movs r3, 0x3 - bl FillBgTilemapBufferRect - movs r0, 0xD5 - lsls r0, 1 - mov r9, r0 - str r4, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x1 - mov r1, r9 - movs r2, 0x1C - movs r3, 0x3 - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x1 - movs r1, 0xD1 - lsls r1, 1 - movs r2, 0x1 - movs r3, 0x4 - bl FillBgTilemapBufferRect - movs r0, 0x1A - mov r8, r0 - str r0, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x1 - ldr r1, =0x000001a3 - movs r2, 0x2 - movs r3, 0x4 - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x1 - movs r1, 0xD2 - lsls r1, 1 - movs r2, 0x1C - movs r3, 0x4 - bl FillBgTilemapBufferRect - str r4, [sp] - movs r6, 0x12 - str r6, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x1 - ldr r1, =0x000001a5 - movs r2, 0x1 - movs r3, 0x5 - bl FillBgTilemapBufferRect - str r4, [sp] - str r6, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x1 - ldr r1, =0x000001a7 - movs r2, 0x1C - movs r3, 0x5 - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x1 - adds r1, r7, 0 - movs r2, 0x1 - movs r3, 0x13 - bl FillBgTilemapBufferRect - mov r0, r8 - str r0, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x1 - mov r1, r10 - movs r2, 0x2 - movs r3, 0x13 - bl FillBgTilemapBufferRect - str r4, [sp] - str r4, [sp, 0x4] - str r5, [sp, 0x8] - movs r0, 0x1 - mov r1, r9 - movs r2, 0x1C - movs r3, 0x13 - bl FillBgTilemapBufferRect - movs r0, 0x1 - bl CopyBgTilemapBufferToVram - add sp, 0xC - pop {r3-r5} - mov r8, r3 - mov r9, r4 - mov r10, r5 - pop {r4-r7} - pop {r0} - bx r0 - .pool - thumb_func_end sub_80BB154 .align 2, 0 @ Don't pad with nop. diff --git a/asm/overworld.s b/asm/overworld.s index c3140f7a9..71a3e7ccf 100644 --- a/asm/overworld.s +++ b/asm/overworld.s @@ -4122,7 +4122,7 @@ sub_80867D8: @ 80867D8 movs r0, 0 movs r1, 0 bl SetGpuReg - bl remove_some_task + bl ScanlineEffect_Stop ldr r2, =0x05000002 mov r1, sp movs r0, 0 diff --git a/asm/party_menu.s b/asm/party_menu.s index 844043a95..d4e22c545 100755 --- a/asm/party_menu.s +++ b/asm/party_menu.s @@ -107,7 +107,7 @@ _081B0290: b _081B048C .pool _081B02AC: - bl remove_some_task + bl ScanlineEffect_Stop b _081B0484 _081B02B2: bl ResetPaletteFade diff --git a/asm/pokedex.s b/asm/pokedex.s index 6ebeb0792..e4b58a144 100644 --- a/asm/pokedex.s +++ b/asm/pokedex.s @@ -379,7 +379,7 @@ _080BB582: b _080BB74C .pool _080BB5FC: - bl remove_some_task + bl ScanlineEffect_Stop bl ResetTasks bl ResetSpriteData bl ResetPaletteFade diff --git a/asm/pokemon_summary_screen.s b/asm/pokemon_summary_screen.s index 51f322e1e..0030b33d2 100755 --- a/asm/pokemon_summary_screen.s +++ b/asm/pokemon_summary_screen.s @@ -2239,7 +2239,7 @@ _081C50E4: bl clear_scheduled_bg_copies_to_vram b _081C51A2 _081C50EE: - bl remove_some_task + bl ScanlineEffect_Stop b _081C51A2 _081C50F4: bl FreeAllSpritePalettes diff --git a/asm/pokenav.s b/asm/pokenav.s index b52715cb4..93a91bf92 100755 --- a/asm/pokenav.s +++ b/asm/pokenav.s @@ -7095,7 +7095,7 @@ titlescreen_0: @ 81CA92C movs r0, 0x44 movs r1, 0xA0 bl SetGpuRegBits - bl remove_some_task + bl ScanlineEffect_Stop bl sub_81CAA3C ldr r2, =gUnknown_08620384 ldr r0, [r2] @@ -7122,7 +7122,7 @@ sub_81CA994: @ 81CA994 lsls r1, 6 movs r0, 0 bl ClearGpuRegBits - bl remove_some_task + bl ScanlineEffect_Stop ldr r0, =sub_81CA9EC bl FindTaskIdByFunc lsls r0, 24 diff --git a/asm/rayquaza_scene.s b/asm/rayquaza_scene.s index ab04d8660..f60b2a252 100755 --- a/asm/rayquaza_scene.s +++ b/asm/rayquaza_scene.s @@ -45,7 +45,7 @@ sub_81D6774: @ 81D6774 push {lr} bl SetVBlankHBlankCallbacksToNull bl clear_scheduled_bg_copies_to_vram - bl remove_some_task + bl ScanlineEffect_Stop bl FreeAllSpritePalettes bl ResetPaletteFade bl ResetSpriteData @@ -1522,7 +1522,7 @@ _081D73D8: adds r0, r2 ldrh r1, [r4, 0x6] strh r1, [r0, 0xE] - bl remove_some_task + bl ScanlineEffect_Stop _081D7428: ldrh r0, [r4] adds r0, 0x1 @@ -1774,7 +1774,7 @@ sub_81D7600: @ 81D7600 bl ChangeBgY movs r0, 0 bl SetVBlankCallback - bl remove_some_task + bl ScanlineEffect_Stop bl ResetSpriteData bl FreeAllSpritePalettes strh r4, [r5] diff --git a/asm/reset_rtc_screen.s b/asm/reset_rtc_screen.s index 1f5ef83d8..ab5e0840c 100644 --- a/asm/reset_rtc_screen.s +++ b/asm/reset_rtc_screen.s @@ -887,7 +887,7 @@ _0809EFCA: movs r1, 0x80 bl ResetOamRange bl LoadOam - bl remove_some_task + bl ScanlineEffect_Stop bl dp12_8087EA4 bl ResetSpriteData bl ResetTasks diff --git a/asm/roulette.s b/asm/roulette.s index 9d9e39feb..3568c1911 100644 --- a/asm/roulette.s +++ b/asm/roulette.s @@ -423,7 +423,7 @@ _081405F4: _08140618: movs r0, 0 bl SetVBlankCallback - bl remove_some_task + bl ScanlineEffect_Stop bl SetVBlankHBlankCallbacksToNull bl ResetVramOamAndBgCntRegs bl ResetAllBgsCoordinates diff --git a/asm/shop.s b/asm/shop.s index ccbf458c9..4ecab08ca 100644 --- a/asm/shop.s +++ b/asm/shop.s @@ -448,7 +448,7 @@ _080DFE20: ldr r2, =0x01000100 add r0, sp, 0x8 bl CpuFastSet - bl remove_some_task + bl ScanlineEffect_Stop bl reset_temp_tile_data_buffers bl FreeAllSpritePalettes bl ResetPaletteFade diff --git a/asm/start_menu.s b/asm/start_menu.s index 6182c3c27..e8f9c3090 100644 --- a/asm/start_menu.s +++ b/asm/start_menu.s @@ -653,7 +653,7 @@ _0809FD38: bl play_some_sound bl RemoveExtraStartMenuWindows bl overworld_free_bg_tilemaps - ldr r0, =CB2_OptionsMenu + ldr r0, =CB2_InitOptionMenu bl SetMainCallback2 ldr r1, =gMain ldr r0, =sub_8086194 @@ -1510,7 +1510,7 @@ _080A0418: bl SetGpuReg movs r0, 0 bl SetVBlankCallback - bl remove_some_task + bl ScanlineEffect_Stop movs r2, 0xA0 lsls r2, 19 mov r1, sp diff --git a/asm/title_screen.s b/asm/title_screen.s index b5286d049..54c1b5353 100644 --- a/asm/title_screen.s +++ b/asm/title_screen.s @@ -614,7 +614,7 @@ _080AA8C4: ldr r0, =gUnknown_08DDE458 ldr r1, =0x0600d800 bl LZ77UnCompVram - bl remove_some_task + bl ScanlineEffect_Stop bl ResetTasks bl ResetSpriteData bl FreeAllSpritePalettes diff --git a/asm/trainer_card.s b/asm/trainer_card.s index ab1b199e7..709e3e8f3 100644 --- a/asm/trainer_card.s +++ b/asm/trainer_card.s @@ -1556,7 +1556,7 @@ sub_80C3404: @ 80C3404 sub_80C3414: @ 80C3414 push {lr} bl ResetTasks - bl remove_some_task + bl ScanlineEffect_Stop ldr r0, =sub_80C2760 movs r1, 0 bl CreateTask @@ -3976,7 +3976,7 @@ sub_80C4998: @ 80C4998 bl HideBg movs r0, 0x3 bl HideBg - bl remove_some_task + bl ScanlineEffect_Stop bl dp12_8087EA4 movs r1, 0 ldr r0, =gUnknown_02038C28 @@ -5310,7 +5310,7 @@ _080C54AC: _080C54D8: movs r0, 0 bl SetVBlankCallback - bl remove_some_task + bl ScanlineEffect_Stop bl SetVBlankHBlankCallbacksToNull movs r0, 0x2 bl DisableInterrupts @@ -5594,7 +5594,7 @@ _080C577C: bl HideBg movs r0, 0 bl SetVBlankCallback - bl remove_some_task + bl ScanlineEffect_Stop bl SetVBlankHBlankCallbacksToNull b _080C57E4 _080C57A6: @@ -7189,7 +7189,7 @@ _080C64F0: _080C6510: movs r0, 0 bl SetVBlankCallback - bl remove_some_task + bl ScanlineEffect_Stop bl SetVBlankHBlankCallbacksToNull b _080C6694 _080C6520: @@ -7400,7 +7400,7 @@ _080C66FC: _080C6722: movs r0, 0 bl SetVBlankCallback - bl remove_some_task + bl ScanlineEffect_Stop bl SetVBlankHBlankCallbacksToNull b _080C67A4 _080C6732: diff --git a/asm/unknown_task.s b/asm/unknown_task.s index f6b96287e..a8672ac8f 100644 --- a/asm/unknown_task.s +++ b/asm/unknown_task.s @@ -5,8 +5,8 @@ .text - thumb_func_start remove_some_task -remove_some_task: @ 80B9FB8 + thumb_func_start ScanlineEffect_Stop +ScanlineEffect_Stop: @ 80B9FB8 push {r4,lr} ldr r4, =gUnknown_02039B28 movs r0, 0 @@ -32,7 +32,7 @@ _080B9FE2: pop {r0} bx r0 .pool - thumb_func_end remove_some_task + thumb_func_end ScanlineEffect_Stop thumb_func_start dp12_8087EA4 dp12_8087EA4: @ 80B9FF8 diff --git a/include/option_menu.h b/include/option_menu.h new file mode 100644 index 000000000..b23a73c4c --- /dev/null +++ b/include/option_menu.h @@ -0,0 +1,6 @@ +#ifndef GUARD_OPTION_MENU_H +#define GUARD_OPTION_MENU_H + +void CB2_InitOptionMenu(void); + +#endif // GUARD_OPTION_MENU_H diff --git a/include/strings.h b/include/strings.h index a382191a0..5a26881a3 100644 --- a/include/strings.h +++ b/include/strings.h @@ -170,4 +170,21 @@ extern const u8 gText_Peak[]; extern const u8 gText_SafariBallStock[]; extern const u8 gText_BattlePyramidFloor[]; +// option menu texts +extern const u8 gText_TextSpeedSlow[]; +extern const u8 gText_TextSpeedMid[]; +extern const u8 gText_TextSpeedFast[]; +extern const u8 gText_BattleSceneOn[]; +extern const u8 gText_BattleSceneOff[]; +extern const u8 gText_BattleStyleShift[]; +extern const u8 gText_BattleStyleSet[]; +extern const u8 gText_SoundMono[]; +extern const u8 gText_SoundStereo[]; +extern const u8 gText_FrameTypeNumber[]; +extern const u8 gText_FrameType[]; +extern const u8 gText_ButtonTypeNormal[]; +extern const u8 gText_ButtonTypeLR[]; +extern const u8 gText_ButtonTypeLEqualsA[]; +extern const u8 gText_Option[]; + #endif //GUARD_STRINGS_H diff --git a/include/text_window.h b/include/text_window.h index 0af007397..f9a458cc3 100644 --- a/include/text_window.h +++ b/include/text_window.h @@ -7,7 +7,7 @@ struct TilesPal u16 *pal; }; -const struct TilesPal* sub_8098758(u8 id); +const struct TilesPal* GetWindowFrameTilesPal(u8 id); void copy_textbox_border_tile_patterns_to_vram(u8 windowId, u16 destOffset, u8 palOffset); void sub_809882C(u8 windowId, u16 destOffset, u8 palOffset); void sub_80987D4(u8 windowId, u8 frameId, u16 destOffset, u8 palOffset); diff --git a/include/unknown_task.h b/include/unknown_task.h index 9c6968c30..906fed3e0 100644 --- a/include/unknown_task.h +++ b/include/unknown_task.h @@ -15,7 +15,7 @@ extern struct UnknownTaskStruct gUnknown_0831AC70; // Exported RAM declarations // Exported ROM declarations -void remove_some_task(void); +void ScanlineEffect_Stop(void); void sub_80BA038(struct UnknownTaskStruct arg0); void sub_80BA0A8(void); diff --git a/ld_script.txt b/ld_script.txt index ae8dd057d..c61a3cfbf 100644 --- a/ld_script.txt +++ b/ld_script.txt @@ -127,7 +127,7 @@ SECTIONS { src/wild_encounter.o(.text); asm/field_effect.o(.text); asm/unknown_task.o(.text); - asm/option_menu.o(.text); + src/option_menu.o(.text); src/pokedex.o(.text); asm/pokedex.o(.text); asm/trainer_card.o(.text); @@ -428,6 +428,7 @@ SECTIONS { src/trainer_see.o(.rodata); data/wild_encounter.o(.rodata); data/field_effect.o(.rodata); + src/option_menu.o(.rodata); data/option_menu.o(.rodata); src/pokedex.o(.rodata); data/pokedex.o(.rodata); diff --git a/src/berry_fix_program.c b/src/berry_fix_program.c index 3b2bfb5f7..f487489d4 100644 --- a/src/berry_fix_program.c +++ b/src/berry_fix_program.c @@ -141,7 +141,7 @@ void InitBerryFixProgram(void) SetVBlankCallback(NULL); ResetSpriteData(); ResetTasks(); - remove_some_task(); + ScanlineEffect_Stop(); SetGpuReg(REG_OFFSET_DISPCNT, 0x0000); berry_fix_mb_manager = AllocZeroed(0x50); berry_fix_mb_manager->state = 0; diff --git a/src/diploma.c b/src/diploma.c index d4a269757..fedc10bd0 100755 --- a/src/diploma.c +++ b/src/diploma.c @@ -72,7 +72,7 @@ void CB2_ShowDiploma(void) DmaFill16(3, 0, VRAM, VRAM_SIZE); DmaFill32(3, 0, OAM, OAM_SIZE); DmaFill16(3, 0, PLTT, PLTT_SIZE); - remove_some_task(); + ScanlineEffect_Stop(); ResetTasks(); ResetSpriteData(); ResetPaletteFade(); diff --git a/src/egg_hatch.c b/src/egg_hatch.c index 1aff894b9..37f2b2e19 100644 --- a/src/egg_hatch.c +++ b/src/egg_hatch.c @@ -66,7 +66,7 @@ extern void overworld_free_bg_tilemaps(void); extern void sub_80AF168(void); extern void AllocateMonSpritesGfx(void); extern void FreeMonSpritesGfx(void); -extern void remove_some_task(void); +extern void ScanlineEffect_Stop(void); extern void reset_temp_tile_data_buffers(void); extern void c2_exit_to_overworld_2_switch(void); extern void play_some_sound(void); @@ -512,7 +512,7 @@ static void CB2_EggHatch_0(void) FreeAllSpritePalettes(); ResetSpriteData(); ResetTasks(); - remove_some_task(); + ScanlineEffect_Stop(); m4aSoundVSyncOn(); gMain.state++; break; diff --git a/src/evolution_scene.c b/src/evolution_scene.c index 4b59147ff..5dfc36cb2 100644 --- a/src/evolution_scene.c +++ b/src/evolution_scene.c @@ -269,7 +269,7 @@ void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo, sub_80356D0(); LoadBattleTextboxAndBackground(); ResetSpriteData(); - remove_some_task(); + ScanlineEffect_Stop(); ResetTasks(); FreeAllSpritePalettes(); diff --git a/src/hall_of_fame.c b/src/hall_of_fame.c index 4465f65a3..3e70e22fa 100644 --- a/src/hall_of_fame.c +++ b/src/hall_of_fame.c @@ -1302,7 +1302,7 @@ static void ClearVramOamPltt_LoadHofPal(void) static void sub_8174F70(void) { - remove_some_task(); + ScanlineEffect_Stop(); ResetTasks(); ResetSpriteData(); reset_temp_tile_data_buffers(); diff --git a/src/mail.c b/src/mail.c index 68a55e242..774e3ec19 100644 --- a/src/mail.c +++ b/src/mail.c @@ -329,7 +329,7 @@ static bool8 MailReadBuildGraphics(void) { case 0: SetVBlankCallback(NULL); - remove_some_task(); + ScanlineEffect_Stop(); SetGpuReg(REG_OFFSET_DISPCNT, 0x0000); break; case 1: diff --git a/src/main.c b/src/main.c index 07b7d9147..d4601293b 100644 --- a/src/main.c +++ b/src/main.c @@ -29,7 +29,7 @@ extern void MapMusicMain(void); extern void EnableInterrupts(u16); extern void sub_8033648(void); extern u16 SetFlashTimerIntr(u8 timerNum, void (**intrFunc)(void)); -extern void remove_some_task(void); +extern void ScanlineEffect_Stop(void); extern struct SoundInfo gSoundInfo; extern u32 gFlashMemoryPresent; @@ -425,7 +425,7 @@ void DoSoftReset(void) { REG_IME = 0; m4aSoundVSyncOff(); - remove_some_task(); + ScanlineEffect_Stop(); DmaStop(1); DmaStop(2); DmaStop(3); diff --git a/src/option_menu.c b/src/option_menu.c new file mode 100644 index 000000000..5b88338ab --- /dev/null +++ b/src/option_menu.c @@ -0,0 +1,630 @@ +#include "global.h" +#include "option_menu.h" +#include "main.h" +#include "menu.h" +#include "unknown_task.h" +#include "palette.h" +#include "sprite.h" +#include "task.h" +#include "bg.h" +#include "gpu_regs.h" +#include "window.h" +#include "text.h" +#include "text_window.h" +#include "international_string_util.h" +#include "strings.h" + +extern void SetPokemonCryStereo(u32 val); + +// Task data +enum +{ + TD_MENUSELECTION, + TD_TEXTSPEED, + TD_BATTLESCENE, + TD_BATTLESTYLE, + TD_SOUND, + TD_BUTTONMODE, + TD_FRAMETYPE, +}; + +// Menu items +enum +{ + MENUITEM_TEXTSPEED, + MENUITEM_BATTLESCENE, + MENUITEM_BATTLESTYLE, + MENUITEM_SOUND, + MENUITEM_BUTTONMODE, + MENUITEM_FRAMETYPE, + MENUITEM_CANCEL, + MENUITEM_COUNT, +}; + +// Window Ids +enum +{ + WIN_TEXT_OPTION, + WIN_OPTIONS +}; + +// this file's functions +static void Task_OptionMenuFadeIn(u8 taskId); +static void Task_OptionMenuProcessInput(u8 taskId); +static void Task_OptionMenuSave(u8 taskId); +static void Task_OptionMenuFadeOut(u8 taskId); +static void HighlightOptionMenuItem(u8 selection); +static u8 TextSpeed_ProcessInput(u8 selection); +static void TextSpeed_DrawChoices(u8 selection); +static u8 BattleScene_ProcessInput(u8 selection); +static void BattleScene_DrawChoices(u8 selection); +static u8 BattleStyle_ProcessInput(u8 selection); +static void BattleStyle_DrawChoices(u8 selection); +static u8 Sound_ProcessInput(u8 selection); +static void Sound_DrawChoices(u8 selection); +static u8 FrameType_ProcessInput(u8 selection); +static void FrameType_DrawChoices(u8 selection); +static u8 ButtonMode_ProcessInput(u8 selection); +static void ButtonMode_DrawChoices(u8 selection); +static void DrawTextOption(void); +static void DrawOptionMenuTexts(void); +static void sub_80BB154(void); + +// EWRAM vars +EWRAM_DATA static bool8 sArrowPressed = FALSE; + +// const rom data +/* +const u16 gUnknown_0839F5FC[] = INCBIN_U16("graphics/misc/option_menu_text.gbapal"); +// note: this is only used in the Japanese release +const static u8 gUnknown_0839F63C[] = INCBIN_U8("graphics/misc/option_menu_equals_sign.4bpp"); +*/ +extern const struct BgTemplate gUnknown_0855C698[2]; +extern const struct WindowTemplate gUnknown_0855C680[]; +extern const u16 gUnknown_0855C6A0[1]; +extern const u16 gUnknown_0855C604[16]; +extern const u8 *const gUnknown_0855C664[MENUITEM_COUNT]; + +// code +static void MainCB2(void) +{ + RunTasks(); + AnimateSprites(); + BuildOamBuffer(); + UpdatePaletteFade(); +} + +static void VBlankCB(void) +{ + LoadOam(); + ProcessSpriteCopyRequests(); + TransferPlttBuffer(); +} + +void CB2_InitOptionMenu(void) +{ + switch (gMain.state) + { + default: + case 0: + SetVBlankCallback(NULL); + gMain.state++; + break; + case 1: + { + u8 *addr; + u32 size; + + addr = (u8 *)VRAM; + size = 0x18000; + while (1) + { + DmaFill16(3, 0, addr, 0x1000); + addr += 0x1000; + size -= 0x1000; + if (size <= 0x1000) + { + DmaFill16(3, 0, addr, size); + break; + } + } + DmaClear32(3, OAM, OAM_SIZE); + DmaClear16(3, PLTT, PLTT_SIZE); + SetGpuReg(REG_OFFSET_DISPCNT, 0); + ResetBgsAndClearDma3BusyFlags(0); + InitBgsFromTemplates(0, gUnknown_0855C698, ARRAY_COUNT(gUnknown_0855C698)); + ChangeBgX(0, 0, 0); + ChangeBgY(0, 0, 0); + ChangeBgX(1, 0, 0); + ChangeBgY(1, 0, 0); + ChangeBgX(2, 0, 0); + ChangeBgY(2, 0, 0); + ChangeBgX(3, 0, 0); + ChangeBgY(3, 0, 0); + InitWindows(gUnknown_0855C680); + DeactivateAllTextPrinters(); + SetGpuReg(REG_OFFSET_WIN0H, 0); + SetGpuReg(REG_OFFSET_WIN0V, 0); + SetGpuReg(REG_OFFSET_WININ, 1); + SetGpuReg(REG_OFFSET_WINOUT, 35); + SetGpuReg(REG_OFFSET_BLDCNT, 193); + SetGpuReg(REG_OFFSET_BLDALPHA, 0); + SetGpuReg(REG_OFFSET_BLDY, 4); + SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_WIN0_ON | DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP); + ShowBg(0); + ShowBg(1); + gMain.state++; + } + break; + case 2: + ResetPaletteFade(); + ScanlineEffect_Stop(); + ResetTasks(); + ResetSpriteData(); + gMain.state++; + break; + case 3: + LoadBgTiles(1, GetWindowFrameTilesPal(gSaveBlock2Ptr->optionsWindowFrameType)->tiles, 0x120, 0x1A2); + gMain.state++; + break; + case 4: + LoadPalette(gUnknown_0855C6A0, 0, sizeof(gUnknown_0855C6A0)); + LoadPalette(GetWindowFrameTilesPal(gSaveBlock2Ptr->optionsWindowFrameType)->pal, 0x70, 0x20); + gMain.state++; + break; + case 5: + LoadPalette(gUnknown_0855C604, 0x10, sizeof(gUnknown_0855C604)); + gMain.state++; + break; + case 6: + PutWindowTilemap(0); + DrawTextOption(); + gMain.state++; + break; + case 7: + gMain.state++; + break; + case 8: + PutWindowTilemap(1); + DrawOptionMenuTexts(); + gMain.state++; + case 9: + sub_80BB154(); + gMain.state++; + break; + case 10: + { + u8 taskId = CreateTask(Task_OptionMenuFadeIn, 0); + + gTasks[taskId].data[TD_MENUSELECTION] = 0; + gTasks[taskId].data[TD_TEXTSPEED] = gSaveBlock2Ptr->optionsTextSpeed; + gTasks[taskId].data[TD_BATTLESCENE] = gSaveBlock2Ptr->optionsBattleSceneOff; + gTasks[taskId].data[TD_BATTLESTYLE] = gSaveBlock2Ptr->optionsBattleStyle; + gTasks[taskId].data[TD_SOUND] = gSaveBlock2Ptr->optionsSound; + gTasks[taskId].data[TD_BUTTONMODE] = gSaveBlock2Ptr->optionsButtonMode; + gTasks[taskId].data[TD_FRAMETYPE] = gSaveBlock2Ptr->optionsWindowFrameType; + + TextSpeed_DrawChoices(gTasks[taskId].data[TD_TEXTSPEED]); + BattleScene_DrawChoices(gTasks[taskId].data[TD_BATTLESCENE]); + BattleStyle_DrawChoices(gTasks[taskId].data[TD_BATTLESTYLE]); + Sound_DrawChoices(gTasks[taskId].data[TD_SOUND]); + ButtonMode_DrawChoices(gTasks[taskId].data[TD_BUTTONMODE]); + FrameType_DrawChoices(gTasks[taskId].data[TD_FRAMETYPE]); + HighlightOptionMenuItem(gTasks[taskId].data[TD_MENUSELECTION]); + + CopyWindowToVram(WIN_OPTIONS, 3); + gMain.state++; + break; + } + case 11: + BeginNormalPaletteFade(-1, 0, 0x10, 0, 0); + SetVBlankCallback(VBlankCB); + SetMainCallback2(MainCB2); + return; + } +} + +static void Task_OptionMenuFadeIn(u8 taskId) +{ + if (!gPaletteFade.active) + { + gTasks[taskId].func = Task_OptionMenuProcessInput; + } +} + +static void Task_OptionMenuProcessInput(u8 taskId) +{ + if (gMain.newKeys & A_BUTTON) + { + if (gTasks[taskId].data[TD_MENUSELECTION] == MENUITEM_CANCEL) + gTasks[taskId].func = Task_OptionMenuSave; + } + else if (gMain.newKeys & B_BUTTON) + { + gTasks[taskId].func = Task_OptionMenuSave; + } + else if (gMain.newKeys & DPAD_UP) + { + if (gTasks[taskId].data[TD_MENUSELECTION] > 0) + gTasks[taskId].data[TD_MENUSELECTION]--; + else + gTasks[taskId].data[TD_MENUSELECTION] = 6; + HighlightOptionMenuItem(gTasks[taskId].data[TD_MENUSELECTION]); + } + else if (gMain.newKeys & DPAD_DOWN) + { + if (gTasks[taskId].data[TD_MENUSELECTION] <= 5) + gTasks[taskId].data[TD_MENUSELECTION]++; + else + gTasks[taskId].data[TD_MENUSELECTION] = 0; + HighlightOptionMenuItem(gTasks[taskId].data[TD_MENUSELECTION]); + } + else + { + u8 previousOption; + + switch (gTasks[taskId].data[TD_MENUSELECTION]) + { + case MENUITEM_TEXTSPEED: + previousOption = gTasks[taskId].data[TD_TEXTSPEED]; + gTasks[taskId].data[TD_TEXTSPEED] = TextSpeed_ProcessInput(gTasks[taskId].data[TD_TEXTSPEED]); + + if (previousOption != gTasks[taskId].data[TD_TEXTSPEED]) + TextSpeed_DrawChoices(gTasks[taskId].data[TD_TEXTSPEED]); + break; + case MENUITEM_BATTLESCENE: + previousOption = gTasks[taskId].data[TD_BATTLESCENE]; + gTasks[taskId].data[TD_BATTLESCENE] = BattleScene_ProcessInput(gTasks[taskId].data[TD_BATTLESCENE]); + + if (previousOption != gTasks[taskId].data[TD_BATTLESCENE]) + BattleScene_DrawChoices(gTasks[taskId].data[TD_BATTLESCENE]); + break; + case MENUITEM_BATTLESTYLE: + previousOption = gTasks[taskId].data[TD_BATTLESTYLE]; + gTasks[taskId].data[TD_BATTLESTYLE] = BattleStyle_ProcessInput(gTasks[taskId].data[TD_BATTLESTYLE]); + + if (previousOption != gTasks[taskId].data[TD_BATTLESTYLE]) + BattleStyle_DrawChoices(gTasks[taskId].data[TD_BATTLESTYLE]); + break; + case MENUITEM_SOUND: + previousOption = gTasks[taskId].data[TD_SOUND]; + gTasks[taskId].data[TD_SOUND] = Sound_ProcessInput(gTasks[taskId].data[TD_SOUND]); + + if (previousOption != gTasks[taskId].data[TD_SOUND]) + Sound_DrawChoices(gTasks[taskId].data[TD_SOUND]); + break; + case MENUITEM_BUTTONMODE: + previousOption = gTasks[taskId].data[TD_BUTTONMODE]; + gTasks[taskId].data[TD_BUTTONMODE] = ButtonMode_ProcessInput(gTasks[taskId].data[TD_BUTTONMODE]); + + if (previousOption != gTasks[taskId].data[TD_BUTTONMODE]) + ButtonMode_DrawChoices(gTasks[taskId].data[TD_BUTTONMODE]); + break; + case MENUITEM_FRAMETYPE: + previousOption = gTasks[taskId].data[TD_FRAMETYPE]; + gTasks[taskId].data[TD_FRAMETYPE] = FrameType_ProcessInput(gTasks[taskId].data[TD_FRAMETYPE]); + + if (previousOption != gTasks[taskId].data[TD_FRAMETYPE]) + FrameType_DrawChoices(gTasks[taskId].data[TD_FRAMETYPE]); + break; + default: + return; + } + + if (sArrowPressed) + { + sArrowPressed = FALSE; + CopyWindowToVram(WIN_OPTIONS, 2); + } + } +} + +static void Task_OptionMenuSave(u8 taskId) +{ + gSaveBlock2Ptr->optionsTextSpeed = gTasks[taskId].data[TD_TEXTSPEED]; + gSaveBlock2Ptr->optionsBattleSceneOff = gTasks[taskId].data[TD_BATTLESCENE]; + gSaveBlock2Ptr->optionsBattleStyle = gTasks[taskId].data[TD_BATTLESTYLE]; + gSaveBlock2Ptr->optionsSound = gTasks[taskId].data[TD_SOUND]; + gSaveBlock2Ptr->optionsButtonMode = gTasks[taskId].data[TD_BUTTONMODE]; + gSaveBlock2Ptr->optionsWindowFrameType = gTasks[taskId].data[TD_FRAMETYPE]; + + BeginNormalPaletteFade(-1, 0, 0, 0x10, 0); + gTasks[taskId].func = Task_OptionMenuFadeOut; +} + +static void Task_OptionMenuFadeOut(u8 taskId) +{ + if (!gPaletteFade.active) + { + DestroyTask(taskId); + FreeAllWindowBuffers(); + SetMainCallback2(gMain.savedCallback); + } +} + +static void HighlightOptionMenuItem(u8 index) +{ + SetGpuReg(REG_OFFSET_WIN0H, WIN_RANGE(16, 224)); + SetGpuReg(REG_OFFSET_WIN0V, WIN_RANGE(index * 16 + 40, index * 16 + 56)); +} + +static void DrawOptionMenuChoice(const u8 *text, u8 x, u8 y, u8 style) +{ + u8 dst[16]; + u16 i; + + for (i = 0; *text != EOS && i <= 14; i++) + dst[i] = *(text++); + + if (style != 0) + { + dst[2] = 4; + dst[5] = 5; + } + + dst[i] = EOS; + PrintTextOnWindow(WIN_OPTIONS, 1, dst, x, y + 1, TEXT_SPEED_FF, NULL); +} + +static u8 TextSpeed_ProcessInput(u8 selection) +{ + if (gMain.newKeys & DPAD_RIGHT) + { + if (selection <= 1) + selection++; + else + selection = 0; + + sArrowPressed = TRUE; + } + if (gMain.newKeys & DPAD_LEFT) + { + if (selection != 0) + selection--; + else + selection = 2; + + sArrowPressed = TRUE; + } + return selection; +} + +static void TextSpeed_DrawChoices(u8 selection) +{ + u8 styles[3]; + s32 widthSlow, widthMid, widthFast, xMid; + + styles[0] = 0; + styles[1] = 0; + styles[2] = 0; + styles[selection] = 1; + + DrawOptionMenuChoice(gText_TextSpeedSlow, 104, 0, styles[0]); + + widthSlow = GetStringWidth(1, gText_TextSpeedSlow, 0); + widthMid = GetStringWidth(1, gText_TextSpeedMid, 0); + widthFast = GetStringWidth(1, gText_TextSpeedFast, 0); + + widthMid -= 94; + xMid = (widthSlow - widthMid - widthFast) / 2 + 104; + DrawOptionMenuChoice(gText_TextSpeedMid, xMid, 0, styles[1]); + + DrawOptionMenuChoice(gText_TextSpeedFast, GetStringRightAlignXOffset(1, gText_TextSpeedFast, 198), 0, styles[2]); +} + +static u8 BattleScene_ProcessInput(u8 selection) +{ + if (gMain.newKeys & (DPAD_LEFT | DPAD_RIGHT)) + { + selection ^= 1; + sArrowPressed = TRUE; + } + + return selection; +} + +static void BattleScene_DrawChoices(u8 selection) +{ + u8 styles[2]; + + styles[0] = 0; + styles[1] = 0; + styles[selection] = 1; + + DrawOptionMenuChoice(gText_BattleSceneOn, 104, 16, styles[0]); + DrawOptionMenuChoice(gText_BattleSceneOff, GetStringRightAlignXOffset(1, gText_BattleSceneOff, 198), 16, styles[1]); +} + +static u8 BattleStyle_ProcessInput(u8 selection) +{ + if (gMain.newKeys & (DPAD_LEFT | DPAD_RIGHT)) + { + selection ^= 1; + sArrowPressed = TRUE; + } + + return selection; +} + +static void BattleStyle_DrawChoices(u8 selection) +{ + u8 styles[2]; + + styles[0] = 0; + styles[1] = 0; + styles[selection] = 1; + + DrawOptionMenuChoice(gText_BattleStyleShift, 104, 32, styles[0]); + DrawOptionMenuChoice(gText_BattleStyleSet, GetStringRightAlignXOffset(1, gText_BattleStyleSet, 198), 32, styles[1]); +} + +static u8 Sound_ProcessInput(u8 selection) +{ + if (gMain.newKeys & (DPAD_LEFT | DPAD_RIGHT)) + { + selection ^= 1; + SetPokemonCryStereo(selection); + sArrowPressed = TRUE; + } + + return selection; +} + +static void Sound_DrawChoices(u8 selection) +{ + u8 styles[2]; + + styles[0] = 0; + styles[1] = 0; + styles[selection] = 1; + + DrawOptionMenuChoice(gText_SoundMono, 104, 48, styles[0]); + DrawOptionMenuChoice(gText_SoundStereo, GetStringRightAlignXOffset(1, gText_SoundStereo, 198), 48, styles[1]); +} + +// TODO: 19 should be defined in text_window.h +static u8 FrameType_ProcessInput(u8 selection) +{ + if (gMain.newKeys & DPAD_RIGHT) + { + if (selection < 19) + selection++; + else + selection = 0; + + LoadBgTiles(1, GetWindowFrameTilesPal(selection)->tiles, 0x120, 0x1A2); + LoadPalette(GetWindowFrameTilesPal(selection)->pal, 0x70, 0x20); + sArrowPressed = TRUE; + } + if (gMain.newKeys & DPAD_LEFT) + { + if (selection != 0) + selection--; + else + selection = 19; + + LoadBgTiles(1, GetWindowFrameTilesPal(selection)->tiles, 0x120, 0x1A2); + LoadPalette(GetWindowFrameTilesPal(selection)->pal, 0x70, 0x20); + sArrowPressed = TRUE; + } + return selection; +} + +static void FrameType_DrawChoices(u8 selection) +{ + u8 text[16]; + u8 n = selection + 1; + u16 i; + + for (i = 0; gText_FrameTypeNumber[i] != EOS && i <= 5; i++) + text[i] = gText_FrameTypeNumber[i]; + + // Convert a number to decimal string + if (n / 10 != 0) + { + text[i] = n / 10 + CHAR_0; + i++; + text[i] = n % 10 + CHAR_0; + i++; + } + else + { + text[i] = n % 10 + CHAR_0; + i++; + text[i] = 0x77; + i++; + } + + text[i] = EOS; + + DrawOptionMenuChoice(gText_FrameType, 104, 80, 0); + DrawOptionMenuChoice(text, 128, 80, 1); +} + +static u8 ButtonMode_ProcessInput(u8 selection) +{ + if (gMain.newKeys & DPAD_RIGHT) + { + if (selection <= 1) + selection++; + else + selection = 0; + + sArrowPressed = TRUE; + } + if (gMain.newKeys & DPAD_LEFT) + { + if (selection != 0) + selection--; + else + selection = 2; + + sArrowPressed = TRUE; + } + return selection; +} + +static void ButtonMode_DrawChoices(u8 selection) +{ + s32 widthNormal, widthLR, widthLA, yLR; + u8 styles[3]; + + styles[0] = 0; + styles[1] = 0; + styles[2] = 0; + styles[selection] = 1; + + DrawOptionMenuChoice(gText_ButtonTypeNormal, 104, 64, styles[0]); + + widthNormal = GetStringWidth(1, gText_ButtonTypeNormal, 0); + widthLR = GetStringWidth(1, gText_ButtonTypeLR, 0); + widthLA = GetStringWidth(1, gText_ButtonTypeLEqualsA, 0); + + widthLR -= 94; + yLR = (widthNormal - widthLR - widthLA) / 2 + 104; + DrawOptionMenuChoice(gText_ButtonTypeLR, yLR, 64, styles[1]); + + DrawOptionMenuChoice(gText_ButtonTypeLEqualsA, GetStringRightAlignXOffset(1, gText_ButtonTypeLEqualsA, 198), 64, styles[2]); +} + +static void DrawTextOption(void) +{ + FillWindowPixelBuffer(WIN_TEXT_OPTION, 0x11); + PrintTextOnWindow(WIN_TEXT_OPTION, 1, gText_Option, 8, 1, TEXT_SPEED_FF, NULL); + CopyWindowToVram(WIN_TEXT_OPTION, 3); +} + +static void DrawOptionMenuTexts(void) +{ + u8 i; + + FillWindowPixelBuffer(WIN_OPTIONS, 0x11); + for (i = 0; i < MENUITEM_COUNT; i++) + { + PrintTextOnWindow(WIN_OPTIONS, 1, gUnknown_0855C664[i], 8, (i * 16) + 1, TEXT_SPEED_FF, NULL); + } + CopyWindowToVram(WIN_OPTIONS, 3); +} + +static void sub_80BB154(void) +{ + // bg, tileNum, x, y, width, height, pal + FillBgTilemapBufferRect(1, 0x1A2, 1, 0, 1, 1, 7); + FillBgTilemapBufferRect(1, 0x1A3, 2, 0, 0x1B, 1, 7); + FillBgTilemapBufferRect(1, 0x1A4, 28, 0, 1, 1, 7); + FillBgTilemapBufferRect(1, 0x1A5, 1, 1, 1, 2, 7); + FillBgTilemapBufferRect(1, 0x1A7, 28, 1, 1, 2, 7); + FillBgTilemapBufferRect(1, 0x1A8, 1, 3, 1, 1, 7); + FillBgTilemapBufferRect(1, 0x1A9, 2, 3, 0x1B, 1, 7); + FillBgTilemapBufferRect(1, 0x1AA, 28, 3, 1, 1, 7); + FillBgTilemapBufferRect(1, 0x1A2, 1, 4, 1, 1, 7); + FillBgTilemapBufferRect(1, 0x1A3, 2, 4, 0x1A, 1, 7); + FillBgTilemapBufferRect(1, 0x1A4, 28, 4, 1, 1, 7); + FillBgTilemapBufferRect(1, 0x1A5, 1, 5, 1, 0x12, 7); + FillBgTilemapBufferRect(1, 0x1A7, 28, 5, 1, 0x12, 7); + FillBgTilemapBufferRect(1, 0x1A8, 1, 19, 1, 1, 7); + FillBgTilemapBufferRect(1, 0x1A9, 2, 19, 0x1A, 1, 7); + FillBgTilemapBufferRect(1, 0x1AA, 28, 19, 1, 1, 7); + + CopyBgTilemapBufferToVram(1); +} diff --git a/src/pokeblock.c b/src/pokeblock.c index 737f2c6f3..573eed52b 100644 --- a/src/pokeblock.c +++ b/src/pokeblock.c @@ -419,7 +419,7 @@ static bool8 InitPokeblockMenu(void) gMain.state++; break; case 1: - remove_some_task(); + ScanlineEffect_Stop(); gMain.state++; break; case 2: diff --git a/src/pokemon_summary_screen.c b/src/pokemon_summary_screen.c index e56448d8b..a900badd1 100755 --- a/src/pokemon_summary_screen.c +++ b/src/pokemon_summary_screen.c @@ -75,7 +75,7 @@ extern u8 sub_81221AC(); extern void SetVBlankHBlankCallbacksToNull(); extern void ResetVramOamAndBgCntRegs(); extern void clear_scheduled_bg_copies_to_vram(); -extern void remove_some_task(); +extern void ScanlineEffect_Stop(); extern void ResetBgsAndClearDma3BusyFlags(u32 leftoverFireRedLeafGreenVariable); extern void ShowBg(u8 a); extern void SetGpuReg(u8 regOffset, u16 value); @@ -455,7 +455,7 @@ bool8 sub_81BFB10(void) gMain.state++; break; case 1: - remove_some_task(); + ScanlineEffect_Stop(); gMain.state++; break; case 2: diff --git a/src/starter_choose.c b/src/starter_choose.c index 2d78af8fb..a47adb4e4 100644 --- a/src/starter_choose.c +++ b/src/starter_choose.c @@ -53,7 +53,7 @@ extern const u8 gUnknown_085B1E0C[]; extern const u8 gUnknown_085B1E28[][2]; extern void sub_809882C(u8, u16, u8); -extern void remove_some_task(void); +extern void ScanlineEffect_Stop(void); extern void clear_scheduled_bg_copies_to_vram(void); extern void dp13_810BB8C(void); extern void do_scheduled_bg_tilemap_copies_to_vram(void); @@ -134,7 +134,7 @@ void CB2_ChooseStarter(void) DeactivateAllTextPrinters(); sub_809882C(0, 0x2A8, 0xD0); clear_scheduled_bg_copies_to_vram(); - remove_some_task(); + ScanlineEffect_Stop(); ResetTasks(); ResetSpriteData(); ResetPaletteFade(); diff --git a/src/text_window.c b/src/text_window.c index 336536c04..67ff309f0 100644 --- a/src/text_window.c +++ b/src/text_window.c @@ -7,14 +7,14 @@ extern u8 LoadBgTiles(u8 bg, const void *src, u16 size, u16 destOffset); extern void FillBgTilemapBufferRect(u8 bg, u16 tileNum, u8 x, u8 y, u8 width, u8 height, u8 palette); -extern const struct TilesPal gUnknown_0851021C[]; +extern const struct TilesPal gUnknown_0851021C[20]; extern const u32 gUnknown_08DDD748[]; extern const u16 gUnknown_0851017C[]; extern const u16 gUnknown_08DDD728[]; -const struct TilesPal* sub_8098758(u8 id) +const struct TilesPal* GetWindowFrameTilesPal(u8 id) { - if (id > 19) + if (id >= ARRAY_COUNT(gUnknown_0851021C)) return &gUnknown_0851021C[0]; else return &gUnknown_0851021C[id]; @@ -121,5 +121,5 @@ const u16* GetOverworldTextboxPalettePtr(void) void sub_8098C6C(u8 bg, u16 destOffset, u8 palOffset) { LoadBgTiles(bg, gUnknown_0851021C[gSaveBlock2Ptr->optionsWindowFrameType].tiles, 0x120, destOffset); - LoadPalette(sub_8098758(gSaveBlock2Ptr->optionsWindowFrameType)->pal, palOffset, 0x20); + LoadPalette(GetWindowFrameTilesPal(gSaveBlock2Ptr->optionsWindowFrameType)->pal, palOffset, 0x20); } diff --git a/src/wallclock.c b/src/wallclock.c index ea6137c5d..dbea24b4c 100644 --- a/src/wallclock.c +++ b/src/wallclock.c @@ -578,7 +578,7 @@ static void LoadWallClockGraphics(void) DeactivateAllTextPrinters(); sub_809882C(0, 0x250, 0xd0); clear_scheduled_bg_copies_to_vram(); - remove_some_task(); + ScanlineEffect_Stop(); ResetTasks(); ResetSpriteData(); ResetPaletteFade(); diff --git a/sym_ewram.txt b/sym_ewram.txt index 4af63595e..9d8ce7497 100644 --- a/sym_ewram.txt +++ b/sym_ewram.txt @@ -743,8 +743,9 @@ gUnknown_02039B28: @ 2039B28 gUnknown_02039B44: @ 2039B44 .space 0x4 -gUnknown_02039B48: @ 2039B48 - .space 0x4 + .include "src/option_menu.o" + + .align 2 gUnknown_02039B4C: @ 2039B4C .space 0x4