2016-07-22 19:46:30 +00:00
|
|
|
#ifndef __URDE_CPLAYER_HPP__
|
|
|
|
#define __URDE_CPLAYER_HPP__
|
|
|
|
|
|
|
|
#include "CPhysicsActor.hpp"
|
|
|
|
#include "zeus/CAABox.hpp"
|
|
|
|
#include "zeus/CTransform.hpp"
|
2016-08-15 01:19:04 +00:00
|
|
|
#include "CWeaponMgr.hpp"
|
2016-07-22 19:46:30 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
class CMaterialList;
|
|
|
|
class CMorphBall;
|
2016-08-14 21:11:44 +00:00
|
|
|
class CPlayerGun;
|
2016-08-15 01:19:04 +00:00
|
|
|
class CDamageInfo;
|
|
|
|
class CScriptWater;
|
|
|
|
class IVisitor;
|
|
|
|
class CFinalInput;
|
2016-09-15 07:26:35 +00:00
|
|
|
class CPlayerCameraBob;
|
2016-08-15 01:19:04 +00:00
|
|
|
class CFirstPersonCamera;
|
2016-07-22 19:46:30 +00:00
|
|
|
|
|
|
|
class CPlayer : public CPhysicsActor
|
|
|
|
{
|
2016-08-14 21:11:44 +00:00
|
|
|
friend class CStateManager;
|
2016-09-15 07:26:35 +00:00
|
|
|
friend class CFirstPersonCamera;
|
2016-09-16 00:56:46 +00:00
|
|
|
friend class CPlayerCameraBob;
|
2016-08-15 01:19:04 +00:00
|
|
|
public:
|
|
|
|
enum class EPlayerScanState
|
|
|
|
{
|
|
|
|
};
|
|
|
|
enum class EPlayerOrbitType
|
|
|
|
{
|
|
|
|
};
|
|
|
|
enum class EPlayerOrbitState
|
|
|
|
{
|
|
|
|
};
|
|
|
|
enum class EPlayerZoneInfo
|
|
|
|
{
|
|
|
|
};
|
|
|
|
enum class EPlayerZoneType
|
|
|
|
{
|
|
|
|
};
|
|
|
|
enum class EPlayerMovementState
|
|
|
|
{
|
|
|
|
};
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
struct CVisorSteam
|
|
|
|
{
|
|
|
|
float x0_;
|
|
|
|
float x4_;
|
|
|
|
float x8_;
|
|
|
|
u32 xc_;
|
|
|
|
float x10_ = 0.f;
|
|
|
|
float x14_ = 0.f;
|
|
|
|
float x18_ = 0.f;
|
|
|
|
u32 x1c_ = 0;
|
|
|
|
float x20_ = 0.f;
|
|
|
|
float x24_ = 0.f;
|
|
|
|
bool x28_ = false;
|
|
|
|
|
|
|
|
void SetSteam(float a, float b, float c, u32 d, bool e)
|
|
|
|
{
|
|
|
|
if (x1c_ == -1 || a > x10_)
|
|
|
|
{
|
|
|
|
x10_ = a;
|
|
|
|
x14_ = b;
|
|
|
|
x18_ = c;
|
|
|
|
x1c_ = d;
|
|
|
|
}
|
|
|
|
x28_ = e;
|
|
|
|
}
|
|
|
|
void Update(float dt);
|
|
|
|
CVisorSteam(float a, float b, float c, u32 d, bool e)
|
|
|
|
: x0_(a), x4_(b), x8_(c), xc_(d), x1c_(e) {}
|
|
|
|
};
|
2016-08-14 21:11:44 +00:00
|
|
|
|
2016-09-16 00:56:46 +00:00
|
|
|
bool x38c_;
|
2016-09-15 07:26:35 +00:00
|
|
|
bool x3dc_;
|
2016-08-14 21:11:44 +00:00
|
|
|
std::unique_ptr<CPlayerGun> x490_gun;
|
2016-07-22 19:46:30 +00:00
|
|
|
std::unique_ptr<CMorphBall> x768_morphball;
|
2016-09-15 07:26:35 +00:00
|
|
|
std::unique_ptr<CPlayerCameraBob> x76c_cameraBob;
|
2016-07-22 19:46:30 +00:00
|
|
|
public:
|
|
|
|
CPlayer(TUniqueId, const zeus::CTransform&, const zeus::CAABox&, unsigned int,
|
|
|
|
const zeus::CVector3f&, float, float, float, float, const CMaterialList&);
|
2016-08-14 21:11:44 +00:00
|
|
|
|
2016-08-15 01:19:04 +00:00
|
|
|
bool IsTransparent() const;
|
|
|
|
void Update(float, CStateManager& mgr);
|
|
|
|
bool IsPlayerDeadEnough() const;
|
|
|
|
void AsyncLoadSuit(CStateManager& mgr);
|
|
|
|
void LoadAnimationTokens();
|
2016-08-31 00:33:59 +00:00
|
|
|
virtual bool CanRenderUnsorted(CStateManager& mgr) const;
|
|
|
|
virtual const CDamageVulnerability* GetDamageVulnerability(const zeus::CVector3f& v1,
|
2016-08-15 01:19:04 +00:00
|
|
|
const zeus::CVector3f& v2,
|
|
|
|
const CDamageInfo& info) const;
|
2016-08-31 00:33:59 +00:00
|
|
|
virtual const CDamageVulnerability* GetDamageVulnerability() const;
|
|
|
|
virtual zeus::CVector3f GetHomingPosition(CStateManager& mgr, float) const;
|
2016-08-15 01:19:04 +00:00
|
|
|
zeus::CVector3f GetAimPosition(CStateManager& mgr, float) const;
|
2016-08-31 00:33:59 +00:00
|
|
|
virtual void FluidFXThink(CActor::EFluidState, CScriptWater& water, CStateManager& mgr);
|
2016-08-15 01:19:04 +00:00
|
|
|
zeus::CVector3f GetDamageLocationWR() const;
|
|
|
|
float GetPrevDamageAmount() const;
|
|
|
|
float GetDamageAmount() const;
|
|
|
|
bool WasDamaged() const;
|
|
|
|
void TakeDamage(bool, const zeus::CVector3f&, float, EWeaponType, CStateManager& mgr);
|
|
|
|
void Accept(IVisitor& visitor);
|
2016-08-17 20:05:23 +00:00
|
|
|
CHealthInfo* HealthInfo(CStateManager& mgr);
|
2016-08-15 01:19:04 +00:00
|
|
|
bool IsUnderBetaMetroidAttack(CStateManager& mgr) const;
|
|
|
|
rstl::optional_object<zeus::CAABox> GetTouchBounds() const;
|
|
|
|
void Touch(CActor&, CStateManager& mgr);
|
|
|
|
void UpdateScanningState(const CFinalInput& input, CStateManager& mgr, float);
|
|
|
|
void ValidateScanning(const CFinalInput& input, CStateManager& mgr);
|
|
|
|
void SetScanningState(EPlayerScanState, CStateManager& mgr);
|
|
|
|
bool GetExplorationMode() const;
|
|
|
|
bool GetCombatMode() const;
|
|
|
|
void RenderGun(CStateManager& mgr, const zeus::CVector3f&) const;
|
|
|
|
void Render(CStateManager& mgr) const;
|
|
|
|
void RenderReflectedPlayer(CStateManager& mgr) const;
|
|
|
|
void PreRender(CStateManager& mgr, const zeus::CFrustum&);
|
2016-08-31 00:33:59 +00:00
|
|
|
zeus::CAABox CalculateRenderBounds();
|
2016-08-15 01:19:04 +00:00
|
|
|
void AddToRenderer(const zeus::CFrustum&, CStateManager&);
|
|
|
|
void ComputeFreeLook(const CFinalInput& input);
|
|
|
|
void UpdateFreeLook(float dt);
|
|
|
|
float GetMaximumPlayerPositiveVerticalVelocity(CStateManager&) const;
|
|
|
|
void ProcessInput(const CFinalInput&, CStateManager&);
|
|
|
|
bool GetFrozenState() const;
|
|
|
|
void Think(float, CStateManager&);
|
|
|
|
void PreThink(float, CStateManager&);
|
|
|
|
void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&);
|
|
|
|
void SetVisorSteam(float, float, float, u32, bool);
|
|
|
|
void UpdateFootstepBounds(const CFinalInput& input, CStateManager&, float);
|
|
|
|
u16 GetMaterialSoundUnderPlayer(CStateManager& mgr, const u16*, int, u16);
|
|
|
|
u16 SfxIdFromMaterial(const CMaterialList&, const u16*, u16);
|
|
|
|
void UpdateCrosshairsState(const CFinalInput&);
|
|
|
|
void UpdateVisorTransition(float, CStateManager& mgr);
|
|
|
|
void UpdateVisorState(const CFinalInput&, float, CStateManager& mgr);
|
|
|
|
void ForceGunOrientation(const zeus::CTransform&, CStateManager& mgr);
|
|
|
|
void UpdateDebugCamera(CStateManager& mgr);
|
|
|
|
CFirstPersonCamera& GetFirstPersonCamera(CStateManager& mgr);
|
|
|
|
void UpdateGunTransform(const zeus::CVector3f&, float, CStateManager& mgr, bool);
|
|
|
|
void DrawGun(CStateManager& mgr);
|
|
|
|
void HolsterGun(CStateManager& mgr);
|
|
|
|
bool GetMorphballTransitionState() const;
|
|
|
|
void UpdateGrappleArmTransform(const zeus::CVector3f&, CStateManager& mgr, float);
|
|
|
|
void ApplyGrappleForces(const CFinalInput& input, CStateManager& mgr, float);
|
|
|
|
bool ValidateFPPosition(const zeus::CVector3f& pos, CStateManager& mgr);
|
|
|
|
void UpdateGrappleState(const CFinalInput& input, CStateManager& mgr);
|
|
|
|
void ApplyGrappleJump(CStateManager& mgr);
|
|
|
|
void BeginGrapple(zeus::CVector3f&, CStateManager& mgr);
|
|
|
|
void BreakGrapple(CStateManager& mgr);
|
|
|
|
void PreventFallingCameraPitch();
|
|
|
|
void OrbitCarcass(CStateManager&);
|
|
|
|
void OrbitPoint(EPlayerOrbitType, CStateManager& mgr);
|
|
|
|
zeus::CVector3f GetHUDOrbitTargetPosition() const;
|
|
|
|
void SetOrbitState(EPlayerOrbitState, CStateManager& mgr);
|
|
|
|
void SetOrbitTargetId(TUniqueId);
|
|
|
|
void UpdateOrbitPosition(float, CStateManager& mgr);
|
|
|
|
void UpdateOrbitZPosition();
|
|
|
|
void UpdateOrbitFixedPosition();
|
|
|
|
void SetOrbitPosition(float, CStateManager& mgr);
|
|
|
|
void UpdateAimTarget(CStateManager& mgr);
|
|
|
|
void UpdateAimTargetTimer(float);
|
|
|
|
bool ValidateAimTargetId(TUniqueId, CStateManager& mgr);
|
|
|
|
bool ValidateObjectForMode(TUniqueId, CStateManager& mgr) const;
|
|
|
|
TUniqueId FindAimTargetId(CStateManager& mgr);
|
|
|
|
TUniqueId CheckEnemiesAgainstOrbitZone(const std::vector<TUniqueId>&, EPlayerZoneInfo,
|
|
|
|
EPlayerZoneType, CStateManager& mgr) const;
|
|
|
|
TUniqueId FindOrbitTargetId(CStateManager& mgr);
|
|
|
|
void UpdateOrbitableObjects(CStateManager& mgr);
|
|
|
|
TUniqueId FindBestOrbitableObject(const std::vector<TUniqueId>&, EPlayerZoneInfo, CStateManager& mgr) const;
|
|
|
|
void FindOrbitableObjects(const std::vector<TUniqueId>&, std::vector<TUniqueId>&, EPlayerZoneInfo,
|
|
|
|
EPlayerZoneType, CStateManager& mgr, bool) const;
|
|
|
|
bool WithinOrbitScreenBox(const zeus::CVector3f&, EPlayerZoneInfo, EPlayerZoneType) const;
|
|
|
|
bool WithinOrbitScreenEllipse(const zeus::CVector3f&, EPlayerZoneInfo) const;
|
|
|
|
void CheckOrbitDisableSourceList(CStateManager& mgr);
|
|
|
|
void CheckOrbitDisableSourceList() const;
|
|
|
|
void RemoveOrbitDisableSource(TUniqueId);
|
|
|
|
void AddOrbitDisableSource(CStateManager& mgr, TUniqueId);
|
|
|
|
void UpdateOrbitPreventionTimer(float);
|
|
|
|
void UpdateOrbitModeTimer(float);
|
|
|
|
void UpdateOrbitZone(CStateManager& mgr);
|
|
|
|
void UpdateOrbitInput(const CFinalInput& input, CStateManager& mgr);
|
|
|
|
void UpdateOrbitSelection(const CFinalInput& input, CStateManager& mgr);
|
|
|
|
void UpdateOrbitOrientation(CStateManager& mgr);
|
|
|
|
void UpdateOrbitTarget(CStateManager& mgr);
|
|
|
|
float GetOrbitMaxLockDistance(CStateManager& mgr) const;
|
|
|
|
float GetOrbitMaxTargetDistance(CStateManager& mgr) const;
|
|
|
|
bool ValidateOrbitTargetId(TUniqueId, CStateManager& mgr) const;
|
|
|
|
bool ValidateCurrentOrbitTargetId(CStateManager& mgr);
|
|
|
|
bool ValidateOrbitTargetIdAndPointer(TUniqueId, CStateManager& mgr) const;
|
|
|
|
zeus::CVector3f GetBallPosition() const;
|
|
|
|
zeus::CVector3f GetEyePosition() const;
|
|
|
|
float GetEyeHeight() const;
|
|
|
|
float GetStepUpHeight() const;
|
|
|
|
float GetStepDownHeight() const;
|
2016-08-14 21:11:44 +00:00
|
|
|
void Teleport(const zeus::CTransform& xf, CStateManager& mgr, bool);
|
2016-08-15 01:19:04 +00:00
|
|
|
zeus::CTransform CreateTransformFromMovementDirection() const;
|
|
|
|
const CCollisionPrimitive& GetCollisionPrimitive() const;
|
|
|
|
zeus::CTransform GetPrimitiveTransform() const;
|
|
|
|
bool CollidedWith(TUniqueId, const CCollisionInfoList&, CStateManager& mgr);
|
|
|
|
float GetActualFirstPersonMaxVelocity() const;
|
|
|
|
void SetMoveState(EPlayerMovementState, CStateManager& mgr);
|
|
|
|
float JumpInput(const CFinalInput& input, CStateManager& mgr);
|
|
|
|
float TurnInput(const CFinalInput& input) const;
|
|
|
|
float StrafeInput(const CFinalInput& input) const;
|
|
|
|
float ForwardInput(const CFinalInput& input, float) const;
|
|
|
|
void ComputeMovement(const CFinalInput& input, CStateManager& mgr, float);
|
|
|
|
float GetWeight() const;
|
|
|
|
float GetDampedClampedVelocityWR() const;
|
2016-07-22 19:46:30 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __URDE_CPLAYER_HPP__
|