From 0cd4794059754c457267212d8582abd665a68c01 Mon Sep 17 00:00:00 2001 From: Henrique Gemignani Passos Lima Date: Mon, 14 Nov 2022 03:05:45 +0200 Subject: [PATCH] Decomp fix for CScriptEMPulse --- Runtime/World/CScriptEMPulse.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Runtime/World/CScriptEMPulse.cpp b/Runtime/World/CScriptEMPulse.cpp index 0defd3dae..d94e641b4 100644 --- a/Runtime/World/CScriptEMPulse.cpp +++ b/Runtime/World/CScriptEMPulse.cpp @@ -78,17 +78,18 @@ void CScriptEMPulse::Touch(CActor& act, CStateManager& mgr) { if (const TCastToPtr 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); } } }