mirror of https://github.com/AxioDL/metaforce.git
Initial CPathCamera imps
This commit is contained in:
parent
186acae5d8
commit
21b25f72a3
|
@ -50,6 +50,12 @@ void CCameraSpline::CalculateKnots(TUniqueId cameraId, const std::vector<SConnec
|
|||
}
|
||||
}
|
||||
|
||||
void CCameraSpline::Initialize(TUniqueId camId, const std::vector<SConnection>& connections, CStateManager& mgr)
|
||||
{
|
||||
CalculateKnots(camId, connections, mgr);
|
||||
x44_length = CalculateSplineLength();
|
||||
}
|
||||
|
||||
void CCameraSpline::Reset(int size)
|
||||
{
|
||||
x4_positions.clear();
|
||||
|
@ -286,4 +292,9 @@ zeus::CVector3f CCameraSpline::GetInterpolatedSplinePointByTime(float time, floa
|
|||
|
||||
return {};
|
||||
}
|
||||
|
||||
float CCameraSpline::FindClosestLengthAlongSpline(float time, const zeus::CVector3f& p)
|
||||
{
|
||||
return 0.f;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,6 +31,9 @@ public:
|
|||
void UpdateSplineLength() { x44_length = CalculateSplineLength(); }
|
||||
zeus::CTransform GetInterpolatedSplinePointByLength(float pos) const;
|
||||
zeus::CVector3f GetInterpolatedSplinePointByTime(float time, float range) const;
|
||||
float FindClosestLengthAlongSpline(float time, const zeus::CVector3f& p);
|
||||
s32 GetSize() const { return x4_positions.size(); }
|
||||
float GetLength() const { return x44_length; }
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,10 @@
|
|||
#include "CPathCamera.hpp"
|
||||
#include "CCameraManager.hpp"
|
||||
#include "CStateManager.hpp"
|
||||
#include "CBallCamera.hpp"
|
||||
#include "World/CScriptCameraHint.hpp"
|
||||
#include "World/CPlayer.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
#include "TCastTo.hpp"
|
||||
|
||||
namespace urde
|
||||
|
@ -23,11 +28,80 @@ void CPathCamera::Accept(IVisitor& visitor)
|
|||
visitor.Visit(this);
|
||||
}
|
||||
|
||||
void CPathCamera::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
|
||||
{
|
||||
CGameCamera::AcceptScriptMsg(msg, uid, mgr);
|
||||
|
||||
if (GetActive() && msg == EScriptObjectMessage::InitializedInArea)
|
||||
x188_spline.Initialize(GetUniqueId(), GetConnectionList(), mgr);
|
||||
}
|
||||
|
||||
void CPathCamera::Think(float dt, CStateManager& mgr)
|
||||
{
|
||||
if (!GetActive())
|
||||
return;
|
||||
|
||||
if (mgr.GetCameraManager()->GetPathCameraId() != GetUniqueId())
|
||||
return;
|
||||
|
||||
if (x188_spline.GetSize() <= 0)
|
||||
return;
|
||||
|
||||
zeus::CTransform xf = GetTransform();
|
||||
zeus::CVector3f ballLook = mgr.GetCameraManager()->GetBallCamera()->GetLookPos();
|
||||
if ((x1ec_flags & 0x10))
|
||||
{
|
||||
if (const CScriptCameraHint* hint = mgr.GetCameraManager()->GetCameraHint(mgr))
|
||||
ballLook.z = hint->GetTranslation().z;
|
||||
}
|
||||
|
||||
if (!mgr.GetPlayer().GetVelocity().canBeNormalized() && (ballLook - GetTranslation()).canBeNormalized())
|
||||
{
|
||||
if (x1ec_flags & 4)
|
||||
SetTransform(x188_spline.GetInterpolatedSplinePointByLength(x1d4_pos));
|
||||
else
|
||||
SetTransform(zeus::lookAt(GetTranslation(), ballLook));
|
||||
return;
|
||||
}
|
||||
|
||||
xf = MoveAlongSpline(dt, mgr);
|
||||
SetTranslation(xf.origin);
|
||||
|
||||
if (x1ec_flags & 0x20)
|
||||
sub8012DD3C(mgr);
|
||||
|
||||
zeus::CVector3f tmp = ballLook - GetTranslation();
|
||||
tmp.z = 0.f;
|
||||
if (tmp.canBeNormalized())
|
||||
SetTransform(zeus::lookAt(GetTranslation(), ballLook));
|
||||
|
||||
if (x1ec_flags & 4)
|
||||
SetTransform(xf);
|
||||
}
|
||||
|
||||
void CPathCamera::ProcessInput(const CFinalInput&, CStateManager& mgr)
|
||||
{
|
||||
}
|
||||
|
||||
void CPathCamera::Reset(const zeus::CTransform&, CStateManager& mgr)
|
||||
{
|
||||
CPlayer& player = mgr.GetPlayer();
|
||||
float f23 = x188_spline.FindClosestLengthAlongSpline(0.f, player.GetTranslation() + g_tweakPlayer->GetPlayerBallHalfExtent());
|
||||
|
||||
float f25 = std::max(0.f, f23 - x1dc_);
|
||||
|
||||
zeus::CTransform xf = x188_spline.GetInterpolatedSplinePointByLength(f25);
|
||||
|
||||
float f1 = x188_spline.GetLength();
|
||||
|
||||
}
|
||||
|
||||
zeus::CTransform CPathCamera::MoveAlongSpline(float, CStateManager& mgr)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
void CPathCamera::sub8012DD3C(CStateManager& )
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -16,8 +16,8 @@ public:
|
|||
private:
|
||||
|
||||
CCameraSpline x188_spline;
|
||||
float x1d4_ = 0.f;
|
||||
float x1d8_ = 0.f;
|
||||
float x1d4_pos = 0.f;
|
||||
float x1d8_time = 0.f;
|
||||
float x1dc_;
|
||||
float x1e0_;
|
||||
float x1e4_;
|
||||
|
@ -32,8 +32,13 @@ public:
|
|||
float, float, u32, EInitialSplinePosition);
|
||||
|
||||
void Accept(IVisitor&);
|
||||
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
|
||||
void Think(float, CStateManager&);
|
||||
void Render(const CStateManager&) const {}
|
||||
void ProcessInput(const CFinalInput&, CStateManager& mgr);
|
||||
void Reset(const zeus::CTransform&, CStateManager& mgr);
|
||||
zeus::CTransform MoveAlongSpline(float, CStateManager&);
|
||||
void sub8012DD3C(CStateManager&);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ void CAmbientAI::Accept(IVisitor& visitor)
|
|||
|
||||
void CAmbientAI::Think(float dt, CStateManager& mgr)
|
||||
{
|
||||
return;
|
||||
if (!GetActive())
|
||||
return;
|
||||
|
||||
|
@ -114,6 +115,7 @@ void CAmbientAI::Think(float dt, CStateManager& mgr)
|
|||
|
||||
void CAmbientAI::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
|
||||
{
|
||||
return;
|
||||
switch(msg)
|
||||
{
|
||||
case EScriptObjectMessage::Reset:
|
||||
|
|
|
@ -2562,7 +2562,26 @@ CEntity* ScriptLoader::LoadGeemer(CStateManager& mgr, CInputStream& in, int prop
|
|||
CPatternedInfo pInfo(in, pair.second);
|
||||
CActorParameters actParms = LoadActorParameters(in);
|
||||
|
||||
if (pInfo.GetAnimationParameters().GetACSFile() == CAssetId())
|
||||
return nullptr;
|
||||
|
||||
float f1 = in.readFloatBig();
|
||||
float f2 = in.readFloatBig();
|
||||
float f3 = in.readFloatBig();
|
||||
float f4 = in.readFloatBig();
|
||||
float f5 = in.readFloatBig();
|
||||
float f6 = in.readFloatBig();
|
||||
float f7 = in.readFloatBig();
|
||||
u16 sId1 = in.readUint32Big() & 0xFFFF;
|
||||
u16 sId2 = in.readUint32Big() & 0xFFFF;
|
||||
u16 sId3 = in.readUint32Big() & 0xFFFF;
|
||||
|
||||
CModelData mData(CAnimRes(pInfo.GetAnimationParameters().GetACSFile(), pInfo.GetAnimationParameters().GetCharacter(),
|
||||
actHead.x40_scale, pInfo.GetAnimationParameters().GetInitialAnimation(), true));
|
||||
|
||||
return new MP1::CParasite(mgr.AllocateUniqueId(), actHead.x0_name, CPatterned::EFlavorType::Zero, info, actHead.x10_transform,
|
||||
std::move(mData), pInfo, 6, 0.f, f1, f2, f3, f4, 0.2f, 0.4f, 0.f, 0.f, 0.f, 0.f, 0.f, 1.f, f7, 0.f, 0.f,
|
||||
f5, f6, false, 2, CDamageVulnerability::NormalVulnerabilty(), MP1::CParasiteInfo(), sId1, sId2, sId3, -1, -1, 0.f, actParms);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadSpindleCamera(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||
|
|
Loading…
Reference in New Issue