COmegaPirate: Implement CFlash

This commit is contained in:
Luke Street 2020-04-19 02:47:25 -04:00
parent 025a989e12
commit 4e88f503ac
12 changed files with 144 additions and 61 deletions

View File

@ -1472,7 +1472,7 @@ void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, flo
beaconAlpha = loc.x4_beaconAlpha; beaconAlpha = loc.x4_beaconAlpha;
} }
if (beaconAlpha > 0.f) { if (beaconAlpha > 0.f) {
const std::array<CTexturedQuadFilter::Vert, 4> verts{{ constexpr std::array<CTexturedQuadFilter::Vert, 4> verts{{
{{-4.f, -8.f, 8.f}, {0.f, 1.f}}, {{-4.f, -8.f, 8.f}, {0.f, 1.f}},
{{-4.f, -8.f, 0.f}, {0.f, 0.f}}, {{-4.f, -8.f, 0.f}, {0.f, 0.f}},
{{4.f, -8.f, 8.f}, {1.f, 1.f}}, {{4.f, -8.f, 8.f}, {1.f, 1.f}},
@ -1486,7 +1486,7 @@ void CAutoMapper::Draw(const CStateManager& mgr, const zeus::CTransform& xf, flo
colorAlpha *= mapAlpha; colorAlpha *= mapAlpha;
zeus::CColor color = zeus::skWhite; zeus::CColor color = zeus::skWhite;
color.a() = colorAlpha; color.a() = colorAlpha;
filter.drawVerts(color, verts.data()); filter.drawVerts(color, verts);
} }
} }
} }

View File

@ -170,13 +170,13 @@ void CMappableObject::Draw(int curArea, const CMapWorldInfo& mwInfo, float alpha
m_texQuadFilter.emplace(EFilterType::Add, tex, CTexturedQuadFilter::ZTest::GEqual); m_texQuadFilter.emplace(EFilterType::Add, tex, CTexturedQuadFilter::ZTest::GEqual);
} }
const std::array<CTexturedQuadFilter::Vert, 4> verts{{ constexpr std::array<CTexturedQuadFilter::Vert, 4> verts{{
{{-2.6f, 0.f, 2.6f}, {0.f, 1.f}}, {{-2.6f, 0.f, 2.6f}, {0.f, 1.f}},
{{-2.6f, 0.f, -2.6f}, {0.f, 0.f}}, {{-2.6f, 0.f, -2.6f}, {0.f, 0.f}},
{{2.6f, 0.f, 2.6f}, {1.f, 1.f}}, {{2.6f, 0.f, 2.6f}, {1.f, 1.f}},
{{2.6f, 0.f, -2.6f}, {1.f, 0.f}}, {{2.6f, 0.f, -2.6f}, {1.f, 0.f}},
}}; }};
m_texQuadFilter->drawVerts(iconColor, verts.data()); m_texQuadFilter->drawVerts(iconColor, verts);
} }
} }

View File

@ -39,10 +39,12 @@ void CSimpleShadow::Render(const TLockedToken<CTexture>& tex) {
m_filter.emplace(EFilterType::InvDstMultiply, tex, CTexturedQuadFilter::ZTest::LEqual); m_filter.emplace(EFilterType::InvDstMultiply, tex, CTexturedQuadFilter::ZTest::LEqual);
float radius = x34_radius * x30_scale; float radius = x34_radius * x30_scale;
CTexturedQuadFilter::Vert verts[] = {{{-radius, 0.f, -radius}, {0.f, 0.f}}, const std::array<CTexturedQuadFilter::Vert, 4> verts{{
{{-radius, 0.f, -radius}, {0.f, 0.f}},
{{radius, 0.f, -radius}, {0.f, 1.f}}, {{radius, 0.f, -radius}, {0.f, 1.f}},
{{-radius, 0.f, radius}, {1.f, 0.f}}, {{-radius, 0.f, radius}, {1.f, 0.f}},
{{radius, 0.f, radius}, {1.f, 1.f}}}; {{radius, 0.f, radius}, {1.f, 1.f}},
}};
m_filter->drawVerts(zeus::skWhite, verts); m_filter->drawVerts(zeus::skWhite, verts);
} }

View File

