metaforce/Runtime/Camera/CCameraManager.hpp

121 lines
3.5 KiB
C++
Raw Normal View History

#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"
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;
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;
std::vector<TUniqueId> x4_cineCameras;
2016-04-16 23:48:29 +00:00
std::list<CCameraShakeData> x18_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;
2016-10-31 22:56:44 +00:00
float x94_;
2016-04-17 02:50:45 +00:00
union
{
struct
{
2016-10-31 22:56:44 +00:00
bool xa0_24_ : 1;
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
};
2016-10-31 22:56:44 +00:00
TUniqueId xa2_ = kInvalidUniqueId;
TUniqueId xa4_ = kInvalidUniqueId;
TUniqueId xa6_ = kInvalidUniqueId;
u32 xa8_ = 1000;
u32 xac_ = 0;
union
{
struct
{
bool x3b8_24_ : 1;
bool x3b8_25_ : 1;
};
u8 _dummy2;
};
float x3bc_curFov = 60.f;
public:
CCameraManager(TUniqueId curCameraId=kInvalidUniqueId);
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
void ResetCameras(CStateManager& mgr);
2016-10-15 19:18:50 +00:00
void SetSpecialCameras(CFirstPersonCamera& fp, CBallCamera& ball);
bool IsInCinematicCamera() const {return x4_cineCameras.size() != 0;}
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);
int AddCameraShaker(const CCameraShakeData& data);
void AddCinemaCamera(TUniqueId, CStateManager& stateMgr);
void SetInsideFluid(bool, TUniqueId);
void Update(float dt, CStateManager& stateMgr);
2017-02-13 00:00:07 +00:00
CEntity* GetCurrentCamera(CStateManager& stateMgr) const;
const CEntity* GetCurrentCamera(const CStateManager& stateMgr) const;
2016-04-17 02:50:45 +00:00
void SetCurrentCameraId(TUniqueId id, CStateManager& stateMgr) {x0_curCameraId = id;}
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; }
2016-10-15 19:18:50 +00:00
CBallCamera* BallCamera(CStateManager&) const;
CGameArea::CAreaFog Fog() { return x3c_fog; }
2016-09-16 00:56:46 +00:00
float sub80009148() const;
2016-10-31 22:56:44 +00:00
void sub800097AC(float, CStateManager&);
void ThinkCameras(float, CStateManager&);
void UpdateFog(float, CStateManager&);
void UpdateRumble(float, CStateManager&);
void UpdateListener(CStateManager&);
float CalculateFogDensity(CStateManager&, const CScriptWater*);
};
}
#endif // __URDE_CCAMERAMANAGER_HPP__