This commit is contained in:
KDSKardabox 2018-02-16 09:29:11 +05:30
commit ffeca135bc
91 changed files with 3746 additions and 7331 deletions

View File

@ -6481,7 +6481,7 @@ _0819218E:
mov r0, r9
cmp r0, 0
bne _081921C4
ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music
ldr r0, =CB2_ReturnToFieldContinueScript
bl SetMainCallback2
b _081921FC
.pool
@ -9539,7 +9539,7 @@ _08193B84:
ldr r0, [r4]
bl Free
str r6, [r4]
ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music
ldr r0, =CB2_ReturnToFieldContinueScript
bl SetMainCallback2
ldr r1, =gTasks
lsls r0, r5, 2
@ -11320,7 +11320,7 @@ _08194B24:
ands r0, r1
cmp r0, 0
bne _08194B3C
ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music
ldr r0, =CB2_ReturnToFieldContinueScript
bl SetMainCallback2
adds r0, r4, 0
bl DestroyTask
@ -14665,7 +14665,7 @@ sub_819672C: @ 819672C
ldrh r2, [r0, 0xA]
ldrh r1, [r0, 0xC]
adds r0, r2, 0
bl get_mapheader_by_bank_and_number
bl Overworld_GetMapHeaderByGroupAndId
ldrb r0, [r0, 0x14]
pop {r1}
bx r1

View File

@ -18683,7 +18683,7 @@ _081A4294:
adds r0, r3, r4
ldrh r1, [r0]
movs r0, 0x20
bl sav12_xor_set
bl SetGameStat
ldr r1, [r7]
adds r0, r1, r6
adds r0, r4
@ -31002,7 +31002,7 @@ sub_81AA810: @ 81AA810
ldrb r1, [r3]
adds r1, 0x2C
movs r0, 0x19
bl get_mapheader_by_bank_and_number
bl Overworld_GetMapHeaderByGroupAndId
adds r5, r0, 0
movs r7, 0
ldr r1, [r5, 0x4]

View File

@ -45,13 +45,13 @@ _0813BFCA:
bge _0813BFCA
movs r0, 0x17
movs r1, 0
bl sav12_xor_set
bl SetGameStat
movs r0, 0x18
movs r1, 0
bl sav12_xor_set
bl SetGameStat
movs r0, 0x19
movs r1, 0
bl sav12_xor_set
bl SetGameStat
pop {r4,r5}
pop {r0}
bx r0
@ -855,7 +855,7 @@ sub_813C664: @ 813C664
ands r0, r1
cmp r0, 0
bne _0813C694
ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music
ldr r0, =CB2_ReturnToFieldContinueScript
bl SetMainCallback2
ldr r0, =gUnknown_0203AB78
ldr r0, [r0]

View File

@ -3172,7 +3172,7 @@ _08163A3C:
_08163A74:
bl sub_816537C
_08163A78:
ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music
ldr r0, =CB2_ReturnToFieldContinueScript
bl SetMainCallback2
add sp, 0x4
pop {r4-r6}

View File

@ -777,7 +777,7 @@ _08150340:
bl warp_in
ldr r0, =gFieldCallback
str r4, [r0]
ldr r0, =c2_load_new_map
ldr r0, =CB2_LoadMap
bl SetMainCallback2
add sp, 0x8
pop {r3}

View File

@ -736,7 +736,7 @@ _080B2984:
.pool
_080B2994:
bl GetLinkPlayerCount_2
ldr r4, =gUnknown_03005DB8
ldr r4, =gFieldLinkPlayerCount
strb r0, [r4]
bl GetMultiplayerId
ldr r1, =gUnknown_03005DB4
@ -826,7 +826,7 @@ _080B2A4E:
.pool
_080B2A6C:
bl GetLinkPlayerCount_2
ldr r4, =gUnknown_03005DB8
ldr r4, =gFieldLinkPlayerCount
strb r0, [r4]
bl GetMultiplayerId
ldr r1, =gUnknown_03005DB4
@ -2132,12 +2132,12 @@ _080B35E0:
ldrb r0, [r0]
cmp r0, 0
bne _080B35FE
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
bl SetMainCallback2
b _080B35FE
.pool
_080B35F8:
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
bl SetMainCallback2
_080B35FE:
bl RunTasks
@ -2156,7 +2156,7 @@ sub_80B360C: @ 80B360C
negs r1, r1
ands r0, r1
str r0, [r2]
bl call_ResetMapMusic
bl Overworld_ResetMapMusic
bl copy_player_party_from_sav1
bl copy_bags_and_unk_data_to_save_blocks
bl sub_813BF10
@ -2586,7 +2586,7 @@ sp02A_crash_sound: @ 80B39BC
push {lr}
ldr r0, =gSpecialVar_0x8006
ldrb r0, [r0]
ldr r1, =c2_exit_to_overworld_1_continue_scripts_restart_music
ldr r1, =CB2_ReturnToFieldContinueScript
bl sub_80C4E74
pop {r0}
bx r0

View File

@ -5588,7 +5588,7 @@ sub_80DA830: @ 80DA830
bl FreeAllWindowBuffers
bl sub_80D7A5C
bl FreeMonSpritesGfx
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
bl SetMainCallback2
_080DA860:
pop {r0}

View File

@ -1825,7 +1825,7 @@ _080F6884:
adds r0, r5, 0
bl DestroyTask
bl FreeAllWindowBuffers
ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music
ldr r0, =CB2_ReturnToFieldContinueScript
bl SetMainCallback2
bl sub_80F7E64
_080F68A8:

View File

@ -5,8 +5,8 @@
.text
thumb_func_start sub_809BEDC
sub_809BEDC: @ 809BEDC
thumb_func_start FieldClearPlayerInput
FieldClearPlayerInput: @ 809BEDC
push {r4,r5,lr}
movs r1, 0x2
negs r1, r1
@ -29,11 +29,11 @@ sub_809BEDC: @ 809BEDC
pop {r4,r5}
pop {r0}
bx r0
thumb_func_end sub_809BEDC
thumb_func_end FieldClearPlayerInput
thumb_func_start process_overworld_input
@ void process_overworld_input(overworld_input_data *input_data, char buttons_new, char buttons_held)
process_overworld_input: @ 809BF08
thumb_func_start FieldGetPlayerInput
@ void FieldGetPlayerInput(overworld_input_data *input_data, char buttons_new, char buttons_held)
FieldGetPlayerInput: @ 809BF08
push {r4-r7,lr}
mov r7, r9
mov r6, r8
@ -176,7 +176,7 @@ _0809C006:
pop {r4-r7}
pop {r0}
bx r0
thumb_func_end process_overworld_input
thumb_func_end FieldGetPlayerInput
thumb_func_start sub_809C014
@ int sub_809C014(overworld_input_data *input_data)
@ -2006,7 +2006,7 @@ _0809CF20:
bl sub_8084D5C
ldrb r0, [r5, 0x7]
ldrb r1, [r5, 0x6]
bl get_mapheader_by_bank_and_number
bl Overworld_GetMapHeaderByGroupAndId
ldr r1, [r0, 0x4]
ldrb r0, [r5, 0x5]
ldr r1, [r1, 0x8]

View File

@ -1943,7 +1943,7 @@ _080B69D4:
thumb_func_start sub_80B69DC
sub_80B69DC: @ 80B69DC
push {lr}
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
bl SetMainCallback2
ldr r1, =gFieldCallback
ldr r0, =mapldr_080842E8
@ -2008,9 +2008,9 @@ _080B6A64:
lsls r0, 24
cmp r0, 0
bne _080B6A8A
bl flag_var_implications_of_teleport_
bl Overworld_ResetStateAfterFly
bl warp_in
ldr r0, =c2_load_new_map
ldr r0, =CB2_LoadMap
bl SetMainCallback2
ldr r1, =gFieldCallback
ldr r0, =mapldr_08084390
@ -2764,7 +2764,7 @@ sub_80B7060: @ 80B7060
ldr r1, =gFieldCallback
ldr r0, =sub_80B70B4
str r0, [r1]
ldr r0, =c2_load_new_map
ldr r0, =CB2_LoadMap
bl SetMainCallback2
ldr r0, =sub_80B6E88
bl FindTaskIdByFunc
@ -3730,7 +3730,7 @@ sub_80B7814: @ 80B7814
ldr r1, =gFieldCallback
ldr r0, =mapldr_080851BC
str r0, [r1]
ldr r0, =c2_load_new_map
ldr r0, =CB2_LoadMap
bl SetMainCallback2
ldr r0, =sub_80B75F0
bl FindTaskIdByFunc
@ -4205,7 +4205,7 @@ sub_80B7BF4: @ 80B7BF4
ldr r1, =gFieldCallback
ldr r0, =sub_80B6B68
str r0, [r1]
ldr r0, =c2_load_new_map
ldr r0, =CB2_LoadMap
bl SetMainCallback2
ldr r0, =sub_80B7A8C
bl FindTaskIdByFunc
@ -4402,7 +4402,7 @@ _080B7D86:
ldr r1, =gFieldCallback
ldr r0, =mapldr_080859D4
str r0, [r1]
ldr r0, =c2_load_new_map
ldr r0, =CB2_LoadMap
bl SetMainCallback2
ldr r0, =sub_80B7CE4
bl FindTaskIdByFunc
@ -4881,9 +4881,9 @@ _080B81B8:
lsrs r0, 24
cmp r0, 0x1
bne _080B81E6
bl copy_saved_warp3_bank_and_enter_x_to_warp1
bl Overworld_SetWarpDestToLastHealLoc
bl warp_in
ldr r0, =c2_load_new_map
ldr r0, =CB2_LoadMap
bl SetMainCallback2
ldr r1, =gFieldCallback
ldr r0, =mapldr_08085D88
@ -5211,7 +5211,7 @@ _080B8484:
thumb_func_start sub_80B849C
sub_80B849C: @ 80B849C
push {r4,lr}
bl sav1_map_get_light_level
bl Overworld_GetMapTypeOfSaveblockLocation
lsls r0, 24
lsrs r0, 24
bl is_light_level_1_2_3_5_or_6

View File

@ -1884,8 +1884,8 @@ _080ABEF4:
.pool
thumb_func_end sub_80ABE18
thumb_func_start sub_80ABF00
sub_80ABF00: @ 80ABF00
thumb_func_start ApplyWeatherGammaShiftToPal
ApplyWeatherGammaShiftToPal: @ 80ABF00
push {lr}
lsls r0, 24
lsrs r0, 24
@ -1900,7 +1900,7 @@ sub_80ABF00: @ 80ABF00
pop {r0}
bx r0
.pool
thumb_func_end sub_80ABF00
thumb_func_end ApplyWeatherGammaShiftToPal
thumb_func_start sub_80ABF20
sub_80ABF20: @ 80ABF20
@ -7855,7 +7855,7 @@ pal_fill_for_maplights: @ 80AF040
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
bl sav1_map_get_light_level
bl Overworld_GetMapTypeOfSaveblockLocation
adds r1, r0, 0
lsls r1, 24
lsrs r1, 24
@ -7910,7 +7910,7 @@ pal_fill_black: @ 80AF0A0
thumb_func_start sub_80AF0B4
sub_80AF0B4: @ 80AF0B4
push {r4,lr}
bl sav1_map_get_light_level
bl Overworld_GetMapTypeOfSaveblockLocation
adds r4, r0, 0
lsls r4, 24
lsrs r4, 24
@ -9015,7 +9015,7 @@ _080AF9D0:
cmp r0, 0
bne _080AF9E8
bl warp_in
ldr r0, =c2_load_new_map
ldr r0, =CB2_LoadMap
bl SetMainCallback2
adds r0, r5, 0
bl DestroyTask
@ -9087,7 +9087,7 @@ _080AFA64:
b _080AFA7C
_080AFA6C:
bl warp_in
ldr r0, =c2_load_new_map
ldr r0, =CB2_LoadMap
bl SetMainCallback2
adds r0, r6, 0
bl DestroyTask
@ -10060,7 +10060,7 @@ _080B0222:
b _080B023A
_080B022A:
bl warp_in
ldr r0, =c2_load_new_map
ldr r0, =CB2_LoadMap
bl SetMainCallback2
adds r0, r5, 0
bl DestroyTask
@ -10478,7 +10478,7 @@ sub_80B058C: @ 80B058C
thumb_func_start sub_80B05B4
sub_80B05B4: @ 80B05B4
push {lr}
bl sub_80859B0
bl Overworld_FadeOutMapMusic
ldr r0, =task50_0807F0C8
movs r1, 0x50
bl CreateTask

View File

@ -20,7 +20,7 @@ Special_ShowDiploma: @ 8137CB4
Special_ViewWallClock: @ 8137CC8
push {lr}
ldr r0, =gMain
ldr r1, =c2_exit_to_overworld_2_switch
ldr r1, =CB2_ReturnToField
str r1, [r0, 0x8]
ldr r0, =Cb2_ViewWallClock
bl SetMainCallback2
@ -1906,7 +1906,7 @@ _08138C7E:
thumb_func_start CB2_FieldShowRegionMap
CB2_FieldShowRegionMap: @ 8138C84
push {lr}
ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music
ldr r0, =CB2_ReturnToFieldContinueScript
bl sub_817018C
pop {r0}
bx r0
@ -7153,14 +7153,14 @@ sub_813B7D8: @ 813B7D8
ldrh r0, [r0]
cmp r0, 0
bne _0813B7F8
ldr r2, =c2_exit_to_overworld_1_continue_scripts_restart_music
ldr r2, =CB2_ReturnToFieldContinueScript
movs r0, 0
movs r1, 0x1
bl DoRayquazaScene
b _0813B802
.pool
_0813B7F8:
ldr r2, =c2_exit_to_overworld_1_continue_scripts_restart_music
ldr r2, =CB2_ReturnToFieldContinueScript
movs r0, 0x1
movs r1, 0
bl DoRayquazaScene

View File

@ -88,7 +88,7 @@ sub_809D908: @ 809D908
bl sub_809D8B8
adds r0, r4, 0x2
adds r1, r4, 0x4
bl wild_encounter_related
bl UpdateAmbientCry
_0809D930:
pop {r4}
pop {r0}
@ -96,8 +96,8 @@ _0809D930:
.pool
thumb_func_end sub_809D908
thumb_func_start overworld_ensure_per_step_coros_running
overworld_ensure_per_step_coros_running: @ 809D93C
thumb_func_start SetUpFieldTasks
SetUpFieldTasks: @ 809D93C
push {r4,r5,lr}
ldr r5, =task_per_step_callback_manager
adds r0, r5, 0
@ -142,7 +142,7 @@ _0809D992:
pop {r0}
bx r0
.pool
thumb_func_end overworld_ensure_per_step_coros_running
thumb_func_end SetUpFieldTasks
thumb_func_start ActivatePerStepCallback
ActivatePerStepCallback: @ 809D9A8
@ -182,8 +182,8 @@ _0809D9EA:
bx r0
thumb_func_end ActivatePerStepCallback
thumb_func_start wild_encounter_reset_coro_args
wild_encounter_reset_coro_args: @ 809D9F0
thumb_func_start ResetFieldTasksArgs
ResetFieldTasksArgs: @ 809D9F0
push {lr}
ldr r0, =task_per_step_callback_manager
bl FindTaskIdByFunc
@ -207,7 +207,7 @@ _0809DA1A:
pop {r0}
bx r0
.pool
thumb_func_end wild_encounter_reset_coro_args
thumb_func_end ResetFieldTasksArgs
thumb_func_start nullsub_34
nullsub_34: @ 809DA2C

View File

@ -11,7 +11,7 @@ mapconnection_get_mapheader: @ 8087D44
ldrb r2, [r0, 0x8]
ldrb r1, [r0, 0x9]
adds r0, r2, 0
bl get_mapheader_by_bank_and_number
bl Overworld_GetMapHeaderByGroupAndId
pop {r1}
bx r1
thumb_func_end mapconnection_get_mapheader