@ -258,10 +258,10 @@ void CTexturedQuadFilter::drawCropped(const zeus::CColor& color, float uvScale)
CGraphics::DrawArray(0, 4); CGraphics::DrawArray(0, 4);
} }
void CTexturedQuadFilter::drawVerts(const zeus::CColor& color, const Vert verts[4], float lod) { void CTexturedQuadFilter::drawVerts(const zeus::CColor& color, std::array<Vert, 4> verts, float lod) {
SCOPED_GRAPHICS_DEBUG_GROUP("CTexturedQuadFilter::drawVerts", zeus::skMagenta); SCOPED_GRAPHICS_DEBUG_GROUP("CTexturedQuadFilter::drawVerts", zeus::skMagenta);
m_vbo->load(verts, sizeof(Vert) * 4); m_vbo->load(verts.data(), sizeof(Vert) * verts.size());
m_uniform.m_matrix = CGraphics::GetPerspectiveProjectionMatrix(true) * CGraphics::g_GXModelView.toMatrix4f(); m_uniform.m_matrix = CGraphics::GetPerspectiveProjectionMatrix(true) * CGraphics::g_GXModelView.toMatrix4f();
m_uniform.m_color = color; m_uniform.m_color = color;
@ -269,7 +269,7 @@ void CTexturedQuadFilter::drawVerts(const zeus::CColor& color, const Vert verts[
m_uniBuf->load(&m_uniform, sizeof(m_uniform)); m_uniBuf->load(&m_uniform, sizeof(m_uniform));
CGraphics::SetShaderDataBinding(m_dataBind); CGraphics::SetShaderDataBinding(m_dataBind);
CGraphics::DrawArray(0, 4); CGraphics::DrawArray(0, verts.size());
} }
void CTexturedQuadFilter::DrawFilter(EFilterShape shape, const zeus::CColor& color, float t) { void CTexturedQuadFilter::DrawFilter(EFilterShape shape, const zeus::CColor& color, float t) {

View File

@ -53,7 +53,7 @@ public:
CTexturedQuadFilter& operator=(CTexturedQuadFilter&&) = default; CTexturedQuadFilter& operator=(CTexturedQuadFilter&&) = default;
void draw(const zeus::CColor& color, float uvScale, const zeus::CRectangle& rect = DefaultRect, float z = 0.f); void draw(const zeus::CColor& color, float uvScale, const zeus::CRectangle& rect = DefaultRect, float z = 0.f);
void drawCropped(const zeus::CColor& color, float uvScale); void drawCropped(const zeus::CColor& color, float uvScale);
void drawVerts(const zeus::CColor& color, const Vert verts[4], float lod = 0.f); void drawVerts(const zeus::CColor& color, std::array<Vert, 4> verts, float lod = 0.f);
void DrawFilter(EFilterShape shape, const zeus::CColor& color, float t); void DrawFilter(EFilterShape shape, const zeus::CColor& color, float t);
const TLockedToken<CTexture>& GetTex() const { return m_tex; } const TLockedToken<CTexture>& GetTex() const { return m_tex; }
const boo::ObjToken<boo::ITexture>& GetBooTex() const { return m_booTex; } const boo::ObjToken<boo::ITexture>& GetBooTex() const { return m_booTex; }

View File

@ -90,14 +90,14 @@ void CAuiImagePane::DoDrawImagePane(const zeus::CColor& color, const CTexture& t
}}; }};
if (noBlur) { if (noBlur) {
quad.drawVerts(useColor, verts.data()); quad.drawVerts(useColor, verts);
} else if ((x14c_deResFactor == 0.f && alpha == 1.f) || tex.GetNumMips() == 1) { } else if ((x14c_deResFactor == 0.f && alpha == 1.f) || tex.GetNumMips() == 1) {
quad.drawVerts(useColor, verts.data(), 0.f); quad.drawVerts(useColor, verts, 0.f);
} else { } else {
const float tmp = (1.f - x14c_deResFactor) * alpha; const float tmp = (1.f - x14c_deResFactor) * alpha;
const float tmp3 = 1.f - tmp * tmp * tmp; const float tmp3 = 1.f - tmp * tmp * tmp;
const float mip = tmp3 * (tex.GetNumMips() - 1); const float mip = tmp3 * (tex.GetNumMips() - 1);
quad.drawVerts(useColor, verts.data(), mip); quad.drawVerts(useColor, verts, mip);
} }
} }

View File

