Decomp fix for CScriptEMPulse

This commit is contained in:
Henrique Gemignani Passos Lima 2022-11-14 03:05:45 +02:00
parent 18a76edf1a
commit 0cd4794059
No known key found for this signature in database
GPG Key ID: E224F951761145F8
1 changed files with 8 additions and 7 deletions

View File

@ -78,17 +78,18 @@ void CScriptEMPulse::Touch(CActor& act, CStateManager& mgr) {
if (const TCastToPtr<CPlayer> pl = act) {
const zeus::CVector3f posDiff = GetTranslation() - pl->GetTranslation();
if (posDiff.magnitude() < xec_finalRadius) {
const float dur =
((1.f - (posDiff.magnitude() / xec_finalRadius)) * (xfc_ - xf8_interferenceDur)) + xf8_interferenceDur;
const float mag =
((1.f - (posDiff.magnitude() / xec_finalRadius)) * (x104_ - xf8_interferenceDur)) + x100_interferenceMag;
const float diffMagnitude = posDiff.magnitude();
if (diffMagnitude < xec_finalRadius) {
const float multi = 1.f - (diffMagnitude / xec_finalRadius);
const float dur = (multi * (xfc_ - xf8_interferenceDur)) + xf8_interferenceDur;
const float mag = (multi * (x104_ - x100_interferenceMag)) + x100_interferenceMag;
if (dur > pl->GetStaticTimer()) {
pl->SetHudDisable(dur, 0.5f, 2.5f);
} else {
mgr.GetPlayerState()->GetStaticInterference().AddSource(GetUniqueId(), mag, dur);
pl->SetOrbitRequestForTarget(mgr.GetPlayer().GetOrbitTargetId(),
CPlayer::EPlayerOrbitRequest::ActivateOrbitSource, mgr);
}
mgr.GetPlayerState()->GetStaticInterference().AddSource(GetUniqueId(), mag, dur);
}
}
}