2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-09 07:47:42 +00:00

New code style refactor

This commit is contained in:
Jack Andersen
2018-12-07 19:30:43 -10:00
parent 41ae32be31
commit 636c82a568
1451 changed files with 171430 additions and 203303 deletions

View File

@@ -7,8 +7,7 @@
#include "Particle/CGenDescription.hpp"
#include "TCastTo.hpp"
namespace urde
{
namespace urde {
const zeus::CVector3f CScriptCameraPitchVolume::skScaleFactor = zeus::CVector3f(0.5f);
CScriptCameraPitchVolume::CScriptCameraPitchVolume(TUniqueId uid, bool active, std::string_view name,
@@ -21,55 +20,45 @@ CScriptCameraPitchVolume::CScriptCameraPitchVolume(TUniqueId uid, bool active, s
, x124_upPitch(r1)
, x128_downPitch(r2)
, x12c_scale(scale * skScaleFactor)
, x138_maxInterpDistance(maxInterpDistance)
{
, x138_maxInterpDistance(maxInterpDistance) {}
void CScriptCameraPitchVolume::Accept(IVisitor& visitor) { visitor.Visit(this); }
void CScriptCameraPitchVolume::Think(float, CStateManager& mgr) {
if (!GetActive())
return;
if (x13c_24_entered && !x13c_25_occupied)
Entered(mgr);
else if (!x13c_24_entered && x13c_25_occupied)
Exited(mgr);
x13c_24_entered = false;
}
void CScriptCameraPitchVolume::Accept(IVisitor& visitor)
{
visitor.Visit(this);
std::experimental::optional<zeus::CAABox> CScriptCameraPitchVolume::GetTouchBounds() const {
return {xe8_obbox.calculateAABox(zeus::CTransform::Identity())};
}
void CScriptCameraPitchVolume::Think(float, CStateManager& mgr)
{
if (!GetActive())
return;
void CScriptCameraPitchVolume::Touch(CActor& act, CStateManager& mgr) {
TCastToPtr<CPlayer> pl(act);
if (!pl)
return;
if (x13c_24_entered && !x13c_25_occupied)
Entered(mgr);
else if (!x13c_24_entered && x13c_25_occupied)
Exited(mgr);
auto plBox = pl->GetTouchBounds();
if (!plBox)
return;
x13c_24_entered = false;
x13c_24_entered = xe8_obbox.AABoxIntersectsBox(plBox.value());
}
std::experimental::optional<zeus::CAABox> CScriptCameraPitchVolume::GetTouchBounds() const
{
return {xe8_obbox.calculateAABox(zeus::CTransform::Identity())};
void CScriptCameraPitchVolume::Entered(urde::CStateManager& mgr) {
x13c_25_occupied = true;
mgr.GetCameraManager()->GetFirstPersonCamera()->SetScriptPitchId(GetUniqueId());
}
void CScriptCameraPitchVolume::Touch(CActor& act, CStateManager& mgr)
{
TCastToPtr<CPlayer> pl(act);
if (!pl)
return;
auto plBox = pl->GetTouchBounds();
if (!plBox)
return;
x13c_24_entered = xe8_obbox.AABoxIntersectsBox(plBox.value());
}
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);
}
void CScriptCameraPitchVolume::Exited(CStateManager& mgr) {
x13c_25_occupied = false;
mgr.GetCameraManager()->GetFirstPersonCamera()->SetScriptPitchId(kInvalidUniqueId);
}
} // namespace urde