@ -45,12 +45,12 @@ void CScanDisplay::CDataDot::Draw(const zeus::CColor& col, float radius) {
CGraphics::SetModelMatrix(xf); CGraphics::SetModelMatrix(xf);
zeus::CColor useColor = col; zeus::CColor useColor = col;
useColor.a() *= x24_alpha; useColor.a() *= x24_alpha;
const CTexturedQuadFilter::Vert verts[4] = { const std::array<CTexturedQuadFilter::Vert, 4> verts{{
{{-radius, 0.f, radius}, {0.f, 1.f}}, {{-radius, 0.f, radius}, {0.f, 1.f}},
{{-radius, 0.f, -radius}, {0.f, 0.f}}, {{-radius, 0.f, -radius}, {0.f, 0.f}},
{{radius, 0.f, radius}, {1.f, 1.f}}, {{radius, 0.f, radius}, {1.f, 1.f}},
{{radius, 0.f, -radius}, {1.f, 0.f}}, {{radius, 0.f, -radius}, {1.f, 0.f}},
}; }};
m_quad.drawVerts(useColor, verts); m_quad.drawVerts(useColor, verts);
} }
} }

View File

@ -614,11 +614,11 @@ void CInGameGuiManager::Draw(CStateManager& stateMgr) {
if (!m_deathRenderTexQuad) if (!m_deathRenderTexQuad)
m_deathRenderTexQuad.emplace(EFilterType::Blend, CGraphics::g_SpareTexture.get()); m_deathRenderTexQuad.emplace(EFilterType::Blend, CGraphics::g_SpareTexture.get());
m_deathRenderTexQuad->drawVerts(zeus::CColor(1.f, colT), verts.data()); m_deathRenderTexQuad->drawVerts(zeus::CColor(1.f, colT), verts);
if (!m_deathDotQuad) if (!m_deathDotQuad)
m_deathDotQuad.emplace(EFilterType::Multiply, x50_deathDot); m_deathDotQuad.emplace(EFilterType::Multiply, x50_deathDot);
m_deathDotQuad->drawVerts(zeus::CColor(1.f, colT), verts.data()); m_deathDotQuad->drawVerts(zeus::CColor(1.f, colT), verts);
} }
} }
} }

View File

