2018-10-07 03:42:33 +00:00
|
|
|
#pragma once
|
2016-04-16 21:49:47 +00:00
|
|
|
|
2019-09-28 02:53:03 +00:00
|
|
|
#include <list>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
#include "Runtime/RetroTypes.hpp"
|
|
|
|
#include "Runtime/rstl.hpp"
|
|
|
|
#include "Runtime/World/CGameArea.hpp"
|
|
|
|
|
|
|
|
#include <zeus/CVector3f.hpp>
|
2016-04-16 21:49:47 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
namespace urde {
|
2016-04-16 21:49:47 +00:00
|
|
|
class CBallCamera;
|
2016-04-16 23:48:29 +00:00
|
|
|
class CCameraShakeData;
|
2019-09-28 02:53:03 +00:00
|
|
|
class CCinematicCamera;
|
|
|
|
class CFirstPersonCamera;
|
|
|
|
class CGameCamera;
|
2017-03-24 05:30:16 +00:00
|
|
|
class CInterpolationCamera;
|
2017-10-06 07:29:56 +00:00
|
|
|
class CScriptCameraHint;
|
2019-09-28 02:53:03 +00:00
|
|
|
class CScriptWater;
|
|
|
|
class CStateManager;
|
|
|
|
|
|
|
|
struct CFinalInput;
|
2016-04-16 21:49:47 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
class CCameraManager {
|
|
|
|
static float sFirstPersonFOV;
|
|
|
|
TUniqueId x0_curCameraId;
|
|
|
|
std::vector<TUniqueId> x4_cineCameras;
|
|
|
|
std::list<CCameraShakeData> x14_shakers;
|
|
|
|
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;
|
|
|
|
CInterpolationCamera* x88_interpCamera = nullptr;
|
|
|
|
float x90_rumbleCooldown = 0.f;
|
|
|
|
float x94_fogDensityFactor = 1.f;
|
|
|
|
float x98_fogDensitySpeed = 0.f;
|
|
|
|
float x9c_fogDensityFactorTarget = 1.f;
|
|
|
|
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
bool xa0_24_pendingRumble : 1;
|
|
|
|
bool xa0_25_rumbling : 1;
|
|
|
|
bool xa0_26_inWater : 1;
|
2016-04-17 02:50:45 +00:00
|
|
|
};
|
2018-12-08 05:30:43 +00:00
|
|
|
u8 _dummy1 = 0;
|
|
|
|
};
|
|
|
|
|
|
|
|
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;
|
|
|
|
rstl::reserved_vector<TUniqueId, 64> x2b0_inactiveCameraHints;
|
|
|
|
rstl::reserved_vector<TUniqueId, 64> x334_activeCameraHints;
|
|
|
|
|
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
bool x3b8_24_ : 1;
|
|
|
|
bool x3b8_25_ : 1;
|
2016-10-31 22:56:44 +00:00
|
|
|
};
|
2018-12-08 05:30:43 +00:00
|
|
|
u8 _dummy2;
|
|
|
|
};
|
2016-10-31 22:56:44 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
float x3bc_curFov = 60.f;
|
2017-10-06 07:29:56 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void SetPathCamera(TUniqueId id, CStateManager& mgr);
|
|
|
|
void SetSpindleCamera(TUniqueId id, CStateManager& mgr);
|
|
|
|
void RestoreHintlessCamera(CStateManager& mgr);
|
|
|
|
void InterpolateToBallCamera(const zeus::CTransform& xf, TUniqueId camId, const zeus::CVector3f& lookPos,
|
|
|
|
float maxTime, float positionSpeed, float rotationSpeed, bool sinusoidal,
|
|
|
|
CStateManager& mgr);
|
|
|
|
void SkipBallCameraCinematic(CStateManager& mgr);
|
|
|
|
void ApplyCameraHint(const CScriptCameraHint& hint, CStateManager& mgr);
|
2017-10-06 07:29:56 +00:00
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
void EnterCinematic(CStateManager& mgr);
|
2017-11-24 08:23:28 +00:00
|
|
|
|
2016-04-16 21:49:47 +00:00
|
|
|
public:
|
2018-12-08 05:30:43 +00:00
|
|
|
CCameraManager(TUniqueId curCameraId = kInvalidUniqueId);
|
|
|
|
|
2019-09-28 02:46:56 +00:00
|
|
|
static float Aspect() { return 1.42f; }
|
|
|
|
static float FarPlane() { return 750.0f; }
|
|
|
|
static float NearPlane() { return 0.2f; }
|
2018-12-08 05:30:43 +00:00
|
|
|
static float FirstPersonFOV() { return sFirstPersonFOV; }
|
2019-09-28 02:46:56 +00:00
|
|
|
static float ThirdPersonFOV() { return 60.0f; }
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
void ResetCameras(CStateManager& mgr);
|
|
|
|
void SetSpecialCameras(CFirstPersonCamera& fp, CBallCamera& ball);
|
|
|
|
bool IsInCinematicCamera() const { return x4_cineCameras.size() != 0; }
|
|
|
|
bool IsInFirstPersonCamera() const;
|
|
|
|
zeus::CVector3f GetGlobalCameraTranslation(const CStateManager& stateMgr) const;
|
|
|
|
zeus::CTransform GetCurrentCameraTransform(const CStateManager& stateMgr) const;
|
2020-01-20 17:51:50 +00:00
|
|
|
void RemoveCameraShaker(u32 id);
|
2018-12-08 05:30:43 +00:00
|
|
|
int AddCameraShaker(const CCameraShakeData& data, bool sfx);
|
2020-03-25 06:33:32 +00:00
|
|
|
void AddCinemaCamera(TUniqueId id, CStateManager& stateMgr);
|
|
|
|
void RemoveCinemaCamera(TUniqueId uid, CStateManager& mgr);
|
|
|
|
void SetInsideFluid(bool isInside, TUniqueId fluidId);
|
2018-12-08 05:30:43 +00:00
|
|
|
void Update(float dt, CStateManager& stateMgr);
|
|
|
|
CGameCamera* GetCurrentCamera(CStateManager& stateMgr) const;
|
|
|
|
const CGameCamera* GetCurrentCamera(const CStateManager& stateMgr) const;
|
|
|
|
void SetCurrentCameraId(TUniqueId id, CStateManager& stateMgr) { x0_curCameraId = id; }
|
|
|
|
void CreateStandardCameras(CStateManager& stateMgr);
|
|
|
|
TUniqueId GetCurrentCameraId() const {
|
|
|
|
if (x4_cineCameras.size())
|
|
|
|
return x4_cineCameras.back();
|
|
|
|
return x0_curCameraId;
|
|
|
|
}
|
|
|
|
TUniqueId GetLastCameraId() const {
|
|
|
|
if (x4_cineCameras.size())
|
|
|
|
return x4_cineCameras.back();
|
|
|
|
return kInvalidUniqueId;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SkipCinematic(CStateManager& stateMgr);
|
|
|
|
|
|
|
|
CFirstPersonCamera* GetFirstPersonCamera() { return x7c_fpCamera; }
|
2019-08-14 10:04:11 +00:00
|
|
|
const CFirstPersonCamera* GetFirstPersonCamera() const { return x7c_fpCamera; }
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
CBallCamera* GetBallCamera() { return x80_ballCamera; }
|
2019-08-14 10:04:11 +00:00
|
|
|
const CBallCamera* GetBallCamera() const { return x80_ballCamera; }
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
CGameArea::CAreaFog& Fog() { return x3c_fog; }
|
2019-08-14 10:04:11 +00:00
|
|
|
const CGameArea::CAreaFog& Fog() const { return x3c_fog; }
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
float GetCameraBobMagnitude() const;
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
2020-03-25 06:33:32 +00:00
|
|
|
float CalculateFogDensity(CStateManager& mgr, const CScriptWater* water) const;
|
|
|
|
void SetFogDensity(float fogDensityTarget, float fogDensitySpeed);
|
2018-12-08 05:30:43 +00:00
|
|
|
|
|
|
|
void ProcessInput(const CFinalInput& input, CStateManager& stateMgr);
|
|
|
|
|
|
|
|
void RenderCameras(const CStateManager& mgr);
|
|
|
|
void SetupBallCamera(CStateManager& mgr);
|
|
|
|
void SetPlayerCamera(CStateManager& mgr, TUniqueId newCamId);
|
|
|
|
int GetFluidCounter() const { return x74_fluidCounter; }
|
|
|
|
bool HasBallCameraInitialPositionHint(CStateManager& mgr) const;
|
|
|
|
|
|
|
|
void DeleteCameraHint(TUniqueId id, CStateManager& mgr);
|
|
|
|
void AddInactiveCameraHint(TUniqueId id, CStateManager& mgr);
|
|
|
|
void AddActiveCameraHint(TUniqueId id, CStateManager& mgr);
|
|
|
|
|
|
|
|
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;
|
|
|
|
bool IsInterpolationCameraActive() const;
|
|
|
|
|
|
|
|
bool ShouldBypassInterpolation() { return false; }
|
2016-04-16 21:49:47 +00:00
|
|
|
};
|
|
|
|
|
2018-12-08 05:30:43 +00:00
|
|
|
} // namespace urde
|