diff --git a/Runtime/MP1/CSamusHud.cpp b/Runtime/MP1/CSamusHud.cpp index 6735c9d48..4d3c52e2e 100644 --- a/Runtime/MP1/CSamusHud.cpp +++ b/Runtime/MP1/CSamusHud.cpp @@ -1597,7 +1597,7 @@ void CSamusHud::Draw(const CStateManager& mgr, float alpha, if (x29c_decoIntf && !x2cc_preLoadCountdown) x29c_decoIntf->Draw(); - if (x2bc_nextState >= EHudState::Combat && x2bc_nextState <= EHudState::Scan) + if (x2bc_nextState >= EHudState::Combat && x2bc_nextState < EHudState::Scan) { if (hudVis && helmetVis != CInGameGuiManager::EHelmetVisMode::ReducedUpdate && diff --git a/Runtime/Particle/CColorElement.cpp b/Runtime/Particle/CColorElement.cpp index 026b90a02..2af23e142 100644 --- a/Runtime/Particle/CColorElement.cpp +++ b/Runtime/Particle/CColorElement.cpp @@ -63,12 +63,12 @@ bool CCEKeyframeEmitter::GetValue(int frame, zeus::CColor& valOut) const bool CCEConstant::GetValue(int frame, zeus::CColor& valOut) const { - float a, b, c, d; - x4_a->GetValue(frame, a); - x8_b->GetValue(frame, b); - xc_c->GetValue(frame, c); - x10_d->GetValue(frame, d); - valOut = zeus::CColor(a, b, c, d); + float r, g, b, a; + x4_r->GetValue(frame, r); + x8_g->GetValue(frame, g); + xc_b->GetValue(frame, b); + x10_a->GetValue(frame, a); + valOut = zeus::CColor(r, g, b, a); return false; } diff --git a/Runtime/Particle/CColorElement.hpp b/Runtime/Particle/CColorElement.hpp index 35404268f..92323b5ed 100644 --- a/Runtime/Particle/CColorElement.hpp +++ b/Runtime/Particle/CColorElement.hpp @@ -24,14 +24,14 @@ public: class CCEConstant : public CColorElement { - std::unique_ptr x4_a; - std::unique_ptr x8_b; - std::unique_ptr xc_c; - std::unique_ptr x10_d; + std::unique_ptr x4_r; + std::unique_ptr x8_g; + std::unique_ptr xc_b; + std::unique_ptr x10_a; public: CCEConstant(std::unique_ptr&& a, std::unique_ptr&& b, std::unique_ptr&& c, std::unique_ptr&& d) - : x4_a(std::move(a)), x8_b(std::move(b)), xc_c(std::move(c)), x10_d(std::move(d)) {} + : x4_r(std::move(a)), x8_g(std::move(b)), xc_b(std::move(c)), x10_a(std::move(d)) {} bool GetValue(int frame, zeus::CColor& colorOut) const; }; diff --git a/Runtime/Particle/CUVElement.cpp b/Runtime/Particle/CUVElement.cpp index bab05d251..8e2071fdb 100644 --- a/Runtime/Particle/CUVElement.cpp +++ b/Runtime/Particle/CUVElement.cpp @@ -5,15 +5,16 @@ namespace urde { -CUVEAnimTexture::CUVEAnimTexture(TToken&& tex, std::unique_ptr&& a, - std::unique_ptr&& b, std::unique_ptr&& c, - std::unique_ptr&& d, std::unique_ptr&& e, bool f) -: x4_tex(std::move(tex)), x24_loop(f), x28_cycleFrames(std::move(e)) +CUVEAnimTexture::CUVEAnimTexture(TToken&& tex, std::unique_ptr&& tileW, + std::unique_ptr&& tileH, std::unique_ptr&& strideW, + std::unique_ptr&& strideH, std::unique_ptr&& cycleFrames, + bool loop) +: x4_tex(std::move(tex)), x24_loop(loop), x28_cycleFrames(std::move(cycleFrames)) { - a->GetValue(0, x10_tileW); - b->GetValue(0, x14_tileH); - c->GetValue(0, x18_strideW); - d->GetValue(0, x1c_strideH); + tileW->GetValue(0, x10_tileW); + tileH->GetValue(0, x14_tileH); + strideW->GetValue(0, x18_strideW); + strideH->GetValue(0, x1c_strideH); int width = x4_tex.GetObj()->GetWidth(); int height = x4_tex.GetObj()->GetHeight(); diff --git a/Runtime/Particle/CUVElement.hpp b/Runtime/Particle/CUVElement.hpp index 447fadd9b..923638279 100644 --- a/Runtime/Particle/CUVElement.hpp +++ b/Runtime/Particle/CUVElement.hpp @@ -55,9 +55,9 @@ struct CUVEAnimTexture : public CUVElement std::unique_ptr x28_cycleFrames; std::vector x2c_uvElems; public: - CUVEAnimTexture(TToken&& tex, std::unique_ptr&& a, std::unique_ptr&& b, - std::unique_ptr&& c, std::unique_ptr&& d, - std::unique_ptr&& e, bool f); + CUVEAnimTexture(TToken&& tex, std::unique_ptr&& tileW, std::unique_ptr&& tileH, + std::unique_ptr&& strideW, std::unique_ptr&& strideH, + std::unique_ptr&& cycleFrames, bool loop); TLockedToken GetValueTexture(int frame) const { return TLockedToken(x4_tex); diff --git a/Runtime/World/CPlayer.cpp b/Runtime/World/CPlayer.cpp index 5944e6748..56f1aa970 100644 --- a/Runtime/World/CPlayer.cpp +++ b/Runtime/World/CPlayer.cpp @@ -383,7 +383,7 @@ void CPlayer::UpdateMorphBallTransition(float dt, CStateManager& mgr) x7cc_transitionSuit = suit; CAnimRes useRes = x7d0_animRes; useRes.SetCharacterNodeId(s32(x7cc_transitionSuit)); - SetModelData(std::make_unique(x7d0_animRes)); + SetModelData(std::make_unique(useRes)); SetIntoBallReadyAnimation(mgr); } return; diff --git a/Runtime/World/CScriptSteam.cpp b/Runtime/World/CScriptSteam.cpp index 97eefd308..aded0a6a5 100644 --- a/Runtime/World/CScriptSteam.cpp +++ b/Runtime/World/CScriptSteam.cpp @@ -1,14 +1,64 @@ #include "CScriptSteam.hpp" +#include "CStateManager.hpp" +#include "CPlayer.hpp" +#include "TCastTo.hpp" namespace urde { CScriptSteam::CScriptSteam(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CVector3f& pos, const zeus::CAABox& aabb, const CDamageInfo& dInfo, const zeus::CVector3f& orientedForce, - ETriggerFlags flags, bool active, CAssetId, float, float, float, float, bool) + ETriggerFlags flags, bool active, CAssetId texture, float f1, float f2, float f3, float f4, + bool b1) : CScriptTrigger(uid, name, info, pos, aabb, dInfo, orientedForce, flags, active, false, false) +, x150_(b1) +, x154_texture(texture) +, x158_(f1) +, x15c_alphaInDur(f2 / f1) +, x160_alphaOutDur(f3 / f1) { + float r3 = (aabb.max.z < aabb.max.y ? aabb.max.z : aabb.max.y); + r3 = (r3 < aabb.max.x ? r3 : aabb.max.x); + if (f4 - 0.f >= 0.000009999999747378752f) + r3 = (r3 < f2 ? r3 : f4); + + x164_ = r3; + x168_ = 1.f / x164_; +} + +void CScriptSteam::Accept(IVisitor& visitor) +{ + visitor.Visit(this); +} + +void CScriptSteam::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr) +{ + if (msg == EScriptObjectMessage::Deactivate) + mgr.Player()->SetVisorSteam(0.f, x158_, x160_alphaOutDur, CAssetId(), x150_); + + CScriptTrigger::AcceptScriptMsg(msg, uid, mgr); +} + +void CScriptSteam::Think(float dt, CStateManager& mgr) +{ + if (!GetActive()) + return; + + CScriptTrigger::Think(dt, mgr); + + if (x148_28_playerTriggerProc && mgr.GetCameraManager()->GetFluidCounter() == 0) + { + zeus::CVector3f eyePos = mgr.GetPlayer().GetEyePosition(); + zeus::CVector3f posDiff = (GetTranslation() - eyePos); + float mag = posDiff.magnitude(); + float distance = (mag >= x164_ ? 0.f : std::cos((1.5707964f * mag) * x168_) * x158_); + mgr.Player()->SetVisorSteam(distance, x15c_alphaInDur, x160_alphaOutDur, x154_texture, x150_); + if (x150_) + mgr.GetEnvFxManager()->SetXB54(2.f * distance); + } + else + mgr.Player()->SetVisorSteam(0.f, x15c_alphaInDur, x160_alphaOutDur, CAssetId(), x150_); } } diff --git a/Runtime/World/CScriptSteam.hpp b/Runtime/World/CScriptSteam.hpp index 147e85082..520875b7b 100644 --- a/Runtime/World/CScriptSteam.hpp +++ b/Runtime/World/CScriptSteam.hpp @@ -8,10 +8,21 @@ namespace urde class CScriptSteam : public CScriptTrigger { + bool x150_; + CAssetId x154_texture; + float x158_; + float x15c_alphaInDur; + float x160_alphaOutDur; + float x164_ = 0.f; + float x168_ = 0.f; public: CScriptSteam(TUniqueId, std::string_view name, const CEntityInfo& info, const zeus::CVector3f& pos, const zeus::CAABox&, const CDamageInfo& dInfo, const zeus::CVector3f& orientedForce, ETriggerFlags flags, bool active, CAssetId, float, float, float, float, bool); + + void Accept(IVisitor&); + void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&); + void Think(float, CStateManager&); }; }