metaforce/Runtime/World/CScriptCameraPitchVolume.cpp

73 lines
2.2 KiB
C++
Raw Normal View History

#include "CScriptCameraPitchVolume.hpp"
#include "CActorParameters.hpp"
#include "CStateManager.hpp"
#include "CPlayer.hpp"
#include "Camera/CCameraManager.hpp"
#include "Camera/CFirstPersonCamera.hpp"
2017-01-15 03:07:01 +00:00
#include "TCastTo.hpp"
namespace urde
{
const zeus::CVector3f CScriptCameraPitchVolume::skScaleFactor = {0.5f};
CScriptCameraPitchVolume::CScriptCameraPitchVolume(TUniqueId uid, bool active, const std::string& name,
const CEntityInfo& info, const zeus::CVector3f& scale,
const zeus::CTransform& xf, const zeus::CRelAngle& r1,
const zeus::CRelAngle& r2, float maxInterpDistance)
2016-12-29 21:38:59 +00:00
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::Trigger),
CActorParameters::None(), kInvalidUniqueId)
, xe8_obbox(xf, scale * skScaleFactor)
, x124_(r1)
, x128_(r2)
, x12c_scale(scale * skScaleFactor)
, x138_maxInterpDistance(maxInterpDistance)
{
}
2017-01-15 03:07:01 +00:00
void CScriptCameraPitchVolume::Accept(IVisitor& visitor)
{
visitor.Visit(this);
}
void CScriptCameraPitchVolume::Think(float, CStateManager&)
{
if (!x30_24_active)
return;
}
rstl::optional_object<zeus::CAABox> CScriptCameraPitchVolume::GetTouchBounds() const
{
return {xe8_obbox.calculateAABox(zeus::CTransform::Identity())};
}
void CScriptCameraPitchVolume::Touch(CActor& act, CStateManager& mgr)
{
2017-01-15 03:59:37 +00:00
TCastToPtr<CPlayer> pl(act);
if (!pl)
return;
auto plBox = pl->GetTouchBounds();
if (!plBox)
return;
zeus::COBBox plOBox = zeus::COBBox::FromAABox(plBox.value(), zeus::CTransform::Identity());
xe8_obbox;
}
const zeus::CVector3f& CScriptCameraPitchVolume::GetScale() const { return x12c_scale; }
float CScriptCameraPitchVolume::GetMaxInterpolationDistance() const { return x138_maxInterpDistance; }
void CScriptCameraPitchVolume::Entered(urde::CStateManager& mgr)
{
x13c_25_occupied = true;
mgr.GetCameraManager()->GetFirstPersonCamera()->SetScriptPitchId(GetUniqueId());
}
void CScriptCameraPitchVolume::Exited(CStateManager& mgr)
{
x13c_25_occupied = false;
mgr.GetCameraManager()->GetFirstPersonCamera()->SetScriptPitchId(kInvalidUniqueId);
}
}