View File

@ -217,7 +217,7 @@ sub_8137304: @ 8137304
bl get_map_light_from_warp0
lsls r0, 24
lsrs r6, r0, 24
bl sav1_map_get_light_level
bl Overworld_GetMapTypeOfSaveblockLocation
lsls r0, 24
lsrs r5, r0, 24
movs r3, 0

View File

@ -713,7 +713,7 @@ _08160CD8:
b _08160E8A
_08160CE6:
bl sub_8160EA0
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
bl SetMainCallback2
b _08160E8A
.pool

View File

@ -9,14 +9,14 @@
sub_80D47D4: @ 80D47D4
push {lr}
bl sub_80A0934
bl AddMapNamePopUpWindowTask
bl ShowMapNamePopup
movs r0, 0x1
pop {r1}
bx r1
thumb_func_end sub_80D47D4
thumb_func_start AddMapNamePopUpWindowTask
AddMapNamePopUpWindowTask: @ 80D47E4
thumb_func_start ShowMapNamePopup
ShowMapNamePopup: @ 80D47E4
push {r4,lr}
movs r0, 0x80
lsls r0, 7
@ -83,7 +83,7 @@ _080D486C:
pop {r0}
bx r0
.pool
thumb_func_end AddMapNamePopUpWindowTask
thumb_func_end ShowMapNamePopup
thumb_func_start Task_MapNamePopUpWindow
Task_MapNamePopUpWindow: @ 80D487C

File diff suppressed because it is too large Load Diff

View File

@ -10032,7 +10032,7 @@ _081B557C:
asrs r1, 24
lsls r1, 16
lsrs r1, 16
bl get_mapheader_by_bank_and_number
bl Overworld_GetMapHeaderByGroupAndId
adds r1, r0, 0
ldr r0, =gStringVar1
ldrb r1, [r1, 0x14]
@ -10057,7 +10057,7 @@ _081B55B8:
asrs r1, 24
lsls r1, 16
lsrs r1, 16
bl get_mapheader_by_bank_and_number
bl Overworld_GetMapHeaderByGroupAndId
adds r1, r0, 0
ldr r0, =gStringVar1
ldrb r1, [r1, 0x14]
@ -10083,7 +10083,7 @@ _081B5614:
.pool
_081B5624:
ldr r1, =gUnknown_0203CEC8
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
_081B5628:
str r0, [r1]
adds r0, r6, 0
@ -10189,7 +10189,7 @@ _081B56F8:
b _081B572A
_081B56FE:
ldr r1, =gUnknown_0203CEC8
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
str r0, [r1]
adds r0, r4, 0
bl sub_81B12C0
@ -10408,7 +10408,7 @@ sub_81B58A8: @ 81B58A8
str r0, [sp]
ldr r0, =sub_81B1370
str r0, [sp, 0x4]
ldr r0, =sub_8086194
ldr r0, =CB2_ReturnToFieldWithOpenMenu
str r0, [sp, 0x8]
movs r0, 0
movs r1, 0
@ -14836,7 +14836,7 @@ CB2_PartyMenuFromStartMenu: @ 81B7F34
str r0, [sp]
ldr r0, =sub_81B1370
str r0, [sp, 0x4]
ldr r0, =sub_8086194
ldr r0, =CB2_ReturnToFieldWithOpenMenu
str r0, [sp, 0x8]
movs r0, 0
movs r1, 0
@ -16021,7 +16021,7 @@ sub_81B892C: @ 81B892C
str r0, [sp]
ldr r0, =sub_81B1370
str r0, [sp, 0x4]
ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music
ldr r0, =CB2_ReturnToFieldContinueScript
str r0, [sp, 0x8]
movs r0, 0
movs r1, 0
@ -16042,7 +16042,7 @@ sub_81B8958: @ 81B8958
str r0, [sp]
ldr r0, =sub_81B1370
str r0, [sp, 0x4]
ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music
ldr r0, =CB2_ReturnToFieldContinueScript
str r0, [sp, 0x8]
movs r0, 0xB
movs r1, 0
@ -17283,7 +17283,7 @@ sub_81B9354: @ 81B9354
str r1, [sp]
ldr r1, =sub_81B1370
str r1, [sp, 0x4]
ldr r1, =c2_exit_to_overworld_2_switch
ldr r1, =CB2_ReturnToField
str r1, [sp, 0x8]
movs r1, 0
movs r2, 0xB
@ -17311,7 +17311,7 @@ _081B93A6:
ldr r0, =gUnknown_03005DB0
ldr r1, =hm_add_c3_without_phase_2
str r1, [r0]
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
bl SetMainCallback2
pop {r4}
pop {r0}
@ -17420,7 +17420,7 @@ _081B9486:
ldr r1, =gUnknown_03005DB0
ldr r0, =hm_add_c3_without_phase_2
str r0, [r1]
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
bl SetMainCallback2
pop {r0}
bx r0
@ -17556,7 +17556,7 @@ _081B95BA:
ldr r0, =gUnknown_03005DB0
ldr r1, =hm_add_c3_without_phase_2
str r1, [r0]
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
bl SetMainCallback2
pop {r4,r5}
pop {r0}
@ -17660,7 +17660,7 @@ sub_81B968C: @ 81B968C
subs r3, 0x1
lsls r3, 24
lsrs r3, 24
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
str r0, [sp]
movs r0, 0x3
bl sub_81BF8EC

View File

@ -586,7 +586,7 @@ sub_816B31C: @ 816B31C
ldr r0, =gFieldCallback
ldr r1, =mapldr_080EBC0C
str r1, [r0]
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
bl SetMainCallback2
pop {r0}
bx r0
@ -1279,7 +1279,7 @@ sub_816B900: @ 816B900
ldr r0, =gFieldCallback
ldr r1, =pal_fill_for_maplights_or_black
str r1, [r0]
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
bl SetMainCallback2
pop {r0}
bx r0
@ -1538,7 +1538,7 @@ sub_816BB28: @ 816BB28
ldr r0, =gFieldCallback
ldr r1, =sub_816BB48
str r1, [r0]
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
bl SetMainCallback2
pop {r0}
bx r0

View File

@ -1244,7 +1244,7 @@ _080BBE18:
bl sub_80BC890
adds r0, r6, 0
bl DestroyTask
ldr r0, =sub_8086194
ldr r0, =CB2_ReturnToFieldWithOpenMenu
bl SetMainCallback2
ldr r0, =gMPlayInfo_BGM
ldr r1, =0x0000ffff

View File

@ -308,7 +308,7 @@ _0813CCB8:
ldr r1, [r5]
ldrb r0, [r1, 0x10]
ldrb r1, [r1, 0x11]
bl get_mapheader_by_bank_and_number
bl Overworld_GetMapHeaderByGroupAndId
ldr r1, [r5]
ldrb r0, [r0, 0x14]
strh r0, [r1, 0x12]
@ -360,7 +360,7 @@ sub_813CD04: @ 813CD04
strb r3, [r1, 0x11]
adds r0, r5, 0
adds r1, r3, 0
bl get_mapheader_by_bank_and_number
bl Overworld_GetMapHeaderByGroupAndId
ldrb r0, [r0, 0x14]
bl CorrectSpecialMapSecId
ldr r2, [r4]
@ -496,7 +496,7 @@ sub_813CE34: @ 813CE34
lsrs r0, 24
lsls r1, 24
lsrs r1, 24
bl get_mapheader_by_bank_and_number
bl Overworld_GetMapHeaderByGroupAndId
ldrb r0, [r0, 0x14]
pop {r1}
bx r1

View File

@ -657,7 +657,7 @@ sub_80C7678: @ 80C7678
ldr r1, =gFieldCallback
ldr r0, =mapldr_0808C6D8
str r0, [r1]
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
bl SetMainCallback2
pop {r0}
bx r0

View File

@ -2024,7 +2024,7 @@ sub_81C4EEC: @ 81C4EEC
thumb_func_start sub_81C4EFC
sub_81C4EFC: @ 81C4EFC
push {lr}
ldr r1, =sub_8086194
ldr r1, =CB2_ReturnToFieldWithOpenMenu
movs r0, 0
bl sub_81C4F98
pop {r0}
@ -2073,7 +2073,7 @@ sub_81C4F44: @ 81C4F44
ldr r0, =gUnknown_03005DB0
ldr r1, =hm_add_c3_without_phase_2
str r1, [r0]
ldr r1, =c2_exit_to_overworld_2_switch
ldr r1, =CB2_ReturnToField
movs r0, 0x3
bl sub_81C4F98
adds r0, r4, 0

View File

@ -14,7 +14,7 @@ CB2_PokeNav: @ 81C7250
str r0, [r4]
cmp r0, 0
bne _081C7270
ldr r0, =sub_8086194
ldr r0, =CB2_ReturnToFieldWithOpenMenu
bl SetMainCallback2
b _081C7292
.pool
@ -66,7 +66,7 @@ sub_81C72BC: @ 81C72BC
str r0, [r4]
cmp r0, 0
bne _081C72F0
ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music
ldr r0, =CB2_ReturnToFieldContinueScript
bl SetMainCallback2
b _081C7320
.pool
@ -351,12 +351,12 @@ _081C752C:
bl sub_81C7334
cmp r4, 0
beq _081C755C
ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music
ldr r0, =CB2_ReturnToFieldContinueScript
bl SetMainCallback2
b _081C7562
.pool
_081C755C:
ldr r0, =sub_8086194
ldr r0, =CB2_ReturnToFieldWithOpenMenu
bl SetMainCallback2
_081C7562:
pop {r4-r7}
@ -8095,7 +8095,7 @@ sub_81CB0C8: @ 81CB0C8
ldrh r2, [r0, 0xA]
ldrh r1, [r0, 0xC]
adds r0, r2, 0
bl get_mapheader_by_bank_and_number
bl Overworld_GetMapHeaderByGroupAndId
ldrb r0, [r0, 0x14]
pop {r1}
bx r1
@ -30295,7 +30295,7 @@ sub_81D6120: @ 81D6120
push {lr}
movs r0, 0x1A
movs r1, 0x40
bl get_mapheader_by_bank_and_number
bl Overworld_GetMapHeaderByGroupAndId
ldr r0, [r0, 0x4]
ldr r0, [r0, 0x8]
adds r0, 0x8
@ -30334,7 +30334,7 @@ _081D6162:
adds r0, r1
ldrh r1, [r0]
movs r0, 0x1A
bl get_mapheader_by_bank_and_number
bl Overworld_GetMapHeaderByGroupAndId
ldr r0, [r0, 0x4]
ldr r0, [r0, 0x8]
_081D6176:

View File

@ -44,7 +44,7 @@ _0813776C:
ldrb r0, [r2, 0x11]
orrs r1, r0
movs r0, 0x1
bl sav12_xor_set
bl SetGameStat
_0813778E:
bl sub_8076D48
ldr r0, =gSaveBlock2Ptr

View File

@ -376,7 +376,7 @@ _0813574C:
thumb_func_start hm2_dig
hm2_dig: @ 8135760
push {lr}
bl flagmods_08054D70
bl Overworld_ResetStateAfterDigEscRope
movs r0, 0x26
bl FieldEffectStart
bl GetCursorSelectionMonId

View File

@ -3116,7 +3116,7 @@ _08014070:
movs r0, 0x6
strb r0, [r1, 0x1]
ldr r1, =gMain
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
str r0, [r1, 0x8]
ldr r0, =sub_807AE50
bl SetMainCallback2
@ -3258,7 +3258,7 @@ _080141D4:
eors r0, r1
lsls r0, 24
lsrs r0, 24
ldr r1, =c2_exit_to_overworld_2_switch
ldr r1, =CB2_ReturnToField
bl sub_80C4E74
_080141F2:
bl RunTasks
@ -3399,7 +3399,7 @@ sub_8014304: @ 8014304
ldr r0, =0x00004087
bl VarSet
bl GetLinkPlayerCount
ldr r1, =gUnknown_03005DB8
ldr r1, =gFieldLinkPlayerCount
strb r0, [r1]
bl GetMultiplayerId
ldr r1, =gUnknown_03005DB4
@ -3757,7 +3757,7 @@ _08014714:
bl GetCursorSelectionMonId
lsls r0, 24
lsrs r0, 24
ldr r1, =c2_load_new_map
ldr r1, =CB2_LoadMap
bl sub_802A9A8
b _08014764
.pool
@ -3766,7 +3766,7 @@ _08014734:
movs r1, 0x9
movs r2, 0x1
bl sub_8014290
ldr r0, =c2_load_new_map
ldr r0, =CB2_LoadMap
bl sub_8020C70
b _08014764
.pool
@ -3778,7 +3778,7 @@ _0801474C:
bl GetCursorSelectionMonId
lsls r0, 24
lsrs r0, 24
ldr r1, =c2_load_new_map
ldr r1, =CB2_LoadMap
bl sub_802493C
_08014764:
adds r0, r4, 0
@ -6931,7 +6931,7 @@ _08016502:
ldr r1, =gFieldCallback
ldr r0, =sub_80AF128
str r0, [r1]
ldr r1, =c2_exit_to_overworld_2_switch
ldr r1, =CB2_ReturnToField
movs r0, 0x8
bl sub_81B8904
b _08016878
@ -7229,7 +7229,7 @@ _0801677E:
ldr r1, =gFieldCallback
ldr r0, =sub_80AF128
str r0, [r1]
ldr r1, =c2_exit_to_overworld_2_switch
ldr r1, =CB2_ReturnToField
movs r0, 0x9
bl sub_81B8904
adds r0, r6, 0
@ -14941,7 +14941,7 @@ _0801A58C:
ldr r0, =gUnknown_03000DAC
ldr r0, [r0]
bl Free
ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music
ldr r0, =CB2_ReturnToFieldContinueScript
bl SetMainCallback2
pop {r4}
pop {r0}
@ -16076,7 +16076,7 @@ _0801AF58:
bl sub_801ABDC
cmp r0, 0
beq _0801AFAE
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
bl SetMainCallback2
b _0801AFAE
.pool
@ -16102,7 +16102,7 @@ _0801AF98:
bl sub_801ABDC
cmp r0, 0
beq _0801AFAE
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
bl SetMainCallback2
_0801AFAE:
bl RunTasks
@ -23568,7 +23568,7 @@ _0801EBA8:
bne _0801EBC2
bl sub_801F544
bl sub_801DE30
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
bl SetMainCallback2
_0801EBC2:
add sp, 0x4
@ -27694,7 +27694,7 @@ _08020C26:
str r0, [r5]
adds r0, r4, 0
bl SetMainCallback2
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
cmp r4, r0
bne _08020C5A
ldr r2, =gTextFlags
@ -27705,8 +27705,8 @@ _08020C26:
movs r0, 0xC8
lsls r0, 1
bl PlayNewMapMusic
ldr r0, =c1_overworld
bl set_callback1
ldr r0, =CB1_Overworld
bl SetMainCallback1
_08020C5A:
movs r0, 0
_08020C5C:

View File

@ -915,8 +915,8 @@ _080FBECA:
bx r0
thumb_func_end RotatingGatePuzzleCameraUpdate
thumb_func_start sub_80FBED0
sub_80FBED0: @ 80FBED0
thumb_func_start RotatingGate_InitPuzzleAndGraphics
RotatingGate_InitPuzzleAndGraphics: @ 80FBED0
push {lr}
bl GetCurrentMapRotatingGatePuzzleType
cmp r0, 0
@ -929,7 +929,7 @@ sub_80FBED0: @ 80FBED0
_080FBEEA:
pop {r0}
bx r0
thumb_func_end sub_80FBED0
thumb_func_end RotatingGate_InitPuzzleAndGraphics
thumb_func_start CheckForRotatingGatePuzzleCollision
CheckForRotatingGatePuzzleCollision: @ 80FBEF0

View File

