2016-04-24 04:03:30 +00:00
|
|
|
#include "CCinematicCamera.hpp"
|
2017-08-29 13:17:52 +00:00
|
|
|
#include "CStateManager.hpp"
|
2017-11-23 02:15:09 +00:00
|
|
|
#include "World/CPlayer.hpp"
|
|
|
|
#include "World/CScriptActor.hpp"
|
2017-01-15 03:07:01 +00:00
|
|
|
#include "TCastTo.hpp"
|
2016-04-24 04:03:30 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
|
2017-11-13 06:19:18 +00:00
|
|
|
CCinematicCamera::CCinematicCamera(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
2017-11-23 02:15:09 +00:00
|
|
|
const zeus::CTransform& xf, bool active, float shotDuration,
|
|
|
|
float fovy, float znear, float zfar, float aspect, u32 flags)
|
|
|
|
: CGameCamera(uid, active, name, info, xf, fovy, znear, zfar, aspect, kInvalidUniqueId, flags & 0x20, 0),
|
|
|
|
x1e8_duration(shotDuration), x1f0_origFovy(fovy), x1fc_(zeus::CQuaternion(xf.basis)), x21c_flags(flags)
|
2016-04-24 04:03:30 +00:00
|
|
|
{
|
2017-11-23 02:15:09 +00:00
|
|
|
x220_24_ = false;
|
2016-04-24 04:03:30 +00:00
|
|
|
}
|
|
|
|
|
2017-01-15 03:07:01 +00:00
|
|
|
void CCinematicCamera::Accept(IVisitor& visitor)
|
|
|
|
{
|
|
|
|
visitor.Visit(this);
|
|
|
|
}
|
|
|
|
|
2017-11-23 02:15:09 +00:00
|
|
|
void CCinematicCamera::ProcessInput(const CFinalInput&, CStateManager& mgr)
|
|
|
|
{
|
|
|
|
// Empty
|
|
|
|
}
|
2016-08-15 01:19:04 +00:00
|
|
|
|
2017-11-23 02:15:09 +00:00
|
|
|
void CCinematicCamera::Reset(const zeus::CTransform&, CStateManager& mgr)
|
|
|
|
{
|
|
|
|
// Empty
|
|
|
|
}
|
2017-02-18 02:19:50 +00:00
|
|
|
|
|
|
|
void CCinematicCamera::WasDeactivated(CStateManager& mgr)
|
|
|
|
{
|
2017-08-29 13:17:52 +00:00
|
|
|
mgr.GetCameraManager()->RemoveCinemaCamera(GetUniqueId(), mgr);
|
2017-11-23 02:15:09 +00:00
|
|
|
mgr.GetPlayer().GetMorphBall()->LoadMorphBallModel(mgr);
|
|
|
|
if (x21c_flags & 0x100)
|
|
|
|
mgr.SetCinematicPause(false);
|
|
|
|
x188_.clear();
|
|
|
|
x198_.clear();
|
|
|
|
x1a8_.clear();
|
|
|
|
x1b8_.clear();
|
|
|
|
x1c8_.clear();
|
|
|
|
x1d8_.clear();
|
2017-08-29 13:17:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CCinematicCamera::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
|
|
|
|
{
|
|
|
|
CGameCamera::AcceptScriptMsg(msg, uid, mgr);
|
2017-11-23 02:15:09 +00:00
|
|
|
switch (msg)
|
2017-08-29 13:17:52 +00:00
|
|
|
{
|
2017-11-23 02:15:09 +00:00
|
|
|
case EScriptObjectMessage::InitializedInArea:
|
|
|
|
if (x21c_flags & 0x4 || x21c_flags & 0x2)
|
2017-08-29 13:17:52 +00:00
|
|
|
{
|
2017-11-23 02:15:09 +00:00
|
|
|
for (const SConnection& conn : x20_conns)
|
|
|
|
{
|
|
|
|
TUniqueId id = mgr.GetIdForScript(conn.x8_objId);
|
|
|
|
if (TCastToPtr<CScriptActor> act = mgr.ObjectById(id))
|
|
|
|
{
|
|
|
|
if (act->GetX2E3_24())
|
|
|
|
{
|
|
|
|
x20c_lookAtId = id;
|
|
|
|
if (conn.x4_msg != EScriptObjectMessage::Deactivate &&
|
|
|
|
conn.x4_msg != EScriptObjectMessage::Reset)
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2017-08-29 13:17:52 +00:00
|
|
|
}
|
2017-11-23 02:15:09 +00:00
|
|
|
break;
|
|
|
|
case EScriptObjectMessage::Activate:
|
|
|
|
CalculateWaypoints(mgr);
|
|
|
|
if ((x21c_flags & 1) == 0 && x220_24_ && x1b8_.empty())
|
|
|
|
break;
|
|
|
|
x1ec_ = 0.f;
|
|
|
|
Think(0.f, mgr);
|
|
|
|
mgr.GetCameraManager()->AddCinemaCamera(GetUniqueId(), mgr);
|
|
|
|
x1f4_ = 0;
|
|
|
|
if (x1a8_.size() > 0)
|
|
|
|
SendArrivedMsg(x1a8_[x1f4_], mgr);
|
|
|
|
x1f8_ = 0;
|
|
|
|
if (x1c8_.size() > 0)
|
|
|
|
SendArrivedMsg(x1c8_[x1f8_], mgr);
|
|
|
|
if (x21c_flags & 0x100)
|
|
|
|
mgr.SetCinematicPause(true);
|
|
|
|
break;
|
|
|
|
case EScriptObjectMessage::Deactivate:
|
2017-08-29 13:17:52 +00:00
|
|
|
WasDeactivated(mgr);
|
2017-11-23 02:15:09 +00:00
|
|
|
break;
|
|
|
|
default:
|
|
|
|
break;
|
2017-08-29 13:17:52 +00:00
|
|
|
}
|
|
|
|
}
|
2017-02-18 02:19:50 +00:00
|
|
|
|
2017-08-29 13:17:52 +00:00
|
|
|
void CCinematicCamera::CalculateWaypoints(CStateManager& mgr)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
void CCinematicCamera::SendArrivedMsg(TUniqueId reciever, CStateManager& mgr)
|
|
|
|
{
|
|
|
|
mgr.SendScriptMsgAlways(reciever, GetUniqueId(), EScriptObjectMessage::Arrived);
|
2017-02-18 02:19:50 +00:00
|
|
|
}
|
2016-04-24 04:03:30 +00:00
|
|
|
}
|