@ -372,12 +372,12 @@ void CPlayerVisor::DrawScanEffect(const CStateManager& mgr, CTargetingManager* t
const float uvX1 = float(rect.x4_left + rect.xc_width) / float(g_Viewport.x8_width); const float uvX1 = float(rect.x4_left + rect.xc_width) / float(g_Viewport.x8_width);
const float uvY0 = float(rect.x8_top) / float(g_Viewport.xc_height); const float uvY0 = float(rect.x8_top) / float(g_Viewport.xc_height);
const float uvY1 = float(rect.x8_top + rect.x10_height) / float(g_Viewport.xc_height); const float uvY1 = float(rect.x8_top + rect.x10_height) / float(g_Viewport.xc_height);
CTexturedQuadFilter::Vert rttVerts[4] = { const std::array<CTexturedQuadFilter::Vert, 4> rttVerts{{
{{-5.f, 0.f, 4.45f}, {uvX0, uvY0}}, {{-5.f, 0.f, 4.45f}, {uvX0, uvY0}},
{{5.f, 0.f, 4.45f}, {uvX1, uvY0}}, {{5.f, 0.f, 4.45f}, {uvX1, uvY0}},
{{-5.f, 0.f, -4.45f}, {uvX0, uvY1}}, {{-5.f, 0.f, -4.45f}, {uvX0, uvY1}},
{{5.f, 0.f, -4.45f}, {uvX1, uvY1}}, {{5.f, 0.f, -4.45f}, {uvX1, uvY1}},
}; }};
if (CGraphics::g_BooPlatform == boo::IGraphicsDataFactory::Platform::OpenGL) { if (CGraphics::g_BooPlatform == boo::IGraphicsDataFactory::Platform::OpenGL) {
rttVerts[0].m_uv.y() = uvY1; rttVerts[0].m_uv.y() = uvY1;
rttVerts[1].m_uv.y() = uvY1; rttVerts[1].m_uv.y() = uvY1;

View File

@ -1,5 +1,6 @@
#include "Runtime/MP1/World/COmegaPirate.hpp" #include "Runtime/MP1/World/COmegaPirate.hpp"
#include "Runtime/Camera/CGameCamera.hpp"
#include "Runtime/Collision/CCollisionActor.hpp" #include "Runtime/Collision/CCollisionActor.hpp"
#include "Runtime/Collision/CCollisionActorManager.hpp" #include "Runtime/Collision/CCollisionActorManager.hpp"
#include "Runtime/Collision/CGameCollision.hpp" #include "Runtime/Collision/CGameCollision.hpp"
@ -38,14 +39,86 @@ constexpr std::array<SOBBJointInfo, 11> skObbJoints{{
} // namespace } // namespace
COmegaPirate::CFlash::CFlash(TUniqueId uid, const CEntityInfo& info, const zeus::CVector3f& pos, COmegaPirate::CFlash::CFlash(TUniqueId uid, const CEntityInfo& info, const zeus::CVector3f& pos,
TToken<CTexture>& thermalSpot, float p5) TLockedToken<CTexture>& thermalSpot, float delay)
: CActor(uid, true, "Omega Pirate Flash", info, zeus::CTransform::Translate(pos), CModelData::CModelDataNull(), {}, : CActor(uid, true, "Omega Pirate Flash", info, zeus::CTransform::Translate(pos), CModelData::CModelDataNull(), {},
CActorParameters::None(), kInvalidUniqueId) CActorParameters::None(), kInvalidUniqueId)
, xe8_thermalSpot(thermalSpot) , xf4_delay(delay)
, xf4_(p5) {} , m_thermalSpotBlend(EFilterType::Blend, thermalSpot)
, m_thermalSpotSubtract(EFilterType::Subtract, thermalSpot) {}
void COmegaPirate::CFlash::Accept(IVisitor& visitor) { visitor.Visit(this); } void COmegaPirate::CFlash::Accept(IVisitor& visitor) { visitor.Visit(this); }
void COmegaPirate::CFlash::Think(float dt, CStateManager& mgr) {
CEntity::Think(dt, mgr);
xf4_delay -= dt;
if (xf4_delay > 0.f) {
return;
}
xf8_ += dt;
float intensity = xf8_;
if (intensity <= 0.75f) {
intensity /= 0.75f;
} else {
intensity = 1.f - (intensity - 0.75f) / 0.25f;
}
const CGameCamera* const camera = mgr.GetCameraManager()->GetCurrentCamera(mgr);
const zeus::CVector3f dist = (GetTranslation() - camera->GetTranslation()).normalized();
float dot = dist.dot(camera->GetTransform().frontVector());
float dVar4 = 0.f;
if (dot >= 0.f) {
dVar4 = dot * dot;
}
xfc_ = dVar4 * intensity;
if (xf8_ > 1.f) {
mgr.FreeScriptObject(GetUniqueId());
}
}
void COmegaPirate::CFlash::PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) {
mgr.RenderLast(GetUniqueId());
// if (xf0_thermalSpot == nullptr && xe8_thermalSpotToken.IsLocked() && xe8_thermalSpotToken.HasReference()) {
// xf0_thermalSpot = xe8_thermalSpotToken.GetObj();
// }
}
void COmegaPirate::CFlash::AddToRenderer(const zeus::CFrustum& frustum, CStateManager& mgr) {}
void COmegaPirate::CFlash::Render(CStateManager& mgr) {
const CPlayerState::EPlayerVisor visor = mgr.GetPlayerState()->GetActiveVisor(mgr);
if (visor == CPlayerState::EPlayerVisor::Thermal) {
return;
}
float alphaMul = 35.f;
CTexturedQuadFilter* filter = nullptr;
if (visor == CPlayerState::EPlayerVisor::XRay) {
// CGraphics::SetBlendMode(ERglBlendMode::Subtract, ERglBlendFactor::One, ERglBlendFactor::Zero,
// ERglLogicOp::Clear);
filter = &m_thermalSpotSubtract;
alphaMul = 60.f;
} else {
// CGraphics::SetBlendMode(ERglBlendMode::Blend, ERglBlendFactor::SrcAlpha, ERglBlendFactor::One,
// ERglLogicOp::Clear);
filter = &m_thermalSpotBlend;
}
CGraphics::SetModelMatrix(zeus::CTransform());
zeus::CColor useColor{1.f, std::max(0.f, (xfc_ * alphaMul) / 255.f)};
const auto rightVec = CGraphics::g_GXModelView.rightVector();
const auto upVec = CGraphics::g_GXModelView.upVector();
const auto rvS = GetTranslation() - rightVec;
const auto rvP = GetTranslation() + rightVec;
const std::array<CTexturedQuadFilter::Vert, 4> verts{{
{rvS + upVec, {0.f, 0.f}},
{rvS - upVec, {1.f, 0.f}},
{rvP - upVec, {1.f, 1.f}},
{rvP + upVec, {0.f, 1.f}},
}};
filter->drawVerts(useColor, verts);
}
COmegaPirate::COmegaPirate(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf, COmegaPirate::COmegaPirate(TUniqueId uid, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms, CModelData&& mData, const CPatternedInfo& pInfo, const CActorParameters& actParms,
CElitePirateData data, CAssetId w1, CAssetId w2, CAssetId w3) CElitePirateData data, CAssetId w1, CAssetId w2, CAssetId w3)
@ -294,7 +367,7 @@ void COmegaPirate::DoubleSnap(CStateManager& mgr, EStateMsg msg, float dt) {
xa88_ = false; xa88_ = false;
xa8c_ = 3.f; xa8c_ = 3.f;
for (auto& entry : x9dc_scriptPlatforms) { for (auto& entry : x9dc_scriptPlatforms) {
if (auto platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) { if (auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) {
platform->SetActive(true); platform->SetActive(true);
platform->SetDamageVulnerability(xae4_platformVuln); platform->SetDamageVulnerability(xae4_platformVuln);
platform->AddMaterial(EMaterialTypes::Orbit, EMaterialTypes::Target, mgr); platform->AddMaterial(EMaterialTypes::Orbit, EMaterialTypes::Target, mgr);
@ -317,10 +390,10 @@ void COmegaPirate::DoubleSnap(CStateManager& mgr, EStateMsg msg, float dt) {
SetState(CElitePirate::EState::Over); SetState(CElitePirate::EState::Over);
} }
} else if (msg == EStateMsg::Deactivate) { } else if (msg == EStateMsg::Deactivate) {
if (auto launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(GetLauncherId()))) { if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(GetLauncherId()))) {
launcher->SetFollowPlayer(true); launcher->SetFollowPlayer(true);
} }
if (auto launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(x990_launcherId2))) { if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(x990_launcherId2))) {
launcher->SetFollowPlayer(true); launcher->SetFollowPlayer(true);
} }
} }
@ -330,7 +403,7 @@ void COmegaPirate::DoUserAnimEvent(CStateManager& mgr, const CInt32POINode& node
switch (type) { switch (type) {
case EUserEventType::EggLay: case EUserEventType::EggLay:
if (x990_launcherId2 != kInvalidUniqueId) { if (x990_launcherId2 != kInvalidUniqueId) {
if (auto entity = mgr.ObjectById(x990_launcherId2)) { if (auto* entity = mgr.ObjectById(x990_launcherId2)) {
mgr.SendScriptMsg(entity, GetUniqueId(), EScriptObjectMessage::Action); mgr.SendScriptMsg(entity, GetUniqueId(), EScriptObjectMessage::Action);
} }
} }
@ -424,7 +497,7 @@ void COmegaPirate::Faint(CStateManager& mgr, EStateMsg msg, float dt) {
xa8c_ = 0.333f; xa8c_ = 0.333f;
} }
for (const auto& entry : x9dc_scriptPlatforms) { for (const auto& entry : x9dc_scriptPlatforms) {
if (auto platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) { if (auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) {
platform->SetActive(true); platform->SetActive(true);
} }
} }
@ -434,7 +507,7 @@ void COmegaPirate::Faint(CStateManager& mgr, EStateMsg msg, float dt) {
float invAlpha = 1.f - alpha; float invAlpha = 1.f - alpha;
size_t idx = 0; size_t idx = 0;
for (const auto& entry : x9dc_scriptPlatforms) { for (const auto& entry : x9dc_scriptPlatforms) {
if (auto platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) { if (auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) {
if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay) { if (mgr.GetPlayerState()->GetActiveVisor(mgr) == CPlayerState::EPlayerVisor::XRay) {
if (xb4c_ > idx) { if (xb4c_ > idx) {
CModelFlags flags{5, 0, 3, zeus::skWhite}; CModelFlags flags{5, 0, 3, zeus::skWhite};
@ -520,7 +593,7 @@ void COmegaPirate::JumpBack(CStateManager& mgr, EStateMsg msg, float dt) {
GetBodyController()->GetCommandMgr().DeliverCmd( GetBodyController()->GetCommandMgr().DeliverCmd(
CBCKnockBackCmd(GetTransform().frontVector(), pas::ESeverity::Five)); CBCKnockBackCmd(GetTransform().frontVector(), pas::ESeverity::Five));
for (const auto& entry : x9dc_scriptPlatforms) { for (const auto& entry : x9dc_scriptPlatforms) {
if (auto platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) { if (auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) {
platform->SetActive(false); platform->SetActive(false);
} }
} }
@ -537,7 +610,7 @@ bool COmegaPirate::Landed(CStateManager& mgr, float arg) { return (xb4c_ & 0xe7)
zeus::CVector3f COmegaPirate::GetOrbitPosition(const CStateManager& mgr) const { zeus::CVector3f COmegaPirate::GetOrbitPosition(const CStateManager& mgr) const {
if (x990_launcherId2 != kInvalidUniqueId && if (x990_launcherId2 != kInvalidUniqueId &&
mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::Thermal) { mgr.GetPlayerState()->GetCurrentVisor() == CPlayerState::EPlayerVisor::Thermal) {
if (const auto actor = static_cast<const CActor*>(mgr.GetObjectById(x990_launcherId2))) { if (const auto* actor = static_cast<const CActor*>(mgr.GetObjectById(x990_launcherId2))) {
return GetLockOnPosition(actor); return GetLockOnPosition(actor);
} }
} }
@ -695,7 +768,7 @@ void COmegaPirate::Suck(CStateManager& mgr, EStateMsg msg, float dt) {
} }
} else if (msg == EStateMsg::Deactivate) { } else if (msg == EStateMsg::Deactivate) {
for (const auto& entry : x9dc_scriptPlatforms) { for (const auto& entry : x9dc_scriptPlatforms) {
if (auto platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) { if (auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) {
platform->SetDamageVulnerability(CDamageVulnerability::ImmuneVulnerabilty()); platform->SetDamageVulnerability(CDamageVulnerability::ImmuneVulnerabilty());
platform->RemoveMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr); platform->RemoveMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
platform->SetDisableXRayAlpha(true); platform->SetDisableXRayAlpha(true);
@ -763,7 +836,7 @@ void COmegaPirate::Think(float dt, CStateManager& mgr) {
} else { } else {
xa38_collisionActorMgr1->SetActive(mgr, true); xa38_collisionActorMgr1->SetActive(mgr, true);
xa9c_collisionActorMgr2->SetActive(mgr, true); xa9c_collisionActorMgr2->SetActive(mgr, true);
if (auto entity = mgr.ObjectById(xa48_)) { if (auto* entity = mgr.ObjectById(xa48_)) {
entity->SetActive(false); entity->SetActive(false);
} }
} }
@ -772,12 +845,12 @@ void COmegaPirate::Think(float dt, CStateManager& mgr) {
xa38_collisionActorMgr1->SetActive(mgr, false); xa38_collisionActorMgr1->SetActive(mgr, false);
if (x9a1_) { if (x9a1_) {
xa9c_collisionActorMgr2->SetActive(mgr, true); xa9c_collisionActorMgr2->SetActive(mgr, true);
if (auto entity = mgr.ObjectById(xa48_)) { if (auto* entity = mgr.ObjectById(xa48_)) {
entity->SetActive(true); entity->SetActive(true);
} }
} else { } else {
xa9c_collisionActorMgr2->SetActive(mgr, false); xa9c_collisionActorMgr2->SetActive(mgr, false);
if (auto entity = mgr.ObjectById(xa48_)) { if (auto* entity = mgr.ObjectById(xa48_)) {
entity->SetActive(false); entity->SetActive(false);
} }
} }
@ -787,7 +860,7 @@ void COmegaPirate::Think(float dt, CStateManager& mgr) {
xa38_collisionActorMgr1->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace); xa38_collisionActorMgr1->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace);
xa9c_collisionActorMgr2->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace); xa9c_collisionActorMgr2->Update(dt, mgr, CCollisionActorManager::EUpdateOptions::ObjectSpace);
if (auto entity = static_cast<CActor*>(mgr.ObjectById(xa46_))) { if (auto* entity = static_cast<CActor*>(mgr.ObjectById(xa46_))) {
float hp = GetHealthInfo(mgr)->GetHP(); float hp = GetHealthInfo(mgr)->GetHP();
*HealthInfo(mgr) = *entity->GetHealthInfo(mgr); *HealthInfo(mgr) = *entity->GetHealthInfo(mgr);
float hpChange = hp - GetHealthInfo(mgr)->GetHP(); float hpChange = hp - GetHealthInfo(mgr)->GetHP();
@ -812,7 +885,7 @@ void COmegaPirate::Think(float dt, CStateManager& mgr) {
sub_8028c704(mgr, dt); sub_8028c704(mgr, dt);
for (auto& entry : x9dc_scriptPlatforms) { for (auto& entry : x9dc_scriptPlatforms) {
auto platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first)); auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first));
if ((!xb78_ && !xb79_) || xa4a_) { if ((!xb78_ && !xb79_) || xa4a_) {
platform->RemoveMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr); platform->RemoveMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
} else { } else {
@ -828,7 +901,7 @@ void COmegaPirate::Think(float dt, CStateManager& mgr) {
AddMaterial(EMaterialTypes::Target, mgr); AddMaterial(EMaterialTypes::Target, mgr);
player.ResetAimTargetPrediction(GetUniqueId()); player.ResetAimTargetPrediction(GetUniqueId());
for (auto& entry : x9dc_scriptPlatforms) { for (auto& entry : x9dc_scriptPlatforms) {
if (auto platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) { if (auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) {
platform->RemoveMaterial(EMaterialTypes::Target, mgr); platform->RemoveMaterial(EMaterialTypes::Target, mgr);
} }
} }
@ -836,7 +909,7 @@ void COmegaPirate::Think(float dt, CStateManager& mgr) {
} else if (!xa4a_) { } else if (!xa4a_) {
RemoveMaterial(EMaterialTypes::Target, mgr); RemoveMaterial(EMaterialTypes::Target, mgr);
for (auto& entry : x9dc_scriptPlatforms) { for (auto& entry : x9dc_scriptPlatforms) {
if (auto platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) { if (auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) {
platform->AddMaterial(EMaterialTypes::Target, mgr); platform->AddMaterial(EMaterialTypes::Target, mgr);
} }
} }
@ -851,10 +924,10 @@ void COmegaPirate::Think(float dt, CStateManager& mgr) {
} }
} }
if (auto launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(GetLauncherId()))) { if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(GetLauncherId()))) {
launcher->SetFollowPlayer(xadf_); launcher->SetFollowPlayer(xadf_);
} }
if (auto launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(x990_launcherId2))) { if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(x990_launcherId2))) {
launcher->SetFollowPlayer(xae0_); launcher->SetFollowPlayer(xae0_);
} }
@ -1143,20 +1216,20 @@ void COmegaPirate::sub_8028f6f0(CStateManager& mgr, float dt) {
x42c_color.a() = x99c_; x42c_color.a() = x99c_;
if (alpha >= 1.f) { if (alpha >= 1.f) {
if (auto launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(GetLauncherId()))) { if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(GetLauncherId()))) {
launcher->SetVisible(true); launcher->SetVisible(true);
launcher->SetColor(zeus::CColor{0.f}); launcher->SetColor(zeus::CColor{0.f});
} }
if (auto launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(x990_launcherId2))) { if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(x990_launcherId2))) {
launcher->SetVisible(true); launcher->SetVisible(true);
launcher->SetColor(zeus::CColor{0.f}); launcher->SetColor(zeus::CColor{0.f});
} }
} else { } else {
if (auto launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(GetLauncherId()))) { if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(GetLauncherId()))) {
launcher->SetColor(zeus::CColor{1.f, alpha}); launcher->SetColor(zeus::CColor{1.f, alpha});
launcher->SetVisible(alpha != 0.f); launcher->SetVisible(alpha != 0.f);
} }
if (auto launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(x990_launcherId2))) { if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(x990_launcherId2))) {
launcher->SetColor(zeus::CColor{1.f, alpha}); launcher->SetColor(zeus::CColor{1.f, alpha});
launcher->SetVisible(alpha != 0.f); launcher->SetVisible(alpha != 0.f);
} }
@ -1218,7 +1291,7 @@ void COmegaPirate::sub_8028cd04(CStateManager& mgr, float dt) {
} }
void COmegaPirate::sub_8028d7e4(CStateManager& mgr, float dt) { void COmegaPirate::sub_8028d7e4(CStateManager& mgr, float dt) {
auto modelData = GetModelData(); auto* modelData = GetModelData();
zeus::CVector3f scale = modelData->GetScale(); zeus::CVector3f scale = modelData->GetScale();
switch (x9c8_) { switch (x9c8_) {
case 0: case 0:
@ -1282,14 +1355,14 @@ void COmegaPirate::sub_8028d7e4(CStateManager& mgr, float dt) {
} }
modelData->SetScale(scale); modelData->SetScale(scale);
if (auto launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(GetLauncherId()))) { if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(GetLauncherId()))) {
launcher->GetModelData()->SetScale(scale); launcher->GetModelData()->SetScale(scale);
} }
if (auto launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(x990_launcherId2))) { if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(x990_launcherId2))) {
launcher->GetModelData()->SetScale(scale); launcher->GetModelData()->SetScale(scale);
} }
for (const auto& entry : x9dc_scriptPlatforms) { for (const auto& entry : x9dc_scriptPlatforms) {
if (auto platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) { if (auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) {
platform->GetModelData()->SetScale(scale); platform->GetModelData()->SetScale(scale);
} }
} }
@ -1332,7 +1405,7 @@ void COmegaPirate::Destroy(CStateManager& mgr) {
SendScriptMsgs(EScriptObjectState::Dead, mgr, EScriptObjectMessage::None); SendScriptMsgs(EScriptObjectState::Dead, mgr, EScriptObjectMessage::None);
SendScriptMsgs(EScriptObjectState::Inside, mgr, EScriptObjectMessage::None); SendScriptMsgs(EScriptObjectState::Inside, mgr, EScriptObjectMessage::None);
for (auto& entry : x9dc_scriptPlatforms) { for (auto& entry : x9dc_scriptPlatforms) {
if (auto platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) { if (auto* platform = static_cast<CScriptPlatform*>(mgr.ObjectById(entry.first))) {
platform->SetActive(false); platform->SetActive(false);
platform->RemoveMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr); platform->RemoveMaterial(EMaterialTypes::Target, EMaterialTypes::Orbit, mgr);
mgr.FreeScriptObject(entry.first); mgr.FreeScriptObject(entry.first);
@ -1340,10 +1413,10 @@ void COmegaPirate::Destroy(CStateManager& mgr) {
} }
x9dc_scriptPlatforms.clear(); x9dc_scriptPlatforms.clear();
if (auto launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(GetLauncherId()))) { if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(GetLauncherId()))) {
launcher->SetActive(false); launcher->SetActive(false);
} }
if (auto launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(x990_launcherId2))) { if (auto* launcher = static_cast<CGrenadeLauncher*>(mgr.ObjectById(x990_launcherId2))) {
launcher->SetActive(false); launcher->SetActive(false);
} }
SetActive(false); SetActive(false);

