Restore CCameraManager::GetCurrentCamera's proper behavior (AKA, I'm an idiot)

This commit is contained in:
Phillip Stephens 2017-03-05 09:54:00 -08:00
parent d78feb1196
commit fe72458f48
6 changed files with 26 additions and 9 deletions

View File

@ -142,16 +142,16 @@ void CCameraManager::Update(float dt, CStateManager& stateMgr)
#endif
}
CEntity* CCameraManager::GetCurrentCamera(CStateManager& stateMgr) const
CGameCamera* CCameraManager::GetCurrentCamera(CStateManager& stateMgr) const
{
CObjectList* camList = stateMgr.ObjectListById(EGameObjectList::GameCamera);
return camList->GetObjectById(GetCurrentCameraId());
return static_cast<CGameCamera*>(camList->GetObjectById(GetCurrentCameraId()));
}
const CEntity* CCameraManager::GetCurrentCamera(const CStateManager& stateMgr) const
const CGameCamera* CCameraManager::GetCurrentCamera(const CStateManager& stateMgr) const
{
const CObjectList* camList = stateMgr.GetObjectListById(EGameObjectList::GameCamera);
return camList->GetObjectById(GetCurrentCameraId());
return static_cast<const CGameCamera*>(camList->GetObjectById(GetCurrentCameraId()));
}
void CCameraManager::SkipCinematic(CStateManager& stateMgr)

View File

@ -81,8 +81,8 @@ public:
void AddCinemaCamera(TUniqueId, CStateManager& stateMgr);
void SetInsideFluid(bool, TUniqueId);
void Update(float dt, CStateManager& stateMgr);
CEntity* GetCurrentCamera(CStateManager& stateMgr) const;
const CEntity* GetCurrentCamera(const CStateManager& stateMgr) const;
CGameCamera* GetCurrentCamera(CStateManager& stateMgr) const;
const CGameCamera* GetCurrentCamera(const CStateManager& stateMgr) const;
void SetCurrentCameraId(TUniqueId id, CStateManager& stateMgr) {x0_curCameraId = id;}
TUniqueId GetCurrentCameraId() const
{

View File

@ -82,7 +82,21 @@ void CCollisionActor::SetDamageVulnerability(const CDamageVulnerability& vuln) {
zeus::CVector3f CCollisionActor::GetScanObjectIndicatorPosition(const CStateManager& mgr)
{
const CGameCamera* gameCamera = static_cast<const CGameCamera*>(mgr.GetCameraManager()->GetCurrentCamera(mgr));
return {};
float scanScale;
if (x258_primitiveType == EPrimitiveType::Sphere)
scanScale = GetSphereRadius();
else
{
const zeus::CVector3f v = GetBoxSize();
float comp = (v.x < v.y ? v.y : v.z);
comp = (comp < v.z ? v.x : comp);
scanScale = 0.5f * comp;
}
scanScale *= 3.0f;
zeus::CVector3f orbitPos = GetOrbitPosition(mgr);
return (scanScale * (orbitPos - gameCamera->GetTransform().origin).normalized()) - orbitPos;
}
const CCollisionPrimitive* CCollisionActor::GetCollisionPrimitive() const

View File

@ -56,6 +56,7 @@ public:
TUniqueId GetLastTouchedObject() const { return x2fc_lastTouched; }
zeus::CVector3f GetScanObjectIndicatorPosition(const CStateManager &);
void SetExtendedTouchBounds(const zeus::CVector3f& boundExt) { x304_extendedTouchBounds = boundExt; }
float GetSphereRadius() const { return x288_sphereRadius; }
};
}

View File

@ -1,5 +1,6 @@
#include "CCompoundTargetReticle.hpp"
#include "GameGlobalObjects.hpp"
#include "Camera/CGameCamera.hpp"
#include "CSimplePool.hpp"
#include "Graphics/CModel.hpp"
#include "CStateManager.hpp"
@ -23,8 +24,8 @@ CTargetReticleRenderState::CTargetReticleRenderState(TUniqueId target, float f1,
}
CCompoundTargetReticle::CCompoundTargetReticle(const CStateManager& mgr)
: x0_(static_cast<const CActor*>(mgr.GetCameraManager()->GetCurrentCamera(mgr))->GetTransform().buildMatrix3f())
, x10_(static_cast<const CActor*>(mgr.GetCameraManager()->GetCurrentCamera(mgr))->GetTransform().buildMatrix3f())
: x0_(mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTransform().buildMatrix3f())
, x10_(mgr.GetCameraManager()->GetCurrentCamera(mgr)->GetTransform().buildMatrix3f())
, x2c_overshootOffsetHalf(0.5f * g_tweakTargeting->GetOvershootOffset())
, x30_premultOvershootOffset(calculate_premultiplied_overshoot_offset(g_tweakTargeting->GetOvershootOffset()))
, x34_crosshairs(g_SimplePool->GetObj(skCrosshairsReticleAssetName))

View File

@ -1,6 +1,7 @@
#include "CScriptActor.hpp"
#include "CStateManager.hpp"
#include "CScriptTrigger.hpp"
#include "Camera/CGameCamera.hpp"
#include "CDamageVulnerability.hpp"
#include "CPlayerState.hpp"
#include "CScriptColorModulate.hpp"