metaforce/Runtime/MP1/CFaceplateDecoration.cpp

55 lines
1.3 KiB
C++
Raw Normal View History

2017-02-12 03:17:18 +00:00
#include "CFaceplateDecoration.hpp"
#include "CStateManager.hpp"
#include "World/CPlayer.hpp"
#include "GameGlobalObjects.hpp"
#include "CSimplePool.hpp"
2017-02-12 04:43:33 +00:00
#include "Particle/CGenDescription.hpp"
2017-02-12 03:17:18 +00:00
namespace urde
{
namespace MP1
{
CFaceplateDecoration::CFaceplateDecoration(CStateManager& stateMgr) {}
void CFaceplateDecoration::Update(float dt, CStateManager& stateMgr)
{
ResId txtrId = stateMgr.GetPlayer().GetVisorSteam().GetTextureId();
if (txtrId == -1)
{
if (xc_ready)
{
x4_tex.Unlock();
x0_id = txtrId;
if (m_texFilter)
m_texFilter = std::experimental::nullopt;
}
}
if (x0_id != txtrId && txtrId != -1)
{
if (m_texFilter)
m_texFilter = std::experimental::nullopt;
x0_id = txtrId;
x4_tex = g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), txtrId});
xc_ready = true;
x4_tex.Lock();
}
if (!m_texFilter && x4_tex.IsLoaded())
m_texFilter.emplace(CCameraFilterPass::EFilterType::Blend, x4_tex);
}
void CFaceplateDecoration::Draw(CStateManager& stateMgr)
{
if (xc_ready && m_texFilter)
{
zeus::CColor color = zeus::CColor::skWhite;
color.a = stateMgr.GetPlayer().GetVisorSteam().GetAlpha();
m_texFilter->draw(color, 1.f);
}
}
}
}