HUD and CPlayer bug fixes

This commit is contained in:
Phillip Stephens 2018-09-20 11:17:09 -07:00
parent 02d54fd5ca
commit 94fd52d0ea
8 changed files with 87 additions and 25 deletions

View File

@ -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 &&

View File

@ -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;
}

View File

@ -24,14 +24,14 @@ public:
class CCEConstant : public CColorElement
{
std::unique_ptr<CRealElement> x4_a;
std::unique_ptr<CRealElement> x8_b;
std::unique_ptr<CRealElement> xc_c;
std::unique_ptr<CRealElement> x10_d;
std::unique_ptr<CRealElement> x4_r;
std::unique_ptr<CRealElement> x8_g;
std::unique_ptr<CRealElement> xc_b;
std::unique_ptr<CRealElement> x10_a;
public:
CCEConstant(std::unique_ptr<CRealElement>&& a, std::unique_ptr<CRealElement>&& b,
std::unique_ptr<CRealElement>&& c, std::unique_ptr<CRealElement>&& 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;
};

View File

@ -5,15 +5,16 @@
namespace urde
{
CUVEAnimTexture::CUVEAnimTexture(TToken<CTexture>&& tex, std::unique_ptr<CIntElement>&& a,
std::unique_ptr<CIntElement>&& b, std::unique_ptr<CIntElement>&& c,
std::unique_ptr<CIntElement>&& d, std::unique_ptr<CIntElement>&& e, bool f)
: x4_tex(std::move(tex)), x24_loop(f), x28_cycleFrames(std::move(e))
CUVEAnimTexture::CUVEAnimTexture(TToken<CTexture>&& tex, std::unique_ptr<CIntElement>&& tileW,
std::unique_ptr<CIntElement>&& tileH, std::unique_ptr<CIntElement>&& strideW,
std::unique_ptr<CIntElement>&& strideH, std::unique_ptr<CIntElement>&& 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();

View File

@ -55,9 +55,9 @@ struct CUVEAnimTexture : public CUVElement
std::unique_ptr<CIntElement> x28_cycleFrames;
std::vector<SUVElementSet> x2c_uvElems;
public:
CUVEAnimTexture(TToken<CTexture>&& tex, std::unique_ptr<CIntElement>&& a, std::unique_ptr<CIntElement>&& b,
std::unique_ptr<CIntElement>&& c, std::unique_ptr<CIntElement>&& d,
std::unique_ptr<CIntElement>&& e, bool f);
CUVEAnimTexture(TToken<CTexture>&& tex, std::unique_ptr<CIntElement>&& tileW, std::unique_ptr<CIntElement>&& tileH,
std::unique_ptr<CIntElement>&& strideW, std::unique_ptr<CIntElement>&& strideH,
std::unique_ptr<CIntElement>&& cycleFrames, bool loop);
TLockedToken<CTexture> GetValueTexture(int frame) const
{
return TLockedToken<CTexture>(x4_tex);

View File

@ -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<CModelData>(x7d0_animRes));
SetModelData(std::make_unique<CModelData>(useRes));
SetIntoBallReadyAnimation(mgr);
}
return;

View File

@ -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_);
}
}

View File

@ -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&);
};
}