metaforce/Runtime/World/CScriptGrapplePoint.cpp

54 lines
1.7 KiB
C++
Raw Normal View History

#include "Runtime/World/CScriptGrapplePoint.hpp"
#include "Runtime/Character/CModelData.hpp"
#include "Runtime/Collision/CMaterialList.hpp"
#include "Runtime/World/CActorParameters.hpp"
#include "TCastTo.hpp" // Generated file, do not modify include path
2016-04-20 21:07:18 +00:00
2018-12-08 05:30:43 +00:00
namespace urde {
2017-11-13 06:19:18 +00:00
CScriptGrapplePoint::CScriptGrapplePoint(TUniqueId uid, std::string_view name, const CEntityInfo& info,
2018-12-08 05:30:43 +00:00
const zeus::CTransform& transform, bool active,
const CGrappleParameters& params)
2018-06-21 00:57:57 +00:00
: CActor(uid, active, name, info, transform, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::Orbit),
2018-12-08 05:30:43 +00:00
CActorParameters::None(), kInvalidUniqueId)
, xe8_touchBounds(x34_transform.origin - 0.5f, x34_transform.origin + 0.5f)
, x100_parameters(params) {}
void CScriptGrapplePoint::Accept(IVisitor& visitor) { visitor.Visit(this); }
void CScriptGrapplePoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) {
switch (msg) {
case EScriptObjectMessage::Activate:
if (!GetActive()) {
AddMaterial(EMaterialTypes::Orbit, mgr);
SetActive(true);
2018-06-21 00:57:57 +00:00
}
2018-12-08 05:30:43 +00:00
break;
case EScriptObjectMessage::Deactivate:
if (GetActive()) {
RemoveMaterial(EMaterialTypes::Orbit, mgr);
SetActive(false);
}
break;
default:
break;
}
2018-06-21 00:57:57 +00:00
}
2018-12-08 05:30:43 +00:00
void CScriptGrapplePoint::Think(float, CStateManager&) {
// Empty
2018-06-21 00:57:57 +00:00
}
void CScriptGrapplePoint::Render(CStateManager&) {
2018-12-08 05:30:43 +00:00
// Empty
2018-06-21 00:57:57 +00:00
}
std::optional<zeus::CAABox> CScriptGrapplePoint::GetTouchBounds() const { return {xe8_touchBounds}; }
2018-06-21 00:57:57 +00:00
void CScriptGrapplePoint::AddToRenderer(const zeus::CFrustum&, CStateManager& mgr) {
2018-12-08 05:30:43 +00:00
CActor::EnsureRendered(mgr);
2018-06-21 00:57:57 +00:00
}
2018-12-08 05:30:43 +00:00
} // namespace urde