Merge pull request #164 from DizzyEggg/decompile_option_menu

Decompile option menu
This commit is contained in:
Diegoisawesome 2018-01-21 06:59:13 -06:00 committed by GitHub
commit 0db23bc215
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
53 changed files with 896 additions and 2013 deletions

View File

@ -18852,7 +18852,7 @@ _0810800C:
negs r0, r0 negs r0, r0
cmp r1, r0 cmp r1, r0
bne _08108022 bne _08108022
bl remove_some_task bl ScanlineEffect_Stop
adds r0, r7, 0 adds r0, r7, 0
bl DestroyTask bl DestroyTask
_08108022: _08108022:

View File

@ -9449,7 +9449,7 @@ _08193AA8:
b _08193BC2 b _08193BC2
_08193ABA: _08193ABA:
bl FreeAllWindowBuffers bl FreeAllWindowBuffers
bl remove_some_task bl ScanlineEffect_Stop
ldr r4, =gUnknown_0203CD7C ldr r4, =gUnknown_0203CD7C
ldr r0, [r4] ldr r0, [r4]
bl Free bl Free
@ -9494,7 +9494,7 @@ _08193B20:
cmp r6, 0 cmp r6, 0
bne _08193BC2 bne _08193BC2
bl FreeAllWindowBuffers bl FreeAllWindowBuffers
bl remove_some_task bl ScanlineEffect_Stop
ldr r4, =gUnknown_0203CD7C ldr r4, =gUnknown_0203CD7C
ldr r0, [r4] ldr r0, [r4]
bl Free bl Free
@ -9534,7 +9534,7 @@ _08193B84:
cmp r6, 0 cmp r6, 0
bne _08193BC2 bne _08193BC2
bl FreeAllWindowBuffers bl FreeAllWindowBuffers
bl remove_some_task bl ScanlineEffect_Stop
ldr r4, =gUnknown_0203CD7C ldr r4, =gUnknown_0203CD7C
ldr r0, [r4] ldr r0, [r4]
bl Free bl Free

View File

@ -1034,7 +1034,7 @@ _0813C6FA:
thumb_func_start sub_813C80C thumb_func_start sub_813C80C
sub_813C80C: @ 813C80C sub_813C80C: @ 813C80C
push {lr} push {lr}
bl remove_some_task bl ScanlineEffect_Stop
bl ResetTasks bl ResetTasks
bl ResetSpriteData bl ResetSpriteData
bl ResetPaletteFade bl ResetPaletteFade

View File

@ -119,7 +119,7 @@ _08177D18:
bl clear_scheduled_bg_copies_to_vram bl clear_scheduled_bg_copies_to_vram
b _08177DDC b _08177DDC
_08177D26: _08177D26:
bl remove_some_task bl ScanlineEffect_Stop
b _08177DDC b _08177DDC
_08177D2C: _08177D2C:
bl ResetPaletteFade bl ResetPaletteFade

View File

@ -88,7 +88,7 @@ _0814FD20:
bl SetVBlankCallback bl SetVBlankCallback
movs r0, 0 movs r0, 0
bl sub_8150B6C bl sub_8150B6C
bl remove_some_task bl ScanlineEffect_Stop
movs r3, 0xC0 movs r3, 0xC0
lsls r3, 19 lsls r3, 19
movs r4, 0xC0 movs r4, 0xC0

View File

@ -107,7 +107,7 @@ _0812FE80:
.4byte _0812FF2A .4byte _0812FF2A
.4byte _0812FF54 .4byte _0812FF54
_0812FE94: _0812FE94:
bl remove_some_task bl ScanlineEffect_Stop
movs r0, 0 movs r0, 0
bl SetVBlankCallback bl SetVBlankCallback
bl AllocateMonSpritesGfx bl AllocateMonSpritesGfx

View File

@ -9621,7 +9621,7 @@ _080AFE64:
ldrsh r0, [r4, r3] ldrsh r0, [r4, r3]
cmp r0, 0x1 cmp r0, 0x1
bne _080AFEB4 bne _080AFEB4
bl remove_some_task bl ScanlineEffect_Stop
movs r0, 0x2 movs r0, 0x2
strh r0, [r4] strh r0, [r4]
b _080AFEC6 b _080AFEC6
@ -9714,7 +9714,7 @@ _080AFF28:
ldrsh r0, [r4, r3] ldrsh r0, [r4, r3]
cmp r0, 0x1 cmp r0, 0x1
bne _080AFF78 bne _080AFF78
bl remove_some_task bl ScanlineEffect_Stop
movs r0, 0x2 movs r0, 0x2
strh r0, [r4] strh r0, [r4]
b _080AFF8A b _080AFF8A

View File

@ -184,7 +184,7 @@ _0816CCF4:
movs r0, 0 movs r0, 0
movs r2, 0 movs r2, 0
bl load_copyright_graphics bl load_copyright_graphics
bl remove_some_task bl ScanlineEffect_Stop
bl ResetTasks bl ResetTasks
bl ResetSpriteData bl ResetSpriteData
bl FreeAllSpritePalettes bl FreeAllSpritePalettes

View File

@ -343,7 +343,7 @@ _081AAE34:
bl clear_scheduled_bg_copies_to_vram bl clear_scheduled_bg_copies_to_vram
b _081AB012 b _081AB012
_081AAE3E: _081AAE3E:
bl remove_some_task bl ScanlineEffect_Stop
ldr r1, =gMain ldr r1, =gMain
movs r2, 0x87 movs r2, 0x87
lsls r2, 3 lsls r2, 3

View File

@ -3360,7 +3360,7 @@ c2_800ACD4: @ 800AF30
movs r2, 0x2 movs r2, 0x2
bl FillPalette bl FillPalette
bl ResetTasks bl ResetTasks
bl remove_some_task bl ScanlineEffect_Stop
ldr r1, =gLinkVSyncDisabled ldr r1, =gLinkVSyncDisabled
ldrb r0, [r1] ldrb r0, [r1]
cmp r0, 0 cmp r0, 0
@ -28637,7 +28637,7 @@ _08018482:
bl ResetSpriteData bl ResetSpriteData
bl FreeAllSpritePalettes bl FreeAllSpritePalettes
bl ResetTasks bl ResetTasks
bl remove_some_task bl ScanlineEffect_Stop
movs r0, 0 movs r0, 0
bl ResetBgsAndClearDma3BusyFlags bl ResetBgsAndClearDma3BusyFlags
ldr r1, =gUnknown_082F0598 ldr r1, =gUnknown_082F0598
@ -32620,7 +32620,7 @@ sub_801A43C: @ 801A43C
bl ResetPaletteFade bl ResetPaletteFade
bl ResetSpriteData bl ResetSpriteData
bl ResetTasks bl ResetTasks
bl remove_some_task bl ScanlineEffect_Stop
bl m4aSoundVSyncOn bl m4aSoundVSyncOn
ldr r0, =sub_801A418 ldr r0, =sub_801A418
bl SetVBlankCallback bl SetVBlankCallback
@ -45999,7 +45999,7 @@ _080210A0:
movs r0, 0 movs r0, 0
movs r1, 0 movs r1, 0
bl SetGpuReg bl SetGpuReg
bl remove_some_task bl ScanlineEffect_Stop
bl reset_temp_tile_data_buffers bl reset_temp_tile_data_buffers
b _080212FC b _080212FC
_080210BE: _080210BE:
@ -61951,7 +61951,7 @@ sub_8028FF8: @ 8028FF8
lsls r4, 24 lsls r4, 24
lsrs r4, 24 lsrs r4, 24
adds r0, r4, 0 adds r0, r4, 0
bl sub_8098758 bl GetWindowFrameTilesPal
ldr r1, [r0] ldr r1, [r0]
movs r2, 0x90 movs r2, 0x90
lsls r2, 1 lsls r2, 1
@ -61959,7 +61959,7 @@ sub_8028FF8: @ 8028FF8
movs r3, 0x1 movs r3, 0x1
bl LoadBgTiles bl LoadBgTiles
adds r0, r4, 0 adds r0, r4, 0
bl sub_8098758 bl GetWindowFrameTilesPal
ldr r0, [r0, 0x4] ldr r0, [r0, 0x4]
movs r1, 0xA0 movs r1, 0xA0
movs r2, 0x20 movs r2, 0x20

