From fff185d924985fc49cfadf16c3e1c0b50cf906d6 Mon Sep 17 00:00:00 2001 From: red031000 Date: Sun, 24 Nov 2024 12:07:31 +0200 Subject: [PATCH 1/2] start to decompile field_move.c --- arm9/arm9.lsf | 3 +- arm9/asm/{unk_02063948.s => field_move_s.s} | 516 ++------------------ arm9/asm/scrcmd_12.s | 26 +- arm9/asm/scrcmd_3.s | 2 +- arm9/asm/unk_0202B870.s | 4 +- arm9/asm/unk_0202DB14.s | 4 +- arm9/asm/unk_02035068.s | 102 ++-- arm9/asm/unk_02036FA4.s | 2 +- arm9/asm/unk_02037024.s | 10 +- arm9/asm/unk_020372D4.s | 4 +- arm9/asm/unk_020377F0.s | 24 +- arm9/asm/unk_02038C78.s | 6 +- arm9/asm/unk_02046030.s | 2 +- arm9/asm/unk_020476CC.s | 14 +- arm9/asm/unk_020484A8.s | 8 +- arm9/asm/unk_02048904.s | 6 +- arm9/asm/unk_0204A498.s | 8 +- arm9/asm/unk_0204B34C.s | 6 +- arm9/asm/unk_0204B9EC.s | 2 +- arm9/asm/unk_0204C1B4.s | 20 +- arm9/asm/unk_0204CB20.s | 10 +- arm9/asm/unk_02050E48.s | 10 +- arm9/asm/unk_020520AC.s | 2 +- arm9/asm/unk_02052EE8.s | 2 +- arm9/asm/unk_02053750.s | 2 +- arm9/asm/unk_0205478C.s | 4 +- arm9/asm/unk_02055068.s | 6 +- arm9/asm/unk_020557F4.s | 20 +- arm9/asm/unk_02058EE8.s | 8 +- arm9/asm/unk_02059F04.s | 4 +- arm9/asm/unk_0205C598.s | 4 +- arm9/asm/unk_0205CE48.s | 54 +- arm9/asm/unk_0205DD18.s | 4 +- arm9/asm/unk_0205E4EC.s | 6 +- arm9/asm/unk_0205F7A0.s | 8 +- arm9/asm/unk_02060344.s | 2 +- arm9/asm/unk_020603B0.s | 2 +- arm9/asm/unk_020607D4.s | 4 +- arm9/asm/unk_0206367C.s | 2 +- arm9/asm/unk_02064E90.s | 2 +- arm9/asm/unk_020653EC.s | 2 +- arm9/asm/unk_02066840.s | 2 +- arm9/asm/unk_02073DA8.s | 2 +- arm9/asm/unk_02080C38.s | 2 +- arm9/asm/unk_02086084.s | 2 +- arm9/asm/unk_02087D00.s | 2 +- arm9/asm/unk_0208A258.s | 2 +- arm9/asm/unk_0208A338.s | 2 +- arm9/global.inc | 36 +- arm9/overlays/05/asm/ov05_021D74E0.s | 8 +- arm9/overlays/05/asm/ov05_021D80E8.s | 32 +- arm9/overlays/05/asm/ov05_021E1374.s | 2 +- arm9/overlays/05/asm/ov05_021E1AD8.s | 2 +- arm9/overlays/05/asm/ov05_021E5FD8.s | 18 +- arm9/overlays/05/asm/ov05_021E8310.s | 4 +- arm9/overlays/05/asm/ov05_021E88E8.s | 2 +- arm9/overlays/05/asm/ov05_021EC458.s | 2 +- arm9/overlays/05/asm/ov05_021F3854.s | 4 +- arm9/overlays/05/asm/ov05_021F4CF8.s | 4 +- arm9/overlays/05/asm/ov05_021F5518.s | 4 +- arm9/overlays/06/asm/overlay_06.s | 54 +- arm9/overlays/14/asm/overlay_14.s | 2 +- arm9/overlays/18/asm/overlay_18.s | 26 +- arm9/overlays/20/asm/ov20_02252440.s | 2 +- arm9/overlays/51/asm/overlay_51.s | 2 +- arm9/overlays/52/src/overlay_52.c | 4 +- arm9/overlays/54/asm/overlay_54.s | 2 +- arm9/overlays/55/asm/overlay_55.s | 4 +- arm9/overlays/56/asm/overlay_56.s | 4 +- arm9/overlays/59/src/ov59_Intro.c | 4 +- arm9/overlays/67/asm/overlay_67.s | 2 +- arm9/overlays/75/asm/overlay_75.s | 2 +- arm9/overlays/83/asm/overlay_83.s | 6 +- arm9/overlays/86/asm/overlay_86.s | 2 +- arm9/src/blackout.c | 2 +- arm9/src/field_move.c | 247 ++++++++++ arm9/src/mail.c | 2 +- arm9/src/message_format.c | 2 +- arm9/src/player_data.c | 2 +- arm9/src/scrcmd.c | 30 +- arm9/src/scrcmd_13.c | 2 +- arm9/src/scrcmd_coins.c | 4 +- arm9/src/scrcmd_daycare.c | 2 +- arm9/src/scrcmd_flags.c | 6 +- arm9/src/scrcmd_mart.c | 2 +- arm9/src/scrcmd_money.c | 10 +- arm9/src/scrcmd_move_relearner.c | 2 +- arm9/src/scrcmd_names.c | 4 +- arm9/src/scrcmd_party.c | 4 +- arm9/src/scrcmd_union.c | 2 +- arm9/src/script_pokemon_util.c | 4 +- arm9/src/task.c | 4 +- arm9/src/unk_02031734.c | 4 +- arm9/src/unk_0204AF24.c | 2 +- arm9/src/unk_0205EC84.c | 2 +- arm9/src/unk_0205FA2C.c | 2 +- arm9/src/unk_0208890C.c | 2 +- include/constants/badge.h | 13 + include/constants/field_move_response.h | 11 + include/constants/sprites.h | 4 + include/constants/std_script.h | 6 + include/constants/weather.h | 2 +- include/field_move.h | 78 +++ include/field_system.h | 14 +- include/field_types_def.h | 2 + include/player_data.h | 2 +- include/script.h | 5 +- include/start_menu.h | 46 ++ include/task.h | 26 +- include/unk_0205EC84.h | 2 +- include/unk_0205F7A0.h | 10 + 111 files changed, 862 insertions(+), 877 deletions(-) rename arm9/asm/{unk_02063948.s => field_move_s.s} (65%) create mode 100644 arm9/src/field_move.c create mode 100644 include/constants/badge.h create mode 100644 include/constants/field_move_response.h create mode 100644 include/constants/std_script.h create mode 100644 include/field_move.h create mode 100644 include/start_menu.h create mode 100644 include/unk_0205F7A0.h diff --git a/arm9/arm9.lsf b/arm9/arm9.lsf index ec9bddc58..fb04a8ad3 100644 --- a/arm9/arm9.lsf +++ b/arm9/arm9.lsf @@ -240,7 +240,8 @@ Static arm9 Object unk_020625EC.o Object unk_0206367C.o Object unk_02063888.o - Object unk_02063948.o + Object field_move.o + Object field_move_s.o Object unk_0206439C.o Object unk_020643C0.o Object unk_020647A4.o diff --git a/arm9/asm/unk_02063948.s b/arm9/asm/field_move_s.s similarity index 65% rename from arm9/asm/unk_02063948.s rename to arm9/asm/field_move_s.s index 195787995..84d5858e7 100644 --- a/arm9/asm/unk_02063948.s +++ b/arm9/asm/field_move_s.s @@ -1,439 +1,11 @@ .include "asm/macros.inc" .include "global.inc" - .section .rodata - - .global UNK_020F7CE4 -UNK_020F7CE4: ; 0x020F7CE4 - .word sub_02063AD0, sub_02063A9C - .word sub_02063BBC, sub_02063B40 - .word sub_02063C70, sub_02063C14 - .word sub_02063D18, sub_02063CE0 - .word sub_02063DC0, sub_02063D88 - .word sub_02063E68, sub_02063E30 - .word sub_02063F10, sub_02063ED8 - .word sub_02063FCC, sub_02063F80 - .word sub_0206405C, sub_0206403C - .word sub_02064134, sub_020640CC - .word sub_020641F0, sub_020641AC - .word sub_020642B4, sub_02064284 - .word sub_02064324, sub_02064310 + .extern FieldMove_CreateUseEnvironment + .extern FieldMove_DeleteUseEnvironment .text - thumb_func_start sub_02063948 -sub_02063948: ; 0x02063948 - cmp r0, #0x0 - bne _02063954 - ldr r0, _0206395C ; =UNK_020F7CE4 - lsl r1, r1, #0x3 - ldr r0, [r0, r1] - bx lr -_02063954: - ldr r0, _02063960 ; =UNK_020F7CE4 + 4 - lsl r1, r1, #0x3 - ldr r0, [r0, r1] - bx lr - .balign 4 -_0206395C: .word UNK_020F7CE4 -_02063960: .word UNK_020F7CE4 + 4 - - thumb_func_start sub_02063964 -sub_02063964: ; 0x02063964 - push {r4-r7, lr} - sub sp, #0xc - add r5, r0, #0x0 - add r4, r1, #0x0 - str r5, [r4, #0x4] - ldr r1, [r5, #0x1c] - ldr r1, [r1, #0x0] - str r1, [r4, #0x0] - mov r1, #0x0 - strh r1, [r4, #0xc] - add r1, sp, #0x8 - bl sub_02037024 - ldr r0, [sp, #0x8] - str r0, [r4, #0x8] - ldr r0, [sp, #0x8] - cmp r0, #0x0 - beq _020639B6 - bl MapObject_GetSpriteID - cmp r0, #0x54 - beq _0206399A - cmp r0, #0x55 - beq _020639A4 - cmp r0, #0x56 - beq _020639AE - b _020639B6 -_0206399A: - ldrh r1, [r4, #0xc] - mov r0, #0x8 - orr r0, r1 - strh r0, [r4, #0xc] - b _020639B6 -_020639A4: - ldrh r1, [r4, #0xc] - mov r0, #0x20 - orr r0, r1 - strh r0, [r4, #0xc] - b _020639B6 -_020639AE: - ldrh r1, [r4, #0xc] - mov r0, #0x1 - orr r0, r1 - strh r0, [r4, #0xc] -_020639B6: - ldr r0, [r5, #0x38] - bl GetPlayerXCoord - str r0, [sp, #0x4] - ldr r0, [r5, #0x38] - bl GetPlayerYCoord - add r2, r0, #0x0 - ldr r1, [sp, #0x4] - str r2, [sp, #0x0] - add r0, r5, #0x0 - bl sub_0204A6E0 - add r7, r0, #0x0 - ldr r0, [r5, #0x38] - add r1, sp, #0x4 - add r2, sp, #0x0 - bl sub_020572B8 - ldr r1, [sp, #0x4] - ldr r2, [sp, #0x0] - add r0, r5, #0x0 - bl sub_0204A6E0 - add r6, r0, #0x0 - ldr r0, [r5, #0x38] - add r1, r7, #0x0 - add r2, r6, #0x0 - bl ov05_021E643C - cmp r0, #0x0 - beq _020639FE - ldrh r1, [r4, #0xc] - mov r0, #0x4 - orr r0, r1 - strh r0, [r4, #0xc] -_020639FE: - ldr r0, [r5, #0x38] - bl PlayerAvatar_GetFacingDirection - add r1, r0, #0x0 - add r0, r6, #0x0 - bl ov05_021E69BC - cmp r0, #0x0 - beq _02063A18 - ldrh r1, [r4, #0xc] - mov r0, #0x80 - orr r0, r1 - strh r0, [r4, #0xc] -_02063A18: - lsl r0, r6, #0x18 - lsr r0, r0, #0x18 - bl sub_02054A48 - cmp r0, #0x0 - beq _02063A2C - ldrh r1, [r4, #0xc] - mov r0, #0x40 - orr r0, r1 - strh r0, [r4, #0xc] -_02063A2C: - ldr r0, [r5, #0xc] - bl Save_LocalFieldData_Get - bl LocalFieldData_GetWeatherType - cmp r0, #0xe - beq _02063A42 - cmp r0, #0x10 - beq _02063A4E - add sp, #0xc - pop {r4-r7, pc} -_02063A42: - ldrh r1, [r4, #0xc] - mov r0, #0x10 - add sp, #0xc - orr r0, r1 - strh r0, [r4, #0xc] - pop {r4-r7, pc} -_02063A4E: - ldrh r1, [r4, #0xc] - mov r0, #0x1 - lsl r0, r0, #0x8 - orr r0, r1 - strh r0, [r4, #0xc] - add sp, #0xc - pop {r4-r7, pc} - - thumb_func_start sub_02063A5C -sub_02063A5C: ; 0x02063A5C - push {r3-r5, lr} - add r5, r0, #0x0 - add r4, r1, #0x0 - mov r0, #0x20 - mov r1, #0x10 - bl AllocFromHeap - ldr r1, _02063A7C ; =0x19740205 - str r1, [r0, #0x0] - ldr r1, [r4, #0x8] - str r1, [r0, #0x4] - ldr r2, [r5, #0x0] - ldr r1, [r5, #0x4] - str r2, [r0, #0x8] - str r1, [r0, #0xc] - pop {r3-r5, pc} - .balign 4 -_02063A7C: .word 0x19740205 - - thumb_func_start sub_02063A80 -sub_02063A80: ; 0x02063A80 - push {r4, lr} - add r4, r0, #0x0 - ldr r1, [r4, #0x0] - ldr r0, _02063A98 ; =0x19740205 - cmp r1, r0 - beq _02063A90 - bl GF_AssertFail -_02063A90: - add r0, r4, #0x0 - bl FreeToHeap - pop {r4, pc} - .balign 4 -_02063A98: .word 0x19740205 - - thumb_func_start sub_02063A9C -sub_02063A9C: ; 0x02063A9C - push {r4, lr} - add r4, r0, #0x0 - ldr r1, [r4, #0x4] - ldr r0, [r1, #0x6c] - sub r0, r0, #0x2 - cmp r0, #0x1 - bhi _02063AAE - mov r0, #0x1 - pop {r4, pc} -_02063AAE: - ldr r0, [r1, #0xc] - bl Save_PlayerData_GetProfileAddr - mov r1, #0x1 - bl PlayerProfile_TestBadgeFlag - cmp r0, #0x0 - bne _02063AC2 - mov r0, #0x2 - pop {r4, pc} -_02063AC2: - ldrh r1, [r4, #0xc] - mov r0, #0x1 - tst r1, r0 - beq _02063ACC - mov r0, #0x0 -_02063ACC: - pop {r4, pc} - .balign 4 - - thumb_func_start sub_02063AD0 -sub_02063AD0: ; 0x02063AD0 - push {r4-r6, lr} - add r5, r0, #0x0 - ldr r0, [r5, #0x0] - add r6, r1, #0x0 - bl TaskManager_GetEnvironment - add r4, r0, #0x0 - add r0, r5, #0x0 - add r1, r6, #0x0 - bl sub_02063A5C - add r5, r0, #0x0 - ldr r0, [r6, #0x4] - bl sub_0204649C - mov r0, #0x72 - ldr r1, _02063B00 ; =sub_02063B04 - lsl r0, r0, #0x2 - str r1, [r4, r0] - add r0, #0x30 - str r5, [r4, r0] - mov r0, #0xa - strh r0, [r4, #0x2a] - pop {r4-r6, pc} - .balign 4 -_02063B00: .word sub_02063B04 - - thumb_func_start sub_02063B04 -sub_02063B04: ; 0x02063B04 - push {r3-r6, lr} - sub sp, #0x4 - add r5, r0, #0x0 - bl TaskManager_GetEnvironment - add r4, r0, #0x0 - add r0, r5, #0x0 - bl TaskManager_GetFieldSystem - add r6, r0, #0x0 - ldr r1, _02063B3C ; =0x00002718 - ldr r2, [r4, #0x4] - add r0, r5, #0x0 - bl StartScriptFromMenu - mov r2, #0x0 - str r2, [sp, #0x0] - ldrh r1, [r4, #0xc] - add r0, r6, #0x0 - add r3, r2, #0x0 - bl sub_020395BC - add r0, r4, #0x0 - bl sub_02063A80 - mov r0, #0x0 - add sp, #0x4 - pop {r3-r6, pc} - .balign 4 -_02063B3C: .word 0x00002718 - - thumb_func_start sub_02063B40 -sub_02063B40: ; 0x02063B40 - push {r4, lr} - add r4, r0, #0x0 - ldr r1, [r4, #0x4] - ldr r0, [r1, #0x6c] - sub r0, r0, #0x2 - cmp r0, #0x1 - bhi _02063B52 - mov r0, #0x1 - pop {r4, pc} -_02063B52: - ldr r0, [r1, #0xc] - bl Save_PlayerData_GetProfileAddr - mov r1, #0x2 - bl PlayerProfile_TestBadgeFlag - cmp r0, #0x0 - bne _02063B66 - mov r0, #0x2 - pop {r4, pc} -_02063B66: - ldr r0, [r4, #0x0] - bl MapHeader_IsFlyAllowed - cmp r0, #0x0 - bne _02063B74 - mov r0, #0x1 - pop {r4, pc} -_02063B74: - ldr r0, [r4, #0x4] - ldr r0, [r0, #0xc] - bl Save_VarsFlags_Get - bl Save_VarsFlags_CheckHaveFollower - cmp r0, #0x1 - bne _02063B88 - mov r0, #0x3 - pop {r4, pc} -_02063B88: - ldr r0, [r4, #0x4] - ldr r0, [r0, #0xc] - bl Save_VarsFlags_Get - bl Save_VarsFlags_CheckSafariSysFlag - cmp r0, #0x1 - beq _02063BA8 - ldr r0, [r4, #0x4] - ldr r0, [r0, #0xc] - bl Save_VarsFlags_Get - bl sub_0205F244 - cmp r0, #0x1 - bne _02063BAC -_02063BA8: - mov r0, #0x1 - b _02063BAE -_02063BAC: - mov r0, #0x0 -_02063BAE: - cmp r0, #0x1 - bne _02063BB6 - mov r0, #0x1 - pop {r4, pc} -_02063BB6: - mov r0, #0x0 - pop {r4, pc} - .balign 4 - - thumb_func_start sub_02063BBC -sub_02063BBC: ; 0x02063BBC - push {r4-r6, lr} - add r5, r0, #0x0 - ldr r0, [r5, #0x0] - bl TaskManager_GetFieldSystem - add r6, r0, #0x0 - ldr r0, [r5, #0x0] - bl TaskManager_GetEnvironment - add r4, r0, #0x0 - mov r0, #0xb - mov r1, #0x4 - bl AllocFromHeap - ldrh r1, [r5, #0x4] - str r1, [r0, #0x0] - mov r1, #0x7f - lsl r1, r1, #0x2 - str r0, [r4, r1] - mov r0, #0xb - sub r1, #0xbc - bl AllocFromHeap - mov r1, #0x7e - lsl r1, r1, #0x2 - str r0, [r4, r1] - ldr r1, [r4, r1] - add r0, r6, #0x0 - mov r2, #0x1 - bl sub_0205F7A0 - mov r1, #0x7e - lsl r1, r1, #0x2 - ldr r1, [r4, r1] - add r0, r6, #0x0 - bl sub_02037E90 - ldr r1, _02063C10 ; =sub_02036AB8 - add r0, r4, #0x0 - bl sub_02035D04 - pop {r4-r6, pc} - .balign 4 -_02063C10: .word sub_02036AB8 - - thumb_func_start sub_02063C14 -sub_02063C14: ; 0x02063C14 - push {r4, lr} - add r4, r0, #0x0 - ldr r1, [r4, #0x4] - ldr r0, [r1, #0x6c] - sub r0, r0, #0x2 - cmp r0, #0x1 - bhi _02063C26 - mov r0, #0x1 - pop {r4, pc} -_02063C26: - ldr r0, [r1, #0xc] - bl Save_PlayerData_GetProfileAddr - mov r1, #0x4 - bl PlayerProfile_TestBadgeFlag - cmp r0, #0x0 - bne _02063C3A - mov r0, #0x2 - pop {r4, pc} -_02063C3A: - ldr r0, [r4, #0x4] - ldr r0, [r0, #0x38] - bl PlayerAvatar_GetState - cmp r0, #0x2 - bne _02063C4A - mov r0, #0x4 - pop {r4, pc} -_02063C4A: - ldrh r1, [r4, #0xc] - mov r0, #0x4 - tst r0, r1 - bne _02063C56 - mov r0, #0x1 - pop {r4, pc} -_02063C56: - ldr r0, [r4, #0x4] - ldr r0, [r0, #0xc] - bl Save_VarsFlags_Get - bl Save_VarsFlags_CheckHaveFollower - cmp r0, #0x1 - bne _02063C6A - mov r0, #0x3 - pop {r4, pc} -_02063C6A: - mov r0, #0x0 - pop {r4, pc} - .balign 4 - thumb_func_start sub_02063C70 sub_02063C70: ; 0x02063C70 push {r4-r6, lr} @@ -444,10 +16,10 @@ sub_02063C70: ; 0x02063C70 add r4, r0, #0x0 add r0, r5, #0x0 add r1, r6, #0x0 - bl sub_02063A5C + bl FieldMove_CreateUseEnvironment add r5, r0, #0x0 ldr r0, [r6, #0x4] - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0x72 ldr r1, _02063CA0 ; =sub_02063CA4 lsl r0, r0, #0x2 @@ -479,9 +51,9 @@ sub_02063CA4: ; 0x02063CA4 ldrh r1, [r4, #0xc] add r0, r6, #0x0 add r3, r2, #0x0 - bl sub_020395BC + bl FieldMove_SetArgs add r0, r4, #0x0 - bl sub_02063A80 + bl FieldMove_DeleteUseEnvironment mov r0, #0x0 add sp, #0x4 pop {r3-r6, pc} @@ -501,7 +73,7 @@ sub_02063CE0: ; 0x02063CE0 pop {r4, pc} _02063CF2: ldr r0, [r1, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile mov r1, #0x5 bl PlayerProfile_TestBadgeFlag cmp r0, #0x0 @@ -530,10 +102,10 @@ sub_02063D18: ; 0x02063D18 add r4, r0, #0x0 add r0, r5, #0x0 add r1, r6, #0x0 - bl sub_02063A5C + bl FieldMove_CreateUseEnvironment add r5, r0, #0x0 ldr r0, [r6, #0x4] - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0x72 ldr r1, _02063D48 ; =sub_02063D4C lsl r0, r0, #0x2 @@ -565,9 +137,9 @@ sub_02063D4C: ; 0x02063D4C ldrh r1, [r4, #0xc] add r0, r6, #0x0 add r3, r2, #0x0 - bl sub_020395BC + bl FieldMove_SetArgs add r0, r4, #0x0 - bl sub_02063A80 + bl FieldMove_DeleteUseEnvironment mov r0, #0x0 add sp, #0x4 pop {r3-r6, pc} @@ -587,7 +159,7 @@ sub_02063D88: ; 0x02063D88 pop {r4, pc} _02063D9A: ldr r0, [r1, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile mov r1, #0x3 bl PlayerProfile_TestBadgeFlag cmp r0, #0x0 @@ -616,10 +188,10 @@ sub_02063DC0: ; 0x02063DC0 add r4, r0, #0x0 add r0, r5, #0x0 add r1, r6, #0x0 - bl sub_02063A5C + bl FieldMove_CreateUseEnvironment add r5, r0, #0x0 ldr r0, [r6, #0x4] - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0x72 ldr r1, _02063DF0 ; =sub_02063DF4 lsl r0, r0, #0x2 @@ -651,9 +223,9 @@ sub_02063DF4: ; 0x02063DF4 ldrh r1, [r4, #0xc] add r0, r6, #0x0 add r3, r2, #0x0 - bl sub_020395BC + bl FieldMove_SetArgs add r0, r4, #0x0 - bl sub_02063A80 + bl FieldMove_DeleteUseEnvironment mov r0, #0x0 add sp, #0x4 pop {r3-r6, pc} @@ -673,7 +245,7 @@ sub_02063E30: ; 0x02063E30 pop {r4, pc} _02063E42: ldr r0, [r1, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile mov r1, #0x0 bl PlayerProfile_TestBadgeFlag cmp r0, #0x0 @@ -702,10 +274,10 @@ sub_02063E68: ; 0x02063E68 add r4, r0, #0x0 add r0, r5, #0x0 add r1, r6, #0x0 - bl sub_02063A5C + bl FieldMove_CreateUseEnvironment add r5, r0, #0x0 ldr r0, [r6, #0x4] - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0x72 ldr r1, _02063E98 ; =sub_02063E9C lsl r0, r0, #0x2 @@ -737,9 +309,9 @@ sub_02063E9C: ; 0x02063E9C ldrh r1, [r4, #0xc] add r0, r6, #0x0 add r3, r2, #0x0 - bl sub_020395BC + bl FieldMove_SetArgs add r0, r4, #0x0 - bl sub_02063A80 + bl FieldMove_DeleteUseEnvironment mov r0, #0x0 add sp, #0x4 pop {r3-r6, pc} @@ -759,7 +331,7 @@ sub_02063ED8: ; 0x02063ED8 pop {r4, pc} _02063EEA: ldr r0, [r1, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile mov r1, #0x7 bl PlayerProfile_TestBadgeFlag cmp r0, #0x0 @@ -788,10 +360,10 @@ sub_02063F10: ; 0x02063F10 add r4, r0, #0x0 add r0, r5, #0x0 add r1, r6, #0x0 - bl sub_02063A5C + bl FieldMove_CreateUseEnvironment add r5, r0, #0x0 ldr r0, [r6, #0x4] - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0x72 ldr r1, _02063F40 ; =sub_02063F44 lsl r0, r0, #0x2 @@ -823,9 +395,9 @@ sub_02063F44: ; 0x02063F44 ldrh r1, [r4, #0xc] add r0, r6, #0x0 add r3, r2, #0x0 - bl sub_020395BC + bl FieldMove_SetArgs add r0, r4, #0x0 - bl sub_02063A80 + bl FieldMove_DeleteUseEnvironment mov r0, #0x0 add sp, #0x4 pop {r3-r6, pc} @@ -845,7 +417,7 @@ sub_02063F80: ; 0x02063F80 pop {r4, pc} _02063F92: ldr r0, [r1, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile mov r1, #0x6 bl PlayerProfile_TestBadgeFlag cmp r0, #0x0 @@ -883,10 +455,10 @@ sub_02063FCC: ; 0x02063FCC add r4, r0, #0x0 add r0, r5, #0x0 add r1, r6, #0x0 - bl sub_02063A5C + bl FieldMove_CreateUseEnvironment add r5, r0, #0x0 ldr r0, [r6, #0x4] - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0x72 ldr r1, _02063FFC ; =sub_02064000 lsl r0, r0, #0x2 @@ -918,9 +490,9 @@ sub_02064000: ; 0x02064000 ldrh r1, [r4, #0xc] add r0, r6, #0x0 add r3, r2, #0x0 - bl sub_020395BC + bl FieldMove_SetArgs add r0, r4, #0x0 - bl sub_02063A80 + bl FieldMove_DeleteUseEnvironment mov r0, #0x0 add sp, #0x4 pop {r3-r6, pc} @@ -958,10 +530,10 @@ sub_0206405C: ; 0x0206405C add r4, r0, #0x0 add r0, r5, #0x0 add r1, r6, #0x0 - bl sub_02063A5C + bl FieldMove_CreateUseEnvironment add r5, r0, #0x0 ldr r0, [r6, #0x4] - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0x72 ldr r1, _0206408C ; =sub_02064090 lsl r0, r0, #0x2 @@ -993,9 +565,9 @@ sub_02064090: ; 0x02064090 ldrh r1, [r4, #0xc] add r0, r6, #0x0 add r3, r2, #0x0 - bl sub_020395BC + bl FieldMove_SetArgs add r0, r4, #0x0 - bl sub_02063A80 + bl FieldMove_DeleteUseEnvironment mov r0, #0x0 add sp, #0x4 pop {r3-r6, pc} @@ -1039,7 +611,7 @@ _02064100: ldr r0, [r4, #0x4] ldr r0, [r0, #0xc] bl Save_VarsFlags_Get - bl sub_0205F244 + bl Save_VarsFlags_CheckPalParkSysFlag cmp r0, #0x1 bne _02064124 _02064120: @@ -1068,7 +640,7 @@ sub_02064134: ; 0x02064134 bl TaskManager_GetEnvironment add r4, r0, #0x0 add r0, r6, #0x0 - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay ldrh r1, [r5, #0x4] ldr r2, [r6, #0xc] mov r0, #0xb @@ -1160,7 +732,7 @@ sub_020641F0: ; 0x020641F0 bl TaskManager_GetEnvironment add r4, r0, #0x0 add r0, r6, #0x0 - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay ldrh r1, [r5, #0x4] ldr r2, [r6, #0xc] mov r0, #0xb @@ -1229,7 +801,7 @@ sub_02064284: ; 0x02064284 _02064294: ldr r0, [r1, #0xc] bl Save_VarsFlags_Get - bl sub_0205F244 + bl Save_VarsFlags_CheckPalParkSysFlag cmp r0, #0x1 bne _020642A6 mov r0, #0x1 @@ -1263,7 +835,7 @@ sub_020642B4: ; 0x020642B4 bl sub_0206439C add r6, r0, #0x0 add r0, r5, #0x0 - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0x72 ldr r1, _0206430C ; =ov05_021F6360 lsl r0, r0, #0x2 @@ -1315,10 +887,10 @@ sub_02064324: ; 0x02064324 add r4, r0, #0x0 add r0, r5, #0x0 add r1, r6, #0x0 - bl sub_02063A5C + bl FieldMove_CreateUseEnvironment add r5, r0, #0x0 add r0, r7, #0x0 - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0x72 ldr r1, _0206435C ; =sub_02064360 lsl r0, r0, #0x2 @@ -1350,9 +922,9 @@ sub_02064360: ; 0x02064360 ldrh r1, [r4, #0xc] add r0, r6, #0x0 add r3, r2, #0x0 - bl sub_020395BC + bl FieldMove_SetArgs add r0, r4, #0x0 - bl sub_02063A80 + bl FieldMove_DeleteUseEnvironment mov r0, #0x0 add sp, #0x4 pop {r3-r6, pc} diff --git a/arm9/asm/scrcmd_12.s b/arm9/asm/scrcmd_12.s index 986108b1f..fef042675 100644 --- a/arm9/asm/scrcmd_12.s +++ b/arm9/asm/scrcmd_12.s @@ -322,7 +322,7 @@ sub_02042F48: ; 0x02042F48 strh r0, [r2, #0x0] ldr r0, [r4, #0x0] ldr r0, [r0, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r2, r0, #0x0 ldr r0, [r4, #0x4] mov r1, #0x0 @@ -339,7 +339,7 @@ sub_02042F6C: ; 0x02042F6C str r0, [sp, #0x10] ldr r0, [sp, #0x4] ldr r0, [r0, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile str r0, [sp, #0xc] ldr r0, [sp, #0x10] mov r7, #0x0 @@ -690,7 +690,7 @@ sub_02043274: ; 0x02043274 strh r0, [r6, #0x0] ldr r0, [r5, #0x0] ldr r0, [r0, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r2, r0, #0x0 ldr r0, [r5, #0x4] mov r1, #0x0 @@ -736,7 +736,7 @@ sub_020432C8: ; 0x020432C8 strh r0, [r6, #0x0] ldr r0, [r5, #0x0] ldr r0, [r0, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r2, r0, #0x0 ldr r0, [r5, #0x4] mov r1, #0x0 @@ -808,7 +808,7 @@ sub_02043358: ; 0x02043358 strh r0, [r6, #0x0] ldr r0, [r5, #0x0] ldr r0, [r0, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r2, r0, #0x0 ldr r0, [r5, #0x4] mov r1, #0x0 @@ -876,7 +876,7 @@ sub_020433DC: ; 0x020433DC strh r0, [r6, #0x0] ldr r0, [r5, #0x0] ldr r0, [r0, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r2, r0, #0x0 ldr r0, [r5, #0x4] mov r1, #0x0 @@ -949,7 +949,7 @@ sub_0204346C: ; 0x0204346C strh r0, [r6, #0x0] ldr r0, [r5, #0x0] ldr r0, [r0, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r2, r0, #0x0 ldr r0, [r5, #0x4] mov r1, #0x0 @@ -1077,7 +1077,7 @@ _02043574: strh r0, [r6, #0x0] ldr r0, [r5, #0x0] ldr r0, [r0, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r2, r0, #0x0 ldr r0, [r5, #0x4] mov r1, #0x0 @@ -1151,7 +1151,7 @@ sub_020435F8: ; 0x020435F8 strh r0, [r6, #0x0] ldr r0, [r5, #0x0] ldr r0, [r0, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r2, r0, #0x0 ldr r0, [r5, #0x4] mov r1, #0x0 @@ -1243,7 +1243,7 @@ sub_020436B8: ; 0x020436B8 strh r0, [r6, #0x0] ldr r0, [r5, #0x0] ldr r0, [r0, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r2, r0, #0x0 ldr r0, [r5, #0x4] mov r1, #0x0 @@ -1334,7 +1334,7 @@ sub_02043774: ; 0x02043774 strh r0, [r6, #0x0] ldr r0, [r5, #0x0] ldr r0, [r0, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r2, r0, #0x0 ldr r0, [r5, #0x4] mov r1, #0x0 @@ -1415,7 +1415,7 @@ sub_02043818: ; 0x02043818 strh r0, [r6, #0x0] ldr r0, [r5, #0x0] ldr r0, [r0, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r2, r0, #0x0 ldr r0, [r5, #0x4] mov r1, #0x0 @@ -1441,7 +1441,7 @@ sub_02043850: ; 0x02043850 strh r0, [r6, #0x0] ldr r0, [r5, #0x0] ldr r0, [r0, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r2, r0, #0x0 ldr r0, [r5, #0x4] mov r1, #0x0 diff --git a/arm9/asm/scrcmd_3.s b/arm9/asm/scrcmd_3.s index aa84f9bde..1194cdf84 100644 --- a/arm9/asm/scrcmd_3.s +++ b/arm9/asm/scrcmd_3.s @@ -79,7 +79,7 @@ ScrCmd_Unk00FA: ; 0x0203FF10 add r0, #0x80 ldr r0, [r0, #0x0] bl FieldSystem_GetSaveData - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r4, r0, #0x0 add r0, r5, #0x0 bl ScriptReadHalfword diff --git a/arm9/asm/unk_0202B870.s b/arm9/asm/unk_0202B870.s index eb0e4973f..c297fb66d 100644 --- a/arm9/asm/unk_0202B870.s +++ b/arm9/asm/unk_0202B870.s @@ -243,7 +243,7 @@ sub_0202B9EC: ; 0x0202B9EC sub sp, #0xc add r5, r0, #0x0 add r4, r1, #0x0 - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile mov r1, #0x4e add r6, r0, #0x0 add r0, r4, #0x0 @@ -718,7 +718,7 @@ sub_0202BD6C: ; 0x0202BD6C str r2, [sp, #0x0] add r4, r0, #0x0 add r5, r1, #0x0 - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile str r0, [sp, #0x4] ldr r0, [sp, #0x0] mov r1, #0x4c diff --git a/arm9/asm/unk_0202DB14.s b/arm9/asm/unk_0202DB14.s index 45ce715de..aaad77d9b 100644 --- a/arm9/asm/unk_0202DB14.s +++ b/arm9/asm/unk_0202DB14.s @@ -15,7 +15,7 @@ sub_0202DB14: ; 0x0202DB14 sub sp, #0xc str r0, [sp, #0x0] str r1, [sp, #0x4] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile str r0, [sp, #0x8] ldr r0, _0202DBA0 ; =UNK_021C59E4 ldr r0, [r0, #0x0] @@ -137,7 +137,7 @@ sub_0202DBE0: ; 0x0202DBE0 ldr r0, _0202DCD8 ; =UNK_021C59E4 ldr r0, [r0, #0x0] ldr r0, [r0, #0x4] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile ldr r1, _0202DCD8 ; =UNK_021C59E4 ldr r2, [r1, #0x0] lsl r1, r4, #0x2 diff --git a/arm9/asm/unk_02035068.s b/arm9/asm/unk_02035068.s index 3451fcc16..669c24e3f 100644 --- a/arm9/asm/unk_02035068.s +++ b/arm9/asm/unk_02035068.s @@ -97,7 +97,7 @@ sub_02035080: ; 0x02035080 _020350A6: ldr r0, [r5, #0xc] bl Save_VarsFlags_Get - bl sub_0205F244 + bl Save_VarsFlags_CheckPalParkSysFlag cmp r0, #0x1 bne _020350C2 add r0, r5, #0x0 @@ -236,7 +236,7 @@ sub_020351A0: ; 0x020351A0 _020351D4: ldr r0, [r5, #0xc] bl Save_VarsFlags_Get - bl sub_0205F244 + bl Save_VarsFlags_CheckPalParkSysFlag cmp r0, #0x1 bne _020351F0 add r0, r5, #0x0 @@ -430,7 +430,7 @@ _02035328: lsl r1, r1, #0x2 add r0, r5, #0x0 add r1, r4, r1 - bl sub_02063964 + bl FieldMove_InitCheckData add r0, r6, #0x0 bl sub_0203549C add r0, r6, #0x0 @@ -670,7 +670,7 @@ _02035526: str r0, [sp, #0x20] ldr r0, [sp, #0x1c] ldr r0, [r0, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r2, r0, #0x0 add r0, r6, #0x0 mov r1, #0x0 @@ -776,7 +776,7 @@ _02035614: bl ScheduleWindowCopyToVram ldr r0, [sp, #0x1c] ldr r0, [r0, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile bl PlayerProfile_GetTrainerGender add r3, r0, #0x0 add r0, r4, #0x0 @@ -927,7 +927,7 @@ sub_02035734: ; 0x02035734 _0203575A: ldr r0, [r4, #0xc] bl Save_VarsFlags_Get - bl sub_0205F244 + bl Save_VarsFlags_CheckPalParkSysFlag cmp r0, #0x1 beq _0203576A b _0203588E @@ -1083,7 +1083,7 @@ sub_020358A0: ; 0x020358A0 bne _020358CE ldr r0, [r4, #0xc] bl Save_VarsFlags_Get - bl sub_0205F244 + bl Save_VarsFlags_CheckPalParkSysFlag cmp r0, #0x0 beq _020358E0 _020358CE: @@ -1622,8 +1622,8 @@ sub_02035CDC: ; 0x02035CDC _02035D02: pop {r4-r6, pc} - thumb_func_start sub_02035D04 -sub_02035D04: ; 0x02035D04 + thumb_func_start StartMenu_SetExitTaskFunc +StartMenu_SetExitTaskFunc: ; 0x02035D04 mov r2, #0x72 lsl r2, r2, #0x2 str r1, [r0, r2] @@ -1667,7 +1667,7 @@ sub_02035D34: ; 0x02035D34 bl Save_Pokedex_Get str r0, [sp, #0x0] ldr r0, [r5, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile str r0, [sp, #0x4] ldr r0, [r5, #0xc] bl Save_VarsFlags_Get @@ -1724,7 +1724,7 @@ sub_02035DC8: ; 0x02035DC8 bl TaskManager_GetEnvironment add r4, r0, #0x0 add r0, r5, #0x0 - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0x7e lsl r0, r0, #0x2 ldr r1, [r4, r0] @@ -1881,7 +1881,7 @@ _02035ECC: add r0, r7, #0x0 bl sub_0207B000 ldr r0, [r5, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r1, r0, #0x0 add r0, r7, #0x0 bl sub_0207C2A4 @@ -1893,7 +1893,7 @@ _02035ECC: str r7, [r4, r0] ldr r1, _02036270 ; =sub_0203684C add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc b _0203625E _02035F4A: mov r0, #0xb @@ -1929,7 +1929,7 @@ _02035F4A: add r0, r7, #0x0 bl sub_0207B000 ldr r0, [r5, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r1, r0, #0x0 add r0, r7, #0x0 bl sub_0207C2A4 @@ -1950,7 +1950,7 @@ _02035F4A: str r7, [r4, r0] ldr r1, _02036270 ; =sub_0203684C add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc b _0203625E _02035FD0: mov r0, #0xb @@ -1986,7 +1986,7 @@ _02035FD0: add r0, r7, #0x0 bl sub_0207B000 ldr r0, [r5, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r1, r0, #0x0 add r0, r7, #0x0 bl sub_0207C2A4 @@ -2007,7 +2007,7 @@ _02035FD0: str r7, [r4, r0] ldr r1, _02036270 ; =sub_0203684C add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc b _0203625E _02036056: ldrh r0, [r6, #0x24] @@ -2048,7 +2048,7 @@ _0203609C: str r0, [r4, r1] ldr r1, _02036278 ; =sub_02036BDC add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc b _0203625E _020360AC: ldr r0, [r5, #0xc] @@ -2075,7 +2075,7 @@ _020360AC: str r0, [r4, r1] ldr r1, _02036278 ; =sub_02036BDC add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc b _0203625E _020360EA: mov r0, #0xb @@ -2092,7 +2092,7 @@ _020360EA: bl Save_Bag_Get add r7, r0, #0x0 ldr r0, [r5, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile ldr r1, _0203627C ; =UNK_020F2A90 add r0, r7, #0x0 mov r2, #0xb @@ -2114,7 +2114,7 @@ _020360EA: bl sub_0203781C ldr r1, _02036280 ; =sub_020362E4 add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc b _0203625E _02036144: mov r0, #0xb @@ -2174,7 +2174,7 @@ _020361A4: str r7, [sp, #0x4] ldrh r1, [r1, #0x6] mov r0, #0x0 - bl sub_02063948 + bl FieldMove_GetMoveFunc mov r1, #0x7a lsl r1, r1, #0x2 add r2, r0, #0x0 @@ -2193,7 +2193,7 @@ _020361CA: str r0, [r4, r1] ldr r1, _02036280 ; =sub_020362E4 add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc b _0203625E _020361E6: add r0, r6, #0x0 @@ -2232,7 +2232,7 @@ _02036226: _0203622A: ldr r1, _02036280 ; =sub_020362E4 add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc b _0203625E _02036234: cmp r0, #0x9 @@ -2247,11 +2247,11 @@ _02036234: str r0, [r4, r1] ldr r1, _02036280 ; =sub_020362E4 add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc b _0203625E _02036254: add r0, r5, #0x0 - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0xc strh r0, [r4, #0x2a] _0203625E: @@ -2435,7 +2435,7 @@ _0203638A: str r5, [r4, r0] ldr r1, _02036508 ; =sub_02035E50 add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc b _020364F8 _020363F6: ldr r0, [r6, #0xc] @@ -2489,7 +2489,7 @@ _020363F6: str r0, [r4, r1] ldr r1, _0203650C ; =sub_02036BDC add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc b _020364F8 _02036474: mov r0, #0xb @@ -2545,11 +2545,11 @@ _020364CE: str r5, [r4, r0] ldr r1, _02036508 ; =sub_02035E50 add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc b _020364F8 _020364EE: add r0, r6, #0x0 - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0xc strh r0, [r4, #0x2a] _020364F8: @@ -2638,7 +2638,7 @@ sub_02036584: ; 0x02036584 ldr r0, [r4, r0] bl sub_02065070 add r0, r5, #0x0 - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0xc strh r0, [r4, #0x2a] mov r0, #0x0 @@ -2796,7 +2796,7 @@ sub_020366D4: ; 0x020366D4 ldr r0, [r4, r0] bl FreeToHeap add r0, r5, #0x0 - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0xc strh r0, [r4, #0x2a] mov r0, #0x0 @@ -2904,7 +2904,7 @@ _020367CA: ldr r0, [r5, r0] bl sub_020853A8 add r0, r4, #0x0 - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay ldr r0, [r4, #0x7c] bl sub_02052F74 mov r0, #0x0 @@ -3056,7 +3056,7 @@ _020368EE: str r5, [r4, r0] ldr r1, _02036958 ; =sub_02035E50 add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc b _0203694A _0203692E: mov r1, #0x7a @@ -3070,7 +3070,7 @@ _0203692E: str r0, [r4, r1] ldr r1, _02036958 ; =sub_02035E50 add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc _0203694A: add r0, r7, #0x0 bl FreeToHeap @@ -3159,7 +3159,7 @@ _020369C6: bl sub_0203791C ldr r1, _02036A10 ; =sub_02036A14 add r0, r6, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc add sp, #0xc pop {r4-r7, pc} .balign 4 @@ -3204,7 +3204,7 @@ sub_02036A14: ; 0x02036A14 str r0, [r4, r1] ldr r1, _02036A74 ; =sub_020362E4 add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc mov r0, #0x0 pop {r3-r5, pc} nop @@ -3234,14 +3234,14 @@ sub_02036A78: ; 0x02036A78 str r0, [r4, r1] ldr r1, _02036AB4 ; =sub_020362E4 add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc mov r0, #0x0 pop {r3-r5, pc} .balign 4 _02036AB4: .word sub_020362E4 - thumb_func_start sub_02036AB8 -sub_02036AB8: ; 0x02036AB8 + thumb_func_start Task_UseFlyInField +Task_UseFlyInField: ; 0x02036AB8 push {r3-r7, lr} sub sp, #0x8 add r4, r0, #0x0 @@ -3277,7 +3277,7 @@ sub_02036AB8: ; 0x02036AB8 str r0, [r4, r1] ldr r1, _02036B88 ; =sub_02035E50 add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc b _02036B82 _02036B0E: ldr r0, [r6, #0xc] @@ -3322,7 +3322,7 @@ _02036B0E: mov r0, #0xb bl FreeToHeapExplicit add r0, r6, #0x0 - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0x72 ldr r1, _02036B8C ; =sub_020638BC lsl r0, r0, #0x2 @@ -3358,7 +3358,7 @@ sub_02036B90: ; 0x02036B90 str r0, [r4, r1] ldr r1, _02036BC0 ; =sub_020362E4 add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc mov r0, #0x0 pop {r3-r5, pc} .balign 4 @@ -3418,7 +3418,7 @@ _02036C0E: str r0, [r4, r1] ldr r1, _02036CE4 ; =sub_020362E4 add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc b _02036CD4 _02036C32: sub r0, r0, #0x4 @@ -3435,7 +3435,7 @@ _02036C32: str r0, [r4, r1] ldr r1, _02036CE8 ; =sub_02035E50 add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc b _02036CD4 _02036C58: sub r0, r0, #0x4 @@ -3464,7 +3464,7 @@ _02036C70: str r0, [r4, r1] ldr r1, _02036CE8 ; =sub_02035E50 add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc b _02036CD4 _02036C98: sub r0, r0, #0x4 @@ -3492,7 +3492,7 @@ _02036CB0: str r0, [r4, r1] ldr r1, _02036CE4 ; =sub_020362E4 add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc _02036CD4: mov r0, #0x7f lsl r0, r0, #0x2 @@ -3572,7 +3572,7 @@ sub_02036CEC: ; 0x02036CEC str r4, [r6, r0] ldr r1, _02036D90 ; =sub_02035E50 add r0, r6, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc pop {r3-r7, pc} nop _02036D8C: .word UNK_020F96DC @@ -3601,7 +3601,7 @@ sub_02036D94: ; 0x02036D94 str r0, [r4, r1] ldr r1, _02036DD0 ; =sub_020362E4 add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc mov r0, #0x0 pop {r3-r5, pc} nop @@ -3626,7 +3626,7 @@ sub_02036DD4: ; 0x02036DD4 str r0, [r4, r1] ldr r1, _02036E04 ; =sub_020362E4 add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc mov r0, #0x0 pop {r3-r5, pc} .balign 4 @@ -3804,7 +3804,7 @@ sub_02036F1C: ; 0x02036F1C bl FreeToHeap ldr r1, _02036FA0 ; =sub_020362E4 add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc _02036F98: pop {r3-r5, pc} nop diff --git a/arm9/asm/unk_02036FA4.s b/arm9/asm/unk_02036FA4.s index 3f7d121de..cec7dda53 100644 --- a/arm9/asm/unk_02036FA4.s +++ b/arm9/asm/unk_02036FA4.s @@ -16,7 +16,7 @@ sub_02036FA4: ; 0x02036FA4 bl GetPlayerXCoord str r0, [r4, #0x0] ldr r0, [r6, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord str r0, [r5, #0x0] cmp r7, #0x3 bhi _02036FFA diff --git a/arm9/asm/unk_02037024.s b/arm9/asm/unk_02037024.s index 19f57eb2e..0e0e848bc 100644 --- a/arm9/asm/unk_02037024.s +++ b/arm9/asm/unk_02037024.s @@ -3,8 +3,8 @@ .text - thumb_func_start sub_02037024 -sub_02037024: ; 0x02037024 + thumb_func_start FieldSystem_GetFacingObject +FieldSystem_GetFacingObject: ; 0x02037024 push {r4-r6, lr} sub sp, #0x8 add r6, r1, #0x0 @@ -16,7 +16,7 @@ sub_02037024: ; 0x02037024 ldr r1, [sp, #0x4] ldr r2, [sp, #0x0] add r0, r5, #0x0 - bl sub_0204A6E0 + bl GetMetatileBehavior bl sub_020547A4 cmp r0, #0x1 bne _0203707E @@ -67,7 +67,7 @@ sub_02037090: ; 0x02037090 push {r3-r5, lr} add r4, r1, #0x0 add r5, r0, #0x0 - bl sub_02037024 + bl FieldSystem_GetFacingObject ldr r0, [r4, #0x0] cmp r0, #0x0 beq _020370B8 @@ -335,7 +335,7 @@ sub_02037264: ; 0x02037264 add r6, r0, #0x0 ldr r0, [sp, #0x0] ldr r0, [r0, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r4, r0, #0x0 ldr r0, [sp, #0x8] mov r7, #0x0 diff --git a/arm9/asm/unk_020372D4.s b/arm9/asm/unk_020372D4.s index fe76a46f2..f5910cbfb 100644 --- a/arm9/asm/unk_020372D4.s +++ b/arm9/asm/unk_020372D4.s @@ -75,8 +75,8 @@ sub_02037334: ; 0x02037334 _02037348: .word SDK_OVERLAY_OVERLAY_63_ID _0203734C: .word ov63_021DBAB8 - thumb_func_start LoadOverlay_OVERLAY_05 -LoadOverlay_OVERLAY_05: ; 0x02037350 + thumb_func_start FieldSystem_LoadFieldOverlayInternal +FieldSystem_LoadFieldOverlayInternal: ; 0x02037350 push {r4, lr} add r4, r0, #0x0 ldr r0, [r4, #0x0] diff --git a/arm9/asm/unk_020377F0.s b/arm9/asm/unk_020377F0.s index 4d4557182..af603f39d 100644 --- a/arm9/asm/unk_020377F0.s +++ b/arm9/asm/unk_020377F0.s @@ -784,7 +784,7 @@ sub_02037C00: ; 0x02037C00 add r0, r4, #0x0 bl sub_0207B000 ldr r0, [r5, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r1, r0, #0x0 add r0, r4, #0x0 bl sub_0207C2A4 @@ -839,7 +839,7 @@ sub_02037C7C: ; 0x02037C7C add r0, r4, #0x0 bl sub_0207B000 add r0, r5, #0x0 - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r1, r0, #0x0 add r0, r4, #0x0 bl sub_0207C2A4 @@ -883,7 +883,7 @@ sub_02037CF0: ; 0x02037CF0 add r0, r4, #0x0 bl sub_0207B000 ldr r0, [r5, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r1, r0, #0x0 add r0, r4, #0x0 bl sub_0207C2A4 @@ -1053,8 +1053,8 @@ sub_02037E80: ; 0x02037E80 _02037E88: .word sub_020373D4 _02037E8C: .word UNK_020F2CE4 - thumb_func_start sub_02037E90 -sub_02037E90: ; 0x02037E90 + thumb_func_start TownMap_Show +TownMap_Show: ; 0x02037E90 push {r4-r6, lr} sub sp, #0x10 ldr r5, _02037EB4 ; =UNK_020F2CD4 @@ -1089,10 +1089,10 @@ sub_02037EB8: ; 0x02037EB8 add r0, r5, #0x0 add r1, r4, #0x0 mov r2, #0x0 - bl sub_0205F7A0 + bl TownMap_Init add r0, r5, #0x0 add r1, r4, #0x0 - bl sub_02037E90 + bl TownMap_Show add r0, r4, #0x0 pop {r3-r5, pc} @@ -1282,7 +1282,7 @@ sub_0203800C: ; 0x0203800C bl Save_GameStats_Get str r0, [r4, #0x10] add r0, r5, #0x0 - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile str r0, [r4, #0x14] ldr r0, [sp, #0x18] str r6, [r4, #0x18] @@ -1407,7 +1407,7 @@ sub_02038144: ; 0x02038144 add r4, r1, #0x0 add r5, r0, #0x0 ldr r0, [r4, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile str r0, [r5, #0x4] ldr r0, [r4, #0xc] bl SaveArray_Party_Get @@ -1929,7 +1929,7 @@ _02038572: ; jump table (using 16-bit offset) .short _020385BC - _02038572 - 2; case 6 _02038580: ldr r0, [r5, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile ldr r1, [r4, #0xc] add r1, #0x1c bl CopyPlayerName @@ -2139,7 +2139,7 @@ sub_020386E0: ; 0x020386E0 bl sub_02029AFC str r0, [r4, #0x18] ldr r0, [r5, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile str r0, [r4, #0x1c] ldr r0, [r5, #0xc] bl Save_PlayerData_GetOptionsAddr @@ -2343,7 +2343,7 @@ _020388CC: bl Save_PlayerData_GetOptionsAddr str r0, [sp, #0x4] ldr r0, [r4, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile str r0, [sp, #0x8] ldr r1, [r4, #0x1c] add r0, r4, #0x0 diff --git a/arm9/asm/unk_02038C78.s b/arm9/asm/unk_02038C78.s index 4dff53c45..16a6ec949 100644 --- a/arm9/asm/unk_02038C78.s +++ b/arm9/asm/unk_02038C78.s @@ -2079,8 +2079,8 @@ _020395B0: pop {r3, pc} .balign 4 - thumb_func_start sub_020395BC -sub_020395BC: ; 0x020395BC + thumb_func_start FieldMove_SetArgs +FieldMove_SetArgs: ; 0x020395BC push {r3-r7, lr} add r4, r1, #0x0 add r5, r0, #0x0 @@ -2345,7 +2345,7 @@ _020397A0: str r0, [sp, #0x18] ldr r0, [sp, #0x0] ldr r0, [r0, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord str r0, [sp, #0x14] ldr r0, [sp, #0x18] sub r0, r0, #0x7 diff --git a/arm9/asm/unk_02046030.s b/arm9/asm/unk_02046030.s index 360eecc74..e28683a82 100644 --- a/arm9/asm/unk_02046030.s +++ b/arm9/asm/unk_02046030.s @@ -74,7 +74,7 @@ _020460AE: bl GetPlayerXCoord strh r0, [r4, #0x4] ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord strh r0, [r4, #0x6] add r0, r5, #0x0 mov r1, #0x1 diff --git a/arm9/asm/unk_020476CC.s b/arm9/asm/unk_020476CC.s index 6ca73510b..9bea3a3fb 100644 --- a/arm9/asm/unk_020476CC.s +++ b/arm9/asm/unk_020476CC.s @@ -182,7 +182,7 @@ sub_02047814: ; 0x02047814 add r5, r1, #0x0 add r6, r0, #0x0 ldr r0, [r5, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile str r0, [sp, #0x10] ldr r0, [r5, #0xc] bl Save_PlayerData_GetOptionsAddr @@ -468,7 +468,7 @@ sub_02047A78: ; 0x02047A78 add r4, r1, #0x0 add r5, r0, #0x0 ldr r0, [r4, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r6, r0, #0x0 ldr r0, [r4, #0xc] bl SaveArray_Party_Get @@ -612,7 +612,7 @@ sub_02047BC0: ; 0x02047BC0 ldr r0, [r0, #0xc] str r1, [sp, #0x0] add r7, r2, #0x0 - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r4, r0, #0x0 ldr r0, [sp, #0x0] ldr r0, [r0, #0xc] @@ -783,7 +783,7 @@ sub_02047D48: ; 0x02047D48 str r1, [sp, #0x0] str r2, [sp, #0x4] add r7, r3, #0x0 - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile str r0, [sp, #0x20] ldr r0, [sp, #0x0] ldr r0, [r0, #0xc] @@ -1010,7 +1010,7 @@ sub_02047F38: ; 0x02047F38 add r5, r1, #0x0 add r4, r0, #0x0 ldr r0, [r5, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r6, r0, #0x0 ldr r0, [r5, #0xc] bl SaveArray_Party_Get @@ -1056,7 +1056,7 @@ sub_02047FA4: ; 0x02047FA4 add r5, r1, #0x0 add r4, r0, #0x0 ldr r0, [r5, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile ldr r0, [r5, #0xc] bl SaveArray_Party_Get ldr r0, [r5, #0xc] @@ -1077,7 +1077,7 @@ sub_02047FD0: ; 0x02047FD0 add r4, r1, #0x0 ldr r1, [r2, #0x8] ldr r2, [r2, #0xc] - bl sub_0204A6E0 + bl GetMetatileBehavior add r5, r0, #0x0 bl sub_020548F0 cmp r0, #0x0 diff --git a/arm9/asm/unk_020484A8.s b/arm9/asm/unk_020484A8.s index 81a5b8447..57a727eb0 100644 --- a/arm9/asm/unk_020484A8.s +++ b/arm9/asm/unk_020484A8.s @@ -268,7 +268,7 @@ CallTask_GameClear: ; 0x02048694 bl Save_VarsFlags_Get add r6, r0, #0x0 ldr r0, [r4, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile str r0, [sp, #0x0] ldr r0, [r4, #0xc] bl Save_LocalFieldData_Get @@ -282,7 +282,7 @@ CallTask_GameClear: ; 0x02048694 bl sub_0205ED0C str r0, [r5, #0x0] ldr r0, [r4, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile str r0, [r5, #0x4] ldr r0, [r4, #0xc] bl SaveArray_Party_Get @@ -291,7 +291,7 @@ CallTask_GameClear: ; 0x02048694 bl Save_PlayerData_GetIGTAddr str r0, [r5, #0xc] ldr r0, [r4, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile bl PlayerProfile_GetTrainerGender str r0, [r5, #0x10] add r0, r6, #0x0 @@ -469,7 +469,7 @@ sub_02048864: ; 0x02048864 bl MessageFormat_New add r6, r0, #0x0 ldr r0, [r5, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r2, r0, #0x0 add r0, r6, #0x0 mov r1, #0x0 diff --git a/arm9/asm/unk_02048904.s b/arm9/asm/unk_02048904.s index c306a1528..36ef2a7b1 100644 --- a/arm9/asm/unk_02048904.s +++ b/arm9/asm/unk_02048904.s @@ -268,7 +268,7 @@ sub_02048AE4: ; 0x02048AE4 bl MapObjectManager_Init str r0, [r5, #0x34] ldr r0, [r5, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile bl PlayerProfile_GetTrainerGender add r4, r0, #0x0 ldr r0, [r5, #0xc] @@ -321,7 +321,7 @@ sub_02048B50: ; 0x02048B50 bl sub_02034E20 add r4, r0, #0x0 ldr r0, [r5, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile bl PlayerProfile_GetTrainerGender add r2, r0, #0x0 ldr r0, [r5, #0x34] @@ -483,7 +483,7 @@ sub_02048CB0: ; 0x02048CB0 add r4, r1, #0x0 add r5, r0, #0x0 ldr r0, [r4, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r6, r0, #0x0 ldr r0, [r4, #0x38] bl GetPlayerXCoord diff --git a/arm9/asm/unk_0204A498.s b/arm9/asm/unk_0204A498.s index 224c62bd4..1d286f16c 100644 --- a/arm9/asm/unk_0204A498.s +++ b/arm9/asm/unk_0204A498.s @@ -328,8 +328,8 @@ _0204A6DC: add sp, #0x4 pop {r3-r4, pc} - thumb_func_start sub_0204A6E0 -sub_0204A6E0: ; 0x0204A6E0 + thumb_func_start GetMetatileBehavior +GetMetatileBehavior: ; 0x0204A6E0 push {r3-r4, lr} sub sp, #0x4 ldr r4, [r0, #0x58] @@ -443,7 +443,7 @@ _0204A78A: add r0, r5, #0x0 add r1, r4, #0x0 add r2, r7, #0x0 - bl sub_0204A6E0 + bl GetMetatileBehavior bl sub_020548B4 cmp r0, #0x0 beq _0204A7BC @@ -501,7 +501,7 @@ _0204A7E4: add r0, r5, #0x0 add r1, r4, #0x0 add r2, r7, #0x0 - bl sub_0204A6E0 + bl GetMetatileBehavior bl sub_020548B4 cmp r0, #0x0 beq _0204A82E diff --git a/arm9/asm/unk_0204B34C.s b/arm9/asm/unk_0204B34C.s index 383177c8b..5612c21eb 100644 --- a/arm9/asm/unk_0204B34C.s +++ b/arm9/asm/unk_0204B34C.s @@ -510,7 +510,7 @@ sub_0204B70C: ; 0x0204B70C bl GetPlayerXCoord add r6, r0, #0x0 ldr r0, [r7, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r4, r0, #0x0 cmp r5, #0x2 bne _0204B72A @@ -565,7 +565,7 @@ sub_0204B770: ; 0x0204B770 bl GetPlayerXCoord add r4, r0, #0x0 ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r2, r0, #0x0 cmp r6, #0x2 bne _0204B78E @@ -591,7 +591,7 @@ sub_0204B7A0: ; 0x0204B7A0 bl GetPlayerXCoord add r7, r0, #0x0 ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r4, r0, #0x0 ldr r0, [r6, #0x4] cmp r0, #0x0 diff --git a/arm9/asm/unk_0204B9EC.s b/arm9/asm/unk_0204B9EC.s index faab51c8d..2a4b67715 100644 --- a/arm9/asm/unk_0204B9EC.s +++ b/arm9/asm/unk_0204B9EC.s @@ -295,7 +295,7 @@ sub_0204BC00: ; 0x0204BC00 push {r4-r6, lr} add r5, r1, #0x0 add r6, r2, #0x0 - bl sub_0204A6E0 + bl GetMetatileBehavior add r4, r0, #0x0 cmp r5, #0x20 blt _0204BC14 diff --git a/arm9/asm/unk_0204C1B4.s b/arm9/asm/unk_0204C1B4.s index a34f8bdbf..c410c6285 100644 --- a/arm9/asm/unk_0204C1B4.s +++ b/arm9/asm/unk_0204C1B4.s @@ -421,7 +421,7 @@ _0204C4D0: bl GetPlayerXCoord add r6, r0, #0x0 ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r1, r0, #0x0 ldr r2, [r4, #0x1c] add r0, r6, #0x0 @@ -481,7 +481,7 @@ _0204C54A: bl GetPlayerXCoord add r6, r0, #0x0 ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r1, r0, #0x0 ldr r2, [r4, #0x1c] add r0, r6, #0x0 @@ -699,11 +699,11 @@ _0204C700: bl GetPlayerXCoord str r0, [sp, #0x0] ldr r0, [r4, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r2, r0, #0x0 ldr r1, [sp, #0x0] add r0, r4, #0x0 - bl sub_0204A6E0 + bl GetMetatileBehavior bl sub_020547B0 cmp r0, #0x0 beq _0204C736 @@ -729,7 +729,7 @@ _0204C74A: bl GetPlayerXCoord add r6, r0, #0x0 ldr r0, [r4, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r1, r0, #0x0 ldr r2, [r5, #0x1c] add r0, r6, #0x0 @@ -785,11 +785,11 @@ _0204C7BE: bl GetPlayerXCoord str r0, [sp, #0x0] ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r2, r0, #0x0 ldr r1, [sp, #0x0] add r0, r5, #0x0 - bl sub_0204A6E0 + bl GetMetatileBehavior bl sub_020547B0 cmp r0, #0x0 beq _0204C7FE @@ -847,7 +847,7 @@ _0204C846: bl GetPlayerXCoord add r6, r0, #0x0 ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r1, r0, #0x0 ldr r2, [r4, #0x1c] add r0, r6, #0x0 @@ -1061,11 +1061,11 @@ sub_0204C9EC: ; 0x0204C9EC bl GetPlayerXCoord add r6, r0, #0x0 ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r2, r0, #0x0 add r0, r5, #0x0 add r1, r6, #0x0 - bl sub_0204A6E0 + bl GetMetatileBehavior add r6, r0, #0x0 bl sub_020548D8 cmp r0, #0x0 diff --git a/arm9/asm/unk_0204CB20.s b/arm9/asm/unk_0204CB20.s index 1f62ce053..54a182dd9 100644 --- a/arm9/asm/unk_0204CB20.s +++ b/arm9/asm/unk_0204CB20.s @@ -256,7 +256,7 @@ sub_0204CC9C: ; 0x0204CC9C ldr r0, [r0, #0x0] ldr r0, [r0, #0x54] ldr r0, [r0, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord _0204CCD6: pop {r3, pc} .balign 4 @@ -619,7 +619,7 @@ sub_0204CF60: ; 0x0204CF60 ldr r0, [r0, #0x0] ldr r0, [r0, #0x54] ldr r0, [r0, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord ldr r1, _0204D03C ; =UNK_021C5A68 ldr r2, [r1, #0x0] lsl r1, r4, #0x3 @@ -658,7 +658,7 @@ sub_0204CF60: ; 0x0204CF60 ldr r0, [r0, #0x0] ldr r0, [r0, #0x54] ldr r0, [r0, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord ldr r1, _0204D03C ; =UNK_021C5A68 ldr r2, [r1, #0x0] lsl r1, r4, #0x3 @@ -845,7 +845,7 @@ sub_0204D168: ; 0x0204D168 ldr r0, [r0, #0x0] ldr r0, [r0, #0x54] ldr r0, [r0, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r2, r0, #0x0 add r0, r5, #0x0 add r1, r4, #0x0 @@ -2548,7 +2548,7 @@ _0204DE98: sub r0, r0, r1 str r0, [sp, #0x10] ldr r0, [sp, #0x18] - bl GetPlayerYCoord + bl GetPlayerZCoord ldrh r1, [r5, #0x2] sub r7, r0, r1 ldr r0, [sp, #0x18] diff --git a/arm9/asm/unk_02050E48.s b/arm9/asm/unk_02050E48.s index 2acdb5e81..3975b4523 100644 --- a/arm9/asm/unk_02050E48.s +++ b/arm9/asm/unk_02050E48.s @@ -30,7 +30,7 @@ sub_02050E48: ; 0x02050E48 add r4, r0, #0x0 bl MI_CpuFill8 ldr r0, [r5, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r1, r0, #0x0 add r0, r4, #0x0 bl sub_0207C2A4 @@ -653,7 +653,7 @@ _02051334: b _020517B8 _02051346: ldr r0, [r4, #0x24] - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay add r0, r4, #0x0 add r0, #0x88 ldrb r0, [r0, #0x0] @@ -687,7 +687,7 @@ _0205136A: b _020517B8 _0205138A: ldr r0, [r4, #0x24] - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay add r0, r4, #0x0 add r0, #0x88 ldrb r0, [r0, #0x0] @@ -1072,7 +1072,7 @@ _020516B6: cmp r0, #0x0 beq _020517B8 ldr r0, [r4, #0x24] - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0x23 str r0, [r4, #0x34] b _020517B8 @@ -2239,7 +2239,7 @@ _02051FEC: b _0205203A _02051FFE: add r0, r5, #0x0 - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay ldr r0, [r4, #0x28] add r0, r0, #0x1 str r0, [r4, #0x28] diff --git a/arm9/asm/unk_020520AC.s b/arm9/asm/unk_020520AC.s index 61d618d33..3cb670e76 100644 --- a/arm9/asm/unk_020520AC.s +++ b/arm9/asm/unk_020520AC.s @@ -205,7 +205,7 @@ _0205211E: str r5, [r4, #0x0] str r6, [r4, #0x4] add r0, r6, #0x0 - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile str r0, [r4, #0x8] add r0, r4, #0x0 bl sub_02052E1C diff --git a/arm9/asm/unk_02052EE8.s b/arm9/asm/unk_02052EE8.s index 0cce0c148..d4041f637 100644 --- a/arm9/asm/unk_02052EE8.s +++ b/arm9/asm/unk_02052EE8.s @@ -414,7 +414,7 @@ sub_020531E4: ; 0x020531E4 str r0, [sp, #0xc] ldr r0, [sp, #0x0] ldr r0, [r0, #0x8] - bl GetPlayerYCoord + bl GetPlayerZCoord ldr r4, [sp, #0x0] str r0, [sp, #0x8] add r6, r4, #0x0 diff --git a/arm9/asm/unk_02053750.s b/arm9/asm/unk_02053750.s index d737c5b2f..4f4e16eb5 100644 --- a/arm9/asm/unk_02053750.s +++ b/arm9/asm/unk_02053750.s @@ -826,7 +826,7 @@ sub_02053D0C: ; 0x02053D0C bl sub_0201B6C8 add r4, r0, #0x0 ldr r0, [r5, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile bl PlayerProfile_GetTrainerGender add r1, r0, #0x0 add r0, r4, #0x4 diff --git a/arm9/asm/unk_0205478C.s b/arm9/asm/unk_0205478C.s index cffd50723..7ea048f4d 100644 --- a/arm9/asm/unk_0205478C.s +++ b/arm9/asm/unk_0205478C.s @@ -596,8 +596,8 @@ _02054A44: mov r0, #0x0 bx lr - thumb_func_start sub_02054A48 -sub_02054A48: ; 0x02054A48 + thumb_func_start MetatileBehavior_IsWaterfall +MetatileBehavior_IsWaterfall: ; 0x02054A48 cmp r0, #0x13 bne _02054A50 mov r0, #0x1 diff --git a/arm9/asm/unk_02055068.s b/arm9/asm/unk_02055068.s index 36b7c4fdf..0da694005 100644 --- a/arm9/asm/unk_02055068.s +++ b/arm9/asm/unk_02055068.s @@ -96,7 +96,7 @@ _02055118: bl GetPlayerXCoord add r6, r0, #0x0 add r0, r5, #0x0 - bl GetPlayerYCoord + bl GetPlayerZCoord add r7, r0, #0x0 add r0, r5, #0x0 bl PlayerAvatar_GetFacingDirection @@ -336,8 +336,8 @@ GetPlayerXCoord: ; 0x02055320 bl MapObject_GetCurrentX pop {r3, pc} - thumb_func_start GetPlayerYCoord -GetPlayerYCoord: ; 0x0205532C + thumb_func_start GetPlayerZCoord +GetPlayerZCoord: ; 0x0205532C push {r3, lr} bl PlayerAvatar_GetMapObject bl MapObject_GetCurrentZ diff --git a/arm9/asm/unk_020557F4.s b/arm9/asm/unk_020557F4.s index 4d110d6d3..de3bf24b6 100644 --- a/arm9/asm/unk_020557F4.s +++ b/arm9/asm/unk_020557F4.s @@ -2627,7 +2627,7 @@ sub_02056CCC: ; 0x02056CCC ldr r0, [sp, #0x0] add r1, r6, r7 add r2, r5, r2 - bl sub_0204A6E0 + bl GetMetatileBehavior cmp r4, #0x3 bhi _02056D54 add r1, r4, r4 @@ -2690,7 +2690,7 @@ sub_02056D58: ; 0x02056D58 ldr r2, [sp, #0x0] add r0, r7, #0x0 add r1, r6, #0x0 - bl sub_0204A6E0 + bl GetMetatileBehavior add r5, r0, #0x0 cmp r4, #0x3 bhi _02056DD8 @@ -2743,7 +2743,7 @@ _02056DD8: add r0, r7, #0x0 add r1, r6, r5 add r2, r2, r3 - bl sub_0204A6E0 + bl GetMetatileBehavior bl sub_020547B0 cmp r0, #0x1 bne _02056E00 @@ -2780,7 +2780,7 @@ sub_02056E04: ; 0x02056E04 ldr r0, [sp, #0x0] add r1, r6, r7 add r2, r4, r2 - bl sub_0204A6E0 + bl GetMetatileBehavior add r4, r0, #0x0 cmp r5, #0x3 bne _02056E56 @@ -2831,7 +2831,7 @@ sub_02056E6C: ; 0x02056E6C ldr r0, [sp, #0x0] add r1, r6, r7 add r2, r2, r3 - bl sub_0204A6E0 + bl GetMetatileBehavior add r1, r0, #0x0 add r0, r5, #0x0 bl sub_02059AC4 @@ -2875,7 +2875,7 @@ sub_02056EC8: ; 0x02056EC8 ldr r0, [sp, #0x4] add r1, r6, r7 add r2, r3, r2 - bl sub_0204A6E0 + bl GetMetatileBehavior add r6, r0, #0x0 ldr r0, [sp, #0x0] bl PlayerAvatar_GetState @@ -2963,7 +2963,7 @@ sub_02056F78: ; 0x02056F78 ldr r0, [sp, #0x0] add r1, r6, r7 add r2, r2, r3 - bl sub_0204A6E0 + bl GetMetatileBehavior add r4, r0, #0x0 add r0, r5, #0x0 add r1, r4, #0x0 @@ -3376,7 +3376,7 @@ sub_02057288: ; 0x02057288 add r0, r6, r0 str r0, [r4, #0x0] ldr r0, [sp, #0x0] - bl GetPlayerYCoord + bl GetPlayerZCoord add r4, r0, #0x0 add r0, r5, #0x0 bl sub_02059C00 @@ -3385,8 +3385,8 @@ sub_02057288: ; 0x02057288 pop {r3-r7, pc} .balign 4 - thumb_func_start sub_020572B8 -sub_020572B8: ; 0x020572B8 + thumb_func_start PlayerAvatar_GetCoordsInFront +PlayerAvatar_GetCoordsInFront: ; 0x020572B8 push {r4-r6, lr} add r5, r0, #0x0 add r4, r1, #0x0 diff --git a/arm9/asm/unk_02058EE8.s b/arm9/asm/unk_02058EE8.s index 6226e0f5e..51b711cd1 100644 --- a/arm9/asm/unk_02058EE8.s +++ b/arm9/asm/unk_02058EE8.s @@ -2615,7 +2615,7 @@ sub_02059A60: ; 0x02059A60 ldr r0, [sp, #0x0] add r1, r6, #0x0 add r2, r7, #0x0 - bl sub_0204A6E0 + bl GetMetatileBehavior add r6, r0, #0x0 mov r0, #0x0 mvn r0, r0 @@ -2910,7 +2910,7 @@ sub_02059C90: ; 0x02059C90 ldr r2, [sp, #0x0] add r1, r6, r7 add r2, r2, r5 - bl sub_0204A6E0 + bl GetMetatileBehavior pop {r3-r7, pc} .balign 4 @@ -3047,7 +3047,7 @@ sub_02059DB4: ; 0x02059DB4 add r1, r4, #0x0 add r2, r6, #0x0 add r7, r0, #0x0 - bl sub_0204A6E0 + bl GetMetatileBehavior add r1, r0, #0x0 add r0, r5, #0x0 bl sub_02058728 @@ -3059,7 +3059,7 @@ sub_02059DB4: ; 0x02059DB4 add r2, r0, #0x0 add r0, r7, #0x0 add r1, r4, #0x0 - bl sub_0204A6E0 + bl GetMetatileBehavior add r4, r0, #0x0 add r0, r5, #0x0 add r1, r4, #0x0 diff --git a/arm9/asm/unk_02059F04.s b/arm9/asm/unk_02059F04.s index 674b2befc..0384f93a0 100644 --- a/arm9/asm/unk_02059F04.s +++ b/arm9/asm/unk_02059F04.s @@ -1739,7 +1739,7 @@ _0205AB8E: bl GetPlayerXCoord add r7, r0, #0x0 add r0, r6, #0x0 - bl GetPlayerYCoord + bl GetPlayerZCoord add r4, r0, #0x0 add r0, r5, #0x0 mov r1, #0x0 @@ -1829,7 +1829,7 @@ _0205AC22: bl GetPlayerXCoord str r0, [sp, #0x10] ldr r0, [sp, #0xc] - bl GetPlayerYCoord + bl GetPlayerZCoord ldr r2, [sp, #0x8] ldr r1, [sp, #0x10] cmp r2, r1 diff --git a/arm9/asm/unk_0205C598.s b/arm9/asm/unk_0205C598.s index 9342a6489..6339e8b8c 100644 --- a/arm9/asm/unk_0205C598.s +++ b/arm9/asm/unk_0205C598.s @@ -288,7 +288,7 @@ sub_0205C794: ; 0x0205C794 bl GetPlayerXCoord add r7, r0, #0x0 add r0, r4, #0x0 - bl GetPlayerYCoord + bl GetPlayerZCoord add r6, r0, #0x0 add r0, r5, #0x0 bl MapObject_GetFacingDirection @@ -332,7 +332,7 @@ _0205C802: bl GetPlayerXCoord str r0, [sp, #0x10] add r0, r4, #0x0 - bl GetPlayerYCoord + bl GetPlayerZCoord add r7, r0, #0x0 add r0, r5, #0x0 mov r1, #0x0 diff --git a/arm9/asm/unk_0205CE48.s b/arm9/asm/unk_0205CE48.s index 9b3987079..8471ce677 100644 --- a/arm9/asm/unk_0205CE48.s +++ b/arm9/asm/unk_0205CE48.s @@ -85,12 +85,12 @@ sub_0205CE80: ; 0x0205CE80 bl GetPlayerXCoord add r6, r0, #0x0 ldr r0, [r4, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r7, r0, #0x0 add r0, r4, #0x0 add r1, r6, #0x0 add r2, r7, #0x0 - bl sub_0204A6E0 + bl GetMetatileBehavior strh r0, [r5, #0xe] ldr r0, [r4, #0x38] bl PlayerAvatar_GetFacingDirection @@ -122,11 +122,11 @@ _0205CEEA: add r0, r4, #0x0 add r1, r6, #0x0 add r2, r7, #0x0 - bl sub_0204A6E0 + bl GetMetatileBehavior strh r0, [r5, #0xc] add r0, r4, #0x0 add r1, sp, #0x0 - bl sub_02037024 + bl FieldSystem_GetFacingObject ldr r1, [sp, #0x0] add r0, r4, #0x0 bl sub_0204B6C4 @@ -168,7 +168,7 @@ sub_0205CF34: ; 0x0205CF34 bl TaskManager_GetEnvironment add r4, r0, #0x0 add r0, r7, #0x0 - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0x72 mov r2, #0x0 ldr r1, _0205CF74 ; =sub_0205CFA0 @@ -229,7 +229,7 @@ sub_0205CFA0: ; 0x0205CFA0 _0205CFC6: add r0, r5, #0x0 add r1, sp, #0x0 - bl sub_02037024 + bl FieldSystem_GetFacingObject ldr r1, [r4, #0x0] ldr r2, [sp, #0x0] lsl r1, r1, #0x10 @@ -330,7 +330,7 @@ sub_0205D024: ; 0x0205D024 str r4, [r7, r0] ldr r1, _0205D0B8 ; =sub_02035E50 add r0, r7, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc pop {r3-r7, pc} nop _0205D0B4: .word UNK_020F96DC @@ -353,7 +353,7 @@ sub_0205D0BC: ; 0x0205D0BC str r0, [r4, r1] ldr r1, _0205D0E8 ; =sub_02036A78 add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc pop {r3-r5, pc} nop _0205D0E8: .word sub_02036A78 @@ -386,7 +386,7 @@ sub_0205D104: ; 0x0205D104 bl TaskManager_GetEnvironment add r4, r0, #0x0 add r0, r5, #0x0 - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0x72 ldr r1, _0205D140 ; =sub_02049844 lsl r0, r0, #0x2 @@ -464,7 +464,7 @@ _0205D1A4: ldr r0, [r5, #0x18] ldr r0, [r0, #0xc] bl Save_VarsFlags_Get - bl sub_0205F244 + bl Save_VarsFlags_CheckPalParkSysFlag cmp r0, #0x1 bne _0205D1CA _0205D1C4: @@ -497,7 +497,7 @@ _0205D1EE: lsr r4, r0, #0x10 ldr r0, [r5, #0x18] ldr r0, [r0, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord lsl r0, r0, #0x10 lsr r2, r0, #0x10 ldr r0, [r5, #0x18] @@ -523,7 +523,7 @@ sub_0205D21C: ; 0x0205D21C bl TaskManager_GetEnvironment add r4, r0, #0x0 add r0, r5, #0x0 - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0x72 ldr r1, _0205D24C ; =sub_0205D264 lsl r0, r0, #0x2 @@ -730,7 +730,7 @@ sub_0205D3B8: ; 0x0205D3B8 bl sub_02037944 ldr r1, _0205D3E0 ; =sub_02036B90 add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc pop {r3-r5, pc} nop _0205D3E0: .word sub_02036B90 @@ -813,7 +813,7 @@ sub_0205D400: ; 0x0205D400 str r4, [r7, r0] ldr r1, _0205D494 ; =sub_02035E50 add r0, r7, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc pop {r3-r7, pc} nop _0205D490: .word UNK_020F96DC @@ -848,7 +848,7 @@ sub_0205D498: ; 0x0205D498 str r6, [r4, r0] ldr r1, _0205D4E0 ; =sub_02036BDC add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc pop {r4-r6, pc} nop _0205D4E0: .word sub_02036BDC @@ -912,7 +912,7 @@ sub_0205D528: ; 0x0205D528 str r0, [r4, r1] ldr r1, _0205D554 ; =sub_02036D94 add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc pop {r3-r5, pc} .balign 4 _0205D554: .word sub_02036D94 @@ -954,7 +954,7 @@ sub_0205D574: ; 0x0205D574 str r1, [r4, r0] ldr r1, _0205D5A4 ; =sub_02036DD4 add r0, r4, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc pop {r3-r5, pc} nop _0205D5A4: .word sub_02036DD4 @@ -994,7 +994,7 @@ sub_0205D5C4: ; 0x0205D5C4 mov r0, #0x0 str r0, [r4, #0x0] add r0, r6, #0x0 - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0x72 ldr r1, _0205D600 ; =sub_0205E30C lsl r0, r0, #0x2 @@ -1127,7 +1127,7 @@ sub_0205D6BC: ; 0x0205D6BC bl TaskManager_GetEnvironment add r4, r0, #0x0 add r0, r6, #0x0 - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay bl ov05_021F57EC str r0, [sp, #0x0] ldr r1, [sp, #0x0] @@ -1200,7 +1200,7 @@ sub_0205D74C: ; 0x0205D74C bl TaskManager_GetEnvironment add r4, r0, #0x0 add r0, r5, #0x0 - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0x72 ldr r1, _0205D784 ; =ov05_021F5C70 lsl r0, r0, #0x2 @@ -1246,7 +1246,7 @@ sub_0205D7A8: ; 0x0205D7A8 bl TaskManager_GetEnvironment add r4, r0, #0x0 add r0, r5, #0x0 - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0x72 ldr r1, _0205D7E0 ; =ov05_021F5C70 lsl r0, r0, #0x2 @@ -1292,7 +1292,7 @@ sub_0205D804: ; 0x0205D804 bl TaskManager_GetEnvironment add r4, r0, #0x0 add r0, r5, #0x0 - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0x72 ldr r1, _0205D83C ; =ov05_021F5C70 lsl r0, r0, #0x2 @@ -1543,7 +1543,7 @@ sub_0205D9A8: ; 0x0205D9A8 str r4, [r7, r0] ldr r1, _0205DA38 ; =sub_02035E50 add r0, r7, #0x0 - bl sub_02035D04 + bl StartMenu_SetExitTaskFunc pop {r3-r7, pc} .balign 4 _0205DA34: .word UNK_020F96DC @@ -1560,7 +1560,7 @@ sub_0205DA3C: ; 0x0205DA3C bl TaskManager_GetEnvironment add r4, r0, #0x0 add r0, r6, #0x0 - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0x72 ldr r1, _0205DA7C ; =sub_0205DAAC lsl r0, r0, #0x2 @@ -1697,7 +1697,7 @@ sub_0205DB44: ; 0x0205DB44 _0205DB54: ldr r0, [r5, #0xc] bl Save_VarsFlags_Get - bl sub_0205F244 + bl Save_VarsFlags_CheckPalParkSysFlag cmp r0, #0x1 bne _0205DB66 mov r0, #0x0 @@ -1786,7 +1786,7 @@ sub_0205DBF0: ; 0x0205DBF0 str r0, [r4, #0x10] ldr r0, [r5, #0x0] ldr r0, [r0, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile mov r1, #0xb str r1, [sp, #0x0] ldrh r2, [r5, #0x28] @@ -1866,7 +1866,7 @@ _0205DCB2: bl FreeToHeap _0205DCB6: add r0, r5, #0x0 - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0x3 add r4, #0x2a strb r0, [r4, #0x0] diff --git a/arm9/asm/unk_0205DD18.s b/arm9/asm/unk_0205DD18.s index 01d7603ed..126180f09 100644 --- a/arm9/asm/unk_0205DD18.s +++ b/arm9/asm/unk_0205DD18.s @@ -589,7 +589,7 @@ sub_0205E12C: ; 0x0205E12C add r2, r6, #0x0 add r7, r0, #0x0 str r6, [r5, #0x4] - bl sub_0204A6E0 + bl GetMetatileBehavior bl sub_0205478C cmp r0, #0x0 beq _0205E1AE @@ -885,7 +885,7 @@ _0205E374: bl GetPlayerXCoord add r6, r0, #0x0 ldr r0, [r4, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r3, r4, #0x0 add r3, #0x90 add r2, r0, #0x0 diff --git a/arm9/asm/unk_0205E4EC.s b/arm9/asm/unk_0205E4EC.s index 30a47e4c8..cd3544db6 100644 --- a/arm9/asm/unk_0205E4EC.s +++ b/arm9/asm/unk_0205E4EC.s @@ -163,7 +163,7 @@ sub_0205E5E0: ; 0x0205E5E0 bl GetPlayerXCoord strh r0, [r5, #0x2] add r0, r4, #0x0 - bl GetPlayerYCoord + bl GetPlayerZCoord strh r0, [r5, #0x4] mov r0, #0xff strh r0, [r5, #0x6] @@ -181,7 +181,7 @@ sub_0205E608: ; 0x0205E608 bl GetPlayerXCoord add r4, r0, #0x0 add r0, r6, #0x0 - bl GetPlayerYCoord + bl GetPlayerZCoord mov r1, #0x2 ldrsh r1, [r5, r1] cmp r4, r1 @@ -207,7 +207,7 @@ sub_0205E63C: ; 0x0205E63C bl GetPlayerXCoord strh r0, [r5, #0x2] add r0, r4, #0x0 - bl GetPlayerYCoord + bl GetPlayerZCoord strh r0, [r5, #0x4] pop {r3-r5, pc} .balign 4 diff --git a/arm9/asm/unk_0205F7A0.s b/arm9/asm/unk_0205F7A0.s index 622741ae0..7b12a0116 100644 --- a/arm9/asm/unk_0205F7A0.s +++ b/arm9/asm/unk_0205F7A0.s @@ -16,8 +16,8 @@ UNK_02105FA8: ; 0x02105FA8 .text - thumb_func_start sub_0205F7A0 -sub_0205F7A0: ; 0x0205F7A0 + thumb_func_start TownMap_Init +TownMap_Init: ; 0x0205F7A0 push {r3-r7, lr} sub sp, #0x10 str r0, [sp, #0x0] @@ -42,7 +42,7 @@ sub_0205F7A0: ; 0x0205F7A0 add r4, r0, #0x0 ldr r0, [sp, #0x0] ldr r0, [r0, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r6, r0, #0x0 ldr r0, [sp, #0x0] asr r1, r4, #0x4 @@ -71,7 +71,7 @@ _0205F806: _0205F812: ldr r0, [sp, #0x0] bl FieldSystem_GetSaveData - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile bl PlayerProfile_GetTrainerGender str r0, [r5, #0xc] ldr r0, [sp, #0x0] diff --git a/arm9/asm/unk_02060344.s b/arm9/asm/unk_02060344.s index 4cc9cb9a2..61a8c94ee 100644 --- a/arm9/asm/unk_02060344.s +++ b/arm9/asm/unk_02060344.s @@ -14,7 +14,7 @@ sub_02060344: ; 0x02060344 bl sub_02029ACC add r4, r0, #0x0 add r0, r5, #0x0 - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r7, r0, #0x0 ldr r0, [sp, #0x0] mov r1, #0xa diff --git a/arm9/asm/unk_020603B0.s b/arm9/asm/unk_020603B0.s index 980135843..37e289fb8 100644 --- a/arm9/asm/unk_020603B0.s +++ b/arm9/asm/unk_020603B0.s @@ -242,7 +242,7 @@ _020604D0: add r2, r6, #0x0 bl sub_0202AAFC ldr r0, [sp, #0x10] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile str r0, [sp, #0x18] mov r0, #0x4 bl AllocMonZeroed diff --git a/arm9/asm/unk_020607D4.s b/arm9/asm/unk_020607D4.s index be379733c..945df1b92 100644 --- a/arm9/asm/unk_020607D4.s +++ b/arm9/asm/unk_020607D4.s @@ -55,7 +55,7 @@ _02060802: bl GetPlayerXCoord add r6, r0, #0x0 ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r1, r0, #0x0 mov r0, #0x3 str r0, [sp, #0x0] @@ -84,7 +84,7 @@ _0206085C: bl GetPlayerXCoord add r6, r0, #0x0 ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r1, r0, #0x0 mov r0, #0x6 str r0, [sp, #0x0] diff --git a/arm9/asm/unk_0206367C.s b/arm9/asm/unk_0206367C.s index d9e8374a1..67f521a0f 100644 --- a/arm9/asm/unk_0206367C.s +++ b/arm9/asm/unk_0206367C.s @@ -232,7 +232,7 @@ sub_0206384C: ; 0x0206384C cmp r6, r4 beq _02063882 ldr r0, [r5, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile mov r1, #0x20 add r5, #0x98 str r1, [sp, #0x0] diff --git a/arm9/asm/unk_02064E90.s b/arm9/asm/unk_02064E90.s index 4cb4002a3..660ac0e33 100644 --- a/arm9/asm/unk_02064E90.s +++ b/arm9/asm/unk_02064E90.s @@ -16,7 +16,7 @@ sub_02064E90: ; 0x02064E90 ldr r5, [sp, #0xbc] bl FieldSystem_GetSaveData str r0, [sp, #0x20] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r7, r0, #0x0 ldr r0, [sp, #0x20] bl Save_GameStats_Get diff --git a/arm9/asm/unk_020653EC.s b/arm9/asm/unk_020653EC.s index 615f4491c..85a710a74 100644 --- a/arm9/asm/unk_020653EC.s +++ b/arm9/asm/unk_020653EC.s @@ -2285,7 +2285,7 @@ _020665D4: mov r0, #0x5b lsl r0, r0, #0x2 ldr r0, [r4, r0] - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay ldrh r0, [r4, #0x12] add r0, r0, #0x1 strh r0, [r4, #0x12] diff --git a/arm9/asm/unk_02066840.s b/arm9/asm/unk_02066840.s index 68ba7ff3c..e352523b0 100644 --- a/arm9/asm/unk_02066840.s +++ b/arm9/asm/unk_02066840.s @@ -13,7 +13,7 @@ sub_02066840: ; 0x02066840 add r6, r0, #0x0 str r1, [sp, #0x0] add r7, r2, #0x0 - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r4, r0, #0x0 add r0, r6, #0x0 bl sub_02029AFC diff --git a/arm9/asm/unk_02073DA8.s b/arm9/asm/unk_02073DA8.s index 9ce42ac98..59b30d020 100644 --- a/arm9/asm/unk_02073DA8.s +++ b/arm9/asm/unk_02073DA8.s @@ -2450,7 +2450,7 @@ sub_020751A0: ; 0x020751A0 sub r1, #0xb lsl r1, r1, #0x10 lsr r1, r1, #0x10 - bl sub_02063948 + bl FieldMove_GetMoveFunc add r1, r0, #0x0 beq _020751C8 ldr r0, _02075234 ; =0x000005A4 diff --git a/arm9/asm/unk_02080C38.s b/arm9/asm/unk_02080C38.s index bc8aab091..a244fac37 100644 --- a/arm9/asm/unk_02080C38.s +++ b/arm9/asm/unk_02080C38.s @@ -112,7 +112,7 @@ _02080CB4: add r7, r0, #0x0 add r0, r6, #0x0 bl FieldSystem_GetSaveData - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile mov r1, #0xb str r0, [sp, #0x0] bl PlayerProfile_GetPlayerName_NewString diff --git a/arm9/asm/unk_02086084.s b/arm9/asm/unk_02086084.s index de039e7df..71b705575 100644 --- a/arm9/asm/unk_02086084.s +++ b/arm9/asm/unk_02086084.s @@ -275,7 +275,7 @@ _020862D6: add r6, r0, #0x0 ldr r5, [r4, #0xc] bl FieldSystem_GetSaveData - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r7, r0, #0x0 ldr r0, [r6, #0x1c] ldr r0, [r0, #0x0] diff --git a/arm9/asm/unk_02087D00.s b/arm9/asm/unk_02087D00.s index 019123e83..136b0053a 100644 --- a/arm9/asm/unk_02087D00.s +++ b/arm9/asm/unk_02087D00.s @@ -60,7 +60,7 @@ sub_02087D00: ; 0x02087D00 bl Save_PoffinData_Get str r0, [r7, #0x8] add r0, r4, #0x0 - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile str r0, [r7, #0xc] add r0, r4, #0x0 bl SaveArray_Party_Get diff --git a/arm9/asm/unk_0208A258.s b/arm9/asm/unk_0208A258.s index 48df85f3e..56cab716b 100644 --- a/arm9/asm/unk_0208A258.s +++ b/arm9/asm/unk_0208A258.s @@ -54,7 +54,7 @@ _0208A2A6: ldr r0, [r4, #0x4] bl FreeToHeap add r0, r5, #0x0 - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0x11 pop {r3-r5, pc} .balign 4 diff --git a/arm9/asm/unk_0208A338.s b/arm9/asm/unk_0208A338.s index c7ea6396f..5d6121368 100644 --- a/arm9/asm/unk_0208A338.s +++ b/arm9/asm/unk_0208A338.s @@ -300,7 +300,7 @@ _0208A5B0: b _0208A6C8 _0208A5B2: ldr r0, [r4, #0x0] - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay mov r0, #0x7 str r0, [r4, #0x54] b _0208A6C8 diff --git a/arm9/global.inc b/arm9/global.inc index fb743e3d7..5c249d868 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -1471,7 +1471,7 @@ .extern sub_020238A4 .extern Save_PlayerData_sizeof .extern Save_PlayerData_Init -.extern Save_PlayerData_GetProfileAddr +.extern Save_PlayerData_GetProfile .extern Save_PlayerData_GetCoinsAddr .extern Save_PlayerData_GetIGTAddr .extern PlayerProfile_sizeof @@ -2582,10 +2582,10 @@ .extern sub_02035118 .extern sub_0203515C .extern sub_020351A0 -.extern sub_02035D04 +.extern StartMenu_SetExitTaskFunc .extern sub_02035E50 .extern sub_02036A78 -.extern sub_02036AB8 +.extern Task_UseFlyInField .extern sub_02036B90 .extern sub_02036BC4 .extern sub_02036BDC @@ -2593,7 +2593,7 @@ .extern sub_02036DD4 .extern sub_02036FA4 .extern sub_02037000 -.extern sub_02037024 +.extern FieldSystem_GetFacingObject .extern sub_02037090 .extern sub_020370BC .extern sub_020371D0 @@ -2639,7 +2639,7 @@ .extern LaunchStoragePCInterface .extern sub_02037E18 .extern sub_02037E80 -.extern sub_02037E90 +.extern TownMap_Show .extern sub_02037EB8 .extern sub_02037EF8 .extern sub_02037F2C @@ -2686,7 +2686,7 @@ .extern FlagClear .extern ResetTempFlagsAndVars .extern sub_0203959C -.extern sub_020395BC +.extern FieldMove_SetArgs .extern sub_020395F4 .extern sub_02039618 .extern TrainerIsDoubleBattle @@ -3434,7 +3434,7 @@ .extern sub_02046420 .extern sub_0204646C .extern FieldSystem_ApplicationIsRunning -.extern sub_0204649C +.extern FieldSystem_LoadFieldOverlay .extern sub_020464A4 .extern sub_02046500 .extern TaskManager_GetFieldSystem @@ -3513,7 +3513,7 @@ .extern sub_0204A3A4 .extern sub_0204A690 .extern sub_0204A6B4 -.extern sub_0204A6E0 +.extern GetMetatileBehavior .extern sub_0204A708 .extern sub_0204A770 .extern sub_0204A7C8 @@ -3861,7 +3861,7 @@ .extern sub_02054A24 .extern sub_02054A30 .extern sub_02054A3C -.extern sub_02054A48 +.extern MetatileBehavior_IsWaterfall .extern sub_02054A54 .extern sub_02054A60 .extern sub_02054A84 @@ -3902,7 +3902,7 @@ .extern sub_02055304 .extern sub_02055314 .extern GetPlayerXCoord -.extern GetPlayerYCoord +.extern GetPlayerZCoord .extern sub_02055338 .extern sub_02055344 .extern sub_02055350 @@ -3982,7 +3982,7 @@ .extern sub_02057254 .extern sub_02057260 .extern sub_02057278 -.extern sub_020572B8 +.extern PlayerAvatar_GetCoordsInFront .extern MapObjectManager_Init .extern MapObjectManager_Delete .extern sub_020573C8 @@ -4567,7 +4567,7 @@ .extern Save_VarsFlags_CheckSafariSysFlag .extern sub_0205F224 .extern sub_0205F234 -.extern sub_0205F244 +.extern Save_VarsFlags_CheckPalParkSysFlag .extern sub_0205F254 .extern sub_0205F264 .extern sub_0205F274 @@ -4623,7 +4623,7 @@ .extern sub_0205F770 .extern sub_0205F780 .extern sub_0205F790 -.extern sub_0205F7A0 +.extern TownMap_Init .extern sub_0205FC50 .extern sub_0205FD38 .extern sub_0205FDDC @@ -4689,8 +4689,8 @@ .extern sub_02063808 .extern sub_02063888 .extern sub_020638BC -.extern sub_02063948 -.extern sub_02063964 +.extern FieldMove_GetMoveFunc +.extern FieldMove_InitCheckData .extern sub_0206439C .extern sub_020643C0 .extern sub_020643F0 @@ -5987,7 +5987,7 @@ .extern ReadWholeNarcMemberByIdPair .extern GetNarcMemberSizeByIdPair .extern AllocAndReadWholeNarcMemberByIdPair -.extern LoadOverlay_OVERLAY_05 +.extern FieldSystem_LoadFieldOverlayInternal .extern Save_PlayerData_GetOptionsAddr .extern MATH_CalcCRC16 .extern MATH_CalcCRC16CCITT @@ -6680,9 +6680,9 @@ .extern Field_PlayerAvatar_ApplyTransitionFlags .extern ov05_021E61A4 .extern CallFieldTask_Surf -.extern ov05_021E643C +.extern Field_PlayerCanSurfOnTile .extern CallFieldTask_RockClimb -.extern ov05_021E69BC +.extern MetatileBehavior_IsRockClimbInDirection .extern CallFieldTask_Waterfall .extern ov05_021E7030 .extern ov05_021E70F0 diff --git a/arm9/overlays/05/asm/ov05_021D74E0.s b/arm9/overlays/05/asm/ov05_021D74E0.s index 63a44494f..98f5ff848 100644 --- a/arm9/overlays/05/asm/ov05_021D74E0.s +++ b/arm9/overlays/05/asm/ov05_021D74E0.s @@ -236,7 +236,7 @@ _021D76E2: ldr r1, [r4, #0x1c] str r0, [r1, #8] ldr r0, [r4, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord ldr r1, [r4, #0x1c] str r0, [r1, #0xc] ldr r0, [r4, #0x38] @@ -386,7 +386,7 @@ ov05_021D7864: ; 0x021D7864 bl GetPlayerXCoord add r4, r0, #0 ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord ldr r2, [r5, #0x1c] ldr r1, [r2, #8] cmp r4, r1 @@ -417,7 +417,7 @@ ov05_021D7894: ; 0x021D7894 add r1, r0, r1 ldr r0, [r5, #0x38] asr r4, r1, #5 - bl GetPlayerYCoord + bl GetPlayerZCoord asr r1, r0, #4 lsr r1, r1, #0x1b add r1, r0, r1 @@ -556,7 +556,7 @@ ov05_021D79B4: ; 0x021D79B4 add r1, r0, r1 ldr r0, [r5, #0x38] asr r6, r1, #5 - bl GetPlayerYCoord + bl GetPlayerZCoord asr r1, r0, #4 lsr r1, r1, #0x1b add r1, r0, r1 diff --git a/arm9/overlays/05/asm/ov05_021D80E8.s b/arm9/overlays/05/asm/ov05_021D80E8.s index c2cf15ff8..2d120806f 100644 --- a/arm9/overlays/05/asm/ov05_021D80E8.s +++ b/arm9/overlays/05/asm/ov05_021D80E8.s @@ -248,7 +248,7 @@ _021D8290: ldr r1, [sp, #0xc] ldr r2, [sp, #8] add r0, r4, #0 - bl sub_0204A6E0 + bl GetMetatileBehavior bl sub_0205478C cmp r0, #0 beq _021D8314 @@ -280,7 +280,7 @@ _021D82EC: ldr r1, [sp, #4] ldr r2, [sp] add r0, r4, #0 - bl sub_0204A6E0 + bl GetMetatileBehavior bl sub_0205478C cmp r0, #0 beq _021D8314 @@ -1051,7 +1051,7 @@ ov05_021D8954: ; 0x021D8954 bl ov05_021D90F8 ldr r0, [r4, #0xc] bl Save_VarsFlags_Get - bl sub_0205F244 + bl Save_VarsFlags_CheckPalParkSysFlag cmp r0, #1 bne _021D8998 ldr r1, [sp, #4] @@ -1142,7 +1142,7 @@ _021D8A00: ldr r1, [sp, #0x10] ldr r2, [sp, #0xc] add r0, r6, #0 - bl sub_0204A6E0 + bl GetMetatileBehavior bl sub_020547B0 cmp r0, #0 beq _021D8A4A @@ -1168,7 +1168,7 @@ _021D8A4A: ldr r1, [sp, #0x10] ldr r2, [sp, #0xc] add r0, r6, #0 - bl sub_0204A6E0 + bl GetMetatileBehavior add r4, r0, #0 bl sub_020547BC cmp r0, #0 @@ -1406,7 +1406,7 @@ _021D8C2E: pop {r3, r4, r5, r6, r7, pc} _021D8C3C: add r0, r4, #0 - bl sub_02054A48 + bl MetatileBehavior_IsWaterfall cmp r0, #0 beq _021D8C4A ldr r0, _021D8D08 ; =0x00002716 @@ -1437,7 +1437,7 @@ _021D8C66: _021D8C78: add r0, r4, #0 add r1, r6, #0 - bl ov05_021E69BC + bl MetatileBehavior_IsRockClimbInDirection cmp r0, #0 beq _021D8C88 ldr r0, _021D8D18 ; =0x00002713 @@ -1448,21 +1448,21 @@ _021D8C88: cmp r0, #2 beq _021D8CE0 ldr r0, [r5, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r6, r0, #0 ldr r0, [r5, #0x38] bl GetPlayerXCoord add r7, r0, #0 ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r2, r0, #0 add r0, r5, #0 add r1, r7, #0 - bl sub_0204A6E0 + bl GetMetatileBehavior add r1, r0, #0 ldr r0, [r5, #0x38] add r2, r4, #0 - bl ov05_021E643C + bl Field_PlayerCanSurfOnTile cmp r0, #0 beq _021D8CE0 add r0, r6, #0 @@ -1524,12 +1524,12 @@ _021D8D4C: bl GetPlayerXCoord add r4, r0, #0 ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r7, r0, #0 add r0, r5, #0 add r1, r4, #0 add r2, r7, #0 - bl sub_0204A6E0 + bl GetMetatileBehavior add r6, r0, #0 add r0, r5, #0 bl ov05_021D8E1C @@ -1991,7 +1991,7 @@ ov05_021D90F8: ; 0x021D90F8 bl GetPlayerXCoord str r0, [r4] ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord str r0, [r6] pop {r4, r5, r6, pc} .balign 4, 0 @@ -2066,7 +2066,7 @@ ov05_021D9178: ; 0x021D9178 ldr r1, [sp, #4] ldr r2, [sp] add r0, r4, #0 - bl sub_0204A6E0 + bl GetMetatileBehavior add sp, #8 pop {r4, pc} @@ -2081,7 +2081,7 @@ ov05_021D9194: ; 0x021D9194 ldr r1, [sp, #4] ldr r2, [sp] add r0, r4, #0 - bl sub_0204A6E0 + bl GetMetatileBehavior add sp, #8 pop {r4, pc} diff --git a/arm9/overlays/05/asm/ov05_021E1374.s b/arm9/overlays/05/asm/ov05_021E1374.s index 3637c3b1e..8ce0f6ec5 100644 --- a/arm9/overlays/05/asm/ov05_021E1374.s +++ b/arm9/overlays/05/asm/ov05_021E1374.s @@ -264,7 +264,7 @@ _021E1562: ldr r0, [sp] ldr r0, [r0, #4] ldr r0, [r0, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord sub r1, r4, #7 str r1, [sp, #0x14] add r1, r4, #7 diff --git a/arm9/overlays/05/asm/ov05_021E1AD8.s b/arm9/overlays/05/asm/ov05_021E1AD8.s index fb6bd63e0..dbf8601bf 100644 --- a/arm9/overlays/05/asm/ov05_021E1AD8.s +++ b/arm9/overlays/05/asm/ov05_021E1AD8.s @@ -1827,7 +1827,7 @@ ov05_021E28A0: ; 0x021E28A0 bl NewString_ReadMsgData str r0, [sp, #0x10] ldr r0, [r7, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile bl PlayerProfile_GetMoney add r2, r0, #0 mov r0, #1 diff --git a/arm9/overlays/05/asm/ov05_021E5FD8.s b/arm9/overlays/05/asm/ov05_021E5FD8.s index d305fbb78..936222d04 100644 --- a/arm9/overlays/05/asm/ov05_021E5FD8.s +++ b/arm9/overlays/05/asm/ov05_021E5FD8.s @@ -556,8 +556,8 @@ CallFieldTask_Surf: ; 0x021E6410 add sp, #0x10 pop {r4, r5, r6, pc} - thumb_func_start ov05_021E643C -ov05_021E643C: ; 0x021E643C + thumb_func_start Field_PlayerCanSurfOnTile +Field_PlayerCanSurfOnTile: ; 0x021E643C push {r4, r5, r6, lr} add r4, r2, #0 add r5, r1, #0 @@ -678,7 +678,7 @@ _021E6514: bl sub_02059BF4 add r6, r0, #0 ldr r0, [r4, #0x20] - bl GetPlayerYCoord + bl GetPlayerZCoord add r7, r0, #0 ldr r0, [r4, #4] bl sub_02059C00 @@ -926,7 +926,7 @@ _021E6732: bl sub_02057278 lsl r0, r0, #0x18 lsr r0, r0, #0x18 - bl sub_02054A48 + bl MetatileBehavior_IsWaterfall cmp r0, #0 bne _021E674A mov r0, #0 @@ -1233,8 +1233,8 @@ CallFieldTask_RockClimb: ; 0x021E6990 add sp, #0x10 pop {r4, r5, r6, pc} - thumb_func_start ov05_021E69BC -ov05_021E69BC: ; 0x021E69BC + thumb_func_start MetatileBehavior_IsRockClimbInDirection +MetatileBehavior_IsRockClimbInDirection: ; 0x021E69BC push {r3, lr} cmp r1, #3 bhi _021E69F6 @@ -1335,7 +1335,7 @@ ov05_021E6A58: ; 0x021E6A58 bl sub_02059BF4 add r6, r0, #0 ldr r0, [r5, #0x10] - bl GetPlayerYCoord + bl GetPlayerZCoord add r7, r0, #0 ldr r0, [r5, #4] bl sub_02059C00 @@ -1441,7 +1441,7 @@ _021E6B2E: lsl r0, r0, #0x18 lsr r0, r0, #0x18 add r1, r4, #0 - bl ov05_021E69BC + bl MetatileBehavior_IsRockClimbInDirection cmp r0, #1 bne _021E6B54 mov r0, #5 @@ -2373,7 +2373,7 @@ ov05_021E727C: ; 0x021E727C bl sub_02059BF4 add r7, r0, #0 add r0, r4, #0 - bl GetPlayerYCoord + bl GetPlayerZCoord str r0, [sp] add r0, r5, #0 bl sub_02059C00 diff --git a/arm9/overlays/05/asm/ov05_021E8310.s b/arm9/overlays/05/asm/ov05_021E8310.s index 2933ad484..37db7fcb9 100644 --- a/arm9/overlays/05/asm/ov05_021E8310.s +++ b/arm9/overlays/05/asm/ov05_021E8310.s @@ -30,7 +30,7 @@ _021E8344: _021E8346: str r0, [r5] add r0, r4, #0 - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile str r0, [r5, #8] add r0, r4, #0 bl Save_PlayerData_GetIGTAddr @@ -376,7 +376,7 @@ Field_SaveGame: ; 0x021E85FC ldr r1, [r4, #0x1c] str r0, [r1, #8] ldr r0, [r4, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord ldr r1, [r4, #0x1c] str r0, [r1, #0xc] mov r1, #0 diff --git a/arm9/overlays/05/asm/ov05_021E88E8.s b/arm9/overlays/05/asm/ov05_021E88E8.s index 3c4df4a74..0e506b66f 100644 --- a/arm9/overlays/05/asm/ov05_021E88E8.s +++ b/arm9/overlays/05/asm/ov05_021E88E8.s @@ -6356,7 +6356,7 @@ _021EBCC4: .word ov05_021F7970 ov05_021EBCC8: ; 0x021EBCC8 push {r3, lr} ldr r0, [r0, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile bl PlayerProfile_GetTrainerGender pop {r3, pc} .balign 4, 0 diff --git a/arm9/overlays/05/asm/ov05_021EC458.s b/arm9/overlays/05/asm/ov05_021EC458.s index c1ca33aff..df0e6aa58 100644 --- a/arm9/overlays/05/asm/ov05_021EC458.s +++ b/arm9/overlays/05/asm/ov05_021EC458.s @@ -101,7 +101,7 @@ ov05_021EC4F0: ; 0x021EC4F0 bl DaycareMon_GetBoxMon str r0, [sp, #4] add r0, r7, #0 - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile bl PlayerProfile_GetNamePtr add r0, r4, #0 mov r1, #0x74 diff --git a/arm9/overlays/05/asm/ov05_021F3854.s b/arm9/overlays/05/asm/ov05_021F3854.s index a5860a083..ea04af7b2 100644 --- a/arm9/overlays/05/asm/ov05_021F3854.s +++ b/arm9/overlays/05/asm/ov05_021F3854.s @@ -24,7 +24,7 @@ ov05_021F3860: ; 0x021F3860 bl GetPlayerXCoord add r6, r0, #0 ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r7, r0, #0 ldr r0, [r4] cmp r0, r6 @@ -38,7 +38,7 @@ _021F3882: add r1, r6, #0 add r2, r7, #0 str r7, [r4, #4] - bl sub_0204A6E0 + bl GetMetatileBehavior add r4, r0, #0 bl sub_02054A18 cmp r0, #0 diff --git a/arm9/overlays/05/asm/ov05_021F4CF8.s b/arm9/overlays/05/asm/ov05_021F4CF8.s index 3a17cd0fb..e5b65d4a9 100644 --- a/arm9/overlays/05/asm/ov05_021F4CF8.s +++ b/arm9/overlays/05/asm/ov05_021F4CF8.s @@ -45,7 +45,7 @@ ov05_021F4D2C: ; 0x021F4D2C bl GetPlayerXCoord add r4, r0, #0 ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r6, r0, #0 ldr r0, [r5, #0x38] bl PlayerAvatar_GetFacingDirection @@ -135,7 +135,7 @@ _021F4DDE: lsl r0, r0, #4 str r0, [r4] ldr r0, [r6, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile bl PlayerProfile_GetTrainerID add r1, r5, #0 bl ov05_021F5138 diff --git a/arm9/overlays/05/asm/ov05_021F5518.s b/arm9/overlays/05/asm/ov05_021F5518.s index 863af52f8..84ae66566 100644 --- a/arm9/overlays/05/asm/ov05_021F5518.s +++ b/arm9/overlays/05/asm/ov05_021F5518.s @@ -483,11 +483,11 @@ _021F5888: bl GetPlayerXCoord add r6, r0, #0 ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r2, r0, #0 add r0, r5, #0 add r1, r6, #0 - bl sub_0204A6E0 + bl GetMetatileBehavior add r1, r0, #0 add r0, r5, #0 bl ov06_0223CDB8 diff --git a/arm9/overlays/06/asm/overlay_06.s b/arm9/overlays/06/asm/overlay_06.s index dd3fcbcff..0f8287ca8 100644 --- a/arm9/overlays/06/asm/overlay_06.s +++ b/arm9/overlays/06/asm/overlay_06.s @@ -4822,12 +4822,12 @@ ov06_0223BA04: ; 0x0223BA04 bl GetPlayerXCoord add r6, r0, #0 ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord str r0, [sp, #0x14] ldr r2, [sp, #0x14] add r0, r5, #0 add r1, r6, #0 - bl sub_0204A6E0 + bl GetMetatileBehavior str r0, [sp, #0x1c] add r2, sp, #0x24 ldr r1, [sp, #0x1c] @@ -5354,11 +5354,11 @@ ov06_0223BE70: ; 0x0223BE70 bl GetPlayerXCoord add r4, r0, #0 ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r2, r0, #0 add r0, r5, #0 add r1, r4, #0 - bl sub_0204A6E0 + bl GetMetatileBehavior add r1, r0, #0 add r0, r5, #0 add r2, sp, #0x1c @@ -5605,11 +5605,11 @@ ov06_0223C08C: ; 0x0223C08C bl GetPlayerXCoord add r6, r0, #0 ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r2, r0, #0 add r0, r5, #0 add r1, r6, #0 - bl sub_0204A6E0 + bl GetMetatileBehavior add r7, r0, #0 add r2, sp, #0x20 add r0, r5, #0 @@ -5931,7 +5931,7 @@ _0223C350: bne _0223C38C add r0, r5, #0 bl FieldSystem_GetSaveData - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile bl PlayerProfile_GetTrainerID str r0, [sp] ldr r0, [sp, #0x34] @@ -5966,7 +5966,7 @@ _0223C3A6: bl GetPlayerXCoord add r6, r0, #0 ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r2, r0, #0 add r0, r5, #0 add r5, #0x90 @@ -8031,7 +8031,7 @@ _0223D342: strb r0, [r4, #0x11] _0223D344: ldr r0, [r6, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile bl PlayerProfile_GetTrainerID str r0, [r4] pop {r3, r4, r5, r6, r7, pc} @@ -8124,7 +8124,7 @@ ov06_0223D3D0: ; 0x0223D3D0 lsl r1, r1, #4 str r0, [r4, r1] ldr r0, [r5, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile mov r1, #0x83 lsl r1, r1, #2 str r0, [r4, r1] @@ -11443,7 +11443,7 @@ _0223EF28: ldr r0, [r1] ldr r0, [r0, #0x68] bl FieldSystem_GetSaveData - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile ldr r1, _0223EFF4 ; =0x02252420 ldr r1, [r1] str r0, [r1, #0x78] @@ -15676,7 +15676,7 @@ CheckPastoriaGymButton: ; 0x02241230 bl GetPlayerXCoord add r5, r0, #0 ldr r0, [r4, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r1, r0, #0 mov r0, #1 str r0, [sp] @@ -15756,7 +15756,7 @@ ov06_022412F4: ; 0x022412F4 push {r4, r5, r6, lr} add r5, r3, #0 ldr r4, [sp, #0x10] - bl sub_0204A6E0 + bl GetMetatileBehavior add r6, r0, #0 bl sub_02054890 cmp r0, #0 @@ -19914,7 +19914,7 @@ ov06_022433B8: ; 0x022433B8 bl LocalFieldData_GetDynamicWarp add r4, r0, #0 ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r6, r0, #0 ldr r0, [r5, #0x38] bl GetPlayerXCoord @@ -20211,7 +20211,7 @@ _0224356C: bl ov06_02244A80 _0224362A: add r0, r6, #0 - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile bl PlayerProfile_GetTrainerGender strb r0, [r4, #0x11] ldrb r0, [r4, #0xf] @@ -22396,7 +22396,7 @@ ov06_022446FC: ; 0x022446FC add r4, r1, #0 add r6, r0, #0 add r0, r4, #0 - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile bl PlayerProfile_GetTrainerGender ldr r1, _02244750 ; =0x0000083E strh r0, [r6, r1] @@ -23738,7 +23738,7 @@ _02245148: strh r0, [r5, #0x14] ldr r0, [sp] ldr r0, [r0, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord strh r0, [r5, #0x16] ldr r0, [sp] ldr r0, [r0, #0x1c] @@ -24286,7 +24286,7 @@ _02245578: cmp r0, #6 bhs _022455BC ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord ldr r1, [r4, #0x10] cmp r0, r1 ble _022455BC @@ -24302,7 +24302,7 @@ _022455B4: b _02245640 _022455BC: ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord ldr r1, [r4, #0x10] cmp r0, r1 bgt _02245640 @@ -24333,7 +24333,7 @@ _022455E0: cmp r0, #6 bhs _0224561E ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord ldr r1, [r4, #0x10] cmp r0, r1 bge _0224561E @@ -24349,7 +24349,7 @@ _02245616: b _02245640 _0224561E: ldr r0, [r5, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord ldr r1, [r4, #0x10] cmp r0, r1 blt _02245640 @@ -31411,7 +31411,7 @@ ov06_02248BC0: ; 0x02248BC0 push {r4, r5, r6, lr} ldr r0, [r0, #0xc] add r6, r1, #0 - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r5, r0, #0 mov r0, #4 mov r1, #0x18 @@ -31447,7 +31447,7 @@ ov06_02248C18: ; 0x02248C18 push {r4, r5, r6, lr} ldr r0, [r0, #0xc] add r5, r1, #0 - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r6, r0, #0 mov r0, #4 mov r1, #0x18 @@ -32164,7 +32164,7 @@ ov06_02249158: ; 0x02249158 ov06_0224916C: ; 0x0224916C push {r3, lr} ldr r0, [r0, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile bl PlayerProfile_CountBadges cmp r0, #5 blt _02249180 @@ -39795,7 +39795,7 @@ _0224CC80: ldr r0, [r5, #0x38] add r1, sp, #0x18 add r2, sp, #0x14 - bl sub_020572B8 + bl PlayerAvatar_GetCoordsInFront ldr r0, [r5, #0x28] bl MapMatrix_GetWidth str r0, [sp] @@ -40902,7 +40902,7 @@ ov06_0224D46C: ; 0x0224D46C bl NewString_ReadMsgData add r5, r0, #0 ldr r0, [sp, #0x1c] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r2, r0, #0 ldr r0, [r4, #0x14] mov r1, #0 @@ -43362,7 +43362,7 @@ ov06_0224E8C4: ; 0x0224E8C4 bl GetPlayerXCoord add r5, r0, #0 add r0, r6, #0 - bl GetPlayerYCoord + bl GetPlayerZCoord add r4, r0, #0 add r0, r6, #0 bl PlayerAvatar_GetFacingDirection diff --git a/arm9/overlays/14/asm/overlay_14.s b/arm9/overlays/14/asm/overlay_14.s index 35e0cc8e8..2382b6f56 100644 --- a/arm9/overlays/14/asm/overlay_14.s +++ b/arm9/overlays/14/asm/overlay_14.s @@ -1948,7 +1948,7 @@ _021D84AA: mov r0, #0x47 lsl r0, r0, #2 ldr r0, [r4, r0] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r1, r0, #0 mov r0, #0x4b lsl r0, r0, #2 diff --git a/arm9/overlays/18/asm/overlay_18.s b/arm9/overlays/18/asm/overlay_18.s index 858104bdd..778830a2e 100644 --- a/arm9/overlays/18/asm/overlay_18.s +++ b/arm9/overlays/18/asm/overlay_18.s @@ -2440,7 +2440,7 @@ _0223A9DC: add r0, r4, #0 bl ov18_0223A560 add r0, r5, #0 - bl sub_0204649C + bl FieldSystem_LoadFieldOverlay ldr r0, [r4] add sp, #0xc add r0, r0, #1 @@ -13451,7 +13451,7 @@ ov18_0223FDEC: ; 0x0223FDEC ldr r0, [r0, #4] ldr r0, [r0, #0x40] ldr r0, [r0, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r7, r0, #0 add r0, r4, #0 bl sub_0204F610 @@ -13872,7 +13872,7 @@ ov18_022400A0: ; 0x022400A0 ldr r0, [r0, #4] ldr r0, [r0, #0x40] ldr r0, [r0, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r3, r0, #0 ldr r0, _022400F8 ; =0x022513A0 add r1, r4, #0 @@ -16018,7 +16018,7 @@ _0224110C: ldr r0, [r0, #4] ldr r0, [r0, #0x40] ldr r0, [r0, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r2, r0, #0 ldr r0, [r4, #8] cmp r0, #0 @@ -19209,7 +19209,7 @@ _02242A20: ldr r0, [r0, #4] ldr r0, [r0, #0x40] ldr r0, [r0, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r2, r0, #0 mov r0, #0x20 str r0, [sp] @@ -22806,7 +22806,7 @@ _02244640: bl GetPlayerXCoord str r0, [r5] ldr r0, [sp] - bl GetPlayerYCoord + bl GetPlayerZCoord str r0, [r5, #4] b _022446AA _0224467E: @@ -26580,7 +26580,7 @@ ov18_02246338: ; 0x02246338 ldr r0, [r0] ldr r0, [r0] ldr r0, [r0, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r1, r0, #0 add r0, r4, #0 bl ov18_0223E2F4 @@ -26780,7 +26780,7 @@ ov18_022464D0: ; 0x022464D0 b _0224650E _022464EE: add r0, r5, #0 - bl LoadOverlay_OVERLAY_05 + bl FieldSystem_LoadFieldOverlayInternal ldr r0, [r4, #0x10] add r0, r0, #1 str r0, [r4, #0x10] @@ -32978,7 +32978,7 @@ _022495BA: bne _022495E2 ldr r0, [r5, #0xc] bl FieldSystem_GetSaveData - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile mov r1, #4 bl PlayerProfile_GetPlayerName_NewString add r7, r0, #0 @@ -35025,7 +35025,7 @@ ov18_0224A6B4: ; 0x0224A6B4 add r4, r0, #0 ldr r0, [r5, #0xc] ldr r0, [r0, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord add r1, r0, #0 add r0, r4, #0 bl ov18_0223E2F4 @@ -35135,7 +35135,7 @@ ov18_0224A78C: ; 0x0224A78C bl ov18_0224D704 ldr r0, [r4, #0xc] bl FieldSystem_GetSaveData - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r1, r0, #0 mov r0, #1 str r0, [sp] @@ -37195,7 +37195,7 @@ ov18_0224B804: ; 0x0224B804 sub r0, r0, r1 str r0, [sp] ldr r0, [r4, #0x38] - bl GetPlayerYCoord + bl GetPlayerZCoord lsl r1, r0, #0x10 mov r0, #0x11 lsl r0, r0, #0x10 @@ -37483,7 +37483,7 @@ _0224BA70: bl ov18_0224DD94 ldr r0, [r4, #0xc] bl FieldSystem_GetSaveData - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r5, r0, #0 ldr r0, [r4, #0xc] bl FieldSystem_GetSaveData diff --git a/arm9/overlays/20/asm/ov20_02252440.s b/arm9/overlays/20/asm/ov20_02252440.s index c5ecf537b..3512b7d8f 100644 --- a/arm9/overlays/20/asm/ov20_02252440.s +++ b/arm9/overlays/20/asm/ov20_02252440.s @@ -1194,7 +1194,7 @@ ov20_02252C40: ; 0x02252C40 ov20_02252C44: ; 0x02252C44 push {r3, lr} ldr r0, [r0, #0x54] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile bl PlayerProfile_GetTrainerGender cmp r0, #1 beq _02252C58 diff --git a/arm9/overlays/51/asm/overlay_51.s b/arm9/overlays/51/asm/overlay_51.s index 087ebec30..6397aa03a 100644 --- a/arm9/overlays/51/asm/overlay_51.s +++ b/arm9/overlays/51/asm/overlay_51.s @@ -291,7 +291,7 @@ ov51_02254A68: ; 0x02254A68 ldr r0, [r5, #0x78] str r0, [r4, #8] ldr r0, [r5, #0xc] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile str r0, [r4, #0x10] mov r0, #0 mov r1, #0xa2 diff --git a/arm9/overlays/52/src/overlay_52.c b/arm9/overlays/52/src/overlay_52.c index adfa5e4f6..50eb21791 100644 --- a/arm9/overlays/52/src/overlay_52.c +++ b/arm9/overlays/52/src/overlay_52.c @@ -377,7 +377,7 @@ void ov52_021D7604(HeapID heapId, struct SaveData *save, BOOL set_trainerid) { sub_02028788(unk_save, 1, MTRandom()); sub_0206007C(save); - PlayerProfile *playerProfile = Save_PlayerData_GetProfileAddr(save); + PlayerProfile *playerProfile = Save_PlayerData_GetProfile(save); u32 trainerid = MTRandom(); if (set_trainerid) { @@ -407,7 +407,7 @@ void ov52_021D769C(u32 unused, struct SaveData *save) { Save_InitDynamicRegion(save); sub_020377E0(save); - PlayerProfile *playerProfile = Save_PlayerData_GetProfileAddr(save); + PlayerProfile *playerProfile = Save_PlayerData_GetProfile(save); PlayerProfile_SetMoney(playerProfile, 3000); sub_0205ECD4(Save_VarsFlags_Get(save)); } diff --git a/arm9/overlays/54/asm/overlay_54.s b/arm9/overlays/54/asm/overlay_54.s index 65ba53309..53bd43f3f 100644 --- a/arm9/overlays/54/asm/overlay_54.s +++ b/arm9/overlays/54/asm/overlay_54.s @@ -3718,7 +3718,7 @@ ov54_021D91C4: ; 0x021D91C4 str r3, [sp, #4] add r5, r1, #0 str r2, [sp] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r4, r0, #0 ldr r0, [sp, #4] mov r7, #0 diff --git a/arm9/overlays/55/asm/overlay_55.s b/arm9/overlays/55/asm/overlay_55.s index d3594307f..8a691fc39 100644 --- a/arm9/overlays/55/asm/overlay_55.s +++ b/arm9/overlays/55/asm/overlay_55.s @@ -1309,7 +1309,7 @@ _021D7F86: cmp r6, #2 bne _021D7FF4 ldr r0, [r5, #8] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r2, r0, #0 ldr r0, [r5, #0xc] mov r1, #0 @@ -3607,7 +3607,7 @@ _021D91D6: mov r1, #0 bl FillWindowPixelBuffer ldr r0, [r5, #8] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r2, r0, #0 ldr r0, [r5, #0xc] mov r1, #0 diff --git a/arm9/overlays/56/asm/overlay_56.s b/arm9/overlays/56/asm/overlay_56.s index f9dd352c5..6011b35dd 100644 --- a/arm9/overlays/56/asm/overlay_56.s +++ b/arm9/overlays/56/asm/overlay_56.s @@ -1974,7 +1974,7 @@ ov56_02212E0C: ; 0x02212E0C add r0, #0xc4 ldr r0, [r0] str r1, [sp] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile str r0, [sp, #0x14] add r0, r5, #0 add r0, #0xc4 @@ -2767,7 +2767,7 @@ ov56_0221341C: ; 0x0221341C add r0, #0xc4 ldr r0, [r0] ldr r5, _02213618 ; =0x00010200 - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile mov r1, #0x36 bl PlayerProfile_GetPlayerName_NewString add r6, r0, #0 diff --git a/arm9/overlays/59/src/ov59_Intro.c b/arm9/overlays/59/src/ov59_Intro.c index 6499ca9f3..ae51c5714 100644 --- a/arm9/overlays/59/src/ov59_Intro.c +++ b/arm9/overlays/59/src/ov59_Intro.c @@ -434,8 +434,8 @@ BOOL ov59_IntroExit(struct OverlayManager *overlayManager, u32 *status) { ov59_IntroOverlayData *data = (ov59_IntroOverlayData *)OverlayManager_GetData(overlayManager); HeapID heapId = data->heapId; - PlayerName_StringToFlat(Save_PlayerData_GetProfileAddr(data->save), data->playerStruct->name); - PlayerProfile_SetTrainerGender(Save_PlayerData_GetProfileAddr(data->save), data->playerStruct->gender); + PlayerName_StringToFlat(Save_PlayerData_GetProfile(data->save), data->playerStruct->name); + PlayerProfile_SetTrainerGender(Save_PlayerData_GetProfile(data->save), data->playerStruct->gender); RivalsNameToU16Array(sub_02024EB4(data->save), data->rivalStruct->name); diff --git a/arm9/overlays/67/asm/overlay_67.s b/arm9/overlays/67/asm/overlay_67.s index 6844c375d..8a1b776f1 100644 --- a/arm9/overlays/67/asm/overlay_67.s +++ b/arm9/overlays/67/asm/overlay_67.s @@ -55,7 +55,7 @@ ov67_021D74E0: ; 0x021D74E0 bl sub_020289A4 str r0, [r4, #0x44] add r0, r5, #0 - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile str r0, [r4, #0x48] mov r0, #0 mov r1, #0x2a diff --git a/arm9/overlays/75/asm/overlay_75.s b/arm9/overlays/75/asm/overlay_75.s index b1678db71..3ee0e04f4 100644 --- a/arm9/overlays/75/asm/overlay_75.s +++ b/arm9/overlays/75/asm/overlay_75.s @@ -481,7 +481,7 @@ ov75_021E6FA4: ; 0x021E6FA4 add r0, #0xc4 ldr r0, [r0] ldr r0, [r0] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile add r1, r4, #0 add r1, #0xcc str r0, [r1] diff --git a/arm9/overlays/83/asm/overlay_83.s b/arm9/overlays/83/asm/overlay_83.s index 1ad6d27aa..57459d44d 100644 --- a/arm9/overlays/83/asm/overlay_83.s +++ b/arm9/overlays/83/asm/overlay_83.s @@ -1949,7 +1949,7 @@ ov83_0222E48C: ; 0x0222E48C add r0, r0, #4 str r1, [r4, r0] ldr r0, [r4, #4] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile str r0, [r4, #0xc] ldr r0, [r4, #4] bl Save_Pokedex_Get @@ -3051,7 +3051,7 @@ ov83_0222EDF8: ; 0x0222EDF8 bl OverlayManager_GetField18 ldr r0, [r0, #8] str r0, [r4, #8] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile str r0, [r4, #0x10] ldr r0, [r4, #8] bl Save_Pokedex_Get @@ -18535,7 +18535,7 @@ ov83_02236764: ; 0x02236764 bl OverlayManager_GetField18 ldr r0, [r0, #8] str r0, [r4, #0x10] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile str r0, [r4, #0x14] ldr r0, [r4, #0x10] bl Save_PlayerData_GetOptionsAddr diff --git a/arm9/overlays/86/asm/overlay_86.s b/arm9/overlays/86/asm/overlay_86.s index bac128445..238e143b6 100644 --- a/arm9/overlays/86/asm/overlay_86.s +++ b/arm9/overlays/86/asm/overlay_86.s @@ -29,7 +29,7 @@ ov86_021D74E0: ; 0x021D74E0 ldr r0, [r0, #4] str r0, [r4, #4] ldr r0, [r4, #8] - bl Save_PlayerData_GetProfileAddr + bl Save_PlayerData_GetProfile str r0, [r4, #0xc] mov r0, #0 add r1, r0, #0 diff --git a/arm9/src/blackout.c b/arm9/src/blackout.c index dd7d656a6..f3a6f5bbc 100644 --- a/arm9/src/blackout.c +++ b/arm9/src/blackout.c @@ -105,7 +105,7 @@ static void Blackout_DrawMessage(FieldSystem *fieldSystem, TaskManager *taskMana AddWindow(env->bgConfig, &env->window, &sBlackoutWindowTemplate); - BufferPlayersName(env->msgFmt, 0, Save_PlayerData_GetProfileAddr(FieldSystem_GetSaveData(fieldSystem))); + BufferPlayersName(env->msgFmt, 0, Save_PlayerData_GetProfile(FieldSystem_GetSaveData(fieldSystem))); if (fieldSystem->location->mapId == MAP_T01R0201) { // {STRVAR_1 3, 0} scurried back home, protecting the exhausted and fainted Pokémon from further harm... Blackout_PrintMessage(env, narc_0328_00004, 0, 0); diff --git a/arm9/src/field_move.c b/arm9/src/field_move.c new file mode 100644 index 000000000..83cef23ff --- /dev/null +++ b/arm9/src/field_move.c @@ -0,0 +1,247 @@ +#include "field_move.h" + +#include "global.h" + +#include "constants/badge.h" +#include "constants/field_move_response.h" +#include "constants/global_fieldmap.h" +#include "constants/sprites.h" +#include "constants/std_script.h" +#include "constants/weather.h" + +#include "map_header.h" +#include "map_object.h" +#include "player_data.h" +#include "save_local_field_data.h" +#include "start_menu.h" +#include "unk_0205EC84.h" +#include "unk_0205F7A0.h" + +/*static*/ FieldUseMoveEnvironment *FieldMove_CreateUseEnvironment(FieldMoveUseData *useData, const FieldMoveCheckData *checkData); +/*static*/ void FieldMove_DeleteUseEnvironment(FieldUseMoveEnvironment *environment); +static u32 FieldMove_CheckCut(const FieldMoveCheckData *checkData); +static void FieldMove_UseCut(FieldMoveUseData *useData, const FieldMoveCheckData *checkData); +static BOOL Task_UseCutInField(TaskManager *taskManager); +static u32 FieldMove_CheckFly(const FieldMoveCheckData *checkData); +static void FieldMove_UseFly(FieldMoveUseData *useData, const FieldMoveCheckData *checkData); +static u32 FieldMove_CheckSurf(const FieldMoveCheckData *checkData); + +extern void sub_02063C70(FieldMoveUseData *useData, const FieldMoveCheckData *checkData); +extern void sub_02063D18(FieldMoveUseData *useData, const FieldMoveCheckData *checkData); +extern u32 sub_02063CE0(const FieldMoveCheckData *checkData); +extern void sub_02063DC0(FieldMoveUseData *useData, const FieldMoveCheckData *checkData); +extern u32 sub_02063D88(const FieldMoveCheckData *checkData); +extern void sub_02063E68(FieldMoveUseData *useData, const FieldMoveCheckData *checkData); +extern u32 sub_02063E30(const FieldMoveCheckData *checkData); +extern void sub_02063F10(FieldMoveUseData *useData, const FieldMoveCheckData *checkData); +extern u32 sub_02063ED8(const FieldMoveCheckData *checkData); +extern void sub_02063FCC(FieldMoveUseData *useData, const FieldMoveCheckData *checkData); +extern u32 sub_02063F80(const FieldMoveCheckData *checkData); +extern void sub_0206405C(FieldMoveUseData *useData, const FieldMoveCheckData *checkData); +extern u32 sub_0206403C(const FieldMoveCheckData *checkData); +extern void sub_02064134(FieldMoveUseData *useData, const FieldMoveCheckData *checkData); +extern u32 sub_020640CC(const FieldMoveCheckData *checkData); +extern void sub_020641F0(FieldMoveUseData *useData, const FieldMoveCheckData *checkData); +extern u32 sub_020641AC(const FieldMoveCheckData *checkData); +extern void sub_020642B4(FieldMoveUseData *useData, const FieldMoveCheckData *checkData); +extern u32 sub_02064284(const FieldMoveCheckData *checkData); +extern void sub_02064324(FieldMoveUseData *useData, const FieldMoveCheckData *checkData); +extern u32 sub_02064310(const FieldMoveCheckData *checkData); +extern void FieldSystem_GetFacingObject(FieldSystem *fieldSystem, LocalMapObject **object); +extern u16 GetPlayerXCoord(PlayerAvatar *playerAvatar); +extern u16 GetPlayerZCoord(PlayerAvatar *playerAvatar); +extern u8 GetMetatileBehavior(FieldSystem *fieldSystem, s32 x, s32 z); +extern void PlayerAvatar_GetCoordsInFront(PlayerAvatar *playerAvatar, s32 *x, s32 *z); +extern BOOL Field_PlayerCanSurfOnTile(PlayerAvatar *fieldPlayerAvatar, u32 standingTile, u32 facingTile); +extern u32 PlayerAvatar_GetFacingDirection(PlayerAvatar *playerAvatar); +extern BOOL MetatileBehavior_IsRockClimbInDirection(u32 facingTile, u32 facingDirection); +extern BOOL MetatileBehavior_IsWaterfall(u8 facingTile); +extern LocalFieldData *Save_LocalFieldData_Get(SaveData *save); +extern u32 LocalFieldData_GetWeatherType(LocalFieldData *localFieldData); +extern void StartScriptFromMenu(TaskManager *taskManager, u16 script, LocalMapObject *object); +extern void FieldMove_SetArgs(FieldSystem *fieldSystem, u16 param1, u16 param2, u16 param3, u16 param4); +extern BOOL Task_UseFlyInField(TaskManager *taksManager); +extern void TownMap_Init(FieldSystem *fieldSystem, TownMapAppData *townMap, u32 param2); +extern void TownMap_Show(FieldSystem *fieldSystem, TownMapAppData *townMap); +extern void StartMenu_SetExitTaskFunc(StartMenuTaskData *startMenu, TaskFunc taskFunc); +extern u32 PlayerAvatar_GetState(PlayerAvatar *avatar); + +static const FieldMoveFuncData sFieldMoveFuncTable[] = { + { FieldMove_UseCut, FieldMove_CheckCut }, + { FieldMove_UseFly, FieldMove_CheckFly }, + { sub_02063C70, FieldMove_CheckSurf }, + { sub_02063D18, sub_02063CE0 }, + { sub_02063DC0, sub_02063D88 }, + { sub_02063E68, sub_02063E30 }, + { sub_02063F10, sub_02063ED8 }, + { sub_02063FCC, sub_02063F80 }, + { sub_0206405C, sub_0206403C }, + { sub_02064134, sub_020640CC }, + { sub_020641F0, sub_020641AC }, + { sub_020642B4, sub_02064284 }, + { sub_02064324, sub_02064310 } +}; + +static inline BOOL FieldMove_CheckSafariOrPalPark(const FieldMoveCheckData *checkData) { + if (Save_VarsFlags_CheckSafariSysFlag(Save_VarsFlags_Get(checkData->fieldSystem->saveData)) == TRUE || Save_VarsFlags_CheckPalParkSysFlag(Save_VarsFlags_Get(checkData->fieldSystem->saveData)) == TRUE) { + return TRUE; + } else { + return FALSE; + } +} + +void *FieldMove_GetMoveFunc(FieldMoveFuncType funcType, u16 fieldMoveIndex) { + if (funcType == FIELD_MOVE_FUNC_USE) { + return sFieldMoveFuncTable[fieldMoveIndex].use; + } else { + return sFieldMoveFuncTable[fieldMoveIndex].check; + } +} + +void FieldMove_InitCheckData(FieldSystem *fieldSystem, FieldMoveCheckData *checkData) { + checkData->fieldSystem = fieldSystem; + checkData->mapId = fieldSystem->location->mapId; + checkData->flag = 0; + + LocalMapObject *facingObject; + + FieldSystem_GetFacingObject(fieldSystem, &facingObject); + checkData->facingObject = facingObject; + + if (facingObject != NULL) { + switch (MapObject_GetSpriteID(facingObject)) { + case SPRITE_ROCK: + checkData->flag |= FIELD_MOVE_CHECK_ROCK; + break; + case SPRITE_BREAKROCK: + checkData->flag |= FIELD_MOVE_CHECK_BREAKROCK; + break; + case SPRITE_TREE: + checkData->flag |= FIELD_MOVE_CHECK_TREE; + break; + } + } + + s32 x = GetPlayerXCoord(fieldSystem->playerAvatar); + s32 z = GetPlayerZCoord(fieldSystem->playerAvatar); + u32 standingTile = GetMetatileBehavior(fieldSystem, x, z); + + PlayerAvatar_GetCoordsInFront(fieldSystem->playerAvatar, &x, &z); + u32 facingTile = GetMetatileBehavior(fieldSystem, x, z); + + if (Field_PlayerCanSurfOnTile(fieldSystem->playerAvatar, standingTile, facingTile)) { + checkData->flag |= FIELD_MOVE_CHECK_WATER; + } + if (MetatileBehavior_IsRockClimbInDirection(facingTile, PlayerAvatar_GetFacingDirection(fieldSystem->playerAvatar))) { + checkData->flag |= FIELD_MOVE_CHECK_ROCKCLIMB; + } + if (MetatileBehavior_IsWaterfall(facingTile)) { + checkData->flag |= FIELD_MOVE_CHECK_WATERFALL; + } + switch (LocalFieldData_GetWeatherType(Save_LocalFieldData_Get(fieldSystem->saveData))) { + case WEATHER_DEFOG: + checkData->flag |= FIELD_MOVE_CHECK_DEFOG; + break; + case WEATHER_FLASH: + checkData->flag |= FIELD_MOVE_CHECK_FLASH; + break; + } +} + +/*static*/ FieldUseMoveEnvironment *FieldMove_CreateUseEnvironment(FieldMoveUseData *useData, const FieldMoveCheckData *checkData) { + FieldUseMoveEnvironment *environment = AllocFromHeap(HEAP_ID_32, sizeof(FieldUseMoveEnvironment)); + environment->magic = 0x19740205; + environment->facingObject = checkData->facingObject; + environment->useData = *useData; + return environment; +} + +/*static*/ void FieldMove_DeleteUseEnvironment(FieldUseMoveEnvironment *environment) { + GF_ASSERT(environment->magic == 0x19740205); + FreeToHeap(environment); +} + +static u32 FieldMove_CheckCut(const FieldMoveCheckData *checkData) { + if (checkData->fieldSystem->unk6C == 2 || checkData->fieldSystem->unk6C == 3) { + return FIELD_MOVE_RESPONSE_NOT_HERE; + } + if (!PlayerProfile_TestBadgeFlag(Save_PlayerData_GetProfile(checkData->fieldSystem->saveData), BADGE_FOREST)) { + return FIELD_MOVE_RESPONSE_NEED_BADGE; + } + if (checkData->flag & FIELD_MOVE_CHECK_TREE) { + return FIELD_MOVE_RESPONSE_OK; + } + + return FIELD_MOVE_RESPONSE_NOT_HERE; +} + +static void FieldMove_UseCut(FieldMoveUseData *useData, const FieldMoveCheckData *checkData) { + StartMenuTaskData *startMenu = TaskManager_GetEnvironment(useData->taskManager); + FieldUseMoveEnvironment *useMoveEnvironment = FieldMove_CreateUseEnvironment(useData, checkData); + FieldSystem_LoadFieldOverlay(checkData->fieldSystem); + startMenu->exitTaskFunc = Task_UseCutInField; + startMenu->exitTaskEnvironment = useMoveEnvironment; + startMenu->state = START_MENU_STATE_10; +} + +static BOOL Task_UseCutInField(TaskManager *taskManager) { + FieldUseMoveEnvironment *environment = TaskManager_GetEnvironment(taskManager); + FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); + StartScriptFromMenu(taskManager, std_menu_cut, environment->facingObject); + FieldMove_SetArgs(fieldSystem, environment->useData.partySlot, 0, 0, 0); + FieldMove_DeleteUseEnvironment(environment); + return FALSE; +} + +static u32 FieldMove_CheckFly(const FieldMoveCheckData *checkData) { + if (checkData->fieldSystem->unk6C == 2 || checkData->fieldSystem->unk6C == 3) { + return FIELD_MOVE_RESPONSE_NOT_HERE; + } + if (!PlayerProfile_TestBadgeFlag(Save_PlayerData_GetProfile(checkData->fieldSystem->saveData), BADGE_COBBLE)) { + return FIELD_MOVE_RESPONSE_NEED_BADGE; + } + if (!MapHeader_IsFlyAllowed(checkData->mapId)) { + return FIELD_MOVE_RESPONSE_NOT_HERE; + } + if (Save_VarsFlags_CheckHaveFollower(Save_VarsFlags_Get(checkData->fieldSystem->saveData)) == TRUE) { + return FIELD_MOVE_RESPONSE_HAVE_FOLLOWER; + } + if (FieldMove_CheckSafariOrPalPark(checkData) == TRUE) { + return FIELD_MOVE_RESPONSE_NOT_HERE; + } + + return FIELD_MOVE_RESPONSE_OK; +} + +static void FieldMove_UseFly(FieldMoveUseData *useData, const FieldMoveCheckData *checkData) { + FieldSystem *fieldSystem = TaskManager_GetFieldSystem(useData->taskManager); + StartMenuTaskData *startMenu = TaskManager_GetEnvironment(useData->taskManager); + FieldMoveData *fieldMoveData = AllocFromHeap(HEAP_ID_FIELD, sizeof(FieldMoveData)); + fieldMoveData->partySlot = useData->partySlot; + startMenu->exitTaskEnvironment2 = fieldMoveData; + TownMapAppData *townMap = AllocFromHeap(HEAP_ID_FIELD, sizeof(TownMapAppData)); + startMenu->exitTaskEnvironment = townMap; + TownMap_Init(fieldSystem, startMenu->exitTaskEnvironment, 1); + TownMap_Show(fieldSystem, startMenu->exitTaskEnvironment); + StartMenu_SetExitTaskFunc(startMenu, Task_UseFlyInField); +} + +static u32 FieldMove_CheckSurf(const FieldMoveCheckData *checkData) { + if (checkData->fieldSystem->unk6C == 2 || checkData->fieldSystem->unk6C == 3) { + return FIELD_MOVE_RESPONSE_NOT_HERE; + } + if (!PlayerProfile_TestBadgeFlag(Save_PlayerData_GetProfile(checkData->fieldSystem->saveData), BADGE_RELIC)) { + return FIELD_MOVE_RESPONSE_NEED_BADGE; + } + if (PlayerAvatar_GetState(checkData->fieldSystem->playerAvatar) == PLAYER_STATE_SURFING) { + return FIELD_MOVE_RESPONSE_ALREADY_SURFING; + } + if (!(checkData->flag & FIELD_MOVE_CHECK_WATER)) { + return FIELD_MOVE_RESPONSE_NOT_HERE; + } + if (Save_VarsFlags_CheckHaveFollower(Save_VarsFlags_Get(checkData->fieldSystem->saveData)) == TRUE) { + return FIELD_MOVE_RESPONSE_HAVE_FOLLOWER; + } + + return FIELD_MOVE_RESPONSE_OK; +} diff --git a/arm9/src/mail.c b/arm9/src/mail.c index 49085ef7f..d663e3e3b 100644 --- a/arm9/src/mail.c +++ b/arm9/src/mail.c @@ -56,7 +56,7 @@ void Mail_SetNewMessageDetails(struct Mail *mail, u8 type, u8 monIdx, struct Sav Mail_Init(mail); mail->mail_type = type; party = SaveArray_Party_Get(save); - profile = Save_PlayerData_GetProfileAddr(save); + profile = Save_PlayerData_GetProfile(save); CopyU16StringArray(mail->author_name, PlayerProfile_GetNamePtr(profile)); mail->author_gender = (u8)PlayerProfile_GetTrainerGender(profile); diff --git a/arm9/src/message_format.c b/arm9/src/message_format.c index e50cc2193..aeb1830e7 100644 --- a/arm9/src/message_format.c +++ b/arm9/src/message_format.c @@ -125,7 +125,7 @@ void BufferRivalsName(MessageFormat *messageFormat, u32 idx, struct SaveData *sa } void BufferFriendsName(MessageFormat *messageFormat, u32 idx, struct SaveData *save) { - PlayerProfile *profile = Save_PlayerData_GetProfileAddr(save); + PlayerProfile *profile = Save_PlayerData_GetProfile(save); struct MsgData *msgData = NewMsgDataFromNarc(MSGDATA_LOAD_LAZY, NARC_MSGDATA_MSG, NARC_msg_narc_0497_bin, messageFormat->heapId); if (PlayerProfile_GetTrainerGender(profile) == PLAYER_GENDER_MALE) { ReadMsgDataIntoString(msgData, narc_0497_00001, messageFormat->buffer); // Dawn diff --git a/arm9/src/player_data.c b/arm9/src/player_data.c index 8a171eb44..81c52b802 100644 --- a/arm9/src/player_data.c +++ b/arm9/src/player_data.c @@ -23,7 +23,7 @@ void Save_PlayerData_Init(PlayerData *pds) { InitIGT(&pds->igt); } -PlayerProfile *Save_PlayerData_GetProfileAddr(struct SaveData *save) { +PlayerProfile *Save_PlayerData_GetProfile(struct SaveData *save) { return &((PlayerData *)SaveArray_Get(save, 1))->profile; } diff --git a/arm9/src/scrcmd.c b/arm9/src/scrcmd.c index 9daf08a28..9282a03dd 100644 --- a/arm9/src/scrcmd.c +++ b/arm9/src/scrcmd.c @@ -103,7 +103,7 @@ extern u32 PlayerAvatar_GetFacingDirection(PlayerAvatar *playerAvatar); extern u32 sub_02059E74(u32 direction); extern void ov05_021F1EC0(LocalMapObject *event, u32 param1); extern u16 GetPlayerXCoord(PlayerAvatar *playerAvatar); -extern u16 GetPlayerYCoord(PlayerAvatar *playerAvatar); +extern u16 GetPlayerZCoord(PlayerAvatar *playerAvatar); extern u16 sub_02029E0C(SealCase *sealCase); extern u16 SealCase_CountSealOccurrenceAnywhere(SealCase *sealCase, u16 sealId); extern void sub_02029D44(SealCase *sealCase, u16 sealId, s16 amount); @@ -133,8 +133,8 @@ extern u32 sub_02027008(SaveFashionData *fashionData, u32 param1); extern void sub_02027478(u32 param0, u16 param1); extern void ShowGeonetScreen(FieldSystem *fieldSystem); extern void ShowSealCapsuleEditor(TaskManager *taskManager, SaveData *save); -extern void sub_0205F7A0(FieldSystem *fieldSystem, TownMapAppData *townMap, u32 param2); // TownMap_Init? -extern void sub_02037E90(FieldSystem *fieldSystem, TownMapAppData *townMap); // ShowTownMap? +extern void TownMap_Init(FieldSystem *fieldSystem, TownMapAppData *townMap, u32 param2); +extern void TownMap_Show(FieldSystem *fieldSystem, TownMapAppData *townMap); extern SavePoffinData *Save_PoffinData_Get(SaveData *save); extern u32 sub_020281B8(SavePoffinData *savePoffinData); extern void sub_02037FE4(FieldSystem *fieldSystem, ScrCmdUnkStruct01D9 *param1); @@ -1801,7 +1801,7 @@ BOOL ScrCmd_GetPlayerPosition(ScriptContext *ctx) { // 0069 u16 *y = ScriptGetVarPointer(ctx); *x = GetPlayerXCoord(fieldSystem->playerAvatar); - *y = GetPlayerYCoord(fieldSystem->playerAvatar); + *y = GetPlayerZCoord(fieldSystem->playerAvatar); return FALSE; } @@ -2265,8 +2265,8 @@ BOOL ScrCmd_ShowSealCapsuleEditor(ScriptContext *ctx) { // 00A9 BOOL ScrCmd_ShowTownMapScreen(ScriptContext *ctx) { // 00AA TownMapAppData **townMap = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_RUNNING_APP_DATA); *townMap = AllocFromHeap(HEAP_ID_FIELD, sizeof(TownMapAppData)); - sub_0205F7A0(ctx->fieldSystem, *townMap, 2); // TownMap_Init? - sub_02037E90(ctx->fieldSystem, *townMap); // ShowTownMap? + TownMap_Init(ctx->fieldSystem, *townMap, 2); + TownMap_Show(ctx->fieldSystem, *townMap); SetupNativeScript(ctx, sub_0203BB90); return TRUE; } @@ -2815,7 +2815,7 @@ BOOL ScrCmd_DummyDexCheck(ScriptContext *ctx) { // 0122 BOOL ScrCmd_GetDexEvaluationMessage(ScriptContext *ctx) { // 0123 Pokedex *pokedex = Save_Pokedex_Get(ctx->fieldSystem->saveData); - PlayerProfile *playerProfile = Save_PlayerData_GetProfileAddr(ctx->fieldSystem->saveData); + PlayerProfile *playerProfile = Save_PlayerData_GetProfile(ctx->fieldSystem->saveData); u8 mode = ScriptReadByte(ctx); u16 *var = ScriptGetVarPointer(ctx); if (mode == 0) { @@ -2987,7 +2987,7 @@ BOOL ScrCmd_Unk013C(ScriptContext *ctx) { // 013C LocalMapObject **lastInteracted = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_LAST_INTERACTED); MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); u16 unk0 = ScriptReadHalfword(ctx); - PlayerProfile *playerProfile = Save_PlayerData_GetProfileAddr(FieldSystem_GetSaveData(ctx->fieldSystem)); + PlayerProfile *playerProfile = Save_PlayerData_GetProfile(FieldSystem_GetSaveData(ctx->fieldSystem)); SaveEasyChat *easyChat = Save_EasyChat_Get(FieldSystem_GetSaveData(ctx->fieldSystem)); u16 objId; @@ -3139,14 +3139,14 @@ BOOL ScrCmd_Unk0153(ScriptContext *ctx) { // 0153 } BOOL ScrCmd_Unk0154(ScriptContext *ctx) { // 0154 - PlayerProfile *playerProfile = Save_PlayerData_GetProfileAddr(FieldSystem_GetSaveData(ctx->fieldSystem)); + PlayerProfile *playerProfile = Save_PlayerData_GetProfile(FieldSystem_GetSaveData(ctx->fieldSystem)); MessageFormat **messageFormat = FieldSysGetAttrAddr(ctx->fieldSystem, SCRIPTENV_MESSAGE_FORMAT); sub_0205363C(PlayerProfile_GetTrainerID(playerProfile), PlayerProfile_GetTrainerGender(playerProfile), *messageFormat); return FALSE; } BOOL ScrCmd_Unk0155(ScriptContext *ctx) { // 0155 - PlayerProfile *playerProfile = Save_PlayerData_GetProfileAddr(FieldSystem_GetSaveData(ctx->fieldSystem)); + PlayerProfile *playerProfile = Save_PlayerData_GetProfile(FieldSystem_GetSaveData(ctx->fieldSystem)); u16 unk0 = ScriptGetVar(ctx); u16 *var = ScriptGetVarPointer(ctx); *var = sub_02053678(PlayerProfile_GetTrainerID(playerProfile), PlayerProfile_GetTrainerGender(playerProfile), unk0); @@ -3155,7 +3155,7 @@ BOOL ScrCmd_Unk0155(ScriptContext *ctx) { // 0155 } BOOL ScrCmd_Unk029C(ScriptContext *ctx) { // 029C - PlayerProfile *playerProfile = Save_PlayerData_GetProfileAddr(FieldSystem_GetSaveData(ctx->fieldSystem)); + PlayerProfile *playerProfile = Save_PlayerData_GetProfile(FieldSystem_GetSaveData(ctx->fieldSystem)); u16 unk0 = ScriptGetVar(ctx); u16 *var = ScriptGetVarPointer(ctx); *var = sub_02053678(PlayerProfile_GetTrainerID(playerProfile), PlayerProfile_GetTrainerGender(playerProfile), unk0); @@ -3163,7 +3163,7 @@ BOOL ScrCmd_Unk029C(ScriptContext *ctx) { // 029C } BOOL ScrCmd_SetPlayerAvatar(ScriptContext *ctx) { // 0156 - PlayerProfile *playerProfile = Save_PlayerData_GetProfileAddr(FieldSystem_GetSaveData(ctx->fieldSystem)); + PlayerProfile *playerProfile = Save_PlayerData_GetProfile(FieldSystem_GetSaveData(ctx->fieldSystem)); u16 avatar = ScriptGetVar(ctx); PlayerProfile_SetAvatar(playerProfile, avatar); return FALSE; @@ -3182,7 +3182,7 @@ BOOL ScrCmd_SetSpawn(ScriptContext *ctx) { // 014C } BOOL ScrCmd_GetPlayerGender(ScriptContext *ctx) { // 014D - PlayerProfile *playerProfile = Save_PlayerData_GetProfileAddr(FieldSystem_GetSaveData(ctx->fieldSystem)); + PlayerProfile *playerProfile = Save_PlayerData_GetProfile(FieldSystem_GetSaveData(ctx->fieldSystem)); u16 *var = ScriptGetVarPointer(ctx); *var = PlayerProfile_GetTrainerGender(playerProfile); return FALSE; @@ -3884,7 +3884,7 @@ BOOL ScrCmd_NationalDex(ScriptContext *ctx) { // 022D *var = 0; if (action == 1) { Pokedex_SetNatDexFlag(Save_Pokedex_Get(ctx->fieldSystem->saveData)); - PlayerProfile_SetNatDexFlag(Save_PlayerData_GetProfileAddr(ctx->fieldSystem->saveData)); + PlayerProfile_SetNatDexFlag(Save_PlayerData_GetProfile(ctx->fieldSystem->saveData)); } else if (action == 2) { *var = Pokedex_GetNatDexFlag(Save_Pokedex_Get(ctx->fieldSystem->saveData)); } else { @@ -3966,7 +3966,7 @@ BOOL ScrCmd_GetGameVersion(ScriptContext *ctx) { // 0246 BOOL ScrCmd_GiveWallpaper(ScriptContext *ctx) { // 0249 - used for easy chat unlock, todo: find better name FieldSystem *fieldSystem = ctx->fieldSystem; - PlayerProfile *playerProfile = Save_PlayerData_GetProfileAddr(FieldSystem_GetSaveData(fieldSystem)); + PlayerProfile *playerProfile = Save_PlayerData_GetProfile(FieldSystem_GetSaveData(fieldSystem)); u16 *var = ScriptGetVarPointer(ctx); PCStorage *pcStorage = SaveArray_PCStorage_Get(fieldSystem->saveData); u16 unk0 = ScriptGetVar(ctx); diff --git a/arm9/src/scrcmd_13.c b/arm9/src/scrcmd_13.c index 1d5b9ceea..7dc443567 100644 --- a/arm9/src/scrcmd_13.c +++ b/arm9/src/scrcmd_13.c @@ -62,7 +62,7 @@ BOOL ScrCmd_Unk0255(struct ScriptContext *ctx) // 0255 void *unk = sub_02022528(ctx->fieldSystem->saveData); struct PCStorage *pc = SaveArray_PCStorage_Get(ctx->fieldSystem->saveData); struct Pokemon *pokemon = AllocMonZeroed(HEAP_ID_32); - PlayerProfile *player = Save_PlayerData_GetProfileAddr(ctx->fieldSystem->saveData); + PlayerProfile *player = Save_PlayerData_GetProfile(ctx->fieldSystem->saveData); struct Pokedex *pokedex = Save_Pokedex_Get(ctx->fieldSystem->saveData); // unused for (s32 i = 0; i < PARTY_SIZE; i++) { diff --git a/arm9/src/scrcmd_coins.c b/arm9/src/scrcmd_coins.c index 9c51586de..1d7e3f32f 100644 --- a/arm9/src/scrcmd_coins.c +++ b/arm9/src/scrcmd_coins.c @@ -83,7 +83,7 @@ BOOL ScrCmd_HasEnoughCoinsImmediate(struct ScriptContext *ctx) // 0274 - todo: C struct FieldSystem *fieldSystem = ctx->fieldSystem; struct SaveData *save = FieldSystem_GetSaveData(fieldSystem); // Created, but discarded. - PlayerProfile *player = Save_PlayerData_GetProfileAddr(save); + PlayerProfile *player = Save_PlayerData_GetProfile(save); u16 *coins_ptr = Save_PlayerData_GetCoinsAddr(fieldSystem->saveData); u16 *ret_ptr = ScriptGetVarPointer(ctx); @@ -104,7 +104,7 @@ BOOL ScrCmd_HasEnoughCoinsAddress(struct ScriptContext *ctx) // 02A9 - todo: Can struct FieldSystem *fieldSystem = ctx->fieldSystem; struct SaveData *save = FieldSystem_GetSaveData(fieldSystem); // Created, but discarded - PlayerProfile *player = Save_PlayerData_GetProfileAddr(save); + PlayerProfile *player = Save_PlayerData_GetProfile(save); u16 *coins_ptr = Save_PlayerData_GetCoinsAddr(fieldSystem->saveData); u16 *ret_ptr = ScriptGetVarPointer(ctx); diff --git a/arm9/src/scrcmd_daycare.c b/arm9/src/scrcmd_daycare.c index ca03ff428..1e975ba6f 100644 --- a/arm9/src/scrcmd_daycare.c +++ b/arm9/src/scrcmd_daycare.c @@ -56,7 +56,7 @@ BOOL ScrCmd_GiveDaycareEgg(struct ScriptContext *ctx) // 01A9 struct Daycare *daycare = SaveArray_Get(fieldSystem->saveData, 8); struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); struct SaveData *save = FieldSystem_GetSaveData(ctx->fieldSystem); - PlayerProfile *player = Save_PlayerData_GetProfileAddr(save); + PlayerProfile *player = Save_PlayerData_GetProfile(save); ov05_Daycare_GiveEggToPlayer(daycare, party, player); diff --git a/arm9/src/scrcmd_flags.c b/arm9/src/scrcmd_flags.c index a95aa6ba9..ef419ef64 100644 --- a/arm9/src/scrcmd_flags.c +++ b/arm9/src/scrcmd_flags.c @@ -82,7 +82,7 @@ BOOL ScrCmd_HasBadge(struct ScriptContext *ctx) // 015B u16 badge_no = ScriptGetVar(ctx); u16 *ret_ptr = ScriptGetVarPointer(ctx); GF_ASSERT(badge_no < 8); - PlayerProfile *player = Save_PlayerData_GetProfileAddr(ctx->fieldSystem->saveData); + PlayerProfile *player = Save_PlayerData_GetProfile(ctx->fieldSystem->saveData); *ret_ptr = (u16)PlayerProfile_TestBadgeFlag(player, badge_no); @@ -93,7 +93,7 @@ BOOL ScrCmd_GiveBadge(struct ScriptContext *ctx) // 015C { u16 badge_no = ScriptGetVar(ctx); GF_ASSERT(badge_no < 8); - PlayerProfile *player = Save_PlayerData_GetProfileAddr(ctx->fieldSystem->saveData); + PlayerProfile *player = Save_PlayerData_GetProfile(ctx->fieldSystem->saveData); PlayerProfile_SetBadgeFlag(player, badge_no); @@ -117,7 +117,7 @@ BOOL ScrCmd_GetTotalEarnedBadges(struct ScriptContext *ctx) // 015D - todo: Coun u16 i; u16 badges; for (i = 0, badges = 0; i < 8; i++) { - PlayerProfile *player = Save_PlayerData_GetProfileAddr(ctx->fieldSystem->saveData); + PlayerProfile *player = Save_PlayerData_GetProfile(ctx->fieldSystem->saveData); BOOL has_badge = PlayerProfile_TestBadgeFlag(player, UNK_020F457F[i]); if (has_badge == TRUE) { badges++; diff --git a/arm9/src/scrcmd_mart.c b/arm9/src/scrcmd_mart.c index 192d2c104..144bed419 100644 --- a/arm9/src/scrcmd_mart.c +++ b/arm9/src/scrcmd_mart.c @@ -356,7 +356,7 @@ BOOL ScrCmd_NormalMart(ScriptContext *ctx) // 0147 - todo: Pokemart? u8 i; for (i = 0; i < 8; i++) { - if (PlayerProfile_TestBadgeFlag(Save_PlayerData_GetProfileAddr(ctx->fieldSystem->saveData), i) == TRUE) { + if (PlayerProfile_TestBadgeFlag(Save_PlayerData_GetProfile(ctx->fieldSystem->saveData), i) == TRUE) { badgeCount++; } } diff --git a/arm9/src/scrcmd_money.c b/arm9/src/scrcmd_money.c index 0af6215d4..aeb00dfd3 100644 --- a/arm9/src/scrcmd_money.c +++ b/arm9/src/scrcmd_money.c @@ -12,7 +12,7 @@ extern void ov05_021E28A0(struct FieldSystem *fieldSystem, Window *moneyBox); BOOL ScrCmd_GiveMoney(struct ScriptContext *ctx) // 006F { struct SaveData *save = FieldSystem_GetSaveData(ctx->fieldSystem); - PlayerProfile *player = Save_PlayerData_GetProfileAddr(save); + PlayerProfile *player = Save_PlayerData_GetProfile(save); u32 amount = ScriptReadWord(ctx); PlayerProfile_AddMoney(player, amount); @@ -23,7 +23,7 @@ BOOL ScrCmd_GiveMoney(struct ScriptContext *ctx) // 006F BOOL ScrCmd_TakeMoneyImmediate(struct ScriptContext *ctx) // 0070 - todo: TakeMoney? { struct SaveData *save = FieldSystem_GetSaveData(ctx->fieldSystem); - PlayerProfile *player = Save_PlayerData_GetProfileAddr(save); + PlayerProfile *player = Save_PlayerData_GetProfile(save); u32 amount = ScriptReadWord(ctx); PlayerProfile_SubMoney(player, amount); @@ -34,7 +34,7 @@ BOOL ScrCmd_TakeMoneyImmediate(struct ScriptContext *ctx) // 0070 - todo: TakeMo BOOL ScrCmd_TakeMoneyAddress(struct ScriptContext *ctx) // 01A3 - todo: TakeMoneyVar? { struct SaveData *save = FieldSystem_GetSaveData(ctx->fieldSystem); - PlayerProfile *player = Save_PlayerData_GetProfileAddr(save); + PlayerProfile *player = Save_PlayerData_GetProfile(save); u16 amount = ScriptGetVar(ctx); PlayerProfile_SubMoney(player, (u32)amount); @@ -45,7 +45,7 @@ BOOL ScrCmd_TakeMoneyAddress(struct ScriptContext *ctx) // 01A3 - todo: TakeMone BOOL ScrCmd_HasEnoughMoneyImmediate(struct ScriptContext *ctx) // 0071 - todo: CanAffordMoney? { struct SaveData *save = FieldSystem_GetSaveData(ctx->fieldSystem); - PlayerProfile *player = Save_PlayerData_GetProfileAddr(save); + PlayerProfile *player = Save_PlayerData_GetProfile(save); u16 *ret_ptr = ScriptGetVarPointer(ctx); u32 amount = ScriptReadWord(ctx); @@ -63,7 +63,7 @@ BOOL ScrCmd_HasEnoughMoneyImmediate(struct ScriptContext *ctx) // 0071 - todo: C BOOL ScrCmd_HasEnoughMoneyAddress(struct ScriptContext *ctx) // 01AB - todo: CanAffordMoneyVar? { struct SaveData *save = FieldSystem_GetSaveData(ctx->fieldSystem); - PlayerProfile *player = Save_PlayerData_GetProfileAddr(save); + PlayerProfile *player = Save_PlayerData_GetProfile(save); u16 *ret_ptr = ScriptGetVarPointer(ctx); u16 amount = ScriptGetVar(ctx); diff --git a/arm9/src/scrcmd_move_relearner.c b/arm9/src/scrcmd_move_relearner.c index 233484d0c..df8febbed 100644 --- a/arm9/src/scrcmd_move_relearner.c +++ b/arm9/src/scrcmd_move_relearner.c @@ -64,7 +64,7 @@ void sub_02045E74(struct ScriptContext *ctx, u8 a1, struct Pokemon *pokemon, u16 moveRelearner->mon = pokemon; struct SaveData *save = FieldSystem_GetSaveData(ctx->fieldSystem); - moveRelearner->profile = Save_PlayerData_GetProfileAddr(save); + moveRelearner->profile = Save_PlayerData_GetProfile(save); moveRelearner->options = Save_PlayerData_GetOptionsAddr(ctx->fieldSystem->saveData); moveRelearner->eligibleMoves = eligibleMoves; diff --git a/arm9/src/scrcmd_names.c b/arm9/src/scrcmd_names.c index d79639e5c..d9c9d2030 100644 --- a/arm9/src/scrcmd_names.c +++ b/arm9/src/scrcmd_names.c @@ -32,7 +32,7 @@ BOOL ScrCmd_GetPlayerName(ScriptContext *ctx) // 00CD - todo: BufferPlayerName? MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); u8 idx = ScriptReadByte(ctx); SaveData *save = FieldSystem_GetSaveData(fieldSystem); - PlayerProfile *player = Save_PlayerData_GetProfileAddr(save); + PlayerProfile *player = Save_PlayerData_GetProfile(save); BufferPlayersName(*messageFormat, idx, player); @@ -208,7 +208,7 @@ BOOL ScrCmd_Unk00D9(ScriptContext *ctx) // 00D9 - todo: BufferPlayerTrainerClass { FieldSystem *fieldSystem = ctx->fieldSystem; SaveData *save = FieldSystem_GetSaveData(fieldSystem); - PlayerProfile *player = Save_PlayerData_GetProfileAddr(save); + PlayerProfile *player = Save_PlayerData_GetProfile(save); MessageFormat **messageFormat = FieldSysGetAttrAddr(fieldSystem, SCRIPTENV_MESSAGE_FORMAT); u8 idx = ScriptReadByte(ctx); u32 gender = PlayerProfile_GetTrainerGender(player); diff --git a/arm9/src/scrcmd_party.c b/arm9/src/scrcmd_party.c index eecbecb8c..1c2a70c3f 100644 --- a/arm9/src/scrcmd_party.c +++ b/arm9/src/scrcmd_party.c @@ -55,7 +55,7 @@ BOOL ScrCmd_CheckPartyMonOTID(struct ScriptContext *ctx) // 0199 - todo: CheckPa { struct FieldSystem *fieldSystem = ctx->fieldSystem; struct SaveData *save = FieldSystem_GetSaveData(fieldSystem); - PlayerProfile *player = Save_PlayerData_GetProfileAddr(save); + PlayerProfile *player = Save_PlayerData_GetProfile(save); u16 *mon_slot = ScriptGetVarPointer(ctx); u16 *ret_ptr = ScriptGetVarPointer(ctx); @@ -77,7 +77,7 @@ BOOL ScrCmd_CheckPartyMonOTID(struct ScriptContext *ctx) // 0199 - todo: CheckPa BOOL ScrCmd_GiveEgg(struct ScriptContext *ctx) // 0097 { struct FieldSystem *fieldSystem = ctx->fieldSystem; - PlayerProfile *player = Save_PlayerData_GetProfileAddr(fieldSystem->saveData); + PlayerProfile *player = Save_PlayerData_GetProfile(fieldSystem->saveData); u16 species = ScriptGetVar(ctx); u16 unk = ScriptGetVar(ctx); struct Party *party = SaveArray_Party_Get(fieldSystem->saveData); diff --git a/arm9/src/scrcmd_union.c b/arm9/src/scrcmd_union.c index f8203b882..cd89933c6 100644 --- a/arm9/src/scrcmd_union.c +++ b/arm9/src/scrcmd_union.c @@ -67,7 +67,7 @@ BOOL ScrCmd_UnionGroup(struct ScriptContext *ctx) // 021D } case 6: { // create a group struct String *player_name = String_New(64, HEAP_ID_32); - PlayerProfile *player = Save_PlayerData_GetProfileAddr(ctx->fieldSystem->saveData); + PlayerProfile *player = Save_PlayerData_GetProfile(ctx->fieldSystem->saveData); PlayerName_FlatToString(player, player_name); sub_020287C0(unk_sav_ptr, 0, 1, player_name); diff --git a/arm9/src/script_pokemon_util.c b/arm9/src/script_pokemon_util.c index 54fca5242..752997aee 100644 --- a/arm9/src/script_pokemon_util.c +++ b/arm9/src/script_pokemon_util.c @@ -26,7 +26,7 @@ BOOL MonNotFaintedOrEgg(struct Pokemon *pokemon) { BOOL GiveMon(HeapID heapId, struct SaveData *save, u16 species, u8 level, u16 item, u32 mapSec, u32 encounterType) { u32 ptr; - PlayerProfile *data = Save_PlayerData_GetProfileAddr(save); + PlayerProfile *data = Save_PlayerData_GetProfile(save); struct Party *party = SaveArray_Party_Get(save); struct Pokemon *mon = AllocMonZeroed(heapId); ZeroMonData(mon); @@ -45,7 +45,7 @@ BOOL GiveMon(HeapID heapId, struct SaveData *save, u16 species, u8 level, u16 it /* Seems to have something to do with Manaphy Egg*/ BOOL GiveEgg(HeapID heapId, struct SaveData *save, u16 species, int level, int metLocIndex, int a3) { #pragma unused(heapId) - PlayerProfile *data = Save_PlayerData_GetProfileAddr(save); + PlayerProfile *data = Save_PlayerData_GetProfile(save); struct Party *party = SaveArray_Party_Get(save); struct Pokemon *mon = AllocMonZeroed(HEAP_ID_32); ZeroMonData(mon); diff --git a/arm9/src/task.c b/arm9/src/task.c index de228486e..c06726158 100644 --- a/arm9/src/task.c +++ b/arm9/src/task.c @@ -67,8 +67,8 @@ BOOL FieldSystem_ApplicationIsRunning(struct FieldSystem *fieldSystem) { return sub_0203739C(fieldSystem) || sub_020373C4(fieldSystem); } -void sub_0204649C(void *r0) { - LoadOverlay_OVERLAY_05(r0); +void FieldSystem_LoadFieldOverlay(FieldSystem *fieldSystem) { + FieldSystem_LoadFieldOverlayInternal(fieldSystem); } BOOL sub_020464A4(void *r0) { diff --git a/arm9/src/unk_02031734.c b/arm9/src/unk_02031734.c index ce96244fc..33b311cb8 100644 --- a/arm9/src/unk_02031734.c +++ b/arm9/src/unk_02031734.c @@ -69,7 +69,7 @@ void sub_02031734(struct SaveData *save, u8 param1) { UNK_021C5A00->unk43 = 1; UNK_021C5A00->unk28 = save; - UNK_021C5A00->unk2C = Save_PlayerData_GetProfileAddr(save); + UNK_021C5A00->unk2C = Save_PlayerData_GetProfile(save); UNK_021C5A00->unk3C = 2; UNK_021C5A00->unk3D = 0; @@ -1610,7 +1610,7 @@ void sub_0203341C() { } void *sub_0203346C(struct SaveData *save, u32 param1) { - Save_PlayerData_GetProfileAddr(save); + Save_PlayerData_GetProfile(save); if (sub_02030F40() != 0) { return 0; } diff --git a/arm9/src/unk_0204AF24.c b/arm9/src/unk_0204AF24.c index 3e7b51c5b..7604fded3 100644 --- a/arm9/src/unk_0204AF24.c +++ b/arm9/src/unk_0204AF24.c @@ -41,7 +41,7 @@ void CallTask_RestoreOverworld(struct TaskManager *taskManager) { GF_ASSERT(FALSE); return; } - sub_0204649C(fieldSystem); + FieldSystem_LoadFieldOverlay(fieldSystem); TaskManager_Call(taskManager, &sub_0204AF6C, NULL); } diff --git a/arm9/src/unk_0205EC84.c b/arm9/src/unk_0205EC84.c index bf4c86ca9..055d59e47 100644 --- a/arm9/src/unk_0205EC84.c +++ b/arm9/src/unk_0205EC84.c @@ -338,7 +338,7 @@ void sub_0205F234(struct SaveVarsFlags *state) { _flag_clear(state, 0x979); } -BOOL sub_0205F244(struct SaveVarsFlags *state) { +BOOL Save_VarsFlags_CheckPalParkSysFlag(struct SaveVarsFlags *state) { return _flag_check(state, 0x979); } diff --git a/arm9/src/unk_0205FA2C.c b/arm9/src/unk_0205FA2C.c index 478c7efcd..636f80037 100644 --- a/arm9/src/unk_0205FA2C.c +++ b/arm9/src/unk_0205FA2C.c @@ -118,7 +118,7 @@ u32 sub_0205FB34( sub_0207B000(ptr, UNK_020F7454); - sub_0207C2A4(ptr, Save_PlayerData_GetProfileAddr(save)); + sub_0207C2A4(ptr, Save_PlayerData_GetProfile(save)); sub_020373D4(fieldSystem, &UNK_020FA6E8, ptr); diff --git a/arm9/src/unk_0208890C.c b/arm9/src/unk_0208890C.c index 705523e44..331d34f48 100644 --- a/arm9/src/unk_0208890C.c +++ b/arm9/src/unk_0208890C.c @@ -29,7 +29,7 @@ struct PoffinCaseAppData *sub_0208890C(u32 a0, struct SaveData *save, HeapID hea ret->save = save; ret->savePoffinData = Save_PoffinData_Get(save); - ret->player = Save_PlayerData_GetProfileAddr(save); + ret->player = Save_PlayerData_GetProfile(save); ret->bag = Save_Bag_Get(save); ret->options = Save_PlayerData_GetOptionsAddr(save); ret->unk1C = a3; diff --git a/include/constants/badge.h b/include/constants/badge.h new file mode 100644 index 000000000..e4deea758 --- /dev/null +++ b/include/constants/badge.h @@ -0,0 +1,13 @@ +#ifndef POKEDIAMOND_CONSTANTS_BADGE_H +#define POKEDIAMOND_CONSTANTS_BADGE_H + +#define BADGE_COAL 0 +#define BADGE_FOREST 1 +#define BADGE_COBBLE 2 +#define BADGE_FEN 3 +#define BADGE_RELIC 4 +#define BADGE_MINE 5 +#define BADGE_ICICLE 6 +#define BADGE_BEACON 7 + +#endif // POKEDIAMOND_CONSTANTS_BADGE_H diff --git a/include/constants/field_move_response.h b/include/constants/field_move_response.h new file mode 100644 index 000000000..d9fea8a9c --- /dev/null +++ b/include/constants/field_move_response.h @@ -0,0 +1,11 @@ +#ifndef POKEDIAMOND_CONSTANTS_FIELD_MOVE_RESPONSE_H +#define POKEDIAMOND_CONSTANTS_FIELD_MOVE_RESPONSE_H + +#define FIELD_MOVE_RESPONSE_OK 0 +#define FIELD_MOVE_RESPONSE_NOT_HERE 1 +#define FIELD_MOVE_RESPONSE_NEED_BADGE 2 +#define FIELD_MOVE_RESPONSE_HAVE_FOLLOWER 3 +#define FIELD_MOVE_RESPONSE_ALREADY_SURFING 4 +#define FIELD_MOVE_RESPONSE_NOT_NOW 5 + +#endif // POKEDIAMOND_CONSTANTS_FIELD_MOVE_RESPONSE_H diff --git a/include/constants/sprites.h b/include/constants/sprites.h index 4260e230c..85c624ec1 100644 --- a/include/constants/sprites.h +++ b/include/constants/sprites.h @@ -1,6 +1,10 @@ #ifndef POKEDIAMOND_CONSTANTS_SPRITES_H #define POKEDIAMOND_CONSTANTS_SPRITES_H +#define SPRITE_ROCK 84 +#define SPRITE_BREAKROCK 85 +#define SPRITE_TREE 86 + #define SPRITE_CAMERA_FOCUS 8192 #endif // POKEDIAMOND_CONSTANTS_SPRITES_H diff --git a/include/constants/std_script.h b/include/constants/std_script.h new file mode 100644 index 000000000..01c1ae582 --- /dev/null +++ b/include/constants/std_script.h @@ -0,0 +1,6 @@ +#ifndef POKEDIAMOND_CONSTANTS_STD_SCRIPT_H +#define POKEDIAMOND_CONSTANTS_STD_SCRIPT_H + +#define std_menu_cut 10008 + +#endif // POKEDIAMOND_CONSTANTS_STD_SCRIPT_H diff --git a/include/constants/weather.h b/include/constants/weather.h index 2c4863423..d2fb31606 100644 --- a/include/constants/weather.h +++ b/include/constants/weather.h @@ -15,7 +15,7 @@ #define WEATHER_DIAMOND_DUST 11 #define WEATHER_UNKNOWN_12 12 // WEATHER_SPIRIT? #define WEATHER_UNKNOWN_13 13 // WEATHER_MYSTIC? -#define WEATHER_UNKNOWN_14 14 // WEATHER_MIST_1? +#define WEATHER_DEFOG 14 #define WEATHER_UNKNOWN_15 15 // WEATHER_MIST_2? #define WEATHER_FLASH 16 #define WEATHER_LIGHTNING 17 diff --git a/include/field_move.h b/include/field_move.h new file mode 100644 index 000000000..f41d2c90a --- /dev/null +++ b/include/field_move.h @@ -0,0 +1,78 @@ +#ifndef POKEDIAMOND_FIELD_MOVE_H +#define POKEDIAMOND_FIELD_MOVE_H + +#include "global.h" + +#include "field_system.h" +#include "task.h" + +typedef struct FieldMoveUseData { + TaskManager *taskManager; + u16 partySlot; + u16 fieldMoveIdx; +} FieldMoveUseData; + +typedef struct FieldMoveCheckData { + u32 mapId; + FieldSystem *fieldSystem; + LocalMapObject *facingObject; + u16 flag; +} FieldMoveCheckData; + +typedef void (*FieldMoveUseFunc)(struct FieldMoveUseData *useData, const struct FieldMoveCheckData *sub); +typedef u32 (*FieldMoveCheckFunc)(const struct FieldMoveCheckData *checkData); + +typedef enum FieldMoveFuncType { + FIELD_MOVE_FUNC_USE, + FIELD_MOVE_FUNC_CHECK +} FieldMoveFuncType; + +#define FIELD_MOVE_CHECK_TREE_F 0 +#define FIELD_MOVE_CHECK_UNK1_F 1 +#define FIELD_MOVE_CHECK_WATER_F 2 +#define FIELD_MOVE_CHECK_ROCK_F 3 +#define FIELD_MOVE_CHECK_DEFOG_F 4 +#define FIELD_MOVE_CHECK_BREAKROCK_F 5 +#define FIELD_MOVE_CHECK_WATERFALL_F 6 +#define FIELD_MOVE_CHECK_ROCKCLIMB_F 7 +#define FIELD_MOVE_CHECK_FLASH_F 8 +#define FIELD_MOVE_CHECK_UNK9_F 9 +#define FIELD_MOVE_CHECK_UNK10_F 10 +#define FIELD_MOVE_CHECK_UNK11_F 11 +#define FIELD_MOVE_CHECK_UNK12_F 12 +#define FIELD_MOVE_CHECK_WHIRLPOOL_F 13 +#define FIELD_MOVE_CHECK_HEADBUTT_F 14 + +typedef enum FieldMoveCheckFlags { + FIELD_MOVE_CHECK_TREE = (1 << FIELD_MOVE_CHECK_TREE_F), + FIELD_MOVE_CHECK_UNK1 = (1 << FIELD_MOVE_CHECK_UNK1_F), + FIELD_MOVE_CHECK_WATER = (1 << FIELD_MOVE_CHECK_WATER_F), + FIELD_MOVE_CHECK_ROCK = (1 << FIELD_MOVE_CHECK_ROCK_F), + FIELD_MOVE_CHECK_DEFOG = (1 << FIELD_MOVE_CHECK_DEFOG_F), + FIELD_MOVE_CHECK_BREAKROCK = (1 << FIELD_MOVE_CHECK_BREAKROCK_F), + FIELD_MOVE_CHECK_WATERFALL = (1 << FIELD_MOVE_CHECK_WATERFALL_F), + FIELD_MOVE_CHECK_ROCKCLIMB = (1 << FIELD_MOVE_CHECK_ROCKCLIMB_F), + FIELD_MOVE_CHECK_FLASH = (1 << FIELD_MOVE_CHECK_FLASH_F), + FIELD_MOVE_CHECK_UNK9 = (1 << FIELD_MOVE_CHECK_UNK9_F), + FIELD_MOVE_CHECK_UNK10 = (1 << FIELD_MOVE_CHECK_UNK10_F), + FIELD_MOVE_CHECK_UNK11 = (1 << FIELD_MOVE_CHECK_UNK11_F), + FIELD_MOVE_CHECK_UNK12 = (1 << FIELD_MOVE_CHECK_UNK12_F), + FIELD_MOVE_CHECK_WHIRLPOOL = (1 << FIELD_MOVE_CHECK_WHIRLPOOL_F), + FIELD_MOVE_CHECK_HEADBUTT = (1 << FIELD_MOVE_CHECK_HEADBUTT_F) +} FieldMoveCheckFlags; + +typedef struct FieldMoveFuncData { + FieldMoveUseFunc use; + FieldMoveCheckFunc check; +} FieldMoveFuncData; + +typedef struct FieldUseMoveEnvironment { + u32 magic; + LocalMapObject *facingObject; + FieldMoveUseData useData; +} FieldUseMoveEnvironment; + +void *FieldMove_GetMoveFunc(FieldMoveFuncType funcType, u16 fieldMoveIndex); +void FieldMove_InitCheckData(FieldSystem *fieldSystem, FieldMoveCheckData *checkData); + +#endif // POKEDIAMOND_FIELD_MOVE_H diff --git a/include/field_system.h b/include/field_system.h index d180a55ea..6400f74d7 100644 --- a/include/field_system.h +++ b/include/field_system.h @@ -37,7 +37,7 @@ typedef struct UnkStruct_02046444 { UnkStruct_020464D4 unk90[1]; // todo find size } UnkStruct_02046444; -typedef struct FieldSystem { +struct FieldSystem { u32 *unk00; UnkFieldStruct04 *unk04; BgConfig *bgConfig; @@ -52,16 +52,18 @@ typedef struct FieldSystem { PlayerAvatar *playerAvatar; u8 padding4[0x24]; u32 unk60; - u8 padding5[0x12]; + u8 padding5[0x8]; + u32 unk6C; + u8 padding6[0x6]; u16 unk76; u32 unk78; u32 unk7C; - u8 padding6[0x10]; + u8 padding7[0x10]; u32 unk90; - u8 padding7[0x4]; + u8 padding8[0x4]; u32 *unk98; - u8 padding8[0xC]; + u8 padding9[0xC]; UnkStruct_02046444 *unkA8; -} FieldSystem; +}; #endif // POKEDIAMOND_FIELD_SYSTEM_H diff --git a/include/field_types_def.h b/include/field_types_def.h index ce8944082..5ccd6bd5b 100644 --- a/include/field_types_def.h +++ b/include/field_types_def.h @@ -1,8 +1,10 @@ #ifndef POKEDIAMOND_FIELD_TYPES_DEF_H #define POKEDIAMOND_FIELD_TYPES_DEF_H +typedef struct FieldSystem FieldSystem; typedef struct LocalMapObject LocalMapObject; typedef struct MapObjectManager MapObjectManager; typedef struct ObjectEvent ObjectEvent; +typedef struct TaskManager TaskManager; #endif // POKEDIAMOND_FIELD_TYPES_DEF_H diff --git a/include/player_data.h b/include/player_data.h index b846015e4..02180f245 100644 --- a/include/player_data.h +++ b/include/player_data.h @@ -40,7 +40,7 @@ typedef struct PlayerData { u32 Save_PlayerData_sizeof(void); void Save_PlayerData_Init(PlayerData *data); -PlayerProfile *Save_PlayerData_GetProfileAddr(struct SaveData *save); +PlayerProfile *Save_PlayerData_GetProfile(struct SaveData *save); struct Options *Save_PlayerData_GetOptionsAddr(struct SaveData *save); u16 *Save_PlayerData_GetCoinsAddr(struct SaveData *save); struct IGT *Save_PlayerData_GetIGTAddr(struct SaveData *save); diff --git a/include/script.h b/include/script.h index fda0d9ba9..1631a0c7d 100644 --- a/include/script.h +++ b/include/script.h @@ -14,6 +14,7 @@ #include "save.h" #include "save_local_field_data.h" #include "task.h" +#include "unk_0205F7A0.h" struct ScriptContext; @@ -42,10 +43,6 @@ typedef struct FashionAppData { BOOL isContest; } FashionAppData; -typedef struct TownMapAppData { // todo fill out - u8 padding[0x140]; -} TownMapAppData; // todo move to own file - typedef struct ScrCmdUnkStruct01D9 { struct SaveData *save; u16 unk04; diff --git a/include/start_menu.h b/include/start_menu.h new file mode 100644 index 000000000..f870eabe9 --- /dev/null +++ b/include/start_menu.h @@ -0,0 +1,46 @@ +#ifndef POKEDIAMOND_START_MENU_H +#define POKEDIAMOND_START_MENU_H + +#include "task.h" + +typedef enum StartMenuState { + START_MENU_STATE_INIT, + START_MENU_STATE_INIT_FORCE_CURSOR, + START_MENU_STATE_2, + START_MENU_STATE_HANDLE_INPUT, + START_MENU_STATE_WAIT_FADE, + START_MENU_STATE_WAIT_APP, + START_MENU_STATE_SAVE, + START_MENU_STATE_7, + START_MENU_STATE_EVOLUTION, + START_MENU_STATE_WAIT_EVOLUTION, + START_MENU_STATE_10, + START_MENU_STATE_11, + START_MENU_STATE_12, + START_MENU_STATE_13, + START_MENU_STATE_14, + START_MENU_STATE_RETURN, + START_MENU_STATE_CLOSE, + START_MENU_STATE_RETURN_WAIT_FADE, + START_MENU_STATE_18, + START_MENU_STATE_19, + START_MENU_STATE_20, +} StartMenuState; + +// TODO: fill out +typedef struct StartMenuTaskData { + u8 filler0[0x2A]; + u16 state; + u8 filler1[0x19C]; + TaskFunc exitTaskFunc; + u8 filler2[0x2C]; + void *exitTaskEnvironment; + void *exitTaskEnvironment2; + u8 filler3[0x4]; +} StartMenuTaskData; + +typedef struct FieldMoveData { + u32 partySlot; +} FieldMoveData; + +#endif // POKEDIAMOND_START_MENU_H diff --git a/include/task.h b/include/task.h index 727ed0cef..d85dd4466 100644 --- a/include/task.h +++ b/include/task.h @@ -1,15 +1,11 @@ #ifndef POKEDIAMOND_TASK_H #define POKEDIAMOND_TASK_H -// #include "script.h" - dirty hack while FieldSystem is still in script.h +#include "field_types_def.h" #include "main.h" -typedef struct TaskManager TaskManager; - typedef BOOL (*TaskFunc)(TaskManager *taskManager); -struct FieldSystem; // FIXME: dirty hack - struct TaskManager { struct TaskManager *prev; TaskFunc func; @@ -17,30 +13,30 @@ struct TaskManager { void *env; struct TaskManager *unk10; void *unk14; - struct FieldSystem *fieldSystem; + FieldSystem *fieldSystem; u32 *unk1C; }; -extern void LoadOverlay_OVERLAY_05(void *); -extern void sub_020373D4(struct FieldSystem *, struct OverlayManagerTemplate *, void *); +extern void FieldSystem_LoadFieldOverlayInternal(FieldSystem *fieldSystem); +extern void sub_020373D4(FieldSystem *, struct OverlayManagerTemplate *, void *); extern BOOL sub_020373AC(void *); -extern BOOL sub_0203739C(struct FieldSystem *fieldSystem); -extern BOOL sub_020373C4(struct FieldSystem *fieldSystem); +extern BOOL sub_0203739C(FieldSystem *fieldSystem); +extern BOOL sub_020373C4(FieldSystem *fieldSystem); -struct TaskManager *Task_New(struct FieldSystem *fieldSystem, TaskFunc taskFunc, void *env); -void FieldSystem_CreateTask(struct FieldSystem *fieldSystem, TaskFunc taskFunc, void *env); +struct TaskManager *Task_New(FieldSystem *fieldSystem, TaskFunc taskFunc, void *env); +void FieldSystem_CreateTask(FieldSystem *fieldSystem, TaskFunc taskFunc, void *env); void TaskManager_Jump(struct TaskManager *taskManager, TaskFunc taskFunc, void *env); void TaskManager_Call(struct TaskManager *taskManager, TaskFunc taskFunc, void *env); BOOL sub_02046420(struct TaskManager *taskManager); BOOL sub_0204646C(struct TaskManager *taskManager); -BOOL FieldSystem_ApplicationIsRunning(struct FieldSystem *fieldSystem); -void sub_0204649C(void *r0); +BOOL FieldSystem_ApplicationIsRunning(FieldSystem *fieldSystem); +void FieldSystem_LoadFieldOverlay(FieldSystem *fieldSystem); BOOL sub_020464A4(void *r0); BOOL sub_020464B8(struct TaskManager *taskManager); void sub_02046500(struct TaskManager *taskManager, u32 r5, u32 r4); void *TaskManager_GetEnvironment(struct TaskManager *taskManager); u32 *TaskManager_GetStatePtr(struct TaskManager *taskManager); u32 sub_02046534(struct TaskManager *taskManager); -struct FieldSystem *TaskManager_GetFieldSystem(struct TaskManager *taskManager); +FieldSystem *TaskManager_GetFieldSystem(struct TaskManager *taskManager); #endif // POKEDIAMOND_TASK_H diff --git a/include/unk_0205EC84.h b/include/unk_0205EC84.h index 8792a2c20..01bbd825a 100644 --- a/include/unk_0205EC84.h +++ b/include/unk_0205EC84.h @@ -42,7 +42,7 @@ void Save_VarsFlags_ClearSafariSysFlag(struct SaveVarsFlags *state); BOOL Save_VarsFlags_CheckSafariSysFlag(struct SaveVarsFlags *state); void sub_0205F224(struct SaveVarsFlags *state); void sub_0205F234(struct SaveVarsFlags *state); -BOOL sub_0205F244(struct SaveVarsFlags *state); +BOOL Save_VarsFlags_CheckPalParkSysFlag(struct SaveVarsFlags *state); void sub_0205F254(struct SaveVarsFlags *state); BOOL sub_0205F264(struct SaveVarsFlags *state, u32 op); void sub_0205F274(struct SaveVarsFlags *state); diff --git a/include/unk_0205F7A0.h b/include/unk_0205F7A0.h new file mode 100644 index 000000000..b5cdd581e --- /dev/null +++ b/include/unk_0205F7A0.h @@ -0,0 +1,10 @@ +#ifndef POKEDIAMOND_UNK_0205F7A0_H +#define POKEDIAMOND_UNK_0205F7A0_H + +#include "global.h" + +typedef struct TownMapAppData { // todo fill out + u8 padding[0x140]; +} TownMapAppData; // todo move to own file + +#endif // POKEDIAMOND_UNK_0205F7A0_H From 0050aef1ee61268216fb4400e1dbb9a1df1107bc Mon Sep 17 00:00:00 2001 From: red031000 Date: Sun, 24 Nov 2024 13:24:17 +0200 Subject: [PATCH 2/2] a thing --- arm9/asm/field_move_s.s | 54 ---------------------------------- arm9/src/field_move.c | 47 ++++++++++++++++++++--------- include/constants/std_script.h | 1 + 3 files changed, 34 insertions(+), 68 deletions(-) diff --git a/arm9/asm/field_move_s.s b/arm9/asm/field_move_s.s index 84d5858e7..c0ab85c0d 100644 --- a/arm9/asm/field_move_s.s +++ b/arm9/asm/field_move_s.s @@ -6,60 +6,6 @@ .text - thumb_func_start sub_02063C70 -sub_02063C70: ; 0x02063C70 - push {r4-r6, lr} - add r5, r0, #0x0 - ldr r0, [r5, #0x0] - add r6, r1, #0x0 - bl TaskManager_GetEnvironment - add r4, r0, #0x0 - add r0, r5, #0x0 - add r1, r6, #0x0 - bl FieldMove_CreateUseEnvironment - add r5, r0, #0x0 - ldr r0, [r6, #0x4] - bl FieldSystem_LoadFieldOverlay - mov r0, #0x72 - ldr r1, _02063CA0 ; =sub_02063CA4 - lsl r0, r0, #0x2 - str r1, [r4, r0] - add r0, #0x30 - str r5, [r4, r0] - mov r0, #0xa - strh r0, [r4, #0x2a] - pop {r4-r6, pc} - .balign 4 -_02063CA0: .word sub_02063CA4 - - thumb_func_start sub_02063CA4 -sub_02063CA4: ; 0x02063CA4 - push {r3-r6, lr} - sub sp, #0x4 - add r5, r0, #0x0 - bl TaskManager_GetEnvironment - add r4, r0, #0x0 - add r0, r5, #0x0 - bl TaskManager_GetFieldSystem - add r6, r0, #0x0 - ldr r1, _02063CDC ; =0x0000271C - add r0, r5, #0x0 - mov r2, #0x0 - bl StartScriptFromMenu - mov r2, #0x0 - str r2, [sp, #0x0] - ldrh r1, [r4, #0xc] - add r0, r6, #0x0 - add r3, r2, #0x0 - bl FieldMove_SetArgs - add r0, r4, #0x0 - bl FieldMove_DeleteUseEnvironment - mov r0, #0x0 - add sp, #0x4 - pop {r3-r6, pc} - .balign 4 -_02063CDC: .word 0x0000271C - thumb_func_start sub_02063CE0 sub_02063CE0: ; 0x02063CE0 push {r4, lr} diff --git a/arm9/src/field_move.c b/arm9/src/field_move.c index 83cef23ff..712eed3b3 100644 --- a/arm9/src/field_move.c +++ b/arm9/src/field_move.c @@ -25,8 +25,9 @@ static BOOL Task_UseCutInField(TaskManager *taskManager); static u32 FieldMove_CheckFly(const FieldMoveCheckData *checkData); static void FieldMove_UseFly(FieldMoveUseData *useData, const FieldMoveCheckData *checkData); static u32 FieldMove_CheckSurf(const FieldMoveCheckData *checkData); +static void FieldMove_UseSurf(FieldMoveUseData *useData, const FieldMoveCheckData *checkData); +static BOOL Task_UseSurfInField(TaskManager *taskManager); -extern void sub_02063C70(FieldMoveUseData *useData, const FieldMoveCheckData *checkData); extern void sub_02063D18(FieldMoveUseData *useData, const FieldMoveCheckData *checkData); extern u32 sub_02063CE0(const FieldMoveCheckData *checkData); extern void sub_02063DC0(FieldMoveUseData *useData, const FieldMoveCheckData *checkData); @@ -67,19 +68,19 @@ extern void StartMenu_SetExitTaskFunc(StartMenuTaskData *startMenu, TaskFunc tas extern u32 PlayerAvatar_GetState(PlayerAvatar *avatar); static const FieldMoveFuncData sFieldMoveFuncTable[] = { - { FieldMove_UseCut, FieldMove_CheckCut }, - { FieldMove_UseFly, FieldMove_CheckFly }, - { sub_02063C70, FieldMove_CheckSurf }, - { sub_02063D18, sub_02063CE0 }, - { sub_02063DC0, sub_02063D88 }, - { sub_02063E68, sub_02063E30 }, - { sub_02063F10, sub_02063ED8 }, - { sub_02063FCC, sub_02063F80 }, - { sub_0206405C, sub_0206403C }, - { sub_02064134, sub_020640CC }, - { sub_020641F0, sub_020641AC }, - { sub_020642B4, sub_02064284 }, - { sub_02064324, sub_02064310 } + { FieldMove_UseCut, FieldMove_CheckCut }, + { FieldMove_UseFly, FieldMove_CheckFly }, + { FieldMove_UseSurf, FieldMove_CheckSurf }, + { sub_02063D18, sub_02063CE0 }, + { sub_02063DC0, sub_02063D88 }, + { sub_02063E68, sub_02063E30 }, + { sub_02063F10, sub_02063ED8 }, + { sub_02063FCC, sub_02063F80 }, + { sub_0206405C, sub_0206403C }, + { sub_02064134, sub_020640CC }, + { sub_020641F0, sub_020641AC }, + { sub_020642B4, sub_02064284 }, + { sub_02064324, sub_02064310 } }; static inline BOOL FieldMove_CheckSafariOrPalPark(const FieldMoveCheckData *checkData) { @@ -245,3 +246,21 @@ static u32 FieldMove_CheckSurf(const FieldMoveCheckData *checkData) { return FIELD_MOVE_RESPONSE_OK; } + +static void FieldMove_UseSurf(FieldMoveUseData *useData, const FieldMoveCheckData *checkData) { + StartMenuTaskData *startMenu = TaskManager_GetEnvironment(useData->taskManager); + FieldUseMoveEnvironment *useMoveEnvironment = FieldMove_CreateUseEnvironment(useData, checkData); + FieldSystem_LoadFieldOverlay(checkData->fieldSystem); + startMenu->exitTaskFunc = Task_UseSurfInField; + startMenu->exitTaskEnvironment = useMoveEnvironment; + startMenu->state = START_MENU_STATE_10; +} + +static BOOL Task_UseSurfInField(TaskManager *taskManager) { + FieldUseMoveEnvironment *useMoveEnvironment = TaskManager_GetEnvironment(taskManager); + FieldSystem *fieldSystem = TaskManager_GetFieldSystem(taskManager); + StartScriptFromMenu(taskManager, std_menu_surf, NULL); + FieldMove_SetArgs(fieldSystem, useMoveEnvironment->useData.partySlot, 0, 0, 0); + FieldMove_DeleteUseEnvironment(useMoveEnvironment); + return FALSE; +} diff --git a/include/constants/std_script.h b/include/constants/std_script.h index 01c1ae582..6380584d8 100644 --- a/include/constants/std_script.h +++ b/include/constants/std_script.h @@ -2,5 +2,6 @@ #define POKEDIAMOND_CONSTANTS_STD_SCRIPT_H #define std_menu_cut 10008 +#define std_menu_surf 10012 #endif // POKEDIAMOND_CONSTANTS_STD_SCRIPT_H