2016-10-01 19:00:16 +00:00
|
|
|
#include "CScriptAiJumpPoint.hpp"
|
|
|
|
#include "CActorParameters.hpp"
|
|
|
|
#include "CStateManager.hpp"
|
|
|
|
#include "CScriptWaypoint.hpp"
|
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
CScriptAiJumpPoint::CScriptAiJumpPoint(TUniqueId uid, const std::string& name, const CEntityInfo& info,
|
|
|
|
zeus::CTransform& xf, bool active, float f1)
|
2016-12-29 21:38:59 +00:00
|
|
|
: CActor(uid, active, name, info, xf, CModelData::CModelDataNull(), CMaterialList(EMaterialTypes::Unknown),
|
2016-12-19 18:27:58 +00:00
|
|
|
CActorParameters::None(), kInvalidUniqueId)
|
|
|
|
, xe8_(f1)
|
2016-10-01 19:00:16 +00:00
|
|
|
{
|
|
|
|
xec_.emplace(xf.origin, xf.origin);
|
|
|
|
}
|
|
|
|
|
|
|
|
void CScriptAiJumpPoint::Think(float dt, CStateManager&)
|
|
|
|
{
|
|
|
|
if (x110_timeRemaining <= 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
x110_timeRemaining -= dt;
|
|
|
|
}
|
|
|
|
|
|
|
|
void CScriptAiJumpPoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId other, CStateManager& mgr)
|
|
|
|
{
|
|
|
|
AcceptScriptMsg(msg, other, mgr);
|
|
|
|
|
|
|
|
if (msg != EScriptObjectMessage::InternalMessage13)
|
|
|
|
return;
|
|
|
|
|
|
|
|
for (SConnection& conn : x20_conns)
|
|
|
|
{
|
|
|
|
if (conn.x0_state != EScriptObjectState::Arrived || conn.x4_msg != EScriptObjectMessage::Next)
|
|
|
|
continue;
|
|
|
|
|
2016-12-19 18:27:58 +00:00
|
|
|
const CScriptWaypoint* wpnt =
|
|
|
|
static_cast<const CScriptWaypoint*>(mgr.GetObjectById(mgr.GetIdForScript(conn.x8_objId)));
|
2016-10-01 19:00:16 +00:00
|
|
|
if (wpnt)
|
|
|
|
{
|
|
|
|
x10c_currentWaypoint = wpnt->GetUniqueId();
|
|
|
|
const CScriptWaypoint* nextWpnt = wpnt->NextWaypoint(mgr);
|
|
|
|
if (nextWpnt)
|
|
|
|
x10e_nextWaypoint = nextWpnt->GetUniqueId();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2016-12-19 18:27:58 +00:00
|
|
|
rstl::optional_object<zeus::CAABox> CScriptAiJumpPoint::GetTouchBounds() const { return xec_; }
|
2016-10-01 19:00:16 +00:00
|
|
|
|
|
|
|
bool CScriptAiJumpPoint::GetInUse(TUniqueId uid) const
|
|
|
|
{
|
2016-12-19 18:27:58 +00:00
|
|
|
if (x108_24 || x110_timeRemaining > 0.f || x10a_occupant != kInvalidUniqueId || uid != kInvalidUniqueId ||
|
|
|
|
uid != x10a_occupant)
|
2016-10-01 19:00:16 +00:00
|
|
|
return true;
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|