View File

@ -127,7 +127,7 @@ InitMainMenu: @ 802F6F4
movs r1, 0xF0 movs r1, 0xF0
movs r2, 0x20 movs r2, 0x20
bl LoadPalette bl LoadPalette
bl remove_some_task bl ScanlineEffect_Stop
bl ResetTasks bl ResetTasks
bl ResetSpriteData bl ResetSpriteData
bl FreeAllSpritePalettes bl FreeAllSpritePalettes
@ -1487,7 +1487,7 @@ _08030460:
ldr r0, =gMain ldr r0, =gMain
ldr r1, =CB2_ReinitMainMenu ldr r1, =CB2_ReinitMainMenu
str r1, [r0, 0x8] str r1, [r0, 0x8]
ldr r0, =CB2_OptionsMenu ldr r0, =CB2_InitOptionMenu
b _0803048A b _0803048A
.pool .pool
_08030478: _08030478:
@ -1929,7 +1929,7 @@ task_new_game_prof_birch_speech_1: @ 80307B0
movs r1, 0x1 movs r1, 0x1
movs r2, 0x10 movs r2, 0x10
bl LoadPalette bl LoadPalette
bl remove_some_task bl ScanlineEffect_Stop
bl ResetSpriteData bl ResetSpriteData
bl FreeAllSpritePalettes bl FreeAllSpritePalettes
bl dp13_810BB8C bl dp13_810BB8C
@ -3708,7 +3708,7 @@ new_game_prof_birch_speech_part2_start: @ 8031678
strh r0, [r4, 0x16] strh r0, [r4, 0x16]
ldr r0, =0x0000ffc4 ldr r0, =0x0000ffc4
strh r0, [r4, 0x10] strh r0, [r4, 0x10]
bl remove_some_task bl ScanlineEffect_Stop
bl ResetSpriteData bl ResetSpriteData
bl FreeAllSpritePalettes bl FreeAllSpritePalettes
bl dp13_810BB8C bl dp13_810BB8C
@ -4783,7 +4783,7 @@ LoadMainMenuWindowFrameTiles: @ 80320A4
ldr r0, [r6] ldr r0, [r6]
ldrb r0, [r0, 0x14] ldrb r0, [r0, 0x14]
lsrs r0, 3 lsrs r0, 3
bl sub_8098758 bl GetWindowFrameTilesPal
ldr r1, [r0] ldr r1, [r0]
movs r2, 0x90 movs r2, 0x90
lsls r2, 1 lsls r2, 1
@ -4793,7 +4793,7 @@ LoadMainMenuWindowFrameTiles: @ 80320A4
ldr r0, [r6] ldr r0, [r6]
ldrb r0, [r0, 0x14] ldrb r0, [r0, 0x14]
lsrs r0, 3 lsrs r0, 3
bl sub_8098758 bl GetWindowFrameTilesPal
ldr r0, [r0, 0x4] ldr r0, [r0, 0x4]
movs r1, 0x20 movs r1, 0x20
movs r2, 0x20 movs r2, 0x20

View File

@ -21,7 +21,7 @@ sub_811F918: @ 811F918
ldr r0, [r0] ldr r0, [r0]
ldrb r0, [r0, 0x14] ldrb r0, [r0, 0x14]
lsrs r0, 3 lsrs r0, 3
bl sub_8098758 bl GetWindowFrameTilesPal
ldr r3, =gUnknown_0203A124 ldr r3, =gUnknown_0203A124
ldr r2, [r3] ldr r2, [r3]
ldr r1, [r0] ldr r1, [r0]

File diff suppressed because it is too large Load Diff

View File

@ -4122,7 +4122,7 @@ sub_80867D8: @ 80867D8
movs r0, 0 movs r0, 0
movs r1, 0 movs r1, 0
bl SetGpuReg bl SetGpuReg
bl remove_some_task bl ScanlineEffect_Stop
ldr r2, =0x05000002 ldr r2, =0x05000002
mov r1, sp mov r1, sp
movs r0, 0 movs r0, 0

View File

@ -107,7 +107,7 @@ _081B0290:
b _081B048C b _081B048C
.pool .pool
_081B02AC: _081B02AC:
bl remove_some_task bl ScanlineEffect_Stop
b _081B0484 b _081B0484
_081B02B2: _081B02B2:
bl ResetPaletteFade bl ResetPaletteFade

View File

@ -379,7 +379,7 @@ _080BB582:
b _080BB74C b _080BB74C
.pool .pool
_080BB5FC: _080BB5FC:
bl remove_some_task bl ScanlineEffect_Stop
bl ResetTasks bl ResetTasks
bl ResetSpriteData bl ResetSpriteData
bl ResetPaletteFade bl ResetPaletteFade

View File

@ -2239,7 +2239,7 @@ _081C50E4:
bl clear_scheduled_bg_copies_to_vram bl clear_scheduled_bg_copies_to_vram
b _081C51A2 b _081C51A2
_081C50EE: _081C50EE:
bl remove_some_task bl ScanlineEffect_Stop
b _081C51A2 b _081C51A2
_081C50F4: _081C50F4:
bl FreeAllSpritePalettes bl FreeAllSpritePalettes

View File

@ -7095,7 +7095,7 @@ titlescreen_0: @ 81CA92C
movs r0, 0x44 movs r0, 0x44
movs r1, 0xA0 movs r1, 0xA0
bl SetGpuRegBits bl SetGpuRegBits
bl remove_some_task bl ScanlineEffect_Stop
bl sub_81CAA3C bl sub_81CAA3C
ldr r2, =gUnknown_08620384 ldr r2, =gUnknown_08620384
ldr r0, [r2] ldr r0, [r2]
@ -7122,7 +7122,7 @@ sub_81CA994: @ 81CA994
lsls r1, 6 lsls r1, 6
movs r0, 0 movs r0, 0
bl ClearGpuRegBits bl ClearGpuRegBits
bl remove_some_task bl ScanlineEffect_Stop
ldr r0, =sub_81CA9EC ldr r0, =sub_81CA9EC
bl FindTaskIdByFunc bl FindTaskIdByFunc
lsls r0, 24 lsls r0, 24

View File

@ -45,7 +45,7 @@ sub_81D6774: @ 81D6774
push {lr} push {lr}
bl SetVBlankHBlankCallbacksToNull bl SetVBlankHBlankCallbacksToNull
bl clear_scheduled_bg_copies_to_vram bl clear_scheduled_bg_copies_to_vram
bl remove_some_task bl ScanlineEffect_Stop
bl FreeAllSpritePalettes bl FreeAllSpritePalettes
bl ResetPaletteFade bl ResetPaletteFade
bl ResetSpriteData bl ResetSpriteData
@ -1522,7 +1522,7 @@ _081D73D8:
adds r0, r2 adds r0, r2
ldrh r1, [r4, 0x6] ldrh r1, [r4, 0x6]
strh r1, [r0, 0xE] strh r1, [r0, 0xE]
bl remove_some_task bl ScanlineEffect_Stop
_081D7428: _081D7428:
ldrh r0, [r4] ldrh r0, [r4]
adds r0, 0x1 adds r0, 0x1
@ -1774,7 +1774,7 @@ sub_81D7600: @ 81D7600
bl ChangeBgY bl ChangeBgY
movs r0, 0 movs r0, 0
bl SetVBlankCallback bl SetVBlankCallback
bl remove_some_task bl ScanlineEffect_Stop
bl ResetSpriteData bl ResetSpriteData
bl FreeAllSpritePalettes bl FreeAllSpritePalettes
strh r4, [r5] strh r4, [r5]