View File

@ -7,16 +7,24 @@ class COmegaPirate : public CElitePirate {
private: private:
class CFlash : public CActor { class CFlash : public CActor {
private: private:
TToken<CTexture> xe8_thermalSpot; // TToken<CTexture> xe8_thermalSpotToken;
int xf0_ = 0; // CTexture* xf0_thermalSpot = nullptr;
float xf4_; float xf4_delay;
float xf8_ = 0.f; float xf8_ = 0.f;
float xfc_ = 0.f; float xfc_ = 0.f;
CTexturedQuadFilter m_thermalSpotBlend;
CTexturedQuadFilter m_thermalSpotSubtract;
public: public:
CFlash(TUniqueId uid, const CEntityInfo& info, const zeus::CVector3f& pos, TToken<CTexture>& thermalSpot, float p5); CFlash(TUniqueId uid, const CEntityInfo& info, const zeus::CVector3f& pos, TLockedToken<CTexture>& thermalSpot,
float delay);
void Accept(IVisitor& visitor) override; void Accept(IVisitor& visitor) override;
void Think(float dt, CStateManager& mgr) override;
void PreRender(CStateManager& mgr, const zeus::CFrustum& frustum) override;
void AddToRenderer(const zeus::CFrustum& frustum, CStateManager& mgr) override;
void Render(CStateManager& mgr) override;
}; };
TUniqueId x990_launcherId2 = kInvalidUniqueId; TUniqueId x990_launcherId2 = kInvalidUniqueId;

View File

@ -995,7 +995,7 @@ void CThardus::RenderFlare(const CStateManager& mgr, float t) {
{{min.x() - offset.x(), min.y() - offset.y(), min.z() - offset.z()}, {1.f, 0.f}}, {{min.x() - offset.x(), min.y() - offset.y(), min.z() - offset.z()}, {1.f, 0.f}},
}}; }};
m_flareFilter->drawVerts({t, t}, verts.data()); m_flareFilter->drawVerts({t, t}, verts);
} }
#if 0 #if 0