2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-08-10 01:39:06 +00:00

Minor CPhazonPool fixes

This commit is contained in:
Phillip Stephens 2021-04-13 19:09:55 -07:00
parent 4e38cf3574
commit 1039424737
Signed by: Antidote
GPG Key ID: F8BEE4C83DACA60D
2 changed files with 38 additions and 31 deletions

View File

@ -153,6 +153,7 @@ void CPhazonPool::Think(float dt, CStateManager& mgr) {
x1c4_ = 0.f; x1c4_ = 0.f;
dVar5 = dt; dVar5 = dt;
} }
}
x1a0_ -= x1bc_ * (dt * x1cc_) + dVar5; x1a0_ -= x1bc_ * (dt * x1cc_) + dVar5;
x1a4_ = x1a0_ / x19c_; x1a4_ = x1a0_ / x19c_;
if (x1a4_ < 0.001f) { if (x1a4_ < 0.001f) {
@ -171,7 +172,6 @@ void CPhazonPool::Think(float dt, CStateManager& mgr) {
SetEmitParticles(false); SetEmitParticles(false);
} }
x1cc_ = 0.f; x1cc_ = 0.f;
}
} else if (x1dc_ == 3) { } else if (x1dc_ == 3) {
x1d0_ -= dt; x1d0_ -= dt;
if (x1d0_ <= 0.f) { if (x1d0_ <= 0.f) {
@ -180,6 +180,7 @@ void CPhazonPool::Think(float dt, CStateManager& mgr) {
} }
} }
if (shouldFree) { if (shouldFree) {
fmt::print(FMT_STRING("Freeing myself! ({})"), GetUniqueId());
mgr.FreeScriptObject(GetUniqueId()); mgr.FreeScriptObject(GetUniqueId());
} }
} }

View File

@ -26,8 +26,9 @@ CPhazonBeam::CPhazonBeam(CAssetId characterId, EWeaponType type, TUniqueId playe
void CPhazonBeam::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) { void CPhazonBeam::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) {
TAreaId aid = mgr.GetPlayer().GetAreaIdAlways(); TAreaId aid = mgr.GetPlayer().GetAreaIdAlways();
if (msg == EScriptObjectMessage::Deleted && aid != kInvalidAreaId) if (msg == EScriptObjectMessage::Deleted && aid != kInvalidAreaId) {
mgr.GetWorld()->GetArea(aid)->SetWeaponWorldLighting(4.f, 1.f); mgr.GetWorld()->GetArea(aid)->SetWeaponWorldLighting(4.f, 1.f);
}
} }
void CPhazonBeam::StopBeam(CStateManager& mgr, bool b1) { void CPhazonBeam::StopBeam(CStateManager& mgr, bool b1) {
@ -37,8 +38,9 @@ void CPhazonBeam::StopBeam(CStateManager& mgr, bool b1) {
void CPhazonBeam::UpdateBeam(float dt, const zeus::CTransform& targetXf, const zeus::CVector3f& localBeamPos, void CPhazonBeam::UpdateBeam(float dt, const zeus::CTransform& targetXf, const zeus::CVector3f& localBeamPos,
CStateManager& mgr) { CStateManager& mgr) {
if (x234_chargeFxGen) if (x234_chargeFxGen) {
x234_chargeFxGen->SetParticleEmission(IsFiring()); x234_chargeFxGen->SetParticleEmission(IsFiring());
}
CGunWeapon::UpdateMuzzleFx(dt, x4_scale, localBeamPos, IsFiring()); CGunWeapon::UpdateMuzzleFx(dt, x4_scale, localBeamPos, IsFiring());
} }
@ -61,8 +63,9 @@ void CPhazonBeam::PreRenderGunFx(const CStateManager& mgr, const zeus::CTransfor
} }
void CPhazonBeam::PostRenderGunFx(const CStateManager& mgr, const zeus::CTransform& xf) { void CPhazonBeam::PostRenderGunFx(const CStateManager& mgr, const zeus::CTransform& xf) {
if (x234_chargeFxGen) if (x234_chargeFxGen) {
x234_chargeFxGen->Render(); x234_chargeFxGen->Render();
}
CGunWeapon::PostRenderGunFx(mgr, xf); CGunWeapon::PostRenderGunFx(mgr, xf);
} }
@ -101,11 +104,12 @@ void CPhazonBeam::Update(float dt, CStateManager& mgr) {
TAreaId aid = mgr.GetPlayer().GetAreaIdAlways(); TAreaId aid = mgr.GetPlayer().GetAreaIdAlways();
if (aid != kInvalidAreaId) { if (aid != kInvalidAreaId) {
CGameArea* area = mgr.GetWorld()->GetArea(aid); CGameArea* area = mgr.GetWorld()->GetArea(aid);
if (x278_fireTime > 1.f / 6.f) if (x278_fireTime > 1.f / 6.f) {
area->SetWeaponWorldLighting(4.f, 1.f); area->SetWeaponWorldLighting(4.f, 1.f);
else } else {
area->SetWeaponWorldLighting(4.f, 0.9f); area->SetWeaponWorldLighting(4.f, 0.9f);
} }
}
if (!IsLoaded()) { if (!IsLoaded()) {
if (CGunWeapon::IsLoaded() && !x274_24_loaded) { if (CGunWeapon::IsLoaded() && !x274_24_loaded) {
@ -118,18 +122,18 @@ void CPhazonBeam::Update(float dt, CStateManager& mgr) {
x274_25_clipWipeActive = true; x274_25_clipWipeActive = true;
} }
} }
} } else if (x274_25_clipWipeActive) {
if (x274_25_clipWipeActive) {
x268_clipWipeScale += 0.75f * dt; x268_clipWipeScale += 0.75f * dt;
if (x268_clipWipeScale > 1.f) if (x268_clipWipeScale > 1.f) {
x268_clipWipeScale = 1.f; x268_clipWipeScale = 1.f;
}
if (x268_clipWipeScale > 0.4f) { if (x268_clipWipeScale > 0.4f) {
if (x26c_clipWipeTranslate < 0.5f) if (x26c_clipWipeTranslate < 0.5f) {
x26c_clipWipeTranslate += 0.75f * dt; x26c_clipWipeTranslate += 0.75f * dt;
else } else {
x274_25_clipWipeActive = false; x274_25_clipWipeActive = false;
} }
}
} else if (x274_26_veinsAlphaActive) { } else if (x274_26_veinsAlphaActive) {
x270_indirectAlpha = x10_solidModelData->GetLocatorTransform("phazonScale_LCTR_SDK").origin.y(); x270_indirectAlpha = x10_solidModelData->GetLocatorTransform("phazonScale_LCTR_SDK").origin.y();
} }
@ -212,7 +216,9 @@ void CPhazonBeam::Draw(bool drawSuitArm, const CStateManager& mgr, const zeus::C
} }
void CPhazonBeam::DrawMuzzleFx(const CStateManager& mgr) const { void CPhazonBeam::DrawMuzzleFx(const CStateManager& mgr) const {
if (IsFiring()) if (!IsFiring()) {
return;
}
CGunWeapon::DrawMuzzleFx(mgr); CGunWeapon::DrawMuzzleFx(mgr);
} }