View File

@ -887,7 +887,7 @@ _0809EFCA:
movs r1, 0x80 movs r1, 0x80
bl ResetOamRange bl ResetOamRange
bl LoadOam bl LoadOam
bl remove_some_task bl ScanlineEffect_Stop
bl dp12_8087EA4 bl dp12_8087EA4
bl ResetSpriteData bl ResetSpriteData
bl ResetTasks bl ResetTasks

View File

@ -423,7 +423,7 @@ _081405F4:
_08140618: _08140618:
movs r0, 0 movs r0, 0
bl SetVBlankCallback bl SetVBlankCallback
bl remove_some_task bl ScanlineEffect_Stop
bl SetVBlankHBlankCallbacksToNull bl SetVBlankHBlankCallbacksToNull
bl ResetVramOamAndBgCntRegs bl ResetVramOamAndBgCntRegs
bl ResetAllBgsCoordinates bl ResetAllBgsCoordinates

View File

@ -448,7 +448,7 @@ _080DFE20:
ldr r2, =0x01000100 ldr r2, =0x01000100
add r0, sp, 0x8 add r0, sp, 0x8
bl CpuFastSet bl CpuFastSet
bl remove_some_task bl ScanlineEffect_Stop
bl reset_temp_tile_data_buffers bl reset_temp_tile_data_buffers
bl FreeAllSpritePalettes bl FreeAllSpritePalettes
bl ResetPaletteFade bl ResetPaletteFade

View File

@ -653,7 +653,7 @@ _0809FD38:
bl play_some_sound bl play_some_sound
bl RemoveExtraStartMenuWindows bl RemoveExtraStartMenuWindows
bl overworld_free_bg_tilemaps bl overworld_free_bg_tilemaps
ldr r0, =CB2_OptionsMenu ldr r0, =CB2_InitOptionMenu
bl SetMainCallback2 bl SetMainCallback2
ldr r1, =gMain ldr r1, =gMain
ldr r0, =sub_8086194 ldr r0, =sub_8086194
@ -1510,7 +1510,7 @@ _080A0418:
bl SetGpuReg bl SetGpuReg
movs r0, 0 movs r0, 0
bl SetVBlankCallback bl SetVBlankCallback
bl remove_some_task bl ScanlineEffect_Stop
movs r2, 0xA0 movs r2, 0xA0
lsls r2, 19 lsls r2, 19
mov r1, sp mov r1, sp

View File

@ -614,7 +614,7 @@ _080AA8C4:
ldr r0, =gUnknown_08DDE458 ldr r0, =gUnknown_08DDE458
ldr r1, =0x0600d800 ldr r1, =0x0600d800
bl LZ77UnCompVram bl LZ77UnCompVram
bl remove_some_task bl ScanlineEffect_Stop
bl ResetTasks bl ResetTasks
bl ResetSpriteData bl ResetSpriteData
bl FreeAllSpritePalettes bl FreeAllSpritePalettes

View File

@ -1556,7 +1556,7 @@ sub_80C3404: @ 80C3404
sub_80C3414: @ 80C3414 sub_80C3414: @ 80C3414
push {lr} push {lr}
bl ResetTasks bl ResetTasks
bl remove_some_task bl ScanlineEffect_Stop
ldr r0, =sub_80C2760 ldr r0, =sub_80C2760
movs r1, 0 movs r1, 0
bl CreateTask bl CreateTask
@ -3976,7 +3976,7 @@ sub_80C4998: @ 80C4998
bl HideBg bl HideBg
movs r0, 0x3 movs r0, 0x3
bl HideBg bl HideBg
bl remove_some_task bl ScanlineEffect_Stop
bl dp12_8087EA4 bl dp12_8087EA4
movs r1, 0 movs r1, 0
ldr r0, =gUnknown_02038C28 ldr r0, =gUnknown_02038C28
@ -5310,7 +5310,7 @@ _080C54AC:
_080C54D8: _080C54D8:
movs r0, 0 movs r0, 0
bl SetVBlankCallback bl SetVBlankCallback
bl remove_some_task bl ScanlineEffect_Stop
bl SetVBlankHBlankCallbacksToNull bl SetVBlankHBlankCallbacksToNull
movs r0, 0x2 movs r0, 0x2
bl DisableInterrupts bl DisableInterrupts
@ -5594,7 +5594,7 @@ _080C577C:
bl HideBg bl HideBg
movs r0, 0 movs r0, 0
bl SetVBlankCallback bl SetVBlankCallback
bl remove_some_task bl ScanlineEffect_Stop
bl SetVBlankHBlankCallbacksToNull bl SetVBlankHBlankCallbacksToNull
b _080C57E4 b _080C57E4
_080C57A6: _080C57A6:
@ -7189,7 +7189,7 @@ _080C64F0:
_080C6510: _080C6510:
movs r0, 0 movs r0, 0
bl SetVBlankCallback bl SetVBlankCallback
bl remove_some_task bl ScanlineEffect_Stop
bl SetVBlankHBlankCallbacksToNull bl SetVBlankHBlankCallbacksToNull
b _080C6694 b _080C6694
_080C6520: _080C6520:
@ -7400,7 +7400,7 @@ _080C66FC:
_080C6722: _080C6722:
movs r0, 0 movs r0, 0
bl SetVBlankCallback bl SetVBlankCallback
bl remove_some_task bl ScanlineEffect_Stop
bl SetVBlankHBlankCallbacksToNull bl SetVBlankHBlankCallbacksToNull
b _080C67A4 b _080C67A4
_080C6732: _080C6732:

View File

@ -5,8 +5,8 @@
.text .text
thumb_func_start remove_some_task thumb_func_start ScanlineEffect_Stop
remove_some_task: @ 80B9FB8 ScanlineEffect_Stop: @ 80B9FB8
push {r4,lr} push {r4,lr}
ldr r4, =gUnknown_02039B28 ldr r4, =gUnknown_02039B28
movs r0, 0 movs r0, 0
@ -32,7 +32,7 @@ _080B9FE2:
pop {r0} pop {r0}
bx r0 bx r0
.pool .pool
thumb_func_end remove_some_task thumb_func_end ScanlineEffect_Stop
thumb_func_start dp12_8087EA4 thumb_func_start dp12_8087EA4
dp12_8087EA4: @ 80B9FF8 dp12_8087EA4: @ 80B9FF8

View File

@ -5041,7 +5041,7 @@ gUnknown_08DDD704:: @ 8DDD704
.incbin "graphics/unknown/unknown_DDD704.bin" @ textbox tilemap?? .incbin "graphics/unknown/unknown_DDD704.bin" @ textbox tilemap??
.align 2 .align 2
gUnknown_08DDD728:: @ 8DDD728 gMessageBox_Pal:: @ 8DDD728
.incbin "graphics/text_window/message_box.gbapal" .incbin "graphics/text_window/message_box.gbapal"
.align 2 .align 2

View File

