mirror of https://github.com/PrimeDecomp/prime.git
Improve CTargetableProjectile
This commit is contained in:
parent
816dde4f03
commit
4c235504e9
|
@ -7,8 +7,8 @@ lbl_ctor:
|
||||||
.section .data
|
.section .data
|
||||||
.balign 8
|
.balign 8
|
||||||
|
|
||||||
.global lbl_803E7158
|
.global __vt__17CEnergyProjectile
|
||||||
lbl_803E7158:
|
__vt__17CEnergyProjectile:
|
||||||
# ROM: 0x3E4158
|
# ROM: 0x3E4158
|
||||||
.4byte 0
|
.4byte 0
|
||||||
.4byte 0
|
.4byte 0
|
||||||
|
@ -2010,9 +2010,9 @@ lbl_80215680:
|
||||||
/* 80215778 002126D8 4B E2 4D 0D */ bl "__ct__15CGameProjectileFbRC28TToken<18CWeaponDescription>RCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>sb"
|
/* 80215778 002126D8 4B E2 4D 0D */ bl "__ct__15CGameProjectileFbRC28TToken<18CWeaponDescription>RCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>11EWeaponTypeRC12CTransform4f14EMaterialTypesRC11CDamageInfo9TUniqueId7TAreaId9TUniqueId9TUniqueIdUibRC9CVector3fRCQ24rstl50optional_object<31TLockedToken<15CGenDescription>>sb"
|
||||||
/* 8021577C 002126DC 38 61 00 40 */ addi r3, r1, 0x40
|
/* 8021577C 002126DC 38 61 00 40 */ addi r3, r1, 0x40
|
||||||
/* 80215780 002126E0 48 12 83 61 */ bl "internal_dereference__Q24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>Fv"
|
/* 80215780 002126E0 48 12 83 61 */ bl "internal_dereference__Q24rstl66basic_string<c,Q24rstl14char_traits<c>,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
|
/* 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
|
/* 80215790 002126F0 38 70 02 EC */ addi r3, r16, 0x2ec
|
||||||
/* 80215794 002126F4 90 90 00 00 */ stw r4, 0(r16)
|
/* 80215794 002126F4 90 90 00 00 */ stw r4, 0(r16)
|
||||||
/* 80215798 002126F8 90 10 02 E8 */ stw r0, 0x2e8(r16)
|
/* 80215798 002126F8 90 10 02 E8 */ stw r0, 0x2e8(r16)
|
||||||
|
|
|
@ -96,9 +96,9 @@ __dt__17CEnergyProjectileFv:
|
||||||
/* 8013B908 00138868 93 C1 00 08 */ stw r30, 8(r1)
|
/* 8013B908 00138868 93 C1 00 08 */ stw r30, 8(r1)
|
||||||
/* 8013B90C 0013886C 7C 7E 1B 79 */ or. r30, r3, r3
|
/* 8013B90C 0013886C 7C 7E 1B 79 */ or. r30, r3, r3
|
||||||
/* 8013B910 00138870 41 82 00 70 */ beq lbl_8013B980
|
/* 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
|
/* 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)
|
/* 8013B920 00138880 90 1E 00 00 */ stw r0, 0(r30)
|
||||||
/* 8013B924 00138884 41 82 00 40 */ beq lbl_8013B964
|
/* 8013B924 00138884 41 82 00 40 */ beq lbl_8013B964
|
||||||
/* 8013B928 00138888 34 1E 03 7C */ addic. r0, r30, 0x37c
|
/* 8013B928 00138888 34 1E 03 7C */ addic. r0, r30, 0x37c
|
||||||
|
|
|
@ -32,6 +32,7 @@ public:
|
||||||
virtual void ResolveCollisionWithActor(const CRayCastResult& res, CActor& act,
|
virtual void ResolveCollisionWithActor(const CRayCastResult& res, CActor& act,
|
||||||
CStateManager& mgr);
|
CStateManager& mgr);
|
||||||
|
|
||||||
|
const CProjectileWeapon& GetProjectile() const { return x170_projectile; }
|
||||||
const CVector3f& GetPreviousPos() const { return x298_previousPos; }
|
const CVector3f& GetPreviousPos() const { return x298_previousPos; }
|
||||||
TUniqueId GetHomingTargetId() const { return x2c0_homingTargetId; }
|
TUniqueId GetHomingTargetId() const { return x2c0_homingTargetId; }
|
||||||
TUniqueId GetHitProjectileOwner() const { return x2c4_hitProjectileOwner; }
|
TUniqueId GetHitProjectileOwner() const { return x2c4_hitProjectileOwner; }
|
||||||
|
|
|
@ -11,16 +11,24 @@ public:
|
||||||
TUniqueId uid, TAreaId aid, TUniqueId owner,
|
TUniqueId uid, TAreaId aid, TUniqueId owner,
|
||||||
const TLockedToken< CWeaponDescription >& weapDesc, TUniqueId homingTarget,
|
const TLockedToken< CWeaponDescription >& weapDesc, TUniqueId homingTarget,
|
||||||
EProjectileAttrib attribs,
|
EProjectileAttrib attribs,
|
||||||
const rstl::optional_object< TLockedToken< CGenDescription > >& visorParticle, ushort visorSfx,
|
const rstl::optional_object< TLockedToken< CGenDescription > >& visorParticle,
|
||||||
bool sendCollideMsg);
|
ushort visorSfx, bool sendCollideMsg);
|
||||||
|
|
||||||
|
// CEntity
|
||||||
|
~CTargetableProjectile() override;
|
||||||
void Accept(IVisitor&) override;
|
void Accept(IVisitor&) override;
|
||||||
|
|
||||||
|
// CACtor
|
||||||
CVector3f GetAimPosition(const CStateManager&, float) const override;
|
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,
|
void ResolveCollisionWithActor(const CRayCastResult& res, CActor& act,
|
||||||
CStateManager& mgr) override;
|
CStateManager& mgr) override;
|
||||||
|
|
||||||
|
// CEnergyProjectile
|
||||||
|
bool Explode(const CVector3f& pos, const CVector3f& normal, EWeaponCollisionResponseTypes type,
|
||||||
|
CStateManager& mgr, const CDamageVulnerability& dVuln, TUniqueId hitActor) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
TToken< CWeaponDescription > x3d8_weaponDesc;
|
TToken< CWeaponDescription > x3d8_weaponDesc;
|
||||||
CDamageInfo x3e0_damage;
|
CDamageInfo x3e0_damage;
|
||||||
|
|
|
@ -55,15 +55,16 @@ bool CTargetableProjectile::Explode(const CVector3f& pos, const CVector3f& norma
|
||||||
|
|
||||||
CVector3f CTargetableProjectile::GetAimPosition(const CStateManager& mgr, float dt) const {
|
CVector3f CTargetableProjectile::GetAimPosition(const CStateManager& mgr, float dt) const {
|
||||||
static float tickRecip = 1.f / CProjectileWeapon::GetTickPeriod();
|
static float tickRecip = 1.f / CProjectileWeapon::GetTickPeriod();
|
||||||
|
const CProjectileWeapon& projectile = GetProjectile();
|
||||||
|
|
||||||
// CVector3f translation = GetTranslation();
|
CVector3f translation = GetTranslation();
|
||||||
// CVector3f velocity = tickRecip * x170_projectile.GetVelocity();
|
CVector3f velocity = tickRecip * projectile.GetVelocity();
|
||||||
// CVector3f gravity = (tickRecip * x170_projectile.GetGravity()) * 0.5f;
|
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)) +
|
// return (dt * (dt * ((tickRecip * projectile.GetGravity()) * 0.5f))) +
|
||||||
(dt * (tickRecip * x170_projectile.GetVelocity())) + GetTranslation();
|
// (dt * (tickRecip * projectile.GetVelocity())) + translation;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CTargetableProjectile::ResolveCollisionWithActor(const CRayCastResult& res, CActor& act,
|
void CTargetableProjectile::ResolveCollisionWithActor(const CRayCastResult& res, CActor& act,
|
||||||
|
@ -75,3 +76,7 @@ void CTargetableProjectile::ResolveCollisionWithActor(const CRayCastResult& res,
|
||||||
SetTransform(xf);
|
SetTransform(xf);
|
||||||
CEnergyProjectile::ResolveCollisionWithActor(res, act, mgr);
|
CEnergyProjectile::ResolveCollisionWithActor(res, act, mgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CEnergyProjectile::~CEnergyProjectile() {}
|
||||||
|
|
||||||
|
CTargetableProjectile::~CTargetableProjectile() {}
|
||||||
|
|
Loading…
Reference in New Issue