2020-01-15 12:07:48 +00:00
|
|
|
#include "Runtime/MP1/CFaceplateDecoration.hpp"
|
|
|
|
|
|
|
|
#include "Runtime/CSimplePool.hpp"
|
|
|
|
#include "Runtime/CStateManager.hpp"
|
|
|
|
#include "Runtime/GameGlobalObjects.hpp"
|
|
|
|
#include "Runtime/Particle/CGenDescription.hpp"
|
|
|
|
#include "Runtime/World/CPlayer.hpp"
|
2017-02-12 03:17:18 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace urde::MP1 {
|
2017-02-12 03:17:18 +00:00
|
|
|
|
|
|
|
CFaceplateDecoration::CFaceplateDecoration(CStateManager& stateMgr) {}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFaceplateDecoration::Update(float dt, CStateManager& stateMgr) {
|
|
|
|
CAssetId txtrId = stateMgr.GetPlayer().GetVisorSteam().GetTextureId();
|
|
|
|
if (!txtrId.IsValid()) {
|
|
|
|
if (xc_ready) {
|
|
|
|
x4_tex.Unlock();
|
|
|
|
x0_id = txtrId;
|
|
|
|
if (m_texFilter)
|
2019-06-12 02:05:17 +00:00
|
|
|
m_texFilter = std::nullopt;
|
2017-02-12 03:17:18 +00:00
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
2017-02-12 03:17:18 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (x0_id != txtrId && txtrId.IsValid()) {
|
|
|
|
if (m_texFilter)
|
2019-06-12 02:05:17 +00:00
|
|
|
m_texFilter = std::nullopt;
|
2018-12-08 05:30:43 +00:00
|
|
|
x0_id = txtrId;
|
|
|
|
x4_tex = g_SimplePool->GetObj(SObjectTag{FOURCC('TXTR'), txtrId});
|
|
|
|
xc_ready = true;
|
|
|
|
x4_tex.Lock();
|
|
|
|
}
|
2017-02-12 03:17:18 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
if (!m_texFilter && x4_tex.IsLoaded())
|
|
|
|
m_texFilter.emplace(EFilterType::Blend, x4_tex);
|
2017-02-12 03:17:18 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void CFaceplateDecoration::Draw(CStateManager& stateMgr) {
|
|
|
|
if (xc_ready && m_texFilter) {
|
2019-07-21 08:42:52 +00:00
|
|
|
SCOPED_GRAPHICS_DEBUG_GROUP("CFaceplateDecoration::Draw", zeus::skPurple);
|
2019-02-24 07:15:54 +00:00
|
|
|
zeus::CColor color = zeus::skWhite;
|
2018-12-08 05:30:43 +00:00
|
|
|
color.a() = stateMgr.GetPlayer().GetVisorSteam().GetAlpha();
|
2019-03-13 03:46:20 +00:00
|
|
|
m_texFilter->DrawFilter(EFilterShape::FullscreenQuarters, color, 1.f);
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
2017-02-12 03:17:18 +00:00
|
|
|
}
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace urde::MP1
|