metaforce/Runtime/World/CScriptVisorFlare.cpp

47 lines
1.8 KiB
C++
Raw Normal View History

#include "Runtime/World/CScriptVisorFlare.hpp"
#include "Runtime/CStateManager.hpp"
#include "Runtime/Particle/CGenDescription.hpp"
#include "Runtime/World/CActorParameters.hpp"
#include "Runtime/World/CPlayer.hpp"
#include "TCastTo.hpp" // Generated file, do not modify include path
2017-03-20 05:09:53 +00:00
2021-04-10 08:42:06 +00:00
namespace metaforce {
2017-03-20 05:09:53 +00:00
2018-12-08 05:30:43 +00:00
CScriptVisorFlare::CScriptVisorFlare(TUniqueId uid, std::string_view name, const CEntityInfo& info, bool active,
const zeus::CVector3f& pos, CVisorFlare::EBlendMode blendMode, bool b1, float f1,
float f2, float f3, u32 w1, u32 w2, std::vector<CVisorFlare::CFlareDef> flares)
2017-03-20 05:09:53 +00:00
: CActor(uid, active, name, info, zeus::CTransform::Translate(pos), CModelData::CModelDataNull(),
2018-12-08 05:30:43 +00:00
CMaterialList(EMaterialTypes::NoStepLogic), CActorParameters::None(), kInvalidUniqueId)
2022-05-24 05:44:20 +00:00
, xe8_flare(blendMode, b1, f1, f2, f3, w1, w2, std::move(flares))
, x11c_notInRenderLast(true) {
2018-12-08 05:30:43 +00:00
xe6_27_thermalVisorFlags = 2;
2017-03-20 05:09:53 +00:00
}
2018-12-08 05:30:43 +00:00
void CScriptVisorFlare::Accept(IVisitor& visitor) { visitor.Visit(this); }
2017-03-20 05:09:53 +00:00
2018-12-08 05:30:43 +00:00
void CScriptVisorFlare::Think(float dt, CStateManager& stateMgr) {
if (GetActive()) {
2018-12-08 05:30:43 +00:00
xe8_flare.Update(dt, GetTranslation(), this, stateMgr);
}
2017-03-20 05:09:53 +00:00
}
2018-12-08 05:30:43 +00:00
void CScriptVisorFlare::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, CStateManager& stateMgr) {
CActor::AcceptScriptMsg(msg, objId, stateMgr);
2017-03-20 05:09:53 +00:00
}
2018-12-08 05:30:43 +00:00
void CScriptVisorFlare::PreRender(CStateManager& stateMgr, const zeus::CFrustum&) {
x11c_notInRenderLast = !stateMgr.RenderLast(x8_uid);
2017-03-20 05:09:53 +00:00
}
void CScriptVisorFlare::AddToRenderer(const zeus::CFrustum&, CStateManager& stateMgr) {
if (x11c_notInRenderLast) {
2018-12-08 05:30:43 +00:00
EnsureRendered(stateMgr, stateMgr.GetPlayer().GetTranslation(), GetSortingBounds(stateMgr));
}
2017-03-20 05:09:53 +00:00
}
void CScriptVisorFlare::Render(CStateManager& stateMgr) { xe8_flare.Render(GetTranslation(), stateMgr); }
2017-03-20 05:09:53 +00:00
2021-04-10 08:42:06 +00:00
} // namespace metaforce