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
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
namespace metaforce::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;
|
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()) {
|
|
|
|
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
|
|
|
void CFaceplateDecoration::Draw(CStateManager& stateMgr) {
|
2022-05-24 00:26:35 +00:00
|
|
|
if (xc_ready && x4_tex) {
|
2019-07-21 08:42:52 +00:00
|
|
|
SCOPED_GRAPHICS_DEBUG_GROUP("CFaceplateDecoration::Draw", zeus::skPurple);
|
2022-05-24 00:26:35 +00:00
|
|
|
float alpha = stateMgr.GetPlayer().GetVisorSteam().GetAlpha();
|
|
|
|
if (!zeus::close_enough(alpha, 0.f)) {
|
|
|
|
zeus::CColor color = zeus::skWhite;
|
|
|
|
color.a() = alpha;
|
|
|
|
CCameraFilterPass::DrawFilter(EFilterType::Blend, EFilterShape::FullscreenQuarters, color, x4_tex.GetObj(), 1.f);
|
|
|
|
}
|
2018-12-08 05:30:43 +00:00
|
|
|
}
|
2017-02-12 03:17:18 +00:00
|
|
|
}
|
|
|
|
|
2021-04-10 08:42:06 +00:00
|
|
|
} // namespace metaforce::MP1
|