2016-04-16 21:49:47 +00:00
|
|
|
#ifndef __URDE_CCAMERAMANAGER_HPP__
|
|
|
|
#define __URDE_CCAMERAMANAGER_HPP__
|
|
|
|
|
|
|
|
#include "RetroTypes.hpp"
|
|
|
|
#include "zeus/CVector3f.hpp"
|
2016-04-16 23:48:29 +00:00
|
|
|
#include "World/CGameArea.hpp"
|
2016-04-16 21:49:47 +00:00
|
|
|
|
|
|
|
namespace urde
|
|
|
|
{
|
|
|
|
class CFirstPersonCamera;
|
|
|
|
class CBallCamera;
|
|
|
|
class CStateManager;
|
2016-04-16 23:48:29 +00:00
|
|
|
class CGameCamera;
|
|
|
|
class CCameraShakeData;
|
2016-10-31 22:56:44 +00:00
|
|
|
class CScriptWater;
|
2017-03-24 05:30:16 +00:00
|
|
|
class CInterpolationCamera;
|
2018-02-04 06:46:47 +00:00
|
|
|
struct CFinalInput;
|
2017-10-06 07:29:56 +00:00
|
|
|
class CScriptCameraHint;
|
|
|
|
class CCinematicCamera;
|
2016-04-16 21:49:47 +00:00
|
|
|
|
|
|
|
class CCameraManager
|
|
|
|
{
|
2016-10-31 22:56:44 +00:00
|
|
|
static float sAspect;
|
|
|
|
static float sFarPlane;
|
|
|
|
static float sNearPlane;
|
|
|
|
static float sFirstPersonFOV;
|
|
|
|
static float sThirdPersonFOV;
|
2016-04-16 23:48:29 +00:00
|
|
|
TUniqueId x0_curCameraId;
|
2016-04-16 21:49:47 +00:00
|
|
|
std::vector<TUniqueId> x4_cineCameras;
|
2017-03-18 05:12:27 +00:00
|
|
|
std::list<CCameraShakeData> x14_shakers;
|
2016-04-17 02:50:45 +00:00
|
|
|
u32 x2c_lastShakeId = 0;
|
|
|
|
zeus::CVector3f x30_shakeOffset;
|
|
|
|
CGameArea::CAreaFog x3c_fog;
|
|
|
|
int x74_fluidCounter = 0;
|
|
|
|
TUniqueId x78_fluidId = kInvalidUniqueId;
|
|
|
|
CFirstPersonCamera* x7c_fpCamera = nullptr;
|
|
|
|
CBallCamera* x80_ballCamera = nullptr;
|
|
|
|
s16 x84_rumbleId = -1;
|
2017-03-24 05:30:16 +00:00
|
|
|
CInterpolationCamera* x88_interpCamera = nullptr;
|
2017-10-06 07:29:56 +00:00
|
|
|
float x90_rumbleCooldown = 0.f;
|
|
|
|
float x94_fogDensityFactor = 1.f;
|
|
|
|
float x98_fogDensitySpeed = 0.f;
|
|
|
|
float x9c_fogDensityFactorTarget = 1.f;
|
2016-04-17 02:50:45 +00:00
|
|
|
|
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
2017-10-06 07:29:56 +00:00
|
|
|
bool xa0_24_pendingRumble : 1;
|
2016-10-31 22:56:44 +00:00
|
|
|
bool xa0_25_rumbling : 1;
|
|
|
|
bool xa0_26_inWater : 1;
|
2016-04-17 02:50:45 +00:00
|
|
|
};
|
2016-10-31 22:56:44 +00:00
|
|
|
u8 _dummy1 = 0;
|
2016-04-17 02:50:45 +00:00
|
|
|
};
|
|
|
|
|
2017-10-06 07:29:56 +00:00
|
|
|
TUniqueId xa2_spindleCamId = kInvalidUniqueId;
|
|
|
|
TUniqueId xa4_pathCamId = kInvalidUniqueId;
|
|
|
|
TUniqueId xa6_camHintId = kInvalidUniqueId;
|
|
|
|
s32 xa8_hintPriority = 1000;
|
|
|
|
rstl::reserved_vector<std::pair<s32, TUniqueId>, 64> xac_cameraHints;
|
2017-10-05 05:40:44 +00:00
|
|
|
rstl::reserved_vector<TUniqueId, 64> x2b0_inactiveCameraHints;
|
|
|
|
rstl::reserved_vector<TUniqueId, 64> x334_activeCameraHints;
|
|
|
|
|
2016-10-31 22:56:44 +00:00
|
|
|
union
|
|
|
|
{
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
bool x3b8_24_ : 1;
|
|
|
|
bool x3b8_25_ : 1;
|
|
|
|
};
|
|
|
|
u8 _dummy2;
|
|
|
|
};
|
|
|
|
|
|
|
|
float x3bc_curFov = 60.f;
|
2017-10-06 07:29:56 +00:00
|
|
|
|
|
|
|
void SetPathCamera(TUniqueId id, CStateManager& mgr);
|
|
|
|
void SetSpindleCamera(TUniqueId id, CStateManager& mgr);
|
|
|
|
void RestoreHintlessCamera(CStateManager& mgr);
|
2017-10-16 05:26:50 +00:00
|
|
|
void InterpolateToBallCamera(const zeus::CTransform& xf, TUniqueId camId, const zeus::CVector3f& lookPos,
|
2017-10-06 07:29:56 +00:00
|
|
|
float f1, float f2, float f3, bool b1, CStateManager& mgr);
|
|
|
|
void SkipBallCameraCinematic(CStateManager& mgr);
|
|
|
|
void ApplyCameraHint(const CScriptCameraHint& hint, CStateManager& mgr);
|
|
|
|
|
2017-11-24 08:23:28 +00:00
|
|
|
void EnterCinematic(CStateManager& mgr);
|
|
|
|
|
2016-04-16 21:49:47 +00:00
|
|
|
public:
|
2016-08-14 03:00:58 +00:00
|
|
|
CCameraManager(TUniqueId curCameraId=kInvalidUniqueId);
|
2016-04-16 21:49:47 +00:00
|
|
|
|
2016-10-31 22:56:44 +00:00
|
|
|
static float Aspect() {return sAspect;}
|
|
|
|
static float FarPlane() {return sFarPlane;}
|
|
|
|
static float NearPlane() {return sNearPlane;}
|
|
|
|
static float FirstPersonFOV() {return sFirstPersonFOV;}
|
|
|
|
static float ThirdPersonFOV() {return sThirdPersonFOV;}
|
2016-04-22 03:40:26 +00:00
|
|
|
|
2016-08-15 01:19:04 +00:00
|
|
|
void ResetCameras(CStateManager& mgr);
|
2016-10-15 19:18:50 +00:00
|
|
|
void SetSpecialCameras(CFirstPersonCamera& fp, CBallCamera& ball);
|
2016-04-16 21:49:47 +00:00
|
|
|
bool IsInCinematicCamera() const {return x4_cineCameras.size() != 0;}
|
2017-07-31 05:19:05 +00:00
|
|
|
bool IsInFirstPersonCamera() const;
|
2016-04-16 21:49:47 +00:00
|
|
|
zeus::CVector3f GetGlobalCameraTranslation(const CStateManager& stateMgr) const;
|
2016-04-17 02:50:45 +00:00
|
|
|
zeus::CTransform GetCurrentCameraTransform(const CStateManager& stateMgr) const;
|
|
|
|
void RemoveCameraShaker(int id);
|
2017-03-18 05:12:27 +00:00
|
|
|
int AddCameraShaker(const CCameraShakeData& data, bool sfx);
|
2016-04-16 21:49:47 +00:00
|
|
|
void AddCinemaCamera(TUniqueId, CStateManager& stateMgr);
|
2017-08-29 13:17:52 +00:00
|
|
|
void RemoveCinemaCamera(TUniqueId, CStateManager&);
|
2016-04-16 21:49:47 +00:00
|
|
|
void SetInsideFluid(bool, TUniqueId);
|
|
|
|
void Update(float dt, CStateManager& stateMgr);
|
2017-03-05 17:54:00 +00:00
|
|
|
CGameCamera* GetCurrentCamera(CStateManager& stateMgr) const;
|
|
|
|
const CGameCamera* GetCurrentCamera(const CStateManager& stateMgr) const;
|
2016-04-17 02:50:45 +00:00
|
|
|
void SetCurrentCameraId(TUniqueId id, CStateManager& stateMgr) {x0_curCameraId = id;}
|
2017-03-24 05:30:16 +00:00
|
|
|
void CreateStandardCameras(CStateManager& stateMgr);
|
2016-04-16 23:48:29 +00:00
|
|
|
TUniqueId GetCurrentCameraId() const
|
|
|
|
{
|
|
|
|
if (x4_cineCameras.size())
|
|
|
|
return x4_cineCameras.back();
|
|
|
|
return x0_curCameraId;
|
|
|
|
}
|
2016-10-31 22:56:44 +00:00
|
|
|
TUniqueId GetLastCameraId() const
|
|
|
|
{
|
|
|
|
if (x4_cineCameras.size())
|
|
|
|
return x4_cineCameras.back();
|
|
|
|
return kInvalidUniqueId;
|
|
|
|
}
|
2016-07-28 07:33:55 +00:00
|
|
|
|
2017-02-18 02:19:50 +00:00
|
|
|
void SkipCinematic(CStateManager& stateMgr);
|
|
|
|
|
2016-08-17 20:05:23 +00:00
|
|
|
CFirstPersonCamera* GetFirstPersonCamera() { return x7c_fpCamera; }
|
2016-07-28 07:33:55 +00:00
|
|
|
CBallCamera* GetBallCamera() { return x80_ballCamera; }
|
2017-03-04 04:31:08 +00:00
|
|
|
CGameArea::CAreaFog& Fog() { return x3c_fog; }
|
2016-09-16 00:56:46 +00:00
|
|
|
|
2017-10-07 05:32:11 +00:00
|
|
|
float GetCameraBobMagnitude() const;
|
2016-10-31 22:56:44 +00:00
|
|
|
|
2017-10-06 07:29:56 +00:00
|
|
|
void UpdateCameraHints(float dt, CStateManager& mgr);
|
|
|
|
void ThinkCameras(float dt, CStateManager& mgr);
|
|
|
|
void UpdateFog(float dt, CStateManager& mgr);
|
|
|
|
void UpdateRumble(float dt, CStateManager& mgr);
|
|
|
|
void UpdateListener(CStateManager& mgr);
|
2016-10-31 22:56:44 +00:00
|
|
|
|
|
|
|
float CalculateFogDensity(CStateManager&, const CScriptWater*);
|
2017-03-24 05:30:16 +00:00
|
|
|
|
|
|
|
void ProcessInput(const CFinalInput& input, CStateManager& stateMgr);
|
2017-03-26 19:36:07 +00:00
|
|
|
|
|
|
|
void RenderCameras(const CStateManager& mgr);
|
2017-08-02 07:13:11 +00:00
|
|
|
void SetupBallCamera(CStateManager& mgr);
|
2017-08-18 01:30:15 +00:00
|
|
|
void SetPlayerCamera(CStateManager& mgr, TUniqueId newCamId);
|
2017-08-02 07:13:11 +00:00
|
|
|
int GetFluidCounter() const { return x74_fluidCounter; }
|
2017-08-18 01:30:15 +00:00
|
|
|
bool HasBallCameraInitialPositionHint(CStateManager& mgr) const;
|
2017-10-05 05:40:44 +00:00
|
|
|
|
|
|
|
void DeleteCameraHint(TUniqueId id, CStateManager& mgr);
|
|
|
|
void AddInactiveCameraHint(TUniqueId id, CStateManager& mgr);
|
|
|
|
void AddActiveCameraHint(TUniqueId id, CStateManager& mgr);
|
|
|
|
|
2017-10-06 07:29:56 +00:00
|
|
|
TUniqueId GetLastCineCameraId() const;
|
|
|
|
TUniqueId GetSpindleCameraId() const { return xa2_spindleCamId; }
|
|
|
|
TUniqueId GetPathCameraId() const { return xa4_pathCamId; }
|
|
|
|
const CCinematicCamera* GetLastCineCamera(CStateManager& mgr) const;
|
|
|
|
const CScriptCameraHint* GetCameraHint(CStateManager& mgr) const;
|
|
|
|
bool HasCameraHint(CStateManager& mgr) const;
|
2017-10-10 03:50:48 +00:00
|
|
|
bool IsInterpolationCameraActive() const;
|
2018-06-26 06:58:43 +00:00
|
|
|
|
|
|
|
bool ShouldBypassInterpolation() { return false; }
|
2016-04-16 21:49:47 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // __URDE_CCAMERAMANAGER_HPP__
|