From 1f56cefe8c94e2540ca8ca8d9d67ff9175fdc488 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Thu, 29 Sep 2022 19:55:38 -0400 Subject: [PATCH] Halfway match CAABox; continue CBallCamera Former-commit-id: 602109d8f0a6ca9abd7ccdacab851e6c2a777fb8 --- asm/Collision/CCollidableSphere.s | 4 +- asm/Kyoto/Math/CAABox.s | 20 -- asm/MetroidPrime/CCollisionActor.s | 4 +- asm/MetroidPrime/CGameCollision.s | 8 +- asm/MetroidPrime/CGroundMovement.s | 4 +- asm/MetroidPrime/CRagDoll.s | 8 +- asm/MetroidPrime/Cameras/CBallCamera.s | 16 +- .../Cameras/CBallCameraFailsafeState.s | 8 +- asm/MetroidPrime/Enemies/CDrone.s | 8 +- asm/MetroidPrime/Enemies/CGrenadeLauncher.s | 8 +- asm/MetroidPrime/Enemies/CMetroid.s | 8 +- .../Enemies/CMetroidPrimeEssence.s | 16 +- asm/MetroidPrime/Enemies/CParasite.s | 4 +- asm/MetroidPrime/Enemies/CTryclops.s | 16 +- asm/MetroidPrime/Enemies/CWallWalker.s | 4 +- asm/MetroidPrime/Enemies/CWarWasp.s | 8 +- asm/MetroidPrime/Player/CMorphBall.s | 40 +-- asm/MetroidPrime/Player/CPlayer.s | 12 +- asm/MetroidPrime/Weapons/CNewFlameThrower.s | 20 +- include/Collision/CCollidableSphere.hpp | 27 ++ include/Collision/CCollisionInfo.hpp | 45 ++++ include/Collision/CMaterialList.hpp | 44 ++-- include/Kyoto/Math/CAABox.hpp | 68 +++-- include/Kyoto/Math/CLine.hpp | 21 ++ include/Kyoto/Math/CLineSeg.hpp | 23 ++ include/Kyoto/Math/CPlane.hpp | 17 +- include/Kyoto/Math/CSphere.hpp | 20 ++ include/Kyoto/Math/CTransform4f.hpp | 7 +- include/Kyoto/Math/CTri.hpp | 27 ++ include/Kyoto/Math/CUnitVector3f.hpp | 19 ++ include/Kyoto/Math/CVector3f.hpp | 11 +- include/MetroidPrime/CGameCollision.hpp | 16 +- include/MetroidPrime/CStateManager.hpp | 1 + include/MetroidPrime/Cameras/CBallCamera.hpp | 24 +- include/WorldFormat/CAreaOctTree.hpp | 93 +++++++ include/WorldFormat/CCollisionSurface.hpp | 20 ++ include/WorldFormat/CMetroidAreaCollider.hpp | 68 +++++ include/rstl/reserved_vector.hpp | 2 +- libc/float.h | 4 +- src/Kyoto/Math/CAABox.cpp | 190 ++++++++++++++ src/MetroidPrime/Cameras/CBallCamera.cpp | 233 ++++++++++++++++++ 41 files changed, 1023 insertions(+), 173 deletions(-) create mode 100644 include/Collision/CCollidableSphere.hpp create mode 100644 include/Collision/CCollisionInfo.hpp create mode 100644 include/Kyoto/Math/CLine.hpp create mode 100644 include/Kyoto/Math/CLineSeg.hpp create mode 100644 include/Kyoto/Math/CSphere.hpp create mode 100644 include/Kyoto/Math/CTri.hpp create mode 100644 include/Kyoto/Math/CUnitVector3f.hpp create mode 100644 include/WorldFormat/CAreaOctTree.hpp create mode 100644 include/WorldFormat/CCollisionSurface.hpp create mode 100644 include/WorldFormat/CMetroidAreaCollider.hpp diff --git a/asm/Collision/CCollidableSphere.s b/asm/Collision/CCollidableSphere.s index 5306a31b..0ed561d8 100644 --- a/asm/Collision/CCollidableSphere.s +++ b/asm/Collision/CCollidableSphere.s @@ -7,8 +7,8 @@ lbl_ctor: .section .data .balign 8 -.global lbl_803ECAF8 -lbl_803ECAF8: +.global __vt__17CCollidableSphere +__vt__17CCollidableSphere: # ROM: 0x3E9AF8 .4byte 0 .4byte 0 diff --git a/asm/Kyoto/Math/CAABox.s b/asm/Kyoto/Math/CAABox.s index 23fa46c4..6f38b558 100644 --- a/asm/Kyoto/Math/CAABox.s +++ b/asm/Kyoto/Math/CAABox.s @@ -199,7 +199,6 @@ lbl_803373C0: /* 803373D4 00334334 7C 03 00 2E */ lwzx r0, r3, r0 /* 803373D8 00334338 7C 09 03 A6 */ mtctr r0 /* 803373DC 0033433C 4E 80 04 20 */ bctr -.global lbl_803373E0 lbl_803373E0: /* 803373E0 00334340 FC 80 F0 18 */ frsp f4, f30 /* 803373E4 00334344 D3 E1 00 50 */ stfs f31, 0x50(r1) @@ -216,7 +215,6 @@ lbl_803373E0: /* 80337410 00334370 D0 41 00 64 */ stfs f2, 0x64(r1) /* 80337414 00334374 4B FD D4 A5 */ bl Magnitude__9CVector3fCFv /* 80337418 00334378 48 00 00 F0 */ b lbl_80337508 -.global lbl_8033741C lbl_8033741C: /* 8033741C 0033437C FC 20 30 90 */ fmr f1, f6 /* 80337420 00334380 38 61 00 38 */ addi r3, r1, 0x38 @@ -233,7 +231,6 @@ lbl_8033741C: /* 8033744C 003343AC 38 61 00 48 */ addi r3, r1, 0x48 /* 80337450 003343B0 4B FD CC A5 */ bl Magnitude__9CVector2fCFv /* 80337454 003343B4 48 00 00 B4 */ b lbl_80337508 -.global lbl_80337458 lbl_80337458: /* 80337458 003343B8 38 61 00 20 */ addi r3, r1, 0x20 /* 8033745C 003343BC 4B FD CD A5 */ bl __ct__9CVector2fFff @@ -249,13 +246,11 @@ lbl_80337458: /* 80337484 003343E4 38 61 00 30 */ addi r3, r1, 0x30 /* 80337488 003343E8 4B FD CC 6D */ bl Magnitude__9CVector2fCFv /* 8033748C 003343EC 48 00 00 7C */ b lbl_80337508 -.global lbl_80337490 lbl_80337490: /* 80337490 003343F0 EC 1D 10 28 */ fsubs f0, f29, f2 /* 80337494 003343F4 FC 00 02 10 */ fabs f0, f0 /* 80337498 003343F8 FC 20 00 18 */ frsp f1, f0 /* 8033749C 003343FC 48 00 00 6C */ b lbl_80337508 -.global lbl_803374A0 lbl_803374A0: /* 803374A0 00334400 FC 40 30 90 */ fmr f2, f6 /* 803374A4 00334404 38 61 00 08 */ addi r3, r1, 8 @@ -272,19 +267,16 @@ lbl_803374A0: /* 803374D0 00334430 38 61 00 18 */ addi r3, r1, 0x18 /* 803374D4 00334434 4B FD CC 21 */ bl Magnitude__9CVector2fCFv /* 803374D8 00334438 48 00 00 30 */ b lbl_80337508 -.global lbl_803374DC lbl_803374DC: /* 803374DC 0033443C EC 1E 30 28 */ fsubs f0, f30, f6 /* 803374E0 00334440 FC 00 02 10 */ fabs f0, f0 /* 803374E4 00334444 FC 20 00 18 */ frsp f1, f0 /* 803374E8 00334448 48 00 00 20 */ b lbl_80337508 -.global lbl_803374EC lbl_803374EC: /* 803374EC 0033444C EC 1F 08 28 */ fsubs f0, f31, f1 /* 803374F0 00334450 FC 00 02 10 */ fabs f0, f0 /* 803374F4 00334454 FC 20 00 18 */ frsp f1, f0 /* 803374F8 00334458 48 00 00 10 */ b lbl_80337508 -.global lbl_803374FC lbl_803374FC: /* 803374FC 0033445C C0 22 CB 88 */ lfs f1, lbl_805AE8A8@sda21(r2) /* 80337500 00334460 48 00 00 08 */ b lbl_80337508 @@ -1008,7 +1000,6 @@ GetEdge__6CAABoxCFQ26CAABox10EBoxEdgeId: /* 80337EE8 00334E48 7C 03 00 2E */ lwzx r0, r3, r0 /* 80337EEC 00334E4C 7C 09 03 A6 */ mtctr r0 /* 80337EF0 00334E50 4E 80 04 20 */ bctr -.global lbl_80337EF4 lbl_80337EF4: /* 80337EF4 00334E54 C3 A4 00 04 */ lfs f29, 4(r4) /* 80337EF8 00334E58 38 61 01 C4 */ addi r3, r1, 0x1c4 @@ -1039,7 +1030,6 @@ lbl_80337EF4: /* 80337F5C 00334EBC D3 BF 00 1C */ stfs f29, 0x1c(r31) /* 80337F60 00334EC0 D3 FF 00 20 */ stfs f31, 0x20(r31) /* 80337F64 00334EC4 48 00 05 70 */ b lbl_803384D4 -.global lbl_80337F68 lbl_80337F68: /* 80337F68 00334EC8 C3 84 00 14 */ lfs f28, 0x14(r4) /* 80337F6C 00334ECC 38 61 01 A0 */ addi r3, r1, 0x1a0 @@ -1070,7 +1060,6 @@ lbl_80337F68: /* 80337FD0 00334F30 D3 DF 00 1C */ stfs f30, 0x1c(r31) /* 80337FD4 00334F34 D3 9F 00 20 */ stfs f28, 0x20(r31) /* 80337FD8 00334F38 48 00 04 FC */ b lbl_803384D4 -.global lbl_80337FDC lbl_80337FDC: /* 80337FDC 00334F3C C3 84 00 08 */ lfs f28, 8(r4) /* 80337FE0 00334F40 38 61 01 7C */ addi r3, r1, 0x17c @@ -1101,7 +1090,6 @@ lbl_80337FDC: /* 80338044 00334FA4 D3 BF 00 1C */ stfs f29, 0x1c(r31) /* 80338048 00334FA8 D3 9F 00 20 */ stfs f28, 0x20(r31) /* 8033804C 00334FAC 48 00 04 88 */ b lbl_803384D4 -.global lbl_80338050 lbl_80338050: /* 80338050 00334FB0 C3 84 00 08 */ lfs f28, 8(r4) /* 80338054 00334FB4 38 61 01 58 */ addi r3, r1, 0x158 @@ -1132,7 +1120,6 @@ lbl_80338050: /* 803380B8 00335018 D3 DF 00 1C */ stfs f30, 0x1c(r31) /* 803380BC 0033501C D3 9F 00 20 */ stfs f28, 0x20(r31) /* 803380C0 00335020 48 00 04 14 */ b lbl_803384D4 -.global lbl_803380C4 lbl_803380C4: /* 803380C4 00335024 C3 84 00 04 */ lfs f28, 4(r4) /* 803380C8 00335028 38 61 01 34 */ addi r3, r1, 0x134 @@ -1163,7 +1150,6 @@ lbl_803380C4: /* 8033812C 0033508C D3 9F 00 1C */ stfs f28, 0x1c(r31) /* 80338130 00335090 D3 DF 00 20 */ stfs f30, 0x20(r31) /* 80338134 00335094 48 00 03 A0 */ b lbl_803384D4 -.global lbl_80338138 lbl_80338138: /* 80338138 00335098 C3 84 00 08 */ lfs f28, 8(r4) /* 8033813C 0033509C 38 61 01 10 */ addi r3, r1, 0x110 @@ -1194,7 +1180,6 @@ lbl_80338138: /* 803381A0 00335100 D3 DF 00 1C */ stfs f30, 0x1c(r31) /* 803381A4 00335104 D3 9F 00 20 */ stfs f28, 0x20(r31) /* 803381A8 00335108 48 00 03 2C */ b lbl_803384D4 -.global lbl_803381AC lbl_803381AC: /* 803381AC 0033510C C3 84 00 14 */ lfs f28, 0x14(r4) /* 803381B0 00335110 38 61 00 EC */ addi r3, r1, 0xec @@ -1225,7 +1210,6 @@ lbl_803381AC: /* 80338214 00335174 D3 BF 00 1C */ stfs f29, 0x1c(r31) /* 80338218 00335178 D3 9F 00 20 */ stfs f28, 0x20(r31) /* 8033821C 0033517C 48 00 02 B8 */ b lbl_803384D4 -.global lbl_80338220 lbl_80338220: /* 80338220 00335180 C3 84 00 14 */ lfs f28, 0x14(r4) /* 80338224 00335184 38 61 00 C8 */ addi r3, r1, 0xc8 @@ -1256,7 +1240,6 @@ lbl_80338220: /* 80338288 003351E8 D3 DF 00 1C */ stfs f30, 0x1c(r31) /* 8033828C 003351EC D3 9F 00 20 */ stfs f28, 0x20(r31) /* 80338290 003351F0 48 00 02 44 */ b lbl_803384D4 -.global lbl_80338294 lbl_80338294: /* 80338294 003351F4 C3 84 00 10 */ lfs f28, 0x10(r4) /* 80338298 003351F8 38 61 00 A4 */ addi r3, r1, 0xa4 @@ -1287,7 +1270,6 @@ lbl_80338294: /* 803382FC 0033525C D3 9F 00 1C */ stfs f28, 0x1c(r31) /* 80338300 00335260 D3 DF 00 20 */ stfs f30, 0x20(r31) /* 80338304 00335264 48 00 01 D0 */ b lbl_803384D4 -.global lbl_80338308 lbl_80338308: /* 80338308 00335268 C3 84 00 08 */ lfs f28, 8(r4) /* 8033830C 0033526C 38 61 00 80 */ addi r3, r1, 0x80 @@ -1318,7 +1300,6 @@ lbl_80338308: /* 80338370 003352D0 D3 BF 00 1C */ stfs f29, 0x1c(r31) /* 80338374 003352D4 D3 9F 00 20 */ stfs f28, 0x20(r31) /* 80338378 003352D8 48 00 01 5C */ b lbl_803384D4 -.global lbl_8033837C lbl_8033837C: /* 8033837C 003352DC C3 84 00 10 */ lfs f28, 0x10(r4) /* 80338380 003352E0 38 61 00 5C */ addi r3, r1, 0x5c @@ -1349,7 +1330,6 @@ lbl_8033837C: /* 803383E4 00335344 D3 9F 00 1C */ stfs f28, 0x1c(r31) /* 803383E8 00335348 D3 DF 00 20 */ stfs f30, 0x20(r31) /* 803383EC 0033534C 48 00 00 E8 */ b lbl_803384D4 -.global lbl_803383F0 lbl_803383F0: /* 803383F0 00335350 C3 84 00 14 */ lfs f28, 0x14(r4) /* 803383F4 00335354 38 61 00 38 */ addi r3, r1, 0x38 diff --git a/asm/MetroidPrime/CCollisionActor.s b/asm/MetroidPrime/CCollisionActor.s index 8d1ed6c3..efff3e08 100644 --- a/asm/MetroidPrime/CCollisionActor.s +++ b/asm/MetroidPrime/CCollisionActor.s @@ -1176,8 +1176,8 @@ lbl_801A95E4: /* 801A96E0 001A6640 38 81 00 38 */ addi r4, r1, 0x38 /* 801A96E4 001A6644 90 A1 00 3C */ stw r5, 0x3c(r1) /* 801A96E8 001A6648 48 12 61 CD */ bl __ct__19CCollisionPrimitiveFRC13CMaterialList -/* 801A96EC 001A664C 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha -/* 801A96F0 001A6650 38 03 CA F8 */ addi r0, r3, lbl_803ECAF8@l +/* 801A96EC 001A664C 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha +/* 801A96F0 001A6650 38 03 CA F8 */ addi r0, r3, __vt__17CCollidableSphere@l /* 801A96F4 001A6654 90 1E 00 00 */ stw r0, 0(r30) /* 801A96F8 001A6658 D3 DE 00 10 */ stfs f30, 0x10(r30) /* 801A96FC 001A665C D3 BE 00 14 */ stfs f29, 0x14(r30) diff --git a/asm/MetroidPrime/CGameCollision.s b/asm/MetroidPrime/CGameCollision.s index 35668372..56dadcb4 100644 --- a/asm/MetroidPrime/CGameCollision.s +++ b/asm/MetroidPrime/CGameCollision.s @@ -232,9 +232,9 @@ sub_8017fb84: /* 8017FD5C 0017CCBC 38 81 00 10 */ addi r4, r1, 0x10 /* 8017FD60 0017CCC0 90 A1 00 14 */ stw r5, 0x14(r1) /* 8017FD64 0017CCC4 48 14 FB 51 */ bl __ct__19CCollisionPrimitiveFRC13CMaterialList -/* 8017FD68 0017CCC8 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha +/* 8017FD68 0017CCC8 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha /* 8017FD6C 0017CCCC 80 AD 8E 98 */ lwz r5, lbl_805A7A58@sda21(r13) -/* 8017FD70 0017CCD0 38 03 CA F8 */ addi r0, r3, lbl_803ECAF8@l +/* 8017FD70 0017CCD0 38 03 CA F8 */ addi r0, r3, __vt__17CCollidableSphere@l /* 8017FD74 0017CCD4 D3 41 01 08 */ stfs f26, 0x108(r1) /* 8017FD78 0017CCD8 38 60 00 00 */ li r3, 0 /* 8017FD7C 0017CCDC 38 80 00 01 */ li r4, 1 @@ -258,9 +258,9 @@ sub_8017fb84: /* 8017FDC4 0017CD24 91 01 00 E0 */ stw r8, 0xe0(r1) /* 8017FDC8 0017CD28 90 01 00 F0 */ stw r0, 0xf0(r1) /* 8017FDCC 0017CD2C 48 00 38 2D */ bl DetectStaticCollisionBoolean_Cached__14CGameCollisionFRC13CStateManagerR19CAreaCollisionCacheRC19CCollisionPrimitiveRC12CTransform4fRC15CMaterialFilter -/* 8017FDD0 0017CD30 3C 80 80 3F */ lis r4, lbl_803ECAF8@ha +/* 8017FDD0 0017CD30 3C 80 80 3F */ lis r4, __vt__17CCollidableSphere@ha /* 8017FDD4 0017CD34 54 60 06 3F */ clrlwi. r0, r3, 0x18 -/* 8017FDD8 0017CD38 3B A4 CA F8 */ addi r29, r4, lbl_803ECAF8@l +/* 8017FDD8 0017CD38 3B A4 CA F8 */ addi r29, r4, __vt__17CCollidableSphere@l /* 8017FDDC 0017CD3C 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha /* 8017FDE0 0017CD40 93 A1 00 F8 */ stw r29, 0xf8(r1) /* 8017FDE4 0017CD44 3B C3 97 E4 */ addi r30, r3, __vt__19CCollisionPrimitive@l diff --git a/asm/MetroidPrime/CGroundMovement.s b/asm/MetroidPrime/CGroundMovement.s index 149fe366..20d06603 100644 --- a/asm/MetroidPrime/CGroundMovement.s +++ b/asm/MetroidPrime/CGroundMovement.s @@ -2496,9 +2496,9 @@ lbl_80187C68: /* 80187CC0 00184C20 7C 64 1B 78 */ mr r4, r3 /* 80187CC4 00184C24 7E 43 93 78 */ mr r3, r18 /* 80187CC8 00184C28 48 14 7B ED */ bl __ct__19CCollisionPrimitiveFRC13CMaterialList -/* 80187CCC 00184C2C 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha +/* 80187CCC 00184C2C 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha /* 80187CD0 00184C30 D2 A1 04 94 */ stfs f21, 0x494(r1) -/* 80187CD4 00184C34 38 03 CA F8 */ addi r0, r3, lbl_803ECAF8@l +/* 80187CD4 00184C34 38 03 CA F8 */ addi r0, r3, __vt__17CCollidableSphere@l /* 80187CD8 00184C38 90 01 04 84 */ stw r0, 0x484(r1) /* 80187CDC 00184C3C D2 C1 04 98 */ stfs f22, 0x498(r1) /* 80187CE0 00184C40 D2 E1 04 9C */ stfs f23, 0x49c(r1) diff --git a/asm/MetroidPrime/CRagDoll.s b/asm/MetroidPrime/CRagDoll.s index cbd4fd60..3c854ddb 100644 --- a/asm/MetroidPrime/CRagDoll.s +++ b/asm/MetroidPrime/CRagDoll.s @@ -1470,8 +1470,8 @@ lbl_8020DBF8: /* 8020DCA0 0020AC00 38 81 00 40 */ addi r4, r1, 0x40 /* 8020DCA4 0020AC04 48 0C 1C 11 */ bl __ct__19CCollisionPrimitiveFRC13CMaterialList /* 8020DCA8 0020AC08 83 01 00 84 */ lwz r24, 0x84(r1) -/* 8020DCAC 0020AC0C 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha -/* 8020DCB0 0020AC10 38 03 CA F8 */ addi r0, r3, lbl_803ECAF8@l +/* 8020DCAC 0020AC0C 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha +/* 8020DCB0 0020AC10 38 03 CA F8 */ addi r0, r3, __vt__17CCollidableSphere@l /* 8020DCB4 0020AC14 83 21 00 88 */ lwz r25, 0x88(r1) /* 8020DCB8 0020AC18 81 81 00 8C */ lwz r12, 0x8c(r1) /* 8020DCBC 0020AC1C 3C 60 80 5A */ lis r3, sIdentity__12CTransform4f@ha @@ -1496,9 +1496,9 @@ lbl_8020DBF8: /* 8020DD08 0020AC68 91 61 00 08 */ stw r11, 8(r1) /* 8020DD0C 0020AC6C 90 01 00 0C */ stw r0, 0xc(r1) /* 8020DD10 0020AC70 4B F7 65 DD */ bl "DetectCollision_Cached_Moving__14CGameCollisionFRC13CStateManagerR19CAreaCollisionCacheRC19CCollisionPrimitiveRC12CTransform4fRC15CMaterialFilterRCQ24rstl32reserved_vector<9TUniqueId,1024>9CVector3fR9TUniqueIdR14CCollisionInfoRd" -/* 8020DD14 0020AC74 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha +/* 8020DD14 0020AC74 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha /* 8020DD18 0020AC78 88 01 01 28 */ lbz r0, 0x128(r1) -/* 8020DD1C 0020AC7C 38 83 CA F8 */ addi r4, r3, lbl_803ECAF8@l +/* 8020DD1C 0020AC7C 38 83 CA F8 */ addi r4, r3, __vt__17CCollidableSphere@l /* 8020DD20 0020AC80 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha /* 8020DD24 0020AC84 90 81 00 90 */ stw r4, 0x90(r1) /* 8020DD28 0020AC88 38 63 97 E4 */ addi r3, r3, __vt__19CCollisionPrimitive@l diff --git a/asm/MetroidPrime/Cameras/CBallCamera.s b/asm/MetroidPrime/Cameras/CBallCamera.s index 5a16652f..b103e8fa 100644 --- a/asm/MetroidPrime/Cameras/CBallCamera.s +++ b/asm/MetroidPrime/Cameras/CBallCamera.s @@ -11291,9 +11291,9 @@ lbl_8008ABF8: /* 8008AC40 00087BA0 38 81 00 20 */ addi r4, r1, 0x20 /* 8008AC44 00087BA4 C3 7F 00 08 */ lfs f27, 8(r31) /* 8008AC48 00087BA8 48 24 4C 6D */ bl __ct__19CCollisionPrimitiveFRC13CMaterialList -/* 8008AC4C 00087BAC 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha +/* 8008AC4C 00087BAC 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha /* 8008AC50 00087BB0 80 AD 84 8C */ lwz r5, lbl_805A704C@sda21(r13) -/* 8008AC54 00087BB4 38 03 CA F8 */ addi r0, r3, lbl_803ECAF8@l +/* 8008AC54 00087BB4 38 03 CA F8 */ addi r0, r3, __vt__17CCollidableSphere@l /* 8008AC58 00087BB8 D3 C1 00 D0 */ stfs f30, 0xd0(r1) /* 8008AC5C 00087BBC 38 60 00 00 */ li r3, 0 /* 8008AC60 00087BC0 38 80 00 01 */ li r4, 1 @@ -11342,9 +11342,9 @@ lbl_8008ABF8: /* 8008AD0C 00087C6C 38 E1 00 A8 */ addi r7, r1, 0xa8 /* 8008AD10 00087C70 39 01 1D 14 */ addi r8, r1, 0x1d14 /* 8008AD14 00087C74 48 0F 98 51 */ bl "DetectCollisionBoolean_Cached__14CGameCollisionFRC13CStateManagerR19CAreaCollisionCacheRC19CCollisionPrimitiveRC12CTransform4fRC15CMaterialFilterRCQ24rstl32reserved_vector<9TUniqueId,1024>" -/* 8008AD18 00087C78 3C 80 80 3F */ lis r4, lbl_803ECAF8@ha +/* 8008AD18 00087C78 3C 80 80 3F */ lis r4, __vt__17CCollidableSphere@ha /* 8008AD1C 00087C7C 54 60 06 3F */ clrlwi. r0, r3, 0x18 -/* 8008AD20 00087C80 38 84 CA F8 */ addi r4, r4, lbl_803ECAF8@l +/* 8008AD20 00087C80 38 84 CA F8 */ addi r4, r4, __vt__17CCollidableSphere@l /* 8008AD24 00087C84 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha /* 8008AD28 00087C88 90 81 00 C0 */ stw r4, 0xc0(r1) /* 8008AD2C 00087C8C 38 63 97 E4 */ addi r3, r3, __vt__19CCollisionPrimitive@l @@ -11455,8 +11455,8 @@ lbl_8008AE34: /* 8008AE9C 00087DFC C3 DF 00 08 */ lfs f30, 8(r31) /* 8008AEA0 00087E00 48 24 4A 15 */ bl __ct__19CCollisionPrimitiveFRC13CMaterialList /* 8008AEA4 00087E04 80 E1 00 54 */ lwz r7, 0x54(r1) -/* 8008AEA8 00087E08 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha -/* 8008AEAC 00087E0C 39 03 CA F8 */ addi r8, r3, lbl_803ECAF8@l +/* 8008AEA8 00087E08 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha +/* 8008AEAC 00087E0C 39 03 CA F8 */ addi r8, r3, __vt__17CCollidableSphere@l /* 8008AEB0 00087E10 80 C1 00 58 */ lwz r6, 0x58(r1) /* 8008AEB4 00087E14 80 01 00 5C */ lwz r0, 0x5c(r1) /* 8008AEB8 00087E18 38 60 00 00 */ li r3, 0 @@ -11517,9 +11517,9 @@ lbl_8008AE34: /* 8008AF94 00087EF4 39 21 00 30 */ addi r9, r1, 0x30 /* 8008AF98 00087EF8 39 41 00 10 */ addi r10, r1, 0x10 /* 8008AF9C 00087EFC 48 0F 93 51 */ bl "DetectCollision_Cached_Moving__14CGameCollisionFRC13CStateManagerR19CAreaCollisionCacheRC19CCollisionPrimitiveRC12CTransform4fRC15CMaterialFilterRCQ24rstl32reserved_vector<9TUniqueId,1024>9CVector3fR9TUniqueIdR14CCollisionInfoRd" -/* 8008AFA0 00087F00 3C 80 80 3F */ lis r4, lbl_803ECAF8@ha +/* 8008AFA0 00087F00 3C 80 80 3F */ lis r4, __vt__17CCollidableSphere@ha /* 8008AFA4 00087F04 54 60 06 3F */ clrlwi. r0, r3, 0x18 -/* 8008AFA8 00087F08 38 84 CA F8 */ addi r4, r4, lbl_803ECAF8@l +/* 8008AFA8 00087F08 38 84 CA F8 */ addi r4, r4, __vt__17CCollidableSphere@l /* 8008AFAC 00087F0C 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha /* 8008AFB0 00087F10 90 81 00 88 */ stw r4, 0x88(r1) /* 8008AFB4 00087F14 38 63 97 E4 */ addi r3, r3, __vt__19CCollisionPrimitive@l diff --git a/asm/MetroidPrime/Cameras/CBallCameraFailsafeState.s b/asm/MetroidPrime/Cameras/CBallCameraFailsafeState.s index f4669715..04b83512 100644 --- a/asm/MetroidPrime/Cameras/CBallCameraFailsafeState.s +++ b/asm/MetroidPrime/Cameras/CBallCameraFailsafeState.s @@ -786,8 +786,8 @@ lbl_8023F058: /* 8023F0C0 0023C020 C3 85 00 08 */ lfs f28, 8(r5) /* 8023F0C4 0023C024 48 09 07 F1 */ bl __ct__19CCollisionPrimitiveFRC13CMaterialList /* 8023F0C8 0023C028 80 E1 00 4C */ lwz r7, 0x4c(r1) -/* 8023F0CC 0023C02C 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha -/* 8023F0D0 0023C030 39 03 CA F8 */ addi r8, r3, lbl_803ECAF8@l +/* 8023F0CC 0023C02C 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha +/* 8023F0D0 0023C030 39 03 CA F8 */ addi r8, r3, __vt__17CCollidableSphere@l /* 8023F0D4 0023C034 80 C1 00 50 */ lwz r6, 0x50(r1) /* 8023F0D8 0023C038 80 01 00 54 */ lwz r0, 0x54(r1) /* 8023F0DC 0023C03C 38 60 00 00 */ li r3, 0 @@ -848,9 +848,9 @@ lbl_8023F058: /* 8023F1B8 0023C118 39 21 00 28 */ addi r9, r1, 0x28 /* 8023F1BC 0023C11C 39 41 00 10 */ addi r10, r1, 0x10 /* 8023F1C0 0023C120 4B F4 51 2D */ bl "DetectCollision_Cached_Moving__14CGameCollisionFRC13CStateManagerR19CAreaCollisionCacheRC19CCollisionPrimitiveRC12CTransform4fRC15CMaterialFilterRCQ24rstl32reserved_vector<9TUniqueId,1024>9CVector3fR9TUniqueIdR14CCollisionInfoRd" -/* 8023F1C4 0023C124 3C 80 80 3F */ lis r4, lbl_803ECAF8@ha +/* 8023F1C4 0023C124 3C 80 80 3F */ lis r4, __vt__17CCollidableSphere@ha /* 8023F1C8 0023C128 54 60 06 3F */ clrlwi. r0, r3, 0x18 -/* 8023F1CC 0023C12C 38 84 CA F8 */ addi r4, r4, lbl_803ECAF8@l +/* 8023F1CC 0023C12C 38 84 CA F8 */ addi r4, r4, __vt__17CCollidableSphere@l /* 8023F1D0 0023C130 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha /* 8023F1D4 0023C134 90 81 00 80 */ stw r4, 0x80(r1) /* 8023F1D8 0023C138 38 63 97 E4 */ addi r3, r3, __vt__19CCollisionPrimitive@l diff --git a/asm/MetroidPrime/Enemies/CDrone.s b/asm/MetroidPrime/Enemies/CDrone.s index 5d8cf3af..b3cfdded 100644 --- a/asm/MetroidPrime/Enemies/CDrone.s +++ b/asm/MetroidPrime/Enemies/CDrone.s @@ -697,9 +697,9 @@ lbl_8015F0B8: lbl_8015F0C0: /* 8015F0C0 0015C020 34 1E 06 90 */ addic. r0, r30, 0x690 /* 8015F0C4 0015C024 41 82 00 24 */ beq lbl_8015F0E8 -/* 8015F0C8 0015C028 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha +/* 8015F0C8 0015C028 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha /* 8015F0CC 0015C02C 34 1E 06 90 */ addic. r0, r30, 0x690 -/* 8015F0D0 0015C030 38 03 CA F8 */ addi r0, r3, lbl_803ECAF8@l +/* 8015F0D0 0015C030 38 03 CA F8 */ addi r0, r3, __vt__17CCollidableSphere@l /* 8015F0D4 0015C034 90 1E 06 90 */ stw r0, 0x690(r30) /* 8015F0D8 0015C038 41 82 00 10 */ beq lbl_8015F0E8 /* 8015F0DC 0015C03C 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha @@ -9090,9 +9090,9 @@ lbl_8016689C: /* 80166AE4 00163A44 A0 0D A3 8C */ lhz r0, kInvalidUniqueId@sda21(r13) /* 80166AE8 00163A48 B0 1E 06 88 */ sth r0, 0x688(r30) /* 80166AEC 00163A4C 48 16 8D C9 */ bl __ct__19CCollisionPrimitiveFRC13CMaterialList -/* 80166AF0 00163A50 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha +/* 80166AF0 00163A50 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha /* 80166AF4 00163A54 7C 1D 00 D0 */ neg r0, r29 -/* 80166AF8 00163A58 38 63 CA F8 */ addi r3, r3, lbl_803ECAF8@l +/* 80166AF8 00163A58 38 63 CA F8 */ addi r3, r3, __vt__17CCollidableSphere@l /* 80166AFC 00163A5C C0 22 9F 68 */ lfs f1, lbl_805ABC88@sda21(r2) /* 80166B00 00163A60 90 72 00 00 */ stw r3, 0(r18) /* 80166B04 00163A64 7C 00 EB 78 */ or r0, r0, r29 diff --git a/asm/MetroidPrime/Enemies/CGrenadeLauncher.s b/asm/MetroidPrime/Enemies/CGrenadeLauncher.s index 9e8fbb36..9f7eb7b2 100644 --- a/asm/MetroidPrime/Enemies/CGrenadeLauncher.s +++ b/asm/MetroidPrime/Enemies/CGrenadeLauncher.s @@ -1890,9 +1890,9 @@ lbl_80230F14: lbl_80230F28: /* 80230F28 0022DE88 34 1E 03 28 */ addic. r0, r30, 0x328 /* 80230F2C 0022DE8C 41 82 00 24 */ beq lbl_80230F50 -/* 80230F30 0022DE90 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha +/* 80230F30 0022DE90 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha /* 80230F34 0022DE94 34 1E 03 28 */ addic. r0, r30, 0x328 -/* 80230F38 0022DE98 38 03 CA F8 */ addi r0, r3, lbl_803ECAF8@l +/* 80230F38 0022DE98 38 03 CA F8 */ addi r0, r3, __vt__17CCollidableSphere@l /* 80230F3C 0022DE9C 90 1E 03 28 */ stw r0, 0x328(r30) /* 80230F40 0022DEA0 41 82 00 10 */ beq lbl_80230F50 /* 80230F44 0022DEA4 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha @@ -2058,9 +2058,9 @@ __ct__16CGrenadeLauncherF9TUniqueId: /* 802311B0 0022E110 D0 01 00 A4 */ stfs f0, 0xa4(r1) /* 802311B4 0022E114 D3 C1 00 A8 */ stfs f30, 0xa8(r1) /* 802311B8 0022E118 48 09 E6 FD */ bl __ct__19CCollisionPrimitiveFRC13CMaterialList -/* 802311BC 0022E11C 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha +/* 802311BC 0022E11C 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha /* 802311C0 0022E120 C0 22 B6 6C */ lfs f1, lbl_805AD38C@sda21(r2) -/* 802311C4 0022E124 38 03 CA F8 */ addi r0, r3, lbl_803ECAF8@l +/* 802311C4 0022E124 38 03 CA F8 */ addi r0, r3, __vt__17CCollidableSphere@l /* 802311C8 0022E128 C0 A2 B6 64 */ lfs f5, lbl_805AD384@sda21(r2) /* 802311CC 0022E12C 90 13 00 00 */ stw r0, 0(r19) /* 802311D0 0022E130 FC 40 08 90 */ fmr f2, f1 diff --git a/asm/MetroidPrime/Enemies/CMetroid.s b/asm/MetroidPrime/Enemies/CMetroid.s index 9239f8f4..b11086b3 100644 --- a/asm/MetroidPrime/Enemies/CMetroid.s +++ b/asm/MetroidPrime/Enemies/CMetroid.s @@ -9121,9 +9121,9 @@ lbl_80171DF4: lbl_80171DFC: /* 80171DFC 0016ED5C 34 1E 06 A0 */ addic. r0, r30, 0x6a0 /* 80171E00 0016ED60 41 82 00 24 */ beq lbl_80171E24 -/* 80171E04 0016ED64 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha +/* 80171E04 0016ED64 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha /* 80171E08 0016ED68 34 1E 06 A0 */ addic. r0, r30, 0x6a0 -/* 80171E0C 0016ED6C 38 03 CA F8 */ addi r0, r3, lbl_803ECAF8@l +/* 80171E0C 0016ED6C 38 03 CA F8 */ addi r0, r3, __vt__17CCollidableSphere@l /* 80171E10 0016ED70 90 1E 06 A0 */ stw r0, 0x6a0(r30) /* 80171E14 0016ED74 41 82 00 10 */ beq lbl_80171E24 /* 80171E18 0016ED78 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha @@ -9217,9 +9217,9 @@ lbl_80171E4C: /* 80171F64 0016EEC4 C3 BF 00 08 */ lfs f29, 8(r31) /* 80171F68 0016EEC8 D0 21 00 6C */ stfs f1, 0x6c(r1) /* 80171F6C 0016EECC 48 15 D9 49 */ bl __ct__19CCollisionPrimitiveFRC13CMaterialList -/* 80171F70 0016EED0 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha +/* 80171F70 0016EED0 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha /* 80171F74 0016EED4 C0 22 A0 98 */ lfs f1, lbl_805ABDB8@sda21(r2) -/* 80171F78 0016EED8 38 03 CA F8 */ addi r0, r3, lbl_803ECAF8@l +/* 80171F78 0016EED8 38 03 CA F8 */ addi r0, r3, __vt__17CCollidableSphere@l /* 80171F7C 0016EEDC 38 7A 06 C0 */ addi r3, r26, 0x6c0 /* 80171F80 0016EEE0 90 19 00 00 */ stw r0, 0(r25) /* 80171F84 0016EEE4 FC 40 08 90 */ fmr f2, f1 diff --git a/asm/MetroidPrime/Enemies/CMetroidPrimeEssence.s b/asm/MetroidPrime/Enemies/CMetroidPrimeEssence.s index 10d3c3f0..d19cb6d8 100644 --- a/asm/MetroidPrime/Enemies/CMetroidPrimeEssence.s +++ b/asm/MetroidPrime/Enemies/CMetroidPrimeEssence.s @@ -2657,8 +2657,8 @@ sub_8027e870: /* 8027EAC0 0027BA20 C3 45 00 08 */ lfs f26, 8(r5) /* 8027EAC4 0027BA24 48 05 0D F1 */ bl __ct__19CCollisionPrimitiveFRC13CMaterialList /* 8027EAC8 0027BA28 C0 02 BD 38 */ lfs f0, lbl_805ADA58@sda21(r2) -/* 8027EACC 0027BA2C 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha -/* 8027EAD0 0027BA30 38 03 CA F8 */ addi r0, r3, lbl_803ECAF8@l +/* 8027EACC 0027BA2C 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha +/* 8027EAD0 0027BA30 38 03 CA F8 */ addi r0, r3, __vt__17CCollidableSphere@l /* 8027EAD4 0027BA34 D3 81 00 B8 */ stfs f28, 0xb8(r1) /* 8027EAD8 0027BA38 7F E3 FB 78 */ mr r3, r31 /* 8027EADC 0027BA3C 7F C5 F3 78 */ mr r5, r30 @@ -2675,9 +2675,9 @@ sub_8027e870: /* 8027EB08 0027BA68 80 A1 01 40 */ lwz r5, 0x140(r1) /* 8027EB0C 0027BA6C 2C 05 00 00 */ cmpwi r5, 0 /* 8027EB10 0027BA70 40 81 00 C0 */ ble lbl_8027EBD0 -/* 8027EB14 0027BA74 3C 80 80 3F */ lis r4, lbl_803ECAF8@ha +/* 8027EB14 0027BA74 3C 80 80 3F */ lis r4, __vt__17CCollidableSphere@ha /* 8027EB18 0027BA78 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha -/* 8027EB1C 0027BA7C 38 04 CA F8 */ addi r0, r4, lbl_803ECAF8@l +/* 8027EB1C 0027BA7C 38 04 CA F8 */ addi r0, r4, __vt__17CCollidableSphere@l /* 8027EB20 0027BA80 38 80 00 00 */ li r4, 0 /* 8027EB24 0027BA84 90 01 00 A8 */ stw r0, 0xa8(r1) /* 8027EB28 0027BA88 38 03 97 E4 */ addi r0, r3, __vt__19CCollisionPrimitive@l @@ -2785,9 +2785,9 @@ lbl_8027EBD0: /* 8027EC9C 0027BBFC 88 01 01 30 */ lbz r0, 0x130(r1) /* 8027ECA0 0027BC00 28 00 00 00 */ cmplwi r0, 0 /* 8027ECA4 0027BC04 40 82 00 C8 */ bne lbl_8027ED6C -/* 8027ECA8 0027BC08 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha +/* 8027ECA8 0027BC08 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha /* 8027ECAC 0027BC0C 80 A1 01 40 */ lwz r5, 0x140(r1) -/* 8027ECB0 0027BC10 38 03 CA F8 */ addi r0, r3, lbl_803ECAF8@l +/* 8027ECB0 0027BC10 38 03 CA F8 */ addi r0, r3, __vt__17CCollidableSphere@l /* 8027ECB4 0027BC14 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha /* 8027ECB8 0027BC18 90 01 00 A8 */ stw r0, 0xa8(r1) /* 8027ECBC 0027BC1C 38 03 97 E4 */ addi r0, r3, __vt__19CCollisionPrimitive@l @@ -2843,9 +2843,9 @@ lbl_8027ED5C: /* 8027ED64 0027BCC4 90 01 0D 44 */ stw r0, 0xd44(r1) /* 8027ED68 0027BCC8 48 00 00 C4 */ b lbl_8027EE2C lbl_8027ED6C: -/* 8027ED6C 0027BCCC 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha +/* 8027ED6C 0027BCCC 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha /* 8027ED70 0027BCD0 80 A1 01 40 */ lwz r5, 0x140(r1) -/* 8027ED74 0027BCD4 38 03 CA F8 */ addi r0, r3, lbl_803ECAF8@l +/* 8027ED74 0027BCD4 38 03 CA F8 */ addi r0, r3, __vt__17CCollidableSphere@l /* 8027ED78 0027BCD8 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha /* 8027ED7C 0027BCDC 90 01 00 A8 */ stw r0, 0xa8(r1) /* 8027ED80 0027BCE0 38 03 97 E4 */ addi r0, r3, __vt__19CCollisionPrimitive@l diff --git a/asm/MetroidPrime/Enemies/CParasite.s b/asm/MetroidPrime/Enemies/CParasite.s index 9f3c4843..74eda79b 100644 --- a/asm/MetroidPrime/Enemies/CParasite.s +++ b/asm/MetroidPrime/Enemies/CParasite.s @@ -362,9 +362,9 @@ __dt__11CWallWalkerFv: /* 80156A9C 001539FC 38 03 A0 F0 */ addi r0, r3, lbl_803EA0F0@l /* 80156AA0 00153A00 90 1E 00 00 */ stw r0, 0(r30) /* 80156AA4 00153A04 41 82 00 24 */ beq lbl_80156AC8 -/* 80156AA8 00153A08 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha +/* 80156AA8 00153A08 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha /* 80156AAC 00153A0C 34 1E 05 90 */ addic. r0, r30, 0x590 -/* 80156AB0 00153A10 38 03 CA F8 */ addi r0, r3, lbl_803ECAF8@l +/* 80156AB0 00153A10 38 03 CA F8 */ addi r0, r3, __vt__17CCollidableSphere@l /* 80156AB4 00153A14 90 1E 05 90 */ stw r0, 0x590(r30) /* 80156AB8 00153A18 41 82 00 10 */ beq lbl_80156AC8 /* 80156ABC 00153A1C 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha diff --git a/asm/MetroidPrime/Enemies/CTryclops.s b/asm/MetroidPrime/Enemies/CTryclops.s index 6ff3254c..d817bf46 100644 --- a/asm/MetroidPrime/Enemies/CTryclops.s +++ b/asm/MetroidPrime/Enemies/CTryclops.s @@ -403,9 +403,9 @@ lbl_8025DC90: /* 8025DD5C 0025ACBC EF A1 10 2A */ fadds f29, f1, f2 /* 8025DD60 0025ACC0 EF C0 F8 2A */ fadds f30, f0, f31 /* 8025DD64 0025ACC4 48 07 1B 51 */ bl __ct__19CCollisionPrimitiveFRC13CMaterialList -/* 8025DD68 0025ACC8 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha +/* 8025DD68 0025ACC8 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha /* 8025DD6C 0025ACCC 38 00 00 00 */ li r0, 0 -/* 8025DD70 0025ACD0 38 A3 CA F8 */ addi r5, r3, lbl_803ECAF8@l +/* 8025DD70 0025ACD0 38 A3 CA F8 */ addi r5, r3, __vt__17CCollidableSphere@l /* 8025DD74 0025ACD4 D3 81 00 88 */ stfs f28, 0x88(r1) /* 8025DD78 0025ACD8 38 61 00 48 */ addi r3, r1, 0x48 /* 8025DD7C 0025ACDC 38 81 00 78 */ addi r4, r1, 0x78 @@ -451,9 +451,9 @@ lbl_8025DE04: lbl_8025DE14: /* 8025DE14 0025AD74 42 00 00 00 */ bdnz lbl_8025DE14 lbl_8025DE18: -/* 8025DE18 0025AD78 3C 80 80 3F */ lis r4, lbl_803ECAF8@ha +/* 8025DE18 0025AD78 3C 80 80 3F */ lis r4, __vt__17CCollidableSphere@ha /* 8025DE1C 0025AD7C 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha -/* 8025DE20 0025AD80 38 04 CA F8 */ addi r0, r4, lbl_803ECAF8@l +/* 8025DE20 0025AD80 38 04 CA F8 */ addi r0, r4, __vt__17CCollidableSphere@l /* 8025DE24 0025AD84 38 80 00 00 */ li r4, 0 /* 8025DE28 0025AD88 90 01 00 78 */ stw r0, 0x78(r1) /* 8025DE2C 0025AD8C 38 03 97 E4 */ addi r0, r3, __vt__19CCollisionPrimitive@l @@ -536,9 +536,9 @@ lbl_8025DF40: lbl_8025DF50: /* 8025DF50 0025AEB0 42 00 00 00 */ bdnz lbl_8025DF50 lbl_8025DF54: -/* 8025DF54 0025AEB4 3C 80 80 3F */ lis r4, lbl_803ECAF8@ha +/* 8025DF54 0025AEB4 3C 80 80 3F */ lis r4, __vt__17CCollidableSphere@ha /* 8025DF58 0025AEB8 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha -/* 8025DF5C 0025AEBC 38 04 CA F8 */ addi r0, r4, lbl_803ECAF8@l +/* 8025DF5C 0025AEBC 38 04 CA F8 */ addi r0, r4, __vt__17CCollidableSphere@l /* 8025DF60 0025AEC0 38 80 00 00 */ li r4, 0 /* 8025DF64 0025AEC4 90 01 00 78 */ stw r0, 0x78(r1) /* 8025DF68 0025AEC8 38 03 97 E4 */ addi r0, r3, __vt__19CCollisionPrimitive@l @@ -576,9 +576,9 @@ lbl_8025DFC8: lbl_8025DFD8: /* 8025DFD8 0025AF38 42 00 00 00 */ bdnz lbl_8025DFD8 lbl_8025DFDC: -/* 8025DFDC 0025AF3C 3C 80 80 3F */ lis r4, lbl_803ECAF8@ha +/* 8025DFDC 0025AF3C 3C 80 80 3F */ lis r4, __vt__17CCollidableSphere@ha /* 8025DFE0 0025AF40 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha -/* 8025DFE4 0025AF44 38 04 CA F8 */ addi r0, r4, lbl_803ECAF8@l +/* 8025DFE4 0025AF44 38 04 CA F8 */ addi r0, r4, __vt__17CCollidableSphere@l /* 8025DFE8 0025AF48 38 80 00 00 */ li r4, 0 /* 8025DFEC 0025AF4C 90 01 00 78 */ stw r0, 0x78(r1) /* 8025DFF0 0025AF50 38 03 97 E4 */ addi r0, r3, __vt__19CCollisionPrimitive@l diff --git a/asm/MetroidPrime/Enemies/CWallWalker.s b/asm/MetroidPrime/Enemies/CWallWalker.s index e4f6abe1..66035006 100644 --- a/asm/MetroidPrime/Enemies/CWallWalker.s +++ b/asm/MetroidPrime/Enemies/CWallWalker.s @@ -1152,9 +1152,9 @@ ProjectPointToPlane__11CWallWalkerFRC9CVector3fRC9CVector3fRC9CVector3f: /* 80269358 002662B8 7F 63 DB 78 */ mr r3, r27 /* 8026935C 002662BC C3 A5 00 08 */ lfs f29, 8(r5) /* 80269360 002662C0 48 06 65 55 */ bl __ct__19CCollisionPrimitiveFRC13CMaterialList -/* 80269364 002662C4 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha +/* 80269364 002662C4 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha /* 80269368 002662C8 C0 02 BB 04 */ lfs f0, lbl_805AD824@sda21(r2) -/* 8026936C 002662CC 38 03 CA F8 */ addi r0, r3, lbl_803ECAF8@l +/* 8026936C 002662CC 38 03 CA F8 */ addi r0, r3, __vt__17CCollidableSphere@l /* 80269370 002662D0 80 82 BA F8 */ lwz r4, lbl_805AD818@sda21(r2) /* 80269374 002662D4 90 1B 00 00 */ stw r0, 0(r27) /* 80269378 002662D8 38 61 00 24 */ addi r3, r1, 0x24 diff --git a/asm/MetroidPrime/Enemies/CWarWasp.s b/asm/MetroidPrime/Enemies/CWarWasp.s index 1176cf65..55fe694b 100644 --- a/asm/MetroidPrime/Enemies/CWarWasp.s +++ b/asm/MetroidPrime/Enemies/CWarWasp.s @@ -6993,9 +6993,9 @@ lbl_80110B94: lbl_80110B9C: /* 80110B9C 0010DAFC 34 1E 05 70 */ addic. r0, r30, 0x570 /* 80110BA0 0010DB00 41 82 00 24 */ beq lbl_80110BC4 -/* 80110BA4 0010DB04 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha +/* 80110BA4 0010DB04 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha /* 80110BA8 0010DB08 34 1E 05 70 */ addic. r0, r30, 0x570 -/* 80110BAC 0010DB0C 38 03 CA F8 */ addi r0, r3, lbl_803ECAF8@l +/* 80110BAC 0010DB0C 38 03 CA F8 */ addi r0, r3, __vt__17CCollidableSphere@l /* 80110BB0 0010DB10 90 1E 05 70 */ stw r0, 0x570(r30) /* 80110BB4 0010DB14 41 82 00 10 */ beq lbl_80110BC4 /* 80110BB8 0010DB18 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha @@ -7064,9 +7064,9 @@ lbl_80110BE0: /* 80110CA0 0010DC00 7E E3 BB 78 */ mr r3, r23 /* 80110CA4 0010DC04 90 18 05 68 */ stw r0, 0x568(r24) /* 80110CA8 0010DC08 48 1B EC 0D */ bl __ct__19CCollisionPrimitiveFRC13CMaterialList -/* 80110CAC 0010DC0C 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha +/* 80110CAC 0010DC0C 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha /* 80110CB0 0010DC10 C0 22 94 DC */ lfs f1, lbl_805AB1FC@sda21(r2) -/* 80110CB4 0010DC14 38 03 CA F8 */ addi r0, r3, lbl_803ECAF8@l +/* 80110CB4 0010DC14 38 03 CA F8 */ addi r0, r3, __vt__17CCollidableSphere@l /* 80110CB8 0010DC18 C0 62 94 F0 */ lfs f3, lbl_805AB210@sda21(r2) /* 80110CBC 0010DC1C 90 17 00 00 */ stw r0, 0(r23) /* 80110CC0 0010DC20 FC 40 08 90 */ fmr f2, f1 diff --git a/asm/MetroidPrime/Player/CMorphBall.s b/asm/MetroidPrime/Player/CMorphBall.s index 34e7df8a..23c182be 100644 --- a/asm/MetroidPrime/Player/CMorphBall.s +++ b/asm/MetroidPrime/Player/CMorphBall.s @@ -5196,9 +5196,9 @@ BallCloseToCollision__10CMorphBallCFRC13CStateManagerfRC15CMaterialFilter: /* 800F162C 000EE58C EF C2 18 2A */ fadds f30, f2, f3 /* 800F1630 000EE590 EF E0 08 2A */ fadds f31, f0, f1 /* 800F1634 000EE594 48 1D E2 81 */ bl __ct__19CCollisionPrimitiveFRC13CMaterialList -/* 800F1638 000EE598 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha +/* 800F1638 000EE598 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha /* 800F163C 000EE59C 38 00 00 00 */ li r0, 0 -/* 800F1640 000EE5A0 38 A3 CA F8 */ addi r5, r3, lbl_803ECAF8@l +/* 800F1640 000EE5A0 38 A3 CA F8 */ addi r5, r3, __vt__17CCollidableSphere@l /* 800F1644 000EE5A4 D3 A1 00 48 */ stfs f29, 0x48(r1) /* 800F1648 000EE5A8 38 61 00 20 */ addi r3, r1, 0x20 /* 800F164C 000EE5AC 38 81 00 38 */ addi r4, r1, 0x38 @@ -5244,9 +5244,9 @@ lbl_800F16D4: lbl_800F16E4: /* 800F16E4 000EE644 42 00 00 00 */ bdnz lbl_800F16E4 lbl_800F16E8: -/* 800F16E8 000EE648 3C 80 80 3F */ lis r4, lbl_803ECAF8@ha +/* 800F16E8 000EE648 3C 80 80 3F */ lis r4, __vt__17CCollidableSphere@ha /* 800F16EC 000EE64C 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha -/* 800F16F0 000EE650 38 04 CA F8 */ addi r0, r4, lbl_803ECAF8@l +/* 800F16F0 000EE650 38 04 CA F8 */ addi r0, r4, __vt__17CCollidableSphere@l /* 800F16F4 000EE654 38 80 00 00 */ li r4, 0 /* 800F16F8 000EE658 90 01 00 38 */ stw r0, 0x38(r1) /* 800F16FC 000EE65C 38 03 97 E4 */ addi r0, r3, __vt__19CCollisionPrimitive@l @@ -5325,9 +5325,9 @@ lbl_800F1800: lbl_800F1810: /* 800F1810 000EE770 42 00 00 00 */ bdnz lbl_800F1810 lbl_800F1814: -/* 800F1814 000EE774 3C 80 80 3F */ lis r4, lbl_803ECAF8@ha +/* 800F1814 000EE774 3C 80 80 3F */ lis r4, __vt__17CCollidableSphere@ha /* 800F1818 000EE778 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha -/* 800F181C 000EE77C 38 04 CA F8 */ addi r0, r4, lbl_803ECAF8@l +/* 800F181C 000EE77C 38 04 CA F8 */ addi r0, r4, __vt__17CCollidableSphere@l /* 800F1820 000EE780 38 80 00 00 */ li r4, 0 /* 800F1824 000EE784 90 01 00 38 */ stw r0, 0x38(r1) /* 800F1828 000EE788 38 03 97 E4 */ addi r0, r3, __vt__19CCollisionPrimitive@l @@ -5365,9 +5365,9 @@ lbl_800F1888: lbl_800F1898: /* 800F1898 000EE7F8 42 00 00 00 */ bdnz lbl_800F1898 lbl_800F189C: -/* 800F189C 000EE7FC 3C 80 80 3F */ lis r4, lbl_803ECAF8@ha +/* 800F189C 000EE7FC 3C 80 80 3F */ lis r4, __vt__17CCollidableSphere@ha /* 800F18A0 000EE800 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha -/* 800F18A4 000EE804 38 04 CA F8 */ addi r0, r4, lbl_803ECAF8@l +/* 800F18A4 000EE804 38 04 CA F8 */ addi r0, r4, __vt__17CCollidableSphere@l /* 800F18A8 000EE808 38 80 00 00 */ li r4, 0 /* 800F18AC 000EE80C 90 01 00 38 */ stw r0, 0x38(r1) /* 800F18B0 000EE810 38 03 97 E4 */ addi r0, r3, __vt__19CCollisionPrimitive@l @@ -6906,10 +6906,10 @@ PreRender__10CMorphBallFR13CStateManagerRC14CFrustumPlanes: /* 800F2ED0 000EFE30 C0 02 91 FC */ lfs f0, lbl_805AAF1C@sda21(r2) /* 800F2ED4 000EFE34 98 1E 02 98 */ stb r0, 0x298(r30) /* 800F2ED8 000EFE38 3C A0 80 3E */ lis r5, __vt__19CCollisionPrimitive@ha -/* 800F2EDC 000EFE3C 3C 80 80 3F */ lis r4, lbl_803ECAF8@ha +/* 800F2EDC 000EFE3C 3C 80 80 3F */ lis r4, __vt__17CCollidableSphere@ha /* 800F2EE0 000EFE40 3C 60 80 5A */ lis r3, sZeroVector__9CVector3f@ha /* 800F2EE4 000EFE44 D0 1E 02 D0 */ stfs f0, 0x2d0(r30) -/* 800F2EE8 000EFE48 38 04 CA F8 */ addi r0, r4, lbl_803ECAF8@l +/* 800F2EE8 000EFE48 38 04 CA F8 */ addi r0, r4, __vt__17CCollidableSphere@l /* 800F2EEC 000EFE4C 38 E0 00 01 */ li r7, 1 /* 800F2EF0 000EFE50 3B E3 66 A0 */ addi r31, r3, sZeroVector__9CVector3f@l /* 800F2EF4 000EFE54 88 DE 02 98 */ lbz r6, 0x298(r30) @@ -7003,8 +7003,8 @@ lbl_800F3020: /* 800F3050 000EFFB0 38 03 97 E4 */ addi r0, r3, __vt__19CCollisionPrimitive@l /* 800F3054 000EFFB4 C0 1F 00 08 */ lfs f0, 8(r31) /* 800F3058 000EFFB8 90 01 00 80 */ stw r0, 0x80(r1) -/* 800F305C 000EFFBC 3C 80 80 3F */ lis r4, lbl_803ECAF8@ha -/* 800F3060 000EFFC0 38 04 CA F8 */ addi r0, r4, lbl_803ECAF8@l +/* 800F305C 000EFFBC 3C 80 80 3F */ lis r4, __vt__17CCollidableSphere@ha +/* 800F3060 000EFFC0 38 04 CA F8 */ addi r0, r4, __vt__17CCollidableSphere@l /* 800F3064 000EFFC4 3C 60 80 5A */ lis r3, sZeroVector__9CVector3f@ha /* 800F3068 000EFFC8 80 BC 00 40 */ lwz r5, 0x40(r28) /* 800F306C 000EFFCC 7F 84 E3 78 */ mr r4, r28 @@ -7052,9 +7052,9 @@ lbl_800F3020: /* 800F3114 000F0074 39 00 00 00 */ li r8, 0 /* 800F3118 000F0078 39 20 00 00 */ li r9, 0 /* 800F311C 000F007C 48 01 E0 B5 */ bl BuildLightShadowTexture__12CWorldShadowFRC13CStateManager7TAreaIdUiRC6CAABoxbb -/* 800F3120 000F0080 3C 80 80 3F */ lis r4, lbl_803ECAF8@ha +/* 800F3120 000F0080 3C 80 80 3F */ lis r4, __vt__17CCollidableSphere@ha /* 800F3124 000F0084 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha -/* 800F3128 000F0088 38 04 CA F8 */ addi r0, r4, lbl_803ECAF8@l +/* 800F3128 000F0088 38 04 CA F8 */ addi r0, r4, __vt__17CCollidableSphere@l /* 800F312C 000F008C 90 01 00 80 */ stw r0, 0x80(r1) /* 800F3130 000F0090 38 03 97 E4 */ addi r0, r3, __vt__19CCollisionPrimitive@l /* 800F3134 000F0094 90 01 00 80 */ stw r0, 0x80(r1) @@ -7113,9 +7113,9 @@ lbl_800F31A8: /* 800F31F8 000F0158 80 63 00 10 */ lwz r3, 0x10(r3) /* 800F31FC 000F015C 4B F3 98 09 */ bl PreRender__9CAnimDataFv lbl_800F3200: -/* 800F3200 000F0160 3C 80 80 3F */ lis r4, lbl_803ECAF8@ha +/* 800F3200 000F0160 3C 80 80 3F */ lis r4, __vt__17CCollidableSphere@ha /* 800F3204 000F0164 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha -/* 800F3208 000F0168 38 04 CA F8 */ addi r0, r4, lbl_803ECAF8@l +/* 800F3208 000F0168 38 04 CA F8 */ addi r0, r4, __vt__17CCollidableSphere@l /* 800F320C 000F016C 90 01 00 B8 */ stw r0, 0xb8(r1) /* 800F3210 000F0170 38 03 97 E4 */ addi r0, r3, __vt__19CCollisionPrimitive@l /* 800F3214 000F0174 90 01 00 B8 */ stw r0, 0xb8(r1) @@ -13981,9 +13981,9 @@ lbl_800F9504: lbl_800F9518: /* 800F9518 000F6478 34 1E 00 38 */ addic. r0, r30, 0x38 /* 800F951C 000F647C 41 82 00 24 */ beq lbl_800F9540 -/* 800F9520 000F6480 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha +/* 800F9520 000F6480 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha /* 800F9524 000F6484 34 1E 00 38 */ addic. r0, r30, 0x38 -/* 800F9528 000F6488 38 03 CA F8 */ addi r0, r3, lbl_803ECAF8@l +/* 800F9528 000F6488 38 03 CA F8 */ addi r0, r3, __vt__17CCollidableSphere@l /* 800F952C 000F648C 90 1E 00 38 */ stw r0, 0x38(r30) /* 800F9530 000F6490 41 82 00 10 */ beq lbl_800F9540 /* 800F9534 000F6494 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha @@ -14075,9 +14075,9 @@ __ct__10CMorphBallFR7CPlayerf: /* 800F9678 000F65D8 38 81 00 B0 */ addi r4, r1, 0xb0 /* 800F967C 000F65DC 90 A1 00 B4 */ stw r5, 0xb4(r1) /* 800F9680 000F65E0 48 1D 62 35 */ bl __ct__19CCollisionPrimitiveFRC13CMaterialList -/* 800F9684 000F65E4 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha +/* 800F9684 000F65E4 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha /* 800F9688 000F65E8 C0 02 91 50 */ lfs f0, lbl_805AAE70@sda21(r2) -/* 800F968C 000F65EC 38 03 CA F8 */ addi r0, r3, lbl_803ECAF8@l +/* 800F968C 000F65EC 38 03 CA F8 */ addi r0, r3, __vt__17CCollidableSphere@l /* 800F9690 000F65F0 80 8D A3 2C */ lwz r4, lbl_805A8EEC@sda21(r13) /* 800F9694 000F65F4 90 1A 00 00 */ stw r0, 0(r26) /* 800F9698 000F65F8 38 61 01 1C */ addi r3, r1, 0x11c diff --git a/asm/MetroidPrime/Player/CPlayer.s b/asm/MetroidPrime/Player/CPlayer.s index a02c5419..55062e6d 100644 --- a/asm/MetroidPrime/Player/CPlayer.s +++ b/asm/MetroidPrime/Player/CPlayer.s @@ -2226,8 +2226,8 @@ lbl_800112F8: /* 8001139C 0000E2FC C3 A1 00 58 */ lfs f29, 0x58(r1) /* 800113A0 0000E300 48 2B E5 15 */ bl __ct__19CCollisionPrimitiveFRC13CMaterialList /* 800113A4 0000E304 C0 02 81 1C */ lfs f0, lbl_805A9E3C@sda21(r2) -/* 800113A8 0000E308 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha -/* 800113AC 0000E30C 38 63 CA F8 */ addi r3, r3, lbl_803ECAF8@l +/* 800113A8 0000E308 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha +/* 800113AC 0000E30C 38 63 CA F8 */ addi r3, r3, __vt__17CCollidableSphere@l /* 800113B0 0000E310 38 00 00 00 */ li r0, 0 /* 800113B4 0000E314 90 61 00 E0 */ stw r3, 0xe0(r1) /* 800113B8 0000E318 38 61 00 78 */ addi r3, r1, 0x78 @@ -2336,9 +2336,9 @@ lbl_80011528: lbl_80011538: /* 80011538 0000E498 42 00 00 00 */ bdnz lbl_80011538 lbl_8001153C: -/* 8001153C 0000E49C 3C 80 80 3F */ lis r4, lbl_803ECAF8@ha +/* 8001153C 0000E49C 3C 80 80 3F */ lis r4, __vt__17CCollidableSphere@ha /* 80011540 0000E4A0 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha -/* 80011544 0000E4A4 38 04 CA F8 */ addi r0, r4, lbl_803ECAF8@l +/* 80011544 0000E4A4 38 04 CA F8 */ addi r0, r4, __vt__17CCollidableSphere@l /* 80011548 0000E4A8 38 80 00 00 */ li r4, 0 /* 8001154C 0000E4AC 90 01 00 E0 */ stw r0, 0xe0(r1) /* 80011550 0000E4B0 38 03 97 E4 */ addi r0, r3, __vt__19CCollisionPrimitive@l @@ -2490,8 +2490,8 @@ __dt__17CCollidableSphere: /* 80011758 0000E6B8 93 E1 00 0C */ stw r31, 0xc(r1) /* 8001175C 0000E6BC 7C 7F 1B 79 */ or. r31, r3, r3 /* 80011760 0000E6C0 41 82 00 30 */ beq lbl_80011790 -/* 80011764 0000E6C4 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha -/* 80011768 0000E6C8 38 03 CA F8 */ addi r0, r3, lbl_803ECAF8@l +/* 80011764 0000E6C4 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha +/* 80011768 0000E6C8 38 03 CA F8 */ addi r0, r3, __vt__17CCollidableSphere@l /* 8001176C 0000E6CC 90 1F 00 00 */ stw r0, 0(r31) /* 80011770 0000E6D0 41 82 00 10 */ beq lbl_80011780 /* 80011774 0000E6D4 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha diff --git a/asm/MetroidPrime/Weapons/CNewFlameThrower.s b/asm/MetroidPrime/Weapons/CNewFlameThrower.s index a107671c..ae2a1801 100644 --- a/asm/MetroidPrime/Weapons/CNewFlameThrower.s +++ b/asm/MetroidPrime/Weapons/CNewFlameThrower.s @@ -1704,8 +1704,8 @@ lbl_802626B0: /* 80262714 0025F674 90 A1 00 94 */ stw r5, 0x94(r1) /* 80262718 0025F678 48 06 D1 9D */ bl __ct__19CCollisionPrimitiveFRC13CMaterialList /* 8026271C 0025F67C A1 2D A3 8C */ lhz r9, kInvalidUniqueId@sda21(r13) -/* 80262720 0025F680 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha -/* 80262724 0025F684 38 A3 CA F8 */ addi r5, r3, lbl_803ECAF8@l +/* 80262720 0025F680 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha +/* 80262724 0025F684 38 A3 CA F8 */ addi r5, r3, __vt__17CCollidableSphere@l /* 80262728 0025F688 38 00 00 00 */ li r0, 0 /* 8026272C 0025F68C 3C 80 80 5A */ lis r4, sIdentity__12CTransform4f@ha /* 80262730 0025F690 3C 60 80 47 */ lis r3, lbl_8046DCA8@ha @@ -2073,9 +2073,9 @@ lbl_80262C78: lbl_80262C88: /* 80262C88 0025FBE8 42 00 00 00 */ bdnz lbl_80262C88 lbl_80262C8C: -/* 80262C8C 0025FBEC 3C 80 80 3F */ lis r4, lbl_803ECAF8@ha +/* 80262C8C 0025FBEC 3C 80 80 3F */ lis r4, __vt__17CCollidableSphere@ha /* 80262C90 0025FBF0 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha -/* 80262C94 0025FBF4 38 04 CA F8 */ addi r0, r4, lbl_803ECAF8@l +/* 80262C94 0025FBF4 38 04 CA F8 */ addi r0, r4, __vt__17CCollidableSphere@l /* 80262C98 0025FBF8 90 01 02 08 */ stw r0, 0x208(r1) /* 80262C9C 0025FBFC 38 80 00 00 */ li r4, 0 /* 80262CA0 0025FC00 38 63 97 E4 */ addi r3, r3, __vt__19CCollisionPrimitive@l @@ -2205,9 +2205,9 @@ lbl_80262E3C: /* 80262E3C 0025FD9C 38 63 00 01 */ addi r3, r3, 1 /* 80262E40 0025FDA0 42 00 FF FC */ bdnz lbl_80262E3C lbl_80262E44: -/* 80262E44 0025FDA4 3C 80 80 3F */ lis r4, lbl_803ECAF8@ha +/* 80262E44 0025FDA4 3C 80 80 3F */ lis r4, __vt__17CCollidableSphere@ha /* 80262E48 0025FDA8 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha -/* 80262E4C 0025FDAC 38 04 CA F8 */ addi r0, r4, lbl_803ECAF8@l +/* 80262E4C 0025FDAC 38 04 CA F8 */ addi r0, r4, __vt__17CCollidableSphere@l /* 80262E50 0025FDB0 38 80 00 00 */ li r4, 0 /* 80262E54 0025FDB4 90 01 02 08 */ stw r0, 0x208(r1) /* 80262E58 0025FDB8 38 03 97 E4 */ addi r0, r3, __vt__19CCollisionPrimitive@l @@ -2359,9 +2359,9 @@ lbl_80262FF8: /* 80263064 0025FFC4 38 81 00 78 */ addi r4, r1, 0x78 /* 80263068 0025FFC8 90 A1 00 7C */ stw r5, 0x7c(r1) /* 8026306C 0025FFCC 48 06 C8 49 */ bl __ct__19CCollisionPrimitiveFRC13CMaterialList -/* 80263070 0025FFD0 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha +/* 80263070 0025FFD0 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha /* 80263074 0025FFD4 D2 E1 01 F8 */ stfs f23, 0x1f8(r1) -/* 80263078 0025FFD8 38 03 CA F8 */ addi r0, r3, lbl_803ECAF8@l +/* 80263078 0025FFD8 38 03 CA F8 */ addi r0, r3, __vt__17CCollidableSphere@l /* 8026307C 0025FFDC 7F A3 EB 78 */ mr r3, r29 /* 80263080 0025FFE0 90 01 01 E8 */ stw r0, 0x1e8(r1) /* 80263084 0025FFE4 7F C4 F3 78 */ mr r4, r30 @@ -2429,9 +2429,9 @@ lbl_80262FF8: /* 8026317C 002600DC 39 21 00 98 */ addi r9, r1, 0x98 /* 80263180 002600E0 4B DE 6F 21 */ bl ApplyDamage__13CStateManagerF9TUniqueId9TUniqueId9TUniqueIdRC11CDamageInfoRC15CMaterialFilterRC9CVector3f lbl_80263184: -/* 80263184 002600E4 3C 60 80 3F */ lis r3, lbl_803ECAF8@ha +/* 80263184 002600E4 3C 60 80 3F */ lis r3, __vt__17CCollidableSphere@ha /* 80263188 002600E8 80 A1 02 A4 */ lwz r5, 0x2a4(r1) -/* 8026318C 002600EC 38 03 CA F8 */ addi r0, r3, lbl_803ECAF8@l +/* 8026318C 002600EC 38 03 CA F8 */ addi r0, r3, __vt__17CCollidableSphere@l /* 80263190 002600F0 3C 60 80 3E */ lis r3, __vt__19CCollisionPrimitive@ha /* 80263194 002600F4 90 01 01 E8 */ stw r0, 0x1e8(r1) /* 80263198 002600F8 38 03 97 E4 */ addi r0, r3, __vt__19CCollisionPrimitive@l diff --git a/include/Collision/CCollidableSphere.hpp b/include/Collision/CCollidableSphere.hpp new file mode 100644 index 00000000..9ca1532a --- /dev/null +++ b/include/Collision/CCollidableSphere.hpp @@ -0,0 +1,27 @@ +#ifndef _CCOLLIDABLESPHERE_HPP +#define _CCOLLIDABLESPHERE_HPP + +#include "types.h" + +#include "Collision/CCollisionPrimitive.hpp" + +#include "Kyoto/Math/CSphere.hpp" + +class CCollidableSphere : public CCollisionPrimitive { +public: + CCollidableSphere(const CSphere& sphere, const CMaterialList& material) + : CCollisionPrimitive(material), x10_sphere(sphere) {} + + u32 GetTableIndex() const override; + CAABox CalculateAABox(const CTransform4f&) const override; + CAABox CalculateLocalAABox() const override; + FourCC GetPrimType() const override; + ~CCollidableSphere() override {} + CRayCastResult CastRayInternal(const CInternalRayCastStructure&) const; + +private: + CSphere x10_sphere; +}; +CHECK_SIZEOF(CCollidableSphere, 0x20) + +#endif diff --git a/include/Collision/CCollisionInfo.hpp b/include/Collision/CCollisionInfo.hpp new file mode 100644 index 00000000..2d28b7c6 --- /dev/null +++ b/include/Collision/CCollisionInfo.hpp @@ -0,0 +1,45 @@ +#ifndef _CCOLLISIONINFO_HPP +#define _CCOLLISIONINFO_HPP + +#include "types.h" + +#include "Collision/CMaterialList.hpp" + +#include "Kyoto/Math/CUnitVector3f.hpp" +#include "Kyoto/Math/CVector3f.hpp" + +class CAABox; + +class CCollisionInfo { +public: + enum EInvalid { + kI_Invalid, + kI_Valid, + }; + enum ESwapMaterials { + // TODO + }; + + CCollisionInfo(EInvalid valid = kI_Invalid); + CCollisionInfo(const CVector3f&, const CMaterialList&, const CMaterialList&, const CVector3f&); + CCollisionInfo(const CVector3f&, const CMaterialList&, const CMaterialList&, const CVector3f&, + const CVector3f&); + CCollisionInfo(const CAABox&, const CMaterialList&, const CMaterialList&, const CVector3f&, + const CVector3f&); + CCollisionInfo(const CCollisionInfo&, ESwapMaterials); + +private: + CVector3f x0_point; + CVector3f xc_extentX; + CVector3f x18_extentY; + CVector3f x24_extentZ; + bool x30_valid; + bool x31_hasExtents; + CMaterialList x38_materialLeft; + CMaterialList x40_materialRight; + CUnitVector3f x48_normalLeft; + CUnitVector3f x54_normalRight; +}; +CHECK_SIZEOF(CCollisionInfo, 0x60) + +#endif diff --git a/include/Collision/CMaterialList.hpp b/include/Collision/CMaterialList.hpp index 922dc06c..a1282f00 100644 --- a/include/Collision/CMaterialList.hpp +++ b/include/Collision/CMaterialList.hpp @@ -72,44 +72,58 @@ static EMaterialTypes SolidMaterial = kMT_Solid; class CMaterialList { public: CMaterialList() : value(0) {} - CMaterialList(const EMaterialTypes& material) : value(0) { value |= u64(1) << material; } + CMaterialList(const EMaterialTypes& m1) : value(0) { Add(m1); } CMaterialList(const EMaterialTypes& m1, const EMaterialTypes& m2) : value(0) { - value |= u64(1) << m1; - value |= u64(1) << m2; + Add(m1); + Add(m2); } CMaterialList(const EMaterialTypes& m1, const EMaterialTypes& m2, const EMaterialTypes& m3) : value(0) { - value |= u64(1) << m1; - value |= u64(1) << m2; - value |= u64(1) << m3; + Add(m1); + Add(m2); + Add(m3); } CMaterialList(const EMaterialTypes& m1, const EMaterialTypes& m2, const EMaterialTypes& m3, const EMaterialTypes& m4) : value(0) { - value |= u64(1) << m1; - value |= u64(1) << m2; - value |= u64(1) << m3; - value |= u64(1) << m4; + Add(m1); + Add(m2); + Add(m3); + Add(m4); } CMaterialList(const EMaterialTypes& m1, const EMaterialTypes& m2, const EMaterialTypes& m3, const EMaterialTypes& m4, const EMaterialTypes& m5) : value(0) { - value |= u64(1) << m1; - value |= u64(1) << m2; - value |= u64(1) << m3; - value |= u64(1) << m4; - value |= u64(1) << m5; + Add(m1); + Add(m2); + Add(m3); + Add(m4); + Add(m5); } CMaterialList(u64 value) : value(value) {} void Add(EMaterialTypes material) { value |= u64(1) << material; } + // Add__13CMaterialListFRC13CMaterialList weak + // Remove__13CMaterialListF14EMaterialTypes weak + // Remove__13CMaterialListFRC13CMaterialList weak const CMaterialList& Union(const CMaterialList& other) { value |= other.value; return *this; } + bool HasMaterial(EMaterialTypes material) const { + return (value & (u64(1) << material)) ? true : false; + } + // HasMaterials__13CMaterialListCFv weak + // GetField__13CMaterialListCFUxUx weak + // Intersection__13CMaterialListCFRC13CMaterialList weak + // BitPosition__13CMaterialListFUx global + // GetMaterialString__13CMaterialListCFv weak + // SharesMaterials__13CMaterialListCFRC13CMaterialList weak private: u64 value; + + // static CMaterialList kEverything; }; CHECK_SIZEOF(CMaterialList, 0x8) diff --git a/include/Kyoto/Math/CAABox.hpp b/include/Kyoto/Math/CAABox.hpp index 1b41544f..5d6281b9 100644 --- a/include/Kyoto/Math/CAABox.hpp +++ b/include/Kyoto/Math/CAABox.hpp @@ -3,41 +3,73 @@ #include "Kyoto/Math/CVector3f.hpp" +class CInputStream; +class CLineSeg; +class CPlane; +class CTransform4f; +class CTri; + class CAABox { public: - // CAABox() { - // // TODO - // } - CAABox(const CVector3f& min, const CVector3f& max); // : min(min), max(max) {} + enum EBoxEdgeId { + kE_Z0, + kE_X0, + kE_Z1, + kE_X1, + kE_Z2, + kE_X2, + kE_Z3, + kE_X3, + kE_Y0, + kE_Y1, + kE_Y2, + kE_Y3, + }; + enum EBoxFaceId { + kF_YMin, + kF_YMax, + kF_XMin, + kF_XMax, + kF_ZMax, + kF_ZMin, + }; + + CAABox(const CVector3f& min, const CVector3f& max); + CAABox(f32 minX, f32 minY, f32 minZ, f32 maxX, f32 maxY, f32 maxZ) + : min(minX, minY, minZ), max(maxX, maxY, maxZ) {} + CAABox(CInputStream& in); // CAABox(const CAABox& other) - // : minX(other.minX) - // , minY(other.minY) - // , minZ(other.minZ) - // , maxX(other.maxX) - // , maxY(other.maxY) - // , maxZ(other.maxZ) {} + // : min(other.min) + // , max(other.max) {} - CAABox& operator=(const CAABox&); + // CAABox& operator=(const CAABox& other) { + // min = other.min; + // max = other.max; + // return *this; + // } + CLineSeg GetEdge(EBoxEdgeId edge) const; + CTri GetTri(EBoxFaceId face, int windOffset) const; CVector3f ClosestPointAlongVector(const CVector3f& vec) const; - // FurthestPointAlongVector__6CAABoxCFRC9CVector3f global + CVector3f FurthestPointAlongVector(const CVector3f& vec) const; const CVector3f& GetMinPoint() const { return min; } const CVector3f& GetMaxPoint() const { return max; } // GetCenterPoint__6CAABoxCFv global // GetPoint__6CAABoxCFi global // Include__6CAABoxFRC9CVector3f weak // Include__6CAABoxFRC6CAABox weak - // AccumulateBounds__6CAABoxFRC9CVector3f global + void AccumulateBounds(const CVector3f&); // bool Invalid__6CAABoxCFv global // PointInside__6CAABoxCFRC9CVector3f global - // InsidePlane__6CAABoxCFRC6CPlane global - // DoBoundsOverlap__6CAABoxCFRC6CAABox global + bool DoBoundsOverlap(const CAABox&) const; // GetVolume__6CAABoxCFv global // GetBooleanIntersection__6CAABoxCFRC6CAABox global - // Inside__6CAABoxCFRC6CAABox global - // ClampToBox__6CAABoxCFRC9CVector3f global + bool Inside(const CAABox& other) const; + bool InsidePlane(const CPlane& plane) const; + CVector3f ClampToBox(const CVector3f& vec) const; // GetTri__6CAABoxCFQ26CAABox10EBoxFaceIdi global // DistanceBetween__6CAABoxFRC6CAABoxRC6CAABox global + CAABox GetTransformedAABox(const CTransform4f& xf) const; // GetPointA__6CAABoxCFv weak // GetPointB__6CAABoxCFv weak @@ -54,8 +86,6 @@ public: // GetTri__6CAABoxCFii weak // GetEdge__6CAABoxCFi weak - // GetTransformedAABox__6CAABoxCFRC12CTransform4f - static const CAABox& Identity() { return mskNullBox; } static const CAABox& MakeMaxInvertedBox() { return mskInvertedBox; } // MakeNullBox__6CAABoxFv ?? diff --git a/include/Kyoto/Math/CLine.hpp b/include/Kyoto/Math/CLine.hpp new file mode 100644 index 00000000..4290fb81 --- /dev/null +++ b/include/Kyoto/Math/CLine.hpp @@ -0,0 +1,21 @@ +#ifndef _CLINE_HPP +#define _CLINE_HPP + +#include "types.h" + +#include "Kyoto/Math/CUnitVector3f.hpp" +#include "Kyoto/Math/CVector3f.hpp" + +class CLine { +public: + CLine(const CVector3f& origin, const CUnitVector3f& dir) : x0_origin(origin), xc_dir(dir) {} + + const CVector3f& GetRefPoint() const { return x0_origin; } + const CUnitVector3f& GetNormal() const { return xc_dir; } + +private: + CVector3f x0_origin; + CUnitVector3f xc_dir; +}; + +#endif diff --git a/include/Kyoto/Math/CLineSeg.hpp b/include/Kyoto/Math/CLineSeg.hpp new file mode 100644 index 00000000..32c26c37 --- /dev/null +++ b/include/Kyoto/Math/CLineSeg.hpp @@ -0,0 +1,23 @@ +#ifndef _CLINESEG_HPP +#define _CLINESEG_HPP + +#include "types.h" + +#include "Kyoto/Math/CUnitVector3f.hpp" +#include "Kyoto/Math/CVector3f.hpp" +#include "Kyoto/Math/CLine.hpp" + +class CLineSeg : public CLine { +public: + CLineSeg(const CVector3f& start, const CVector3f& end) + : CLine(start, (end - start).AsNormalized()) + , x18_end(end) {} + + const CVector3f& GetEndPoint() const { return x18_end; } + +private: + CVector3f x18_end; +}; +CHECK_SIZEOF(CLineSeg, 0x24) + +#endif diff --git a/include/Kyoto/Math/CPlane.hpp b/include/Kyoto/Math/CPlane.hpp index b3fdecb6..941adf0a 100644 --- a/include/Kyoto/Math/CPlane.hpp +++ b/include/Kyoto/Math/CPlane.hpp @@ -3,15 +3,24 @@ #include "types.h" +#include "Kyoto/Math/CVector3f.hpp" + class CPlane { public: + CPlane(const CVector3f&, const CUnitVector3f&); // TODO weak + CPlane(float, const CUnitVector3f&); // TODO weak + CPlane(const CVector3f&, const CVector3f&, const CVector3f&); // TODO + const CUnitVector3f& GetNormal() const { return x0_normal; } + f32 GetConstant() const { return xc_constant; } + // GetHeight__6CPlaneCFRC9CVector3f + // IsFacing__6CPlaneCFRC9CVector3f + // ClipLineSegment__6CPlaneCFRC9CVector3fRC9CVector3f + private: - f32 x; - f32 y; - f32 z; - f32 w; + CUnitVector3f x0_normal; + f32 xc_constant; }; CHECK_SIZEOF(CPlane, 0x10) diff --git a/include/Kyoto/Math/CSphere.hpp b/include/Kyoto/Math/CSphere.hpp new file mode 100644 index 00000000..cb206eaf --- /dev/null +++ b/include/Kyoto/Math/CSphere.hpp @@ -0,0 +1,20 @@ +#ifndef _CSPHERE_HPP +#define _CSPHERE_HPP + +#include "types.h" + +#include "Kyoto/Math/CVector3f.hpp" + +class CSphere { +public: + CSphere(const CVector3f& pos, f32 radius) : x0_pos(pos), xc_radius(radius) {} + + // TODO + +private: + CVector3f x0_pos; + f32 xc_radius; +}; +CHECK_SIZEOF(CSphere, 0x10) + +#endif diff --git a/include/Kyoto/Math/CTransform4f.hpp b/include/Kyoto/Math/CTransform4f.hpp index 611a15b5..cddbc552 100644 --- a/include/Kyoto/Math/CTransform4f.hpp +++ b/include/Kyoto/Math/CTransform4f.hpp @@ -53,7 +53,7 @@ public: inline const CVector3f& GetRow(EDimX dim) const { return m0; } inline const CVector3f& GetRow(EDimY dim) const { return m1; } inline const CVector3f& GetRow(EDimZ dim) const { return m2; } - // GetRow__12CTransform4fCFi + inline const CVector3f& GetRow(int i) const { return *(&m0 + i); } // GetUp__12CTransform4fCFv static CTransform4f LookAt(const CVector3f& pos, const CVector3f& lookPos, const CVector3f& up = CVector3f::Up()); @@ -73,8 +73,6 @@ public: // ScaleBy__12CTransform4fFf // SetRotation__12CTransform4fFRC12CTransform4f // SetRotation__12CTransform4fFRC9CMatrix3f - // Translate__12CTransform4fFfff - // Translate__12CTransform4fFRC9CVector3f // TransposeMultiply__12CTransform4fCFRC9CVector3f CVector3f TransposeRotate(const CVector3f& in) const; @@ -96,6 +94,9 @@ public: static CTransform4f FromColumns(const CVector3f&, const CVector3f&, const CVector3f&, const CVector3f&); + static CTransform4f Translate(f32 x, f32 y, f32 z); + static CTransform4f Translate(const CVector3f& vec); + static const CTransform4f& Identity() { return sIdentity; } private: diff --git a/include/Kyoto/Math/CTri.hpp b/include/Kyoto/Math/CTri.hpp new file mode 100644 index 00000000..f83ba33f --- /dev/null +++ b/include/Kyoto/Math/CTri.hpp @@ -0,0 +1,27 @@ +#ifndef _CTRI_HPP +#define _CTRI_HPP + +#include "types.h" + +#include "Kyoto/Math/CPlane.hpp" +#include "Kyoto/Math/CVector3f.hpp" + +class CTri { +public: + CTri(const CVector3f& a, const CVector3f& b, const CVector3f& c) + : x0_plane(a, b, c), x10_a(a), x1c_b(b), x28_c(c) {} + + const CPlane& GetPlane() const { return x0_plane; } + const CVector3f& GetPointA() const { return x10_a; } + const CVector3f& GetPointB() const { return x1c_b; } + const CVector3f& GetPointC() const { return x28_c; } + +private: + CPlane x0_plane; + CVector3f x10_a; + CVector3f x1c_b; + CVector3f x28_c; +}; +CHECK_SIZEOF(CTri, 0x34) + +#endif diff --git a/include/Kyoto/Math/CUnitVector3f.hpp b/include/Kyoto/Math/CUnitVector3f.hpp new file mode 100644 index 00000000..f09c8730 --- /dev/null +++ b/include/Kyoto/Math/CUnitVector3f.hpp @@ -0,0 +1,19 @@ +#ifndef _CUNITVECTOR3F_HPP +#define _CUNITVECTOR3F_HPP + +#include "types.h" + +#include "Kyoto/Math/CVector3f.hpp" + +class CUnitVector3f : public CVector3f { +public: + enum ENormalize { + // TODO + }; + CUnitVector3f(f32 x, f32 y, f32 z); + CUnitVector3f(const CVector3f& vec); + // TODO +}; +CHECK_SIZEOF(CUnitVector3f, 0xc) + +#endif diff --git a/include/Kyoto/Math/CVector3f.hpp b/include/Kyoto/Math/CVector3f.hpp index cc7599aa..de0eca00 100644 --- a/include/Kyoto/Math/CVector3f.hpp +++ b/include/Kyoto/Math/CVector3f.hpp @@ -32,7 +32,7 @@ public: // Slerp__9CVector3fFRC9CVector3fRC9CVector3fRC9CRelAngle void Normalize(); f32 Magnitude() const; - // AsNormalized__9CVector3fCFv + CVector3f AsNormalized() const; bool CanBeNormalized() const; // GetAngleDiff__9CVector3fFRC9CVector3fRC9CVector3f // IsEqu__9CVector3fCFRC9CVector3ff @@ -47,8 +47,8 @@ public: f32 operator[](EDimY) const { return mY; } f32 operator[](EDimZ) const { return mZ; } - f32& operator[](int i) { return *(&mX + i); } - // f32 operator[](int i) const { return *(&mX + i); } + f32& operator[](int i) { return (&mX)[i]; } + f32 operator[](int i) const { return (&mX)[i]; } bool IsNonZero() const { return mX != 0.f || mY != 0.f || mZ != 0.f; } CVector3f DropZ() const { return CVector3f(mX, mY, 0.f); } @@ -78,6 +78,10 @@ public: return *this; } + static f32 Dot(const CVector3f& a, const CVector3f& b) { + return (a.GetX() * b.GetX()) + (a.GetY() * b.GetY()) + (a.GetZ() * b.GetZ()); + } + static const CVector3f& Zero() { return sZeroVector; } static const CVector3f& Up() { return sUpVector; } static const CVector3f& Down() { return sDownVector; } @@ -99,6 +103,7 @@ private: static CVector3f sForwardVector; static CVector3f sBackVector; }; +CHECK_SIZEOF(CVector3f, 0xc) // ClassifyVector__FRC9CVector3f // TGetType<9CVector3f>__FRC9CVector3f diff --git a/include/MetroidPrime/CGameCollision.hpp b/include/MetroidPrime/CGameCollision.hpp index 0fcb4ab0..c18be726 100644 --- a/include/MetroidPrime/CGameCollision.hpp +++ b/include/MetroidPrime/CGameCollision.hpp @@ -3,10 +3,11 @@ #include "types.h" -class CStateManager; +class CAreaCollisionCache; class CCollisionPrimitive; -class CTransform4f; class CMaterialFilter; +class CStateManager; +class CTransform4f; class CGameCollision { public: @@ -14,6 +15,15 @@ public: const CTransform4f&, const CMaterialFilter&); static bool DetectDynamicCollisionBoolean(const CCollisionPrimitive&, const CTransform4f&, const TEntityList&, const CStateManager&); + static void BuildAreaCollisionCache(const CStateManager& mgr, CAreaCollisionCache& cache); + static bool DetectCollisionBoolean_Cached(const CStateManager& mgr, CAreaCollisionCache& cache, + const CCollisionPrimitive& prim, const CTransform4f& xf, + const CMaterialFilter& filter, + const TEntityList& nearList); + static bool DetectCollision_Cached_Moving(const CStateManager&, CAreaCollisionCache&, + const CCollisionPrimitive&, const CTransform4f&, + const CMaterialFilter&, const TEntityList&, CVector3f, + TUniqueId&, CCollisionInfo&, f64&); }; -#endif \ No newline at end of file +#endif diff --git a/include/MetroidPrime/CStateManager.hpp b/include/MetroidPrime/CStateManager.hpp index e1e86740..e95f7f0e 100644 --- a/include/MetroidPrime/CStateManager.hpp +++ b/include/MetroidPrime/CStateManager.hpp @@ -60,6 +60,7 @@ public: CRayCastResult RayWorldIntersection(TUniqueId& idOut, const CVector3f& pos, const CVector3f& dir, f32 length, const CMaterialFilter& filter, const TEntityList& list) const; + void BuildColliderList(TEntityList& out, const CActor& actor, const CAABox& aabb) const; CEntity* ObjectById(TUniqueId uid); const CEntity* GetObjectById(TUniqueId uid) const; diff --git a/include/MetroidPrime/Cameras/CBallCamera.hpp b/include/MetroidPrime/Cameras/CBallCamera.hpp index 0f88756f..f36ef016 100644 --- a/include/MetroidPrime/Cameras/CBallCamera.hpp +++ b/include/MetroidPrime/Cameras/CBallCamera.hpp @@ -44,7 +44,8 @@ public: const CVector3f& GetLookAtPosition() const { return x20_scaledWorldPos; } const CVector3f& GetLineOfSight() const; const CVector3f& GetPosition() const { return x8_lastLocalPos; } - uint GetOcclusionCount() const { return x4c_occlusionCount; } + int GetOcclusionCount() const { return x4c_occlusionCount; } + f32 GetScale() const { return x50_scale; } void SetRadius(f32 radius) { this->x4_radius = radius; } // TODO @@ -53,7 +54,8 @@ public: void SetDesiredPosition(CVector3f vec) { x14_localPos = vec; } void SetLookAtPosition(CVector3f vec) { x20_scaledWorldPos = vec; } void SetLineOfSight(); - void SetOcclusionCount(uint val) { x4c_occlusionCount = val; } + void SetOcclusionCount(int val) { x4c_occlusionCount = val; } + void SetScale(f32 val) { x50_scale = val; } private: f32 x4_radius; @@ -62,9 +64,7 @@ private: CVector3f x20_scaledWorldPos; // look at position CVector3f x2c_lastWorldPos; // real position CCameraSpring x38_spring; - -public: // TODO - uint x4c_occlusionCount; + int x4c_occlusionCount; f32 x50_scale; }; @@ -126,6 +126,18 @@ public: void UpdateColliders(const CTransform4f& xf, rstl::vector< CCameraCollider >& colliderList, int& idx, int count, float tolerance, const TEntityList& nearList, f32 dt, CStateManager& mgr); + CVector3f CalculateCollidersCentroid(const rstl::vector< CCameraCollider >& colliderList, + int numObscured) const; + CVector3f ApplyColliders(); + int CountObscuredColliders(const rstl::vector< CCameraCollider >& colliderList) const; + CAABox CalculateCollidersBoundingBox(const rstl::vector< CCameraCollider >& colliderList, + const CStateManager&) const; + CVector3f AvoidGeometryFull(const CTransform4f& xf, const TEntityList& nearList, f32 dt, + CStateManager& mgr); + CVector3f AvoidGeometry(const CTransform4f& xf, const TEntityList& nearList, f32 dt, + CStateManager& mgr); + bool DetectCollision(const CVector3f& from, const CVector3f& to, f32 radius, f32& d, + CStateManager& mgr); const CVector3f& GetLookAtPosition() const { return x1d8_lookPos; } f32 GetDistance() const { return x190_curMinDistance; } @@ -226,7 +238,7 @@ private: f32 x30c_speedingTime; CVector3f x310_idealLookVec; CVector3f x31c_predictedLookPos; - uint x328_avoidGeomCycle; + int x328_avoidGeomCycle; f32 x32c_colliderMag; f32 x330_clearColliderThreshold; CAABox x334_collidersAABB; diff --git a/include/WorldFormat/CAreaOctTree.hpp b/include/WorldFormat/CAreaOctTree.hpp new file mode 100644 index 00000000..2741e9f6 --- /dev/null +++ b/include/WorldFormat/CAreaOctTree.hpp @@ -0,0 +1,93 @@ +#ifndef _CAREAOCTTREE_HPP +#define _CAREAOCTTREE_HPP + +#include "types.h" + +#include "WorldFormat/CCollisionSurface.hpp" + +#include "Kyoto/Math/CAABox.hpp" +#include "Kyoto/Math/CPlane.hpp" + +#include "rstl/optional_object.hpp" + +class CCollisionEdge; +class CLine; +class CMaterialFilter; + +class CAreaOctTree { +public: + struct SRayResult { + CPlane x0_plane; + rstl::optional_object< CCollisionSurface > x10_surface; + f32 x3c_t; + }; + + class TriListReference { + public: + explicit TriListReference(const u16* ptr) : m_ptr(ptr) {} + u16 GetAt(int idx) const { return m_ptr[idx + 1]; } + u16 GetSize() const { return m_ptr[0]; } + + private: + const u16* m_ptr; + }; + + class Node { + public: + enum ETreeType { kTT_Invalid, kTT_Branch, kTT_Leaf }; + + Node(const void* ptr, const CAABox& aabb, const CAreaOctTree& owner, ETreeType type) + : x0_aabb(aabb) + , x18_ptr(reinterpret_cast< const u8* >(ptr)) + , x1c_owner(owner) + , x20_nodeType(type) {} + + bool LineTest(const CLine& line, const CMaterialFilter& filter, f32 length) const; + void LineTestEx(const CLine& line, const CMaterialFilter& filter, SRayResult& res, + f32 length) const; + + const CAreaOctTree& GetOwner() const { return x1c_owner; } + const CAABox& GetBoundingBox() const { return x0_aabb; } + u16 GetChildFlags() const { return *reinterpret_cast< const u16* >(x18_ptr); } + Node GetChild(int idx) const; + TriListReference GetTriangleArray() const; + ETreeType GetChildType(int idx) const { + u16 flags = *reinterpret_cast< const u16* >(x18_ptr); + return ETreeType((flags >> (2 * idx)) & 0x3); + } + ETreeType GetTreeType() const { return x20_nodeType; } + + private: + CAABox x0_aabb; + const u8* x18_ptr; + const CAreaOctTree& x1c_owner; + ETreeType x20_nodeType; + + bool LineTestInternal(const CLine& line, const CMaterialFilter& filter, f32 lT, f32 hT, + f32 maxT, const CVector3f& vec) const; + void LineTestExInternal(const CLine& line, const CMaterialFilter& filter, SRayResult& res, + f32 lT, f32 hT, f32 maxT, const CVector3f& dirRecip) const; + }; + + // TODO + +private: + CAABox x0_aabb; + Node::ETreeType x18_treeType; + const u8* x1c_buf; + const u8* x20_treeBuf; + uint x24_matCount; + const uint* x28_materials; + const u8* x2c_vertMats; + const u8* x30_edgeMats; + const u8* x34_polyMats; + uint x38_edgeCount; + const CCollisionEdge* x3c_edges; + uint x40_polyCount; + const u16* x44_polyEdges; + uint x48_vertCount; + const float* x4c_verts; +}; +CHECK_SIZEOF(CAreaOctTree, 0x50) + +#endif diff --git a/include/WorldFormat/CCollisionSurface.hpp b/include/WorldFormat/CCollisionSurface.hpp new file mode 100644 index 00000000..fb995810 --- /dev/null +++ b/include/WorldFormat/CCollisionSurface.hpp @@ -0,0 +1,20 @@ +#ifndef _CCOLLISIONSURFACE_HPP +#define _CCOLLISIONSURFACE_HPP + +#include "types.h" + +#include "Kyoto/Math/CVector3f.hpp" + +class CCollisionSurface { +public: + typedef CVector3f TVerts[3]; + + // TODO + +private: + TVerts x0_data; + uint x24_flags; +}; +CHECK_SIZEOF(CCollisionSurface, 0x28) + +#endif diff --git a/include/WorldFormat/CMetroidAreaCollider.hpp b/include/WorldFormat/CMetroidAreaCollider.hpp new file mode 100644 index 00000000..28938120 --- /dev/null +++ b/include/WorldFormat/CMetroidAreaCollider.hpp @@ -0,0 +1,68 @@ +#ifndef _CMETROIDAREACOLLIDER_HPP +#define _CMETROIDAREACOLLIDER_HPP + +#include "types.h" + +#include "WorldFormat/CAreaOctTree.hpp" + +#include "Kyoto/Math/CAABox.hpp" + +#include "rstl/reserved_vector.hpp" + +class CMetroidAreaCollider { +public: + class COctreeLeafCache { + public: + COctreeLeafCache(const CAreaOctTree& octTree); + void AddLeaf(const CAreaOctTree::Node& node); + u32 GetNumLeaves() const { return x4_nodeCache.size(); } + bool HasCacheOverflowed() const { return x908_24_overflow; } + const CAreaOctTree& GetOctTree() const { return x0_octTree; } + rstl::reserved_vector< CAreaOctTree::Node, 64 >::const_iterator begin() const { + return x4_nodeCache.begin(); + } + rstl::reserved_vector< CAreaOctTree::Node, 64 >::const_iterator end() const { + return x4_nodeCache.end(); + } + + private: + const CAreaOctTree& x0_octTree; + rstl::reserved_vector< CAreaOctTree::Node, 64 > x4_nodeCache; + bool x908_24_overflow : 1; + }; + + // TODO + +private: + // TODO +}; + +class CAreaCollisionCache { +public: + CAreaCollisionCache(const CAABox& aabb); + + void ClearCache(); + const CAABox& GetCacheBounds() const { return x0_aabb; } + void SetCacheBounds(const CAABox& aabb) { x0_aabb = aabb; } + void AddOctreeLeafCache(const CMetroidAreaCollider::COctreeLeafCache& leafCache); + u32 GetNumCaches() const { return x18_leafCaches.size(); } + const CMetroidAreaCollider::COctreeLeafCache& GetOctreeLeafCache(int idx) { + return x18_leafCaches[idx]; + } + bool HasCacheOverflowed() const { return x1b40_24_leafOverflow; } + rstl::reserved_vector< CMetroidAreaCollider::COctreeLeafCache, 3 >::const_iterator begin() const { + return x18_leafCaches.begin(); + } + rstl::reserved_vector< CMetroidAreaCollider::COctreeLeafCache, 3 >::const_iterator end() const { + return x18_leafCaches.end(); + } + +private: + CAABox x0_aabb; + rstl::reserved_vector< CMetroidAreaCollider::COctreeLeafCache, 3 > x18_leafCaches; + bool x1b40_24_leafOverflow : 1; + bool x1b40_25_cacheOverflow : 1; +}; +CHECK_SIZEOF(CAreaCollisionCache, 0x1b44) + +#endif diff --git a/include/rstl/reserved_vector.hpp b/include/rstl/reserved_vector.hpp index 628f5110..0bc03189 100644 --- a/include/rstl/reserved_vector.hpp +++ b/include/rstl/reserved_vector.hpp @@ -38,7 +38,7 @@ public: } void clear() { for (int i = 0; i < x0_count; ++i) { - rstl::destroy(&data()[i]); + rstl::destroy(&reinterpret_cast< T* >(x4_data)[i]); } x0_count = 0; } diff --git a/libc/float.h b/libc/float.h index 5023d19d..6294cdfc 100644 --- a/libc/float.h +++ b/libc/float.h @@ -5,7 +5,9 @@ extern "C" { #endif -#define FLT_EPSILON 1.1920928955078125e-07f +#define FLT_MAX 3.402823466e+38f +#define FLT_EPSILON 1.192092896e-07f +#define FLT_MIN 1.175494351e-38f #ifdef __cplusplus } diff --git a/src/Kyoto/Math/CAABox.cpp b/src/Kyoto/Math/CAABox.cpp index c39c6b26..ba7c80fb 100644 --- a/src/Kyoto/Math/CAABox.cpp +++ b/src/Kyoto/Math/CAABox.cpp @@ -1,6 +1,196 @@ #include "Kyoto/Math/CAABox.hpp" +#include "Kyoto/Math/CLineSeg.hpp" #include "Kyoto/Math/CMath.hpp" +#include "Kyoto/Math/CTransform4f.hpp" +#include "Kyoto/Math/CTri.hpp" +#include "Kyoto/Streams/CInputStream.hpp" + +#include "float.h" + +CAABox CAABox::mskInvertedBox(FLT_MIN, FLT_MIN, FLT_MIN, FLT_MAX, FLT_MAX, FLT_MAX); +CAABox CAABox::mskNullBox(0.f, 0.f, 0.f, 0.f, 0.f, 0.f); + +CAABox::CAABox(CInputStream& in) : min(in), max(in) {} + +CAABox::CAABox(const CVector3f& min, const CVector3f& max) : min(min), max(max) {} + +CLineSeg CAABox::GetEdge(EBoxEdgeId id) const { + switch (id) { + case kE_Z0: + return CLineSeg(CVector3f(min.GetX(), min.GetY(), max.GetZ()), + CVector3f(min.GetX(), min.GetY(), min.GetZ())); + case kE_Y0: + return CLineSeg(CVector3f(min.GetX(), min.GetY(), max.GetZ()), + CVector3f(min.GetX(), max.GetY(), max.GetZ())); + case kE_X0: + return CLineSeg(CVector3f(min.GetX(), min.GetY(), min.GetZ()), + CVector3f(max.GetX(), min.GetY(), min.GetZ())); + case kE_Y1: + return CLineSeg(CVector3f(min.GetX(), min.GetY(), min.GetZ()), + CVector3f(min.GetX(), max.GetY(), min.GetZ())); + case kE_Z1: + return CLineSeg(CVector3f(max.GetX(), min.GetY(), min.GetZ()), + CVector3f(max.GetX(), min.GetY(), max.GetZ())); + case kE_Y2: + return CLineSeg(CVector3f(max.GetX(), min.GetY(), min.GetZ()), + CVector3f(max.GetX(), max.GetY(), min.GetZ())); + case kE_X1: + return CLineSeg(CVector3f(max.GetX(), min.GetY(), max.GetZ()), + CVector3f(min.GetX(), min.GetY(), max.GetZ())); + case kE_Y3: + return CLineSeg(CVector3f(max.GetX(), min.GetY(), max.GetZ()), + CVector3f(max.GetX(), max.GetY(), max.GetZ())); + case kE_Z2: + return CLineSeg(CVector3f(max.GetX(), max.GetY(), max.GetZ()), + CVector3f(max.GetX(), max.GetY(), min.GetZ())); + case kE_X2: + return CLineSeg(CVector3f(max.GetX(), max.GetY(), min.GetZ()), + CVector3f(min.GetX(), max.GetY(), min.GetZ())); + case kE_Z3: + return CLineSeg(CVector3f(min.GetX(), max.GetY(), min.GetZ()), + CVector3f(min.GetX(), max.GetY(), max.GetZ())); + case kE_X3: + return CLineSeg(CVector3f(min.GetX(), max.GetY(), max.GetZ()), + CVector3f(max.GetX(), max.GetY(), max.GetZ())); + default: + return CLineSeg(CVector3f(min.GetX(), min.GetY(), max.GetZ()), + CVector3f(min.GetX(), min.GetY(), min.GetZ())); + } +} + +CTri CAABox::GetTri(EBoxFaceId face, int windOffset) const { + CVector3f verts[4] = { + CVector3f(min.GetX(), min.GetY(), max.GetZ()), + CVector3f(min.GetX(), min.GetY(), min.GetZ()), + CVector3f(max.GetX(), min.GetY(), min.GetZ()), + CVector3f(max.GetX(), min.GetY(), max.GetZ()), + }; + switch (face) { + case kF_YMin: + default: + verts[0] = CVector3f(min.GetX(), min.GetY(), max.GetZ()); + verts[1] = CVector3f(max.GetX(), min.GetY(), max.GetZ()); + verts[2] = CVector3f(max.GetX(), min.GetY(), min.GetZ()); + verts[3] = CVector3f(min.GetX(), min.GetY(), min.GetZ()); + break; + case kF_YMax: + verts[0] = CVector3f(max.GetX(), max.GetY(), max.GetZ()); + verts[1] = CVector3f(min.GetX(), max.GetY(), max.GetZ()); + verts[2] = CVector3f(min.GetX(), max.GetY(), min.GetZ()); + verts[3] = CVector3f(max.GetX(), max.GetY(), min.GetZ()); + break; + case kF_XMin: + verts[0] = CVector3f(min.GetX(), max.GetY(), max.GetZ()); + verts[1] = CVector3f(min.GetX(), min.GetY(), max.GetZ()); + verts[2] = CVector3f(min.GetX(), min.GetY(), min.GetZ()); + verts[3] = CVector3f(min.GetX(), max.GetY(), min.GetZ()); + break; + case kF_XMax: + verts[0] = CVector3f(max.GetX(), min.GetY(), max.GetZ()); + verts[1] = CVector3f(max.GetX(), max.GetY(), max.GetZ()); + verts[2] = CVector3f(max.GetX(), max.GetY(), min.GetZ()); + verts[3] = CVector3f(max.GetX(), min.GetY(), min.GetZ()); + break; + case kF_ZMax: + verts[0] = CVector3f(min.GetX(), max.GetY(), max.GetZ()); + verts[1] = CVector3f(max.GetX(), max.GetY(), max.GetZ()); + verts[2] = CVector3f(max.GetX(), min.GetY(), max.GetZ()); + verts[3] = CVector3f(min.GetX(), min.GetY(), max.GetZ()); + break; + case kF_ZMin: + verts[0] = min; + verts[1] = CVector3f(max.GetX(), min.GetY(), min.GetZ()); + verts[2] = CVector3f(max.GetX(), max.GetY(), min.GetZ()); + verts[3] = CVector3f(min.GetX(), max.GetY(), min.GetZ()); + break; + } + return CTri(verts[windOffset], verts[(windOffset + 1) % 4], verts[(windOffset + 2) % 4]); +} + +bool CAABox::DoBoundsOverlap(const CAABox& other) const { + if (other.min.GetX() > max.GetX() || min.GetX() > other.max.GetX() || + other.min.GetY() > max.GetY() || min.GetY() > other.max.GetY() || + other.min.GetZ() > max.GetZ() || min.GetZ() > other.max.GetZ()) { + return false; + } + return true; +} + +void CAABox::AccumulateBounds(const CVector3f& other) { + if (other.GetX() < min.GetX()) { + min.SetX(other.GetX()); + } + if (other.GetY() < min.GetY()) { + min.SetY(other.GetY()); + } + if (other.GetZ() < min.GetZ()) { + min.SetZ(other.GetZ()); + } + if (other.GetX() > max.GetX()) { + max.SetX(other.GetX()); + } + if (other.GetY() > max.GetY()) { + max.SetY(other.GetY()); + } + if (other.GetZ() > max.GetZ()) { + max.SetZ(other.GetZ()); + } +} + +bool CAABox::Inside(const CAABox& other) const { + if (min.GetX() >= other.min.GetX() && max.GetX() <= other.max.GetX() && + min.GetY() >= other.min.GetY() && max.GetY() <= other.max.GetY() && + min.GetZ() >= other.min.GetZ() && max.GetZ() <= other.max.GetZ()) { + return true; + } + return false; +} + +bool CAABox::InsidePlane(const CPlane& plane) const { + CVector3f vec(CMath::FastFSel(plane.GetNormal().GetX(), min.GetX(), max.GetX()), + CMath::FastFSel(plane.GetNormal().GetY(), min.GetY(), max.GetY()), + CMath::FastFSel(plane.GetNormal().GetZ(), min.GetZ(), max.GetZ())); + return !(CVector3f::Dot(plane.GetNormal(), vec) >= plane.GetConstant()); +} + +// TODO non-matching +CAABox CAABox::GetTransformedAABox(const CTransform4f& xf) const { + if (&xf == &CTransform4f::Identity()) { + return *this; + } + + CVector3f newMin = xf.GetTranslation(); + CVector3f newMax = xf.GetTranslation(); + for (int x = 0; x < 3; ++x) { + for (int y = 0; y < 3; ++y) { + f32 mul = xf.GetRow(x)[y]; + f32 minMul = mul * GetMinPoint()[y]; + f32 maxMul = mul * GetMaxPoint()[y]; + if (minMul < maxMul) { + newMin[x] += maxMul; + newMax[x] += minMul; + } else { + newMin[x] += minMul; + newMax[x] += maxMul; + } + } + } + return CAABox(newMin, newMax); +} + +CVector3f CAABox::ClampToBox(const CVector3f& vec) const { + return CVector3f( + vec.GetX() < min.GetX() ? min.GetX() : (vec.GetX() > max.GetX() ? max.GetX() : vec.GetX()), + vec.GetY() < min.GetY() ? min.GetY() : (vec.GetY() > max.GetY() ? max.GetY() : vec.GetY()), + vec.GetZ() < min.GetZ() ? min.GetZ() : (vec.GetZ() > max.GetZ() ? max.GetZ() : vec.GetZ())); +} + +CVector3f CAABox::FurthestPointAlongVector(const CVector3f& vec) const { + return CVector3f(CMath::FastFSel(vec.GetX(), max.GetX(), min.GetX()), + CMath::FastFSel(vec.GetY(), max.GetY(), min.GetY()), + CMath::FastFSel(vec.GetZ(), max.GetZ(), min.GetZ())); +} CVector3f CAABox::ClosestPointAlongVector(const CVector3f& vec) const { return CVector3f(CMath::FastFSel(vec.GetX(), min.GetX(), max.GetX()), diff --git a/src/MetroidPrime/Cameras/CBallCamera.cpp b/src/MetroidPrime/Cameras/CBallCamera.cpp index 00ac6829..f4dd501a 100644 --- a/src/MetroidPrime/Cameras/CBallCamera.cpp +++ b/src/MetroidPrime/Cameras/CBallCamera.cpp @@ -2,14 +2,19 @@ #include "math.h" +#include "Collision/CCollidableSphere.hpp" +#include "Collision/CCollisionInfo.hpp" #include "Collision/CRayCastResult.hpp" #include "MetroidPrime/CCollisionActor.hpp" +#include "MetroidPrime/CGameCollision.hpp" #include "MetroidPrime/Cameras/CCameraManager.hpp" #include "MetroidPrime/Player/CPlayer.hpp" #include "MetroidPrime/Tweaks/CTweakBall.hpp" #include "MetroidPrime/Tweaks/CTweakPlayer.hpp" +#include "WorldFormat/CMetroidAreaCollider.hpp" + static CMaterialList kLineOfSightIncludeList = CMaterialList(kMT_Solid); static CMaterialList kLineOfSightExcludeList = CMaterialList(kMT_ProjectilePassthrough, kMT_Player, kMT_Character, kMT_CameraPassthrough); @@ -354,3 +359,231 @@ void CBallCamera::UpdateColliders(const CTransform4f& xf, } } } + +// TODO non-matching regswaps +CVector3f +CBallCamera::CalculateCollidersCentroid(const rstl::vector< CCameraCollider >& colliderList, + int numObscured) const { + if (colliderList.size() < 3) { + return CVector3f(0.f, 1.f, 0.f); + } + + int clearColliders = 0; + int prevCol = colliderList.size() - 1; + f32 accumCross = 0.f; + f32 accumX = 0.f; + f32 accumZ = 0.f; + for (int i = 0; i < colliderList.size(); ++i) { + if (colliderList[prevCol].GetOcclusionCount() < 2 && colliderList[i].GetOcclusionCount() < 2) { + f32 scale = colliderList[prevCol].GetScale(); + f32 z0 = scale * colliderList[prevCol].GetPosition().GetZ(); + f32 x0 = scale * colliderList[prevCol].GetPosition().GetX(); + f32 x1 = scale * colliderList[i].GetPosition().GetX(); + f32 z1 = scale * colliderList[i].GetPosition().GetZ(); + + f32 cross = x0 * z1 - x1 * z0; + accumCross += cross; + accumX += cross * (x1 + x0); + accumZ += cross * (z1 + z0); + } else { + clearColliders += 1; + } + prevCol = i; + } + + if (static_cast< f32 >(clearColliders) / static_cast< f32 >(colliderList.size()) <= + x330_clearColliderThreshold) { + return CVector3f(0.f, 1.f, 0.f); + } + + if (accumCross != 0.f) { + f32 baryCross = 3.f * accumCross; + return CVector3f(accumX / baryCross, 0.f, accumZ / baryCross); + } + + return CVector3f(0.f, 2.f, 0.f); +} + +CVector3f CBallCamera::ApplyColliders() { + CVector3f smallCentroid = + CalculateCollidersCentroid(x264_smallColliders, x2c4_smallCollidersObsCount); + CVector3f mediumCentroid = + CalculateCollidersCentroid(x274_mediumColliders, x2c8_mediumCollidersObsCount); + CVector3f largeCentroid = + CalculateCollidersCentroid(x284_largeColliders, x2cc_largeCollidersObsCount); + + if (smallCentroid.GetY() == 0.f) { + x2a0_smallCentroid = smallCentroid; + } else { + x2a0_smallCentroid = CVector3f::Zero(); + } + + float centroidX = x2a0_smallCentroid.GetX(); + float centroidZ = x2a0_smallCentroid.GetZ(); + + if (mediumCentroid.GetY() == 0.f) { + x2ac_mediumCentroid = mediumCentroid; + } else { + x2ac_mediumCentroid = CVector3f::Zero(); + } + + centroidX += x2ac_mediumCentroid.GetX(); + centroidZ += x2ac_mediumCentroid.GetZ(); + + if (largeCentroid.GetY() == 0.f) { + x2b8_largeCentroid = largeCentroid; + } else { + x2b8_largeCentroid = CVector3f::Zero(); + } + + centroidX += x2b8_largeCentroid.GetX(); + centroidZ += x2b8_largeCentroid.GetZ(); + + if (x18c_31_clearLOS) { + centroidX /= 1.5f; + } + centroidZ /= 3.f; + + if (!x18c_31_clearLOS && x368_obscuringObjectId == kInvalidUniqueId) { + float xMul = 1.5f; + float zMul = 1.f; + if (x350_obscuringMaterial.HasMaterial(kMT_Floor)) { + zMul += 2.f * x358_unobscureMag; + } + if (x350_obscuringMaterial.HasMaterial(kMT_Wall)) { + xMul += 3.f * CMath::Clamp(0.f, x358_unobscureMag - 0.25f, 1.f); + } + centroidX *= xMul; + centroidZ *= zMul; + } + + if (!x18c_28_volumeCollider) { + return CVector3f::Zero(); + } + + if (fabsf(centroidX) < 0.05f) { + centroidX = 0.f; + } + if (fabsf(centroidZ) < 0.05f) { + centroidZ = 0.f; + } + + if (x18c_31_clearLOS) { + centroidZ *= 0.5f; + } + + return CVector3f(centroidX, 0.f, centroidZ); +} + +int CBallCamera::CountObscuredColliders(const rstl::vector< CCameraCollider >& colliderList) const { + int ret = 0; + for (int i = 0; i < colliderList.size(); i++) { + if (colliderList[i].GetOcclusionCount() >= 2) { + ++ret; + } + } + return ret; +} + +CAABox +CBallCamera::CalculateCollidersBoundingBox(const rstl::vector< CCameraCollider >& colliderList, + const CStateManager& mgr) const { + CAABox aabb = CAABox::MakeMaxInvertedBox(); + for (int i = 0; i < colliderList.size(); i++) { + aabb.AccumulateBounds(colliderList[i].GetRealPosition()); + } + aabb.AccumulateBounds(mgr.GetPlayer()->GetTranslation()); + return aabb; +} + +CVector3f CBallCamera::AvoidGeometryFull(const CTransform4f& xf, const TEntityList& nearList, + f32 dt, CStateManager& mgr) { + UpdateColliders(xf, x264_smallColliders, x2d0_smallColliderIt, x264_smallColliders.size(), 4.f, + nearList, dt, mgr); + UpdateColliders(xf, x274_mediumColliders, x2d4_mediumColliderIt, x274_mediumColliders.size(), 4.f, + nearList, dt, mgr); + UpdateColliders(xf, x284_largeColliders, x2d8_largeColliderIt, x284_largeColliders.size(), 4.f, + nearList, dt, mgr); + return ApplyColliders(); +} + +CVector3f CBallCamera::AvoidGeometry(const CTransform4f& xf, const TEntityList& nearList, f32 dt, + CStateManager& mgr) { + switch (x328_avoidGeomCycle) { + case 0: + UpdateColliders(xf, x264_smallColliders, x2d0_smallColliderIt, 1, 4.f, nearList, dt, mgr); + break; + case 1: + UpdateColliders(xf, x274_mediumColliders, x2d4_mediumColliderIt, 3, 4.f, nearList, dt, mgr); + break; + case 2: + UpdateColliders(xf, x284_largeColliders, x2d8_largeColliderIt, 4, 4.f, nearList, dt, mgr); + break; + case 3: + UpdateColliders(xf, x284_largeColliders, x2d8_largeColliderIt, 4, 4.f, nearList, dt, mgr); + break; + default: + break; + } + + int newCycle = x328_avoidGeomCycle + 1; + x328_avoidGeomCycle = newCycle; + if (newCycle >= 4) { + x328_avoidGeomCycle = 0; + } + + return ApplyColliders(); +} + +// TODO non-matching regswaps +bool CBallCamera::DetectCollision(const CVector3f& from, const CVector3f& to, f32 radius, f32& d, + CStateManager& mgr) { + CVector3f delta = to - from; + f32 deltaMag = delta.Magnitude(); + CVector3f deltaNorm = delta * (1.f / deltaMag); + bool clear = true; + + if (deltaMag > 0.000001f) { + f32 margin = 2.f * radius; + CAABox aabb = CAABox::MakeMaxInvertedBox(); + aabb.AccumulateBounds(from); + aabb.AccumulateBounds(to); + aabb = CAABox(aabb.GetMinPoint() - CVector3f(margin, margin, margin), + aabb.GetMaxPoint() + CVector3f(margin, margin, margin)); + TEntityList nearList; + mgr.BuildColliderList(nearList, *mgr.GetPlayer(), aabb); + CAreaCollisionCache cache(aabb); + CGameCollision::BuildAreaCollisionCache(mgr, cache); + if (cache.HasCacheOverflowed()) { + clear = false; + } + if (CGameCollision::DetectCollisionBoolean_Cached( + mgr, cache, + CCollidableSphere(CSphere(CVector3f::Zero(), radius), CMaterialList(kMT_Solid)), + CTransform4f::Translate(from), + CMaterialFilter::MakeIncludeExclude( + CMaterialList(kMT_Solid), CMaterialList(kMT_ProjectilePassthrough, kMT_Player, + kMT_Character, kMT_CameraPassthrough)), + nearList)) { + d = -1.f; + return true; + } + if (clear) { + TUniqueId intersectId = kInvalidUniqueId; + CCollisionInfo info; + f64 dTmp = deltaMag; + if (CGameCollision::DetectCollision_Cached_Moving( + mgr, cache, + CCollidableSphere(CSphere(CVector3f::Zero(), radius), CMaterialList(kMT_Solid)), + CTransform4f::Translate(from), + CMaterialFilter::MakeIncludeExclude( + CMaterialList(kMT_Solid), CMaterialList(kMT_ProjectilePassthrough, kMT_Player, + kMT_Character, kMT_CameraPassthrough)), + nearList, deltaNorm, intersectId, info, dTmp)) { + d = static_cast< f32 >(dTmp); + clear = false; + } + } + } + return !clear; +}