mirror of https://github.com/AxioDL/metaforce.git
CCameraManager imps
This commit is contained in:
parent
5bbfd3bec9
commit
d733dce1cf
|
@ -9,6 +9,7 @@ namespace DataSpec
|
|||
struct ITweakGame : BigYAML
|
||||
{
|
||||
virtual const std::string& GetWorldPrefix() const=0;
|
||||
virtual float GetFirstPersonFOV() const =0;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -9,24 +9,28 @@ namespace DataSpec
|
|||
|
||||
struct ITweakPlayer : BigYAML
|
||||
{
|
||||
virtual float GetX50() const=0;
|
||||
virtual float GetX54() const=0;
|
||||
virtual float GetX58() const=0;
|
||||
virtual float GetX5C() const=0;
|
||||
virtual float GetPlayerHeight() const=0; // x26c
|
||||
virtual float GetPlayerXYHalfExtent() const=0; // x270
|
||||
virtual float GetPlayerSomething1() const=0; // x274
|
||||
virtual float GetPlayerSomething2() const=0; // x278
|
||||
virtual float GetPlayerSomething3() const=0; // x27c
|
||||
virtual float GetPlayerSomething4() const=0; // x134
|
||||
virtual bool GetPlayerSomething5() const=0; // x228_24
|
||||
virtual float GetPlayerSomething6() const=0; // x288
|
||||
virtual float GetPlayerSomething7() const=0; // x28c
|
||||
virtual float GetPlayerSomething8() const=0; // x290
|
||||
virtual float GetPlayerSomething9() const=0; // x294
|
||||
virtual float GetPlayerSomething10() const=0; // x298
|
||||
virtual float GetPlayerSomething11() const=0; // x29c
|
||||
virtual float GetPlayerSomething12() const=0; // x280
|
||||
virtual float GetPlayerSomething13() const=0; // x2b0
|
||||
virtual float GetPlayerSomething14() const=0; // x184
|
||||
virtual float GetPlayerSomething15() const=0; // x138
|
||||
virtual float GetPlayerSomething16() const=0; // x14c
|
||||
virtual bool GetX228_24() const=0; // x228_24
|
||||
virtual float GetX274() const=0; // x274
|
||||
virtual float GetX278() const=0; // x278
|
||||
virtual float GetX27C() const=0; // x27c
|
||||
virtual float GetX124() const=0; // x134
|
||||
virtual float GetX288() const=0; // x288
|
||||
virtual float GetX28c() const=0; // x28c
|
||||
virtual float GetX290() const=0; // x290
|
||||
virtual float GetX294() const=0; // x294
|
||||
virtual float GetX298() const=0; // x298
|
||||
virtual float GetX29C() const=0; // x29c
|
||||
virtual float GetX280() const=0; // x280
|
||||
virtual float GetX2B0() const=0; // x2b0
|
||||
virtual float GetX184() const=0; // x184
|
||||
virtual float GetX138() const=0; // x138
|
||||
virtual float GetX14C() const=0; // x14c
|
||||
virtual float GetLeftLogicalThreshold() const=0;
|
||||
virtual float GetRightLogicalThreshold() const=0;
|
||||
};
|
||||
|
|
|
@ -36,6 +36,7 @@ struct CTweakGame : ITweakGame
|
|||
Value<float> x68_hardmodeWeaponMult;
|
||||
|
||||
virtual const std::string& GetWorldPrefix() const { return x4_worldPrefix; }
|
||||
virtual float GetFirstPersonFOV() const { return x24_fov; }
|
||||
CTweakGame(athena::io::IStreamReader& in) { this->read(in); x2b_unknown4 = false; }
|
||||
};
|
||||
}
|
||||
|
|
|
@ -175,24 +175,28 @@ struct CTweakPlayer : ITweakPlayer
|
|||
Value<float> x300_;
|
||||
Value<float> x304_;
|
||||
Value<float> x308_;
|
||||
float GetX50() const { return x44_[3]; }
|
||||
float GetX54() const { return x44_[4]; }
|
||||
float GetX58() const { return x44_[5]; }
|
||||
float GetX5C() const { return x44_[6]; }
|
||||
float GetPlayerHeight() const { return x26c_playerHeight; }
|
||||
float GetPlayerXYHalfExtent() const { return x270_playerXYHalfExtent; }
|
||||
float GetPlayerSomething1() const { return x274_; }
|
||||
float GetPlayerSomething2() const { return x278_; }
|
||||
float GetPlayerSomething3() const { return x27c_; }
|
||||
float GetPlayerSomething4() const { return x134_; }
|
||||
bool GetPlayerSomething5() const { return x228_24_; }
|
||||
float GetPlayerSomething6() const { return x288_; }
|
||||
float GetPlayerSomething7() const { return x28c_; }
|
||||
float GetPlayerSomething8() const { return x290_; }
|
||||
float GetPlayerSomething9() const { return x294_; }
|
||||
float GetPlayerSomething10() const { return x298_; }
|
||||
float GetPlayerSomething11() const { return x29c_; }
|
||||
float GetPlayerSomething12() const { return x280_; }
|
||||
float GetPlayerSomething13() const { return x2b0_; }
|
||||
float GetPlayerSomething14() const { return x184_; }
|
||||
float GetPlayerSomething15() const { return x138_; }
|
||||
float GetPlayerSomething16() const { return x14c_; }
|
||||
float GetX274() const { return x274_; }
|
||||
float GetX278() const { return x278_; }
|
||||
float GetX27C() const { return x27c_; }
|
||||
float GetX124() const { return x134_; }
|
||||
bool GetX228_24() const { return x228_24_; }
|
||||
float GetX288() const { return x288_; }
|
||||
float GetX28c() const { return x28c_; }
|
||||
float GetX290() const { return x290_; }
|
||||
float GetX294() const { return x294_; }
|
||||
float GetX298() const { return x298_; }
|
||||
float GetX29C() const { return x29c_; }
|
||||
float GetX280() const { return x280_; }
|
||||
float GetX2B0() const { return x2b0_; }
|
||||
float GetX184() const { return x184_; }
|
||||
float GetX138() const { return x138_; }
|
||||
float GetX14C() const { return x14c_; }
|
||||
float GetLeftLogicalThreshold() const {return x150_leftDiv;}
|
||||
float GetRightLogicalThreshold() const {return x154_rightDiv;}
|
||||
CTweakPlayer() = default;
|
||||
|
|
|
@ -624,9 +624,9 @@ void CStateManager::CreateStandardGameObjects()
|
|||
{
|
||||
float height = g_tweakPlayer->GetPlayerHeight();
|
||||
float xyHe = g_tweakPlayer->GetPlayerXYHalfExtent();
|
||||
float unk1 = g_tweakPlayer->GetPlayerSomething1();
|
||||
float unk2 = g_tweakPlayer->GetPlayerSomething2();
|
||||
float unk3 = g_tweakPlayer->GetPlayerSomething3();
|
||||
float unk1 = g_tweakPlayer->GetX274();
|
||||
float unk2 = g_tweakPlayer->GetX278();
|
||||
float unk3 = g_tweakPlayer->GetX27C();
|
||||
zeus::CAABox pBounds = {{-xyHe, -xyHe, 0.f}, {xyHe, xyHe, height}};
|
||||
auto q = zeus::CQuaternion::fromAxisAngle(zeus::CVector3f{0.f, 0.f, 1.f}, zeus::degToRad(129.6f));
|
||||
x84c_player.reset(new CPlayer(AllocateUniqueId(), zeus::CTransform(q), pBounds, 0,
|
||||
|
|
|
@ -7,14 +7,25 @@
|
|||
#include "Input/CRumbleManager.hpp"
|
||||
#include "World/CScriptWater.hpp"
|
||||
#include "World/CPlayer.hpp"
|
||||
|
||||
#include "World/CScriptWater.hpp"
|
||||
#include "CPlayerState.hpp"
|
||||
#include "GameGlobalObjects.hpp"
|
||||
#include "Graphics/CGraphics.hpp"
|
||||
#include "CObjectList.hpp"
|
||||
namespace urde
|
||||
{
|
||||
float CCameraManager::sAspect = 1.42f;
|
||||
float CCameraManager::sFarPlane = 750.f;
|
||||
float CCameraManager::sNearPlane = 0.2f;
|
||||
float CCameraManager::sFirstPersonFOV = 55.f;
|
||||
float CCameraManager::sThirdPersonFOV = 60.f;
|
||||
|
||||
CCameraManager::CCameraManager(TUniqueId curCameraId) : x0_curCameraId(curCameraId)
|
||||
{
|
||||
CSfxManager::AddListener(CSfxManager::ESfxChannels::One, zeus::CVector3f::skZero, zeus::CVector3f::skZero,
|
||||
{1.f, 0.f, 0.f}, {0.f, 0.f, 1.f}, 50.f, 50.f, 1000.f, 1, 0x7f);
|
||||
sAspect = float(gViewport.x8_width / gViewport.xc_height);
|
||||
sFirstPersonFOV = g_tweakGame->GetFirstPersonFOV();
|
||||
}
|
||||
|
||||
zeus::CVector3f CCameraManager::GetGlobalCameraTranslation(const CStateManager& stateMgr) const
|
||||
|
@ -61,6 +72,13 @@ void CCameraManager::SetInsideFluid(bool val, TUniqueId fluidId)
|
|||
|
||||
void CCameraManager::Update(float dt, CStateManager& stateMgr)
|
||||
{
|
||||
sub800097AC(dt, stateMgr);
|
||||
ThinkCameras(dt, stateMgr);
|
||||
UpdateListener(stateMgr);
|
||||
UpdateRumble(dt, stateMgr);
|
||||
UpdateFog(dt, stateMgr);
|
||||
|
||||
#if 0
|
||||
const CGameCamera* camera = GetCurrentCamera(stateMgr);
|
||||
zeus::CVector3f heading = camera->GetTransform().basis * zeus::CVector3f{0.f, 1.f, 0.f};
|
||||
CSfxManager::UpdateListener(camera->GetTransform().origin, zeus::CVector3f::skZero, heading, {0.f, 0.f, 1.f}, 0x7f);
|
||||
|
@ -79,15 +97,15 @@ void CCameraManager::Update(float dt, CStateManager& stateMgr)
|
|||
|
||||
if (x18_shakers.size())
|
||||
{
|
||||
if (!x86_25_rumbling || x86_24_)
|
||||
if (!xa0_25_rumbling || xa0_24_)
|
||||
{
|
||||
stateMgr.GetRumbleManager().Rumble(ERumbleFxId::Seven, stateMgr, ERumblePriority::Two);
|
||||
x86_25_rumbling = true;
|
||||
xa0_25_rumbling = true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
x86_25_rumbling = false;
|
||||
xa0_25_rumbling = false;
|
||||
if (x84_rumbleId != -1)
|
||||
{
|
||||
stateMgr.GetRumbleManager().StopRumble(x84_rumbleId);
|
||||
|
@ -107,16 +125,17 @@ void CCameraManager::Update(float dt, CStateManager& stateMgr)
|
|||
stateMgr.GetCameraFilterPass(4).SetFilter(CCameraFilterPass::EFilterType::Multiply,
|
||||
CCameraFilterPass::EFilterShape::Fullscreen, 0.f, tmpColor, -1);
|
||||
}
|
||||
x86_26_inWater = true;
|
||||
xa0_26_inWater = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
x86_26_inWater = false;
|
||||
xa0_26_inWater = false;
|
||||
x3c_fog.DisableFog();
|
||||
stateMgr.GetCameraFilterPass(4).DisableFilter(dt);
|
||||
}
|
||||
|
||||
x3c_fog.Update(dt);
|
||||
#endif
|
||||
}
|
||||
|
||||
CGameCamera* CCameraManager::GetCurrentCamera(CStateManager& stateMgr) const
|
||||
|
@ -138,6 +157,61 @@ float CCameraManager::sub80009148() const
|
|||
1.f);
|
||||
}
|
||||
|
||||
void CCameraManager::sub800097AC(float, CStateManager& mgr)
|
||||
{
|
||||
}
|
||||
|
||||
void CCameraManager::ThinkCameras(float dt, CStateManager& mgr)
|
||||
{
|
||||
CGameCameraList gcList = mgr.GetCameraObjectList();
|
||||
|
||||
for (CEntity* ent : gcList)
|
||||
{
|
||||
CGameCamera* gc = dynamic_cast<CGameCamera*>(ent);
|
||||
if (gc)
|
||||
{
|
||||
gc->Think(dt, mgr);
|
||||
gc->UpdatePerspective(dt);
|
||||
}
|
||||
}
|
||||
|
||||
if (IsInCinematicCamera())
|
||||
return;
|
||||
|
||||
TUniqueId camId = GetLastCameraId();
|
||||
const CGameCamera* cam = dynamic_cast<const CGameCamera*>(mgr.GetObjectById(camId));
|
||||
|
||||
if (cam)
|
||||
x3bc_curFov = cam->GetFov();
|
||||
}
|
||||
|
||||
void CCameraManager::UpdateFog(float, CStateManager&)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CCameraManager::UpdateRumble(float, CStateManager&)
|
||||
{
|
||||
}
|
||||
|
||||
void CCameraManager::UpdateListener(CStateManager& mgr)
|
||||
{
|
||||
const zeus::CTransform xf = GetCurrentCameraTransform(mgr);
|
||||
CSfxManager::UpdateListener(xf.origin, zeus::CVector3f::skZero, xf.frontVector(), xf.upVector(), 127);
|
||||
}
|
||||
|
||||
float CCameraManager::CalculateFogDensity(CStateManager& mgr, const CScriptWater* water)
|
||||
{
|
||||
float f31 = 1.f /* 1.f - water->x1b4_->x40_; */;
|
||||
float f1 = 0;
|
||||
if (mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::GravitySuit))
|
||||
f1 = (g_tweakPlayer->GetX54() * g_tweakPlayer->GetX50()) + f31;
|
||||
else
|
||||
f1 = (g_tweakPlayer->GetX5C() * g_tweakPlayer->GetX58()) + f31;
|
||||
|
||||
return f1 * x94_;
|
||||
}
|
||||
|
||||
void CCameraManager::ResetCameras(CStateManager& mgr)
|
||||
{
|
||||
zeus::CTransform xf = mgr.GetPlayer().CreateTransformFromMovementDirection();
|
||||
|
|
|
@ -12,9 +12,15 @@ class CBallCamera;
|
|||
class CStateManager;
|
||||
class CGameCamera;
|
||||
class CCameraShakeData;
|
||||
class CScriptWater;
|
||||
|
||||
class CCameraManager
|
||||
{
|
||||
static float sAspect;
|
||||
static float sFarPlane;
|
||||
static float sNearPlane;
|
||||
static float sFirstPersonFOV;
|
||||
static float sThirdPersonFOV;
|
||||
TUniqueId x0_curCameraId;
|
||||
std::vector<TUniqueId> x4_cineCameras;
|
||||
std::list<CCameraShakeData> x18_shakers;
|
||||
|
@ -26,26 +32,44 @@ class CCameraManager
|
|||
CFirstPersonCamera* x7c_fpCamera = nullptr;
|
||||
CBallCamera* x80_ballCamera = nullptr;
|
||||
s16 x84_rumbleId = -1;
|
||||
float x94_;
|
||||
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
bool x86_24_ : 1;
|
||||
bool x86_25_rumbling : 1;
|
||||
bool x86_26_inWater : 1;
|
||||
bool xa0_24_ : 1;
|
||||
bool xa0_25_rumbling : 1;
|
||||
bool xa0_26_inWater : 1;
|
||||
};
|
||||
u8 _dummy = 0;
|
||||
u8 _dummy1 = 0;
|
||||
};
|
||||
|
||||
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);
|
||||
|
||||
static float DefaultAspect() {return 1.42f;}
|
||||
static float DefaultFarPlane() {return 750.0f;}
|
||||
static float DefaultNearPlane() {return 0.2f;}
|
||||
static float DefaultFirstPersonFOV() {return 55.0f;}
|
||||
static float DefaultThirdPersonFOV() {return 60.0f;}
|
||||
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;}
|
||||
|
||||
void ResetCameras(CStateManager& mgr);
|
||||
void SetSpecialCameras(CFirstPersonCamera& fp, CBallCamera& ball);
|
||||
|
@ -66,6 +90,12 @@ public:
|
|||
return x4_cineCameras.back();
|
||||
return x0_curCameraId;
|
||||
}
|
||||
TUniqueId GetLastCameraId() const
|
||||
{
|
||||
if (x4_cineCameras.size())
|
||||
return x4_cineCameras.back();
|
||||
return kInvalidUniqueId;
|
||||
}
|
||||
|
||||
CFirstPersonCamera* GetFirstPersonCamera() { return x7c_fpCamera; }
|
||||
CBallCamera* GetBallCamera() { return x80_ballCamera; }
|
||||
|
@ -73,6 +103,14 @@ public:
|
|||
CGameArea::CAreaFog Fog() { return x3c_fog; }
|
||||
|
||||
float sub80009148() const;
|
||||
|
||||
void sub800097AC(float, CStateManager&);
|
||||
void ThinkCameras(float, CStateManager&);
|
||||
void UpdateFog(float, CStateManager&);
|
||||
void UpdateRumble(float, CStateManager&);
|
||||
void UpdateListener(CStateManager&);
|
||||
|
||||
float CalculateFogDensity(CStateManager&, const CScriptWater*);
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -75,13 +75,13 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
|
|||
if (player->x3dc_)
|
||||
{
|
||||
float angle = player->x3ec_;
|
||||
if (std::fabs(player->x3ec_) > (g_tweakPlayer->GetPlayerSomething4() - std::fabs(x1c0_)))
|
||||
if (std::fabs(player->x3ec_) > (g_tweakPlayer->GetX124() - std::fabs(x1c0_)))
|
||||
angle = (player->x3ec_ > -0.f ? -1.f : 1.f);
|
||||
zeus::CVector3f vec;
|
||||
vec.z = std::sin(angle);
|
||||
vec.y = std::cos(-player->x3e4_) * std::cos(angle);
|
||||
vec.x = std::sin(-player->x3e4_) * std::cos(angle);
|
||||
if (g_tweakPlayer->GetPlayerSomething5() && !zeus::close_enough(vec, zeus::CVector3f::skZero))
|
||||
if (g_tweakPlayer->GetX228_24() && !zeus::close_enough(vec, zeus::CVector3f::skZero))
|
||||
vec.normalize();
|
||||
|
||||
rVec = zeus::CQuaternion::lookAt({0.f, 1.f, 0.f}, rVec, zeus::CRelAngle::FromDegrees(360.f)).transform(vec);
|
||||
|
@ -112,10 +112,10 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
|
|||
{
|
||||
if (player->x294_ > 0.f)
|
||||
{
|
||||
float angle = zeus::clamp(0.f, (player->x294_ - g_tweakPlayer->GetPlayerSomething6()) /
|
||||
g_tweakPlayer->GetPlayerSomething7(),
|
||||
float angle = zeus::clamp(0.f, (player->x294_ - g_tweakPlayer->GetX288()) /
|
||||
g_tweakPlayer->GetX28c(),
|
||||
1.f) *
|
||||
g_tweakPlayer->GetPlayerSomething8();
|
||||
g_tweakPlayer->GetX290();
|
||||
angle += x1c0_;
|
||||
rVec.x = 0.f;
|
||||
rVec.y = std::cos(angle);
|
||||
|
@ -125,10 +125,10 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
|
|||
}
|
||||
else if (player->x29c_ > 0.f)
|
||||
{
|
||||
float angle = zeus::clamp(0.f, (player->x29c_ - g_tweakPlayer->GetPlayerSomething9()) /
|
||||
g_tweakPlayer->GetPlayerSomething10(),
|
||||
float angle = zeus::clamp(0.f, (player->x29c_ - g_tweakPlayer->GetX294()) /
|
||||
g_tweakPlayer->GetX298(),
|
||||
1.f) *
|
||||
g_tweakPlayer->GetPlayerSomething11();
|
||||
g_tweakPlayer->GetX29C();
|
||||
rVec.x = 0.f;
|
||||
rVec.y = std::cos(angle);
|
||||
rVec.z = -std::sin(angle);
|
||||
|
@ -152,7 +152,7 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
|
|||
if (gunFrontVec.canBeNormalized())
|
||||
gunFrontVec.normalize();
|
||||
|
||||
float scaledDt = (dt * g_tweakPlayer->GetPlayerSomething14());
|
||||
float scaledDt = (dt * g_tweakPlayer->GetX184());
|
||||
float angle = gunFrontVec.dot(rVec);
|
||||
if (std::fabs(angle) > 1.f)
|
||||
angle = (angle > -0.f ? -1.f : 1.f);
|
||||
|
@ -183,7 +183,7 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
|
|||
|
||||
/* BUG: This is exactly what the runtime is doing, should we restore the intended behavior? */
|
||||
float angle = gunFrontVec.dot(rVec);
|
||||
float sdt = dt * g_tweakPlayer->GetPlayerSomething13();
|
||||
float sdt = dt * g_tweakPlayer->GetX2B0();
|
||||
|
||||
if (std::fabs(angle) > 1.0f)
|
||||
angle = (angle > -0.f ? -1.f : 1.f);
|
||||
|
@ -194,17 +194,17 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
|
|||
}
|
||||
else if (player->x304_ == 2 || player->x304_ == 3)
|
||||
{
|
||||
dt *= g_tweakPlayer->GetPlayerSomething14();
|
||||
dt *= g_tweakPlayer->GetX184();
|
||||
CalculateGunFollowOrientationAndTransform(gunXf, qGun, dt, rVec);
|
||||
}
|
||||
else if (player->x304_ == 5)
|
||||
{
|
||||
dt *= g_tweakPlayer->GetPlayerSomething13();
|
||||
dt *= g_tweakPlayer->GetX2B0();
|
||||
CalculateGunFollowOrientationAndTransform(gunXf, qGun, dt, rVec);
|
||||
}
|
||||
else
|
||||
{
|
||||
dt *= g_tweakPlayer->GetPlayerSomething12();
|
||||
dt *= g_tweakPlayer->GetX280();
|
||||
CalculateGunFollowOrientationAndTransform(gunXf, qGun, dt, rVec);
|
||||
}
|
||||
}
|
||||
|
@ -227,9 +227,9 @@ void CFirstPersonCamera::UpdateTransform(CStateManager& mgr, float dt)
|
|||
float angle = gunFront.dot(rVec);
|
||||
if (std::fabs(angle) > 1.f)
|
||||
angle = (angle > -0.f ? -1.f : 1.f);
|
||||
float sdt = dt * g_tweakPlayer->GetPlayerSomething15();
|
||||
float sdt = dt * g_tweakPlayer->GetX138();
|
||||
qGun = zeus::CQuaternion::lookAt(
|
||||
rVec, gunFront, sdt * zeus::clamp(0.f, g_tweakPlayer->GetPlayerSomething16() * (std::acos(angle) / sdt), 1.f));
|
||||
rVec, gunFront, sdt * zeus::clamp(0.f, g_tweakPlayer->GetX14C() * (std::acos(angle) / sdt), 1.f));
|
||||
}
|
||||
zeus::CTransform bobXf = player->GetCameraBob()->GetCameraBobTransformation();
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ CGameCamera::CGameCamera(TUniqueId uid, bool active, const std::string& name, co
|
|||
CActorParameters::None(), kInvalidUniqueId)
|
||||
, xe8_watchedObject(uid2)
|
||||
, x12c_(xf)
|
||||
, x15c_fov(fovy)
|
||||
, x15c_currentFov(fovy)
|
||||
, x160_znear(znear)
|
||||
, x164_zfar(zfar)
|
||||
, x168_aspect(aspect)
|
||||
|
@ -21,7 +21,7 @@ CGameCamera::CGameCamera(TUniqueId uid, bool active, const std::string& name, co
|
|||
, x170_24_perspDirty(true)
|
||||
, x170_25_disablesInput(b1)
|
||||
, x180_(fovy)
|
||||
, x184_(fovy)
|
||||
, x184_fov(fovy)
|
||||
{
|
||||
|
||||
xe7_29_ = false;
|
||||
|
@ -54,7 +54,7 @@ zeus::CMatrix4f CGameCamera::GetPerspectiveMatrix() const
|
|||
if (x170_24_perspDirty)
|
||||
{
|
||||
const_cast<CGameCamera*>(this)->xec_perspectiveMatrix =
|
||||
CGraphics::CalculatePerspectiveMatrix(x15c_fov, x168_aspect, x160_znear, x164_zfar, false);
|
||||
CGraphics::CalculatePerspectiveMatrix(x15c_currentFov, x168_aspect, x160_znear, x164_zfar, false);
|
||||
const_cast<CGameCamera*>(this)->x170_24_perspDirty = false;
|
||||
}
|
||||
|
||||
|
@ -108,40 +108,40 @@ float CGameCamera::GetAspectRatio() const { return x168_aspect; }
|
|||
|
||||
TUniqueId CGameCamera::GetWatchedObject() const { return xe8_watchedObject; }
|
||||
|
||||
float CGameCamera::GetFov() const { return x15c_fov; }
|
||||
float CGameCamera::GetFov() const { return x15c_currentFov; }
|
||||
|
||||
void CGameCamera::sub8005AE3C(float f1)
|
||||
void CGameCamera::UpdatePerspective(float dt)
|
||||
{
|
||||
if (x174_ > 0.f)
|
||||
{
|
||||
x174_ -= f1;
|
||||
x174_ -= dt;
|
||||
return;
|
||||
}
|
||||
|
||||
if (x178_ <= 0.f)
|
||||
return;
|
||||
|
||||
x178_ -= f1;
|
||||
x178_ -= dt;
|
||||
if (x178_ > 0.f)
|
||||
{
|
||||
x15c_fov = x184_;
|
||||
x15c_currentFov = x184_fov;
|
||||
x170_24_perspDirty = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
x15c_fov = zeus::clamp(0.f, (f1 / x17c_), 1.f) + ((x180_ - x184_) * x184_);
|
||||
x15c_currentFov = zeus::clamp(0.f, (dt / x17c_), 1.f) + ((x180_ - x184_fov) * x184_fov);
|
||||
x170_24_perspDirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
void CGameCamera::sub8005AF18(float f1, float f2, float f3, float f4)
|
||||
void CGameCamera::sub8005AF18(float f1, float fov, float f3, float f4)
|
||||
{
|
||||
if (f3 < 0.f)
|
||||
{
|
||||
x15c_fov = f2;
|
||||
x15c_currentFov = fov;
|
||||
x170_24_perspDirty = true;
|
||||
x184_ = f2;
|
||||
x184_ = x174_ = 0.f;
|
||||
x184_fov = fov;
|
||||
x178_ = x174_ = 0.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -149,8 +149,8 @@ void CGameCamera::sub8005AF18(float f1, float f2, float f3, float f4)
|
|||
x17c_ = f3;
|
||||
x178_ = f3;
|
||||
x180_ = f1;
|
||||
x184_ = f2;
|
||||
x15c_fov = f1;
|
||||
x184_fov = fov;
|
||||
x15c_currentFov = f1;
|
||||
x170_24_perspDirty = true;
|
||||
}
|
||||
}
|
||||
|
@ -159,7 +159,7 @@ void CGameCamera::sub8005AF88()
|
|||
{
|
||||
if (x178_ > 0)
|
||||
{
|
||||
x15c_fov = x184_;
|
||||
x15c_currentFov = x184_fov;
|
||||
x170_24_perspDirty = true;
|
||||
}
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@ class CGameCamera : public CActor
|
|||
TUniqueId xe8_watchedObject;
|
||||
zeus::CMatrix4f xec_perspectiveMatrix;
|
||||
zeus::CTransform x12c_;
|
||||
float x15c_fov;
|
||||
float x15c_currentFov;
|
||||
float x160_znear;
|
||||
float x164_zfar;
|
||||
float x168_aspect;
|
||||
|
@ -30,7 +30,7 @@ class CGameCamera : public CActor
|
|||
float x178_ = 0.f;
|
||||
float x17c_ = 0.f;
|
||||
float x180_;
|
||||
float x184_;
|
||||
float x184_fov;
|
||||
public:
|
||||
CGameCamera(TUniqueId, bool active, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf,
|
||||
float fov, float nearz, float farz, float aspect, TUniqueId, bool, u32);
|
||||
|
@ -51,7 +51,7 @@ public:
|
|||
float GetFov() const;
|
||||
void GetControllerNumber() const;
|
||||
bool DisablesInput() const;
|
||||
void sub8005AE3C(float);
|
||||
void UpdatePerspective(float);
|
||||
void sub8005AF18(float, float, float, float);
|
||||
void sub8005AF88();
|
||||
};
|
||||
|
|
|
@ -9,10 +9,10 @@ CPathCamera::CPathCamera(TUniqueId uid, const std::string& name, const CEntityIn
|
|||
float, float, float, float, float, float, float, u32,
|
||||
EInitialSplinePosition)
|
||||
: CGameCamera(uid, active, name, info, xf,
|
||||
CCameraManager::DefaultThirdPersonFOV(),
|
||||
CCameraManager::DefaultNearPlane(),
|
||||
CCameraManager::DefaultFarPlane(),
|
||||
CCameraManager::DefaultAspect(), kInvalidUniqueId, 0, 0)
|
||||
CCameraManager::ThirdPersonFOV(),
|
||||
CCameraManager::NearPlane(),
|
||||
CCameraManager::FarPlane(),
|
||||
CCameraManager::Aspect(), kInvalidUniqueId, 0, 0)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ zeus::CVector2i CGraphics::g_ViewportResolutionHalf;
|
|||
SClipScreenRect CGraphics::g_CroppedViewport;
|
||||
int CGraphics::g_ViewportSamples = 1;
|
||||
bool CGraphics::g_IsGXModelMatrixIdentity = true;
|
||||
SViewport gViewport = {0, 0, 640, 480, 640 / 2.f, 480 / 2.f};
|
||||
|
||||
void CGraphics::DisableAllLights()
|
||||
{
|
||||
|
|
|
@ -139,6 +139,18 @@ enum class ERglFogMode
|
|||
OrthoRevExp2 = 0x0F
|
||||
};
|
||||
|
||||
struct SViewport
|
||||
{
|
||||
u32 x0_left;
|
||||
u32 x4_top;
|
||||
u32 x8_width;
|
||||
u32 xc_height;
|
||||
float x10_halfWidth;
|
||||
float x14_halfHeight;
|
||||
};
|
||||
|
||||
extern SViewport gViewport;
|
||||
|
||||
struct SClipScreenRect
|
||||
{
|
||||
bool x0_valid = false;
|
||||
|
|
|
@ -151,6 +151,16 @@ void CActor::RemoveEmitter()
|
|||
}
|
||||
}
|
||||
|
||||
const zeus::CTransform CActor::GetScaledLocatorTransform(const std::string& segName) const
|
||||
{
|
||||
return x64_modelData->GetScaledLocatorTransform(segName);
|
||||
}
|
||||
|
||||
const zeus::CTransform CActor::GetLocatorTransform(const std::string& segName) const
|
||||
{
|
||||
return x64_modelData->GetLocatorTransform(segName);
|
||||
}
|
||||
|
||||
EWeaponCollisionResponseTypes CActor::GetCollisionResponseType(const zeus::CVector3f&,
|
||||
const zeus::CVector3f&, CWeaponMode&, int)
|
||||
{
|
||||
|
@ -301,4 +311,14 @@ void CActor::SetTranslation(const zeus::CVector3f &tr)
|
|||
xe4_29_ = true;
|
||||
}
|
||||
|
||||
float CActor::GetPitch() const
|
||||
{
|
||||
return zeus::CQuaternion(x34_transform.buildMatrix3f()).pitch();
|
||||
}
|
||||
|
||||
float CActor::GetYaw() const
|
||||
{
|
||||
return zeus::CQuaternion(x34_transform.buildMatrix3f()).yaw();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -117,7 +117,8 @@ public:
|
|||
|
||||
void RemoveEmitter();
|
||||
const zeus::CTransform& GetTransform() const {return x34_transform;}
|
||||
|
||||
const zeus::CTransform GetScaledLocatorTransform(const std::string& segName) const;
|
||||
const zeus::CTransform GetLocatorTransform(const std::string& segName) const;
|
||||
void RemoveMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&);
|
||||
void RemoveMaterial(EMaterialTypes, EMaterialTypes, EMaterialTypes, CStateManager&);
|
||||
void RemoveMaterial(EMaterialTypes, EMaterialTypes, CStateManager&);
|
||||
|
@ -139,6 +140,9 @@ public:
|
|||
const CSfxHandle* GetSfxHandle() const;
|
||||
void SetSfxPitchBend(s32);
|
||||
void SetTranslation(const zeus::CVector3f& tr);
|
||||
|
||||
float GetPitch() const;
|
||||
float GetYaw() const;
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
@ -222,10 +222,10 @@ void CWorldTransManager::DrawEnabled()
|
|||
{
|
||||
float wsAspect = CWideScreenFilter::SetViewportToMatch(1.f);
|
||||
|
||||
g_Renderer->SetPerspective(CCameraManager::DefaultFirstPersonFOV(),
|
||||
g_Renderer->SetPerspective(CCameraManager::FirstPersonFOV(),
|
||||
wsAspect,
|
||||
CCameraManager::DefaultNearPlane(),
|
||||
CCameraManager::DefaultFarPlane());
|
||||
CCameraManager::NearPlane(),
|
||||
CCameraManager::FarPlane());
|
||||
g_Renderer->x318_26_ = true;
|
||||
|
||||
if (x0_curTime <= x4_modelData->x1d0_dissolveStartTime)
|
||||
|
|
|
@ -742,8 +742,8 @@ CEntity* ScriptLoader::LoadCamera(CStateManager& mgr, CInputStream& in, int prop
|
|||
u32 flags = b2 | b3 << 1 | b4 << 2 | b5 << 3 | b6 << 4 | b7 << 5 | b8 << 6 | b9 << 8;
|
||||
|
||||
return new CCinematicCamera(mgr.AllocateUniqueId(), head.x0_name, info, head.x10_transform, b1, f1,
|
||||
f2 / CCameraManager::DefaultAspect(), CCameraManager::DefaultNearPlane(),
|
||||
CCameraManager::DefaultFarPlane(), CCameraManager::DefaultAspect(), flags);
|
||||
f2 / CCameraManager::Aspect(), CCameraManager::NearPlane(),
|
||||
CCameraManager::FarPlane(), CCameraManager::Aspect(), flags);
|
||||
}
|
||||
|
||||
CEntity* ScriptLoader::LoadCameraWaypoint(CStateManager& mgr, CInputStream& in, int propCount, const CEntityInfo& info)
|
||||
|
|
Loading…
Reference in New Issue