2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2016-04-20 21:44:18 +00:00
|
|
|
|
|
|
|
#include "CPhysicsActor.hpp"
|
|
|
|
#include "optional.hpp"
|
|
|
|
#include "CToken.hpp"
|
2017-06-11 05:49:27 +00:00
|
|
|
#include "CHealthInfo.hpp"
|
|
|
|
#include "CDamageVulnerability.hpp"
|
2016-04-20 21:44:18 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
class CCollidableOBBTreeGroup;
|
2017-06-11 05:49:27 +00:00
|
|
|
class CCollidableOBBTreeGroupContainer;
|
2018-06-08 21:00:18 +00:00
|
|
|
class CFluidPlane;
|
2017-06-11 05:49:27 +00:00
|
|
|
|
|
|
|
struct SRiders
|
|
|
|
{
|
|
|
|
TUniqueId x0_uid;
|
2018-06-29 20:21:36 +00:00
|
|
|
float x4_decayTimer;
|
2017-06-11 05:49:27 +00:00
|
|
|
zeus::CTransform x8_transform;
|
2018-06-29 20:21:36 +00:00
|
|
|
|
|
|
|
SRiders(TUniqueId id, float decayTimer, const zeus::CTransform& xf)
|
|
|
|
: x0_uid(id), x4_decayTimer(decayTimer), x8_transform(xf) {}
|
2017-06-11 05:49:27 +00:00
|
|
|
};
|
2016-04-20 21:44:18 +00:00
|
|
|
|
|
|
|
class CScriptPlatform : public CPhysicsActor
|
|
|
|
{
|
2017-06-11 05:49:27 +00:00
|
|
|
u32 x254_;
|
2018-06-08 21:00:18 +00:00
|
|
|
TUniqueId x258_currentWaypoint = kInvalidUniqueId;
|
|
|
|
TUniqueId x25a_targetWaypoint = kInvalidUniqueId;
|
2018-06-29 20:21:36 +00:00
|
|
|
float x25c_currentSpeed;
|
|
|
|
float x260_moveDelay = 0.f;
|
|
|
|
float x264_collisionRecoverDelay = 0.f;
|
2018-06-08 21:00:18 +00:00
|
|
|
float x268_fadeInTime = 0.f;
|
|
|
|
float x26c_fadeOutTime = 0.f;
|
2018-06-29 20:21:36 +00:00
|
|
|
zeus::CVector3f x270_dragDelta;
|
|
|
|
zeus::CQuaternion x27c_rotDelta;
|
2018-06-08 21:00:18 +00:00
|
|
|
CHealthInfo x28c_initialHealth;
|
|
|
|
CHealthInfo x294_health;
|
|
|
|
CDamageVulnerability x29c_damageVuln;
|
2018-04-30 03:12:41 +00:00
|
|
|
std::experimental::optional<TLockedToken<CCollidableOBBTreeGroupContainer>> x304_treeGroupContainer;
|
2017-06-11 05:49:27 +00:00
|
|
|
std::unique_ptr<CCollidableOBBTreeGroup> x314_treeGroup;
|
|
|
|
std::vector<SRiders> x318_riders;
|
2018-06-29 20:21:36 +00:00
|
|
|
std::vector<SRiders> x328_slavesStatic;
|
|
|
|
std::vector<SRiders> x338_slavesDynamic;
|
|
|
|
float x348_xrayAlpha;
|
|
|
|
u32 x34c_maxRainSplashes;
|
|
|
|
u32 x350_rainGenRate;
|
|
|
|
TUniqueId x354_boundsTrigger = kInvalidUniqueId;
|
2017-06-11 05:49:27 +00:00
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
2018-06-08 21:00:18 +00:00
|
|
|
bool x356_24_dead : 1;
|
2018-06-29 20:21:36 +00:00
|
|
|
bool x356_25_notAnimating : 1;
|
|
|
|
bool x356_26_detectCollision : 1;
|
|
|
|
bool x356_27_squishedRider : 1;
|
|
|
|
bool x356_28_rainSplashes : 1;
|
|
|
|
bool x356_29_setXrayDrawFlags : 1;
|
|
|
|
bool x356_30_disableXrayAlpha : 1;
|
|
|
|
bool x356_31_xrayFog : 1;
|
2017-06-11 05:49:27 +00:00
|
|
|
};
|
|
|
|
u32 x356_dummy = 0;
|
|
|
|
};
|
|
|
|
|
2018-06-29 20:21:36 +00:00
|
|
|
void DragSlave(CStateManager& mgr, rstl::reserved_vector<u16, 1024>& draggedSet,
|
|
|
|
CActor* actor, const zeus::CVector3f& delta);
|
|
|
|
void DragSlaves(CStateManager& mgr, rstl::reserved_vector<u16, 1024>& draggedSet,
|
|
|
|
const zeus::CVector3f& delta);
|
|
|
|
static void DecayRiders(std::vector<SRiders>& riders, float dt, CStateManager& mgr);
|
|
|
|
static void MoveRiders(CStateManager& mgr, float dt, bool active, std::vector<SRiders>& riders,
|
|
|
|
std::vector<SRiders>& collidedRiders, const zeus::CTransform& oldXf,
|
|
|
|
const zeus::CTransform& newXf, const zeus::CVector3f& dragDelta,
|
|
|
|
const zeus::CQuaternion& rotDelta);
|
|
|
|
static rstl::reserved_vector<TUniqueId, 1024> BuildNearListFromRiders
|
|
|
|
(CStateManager& mgr, const std::vector<SRiders>& movedRiders);
|
|
|
|
|
2016-04-20 21:44:18 +00:00
|
|
|
public:
|
2018-06-29 20:21:36 +00:00
|
|
|
CScriptPlatform(TUniqueId uid, std::string_view name, const CEntityInfo& info,
|
|
|
|
const zeus::CTransform& xf, CModelData&& mData, const CActorParameters& actParms,
|
|
|
|
const zeus::CAABox& aabb, float speed, bool detectCollision, float xrayAlpha,
|
|
|
|
bool active, const CHealthInfo& hInfo, const CDamageVulnerability& dVuln,
|
|
|
|
const std::experimental::optional<TLockedToken<CCollidableOBBTreeGroupContainer>>& dcln,
|
|
|
|
bool rainSplashes, u32 maxRainSplashes, u32 rainGenRate);
|
2017-01-15 03:07:01 +00:00
|
|
|
|
|
|
|
void Accept(IVisitor& visitor);
|
2018-06-08 21:00:18 +00:00
|
|
|
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
|
|
|
|
void PreThink(float, CStateManager&);
|
|
|
|
void Think(float, CStateManager&);
|
2018-06-29 20:21:36 +00:00
|
|
|
void PreRender(CStateManager&, const zeus::CFrustum&);
|
|
|
|
void Render(const CStateManager&) const;
|
2018-04-30 03:12:41 +00:00
|
|
|
std::experimental::optional<zeus::CAABox> GetTouchBounds() const;
|
2018-06-24 02:39:53 +00:00
|
|
|
zeus::CTransform GetPrimitiveTransform() const;
|
|
|
|
const CCollisionPrimitive* GetCollisionPrimitive() const;
|
2018-06-29 20:21:36 +00:00
|
|
|
zeus::CVector3f GetOrbitPosition(const CStateManager& mgr) const;
|
|
|
|
zeus::CVector3f GetAimPosition(const CStateManager& mgr, float dt) const;
|
|
|
|
zeus::CAABox GetSortingBounds(const CStateManager& mgr) const;
|
2017-06-18 01:58:13 +00:00
|
|
|
bool IsRider(TUniqueId id) const;
|
2018-02-12 05:30:21 +00:00
|
|
|
bool IsSlave(TUniqueId id) const;
|
2018-06-29 20:21:36 +00:00
|
|
|
std::vector<SRiders>& GetStaticSlaves() { return x328_slavesStatic; }
|
|
|
|
const std::vector<SRiders>& GetStaticSlaves() const { return x328_slavesStatic; }
|
|
|
|
std::vector<SRiders>& GetDynamicSlaves() { return x338_slavesDynamic; }
|
|
|
|
const std::vector<SRiders>& GetDynamicSlaves() const { return x338_slavesDynamic; }
|
2018-02-11 05:27:00 +00:00
|
|
|
bool HasComplexCollision() const { return x314_treeGroup.operator bool(); }
|
2018-06-08 21:00:18 +00:00
|
|
|
void BuildSlaveList(CStateManager&);
|
2018-06-29 20:21:36 +00:00
|
|
|
static void AddRider(std::vector<SRiders>& riders, TUniqueId riderId,
|
|
|
|
const CPhysicsActor* ridee, CStateManager& mgr);
|
|
|
|
void AddSlave(TUniqueId, CStateManager&);
|
2018-06-08 21:00:18 +00:00
|
|
|
TUniqueId GetNext(TUniqueId, CStateManager&);
|
|
|
|
TUniqueId GetWaypoint(CStateManager&);
|
|
|
|
|
|
|
|
const CDamageVulnerability* GetDamageVulnerability() const { return &x29c_damageVuln; }
|
|
|
|
CHealthInfo* HealthInfo(CStateManager&) { return &x294_health; }
|
|
|
|
|
|
|
|
virtual void SplashThink(const zeus::CAABox&, const CFluidPlane&, float, CStateManager&) const;
|
|
|
|
virtual zeus::CQuaternion Move(float, CStateManager&);
|
2016-04-20 21:44:18 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|