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)
|
|
|
|
{
|
2017-08-13 05:26:14 +00:00
|
|
|
CAssetId txtrId = stateMgr.GetPlayer().GetVisorSteam().GetTextureId();
|
2017-02-12 03:17:18 +00:00
|
|
|
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())
|
2017-06-01 05:34:24 +00:00
|
|
|
m_texFilter.emplace(EFilterType::Blend, x4_tex);
|
2017-02-12 03:17:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|