2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-08-04 10:55:35 +00:00
metaforce/Runtime/World/CScriptGrapplePoint.cpp
Lioncash cabbfcc320 CActor: Make AddToRenderer() non-const
This member function alters instance state in a few implementations, so
it shouldn't be made const.

The state manager parameter also shouldn't be const. Retrieved data
from the post constructed instance is further modified in some
implementations. This removes the constness on this parameter in order
to fix more const_cast usages in a follow-up change.
2020-04-06 00:52:10 -04:00

54 lines
1.7 KiB
C++

#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
namespace urde {
CScriptGrapplePoint::CScriptGrapplePoint(TUniqueId uid, std::string_view name, const CEntityInfo& info,
const zeus::CTransform& transform, bool active,
const CGrappleParameters& params)
: CActor(uid, active, name, info, transform, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::Orbit),
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);
}
break;
case EScriptObjectMessage::Deactivate:
if (GetActive()) {
RemoveMaterial(EMaterialTypes::Orbit, mgr);
SetActive(false);
}
break;
default:
break;
}
}
void CScriptGrapplePoint::Think(float, CStateManager&) {
// Empty
}
void CScriptGrapplePoint::Render(const CStateManager&) const {
// Empty
}
std::optional<zeus::CAABox> CScriptGrapplePoint::GetTouchBounds() const { return {xe8_touchBounds}; }
void CScriptGrapplePoint::AddToRenderer(const zeus::CFrustum&, CStateManager& mgr) {
CActor::EnsureRendered(mgr);
}
} // namespace urde