metaforce/Runtime/World/CActor.cpp

580 lines
19 KiB
C++
Raw Normal View History

#include "CActor.hpp"
2016-04-22 20:22:45 +00:00
#include "CActorParameters.hpp"
#include "CStateManager.hpp"
#include "Collision/CMaterialList.hpp"
2016-04-29 10:08:46 +00:00
#include "Audio/CSfxManager.hpp"
2017-01-15 03:07:01 +00:00
#include "TCastTo.hpp"
2017-02-11 00:52:52 +00:00
#include "Character/IAnimReader.hpp"
#include "Character/CActorLights.hpp"
2017-06-03 06:03:07 +00:00
#include "Camera/CGameCamera.hpp"
2017-11-24 08:23:28 +00:00
#include "GameGlobalObjects.hpp"
#include "CSimplePool.hpp"
2016-03-04 23:04:53 +00:00
namespace urde
{
2016-04-22 20:22:45 +00:00
static CMaterialList MakeActorMaterialList(const CMaterialList& materialList, const CActorParameters& params)
{
CMaterialList ret = materialList;
if (params.GetVisorParameters().x0_28_b3)
ret.Add(EMaterialTypes::Unknown46);
2016-04-22 20:22:45 +00:00
if (params.GetVisorParameters().x0_29_b4)
ret.Add(EMaterialTypes::ScanPassthrough);
2016-04-22 20:22:45 +00:00
return ret;
}
2017-11-26 03:04:25 +00:00
CActor::CActor(TUniqueId uid, bool active, std::string_view name, const CEntityInfo& info, const zeus::CTransform& xf,
CModelData&& mData, const CMaterialList& list, const CActorParameters& params, TUniqueId otherUid)
: CEntity(uid, info, active, name)
2017-11-26 03:04:25 +00:00
, x34_transform(xf)
, x68_material(MakeActorMaterialList(list, params))
2017-01-07 01:58:05 +00:00
, x70_materialFilter(CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {0ull}))
, xc6_nextDrawNode(otherUid)
2016-04-22 20:22:45 +00:00
{
2017-11-24 08:23:28 +00:00
x90_actorLights = mData.IsNull() ? std::unique_ptr<CActorLights>() : params.x0_lightParms.MakeActorLights();
2016-05-03 08:27:28 +00:00
if (mData.x10_animData || mData.x1c_normalModel)
2016-04-22 20:22:45 +00:00
x64_modelData = std::make_unique<CModelData>(std::move(mData));
2017-11-24 08:23:28 +00:00
xd0_ = params.x64_;
2017-06-03 06:03:07 +00:00
xd8_nonLoopingSfxHandles.resize(2);
2017-11-26 03:04:25 +00:00
xe4_27_notInSortedLists = true;
2017-11-24 08:23:28 +00:00
xe4_28_ = true;
xe4_29_actorLightsDirty = true;
xe4_31_lightsDirty = true;
xe5_27_useInSortedLists = true;
xe5_28_callTouch = true;
xe5_29_ = params.x58_24_;
xe5_30_ = params.x58_26_;
xe6_27_renderVisorFlags = u8(params.x58_25_thermalHeat ? 2 : 1);
xe6_29_ = true;
xe6_31_targetableVisorFlags = params.GetVisorParameters().GetMask();
xe7_27_ = true;
xe7_29_actorActive = active;
xe7_30_doTargetDistanceTest = true;
xe7_31_targetable = true;
if (x64_modelData)
{
if (params.x44_xrayAssets.first.IsValid())
x64_modelData->SetXRayModel(params.x44_xrayAssets);
if (params.x4c_thermalAssets.first.IsValid())
x64_modelData->SetInfraModel(params.x4c_thermalAssets);
if (!params.x0_lightParms.x1c_makeLights || params.x0_lightParms.x3c_maxAreaLights == 0)
x64_modelData->x18_ambientColor = params.x0_lightParms.x18_noLightsAmbient;
x64_modelData->x14_25_sortThermal = !params.x58_27_noSortThermal;
}
if (params.x40_scanParms.GetScanId().IsValid())
x98_scanObjectInfo = g_SimplePool->GetObj(SObjectTag{FOURCC('SCAN'), params.x40_scanParms.GetScanId()});
2016-04-22 20:22:45 +00:00
}
2016-04-29 10:08:46 +00:00
void CActor::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStateManager& mgr)
{
switch (msg)
2016-04-29 10:08:46 +00:00
{
case EScriptObjectMessage::Activate:
{
if (!x30_24_active)
xbc_time = CGraphics::GetSecondsMod900();
}
break;
2016-04-29 10:08:46 +00:00
case EScriptObjectMessage::Decrement:
RemoveEmitter();
break;
2017-03-24 05:30:16 +00:00
case EScriptObjectMessage::Registered: // 33
2016-04-29 10:08:46 +00:00
{
2016-12-29 21:38:59 +00:00
if (x98_scanObjectInfo)
AddMaterial(EMaterialTypes::Scannable, mgr);
2016-04-29 10:08:46 +00:00
else
2016-12-29 21:38:59 +00:00
RemoveMaterial(EMaterialTypes::Scannable, mgr);
2016-04-29 10:08:46 +00:00
if (HasModelData() && x64_modelData->AnimationData())
{
TAreaId aid = GetAreaId();
2017-11-24 08:01:06 +00:00
x64_modelData->AnimationData()->InitializeEffects(mgr, aid, x64_modelData->GetScale());
2016-04-29 10:08:46 +00:00
}
}
break;
2017-02-14 04:27:20 +00:00
case EScriptObjectMessage::Deleted: // 34
2016-04-29 10:08:46 +00:00
{
RemoveEmitter();
2016-11-20 21:53:15 +00:00
if (HasModelData() && x64_modelData->AnimationData() && x64_modelData->GetNormalModel())
2017-11-24 08:01:06 +00:00
x64_modelData->AnimationData()->GetParticleDB().DeleteAllLights(mgr);
2016-04-29 10:08:46 +00:00
}
break;
2017-03-24 05:30:16 +00:00
case EScriptObjectMessage::InitializedInArea: // 35
2016-04-29 10:08:46 +00:00
{
for (const SConnection& conn : x20_conns)
{
2017-08-01 10:08:42 +00:00
if (conn.x0_state != EScriptObjectState::Default)
2016-04-29 10:08:46 +00:00
continue;
2017-01-15 03:07:01 +00:00
const CActor* act = TCastToConstPtr<CActor>(mgr.GetObjectById(mgr.GetIdForScript(conn.x8_objId)));
if (act && xc6_nextDrawNode == kInvalidUniqueId)
xc6_nextDrawNode = act->GetUniqueId();
2016-04-29 10:08:46 +00:00
}
}
break;
2017-06-12 04:23:34 +00:00
case EScriptObjectMessage::UpdateSplashInhabitant: // 37
2016-05-03 08:27:28 +00:00
SetInFluid(true, uid);
2016-04-29 10:08:46 +00:00
break;
2017-06-12 04:23:34 +00:00
case EScriptObjectMessage::RemoveSplashInhabitant: // 39
2016-05-03 08:27:28 +00:00
SetInFluid(false, kInvalidUniqueId);
2016-04-29 10:08:46 +00:00
break;
default:
break;
2016-04-29 10:08:46 +00:00
}
CEntity::AcceptScriptMsg(msg, uid, mgr);
}
void CActor::PreRender(CStateManager&, const zeus::CFrustum&)
{
}
void CActor::AddToRenderer(const zeus::CFrustum&, const CStateManager&) const
{
}
void CActor::Render(const CStateManager&) const
{
}
bool CActor::CanRenderUnsorted(const CStateManager&) const
{
return false;
}
2016-11-20 21:53:15 +00:00
void CActor::CalculateRenderBounds()
{
2016-11-20 21:53:15 +00:00
if (x64_modelData && (x64_modelData->AnimationData() || x64_modelData->GetNormalModel()))
2017-08-10 07:05:27 +00:00
x9c_renderBounds = x64_modelData->GetBounds(x34_transform);
2016-11-20 21:53:15 +00:00
else
2017-08-10 07:05:27 +00:00
x9c_renderBounds = zeus::CAABox(x34_transform.origin, x34_transform.origin);
}
2017-08-20 05:23:22 +00:00
CHealthInfo* CActor::HealthInfo(CStateManager&) { return nullptr; }
const CDamageVulnerability* CActor::GetDamageVulnerability() const { return nullptr; }
const CDamageVulnerability* CActor::GetDamageVulnerability(const zeus::CVector3f&, const zeus::CVector3f&,
const CDamageInfo&) const
{
return nullptr;
}
rstl::optional_object<zeus::CAABox> CActor::GetTouchBounds() const { return {}; }
void CActor::Touch(CActor&, CStateManager&) {}
zeus::CVector3f CActor::GetOrbitPosition(const CStateManager&) const { return x34_transform.origin; }
zeus::CVector3f CActor::GetAimPosition(const CStateManager&, float) const { return x34_transform.origin; }
2016-05-03 08:27:28 +00:00
zeus::CVector3f CActor::GetHomingPosition(const CStateManager& mgr, float f) const { return GetAimPosition(mgr, f); }
2017-05-30 03:45:31 +00:00
zeus::CVector3f CActor::GetScanObjectIndicatorPosition(const CStateManager&) const { return {}; }
2016-04-29 10:08:46 +00:00
void CActor::RemoveEmitter()
{
2017-06-03 06:03:07 +00:00
if (x8c_loopingSfxHandle)
2016-04-29 10:08:46 +00:00
{
2017-06-03 06:03:07 +00:00
CSfxManager::RemoveEmitter(x8c_loopingSfxHandle);
2016-04-29 10:08:46 +00:00
x88_sfxId = -1;
2017-06-03 06:03:07 +00:00
x8c_loopingSfxHandle.reset();
2016-04-29 10:08:46 +00:00
}
}
2017-07-14 05:14:19 +00:00
void CActor::SetVolume(float vol)
{
if (x8c_loopingSfxHandle)
CSfxManager::UpdateEmitter(x8c_loopingSfxHandle, GetTranslation(), zeus::CVector3f::skZero, vol);
}
2017-11-13 06:19:18 +00:00
const zeus::CTransform CActor::GetScaledLocatorTransform(std::string_view segName) const
2016-10-31 22:56:44 +00:00
{
return x64_modelData->GetScaledLocatorTransform(segName);
}
2017-11-13 06:19:18 +00:00
const zeus::CTransform CActor::GetLocatorTransform(std::string_view segName) const
2016-10-31 22:56:44 +00:00
{
return x64_modelData->GetLocatorTransform(segName);
}
EWeaponCollisionResponseTypes CActor::GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&,
2017-08-13 05:26:14 +00:00
const CWeaponMode&, s32) const
2016-05-03 08:27:28 +00:00
{
return EWeaponCollisionResponseTypes::Unknown13;
}
void CActor::FluidFXThink(CActor::EFluidState, CScriptWater&, CStateManager&) {}
void CActor::OnScanStateChanged(EScanState state, CStateManager& mgr)
{
2016-11-22 20:43:16 +00:00
if (state == EScanState::Start)
SendScriptMsgs(EScriptObjectState::ScanStart, mgr, EScriptObjectMessage::None);
else if (state == EScanState::Processing)
SendScriptMsgs(EScriptObjectState::ScanProcessing, mgr, EScriptObjectMessage::None);
else if (state == EScanState::Done)
SendScriptMsgs(EScriptObjectState::ScanDone, mgr, EScriptObjectMessage::None);
}
2017-08-10 07:05:27 +00:00
zeus::CAABox CActor::GetSortingBounds(const CStateManager&) const { return x9c_renderBounds; }
2017-06-03 06:03:07 +00:00
void CActor::DoUserAnimEvent(CStateManager&, CInt32POINode&, EUserEventType, float dt) {}
void CActor::RemoveMaterial(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, EMaterialTypes t4,
CStateManager& mgr)
2016-04-22 20:22:45 +00:00
{
x68_material.Remove(t1);
2016-04-22 20:22:45 +00:00
RemoveMaterial(t2, t3, t4, mgr);
}
void CActor::RemoveMaterial(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, CStateManager& mgr)
2016-04-22 20:22:45 +00:00
{
x68_material.Remove(t1);
2016-04-22 20:22:45 +00:00
RemoveMaterial(t2, t3, mgr);
}
void CActor::RemoveMaterial(EMaterialTypes t1, EMaterialTypes t2, CStateManager& mgr) { x68_material.Remove(t1); }
2016-04-22 20:22:45 +00:00
void CActor::RemoveMaterial(EMaterialTypes t, CStateManager& mgr)
{
x68_material.Remove(t);
2016-04-22 20:22:45 +00:00
mgr.UpdateObjectInLists(*this);
}
void CActor::AddMaterial(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, EMaterialTypes t4, EMaterialTypes t5,
CStateManager& mgr)
2016-04-22 20:22:45 +00:00
{
x68_material.Add(t1);
2016-04-22 20:22:45 +00:00
AddMaterial(t2, t3, t4, t5, mgr);
}
void CActor::AddMaterial(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, EMaterialTypes t4, CStateManager& mgr)
{
x68_material.Add(t1);
2016-04-22 20:22:45 +00:00
AddMaterial(t2, t3, t4, mgr);
}
void CActor::AddMaterial(EMaterialTypes t1, EMaterialTypes t2, EMaterialTypes t3, CStateManager& mgr)
{
x68_material.Add(t1);
2016-04-22 20:22:45 +00:00
AddMaterial(t2, t3, mgr);
}
void CActor::AddMaterial(EMaterialTypes t1, EMaterialTypes t2, CStateManager& mgr)
{
x68_material.Add(t1);
2016-04-22 20:22:45 +00:00
AddMaterial(t2, mgr);
}
void CActor::AddMaterial(EMaterialTypes type, CStateManager& mgr)
2016-04-19 00:17:49 +00:00
{
x68_material.Add(type);
2016-04-22 20:22:45 +00:00
mgr.UpdateObjectInLists(*this);
2016-04-19 00:17:49 +00:00
}
2017-03-26 04:12:06 +00:00
void CActor::AddMaterial(const CMaterialList& l)
{
x68_material.Add(l);
}
2017-02-03 23:32:15 +00:00
void CActor::CreateShadow(bool b)
{
if (b)
{
_CreateShadow();
if (!xe5_24_ && x94_simpleShadow)
xe5_25_ = true;
}
xe5_24_ = b;
}
void CActor::_CreateShadow()
{
if (!x94_simpleShadow && x64_modelData && (x64_modelData->HasAnimData() || x64_modelData->HasNormalModel()))
x94_simpleShadow.reset(new CSimpleShadow(1.f, 1.f, 20.f, 0.05f));
}
void CActor::SetCallTouch(bool callTouch) { xe5_28_callTouch = callTouch; }
2016-05-03 08:27:28 +00:00
bool CActor::GetCallTouch() const { return xe5_28_callTouch; }
2016-05-03 08:27:28 +00:00
2017-02-14 04:27:20 +00:00
void CActor::SetUseInSortedLists(bool use) { xe5_27_useInSortedLists = use; }
2016-05-03 08:27:28 +00:00
bool CActor::GetUseInSortedLists() const { return xe5_27_useInSortedLists; }
2016-05-03 08:27:28 +00:00
void CActor::SetInFluid(bool in, TUniqueId uid)
{
if (in)
{
2017-06-12 04:23:34 +00:00
xe6_24_fluidCounter += 1;
2016-05-03 08:27:28 +00:00
xc4_fluidId = uid;
}
else
{
2017-06-12 04:23:34 +00:00
if (!xe6_24_fluidCounter)
2016-05-03 08:27:28 +00:00
return;
2017-06-12 04:23:34 +00:00
xe6_24_fluidCounter -= 1;
if (xe6_24_fluidCounter == 0)
2016-05-03 08:27:28 +00:00
xc4_fluidId = kInvalidUniqueId;
}
}
bool CActor::HasModelData() const { return bool(x64_modelData); }
2016-05-03 08:27:28 +00:00
2017-06-03 06:03:07 +00:00
void CActor::SetSoundEventPitchBend(s32 val)
2016-05-03 08:27:28 +00:00
{
xe6_30_enablePitchBend = true;
2017-07-16 06:13:37 +00:00
xc0_pitchBend = val / 8192.f - 1.f;
2017-06-03 06:03:07 +00:00
if (!x8c_loopingSfxHandle)
2016-05-03 08:27:28 +00:00
return;
2017-07-16 06:13:37 +00:00
CSfxManager::PitchBend(x8c_loopingSfxHandle, xc0_pitchBend);
2016-04-29 10:08:46 +00:00
}
2017-01-21 06:03:37 +00:00
void CActor::SetRotation(const zeus::CQuaternion &q)
{
x34_transform = q.toTransform(x34_transform.origin);
2017-11-26 03:04:25 +00:00
xe4_27_notInSortedLists = true;
2017-01-21 06:03:37 +00:00
xe4_28_ = true;
2017-08-13 07:56:35 +00:00
xe4_29_actorLightsDirty = true;
2017-01-21 06:03:37 +00:00
}
void CActor::SetTranslation(const zeus::CVector3f& tr)
2016-09-01 04:10:08 +00:00
{
x34_transform.origin = tr;
2017-11-26 03:04:25 +00:00
xe4_27_notInSortedLists = true;
2016-09-01 04:10:08 +00:00
xe4_28_ = true;
2017-08-13 07:56:35 +00:00
xe4_29_actorLightsDirty = true;
2016-09-01 04:10:08 +00:00
}
2017-01-24 17:23:10 +00:00
void CActor::SetTransform(const zeus::CTransform& tr)
{
x34_transform = tr;
2017-11-26 03:04:25 +00:00
xe4_27_notInSortedLists = true;
2017-01-24 17:23:10 +00:00
xe4_28_ = true;
2017-08-13 07:56:35 +00:00
xe4_29_actorLightsDirty = true;
2017-01-24 17:23:10 +00:00
}
void CActor::SetAddedToken(u32 tok) { xcc_addedToken = tok; }
2016-11-20 21:53:15 +00:00
float CActor::GetPitch() const { return zeus::CQuaternion(x34_transform.buildMatrix3f()).pitch(); }
2016-10-31 22:56:44 +00:00
float CActor::GetYaw() const { return zeus::CQuaternion(x34_transform.buildMatrix3f()).yaw(); }
2017-02-11 00:52:52 +00:00
2017-08-18 01:30:15 +00:00
void CActor::EnsureRendered(const CStateManager& mgr)
{
zeus::CAABox aabb = GetSortingBounds(mgr);
EnsureRendered(mgr, aabb.closestPointAlongVector(CGraphics::g_ViewMatrix.origin), aabb);
}
2017-03-20 05:09:53 +00:00
void CActor::EnsureRendered(const CStateManager& stateMgr, const zeus::CVector3f& pos,
const zeus::CAABox& aabb) const
{
if (x64_modelData)
{
x64_modelData->RenderUnsortedParts(x64_modelData->GetRenderingModel(stateMgr),
x34_transform, x90_actorLights.get(), xb4_drawFlags);
}
stateMgr.AddDrawableActor(*this, pos, aabb);
}
2017-06-03 06:03:07 +00:00
void CActor::UpdateSfxEmitters()
{
for (CSfxHandle& sfx : xd8_nonLoopingSfxHandles)
CSfxManager::UpdateEmitter(sfx, x34_transform.origin, zeus::CVector3f::skZero, xd4_maxVol);
}
void CActor::ProcessSoundEvent(u32 sfxId, float weight, u32 flags, float falloff, float maxDist,
float minVol, float maxVol, const zeus::CVector3f& toListener,
const zeus::CVector3f& position, TAreaId aid, CStateManager& mgr,
bool translateId)
2017-02-11 00:52:52 +00:00
{
2017-06-03 06:03:07 +00:00
if (toListener.magSquared() >= maxDist * maxDist)
return;
u16 id = translateId ? CSfxManager::TranslateSFXID(sfxId) : sfxId;
u32 musyxFlags = 0x1; // Continuous parameter update
if (flags & 0x8)
musyxFlags |= 0x8; // Doppler FX
CAudioSys::C3DEmitterParmData parms;
parms.x0_pos = position;
parms.xc_dir = zeus::CVector3f::skZero;
parms.x18_maxDist = maxDist;
parms.x1c_distComp = falloff;
parms.x20_flags = musyxFlags;
parms.x24_sfxId = id;
parms.x26_maxVol = maxVol;
parms.x27_minVol = minVol;
parms.x28_important = false;
parms.x29_prio = 0x7f;
bool useAcoustics = (flags & 0x80) == 0;
bool looping = (sfxId & 0x80000000) != 0;
bool nonEmitter = (sfxId & 0x40000000) != 0;
bool continuousUpdate = (sfxId & 0x20000000) != 0;
if (mgr.GetActiveRandom()->Float() > weight)
return;
if (looping)
{
u16 curId = x88_sfxId;
if (!x8c_loopingSfxHandle)
{
CSfxHandle handle;
if (nonEmitter)
handle = CSfxManager::SfxStart(id, 1.f, 0.f, true, 0x7f, true, aid);
else
handle = CSfxManager::AddEmitter(parms, useAcoustics, 0x7f, true, aid);
if (handle)
{
x88_sfxId = id;
x8c_loopingSfxHandle = handle;
if (xe6_30_enablePitchBend)
CSfxManager::PitchBend(handle, xc0_pitchBend);
}
}
else if (curId == id)
{
CSfxManager::UpdateEmitter(x8c_loopingSfxHandle, position, zeus::CVector3f::skZero, maxVol);
}
else if (flags & 0x4)
{
CSfxManager::RemoveEmitter(x8c_loopingSfxHandle);
CSfxHandle handle = CSfxManager::AddEmitter(parms, useAcoustics, 0x7f, true, aid);
if (handle)
{
x88_sfxId = id;
x8c_loopingSfxHandle = handle;
if (xe6_30_enablePitchBend)
CSfxManager::PitchBend(handle, xc0_pitchBend);
}
}
}
else
{
CSfxHandle handle;
if (nonEmitter)
handle = CSfxManager::SfxStart(id, 1.f, 0.f, useAcoustics, 0x7f, false, aid);
else
handle = CSfxManager::AddEmitter(parms, useAcoustics, 0x7f, false, aid);
if (continuousUpdate)
{
xd8_nonLoopingSfxHandles[xe4_24_nextNonLoopingSfxHandle] = handle;
xe4_24_nextNonLoopingSfxHandle = (xe4_24_nextNonLoopingSfxHandle + 1) % xd8_nonLoopingSfxHandles.size();
}
if (xe6_30_enablePitchBend)
CSfxManager::PitchBend(handle, xc0_pitchBend);
}
}
SAdvancementDeltas CActor::UpdateAnimation(float dt, CStateManager& mgr, bool advTree)
{
SAdvancementDeltas deltas = x64_modelData->AdvanceAnimation(dt, mgr, GetAreaId(), advTree);
x64_modelData->AdvanceParticles(x34_transform, dt, mgr);
UpdateSfxEmitters();
if (x64_modelData && x64_modelData->HasAnimData())
{
zeus::CVector3f toCamera =
mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTranslation() - x34_transform.origin;
for (int i=0 ; i<x64_modelData->GetAnimationData()->GetPassedSoundPOICount() ; ++i)
{
CSoundPOINode& poi = CAnimData::g_SoundPOINodes[i];
if (poi.GetPoiType() != EPOIType::Sound)
continue;
if (xe5_26_muted)
continue;
if (poi.GetCharacterIndex() != -1 &&
x64_modelData->GetAnimationData()->GetCharacterIndex() != poi.GetCharacterIndex())
continue;
ProcessSoundEvent(poi.GetSfxId(), poi.GetWeight(), poi.GetFlags(), poi.GetFalloff(),
poi.GetMaxDist(), 0.16f, xd4_maxVol, toCamera, x34_transform.origin, x4_areaId,
mgr, true);
}
for (int i=0 ; i<x64_modelData->GetAnimationData()->GetPassedIntPOICount() ; ++i)
{
CInt32POINode& poi = CAnimData::g_Int32POINodes[i];
if (poi.GetPoiType() == EPOIType::SoundInt32)
{
if (xe5_26_muted)
continue;
if (poi.GetCharacterIndex() != -1 &&
x64_modelData->GetAnimationData()->GetCharacterIndex() != poi.GetCharacterIndex())
continue;
ProcessSoundEvent(poi.GetValue(), poi.GetWeight(), poi.GetFlags(), 0.1f,
150.f, 0.16f, xd4_maxVol, toCamera, x34_transform.origin, x4_areaId,
mgr, true);
}
else if (poi.GetPoiType() == EPOIType::UserEvent)
{
DoUserAnimEvent(mgr, poi, EUserEventType(poi.GetValue()), dt);
}
}
for (int i=0 ; i<x64_modelData->GetAnimationData()->GetPassedParticlePOICount() ; ++i)
{
CParticlePOINode& poi = CAnimData::g_ParticlePOINodes[i];
if (poi.GetCharacterIndex() != -1 &&
x64_modelData->GetAnimationData()->GetCharacterIndex() != poi.GetCharacterIndex())
continue;
x64_modelData->AnimationData()->GetParticleDB().SetParticleEffectState(poi.GetString(), true, mgr);
}
}
return deltas;
2017-02-11 00:52:52 +00:00
}
2017-09-30 03:45:57 +00:00
void CActor::SetActorLights(std::unique_ptr<CActorLights>&& lights)
{
x90_actorLights = std::move(lights);
xe4_31_lightsDirty = true;
}
2017-03-05 07:57:12 +00:00
bool CActor::CanDrawStatic() const
{
if (!x30_24_active)
return false;
if (x64_modelData && x64_modelData->HasNormalModel())
2017-03-20 05:09:53 +00:00
return xb4_drawFlags.x0_blendMode <= 4;
2017-03-05 07:57:12 +00:00
return false;
}
2017-04-02 03:03:37 +00:00
const CScannableObjectInfo* CActor::GetScannableObjectInfo() const
{
2017-11-24 08:23:28 +00:00
if (!x98_scanObjectInfo || !x98_scanObjectInfo.IsLoaded())
2017-04-02 03:03:37 +00:00
return nullptr;
2017-11-24 08:23:28 +00:00
return x98_scanObjectInfo.GetObj();
2017-04-02 03:03:37 +00:00
}
void CActor::SetCalculateLighting(bool c)
{
if (!x90_actorLights)
x90_actorLights = std::make_unique<CActorLights>(8, zeus::CVector3f::skZero,
4, 4, false, false, false, 0.1f);
xe4_31_lightsDirty = c;
}
2017-07-10 04:55:51 +00:00
float CActor::GetAverageAnimVelocity(int anim) const
{
if (HasModelData() && GetModelData()->HasAnimData())
return GetModelData()->GetAnimationData()->GetAverageVelocity(anim);
return 0.f;
}
2017-08-18 01:30:15 +00:00
void CActor::SetModelData(std::unique_ptr<CModelData>&& mData)
{
if (mData->IsNull())
x64_modelData.reset();
else
x64_modelData = std::move(mData);
}
}