2017-03-01 03:42:06 +00:00
|
|
|
#include "CCollisionActorManager.hpp"
|
2017-03-26 04:12:06 +00:00
|
|
|
#include "TCastTo.hpp"
|
|
|
|
#include "World/CActor.hpp"
|
|
|
|
#include "CStateManager.hpp"
|
|
|
|
#include "CMaterialList.hpp"
|
2017-03-01 03:42:06 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
|
2018-11-10 02:47:07 +00:00
|
|
|
CCollisionActorManager::CCollisionActorManager(CStateManager& mgr, TUniqueId owner, TAreaId area,
|
|
|
|
const std::vector<CJointCollisionDescription>& descs, bool b1)
|
2017-05-07 06:55:01 +00:00
|
|
|
: x0_jointDescriptions(descs)
|
2018-11-10 02:47:07 +00:00
|
|
|
, x10_ownerId(owner)
|
|
|
|
, x12_(b1)
|
2017-03-01 03:42:06 +00:00
|
|
|
{
|
|
|
|
}
|
2017-03-13 01:07:03 +00:00
|
|
|
|
2017-05-07 06:55:01 +00:00
|
|
|
void CCollisionActorManager::Destroy(CStateManager& mgr) const
|
|
|
|
{
|
|
|
|
for (const CJointCollisionDescription& desc : x0_jointDescriptions)
|
2017-06-04 01:01:09 +00:00
|
|
|
mgr.FreeScriptObject(desc.GetCollisionActorId());
|
2017-05-07 06:55:01 +00:00
|
|
|
|
|
|
|
const_cast<CCollisionActorManager&>(*this).x13_ = true;
|
|
|
|
}
|
|
|
|
|
2018-11-10 02:47:07 +00:00
|
|
|
void CCollisionActorManager::SetActive(CStateManager& mgr, bool active)
|
2017-03-26 04:12:06 +00:00
|
|
|
{
|
2018-11-10 02:47:07 +00:00
|
|
|
for (const CJointCollisionDescription& jDesc : x0_jointDescriptions)
|
|
|
|
{
|
|
|
|
TCastToPtr<CActor> act(mgr.ObjectById(jDesc.GetCollisionActorId()));
|
2017-03-26 04:12:06 +00:00
|
|
|
|
2018-11-10 02:47:07 +00:00
|
|
|
if (act)
|
|
|
|
{
|
|
|
|
bool curActive = act->GetActive();
|
|
|
|
if (curActive != active)
|
|
|
|
act->SetActive(active);
|
|
|
|
|
|
|
|
if (!curActive)
|
|
|
|
Update(0.f, mgr, EUpdateOptions::One);
|
|
|
|
}
|
|
|
|
}
|
2017-03-26 04:12:06 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void CCollisionActorManager::AddMaterial(CStateManager& mgr, const CMaterialList& list)
|
|
|
|
{
|
|
|
|
for (const CJointCollisionDescription& jDesc : x0_jointDescriptions)
|
|
|
|
{
|
|
|
|
TCastToPtr<CActor> act(mgr.ObjectById(jDesc.GetCollisionActorId()));
|
|
|
|
|
|
|
|
if (act)
|
|
|
|
act->AddMaterial(list);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-03-13 01:07:03 +00:00
|
|
|
u32 CCollisionActorManager::GetNumCollisionActors() const
|
|
|
|
{
|
|
|
|
return x0_jointDescriptions.size();
|
|
|
|
}
|
|
|
|
|
|
|
|
CJointCollisionDescription CCollisionActorManager::GetCollisionDescFromIndex(u32 idx) const
|
|
|
|
{
|
|
|
|
return x0_jointDescriptions[idx];
|
|
|
|
}
|
|
|
|
|
2018-10-28 00:20:30 +00:00
|
|
|
void CCollisionActorManager::Update(float, CStateManager&, CCollisionActorManager::EUpdateOptions) const
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2017-03-01 03:42:06 +00:00
|
|
|
}
|