diff --git a/asm/MetroidPrime/Weapons/CEnergyProjectile.s b/asm/MetroidPrime/Weapons/CEnergyProjectile.s index 2625fa29..3c2db626 100644 --- a/asm/MetroidPrime/Weapons/CEnergyProjectile.s +++ b/asm/MetroidPrime/Weapons/CEnergyProjectile.s @@ -7,8 +7,8 @@ lbl_ctor: .section .data .balign 8 -.global lbl_803E7158 -lbl_803E7158: +.global __vt__17CEnergyProjectile +__vt__17CEnergyProjectile: # ROM: 0x3E4158 .4byte 0 .4byte 0 @@ -2010,9 +2010,9 @@ lbl_80215680: /* 80215778 002126D8 4B E2 4D 0D */ bl "__ct__15CGameProjectileFbRC28TToken<18CWeaponDescription>RCQ24rstl66basic_string,Q24rstl17rmemory_allocator>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>sb" /* 8021577C 002126DC 38 61 00 40 */ addi r3, r1, 0x40 /* 80215780 002126E0 48 12 83 61 */ bl "internal_dereference__Q24rstl66basic_string,Q24rstl17rmemory_allocator>Fv" -/* 80215784 002126E4 3C 60 80 3E */ lis r3, lbl_803E7158@ha +/* 80215784 002126E4 3C 60 80 3E */ lis r3, __vt__17CEnergyProjectile@ha /* 80215788 002126E8 38 00 00 00 */ li r0, 0 -/* 8021578C 002126EC 38 83 71 58 */ addi r4, r3, lbl_803E7158@l +/* 8021578C 002126EC 38 83 71 58 */ addi r4, r3, __vt__17CEnergyProjectile@l /* 80215790 002126F0 38 70 02 EC */ addi r3, r16, 0x2ec /* 80215794 002126F4 90 90 00 00 */ stw r4, 0(r16) /* 80215798 002126F8 90 10 02 E8 */ stw r0, 0x2e8(r16) diff --git a/asm/MetroidPrime/Weapons/CTargetableProjectile.s b/asm/MetroidPrime/Weapons/CTargetableProjectile.s index ea09f9ca..02bebfa0 100644 --- a/asm/MetroidPrime/Weapons/CTargetableProjectile.s +++ b/asm/MetroidPrime/Weapons/CTargetableProjectile.s @@ -96,9 +96,9 @@ __dt__17CEnergyProjectileFv: /* 8013B908 00138868 93 C1 00 08 */ stw r30, 8(r1) /* 8013B90C 0013886C 7C 7E 1B 79 */ or. r30, r3, r3 /* 8013B910 00138870 41 82 00 70 */ beq lbl_8013B980 -/* 8013B914 00138874 3C 60 80 3E */ lis r3, lbl_803E7158@ha +/* 8013B914 00138874 3C 60 80 3E */ lis r3, __vt__17CEnergyProjectile@ha /* 8013B918 00138878 34 1E 02 FC */ addic. r0, r30, 0x2fc -/* 8013B91C 0013887C 38 03 71 58 */ addi r0, r3, lbl_803E7158@l +/* 8013B91C 0013887C 38 03 71 58 */ addi r0, r3, __vt__17CEnergyProjectile@l /* 8013B920 00138880 90 1E 00 00 */ stw r0, 0(r30) /* 8013B924 00138884 41 82 00 40 */ beq lbl_8013B964 /* 8013B928 00138888 34 1E 03 7C */ addic. r0, r30, 0x37c diff --git a/include/MetroidPrime/Weapons/CGameProjectile.hpp b/include/MetroidPrime/Weapons/CGameProjectile.hpp index 1b42d3ed..b965d11d 100644 --- a/include/MetroidPrime/Weapons/CGameProjectile.hpp +++ b/include/MetroidPrime/Weapons/CGameProjectile.hpp @@ -32,6 +32,7 @@ public: virtual void ResolveCollisionWithActor(const CRayCastResult& res, CActor& act, CStateManager& mgr); + const CProjectileWeapon& GetProjectile() const { return x170_projectile; } const CVector3f& GetPreviousPos() const { return x298_previousPos; } TUniqueId GetHomingTargetId() const { return x2c0_homingTargetId; } TUniqueId GetHitProjectileOwner() const { return x2c4_hitProjectileOwner; } diff --git a/include/MetroidPrime/Weapons/CTargetableProjectile.hpp b/include/MetroidPrime/Weapons/CTargetableProjectile.hpp index 06c7f760..010fe5e1 100644 --- a/include/MetroidPrime/Weapons/CTargetableProjectile.hpp +++ b/include/MetroidPrime/Weapons/CTargetableProjectile.hpp @@ -11,16 +11,24 @@ public: TUniqueId uid, TAreaId aid, TUniqueId owner, const TLockedToken< CWeaponDescription >& weapDesc, TUniqueId homingTarget, EProjectileAttrib attribs, - const rstl::optional_object< TLockedToken< CGenDescription > >& visorParticle, ushort visorSfx, - bool sendCollideMsg); + const rstl::optional_object< TLockedToken< CGenDescription > >& visorParticle, + ushort visorSfx, bool sendCollideMsg); + // CEntity + ~CTargetableProjectile() override; void Accept(IVisitor&) override; + + // CACtor CVector3f GetAimPosition(const CStateManager&, float) const override; - bool Explode(const CVector3f& pos, const CVector3f& normal, EWeaponCollisionResponseTypes type, - CStateManager& mgr, const CDamageVulnerability& dVuln, TUniqueId hitActor) override; + + // CGameProjectile void ResolveCollisionWithActor(const CRayCastResult& res, CActor& act, CStateManager& mgr) override; + // CEnergyProjectile + bool Explode(const CVector3f& pos, const CVector3f& normal, EWeaponCollisionResponseTypes type, + CStateManager& mgr, const CDamageVulnerability& dVuln, TUniqueId hitActor) override; + private: TToken< CWeaponDescription > x3d8_weaponDesc; CDamageInfo x3e0_damage; diff --git a/src/MetroidPrime/Weapons/CTargetableProjectile.cpp b/src/MetroidPrime/Weapons/CTargetableProjectile.cpp index d51d41be..e1a22ca9 100644 --- a/src/MetroidPrime/Weapons/CTargetableProjectile.cpp +++ b/src/MetroidPrime/Weapons/CTargetableProjectile.cpp @@ -55,15 +55,16 @@ bool CTargetableProjectile::Explode(const CVector3f& pos, const CVector3f& norma CVector3f CTargetableProjectile::GetAimPosition(const CStateManager& mgr, float dt) const { static float tickRecip = 1.f / CProjectileWeapon::GetTickPeriod(); + const CProjectileWeapon& projectile = GetProjectile(); - // CVector3f translation = GetTranslation(); - // CVector3f velocity = tickRecip * x170_projectile.GetVelocity(); - // CVector3f gravity = (tickRecip * x170_projectile.GetGravity()) * 0.5f; + CVector3f translation = GetTranslation(); + CVector3f velocity = tickRecip * projectile.GetVelocity(); + CVector3f gravity = tickRecip * projectile.GetGravity(); - // return (dt * dt * gravity) + (dt * velocity) + translation; + return (dt * (dt * (gravity * 0.5f))) + (dt * velocity) + translation; - return (dt * dt * ((tickRecip * x170_projectile.GetGravity()) * 0.5f)) + - (dt * (tickRecip * x170_projectile.GetVelocity())) + GetTranslation(); + // return (dt * (dt * ((tickRecip * projectile.GetGravity()) * 0.5f))) + + // (dt * (tickRecip * projectile.GetVelocity())) + translation; } void CTargetableProjectile::ResolveCollisionWithActor(const CRayCastResult& res, CActor& act, @@ -75,3 +76,7 @@ void CTargetableProjectile::ResolveCollisionWithActor(const CRayCastResult& res, SetTransform(xf); CEnergyProjectile::ResolveCollisionWithActor(res, act, mgr); } + +CEnergyProjectile::~CEnergyProjectile() {} + +CTargetableProjectile::~CTargetableProjectile() {}