CTargetableProjectile: Implement ResolveCollisionWithActor & fixes

This commit is contained in:
Luke Street 2020-09-25 14:14:24 -04:00
parent bbf66133c5
commit c474b19b9d
2 changed files with 12 additions and 6 deletions

View File

@ -35,16 +35,16 @@ bool CTargetableProjectile::Explode(const zeus::CVector3f& pos, const zeus::CVec
const CDamageVulnerability& dVuln, TUniqueId hitActor) { const CDamageVulnerability& dVuln, TUniqueId hitActor) {
bool ret = CEnergyProjectile::Explode(pos, normal, type, mgr, dVuln, hitActor); bool ret = CEnergyProjectile::Explode(pos, normal, type, mgr, dVuln, hitActor);
if (x2e4_24_active || x2c4_ == kInvalidUniqueId || x2c4_ != mgr.GetPlayer().GetUniqueId()) if (x2e4_24_active || x2c4_ == kInvalidUniqueId || x2c4_ != mgr.GetPlayer().GetUniqueId()) {
return ret; return ret;
}
if (TCastToConstPtr<CActor> act = mgr.GetObjectById(xec_ownerId)) { if (TCastToConstPtr<CActor> act = mgr.GetObjectById(xec_ownerId)) {
TUniqueId uid = mgr.AllocateUniqueId(); TUniqueId uid = mgr.AllocateUniqueId();
zeus::CTransform xf = zeus::CTransform xf = zeus::lookAt(x170_projectile.GetTranslation(), act->GetAimPosition(mgr, 0.f), zeus::skUp);
zeus::lookAt(x170_projectile.GetTranslation(), act->GetAimPosition(mgr, 0.f), zeus::skUp); auto* projectile = new CEnergyProjectile(true, x3d8_weaponDesc, xf0_weaponType, xf, EMaterialTypes::Player,
CEnergyProjectile* projectile = new CEnergyProjectile( x3e0_damage, uid, GetAreaIdAlways(), x2c4_, xec_ownerId,
true, x3d8_weaponDesc, xf0_weaponType, xf, EMaterialTypes::Player, x3e0_damage, uid, GetAreaIdAlways(), EProjectileAttrib::None, false, zeus::skOne3f, {}, 0xFFFF, false);
kInvalidUniqueId, xec_ownerId, EProjectileAttrib::None, false, zeus::skOne3f, {}, 0xFFFF, false);
mgr.AddObject(projectile); mgr.AddObject(projectile);
projectile->AddMaterial(EMaterialTypes::Orbit); projectile->AddMaterial(EMaterialTypes::Orbit);
mgr.GetPlayer().ResetAimTargetPrediction(uid); mgr.GetPlayer().ResetAimTargetPrediction(uid);
@ -55,4 +55,9 @@ bool CTargetableProjectile::Explode(const zeus::CVector3f& pos, const zeus::CVec
return ret; return ret;
} }
void CTargetableProjectile::ResolveCollisionWithActor(const CRayCastResult& res, CActor& act, CStateManager& mgr) {
SetTransform(zeus::lookAt(GetTranslation(), GetAimPosition(mgr, 0.1f)));
CEnergyProjectile::ResolveCollisionWithActor(res, act, mgr);
}
} // namespace urde } // namespace urde

View File

@ -23,6 +23,7 @@ public:
zeus::CVector3f GetAimPosition(const CStateManager&, float) const override; zeus::CVector3f GetAimPosition(const CStateManager&, float) const override;
bool Explode(const zeus::CVector3f& pos, const zeus::CVector3f& normal, EWeaponCollisionResponseTypes type, bool Explode(const zeus::CVector3f& pos, const zeus::CVector3f& normal, EWeaponCollisionResponseTypes type,
CStateManager& mgr, const CDamageVulnerability& dVuln, TUniqueId hitActor) override; CStateManager& mgr, const CDamageVulnerability& dVuln, TUniqueId hitActor) override;
void ResolveCollisionWithActor(const CRayCastResult& res, CActor& act, CStateManager& mgr) override;
}; };
} // namespace urde } // namespace urde