metaforce/Runtime/World/CScriptGrapplePoint.cpp

52 lines
1.6 KiB
C++
Raw Normal View History

2016-04-20 21:07:18 +00:00
#include "CScriptGrapplePoint.hpp"
#include "Character/CModelData.hpp"
#include "Collision/CMaterialList.hpp"
#include "CActorParameters.hpp"
2017-01-15 03:07:01 +00:00
#include "TCastTo.hpp"
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
}
2018-12-08 05:30:43 +00:00
void CScriptGrapplePoint::Render(const CStateManager&) const {
// Empty
2018-06-21 00:57:57 +00:00
}
2019-01-29 08:28:35 +00:00
rstl::optional<zeus::CAABox> CScriptGrapplePoint::GetTouchBounds() const { return {xe8_touchBounds}; }
2018-06-21 00:57:57 +00:00
2018-12-08 05:30:43 +00:00
void CScriptGrapplePoint::AddToRenderer(const zeus::CFrustum&, const CStateManager& mgr) const {
CActor::EnsureRendered(mgr);
2018-06-21 00:57:57 +00:00
}
2018-12-08 05:30:43 +00:00
} // namespace urde