diff --git a/asm/bigGoron.s b/asm/bigGoron.s index a763a077..293eb6a0 100644 --- a/asm/bigGoron.s +++ b/asm/bigGoron.s @@ -120,7 +120,7 @@ sub_0806D0F8: @ 0x0806D0F8 movs r0, #7 movs r1, #0x4c movs r2, #7 - bl sub_0805EB00 + bl FindEntityInListBySubtype cmp r0, #0 beq _0806D10C bl sub_0806D0B0 @@ -928,7 +928,7 @@ sub_0806D6D0: @ 0x0806D6D0 movs r1, #0x4c movs r2, #7 movs r3, #2 - bl sub_0805EB2C + bl FindEntityInListByForm adds r1, r0, #0 cmp r1, #0 beq _0806D6EE @@ -940,7 +940,7 @@ _0806D6EE: movs r1, #0x4c movs r2, #7 movs r3, #1 - bl sub_0805EB2C + bl FindEntityInListByForm adds r1, r0, #0 cmp r1, #0 beq _0806D706 @@ -961,7 +961,7 @@ sub_0806D70C: @ 0x0806D70C movs r1, #0x4c movs r2, #7 movs r3, #2 - bl sub_0805EB2C + bl FindEntityInListByForm adds r2, r0, #0 cmp r2, #0 beq _0806D728 @@ -972,7 +972,7 @@ _0806D728: movs r1, #0x4c movs r2, #7 movs r3, #1 - bl sub_0805EB2C + bl FindEntityInListByForm adds r2, r0, #0 cmp r2, #0 beq _0806D746 @@ -996,7 +996,7 @@ sub_0806D74C: @ 0x0806D74C movs r1, #0x4c movs r2, #7 movs r3, #2 - bl sub_0805EB2C + bl FindEntityInListByForm adds r1, r0, #0 cmp r1, #0 beq _0806D76A @@ -1008,7 +1008,7 @@ _0806D76A: movs r1, #0x4c movs r2, #7 movs r3, #1 - bl sub_0805EB2C + bl FindEntityInListByForm adds r1, r0, #0 cmp r1, #0 beq _0806D782 @@ -1029,7 +1029,7 @@ sub_0806D788: @ 0x0806D788 movs r1, #0x4c movs r2, #7 movs r3, #2 - bl sub_0805EB2C + bl FindEntityInListByForm adds r1, r0, #0 cmp r1, #0 beq _0806D7A6 @@ -1041,7 +1041,7 @@ _0806D7A6: movs r1, #0x4c movs r2, #7 movs r3, #1 - bl sub_0805EB2C + bl FindEntityInListByForm adds r1, r0, #0 cmp r1, #0 beq _0806D7BE @@ -1070,7 +1070,7 @@ sub_0806D7C4: @ 0x0806D7C4 movs r1, #0x4c movs r2, #7 movs r3, #2 - bl sub_0805EB2C + bl FindEntityInListByForm cmp r0, #0 beq _0806D7FC movs r1, #0x2e @@ -1098,7 +1098,7 @@ sub_0806D804: @ 0x0806D804 movs r1, #0x4c movs r2, #7 movs r3, #2 - bl sub_0805EB2C + bl FindEntityInListByForm adds r1, r0, #0 cmp r1, #0 beq _0806D83A diff --git a/asm/bird.s b/asm/bird.s index dae30ccc..0542b6c6 100644 --- a/asm/bird.s +++ b/asm/bird.s @@ -681,7 +681,7 @@ _0809D478: cmp r4, #0 beq _0809D484 adds r0, r4, #0 - bl sub_0805E79C + bl DeleteEntityAny _0809D484: bl DeleteThisEntity _0809D488: @@ -1002,7 +1002,7 @@ CreateBird: @ 0x0809D700 movs r1, #0x95 movs r2, #6 movs r3, #8 - bl sub_0805EB2C + bl FindEntityInListByForm adds r4, r0, #0 cmp r4, #0 bne _0809D732 diff --git a/asm/book.s b/asm/book.s index 992ba2c0..a0496c64 100644 --- a/asm/book.s +++ b/asm/book.s @@ -327,7 +327,7 @@ _0809B606: movs r0, #7 movs r1, #0x1a movs r2, #7 - bl sub_0805EB00 + bl FindEntityInListBySubtype adds r2, r0, #0 cmp r2, #0 beq _0809B682 diff --git a/asm/code_08019444.s b/asm/code_08019444.s index d71f4fff..4a7713fe 100644 --- a/asm/code_08019444.s +++ b/asm/code_08019444.s @@ -3374,13 +3374,13 @@ sub_0801AD6C: @ 0x0801AD6C adds r0, r0, r1 ldrb r1, [r0] adds r0, r5, #0 - bl sub_0805EA2C + bl AppendEntityToList b _0801AE26 .align 2, 0 _0801ADD4: .4byte gRoomControls _0801ADD8: .4byte gUnk_081091E4 _0801ADDC: - bl sub_0805E8D4 + bl GetEmptyManager adds r3, r0, #0 cmp r3, #0 beq _0801AE26 @@ -3414,7 +3414,7 @@ _0801ADDC: adds r0, r0, r1 ldrb r1, [r0] adds r0, r3, #0 - bl sub_0805EA2C + bl AppendEntityToList _0801AE26: pop {r4, r5, r6, pc} .align 2, 0 diff --git a/asm/code_0801CEC0.s b/asm/code_0801CEC0.s index e55bb415..ff3d26df 100644 --- a/asm/code_0801CEC0.s +++ b/asm/code_0801CEC0.s @@ -561,7 +561,7 @@ _0801D390: bne _0801D380 _0801D3AC: movs r1, #0 - ldr r4, _0801D450 @ =gUnk_03003D70 + ldr r4, _0801D450 @ =gEntityLists mov ip, r4 _0801D3B2: lsls r0, r1, #3 @@ -647,7 +647,7 @@ _0801D444: add sp, #0x10 pop {r4, r5, r6, r7, pc} .align 2, 0 -_0801D450: .4byte gUnk_03003D70 +_0801D450: .4byte gEntityLists _0801D454: .4byte gUnk_020000C0 thumb_func_start sub_0801D458 diff --git a/asm/code_0804AEB0.s b/asm/code_0804AEB0.s index 2c4fdb3b..6ccfba79 100644 --- a/asm/code_0804AEB0.s +++ b/asm/code_0804AEB0.s @@ -26,7 +26,7 @@ sub_0804AEB0: @ 0x0804AEB0 adds r0, r4, r0 ldrb r1, [r0] adds r0, r5, #0 - bl sub_0805EA2C + bl AppendEntityToList b _0804AEF6 .align 2, 0 _0804AEDC: .4byte gUnk_081091E4 @@ -35,12 +35,12 @@ _0804AEE0: bne _0804AEEE adds r0, r5, #0 movs r1, #8 - bl sub_0805EA2C + bl AppendEntityToList b _0804AEF6 _0804AEEE: adds r0, r5, #0 adds r1, r2, #0 - bl sub_0805EA2C + bl AppendEntityToList _0804AEF6: adds r1, r5, #0 adds r1, #0x78 diff --git a/asm/code_0804B058.s b/asm/code_0804B058.s index a3e87e29..3557f857 100644 --- a/asm/code_0804B058.s +++ b/asm/code_0804B058.s @@ -252,7 +252,7 @@ _0804B2FC: sub_0804B300: @ 0x0804B300 push {r4, lr} adds r4, r0, #0 - bl sub_0805E8D4 + bl GetEmptyManager adds r1, r0, #0 cmp r1, #0 beq _0804B332 @@ -272,7 +272,7 @@ sub_0804B300: @ 0x0804B300 strh r0, [r1, #0x3e] adds r0, r1, #0 movs r1, #6 - bl sub_0805EA2C + bl AppendEntityToList _0804B332: pop {r4, pc} @@ -304,7 +304,7 @@ _0804B35A: bne _0804B380 movs r0, #1 strb r0, [r1, #1] - bl sub_0805E8D4 + bl GetEmptyManager adds r1, r0, #0 cmp r1, #0 beq _0804B380 @@ -314,7 +314,7 @@ _0804B35A: strb r0, [r1, #9] adds r0, r1, #0 movs r1, #6 - bl sub_0805EA2C + bl AppendEntityToList _0804B380: pop {r4, pc} .align 2, 0 diff --git a/asm/code_080526F8.s b/asm/code_080526F8.s index e40df276..d054a0b6 100644 --- a/asm/code_080526F8.s +++ b/asm/code_080526F8.s @@ -665,7 +665,7 @@ sub_08052BF8: @ 0x08052BF8 adds r0, r2, #0 adds r0, #0x2e strb r1, [r0] - bl sub_0805E8D4 + bl GetEmptyManager adds r1, r0, #0 cmp r1, #0 beq _08052C30 @@ -676,7 +676,7 @@ sub_08052BF8: @ 0x08052BF8 strb r0, [r1, #0xa] adds r0, r1, #0 movs r1, #0 - bl sub_0805EA2C + bl AppendEntityToList _08052C30: pop {pc} .align 2, 0 @@ -1115,7 +1115,7 @@ _08052F72: ldrh r0, [r3, #0xc] adds r0, r0, r5 strh r0, [r3, #0xc] - ldr r2, _08052FD4 @ =gUnk_03003D70 + ldr r2, _08052FD4 @ =gEntityLists adds r6, r2, #0 adds r6, #0x48 _08052FA4: @@ -1146,7 +1146,7 @@ _08052FCC: pop {r4, r5, r6, pc} .align 2, 0 _08052FD0: .4byte 0x0000085C -_08052FD4: .4byte gUnk_03003D70 +_08052FD4: .4byte gEntityLists thumb_func_start sub_08052FD8 sub_08052FD8: @ 0x08052FD8 @@ -1377,7 +1377,7 @@ sub_08053178: @ 0x08053178 bl CheckGlobalFlag cmp r0, #0 bne _080531DC - bl sub_0805E8D4 + bl GetEmptyManager adds r4, r0, #0 cmp r4, #0 beq _080531DC @@ -1387,7 +1387,7 @@ sub_08053178: @ 0x08053178 strb r0, [r4, #9] adds r0, r4, #0 movs r1, #8 - bl sub_0805EA2C + bl AppendEntityToList ldr r0, _080531F0 @ =gRoomVars ldrb r0, [r0] cmp r0, #0 @@ -2013,7 +2013,7 @@ sub_0805368C: @ 0x0805368C movs r0, #6 movs r1, #0x5d movs r2, #6 - bl sub_0805EB00 + bl FindEntityInListBySubtype cmp r0, #0 beq _080536A6 bl DeleteEntity diff --git a/asm/code_0805436C.s b/asm/code_0805436C.s index 16f8ca8e..d1a63f7b 100644 --- a/asm/code_0805436C.s +++ b/asm/code_0805436C.s @@ -789,7 +789,7 @@ _08054EB4: .4byte gMenu sub_08054EB8: @ 0x08054EB8 push {r4, lr} adds r4, r0, #0 - bl sub_0805E8D4 + bl GetEmptyManager adds r3, r0, #0 cmp r3, #0 beq _08054EF6 @@ -815,7 +815,7 @@ sub_08054EB8: @ 0x08054EB8 strh r0, [r3, #0x3e] adds r0, r3, #0 movs r1, #6 - bl sub_0805EA2C + bl AppendEntityToList _08054EF6: pop {r4, pc} .align 2, 0 @@ -2571,7 +2571,7 @@ _08055C6C: movs r1, #0x9e movs r2, #6 movs r3, #0 - bl sub_0805EB2C + bl FindEntityInListByForm adds r4, r0, #0 cmp r4, #0 beq _08055C8C diff --git a/asm/code_0805E3B0.s b/asm/code_0805E3B0.s index 9b1b8201..061f417a 100644 --- a/asm/code_0805E3B0.s +++ b/asm/code_0805E3B0.s @@ -336,7 +336,7 @@ sub_0805E5C0: @ 0x0805E5C0 ldr r1, _0805E5F4 @ =gUnk_03005F40 movs r0, #0 bl _call_via_r1 - bl sub_0805E84C + bl ClearAllDeletedEntities bl sub_0805EE88 pop {pc} .align 2, 0 @@ -349,7 +349,7 @@ sub_0805E5F8: @ 0x0805E5F8 ldr r1, _0805E608 @ =gUnk_03005F40 movs r0, #1 bl _call_via_r1 - bl sub_0805E84C + bl ClearAllDeletedEntities pop {pc} .align 2, 0 _0805E608: .4byte gUnk_03005F40 @@ -370,10 +370,10 @@ EraseAllEntities: @ 0x0805E60C lsls r1, r1, #4 bl _DmaZero bl sub_0805E98C - ldr r0, _0805E660 @ =gUnk_03003DBC + ldr r0, _0805E660 @ =gEntCount movs r1, #0 strb r1, [r0] - ldr r0, _0805E664 @ =gUnk_020354B4 + ldr r0, _0805E664 @ =gManagerCount strb r1, [r0] ldr r1, _0805E668 @ =gUnk_03000000 ldr r2, _0805E66C @ =0x00000427 @@ -391,8 +391,8 @@ EraseAllEntities: @ 0x0805E60C _0805E654: .4byte gUnk_03003DC0 _0805E658: .4byte gPlayerEntity _0805E65C: .4byte gUnk_02033290 -_0805E660: .4byte gUnk_03003DBC -_0805E664: .4byte gUnk_020354B4 +_0805E660: .4byte gEntCount +_0805E664: .4byte gManagerCount _0805E668: .4byte gUnk_03000000 _0805E66C: .4byte 0x00000427 _0805E670: .4byte 0x00000426 diff --git a/asm/code_0806EC20.s b/asm/code_0806EC20.s index 7a47cab4..edca84a3 100644 --- a/asm/code_0806EC20.s +++ b/asm/code_0806EC20.s @@ -27,7 +27,7 @@ sub_0806EC38: @ 0x0806EC38 movs r0, #7 movs r1, #0x58 movs r2, #7 - bl sub_0805EB00 + bl FindEntityInListBySubtype cmp r0, #0 beq _0806EC4C bl DeleteEntity diff --git a/asm/code_080732D0.s b/asm/code_080732D0.s index 6068b8b1..f8c6d611 100644 --- a/asm/code_080732D0.s +++ b/asm/code_080732D0.s @@ -4592,7 +4592,7 @@ _080754F2: movs r0, #8 movs r1, #0xf movs r2, #2 - bl sub_0805EB00 + bl FindEntityInListBySubtype cmp r0, #0 bne _08075538 adds r0, r4, #0 @@ -6017,7 +6017,7 @@ sub_08075FF8: @ 0x08075FF8 movs r0, #8 movs r1, #2 movs r2, #2 - bl sub_0805EB00 + bl FindEntityInListBySubtype b _08076026 .align 2, 0 _08076018: .4byte gPlayerState @@ -6025,7 +6025,7 @@ _0807601C: adds r5, #1 adds r0, r4, #0 movs r1, #2 - bl sub_0805EB64 + bl FindNextEntityOfSameSubtype _08076026: adds r4, r0, #0 cmp r4, #0 diff --git a/asm/code_08078778.s b/asm/code_08078778.s index cf4104c6..f3bcc358 100644 --- a/asm/code_08078778.s +++ b/asm/code_08078778.s @@ -44,7 +44,7 @@ _080788BA: movs r0, #6 movs r1, #9 movs r2, #6 - bl sub_0805EB00 + bl FindEntityInListBySubtype cmp r0, #0 bne _080788D6 movs r0, #9 diff --git a/asm/code_0807CC3C.s b/asm/code_0807CC3C.s index c1a22a53..a9ace9d1 100644 --- a/asm/code_0807CC3C.s +++ b/asm/code_0807CC3C.s @@ -5950,7 +5950,7 @@ sub_0807F950: @ 0x0807F950 movs r1, #0x56 movs r2, #6 movs r3, #0 - bl sub_0805EB2C + bl FindEntityInListByForm cmp r0, #0 beq _0807F96C bl DeleteEntity diff --git a/asm/code_080A5574.s b/asm/code_080A5574.s index b0893ba6..ec2e0e3a 100644 --- a/asm/code_080A5574.s +++ b/asm/code_080A5574.s @@ -4931,7 +4931,7 @@ _080A7C52: strb r0, [r4, #8] adds r0, r4, #0 movs r1, #6 - bl sub_0805EA2C + bl AppendEntityToList _080A7C72: adds r0, r4, #0 pop {r4, r5, r6, r7, pc} @@ -5288,7 +5288,7 @@ sub_080A7EE0: @ 0x080A7EE0 strb r5, [r4, #9] adds r0, r4, #0 movs r1, #5 - bl sub_0805EA2C + bl AppendEntityToList _080A7EFC: adds r0, r4, #0 pop {r4, r5, pc} @@ -12015,7 +12015,7 @@ _080AB128: .4byte gSineTable sub_080AB12C: @ 0x080AB12C push {r4, lr} adds r4, r0, #0 - ldr r0, _080AB168 @ =gUnk_03003DBC + ldr r0, _080AB168 @ =gEntCount ldrb r0, [r0] cmp r0, #0x44 bhi _080AB16C @@ -12040,7 +12040,7 @@ sub_080AB12C: @ 0x080AB12C movs r0, #1 b _080AB16E .align 2, 0 -_080AB168: .4byte gUnk_03003DBC +_080AB168: .4byte gEntCount _080AB16C: movs r0, #0 _080AB16E: @@ -14792,7 +14792,7 @@ sub_080AC5E4: @ 0x080AC5E4 ldrb r4, [r5, #0xa] cmp r4, #0 bne _080AC668 - ldr r0, _080AC664 @ =gUnk_03003DBC + ldr r0, _080AC664 @ =gEntCount ldrb r0, [r0] cmp r0, #0x43 bhi _080AC670 @@ -14845,9 +14845,9 @@ sub_080AC5E4: @ 0x080AC5E4 str r0, [r7, #0x54] b _080AC6C8 .align 2, 0 -_080AC664: .4byte gUnk_03003DBC +_080AC664: .4byte gEntCount _080AC668: - ldr r0, _080AC674 @ =gUnk_03003DBC + ldr r0, _080AC674 @ =gEntCount ldrb r0, [r0] cmp r0, #0x44 bls _080AC678 @@ -14855,7 +14855,7 @@ _080AC670: movs r0, #0 b _080AC6E8 .align 2, 0 -_080AC674: .4byte gUnk_03003DBC +_080AC674: .4byte gEntCount _080AC678: adds r1, r5, #0 adds r1, #0x79 diff --git a/asm/createEntity.s b/asm/createEntity.s index 11de294a..8451dec1 100644 --- a/asm/createEntity.s +++ b/asm/createEntity.s @@ -19,14 +19,14 @@ CreateEntity: @ 0x0804ADF8 bne _0804AE1C ldrb r1, [r4, #2] adds r0, r6, #0 - bl sub_0805EB9C + bl FindEntityBySubtype cmp r0, #0 beq _0804AE1C movs r0, #0 b _0804AEAC _0804AE1C: adds r0, r6, #0 - bl sub_0805E768 + bl GetEmptyEntityAny adds r5, r0, #0 cmp r5, #0 beq _0804AEAA diff --git a/asm/fireballGuy.s b/asm/fireballGuy.s index 675564bd..af3e9ad0 100644 --- a/asm/fireballGuy.s +++ b/asm/fireballGuy.s @@ -126,7 +126,7 @@ sub_08045454: @ 0x08045454 ldrb r7, [r0] movs r0, #0x48 subs r0, r0, r7 - ldr r1, _0804551C @ =gUnk_03003DBC + ldr r1, _0804551C @ =gEntCount ldrb r1, [r1] cmp r0, r1 ble _0804550C @@ -212,7 +212,7 @@ _0804550C: pop {r4, r5, r6, r7, pc} .align 2, 0 _08045518: .4byte gUnk_080D180C -_0804551C: .4byte gUnk_03003DBC +_0804551C: .4byte gEntCount _08045520: .4byte gUnk_080D1810 thumb_func_start sub_08045524 diff --git a/asm/fourElements.s b/asm/fourElements.s index 2c64461e..bd33c8b4 100644 --- a/asm/fourElements.s +++ b/asm/fourElements.s @@ -355,7 +355,7 @@ sub_080A0464: @ 0x080A0464 movs r0, #6 movs r1, #0xac movs r2, #6 - bl sub_0805EB00 + bl FindEntityInListBySubtype cmp r0, #0 beq _080A048A movs r1, #0x2e diff --git a/asm/getEmptyEntity.s b/asm/getEmptyEntity.s index f3b43342..be445c5d 100644 --- a/asm/getEmptyEntity.s +++ b/asm/getEmptyEntity.s @@ -10,7 +10,7 @@ GetEmptyEntity: @ 0x0805E678 push {r4, r5, r6, r7, lr} mov r7, r8 push {r7} - ldr r0, _0805E698 @ =gUnk_03003DBC + ldr r0, _0805E698 @ =gEntCount ldrb r0, [r0] cmp r0, #0x46 bhi _0805E6A6 @@ -25,7 +25,7 @@ _0805E68E: adds r0, r4, #0 b _0805E730 .align 2, 0 -_0805E698: .4byte gUnk_03003DBC +_0805E698: .4byte gEntCount _0805E69C: .4byte gUnk_030015A0 _0805E6A0: adds r4, #0x88 @@ -47,7 +47,7 @@ _0805E6A8: cmp r4, r0 beq _0805E6D4 adds r0, r4, #0 - bl sub_0805E870 + bl ClearDeletedEntity adds r0, r4, #0 b _0805E730 .align 2, 0 @@ -61,7 +61,7 @@ _0805E6D4: movs r0, #0 mov ip, r0 movs r5, #0 - ldr r2, _0805E73C @ =gUnk_03003D70 + ldr r2, _0805E73C @ =gEntityLists movs r0, #0x48 adds r0, r0, r2 mov r8, r0 @@ -100,7 +100,7 @@ _0805E718: adds r0, r5, #0 bl DeleteEntity adds r0, r5, #0 - bl sub_0805E870 + bl ClearDeletedEntity _0805E72E: adds r0, r5, #0 _0805E730: @@ -109,5 +109,5 @@ _0805E730: pop {r4, r5, r6, r7, pc} .align 2, 0 _0805E738: .4byte gUnk_03003BE0 -_0805E73C: .4byte gUnk_03003D70 +_0805E73C: .4byte gEntityLists _0805E740: .4byte gUnk_03003DD0 diff --git a/asm/guardWithSpear.s b/asm/guardWithSpear.s index 710a6b81..1ffd80f5 100644 --- a/asm/guardWithSpear.s +++ b/asm/guardWithSpear.s @@ -153,7 +153,7 @@ sub_08064180: @ 0x08064180 movs r0, #7 movs r1, #0x15 movs r2, #7 - bl sub_0805EB00 + bl FindEntityInListBySubtype cmp r0, #0 beq _08064194 bl DeleteEntity diff --git a/asm/gyorgFemale.s b/asm/gyorgFemale.s index 7523b997..04dfbde8 100644 --- a/asm/gyorgFemale.s +++ b/asm/gyorgFemale.s @@ -24,7 +24,7 @@ _08046148: .4byte gUnk_080D1A64 sub_0804614C: @ 0x0804614C push {r4, r5, r6, lr} adds r6, r0, #0 - ldr r0, _08046248 @ =gUnk_03003DBC + ldr r0, _08046248 @ =gEntCount ldrb r0, [r0] cmp r0, #0x3d bhi _08046244 @@ -133,7 +133,7 @@ sub_0804614C: @ 0x0804614C _08046244: pop {r4, r5, r6, pc} .align 2, 0 -_08046248: .4byte gUnk_03003DBC +_08046248: .4byte gEntCount _0804624C: .4byte gUnk_02019EE0 _08046250: .4byte gUnk_02002F00 _08046254: .4byte gPlayerEntity diff --git a/asm/lilypadLarge.s b/asm/lilypadLarge.s index 2fb565f2..a702d9ac 100644 --- a/asm/lilypadLarge.s +++ b/asm/lilypadLarge.s @@ -73,7 +73,7 @@ _08085566: b _0808557A _0808556C: adds r0, r4, #0 - bl sub_0805EABC + bl DoesSimilarEntityExist cmp r0, #0 beq _0808557A bl DeleteThisEntity @@ -1072,7 +1072,7 @@ _08085D0C: sub_08085D10: @ 0x08085D10 push {r4, lr} adds r4, r0, #0 - bl sub_0805EABC + bl DoesSimilarEntityExist cmp r0, #0 beq _08085D26 ldrb r0, [r4, #0xb] diff --git a/asm/macroAcorn.s b/asm/macroAcorn.s index 24eb54c6..d732db56 100644 --- a/asm/macroAcorn.s +++ b/asm/macroAcorn.s @@ -44,7 +44,7 @@ _0809E52E: ands r0, r2 cmp r0, #0 beq _0809E5A4 - ldr r0, _0809E5A0 @ =gUnk_03003DBC + ldr r0, _0809E5A0 @ =gEntCount ldrb r0, [r0] cmp r0, #0x44 bhi _0809E5B4 @@ -85,7 +85,7 @@ _0809E52E: bl CopyPosition b _0809E5C4 .align 2, 0 -_0809E5A0: .4byte gUnk_03003DBC +_0809E5A0: .4byte gEntCount _0809E5A4: adds r2, r5, #1 movs r0, #0x9a diff --git a/asm/macroBook.s b/asm/macroBook.s index 838925b4..7836e99b 100644 --- a/asm/macroBook.s +++ b/asm/macroBook.s @@ -360,7 +360,7 @@ sub_0809AA00: @ 0x0809AA00 movs r0, #7 movs r1, #0x38 movs r2, #7 - bl sub_0805EB00 + bl FindEntityInListBySubtype adds r4, r0, #0 adds r7, r5, #0 adds r7, #0x78 @@ -380,7 +380,7 @@ _0809AA30: _0809AA3A: adds r0, r4, #0 movs r1, #7 - bl sub_0805EB64 + bl FindNextEntityOfSameSubtype adds r4, r0, #0 cmp r4, #0 bne _0809AA30 diff --git a/asm/madderpillar.s b/asm/madderpillar.s index c3011ca6..22924791 100644 --- a/asm/madderpillar.s +++ b/asm/madderpillar.s @@ -154,7 +154,7 @@ nullsub_14: @ 0x08029998 sub_0802999C: @ 0x0802999C push {r4, r5, r6, r7, lr} adds r7, r0, #0 - ldr r0, _08029A90 @ =gUnk_03003DBC + ldr r0, _08029A90 @ =gEntCount ldrb r0, [r0] cmp r0, #0x43 bhi _08029A8E @@ -261,7 +261,7 @@ sub_0802999C: @ 0x0802999C _08029A8E: pop {r4, r5, r6, r7, pc} .align 2, 0 -_08029A90: .4byte gUnk_03003DBC +_08029A90: .4byte gEntCount thumb_func_start sub_08029A94 sub_08029A94: @ 0x08029A94 diff --git a/asm/manager14.s b/asm/manager14.s index 5c2dec7e..68765dba 100644 --- a/asm/manager14.s +++ b/asm/manager14.s @@ -30,7 +30,7 @@ _08059E7C: .4byte gUnk_081085A4 sub_08059E80: @ 0x08059E80 push {r4, r5, lr} adds r4, r0, #0 - bl sub_0805EABC + bl DoesSimilarEntityExist cmp r0, #0 beq _08059E90 bl DeleteThisEntity diff --git a/asm/manager15.s b/asm/manager15.s index 0106e9d8..84043eef 100644 --- a/asm/manager15.s +++ b/asm/manager15.s @@ -152,7 +152,7 @@ sub_0805A394: @ 0x0805A394 movs r0, #3 movs r1, #0x13 movs r2, #4 - bl sub_0805EB00 + bl FindEntityInListBySubtype cmp r0, #0 beq _0805A3AA ldrb r0, [r0, #0xa] diff --git a/asm/manager16.s b/asm/manager16.s index 58f8404c..551ddbc1 100644 --- a/asm/manager16.s +++ b/asm/manager16.s @@ -114,7 +114,7 @@ _0805AC1A: ands r0, r1 cmp r0, #0 beq _0805ACA6 - ldr r0, _0805AC5C @ =gUnk_03003DBC + ldr r0, _0805AC5C @ =gEntCount ldrb r0, [r0] cmp r0, #0x46 bhi _0805ACA6 @@ -140,7 +140,7 @@ _0805AC48: bl CreateNPC b _0805AC6A .align 2, 0 -_0805AC5C: .4byte gUnk_03003DBC +_0805AC5C: .4byte gEntCount _0805AC60: ldrb r0, [r4] ldrb r1, [r4, #1] diff --git a/asm/manager1A.s b/asm/manager1A.s index 11c578a6..82586617 100644 --- a/asm/manager1A.s +++ b/asm/manager1A.s @@ -456,7 +456,7 @@ _0805B38C: .4byte 0x0000FFF7 sub_0805B390: @ 0x0805B390 push {r4, lr} adds r4, r0, #0 - bl sub_0805E8D4 + bl GetEmptyManager adds r1, r0, #0 cmp r1, #0 beq _0805B3B0 @@ -467,7 +467,7 @@ sub_0805B390: @ 0x0805B390 strb r4, [r1, #0xa] adds r0, r1, #0 movs r1, #6 - bl sub_0805EA2C + bl AppendEntityToList _0805B3B0: pop {r4, pc} .align 2, 0 diff --git a/asm/manager1B.s b/asm/manager1B.s index e3626e3d..c591eaa4 100644 --- a/asm/manager1B.s +++ b/asm/manager1B.s @@ -10,7 +10,7 @@ sub_0805B3B4: @ 0x0805B3B4 push {r4, r5, lr} adds r4, r0, #0 - bl sub_0805EABC + bl DoesSimilarEntityExist cmp r0, #0 beq _0805B3C4 bl DeleteThisEntity diff --git a/asm/manager1E.s b/asm/manager1E.s index 153adc0b..36bd3e55 100644 --- a/asm/manager1E.s +++ b/asm/manager1E.s @@ -45,7 +45,7 @@ sub_0805B680: @ 0x0805B680 cmp r0, #0 beq _0805B6B8 adds r0, r4, #0 - bl sub_0805E900 + bl DeleteManager b _0805B6BE _0805B6B8: adds r0, r4, #0 @@ -72,7 +72,7 @@ sub_0805B6C0: @ 0x0805B6C0 cmp r0, #0 bne _0805B6F2 adds r0, r4, #0 - bl sub_0805E900 + bl DeleteManager b _0805B6F2 _0805B6EC: ldrh r0, [r4, #0x3e] diff --git a/asm/manager20.s b/asm/manager20.s index e7ab8cbf..77f6e5b0 100644 --- a/asm/manager20.s +++ b/asm/manager20.s @@ -67,7 +67,7 @@ _0805B7FC: adds r0, r0, r1 strh r0, [r4, #0x32] adds r0, r5, #0 - bl sub_0805E900 + bl DeleteManager _0805B81A: pop {r4, r5, pc} .align 2, 0 diff --git a/asm/manager22.s b/asm/manager22.s index af6900a2..fb9246b5 100644 --- a/asm/manager22.s +++ b/asm/manager22.s @@ -281,7 +281,7 @@ sub_0805BB00: @ 0x0805BB00 ldrb r0, [r0, #0xc] cmp r0, #0 bne _0805BB28 - bl sub_0805E8D4 + bl GetEmptyManager adds r1, r0, #0 cmp r1, #0 beq _0805BB28 @@ -291,7 +291,7 @@ sub_0805BB00: @ 0x0805BB00 strb r0, [r1, #9] adds r0, r1, #0 movs r1, #0 - bl sub_0805EA2C + bl AppendEntityToList _0805BB28: ldr r1, _0805BB54 @ =0x0600F000 movs r2, #0x80 @@ -342,7 +342,7 @@ _0805BB82: strh r1, [r2, #0xc] movs r0, #9 movs r1, #0x22 - bl sub_0805EB9C + bl FindEntityBySubtype cmp r0, #0 beq _0805BBAE bl sub_0805B8EC diff --git a/asm/manager24.s b/asm/manager24.s index 33f7ad45..8718bf74 100644 --- a/asm/manager24.s +++ b/asm/manager24.s @@ -50,7 +50,7 @@ sub_0805BF30: @ 0x0805BF30 adds r0, r4, #0 bl sub_0805C02C adds r0, r4, #0 - bl sub_0805E900 + bl DeleteManager _0805BF74: pop {r4, pc} .align 2, 0 @@ -91,7 +91,7 @@ sub_0805BFA4: @ 0x0805BFA4 movs r0, #0x72 bl PlaySFX adds r0, r4, #0 - bl sub_0805E900 + bl DeleteManager _0805BFC0: pop {r4, pc} .align 2, 0 diff --git a/asm/manager26.s b/asm/manager26.s index 7aab3755..7e21f1dd 100644 --- a/asm/manager26.s +++ b/asm/manager26.s @@ -30,7 +30,7 @@ sub_0805C6D0: @ 0x0805C6D0 cmp r4, #0 bne _0805C6EA adds r0, r5, #0 - bl sub_0805E900 + bl DeleteManager b _0805C79A _0805C6EA: ldr r3, _0805C784 @ =gRoomControls diff --git a/asm/manager28.s b/asm/manager28.s index 2c6d28e3..acbf9d14 100644 --- a/asm/manager28.s +++ b/asm/manager28.s @@ -42,7 +42,7 @@ _0805C962: adds r5, r0, #0 cmp r5, #1 ble _0805C9A8 - bl sub_0805E8D4 + bl GetEmptyManager adds r2, r0, #0 cmp r2, #0 beq _0805C9A8 @@ -64,10 +64,10 @@ _0805C962: stm r1!, {r3, r5} adds r0, r2, #0 movs r1, #6 - bl sub_0805EA2C + bl AppendEntityToList _0805C9A8: adds r0, r4, #0 - bl sub_0805E900 + bl DeleteManager b _0805C9B8 _0805C9B0: movs r1, #0 diff --git a/asm/manager29.s b/asm/manager29.s index 955eaf6a..c87bd2dd 100644 --- a/asm/manager29.s +++ b/asm/manager29.s @@ -22,7 +22,7 @@ sub_0805CB90: @ 0x0805CB90 adds r0, r4, #0 bl sub_0805CC3C adds r0, r4, #0 - bl sub_0805E900 + bl DeleteManager b _0805CBCE _0805CBB8: adds r0, r4, #0 @@ -32,7 +32,7 @@ _0805CBB8: ldrh r0, [r4, #0x3e] bl SetFlag adds r0, r4, #0 - bl sub_0805E900 + bl DeleteManager _0805CBCE: pop {r4, pc} diff --git a/asm/manager2B.s b/asm/manager2B.s index ed785d35..4320672d 100644 --- a/asm/manager2B.s +++ b/asm/manager2B.s @@ -33,7 +33,7 @@ sub_0805D02C: @ 0x0805D02C beq _0805D046 bl DeleteThisEntity _0805D046: - ldr r0, _0805D0BC @ =gUnk_03003DBC + ldr r0, _0805D0BC @ =gEntCount ldrb r0, [r0] cmp r0, #0x43 bhi _0805D0B0 @@ -91,7 +91,7 @@ _0805D0B0: mov sl, r5 pop {r4, r5, r6, r7, pc} .align 2, 0 -_0805D0BC: .4byte gUnk_03003DBC +_0805D0BC: .4byte gEntCount _0805D0C0: .4byte gRoomControls thumb_func_start sub_0805D0C4 @@ -138,7 +138,7 @@ sub_0805D0FC: @ 0x0805D0FC ldrh r0, [r4, #0x3e] bl SetFlag adds r0, r4, #0 - bl sub_0805E900 + bl DeleteManager _0805D118: pop {r4, pc} .align 2, 0 diff --git a/asm/manager2D.s b/asm/manager2D.s index 374004d2..5fd4ed29 100644 --- a/asm/manager2D.s +++ b/asm/manager2D.s @@ -37,7 +37,7 @@ sub_0805D1FC: @ 0x0805D1FC bl UpdateSpriteForCollisionLayer _0805D236: adds r0, r4, #0 - bl sub_0805E900 + bl DeleteManager pop {r4, r5, pc} .align 2, 0 _0805D240: .4byte 0x00004014 diff --git a/asm/manager32.s b/asm/manager32.s index 755c5750..eb82a823 100644 --- a/asm/manager32.s +++ b/asm/manager32.s @@ -412,7 +412,7 @@ sub_0805DA90: @ 0x0805DA90 push {r4, r5, lr} adds r5, r0, #0 adds r4, r1, #0 - bl sub_0805E8D4 + bl GetEmptyManager adds r1, r0, #0 cmp r1, #0 beq _0805DAB4 @@ -424,7 +424,7 @@ sub_0805DA90: @ 0x0805DA90 str r5, [r1, #0x14] adds r0, r1, #0 movs r1, #8 - bl sub_0805EA2C + bl AppendEntityToList _0805DAB4: ldr r0, _0805DAD8 @ =gArea ldr r1, _0805DADC @ =0x0000088C @@ -439,7 +439,7 @@ _0805DAB4: strh r0, [r2] bl sub_080528F0 ldr r0, [r4] - bl sub_0805E900 + bl DeleteManager _0805DAD4: pop {r4, r5, pc} .align 2, 0 diff --git a/asm/manager36.s b/asm/manager36.s index 49cdac68..4c768dcc 100644 --- a/asm/manager36.s +++ b/asm/manager36.s @@ -43,7 +43,7 @@ _0805DDE8: sub_0805DDEC: @ 0x0805DDEC push {r4, r5, lr} adds r5, r1, #0 - bl sub_0805E8D4 + bl GetEmptyManager adds r4, r0, #0 cmp r4, #0 beq _0805DE16 @@ -55,7 +55,7 @@ sub_0805DDEC: @ 0x0805DDEC strb r0, [r4, #0xa] adds r0, r4, #0 movs r1, #6 - bl sub_0805EA2C + bl AppendEntityToList adds r0, r4, #0 movs r1, #6 bl sub_0805E3A0 @@ -72,10 +72,10 @@ sub_0805DE18: @ 0x0805DE18 movs r0, #9 movs r1, #0x36 movs r2, #6 - bl sub_0805EB2C + bl FindEntityInListByForm cmp r0, #0 beq _0805DE34 - bl sub_0805E79C + bl DeleteEntityAny _0805DE34: add sp, #4 pop {pc} diff --git a/asm/manager5.s b/asm/manager5.s index 69557a43..0a6c1d56 100644 --- a/asm/manager5.s +++ b/asm/manager5.s @@ -111,7 +111,7 @@ _08057B6A: bne _08057B6A _08057B94: adds r0, r5, #0 - bl sub_0805E900 + bl DeleteManager _08057B9A: pop {r4, r5, pc} .align 2, 0 @@ -238,7 +238,7 @@ _08057C88: bl PlaySFX _08057C96: adds r0, r4, #0 - bl sub_0805E900 + bl DeleteManager _08057C9C: pop {r4, pc} .align 2, 0 diff --git a/asm/managerB.s b/asm/managerB.s index 6e6d4cd0..58d1be89 100644 --- a/asm/managerB.s +++ b/asm/managerB.s @@ -199,7 +199,7 @@ _0805875C: sub_08058760: @ 0x08058760 push {r4, r5, lr} adds r5, r0, #0 - bl sub_0805E8D4 + bl GetEmptyManager adds r4, r0, #0 cmp r4, #0 beq _08058794 @@ -219,7 +219,7 @@ sub_08058760: @ 0x08058760 bl _DmaZero adds r0, r4, #0 movs r1, #8 - bl sub_0805EA2C + bl AppendEntityToList _08058794: adds r0, r4, #0 pop {r4, r5, pc} diff --git a/asm/managerD.s b/asm/managerD.s index b8ce9ae1..77df8bf6 100644 --- a/asm/managerD.s +++ b/asm/managerD.s @@ -82,6 +82,6 @@ sub_08058E34: @ 0x08058E34 bl LoadRoomEntityList _08058E58: adds r0, r4, #0 - bl sub_0805E900 + bl DeleteManager _08058E5E: pop {r4, pc} diff --git a/asm/managerF.s b/asm/managerF.s index b975e239..93add104 100644 --- a/asm/managerF.s +++ b/asm/managerF.s @@ -158,7 +158,7 @@ _08058FE2: cmp r0, #0 beq _08059060 adds r0, r4, #0 - bl sub_0805E900 + bl DeleteManager b _08059060 _08058FF6: ldrh r0, [r4, #0x3e] @@ -272,7 +272,7 @@ _080590CC: ldr r0, _080590DC @ =gUnk_080F4B88 bl LoadRoomEntityList adds r0, r4, #0 - bl sub_0805E900 + bl DeleteManager _080590D8: pop {r4, r5, pc} .align 2, 0 @@ -492,7 +492,7 @@ sub_08059278: @ 0x08059278 movs r0, #9 movs r1, #0xf movs r2, #6 - bl sub_0805EB00 + bl FindEntityInListBySubtype cmp r0, #0 beq _0805928C bl sub_08058ECC diff --git a/asm/mazaalBracelet.s b/asm/mazaalBracelet.s index 95170d28..b24cfa78 100644 --- a/asm/mazaalBracelet.s +++ b/asm/mazaalBracelet.s @@ -164,7 +164,7 @@ _0803A270: .4byte gUnk_080CFC3C sub_0803A274: @ 0x0803A274 push {r4, lr} adds r4, r0, #0 - ldr r0, _0803A2C8 @ =gUnk_03003DBC + ldr r0, _0803A2C8 @ =gEntCount ldrb r0, [r0] cmp r0, #0x44 bhi _0803A360 @@ -200,7 +200,7 @@ sub_0803A274: @ 0x0803A274 bl PositionRelative b _0803A310 .align 2, 0 -_0803A2C8: .4byte gUnk_03003DBC +_0803A2C8: .4byte gEntCount _0803A2CC: movs r0, #0x38 movs r1, #1 diff --git a/asm/mazaalHead.s b/asm/mazaalHead.s index 93f4a365..55f5764a 100644 --- a/asm/mazaalHead.s +++ b/asm/mazaalHead.s @@ -70,7 +70,7 @@ _08033F38: .4byte gUnk_080CECB4 sub_08033F3C: @ 0x08033F3C push {r4, r5, lr} adds r4, r0, #0 - ldr r0, _08033F64 @ =gUnk_03003DBC + ldr r0, _08033F64 @ =gEntCount ldrb r0, [r0] cmp r0, #0x42 bhi _08033FFA @@ -87,7 +87,7 @@ sub_08033F3C: @ 0x08033F3C strb r0, [r1] b _08033F70 .align 2, 0 -_08033F64: .4byte gUnk_03003DBC +_08033F64: .4byte gEntCount _08033F68: .4byte gScreenTransition _08033F6C: movs r0, #1 diff --git a/asm/mazaalMacro.s b/asm/mazaalMacro.s index 5d4ff187..063718d6 100644 --- a/asm/mazaalMacro.s +++ b/asm/mazaalMacro.s @@ -566,14 +566,14 @@ sub_08035084: @ 0x08035084 ldrb r0, [r0, #0xa] cmp r0, #0 bne _08035118 - ldr r0, _080350A0 @ =gUnk_03003DBC + ldr r0, _080350A0 @ =gEntCount ldrb r0, [r0] cmp r0, #0x42 bls _080350A4 movs r0, #0 b _0803511A .align 2, 0 -_080350A0: .4byte gUnk_03003DBC +_080350A0: .4byte gEntCount _080350A4: ldr r4, _080350D8 @ =gUnk_030010D8 _080350A6: diff --git a/asm/moldorm.s b/asm/moldorm.s index f511004c..24d0838f 100644 --- a/asm/moldorm.s +++ b/asm/moldorm.s @@ -127,7 +127,7 @@ sub_08022C58: @ 0x08022C58 movs r0, #0x7f ands r0, r1 strb r0, [r7, #0x10] - ldr r0, _08022D3C @ =gUnk_03003DBC + ldr r0, _08022D3C @ =gEntCount ldrb r0, [r0] cmp r0, #0x44 bhi _08022D34 @@ -226,7 +226,7 @@ _08022D34: mov sb, r4 pop {r4, r5, r6, r7, pc} .align 2, 0 -_08022D3C: .4byte gUnk_03003DBC +_08022D3C: .4byte gEntCount thumb_func_start sub_08022D40 sub_08022D40: @ 0x08022D40 diff --git a/asm/moldworm.s b/asm/moldworm.s index 5b914aa5..943cf3e1 100644 --- a/asm/moldworm.s +++ b/asm/moldworm.s @@ -221,7 +221,7 @@ nullsub_135: @ 0x080231B8 sub_080231BC: @ 0x080231BC push {r4, r5, r6, lr} adds r6, r0, #0 - ldr r0, _08023280 @ =gUnk_03003DBC + ldr r0, _08023280 @ =gEntCount ldrb r0, [r0] cmp r0, #0x3f bhi _0802327E @@ -308,7 +308,7 @@ sub_080231BC: @ 0x080231BC _0802327E: pop {r4, r5, r6, pc} .align 2, 0 -_08023280: .4byte gUnk_03003DBC +_08023280: .4byte gEntCount thumb_func_start nullsub_136 nullsub_136: @ 0x08023284 diff --git a/asm/non_matching/acroBandits/sub_08031C58.inc b/asm/non_matching/acroBandits/sub_08031C58.inc index 1c641ec3..8d93c546 100644 --- a/asm/non_matching/acroBandits/sub_08031C58.inc +++ b/asm/non_matching/acroBandits/sub_08031C58.inc @@ -18,7 +18,7 @@ lsrs r2, r0, #0x18 cmp r2, #0 beq _08031D54 - ldr r0, _08031D50 @ =gUnk_03003DBC + ldr r0, _08031D50 @ =gEntCount ldrb r0, [r0] cmp r0, #0x42 bhi _08031D66 @@ -115,7 +115,7 @@ bl InitializeAnimation b _08031D66 .align 2, 0 -_08031D50: .4byte gUnk_03003DBC +_08031D50: .4byte gEntCount _08031D54: movs r0, #1 ands r0, r1 diff --git a/asm/non_matching/slime/sub_080450A8.inc b/asm/non_matching/slime/sub_080450A8.inc index d8226a90..2190a864 100644 --- a/asm/non_matching/slime/sub_080450A8.inc +++ b/asm/non_matching/slime/sub_080450A8.inc @@ -18,7 +18,7 @@ ldrb r7, [r0] movs r0, #0x48 subs r0, r0, r7 - ldr r1, _08045170 @ =gUnk_03003DBC + ldr r1, _08045170 @ =gEntCount ldrb r1, [r1] cmp r0, r1 ble _08045160 @@ -104,6 +104,6 @@ _08045160: pop {r4, r5, r6, r7, pc} .align 2, 0 _0804516C: .4byte gUnk_080D16D0 -_08045170: .4byte gUnk_03003DBC +_08045170: .4byte gEntCount _08045174: .4byte gUnk_080D16D4 .syntax divided \ No newline at end of file diff --git a/asm/object3E.s b/asm/object3E.s index 16fea14e..1a988dca 100644 --- a/asm/object3E.s +++ b/asm/object3E.s @@ -247,7 +247,7 @@ sub_0808D280: @ 0x0808D280 movs r1, #0x3e movs r2, #6 movs r3, #9 - bl sub_0805EB2C + bl FindEntityInListByForm adds r2, r0, #0 cmp r2, #0 beq _0808D2C4 @@ -287,7 +287,7 @@ sub_0808D2CC: @ 0x0808D2CC movs r1, #0x3e movs r2, #6 movs r3, #1 - bl sub_0805EB2C + bl FindEntityInListByForm adds r1, r0, #0 cmp r1, #0 beq _0808D2F2 diff --git a/asm/object6A.s b/asm/object6A.s index 938eb239..dedb6152 100644 --- a/asm/object6A.s +++ b/asm/object6A.s @@ -235,7 +235,7 @@ sub_08094BE0: @ 0x08094BE0 movs r1, #0x6a movs r2, #6 movs r3, #0x22 - bl sub_0805EB2C + bl FindEntityInListByForm adds r4, r0, #0 cmp r4, #0 beq _08094C22 @@ -390,7 +390,7 @@ sub_08094D10: @ 0x08094D10 movs r1, #0x6a movs r2, #6 movs r3, #3 - bl sub_0805EB2C + bl FindEntityInListByForm adds r1, r0, #0 cmp r1, #0 beq _08094D2E @@ -442,7 +442,7 @@ sub_08094D70: @ 0x08094D70 movs r1, #0x6a movs r2, #6 movs r3, #0x15 - bl sub_0805EB2C + bl FindEntityInListByForm adds r1, r0, #0 cmp r1, #0 beq _08094D8E @@ -527,7 +527,7 @@ sub_08094E0C: @ 0x08094E0C movs r1, #0x6a movs r2, #6 movs r3, #4 - bl sub_0805EB2C + bl FindEntityInListByForm adds r1, r0, #0 cmp r1, #0 beq _08094E2A @@ -951,7 +951,7 @@ sub_08095164: @ 0x08095164 movs r1, #0x6a movs r2, #6 movs r3, #8 - bl sub_0805EB2C + bl FindEntityInListByForm cmp r0, #0 beq _08095182 movs r1, #3 @@ -2103,7 +2103,7 @@ sub_08095A68: @ 0x08095A68 movs r1, #0x6a movs r2, #6 movs r3, #0x16 - bl sub_0805EB2C + bl FindEntityInListByForm adds r1, r0, #0 cmp r1, #0 beq _08095A86 diff --git a/asm/object97.s b/asm/object97.s index 0e88f13d..f90fc4ea 100644 --- a/asm/object97.s +++ b/asm/object97.s @@ -62,7 +62,7 @@ sub_0809D9D8: @ 0x0809D9D8 bl InitAnimationForceUpdate adds r0, r4, #0 movs r1, #6 - bl sub_0805EB64 + bl FindNextEntityOfSameSubtype cmp r0, #0 beq _0809DA1E str r4, [r0, #0x50] @@ -436,7 +436,7 @@ sub_0809DC80: @ 0x0809DC80 bl InitAnimationForceUpdate adds r0, r4, #0 movs r1, #6 - bl sub_0805EB64 + bl FindNextEntityOfSameSubtype cmp r0, #0 beq _0809DD00 str r4, [r0, #0x50] @@ -740,7 +740,7 @@ _0809DF16: bl CopyPosition _0809DF52: adds r0, r5, #0 - bl sub_0805E79C + bl DeleteEntityAny movs r0, #0 str r0, [r4, #0x54] b _0809DF98 diff --git a/asm/object98.s b/asm/object98.s index 99e1d8ab..d72bf8b0 100644 --- a/asm/object98.s +++ b/asm/object98.s @@ -35,7 +35,7 @@ _0809E372: ldrb r2, [r4, #0xe] movs r0, #0x48 subs r0, r0, r2 - ldr r1, _0809E3E0 @ =gUnk_03003DBC + ldr r1, _0809E3E0 @ =gEntCount ldrb r1, [r1] cmp r0, r1 ble _0809E3D8 @@ -86,7 +86,7 @@ _0809E3D8: mov r8, r3 pop {r4, r5, r6, r7, pc} .align 2, 0 -_0809E3E0: .4byte gUnk_03003DBC +_0809E3E0: .4byte gEntCount thumb_func_start sub_0809E3E4 sub_0809E3E4: @ 0x0809E3E4 diff --git a/asm/objectA5.s b/asm/objectA5.s index 44f9c50e..9e86a2bd 100644 --- a/asm/objectA5.s +++ b/asm/objectA5.s @@ -13,7 +13,7 @@ ObjectA5: @ 0x0809F8A4 mov r7, r8 push {r7} adds r6, r0, #0 - ldr r0, _0809F904 @ =gUnk_03003DBC + ldr r0, _0809F904 @ =gEntCount ldrb r0, [r0] cmp r0, #0x42 bhi _0809F8FC @@ -58,4 +58,4 @@ _0809F8FC: mov r8, r3 pop {r4, r5, r6, r7, pc} .align 2, 0 -_0809F904: .4byte gUnk_03003DBC +_0809F904: .4byte gEntCount diff --git a/asm/objectB9.s b/asm/objectB9.s index 43f746d3..1a600eb6 100644 --- a/asm/objectB9.s +++ b/asm/objectB9.s @@ -222,7 +222,7 @@ _080A1392: cmp r1, #0 beq _080A13A6 adds r0, r1, #0 - bl sub_0805E79C + bl DeleteEntityAny _080A13A6: subs r6, #1 adds r5, #1 @@ -475,7 +475,7 @@ sub_080A1550: @ 0x080A1550 cmp r0, #0 bne _080A1582 adds r0, r4, #0 - bl sub_0805E79C + bl DeleteEntityAny b _080A15FE _080A1582: mov r0, r8 diff --git a/asm/objectBA.s b/asm/objectBA.s index 07f407a3..b55d3613 100644 --- a/asm/objectBA.s +++ b/asm/objectBA.s @@ -40,7 +40,7 @@ sub_080A1704: @ 0x080A1704 beq _080A171E bl DeleteThisEntity _080A171E: - ldr r0, _080A1828 @ =gUnk_03003DBC + ldr r0, _080A1828 @ =gEntCount ldrb r0, [r0] cmp r0, #0x45 bhi _080A181C @@ -169,7 +169,7 @@ _080A181C: mov sl, r5 pop {r4, r5, r6, r7, pc} .align 2, 0 -_080A1828: .4byte gUnk_03003DBC +_080A1828: .4byte gEntCount _080A182C: .4byte gRoomControls _080A1830: .4byte gScreen _080A1834: .4byte 0x00001E07 diff --git a/asm/pesto.s b/asm/pesto.s index e5c6ca52..80a94b95 100644 --- a/asm/pesto.s +++ b/asm/pesto.s @@ -1666,7 +1666,7 @@ _08024BA0: movs r0, #8 movs r1, #2 movs r2, #2 - bl sub_0805EB00 + bl FindEntityInListBySubtype adds r4, r0, #0 cmp r4, #0 beq _08024BF0 @@ -1676,7 +1676,7 @@ _08024BA0: _08024BB6: adds r0, r4, #0 movs r1, #2 - bl sub_0805EB64 + bl FindNextEntityOfSameSubtype adds r4, r0, #0 cmp r4, #0 beq _08024BF0 @@ -1708,7 +1708,7 @@ _08024BF0: movs r0, #6 movs r1, #5 movs r2, #6 - bl sub_0805EB00 + bl FindEntityInListBySubtype adds r4, r0, #0 cmp r4, #0 beq _08024C3C @@ -1718,7 +1718,7 @@ _08024BF0: _08024C0A: adds r0, r4, #0 movs r1, #6 - bl sub_0805EB64 + bl FindNextEntityOfSameSubtype adds r4, r0, #0 cmp r4, #0 beq _08024C3C diff --git a/asm/pina.s b/asm/pina.s index 7697a309..80d77d98 100644 --- a/asm/pina.s +++ b/asm/pina.s @@ -235,7 +235,7 @@ sub_08063C14: @ 0x08063C14 push {lr} movs r0, #7 movs r1, #0x14 - bl sub_0805EB9C + bl FindEntityBySubtype cmp r0, #0 beq _08063C28 movs r1, #8 @@ -249,7 +249,7 @@ sub_08063C2C: @ 0x08063C2C push {lr} movs r0, #7 movs r1, #0x14 - bl sub_0805EB9C + bl FindEntityBySubtype cmp r0, #0 beq _08063C40 movs r1, #4 @@ -263,7 +263,7 @@ sub_08063C44: @ 0x08063C44 push {lr} movs r0, #7 movs r1, #0x14 - bl sub_0805EB9C + bl FindEntityBySubtype cmp r0, #0 beq _08063C58 movs r1, #0 @@ -277,7 +277,7 @@ sub_08063C5C: @ 0x08063C5C push {lr} movs r0, #7 movs r1, #0x14 - bl sub_0805EB9C + bl FindEntityBySubtype cmp r0, #0 beq _08063C70 movs r1, #9 @@ -291,7 +291,7 @@ sub_08063C74: @ 0x08063C74 push {lr} movs r0, #7 movs r1, #0x14 - bl sub_0805EB9C + bl FindEntityBySubtype cmp r0, #0 beq _08063C8C movs r2, #0x18 diff --git a/asm/pullableLever.s b/asm/pullableLever.s index c3092d74..93c1257d 100644 --- a/asm/pullableLever.s +++ b/asm/pullableLever.s @@ -73,7 +73,7 @@ _08091260: sub_08091264: @ 0x08091264 push {r4, r5, r6, r7, lr} adds r6, r0, #0 - ldr r0, _080912C4 @ =gUnk_03003DBC + ldr r0, _080912C4 @ =gEntCount ldrb r0, [r0] cmp r0, #0x45 bhi _0809132C @@ -117,7 +117,7 @@ sub_08091264: @ 0x08091264 ldr r0, _080912C8 @ =gUnk_080FD278 b _080912CE .align 2, 0 -_080912C4: .4byte gUnk_03003DBC +_080912C4: .4byte gEntCount _080912C8: .4byte gUnk_080FD278 _080912CC: ldr r0, _08091330 @ =gUnk_080FD270 diff --git a/asm/rem.s b/asm/rem.s index 8e31e8c7..aff7c85d 100644 --- a/asm/rem.s +++ b/asm/rem.s @@ -928,7 +928,7 @@ _0806AAD8: str r6, [r0] adds r0, r6, #0 movs r1, #7 - bl sub_0805EA78 + bl PrependEntityToList movs r0, #0xc0 lsls r0, r0, #9 str r0, [r6, #0x20] @@ -938,7 +938,7 @@ _0806AAEE: adds r0, #0xac ldr r0, [r0] movs r1, #7 - bl sub_0805EB64 + bl FindNextEntityOfSameSubtype adds r1, r0, #0 adds r0, r4, #0 adds r0, #0xb0 @@ -948,7 +948,7 @@ _0806AB02: adds r0, #0xb0 ldr r0, [r0] movs r1, #7 - bl sub_0805EB64 + bl FindNextEntityOfSameSubtype adds r1, r0, #0 mov r0, r8 adds r0, #0xb4 @@ -1041,7 +1041,7 @@ sub_0806AB9C: @ 0x0806AB9C movs r1, #0x37 movs r2, #7 movs r3, #1 - bl sub_0805EB2C + bl FindEntityInListByForm cmp r0, #0 beq _0806ABBC bl DeleteEntity diff --git a/asm/sub_080A276C.s b/asm/sub_080A276C.s index 9eac5420..26ffa208 100644 --- a/asm/sub_080A276C.s +++ b/asm/sub_080A276C.s @@ -29,10 +29,10 @@ sub_080A276C: @ 0x080A276C str r5, [r6, #0x50] adds r0, r6, #0 movs r1, #6 - bl sub_0805EA2C + bl AppendEntityToList adds r0, r6, #0 movs r1, #6 - bl sub_0805EA78 + bl PrependEntityToList ldr r4, _080A2828 @ =gPlayerEntity adds r0, r4, #0 adds r1, r6, #0 diff --git a/asm/vaatiArm.s b/asm/vaatiArm.s index fcbaf7fa..3324c7ec 100644 --- a/asm/vaatiArm.s +++ b/asm/vaatiArm.s @@ -2531,7 +2531,7 @@ sub_080437DC: @ 0x080437DC mov r7, r8 push {r7} adds r6, r0, #0 - ldr r0, _0804392C @ =gUnk_03003DBC + ldr r0, _0804392C @ =gEntCount ldrb r0, [r0] cmp r0, #0x43 bls _080437EE @@ -2688,7 +2688,7 @@ _080437FC: movs r0, #1 b _08043936 .align 2, 0 -_0804392C: .4byte gUnk_03003DBC +_0804392C: .4byte gEntCount _08043930: .4byte gUnk_080D135C _08043934: movs r0, #0 diff --git a/asm/vaatiEyesMacro.s b/asm/vaatiEyesMacro.s index 4e3d3252..650c360c 100644 --- a/asm/vaatiEyesMacro.s +++ b/asm/vaatiEyesMacro.s @@ -161,11 +161,11 @@ _0802ED88: .4byte gUnk_080CDE5C sub_0802ED8C: @ 0x0802ED8C push {r4, lr} adds r4, r0, #0 - ldr r0, _0802EDD0 @ =gUnk_03003DBC + ldr r0, _0802EDD0 @ =gEntCount ldrb r0, [r0] cmp r0, #0x46 bhi _0802EE0A - bl sub_0805E8D4 + bl GetEmptyManager adds r1, r0, #0 cmp r1, #0 beq _0802EE0A @@ -176,7 +176,7 @@ sub_0802ED8C: @ 0x0802ED8C str r4, [r1, #0x14] adds r0, r1, #0 movs r1, #8 - bl sub_0805EA2C + bl AppendEntityToList movs r0, #0x25 movs r1, #2 bl CreateEnemy @@ -191,7 +191,7 @@ sub_0802ED8C: @ 0x0802ED8C adds r0, #0x3a b _0802EDE0 .align 2, 0 -_0802EDD0: .4byte gUnk_03003DBC +_0802EDD0: .4byte gEntCount _0802EDD4: .4byte gRoomControls _0802EDD8: .4byte gScreenTransition _0802EDDC: @@ -246,7 +246,7 @@ _0802EE34: .4byte gUnk_080CDE64 sub_0802EE38: @ 0x0802EE38 push {r4, r5, lr} adds r5, r0, #0 - ldr r0, _0802EE84 @ =gUnk_03003DBC + ldr r0, _0802EE84 @ =gEntCount ldrb r0, [r0] cmp r0, #0x46 bhi _0802EE82 @@ -280,7 +280,7 @@ sub_0802EE38: @ 0x0802EE38 _0802EE82: pop {r4, r5, pc} .align 2, 0 -_0802EE84: .4byte gUnk_03003DBC +_0802EE84: .4byte gEntCount _0802EE88: .4byte gUnk_080CDE6C thumb_func_start sub_0802EE8C diff --git a/asm/vaatiRebornEnemy.s b/asm/vaatiRebornEnemy.s index 83d5f0c1..235a04ad 100644 --- a/asm/vaatiRebornEnemy.s +++ b/asm/vaatiRebornEnemy.s @@ -82,7 +82,7 @@ _0803D146: bne _0803D158 b _0803D25A _0803D158: - ldr r0, _0803D25C @ =gUnk_03003DBC + ldr r0, _0803D25C @ =gEntCount ldrb r0, [r0] cmp r0, #0x41 bhi _0803D25A @@ -210,7 +210,7 @@ _0803D210: _0803D25A: pop {r4, r5, r6, pc} .align 2, 0 -_0803D25C: .4byte gUnk_03003DBC +_0803D25C: .4byte gEntCount _0803D260: .4byte gUnk_080D04A8 thumb_func_start sub_0803D264 diff --git a/asm/vaatiTransfigured.s b/asm/vaatiTransfigured.s index adec010a..be7920c3 100644 --- a/asm/vaatiTransfigured.s +++ b/asm/vaatiTransfigured.s @@ -102,7 +102,7 @@ sub_0803F818: @ 0x0803F818 bl CheckRoomFlag cmp r0, #0 beq _0803F910 - ldr r0, _0803F8FC @ =gUnk_03003DBC + ldr r0, _0803F8FC @ =gEntCount ldrb r0, [r0] cmp r0, #0x50 bhi _0803F910 @@ -204,7 +204,7 @@ _0803F8E0: strb r6, [r0, #0xe] b _0803F902 .align 2, 0 -_0803F8FC: .4byte gUnk_03003DBC +_0803F8FC: .4byte gEntCount _0803F900: strb r1, [r0, #0xe] _0803F902: @@ -1424,7 +1424,7 @@ _08040212: movs r1, #4 orrs r0, r1 strb r0, [r2] - ldr r0, _08040264 @ =gUnk_03003DBC + ldr r0, _08040264 @ =gEntCount ldrb r0, [r0] cmp r0, #0x45 bhi _08040260 @@ -1453,7 +1453,7 @@ _08040212: _08040260: pop {r4, r5, pc} .align 2, 0 -_08040264: .4byte gUnk_03003DBC +_08040264: .4byte gEntCount thumb_func_start sub_08040268 sub_08040268: @ 0x08040268 @@ -1883,7 +1883,7 @@ _08040582: movs r0, #0x7f ands r0, r1 strb r0, [r2] - ldr r0, _080405D0 @ =gUnk_03003DBC + ldr r0, _080405D0 @ =gEntCount ldrb r0, [r0] cmp r0, #0x46 bhi _080405A8 @@ -1912,7 +1912,7 @@ _080405C4: _080405CC: pop {r4, pc} .align 2, 0 -_080405D0: .4byte gUnk_03003DBC +_080405D0: .4byte gEntCount _080405D4: .4byte 0x00000149 thumb_func_start sub_080405D8 diff --git a/asm/vaatiWrath.s b/asm/vaatiWrath.s index 0c7960ff..46a98812 100644 --- a/asm/vaatiWrath.s +++ b/asm/vaatiWrath.s @@ -1277,7 +1277,7 @@ sub_08041D14: @ 0x08041D14 .align 2, 0 _08041D3C: .4byte gTextBox _08041D40: - ldr r0, _08041D80 @ =gUnk_03003DBC + ldr r0, _08041D80 @ =gEntCount ldrb r0, [r0] cmp r0, #0x45 bhi _08041D7C @@ -1307,7 +1307,7 @@ _08041D40: _08041D7C: pop {r4, r5, pc} .align 2, 0 -_08041D80: .4byte gUnk_03003DBC +_08041D80: .4byte gEntCount thumb_func_start sub_08041D84 sub_08041D84: @ 0x08041D84 @@ -1485,7 +1485,7 @@ _08041ED0: .4byte gUnk_080D0E90 sub_08041ED4: @ 0x08041ED4 push {r4, r5, lr} adds r5, r0, #0 - ldr r0, _08041F14 @ =gUnk_03003DBC + ldr r0, _08041F14 @ =gEntCount ldrb r0, [r0] cmp r0, #0x45 bhi _08041F18 @@ -1513,7 +1513,7 @@ sub_08041ED4: @ 0x08041ED4 movs r0, #1 b _08041F1A .align 2, 0 -_08041F14: .4byte gUnk_03003DBC +_08041F14: .4byte gEntCount _08041F18: movs r0, #0 _08041F1A: @@ -1523,7 +1523,7 @@ _08041F1A: sub_08041F1C: @ 0x08041F1C push {r4, lr} adds r4, r0, #0 - ldr r0, _08041F6C @ =gUnk_03003DBC + ldr r0, _08041F6C @ =gEntCount ldrb r0, [r0] cmp r0, #0x43 bhi _08041F70 @@ -1558,7 +1558,7 @@ sub_08041F1C: @ 0x08041F1C movs r0, #1 b _08041F72 .align 2, 0 -_08041F6C: .4byte gUnk_03003DBC +_08041F6C: .4byte gEntCount _08041F70: movs r0, #0 _08041F72: @@ -1569,14 +1569,14 @@ sub_08041F74: @ 0x08041F74 push {r4, r5, r6, r7, lr} adds r5, r0, #0 adds r6, r1, #0 - ldr r0, _08041F88 @ =gUnk_03003DBC + ldr r0, _08041F88 @ =gEntCount ldrb r0, [r0] cmp r0, #0x46 bls _08041F8C movs r0, #0 b _08041FC8 .align 2, 0 -_08041F88: .4byte gUnk_03003DBC +_08041F88: .4byte gEntCount _08041F8C: ldr r7, [r5, #0x64] movs r4, #0 @@ -1616,7 +1616,7 @@ _08041FC8: sub_08041FCC: @ 0x08041FCC push {r4, lr} adds r4, r0, #0 - ldr r0, _08041FFC @ =gUnk_03003DBC + ldr r0, _08041FFC @ =gEntCount ldrb r0, [r0] cmp r0, #0x4c bhi _08042000 @@ -1635,7 +1635,7 @@ sub_08041FCC: @ 0x08041FCC movs r0, #1 b _08042002 .align 2, 0 -_08041FFC: .4byte gUnk_03003DBC +_08041FFC: .4byte gEntCount _08042000: movs r0, #0 _08042002: diff --git a/include/entity.h b/include/entity.h index 5eaa1f2f..36b02000 100644 --- a/include/entity.h +++ b/include/entity.h @@ -26,8 +26,8 @@ typedef struct { } BoundingBox; typedef struct Entity { - /*0x00*/ struct Entity* field_0x0; - /*0x04*/ struct Entity* field_0x4; + /*0x00*/ struct Entity* prev; + /*0x04*/ struct Entity* next; /*0x08*/ EntityType entityType; /*0x0c*/ u8 action; /*0x0d*/ u8 previousActionFlag; diff --git a/include/functions.h b/include/functions.h index 41da17db..30576777 100644 --- a/include/functions.h +++ b/include/functions.h @@ -71,8 +71,8 @@ extern u32 sub_0806F5A4(u32); extern void sub_08078784(Entity*, u32); extern void sub_0807DD50(Entity*); extern void sub_0807DD94(Entity*, u32); -extern Entity* sub_0805EB00(u32, u32, u32); -extern Entity* sub_0805EB2C(u32, u32, u32, u32, u32); +extern Entity* FindEntityInListBySubtype(u32, u32, u32); +extern Entity* FindEntityInListByForm(u32, u32, u32, u32, u32); extern s32 sub_0806ED9C(Entity*, u32, u32); extern void sub_0807000C(Entity*); extern void sub_0805E47C(Entity*); @@ -196,8 +196,8 @@ extern u32 sub_0807953C(void); extern void ResetPlayer(void); extern void sub_080A29BC(Entity*); extern void sub_080AE068(Entity*); -extern Entity* sub_0805E8D4(void); -extern void sub_0805EA2C(Entity*, u32); +extern Entity* GetEmptyManager(void); +extern void AppendEntityToList(Entity*, u32); extern u32 sub_0800445C(Entity*); extern void sub_0807A108(void); extern void sub_0801766C(Entity*); diff --git a/include/greatFairy.h b/include/greatFairy.h index 517db168..317bbf49 100644 --- a/include/greatFairy.h +++ b/include/greatFairy.h @@ -19,9 +19,9 @@ extern u32 sub_080045D4(); extern void sub_0806F69C(); extern u32 Random(); extern void sub_0805E3A0(Entity*, u32); -extern Entity* sub_0805EB00(u32, u32, u32); +extern Entity* FindEntityInListBySubtype(u32, u32, u32); extern void sub_080791D0(); -extern u32 sub_0805EB2C(u32, u32, u32, u32, u32); +extern u32 FindEntityInListByForm(u32, u32, u32, u32, u32); extern void (*const GreatFairy_Main[])(Entity*); extern void (*const GreatFairy_Behaviors[])(Entity*); extern void (*const GreatFairy_WingsBehaviors[])(Entity*); diff --git a/linker.ld b/linker.ld index c8153286..48165919 100644 --- a/linker.ld +++ b/linker.ld @@ -135,7 +135,7 @@ SECTIONS { . = 0x000350F0; gUnk_020350F0 = .; . = 0x00035160; gUnk_02035160 = .; . = 0x000354B0; gUnk_020354B0 = .; - . = 0x000354B4; gUnk_020354B4 = .; + . = 0x000354B4; gManagerCount = .; . = 0x000354C0; gUnk_020354C0 = .; . = 0x0003553E; gUnk_0203553E = .; . = 0x00035540; gUnk_02035540 = .; @@ -189,14 +189,14 @@ SECTIONS { . = 0x00003BE0; gUnk_03003BE0 = .; . = 0x00003C70; gUnk_03003C70 = .; . = 0x00003D68; gUnk_03003D68 = .; - . = 0x00003D70; gUnk_03003D70 = .; + . = 0x00003D70; gEntityLists = .; . = 0x00003D80; gUnk_03003D80 = .; . = 0x00003D90; gUnk_03003D90 = .; . = 0x00003DA0; gUnk_03003DA0 = .; . = 0x00003DA8; gUnk_03003DA8 = .; . = 0x00003DB0; gUnk_03003DB0 = .; . = 0x00003DB8; gUnk_03003DB8 = .; - . = 0x00003DBC; gUnk_03003DBC = .; + . = 0x00003DBC; gEntCount = .; . = 0x00003DC0; gUnk_03003DC0 = .; . = 0x00003DD0; gUnk_03003DD0 = .; . = 0x00003DE0; gUnk_03003DE0 = .; diff --git a/src/code_08077B98.c b/src/code_08077B98.c index cf2b3b2c..b0d62afc 100644 --- a/src/code_08077B98.c +++ b/src/code_08077B98.c @@ -17,7 +17,7 @@ Entity* sub_08077C94(ItemBehavior*, u32); void* sub_08077C54(UnkItemStruct* unk); Entity* CreatePlayerBomb(ItemBehavior*, u32); extern Entity* sub_0805E744(); -extern void sub_0805EA2C(Entity*, u32); +extern void AppendEntityToList(Entity*, u32); extern struct_0811BE48 gUnk_0811BE48[]; @@ -84,7 +84,7 @@ void* sub_08077C54(UnkItemStruct* unk) item->flags = 0xa0; item->parent = (Entity*)unk; item->field_0x68.HALF.LO = unk->field_0x1; - sub_0805EA2C(item, 2); + AppendEntityToList(item, 2); } return item; } @@ -93,7 +93,7 @@ Entity* sub_08077C94(ItemBehavior* arg0, u32 arg1) { Entity* iVar1; - iVar1 = sub_0805EB00(8, gUnk_0811BE48[arg1].unk[3], 2); + iVar1 = FindEntityInListBySubtype(8, gUnk_0811BE48[arg1].unk[3], 2); if (iVar1 == NULL) { return NULL; } @@ -112,7 +112,7 @@ Entity * CreatePlayerItem(u32 subtype, u32 form, u32 parameter, u32 unk) (ent->entityType).form = form; (ent->entityType).parameter = parameter; ent->field_0x68.HALF.LO = unk; - sub_0805EA2C(ent, 2); + AppendEntityToList(ent, 2); } return ent; } @@ -129,7 +129,7 @@ Entity * sub_08077CF8(u32 subtype, u32 form, u32 parameter, u32 unk) (ent->entityType).form = form; (ent->entityType).parameter = parameter; ent->field_0x68.HALF.LO = unk; - sub_0805EA2C(ent, 2); + AppendEntityToList(ent, 2); } return ent; } diff --git a/src/createEnemy.c b/src/createEnemy.c index 6090da14..3b243e79 100644 --- a/src/createEnemy.c +++ b/src/createEnemy.c @@ -2,7 +2,7 @@ #include "global.h" extern Entity* GetEmptyEntity(); -extern void sub_0805EA2C(Entity*, u8); +extern void AppendEntityToList(Entity*, u8); Entity* CreateEnemy(u32 subtype, u32 form) { Entity* enemy; @@ -12,7 +12,7 @@ Entity* CreateEnemy(u32 subtype, u32 form) { (enemy->entityType).type = 3; (enemy->entityType).subtype = subtype; (enemy->entityType).form = form; - sub_0805EA2C(enemy, 4); + AppendEntityToList(enemy, 4); } return enemy; } diff --git a/src/createEntity.c b/src/createEntity.c index 9d597c4c..7bcb0bea 100644 --- a/src/createEntity.c +++ b/src/createEntity.c @@ -2,8 +2,8 @@ // #include "entityData.h" // #include "global.h" -// extern Entity * sub_0805EB9C(u32, u32); -// extern Entity * sub_0805E768(); +// extern Entity * FindEntityBySubtype(u32, u32); +// extern Entity * GetEmptyEntityAny(); // extern void sub_0804AEB0(Entity *, EntityData *); // extern u32 sub_0804AF0C(Entity *, EntityData *); // extern void sub_08016A30(Entity *); @@ -17,11 +17,11 @@ // type = param_1->entityType & 15; // if (((param_1->field_0x1 & 240) == 80) && -// (preexisting = sub_0805EB9C(type,param_1->entitySubtype), preexisting != NULL)) { +// (preexisting = FindEntityBySubtype(type,param_1->entitySubtype), preexisting != NULL)) { // entity = NULL; // } // else { -// entity = sub_0805E768(); //Get empty entity +// entity = GetEmptyEntityAny(); //Get empty entity // if (entity != NULL) { // (entity->entityType).type = type; // (entity->entityType).subtype = param_1->entitySubtype; diff --git a/src/createNPC.c b/src/createNPC.c index e7f0783d..3e11ba91 100644 --- a/src/createNPC.c +++ b/src/createNPC.c @@ -2,7 +2,7 @@ #include "entity.h" extern Entity* GetEmptyEntity(); -extern void sub_0805EA2C(Entity*, u8); +extern void AppendEntityToList(Entity*, u8); Entity* CreateNPC(u32 subtype, u32 form, u32 parameter) @@ -15,7 +15,7 @@ Entity* CreateNPC(u32 subtype, u32 form, u32 parameter) (pEVar1->entityType).subtype = subtype; (pEVar1->entityType).form = form; (pEVar1->entityType).parameter = parameter; - sub_0805EA2C(pEVar1, 7); + AppendEntityToList(pEVar1, 7); } return pEVar1; } diff --git a/src/createObject.c b/src/createObject.c index db13f173..93db1d93 100644 --- a/src/createObject.c +++ b/src/createObject.c @@ -2,7 +2,7 @@ #include "entity.h" extern Entity* GetEmptyEntity(); -extern void sub_0805EA2C(Entity*, u8); +extern void AppendEntityToList(Entity*, u8); Entity* CreateObject(u32 subtype, u32 param1, u32 param2) @@ -15,7 +15,7 @@ Entity* CreateObject(u32 subtype, u32 param1, u32 param2) (newEnt->entityType).subtype = subtype; (newEnt->entityType).form = param1; (newEnt->entityType).parameter = param2; - sub_0805EA2C(newEnt, 6); + AppendEntityToList(newEnt, 6); } return newEnt; } diff --git a/src/enemy/acroBandits.c b/src/enemy/acroBandits.c index b183b93f..5bfe5e01 100644 --- a/src/enemy/acroBandits.c +++ b/src/enemy/acroBandits.c @@ -21,7 +21,7 @@ extern void SetChildOffset(Entity*, s32, s32, s32); extern u32 Random(void); extern Entity* gUnk_020000B0; -extern u8 gUnk_03003DBC; +extern u8 gEntCount; extern void (*const gUnk_080012C8[])(Entity*); extern void (*const gUnk_080CE56C[])(Entity*); extern void (*const gUnk_080CE584[])(Entity*); @@ -216,7 +216,7 @@ void sub_08031C58(Entity* this) { GetNextFrame(this); if (this->frames.b.f3) { - if (gUnk_03003DBC < 0x43) { + if (gEntCount < 0x43) { tmp = Random(); tmp &= 3; diff --git a/src/enemy/rupeeLike.c b/src/enemy/rupeeLike.c index 714d3788..7a021657 100644 --- a/src/enemy/rupeeLike.c +++ b/src/enemy/rupeeLike.c @@ -205,7 +205,7 @@ void sub_08029660(Entity* this) { } void sub_08029688(Entity* this) { - if (this->parent->field_0x4 == NULL) { + if (this->parent->next == NULL) { DeleteEntity(this); } } diff --git a/src/entity.c b/src/entity.c index cae8ee22..0f7f16d3 100644 --- a/src/entity.c +++ b/src/entity.c @@ -10,36 +10,33 @@ typedef struct OtherEntity { extern Entity gUnk_030011E8[7]; -Entity* sub_0805E744(void) - -{ +Entity* sub_0805E744(void) { Entity* ent = gUnk_030011E8; do { - if (ent->field_0x0 == NULL) { + if (ent->prev == NULL) { return ent; } - } while (ent++, ent < &gUnk_030011E8[7]); + } while (++ent < &gUnk_030011E8[7]); return NULL; } extern Entity* GetEmptyEntity(); -OtherEntity* sub_0805E8D4(); +OtherEntity* GetEmptyManager(); typedef void* (*Getter)(void); -void* sub_0805E768(int type) - -{ +void* GetEmptyEntityAny(int type) { Getter getter = NULL; if (type == 9) { - getter = (Getter)sub_0805E8D4; + getter = (Getter)GetEmptyManager; } else { getter = (Getter)GetEmptyEntity; } return getter(); } + typedef struct { int field_0x0; int field_0x4; @@ -50,27 +47,23 @@ typedef struct { extern struct_03003DD0 gUnk_03003DD0; extern u32 _call_via_r0(u32*); extern u32 gUnk_03005F24; -extern void sub_0805E79C(Entity*); +extern void DeleteEntityAny(Entity*); -void DeleteThisEntity(void) - -{ - sub_0805E79C(gUnk_03003DD0.field_0x8); +void DeleteThisEntity(void) { + DeleteEntityAny(gUnk_03003DD0.field_0x8); _call_via_r0((u32*)&gUnk_03005F24); return; } void DeleteEntity(Entity*); -void sub_0805E900(OtherEntity*); +void DeleteManager(OtherEntity*); typedef void (*Deleter)(void*); -void sub_0805E79C(Entity* ent) - -{ +void DeleteEntityAny(Entity* ent) { Deleter deleter = NULL; if (ent->entityType.type == 9) { - deleter = (Deleter)sub_0805E900; + deleter = (Deleter)DeleteManager; } else { deleter = (Deleter)DeleteEntity; } @@ -89,12 +82,10 @@ extern void sub_0807DB08(); extern void sub_0806FBEC(); extern void sub_0801DA0C(); extern void sub_0804AA1C(); -extern void sub_0805EA98(); // Unlink +extern void UnlinkEntity(); // Unlink -void DeleteEntity(Entity* ent) - -{ - if (ent->field_0x4) { +void DeleteEntity(Entity* ent) { + if (ent->next) { sub_080AE068(ent); sub_0801D230(ent); sub_0806FE84(ent); @@ -107,7 +98,7 @@ void DeleteEntity(Entity* ent) sub_0806FBEC(ent); sub_0801DA0C(ent->otherEntity); ent->otherEntity = NULL; - if ((ent->entityType).type == '\x03') { + if ((ent->entityType).type == 3) { sub_0804AA1C(ent); } ent->flags = ent->flags & 0x7f; @@ -116,68 +107,60 @@ void DeleteEntity(Entity* ent) ent->bitfield = 0; ent->field_0x42 = 0; ent->currentHealth = 0; - sub_0805EA98(ent); - ent->field_0x4 = NULL; - ent->field_0x0 = (Entity*)0xffffffff; + UnlinkEntity(ent); + ent->next = NULL; + ent->prev = (Entity*)0xffffffff; } } extern Entity gPlayerEntity; -void sub_0805E870(Entity*); +void ClearDeletedEntity(Entity*); -void sub_0805E84C(void) - -{ +void ClearAllDeletedEntities(void) { Entity* ent = &gPlayerEntity; do { - if ((int)ent->field_0x0 < 0) { - sub_0805E870(ent); + if ((int)ent->prev < 0) { + ClearDeletedEntity(ent); } } while (ent++, ent < (&gPlayerEntity + 80)); return; } -extern u8 gUnk_03003DBC; +extern u8 gEntCount; -void sub_0805E870(Entity* ent) - -{ +void ClearDeletedEntity(Entity* ent) { DmaClear32(3, ent, sizeof(Entity)); - gUnk_03003DBC--; + gEntCount--; } -typedef struct struct_03003D70 { - void* field_0x0; - void* field_0x4; -} struct_03003D70; +typedef struct LinkedList { + Entity* last; + Entity* first; +} LinkedList; -extern struct_03003D70 gUnk_03003D70[9]; +extern LinkedList gEntityLists[9]; extern EntityType gUnk_03003DB8; -void sub_0805E89C(void) - -{ +void sub_0805E89C(void) { Entity* ent; Entity* next; - struct_03003D70* it; + LinkedList* it; - it = gUnk_03003D70; - if (it->field_0x4) { + it = &gEntityLists[0]; + if (it->first) { do { - for (ent = it->field_0x4; (u32)ent != (u32)it; ent = next) { - next = ent->field_0x4; - sub_0805E79C(ent); + for (ent = it->first; (u32)ent != (u32)it; ent = next) { + next = ent->next; + DeleteEntityAny(ent); } - } while (it++, it < (gUnk_03003D70 + 9)); - sub_0805E84C(); + } while (++it < &gEntityLists[9]); + ClearAllDeletedEntities(); } } extern OtherEntity gUnk_02033290; -OtherEntity* sub_0805E8D4(void) - -{ +OtherEntity* GetEmptyManager(void) { OtherEntity* it; for (it = &gUnk_02033290; it < (&gUnk_02033290 + 32); it++) { if (it->prev == 0) { @@ -188,25 +171,21 @@ OtherEntity* sub_0805E8D4(void) } extern void _DmaZero(void*, u32); -extern u8 gUnk_020354B4; +extern u8 gManagerCount; -void sub_0805E900(OtherEntity* ent) - -{ +void DeleteManager(OtherEntity* ent) { if (!ent->next) return; sub_0805E92C(ent); - sub_0805EA98(ent); - _DmaZero(ent, 0x40); - gUnk_020354B4--; + UnlinkEntity(ent); + _DmaZero(ent, sizeof(OtherEntity)); + gManagerCount--; } #include "area.h" -void sub_0805E92C(u32 param_1) - -{ +void sub_0805E92C(u32 param_1) { if (param_1 == gArea.unk2) { gArea.unk2 = 0; gArea.unk3 = 0; @@ -218,206 +197,175 @@ extern Entity gUnk_020369F0; extern void sub_0801D66C(const void* src, void* dest, size_t size); // dma copy extern void sub_0805E98C(void); -void sub_0805E958(void) - -{ - sub_0801D66C(&gUnk_03003D70, &gUnk_020369F0, 0x48); +void sub_0805E958(void) { + sub_0801D66C(&gEntityLists, &gUnk_020369F0, 0x48); sub_0805E98C(); } -void sub_0805E974(void) - -{ - sub_0801D66C(&gUnk_020369F0, &gUnk_03003D70, 0x48); +void sub_0805E974(void) { + sub_0801D66C(&gUnk_020369F0, &gEntityLists, 0x48); } -void sub_0805E98C(void) +void sub_0805E98C(void) { + LinkedList* list; -{ - struct_03003D70* it; - - for (it = gUnk_03003D70; it < &gUnk_03003D70[9]; it++) { - it->field_0x0 = it; - it->field_0x4 = (Entity*)it; + for (list = gEntityLists; list < &gEntityLists[9]; list++) { + list->last = (Entity*)list; + list->first = (Entity*)list; } } -void sub_0805E9A8(void) +void sub_0805E9A8(void) { + Entity* i; + LinkedList* list; -{ - Entity* entry; - struct_03003D70* it; - - it = gUnk_03003D70; + list = &gEntityLists[0]; do { - for (entry = it->field_0x4; (u32)entry != (u32)it; entry = entry->field_0x4) { - entry->flags &= 0xfd; - if ((entry->flags & 0x20) == 0) { - entry->flags |= 0x10; + for (i = list->first; (u32)i != (u32)list; i = i->next) { + i->flags &= 0xfd; + if ((i->flags & 0x20) == 0) { + i->flags |= 0x10; } } - } while (it++, it < (gUnk_03003D70 + 9)); + } while (++list < &gEntityLists[9]); } -void sub_0805E9F4(void) - -{ +void sub_0805E9F4(void) { Entity* ent; Entity* next; - struct_03003D70* it; + LinkedList* list; - it = gUnk_03003D70; + list = &gEntityLists[0]; do { - for (ent = it->field_0x4; (u32)ent != (u32)it; ent = next) { - next = ent->field_0x4; + for (ent = list->first; (u32)ent != (u32)list; ent = next) { + next = ent->next; if (ent->flags & 0x10) - sub_0805E79C(ent); + DeleteEntityAny(ent); } - } while (it++, it < (gUnk_03003D70 + 9)); + } while (++list < &gEntityLists[9]); } extern void sub_0805E374(Entity*); -void sub_0805EA2C(Entity* ent, int kind) +void AppendEntityToList(Entity* ent, int listIndex) { + LinkedList* list; -{ - Entity* prev; - struct_03003D70* next; - - next = (gUnk_03003D70 + kind); - ent->field_0x4 = (Entity*)next; - prev = next->field_0x0; - ent->field_0x0 = prev; - prev->field_0x4 = ent; - next->field_0x0 = ent; + list = &gEntityLists[listIndex]; + ent->next = (Entity*)list; + ent->prev = list->last; + list->last->next = ent; + list->last = ent; if (ent->entityType.type != 9) { ent->spritePriority.b0 = 4; - gUnk_03003DBC++; + gEntCount++; } else { - gUnk_020354B4++; + gManagerCount++; } sub_0805E374(ent); } -void sub_0805EA78(Entity* ent, int kind) +void PrependEntityToList(Entity* ent, int listIndex) { + LinkedList* list; -{ - struct_03003D70* it; - - sub_0805EA98(ent); - it = &gUnk_03003D70[kind]; - ent->field_0x0 = (Entity*)it; - ent->field_0x4 = it->field_0x4; - ((Entity*)it->field_0x4)->field_0x0 = ent; - it->field_0x4 = ent; + UnlinkEntity(ent); + list = &gEntityLists[listIndex]; + ent->prev = (Entity*)list; + ent->next = list->first; + list->first->prev = ent; + list->first = ent; } -void sub_0805EA98(Entity* ent) - -{ +void UnlinkEntity(Entity* ent) { if (ent == gUnk_03003DD0.field_0x8) { - gUnk_03003DD0.field_0x8 = ent->field_0x0; + gUnk_03003DD0.field_0x8 = ent->prev; } - ent->field_0x0->field_0x4 = ent->field_0x4; - ent->field_0x4->field_0x0 = ent->field_0x0; + ent->prev->next = ent->next; + ent->next->prev = ent->prev; } -int sub_0805EABC(Entity* ent) +bool32 DoesSimilarEntityExist(Entity* ent) { + Entity* i; + LinkedList* list; -{ - Entity* ent2; - struct_03003D70 *it, *end; - - it = gUnk_03003D70; - end = (gUnk_03003D70 + 9); + list = &gEntityLists[0]; do { - for (ent2 = (Entity*)it->field_0x4; (u32)ent2 != (u32)it; ent2 = ent2->field_0x4) { - if ((u32)ent2 != (u32)ent && ent2->entityType.type == ent->entityType.type && - ent2->entityType.subtype == ent->entityType.subtype) { - return 1; + for (i = list->first; (u32)i != (u32)list; i = i->next) { + if ((u32)i != (u32)ent && i->entityType.type == ent->entityType.type && + i->entityType.subtype == ent->entityType.subtype) { + return TRUE; } } - } while (it++, it < end); + } while (++list < &gEntityLists[9]); - return 0; + return FALSE; } -Entity* sub_0805EB00(int type, int subtype, int kind) - -{ +Entity* FindEntityInListBySubtype(int type, int subtype, int listIndex) { Entity* it; - struct_03003D70* node; + LinkedList* list; - node = &gUnk_03003D70[kind]; - for (it = node->field_0x4; (u32)it != (u32)node; it = it->field_0x4) { + list = &gEntityLists[listIndex]; + for (it = list->first; (u32)it != (u32)list; it = it->next) { if (type == it->entityType.type && subtype == it->entityType.subtype) return it; } return NULL; } -Entity* sub_0805EB2C(int type, int subtype, int kind, int form, int parameter) +Entity* FindEntityInListByForm(int type, int subtype, int listIndex, int form, int parameter) { + Entity* i; + LinkedList* list; -{ - Entity* it; - struct_03003D70* node; - - node = &gUnk_03003D70[kind]; - node = &gUnk_03003D70[kind]; - for (it = node->field_0x4; (u32)it != (u32)node; it = it->field_0x4) { - if (type == it->entityType.type && subtype == it->entityType.subtype && form == it->entityType.form && - parameter == it->entityType.parameter) - return it; + list = &gEntityLists[listIndex]; + for (i = list->first; (u32)i != (u32)list; i = i->next) { + if (type == i->entityType.type + && subtype == i->entityType.subtype + && form == i->entityType.form + && parameter == i->entityType.parameter) + return i; } return NULL; } -Entity* sub_0805EB64(Entity* ent, int kind) +Entity* FindNextEntityOfSameSubtype(Entity* ent, int listIndex) { + Entity* i; + LinkedList* list; -{ - Entity* it; - struct_03003D70* end; - - end = &gUnk_03003D70[kind]; - for (it = ent->field_0x4; (u32)it != (u32)end; it = it->field_0x4) { - if (it->entityType.type == ent->entityType.type && it->entityType.subtype == ent->entityType.subtype) - return it; + list = &gEntityLists[listIndex]; + for (i = ent->next; (u32)i != (u32)list; i = i->next) { + if (i->entityType.type == ent->entityType.type && i->entityType.subtype == ent->entityType.subtype) + return i; } return NULL; } -Entity* sub_0805EB9C(int type, int subtype) +Entity* FindEntityBySubtype(int type, int subtype) { + Entity* i; + LinkedList* list; -{ - Entity* it2; - struct_03003D70 *it, *end; - - it = gUnk_03003D70; - end = (gUnk_03003D70 + 9); + list = &gEntityLists[0]; do { - for (it2 = (Entity*)it->field_0x4; (u32)it2 != (u32)it; it2 = it2->field_0x4) { - if ((type == (it2->entityType).type) && (subtype == (it2->entityType).subtype)) - return it2; + for (i = (Entity*)list->first; (u32)i != (u32)list; i = i->next) { + if ((type == (i->entityType).type) && (subtype == (i->entityType).subtype)) + return i; } - } while (it++, it < end); + } while (++list < &gEntityLists[9]); - return 0; + return NULL; } -void sub_0805EBCC(void) - -{ +void DeleteAllEnemies(void) { Entity* ent; Entity* next; - struct_03003D70* it; + LinkedList* list; - it = gUnk_03003D70; + list = &gEntityLists[0]; do { - for (ent = it->field_0x4; (u32)ent != (u32)it; ent = next) { - next = ent->field_0x4; + for (ent = list->first; (u32)ent != (u32)list; ent = next) { + next = ent->next; if (ent->entityType.type == 3) DeleteEntity(ent); } - } while (it++, it < (gUnk_03003D70 + 9)); - sub_0805E84C(); + } while (++list < &gEntityLists[9]); + ClearAllDeletedEntities(); } diff --git a/src/initializePlayer.c b/src/initializePlayer.c index 589d550e..f9993ef3 100644 --- a/src/initializePlayer.c +++ b/src/initializePlayer.c @@ -63,6 +63,6 @@ void InitializePlayer(void) pl->animationState = gScreenTransition.playerState; pl->collisionLayer = gScreenTransition.playerLayer; UpdateSpriteForCollisionLayer(pl); - sub_0805EA2C(pl, 1); + AppendEntityToList(pl, 1); sub_08017640(); } \ No newline at end of file diff --git a/src/manager/manager4.c b/src/manager/manager4.c index 1473aa61..2b0ddd3d 100644 --- a/src/manager/manager4.c +++ b/src/manager/manager4.c @@ -98,7 +98,7 @@ u32 sub_0805795C(Manager* this, DiggingCaveEntrance* entr) { #endif extern void sub_0805E5A8(void); -extern void sub_0805E900(Manager*); +extern void DeleteManager(Manager*); extern void sub_08080930(); void sub_08057A18(Manager* this, DiggingCaveEntrance* entr) { @@ -121,7 +121,7 @@ void sub_08057A18(Manager* this, DiggingCaveEntrance* entr) { gUnk_03004030.unk_0b = entr->target_roomID | 0x80; } sub_08080930(entr->unk_03); - sub_0805E900(this); + DeleteManager(this); } DiggingCaveEntrance* sub_08057AA8(DiggingCaveEntrance* entr, int roomID){ diff --git a/src/manager/manager6.c b/src/manager/manager6.c index 7914a224..be4530ad 100644 --- a/src/manager/manager6.c +++ b/src/manager/manager6.c @@ -6,7 +6,7 @@ extern void* GetCurrentRoomProperty(u8); extern u32 CheckPlayerInRegion(u16, u16, u8, u8); extern void DoExitTransition(void*); -extern void sub_0805E900(Entity*); +extern void DeleteManager(Entity*); void sub_08057CB4(Entity * this) { u32 tmp; @@ -15,7 +15,7 @@ void sub_08057CB4(Entity * this) { this->action = 1; this->field_0x20 = (s32) GetCurrentRoomProperty(this->entityType.form); if (this->field_0x20 == 0) { - sub_0805E900(this); + DeleteManager(this); return; } } diff --git a/src/manager/managerE.c b/src/manager/managerE.c index 52402c22..7145ad13 100644 --- a/src/manager/managerE.c +++ b/src/manager/managerE.c @@ -7,7 +7,7 @@ extern Entity* GetCurrentRoomProperty(u8); extern void LoadRoomEntityList(Entity*); extern void DeleteThisEntity(void); -extern void sub_0805E900(Manager*); +extern void DeleteManager(Manager*); extern void sub_08078A90(u32); extern void sub_08078B48(void); extern void PlaySFX(u32); @@ -16,7 +16,7 @@ void sub_08058E60(Manager* this) { if (!this->unk_0c) { this->unk_0c = 1; if (CheckFlags(this->unk_3e)) { - sub_0805E900(this); + DeleteManager(this); return; } } diff --git a/src/npc/bigGoron.c b/src/npc/bigGoron.c index e2024a25..694ec6f7 100644 --- a/src/npc/bigGoron.c +++ b/src/npc/bigGoron.c @@ -14,7 +14,7 @@ extern void sub_0807DDE4(Entity*); extern u32 Random(void); extern void PlaySFX(u32); extern void sub_0806D02C(Entity*); -extern Entity* sub_0805EB2C(u32, u32, u32, u32, u32); +extern Entity* FindEntityInListByForm(u32, u32, u32, u32, u32); void BigGoron(Entity* this) { gUnk_081140D4[this->entityType.form](this); @@ -62,7 +62,7 @@ void sub_0806CF30(Entity* this) { void sub_0806D00C(Entity* this) { Entity* pEVar1; - pEVar1 = sub_0805EB2C(7, 76, 7, 0, 0); + pEVar1 = FindEntityInListByForm(7, 76, 7, 0, 0); if (pEVar1 != NULL) { this->parent = pEVar1; } diff --git a/src/npc/forestMinish.c b/src/npc/forestMinish.c index 4fa025c6..7c2d214d 100644 --- a/src/npc/forestMinish.c +++ b/src/npc/forestMinish.c @@ -19,7 +19,7 @@ extern void sub_0807000C(Entity*); extern void sub_080042BA(Entity*, u32); extern void sub_08060158(Entity*); extern u32 CheckKinstoneFused(u32); -extern Entity* sub_0805EB00(u32, u32, u32); +extern Entity* FindEntityInListBySubtype(u32, u32, u32); extern void sub_080A29BC(Entity* parent); extern void DeleteEntity(Entity*); extern u32 Random(void); @@ -248,7 +248,7 @@ void sub_08060318(void) int i; for (i = 2; i >= 0; i--) { - ent = sub_0805EB00(8, 2, 2); + ent = FindEntityInListBySubtype(8, 2, 2); if (ent != NULL) { sub_080A29BC(ent); DeleteEntity(ent); diff --git a/src/npc/goronMerchant.c b/src/npc/goronMerchant.c index 94736676..c2d7cd03 100644 --- a/src/npc/goronMerchant.c +++ b/src/npc/goronMerchant.c @@ -94,12 +94,12 @@ void sub_08069684(void) { Entity *mgr; - if (sub_0805EB00(9, 0x31, 8) == NULL) { - mgr = sub_0805E8D4(); + if (FindEntityInListBySubtype(9, 0x31, 8) == NULL) { + mgr = GetEmptyManager(); if (mgr != NULL) { mgr->entityType.type = 9; mgr->entityType.subtype = 0x31; - sub_0805EA2C(mgr, 8); + AppendEntityToList(mgr, 8); } } } diff --git a/src/npc/guard.c b/src/npc/guard.c index 675e2cb6..42e13136 100644 --- a/src/npc/guard.c +++ b/src/npc/guard.c @@ -41,7 +41,7 @@ extern void (*const gUnk_0810F544[])(Entity*); extern void (*const gUnk_0810F550[])(Entity*); // entity count -extern u8 gUnk_03003DBC; +extern u8 gEntCount; extern SpriteLoadData gUnk_0810F524[]; extern void* gUnk_0810F6BC[]; extern ScreenTransition gScreenTransition; @@ -63,7 +63,7 @@ void sub_08063D44(Entity* this) { Entity* ent; u32 temp, idx; - if (gUnk_03003DBC > 0x46) + if (gEntCount > 0x46) return; temp = this->entityType.subtype; diff --git a/src/npc/malon.c b/src/npc/malon.c index 15b8c1f4..340e9cf7 100644 --- a/src/npc/malon.c +++ b/src/npc/malon.c @@ -57,12 +57,12 @@ void sub_08065900(Entity* this) { void sub_08065914(Entity* this) { Entity* target; - target = sub_0805EB00(7, 0x1F, 7); + target = FindEntityInListBySubtype(7, 0x1F, 7); if (target != NULL) { PositionRelative(this, target, 0x180000, -0x10000); target->parent = this; } - target = sub_0805EB00(7, 0x20, 7); + target = FindEntityInListBySubtype(7, 0x20, 7); if (target != NULL) { PositionRelative(this, target, 0x280000, 0); target->parent = this; diff --git a/src/npc/zelda.c b/src/npc/zelda.c index 03764a5e..941f96e5 100644 --- a/src/npc/zelda.c +++ b/src/npc/zelda.c @@ -4,11 +4,11 @@ #include "room.h" #include "flags.h" -extern void sub_0805EA78(Entity*, u32); +extern void PrependEntityToList(Entity*, u32); extern void sub_0805E3A0(Entity*, u32); extern void sub_0807DD50(Entity*); extern void sub_0807DD94(Entity*, u32); -extern Entity* sub_0805EB9C(u32, u32); +extern Entity* FindEntityBySubtype(u32, u32); void CopyPosition(Entity*, Entity*); void sub_08068680(Entity*, Entity*); void sub_08068694(Entity*, Entity*); @@ -34,7 +34,7 @@ void Zelda(Entity* ent) { void sub_08066CCC(Entity* ent) { ent->action = 1; ent->spriteSettings.b.draw = 1; - sub_0805EA78(ent, 7); + PrependEntityToList(ent, 7); sub_0805E3A0(ent, 2); sub_0807DD50(ent); } @@ -44,7 +44,7 @@ void sub_08066CF8(Entity* ent) { } void sub_08066D04(Entity* ent) { - ent->parent = sub_0805EB9C(7, 0x2E); + ent->parent = FindEntityBySubtype(7, 0x2E); } void sub_08066D14(Entity* ent, u32* param_2) { @@ -99,7 +99,7 @@ void sub_08066D94(Entity* ent) { void sub_08066DE4(Entity* ent) { Entity* pEVar1; - pEVar1 = sub_0805EB9C(7, 0x2E); + pEVar1 = FindEntityBySubtype(7, 0x2E); if (pEVar1 != NULL) { CopyPosition(ent, pEVar1); sub_080686C4(ent, pEVar1); diff --git a/src/object/greatFairy.c b/src/object/greatFairy.c index 5c82892a..9174ab63 100644 --- a/src/object/greatFairy.c +++ b/src/object/greatFairy.c @@ -521,7 +521,7 @@ void sub_080873FC(void) { PlaySFX(0xf7); gRoomControls.cameraTarget = NULL; - while (ent = sub_0805EB00(0x6, 0x1b, 0x6), ent != NULL) { + while (ent = FindEntityInListBySubtype(0x6, 0x1b, 0x6), ent != NULL) { DeleteEntity(ent); } } @@ -550,7 +550,7 @@ void sub_08087424(Entity* arg0, struct_08087424* arg1) { void sub_0808747C(u32 arg0, u32 arg1) { u32 iVar1; - iVar1 = sub_0805EB2C(0x6, 0xf, 0x6, 0xb, 0x0); + iVar1 = FindEntityInListByForm(0x6, 0xf, 0x6, 0xb, 0x0); if (iVar1 != 0) { iVar1 = 1; } diff --git a/src/object/object1A.c b/src/object/object1A.c index f7d9e469..91129a16 100644 --- a/src/object/object1A.c +++ b/src/object/object1A.c @@ -37,7 +37,7 @@ void sub_080869DC(Entity* ent) { void sub_08086A28(Entity* ent) { s32 iVar1; - if (ent->attachedEntity->field_0x4 == NULL) { + if (ent->attachedEntity->next == NULL) { ent->action = 2; } else { iVar1 = sub_080044EC(ent, 10240); diff --git a/src/object/object48.c b/src/object/object48.c index 7f93ea16..30ddda26 100755 --- a/src/object/object48.c +++ b/src/object/object48.c @@ -324,13 +324,13 @@ void sub_0808EBB8(Entity* this) { static Entity* sub_0808EC80(int form) { Entity* entityA = &gUnk_03003DA0; - Entity* entityB = entityA->field_0x4; + Entity* entityB = entityA->next; while (entityB != entityA) { if ((entityB->entityType.type == 0x6 && entityB->entityType.subtype == 0x48) && form == entityB->entityType.form) { return entityB; } - entityB = entityB->field_0x4; + entityB = entityB->next; } return NULL; } diff --git a/src/object/object7E.c b/src/object/object7E.c index 744a1b3d..75ff0e63 100644 --- a/src/object/object7E.c +++ b/src/object/object7E.c @@ -4,7 +4,7 @@ void Object7E(Entity *this) { - if (this->parent->field_0x4 == NULL) { + if (this->parent->next == NULL) { DeleteThisEntity(); } if (this->action == 0) { diff --git a/src/object/objectAF.c b/src/object/objectAF.c index 0415398b..382e32a3 100644 --- a/src/object/objectAF.c +++ b/src/object/objectAF.c @@ -31,7 +31,7 @@ void sub_080A05F4(Entity* this) { this->action = 2; InitializeAnimation(this, 2); } else { - if (this->parent->field_0x4 == NULL) { + if (this->parent->next == NULL) { DeleteThisEntity(); } sub_080A0640(this); diff --git a/src/sub_08070680.c b/src/sub_08070680.c index f99b745e..566bfd7b 100644 --- a/src/sub_08070680.c +++ b/src/sub_08070680.c @@ -53,7 +53,7 @@ void sub_08070698(Entity *this) sub_08079938(); gPlayerState.field_0xa8[0] = 7; sub_0807ACCC(this); - ent = sub_0805EB2C(0x6, 0xf, 0x6, 0xb, 0x0); + ent = FindEntityInListByForm(0x6, 0xf, 0x6, 0xb, 0x0); if (ent != NULL) { DeleteEntity(ent); }