2022-10-09 05:13:17 +00:00
|
|
|
#ifndef _CCAMERAMANAGER
|
|
|
|
#define _CCAMERAMANAGER
|
2022-08-13 01:26:00 +00:00
|
|
|
|
|
|
|
#include "types.h"
|
|
|
|
|
2022-11-07 00:20:46 +00:00
|
|
|
#include "MetroidPrime/CGameArea.hpp"
|
|
|
|
#include "MetroidPrime/Cameras/CCameraShakeData.hpp"
|
2024-09-22 22:58:50 +00:00
|
|
|
#include "MetroidPrime/TGameTypes.hpp"
|
2022-08-13 01:26:00 +00:00
|
|
|
|
|
|
|
#include "Kyoto/Math/CVector3f.hpp"
|
|
|
|
|
|
|
|
#include "rstl/list.hpp"
|
|
|
|
#include "rstl/pair.hpp"
|
|
|
|
#include "rstl/reserved_vector.hpp"
|
|
|
|
#include "rstl/vector.hpp"
|
|
|
|
|
|
|
|
class CBallCamera;
|
|
|
|
class CCameraShakeData;
|
2024-09-22 22:58:50 +00:00
|
|
|
class CFinalInput;
|
2022-08-13 01:26:00 +00:00
|
|
|
class CFirstPersonCamera;
|
2022-08-13 02:48:34 +00:00
|
|
|
class CGameCamera;
|
2022-08-13 01:26:00 +00:00
|
|
|
class CInterpolationCamera;
|
2024-09-23 05:56:21 +00:00
|
|
|
class CScriptCameraHint;
|
2024-09-22 22:58:50 +00:00
|
|
|
class CScriptWater;
|
2022-08-13 02:48:34 +00:00
|
|
|
class CStateManager;
|
2022-08-13 01:26:00 +00:00
|
|
|
|
2022-11-10 06:50:18 +00:00
|
|
|
#ifdef __MWERKS__
|
|
|
|
#pragma cpp_extensions on
|
2024-09-22 22:58:50 +00:00
|
|
|
#endif
|
|
|
|
|
2022-08-13 01:26:00 +00:00
|
|
|
class CCameraManager {
|
2022-11-07 00:20:46 +00:00
|
|
|
static float sFirstPersonFOV;
|
|
|
|
static float sThirdPersonFOV;
|
|
|
|
static float sNearPlane;
|
|
|
|
static float sFarPlane;
|
|
|
|
static float sAspectRatio;
|
|
|
|
static float lbl_805A6BE4;
|
|
|
|
static float lbl_805A6BE8;
|
2024-09-22 22:58:50 +00:00
|
|
|
|
2022-08-13 02:48:34 +00:00
|
|
|
public:
|
2022-11-15 01:08:30 +00:00
|
|
|
CCameraManager(TUniqueId curCamera = kInvalidUniqueId);
|
2022-11-07 00:20:46 +00:00
|
|
|
|
2024-09-25 04:05:42 +00:00
|
|
|
void CreateCameras(CStateManager& mgr);
|
|
|
|
void UpdateCameras(float dt, CStateManager& mgr);
|
2022-11-10 06:50:18 +00:00
|
|
|
void ResetCameras(CStateManager& mgr);
|
2024-09-25 04:05:42 +00:00
|
|
|
void Render(const CStateManager& mgr);
|
2022-11-10 06:50:18 +00:00
|
|
|
TUniqueId GetCurrentCameraId() const;
|
2024-09-22 22:58:50 +00:00
|
|
|
void SetCurrentCameraId(TUniqueId camId);
|
2022-11-10 06:50:18 +00:00
|
|
|
|
|
|
|
CGameCamera& CurrentCamera(CStateManager& mgr);
|
2022-11-04 05:39:14 +00:00
|
|
|
const CGameCamera& GetCurrentCamera(const CStateManager& mgr) const;
|
2024-09-25 04:05:42 +00:00
|
|
|
const CGameCamera& GetCurrentCinematicCamera(CStateManager& mgr) const;
|
|
|
|
TUniqueId GetCurrentCinematicCameraId() const;
|
2022-11-10 06:50:18 +00:00
|
|
|
|
2024-09-22 22:58:50 +00:00
|
|
|
void Update(float dt, CStateManager& mgr);
|
2024-09-25 04:05:42 +00:00
|
|
|
void UpdateAudioListener(CStateManager& mgr);
|
|
|
|
void UpdateScreenShake(float dt, CStateManager& mgr);
|
|
|
|
void UpdateFilters(float dt, CStateManager& mgr);
|
2024-09-22 22:58:50 +00:00
|
|
|
void UpdateCameraHints(float dt, CStateManager& mgr);
|
2024-09-25 04:05:42 +00:00
|
|
|
float GetWaterFarDistance(CStateManager& mgr, const CScriptWater* water);
|
|
|
|
void SetWaterFogScale(float fogDensityTarget, float fogDensitySpeed);
|
2022-11-10 06:50:18 +00:00
|
|
|
|
2022-10-08 04:53:28 +00:00
|
|
|
CFirstPersonCamera* FirstPersonCamera() const /* map */ { return x7c_fpCamera; }
|
2022-10-05 18:05:56 +00:00
|
|
|
const CFirstPersonCamera* GetFirstPersonCamera() const { return x7c_fpCamera; }
|
2022-11-10 06:50:18 +00:00
|
|
|
|
2022-09-29 05:30:20 +00:00
|
|
|
void SetPlayerCamera(CStateManager& mgr, TUniqueId newCamId);
|
2022-10-06 20:34:27 +00:00
|
|
|
bool IsInCinematicCamera() const;
|
2024-09-22 22:58:50 +00:00
|
|
|
void AddCinemaCamera(TUniqueId uid, CStateManager& mgr);
|
|
|
|
void RemoveCinemaCamera(TUniqueId uid, CStateManager& mgr);
|
|
|
|
void EnterCinematic(CStateManager& mgr);
|
2024-09-25 04:05:42 +00:00
|
|
|
void StopCinematics(CStateManager& mgr);
|
2022-11-10 06:50:18 +00:00
|
|
|
|
2022-11-03 12:29:47 +00:00
|
|
|
int AddCameraShaker(const CCameraShakeData& data, bool sfx);
|
2024-09-22 22:58:50 +00:00
|
|
|
void RemoveCameraShaker(int id);
|
|
|
|
CTransform4f GetCurrentCameraTransform(const CStateManager& mgr) const;
|
2024-09-23 05:56:21 +00:00
|
|
|
CVector3f GetGlobalCameraTranslation(const CStateManager& mgr) const;
|
2024-10-15 05:47:46 +00:00
|
|
|
bool IsInFPCamera() const;
|
2024-09-23 05:56:21 +00:00
|
|
|
bool IsInterpolationCameraActive() const;
|
|
|
|
bool ShouldBypassInterpolationCamera() const;
|
2024-09-25 04:05:42 +00:00
|
|
|
void SetupInterpolation(const CTransform4f& xf, TUniqueId camId, CVector3f lookPos,
|
2024-09-23 05:56:21 +00:00
|
|
|
float maxTime, float positionSpeed, float rotationSpeed,
|
|
|
|
bool sinusoidal, CStateManager& mgr);
|
2024-09-25 04:05:42 +00:00
|
|
|
void CinematicCut(CStateManager& mgr);
|
|
|
|
void UseCameraHint(const CScriptCameraHint& hint, CStateManager& mgr);
|
|
|
|
void NoCameraHintsLeft(CStateManager& mgr);
|
|
|
|
void AddCameraHint(TUniqueId uid, CStateManager& mgr);
|
|
|
|
void DeleteCameraHint(TUniqueId uid, CStateManager& mgr);
|
|
|
|
void ReallyRemoveCameraHint(TUniqueId uid, CStateManager& mgr);
|
2024-09-22 22:58:50 +00:00
|
|
|
// SetSpecialCameras__14CCameraManagerFR18CFirstPersonCameraR11CBallCamera
|
2024-09-30 06:02:23 +00:00
|
|
|
void ResetCameraHint(CStateManager& mgr);
|
2022-10-02 10:13:35 +00:00
|
|
|
|
2022-11-07 00:20:46 +00:00
|
|
|
void SetCurrentFov(float fov) { x3bc_curFov = fov; }
|
2024-09-22 22:58:50 +00:00
|
|
|
|
2022-10-21 12:01:25 +00:00
|
|
|
int GetFluidCounter() const { return x74_fluidCounter; }
|
2024-09-22 22:58:50 +00:00
|
|
|
TUniqueId GetFluidId() const { return x78_fluidId; }
|
2024-09-28 19:43:23 +00:00
|
|
|
bool GetInsideFluid() const { return x74_fluidCounter == 0; }
|
2024-09-25 04:05:42 +00:00
|
|
|
bool IsInsideFluid() const { return xa0_26_inWater; }
|
2024-09-22 22:58:50 +00:00
|
|
|
// WasInsideFluid__14CCameraManagerCFv
|
|
|
|
// SetWasInsideFluid__14CCameraManagerFb
|
|
|
|
void SetInsideFluid(bool isInside, TUniqueId fluidId);
|
2022-09-21 05:18:07 +00:00
|
|
|
|
2024-09-22 22:58:50 +00:00
|
|
|
void ProcessInput(const CFinalInput& input, CStateManager& mgr);
|
2022-11-07 00:20:46 +00:00
|
|
|
|
2024-09-25 04:05:42 +00:00
|
|
|
void SetPathCamera(TUniqueId id, CStateManager& mgr);
|
|
|
|
TUniqueId GetPathCameraId() const;
|
|
|
|
void SetSpindleCamera(TUniqueId id, CStateManager& mgr);
|
|
|
|
TUniqueId GetSpindleCameraId() const;
|
|
|
|
|
2024-09-30 06:02:23 +00:00
|
|
|
CBallCamera* BallCamera() const { return x80_ballCamera; }
|
|
|
|
const CBallCamera* GetBallCamera() const { return x80_ballCamera; }
|
|
|
|
|
2024-09-25 04:05:42 +00:00
|
|
|
static float GetDefaultThirdPersonVerticalFOV();
|
|
|
|
static float GetDefaultFirstPersonVerticalFOV();
|
|
|
|
static float GetDefaultFirstPersonNearClipDistance();
|
|
|
|
static float GetDefaultFirstPersonFarClipDistance();
|
|
|
|
static float GetDefaultAspectRatio();
|
2024-09-22 22:58:50 +00:00
|
|
|
|
2022-08-13 01:26:00 +00:00
|
|
|
private:
|
|
|
|
TUniqueId x0_curCameraId;
|
|
|
|
rstl::vector< TUniqueId > x4_cineCameras;
|
|
|
|
rstl::list< CCameraShakeData > x14_shakers;
|
2022-09-05 04:01:13 +00:00
|
|
|
uint x2c_lastShakeId;
|
2022-08-13 01:26:00 +00:00
|
|
|
CVector3f x30_shakeOffset;
|
2022-11-07 00:20:46 +00:00
|
|
|
CGameArea::CAreaFog x3c_fog;
|
2022-09-05 04:01:13 +00:00
|
|
|
int x74_fluidCounter;
|
2022-08-13 01:26:00 +00:00
|
|
|
TUniqueId x78_fluidId;
|
|
|
|
CFirstPersonCamera* x7c_fpCamera;
|
|
|
|
CBallCamera* x80_ballCamera;
|
2022-09-05 04:01:13 +00:00
|
|
|
int x84_rumbleId;
|
2022-08-13 01:26:00 +00:00
|
|
|
CInterpolationCamera* x88_interpCamera;
|
2022-10-09 05:37:23 +00:00
|
|
|
short x8c_;
|
|
|
|
float x90_rumbleCooldown;
|
|
|
|
float x94_fogDensityFactor;
|
|
|
|
float x98_fogDensitySpeed;
|
|
|
|
float x9c_fogDensityFactorTarget;
|
2022-11-10 06:50:18 +00:00
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
bool xa0_24_pendingRumble : 1;
|
|
|
|
bool xa0_25_rumbling : 1;
|
|
|
|
bool xa0_26_inWater : 1;
|
|
|
|
};
|
|
|
|
uchar xa0_flags;
|
|
|
|
};
|
|
|
|
|
2022-08-13 01:26:00 +00:00
|
|
|
TUniqueId xa2_spindleCamId;
|
|
|
|
TUniqueId xa4_pathCamId;
|
|
|
|
TUniqueId xa6_camHintId;
|
2022-09-05 04:01:13 +00:00
|
|
|
int xa8_hintPriority;
|
|
|
|
rstl::reserved_vector< rstl::pair< int, TUniqueId >, 64 > xac_cameraHints;
|
2022-08-13 01:26:00 +00:00
|
|
|
rstl::reserved_vector< TUniqueId, 64 > x2b0_inactiveCameraHints;
|
|
|
|
rstl::reserved_vector< TUniqueId, 64 > x334_activeCameraHints;
|
|
|
|
bool x3b8_24_ : 1;
|
|
|
|
bool x3b8_25_ : 1;
|
2022-10-09 05:37:23 +00:00
|
|
|
float x3bc_curFov;
|
2022-08-13 01:26:00 +00:00
|
|
|
};
|
|
|
|
CHECK_SIZEOF(CCameraManager, 0x3c0)
|
|
|
|
|
2022-11-10 06:51:09 +00:00
|
|
|
#ifdef __MWERKS__
|
2022-11-10 06:50:18 +00:00
|
|
|
#pragma cpp_extensions reset
|
2024-09-22 22:58:50 +00:00
|
|
|
#endif
|
|
|
|
|
2022-10-09 05:13:17 +00:00
|
|
|
#endif // _CCAMERAMANAGER
|