@ -2570,7 +2570,7 @@ sub_8141800: @ 8141800
movs r0, 0x1E
ldrsh r1, [r4, r0]
movs r0, 0x1D
bl sav12_xor_set
bl SetGameStat
_08141848:
ldr r1, =sub_8141A18
ldr r2, =0x0000ffff
@ -3276,7 +3276,7 @@ sub_8141E7C: @ 8141E7C
ldr r1, =gFieldCallback
ldr r0, =sub_80AF168
str r0, [r1]
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
bl SetMainCallback2
adds r0, r5, 0
bl DestroyTask

View File

@ -390,7 +390,7 @@ _080F8AB6:
thumb_func_start sub_80F8ACC
sub_80F8ACC: @ 80F8ACC
push {lr}
ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music
ldr r0, =CB2_ReturnToFieldContinueScript
bl SetMainCallback2
pop {r0}
bx r0
@ -1559,7 +1559,7 @@ _080F9478:
movs r0, 0x1
strh r0, [r1]
_080F947E:
ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music
ldr r0, =CB2_ReturnToFieldContinueScript
bl SetMainCallback2
pop {r0}
bx r0
@ -1599,7 +1599,7 @@ _080F94D0:
movs r0, 0x1
strh r0, [r1]
_080F94D6:
ldr r0, =c2_exit_to_overworld_1_continue_scripts_restart_music
ldr r0, =CB2_ReturnToFieldContinueScript
bl SetMainCallback2
pop {r0}
bx r0

View File

@ -230,7 +230,7 @@ CB2_ExitSellMenu: @ 80DFC48
ldr r0, =gFieldCallback
ldr r1, =MapPostLoadHook_ExitBuyOrSellMenu
str r1, [r0]
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
bl SetMainCallback2
pop {r0}
bx r0
@ -2706,7 +2706,7 @@ Task_ExitBuyMenu: @ 80E11B0
bne _080E11D6
bl RemoveMoneyLabelObject
bl BuyMenuFreeMemory
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
bl SetMainCallback2
adds r0, r4, 0
bl DestroyTask

View File

@ -591,7 +591,7 @@ StartMenu_PlayerName: @ 809FC8C
cmp r0, 0
beq _0809FCC8
_0809FCB6:
ldr r0, =sub_8086194
ldr r0, =CB2_ReturnToFieldWithOpenMenu
bl sub_80C4DDC
b _0809FCEA
.pool
@ -601,12 +601,12 @@ _0809FCC8:
lsls r0, 24
cmp r0, 0
beq _0809FCE4
ldr r0, =sub_8086194
ldr r0, =CB2_ReturnToFieldWithOpenMenu
bl sub_80C51C4
b _0809FCEA
.pool
_0809FCE4:
ldr r0, =sub_8086194
ldr r0, =CB2_ReturnToFieldWithOpenMenu
bl sub_80C4DDC
_0809FCEA:
movs r0, 0x1
@ -656,7 +656,7 @@ _0809FD38:
ldr r0, =CB2_InitOptionMenu
bl SetMainCallback2
ldr r1, =gMain
ldr r0, =sub_8086194
ldr r0, =CB2_ReturnToFieldWithOpenMenu
str r0, [r1, 0x8]
movs r0, 0x1
_0809FD52:
@ -703,7 +703,7 @@ _0809FDA0:
bl overworld_free_bg_tilemaps
ldr r0, =gUnknown_03005DB4
ldrb r0, [r0]
ldr r1, =sub_8086194
ldr r1, =CB2_ReturnToFieldWithOpenMenu
bl sub_80C4E74
movs r0, 0x1
_0809FDB4:

View File

@ -10669,7 +10669,7 @@ _0807CF5C:
bl Free
str r4, [r7]
_0807CFAA:
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
bl SetMainCallback2
bl sub_807E784
_0807CFB4:
@ -12774,7 +12774,7 @@ _0807E3A8:
bl Free
str r4, [r7]
_0807E3F6:
ldr r0, =c2_exit_to_overworld_2_switch
ldr r0, =CB2_ReturnToField
bl SetMainCallback2
bl sub_807E784
_0807E400:

View File

@ -8,7 +8,6 @@
.include "asm/macros.inc"
.include "asm/macros/event.inc"
.include "constants/constants.inc"
.section script_data, "aw", %progbits
@ -1287,12 +1286,12 @@ EverGrandeCity_HallOfFame_EventScript_271851:: @ 8271851
setvar VAR_0x40D3, 1
return
EverGrandeCity_HallOfFame_EventScript_271857:: @ 8271857
EventScript_WhiteOut:: @ 8271857
call EverGrandeCity_HallOfFame_EventScript_2718CC
goto EverGrandeCity_HallOfFame_EventScript_271862
goto EventScript_271862
end
EverGrandeCity_HallOfFame_EventScript_271862:: @ 8271862
EventScript_271862:: @ 8271862
compare VAR_0x4096, 1
goto_eq EverGrandeCity_HallOfFame_EventScript_271884
compare VAR_0x4096, 2

View File

@ -483,7 +483,7 @@ gUnknown_0854FE64:: @ 854FE64
.2byte 0x00c8, 0x0048, 0x0040, 0x0038, 0x0030, 0x0028, 0x0020, 0x0018, 0x0000, 0x0000
.align 2
gUnknown_0854FE78:: @ 854FE78
gMaxFlashLevel:: @ 854FE78
.4byte 0x00000008
.align 2

View File

@ -8,7 +8,7 @@
.align 2
gUnknown_085920D8:: @ 85920D8
.4byte sub_81B617C
.4byte c2_exit_to_overworld_2_switch
.4byte CB2_ReturnToField
.4byte NULL
.align 2

View File

@ -1,52 +0,0 @@
.include "asm/macros.inc"
.include "constants/constants.inc"
.section .rodata
.align 2, 0
gUnknown_08339D3C:: @ 8339D3C
.4byte 0xFFFFFF, 0xFFFFFFFF, 0x4B0, 0xE10, 0x4B0, 0x960, 0x32, 0x50, 0xFFFFFFD4, 0x2C
gUnknown_08339D64:: @ 8339D64
.4byte 0, 0
.4byte 0, 1
.4byte 0, -1
.4byte -1, 0
.4byte 1, 0
.4byte -1, 1
.4byte 1, 1
.4byte -1, -1
.4byte 1, -1
gUnknown_08339DAC:: @ 8339DAC
.4byte 0x1F8
.4byte 0x11D1
.4byte 0x21C2
.4byte 0x31E3
gUnknown_08339DBC:: @ 8339DBC
.4byte REG_WIN0H
.4byte 0xa2600001
.byte 1, 0
.align 2
gUnknown_08339DC8:: @ 8339DC8
.4byte sub_80879D8
.4byte sub_80879F8
.4byte sub_80879FC
gUnknown_08339DD4:: @ 8339DD4
.4byte sub_8087A1C
.4byte sub_8087A20
.4byte sub_8087A20
.4byte sub_8087A20
.4byte sub_8087A20
.4byte sub_8087A1C
.4byte sub_8087A1C
.4byte sub_8087A88
.4byte sub_8087A88
.4byte sub_8087A88
.4byte sub_8087A88
gUnknown_08339E00:: @ 8339E00
.4byte sub_8087AA0
.4byte sub_8087AA8

View File

@ -916,21 +916,21 @@ RecordCorner_EventScript_277471:: @ 8277471
releaseall
end
gUnknown_0827747E:: @ 827747E
EventScript_TradeRoom_ReadTrainerCard1:: @ 827747E
msgbox Text_278452, 4
fadescreen 1
special sp02A_crash_sound
waitstate
end
gUnknown_0827748D:: @ 827748D
EventScript_TradeRoom_ReadTrainerCard2:: @ 827748D
msgbox Text_27847B, 4
fadescreen 1
special sp02A_crash_sound
waitstate
end
gUnknown_0827749C:: @ 827749C
EventScript_TradeRoom_TooBusyToNotice:: @ 827749C
msgbox Text_27842E, 4
closemessage
end
@ -983,7 +983,7 @@ gUnknown_08277509:: @ 8277509
special sub_80B371C
end
gUnknown_08277513:: @ 8277513
EventScript_277513:: @ 8277513
special sub_80B36EC
special sub_80AF9F8
waitstate

View File

@ -28,7 +28,7 @@ BattleFrontier_BattlePyramidEmptySquare_EventScript_252A77:: @ 8252A77
end
BattleFrontier_BattlePyramidEmptySquare_EventScript_252A8F:: @ 8252A8F
special AddMapNamePopUpWindowTask
special ShowMapNamePopup
setvar VAR_0x400F, 0
end

View File

@ -64,7 +64,7 @@ BattleFrontier_BattlePyramidTop_EventScript_255180:: @ 8255180
end
BattleFrontier_BattlePyramidTop_EventScript_25518A:: @ 825518A
special AddMapNamePopUpWindowTask
special ShowMapNamePopup
setvar VAR_0x400F, 0
end

View File

@ -12,7 +12,7 @@ FortreeCity_Gym_MapScript2_2165BA: @ 82165BA
.2byte 0
FortreeCity_Gym_EventScript_2165C4:: @ 82165C4
special sub_80FBED0
special RotatingGate_InitPuzzleAndGraphics
end
FortreeCity_Gym_EventScript_2165C8:: @ 82165C8

View File

@ -12,7 +12,7 @@ Route110_TrickHousePuzzle6_MapScript2_26DDB6: @ 826DDB6
.2byte 0
Route110_TrickHousePuzzle6_EventScript_26DDC0:: @ 826DDC0
special sub_80FBED0
special RotatingGate_InitPuzzleAndGraphics
end
Route110_TrickHousePuzzle6_EventScript_26DDC4:: @ 826DDC4

View File

@ -18,7 +18,7 @@ Route119_EventScript_1F4439:: @ 81F4439
Route119_MapScript1_1F444D: @ 81F444D
call Route119_EventScript_271ED7
call Route119_EventScript_271EFB
compare VAR_0x40B3, 1
compare VAR_WEATHER_INSTITUTE_STATE, 1
call_if 1, Route119_EventScript_1F4466
special SetRoute119Weather
end
@ -26,7 +26,7 @@ Route119_MapScript1_1F444D: @ 81F444D
Route119_EventScript_1F4466:: @ 81F4466
setflag FLAG_0x37D
clearflag FLAG_0x37C
setvar VAR_0x40B3, 2
setvar VAR_WEATHER_INSTITUTE_STATE, 2
return
Route119_EventScript_1F4472:: @ 81F4472

View File

@ -3,7 +3,7 @@ Route119_WeatherInstitute_1F_MapScripts:: @ 826FA86
.byte 0
Route119_WeatherInstitute_1F_MapScript1_26FA8C: @ 826FA8C
compare VAR_0x40B3, 0
compare VAR_WEATHER_INSTITUTE_STATE, 0
call_if 1, Route119_WeatherInstitute_1F_EventScript_26FA98
end
@ -16,7 +16,7 @@ Route119_WeatherInstitute_1F_EventScript_26FAA4:: @ 826FAA4
lock
faceplayer
special GetPlayerBigGuyGirlString
compare VAR_0x40B3, 0
compare VAR_WEATHER_INSTITUTE_STATE, 0
goto_eq Route119_WeatherInstitute_1F_EventScript_26FABE
msgbox Route119_WeatherInstitute_1F_Text_26FCE5, 4
release

View File

@ -3,9 +3,9 @@ Route119_WeatherInstitute_2F_MapScripts:: @ 826FF1E
.byte 0
Route119_WeatherInstitute_2F_MapScript1_26FF24: @ 826FF24
compare VAR_0x40B3, 0
compare VAR_WEATHER_INSTITUTE_STATE, 0
call_if 1, Route119_WeatherInstitute_2F_EventScript_26FF44
compare VAR_0x40B3, 1
compare VAR_WEATHER_INSTITUTE_STATE, 1
call_if 1, Route119_WeatherInstitute_2F_EventScript_26FF50
checkflag FLAG_SYS_GAME_CLEAR
call_if 1, Route119_WeatherInstitute_2F_EventScript_26FF5C
@ -62,7 +62,7 @@ Route119_WeatherInstitute_2F_EventScript_26FFC8:: @ 826FFC8
waitmovement 0
msgbox Route119_WeatherInstitute_2F_Text_2705DD, 4
closemessage
setvar VAR_0x40B3, 1
setvar VAR_WEATHER_INSTITUTE_STATE, 1
clearflag FLAG_0x37D
fadedefaultbgm
fadescreen 1

View File

@ -213,7 +213,7 @@ gSpecials:: @ 81DBA64
def_special sub_80F972C
def_special sp0C8_whiteout_maybe
def_special sub_80FBE90
def_special sub_80FBED0
def_special RotatingGate_InitPuzzleAndGraphics
def_special SetSSTidalFlag
def_special ResetSSTidalFlag
def_special EnterSafariMode
@ -417,8 +417,8 @@ gSpecials:: @ 81DBA64
def_special sub_813B880
def_special sub_81A085C
def_special ShouldTryGetTrainerScript
def_special AddMapNamePopUpWindowTask
def_special AddMapNamePopUpWindowTask
def_special ShowMapNamePopup
def_special ShowMapNamePopup
def_special sub_81BE994
def_special sub_81BE79C
def_special sub_81BE7F4

View File

@ -51,9 +51,10 @@
#define GAME_STAT_USED_DAYCARE 47
#define GAME_STAT_RODE_CABLE_CAR 48
#define GAME_STAT_ENTERED_HOT_SPRINGS 49
#define GAME_STAT_50 50
#define GAME_STAT_51 51
/*TODO: add new stats added in Emerald*/
#define NUM_USED_GAME_STATS 52
#define NUM_GAME_STATS 64
#endif // GUARD_CONSTANTS_GAME_STAT_H

View File

@ -184,7 +184,7 @@
#define VAR_0x40B0 0x40B0
#define VAR_0x40B1 0x40B1
#define VAR_0x40B2 0x40B2
#define VAR_0x40B3 0x40B3
#define VAR_WEATHER_INSTITUTE_STATE 0x40B3
#define VAR_PORTHOLE 0x40B4
#define VAR_0x40B5 0x40B5
#define VAR_0x40B6 0x40B6

View File

@ -26,5 +26,14 @@ void DrawWholeMapView(void);
void CurrentMapDrawMetatileAt(int x, int y);
void sub_8089C08(s16 *a0, s16 *a1);
void DrawDoorMetatileAt(int x, int y, u16 *arr);
void move_tilemap_camera_to_upper_left_corner(void);
void sub_8057A58(void);
void ResetCameraUpdateInfo(void);
u32 InitCameraUpdateCallback(u8 a);
void CameraUpdate(void);
void SetCameraPanningCallback(void (*a)(void));
void SetCameraPanning(s16 a, s16 b);
void InstallCameraPanAheadCallback(void);
void UpdateCameraPanning(void);
#endif //GUARD_FIELD_CAMERA_H

View File

@ -0,0 +1,41 @@
#ifndef GUARD_FIELDCONTROLAVATAR_H
#define GUARD_FIELDCONTROLAVATAR_H
struct FieldInput
{
u8 pressedAButton:1;
u8 input_field_0_1:1;
u8 pressedStartButton:1;
u8 pressedSelectButton:1;
u8 input_field_0_4:1;
u8 input_field_0_5:1;
u8 input_field_0_6:1;
u8 pressedBButton:1;
u8 input_field_1_0:1;
u8 input_field_1_1:1;
u8 input_field_1_2:1;
u8 input_field_1_3:1;
u8 input_field_1_4:1;
u8 input_field_1_5:1;
u8 input_field_1_6:1;
u8 input_field_1_7:1;
u8 dpadDirection;
u8 input_field_3;
};
void FieldClearPlayerInput(struct FieldInput *pStruct);
void FieldGetPlayerInput(struct FieldInput *pStruct, u16 keys, u16 heldKeys);
int sub_809C014(struct FieldInput *pStruct);
u8 *sub_80682A8(struct MapPosition *, u8, u8);
void overworld_poison_timer_set(void);
void prev_quest_postbuffer_cursor_backup_reset(void);
u8 *sub_8068E24(struct MapPosition *);
u8 *GetFieldObjectScriptPointerPlayerFacing(void);
bool8 mapheader_trigger_activate_at__run_now(struct MapPosition *);
bool8 sub_8068870(u16 a);
bool8 sub_8068894(void);
bool8 sub_8068A64(struct MapPosition *, u16);
u8 sub_8068F18(void);
bool8 dive_warp(struct MapPosition *position, u16 b);
#endif // GUARD_FIELDCONTROLAVATAR_H

