diff --git a/arm9/asm/map_object_s.s b/arm9/asm/map_object_s.s index 7d242ea41..309e21577 100644 --- a/arm9/asm/map_object_s.s +++ b/arm9/asm/map_object_s.s @@ -9,202 +9,13 @@ .extern MapObjectManager_ClearFlagsBits .extern MapObjectManager_GetFlagsBitsMask .extern MapObjectManager_GetObjects - .extern MapObjectManager_GetFieldSystem .extern MapObject_SetMovement .extern MapObject_GetEventFlag .extern sub_0205855C - .extern MapObject_GetManagerFromManager .extern sub_02058660 .text - thumb_func_start sub_0205866C -sub_0205866C: ; 0x0205866C - push {r4, lr} - add r4, r0, #0x0 - bl MapObject_GetMovement - bl sub_02058D14 - add r1, r0, #0x0 - ldr r1, [r1, #0x10] - add r0, r4, #0x0 - blx r1 - pop {r4, pc} - .balign 4 - - thumb_func_start sub_02058684 -sub_02058684: ; 0x02058684 - add r0, #0xc4 - str r1, [r0, #0x0] - bx lr - .balign 4 - - thumb_func_start sub_0205868C -sub_0205868C: ; 0x0205868C - push {r3, lr} - add r1, r0, #0x0 - add r1, #0xc4 - ldr r1, [r1, #0x0] - blx r1 - pop {r3, pc} - - thumb_func_start sub_02058698 -sub_02058698: ; 0x02058698 - add r0, #0xc8 - str r1, [r0, #0x0] - bx lr - .balign 4 - - thumb_func_start sub_020586A0 -sub_020586A0: ; 0x020586A0 - push {r3, lr} - add r1, r0, #0x0 - add r1, #0xc8 - ldr r1, [r1, #0x0] - blx r1 - pop {r3, pc} - - thumb_func_start sub_020586AC -sub_020586AC: ; 0x020586AC - add r0, #0xcc - str r1, [r0, #0x0] - bx lr - .balign 4 - - thumb_func_start sub_020586B4 -sub_020586B4: ; 0x020586B4 - push {r3, lr} - add r1, r0, #0x0 - add r1, #0xcc - ldr r1, [r1, #0x0] - blx r1 - pop {r3, pc} - - thumb_func_start sub_020586C0 -sub_020586C0: ; 0x020586C0 - add r0, #0xd0 - str r1, [r0, #0x0] - bx lr - .balign 4 - - thumb_func_start sub_020586C8 -sub_020586C8: ; 0x020586C8 - push {r3, lr} - add r1, r0, #0x0 - add r1, #0xd0 - ldr r1, [r1, #0x0] - blx r1 - pop {r3, pc} - - thumb_func_start sub_020586D4 -sub_020586D4: ; 0x020586D4 - add r0, #0xd4 - str r1, [r0, #0x0] - bx lr - .balign 4 - - thumb_func_start sub_020586DC -sub_020586DC: ; 0x020586DC - push {r3, lr} - add r1, r0, #0x0 - add r1, #0xd4 - ldr r1, [r1, #0x0] - blx r1 - pop {r3, pc} - - thumb_func_start sub_020586E8 -sub_020586E8: ; 0x020586E8 - add r0, #0xa4 - str r1, [r0, #0x0] - bx lr - .balign 4 - - thumb_func_start sub_020586F0 -sub_020586F0: ; 0x020586F0 - add r0, #0xa4 - ldr r0, [r0, #0x0] - bx lr - .balign 4 - - thumb_func_start sub_020586F8 -sub_020586F8: ; 0x020586F8 - add r0, #0xa8 - str r1, [r0, #0x0] - bx lr - .balign 4 - - thumb_func_start sub_02058700 -sub_02058700: ; 0x02058700 - add r1, r0, #0x0 - add r1, #0xa8 - ldr r1, [r1, #0x0] - add r0, #0xa8 - add r1, r1, #0x1 - str r1, [r0, #0x0] - bx lr - .balign 4 - - thumb_func_start sub_02058710 -sub_02058710: ; 0x02058710 - add r0, #0xa8 - ldr r0, [r0, #0x0] - bx lr - .balign 4 - - thumb_func_start sub_02058718 -sub_02058718: ; 0x02058718 - add r0, #0xac - strh r1, [r0, #0x0] - bx lr - .balign 4 - - thumb_func_start sub_02058720 -sub_02058720: ; 0x02058720 - add r0, #0xac - ldrh r0, [r0, #0x0] - bx lr - .balign 4 - - thumb_func_start sub_02058728 -sub_02058728: ; 0x02058728 - add r0, #0xae - strh r1, [r0, #0x0] - bx lr - .balign 4 - - thumb_func_start sub_02058730 -sub_02058730: ; 0x02058730 - add r0, #0xae - ldrh r0, [r0, #0x0] - bx lr - .balign 4 - - thumb_func_start MapObject_GetFieldSystem -MapObject_GetFieldSystem: ; 0x02058738 - push {r3, lr} - bl MapObject_GetManagerFromManager - bl MapObjectManager_GetFieldSystem - pop {r3, pc} - - thumb_func_start sub_02058744 -sub_02058744: ; 0x02058744 - push {r3, lr} - bl MapObject_GetManager - bl MapObjectManager_GetPriority - pop {r3, pc} - - thumb_func_start sub_02058750 -sub_02058750: ; 0x02058750 - push {r4, lr} - add r4, r0, #0x0 - bl MapObject_CheckFlag25 - cmp r0, #0x1 - beq _02058760 - bl GF_AssertFail -_02058760: - add r0, r4, #0x0 - bl MapObject_GetEventFlag - pop {r4, pc} - thumb_func_start sub_02058768 sub_02058768: ; 0x02058768 ldr r3, _02058770 ; =MapObjectManager_SetFlagsBits diff --git a/arm9/asm/unk_020557F4.s b/arm9/asm/unk_020557F4.s index ac5023d0a..33a9024cf 100644 --- a/arm9/asm/unk_020557F4.s +++ b/arm9/asm/unk_020557F4.s @@ -122,7 +122,7 @@ _020558B8: pop {r4-r6, pc} _020558C4: add r0, r6, #0x0 - bl sub_020586F0 + bl MapObject_GetMovementCommand bl sub_020570F0 cmp r0, #0x1 bne _020558FA @@ -213,7 +213,7 @@ sub_02055968: ; 0x02055968 lsl r0, r0, #0x18 lsr r5, r0, #0x18 add r0, r4, #0x0 - bl sub_020586F0 + bl MapObject_GetMovementCommand bl sub_0205B020 add r1, r0, #0x0 mov r0, #0x0 @@ -264,7 +264,7 @@ _020559D8: bl PlaySE _020559F8: add r0, r4, #0x0 - bl sub_020586F0 + bl MapObject_GetMovementCommand bl sub_020570F0 cmp r0, #0x0 bne _02055A20 @@ -329,7 +329,7 @@ _02055A76: pop {r3-r7, pc} _02055A8E: add r0, r7, #0x0 - bl sub_020586F0 + bl MapObject_GetMovementCommand bl sub_020570F0 cmp r0, #0x1 beq _02055B10 @@ -447,7 +447,7 @@ _02055B60: pop {r3-r5, pc} _02055B74: add r0, r4, #0x0 - bl sub_020586F0 + bl MapObject_GetMovementCommand bl sub_020570F0 cmp r0, #0x1 bne _02055B86 @@ -3123,7 +3123,7 @@ sub_020570C4: ; 0x020570C4 pop {r4, pc} _020570D8: add r0, r4, #0x0 - bl sub_020586F0 + bl MapObject_GetMovementCommand bl sub_020570F0 cmp r0, #0x1 bne _020570EA diff --git a/arm9/asm/unk_0205AD98.s b/arm9/asm/unk_0205AD98.s index ab66ef2d4..7f8820ba8 100644 --- a/arm9/asm/unk_0205AD98.s +++ b/arm9/asm/unk_0205AD98.s @@ -58,10 +58,10 @@ sub_0205ADDC: ; 0x0205ADDC _0205ADEA: add r0, r5, #0x0 add r1, r4, #0x0 - bl sub_020586E8 + bl MapObject_SetMovementCommand add r0, r5, #0x0 mov r1, #0x0 - bl sub_020586F8 + bl MapObject_SetMovementStep add r0, r5, #0x0 mov r1, #0x10 bl MapObject_SetFlagsBits @@ -74,10 +74,10 @@ _0205ADEA: sub_0205AE0C: ; 0x0205AE0C push {r4, lr} add r4, r0, #0x0 - bl sub_020586E8 + bl MapObject_SetMovementCommand add r0, r4, #0x0 mov r1, #0x0 - bl sub_020586F8 + bl MapObject_SetMovementStep add r0, r4, #0x0 mov r1, #0x20 bl MapObject_ClearFlagsBits @@ -144,10 +144,10 @@ MapObject_ClearHeldMovement: ; 0x0205AE80 bl MapObject_SetFlagsBits add r0, r4, #0x0 mov r1, #0xff - bl sub_020586E8 + bl MapObject_SetMovementCommand add r0, r4, #0x0 mov r1, #0x0 - bl sub_020586F8 + bl MapObject_SetMovementStep pop {r4, pc} thumb_func_start sub_0205AEA4 @@ -408,12 +408,12 @@ sub_0205B058: ; 0x0205B058 add r5, r0, #0x0 _0205B05C: add r0, r5, #0x0 - bl sub_020586F0 + bl MapObject_GetMovementCommand add r4, r0, #0x0 cmp r4, #0xff beq _0205B07C add r0, r5, #0x0 - bl sub_02058710 + bl MapObject_GetMovementStep add r2, r0, #0x0 add r0, r5, #0x0 add r1, r4, #0x0 @@ -442,10 +442,10 @@ _0205B098: bl MapObject_ClearFlagsBits add r0, r4, #0x0 mov r1, #0xff - bl sub_020586E8 + bl MapObject_SetMovementCommand add r0, r4, #0x0 mov r1, #0x0 - bl sub_020586F8 + bl MapObject_SetMovementStep mov r0, #0x1 pop {r4, pc} @@ -481,7 +481,7 @@ sub_0205B0D4: ; 0x0205B0D4 add r0, r4, #0x0 bl sub_02059C60 add r0, r4, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep pop {r4, pc} .balign 4 @@ -546,7 +546,7 @@ sub_0205B124: ; 0x0205B124 mov r1, #0x4 bl MapObject_SetFlagsBits add r0, r5, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep pop {r3-r7, pc} .balign 4 @@ -583,7 +583,7 @@ _0205B198: mov r1, #0x0 bl sub_02058544 add r0, r5, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep mov r0, #0x1 pop {r3-r5, pc} .balign 4 @@ -957,7 +957,7 @@ sub_0205B408: ; 0x0205B408 add r0, r5, #0x0 bl sub_02059C60 add r0, r5, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep pop {r3-r7, pc} thumb_func_start sub_0205B43C @@ -982,7 +982,7 @@ _0205B456: mov r1, #0x0 bl sub_02058544 add r0, r4, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep mov r0, #0x1 pop {r4, pc} @@ -1227,7 +1227,7 @@ _0205B5EA: add r0, r5, #0x0 bl sub_02058544 add r0, r5, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep ldr r0, _0205B618 ; =0x0000060B bl PlaySE pop {r3-r7, pc} @@ -1332,7 +1332,7 @@ _0205B6B8: mov r1, #0x0 bl sub_02058544 add r0, r5, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep ldr r0, _0205B700 ; =0x00000647 bl PlaySE mov r0, #0x1 @@ -1724,7 +1724,7 @@ sub_0205B99C: ; 0x0205B99C bl sub_020585DC str r4, [r0, #0x0] add r0, r5, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep pop {r3-r5, pc} .balign 4 @@ -1742,7 +1742,7 @@ sub_0205B9B4: ; 0x0205B9B4 pop {r4, pc} _0205B9CA: add r0, r4, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep mov r0, #0x1 pop {r4, pc} @@ -1815,7 +1815,7 @@ sub_0205BA28: ; 0x0205BA28 mov r1, #0x0 bl sub_02058544 add r0, r4, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep mov r0, #0x1 pop {r4, pc} .balign 4 @@ -1852,7 +1852,7 @@ sub_0205BA4C: ; 0x0205BA4C pop {r4-r5, pc} _0205BA88: add r0, r5, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep mov r0, #0x1 add sp, #0xc pop {r4-r5, pc} @@ -1872,7 +1872,7 @@ sub_0205BA94: ; 0x0205BA94 mov r1, #0x0 bl sub_02058544 add r0, r4, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep mov r0, #0x1 pop {r4, pc} nop @@ -1910,7 +1910,7 @@ _0205BADA: pop {r4-r5, pc} _0205BAFA: add r0, r5, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep mov r0, #0x1 add sp, #0xc pop {r4-r5, pc} @@ -1924,7 +1924,7 @@ sub_0205BB08: ; 0x0205BB08 lsl r1, r1, #0x8 bl MapObject_SetFlagsBits add r0, r4, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep mov r0, #0x1 pop {r4, pc} .balign 4 @@ -1937,7 +1937,7 @@ sub_0205BB20: ; 0x0205BB20 lsl r1, r1, #0x8 bl MapObject_ClearFlagsBits add r0, r4, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep mov r0, #0x1 pop {r4, pc} .balign 4 @@ -1949,7 +1949,7 @@ sub_0205BB38: ; 0x0205BB38 mov r1, #0x80 bl MapObject_SetFlagsBits add r0, r4, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep mov r0, #0x1 pop {r4, pc} @@ -1960,7 +1960,7 @@ sub_0205BB4C: ; 0x0205BB4C mov r1, #0x80 bl MapObject_ClearFlagsBits add r0, r4, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep mov r0, #0x1 pop {r4, pc} @@ -1972,7 +1972,7 @@ sub_0205BB60: ; 0x0205BB60 lsl r1, r1, #0x8 bl MapObject_SetFlagsBits add r0, r4, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep mov r0, #0x1 pop {r4, pc} .balign 4 @@ -1985,7 +1985,7 @@ sub_0205BB78: ; 0x0205BB78 lsl r1, r1, #0x8 bl MapObject_ClearFlagsBits add r0, r4, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep mov r0, #0x1 pop {r4, pc} .balign 4 @@ -2005,7 +2005,7 @@ sub_0205BB90: ; 0x0205BB90 bl ov05_021E7AC0 str r0, [r4, #0x4] add r0, r5, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep pop {r4-r6, pc} thumb_func_start sub_0205BBB4 @@ -2021,7 +2021,7 @@ sub_0205BBB4: ; 0x0205BBB4 ldr r0, [r4, #0x4] bl sub_02064520 add r0, r5, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep mov r0, #0x1 pop {r3-r5, pc} _0205BBD8: @@ -2069,7 +2069,7 @@ sub_0205BBF4: ; 0x0205BBF4 mov r1, #0x4 bl MapObject_SetFlagsBits add r0, r5, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep pop {r3-r7, pc} .balign 4 @@ -2113,7 +2113,7 @@ _0205BC6E: mov r1, #0x0 bl sub_02058544 add r0, r5, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep mov r0, #0x1 pop {r4-r6, pc} @@ -2292,7 +2292,7 @@ sub_0205BD9C: ; 0x0205BD9C mov r1, #0x9 bl sub_02058544 add r0, r4, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep mov r0, #0x0 pop {r4, pc} @@ -2313,7 +2313,7 @@ sub_0205BDB8: ; 0x0205BDB8 mov r1, #0x0 bl sub_02058544 add r0, r4, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep _0205BDE0: mov r0, #0x0 pop {r4, pc} @@ -2348,7 +2348,7 @@ _0205BDFE: lsl r1, r1, #0x14 bl MapObject_ClearFlagsBits add r0, r4, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep mov r0, #0x0 add sp, #0xc pop {r3-r4, pc} @@ -2395,7 +2395,7 @@ _0205BE70: add r0, r5, #0x0 bl sub_0205EB2C add r0, r5, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep mov r0, #0x1 add sp, #0xc pop {r4-r5, pc} @@ -2413,7 +2413,7 @@ sub_0205BEA0: ; 0x0205BEA0 mov r1, #0x0 bl sub_02058544 add r0, r4, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep mov r0, #0x0 pop {r4, pc} @@ -2427,7 +2427,7 @@ sub_0205BEBC: ; 0x0205BEBC mov r1, #0x1 bl sub_02058544 add r0, r4, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep mov r0, #0x0 pop {r4, pc} @@ -2445,6 +2445,6 @@ sub_0205BED8: ; 0x0205BED8 pop {r4, pc} _0205BEEE: add r0, r4, #0x0 - bl sub_02058700 + bl MapObject_IncrementMovementStep mov r0, #0x1 pop {r4, pc} diff --git a/arm9/global.inc b/arm9/global.inc index 84d2ce547..16908cfd3 100644 --- a/arm9/global.inc +++ b/arm9/global.inc @@ -4002,7 +4002,7 @@ .extern MapObjectManager_GetFirstActiveObjectByID .extern MapObjectManager_GetFirstActiveObjectWithMovement .extern MapObjectManager_GetNextObjectWithFlagFromIndex -.extern sub_0205829C +.extern MapObject_GetPriorityPlusValue .extern sub_020582A8 .extern sub_020582F8 .extern MapObjectManager_GetObjectCount @@ -4062,17 +4062,17 @@ .extern sub_0205864C .extern sub_020586A0 .extern sub_020586DC -.extern sub_020586E8 -.extern sub_020586F0 -.extern sub_020586F8 -.extern sub_02058700 -.extern sub_02058710 +.extern MapObject_SetMovementCommand +.extern MapObject_GetMovementCommand +.extern MapObject_SetMovementStep +.extern MapObject_IncrementMovementStep +.extern MapObject_GetMovementStep .extern sub_02058718 .extern sub_02058720 .extern sub_02058728 .extern sub_02058730 .extern MapObject_GetFieldSystem -.extern sub_02058744 +.extern MapObject_GetPriority .extern sub_02058750 .extern sub_02058768 .extern sub_02058774 diff --git a/arm9/overlays/05/asm/ov05_021E5E10.s b/arm9/overlays/05/asm/ov05_021E5E10.s index afaa6c90e..21078aa6c 100644 --- a/arm9/overlays/05/asm/ov05_021E5E10.s +++ b/arm9/overlays/05/asm/ov05_021E5E10.s @@ -126,7 +126,7 @@ _021E5EEA: _021E5EF4: add r0, r4, #0 mov r1, #2 - bl sub_0205829C + bl MapObject_GetPriorityPlusValue add r1, sp, #8 str r1, [sp] str r0, [sp, #4] diff --git a/arm9/overlays/05/asm/ov05_021E779C.s b/arm9/overlays/05/asm/ov05_021E779C.s index c443bddce..ac49fa9d2 100644 --- a/arm9/overlays/05/asm/ov05_021E779C.s +++ b/arm9/overlays/05/asm/ov05_021E779C.s @@ -466,7 +466,7 @@ ov05_021E7AC0: ; 0x021E7AC0 str r5, [sp, #0x20] bl MapObject_GetPositionVec add r0, r5, #0 - bl sub_02058744 + bl MapObject_GetPriority add r1, r0, #1 add r0, sp, #0x14 str r0, [sp] diff --git a/arm9/overlays/05/asm/ov05_021ED9C0.s b/arm9/overlays/05/asm/ov05_021ED9C0.s index ce28e3d37..1310f0abf 100644 --- a/arm9/overlays/05/asm/ov05_021ED9C0.s +++ b/arm9/overlays/05/asm/ov05_021ED9C0.s @@ -96,7 +96,7 @@ ov05_021EDA48: ; 0x021EDA48 add r0, r5, #0 mov r1, #2 str r5, [sp, #0x20] - bl sub_0205829C + bl MapObject_GetPriorityPlusValue add r1, sp, #0x14 str r1, [sp] str r0, [sp, #4] diff --git a/arm9/overlays/05/asm/ov05_021EDB70.s b/arm9/overlays/05/asm/ov05_021EDB70.s index 4bd86da4d..d4ab03df2 100644 --- a/arm9/overlays/05/asm/ov05_021EDB70.s +++ b/arm9/overlays/05/asm/ov05_021EDB70.s @@ -74,7 +74,7 @@ ov05_021EDBC8: ; 0x021EDBC8 add r0, r4, #0 mov r1, #2 str r5, [sp, #0x1c] - bl sub_0205829C + bl MapObject_GetPriorityPlusValue add r1, sp, #0x14 str r1, [sp] str r0, [sp, #4] diff --git a/arm9/overlays/05/asm/ov05_021F1F04.s b/arm9/overlays/05/asm/ov05_021F1F04.s index de6ebbdf2..eb8ae3b0a 100644 --- a/arm9/overlays/05/asm/ov05_021F1F04.s +++ b/arm9/overlays/05/asm/ov05_021F1F04.s @@ -3109,7 +3109,7 @@ _021F35EC: bne _021F367A add r0, r7, #0 mov r1, #2 - bl sub_0205829C + bl MapObject_GetPriorityPlusValue str r0, [sp, #0xc] add r0, r7, #0 mov r1, #1 diff --git a/arm9/overlays/05/src/ov05_021E72FC.c b/arm9/overlays/05/src/ov05_021E72FC.c index b67fec2ee..9a693335c 100644 --- a/arm9/overlays/05/src/ov05_021E72FC.c +++ b/arm9/overlays/05/src/ov05_021E72FC.c @@ -9,7 +9,6 @@ #include "unk_020051F4.h" extern LocalMapObject *PlayerAvatar_GetMapObject(u32 param0); -extern u32 sub_02058720(LocalMapObject *object); extern BOOL sub_02054B30(u8 param0); extern BOOL sub_02054B3C(u8 param0); extern BOOL sub_02054B48(u8 param0); diff --git a/arm9/overlays/06/asm/overlay_06.s b/arm9/overlays/06/asm/overlay_06.s index 1e631a223..97e2f4942 100644 --- a/arm9/overlays/06/asm/overlay_06.s +++ b/arm9/overlays/06/asm/overlay_06.s @@ -32666,7 +32666,7 @@ ov06_02249508: ; 0x02249508 bl MapObject_GetPositionVec add r0, r5, #0 mov r1, #2 - bl sub_0205829C + bl MapObject_GetPriorityPlusValue add r1, sp, #0x14 str r1, [sp] str r0, [sp, #4] @@ -32841,7 +32841,7 @@ ov06_02249668: ; 0x02249668 bl MapObject_GetPositionVec add r0, r5, #0 mov r1, #2 - bl sub_0205829C + bl MapObject_GetPriorityPlusValue add r1, sp, #0x14 str r1, [sp] str r0, [sp, #4] @@ -33042,7 +33042,7 @@ ov06_022497E8: ; 0x022497E8 bl MapObject_GetPositionVec add r0, r5, #0 mov r1, #2 - bl sub_0205829C + bl MapObject_GetPriorityPlusValue add r1, sp, #8 str r1, [sp] str r0, [sp, #4] @@ -33909,7 +33909,7 @@ ov06_02249E9C: ; 0x02249E9C str r0, [sp, #0x18] add r0, r5, #0 mov r1, #2 - bl sub_0205829C + bl MapObject_GetPriorityPlusValue add r7, r0, #0 add r0, r5, #0 bl ov05_021E4C24 @@ -34281,7 +34281,7 @@ _0224A160: mov r1, #2 str r4, [sp, #0x6c] str r5, [sp, #0xc4] - bl sub_0205829C + bl MapObject_GetPriorityPlusValue add r1, sp, #0x68 str r1, [sp] str r0, [sp, #4] @@ -34508,7 +34508,7 @@ ov06_0224A310: ; 0x0224A310 str r5, [sp, #0x1c] bl MapObject_GetPositionVec add r0, r5, #0 - bl sub_02058744 + bl MapObject_GetPriority add r1, r0, #1 add r0, sp, #0x14 str r0, [sp] @@ -34994,7 +34994,7 @@ ov06_0224A6B8: ; 0x0224A6B8 mov r1, #2 str r4, [sp, #0x14] str r5, [sp, #0x1c] - bl sub_0205829C + bl MapObject_GetPriorityPlusValue add r1, sp, #0x14 str r1, [sp] str r0, [sp, #4] @@ -35265,7 +35265,7 @@ ov06_0224A8D4: ; 0x0224A8D4 mov r1, #2 str r4, [sp, #0x14] str r5, [sp, #0x1c] - bl sub_0205829C + bl MapObject_GetPriorityPlusValue add r1, sp, #0x14 str r1, [sp] str r0, [sp, #4] @@ -35455,7 +35455,7 @@ ov06_0224AA40: ; 0x0224AA40 mov r1, #2 str r4, [sp, #0x14] str r5, [sp, #0x1c] - bl sub_0205829C + bl MapObject_GetPriorityPlusValue add r1, sp, #0x14 str r1, [sp] str r0, [sp, #4] @@ -35677,7 +35677,7 @@ _0224ABF6: _0224AC12: add r0, r5, #0 mov r1, #2 - bl sub_0205829C + bl MapObject_GetPriorityPlusValue add r1, sp, #0x20 str r1, [sp] str r0, [sp, #4] @@ -36112,7 +36112,7 @@ _0224AF3E: _0224AF46: add r0, r5, #0 mov r1, #2 - bl sub_0205829C + bl MapObject_GetPriorityPlusValue add r1, sp, #0x18 str r1, [sp] str r0, [sp, #4] @@ -36390,7 +36390,7 @@ ov06_0224B124: ; 0x0224B124 str r0, [sp, #0x14] add r0, r5, #0 mov r1, #2 - bl sub_0205829C + bl MapObject_GetPriorityPlusValue add r1, sp, #8 str r1, [sp] str r0, [sp, #4] @@ -36596,7 +36596,7 @@ ov06_0224B2C4: ; 0x0224B2C4 str r0, [sp, #0x14] add r0, r5, #0 mov r1, #2 - bl sub_0205829C + bl MapObject_GetPriorityPlusValue add r1, sp, #8 str r1, [sp] str r0, [sp, #4] @@ -36909,7 +36909,7 @@ ov06_0224B568: ; 0x0224B568 bl MapObject_GetPositionVec add r0, r5, #0 mov r1, #2 - bl sub_0205829C + bl MapObject_GetPriorityPlusValue add r1, sp, #8 str r1, [sp] str r0, [sp, #4] @@ -37479,7 +37479,7 @@ ov06_0224B9E0: ; 0x0224B9E0 add r0, r5, #0 mov r1, #2 str r5, [sp, #0x20] - bl sub_0205829C + bl MapObject_GetPriorityPlusValue add r1, sp, #0x14 str r1, [sp] str r0, [sp, #4] @@ -37741,7 +37741,7 @@ ov06_0224BBEC: ; 0x0224BBEC bl sub_02059E60 add r0, r5, #0 mov r1, #2 - bl sub_0205829C + bl MapObject_GetPriorityPlusValue add r1, sp, #0x14 str r1, [sp] str r0, [sp, #4] @@ -37947,7 +37947,7 @@ ov06_0224BD90: ; 0x0224BD90 bl MapObject_GetPositionVec add r0, r5, #0 mov r1, #2 - bl sub_0205829C + bl MapObject_GetPriorityPlusValue add r1, sp, #8 str r1, [sp] str r0, [sp, #4] @@ -38274,7 +38274,7 @@ ov06_0224C038: ; 0x0224C038 bl MapObject_GetPositionVec add r0, r5, #0 mov r1, #2 - bl sub_0205829C + bl MapObject_GetPriorityPlusValue add r1, sp, #8 str r1, [sp] str r0, [sp, #4] @@ -40141,7 +40141,7 @@ ov06_0224CECC: ; 0x0224CECC str r0, [sp, #0x1c] add r0, r5, #0 mov r1, #2 - bl sub_0205829C + bl MapObject_GetPriorityPlusValue add r1, sp, #0xc str r1, [sp] str r0, [sp, #4] @@ -40673,7 +40673,7 @@ ov06_0224D2E0: ; 0x0224D2E0 bl sub_02059E60 add r0, r5, #0 mov r1, #2 - bl sub_0205829C + bl MapObject_GetPriorityPlusValue add r1, sp, #0x14 str r1, [sp] str r0, [sp, #4] diff --git a/arm9/src/map_object.c b/arm9/src/map_object.c index fcdc70f2c..b7dd070d6 100644 --- a/arm9/src/map_object.c +++ b/arm9/src/map_object.c @@ -64,6 +64,15 @@ static void sub_02058630(LocalMapObject *object, LocalMapObject_UnkCallback call static void sub_02058644(LocalMapObject *object, LocalMapObject_UnkCallback callback); static void sub_02058658(LocalMapObject *object, LocalMapObject_UnkCallback callback); /*static*/ void sub_02058660(LocalMapObject *object); +static void sub_0205866C(LocalMapObject *object); +static void sub_02058684(LocalMapObject *object, LocalMapObject_UnkCallback callback); +static void sub_0205868C(LocalMapObject *object); +static void sub_02058698(LocalMapObject *object, LocalMapObject_UnkCallback callback); +static void sub_020586AC(LocalMapObject *object, LocalMapObject_UnkCallback callback); +static void sub_020586B4(LocalMapObject *object); +static void sub_020586C0(LocalMapObject *object, LocalMapObject_UnkCallback callback); +static void sub_020586C8(LocalMapObject *object); +static void sub_020586D4(LocalMapObject *object, LocalMapObject_UnkCallback callback); extern BOOL MapObject_IsInUse(LocalMapObject *object); extern void ov05_021F2AF4(MapObjectManager *manager, void *param0); @@ -89,22 +98,13 @@ extern ObjectEvent *ObjectEvent_GetById(u32 id, u32 objectEventCount, ObjectEven extern u8 FieldSystem_FlagCheck(FieldSystem *fieldSystem, u16 flag); extern BOOL sub_02058934(LocalMapObject *object); extern BOOL sub_020587E0(MapObjectManager *manager); -extern void sub_020586B4(LocalMapObject *object); extern MapObjectManager *MapObject_GetManagerFromManager(LocalMapObject *object); -extern FieldSystem *MapObject_GetFieldSystem(LocalMapObject *object); extern void FieldSystem_FlagSet(FieldSystem *fieldSystem, u16 flag); extern void sub_02058ED8(LocalMapObject *object); extern void sub_02058EDC(LocalMapObject *object); extern void sub_02058EE0(LocalMapObject *object); extern void sub_02058EE4(LocalMapObject *object); -extern void sub_02058684(LocalMapObject *object, LocalMapObject_UnkCallback callback); -extern void sub_02058698(LocalMapObject *object, LocalMapObject_UnkCallback callback); -extern void sub_020586AC(LocalMapObject *object, LocalMapObject_UnkCallback callback); -extern void sub_020586C0(LocalMapObject *object, LocalMapObject_UnkCallback callback); -extern void sub_020586D4(LocalMapObject *object, LocalMapObject_UnkCallback callback); -extern void sub_020586C8(LocalMapObject *object); extern BOOL MapObject_CheckFlag14(LocalMapObject *object); -extern void sub_020586DC(LocalMapObject *object); extern void sub_02057AEC(MapObjectManager *manager, LocalMapObject *object); extern u32 MapObject_GetInitialX(LocalMapObject *object); extern u32 MapObject_GetInitialHeight(LocalMapObject *object); @@ -124,14 +124,12 @@ extern void MapObject_SetCurrentHeight(LocalMapObject *object, u32 currentHeight extern void MapObject_SetCurrentY(LocalMapObject *object, u32 currentY); extern void MapObject_SetPositionVec(LocalMapObject *object, VecFx32 *coords); extern void MapObject_ClearHeldMovement(LocalMapObject *object); -extern void sub_0205866C(LocalMapObject *object); extern void MapObject_GetPositionVec(LocalMapObject *object, VecFx32 *position); extern void MapObject_SetPreviousX(LocalMapObject *object, u32 previousX); extern void MapObject_SetPreviousHeight(LocalMapObject *object, u32 previousHeight); extern void MapObject_SetPreviousY(LocalMapObject *object, u32 previousY); extern void MapObject_CreateFromInitArgs(MapObjectInitArgs *args); extern BOOL MapObject_CheckFlag25(LocalMapObject *object); -extern u32 sub_02058750(LocalMapObject *object); extern u16 ObjectEvent_GetSpriteID(ObjectEvent *objectEvent); extern u16 ObjectEvent_GetMovement(ObjectEvent *objectEvent); extern u16 ObjectEvent_GetType(ObjectEvent *objectEvent); @@ -150,22 +148,15 @@ extern LocalMapObject_UnkCallback sub_02058D30(UnkLMOCallbackStruct *callbackStr extern LocalMapObject_UnkCallback sub_02058D34(UnkLMOCallbackStruct *callbackStruct); extern UnkLMOCallbackStruct2 *sub_02058D4C(u32 spriteId); extern LocalMapObject_UnkCallback sub_02058D38(UnkLMOCallbackStruct2 *callbackStruct); -extern void sub_02058684(LocalMapObject *object, LocalMapObject_UnkCallback callback); extern LocalMapObject_UnkCallback sub_02058D3C(UnkLMOCallbackStruct2 *callbackStruct); -extern void sub_02058698(LocalMapObject *object, LocalMapObject_UnkCallback callback); extern LocalMapObject_UnkCallback sub_02058D40(UnkLMOCallbackStruct2 *callbackStruct); -extern void sub_020586AC(LocalMapObject *object, LocalMapObject_UnkCallback callback); extern LocalMapObject_UnkCallback sub_02058D44(UnkLMOCallbackStruct2 *callbackStruct); -extern void sub_020586C0(LocalMapObject *object, LocalMapObject_UnkCallback callback); extern LocalMapObject_UnkCallback sub_02058D48(UnkLMOCallbackStruct2 *callbackStruct); -extern void sub_020586D4(LocalMapObject *object, LocalMapObject_UnkCallback callback); extern u16 FieldSystem_VarGetObjectEventGraphicsId(FieldSystem *fieldSystem, u16 spriteId); extern u32 sub_02059D1C(LocalMapObject *object); extern void sub_02058EE8(LocalMapObject *object); extern void ov05_021F2E0C(LocalMapObject *object, BOOL set); -extern void sub_0205868C(LocalMapObject *object); extern void MapObject_SetFlag14(LocalMapObject *object); -extern void *sub_02058744(LocalMapObject *object); extern void sub_02058EF8(LocalMapObject *object); extern void ov05_021F1D8C(LocalMapObject *object); extern BOOL sub_0205C334(void); @@ -851,8 +842,8 @@ static void sub_02058258(LocalMapObject *object, u32 mapNo, ObjectEvent *objectE MapObject_SetMapID(object, mapNo); } -u32 sub_0205829C(LocalMapObject *object, u32 param1) { - return (u32)(sub_02058744(object) + param1); +u32 MapObject_GetPriorityPlusValue(LocalMapObject *object, u32 value) { + return (u32)((void *)MapObject_GetPriority(object) + value); // MUST be cast to void * to match } BOOL sub_020582A8(LocalMapObject *object, u32 objectId, u32 mapId) { @@ -1286,3 +1277,97 @@ static void sub_02058658(LocalMapObject *object, LocalMapObject_UnkCallback call /*static*/ void sub_02058660(LocalMapObject *object) { object->unkC0(object); } + +static void sub_0205866C(LocalMapObject *object) { + UnkLMOCallbackStruct *unk = sub_02058D14(MapObject_GetMovement(object)); + unk->unk10(object); +} + +static void sub_02058684(LocalMapObject *object, LocalMapObject_UnkCallback callback) { + object->unkC4 = callback; +} + +static void sub_0205868C(LocalMapObject *object) { + object->unkC4(object); +} + +static void sub_02058698(LocalMapObject *object, LocalMapObject_UnkCallback callback) { + object->unkC8 = callback; +} + +void sub_020586A0(LocalMapObject *object) { + object->unkC8(object); +} + +static void sub_020586AC(LocalMapObject *object, LocalMapObject_UnkCallback callback) { + object->unkCC = callback; +} + +static void sub_020586B4(LocalMapObject *object) { + object->unkCC(object); +} + +static void sub_020586C0(LocalMapObject *object, LocalMapObject_UnkCallback callback) { + object->unkD0 = callback; +} + +static void sub_020586C8(LocalMapObject *object) { + object->unkD0(object); +} + +static void sub_020586D4(LocalMapObject *object, LocalMapObject_UnkCallback callback) { + object->unkD4 = callback; +} + +void sub_020586DC(LocalMapObject *object) { + object->unkD4(object); +} + +void MapObject_SetMovementCommand(LocalMapObject *object, u32 command) { + object->movementCmd = command; +} + +u32 MapObject_GetMovementCommand(LocalMapObject *object) { + return object->movementCmd; +} + +void MapObject_SetMovementStep(LocalMapObject *object, u32 step) { + object->movementStep = step; +} + +void MapObject_IncrementMovementStep(LocalMapObject *object) { + object->movementStep++; +} + +u32 MapObject_GetMovementStep(LocalMapObject *object) { + return object->movementStep; +} + +void sub_02058718(LocalMapObject *object, u16 param1) { + object->unkAC = param1; +} + +u16 sub_02058720(LocalMapObject *object) { + return object->unkAC; +} + +void sub_02058728(LocalMapObject *object, u16 param1) { + object->unkAE = param1; +} + +u16 sub_02058730(LocalMapObject *object) { + return object->unkAE; +} + +FieldSystem *MapObject_GetFieldSystem(LocalMapObject *object) { + return MapObjectManager_GetFieldSystem(MapObject_GetManagerFromManager(object)); +} + +u32 MapObject_GetPriority(LocalMapObject *object) { + return MapObjectManager_GetPriority(MapObject_GetManager(object)); +} + +u32 sub_02058750(LocalMapObject *object) { + GF_ASSERT(MapObject_CheckFlag25(object) == TRUE); + return MapObject_GetEventFlag(object); +} diff --git a/include/map_object.h b/include/map_object.h index 53202c04b..8efd67dcf 100644 --- a/include/map_object.h +++ b/include/map_object.h @@ -72,13 +72,20 @@ struct LocalMapObject { s32 yRange; u8 padding[0x54]; u32 unkA0; - u8 padding2[0xC]; + u32 movementCmd; + u32 movementStep; + u16 unkAC; + u16 unkAE; SysTask *unkB0; MapObjectManager *manager; LocalMapObject_UnkCallback unkB8; LocalMapObject_UnkCallback unkBC; LocalMapObject_UnkCallback unkC0; - u8 padding3[0x14]; + LocalMapObject_UnkCallback unkC4; + LocalMapObject_UnkCallback unkC8; + LocalMapObject_UnkCallback unkCC; + LocalMapObject_UnkCallback unkD0; + LocalMapObject_UnkCallback unkD4; u8 unkD8[0x10]; u8 unkE8[0x10]; u8 unkF8[0x10]; @@ -173,7 +180,7 @@ void MapObject_CreateFromMultipleObjectEvents(MapObjectManager *manager, u32 map LocalMapObject *MapObjectManager_GetFirstActiveObjectByID(MapObjectManager *manager, u32 id); LocalMapObject *MapObjectManager_GetFirstActiveObjectWithMovement(MapObjectManager *manager, u32 movement); BOOL MapObjectManager_GetNextObjectWithFlagFromIndex(MapObjectManager *manager, LocalMapObject **objectDest, s32 *index, MapObjectFlagBits flag); -u32 sub_0205829C(LocalMapObject *object, u32 param1); +u32 MapObject_GetPriorityPlusValue(LocalMapObject *object, u32 value); BOOL sub_020582A8(LocalMapObject *object, u32 objectId, u32 mapId); BOOL sub_020582F8(LocalMapObject *object, u32 spriteId, u32 objectId, u32 mapId); u32 MapObjectManager_GetObjectCount(MapObjectManager *manager); @@ -232,5 +239,19 @@ u8 *sub_02058604(LocalMapObject *object, s32 size); u8 *sub_02058628(LocalMapObject *object); void sub_02058638(LocalMapObject *object); void sub_0205864C(LocalMapObject *object); +void sub_020586A0(LocalMapObject *object); +void sub_020586DC(LocalMapObject *object); +void MapObject_SetMovementCommand(LocalMapObject *object, u32 command); +u32 MapObject_GetMovementCommand(LocalMapObject *object); +void MapObject_SetMovementStep(LocalMapObject *object, u32 step); +void MapObject_IncrementMovementStep(LocalMapObject *object); +u32 MapObject_GetMovementStep(LocalMapObject *object); +void sub_02058718(LocalMapObject *object, u16 param1); +u16 sub_02058720(LocalMapObject *object); +void sub_02058728(LocalMapObject *object, u16 param1); +u16 sub_02058730(LocalMapObject *object); +FieldSystem *MapObject_GetFieldSystem(LocalMapObject *object); +u32 MapObject_GetPriority(LocalMapObject *object); +u32 sub_02058750(LocalMapObject *object); #endif // POKEDIAMOND_MAP_OBJECT_H