@ -1,30 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2, 0
gUnknown_0855C604:: @ 855C604
.incbin "graphics/interface/855C604.gbapal"
.incbin "graphics/interface/855C624.bin"
gUnknown_0855C664:: @ 855C664
.4byte gUnknown_085EE590
.4byte gUnknown_085EE59B
.4byte gUnknown_085EE5A8
.4byte gUnknown_085EE5B5
.4byte gUnknown_085EE5C8
.4byte gUnknown_085EE5BB
.4byte gUnknown_085EE5C1
gUnknown_0855C680:: @ 855C680
window_template 1, 2, 1, 0x1A, 2, 1, 2
window_template 0, 2, 5, 0x1A, 14, 1, 0x36
null_window_template
gUnknown_0855C698:: @ 855C698
.4byte 0x1E5
.4byte 0x11F4
gUnknown_0855C6A0:: @ 855C6A0
.2byte 0x7E51, 0

View File

@ -4379,25 +4379,25 @@ gText_ABtnTitleScreen:: @ 85EE572
gText_Option:: @ 85EE589 gText_Option:: @ 85EE589
.string "OPTION$" .string "OPTION$"
gUnknown_085EE590:: @ 85EE590 gText_TextSpeed:: @ 85EE590
.string "TEXT SPEED$" .string "TEXT SPEED$"
gUnknown_085EE59B:: @ 85EE59B gText_BattleScene:: @ 85EE59B
.string "BATTLE SCENE$" .string "BATTLE SCENE$"
gUnknown_085EE5A8:: @ 85EE5A8 gText_BattleStyle:: @ 85EE5A8
.string "BATTLE STYLE$" .string "BATTLE STYLE$"
gUnknown_085EE5B5:: @ 85EE5B5 gText_Sound:: @ 85EE5B5
.string "SOUND$" .string "SOUND$"
gUnknown_085EE5BB:: @ 85EE5BB gText_Frame:: @ 85EE5BB
.string "FRAME$" .string "FRAME$"
gUnknown_085EE5C1:: @ 85EE5C1 gText_OptionMenuCancel:: @ 85EE5C1
.string "CANCEL$" .string "CANCEL$"
gUnknown_085EE5C8:: @ 85EE5C8 gText_ButtonMode:: @ 85EE5C8
.string "BUTTON MODE$" .string "BUTTON MODE$"
gText_TextSpeedSlow:: @ 85EE5D4 gText_TextSpeedSlow:: @ 85EE5D4

View File

@ -1,196 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2
gTextWindowFrame1_Gfx:: @ 850E87C
.incbin "graphics/text_window/1.4bpp"
.align 2
gTextWindowFrame2_Gfx:: @ 850E99C
.incbin "graphics/text_window/2.4bpp"
.align 2
gTextWindowFrame3_Gfx:: @ 850EABC
.incbin "graphics/text_window/3.4bpp"
.align 2
gTextWindowFrame4_Gfx:: @ 850EBDC
.incbin "graphics/text_window/4.4bpp"
.align 2
gTextWindowFrame5_Gfx:: @ 850ECFC
.incbin "graphics/text_window/5.4bpp"
.align 2
gTextWindowFrame6_Gfx:: @ 850EE1C
.incbin "graphics/text_window/6.4bpp"
.align 2
gTextWindowFrame7_Gfx:: @ 850EF3C
.incbin "graphics/text_window/7.4bpp"
.align 2
gTextWindowFrame8_Gfx:: @ 850F05C
.incbin "graphics/text_window/8.4bpp"
.align 2
gTextWindowFrame9_Gfx:: @ 850F17C
.incbin "graphics/text_window/9.4bpp"
.align 2
gTextWindowFrame10_Gfx:: @ 850F29C
.incbin "graphics/text_window/10.4bpp"
.align 2
gTextWindowFrame11_Gfx:: @ 850F3BC
.incbin "graphics/text_window/11.4bpp"
.align 2
gTextWindowFrame12_Gfx:: @ 850F4DC
.incbin "graphics/text_window/12.4bpp"
.align 2
gTextWindowFrame13_Gfx:: @ 850F5FC
.incbin "graphics/text_window/13.4bpp"
.align 2
gTextWindowFrame14_Gfx:: @ 850F71C
.incbin "graphics/text_window/14.4bpp"
.align 2
gTextWindowFrame15_Gfx:: @ 850F83C
.incbin "graphics/text_window/15.4bpp"
.align 2
gTextWindowFrame16_Gfx:: @ 850F95C
.incbin "graphics/text_window/16.4bpp"
.align 2
gTextWindowFrame17_Gfx:: @ 850FA7C
.incbin "graphics/text_window/17.4bpp"
.align 2
gTextWindowFrame18_Gfx:: @ 850FB9C
.incbin "graphics/text_window/18.4bpp"
.align 2
gTextWindowFrame19_Gfx:: @ 850FCBC
.incbin "graphics/text_window/19.4bpp"
.align 2
gTextWindowFrame20_Gfx:: @ 850FDDC
.incbin "graphics/text_window/20.4bpp"
.align 2
gTextWindowFrame1_Pal:: @ 850FEFC
.incbin "graphics/text_window/1.gbapal"
.align 2
gTextWindowFrame2_Pal:: @ 850FF1C
.incbin "graphics/text_window/2.gbapal"
.align 2
gTextWindowFrame3_Pal:: @ 850FF3C
.incbin "graphics/text_window/3.gbapal"
.align 2
gTextWindowFrame4_Pal:: @ 850FF5C
.incbin "graphics/text_window/4.gbapal"
.align 2
gTextWindowFrame5_Pal:: @ 850FF7C
.incbin "graphics/text_window/5.gbapal"
.align 2
gTextWindowFrame6_Pal:: @ 850FF9C
.incbin "graphics/text_window/6.gbapal"
.align 2
gTextWindowFrame7_Pal:: @ 850FFBC
.incbin "graphics/text_window/7.gbapal"
.align 2
gTextWindowFrame8_Pal:: @ 850FFDC
.incbin "graphics/text_window/8.gbapal"
.align 2
gTextWindowFrame9_Pal:: @ 850FFFC
.incbin "graphics/text_window/9.gbapal"
.align 2
gTextWindowFrame10_Pal:: @ 851001C
.incbin "graphics/text_window/10.gbapal"
.align 2
gTextWindowFrame11_Pal:: @ 851003C
.incbin "graphics/text_window/11.gbapal"
.align 2
gTextWindowFrame12_Pal:: @ 851005C
.incbin "graphics/text_window/12.gbapal"
.align 2
gTextWindowFrame13_Pal:: @ 851007C
.incbin "graphics/text_window/13.gbapal"
.align 2
gTextWindowFrame14_Pal:: @ 851009C
.incbin "graphics/text_window/14.gbapal"
.align 2
gTextWindowFrame15_Pal:: @ 85100BC
.incbin "graphics/text_window/15.gbapal"
.align 2
gTextWindowFrame16_Pal:: @ 85100DC
.incbin "graphics/text_window/16.gbapal"
.align 2
gTextWindowFrame17_Pal:: @ 85100FC
.incbin "graphics/text_window/17.gbapal"
.align 2
gTextWindowFrame18_Pal:: @ 851011C
.incbin "graphics/text_window/18.gbapal"
.align 2
gTextWindowFrame19_Pal:: @ 851013C
.incbin "graphics/text_window/19.gbapal"
.align 2
gTextWindowFrame20_Pal:: @ 851015C
.incbin "graphics/text_window/20.gbapal"
.align 2
gUnknown_0851017C:: @ 851017C
.incbin "graphics/text_window/message_box.gbapal"
.incbin "graphics/text_window/text_pal1.gbapal"
.incbin "graphics/text_window/text_pal2.gbapal"
.incbin "graphics/text_window/text_pal3.gbapal"
.incbin "graphics/text_window/text_pal4.gbapal"
.align 2
gUnknown_0851021C:: @ 851021C
.4byte gTextWindowFrame1_Gfx, gTextWindowFrame1_Pal
.4byte gTextWindowFrame2_Gfx, gTextWindowFrame2_Pal
.4byte gTextWindowFrame3_Gfx, gTextWindowFrame3_Pal
.4byte gTextWindowFrame4_Gfx, gTextWindowFrame4_Pal
.4byte gTextWindowFrame5_Gfx, gTextWindowFrame5_Pal
.4byte gTextWindowFrame6_Gfx, gTextWindowFrame6_Pal
.4byte gTextWindowFrame7_Gfx, gTextWindowFrame7_Pal
.4byte gTextWindowFrame8_Gfx, gTextWindowFrame8_Pal
.4byte gTextWindowFrame9_Gfx, gTextWindowFrame9_Pal
.4byte gTextWindowFrame10_Gfx, gTextWindowFrame10_Pal
.4byte gTextWindowFrame11_Gfx, gTextWindowFrame11_Pal
.4byte gTextWindowFrame12_Gfx, gTextWindowFrame12_Pal
.4byte gTextWindowFrame13_Gfx, gTextWindowFrame13_Pal
.4byte gTextWindowFrame14_Gfx, gTextWindowFrame14_Pal
.4byte gTextWindowFrame15_Gfx, gTextWindowFrame15_Pal
.4byte gTextWindowFrame16_Gfx, gTextWindowFrame16_Pal
.4byte gTextWindowFrame17_Gfx, gTextWindowFrame17_Pal
.4byte gTextWindowFrame18_Gfx, gTextWindowFrame18_Pal
.4byte gTextWindowFrame19_Gfx, gTextWindowFrame19_Pal
.4byte gTextWindowFrame20_Gfx, gTextWindowFrame20_Pal

