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,25 +153,25 @@ void CPhazonPool::Think(float dt, CStateManager& mgr) {
x1c4_ = 0.f;
dVar5 = dt;
}
x1a0_ -= x1bc_ * (dt * x1cc_) + dVar5;
x1a4_ = x1a0_ / x19c_;
if (x1a4_ < 0.001f) {
if (x1e0_24_) {
shouldFree = true;
} else {
SetCallTouch(false);
if (x1e0_25_) {
x1dc_ = 0;
SetActive(false);
} else {
x1dc_ = 3;
x1d0_ = x1c8_;
}
}
SetEmitParticles(false);
}
x1cc_ = 0.f;
}
x1a0_ -= x1bc_ * (dt * x1cc_) + dVar5;
x1a4_ = x1a0_ / x19c_;
if (x1a4_ < 0.001f) {
if (x1e0_24_) {
shouldFree = true;
} else {
SetCallTouch(false);
if (x1e0_25_) {
x1dc_ = 0;
SetActive(false);
} else {
x1dc_ = 3;
x1d0_ = x1c8_;
}
}
SetEmitParticles(false);
}
x1cc_ = 0.f;
} else if (x1dc_ == 3) {
x1d0_ -= dt;
if (x1d0_ <= 0.f) {
@ -180,6 +180,7 @@ void CPhazonPool::Think(float dt, CStateManager& mgr) {
}
}
if (shouldFree) {
fmt::print(FMT_STRING("Freeing myself! ({})"), 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) {
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);
}
}
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,
CStateManager& mgr) {
if (x234_chargeFxGen)
if (x234_chargeFxGen) {
x234_chargeFxGen->SetParticleEmission(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) {
if (x234_chargeFxGen)
if (x234_chargeFxGen) {
x234_chargeFxGen->Render();
}
CGunWeapon::PostRenderGunFx(mgr, xf);
}
@ -101,10 +104,11 @@ void CPhazonBeam::Update(float dt, CStateManager& mgr) {
TAreaId aid = mgr.GetPlayer().GetAreaIdAlways();
if (aid != kInvalidAreaId) {
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);
else
} else {
area->SetWeaponWorldLighting(4.f, 0.9f);
}
}
if (!IsLoaded()) {
@ -118,17 +122,17 @@ void CPhazonBeam::Update(float dt, CStateManager& mgr) {
x274_25_clipWipeActive = true;
}
}
}
if (x274_25_clipWipeActive) {
} else if (x274_25_clipWipeActive) {
x268_clipWipeScale += 0.75f * dt;
if (x268_clipWipeScale > 1.f)
if (x268_clipWipeScale > 1.f) {
x268_clipWipeScale = 1.f;
}
if (x268_clipWipeScale > 0.4f) {
if (x26c_clipWipeTranslate < 0.5f)
if (x26c_clipWipeTranslate < 0.5f) {
x26c_clipWipeTranslate += 0.75f * dt;
else
} else {
x274_25_clipWipeActive = false;
}
}
} else if (x274_26_veinsAlphaActive) {
x270_indirectAlpha = x10_solidModelData->GetLocatorTransform("phazonScale_LCTR_SDK").origin.y();
@ -212,8 +216,10 @@ void CPhazonBeam::Draw(bool drawSuitArm, const CStateManager& mgr, const zeus::C
}
void CPhazonBeam::DrawMuzzleFx(const CStateManager& mgr) const {
if (IsFiring())
CGunWeapon::DrawMuzzleFx(mgr);
if (!IsFiring()) {
return;
}
CGunWeapon::DrawMuzzleFx(mgr);
}
} // namespace metaforce