diff --git a/asm/include/overlay_01_021F1AFC.inc b/asm/include/overlay_01_021F1AFC.inc index 649195731..e5ee9cd81 100644 --- a/asm/include/overlay_01_021F1AFC.inc +++ b/asm/include/overlay_01_021F1AFC.inc @@ -54,7 +54,7 @@ .public sub_0205DFEC .public MapObject_Delete .public MapObject_GetID -.public sub_0205F254 +.public MapObject_GetMapID .public MapObject_GetSpriteID .public MapObject_GetFlagID .public MapObject_GetNextFacingDirection diff --git a/asm/include/overlay_01_021F8D80.inc b/asm/include/overlay_01_021F8D80.inc index e44b622d5..b281589eb 100644 --- a/asm/include/overlay_01_021F8D80.inc +++ b/asm/include/overlay_01_021F8D80.inc @@ -18,11 +18,11 @@ .public MapObjectManager_GetFlagsBitsMask .public MapObjectManager_GetPriority .public sub_0205F1A0 -.public FldObjSys_SetMModelNarc -.public FldObjSys_GetMModelNarc +.public MapObjectManager_SetMapModelNarc +.public MapObjectManager_GetMapModelNarc .public MapObject_SetFlagsBits .public MapObject_ClearFlagsBits -.public MapObject_GetFlagsBits +.public MapObject_GetFlagsBitsMask .public MapObject_TestFlagsBits .public MapObject_GetSpriteID .public MapObject_SetFacingDirection diff --git a/asm/include/overlay_01_021F944C.inc b/asm/include/overlay_01_021F944C.inc index 4bae14a41..0ff6e0716 100644 --- a/asm/include/overlay_01_021F944C.inc +++ b/asm/include/overlay_01_021F944C.inc @@ -52,10 +52,10 @@ .public sub_0205F1A0 .public MapObjectManager_GetObjects2 .public MapObjectArray_NextObject -.public FldObjSys_GetMModelNarc +.public MapObjectManager_GetMapModelNarc .public MapObject_SetFlagsBits .public MapObject_ClearFlagsBits -.public MapObject_GetFlagsBits +.public MapObject_GetFlagsBitsMask .public MapObject_TestFlagsBits .public MapObject_GetID .public MapObject_GetSpriteID diff --git a/asm/include/overlay_01_021FD1B8.inc b/asm/include/overlay_01_021FD1B8.inc index 7f073d0e7..d53c740f7 100644 --- a/asm/include/overlay_01_021FD1B8.inc +++ b/asm/include/overlay_01_021FD1B8.inc @@ -4,7 +4,7 @@ .public sub_0205F09C .public sub_0205F0A8 .public MapObject_GetID -.public sub_0205F254 +.public MapObject_GetMapID .public MapObject_GetSpriteID .public sub_0205F544 .public MapObject_CheckFlag25 diff --git a/asm/include/overlay_01_021FD41C.inc b/asm/include/overlay_01_021FD41C.inc index 4e46106c6..be4e0136b 100644 --- a/asm/include/overlay_01_021FD41C.inc +++ b/asm/include/overlay_01_021FD41C.inc @@ -8,7 +8,7 @@ .public MapObjectManager_GetPriority .public MapObject_TestFlagsBits .public MapObject_GetID -.public sub_0205F254 +.public MapObject_GetMapID .public MapObject_GetSpriteID .public MapObject_GetFacingDirection .public sub_0205F544 diff --git a/asm/include/overlay_01_021FDA14.inc b/asm/include/overlay_01_021FDA14.inc index 5c9455a71..74c7948ff 100644 --- a/asm/include/overlay_01_021FDA14.inc +++ b/asm/include/overlay_01_021FDA14.inc @@ -16,7 +16,7 @@ .public sub_0205F09C .public sub_0205F0A8 .public MapObject_GetID -.public sub_0205F254 +.public MapObject_GetMapID .public MapObject_GetSpriteID .public MapObject_GetFacingDirection .public MapObject_GetManager diff --git a/asm/include/overlay_01_021FE780.inc b/asm/include/overlay_01_021FE780.inc index 02ae7b3cb..7abc347a7 100644 --- a/asm/include/overlay_01_021FE780.inc +++ b/asm/include/overlay_01_021FE780.inc @@ -4,7 +4,7 @@ .public sub_0205F09C .public sub_0205F0A8 .public MapObject_GetID -.public sub_0205F254 +.public MapObject_GetMapID .public MapObject_GetFacingDirection .public MapObject_GetFieldSystem .public MapObject_GetPositionVec diff --git a/asm/include/overlay_01_021FEEEC.inc b/asm/include/overlay_01_021FEEEC.inc index e54b30439..e1fbfdc01 100644 --- a/asm/include/overlay_01_021FEEEC.inc +++ b/asm/include/overlay_01_021FEEEC.inc @@ -10,7 +10,7 @@ .public sub_0205F0F8 .public MapObject_TestFlagsBits .public MapObject_GetID -.public sub_0205F254 +.public MapObject_GetMapID .public MapObject_GetSpriteID .public MapObject_GetFacingDirection .public MapObject_GetCurrentX diff --git a/asm/include/overlay_01_021FF464.inc b/asm/include/overlay_01_021FF464.inc index 05b76fe2f..6c6984893 100644 --- a/asm/include/overlay_01_021FF464.inc +++ b/asm/include/overlay_01_021FF464.inc @@ -10,7 +10,7 @@ .public sub_0205F0F8 .public MapObject_TestFlagsBits .public MapObject_GetID -.public sub_0205F254 +.public MapObject_GetMapID .public MapObject_GetSpriteID .public MapObject_GetFieldSystem .public MapObject_CheckFlag26 diff --git a/asm/include/overlay_01_021FF6B0.inc b/asm/include/overlay_01_021FF6B0.inc index 9631369d0..0cc71b8f3 100644 --- a/asm/include/overlay_01_021FF6B0.inc +++ b/asm/include/overlay_01_021FF6B0.inc @@ -6,7 +6,7 @@ .public sub_02023F70 .public sub_0205F09C .public MapObject_GetID -.public sub_0205F254 +.public MapObject_GetMapID .public MapObject_GetFieldSystem .public MapObject_GetCurrentX .public MapObject_GetCurrentY diff --git a/asm/include/overlay_01_021FF854.inc b/asm/include/overlay_01_021FF854.inc index 59d915d9f..eb23878a6 100644 --- a/asm/include/overlay_01_021FF854.inc +++ b/asm/include/overlay_01_021FF854.inc @@ -10,7 +10,7 @@ .public sub_0205F0F8 .public MapObject_TestFlagsBits .public MapObject_GetID -.public sub_0205F254 +.public MapObject_GetMapID .public MapObject_GetSpriteID .public MapObject_GetFacingDirection .public MapObject_GetCurrentX diff --git a/asm/include/overlay_01_021FFC0C.inc b/asm/include/overlay_01_021FFC0C.inc index d5e589dbe..664e29f37 100644 --- a/asm/include/overlay_01_021FFC0C.inc +++ b/asm/include/overlay_01_021FFC0C.inc @@ -10,7 +10,7 @@ .public sub_0205F0F8 .public MapObject_TestFlagsBits .public MapObject_GetID -.public sub_0205F254 +.public MapObject_GetMapID .public MapObject_GetSpriteID .public MapObject_GetFacingDirection .public MapObject_GetCurrentX diff --git a/asm/include/overlay_01_02200040.inc b/asm/include/overlay_01_02200040.inc index d93080062..99fc79687 100644 --- a/asm/include/overlay_01_02200040.inc +++ b/asm/include/overlay_01_02200040.inc @@ -6,7 +6,7 @@ .public sub_02023F70 .public sub_0205F09C .public MapObject_GetID -.public sub_0205F254 +.public MapObject_GetMapID .public MapObject_GetFieldSystem .public MapObject_GetCurrentX .public MapObject_GetCurrentY diff --git a/asm/include/overlay_01_022001E4.inc b/asm/include/overlay_01_022001E4.inc index 9d564dc62..a3b3da0e1 100644 --- a/asm/include/overlay_01_022001E4.inc +++ b/asm/include/overlay_01_022001E4.inc @@ -8,7 +8,7 @@ .public GF_AssertFail .public sub_0205F0A8 .public MapObject_GetID -.public sub_0205F254 +.public MapObject_GetMapID .public sub_0205F538 .public MapObject_GetPositionVec .public MapObject_GetFacingVec diff --git a/asm/include/overlay_01_022006A8.inc b/asm/include/overlay_01_022006A8.inc index ad2d4fa1a..aeeb587b6 100644 --- a/asm/include/overlay_01_022006A8.inc +++ b/asm/include/overlay_01_022006A8.inc @@ -5,7 +5,7 @@ .public sub_0205F09C .public sub_0205F0A8 .public MapObject_GetID -.public sub_0205F254 +.public MapObject_GetMapID .public MapObject_GetFieldSystem .public MapObject_GetPositionVec .public MapObject_GetFacingVec diff --git a/asm/include/overlay_01_02200858.inc b/asm/include/overlay_01_02200858.inc index ba8e7d90c..cc09af276 100644 --- a/asm/include/overlay_01_02200858.inc +++ b/asm/include/overlay_01_02200858.inc @@ -10,7 +10,7 @@ .public sub_0205F09C .public sub_0205F0A8 .public MapObject_GetID -.public sub_0205F254 +.public MapObject_GetMapID .public sub_0205F504 .public MapObject_GetCurrentX .public MapObject_GetCurrentY diff --git a/asm/include/overlay_01_022031C0.inc b/asm/include/overlay_01_022031C0.inc index b1467021d..b1056458d 100644 --- a/asm/include/overlay_01_022031C0.inc +++ b/asm/include/overlay_01_022031C0.inc @@ -8,7 +8,7 @@ .public sub_0205F09C .public sub_0205F0F8 .public MapObject_GetID -.public sub_0205F254 +.public MapObject_GetMapID .public MapObject_GetSpriteID .public MapObject_GetFacingDirection .public sub_0205F484 diff --git a/asm/include/overlay_01_02203A18.inc b/asm/include/overlay_01_02203A18.inc index 824f798e8..a9a3aab2c 100644 --- a/asm/include/overlay_01_02203A18.inc +++ b/asm/include/overlay_01_02203A18.inc @@ -19,7 +19,7 @@ .public TaskManager_GetStatePtr .public sub_0205F0A8 .public MapObject_GetID -.public sub_0205F254 +.public MapObject_GetMapID .public sub_0205F538 .public MapObject_GetPositionVec .public MapObject_GetFacingVec diff --git a/asm/include/overlay_01_022053EC.inc b/asm/include/overlay_01_022053EC.inc index 3fe70f9f7..79855ad0e 100644 --- a/asm/include/overlay_01_022053EC.inc +++ b/asm/include/overlay_01_022053EC.inc @@ -36,7 +36,7 @@ .public PlayerAvatar_GetMapObject .public MapObject_Remove .public sub_0205F1A0 -.public FldObjSys_GetMModelNarc +.public MapObjectManager_GetMapModelNarc .public MapObject_GetID .public MapObject_GetSpriteID .public MapObject_SetFacingDirection diff --git a/asm/include/unk_0205FD20.inc b/asm/include/unk_0205FD20.inc index 02fc83727..5de456c60 100644 --- a/asm/include/unk_0205FD20.inc +++ b/asm/include/unk_0205FD20.inc @@ -32,10 +32,10 @@ .public MapObjectManager_GetObjectCount .public MapObjectManager_GetObjects2 .public MapObjectArray_NextObject -.public MapObject_GetFlagsWord +.public MapObject_GetFlags .public MapObject_SetFlagsBits .public MapObject_ClearFlagsBits -.public MapObject_GetFlagsBits +.public MapObject_GetFlagsBitsMask .public MapObject_TestFlagsBits .public MapObject_GetID .public MapObject_GetSpriteID diff --git a/asm/include/unk_02061284.inc b/asm/include/unk_02061284.inc index 2bbdf572d..994fa45e8 100644 --- a/asm/include/unk_02061284.inc +++ b/asm/include/unk_02061284.inc @@ -9,7 +9,7 @@ .public sub_0205DE98 .public MapObject_SetFlagsBits .public MapObject_ClearFlagsBits -.public MapObject_GetFlagsBits +.public MapObject_GetFlagsBitsMask .public MapObject_GetMovement .public MapObject_GetType .public MapObject_GetInitialFacingDirection diff --git a/asm/include/unk_020658D4.inc b/asm/include/unk_020658D4.inc index 50674ec30..98b468e6b 100644 --- a/asm/include/unk_020658D4.inc +++ b/asm/include/unk_020658D4.inc @@ -17,9 +17,9 @@ .public MapObjectManager_GetNextObjectWithFlagFromIndex .public MapObject_SetFlagsBits .public MapObject_ClearFlagsBits -.public MapObject_GetFlagsBits +.public MapObject_GetFlagsBitsMask .public MapObject_TestFlagsBits -.public sub_0205F254 +.public MapObject_GetMapID .public MapObject_GetType .public MapObject_GetFacingDirection .public sub_0205F328 diff --git a/asm/overlay_01_021F1AFC.s b/asm/overlay_01_021F1AFC.s index f5c46eb10..9c6f76f21 100644 --- a/asm/overlay_01_021F1AFC.s +++ b/asm/overlay_01_021F1AFC.s @@ -616,7 +616,7 @@ ov01_021F1F8C: ; 0x021F1F8C mov r6, #0 _021F1F96: add r0, r5, #0 - bl sub_0205F254 + bl MapObject_GetMapID ldrh r1, [r4] cmp r1, r0 bne _021F1FF4 diff --git a/asm/overlay_01_021F8D80.s b/asm/overlay_01_021F8D80.s index 85dcec49c..6222feb88 100644 --- a/asm/overlay_01_021F8D80.s +++ b/asm/overlay_01_021F8D80.s @@ -715,7 +715,7 @@ FldObjSys_OpenMModelNarc: ; 0x021F927C bl NARC_New add r1, r0, #0 add r0, r4, #0 - bl FldObjSys_SetMModelNarc + bl MapObjectManager_SetMapModelNarc pop {r4, pc} .balign 4, 0 thumb_func_end FldObjSys_OpenMModelNarc @@ -723,7 +723,7 @@ FldObjSys_OpenMModelNarc: ; 0x021F927C thumb_func_start FldObjSys_CloseMModelNarc FldObjSys_CloseMModelNarc: ; 0x021F9294 push {r3, lr} - bl FldObjSys_GetMModelNarc + bl MapObjectManager_GetMapModelNarc bl NARC_Delete pop {r3, pc} thumb_func_end FldObjSys_CloseMModelNarc @@ -740,7 +740,7 @@ ov01_021F92A0: ; 0x021F92A0 mov r1, #1 add r0, r4, #0 lsl r1, r1, #0xe - bl MapObject_GetFlagsBits + bl MapObject_GetFlagsBitsMask cmp r0, #0 beq _021F92DA add r0, r4, #0 @@ -840,7 +840,7 @@ _021F935E: mov r1, #1 add r0, r4, #0 lsl r1, r1, #8 - bl MapObject_GetFlagsBits + bl MapObject_GetFlagsBitsMask cmp r0, #0 beq _021F9370 mov r0, #1 @@ -855,7 +855,7 @@ ReadMModelFromNarcInternal: ; 0x021F9374 push {r4, r5, r6, lr} add r4, r1, #0 add r5, r2, #0 - bl FldObjSys_GetMModelNarc + bl MapObjectManager_GetMapModelNarc add r1, r4, #0 add r6, r0, #0 bl NARC_GetMemberSize diff --git a/asm/overlay_01_021F944C.s b/asm/overlay_01_021F944C.s index a13abe4f3..69093b2ce 100644 --- a/asm/overlay_01_021F944C.s +++ b/asm/overlay_01_021F944C.s @@ -642,7 +642,7 @@ _021F98F8: mov r0, #0x41 lsl r0, r0, #2 ldr r0, [r5, r0] - bl FldObjSys_GetMModelNarc + bl MapObjectManager_GetMapModelNarc add r2, r0, #0 mov r0, #0 str r0, [sp] @@ -2095,7 +2095,7 @@ ov01_021FA2D4: ; 0x021FA2D4 push {r3, lr} mov r1, #1 lsl r1, r1, #0x16 - bl MapObject_GetFlagsBits + bl MapObject_GetFlagsBitsMask cmp r0, #0 beq _021FA2E6 mov r0, #1 diff --git a/asm/overlay_01_021FD1B8.s b/asm/overlay_01_021FD1B8.s index f84194d2c..59cd72f73 100644 --- a/asm/overlay_01_021FD1B8.s +++ b/asm/overlay_01_021FD1B8.s @@ -254,7 +254,7 @@ ov01_021FD328: ; 0x021FD328 bl sub_0205F544 b _021FD368 _021FD364: - bl sub_0205F254 + bl MapObject_GetMapID _021FD368: str r0, [r4, #8] add r4, #0xc diff --git a/asm/overlay_01_021FD41C.s b/asm/overlay_01_021FD41C.s index 56b62c6e4..0132e8014 100644 --- a/asm/overlay_01_021FD41C.s +++ b/asm/overlay_01_021FD41C.s @@ -410,7 +410,7 @@ ov01_021FD6C8: ; 0x021FD6C8 bl sub_0205F544 b _021FD70E _021FD70A: - bl sub_0205F254 + bl MapObject_GetMapID _021FD70E: str r0, [r4, #8] mov r0, #1 @@ -506,7 +506,7 @@ ov01_021FD784: ; 0x021FD784 bl sub_0205F544 b _021FD7CA _021FD7C6: - bl sub_0205F254 + bl MapObject_GetMapID _021FD7CA: str r0, [r4, #8] mov r0, #1 diff --git a/asm/overlay_01_021FDA14.s b/asm/overlay_01_021FDA14.s index accd5c2c0..a1ab2ba67 100644 --- a/asm/overlay_01_021FDA14.s +++ b/asm/overlay_01_021FDA14.s @@ -126,7 +126,7 @@ ov01_021FDAC0: ; 0x021FDAC0 bl MapObject_GetID str r0, [r4] ldr r0, [r4, #0x20] - bl sub_0205F254 + bl MapObject_GetMapID str r0, [r4, #4] ldr r0, [r4, #0x20] bl MapObject_GetSpriteID @@ -776,7 +776,7 @@ ov01_021FDFD4: ; 0x021FDFD4 bl MapObject_GetID str r0, [r4] ldr r0, [r4, #0x20] - bl sub_0205F254 + bl MapObject_GetMapID str r0, [r4, #4] ldr r0, [r4, #0x20] bl MapObject_GetSpriteID diff --git a/asm/overlay_01_021FE780.s b/asm/overlay_01_021FE780.s index 546066e2f..d7bc301a3 100644 --- a/asm/overlay_01_021FE780.s +++ b/asm/overlay_01_021FE780.s @@ -155,7 +155,7 @@ ov01_021FE868: ; 0x021FE868 bl MapObject_GetID str r0, [r5, #0xc] add r0, r4, #0 - bl sub_0205F254 + bl MapObject_GetMapID str r0, [r5, #0x10] ldr r0, [r7] str r0, [r5, #8] diff --git a/asm/overlay_01_021FEEEC.s b/asm/overlay_01_021FEEEC.s index 1ffcee4f8..247a3793a 100644 --- a/asm/overlay_01_021FEEEC.s +++ b/asm/overlay_01_021FEEEC.s @@ -335,7 +335,7 @@ _021FF188: bl MapObject_GetID str r0, [r4, #8] ldr r0, [r4, #0x30] - bl sub_0205F254 + bl MapObject_GetMapID str r0, [r4, #0xc] ldr r0, [r4, #0x18] lsl r0, r0, #0x10 diff --git a/asm/overlay_01_021FF464.s b/asm/overlay_01_021FF464.s index bb1175bdc..1ead72813 100644 --- a/asm/overlay_01_021FF464.s +++ b/asm/overlay_01_021FF464.s @@ -159,7 +159,7 @@ ov01_021FF54C: ; 0x021FF54C bl MapObject_GetID str r0, [r4, #8] ldr r0, [r4, #0x20] - bl sub_0205F254 + bl MapObject_GetMapID str r0, [r4, #0xc] add r0, r5, #0 add r1, sp, #0 diff --git a/asm/overlay_01_021FF6B0.s b/asm/overlay_01_021FF6B0.s index 5078bd648..57d0841d7 100644 --- a/asm/overlay_01_021FF6B0.s +++ b/asm/overlay_01_021FF6B0.s @@ -158,7 +158,7 @@ ov01_021FF7B0: ; 0x021FF7B0 bl MapObject_GetID str r0, [r4, #4] ldr r0, [r4, #0x1c] - bl sub_0205F254 + bl MapObject_GetMapID str r0, [r4, #8] add r0, r5, #0 add r1, sp, #0 diff --git a/asm/overlay_01_021FF854.s b/asm/overlay_01_021FF854.s index 1320b7a92..2ae35e53c 100644 --- a/asm/overlay_01_021FF854.s +++ b/asm/overlay_01_021FF854.s @@ -241,7 +241,7 @@ _021FFA08: bl MapObject_GetID str r0, [r4, #8] ldr r0, [r4, #0x30] - bl sub_0205F254 + bl MapObject_GetMapID str r0, [r4, #0xc] ldr r0, [r4, #0x18] lsl r0, r0, #0x10 diff --git a/asm/overlay_01_021FFC0C.s b/asm/overlay_01_021FFC0C.s index 65265eb6b..540a82ecf 100644 --- a/asm/overlay_01_021FFC0C.s +++ b/asm/overlay_01_021FFC0C.s @@ -120,7 +120,7 @@ _021FFCBC: bl MapObject_GetID str r0, [r4, #8] ldr r0, [r4, #0x30] - bl sub_0205F254 + bl MapObject_GetMapID str r0, [r4, #0xc] ldr r0, [r4, #0x18] lsl r0, r0, #0x10 diff --git a/asm/overlay_01_02200040.s b/asm/overlay_01_02200040.s index 183a9f5f7..0bbde9bc6 100644 --- a/asm/overlay_01_02200040.s +++ b/asm/overlay_01_02200040.s @@ -158,7 +158,7 @@ ov01_02200140: ; 0x02200140 bl MapObject_GetID str r0, [r4, #4] ldr r0, [r4, #0x1c] - bl sub_0205F254 + bl MapObject_GetMapID str r0, [r4, #8] add r0, r5, #0 add r1, sp, #0 diff --git a/asm/overlay_01_022001E4.s b/asm/overlay_01_022001E4.s index 53a77649e..27f6edc60 100644 --- a/asm/overlay_01_022001E4.s +++ b/asm/overlay_01_022001E4.s @@ -568,7 +568,7 @@ ov01_0220059C: ; 0x0220059C bl MapObject_GetID str r0, [r4, #8] ldr r0, [r4, #0x3c] - bl sub_0205F254 + bl MapObject_GetMapID str r0, [r4, #0xc] mov r0, #6 lsl r0, r0, #0xc diff --git a/asm/overlay_01_022006A8.s b/asm/overlay_01_022006A8.s index 6d5d19f3b..b7eac0ca4 100644 --- a/asm/overlay_01_022006A8.s +++ b/asm/overlay_01_022006A8.s @@ -148,7 +148,7 @@ ov01_02200780: ; 0x02200780 bl MapObject_GetID str r0, [r4, #4] ldr r0, [r4, #0x1c] - bl sub_0205F254 + bl MapObject_GetMapID str r0, [r4, #8] add r0, r5, #0 add r1, sp, #0 diff --git a/asm/overlay_01_02200858.s b/asm/overlay_01_02200858.s index 982b3f30d..0cdae19b9 100644 --- a/asm/overlay_01_02200858.s +++ b/asm/overlay_01_02200858.s @@ -127,7 +127,7 @@ ov01_02200900: ; 0x02200900 bl MapObject_GetID str r0, [r5, #0x14] add r0, r4, #0 - bl sub_0205F254 + bl MapObject_GetMapID str r0, [r5, #0x18] mov r0, #1 pop {r3, r4, r5, pc} diff --git a/asm/overlay_01_022031C0.s b/asm/overlay_01_022031C0.s index 595af12b8..32f0834dd 100644 --- a/asm/overlay_01_022031C0.s +++ b/asm/overlay_01_022031C0.s @@ -239,7 +239,7 @@ _02203374: bl MapObject_GetID str r0, [r4, #8] ldr r0, [r4, #0x30] - bl sub_0205F254 + bl MapObject_GetMapID add r6, r4, #0 add r3, sp, #0 add r6, #0x18 @@ -557,7 +557,7 @@ _022035F4: bl MapObject_GetID str r0, [r4, #8] ldr r0, [r4, #0x30] - bl sub_0205F254 + bl MapObject_GetMapID add r6, r4, #0 add r3, sp, #0 add r6, #0x18 @@ -833,7 +833,7 @@ _02203838: bl MapObject_GetID str r0, [r4, #8] ldr r0, [r4, #0x30] - bl sub_0205F254 + bl MapObject_GetMapID add r6, r4, #0 add r3, sp, #0 add r6, #0x18 diff --git a/asm/overlay_01_02203A18.s b/asm/overlay_01_02203A18.s index ce9b2b729..4db0cbc01 100644 --- a/asm/overlay_01_02203A18.s +++ b/asm/overlay_01_02203A18.s @@ -242,7 +242,7 @@ ov01_02203BB4: ; 0x02203BB4 bl MapObject_GetID str r0, [r4, #8] ldr r0, [r4, #0x38] - bl sub_0205F254 + bl MapObject_GetMapID str r0, [r4, #0xc] mov r0, #6 lsl r0, r0, #0xc diff --git a/asm/overlay_01_022053EC.s b/asm/overlay_01_022053EC.s index 4209437ed..031301bdc 100644 --- a/asm/overlay_01_022053EC.s +++ b/asm/overlay_01_022053EC.s @@ -699,7 +699,7 @@ ov01_0220589C: ; 0x0220589C add r7, r0, #0 add r0, r6, #0 bl MapObject_GetManager - bl FldObjSys_GetMModelNarc + bl MapObjectManager_GetMapModelNarc add r1, r7, #0 mov r2, #0xb bl NARC_AllocAndReadWholeMember @@ -1362,7 +1362,7 @@ _02205E12: bl ov01_02206088 add r7, r0, #0 ldr r0, [r5, #0x3c] - bl FldObjSys_GetMModelNarc + bl MapObjectManager_GetMapModelNarc add r1, r7, #0 mov r2, #0xb bl NARC_AllocAndReadWholeMember @@ -1756,7 +1756,7 @@ _02206142: bl ov01_02206088 add r7, r0, #0 ldr r0, [r6, #0x3c] - bl FldObjSys_GetMModelNarc + bl MapObjectManager_GetMapModelNarc add r1, r7, #0 mov r2, #0xb bl NARC_AllocAndReadWholeMember diff --git a/asm/unk_0205FD20.s b/asm/unk_0205FD20.s index 4d10fa44e..36f39bac6 100644 --- a/asm/unk_0205FD20.s +++ b/asm/unk_0205FD20.s @@ -40,7 +40,7 @@ sub_0205FD30: ; 0x0205FD30 bl sub_0205FE48 add r0, r4, #0 mov r1, #0x10 - bl MapObject_GetFlagsBits + bl MapObject_GetFlagsBitsMask cmp r0, #0 beq _0205FD64 add r0, r4, #0 @@ -84,7 +84,7 @@ _0205FDA8: mov r1, #6 add r0, r4, #0 lsl r1, r1, #0xa - bl MapObject_GetFlagsBits + bl MapObject_GetFlagsBitsMask cmp r0, #0 bne _0205FDBA mov r0, #1 @@ -105,7 +105,7 @@ _0205FDC8: pop {r4, pc} _0205FDD6: add r0, r4, #0 - bl MapObject_GetFlagsWord + bl MapObject_GetFlags mov r1, #1 lsl r1, r1, #0xc add r2, r0, #0 @@ -139,7 +139,7 @@ sub_0205FE0C: ; 0x0205FE0C mov r1, #1 lsl r1, r1, #0xc add r4, r0, #0 - bl MapObject_GetFlagsBits + bl MapObject_GetFlagsBitsMask cmp r0, #0 beq _0205FE22 add r0, r4, #0 @@ -154,7 +154,7 @@ sub_0205FE24: ; 0x0205FE24 mov r1, #2 lsl r1, r1, #0xa add r4, r0, #0 - bl MapObject_GetFlagsBits + bl MapObject_GetFlagsBitsMask cmp r0, #0 beq _0205FE44 add r0, r4, #0 @@ -173,7 +173,7 @@ sub_0205FE48: ; 0x0205FE48 push {r4, lr} mov r1, #4 add r4, r0, #0 - bl MapObject_GetFlagsBits + bl MapObject_GetFlagsBitsMask cmp r0, #0 beq _0205FE5C add r0, r4, #0 @@ -193,7 +193,7 @@ sub_0205FE6C: ; 0x0205FE6C mov r1, #1 lsl r1, r1, #0x10 add r4, r0, #0 - bl MapObject_GetFlagsBits + bl MapObject_GetFlagsBitsMask cmp r0, #0 beq _0205FE84 add r0, r4, #0 @@ -202,7 +202,7 @@ sub_0205FE6C: ; 0x0205FE6C _0205FE84: add r0, r4, #0 mov r1, #4 - bl MapObject_GetFlagsBits + bl MapObject_GetFlagsBitsMask cmp r0, #0 beq _0205FE96 add r0, r4, #0 @@ -222,7 +222,7 @@ sub_0205FEA4: ; 0x0205FEA4 mov r1, #2 lsl r1, r1, #0x10 add r4, r0, #0 - bl MapObject_GetFlagsBits + bl MapObject_GetFlagsBitsMask cmp r0, #0 beq _0205FEBC add r0, r4, #0 @@ -231,7 +231,7 @@ sub_0205FEA4: ; 0x0205FEA4 _0205FEBC: add r0, r4, #0 mov r1, #8 - bl MapObject_GetFlagsBits + bl MapObject_GetFlagsBitsMask cmp r0, #0 beq _0205FECE add r0, r4, #0 @@ -929,7 +929,7 @@ _02060490: mov r1, #2 add r0, r5, #0 lsl r1, r1, #0xe - bl MapObject_GetFlagsBits + bl MapObject_GetFlagsBitsMask cmp r0, #0 bne _0206052E add r0, r5, #0 @@ -984,7 +984,7 @@ _02060510: mov r1, #2 add r0, r5, #0 lsl r1, r1, #0xe - bl MapObject_GetFlagsBits + bl MapObject_GetFlagsBitsMask cmp r0, #0 bne _0206052E add r0, r5, #0 @@ -1876,13 +1876,13 @@ _02060C1C: cmp r0, r1 beq _02060C94 mov r1, #1 - bl MapObject_GetFlagsBits + bl MapObject_GetFlagsBitsMask cmp r0, #0 beq _02060C94 mov r1, #1 ldr r0, [sp, #8] lsl r1, r1, #0x12 - bl MapObject_GetFlagsBits + bl MapObject_GetFlagsBitsMask cmp r0, #0 bne _02060C94 ldr r0, [sp, #8] @@ -1959,7 +1959,7 @@ _02060CC8: cmp r0, r1 beq _02060D84 mov r1, #1 - bl MapObject_GetFlagsBits + bl MapObject_GetFlagsBitsMask cmp r0, #0 beq _02060D84 ldr r0, [sp, #4] diff --git a/asm/unk_02061284.s b/asm/unk_02061284.s index f982e13f8..195918fff 100644 --- a/asm/unk_02061284.s +++ b/asm/unk_02061284.s @@ -2055,7 +2055,7 @@ _020620AE: ldr r4, [r1, r0] add r0, r7, #0 mov r1, #0x80 - bl MapObject_GetFlagsBits + bl MapObject_GetFlagsBitsMask cmp r0, #0 beq _020620DC mov r0, #1 diff --git a/asm/unk_020658D4.s b/asm/unk_020658D4.s index fad777c4b..814673121 100644 --- a/asm/unk_020658D4.s +++ b/asm/unk_020658D4.s @@ -1050,7 +1050,7 @@ sub_020660C0: ; 0x020660C0 bl MapObject_GetType str r0, [sp] add r0, r4, #0 - bl sub_0205F254 + bl MapObject_GetMapID add r6, r0, #0 add r0, r4, #0 bl sub_02064518 @@ -1088,7 +1088,7 @@ _0206611A: ldr r0, [sp, #4] cmp r4, r0 beq _02066138 - bl sub_0205F254 + bl MapObject_GetMapID cmp r6, r0 bne _02066138 ldr r0, [sp, #4] @@ -1124,7 +1124,7 @@ sub_02066150: ; 0x02066150 mov r0, #0 str r0, [sp, #8] add r0, r5, #0 - bl sub_0205F254 + bl MapObject_GetMapID add r7, r0, #0 add r0, r5, #0 bl sub_02064518 @@ -1140,7 +1140,7 @@ _02066182: ldr r0, [sp, #4] cmp r5, r0 beq _020661B2 - bl sub_0205F254 + bl MapObject_GetMapID cmp r7, r0 bne _020661B2 ldr r0, [sp, #4] @@ -1222,7 +1222,7 @@ _0206621A: mov r1, #0x61 add r0, r5, #0 lsl r1, r1, #6 - bl MapObject_GetFlagsBits + bl MapObject_GetFlagsBitsMask cmp r0, #0 bne _02066236 _02066232: diff --git a/include/map_object.h b/include/map_object.h index 5e5431788..1ef7861af 100644 --- a/include/map_object.h +++ b/include/map_object.h @@ -13,7 +13,7 @@ typedef struct SavedMapObject { s8 initialFacing; s8 currentFacing; s8 nextFacing; - u16 unk10; + u16 mapId; u16 spriteId; u16 type; u16 flagId; @@ -36,7 +36,7 @@ struct MapObjectManager { // declared field_system.h u32 unk8; u32 priority; u8 unk10[4]; - NARC *mmodel_narc; + NARC *mapModelNarc; u32 unk18; u8 unk1C[0x108]; LocalMapObject *objects; @@ -48,8 +48,8 @@ typedef void (*LocalMapObject_UnkCallback)(LocalMapObject *object); struct LocalMapObject { // declared field_system.h /*0x000*/ u32 flags; /*0x004*/ u32 flags2; - /*0x008*/ int id; - /*0x00C*/ int unkC; // some kind of flag ID + /*0x008*/ u32 id; + /*0x00C*/ u32 mapId; /*0x010*/ int spriteId; /*0x014*/ int movement; /*0x018*/ int type; @@ -163,7 +163,7 @@ typedef struct MapObjectInitArgs { // FIXME: Some of these declarations are static and don't belong in here. MapObjectManager *MapObjectManager_Init(FieldSystem *fieldSystem, u32 objectCount, u32 priority); void MapObjectManager_Delete(MapObjectManager *manager); -void sub_0205E104(MapObjectManager *manager, u32 unused, u32 flagId, u32 objectCount, ObjectEvent *objectEvents); +void sub_0205E104(MapObjectManager *manager, u32 unused, u32 mapId, u32 objectCount, ObjectEvent *objectEvents); LocalMapObject *MapObject_Create(MapObjectManager *manager, u32 x, u32 z, u32 direction, u32 sprite, u32 movement, u32 mapNo); LocalMapObject *MapObject_CreateWithParams(MapObjectManager *manager, u32 x, u32 y, u32 direction, u32 sprite, u32 movement, u32 mapNo, u32 param0, u32 param1, u32 param2); LocalMapObject *MapObject_CreateFromObjectEventWithId(MapObjectManager *mapObjectManager, u16 objectId, u32 numObjects, u32 mapId, const ObjectEvent *templates); @@ -183,8 +183,8 @@ LocalMapObject *MapObjectManager_GetFirstActiveObjectByID(MapObjectManager *mana LocalMapObject *MapObjectManager_GetFirstActiveObjectWithMovement(MapObjectManager *manager, u32 movement); BOOL MapObjectManager_GetNextObjectWithFlagFromIndex(MapObjectManager *manager, LocalMapObject **objectDest, s32 *index, MapObjectFlagBits flag); u32 sub_0205F09C(LocalMapObject *object, u32 param1); -BOOL sub_0205F0A8(LocalMapObject *object, u32 mapId, u32 flagId); -BOOL sub_0205F0F8(LocalMapObject *object, u32 spriteId, u32 mapId, u32 flagId); +BOOL sub_0205F0A8(LocalMapObject *object, u32 objectId, u32 mapId); +BOOL sub_0205F0F8(LocalMapObject *object, u32 spriteId, u32 objectId, u32 mapId); u32 MapObjectManager_GetObjectCount(MapObjectManager *manager); void MapObjectManager_SetFlagsBits(MapObjectManager *manager, u32 bits); void MapObjectManager_ClearFlagsBits(MapObjectManager *manager, u32 bits); @@ -196,21 +196,16 @@ LocalMapObject *MapObjectManager_GetObjects(MapObjectManager *manager); void MapObjectArray_NextObject(LocalMapObject **objects); void MapObjectArray_NextObject2(LocalMapObject **objects); FieldSystem *MapObjectManager_GetFieldSystem(MapObjectManager *manager); -void FldObjSys_SetMModelNarc(MapObjectManager *manager, NARC *mmodel_narc); -NARC *FldObjSys_GetMModelNarc(MapObjectManager *manager); -void MapObject_SetFlagsWord(LocalMapObject *object, u32 bits); -u32 MapObject_GetFlagsWord(LocalMapObject *object); +void MapObjectManager_SetMapModelNarc(MapObjectManager *manager, NARC *mapModelNarc); +NARC *MapObjectManager_GetMapModelNarc(MapObjectManager *manager); +u32 MapObject_GetFlags(LocalMapObject *object); void MapObject_SetFlagsBits(LocalMapObject *mapObject, MapObjectFlagBits bits); void MapObject_ClearFlagsBits(LocalMapObject *mapObject, MapObjectFlagBits bits); -u32 MapObject_GetFlagsBits(LocalMapObject *object, MapObjectFlagBits mask); +u32 MapObject_GetFlagsBitsMask(LocalMapObject *object, MapObjectFlagBits bits); BOOL MapObject_TestFlagsBits(LocalMapObject *object, MapObjectFlagBits bits); -void MapObject_SetFlags2Word(LocalMapObject *object, u32 bits); -u32 MapObject_GetFlags2Word(LocalMapObject *object); -u32 MapObject_GetFlags2Mask(LocalMapObject *object, u32 mask); -void MapObject_SetID(LocalMapObject *mapObject, u32 id); -u32 MapObject_GetID(LocalMapObject *obj); -void sub_0205F250(LocalMapObject *object, u32 a1); -u32 sub_0205F254(LocalMapObject *obj); +void MapObject_SetID(LocalMapObject *object, u32 id); +u32 MapObject_GetID(LocalMapObject *object); +u32 MapObject_GetMapID(LocalMapObject *obj); void MapObject_SetSpriteID(LocalMapObject *mapObject, u32 spriteId); u32 MapObject_GetSpriteID(LocalMapObject *mapObject); void MapObject_SetMovement(LocalMapObject *object, u32 movement); diff --git a/include/overlay_01_021F1348.h b/include/overlay_01_021F1348.h index dea808159..352b86895 100644 --- a/include/overlay_01_021F1348.h +++ b/include/overlay_01_021F1348.h @@ -21,8 +21,8 @@ typedef struct { typedef struct { int unk0; BOOL unk4; - int unk8; - int unkC; + u32 localMapObjectId; + u32 mapId; UnkOv01_021FFFCC_common unk10; NNSG3dRenderObj *unk24; } UnkOv01_021FFFCD; diff --git a/src/field/overlay_01_021FFECC.c b/src/field/overlay_01_021FFECC.c index 4738f39fc..b434a057a 100644 --- a/src/field/overlay_01_021FFECC.c +++ b/src/field/overlay_01_021FFECC.c @@ -78,16 +78,16 @@ static BOOL ov01_021FFFCC(void *a0, UnkOv01_021FFFCD *a1) { UnkOv01_021FFFCC *ptr = sub_02068D98(a0); LocalMapObject *mapObject = ptr->unk0.unkC; - a1->unk10 = ptr->unk0; - a1->unk8 = MapObject_GetID(mapObject); - a1->unkC = sub_0205F254(mapObject); + a1->unk10 = ptr->unk0; + a1->localMapObjectId = MapObject_GetID(mapObject); + a1->mapId = MapObject_GetMapID(mapObject); return TRUE; } static BOOL ov01_021FFFFC(void *a0, UnkOv01_021FFFCD *a1) { LocalMapObject *mapObject = a1->unk10.unkC; - BOOL val = sub_0205F0A8(mapObject, a1->unk8, a1->unkC); + BOOL val = sub_0205F0A8(mapObject, a1->localMapObjectId, a1->mapId); if (val == TRUE) { return sub_02066420(mapObject, 0); } diff --git a/src/map_object.c b/src/map_object.c index 64ff727a2..c1f3635b2 100644 --- a/src/map_object.c +++ b/src/map_object.c @@ -35,8 +35,8 @@ static void sub_0205EC90(LocalMapObject *object, MapObjectManager *manager); static void sub_0205ECE0(LocalMapObject *object); static void sub_0205ED18(LocalMapObject *object); static void MapObject_Clear(LocalMapObject *object); -static u32 sub_0205ED90(LocalMapObject *object, u32 flagId, u32 objectEventCount, ObjectEvent *objectEvents); -static LocalMapObject *MapObjectManager_GetFirstObjectWithID(MapObjectManager *manager, u32 objectId, u32 flagId); +static u32 sub_0205ED90(LocalMapObject *object, u32 mapId, u32 objectEventCount, ObjectEvent *objectEvents); +static LocalMapObject *MapObjectManager_GetFirstObjectWithIDAndMap(MapObjectManager *manager, u32 mapId, u32 flagId); static void sub_0205EF48(LocalMapObject *object); static void sub_0205EF5C(LocalMapObject *object); static void sub_0205EF8C(LocalMapObject *object); @@ -57,6 +57,11 @@ static void MapObjectManager_SetPriority(MapObjectManager *manager, u32 priority static void MapObjectManager_SetObjects(MapObjectManager *manager, LocalMapObject *objects); static LocalMapObject *MapObjectManager_GetObjects3(MapObjectManager *manager); static void MapObjectManager_SetFieldSystem(MapObjectManager *manager, FieldSystem *fieldSystem); +static void MapObject_SetFlags(LocalMapObject *object, u32 flags); +static void MapObject_SetFlags2(LocalMapObject *object, u32 flags); +static u32 MapObject_GetFlags2(LocalMapObject *object); +static u32 MapObject_GetFlags2BitsMask(LocalMapObject *object, u32 bits); +static void MapObject_SetMapID(LocalMapObject *object, u32 mapId); MapObjectManager *MapObjectManager_Init(FieldSystem *fieldSystem, u32 objectCount, u32 priority) { MapObjectManager *ret = MapObjectManager_New(objectCount); @@ -72,15 +77,15 @@ void MapObjectManager_Delete(MapObjectManager *manager) { FreeToHeapExplicit(HEAP_ID_FIELD, manager); } -void sub_0205E104(MapObjectManager *manager, u32 unused, u32 flagId, u32 objectCount, ObjectEvent *objectEvents) { +void sub_0205E104(MapObjectManager *manager, u32 unused, u32 mapId, u32 objectCount, ObjectEvent *objectEvents) { u32 count = MapObjectManager_GetObjectCount(manager); LocalMapObject *objects = MapObjectManager_GetObjects(manager); for (; count != 0; count--) { if (MapObject_IsInUse(objects) == TRUE) { - switch (sub_0205ED90(objects, flagId, objectCount, objectEvents)) { + switch (sub_0205ED90(objects, mapId, objectCount, objectEvents)) { case 0: - if (sub_0205F254(objects) != flagId && !MapObject_TestFlagsBits(objects, MAPOBJECTFLAG_UNK10)) { + if (MapObject_GetMapID(objects) != mapId && !MapObject_TestFlagsBits(objects, MAPOBJECTFLAG_UNK10)) { MapObject_Remove(objects); } break; @@ -124,7 +129,7 @@ static LocalMapObject *MapObject_CreateFromObjectEvent(MapObjectManager *manager return ret; } } else { - ret = MapObjectManager_GetFirstObjectWithID(manager, objectId, ObjectEvent_GetFlagID_AssertScriptIDIsUnset(eventPtr)); + ret = MapObjectManager_GetFirstObjectWithIDAndMap(manager, objectId, ObjectEvent_GetFlagID_AssertScriptIDIsUnset(eventPtr)); if (ret != NULL) { sub_0205F058(ret, mapNo, eventPtr); return ret; @@ -138,7 +143,7 @@ static LocalMapObject *MapObject_CreateFromObjectEvent(MapObjectManager *manager MapObject_InitFromObjectEvent(ret, eventPtr, MapObjectManager_GetFieldSystem(manager)); sub_0205EC90(ret, manager); - sub_0205F250(ret, mapNo); + MapObject_SetMapID(ret, mapNo); sub_0205EFA4(ret); sub_0205EFB4(ret); MapObject_SetFlagsBits(ret, MAPOBJECTFLAG_UNK2); @@ -219,7 +224,7 @@ void MapObject_Delete(LocalMapObject *object) { void sub_0205E420(LocalMapObject *object) { if (sub_0205F5D4(MapObject_GetManager(object)) == TRUE) { - if (MapObject_GetFlagsBits(object, MAPOBJECTFLAG_UNK14) != 0) { + if (MapObject_GetFlagsBitsMask(object, MAPOBJECTFLAG_UNK14) != 0) { sub_0205F498(object); } MapObject_ClearFlagsBits(object, MAPOBJECTFLAG_UNK14); @@ -238,7 +243,7 @@ void MapObjectManager_RemoveAllActiveObjects(MapObjectManager *manager) { LocalMapObject *objects = MapObjectManager_GetObjects(manager); do { // BUG: does not check for if count is zero, and will always execute at least once - if (MapObject_GetFlagsBits(objects, MAPOBJECTFLAG_ACTIVE) != 0) { + if (MapObject_GetFlagsBitsMask(objects, MAPOBJECTFLAG_ACTIVE) != 0) { MapObject_Remove(objects); } @@ -255,7 +260,7 @@ void sub_0205E4C8(MapObjectManager *manager) { LocalMapObject *objects = MapObjectManager_GetObjects(manager); do { - if (MapObject_GetFlagsBits(objects, MAPOBJECTFLAG_ACTIVE) != 0 && MapObject_GetFlagsBits(objects, MAPOBJECTFLAG_UNK14) != 0) { + if (MapObject_GetFlagsBitsMask(objects, MAPOBJECTFLAG_ACTIVE) != 0 && MapObject_GetFlagsBitsMask(objects, MAPOBJECTFLAG_UNK14) != 0) { sub_0205F4AC(objects); MapObject_NoOp(objects); } @@ -349,10 +354,10 @@ void MapObjectManager_RestoreFromSave(MapObjectManager *manager, SavedMapObject } static void SavedMapObject_InitFromLocalMapObject(FieldSystem *fieldSystem, LocalMapObject *localObject, SavedMapObject *savedObject) { - savedObject->flags = MapObject_GetFlagsWord(localObject); - savedObject->flags2 = MapObject_GetFlags2Word(localObject); + savedObject->flags = MapObject_GetFlags(localObject); + savedObject->flags2 = MapObject_GetFlags2(localObject); savedObject->objId = MapObject_GetID(localObject); - savedObject->unk10 = sub_0205F254(localObject); + savedObject->mapId = MapObject_GetMapID(localObject); savedObject->spriteId = MapObject_GetSpriteID(localObject); savedObject->movement = MapObject_GetMovement(localObject); savedObject->type = MapObject_GetType(localObject); @@ -391,10 +396,10 @@ static void SavedMapObject_InitFromLocalMapObject(FieldSystem *fieldSystem, Loca } static void LocalMapObject_InitFromSavedMapObject(LocalMapObject *localObject, SavedMapObject *savedObject) { - MapObject_SetFlagsWord(localObject, savedObject->flags); - MapObject_SetFlags2Word(localObject, savedObject->flags2); + MapObject_SetFlags(localObject, savedObject->flags); + MapObject_SetFlags2(localObject, savedObject->flags2); MapObject_SetID(localObject, savedObject->objId); - sub_0205F250(localObject, savedObject->unk10); + MapObject_SetMapID(localObject, savedObject->mapId); MapObject_SetSpriteID(localObject, savedObject->spriteId); MapObject_SetMovement(localObject, savedObject->movement); MapObject_SetType(localObject, savedObject->type); @@ -497,7 +502,7 @@ static LocalMapObject *MapObjectManager_GetFirstInactiveObject(MapObjectManager LocalMapObject *objects = MapObjectManager_GetObjects(manager); do { - if (MapObject_GetFlagsBits(objects, MAPOBJECTFLAG_ACTIVE) == 0) { + if (MapObject_GetFlagsBitsMask(objects, MAPOBJECTFLAG_ACTIVE) == 0) { return objects; } @@ -610,22 +615,25 @@ static void MapObject_Clear(LocalMapObject *object) { memset(object, 0, sizeof(LocalMapObject)); } -static u32 sub_0205ED90(LocalMapObject *object, u32 flagId, u32 objectEventCount, ObjectEvent *objectEvents) { +static u32 sub_0205ED90(LocalMapObject *object, u32 mapId, u32 objectEventCount, ObjectEvent *objectEvents) { for (; objectEventCount != 0; objectEventCount--, objectEvents++) { if (ObjectEvent_GetID(objectEvents) != MapObject_GetID(object)) { continue; } if (ObjectEvent_ScriptIDIsUnset(objectEvents) == TRUE) { - u16 flagIdUnset = ObjectEvent_GetFlagID_AssertScriptIDIsUnset(objectEvents); + u16 flagId = ObjectEvent_GetFlagID_AssertScriptIDIsUnset(objectEvents); if (MapObject_CheckFlag25(object) == TRUE) { // this and the one below cannot be combined as it doesn't match - if (sub_0205F544(object) == flagIdUnset) { + if (sub_0205F544(object) == flagId) { return 1; } - } else if (sub_0205F254(object) == flagIdUnset) { + // I'm assume that sometimes the ObjectEvent flags equals the mapId to signify that + // this is a map-wide event etc. + } else if (MapObject_GetMapID(object) == flagId) { return 2; } - } else if (MapObject_CheckFlag25(object) == TRUE && sub_0205F544(object) == flagId) { + // this is indeed a weird comparsion, but I checked, it's correct + } else if (MapObject_CheckFlag25(object) == TRUE && sub_0205F544(object) == mapId) { return 2; } } @@ -633,14 +641,12 @@ static u32 sub_0205ED90(LocalMapObject *object, u32 flagId, u32 objectEventCount return 0; } -// TODO: this also gets based on the second param, which is currently labelled as flagId, but is not -// see the note attached to sub_0205F254 -static LocalMapObject *MapObjectManager_GetFirstObjectWithID(MapObjectManager *manager, u32 objectId, u32 flagId) { +static LocalMapObject *MapObjectManager_GetFirstObjectWithIDAndMap(MapObjectManager *manager, u32 objectId, u32 mapId) { s32 index = 0; LocalMapObject *object; while (MapObjectManager_GetNextObjectWithFlagFromIndex(manager, &object, &index, MAPOBJECTFLAG_ACTIVE) == TRUE) { - if (MapObject_GetID(object) == objectId && sub_0205F254(object) == flagId) { + if (MapObject_GetID(object) == objectId && MapObject_GetMapID(object) == mapId) { return object; } } @@ -692,7 +698,7 @@ BOOL MapObjectManager_GetNextObjectWithFlagFromIndex(MapObjectManager *manager, do { (*index)++; - if (flag == (MapObjectFlagBits)MapObject_GetFlagsBits(object, flag)) { + if (flag == (MapObjectFlagBits)MapObject_GetFlagsBitsMask(object, flag)) { *objectDest = object; return TRUE; } @@ -726,7 +732,7 @@ static u32 FieldSystem_ResolveObjectSpriteID(FieldSystem *fieldSystem, s32 sprit } static void sub_0205EF8C(LocalMapObject *object) { - if (MapObject_GetFlagsBits(object, MAPOBJECTFLAG_UNK12) != 0) { + if (MapObject_GetFlagsBitsMask(object, MAPOBJECTFLAG_UNK12) != 0) { sub_02061070(object); } } @@ -760,7 +766,7 @@ static void sub_0205F014(LocalMapObject *object, ObjectEvent *objectEvent, u32 m GF_ASSERT(MapObject_CheckFlag25(object) == TRUE); MapObject_SetFlag25(object, FALSE); - sub_0205F250(object, mapNo); + MapObject_SetMapID(object, mapNo); MapObject_SetScriptID(object, ObjectEvent_GetScriptID(objectEvent)); MapObject_SetFlagID(object, ObjectEvent_GetFlagID(objectEvent)); } @@ -771,28 +777,28 @@ static void sub_0205F058(LocalMapObject *object, u32 mapNo, ObjectEvent *objectE MapObject_SetFlag25(object, TRUE); MapObject_SetScriptID(object, ObjectEvent_GetScriptID(objectEvent)); MapObject_SetFlagID(object, ObjectEvent_GetFlagID_AssertScriptIDIsUnset(objectEvent)); - sub_0205F250(object, mapNo); + MapObject_SetMapID(object, mapNo); } u32 sub_0205F09C(LocalMapObject *object, u32 param1) { return (u32)(sub_0205F538(object) + param1); } -BOOL sub_0205F0A8(LocalMapObject *object, u32 mapId, u32 flagId) { +BOOL sub_0205F0A8(LocalMapObject *object, u32 objectId, u32 mapId) { if (!MapObject_TestFlagsBits(object, MAPOBJECTFLAG_ACTIVE)) { return FALSE; } - if (MapObject_GetID(object) != mapId) { + if (MapObject_GetID(object) != objectId) { return FALSE; } - if (sub_0205F254(object) != flagId) { + if (MapObject_GetMapID(object) != mapId) { if (!MapObject_CheckFlag25(object)) { return FALSE; } - if (sub_0205F544(object) != flagId) { + if (sub_0205F544(object) != mapId) { return FALSE; } } @@ -800,7 +806,7 @@ BOOL sub_0205F0A8(LocalMapObject *object, u32 mapId, u32 flagId) { return TRUE; } -BOOL sub_0205F0F8(LocalMapObject *object, u32 spriteId, u32 mapId, u32 flagId) { +BOOL sub_0205F0F8(LocalMapObject *object, u32 spriteId, u32 objectId, u32 mapId) { if (!MapObject_TestFlagsBits(object, MAPOBJECTFLAG_ACTIVE)) { return FALSE; } @@ -810,7 +816,7 @@ BOOL sub_0205F0F8(LocalMapObject *object, u32 spriteId, u32 mapId, u32 flagId) { return FALSE; } - return sub_0205F0A8(object, mapId, flagId); + return sub_0205F0A8(object, objectId, mapId); } static void sub_0205F12C(SysTask *task, LocalMapObject *object) { @@ -909,20 +915,20 @@ FieldSystem *MapObjectManager_GetFieldSystem(MapObjectManager *manager) { return manager->fieldSystem; } -void FldObjSys_SetMModelNarc(MapObjectManager *manager, NARC *mmodel_narc) { - manager->mmodel_narc = mmodel_narc; +void MapObjectManager_SetMapModelNarc(MapObjectManager *manager, NARC *mapModelNarc) { + manager->mapModelNarc = mapModelNarc; } -NARC *FldObjSys_GetMModelNarc(MapObjectManager *manager) { - GF_ASSERT(manager->mmodel_narc != NULL); - return manager->mmodel_narc; +NARC *MapObjectManager_GetMapModelNarc(MapObjectManager *manager) { + GF_ASSERT(manager->mapModelNarc != NULL); + return manager->mapModelNarc; } -void MapObject_SetFlagsWord(LocalMapObject *object, u32 bits) { - object->flags = bits; +static void MapObject_SetFlags(LocalMapObject *object, u32 flags) { + object->flags = flags; } -u32 MapObject_GetFlagsWord(LocalMapObject *object) { +u32 MapObject_GetFlags(LocalMapObject *object) { return object->flags; } @@ -934,24 +940,24 @@ void MapObject_ClearFlagsBits(LocalMapObject *object, MapObjectFlagBits bits) { object->flags &= ~bits; } -u32 MapObject_GetFlagsBits(LocalMapObject *object, MapObjectFlagBits mask) { - return object->flags & mask; +u32 MapObject_GetFlagsBitsMask(LocalMapObject *object, MapObjectFlagBits bits) { + return object->flags & bits; } BOOL MapObject_TestFlagsBits(LocalMapObject *object, MapObjectFlagBits bits) { return (object->flags & bits) != 0; } -void MapObject_SetFlags2Word(LocalMapObject *object, u32 bits) { - object->flags2 = bits; +static void MapObject_SetFlags2(LocalMapObject *object, u32 flags) { + object->flags2 = flags; } -u32 MapObject_GetFlags2Word(LocalMapObject *object) { +static u32 MapObject_GetFlags2(LocalMapObject *object) { return object->flags2; } -u32 MapObject_GetFlags2Mask(LocalMapObject *object, u32 mask) { - return object->flags2 & mask; +static u32 MapObject_GetFlags2BitsMask(LocalMapObject *object, u32 bits) { + return object->flags2 & bits; } void MapObject_SetID(LocalMapObject *object, u32 id) { @@ -962,23 +968,12 @@ u32 MapObject_GetID(LocalMapObject *object) { return object->id; } -/* - * Something is very wrong here. One of the variables is mislabelled or misnamed. - * Both of the following two functions access LMO's unkC, Initially I thought to - * rename unkC to objectEventFlags, as in MapObjectManager_GetFirstObjectWithID - * sub_0205F254 is used to compare to OE's flags in MapObject_CreateFromObjectEvent. - * However, sub_0205F250 is often used (again in MapObject_CreateFromObjectEvent) for - * assignment of the mapNo to unkC, which of course conflicts with the other - * established uses for unkC. Someone with more understanding of this, potentially - * from binary land may do better than me at figuring out what is going on here - * - red031000 - */ -void sub_0205F250(LocalMapObject *object, u32 a1) { - object->unkC = a1; +static void MapObject_SetMapID(LocalMapObject *object, u32 mapId) { + object->mapId = mapId; } -u32 sub_0205F254(LocalMapObject *object) { - return object->unkC; +u32 MapObject_GetMapID(LocalMapObject *object) { + return object->mapId; } void MapObject_SetSpriteID(LocalMapObject *object, u32 spriteId) { @@ -1035,7 +1030,7 @@ void MapObject_SetFacingDirectionDirect(LocalMapObject *object, u32 direction) { } void MapObject_SetFacingDirection(LocalMapObject *object, u32 direction) { - if (MapObject_GetFlagsBits(object, MAPOBJECTFLAG_UNK7) == 0) { + if (MapObject_GetFlagsBitsMask(object, MAPOBJECTFLAG_UNK7) == 0) { object->currentFacingBak = object->currentFacing; object->currentFacing = direction; } @@ -1461,7 +1456,7 @@ BOOL sub_0205F73C(LocalMapObject *object) { return FALSE; } - if (MapObject_GetFlagsBits(object, MAPOBJECTFLAG_UNK14) != 0) { + if (MapObject_GetFlagsBitsMask(object, MAPOBJECTFLAG_UNK14) != 0) { return TRUE; } @@ -1477,7 +1472,7 @@ void MapObject_SetIgnoreHeights(LocalMapObject *object, BOOL set) { } BOOL MapObject_CheckIgnoreHeights(LocalMapObject *object) { - return MapObject_GetFlagsBits(object, MAPOBJECTFLAG_IGNORE_HEIGHTS) != 0; + return MapObject_GetFlagsBitsMask(object, MAPOBJECTFLAG_IGNORE_HEIGHTS) != 0; } void MapObject_SetFlag10(LocalMapObject *object, BOOL set) { @@ -1497,7 +1492,7 @@ void MapObject_SetFlag25(LocalMapObject *object, BOOL set) { } BOOL MapObject_CheckFlag25(LocalMapObject *object) { - return MapObject_GetFlagsBits(object, MAPOBJECTFLAG_UNK25) != 0; + return MapObject_GetFlagsBitsMask(object, MAPOBJECTFLAG_UNK25) != 0; } void MapObject_SetFlag26(LocalMapObject *object, BOOL set) { @@ -1509,7 +1504,7 @@ void MapObject_SetFlag26(LocalMapObject *object, BOOL set) { } BOOL MapObject_CheckFlag26(LocalMapObject *object) { - return MapObject_GetFlagsBits(object, MAPOBJECTFLAG_UNK26) != 0; + return MapObject_GetFlagsBitsMask(object, MAPOBJECTFLAG_UNK26) != 0; } void MapObject_SetFlag28(LocalMapObject *object, BOOL set) { @@ -1521,7 +1516,7 @@ void MapObject_SetFlag28(LocalMapObject *object, BOOL set) { } BOOL MapObject_CheckFlag28(LocalMapObject *object) { - return MapObject_GetFlagsBits(object, MAPOBJECTFLAG_UNK28) != 0; + return MapObject_GetFlagsBitsMask(object, MAPOBJECTFLAG_UNK28) != 0; } void MapObject_SetFlag24(LocalMapObject *object, BOOL set) { @@ -1533,11 +1528,11 @@ void MapObject_SetFlag24(LocalMapObject *object, BOOL set) { } BOOL MapObject_CheckFlag24(LocalMapObject *object) { - return MapObject_GetFlagsBits(object, MAPOBJECTFLAG_UNK24) != 0; + return MapObject_GetFlagsBitsMask(object, MAPOBJECTFLAG_UNK24) != 0; } BOOL MapObject_CheckFlag4(LocalMapObject *object) { - return MapObject_GetFlagsBits(object, MAPOBJECTFLAG_UNK4) != 0; + return MapObject_GetFlagsBitsMask(object, MAPOBJECTFLAG_UNK4) != 0; } void MapObject_SetFlag29(LocalMapObject *object, BOOL set) { @@ -1549,11 +1544,11 @@ void MapObject_SetFlag29(LocalMapObject *object, BOOL set) { } BOOL MapObject_CheckFlag29(LocalMapObject *object) { - return MapObject_GetFlagsBits(object, MAPOBJECTFLAG_UNK29) != 0; + return MapObject_GetFlagsBitsMask(object, MAPOBJECTFLAG_UNK29) != 0; } BOOL sub_0205F8D0(LocalMapObject *object) { - return MapObject_GetFlags2Mask(object, 1 << 2) != FALSE; + return MapObject_GetFlags2BitsMask(object, 1 << 2) != FALSE; } u32 MapObject_GetInitialX(LocalMapObject *object) { @@ -1906,7 +1901,7 @@ LocalMapObject *sub_0205FB58(MapObjectManager *manager, u32 x, u32 y, BOOL a3) { LocalMapObject *object = objects; do { - if (MapObject_GetFlagsBits(object, MAPOBJECTFLAG_ACTIVE) != 0) { + if (MapObject_GetFlagsBitsMask(object, MAPOBJECTFLAG_ACTIVE) != 0) { if (a3 && x == MapObject_GetPrevX(object) && y == MapObject_GetPrevY(object)) { return object; } diff --git a/src/unk_0206D494.c b/src/unk_0206D494.c index 13cd59482..8bb7876be 100644 --- a/src/unk_0206D494.c +++ b/src/unk_0206D494.c @@ -137,8 +137,8 @@ static LocalMapObject *sub_0206D614(MapObjectManager *manager, u32 x, u32 a2, u3 LocalMapObject *object = MapObjectManager_GetObjects(manager); u32 count = MapObjectManager_GetObjectCount(manager); do { - if (MapObject_GetFlagsBits(object, MAPOBJECTFLAG_ACTIVE) - && !MapObject_GetFlagsBits(object, MAPOBJECTFLAG_UNK18)) { + if (MapObject_GetFlagsBitsMask(object, MAPOBJECTFLAG_ACTIVE) + && !MapObject_GetFlagsBitsMask(object, MAPOBJECTFLAG_UNK18)) { u32 curX = MapObject_GetCurrentX(object); u32 curY = MapObject_GetCurrentY(object); if (curX == x && curY == y) {