Binary file not shown.

After

Width:  |  Height:  |  Size: 81 B

View File

@ -0,0 +1,19 @@
JASC-PAL
0100
16
0 0 0
255 255 255
255 180 82
197 123 0
255 139 131
255 49 24
74 74 74
213 213 205
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0
0 0 0

View File

@ -1,6 +1,10 @@
#ifndef GUARD_GRAPHICS_H #ifndef GUARD_GRAPHICS_H
#define GUARD_GRAPHICS_H #define GUARD_GRAPHICS_H
// overworld
extern const u32 gMessageBox_Gfx[];
extern const u16 gMessageBox_Pal[];
// interface pokeballs // interface pokeballs
extern const u8 gInterfaceGfx_PokeBall[]; extern const u8 gInterfaceGfx_PokeBall[];
extern const u8 gInterfacePal_PokeBall[]; extern const u8 gInterfacePal_PokeBall[];

6
include/option_menu.h Normal file
View File

@ -0,0 +1,6 @@
#ifndef GUARD_OPTION_MENU_H
#define GUARD_OPTION_MENU_H
void CB2_InitOptionMenu(void);
#endif // GUARD_OPTION_MENU_H

View File

@ -170,4 +170,29 @@ extern const u8 gText_Peak[];
extern const u8 gText_SafariBallStock[]; extern const u8 gText_SafariBallStock[];
extern const u8 gText_BattlePyramidFloor[]; 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[];
extern const u8 gText_OptionMenu[];
extern const u8 gText_TextSpeed[];
extern const u8 gText_BattleScene[];
extern const u8 gText_BattleStyle[];
extern const u8 gText_Sound[];
extern const u8 gText_Frame[];
extern const u8 gText_OptionMenuCancel[];
extern const u8 gText_ButtonMode[];
#endif //GUARD_STRINGS_H #endif //GUARD_STRINGS_H

View File

@ -1,13 +1,18 @@
#ifndef GUARD_TEXT_WINDOW_H #ifndef GUARD_TEXT_WINDOW_H
#define GUARD_TEXT_WINDOW_H #define GUARD_TEXT_WINDOW_H
#define WINDOW_FRAMES_COUNT 20
struct TilesPal struct TilesPal
{ {
u32 *tiles; const u32 *tiles;
u16 *pal; const u16 *pal;
}; };
const struct TilesPal* sub_8098758(u8 id); extern const u32 gTextWindowFrame1_Gfx[];
extern const u16 gTextWindowFrame1_Pal[];
const struct TilesPal* GetWindowFrameTilesPal(u8 id);
void copy_textbox_border_tile_patterns_to_vram(u8 windowId, u16 destOffset, u8 palOffset); 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_809882C(u8 windowId, u16 destOffset, u8 palOffset);
void sub_80987D4(u8 windowId, u8 frameId, u16 destOffset, u8 palOffset); void sub_80987D4(u8 windowId, u8 frameId, u16 destOffset, u8 palOffset);
@ -15,8 +20,8 @@ void box_border_load_tiles_and_pal(u8 windowId, u16 destOffset, u8 palOffset);
void sub_8098858(u8 windowId, u16 tileNum, u8 palNum); void sub_8098858(u8 windowId, u16 tileNum, u8 palNum);
void sub_80989E0(u8 windowId, u16 tileNum, u8 palNum); void sub_80989E0(u8 windowId, u16 tileNum, u8 palNum);
void rbox_fill_rectangle(u8 windowId); void rbox_fill_rectangle(u8 windowId);
const u16* stdpal_get(u8 id); const u16 *stdpal_get(u8 id);
const u16* GetOverworldTextboxPalettePtr(void); const u16 *GetOverworldTextboxPalettePtr(void);
void sub_8098C6C(u8 bg, u16 destOffset, u8 palOffset); void sub_8098C6C(u8 bg, u16 destOffset, u8 palOffset);
#endif // GUARD_TEXT_WINDOW_H #endif // GUARD_TEXT_WINDOW_H

View File

@ -15,7 +15,7 @@ extern struct UnknownTaskStruct gUnknown_0831AC70;
// Exported RAM declarations // Exported RAM declarations
// Exported ROM declarations // Exported ROM declarations
void remove_some_task(void); void ScanlineEffect_Stop(void);
void sub_80BA038(struct UnknownTaskStruct arg0); void sub_80BA038(struct UnknownTaskStruct arg0);
void sub_80BA0A8(void); void sub_80BA0A8(void);

View File

