2016-04-13 06:07:23 +00:00
|
|
|
#ifndef __URDE_CACTOR_HPP__
|
|
|
|
#define __URDE_CACTOR_HPP__
|
2015-08-22 01:58:41 +00:00
|
|
|
|
|
|
|
#include "CEntity.hpp"
|
2016-05-21 03:02:09 +00:00
|
|
|
#include "Graphics/CGraphics.hpp"
|
2016-08-31 00:33:59 +00:00
|
|
|
#include "Graphics/CSimpleShadow.hpp"
|
2016-03-04 23:04:53 +00:00
|
|
|
#include "zeus/zeus.hpp"
|
2016-04-25 05:46:28 +00:00
|
|
|
#include "Collision/CMaterialFilter.hpp"
|
2016-04-22 20:22:45 +00:00
|
|
|
#include "Character/CModelData.hpp"
|
2016-08-31 00:33:59 +00:00
|
|
|
#include "Character/CActorLights.hpp"
|
2016-07-28 07:33:55 +00:00
|
|
|
#include "Collision/CCollisionResponseData.hpp"
|
2016-12-29 05:53:00 +00:00
|
|
|
#include "Audio/CSfxManager.hpp"
|
2017-04-02 03:28:30 +00:00
|
|
|
#include "CScannableObjectInfo.hpp"
|
2018-02-12 05:30:21 +00:00
|
|
|
#include "Weapon/WeaponCommon.hpp"
|
2015-08-22 01:58:41 +00:00
|
|
|
|
2016-03-04 23:04:53 +00:00
|
|
|
namespace urde
|
2015-08-22 01:58:41 +00:00
|
|
|
{
|
2015-11-02 18:45:39 +00:00
|
|
|
|
2015-08-22 01:58:41 +00:00
|
|
|
class CActorParameters;
|
2015-11-02 18:45:39 +00:00
|
|
|
class CWeaponMode;
|
2016-04-19 00:17:49 +00:00
|
|
|
class CHealthInfo;
|
2016-08-31 00:33:59 +00:00
|
|
|
class CDamageInfo;
|
2016-04-19 00:17:49 +00:00
|
|
|
class CDamageVulnerability;
|
|
|
|
class CLightParameters;
|
2016-08-31 00:33:59 +00:00
|
|
|
class CScriptWater;
|
2016-05-03 08:27:28 +00:00
|
|
|
class CSimpleShadow;
|
|
|
|
|
2015-08-22 01:58:41 +00:00
|
|
|
class CActor : public CEntity
|
|
|
|
{
|
2017-03-04 04:31:08 +00:00
|
|
|
friend class CStateManager;
|
2015-11-02 18:45:39 +00:00
|
|
|
protected:
|
2016-03-04 23:04:53 +00:00
|
|
|
zeus::CTransform x34_transform;
|
2016-04-22 20:22:45 +00:00
|
|
|
std::unique_ptr<CModelData> x64_modelData;
|
2017-01-04 04:08:30 +00:00
|
|
|
CMaterialList x68_material;
|
|
|
|
CMaterialFilter x70_materialFilter;
|
2016-05-03 08:27:28 +00:00
|
|
|
s16 x88_sfxId = -1;
|
2017-06-03 06:03:07 +00:00
|
|
|
CSfxHandle x8c_loopingSfxHandle;
|
2016-08-31 00:33:59 +00:00
|
|
|
std::unique_ptr<CActorLights> x90_actorLights;
|
|
|
|
std::unique_ptr<CSimpleShadow> x94_simpleShadow;
|
2017-11-24 08:23:28 +00:00
|
|
|
TLockedToken<CScannableObjectInfo> x98_scanObjectInfo;
|
2017-08-10 07:05:27 +00:00
|
|
|
zeus::CAABox x9c_renderBounds;
|
2017-03-20 05:09:53 +00:00
|
|
|
CModelFlags xb4_drawFlags;
|
2016-05-03 08:27:28 +00:00
|
|
|
float xbc_time = 0.f;
|
2017-06-03 06:03:07 +00:00
|
|
|
float xc0_pitchBend = 0.f;
|
2016-05-03 08:27:28 +00:00
|
|
|
TUniqueId xc4_fluidId = kInvalidUniqueId;
|
2017-11-24 08:23:28 +00:00
|
|
|
TUniqueId xc6_nextDrawNode;
|
|
|
|
int xc8_drawnToken = -1;
|
|
|
|
int xcc_addedToken = -1;
|
2018-02-05 06:56:09 +00:00
|
|
|
float xd0_thermalMag;
|
2017-06-03 06:03:07 +00:00
|
|
|
float xd4_maxVol = 1.f;
|
|
|
|
rstl::reserved_vector<CSfxHandle, 2> xd8_nonLoopingSfxHandles;
|
2017-01-24 17:23:10 +00:00
|
|
|
union
|
|
|
|
{
|
2016-04-22 20:22:45 +00:00
|
|
|
struct
|
|
|
|
{
|
2017-06-03 06:03:07 +00:00
|
|
|
u8 xe4_24_nextNonLoopingSfxHandle : 3;
|
2017-11-26 03:04:25 +00:00
|
|
|
bool xe4_27_notInSortedLists : 1;
|
2018-04-26 21:12:20 +00:00
|
|
|
bool xe4_28_transformDirty : 1;
|
2017-08-13 07:56:35 +00:00
|
|
|
bool xe4_29_actorLightsDirty : 1;
|
|
|
|
bool xe4_30_outOfFrustum : 1;
|
2018-05-11 07:02:42 +00:00
|
|
|
bool xe4_31_calculateLighting : 1;
|
2018-02-05 06:56:09 +00:00
|
|
|
bool xe5_24_shadowEnabled : 1;
|
|
|
|
bool xe5_25_shadowDirty : 1;
|
2016-04-22 20:22:45 +00:00
|
|
|
bool xe5_26_muted : 1;
|
|
|
|
bool xe5_27_useInSortedLists : 1;
|
|
|
|
bool xe5_28_callTouch : 1;
|
2018-02-05 06:56:09 +00:00
|
|
|
bool xe5_29_globalTimeProvider : 1;
|
2018-02-13 06:46:59 +00:00
|
|
|
bool xe5_30_renderUnsorted : 1;
|
2018-02-05 06:56:09 +00:00
|
|
|
bool xe5_31_pointGeneratorParticles : 1;
|
2017-06-12 04:23:34 +00:00
|
|
|
u8 xe6_24_fluidCounter : 3;
|
2018-02-08 06:18:27 +00:00
|
|
|
u8 xe6_27_thermalVisorFlags : 2; // 1: thermal cold, 2: thermal hot
|
2018-02-13 06:46:59 +00:00
|
|
|
bool xe6_29_renderParticleDBInside : 1;
|
2016-05-03 08:27:28 +00:00
|
|
|
bool xe6_30_enablePitchBend : 1;
|
2017-07-30 01:06:06 +00:00
|
|
|
u8 xe6_31_targetableVisorFlags : 4;
|
2018-02-05 06:56:09 +00:00
|
|
|
bool xe7_27_enableRender : 1;
|
2017-09-07 03:55:31 +00:00
|
|
|
bool xe7_28_worldLightingDirty : 1;
|
2018-05-18 04:16:33 +00:00
|
|
|
bool xe7_29_drawEnabled : 1;
|
2017-05-30 03:45:31 +00:00
|
|
|
bool xe7_30_doTargetDistanceTest : 1;
|
2017-07-30 01:06:06 +00:00
|
|
|
bool xe7_31_targetable : 1;
|
2016-04-22 20:22:45 +00:00
|
|
|
};
|
2016-08-10 00:46:53 +00:00
|
|
|
u32 dummy = 0;
|
2016-04-22 20:22:45 +00:00
|
|
|
};
|
2017-02-03 23:32:15 +00:00
|
|
|
void _CreateShadow();
|
2017-06-03 06:03:07 +00:00
|
|
|
void UpdateSfxEmitters();
|
2018-02-05 06:56:09 +00:00
|
|
|
void DrawTouchBounds() const;
|
|
|
|
void RenderInternal(const CStateManager& mgr) const;
|
2018-02-13 06:46:59 +00:00
|
|
|
bool IsModelOpaque(const CStateManager& mgr) const;
|
2016-12-19 18:27:58 +00:00
|
|
|
|
2015-08-22 01:58:41 +00:00
|
|
|
public:
|
2016-07-22 22:22:36 +00:00
|
|
|
enum class EFluidState
|
|
|
|
{
|
2017-08-14 03:55:06 +00:00
|
|
|
EnteredFluid,
|
|
|
|
InFluid,
|
|
|
|
LeftFluid
|
2016-07-22 22:22:36 +00:00
|
|
|
};
|
|
|
|
|
2016-08-10 00:46:53 +00:00
|
|
|
enum class EScanState
|
|
|
|
{
|
2016-11-22 20:43:16 +00:00
|
|
|
Start,
|
|
|
|
Processing,
|
|
|
|
Done,
|
2016-08-10 00:46:53 +00:00
|
|
|
};
|
|
|
|
|
2017-11-24 08:23:28 +00:00
|
|
|
CActor(TUniqueId uid, bool active, std::string_view name, const CEntityInfo& info, const zeus::CTransform&,
|
|
|
|
CModelData&& mData, const CMaterialList& list, const CActorParameters& params, TUniqueId otherUid);
|
2015-10-29 07:52:15 +00:00
|
|
|
|
2016-04-29 10:08:46 +00:00
|
|
|
virtual void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
|
2016-04-22 20:22:45 +00:00
|
|
|
virtual void SetActive(bool active)
|
|
|
|
{
|
2017-11-26 03:04:25 +00:00
|
|
|
xe4_27_notInSortedLists = true;
|
2018-04-26 21:12:20 +00:00
|
|
|
xe4_28_transformDirty = true;
|
2017-08-13 07:56:35 +00:00
|
|
|
xe4_29_actorLightsDirty = true;
|
2018-05-18 04:16:33 +00:00
|
|
|
xe7_29_drawEnabled = active;
|
2016-04-22 20:22:45 +00:00
|
|
|
CEntity::SetActive(active);
|
|
|
|
}
|
2017-12-20 06:06:54 +00:00
|
|
|
virtual void PreRender(CStateManager&, const zeus::CFrustum&);
|
|
|
|
virtual void AddToRenderer(const zeus::CFrustum&, const CStateManager&) const;
|
|
|
|
virtual void Render(const CStateManager&) const;
|
|
|
|
virtual bool CanRenderUnsorted(const CStateManager&) const;
|
2016-11-20 21:53:15 +00:00
|
|
|
virtual void CalculateRenderBounds();
|
2017-08-20 05:23:22 +00:00
|
|
|
virtual CHealthInfo* HealthInfo(CStateManager&);
|
2016-08-31 00:33:59 +00:00
|
|
|
virtual const CDamageVulnerability* GetDamageVulnerability() const;
|
2016-12-19 18:27:58 +00:00
|
|
|
virtual const CDamageVulnerability* GetDamageVulnerability(const zeus::CVector3f&, const zeus::CVector3f&,
|
|
|
|
const CDamageInfo&) const;
|
2018-04-30 03:12:41 +00:00
|
|
|
virtual std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
|
2016-08-31 00:33:59 +00:00
|
|
|
virtual void Touch(CActor&, CStateManager&);
|
|
|
|
virtual zeus::CVector3f GetOrbitPosition(const CStateManager&) const;
|
|
|
|
virtual zeus::CVector3f GetAimPosition(const CStateManager&, float) const;
|
|
|
|
virtual zeus::CVector3f GetHomingPosition(const CStateManager&, float) const;
|
2017-05-30 03:45:31 +00:00
|
|
|
virtual zeus::CVector3f GetScanObjectIndicatorPosition(const CStateManager&) const;
|
2016-08-31 00:33:59 +00:00
|
|
|
virtual EWeaponCollisionResponseTypes GetCollisionResponseType(const zeus::CVector3f&, const zeus::CVector3f&,
|
2018-02-12 05:30:21 +00:00
|
|
|
const CWeaponMode&, EProjectileAttrib) const;
|
2016-08-31 00:33:59 +00:00
|
|
|
virtual void FluidFXThink(EFluidState, CScriptWater&, CStateManager&);
|
|
|
|
virtual void OnScanStateChanged(EScanState, CStateManager&);
|
2016-11-20 21:53:15 +00:00
|
|
|
virtual zeus::CAABox GetSortingBounds(const CStateManager&) const;
|
2017-06-03 06:03:07 +00:00
|
|
|
virtual void DoUserAnimEvent(CStateManager&, CInt32POINode&, EUserEventType, float dt);
|
2016-04-22 20:22:45 +00:00
|
|
|
|
2016-04-29 10:08:46 +00:00
|
|
|
void RemoveEmitter();
|
2017-07-14 05:14:19 +00:00
|
|
|
void SetVolume(float vol);
|
2016-12-19 18:27:58 +00:00
|
|
|
const zeus::CTransform& GetTransform() const { return x34_transform; }
|
2017-01-24 17:23:10 +00:00
|
|
|
const zeus::CVector3f& GetTranslation() const { return x34_transform.origin; }
|
2017-11-13 06:19:18 +00:00
|
|
|
const zeus::CTransform GetScaledLocatorTransform(std::string_view segName) const;
|
|
|
|
const zeus::CTransform GetLocatorTransform(std::string_view segName) const;
|
2016-04-22 20:22:45 +00:00
|
|
|
void RemoveMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&);
|
|
|
|
void RemoveMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&);
|
|
|
|
void RemoveMaterial(EMaterialTypes, EMaterialTypes, CStateManager&);
|
|
|
|
void RemoveMaterial(EMaterialTypes, CStateManager&);
|
|
|
|
void AddMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&);
|
|
|
|
void AddMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&);
|
|
|
|
void AddMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&);
|
|
|
|
void AddMaterial(EMaterialTypes, EMaterialTypes, CStateManager&);
|
|
|
|
void AddMaterial(EMaterialTypes, CStateManager&);
|
2017-03-26 04:12:06 +00:00
|
|
|
void AddMaterial(const CMaterialList& l);
|
2015-11-02 18:45:39 +00:00
|
|
|
|
2017-02-03 23:32:15 +00:00
|
|
|
void CreateShadow(bool);
|
2016-05-03 08:27:28 +00:00
|
|
|
void SetCallTouch(bool callTouch);
|
|
|
|
bool GetCallTouch() const;
|
2017-02-14 04:27:20 +00:00
|
|
|
void SetUseInSortedLists(bool use);
|
2016-05-03 08:27:28 +00:00
|
|
|
bool GetUseInSortedLists() const;
|
2017-01-04 04:08:30 +00:00
|
|
|
const CMaterialFilter& GetMaterialFilter() const { return x70_materialFilter; }
|
|
|
|
void SetMaterialFilter(const CMaterialFilter& filter) { x70_materialFilter = filter; }
|
|
|
|
const CMaterialList& GetMaterialList() const { return x68_material; }
|
2017-10-09 02:41:50 +00:00
|
|
|
void SetMaterialList(const CMaterialList& list) { x68_material = list; }
|
2016-05-03 08:27:28 +00:00
|
|
|
void SetInFluid(bool in, TUniqueId uid);
|
2016-04-29 10:08:46 +00:00
|
|
|
bool HasModelData() const;
|
2017-06-03 06:03:07 +00:00
|
|
|
const CSfxHandle& GetSfxHandle() const { return x8c_loopingSfxHandle; }
|
|
|
|
void SetSoundEventPitchBend(s32);
|
2017-01-21 06:03:37 +00:00
|
|
|
void SetRotation(const zeus::CQuaternion& q);
|
2016-09-01 04:10:08 +00:00
|
|
|
void SetTranslation(const zeus::CVector3f& tr);
|
2017-01-24 17:23:10 +00:00
|
|
|
void SetTransform(const zeus::CTransform& tr);
|
2016-11-20 21:53:15 +00:00
|
|
|
void SetAddedToken(u32 tok);
|
2016-10-31 22:56:44 +00:00
|
|
|
float GetPitch() const;
|
|
|
|
float GetYaw() const;
|
2017-01-04 04:08:30 +00:00
|
|
|
const CModelData* GetModelData() const { return x64_modelData.get(); }
|
2017-01-24 17:23:10 +00:00
|
|
|
CModelData* ModelData() { return x64_modelData.get(); }
|
2018-02-05 06:56:09 +00:00
|
|
|
void EnsureRendered(const CStateManager&) const;
|
2017-03-20 05:09:53 +00:00
|
|
|
void EnsureRendered(const CStateManager&, const zeus::CVector3f&, const zeus::CAABox&) const;
|
2017-06-03 06:03:07 +00:00
|
|
|
void 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
|
|
|
SAdvancementDeltas UpdateAnimation(float, CStateManager&, bool);
|
2017-09-30 03:45:57 +00:00
|
|
|
void SetActorLights(std::unique_ptr<CActorLights>&& lights);
|
2017-08-08 06:03:57 +00:00
|
|
|
const CActorLights* GetActorLights() const { return x90_actorLights.get(); }
|
2017-09-30 03:45:57 +00:00
|
|
|
CActorLights* ActorLights() { return x90_actorLights.get(); }
|
2017-03-05 07:57:12 +00:00
|
|
|
bool CanDrawStatic() const;
|
2018-05-19 05:16:08 +00:00
|
|
|
bool IsDrawEnabled() const { return xe7_29_drawEnabled; }
|
2017-09-07 03:55:31 +00:00
|
|
|
void SetWorldLightingDirty(bool b) { xe7_28_worldLightingDirty = b; }
|
2017-04-02 03:03:37 +00:00
|
|
|
const CScannableObjectInfo* GetScannableObjectInfo() const;
|
2017-08-20 05:23:22 +00:00
|
|
|
const CHealthInfo* GetHealthInfo(const CStateManager& mgr) const
|
|
|
|
{ return const_cast<CActor*>(this)->HealthInfo(const_cast<CStateManager&>(mgr)); }
|
2017-05-30 03:45:31 +00:00
|
|
|
bool GetDoTargetDistanceTest() const { return xe7_30_doTargetDistanceTest; }
|
2017-06-18 01:58:13 +00:00
|
|
|
void SetCalculateLighting(bool c);
|
2017-07-10 04:55:51 +00:00
|
|
|
float GetAverageAnimVelocity(int anim) const;
|
2017-07-30 01:06:06 +00:00
|
|
|
u8 GetTargetableVisorFlags() const { return xe6_31_targetableVisorFlags; }
|
|
|
|
bool GetIsTargetable() const { return xe7_31_targetable; }
|
2017-08-14 03:55:06 +00:00
|
|
|
void SetDrawFlags(const CModelFlags& flags) { xb4_drawFlags = flags; }
|
2017-08-18 01:30:15 +00:00
|
|
|
void SetModelData(std::unique_ptr<CModelData>&& mData);
|
2017-09-12 05:51:17 +00:00
|
|
|
u8 GetFluidCounter() const { return xe6_24_fluidCounter; }
|
2017-10-10 03:50:48 +00:00
|
|
|
TUniqueId GetFluidId() const { return xc4_fluidId; }
|
2018-05-14 04:38:58 +00:00
|
|
|
bool GetPointGeneratorParticles() const { return xe5_31_pointGeneratorParticles; }
|
|
|
|
void SetPointGeneratorParticles(bool s) { xe5_31_pointGeneratorParticles = s; }
|
2015-08-22 01:58:41 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
2016-04-13 06:07:23 +00:00
|
|
|
#endif // __URDE_CACTOR_HPP__
|