View File

@ -10,6 +10,8 @@
// Exported RAM declarations
// Exported ROM declarations
u8 ZCoordToPriority(u8);
void FieldObjectUpdateZCoord(struct MapObject *pObject);
void SetObjectSubpriorityByZCoord(u8, struct Sprite *, u8);
void InitObjectPriorityByZCoord(struct Sprite *, u8);
bool8 IsZCoordMismatchAt(u8, s16, s16);

View File

@ -25,6 +25,7 @@ enum SpinnerRunnerFollowPatterns {
// Exported ROM declarations
void sub_808D438(void);
u8 get_go_image_anim_num(u8);
u8 GetFieldObjectIdByLocalIdAndMap(u8, u8, u8);
bool8 TryGetFieldObjectIdByLocalIdAndMap(u8, u8, u8, u8 *);
u8 GetFieldObjectIdByXY(s16, s16);
@ -88,6 +89,8 @@ bool8 FieldObjectIsSpecialAnimOrDirectionSequenceAnimActive(struct MapObject *ma
u8 FieldObjectCheckIfSpecialAnimFinishedOrInactive(struct MapObject *mapObject);
void sub_808F23C(const struct MapObject *mapObject, u8 movementType);
void sub_808F208(const struct MapObject *mapObject);
void npc_coords_shift_still(struct MapObject *pObject);
void FieldObjectMoveDestCoords(struct MapObject *pObject, u32 unk_19, s16 *pInt, s16 *pInt1);
// Exported data declarations

View File

@ -1,6 +1,7 @@
#ifndef GUARD_FIELD_PLAYER_AVATAR_H
#define GUARD_FIELD_PLAYER_AVATAR_H
void player_step(u8 a, u16 b, u16 c);
void ClearPlayerAvatarInfo(void);
void SetPlayerAvatarExtraStateTransition(u8, u8);
u8 GetPlayerAvatarGenderByGraphicsId(u8);
@ -32,11 +33,11 @@ u8 CheckForFieldObjectCollision(struct MapObject *a, s16 b, s16 c, u8 d, u8 e);
u8 PlayerGetZCoord(void);
void SetPlayerAvatarTransitionFlags(u16 a);
void sub_808BCE8(void);
void InitPlayerAvatar(s16 a, s16 b, u8 c, u8 d);
void sub_808B864(void);
void sub_808BCF4(void);
void sub_808D074(u8);
void GetXYCoordsOneStepInFrontOfPlayer(s16 *xPtr, s16 *yPtr);
u8 GetRivalAvatarGraphicsIdByStateIdAndGender(u8, u8);
#endif //GUARD_FIELD_PLAYER_AVATAR_H
#endif // GUARD_FIELD_PLAYER_AVATAR_H

View File

@ -15,5 +15,6 @@ bool8 MapGridIsImpassableAt(s16, s16);
s32 GetMapBorderIdAt(s16, s16);
bool32 CanCameraMoveInDirection(u8);
u16 GetBehaviorByMetatileId(u16 metatileId);
void sav1_camera_get_focus_coords(u16 *x, u16 *y);
#endif //GUARD_FIELDMAP_H

View File

@ -501,23 +501,24 @@
// I/O register fields
// DISPCNT
#define DISPCNT_MODE_0 0x0000 // BG0: text, BG1: text, BG2: text, BG3: text
#define DISPCNT_MODE_1 0x0001 // BG0: text, BG1: text, BG2: affine, BG3: off
#define DISPCNT_MODE_2 0x0002 // BG0: off, BG1: off, BG2: affine, BG3: affine
#define DISPCNT_MODE_3 0x0003 // Bitmap mode, 240x160, BGR555 color
#define DISPCNT_MODE_4 0x0004 // Bitmap mode, 240x160, 256 color palette
#define DISPCNT_MODE_5 0x0005 // Bitmap mode, 160x128, BGR555 color
#define DISPCNT_OBJ_1D_MAP 0x0040
#define DISPCNT_FORCED_BLANK 0x0080
#define DISPCNT_BG0_ON 0x0100
#define DISPCNT_BG1_ON 0x0200
#define DISPCNT_BG2_ON 0x0400
#define DISPCNT_BG3_ON 0x0800
#define DISPCNT_BG_ALL_ON 0x0F00
#define DISPCNT_OBJ_ON 0x1000
#define DISPCNT_WIN0_ON 0x2000
#define DISPCNT_WIN1_ON 0x4000
#define DISPCNT_OBJWIN_ON 0x8000
#define DISPCNT_MODE_0 0x0000 // BG0: text, BG1: text, BG2: text, BG3: text
#define DISPCNT_MODE_1 0x0001 // BG0: text, BG1: text, BG2: affine, BG3: off
#define DISPCNT_MODE_2 0x0002 // BG0: off, BG1: off, BG2: affine, BG3: affine
#define DISPCNT_MODE_3 0x0003 // Bitmap mode, 240x160, BGR555 color
#define DISPCNT_MODE_4 0x0004 // Bitmap mode, 240x160, 256 color palette
#define DISPCNT_MODE_5 0x0005 // Bitmap mode, 160x128, BGR555 color
#define DISPCNT_HBLANK_INTERVAL 0x0020 // Allow access to OAM during H-Blank
#define DISPCNT_OBJ_1D_MAP 0x0040
#define DISPCNT_FORCED_BLANK 0x0080
#define DISPCNT_BG0_ON 0x0100
#define DISPCNT_BG1_ON 0x0200
#define DISPCNT_BG2_ON 0x0400
#define DISPCNT_BG3_ON 0x0800
#define DISPCNT_BG_ALL_ON 0x0F00
#define DISPCNT_OBJ_ON 0x1000
#define DISPCNT_WIN0_ON 0x2000
#define DISPCNT_WIN1_ON 0x4000
#define DISPCNT_OBJWIN_ON 0x8000
// DISPSTAT
#define DISPSTAT_VBLANK 0x0001 // in V-Blank

View File

@ -162,10 +162,10 @@ struct MapConnections
struct MapHeader
{
/* 0x00 */ struct MapData *mapData;
/* 0x04 */ struct MapEvents *events;
/* 0x08 */ u8 *mapScripts;
/* 0x0C */ struct MapConnections *connections;
/* 0x00 */ const struct MapData *mapData;
/* 0x04 */ const struct MapEvents *events;
/* 0x08 */ const u8 *mapScripts;
/* 0x0C */ const struct MapConnections *connections;
/* 0x10 */ u16 music;
/* 0x12 */ u16 mapDataId;
/* 0x14 */ u8 regionMapSectionId;

View File

@ -144,6 +144,18 @@ struct UCoords16
u16 y;
};
struct Coords32
{
s32 x;
s32 y;
};
struct UCoords32
{
u32 x;
u32 y;
};
struct Time
{
/*0x00*/ s16 days;
@ -618,12 +630,12 @@ struct SaveBlock1
/*0x04*/ struct WarpData location;
/*0x0C*/ struct WarpData warp1;
/*0x14*/ struct WarpData warp2;
/*0x1C*/ struct WarpData warp3;
/*0x1C*/ struct WarpData lastHealLocation;
/*0x24*/ struct WarpData warp4;
/*0x2C*/ u16 battleMusic;
/*0x2C*/ u16 savedMusic;
/*0x2E*/ u8 weather;
/*0x2F*/ u8 filler_2F;
/*0x30*/ u8 flashUsed;
/*0x30*/ u8 flashLevel;
/*0x32*/ u16 mapDataId;
/*0x34*/ u16 mapView[0x100];
/*0x234*/ u8 playerPartyCount;
@ -705,6 +717,23 @@ struct SaveBlock1
extern struct SaveBlock1* gSaveBlock1Ptr;
struct MapPosition
{
s16 x;
s16 y;
u8 height;
};
struct UnkStruct_8054FF8
{
u8 a;
u8 b;
u8 c;
u8 d;
struct MapPosition sub;
u16 field_C;
};
struct Bitmap // TODO: Find a better spot for this
{
u8* pixels;

View File

@ -12,7 +12,7 @@ void ItemUseOutOfBattle_Itemfinder(u8);
void ItemUseOnFieldCB_Itemfinder(u8);
void RunItemfinderResults(u8);
void ExitItemfinder(u8);
bool8 ItemfinderCheckForHiddenItems(struct MapEvents *, u8);
bool8 ItemfinderCheckForHiddenItems(const struct MapEvents *, u8);
void sub_80C9720(u8);
void sub_80C9838(u8, s16, s16);
u8 GetPlayerDirectionTowardsHiddenItem(s16, s16);

View File

@ -1,7 +1,5 @@
#ifndef GUARD_ROM4_H
#define GUARD_ROM4_H
#include "main.h"
#ifndef GUARD_OVERWORLD_H
#define GUARD_OVERWORLD_H
struct UnkPlayerStruct
{
@ -17,70 +15,124 @@ struct LinkPlayerMapObject
u8 mode;
};
struct UCoords32
{
u32 x, y;
};
extern struct WarpData gUnknown_020322DC;
extern struct LinkPlayerMapObject gLinkPlayerMapObjects[4];
extern MainCallback gFieldCallback;
void Overworld_SetMapObjTemplateCoords(u8, s16, s16);
void Overworld_SetMapObjTemplateMovementType(u8, u8);
extern const struct UCoords32 gUnknown_08339D64[];
void Overworld_SetWarpDestination(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void saved_warp2_set(int unused, s8 mapGroup, s8 mapNum, s8 warpId);
void saved_warp2_set_2(int unused, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void Overworld_SetHealLocationWarp(u8);
void sub_8084DD4(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void sub_8084E2C(s8, s8, s8, s8, s8);
void sub_8084E80(s8, s8, s8, s8, s8);
void sub_8084EBC(s16, s16);
void player_avatar_init_params_reset(void);
bool8 Overworld_MapTypeAllowsTeleportAndFly(u8 mapType);
void DoWhiteOut(void);
void Overworld_ResetStateAfterFly(void);
void Overworld_ResetStateAfterTeleport(void);
void Overworld_SetFlashLevel(s32 a1);
//u8 Overworld_GetFlashLevel(void);
void sub_8085524(u16);
void Overworld_SetSavedMusic(u16);
void Overworld_ChangeMusicToDefault(void);
void Overworld_ChangeMusicTo(u16);
bool32 is_c1_link_related_active(void);
extern u16 gUnknown_03005DA8;
void CB2_NewGame(void);
void strange_npc_table_clear(void);
const struct MapHeader *get_mapheader_by_bank_and_number(u16, u16);
void FieldObjectMoveDestCoords(struct MapObject *, u32, s16 *, s16 *);
void sub_8086230(void);
void c2_exit_to_overworld_2_switch(void);
bool32 sub_8087598(void);
void c2_exit_to_overworld_1_continue_scripts_restart_music(void);
void Overworld_ResetStateAfterDigEscRope(void);
void ResetGameStats(void);
void IncrementGameStat(u8 index);
u32 GetGameStat(u8 index);
void SetGameStat(u8 index, u32 value);
void ApplyNewEncryptionKeyToGameStats(u32 newKey);
void LoadMapObjTemplatesFromHeader(void);
void LoadSaveblockMapObjScripts(void);
void Overworld_SetMapObjTemplateCoords(u8 localId, s16 x, s16 y);
void Overworld_SetMapObjTemplateMovementType(u8 localId, u8 movementType);
const struct MapData *get_mapdata_header(void);
void ApplyCurrentWarp(void);
void set_warp2_warp3_to_neg_1(void);
void SetWarpData(struct WarpData *warp, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
bool32 warp_data_is_not_neg_1(struct WarpData *warp);
const struct MapHeader *Overworld_GetMapHeaderByGroupAndId(u16 mapGroup, u16 mapNum);
const struct MapHeader *warp1_get_mapheader(void);
void set_current_map_header_from_sav1_save_old_name(void);
void LoadSaveblockMapHeader(void);
void update_camera_pos_from_warpid(void);
void warp_in(void);
u8 get_map_light_level_by_bank_and_number(s8 mapGroup, s8 mapNum);
void sub_8086194(void);
void sub_8084CCC(u8 spawn);
void warp1_set_2(s8 mapGroup, s8 mapNum, s8 warpNum);
void c2_load_new_map(void);
void Overworld_SetWarpDestination(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void warp1_set_2(s8 mapGroup, s8 mapNum, s8 warpId);
void saved_warp2_set(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId);
void saved_warp2_set_2(s32 unused, s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void copy_saved_warp2_bank_and_enter_x_to_warp1(u8 unused);
void mapldr_default(void);
void sub_8084CCC(u8 a1);
void Overworld_SetWarpDestToLastHealLoc(void);
void Overworld_SetHealLocationWarp(u8 healLocationId);
void sub_8084D5C(s16 a1, s16 a2);
void sub_8084DD4(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void sub_8084E14(void);
void sub_8084E2C(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void warp1_set_to_warp2(void);
void sub_8084E80(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void sub_8084EBC(s16 x, s16 y);
void warp1_set_to_sav1w(void);
void sub_8084F2C(s8 mapGroup, s8 mapNum, s8 warpId, s8 x, s8 y);
void sub_8084F6C(u8 a1);
void sub_8084FAC(void);
const struct MapConnection *GetMapConnection(u8 dir);
bool8 sub_8084FF8(u8 dir, u16 x, u16 y);
bool8 sub_8085058(u16 x, u16 y);
bool8 sub_8085078(u16 x, u16 y);
void mliX_load_map(u8 mapGroup, u8 mapNum);
void player_avatar_init_params_reset(void);
void walkrun_find_lowest_active_bit_in_bitfield(void);
bool32 Overworld_IsBikingAllowed(void);
void SetDefaultFlashLevel(void);
void Overworld_SetFlashLevel(s32 flashLevel);
u8 Overworld_GetFlashLevel(void);
void sub_8085524(u16 mapDataId);
void sub_8085540(u8 var);
u8 sub_808554C(void);
u16 GetLocationMusic(struct WarpData *warp);
u16 GetCurrLocationDefaultMusic(void);
u16 GetWarpDestinationMusic(void);
void Overworld_ResetMapMusic(void);
void Overworld_PlaySpecialMapMusic(void);
void Overworld_SetSavedMusic(u16 songNum);
void Overworld_ClearSavedMusic(void);
void Overworld_ChangeMusicToDefault(void);
void Overworld_ChangeMusicTo(u16 newMusic);
u8 GetMapMusicFadeoutSpeed(void);
void music_something(void);
bool8 sub_80859A0(void);
void Overworld_FadeOutMapMusic(void);
void UpdateAmbientCry(s16 *state, u16 *delayCounter);
u8 GetMapTypeByGroupAndId(s8 mapGroup, s8 mapNum);
u8 GetMapTypeByWarpData(struct WarpData *warp);
u8 Overworld_GetMapTypeOfSaveblockLocation(void);
u8 get_map_light_from_warp0(void);
bool8 is_light_level_1_2_3_5_or_6(u8 a1);
void sub_8086194(void);
bool8 is_light_level_1_2_3_5_or_6(u8 mapType);
bool8 Overworld_MapTypeAllowsTeleportAndFly(u8 mapType);
bool8 Overworld_MapTypeIsIndoors(u8 mapType);
u8 sav1_saved_warp2_map_get_name(void);
u8 sav1_map_get_name(void);
u8 GetCurrentMapBattleScene(void);
void overworld_free_bg_tilemaps(void);
bool32 is_c1_link_related_active(void);
void CB1_Overworld(void);
void CB2_OverworldBasic(void);
void CB2_Overworld(void);
void SetMainCallback1(void (*cb)(void));
void sub_8085E94(void *a0);
void CB2_NewGame(void);
void CB2_WhiteOut(void);
void CB2_LoadMap(void);
void sub_8086024(void);
void sub_8086074(void);
void CB2_ReturnToField(void);
void CB2_ReturnToFieldLocal(void);
void CB2_ReturnToFieldLink(void);
void c2_8056854(void);
void CB2_ReturnToFieldWithOpenMenu(void);
void sub_80861B0(void);
void CB2_ReturnToFieldContinueScript(void);
void sub_80861E8(void);
void CB2_ContinueSavedGame(void);
void sub_8086C2C(void);
u32 sub_8087214(void);
bool32 sub_808727C(void);
u16 sub_8087288(void);
u16 sub_808729C(void);
u16 sub_80872B0(void);
u16 sub_80872C4(void);
bool32 sub_8087598(void);
bool32 sub_80875C8(void);
bool32 sub_8087634(void);
bool32 sub_808766C(void);
void IncrementGameStat(u8);
u32 GetGameStat(u8);
void ZeroAllLinkPlayerMapObjects(void);
void CB2_OverworldBasic(void);
#endif //GUARD_ROM4_H
#endif // GUARD_OVERWORLD_H

View File

@ -86,7 +86,7 @@ SECTIONS {
src/berry_blender.o(.text);
src/play_time.o(.text);
src/new_game.o(.text);
asm/overworld.o(.text);
src/overworld.o(.text);
asm/fieldmap.o(.text);
src/metatile_behavior.o(.text);
asm/field_camera.o(.text);
@ -393,7 +393,7 @@ SECTIONS {
data/trade.o(.rodata);
src/berry_blender.o(.rodata);
src/new_game.o(.rodata);
data/overworld.o(.rodata);
src/overworld.o(.rodata);
data/tilesets.o(.rodata);
data/maps.o(.rodata);
data/fieldmap.o(.rodata);

View File

@ -76,7 +76,7 @@ extern bool8 sub_81B1250(void); // ?
extern bool8 InBattlePike(void);
extern bool8 InBattlePyramid(void);
extern u16 GetBattlePyramidPickupItemId(void);
extern u8 sav1_map_get_light_level(void);
extern u8 Overworld_GetMapTypeOfSaveblockLocation(void);
extern u8 sub_813B21C(void);
extern u16 get_unknown_box_id(void);
@ -10578,7 +10578,7 @@ static void atkEF_handleballthrow(void)
ballMultiplier = 10;
break;
case ITEM_DIVE_BALL:
if (sav1_map_get_light_level() == 5)
if (Overworld_GetMapTypeOfSaveblockLocation() == 5)
ballMultiplier = 35;
else
ballMultiplier = 10;

View File

@ -49,6 +49,8 @@ struct TrainerBattleParameter
u8 ptrType;
};
extern void (*gFieldCallback)(void);
extern bool8 InBattlePyramid(void);
extern bool8 InBattlePike(void);
extern bool32 InTrainerHill(void);
@ -472,7 +474,7 @@ void StartWallyTutorialBattle(void)
{
CreateMaleMon(&gEnemyParty[0], SPECIES_RALTS, 5);
ScriptContext2_Enable();
gMain.savedCallback = c2_exit_to_overworld_1_continue_scripts_restart_music;
gMain.savedCallback = CB2_ReturnToFieldContinueScript;
gBattleTypeFlags = BATTLE_TYPE_WALLY_TUTORIAL;
CreateBattleStartTask(B_TRANSITION_SLICE, 0);
}
@ -601,7 +603,7 @@ static void CB2_EndWildBattle(void)
}
else
{
SetMainCallback2(c2_exit_to_overworld_2_switch);
SetMainCallback2(CB2_ReturnToField);
gFieldCallback = sub_80AF6F0;
}
}
@ -614,13 +616,13 @@ static void CB2_EndScriptedWildBattle(void)
if (IsPlayerDefeated(gBattleOutcome) == TRUE)
{
if (InBattlePyramid())
SetMainCallback2(c2_exit_to_overworld_1_continue_scripts_restart_music);
SetMainCallback2(CB2_ReturnToFieldContinueScript);
else
SetMainCallback2(CB2_WhiteOut);
}
else
{
SetMainCallback2(c2_exit_to_overworld_1_continue_scripts_restart_music);
SetMainCallback2(CB2_ReturnToFieldContinueScript);
}
}
@ -937,7 +939,7 @@ static void CB2_StartFirstBattle(void)
static void CB2_EndFirstBattle(void)
{
Overworld_ClearSavedMusic();
SetMainCallback2(c2_exit_to_overworld_1_continue_scripts_restart_music);
SetMainCallback2(CB2_ReturnToFieldContinueScript);
}
static void sub_80B1218(void)
@ -1313,18 +1315,18 @@ static void CB2_EndTrainerBattle(void)
{
if (gTrainerBattleOpponent_A == SECRET_BASE_OPPONENT)
{
SetMainCallback2(c2_exit_to_overworld_1_continue_scripts_restart_music);
SetMainCallback2(CB2_ReturnToFieldContinueScript);
}
else if (IsPlayerDefeated(gBattleOutcome) == TRUE)
{
if (InBattlePyramid() || sub_81D5C18())
SetMainCallback2(c2_exit_to_overworld_1_continue_scripts_restart_music);
SetMainCallback2(CB2_ReturnToFieldContinueScript);
else
SetMainCallback2(CB2_WhiteOut);
}
else
{
SetMainCallback2(c2_exit_to_overworld_1_continue_scripts_restart_music);
SetMainCallback2(CB2_ReturnToFieldContinueScript);
if (!InBattlePyramid() && !sub_81D5C18())
{
RegisterTrainerInMatchCall();
@ -1337,7 +1339,7 @@ static void CB2_EndRematchBattle(void)
{
if (gTrainerBattleOpponent_A == SECRET_BASE_OPPONENT)
{
SetMainCallback2(c2_exit_to_overworld_1_continue_scripts_restart_music);
SetMainCallback2(CB2_ReturnToFieldContinueScript);
}
else if (IsPlayerDefeated(gBattleOutcome) == TRUE)
{
@ -1345,7 +1347,7 @@ static void CB2_EndRematchBattle(void)
}
else
{
SetMainCallback2(c2_exit_to_overworld_1_continue_scripts_restart_music);
SetMainCallback2(CB2_ReturnToFieldContinueScript);
RegisterTrainerInMatchCall();
SetBattledTrainersFlags();
HandleRematchVarsOnBattleEnd();

View File

@ -919,7 +919,7 @@ static void CB2_TestBattleTransition(void)
if (IsBattleTransitionDone())
{
sTestingTransitionState = 0;
SetMainCallback2(c2_exit_to_overworld_2_switch);
SetMainCallback2(CB2_ReturnToField);
}
break;
}

View File

@ -161,7 +161,7 @@ extern void copy_textbox_border_tile_patterns_to_vram(u8, u16, u8);
extern void sub_81AABF0(void (*callback)(void));
extern void sub_800B4C0(void);
extern void ClearLinkCallback(void);
extern void c2_exit_to_overworld_1_continue_scripts_restart_music(void);
extern void CB2_ReturnToFieldContinueScript(void);
extern void sub_8153430(void);
extern bool8 sub_8153474(void);
extern void sub_80EECEC(void);
@ -2692,7 +2692,7 @@ static void CB2_HandlePlayerLinkPlayAgainChoice(void)
if (gReceivedRemoteLinkPlayers == 0)
{
FREE_AND_SET_NULL(sBerryBlenderData);
SetMainCallback2(c2_exit_to_overworld_1_continue_scripts_restart_music);
SetMainCallback2(CB2_ReturnToFieldContinueScript);
}
break;
}
@ -2742,7 +2742,7 @@ static void CB2_HandlePlayerPlayAgainChoice(void)
if (sBerryBlenderData->playAgainState == PLAY_AGAIN_OK)
SetMainCallback2(DoBerryBlending);
else
SetMainCallback2(c2_exit_to_overworld_1_continue_scripts_restart_music);
SetMainCallback2(CB2_ReturnToFieldContinueScript);
FreeAllWindowBuffers();
UnsetBgTilemapBuffer(2);

View File

@ -83,7 +83,7 @@ static void UpdatePerMinute(struct Time *localTime)
static void ReturnFromStartWallClock(void)
{
InitTimeBasedEvents();
SetMainCallback2(c2_exit_to_overworld_1_continue_scripts_restart_music);
SetMainCallback2(CB2_ReturnToFieldContinueScript);
}
void StartWallClock(void)

View File

@ -46,7 +46,7 @@ extern void sub_819746C(u8, bool8);
extern void NewMenuHelpers_DrawStdWindowFrame(u8, bool8);
extern void sub_81B9328(void);
extern void sub_81AF078(u32, bool8, struct ListMenu *);
extern void c2_exit_to_overworld_2_switch(void);
extern void CB2_ReturnToField(void);
// this file's functions
static void ClearDaycareMonMisc(struct DaycareMiscMon *misc);
@ -1315,5 +1315,5 @@ void ShowDaycareLevelMenu(void)
void ChooseSendDaycareMon(void)
{
sub_81B9328();
gMain.savedCallback = c2_exit_to_overworld_2_switch;
gMain.savedCallback = CB2_ReturnToField;
}

View File

@ -38,6 +38,8 @@
#include "decoration.h"
#include "graphics.h"
extern void (*gFieldCallback)(void);
// Static type declarations
#define OVERWORLD_PLACE_DECOR_SELECTOR_PAL_TAG 0xbe5
@ -1682,7 +1684,7 @@ void c1_overworld_prev_quest(u8 taskId)
sub_812A3C8();
FreeSpritePaletteByTag(OVERWORLD_PLACE_DECOR_SELECTOR_PAL_TAG);
gFieldCallback = sub_8128CD4;
SetMainCallback2(c2_exit_to_overworld_2_switch);
SetMainCallback2(CB2_ReturnToField);
DestroyTask(taskId);
break;
}
@ -2673,7 +2675,7 @@ void sub_812A25C(u8 taskId)
case 1:
sub_812A3C8();
gFieldCallback = sub_812A334;
SetMainCallback2(c2_exit_to_overworld_2_switch);
SetMainCallback2(CB2_ReturnToField);
DestroyTask(taskId);
break;
}

View File

@ -63,7 +63,7 @@ extern void FadeScreen(u8, u8);
extern void overworld_free_bg_tilemaps(void);
extern void sub_80AF168(void);
extern void ScanlineEffect_Stop(void);
extern void c2_exit_to_overworld_2_switch(void);
extern void CB2_ReturnToField(void);
extern void play_some_sound(void);
extern void DoNamingScreen(u8, const u8*, u16, u8, u32, MainCallback);
extern u16 sub_80D22D0(void);
@ -564,7 +564,7 @@ static void EggHatchSetMonNickname(void)
SetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_NICKNAME, gStringVar3);
FreeMonSpritesGfx();
Free(sEggHatchData);
SetMainCallback2(c2_exit_to_overworld_2_switch);
SetMainCallback2(CB2_ReturnToField);
}
static void Task_EggHatchPlayBGM(u8 taskID)
@ -688,7 +688,7 @@ static void CB2_EggHatch_1(void)
UnsetBgTilemapBuffer(0);
UnsetBgTilemapBuffer(1);
Free(sEggHatchData);
SetMainCallback2(c2_exit_to_overworld_2_switch);
SetMainCallback2(CB2_ReturnToField);
}
break;
}

View File

@ -198,7 +198,7 @@ static void npcs_clear_ids_and_state(void)
void sub_808D438(void)
{
strange_npc_table_clear();
ZeroAllLinkPlayerMapObjects();
npcs_clear_ids_and_state();
ClearPlayerAvatarInfo();
sub_808D450();
@ -1673,7 +1673,7 @@ struct MapObjectTemplate *GetFieldObjectTemplateByLocalIdAndMap(u8 localId, u8 m
}
else
{
mapHeader = get_mapheader_by_bank_and_number(mapGroup, mapNum);
mapHeader = Overworld_GetMapHeaderByGroupAndId(mapGroup, mapNum);
templates = mapHeader->events->mapObjects;
count = mapHeader->events->mapObjectCount;
}

View File

@ -25,7 +25,7 @@ void AccessHallOfFamePC(void)
void ReturnFromHallOfFamePC(void)
{
SetMainCallback2(c2_exit_to_overworld_2_switch);
SetMainCallback2(CB2_ReturnToField);
gFieldCallback = ReshowPCMenuAfterHallOfFamePC;
}

View File

@ -155,19 +155,19 @@ void sub_81AD6FC(u8 taskId);
// .rodata
const struct BgTemplate gUnknown_08613F90[3] = {
{0, 0, 31, 0, 0, 1, 0},
{1, 0, 30, 0, 0, 0, 0},
{0, 0, 31, 0, 0, 1, 0},
{1, 0, 30, 0, 0, 0, 0},
{2, 3, 29, 0, 0, 2, 0}
};
const struct ListMenuTemplate gUnknown_08613F9C = {
NULL, bag_menu_change_item_callback, sub_81AB520, 0, 0, 0, 0, 8, 0, 1, 1, 0, 3, 0, 0, 0, 7, 0
};
const struct MenuAction gUnknown_08613FB4[] = {
{gMenuText_Use, ItemMenu_UseOutOfBattle},
{gMenuText_Toss, ItemMenu_Toss},
{gMenuText_Register, ItemMenu_Register},
{gMenuText_Use, ItemMenu_UseOutOfBattle},
{gMenuText_Toss, ItemMenu_Toss},
{gMenuText_Register, ItemMenu_Register},
{gMenuText_Give, ItemMenu_Give},
{gText_Cancel2, ItemMenu_Cancel},
{gMenuText_Use, ItemMenu_UseInBattle},
@ -219,7 +219,7 @@ const struct ArrowStruct gUnknown_08614094 = {0, 0x1C, 16, 1, 100, 16, -1, -1, 0
const u8 gUnknown_086140A4[] = INCBIN_U8("graphics/interface/select_button.4bpp");
const u8 gUnknown_08614164[][3] = {
{0, 1, 3},
{0, 1, 3},
{0, 1, 4},
{0, 3, 6},
{2, 1, 3},
@ -252,7 +252,7 @@ const struct WindowTemplate gUnknown_086141AC[] = {
// .text
struct BagStruct {
void (*bagCallback)(void);
void (*bagCallback)(void);
u8 location;
u8 pocket;
u8 unk6[2];
@ -339,7 +339,7 @@ void ResetBagScrollPositions(void)
void CB2_BagMenuFromStartMenu(void)
{
GoToBagMenu(0, 5, sub_8086194);
GoToBagMenu(0, 5, CB2_ReturnToFieldWithOpenMenu);
}
void sub_81AABB0(void)
@ -630,7 +630,7 @@ void load_bag_item_list_buffers(u8 pocketId)
u16 i;
struct BagPocket *pocket = &gBagPockets[pocketId];
struct ListMenuItem *subBuffer;
if (!gUnknown_0203CE54->unk81B_2)
{
for (i = 0; i < gUnknown_0203CE54->unk829[pocketId] - 1; i++)
@ -903,7 +903,7 @@ u8 sub_81ABB2C(u8 a)
void DisplayItemMessage(u8 taskId, u8 fontId, const u8 *str, void ( *callback)(u8 taskId))
{
s16* data = gTasks[taskId].data;
data[10] = AddItemMessageWindow(4);
FillWindowPixelBuffer(data[10], 17);
DisplayMessageAndContinueTask(taskId, data[10], 10, 13, fontId, GetPlayerTextSpeed(), str, callback);
@ -1056,7 +1056,7 @@ void SwitchBagPocket(u8 taskId, s16 deltaBagPocketId, u16 a3)
s16* data = gTasks[taskId].data;
u8 pocketId;
data[13] = 0;
data[12] = 0;
data[11] = deltaBagPocketId;
@ -1244,7 +1244,7 @@ _081AC09A:\n\
void sub_81AC10C(u8 taskId)
{
s16* data = gTasks[taskId].data;
if (!sub_81221AC() && !IsWallysBag())
{
switch (GetSwitchBagPocketDirection())
@ -1317,7 +1317,7 @@ bool8 sub_81AC2C0(void)
void bag_menu_swap_items(u8 taskId)
{
s16* data = gTasks[taskId].data;
sub_81AF15C(data[0], 16, 1);
data[1] = gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket] + gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket];
gUnknown_0203CE54->unk81A = data[1];
@ -1335,7 +1335,7 @@ void sub_81AC3C0(u8 taskId)
{
s16* data = gTasks[taskId].data;
int r7;
if (sub_81221EC() != TRUE)
{
if (gMain.newKeys & SELECT_BUTTON)
@ -1375,7 +1375,7 @@ void sub_81AC498(u8 taskId)
u16* scrollPos = &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket];
u16* cursorPos = &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket];
u16 realPos = (*scrollPos + *cursorPos);
if (data[1] == realPos || data[1] == (realPos - 1))
sub_81AC590(taskId);
else
@ -1398,7 +1398,7 @@ void sub_81AC590(u8 taskId)
s16* data = gTasks[taskId].data;
u16* scrollPos = &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket];
u16* cursorPos = &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket];
gUnknown_0203CE54->unk81A = -1;
sub_81AE6C8(data[0], scrollPos, cursorPos);
if (data[1] < (*scrollPos + *cursorPos))
@ -1689,7 +1689,7 @@ void ItemMenu_UseOutOfBattle(u8 taskId)
void ItemMenu_Toss(u8 taskId)
{
s16* data = gTasks[taskId].data;
bag_menu_remove_some_window();
data[8] = 1;
if (data[2] == 1)
@ -1710,7 +1710,7 @@ void ItemMenu_Toss(u8 taskId)
void BagMenuConfirmToss(u8 taskId)
{
s16* data = gTasks[taskId].data;
CopyItemName(gSpecialVar_ItemId, gStringVar1);
ConvertIntToDecimalStringN(gStringVar2, data[8], 0, 3);
StringExpandPlaceholders(gStringVar4, gText_ConfirmTossItems);
@ -1722,7 +1722,7 @@ void BagMenuConfirmToss(u8 taskId)
void BagMenuCancelToss(u8 taskId)
{
s16* data = gTasks[taskId].data;
bag_menu_print_description_box_text(data[1]);
bag_menu_print_cursor_(data[0], 0);
set_callback3_to_bag(taskId);
@ -1731,7 +1731,7 @@ void BagMenuCancelToss(u8 taskId)
void Task_ChooseHowManyToToss(u8 taskId)
{
s16* data = gTasks[taskId].data;
if (AdjustQuantityAccordingToDPadInput(&data[8], data[2]) == TRUE)
{
sub_81ABC54(gUnknown_0203CE54->unk817, data[8]);
@ -1753,7 +1753,7 @@ void Task_ChooseHowManyToToss(u8 taskId)
void BagMenuActuallyToss(u8 taskId)
{
s16* data = gTasks[taskId].data;
CopyItemName(gSpecialVar_ItemId, gStringVar1);
ConvertIntToDecimalStringN(gStringVar2, data[8], 0, 3);
StringExpandPlaceholders(gStringVar4, gText_ThrewAwayVar2Var1s);
@ -1767,7 +1767,7 @@ void Task_ActuallyToss(u8 taskId)
s16* data = gTasks[taskId].data;
u16* scrollPos = &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket];
u16* cursorPos = &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket];
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
{
PlaySE(SE_SELECT);
@ -1787,7 +1787,7 @@ void ItemMenu_Register(u8 taskId)
s16* data = gTasks[taskId].data;
u16* scrollPos = &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket];
u16* cursorPos = &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket];
if (gSaveBlock1Ptr->registeredItem == gSpecialVar_ItemId)
gSaveBlock1Ptr->registeredItem = 0;
else
@ -1852,7 +1852,7 @@ void ItemMenu_CheckTag(u8 taskId)
void ItemMenu_Cancel(u8 taskId)
{
s16* data = gTasks[taskId].data;
bag_menu_remove_some_window();
bag_menu_print_description_box_text(data[1]);
schedule_bg_copy_tilemap_to_vram(0);
@ -1910,7 +1910,7 @@ void item_menu_type_b(u8 taskId)
bool8 UseRegisteredKeyItemOnField(void)
{
u8 taskId;
if (InUnionRoom() == TRUE || InBattlePyramid() || InBattlePike() || InMultiBattleRoom() == TRUE)
return FALSE;
HideMapNamePopUpWindow();
@ -1938,14 +1938,14 @@ bool8 UseRegisteredKeyItemOnField(void)
void display_sell_item_ask_str(u8 taskId)
{
s16* data = gTasks[taskId].data;
if (itemid_get_market_price(gSpecialVar_ItemId) == 0)
{
CopyItemName(gSpecialVar_ItemId, gStringVar2);
StringExpandPlaceholders(gStringVar4, gText_CantBuyKeyItem);
DisplayItemMessage(taskId, 1, gStringVar4, bag_menu_inits_lists_menu);
}
else
else
{
data[8] = 1;
if (data[2] == 1)
@ -1965,7 +1965,7 @@ void display_sell_item_ask_str(u8 taskId)
void sub_81AD680(u8 taskId)
{
s16* data = gTasks[taskId].data;
ConvertIntToDecimalStringN(gStringVar1, (itemid_get_market_price(gSpecialVar_ItemId) / 2) * data[8], 0, 6);
StringExpandPlaceholders(gStringVar4, gText_ICanPayVar1);
DisplayItemMessage(taskId, 1, gStringVar4, sub_81AD6E4);
@ -1979,7 +1979,7 @@ void sub_81AD6E4(u8 taskId)
void sub_81AD6FC(u8 taskId)
{
s16* data = gTasks[taskId].data;
bag_menu_remove_money_window();
bag_menu_RemoveBagItem_message_window(4);
bag_menu_print_cursor_(data[0], 0);
@ -1990,7 +1990,7 @@ void sub_81AD730(u8 taskId)
{
s16* data = gTasks[taskId].data;
u8 windowId = bag_menu_add_window(8);
sub_81ABCC0(windowId, 1, (itemid_get_market_price(gSpecialVar_ItemId) / 2) * data[8]);
bag_menu_AddMoney_window();
gTasks[taskId].func = sub_81AD794;
@ -1999,7 +1999,7 @@ void sub_81AD730(u8 taskId)
void sub_81AD794(u8 taskId)
{
s16* data = gTasks[taskId].data;
if (AdjustQuantityAccordingToDPadInput(&data[8], data[2]) == TRUE)
{
sub_81ABCC0(gUnknown_0203CE54->unk818, data[8], (itemid_get_market_price(gSpecialVar_ItemId) / 2) * data[8]);
@ -2024,7 +2024,7 @@ void sub_81AD794(u8 taskId)
void sub_81AD84C(u8 taskId)
{
s16* data = gTasks[taskId].data;
CopyItemName(gSpecialVar_ItemId, gStringVar2);
ConvertIntToDecimalStringN(gStringVar1, (itemid_get_market_price(gSpecialVar_ItemId) / 2) * data[8], 0, 6);
StringExpandPlaceholders(gStringVar4, gText_TurnedOverVar1ForVar2);
@ -2036,7 +2036,7 @@ void sub_81AD8C8(u8 taskId)
s16* data = gTasks[taskId].data;
u16* scrollPos = &gUnknown_0203CE58.scrollPosition[gUnknown_0203CE58.pocket];
u16* cursorPos = &gUnknown_0203CE58.cursorPosition[gUnknown_0203CE58.pocket];
PlaySE(SE_REGI);
RemoveBagItem(gSpecialVar_ItemId, data[8]);
AddMoney(&gSaveBlock1Ptr->money, (itemid_get_market_price(gSpecialVar_ItemId) / 2) * data[8]);
@ -2063,7 +2063,7 @@ void sub_81AD9C0(u8 taskId)
void display_deposit_item_ask_str(u8 taskId)
{
s16* data = gTasks[taskId].data;
data[8] = 1;
if (data[2] == 1)
{
@ -2083,7 +2083,7 @@ void display_deposit_item_ask_str(u8 taskId)
void sub_81ADA7C(u8 taskId)
{
s16* data = gTasks[taskId].data;
if (AdjustQuantityAccordingToDPadInput(&data[8], data[2]) == TRUE)
{
sub_81ABC54(gUnknown_0203CE54->unk817, data[8]);
@ -2107,7 +2107,7 @@ void sub_81ADA7C(u8 taskId)
void sub_81ADB14(u8 taskId)
{
s16* data = gTasks[taskId].data;
FillWindowPixelBuffer(1, 0);
if (itemid_is_unique(gSpecialVar_ItemId))
{
@ -2132,7 +2132,7 @@ void sub_81ADB14(u8 taskId)
void sub_81ADC0C(u8 taskId)
{
s16* data = gTasks[taskId].data;
if (gMain.newKeys & (A_BUTTON | B_BUTTON))
{
PlaySE(SE_SELECT);
@ -2152,7 +2152,7 @@ bool8 IsWallysBag(void)
void PrepareBagForWallyTutorial(void)
{
u32 i;
gUnknown_0203CE80 = AllocZeroed(sizeof(struct TempWallyStruct));
memcpy(gUnknown_0203CE80->bagPocket_Items, gSaveBlock1Ptr->bagPocket_Items, sizeof(gSaveBlock1Ptr->bagPocket_Items));
memcpy(gUnknown_0203CE80->bagPocket_PokeBalls, gSaveBlock1Ptr->bagPocket_PokeBalls, sizeof(gSaveBlock1Ptr->bagPocket_PokeBalls));
@ -2170,7 +2170,7 @@ void PrepareBagForWallyTutorial(void)
void RestoreBagAfterWallyTutorial(void)
{
u32 i;
memcpy(gSaveBlock1Ptr->bagPocket_Items, gUnknown_0203CE80->bagPocket_Items, sizeof(gUnknown_0203CE80->bagPocket_Items));
memcpy(gSaveBlock1Ptr->bagPocket_PokeBalls, gUnknown_0203CE80->bagPocket_PokeBalls, sizeof(gUnknown_0203CE80->bagPocket_PokeBalls));
gUnknown_0203CE58.pocket = gUnknown_0203CE80->pocket;
@ -2193,7 +2193,7 @@ void DoWallyTutorialBagMenu(void)
void Task_WallyTutorialBagMenu(u8 taskId)
{
s16* data = gTasks[taskId].data;
if (!gPaletteFade.active)
{
switch (data[8])
@ -2235,7 +2235,7 @@ void unknown_ItemMenu_Show(u8 taskId)
void bag_menu_leave_maybe_3(void)
{
gFieldCallback = sub_819FA50;
SetMainCallback2(c2_exit_to_overworld_2_switch);
SetMainCallback2(CB2_ReturnToField);
}
void unknown_ItemMenu_Give2(u8 taskId)
@ -2249,7 +2249,7 @@ void unknown_ItemMenu_Give2(u8 taskId)
void bag_menu_leave_maybe_2(void)
{
gFieldCallback = sub_818DEF4;
SetMainCallback2(c2_exit_to_overworld_2_switch);
SetMainCallback2(CB2_ReturnToField);
}
void unknown_ItemMenu_Confirm2(u8 taskId)
@ -2262,7 +2262,7 @@ void unknown_ItemMenu_Confirm2(u8 taskId)
void bag_menu_leave_maybe(void)
{
gFieldCallback = sub_818E564;
SetMainCallback2(c2_exit_to_overworld_2_switch);
SetMainCallback2(CB2_ReturnToField);
}
void bag_menu_print_pocket_names(u8 *pocketName1, u8 *pocketName2)
@ -2270,7 +2270,7 @@ void bag_menu_print_pocket_names(u8 *pocketName1, u8 *pocketName2)
struct WindowTemplate window = {0, 0, 0, 0, 0, 0, 0};
u16 windowId;
int offset;
window.width = 16;
window.height = 2;
windowId = AddWindow(&window);
@ -2304,7 +2304,7 @@ void bag_menu_copy_pocket_name_to_window(u32 a)
void setup_bag_menu_textboxes(void)
{
u8 i;
InitWindows(gUnknown_08614174);
DeactivateAllTextPrinters();
sub_809882C(0, 1, -32);
@ -2328,7 +2328,7 @@ void bag_menu_print(u8 a, u8 b, const u8 *str, u8 c, u8 d, u8 e, u8 f, u8 g, u8
u8 sub_81AE124(u8 a)
{
return gUnknown_0203CE54->unk810[a];
}
}
u8 bag_menu_add_window(u8 a)
{
@ -2409,7 +2409,7 @@ void PrintTMHMMoveData(u16 itemId)
u8 i;
u16 moveId;
const u8* text;
FillWindowPixelBuffer(4, 0);
if (itemId == ITEM_NONE)
{

View File

@ -1,6 +1,7 @@
#include "global.h"
#include "item_use.h"
#include "battle.h"
#include "main.h"
#include "berry.h"
#include "bike.h"
#include "coins.h"
@ -45,7 +46,7 @@ extern void ItemUseOutOfBattle_EvolutionStone(u8 b);
extern void bag_menu_mail_related(void);
extern void OpenPokeblockCase(u8 a, void(*b)(void));
extern void overworld_free_bg_tilemaps(void);
extern bool32 sav1_map_is_biking_allowed(void);
extern bool32 Overworld_IsBikingAllowed(void);
extern bool8 IsPlayerFacingSurfableFishableWater(void);
extern bool8 sub_81221AC(void);
extern u8 gText_ItemFinderNothing[];
@ -85,11 +86,12 @@ extern void sub_81C59BC(void);
extern void sub_81AB9A8(u8);
extern void sub_81ABA88(u8);
extern void sub_80B7CC8(void);
extern void flagmods_08054D70(void);
extern void Overworld_ResetStateAfterDigEscRope(void);
extern u8* sub_806CF78(u16);
extern void sub_81B89F0(void);
extern u8 GetItemEffectType(u16);
extern struct MapConnection *sub_8088A8C(s16, s16);
extern void (*gFieldCallback)(void);
void MapPostLoadHook_UseItem(void);
void sub_80AF6D4(void);
@ -119,7 +121,7 @@ void DisplayItemMessageOnField(u8 taskId, u8* str, void(*callback)(u8 taskId));
void sub_81C6714(u8 taskId);
void CleanUpAfterFailingToUseRegisteredKeyItemOnField(u8 taskId);
void StartFishing(u8 a);
bool8 ItemfinderCheckForHiddenItems(struct MapEvents *, u8);
bool8 ItemfinderCheckForHiddenItems(const struct MapEvents *, u8);
u8 sub_80FD9B0(s16 a, s16 b);
void sub_80FDA24(u8 a);
void sub_80FD8E0(u8 taskId, s16 x, s16 y);
@ -236,7 +238,7 @@ void ItemUseOutOfBattle_Bike(u8 taskId)
DisplayCannotDismountBikeMessage(taskId, data[3]);
else
{
if (sav1_map_is_biking_allowed() == TRUE && IsBikingDisallowedByPlayer() == 0)
if (Overworld_IsBikingAllowed() == TRUE && IsBikingDisallowedByPlayer() == 0)
{
gUnknown_0203A0F4 = ItemUseOnFieldCB_Bike;
SetUpItemUseOnFieldCallback(taskId);
@ -363,7 +365,7 @@ void sub_80FD5CC(u8 taskId)
DestroyTask(taskId);
}
bool8 ItemfinderCheckForHiddenItems(struct MapEvents *events, u8 taskId)
bool8 ItemfinderCheckForHiddenItems(const struct MapEvents *events, u8 taskId)
{
int distanceX, distanceY;
s16 x, y, i, newDistanceX, newDistanceY;
@ -390,7 +392,7 @@ bool8 ItemfinderCheckForHiddenItems(struct MapEvents *events, u8 taskId)
return FALSE;
}
bool8 sub_80FD6D4(struct MapEvents *events, s16 x, s16 y)
bool8 sub_80FD6D4(const struct MapEvents *events, s16 x, s16 y)
{
u8 bgEventCount = events->bgEventCount;
struct BgEvent *bgEvent = events->bgEvents;
@ -637,7 +639,7 @@ void sub_80FDC00(u8 taskId)
if (!gPaletteFade.active)
{
overworld_free_bg_tilemaps();
OpenPokeblockCase(0, c2_exit_to_overworld_2_switch);
OpenPokeblockCase(0, CB2_ReturnToField);
DestroyTask(taskId);
}
}
@ -678,7 +680,7 @@ void sub_80FDD10(u8 taskId)
{
gUnknown_0203A0F4 = sub_80FDD74;
gFieldCallback = MapPostLoadHook_UseItem;
*gUnknown_0203CE54 = c2_exit_to_overworld_2_switch;
*gUnknown_0203CE54 = CB2_ReturnToField;
unknown_ItemMenu_Confirm(taskId);
}
else
@ -904,7 +906,7 @@ void task08_080A1C44(u8 taskId)
void re_escape_rope(u8 taskId)
{
flagmods_08054D70();
Overworld_ResetStateAfterDigEscRope();
sub_80FE058();
gTasks[taskId].data[0] = 0;
DisplayItemMessageOnField(taskId, gStringVar4, task08_080A1C44);

View File

@ -1079,7 +1079,7 @@ void sub_818E914(void)
void sub_818E92C(void)
{
OpenPokeblockCase(3, c2_exit_to_overworld_2_switch);
OpenPokeblockCase(3, CB2_ReturnToField);
}
void sub_818E940(void)

View File

@ -28,6 +28,8 @@
#include "link.h"
#include "link_rfu.h"
extern u16 gUnknown_03005DA8;
// Static type declarations
struct BlockTransfer

View File

@ -16,6 +16,8 @@
#include "rom_8011DC0.h"
#include "link_rfu.h"
extern u16 gUnknown_03005DA8;
// Static type declarations
// Static RAM declarations

View File

@ -133,12 +133,12 @@ void MoveSaveBlocks_ResetHeap(void)
}
u8 sav2_x1_query_bit1(void)
u32 GetSecretBase2Field_9(void)
{
return gSaveBlock2Ptr->specialSaveWarp & 1;
}
void sav2_x9_clear_bit1(void)
void ClearSecretBase2Field_9(void)
{
gSaveBlock2Ptr->specialSaveWarp &= ~1;
}

View File

@ -295,7 +295,7 @@ void CB2_ReinitMainMenu(void)
u32 InitMainMenu(bool8 returningFromOptionsMenu)
{
SetVBlankCallback(NULL);
SetGpuReg(REG_OFFSET_DISPCNT, 0);
SetGpuReg(REG_OFFSET_BG2CNT, 0);
SetGpuReg(REG_OFFSET_BG1CNT, 0);
@ -306,11 +306,11 @@ u32 InitMainMenu(bool8 returningFromOptionsMenu)
SetGpuReg(REG_OFFSET_BG1VOFS, 0);
SetGpuReg(REG_OFFSET_BG0HOFS, 0);
SetGpuReg(REG_OFFSET_BG0VOFS, 0);
DmaFill16(3, 0, (void *)VRAM, VRAM_SIZE);
DmaFill32(3, 0, (void *)OAM, OAM_SIZE);
DmaFill16(3, 0, (void *)(PLTT + 2), PLTT_SIZE - 2);
ResetPaletteFade();
LoadPalette(gMainMenuBgPal, 0, 32);
LoadPalette(gMainMenuTextPal, 0xF0, 32);
@ -331,7 +331,7 @@ u32 InitMainMenu(bool8 returningFromOptionsMenu)
InitWindows(gUnknown_082FF038);
DeactivateAllTextPrinters();
LoadMainMenuWindowFrameTiles(0, MAIN_MENU_BORDER_TILE);
SetGpuReg(REG_OFFSET_WIN0H, 0);
SetGpuReg(REG_OFFSET_WIN0V, 0);
SetGpuReg(REG_OFFSET_WININ, 0);
@ -339,7 +339,7 @@ u32 InitMainMenu(bool8 returningFromOptionsMenu)
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BLDY, 0);
EnableInterrupts(1);
SetVBlankCallback(VBlankCB_MainMenu);
SetMainCallback2(CB2_MainMenu);
@ -347,14 +347,14 @@ u32 InitMainMenu(bool8 returningFromOptionsMenu)
ShowBg(0);
HideBg(1);
CreateTask(Task_MainMenuCheckSaveFile, 0);
return 0;
}
void Task_MainMenuCheckSaveFile(u8 taskId)
{
s16* data = gTasks[taskId].data;
if (!gPaletteFade.active)
{
SetGpuReg(REG_OFFSET_WIN0H, 0);
@ -364,7 +364,7 @@ void Task_MainMenuCheckSaveFile(u8 taskId)
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_DARKEN | BLDCNT_TGT1_BG0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BLDY, 7);
if (sub_80093CC())
data[15] = 1;
switch (gSaveFileStatus)
@ -442,7 +442,7 @@ void Task_MainMenuCheckBattery(u8 taskId)
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_DARKEN | BLDCNT_TGT1_BG0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BLDY, 7);
if (!(RtcGetErrorStatus() & RTC_ERR_FLAG_MASK))
{
gTasks[taskId].func = Task_DisplayMainMenu;
@ -470,7 +470,7 @@ void Task_DisplayMainMenu(u8 taskId)
{
s16* data = gTasks[taskId].data;
u16 palette;
if (!gPaletteFade.active)
{
SetGpuReg(REG_OFFSET_WIN0H, 0);
@ -480,19 +480,19 @@ void Task_DisplayMainMenu(u8 taskId)
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_EFFECT_DARKEN | BLDCNT_TGT1_BG0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BLDY, 7);
palette = RGB_BLACK;
LoadPalette(&palette, 254, 2);
palette = RGB_WHITE;
LoadPalette(&palette, 250, 2);
palette = RGB(12, 12, 12);
LoadPalette(&palette, 251, 2);
palette = RGB(26, 26, 25);
LoadPalette(&palette, 252, 2);
if (gSaveBlock2Ptr->playerGender == MALE)
{
palette = RGB(4, 16, 31);
@ -503,7 +503,7 @@ void Task_DisplayMainMenu(u8 taskId)
palette = RGB(31, 3, 21);
LoadPalette(&palette, 241, 2);
}
switch (gTasks[taskId].data[0])
{
case HAS_NO_SAVED_GAME:
@ -611,7 +611,7 @@ void Task_HighlightSelectedMainMenuItem(u8 taskId)
bool8 HandleMainMenuInput(u8 taskId)
{
s16* data = gTasks[taskId].data;
if (gMain.newKeys & A_BUTTON)
{
PlaySE(SE_SELECT);
@ -664,7 +664,7 @@ void Task_HandleMainMenuAPressed(u8 taskId)
{
bool8 r2;
u8 action;
if (!gPaletteFade.active)
{
if (gTasks[taskId].data[0] == 3)
@ -791,7 +791,7 @@ void Task_HandleMainMenuAPressed(u8 taskId)
case 1:
gPlttBufferUnfaded[0] = RGB_BLACK;
gPlttBufferFaded[0] = RGB_BLACK;
SetMainCallback2(sub_8086230);
SetMainCallback2(CB2_ContinueSavedGame);
DestroyTask(taskId);
break;
case 2:
@ -888,7 +888,7 @@ void Task_DisplayMainMenuInvalidActionError(u8 taskId)
void HighlightSelectedMainMenuItem(u8 menuType, u8 selectedMenuItem, s16 a)
{
SetGpuReg(REG_OFFSET_WIN0H, 0x9E7);
switch (menuType)
{
case HAS_NO_SAVED_GAME:
@ -982,7 +982,7 @@ void task_new_game_prof_birch_speech_1(u8 taskId)
SetGpuReg(REG_OFFSET_BLDCNT, 0);
SetGpuReg(REG_OFFSET_BLDALPHA, 0);
SetGpuReg(REG_OFFSET_BLDY, 0);
LZ77UnCompVram(gBirchIntroShadowGfx, (void*)VRAM);
LZ77UnCompVram(gUnknown_082FEEF0, (void*)(VRAM + 0x3800));
LoadPalette(gUnknown_082FECFC, 0, 64);
@ -1006,7 +1006,7 @@ void task_new_game_prof_birch_speech_1(u8 taskId)
void task_new_game_prof_birch_speech_2(u8 taskId)
{
u8 spriteId;
if (gTasks[taskId].data[7])
{
gTasks[taskId].data[7]--;
@ -1074,12 +1074,12 @@ void task_new_game_prof_birch_speech_5(u8 taskId)
void sub_8030A70(u8 taskId)
{
u8 spriteId = gTasks[gUnknown_03000DD0].data[9];
gSprites[spriteId].pos1.x = 0x64;
gSprites[spriteId].pos1.y = 0x4B;
gSprites[spriteId].invisible = 0;
gSprites[spriteId].data[0] = 0;
CreatePokeballSpriteToReleaseMon(spriteId, gSprites[spriteId].oam.paletteNum, 0x70, 0x3A, 0, 0, 0x20, 0xFFFF, SPECIES_LOTAD);
gTasks[taskId].func = sub_8030B14;
gTasks[gUnknown_03000DD0].data[7] = 0;
@ -1167,7 +1167,7 @@ void task_new_game_prof_birch_speech_9(u8 taskId)
else
{
u8 spriteId = gTasks[taskId].data[10];
gSprites[spriteId].pos1.x = 0xB4;
gSprites[spriteId].pos1.y = 0x3C;
gSprites[spriteId].invisible = 0;
@ -1211,7 +1211,7 @@ void task_new_game_prof_birch_speech_13(u8 taskId)
{
int gender = sub_8031DB4();
int r3;
switch (gender)
{
case MALE:
@ -1227,7 +1227,7 @@ void task_new_game_prof_birch_speech_13(u8 taskId)
gTasks[taskId].func = task_new_game_prof_birch_speech_14;
break;
}
r3 = GetMenuCursorPos();
r3 = GetMenuCursorPos();
if (r3 != gTasks[taskId].data[6])
{
gTasks[taskId].data[6] = r3;
@ -1264,7 +1264,7 @@ void sub_8030ED4(u8 taskId)
void sub_8030F7C(u8 taskId)
{
u8 spriteId = gTasks[taskId].data[2];
if (gSprites[spriteId].pos1.x > 0xB4)
{
gSprites[spriteId].pos1.x -= 4;
@ -1366,7 +1366,7 @@ void task_new_game_prof_birch_speech_part2_5(u8 taskId)
void task_new_game_prof_birch_speech_part2_6(u8 taskId)
{
u8 spriteId;
if (gTasks[taskId].data[5])
{
gSprites[gTasks[taskId].data[10]].invisible = TRUE;
@ -1411,7 +1411,7 @@ void task_new_game_prof_birch_speech_part2_7(u8 taskId)
void task_new_game_prof_birch_speech_part2_8(u8 taskId)
{
u8 spriteId;
if (gTasks[taskId].data[5])
{
gSprites[gTasks[taskId].data[8]].invisible = 1;
@ -1441,7 +1441,7 @@ void task_new_game_prof_birch_speech_part2_8(u8 taskId)
void task_new_game_prof_birch_speech_part2_9(u8 taskId)
{
u8 spriteId;
if (gTasks[taskId].data[5])
{
gSprites[gTasks[taskId].data[2]].oam.objMode = 0;
@ -1463,7 +1463,7 @@ void task_new_game_prof_birch_speech_part2_9(u8 taskId)
void task_new_game_prof_birch_speech_part2_10(u8 taskId)
{
u8 spriteId = gTasks[taskId].data[2];
if (gSprites[spriteId].affineAnimEnded)
gTasks[taskId].func = task_new_game_prof_birch_speech_part2_11;
}
@ -1471,7 +1471,7 @@ void task_new_game_prof_birch_speech_part2_10(u8 taskId)
void task_new_game_prof_birch_speech_part2_11(u8 taskId)
{
u8 spriteId;
if (!gPaletteFade.active)
{
spriteId = gTasks[taskId].data[2];
@ -1499,7 +1499,7 @@ void new_game_prof_birch_speech_part2_start(void)
u8 taskId;
u8 spriteId;
u16 savedIme;
ResetBgsAndClearDma3BusyFlags(0);
SetGpuReg(REG_OFFSET_DISPCNT, 0);
SetGpuReg(REG_OFFSET_DISPCNT, DISPCNT_OBJ_ON | DISPCNT_OBJ_1D_MAP);
@ -1577,7 +1577,7 @@ void nullsub_11(struct Sprite *sprite)
void sub_80318D8(struct Sprite *sprite)
{
u32 y;
y = (sprite->pos1.y << 16) + sprite->data[0] + 0xC000;
sprite->pos1.y = y >> 16;
sprite->data[0] = y;
@ -1594,7 +1594,7 @@ void AddBirchSpeechObjects(u8 taskId)
u8 spriteId2;
u8 spriteId3;
u8 spriteId4;
gSprites[spriteId].callback = nullsub_11;
gSprites[spriteId].oam.priority = 0;
gSprites[spriteId].invisible = TRUE;
@ -1619,7 +1619,7 @@ void AddBirchSpeechObjects(u8 taskId)
void sub_8031A5C(u8 taskId)
{
int alpha;
if (gTasks[taskId].data[1] == 0)
{
gTasks[gTasks[taskId].data[0]].data[5] = 1;
@ -1642,7 +1642,7 @@ void sub_8031A5C(u8 taskId)
void sub_8031ACC(u8 taskId, u8 a)
{
u8 taskId2;
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_BG1 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT1_OBJ);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(16, 0));
SetGpuReg(REG_OFFSET_BLDY, 0);
@ -1658,7 +1658,7 @@ void sub_8031ACC(u8 taskId, u8 a)
void sub_8031B3C(u8 taskId)
{
int alpha;
if (gTasks[taskId].data[1] == 16)
{
gTasks[gTasks[taskId].data[0]].data[5] = 1;
@ -1681,7 +1681,7 @@ void sub_8031B3C(u8 taskId)
void sub_8031BAC(u8 taskId, u8 a)
{
u8 taskId2;
SetGpuReg(REG_OFFSET_BLDCNT, BLDCNT_TGT2_BG1 | BLDCNT_EFFECT_BLEND | BLDCNT_TGT1_OBJ);
SetGpuReg(REG_OFFSET_BLDALPHA, BLDALPHA_BLEND(0, 16));
SetGpuReg(REG_OFFSET_BLDY, 0);
@ -1719,7 +1719,7 @@ void sub_8031C1C(u8 taskId)
void sub_8031C88(u8 taskId, u8 a)
{
u8 taskId2;
taskId2 = CreateTask(sub_8031C1C, 0);
gTasks[taskId2].data[0] = taskId;
gTasks[taskId2].data[1] = 0;
@ -1753,7 +1753,7 @@ void sub_8031CC8(u8 taskId)
void sub_8031D34(u8 taskId, u8 a)
{
u8 taskId2;
taskId2 = CreateTask(sub_8031CC8, 0);
gTasks[taskId2].data[0] = taskId;
gTasks[taskId2].data[1] = 8;
@ -1781,7 +1781,7 @@ void set_default_player_name(u8 nameId)
{
const u8* name;
u8 i;
if (gSaveBlock2Ptr->playerGender == MALE)
name = gMalePresetNames[nameId];
else
@ -1821,7 +1821,7 @@ void fmt_player(void)
{
u8 str[0x20];
u8* ptr;
StringExpandPlaceholders(gStringVar4, gText_ContinueMenuTime);
box_print(2, 1, 0x6C, 17, gUnknown_082FF0E3, -1, gStringVar4);
ptr = ConvertIntToDecimalStringN(str, gSaveBlock2Ptr->playTimeHours, 0, 3);
@ -1834,7 +1834,7 @@ void fmt_pokedex(void)
{
u8 str[0x20];
u16 dexCount;
if (FlagGet(FLAG_SYS_POKEDEX_GET) == TRUE)
{
if (IsNationalPokedexEnabled())
@ -1853,7 +1853,7 @@ void fmt_badges(void)
u8 str[0x20];
u8 badgeCount = 0;
u32 i;
for (i = FLAG_BADGE01_GET; i <= FLAG_BADGE08_GET; i++)
{
if (FlagGet(i))
@ -1880,7 +1880,7 @@ void DrawMainMenuWindowBorder(const struct WindowTemplate *template, u16 baseTil
u16 sp10 = 6 + baseTileNum;
u16 sp14 = 7 + baseTileNum;
u16 r6 = 8 + baseTileNum;
FillBgTilemapBufferRect(template->priority, baseTileNum, template->tilemapLeft - 1, template->tilemapTop - 1, 1, 1, 2);
FillBgTilemapBufferRect(template->priority, r9, template->tilemapLeft, template->tilemapTop - 1, template->width, 1, 2);
FillBgTilemapBufferRect(template->priority, r10, template->tilemapLeft + template->width, template->tilemapTop - 1, 1, 1, 2);
@ -1919,7 +1919,7 @@ void sub_8032318(u8 a)
u8 fontAttribute3 = GetFontAttribute(1, 1);
u8 windowAttribute = GetWindowAttribute(a, 3);
u8 windowAttribute2 = GetWindowAttribute(a, 4);
FillWindowPixelRect(a, fontAttribute, 0, 0, fontAttribute2 * windowAttribute, fontAttribute3 * windowAttribute2);
CopyWindowToVram(a, 2);
}
@ -1936,7 +1936,7 @@ void sub_80323A0(struct TextSubPrinter *printer, u16 a)
void sub_80323CC(u8 a, u8 b, u16 c, u16 d, u8 e, u8 f)
{
struct WindowTemplate sp;
sp = sub_8198A50(0, a + 1, b + 1, 5, 4, f, d);
CreateYesNoMenu(&sp, c, e, 0);
}

View File

@ -1798,22 +1798,22 @@ static bool8 sub_80E503C(u8 character)
static void sub_80E5074(void)
{
DoNamingScreen(0, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, sub_8086194);
DoNamingScreen(0, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, CB2_ReturnToFieldWithOpenMenu);
}
static void sub_80E509C(void)
{
DoNamingScreen(1, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, sub_8086194);
DoNamingScreen(1, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, CB2_ReturnToFieldWithOpenMenu);
}
static void sub_80E50C4(void)
{
DoNamingScreen(2, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, sub_8086194);
DoNamingScreen(2, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, CB2_ReturnToFieldWithOpenMenu);
}
static void sub_80E50EC(void)
{
DoNamingScreen(3, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, sub_8086194);
DoNamingScreen(3, gSaveBlock2Ptr->playerName, gSaveBlock2Ptr->playerGender, 0, 0, CB2_ReturnToFieldWithOpenMenu);
}
//--------------------------------------------------

File diff suppressed because it is too large Load Diff

View File

@ -74,7 +74,7 @@ extern void (*gFieldCallback)(void);
extern const u16 gUnknown_0860F074[];
extern void c2_exit_to_overworld_2_switch(void);
extern void CB2_ReturnToField(void);
extern bool8 sub_81221EC(void);
extern void sub_809882C(u8, u16, u8);
extern void copy_textbox_border_tile_patterns_to_vram(u8, u16, u8);
@ -374,7 +374,7 @@ void OpenPokeblockCaseInBattle(void)
void OpenPokeblockCaseOnFeeder(void)
{
OpenPokeblockCase(PBLOCK_CASE_FEEDER, c2_exit_to_overworld_2_switch);
OpenPokeblockCase(PBLOCK_CASE_FEEDER, CB2_ReturnToField);
}
static void CB2_PokeblockMenu(void)

View File

@ -881,7 +881,7 @@ static void RegionMap_InitializeStateBasedOnPlayerLocation(void)
return;
}
switch (get_map_light_level_by_bank_and_number(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum))
switch (GetMapTypeByGroupAndId(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum))
{
default:
case 1:
@ -904,7 +904,7 @@ static void RegionMap_InitializeStateBasedOnPlayerLocation(void)
case 7:
if (gMapHeader.flags & 0x02)
{
mapHeader = get_mapheader_by_bank_and_number(gSaveBlock1Ptr->warp4.mapGroup, gSaveBlock1Ptr->warp4.mapNum);
mapHeader = Overworld_GetMapHeaderByGroupAndId(gSaveBlock1Ptr->warp4.mapGroup, gSaveBlock1Ptr->warp4.mapNum);
gRegionMap->mapSecId = mapHeader->regionMapSectionId;
gRegionMap->playerIsInCave = TRUE;
mapWidth = mapHeader->mapData->width;
@ -923,7 +923,7 @@ static void RegionMap_InitializeStateBasedOnPlayerLocation(void)
}
break;
case 9:
mapHeader = get_mapheader_by_bank_and_number((u16)gSaveBlock1Ptr->warp2.mapGroup, (u16)gSaveBlock1Ptr->warp2.mapNum);
mapHeader = Overworld_GetMapHeaderByGroupAndId((u16)gSaveBlock1Ptr->warp2.mapGroup, (u16)gSaveBlock1Ptr->warp2.mapNum);
gRegionMap->mapSecId = mapHeader->regionMapSectionId;
gRegionMap->playerIsInCave = TRUE;
mapWidth = mapHeader->mapData->width;
@ -937,12 +937,12 @@ static void RegionMap_InitializeStateBasedOnPlayerLocation(void)
if (gRegionMap->mapSecId != MAPSEC_DYNAMIC)
{
storedWarp = &gSaveBlock1Ptr->warp4;
mapHeader = get_mapheader_by_bank_and_number(storedWarp->mapGroup, storedWarp->mapNum);
mapHeader = Overworld_GetMapHeaderByGroupAndId(storedWarp->mapGroup, storedWarp->mapNum);
}
else
{
storedWarp = &gSaveBlock1Ptr->warp2;
mapHeader = get_mapheader_by_bank_and_number(storedWarp->mapGroup, storedWarp->mapNum);
mapHeader = Overworld_GetMapHeaderByGroupAndId(storedWarp->mapGroup, storedWarp->mapNum);
gRegionMap->mapSecId = mapHeader->regionMapSectionId;
}
if (RegionMap_IsPlayerInCave(gRegionMap->mapSecId))
@ -1065,7 +1065,7 @@ static void RegionMap_InitializeStateBasedOnSSTidalLocation(void)
break;
default:
case 0:
mapHeader = get_mapheader_by_bank_and_number(mapGroup, mapNum);
mapHeader = Overworld_GetMapHeaderByGroupAndId(mapGroup, mapNum);
gRegionMap->mapSecId = mapHeader->regionMapSectionId;
dimensionScale = mapHeader->mapData->width / gRegionMapEntries[gRegionMap->mapSecId].width;
@ -1581,7 +1581,7 @@ void MCB2_FlyMap(void)
gUnknown_0203A148 = malloc(sizeof(*gUnknown_0203A148));
if (gUnknown_0203A148 == NULL)
{
SetMainCallback2(sub_8086194);
SetMainCallback2(CB2_ReturnToFieldWithOpenMenu);
}
else
{

View File

@ -26,5 +26,5 @@ void sub_81700F8(void)
Sav2_ClearSetDefault();
SetPokemonCryStereo(gSaveBlock2Ptr->optionsSound);
InitHeap(gHeap, HEAP_SIZE);
SetMainCallback2(sub_8086230);
SetMainCallback2(CB2_ContinueSavedGame);
}

View File

@ -30,9 +30,9 @@ extern void sub_80EE44C(u8, u8);
extern void IncrementGameStat(u8 index);
extern void ScriptContext1_SetupScript(u8*);
extern void ScriptContext2_RunNewScript(u8*);
extern void c2_exit_to_overworld_2_switch(void);
extern void c2_exit_to_overworld_1_continue_scripts_restart_music(void);
extern void c2_load_new_map(void);
extern void CB2_ReturnToField(void);
extern void CB2_ReturnToFieldContinueScript(void);
extern void CB2_LoadMap(void);
extern void sub_80AF6F0(void);
extern void ScriptContext1_Stop(void);
extern void warp_in(void);
@ -112,20 +112,20 @@ void CB2_EndSafariBattle(void)
sSafariZoneCaughtMons++;
if (gNumSafariBalls != 0)
{
SetMainCallback2(c2_exit_to_overworld_2_switch);
SetMainCallback2(CB2_ReturnToField);
}
else if (gBattleOutcome == B_OUTCOME_NO_SAFARI_BALLS)
{
ScriptContext2_RunNewScript(EventScript_2A4B4C);
warp_in();
gFieldCallback = sub_80AF6F0;
SetMainCallback2(c2_load_new_map);
SetMainCallback2(CB2_LoadMap);
}
else if (gBattleOutcome == B_OUTCOME_CAUGHT)
{
ScriptContext1_SetupScript(EventScript_2A4B9B);
ScriptContext1_Stop();
SetMainCallback2(c2_exit_to_overworld_1_continue_scripts_restart_music);
SetMainCallback2(CB2_ReturnToFieldContinueScript);
}
}

View File

@ -2054,7 +2054,7 @@ bool8 ScrCmd_playslotmachine(struct ScriptContext *ctx)
{
u8 slotMachineIndex = VarGet(ScriptReadHalfword(ctx));
PlaySlotMachine(slotMachineIndex, c2_exit_to_overworld_1_continue_scripts_restart_music);
PlaySlotMachine(slotMachineIndex, CB2_ReturnToFieldContinueScript);
ScriptContext1_Stop();
return TRUE;
}

View File

@ -243,7 +243,7 @@ void ScriptContext2_RunNewScript(const u8 *ptr)
u8 *mapheader_get_tagged_pointer(u8 tag)
{
u8 *mapScripts = gMapHeader.mapScripts;
const u8 *mapScripts = gMapHeader.mapScripts;
if (!mapScripts)
return NULL;

View File

@ -3,6 +3,7 @@
#include "global.h"
#include "constants/decorations.h"
#include "malloc.h"
#include "main.h"
#include "task.h"
#include "palette.h"
#include "list_menu.h"
@ -39,6 +40,10 @@
#include "tv.h"
#include "secret_base.h"
extern void (*gFieldCallback)(void);
extern void mapldr_default(void);
// Static type declarations
struct SecretBaseListMenuBuffer {
@ -244,7 +249,7 @@ void sub_80E8C98(void)
void sub_80E8CB0(s16 *xPtr, s16 *yPtr, u16 tile)
{
struct MapData *mapData;
const struct MapData *mapData;
s16 x;
s16 y;
@ -386,7 +391,7 @@ void sub_80E8FD0(u8 taskId)
sub_80E8F9C();
warp_in();
gFieldCallback = sub_80AF168;
SetMainCallback2(c2_load_new_map);
SetMainCallback2(CB2_LoadMap);
DestroyTask(taskId);
break;
}
@ -444,7 +449,7 @@ void sub_80E916C(u8 taskId)
Overworld_SetWarpDestination(gSaveBlock1Ptr->location.mapGroup, gSaveBlock1Ptr->location.mapNum, -1, gUnknown_0858CFE8[idx + 2], gUnknown_0858CFE8[idx + 3]);
warp_in();
gFieldCallback = sub_80E9108;
SetMainCallback2(c2_load_new_map);
SetMainCallback2(CB2_LoadMap);
DestroyTask(taskId);
}
}
@ -642,7 +647,7 @@ void sub_80E96A4(u8 taskId)
copy_saved_warp2_bank_and_enter_x_to_warp1(0x7e);
warp_in();
gFieldCallback = mapldr_default;
SetMainCallback2(c2_load_new_map);
SetMainCallback2(CB2_LoadMap);
ScriptContext2_Disable();
DestroyTask(taskId);
break;
@ -773,7 +778,7 @@ void sub_80E9AD0(void)
u16 i;
u16 j;
s16 tile;
struct MapEvents *events;
const struct MapEvents *events;
events = gMapHeader.events;
for (i = 0; i < events->bgEventCount; i ++)

View File

@ -3633,7 +3633,7 @@ void ChangePokemonNickname(void)
void ChangePokemonNickname_CB(void)
{
SetMonData(&gPlayerParty[gSpecialVar_0x8004], MON_DATA_NICKNAME, gStringVar2);
c2_exit_to_overworld_1_continue_scripts_restart_music();
CB2_ReturnToFieldContinueScript();
}
void ChangeBoxPokemonNickname(void)
@ -3649,7 +3649,7 @@ void ChangeBoxPokemonNickname(void)
void ChangeBoxPokemonNickname_CB(void)
{
SetBoxMonNickFromAnyBox(gSpecialVar_MonBoxId, gSpecialVar_MonBoxPos, gStringVar2);
c2_exit_to_overworld_1_continue_scripts_restart_music();
CB2_ReturnToFieldContinueScript();
}
void TV_CopyNicknameToStringVar1AndEnsureTerminated(void)

View File

@ -14,7 +14,7 @@ extern const u8 gText_Peekaboo[];
extern u8 *GetWaldaPhrasePtr(void);
extern bool32 IsWaldaPhraseEmpty(void);
extern void sub_80AF168(void);
extern void c2_exit_to_overworld_2_switch(void);
extern void CB2_ReturnToField(void);
extern void SetWaldaPhrase(const u8 *src);
extern void SetWaldaWallpaperPatternId(u8 patternId);
extern void SetWaldaWallpaperIconId(u8 iconId);
@ -80,7 +80,7 @@ static void CB2_HandleGivenWaldaPhrase(void)
StringCopy(gStringVar1, GetWaldaPhrasePtr());
gFieldCallback = sub_80AF168;
SetMainCallback2(c2_exit_to_overworld_2_switch);
SetMainCallback2(CB2_ReturnToField);
}
static u32 GetWaldaPhraseInputCase(u8 *inputPtr)

View File

@ -52,7 +52,7 @@ gUnknown_03005DB0: @ 3005DB0
gUnknown_03005DB4: @ 3005DB4
.space 0x4
gUnknown_03005DB8: @ 3005DB8
gFieldLinkPlayerCount: @ 3005DB8
.space 0x8
gUnknown_03005DC0: @ 3005DC0

View File

@ -208,35 +208,7 @@ gDifferentSaveFile: @ 20322D4
gUnknown_020322D5: @ 20322D5
.space 0x3
gUnknown_020322D8: @ 20322D8
.space 0x4
gUnknown_020322DC: @ 20322DC
.space 0x8
gUnknown_020322E4: @ 20322E4
.space 0x8
gUnknown_020322EC: @ 20322EC
.space 0x8
gUnknown_020322F4: @ 20322F4
.space 0x8
gUnknown_020322FC: @ 20322FC
.space 0x4
gUnknown_02032300: @ 2032300
.space 0x4
gUnknown_02032304: @ 2032304
.space 0x2
gUnknown_02032306: @ 2032306
.space 0x2
gLinkPlayerMapObjects: @ 2032308
.space 0x10
.include "src/overworld.o"
gUnknown_02032318: @ 2032318
.space 0x5000