mirror of https://github.com/AxioDL/metaforce.git
Merge pull request #137 from lioncash/damage-info
CDamageInfo: Make certain constructors constexpr
This commit is contained in:
commit
afc77c35e6
|
@ -19,7 +19,7 @@ class CDamageInfo {
|
||||||
bool x18_noImmunity = false;
|
bool x18_noImmunity = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CDamageInfo() = default;
|
constexpr CDamageInfo() = default;
|
||||||
CDamageInfo(CInputStream& in) {
|
CDamageInfo(CInputStream& in) {
|
||||||
in.readUint32Big();
|
in.readUint32Big();
|
||||||
x0_weaponMode = CWeaponMode(EWeaponType(in.readUint32Big()));
|
x0_weaponMode = CWeaponMode(EWeaponType(in.readUint32Big()));
|
||||||
|
@ -28,10 +28,15 @@ public:
|
||||||
x10_radius = in.readFloatBig();
|
x10_radius = in.readFloatBig();
|
||||||
x14_knockback = in.readFloatBig();
|
x14_knockback = in.readFloatBig();
|
||||||
}
|
}
|
||||||
CDamageInfo(const CWeaponMode& mode, float damage, float radius, float knockback)
|
constexpr CDamageInfo(const CWeaponMode& mode, float damage, float radius, float knockback)
|
||||||
: x0_weaponMode(mode), x8_damage(damage), xc_radiusDamage(damage), x10_radius(radius), x14_knockback(knockback) {}
|
: x0_weaponMode(mode), x8_damage(damage), xc_radiusDamage(damage), x10_radius(radius), x14_knockback(knockback) {}
|
||||||
|
|
||||||
CDamageInfo(const CDamageInfo& other) = default;
|
constexpr CDamageInfo(const CDamageInfo&) = default;
|
||||||
|
constexpr CDamageInfo& operator=(const CDamageInfo&) = default;
|
||||||
|
|
||||||
|
constexpr CDamageInfo(CDamageInfo&&) = default;
|
||||||
|
constexpr CDamageInfo& operator=(CDamageInfo&&) = default;
|
||||||
|
|
||||||
CDamageInfo(const CDamageInfo&, float);
|
CDamageInfo(const CDamageInfo&, float);
|
||||||
CDamageInfo(const DataSpec::SShotParam& other);
|
CDamageInfo(const DataSpec::SShotParam& other);
|
||||||
CDamageInfo& operator=(const DataSpec::SShotParam& other);
|
CDamageInfo& operator=(const DataSpec::SShotParam& other);
|
||||||
|
|
|
@ -534,7 +534,7 @@ void CKnockBackController::DoDeferredKnockBack(CStateManager& mgr, CPatterned& p
|
||||||
DoKnockBackAnimation(backVec, mgr, parent, 10.f);
|
DoKnockBackAnimation(backVec, mgr, parent, 10.f);
|
||||||
ResetKnockBackImpulse(parent, backVec, 2.f);
|
ResetKnockBackImpulse(parent, backVec, 2.f);
|
||||||
x82_25_inDeferredKnockBack = true;
|
x82_25_inDeferredKnockBack = true;
|
||||||
parent.KnockBack(backVec, mgr, CDamageInfo({x14_deferWeaponType, false, true, false}, 0.f, 0.f, 10.f),
|
parent.KnockBack(backVec, mgr, CDamageInfo(CWeaponMode{x14_deferWeaponType, false, true, false}, 0.f, 0.f, 10.f),
|
||||||
EKnockBackType::Radius, x82_25_inDeferredKnockBack, 10.f);
|
EKnockBackType::Radius, x82_25_inDeferredKnockBack, 10.f);
|
||||||
x82_25_inDeferredKnockBack = false;
|
x82_25_inDeferredKnockBack = false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2045,7 +2045,7 @@ float CMorphBall::ComputeMaxSpeed() const {
|
||||||
return g_tweakBall->GetBallTranslationMaxSpeed(int(x0_player.GetSurfaceRestraint()));
|
return g_tweakBall->GetBallTranslationMaxSpeed(int(x0_player.GetSurfaceRestraint()));
|
||||||
}
|
}
|
||||||
|
|
||||||
static const CDamageInfo kBallDamage = {CWeaponMode(EWeaponType::BoostBall), 50000.f, 0.f, 0.f};
|
constexpr CDamageInfo kBallDamage = {CWeaponMode(EWeaponType::BoostBall), 50000.f, 0.f, 0.f};
|
||||||
|
|
||||||
void CMorphBall::Touch(CActor& actor, CStateManager& mgr) {
|
void CMorphBall::Touch(CActor& actor, CStateManager& mgr) {
|
||||||
if (TCastToPtr<CPhysicsActor> act = actor) {
|
if (TCastToPtr<CPhysicsActor> act = actor) {
|
||||||
|
|
|
@ -258,7 +258,7 @@ void CPatterned::Think(float dt, CStateManager& mgr) {
|
||||||
if (x450_bodyController->IsElectrocuting()) {
|
if (x450_bodyController->IsElectrocuting()) {
|
||||||
mgr.GetActorModelParticles()->StartElectric(*this);
|
mgr.GetActorModelParticles()->StartElectric(*this);
|
||||||
if (x3f0_pendingShockDamage > 0.f && x400_25_alive) {
|
if (x3f0_pendingShockDamage > 0.f && x400_25_alive) {
|
||||||
CDamageInfo dInfo({{EWeaponType::Wave}, x3f0_pendingShockDamage, 0.f, 0.f}, dt);
|
const CDamageInfo dInfo(CDamageInfo{CWeaponMode{EWeaponType::Wave}, x3f0_pendingShockDamage, 0.f, 0.f}, dt);
|
||||||
mgr.ApplyDamage(kInvalidUniqueId, GetUniqueId(), kInvalidUniqueId, dInfo,
|
mgr.ApplyDamage(kInvalidUniqueId, GetUniqueId(), kInvalidUniqueId, dInfo,
|
||||||
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), {});
|
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), {});
|
||||||
}
|
}
|
||||||
|
@ -273,7 +273,7 @@ void CPatterned::Think(float dt, CStateManager& mgr) {
|
||||||
if (x450_bodyController->IsOnFire()) {
|
if (x450_bodyController->IsOnFire()) {
|
||||||
if (x400_25_alive) {
|
if (x400_25_alive) {
|
||||||
mgr.GetActorModelParticles()->LightDudeOnFire(*this);
|
mgr.GetActorModelParticles()->LightDudeOnFire(*this);
|
||||||
CDamageInfo dInfo({{EWeaponType::Plasma}, x3ec_pendingFireDamage, 0.f, 0.f}, dt);
|
const CDamageInfo dInfo(CDamageInfo{CWeaponMode{EWeaponType::Plasma}, x3ec_pendingFireDamage, 0.f, 0.f}, dt);
|
||||||
mgr.ApplyDamage(kInvalidUniqueId, GetUniqueId(), kInvalidUniqueId, dInfo,
|
mgr.ApplyDamage(kInvalidUniqueId, GetUniqueId(), kInvalidUniqueId, dInfo,
|
||||||
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), {});
|
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), {});
|
||||||
}
|
}
|
||||||
|
|
|
@ -867,7 +867,7 @@ const CDamageVulnerability* CPlayer::GetDamageVulnerability(const zeus::CVector3
|
||||||
}
|
}
|
||||||
|
|
||||||
const CDamageVulnerability* CPlayer::GetDamageVulnerability() const {
|
const CDamageVulnerability* CPlayer::GetDamageVulnerability() const {
|
||||||
CDamageInfo info(CWeaponMode(EWeaponType::Power, false, false, false), 0.f, 0.f, 0.f);
|
constexpr CDamageInfo info(CWeaponMode(EWeaponType::Power, false, false, false), 0.f, 0.f, 0.f);
|
||||||
return GetDamageVulnerability(zeus::skZero3f, zeus::skUp, info);
|
return GetDamageVulnerability(zeus::skZero3f, zeus::skUp, info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1100,7 +1100,7 @@ void CWallCrawlerSwarm::Touch(CActor& other, CStateManager& mgr) {
|
||||||
zeus::CAABox aabb(b.GetTranslation() - radius, b.GetTranslation() + radius);
|
zeus::CAABox aabb(b.GetTranslation() - radius, b.GetTranslation() + radius);
|
||||||
if (playerTb->intersects(aabb)) {
|
if (playerTb->intersects(aabb)) {
|
||||||
if (b.GetActive() && x558_flavor == EFlavor::Parasite) {
|
if (b.GetActive() && x558_flavor == EFlavor::Parasite) {
|
||||||
CDamageInfo dInfo(CWeaponMode(EWeaponType::AI), 2.0e-05f, 0.f, 0.f);
|
constexpr CDamageInfo dInfo(CWeaponMode(EWeaponType::AI), 2.0e-05f, 0.f, 0.f);
|
||||||
mgr.ApplyDamage(GetUniqueId(), player->GetUniqueId(), GetUniqueId(), dInfo,
|
mgr.ApplyDamage(GetUniqueId(), player->GetUniqueId(), GetUniqueId(), dInfo,
|
||||||
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), zeus::skZero3f);
|
CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {}), zeus::skZero3f);
|
||||||
KillBoid(b, mgr, 0.f, 1.f);
|
KillBoid(b, mgr, 0.f, 1.f);
|
||||||
|
|
Loading…
Reference in New Issue