@ -127,7 +127,7 @@ SECTIONS {
src/wild_encounter.o(.text); src/wild_encounter.o(.text);
asm/field_effect.o(.text); asm/field_effect.o(.text);
asm/unknown_task.o(.text); asm/unknown_task.o(.text);
asm/option_menu.o(.text); src/option_menu.o(.text);
src/pokedex.o(.text); src/pokedex.o(.text);
asm/pokedex.o(.text); asm/pokedex.o(.text);
asm/trainer_card.o(.text); asm/trainer_card.o(.text);
@ -405,7 +405,7 @@ SECTIONS {
data/field_map_obj.o(.rodata); data/field_map_obj.o(.rodata);
data/field_ground_effect.o(.rodata); data/field_ground_effect.o(.rodata);
data/map_obj_8097404.o(.rodata); data/map_obj_8097404.o(.rodata);
data/text_window.o(.rodata); src/text_window.o(.rodata);
src/scrcmd.o(.rodata); src/scrcmd.o(.rodata);
data/coord_event_weather.o(.rodata); data/coord_event_weather.o(.rodata);
data/field_tasks.o(.rodata); data/field_tasks.o(.rodata);
@ -426,7 +426,7 @@ SECTIONS {
src/trainer_see.o(.rodata); src/trainer_see.o(.rodata);
data/wild_encounter.o(.rodata); data/wild_encounter.o(.rodata);
data/field_effect.o(.rodata); data/field_effect.o(.rodata);
data/option_menu.o(.rodata); src/option_menu.o(.rodata);
src/pokedex.o(.rodata); src/pokedex.o(.rodata);
data/pokedex.o(.rodata); data/pokedex.o(.rodata);
data/trainer_card.o(.rodata); data/trainer_card.o(.rodata);

View File

@ -141,7 +141,7 @@ void InitBerryFixProgram(void)
SetVBlankCallback(NULL); SetVBlankCallback(NULL);
ResetSpriteData(); ResetSpriteData();
ResetTasks(); ResetTasks();
remove_some_task(); ScanlineEffect_Stop();
SetGpuReg(REG_OFFSET_DISPCNT, 0x0000); SetGpuReg(REG_OFFSET_DISPCNT, 0x0000);
berry_fix_mb_manager = AllocZeroed(0x50); berry_fix_mb_manager = AllocZeroed(0x50);
berry_fix_mb_manager->state = 0; berry_fix_mb_manager->state = 0;

View File

@ -72,7 +72,7 @@ void CB2_ShowDiploma(void)
DmaFill16(3, 0, VRAM, VRAM_SIZE); DmaFill16(3, 0, VRAM, VRAM_SIZE);
DmaFill32(3, 0, OAM, OAM_SIZE); DmaFill32(3, 0, OAM, OAM_SIZE);
DmaFill16(3, 0, PLTT, PLTT_SIZE); DmaFill16(3, 0, PLTT, PLTT_SIZE);
remove_some_task(); ScanlineEffect_Stop();
ResetTasks(); ResetTasks();
ResetSpriteData(); ResetSpriteData();
ResetPaletteFade(); ResetPaletteFade();

View File

@ -66,7 +66,7 @@ extern void overworld_free_bg_tilemaps(void);
extern void sub_80AF168(void); extern void sub_80AF168(void);
extern void AllocateMonSpritesGfx(void); extern void AllocateMonSpritesGfx(void);
extern void FreeMonSpritesGfx(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 reset_temp_tile_data_buffers(void);
extern void c2_exit_to_overworld_2_switch(void); extern void c2_exit_to_overworld_2_switch(void);
extern void play_some_sound(void); extern void play_some_sound(void);
@ -512,7 +512,7 @@ static void CB2_EggHatch_0(void)
FreeAllSpritePalettes(); FreeAllSpritePalettes();
ResetSpriteData(); ResetSpriteData();
ResetTasks(); ResetTasks();
remove_some_task(); ScanlineEffect_Stop();
m4aSoundVSyncOn(); m4aSoundVSyncOn();
gMain.state++; gMain.state++;
break; break;

View File

@ -269,7 +269,7 @@ void EvolutionScene(struct Pokemon* mon, u16 speciesToEvolve, bool8 canStopEvo,
sub_80356D0(); sub_80356D0();
LoadBattleTextboxAndBackground(); LoadBattleTextboxAndBackground();
ResetSpriteData(); ResetSpriteData();
remove_some_task(); ScanlineEffect_Stop();
ResetTasks(); ResetTasks();
FreeAllSpritePalettes(); FreeAllSpritePalettes();

View File

@ -1302,7 +1302,7 @@ static void ClearVramOamPltt_LoadHofPal(void)
static void sub_8174F70(void) static void sub_8174F70(void)
{ {
remove_some_task(); ScanlineEffect_Stop();
ResetTasks(); ResetTasks();
ResetSpriteData(); ResetSpriteData();
reset_temp_tile_data_buffers(); reset_temp_tile_data_buffers();

View File

@ -305,7 +305,7 @@ static bool8 MailReadBuildGraphics(void)
{ {
case 0: case 0:
SetVBlankCallback(NULL); SetVBlankCallback(NULL);
remove_some_task(); ScanlineEffect_Stop();
SetGpuReg(REG_OFFSET_DISPCNT, 0x0000); SetGpuReg(REG_OFFSET_DISPCNT, 0x0000);
break; break;
case 1: case 1:

View File

@ -29,7 +29,7 @@ extern void MapMusicMain(void);
extern void EnableInterrupts(u16); extern void EnableInterrupts(u16);
extern void sub_8033648(void); extern void sub_8033648(void);
extern u16 SetFlashTimerIntr(u8 timerNum, void (**intrFunc)(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 struct SoundInfo gSoundInfo;
extern u32 gFlashMemoryPresent; extern u32 gFlashMemoryPresent;
@ -425,7 +425,7 @@ void DoSoftReset(void)
{ {
REG_IME = 0; REG_IME = 0;
m4aSoundVSyncOff(); m4aSoundVSyncOff();
remove_some_task(); ScanlineEffect_Stop();
DmaStop(1); DmaStop(1);
DmaStop(2); DmaStop(2);
DmaStop(3); DmaStop(3);

662
src/option_menu.c Normal file
View File

@ -0,0 +1,662 @@
#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
static const u16 sUnknown_0855C604[] = INCBIN_U16("graphics/misc/option_menu_text.gbapal");
// note: this is only used in the Japanese release
static const u8 sEqualSignGfx[] = INCBIN_U8("graphics/misc/option_menu_equals_sign.4bpp");
static const u8 *const sOptionMenuItemsNames[MENUITEM_COUNT] =
{
gText_TextSpeed,
gText_BattleScene,
gText_BattleStyle,
gText_Sound,
gText_ButtonMode,
gText_Frame,
gText_OptionMenuCancel,
};
static const struct WindowTemplate sOptionMenuWinTemplates[] =
{
{1, 2, 1, 0x1A, 2, 1, 2},
{0, 2, 5, 0x1A, 0xE, 1, 0x36},
DUMMY_WIN_TEMPLATE
};
static const struct BgTemplate sOptionMenuBgTemplates[] =
{
{
.bg = 1,
.charBaseIndex = 1,
.mapBaseIndex = 30,
.screenSize = 0,
.paletteMode = 0,
.priority = 0,
.baseTile = 0
},
{
.bg = 0,
.charBaseIndex = 1,
.mapBaseIndex = 31,
.screenSize = 0,
.paletteMode = 0,
.priority = 1,
.baseTile = 0
}
};
static const u16 sUnknown_0855C6A0[] = {0x7E51};
// 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, sOptionMenuBgTemplates, ARRAY_COUNT(sOptionMenuBgTemplates));
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(sOptionMenuWinTemplates);
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(sUnknown_0855C6A0, 0, sizeof(sUnknown_0855C6A0));
LoadPalette(GetWindowFrameTilesPal(gSaveBlock2Ptr->optionsWindowFrameType)->pal, 0x70, 0x20);
gMain.state++;
break;
case 5:
LoadPalette(sUnknown_0855C604, 0x10, sizeof(sUnknown_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]);
}
static u8 FrameType_ProcessInput(u8 selection)
{
if (gMain.newKeys & DPAD_RIGHT)
{
if (selection < WINDOW_FRAMES_COUNT - 1)
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 = WINDOW_FRAMES_COUNT - 1;
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, xLR;
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;
xLR = (widthNormal - widthLR - widthLA) / 2 + 104;
DrawOptionMenuChoice(gText_ButtonTypeLR, xLR, 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, sOptionMenuItemsNames[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);
}

View File

@ -419,7 +419,7 @@ static bool8 InitPokeblockMenu(void)
gMain.state++; gMain.state++;
break; break;
case 1: case 1:
remove_some_task(); ScanlineEffect_Stop();
gMain.state++; gMain.state++;
break; break;
case 2: case 2:

View File

@ -75,7 +75,7 @@ extern u8 sub_81221AC();
extern void SetVBlankHBlankCallbacksToNull(); extern void SetVBlankHBlankCallbacksToNull();
extern void ResetVramOamAndBgCntRegs(); extern void ResetVramOamAndBgCntRegs();
extern void clear_scheduled_bg_copies_to_vram(); extern void clear_scheduled_bg_copies_to_vram();
extern void remove_some_task(); extern void ScanlineEffect_Stop();
extern void ResetBgsAndClearDma3BusyFlags(u32 leftoverFireRedLeafGreenVariable); extern void ResetBgsAndClearDma3BusyFlags(u32 leftoverFireRedLeafGreenVariable);
extern void ShowBg(u8 a); extern void ShowBg(u8 a);
extern void SetGpuReg(u8 regOffset, u16 value); extern void SetGpuReg(u8 regOffset, u16 value);
@ -455,7 +455,7 @@ bool8 sub_81BFB10(void)
gMain.state++; gMain.state++;
break; break;
case 1: case 1:
remove_some_task(); ScanlineEffect_Stop();
gMain.state++; gMain.state++;
break; break;
case 2: case 2:

View File

@ -9,6 +9,7 @@
#include "menu.h" #include "menu.h"
#include "save.h" #include "save.h"
#include "gba/flash_internal.h" #include "gba/flash_internal.h"
#include "text_window.h"
#define MSG_WIN_TOP 12 #define MSG_WIN_TOP 12
#define CLOCK_WIN_TOP (MSG_WIN_TOP - 4) #define CLOCK_WIN_TOP (MSG_WIN_TOP - 4)
@ -21,9 +22,7 @@ extern const u8 gBirchHelpGfx[];
extern const u8 gBirchBagTilemap[]; extern const u8 gBirchBagTilemap[];
extern const u8 gBirchGrassTilemap[]; extern const u8 gBirchGrassTilemap[];
extern const u16 gBirchBagGrassPal[]; extern const u16 gBirchBagGrassPal[];
extern const u16 gTextWindowFrame1_Pal[];
extern const u16 gUnknown_0860F074[]; extern const u16 gUnknown_0860F074[];
extern const u32 gTextWindowFrame1_Gfx[];
extern struct SaveSection gSaveDataBuffer; extern struct SaveSection gSaveDataBuffer;
extern u8 gText_SaveFailedCheckingBackup[]; extern u8 gText_SaveFailedCheckingBackup[];

View File

@ -53,7 +53,7 @@ extern const u8 gUnknown_085B1E0C[];
extern const u8 gUnknown_085B1E28[][2]; extern const u8 gUnknown_085B1E28[][2];
extern void sub_809882C(u8, u16, u8); 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 clear_scheduled_bg_copies_to_vram(void);
extern void dp13_810BB8C(void); extern void dp13_810BB8C(void);
extern void do_scheduled_bg_tilemap_copies_to_vram(void); extern void do_scheduled_bg_tilemap_copies_to_vram(void);
@ -134,7 +134,7 @@ void CB2_ChooseStarter(void)
DeactivateAllTextPrinters(); DeactivateAllTextPrinters();
sub_809882C(0, 0x2A8, 0xD0); sub_809882C(0, 0x2A8, 0xD0);
clear_scheduled_bg_copies_to_vram(); clear_scheduled_bg_copies_to_vram();
remove_some_task(); ScanlineEffect_Stop();
ResetTasks(); ResetTasks();
ResetSpriteData(); ResetSpriteData();
ResetPaletteFade(); ResetPaletteFade();

View File

@ -3,21 +3,92 @@
#include "text_window.h" #include "text_window.h"
#include "window.h" #include "window.h"
#include "palette.h" #include "palette.h"
#include "bg.h"
#include "graphics.h"
extern u8 LoadBgTiles(u8 bg, const void *src, u16 size, u16 destOffset); // const rom data
extern void FillBgTilemapBufferRect(u8 bg, u16 tileNum, u8 x, u8 y, u8 width, u8 height, u8 palette); const u32 gTextWindowFrame1_Gfx[] = INCBIN_U32("graphics/text_window/1.4bpp");
static const u32 sTextWindowFrame2_Gfx[] = INCBIN_U32("graphics/text_window/2.4bpp");
static const u32 sTextWindowFrame3_Gfx[] = INCBIN_U32("graphics/text_window/3.4bpp");
static const u32 sTextWindowFrame4_Gfx[] = INCBIN_U32("graphics/text_window/4.4bpp");
static const u32 sTextWindowFrame5_Gfx[] = INCBIN_U32("graphics/text_window/5.4bpp");
static const u32 sTextWindowFrame6_Gfx[] = INCBIN_U32("graphics/text_window/6.4bpp");
static const u32 sTextWindowFrame7_Gfx[] = INCBIN_U32("graphics/text_window/7.4bpp");
static const u32 sTextWindowFrame8_Gfx[] = INCBIN_U32("graphics/text_window/8.4bpp");
static const u32 sTextWindowFrame9_Gfx[] = INCBIN_U32("graphics/text_window/9.4bpp");
static const u32 sTextWindowFrame10_Gfx[] = INCBIN_U32("graphics/text_window/10.4bpp");
static const u32 sTextWindowFrame11_Gfx[] = INCBIN_U32("graphics/text_window/11.4bpp");
static const u32 sTextWindowFrame12_Gfx[] = INCBIN_U32("graphics/text_window/12.4bpp");
static const u32 sTextWindowFrame13_Gfx[] = INCBIN_U32("graphics/text_window/13.4bpp");
static const u32 sTextWindowFrame14_Gfx[] = INCBIN_U32("graphics/text_window/14.4bpp");
static const u32 sTextWindowFrame15_Gfx[] = INCBIN_U32("graphics/text_window/15.4bpp");
static const u32 sTextWindowFrame16_Gfx[] = INCBIN_U32("graphics/text_window/16.4bpp");
static const u32 sTextWindowFrame17_Gfx[] = INCBIN_U32("graphics/text_window/17.4bpp");
static const u32 sTextWindowFrame18_Gfx[] = INCBIN_U32("graphics/text_window/18.4bpp");
static const u32 sTextWindowFrame19_Gfx[] = INCBIN_U32("graphics/text_window/19.4bpp");
static const u32 sTextWindowFrame20_Gfx[] = INCBIN_U32("graphics/text_window/20.4bpp");
extern const struct TilesPal gUnknown_0851021C[]; const u16 gTextWindowFrame1_Pal[] = INCBIN_U16("graphics/text_window/1.gbapal");
extern const u32 gMessageBox_Gfx[]; static const u16 sTextWindowFrame2_Pal[] = INCBIN_U16("graphics/text_window/2.gbapal");
extern const u16 gUnknown_0851017C[]; static const u16 sTextWindowFrame3_Pal[] = INCBIN_U16("graphics/text_window/3.gbapal");
extern const u16 gUnknown_08DDD728[]; static const u16 sTextWindowFrame4_Pal[] = INCBIN_U16("graphics/text_window/4.gbapal");
static const u16 sTextWindowFrame5_Pal[] = INCBIN_U16("graphics/text_window/5.gbapal");
static const u16 sTextWindowFrame6_Pal[] = INCBIN_U16("graphics/text_window/6.gbapal");
static const u16 sTextWindowFrame7_Pal[] = INCBIN_U16("graphics/text_window/7.gbapal");
static const u16 sTextWindowFrame8_Pal[] = INCBIN_U16("graphics/text_window/8.gbapal");
static const u16 sTextWindowFrame9_Pal[] = INCBIN_U16("graphics/text_window/9.gbapal");
static const u16 sTextWindowFrame10_Pal[] = INCBIN_U16("graphics/text_window/10.gbapal");
static const u16 sTextWindowFrame11_Pal[] = INCBIN_U16("graphics/text_window/11.gbapal");
static const u16 sTextWindowFrame12_Pal[] = INCBIN_U16("graphics/text_window/12.gbapal");
static const u16 sTextWindowFrame13_Pal[] = INCBIN_U16("graphics/text_window/13.gbapal");
static const u16 sTextWindowFrame14_Pal[] = INCBIN_U16("graphics/text_window/14.gbapal");
static const u16 sTextWindowFrame15_Pal[] = INCBIN_U16("graphics/text_window/15.gbapal");
static const u16 sTextWindowFrame16_Pal[] = INCBIN_U16("graphics/text_window/16.gbapal");
static const u16 sTextWindowFrame17_Pal[] = INCBIN_U16("graphics/text_window/17.gbapal");
static const u16 sTextWindowFrame18_Pal[] = INCBIN_U16("graphics/text_window/18.gbapal");
static const u16 sTextWindowFrame19_Pal[] = INCBIN_U16("graphics/text_window/19.gbapal");
static const u16 sTextWindowFrame20_Pal[] = INCBIN_U16("graphics/text_window/20.gbapal");
const struct TilesPal* sub_8098758(u8 id) static const u16 sUnknown_0851017C[][16] =
{ {
if (id > 19) INCBIN_U16("graphics/text_window/message_box.gbapal"),
return &gUnknown_0851021C[0]; INCBIN_U16("graphics/text_window/text_pal1.gbapal"),
INCBIN_U16("graphics/text_window/text_pal2.gbapal"),
INCBIN_U16("graphics/text_window/text_pal3.gbapal"),
INCBIN_U16("graphics/text_window/text_pal4.gbapal")
};
static const struct TilesPal sWindowFrames[WINDOW_FRAMES_COUNT] =
{
{gTextWindowFrame1_Gfx, gTextWindowFrame1_Pal},
{sTextWindowFrame2_Gfx, sTextWindowFrame2_Pal},
{sTextWindowFrame3_Gfx, sTextWindowFrame3_Pal},
{sTextWindowFrame4_Gfx, sTextWindowFrame4_Pal},
{sTextWindowFrame5_Gfx, sTextWindowFrame5_Pal},
{sTextWindowFrame6_Gfx, sTextWindowFrame6_Pal},
{sTextWindowFrame7_Gfx, sTextWindowFrame7_Pal},
{sTextWindowFrame8_Gfx, sTextWindowFrame8_Pal},
{sTextWindowFrame9_Gfx, sTextWindowFrame9_Pal},
{sTextWindowFrame10_Gfx, sTextWindowFrame10_Pal},
{sTextWindowFrame11_Gfx, sTextWindowFrame11_Pal},
{sTextWindowFrame12_Gfx, sTextWindowFrame12_Pal},
{sTextWindowFrame13_Gfx, sTextWindowFrame13_Pal},
{sTextWindowFrame14_Gfx, sTextWindowFrame14_Pal},
{sTextWindowFrame15_Gfx, sTextWindowFrame15_Pal},
{sTextWindowFrame16_Gfx, sTextWindowFrame16_Pal},
{sTextWindowFrame17_Gfx, sTextWindowFrame17_Pal},
{sTextWindowFrame18_Gfx, sTextWindowFrame18_Pal},
{sTextWindowFrame19_Gfx, sTextWindowFrame19_Pal},
{sTextWindowFrame20_Gfx, sTextWindowFrame20_Pal}
};
// code
const struct TilesPal *GetWindowFrameTilesPal(u8 id)
{
if (id >= WINDOW_FRAMES_COUNT)
return &sWindowFrames[0];
else else
return &gUnknown_0851021C[id]; return &sWindowFrames[id];
} }
void copy_textbox_border_tile_patterns_to_vram(u8 windowId, u16 destOffset, u8 palOffset) void copy_textbox_border_tile_patterns_to_vram(u8 windowId, u16 destOffset, u8 palOffset)
@ -33,8 +104,8 @@ void box_border_load_tiles_and_pal(u8 windowId, u16 destOffset, u8 palOffset)
void sub_80987D4(u8 windowId, u8 frameId, u16 destOffset, u8 palOffset) void sub_80987D4(u8 windowId, u8 frameId, u16 destOffset, u8 palOffset)
{ {
LoadBgTiles(GetWindowAttribute(windowId, WINDOW_PRIORITY), gUnknown_0851021C[frameId].tiles, 0x120, destOffset); LoadBgTiles(GetWindowAttribute(windowId, WINDOW_PRIORITY), sWindowFrames[frameId].tiles, 0x120, destOffset);
LoadPalette(gUnknown_0851021C[frameId].pal, palOffset, 0x20); LoadPalette(sWindowFrames[frameId].pal, palOffset, 0x20);
} }
void sub_809882C(u8 windowId, u16 destOffset, u8 palOffset) void sub_809882C(u8 windowId, u16 destOffset, u8 palOffset)
@ -89,7 +160,7 @@ void rbox_fill_rectangle(u8 windowId)
FillBgTilemapBufferRect(bgLayer, 0, tilemapLeft - 1, tilemapTop - 1, width + 2, height + 2, 0x11); FillBgTilemapBufferRect(bgLayer, 0, tilemapLeft - 1, tilemapTop - 1, width + 2, height + 2, 0x11);
} }
const u16* stdpal_get(u8 id) const u16 *stdpal_get(u8 id)
{ {
switch (id) switch (id)
{ {
@ -110,16 +181,17 @@ const u16* stdpal_get(u8 id)
id = 0x40; id = 0x40;
break; break;
} }
return &gUnknown_0851017C[id];
return (const u16 *)(sUnknown_0851017C) + id;
} }
const u16* GetOverworldTextboxPalettePtr(void) const u16 *GetOverworldTextboxPalettePtr(void)
{ {
return gUnknown_08DDD728; return gMessageBox_Pal;
} }
void sub_8098C6C(u8 bg, u16 destOffset, u8 palOffset) void sub_8098C6C(u8 bg, u16 destOffset, u8 palOffset)
{ {
LoadBgTiles(bg, gUnknown_0851021C[gSaveBlock2Ptr->optionsWindowFrameType].tiles, 0x120, destOffset); LoadBgTiles(bg, sWindowFrames[gSaveBlock2Ptr->optionsWindowFrameType].tiles, 0x120, destOffset);
LoadPalette(sub_8098758(gSaveBlock2Ptr->optionsWindowFrameType)->pal, palOffset, 0x20); LoadPalette(GetWindowFrameTilesPal(gSaveBlock2Ptr->optionsWindowFrameType)->pal, palOffset, 0x20);
} }

View File

@ -578,7 +578,7 @@ static void LoadWallClockGraphics(void)
DeactivateAllTextPrinters(); DeactivateAllTextPrinters();
sub_809882C(0, 0x250, 0xd0); sub_809882C(0, 0x250, 0xd0);
clear_scheduled_bg_copies_to_vram(); clear_scheduled_bg_copies_to_vram();
remove_some_task(); ScanlineEffect_Stop();
ResetTasks(); ResetTasks();
ResetSpriteData(); ResetSpriteData();
ResetPaletteFade(); ResetPaletteFade();

View File

@ -743,8 +743,9 @@ gUnknown_02039B28: @ 2039B28
gUnknown_02039B44: @ 2039B44 gUnknown_02039B44: @ 2039B44
.space 0x4 .space 0x4
gUnknown_02039B48: @ 2039B48 .include "src/option_menu.o"
.space 0x4
.align 2
gUnknown_02039B4C: @ 2039B4C gUnknown_02039B4C: @ 2039B4C
.space 0x4 .space 0x4