CCameraManager fixes

This commit is contained in:
Phillip Stephens
2026-01-16 01:51:56 -08:00
parent fc850bdfad
commit 9384291de3
15 changed files with 135 additions and 98 deletions
+8 -10
View File
@@ -184,7 +184,7 @@ __ct__14CCameraManagerF9TUniqueId = .text:0x8000C0E0; // type:function size:0x1D
Clamp<f>__5CMathFRCfRCfRCf = .text:0x8000C2B4; // type:function size:0x2C scope:global
sort<PQ24rstl18pair<i,9TUniqueId>,Q24rstl63pair_sorter_finder<Q24rstl18pair<i,9TUniqueId>,Q24rstl7less<i>>>__4rstlFPQ24rstl18pair<i,9TUniqueId>PQ24rstl18pair<i,9TUniqueId>Q24rstl63pair_sorter_finder<Q24rstl18pair<i,9TUniqueId>,Q24rstl7less<i>> = .text:0x8000C2E0; // type:function size:0x128
reserve__Q24rstl45vector<9TUniqueId,Q24rstl17rmemory_allocator>Fi = .text:0x8000C408; // type:function size:0xEC scope:global
erase__Q24rstl51list<16CCameraShakeData,Q24rstl17rmemory_allocator>FRCQ34rstl51list<16CCameraShakeData,Q24rstl17rmemory_allocator>8iterator = .text:0x8000C4F4; // type:function size:0xC0 scope:global
do_erase__Q24rstl51list<16CCameraShakeData,Q24rstl17rmemory_allocator>FPQ34rstl51list<16CCameraShakeData,Q24rstl17rmemory_allocator>4node = .text:0x8000C4F4; // type:function size:0xC0 scope:global
__dt__Q24rstl51list<16CCameraShakeData,Q24rstl17rmemory_allocator>Fv = .text:0x8000C5B4; // type:function size:0xC0
__insertion_sort<PQ24rstl18pair<i,9TUniqueId>,Q24rstl63pair_sorter_finder<Q24rstl18pair<i,9TUniqueId>,Q24rstl7less<i>>>__4rstlFPQ24rstl18pair<i,9TUniqueId>PQ24rstl18pair<i,9TUniqueId>Q24rstl63pair_sorter_finder<Q24rstl18pair<i,9TUniqueId>,Q24rstl7less<i>> = .text:0x8000C674; // type:function size:0x84
__sort3<Q24rstl18pair<i,9TUniqueId>,Q24rstl63pair_sorter_finder<Q24rstl18pair<i,9TUniqueId>,Q24rstl7less<i>>>__4rstlFRQ24rstl18pair<i,9TUniqueId>RQ24rstl18pair<i,9TUniqueId>RQ24rstl18pair<i,9TUniqueId>Q24rstl63pair_sorter_finder<Q24rstl18pair<i,9TUniqueId>,Q24rstl7less<i>> = .text:0x8000C6F8; // type:function size:0x90
@@ -1933,7 +1933,7 @@ SetState__11CBallCameraFQ211CBallCamera16EBallCameraStateR13CStateManager = .tex
Think__11CBallCameraFfR13CStateManager = .text:0x80082E20; // type:function size:0x2D4 scope:global
DoorClosed__11CBallCameraF9TUniqueId = .text:0x800830F4; // type:function size:0x24 scope:global
DoorClosing__11CBallCameraF9TUniqueId = .text:0x80083118; // type:function size:0x24 scope:global
IsBallNearDoor__11CBallCameraCFRC9CVector3fR13CStateManager = .text:0x8008313C; // type:function size:0x21C scope:global
CheckDoorProximity__11CBallCameraFRC9CVector3fRC13CStateManager = .text:0x8008313C; // type:function size:0x21C scope:global
CheckFailSafe__11CBallCameraFfR13CStateManager = .text:0x80083358; // type:function size:0x5EC scope:global
ActivateFailSafe__11CBallCameraFfR13CStateManager = .text:0x80083944; // type:function size:0x120 scope:global
UpdateLookAtPosition__11CBallCameraFfR13CStateManager = .text:0x80083A64; // type:function size:0x594 scope:global
@@ -6925,11 +6925,11 @@ Render__11CPathCameraCFRC13CStateManager = .text:0x8012D9A4; // type:function si
Accept__11CPathCameraFR8IVisitor = .text:0x8012D9A8; // type:function size:0x38 scope:global
ProcessInput__11CPathCameraFRC11CFinalInputR13CStateManager = .text:0x8012D9E0; // type:function size:0x4 scope:global
Think__11CPathCameraFfR13CStateManager = .text:0x8012D9E4; // type:function size:0x358 scope:global
ClampToClosedDoor__11CPathCameraFR13CStateManager = .text:0x8012DD3C; // type:function size:0xF4 scope:global
AvoidDoorCollisions__11CPathCameraFR13CStateManager = .text:0x8012DD3C; // type:function size:0xF4 scope:global
MoveAlongSpline__11CPathCameraFfR13CStateManager = .text:0x8012DE30; // type:function size:0x3D8 scope:global
Reset__11CPathCameraFRC12CTransform4fR13CStateManager = .text:0x8012E208; // type:function size:0x4A0 scope:global
__dt__11CPathCameraFv = .text:0x8012E6A8; // type:function size:0x70 scope:global
__ct__11CPathCameraF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fbfffffUlQ211CPathCamera22EInitialSplinePosition = .text:0x8012E718; // type:function size:0x17C scope:global
__ct__11CPathCameraF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fbfffffUiQ211CPathCamera22EInitialSplinePosition = .text:0x8012E718; // type:function size:0x17C scope:global
__sinit_CPathCamera_cpp = .text:0x8012E894; // type:function size:0x78 scope:local
Render__11CFluidPlaneFRC13CStateManagerRC6CAABoxRC14CFrustumPlanesRC14CRippleManagerRC9CVector3f = .text:0x8012E90C; // type:function size:0x4
AddRipple__11CFluidPlaneFRC7CRippleRC12CScriptWaterR13CStateManager = .text:0x8012E910; // type:function size:0x54 scope:global
@@ -18406,7 +18406,7 @@ __vt__11CBCCoverCmd = .data:0x803E0B8C; // type:object size:0xC scope:global
__vt__14CBCWallHangCmd = .data:0x803E0B98; // type:object size:0x48 scope:global
lbl_803E0BE0 = .data:0x803E0BE0; // type:object size:0x18
__vt__17CScriptCoverPoint = .data:0x803E0BF8; // type:object size:0x6C scope:global
__vt__11CPathCamera = .data:0x803E0C68; // type:object size:0x78
__vt__11CPathCamera = .data:0x803E0C68; // type:object size:0x74
__vt__11CFluidPlane = .data:0x803E0CE0; // type:object size:0x20
__vt__19CScriptGrapplePoint = .data:0x803E0D00; // type:object size:0x6C scope:global
__vt__19CHUDBillboardEffect = .data:0x803E0D70; // type:object size:0x6C scope:global
@@ -19321,7 +19321,7 @@ lbl_8046C558 = .bss:0x8046C558; // type:object size:0xC
lbl_8046C564 = .bss:0x8046C564; // type:object size:0xC
lbl_8046C570 = .bss:0x8046C570; // type:object size:0xA8
lbl_8046C618 = .bss:0x8046C618; // type:object size:0x108
lbl_8046C720 = .bss:0x8046C720; // type:object size:0x18 data:4byte
kLineOfSightFilter = .bss:0x8046C720; // type:object size:0x18 data:4byte
result$468 = .bss:0x8046C738; // type:object size:0xC scope:local align:4 data:float
lbl_8046C748 = .bss:0x8046C748; // type:object size:0x10
lbl_8046C758 = .bss:0x8046C758; // type:object size:0x18 data:4byte
@@ -21818,10 +21818,8 @@ kInvalidAreaId = .sbss:0x805A8F50; // type:object size:0x4 scope:global data:4by
kUnkId = .sbss:0x805A8F54; // type:object size:0x4 scope:local data:4byte
lbl_805A8F58 = .sbss:0x805A8F58; // type:object size:0x1 data:byte
lbl_805A8F5C = .sbss:0x805A8F5C; // type:object size:0x4
lbl_805A8F60 = .sbss:0x805A8F60; // type:object size:0x4 data:4byte
lbl_805A8F64 = .sbss:0x805A8F64; // type:object size:0x4 data:4byte
lbl_805A8F68 = .sbss:0x805A8F68; // type:object size:0x4 data:4byte
lbl_805A8F6C = .sbss:0x805A8F6C; // type:object size:0x4 data:4byte
kLineOfSightIncludeList = .sbss:0x805A8F60; // type:object size:0x8 data:8byte
kLineOfSightExcludeList = .sbss:0x805A8F68; // type:object size:0x8 data:8byte
g_BillboardCount__19CHUDBillboardEffect = .sbss:0x805A8F70; // type:object size:0x4 scope:global data:4byte
g_IndirectTexturedBillboardCount__19CHUDBillboardEffect = .sbss:0x805A8F74; // type:object size:0x4 scope:global data:4byte
init$469 = .sbss:0x805A8F78; // type:object size:0x1 scope:local data:byte
+4 -4
View File
@@ -184,7 +184,7 @@ __ct__14CCameraManagerF9TUniqueId = .text:0x8000C15C; // type:function size:0x1D
Clamp<f>__5CMathFRCfRCfRCf = .text:0x8000C330; // type:function size:0x2C scope:weak
sort<PQ24rstl18pair<i,9TUniqueId>,Q24rstl63pair_sorter_finder<Q24rstl18pair<i,9TUniqueId>,Q24rstl7less<i>>>__4rstlFPQ24rstl18pair<i,9TUniqueId>PQ24rstl18pair<i,9TUniqueId>Q24rstl63pair_sorter_finder<Q24rstl18pair<i,9TUniqueId>,Q24rstl7less<i>> = .text:0x8000C35C; // type:function size:0x128 scope:global
reserve__Q24rstl45vector<9TUniqueId,Q24rstl17rmemory_allocator>Fi = .text:0x8000C484; // type:function size:0xEC scope:global
erase__Q24rstl51list<16CCameraShakeData,Q24rstl17rmemory_allocator>FRCQ34rstl51list<16CCameraShakeData,Q24rstl17rmemory_allocator>8iterator = .text:0x8000C570; // type:function size:0xC0 scope:global
do_erase__Q24rstl51list<16CCameraShakeData,Q24rstl17rmemory_allocator>FPQ34rstl51list<16CCameraShakeData,Q24rstl17rmemory_allocator>4node = .text:0x8000C570; // type:function size:0xC0 scope:global
__dt__Q24rstl51list<16CCameraShakeData,Q24rstl17rmemory_allocator>Fv = .text:0x8000C630; // type:function size:0xC0 scope:global
__insertion_sort<PQ24rstl18pair<i,9TUniqueId>,Q24rstl63pair_sorter_finder<Q24rstl18pair<i,9TUniqueId>,Q24rstl7less<i>>>__4rstlFPQ24rstl18pair<i,9TUniqueId>PQ24rstl18pair<i,9TUniqueId>Q24rstl63pair_sorter_finder<Q24rstl18pair<i,9TUniqueId>,Q24rstl7less<i>> = .text:0x8000C6F0; // type:function size:0x84 scope:global
__sort3<Q24rstl18pair<i,9TUniqueId>,Q24rstl63pair_sorter_finder<Q24rstl18pair<i,9TUniqueId>,Q24rstl7less<i>>>__4rstlFRQ24rstl18pair<i,9TUniqueId>RQ24rstl18pair<i,9TUniqueId>RQ24rstl18pair<i,9TUniqueId>Q24rstl63pair_sorter_finder<Q24rstl18pair<i,9TUniqueId>,Q24rstl7less<i>> = .text:0x8000C774; // type:function size:0x90 scope:global
@@ -1933,7 +1933,7 @@ SetState__11CBallCameraFQ211CBallCamera16EBallCameraStateR13CStateManager = .tex
Think__11CBallCameraFfR13CStateManager = .text:0x80082E9C; // type:function size:0x2D4 scope:global
DoorClosed__11CBallCameraF9TUniqueId = .text:0x80083170; // type:function size:0x24 scope:global
DoorClosing__11CBallCameraF9TUniqueId = .text:0x80083194; // type:function size:0x24 scope:global
IsBallNearDoor__11CBallCameraCFRC9CVector3fR13CStateManager = .text:0x800831B8; // type:function size:0x21C scope:global
CheckDoorProximity__11CBallCameraFRC9CVector3fRC13CStateManager = .text:0x800831B8; // type:function size:0x21C scope:global
CheckFailSafe__11CBallCameraFfR13CStateManager = .text:0x800833D4; // type:function size:0x5EC scope:global
ActivateFailSafe__11CBallCameraFfR13CStateManager = .text:0x800839C0; // type:function size:0x120 scope:global
UpdateLookAtPosition__11CBallCameraFfR13CStateManager = .text:0x80083AE0; // type:function size:0x594 scope:global
@@ -6925,11 +6925,11 @@ Render__11CPathCameraCFRC13CStateManager = .text:0x8012DA20; // type:function si
Accept__11CPathCameraFR8IVisitor = .text:0x8012DA24; // type:function size:0x38 scope:global
ProcessInput__11CPathCameraFRC11CFinalInputR13CStateManager = .text:0x8012DA5C; // type:function size:0x4 scope:global
Think__11CPathCameraFfR13CStateManager = .text:0x8012DA60; // type:function size:0x358 scope:global
ClampToClosedDoor__11CPathCameraFR13CStateManager = .text:0x8012DDB8; // type:function size:0xF4 scope:global
AvoidDoorCollisions__11CPathCameraFR13CStateManager = .text:0x8012DDB8; // type:function size:0xF4 scope:global
MoveAlongSpline__11CPathCameraFfR13CStateManager = .text:0x8012DEAC; // type:function size:0x3D8 scope:global
Reset__11CPathCameraFRC12CTransform4fR13CStateManager = .text:0x8012E284; // type:function size:0x4A0 scope:global
__dt__11CPathCameraFv = .text:0x8012E724; // type:function size:0x70 scope:global
__ct__11CPathCameraF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fbfffffUlQ211CPathCamera22EInitialSplinePosition = .text:0x8012E794; // type:function size:0x17C scope:global
__ct__11CPathCameraF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>,Q24rstl17rmemory_allocator>RC11CEntityInfoRC12CTransform4fbfffffUiQ211CPathCamera22EInitialSplinePosition = .text:0x8012E794; // type:function size:0x17C scope:global
__sinit_CPathCamera_cpp = .text:0x8012E910; // type:function size:0x78 scope:global
Render__11CFluidPlaneFRC13CStateManagerRC6CAABoxRC14CFrustumPlanesRC14CRippleManagerRC9CVector3f = .text:0x8012E988; // type:function size:0x4 scope:global
AddRipple__11CFluidPlaneFRC7CRippleRC12CScriptWaterR13CStateManager = .text:0x8012E98C; // type:function size:0x54 scope:global
+1 -1
View File
@@ -184,7 +184,7 @@ __ct__14CCameraManagerF9TUniqueId = .text:0x8000C154; // type:function size:0x1D
Clamp<f>__5CMathFRCfRCfRCf = .text:0x8000C328; // type:function size:0x2C
sort<PQ24rstl18pair<i,9TUniqueId>,Q24rstl63pair_sorter_finder<Q24rstl18pair<i,9TUniqueId>,Q24rstl7less<i>>>__4rstlFPQ24rstl18pair<i,9TUniqueId>PQ24rstl18pair<i,9TUniqueId>Q24rstl63pair_sorter_finder<Q24rstl18pair<i,9TUniqueId>,Q24rstl7less<i>> = .text:0x8000C354; // type:function size:0x128
reserve__Q24rstl45vector<9TUniqueId,Q24rstl17rmemory_allocator>Fi = .text:0x8000C47C; // type:function size:0xEC
erase__Q24rstl51list<16CCameraShakeData,Q24rstl17rmemory_allocator>FRCQ34rstl51list<16CCameraShakeData,Q24rstl17rmemory_allocator>8iterator = .text:0x8000C568; // type:function size:0xC0
do_erase__Q24rstl51list<16CCameraShakeData,Q24rstl17rmemory_allocator>FPQ34rstl51list<16CCameraShakeData,Q24rstl17rmemory_allocator>4node = .text:0x8000C568; // type:function size:0xC0
__dt__Q24rstl51list<16CCameraShakeData,Q24rstl17rmemory_allocator>Fv = .text:0x8000C628; // type:function size:0xC0
__insertion_sort<PQ24rstl18pair<i,9TUniqueId>,Q24rstl63pair_sorter_finder<Q24rstl18pair<i,9TUniqueId>,Q24rstl7less<i>>>__4rstlFPQ24rstl18pair<i,9TUniqueId>PQ24rstl18pair<i,9TUniqueId>Q24rstl63pair_sorter_finder<Q24rstl18pair<i,9TUniqueId>,Q24rstl7less<i>> = .text:0x8000C6E8; // type:function size:0x84
__sort3<Q24rstl18pair<i,9TUniqueId>,Q24rstl63pair_sorter_finder<Q24rstl18pair<i,9TUniqueId>,Q24rstl7less<i>>>__4rstlFRQ24rstl18pair<i,9TUniqueId>RQ24rstl18pair<i,9TUniqueId>RQ24rstl18pair<i,9TUniqueId>Q24rstl63pair_sorter_finder<Q24rstl18pair<i,9TUniqueId>,Q24rstl7less<i>> = .text:0x8000C76C; // type:function size:0x90
@@ -158,6 +158,7 @@ public:
}
void SetElevation(float v) { x1a0_elevation = v; }
void SetLookAtOffset(CVector3f vec) { x1b4_lookAtOffset = vec; }
TUniqueId GetTooCloseActorId() const { return x3dc_tooCloseActorId; }
void SetChaseLookAtOffset(CVector3f vec) { x410_chaseLookAtOffset = vec; }
void SetWorldOffset(CVector3f vec); // TODO
EBallCameraState GetState() const { return x400_state; }
@@ -170,6 +171,8 @@ public:
void DoorClosing(TUniqueId uid);
void DoorClosed(TUniqueId uid);
static bool CheckDoorProximity(const CVector3f& vec, const CStateManager& mgr);
private:
struct SFailsafeState {
@@ -59,7 +59,7 @@ public:
, x8_shakerX()
, x44_shakerY()
, x80_shakerZ(true, SCameraShakePoint(false, 0.25f * duration, 0.f, 0.75f * duration, magnitude),
SCameraShakePoint(true, 0.f, 0.f, 0.5f * duration, 2.f)) {}
SCameraShakePoint(true, 0.f, 0.f, 0.5f * duration, 2.f)) {}
void SetId(int id) { xbc_shakerId = id; }
int GetId() const { return xbc_shakerId; }
void Update(float dt, CStateManager& mgr);
@@ -1,6 +1,7 @@
#ifndef _CCAMERASPLINE
#define _CCAMERASPLINE
#include "Kyoto/Math/CTransform4f.hpp"
#include "types.h"
#include "MetroidPrime/TGameTypes.hpp"
@@ -18,7 +19,10 @@ public:
// tODO
void Initialise(TUniqueId, const rstl::vector<SConnection>&, CStateManager&);
void Initialise(TUniqueId, const rstl::vector< SConnection >&, CStateManager&);
CTransform4f GetInterpolatedSplinePointByLength(float length) const;
float FindClosestLengthOnSpline(float t, const CVector3f& point);
private:
rstl::vector< CVector3f > x4_positions;
@@ -7,9 +7,10 @@
class CCinematicCamera : public CGameCamera {
public:
CCinematicCamera(TUniqueId uid, const rstl::string& name, const CEntityInfo& info,
const CTransform4f& xf, bool active, float shotDuration, float fovy, float znear,
float zfar, float aspect, uint flags);
CCinematicCamera(const TUniqueId uid, const rstl::string& name, const CEntityInfo& info,
const CTransform4f& xf, const bool active, const float shotDuration,
const float fovy, const float znear, const float zfar, const float aspect,
const uint flags);
~CCinematicCamera();
// CActor
void Accept(IVisitor& visitor) override;
+4 -3
View File
@@ -12,9 +12,10 @@ class CFinalInput;
class CGameCamera : public CActor {
public:
CGameCamera(TUniqueId uid, bool active, const rstl::string& name, const CEntityInfo& info,
const CTransform4f& xf, float fov, float nearZ, float farZ, float aspect,
TUniqueId watchedId, bool disableInput, int controllerIdx);
CGameCamera(const TUniqueId uid, const bool active, const rstl::string& name,
const CEntityInfo& info, const CTransform4f& xf, const float fov, const float nearZ,
const float farZ, const float aspect, const TUniqueId watchedId,
const bool disableInput, const int controllerIdx);
// CEntity
~CGameCamera() override;
+16 -16
View File
@@ -13,11 +13,11 @@ public:
kISP_ClampBasis,
};
CPathCamera(TUniqueId uid, const rstl::string& name, const CEntityInfo& info,
const CTransform4f& xf, bool active, float lengthExtent, float filterMag,
float filterProportion, float minEaseDist, float maxEaseDist, u32 flags,
EInitialSplinePosition initPos);
~CPathCamera();
CPathCamera(const TUniqueId uid, const rstl::string& name, const CEntityInfo& info,
const CTransform4f& xf, const bool active, const float lengthExtent, const float filterMag,
const float filterProportion, const float minEaseDist, const float maxEaseDist, const uint flags,
const EInitialSplinePosition initPos);
~CPathCamera() override;
void Accept(IVisitor& visitor) override;
void AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId sender, CStateManager& mgr) override;
@@ -26,19 +26,19 @@ public:
void ProcessInput(const CFinalInput& input, CStateManager& mgr) override;
void Reset(const CTransform4f& xf, CStateManager& mgr) override;
CTransform4f MoveAlongSpline(float dt, CStateManager& mgr);
void ClampToClosedDoor(CStateManager& mgr);
void AvoidDoorCollisions(CStateManager& mgr);
private:
CCameraSpline x188_spline;
float x1d4_pos;
float x1d8_time;
float x1dc_lengthExtent;
float x1e0_filterMag;
float x1e4_filterProportion;
EInitialSplinePosition x1e8_initPos;
u32 x1ec_flags;
float x1f0_minEaseDist;
float x1f4_maxEaseDist;
CCameraSpline mSpline;
float mPos;
float mTime;
float mLengthExtent;
float mFilterMag;
float mFilterProportions;
EInitialSplinePosition mInitialPosition;
uint mFlags;
float mMinEaseDist;
float mMaxEaseDist;
};
#endif // _CPATHCAMERA
+4 -2
View File
@@ -45,7 +45,8 @@ void __insertion_sort(It first, It last, Cmp cmp) {
It t1 = next - 1;
It t2 = next;
while (first < t2 && cmp(value, *t1)) {
*t2-- = *t1--;
*t2-- = *t1;
--t1;
}
*t2 = value;
}
@@ -90,7 +91,8 @@ void sort(It first, It last, Cmp cmp) {
--end;
if (it >= end)
break;
iter_swap(it++, end--);
iter_swap(it, end--);
++it;
}
sort(first, it, cmp);
sort(it, last, cmp);
+3 -3
View File
@@ -14,7 +14,7 @@ public:
class const_iterator;
iterator erase(const iterator& item) { return do_erase(item.get_node()); }
// private:
// private:
struct node;
node* do_erase(node* item);
@@ -72,7 +72,7 @@ public:
node* n;
x0_allocator.allocate(n, 1);
new (n) node(prev, next);
construct(n->get_value(), val);
new(n->get_value()) T(val);
return n;
}
@@ -169,7 +169,7 @@ template < typename T, typename Alloc >
typename list< T, Alloc >::node* list< T, Alloc >::do_erase(node* node) {
typename list< T, Alloc >::node* result = node->get_next();
if (node == x4_start) {
x4_start = result;
x4_start = node->get_next();
}
node->get_prev()->set_next(node->get_next());
node->get_next()->set_prev(node->get_prev());
+1 -1
View File
@@ -226,7 +226,7 @@ typename vector< T, Alloc >::iterator vector< T, Alloc >::erase(iterator first,
int newCount = first - begin();
for (iterator moved = begin() + newCount, it = last; it != end(); ++moved, ++newCount, ++it) {
for (iterator it = last, moved = begin() + newCount; it != end(); ++moved, ++newCount, ++it) {
construct(&*moved, *it);
}
x4_count = newCount;
+15 -14
View File
@@ -81,7 +81,7 @@ void CCameraManager::CreateCameras(CStateManager& mgr) {
TUniqueId fpId = mgr.AllocateUniqueId();
x7c_fpCamera = rs_new CFirstPersonCamera(
fpId, xf, plId, gpTweakPlayer->mOrbitCameraSpeed, GetDefaultFirstPersonVerticalFOV(),
fpId, xf, plId, gpTweakPlayer->GetOrbitCameraSpeed(), GetDefaultFirstPersonVerticalFOV(),
GetDefaultFirstPersonNearClipDistance(), GetDefaultFirstPersonFarClipDistance(),
GetDefaultAspectRatio());
mgr.AddObject(x7c_fpCamera);
@@ -369,7 +369,15 @@ void CCameraManager::StopCinematics(CStateManager& mgr) {
x7c_fpCamera->CancelCinematicOffset();
}
int CCameraManager::AddCameraShaker(const CCameraShakeData& data, bool sfx) {
inline CSfxHandle CreateSfxHandle(uchar vol, const CCameraShakeData& data) {
if (data.GetFlags() & 1) {
CVector3f pos = data.GetSfxPos();
CSfxHandle tmp = CSfxManager::AddEmitter(SFXamb_x_rumble_lp_00, pos, CVector3f::Zero(), vol);
return tmp;
}
return CSfxManager::SfxStart(SFXamb_x_rumble_lp_00, vol, 64);
}
int CCameraManager::AddCameraShaker(const CCameraShakeData& data, const bool sfx) {
CCameraShakeData shakeData = data;
shakeData.SetId(++x2c_lastShakeId);
x14_shakers.push_back(shakeData);
@@ -379,21 +387,14 @@ int CCameraManager::AddCameraShaker(const CCameraShakeData& data, bool sfx) {
}
float duration = data.GetDuration();
if (sfx && duration > 0.f) {
float component1 = data.GetSomething2();
float component2 = data.GetSomething();
float component1 = data.GetSomething();
float component2 = data.GetSomething2();
if (component2 > component1) {
component1 = component2;
}
float volF = CMath::Clamp(100.f, component1 * 9.f + 100.f, 127.f);
uchar vol = static_cast< uchar >(volF);
CSfxHandle sfxHandle;
if (data.GetFlags() & 0x1) {
CVector3f pos = data.GetSfxPos();
sfxHandle = CSfxManager::AddEmitter(SFXamb_x_rumble_lp_00, pos, CVector3f::Zero(), vol);
} else {
sfxHandle = CSfxManager::SfxStart(SFXamb_x_rumble_lp_00, vol, 64);
}
CSfxManager::SetDuration(sfxHandle, duration);
const CSfxHandle handle = CreateSfxHandle(
static_cast< uchar >(CMath::Clamp(100.f, component1 * 9.f + 100.f, 127.f)), data);
CSfxManager::SetDuration(handle, duration);
}
return x2c_lastShakeId;
}
@@ -10,9 +10,11 @@
#include "rstl/algorithm.hpp"
CCinematicCamera::CCinematicCamera(TUniqueId uid, const rstl::string& name, const CEntityInfo& info,
const CTransform4f& xf, bool active, float shotDuration,
float fovy, float znear, float zfar, float aspect, uint flags)
CCinematicCamera::CCinematicCamera(const TUniqueId uid, const rstl::string& name,
const CEntityInfo& info, const CTransform4f& xf,
const bool active, const float shotDuration, const float fovy,
const float znear, const float zfar, const float aspect,
const uint flags)
: CGameCamera(uid, active, name, info, xf, fovy, znear, zfar, aspect, kInvalidUniqueId,
(flags & 0x20) != 0, 0)
, x1e8_duration(shotDuration)
+61 -36
View File
@@ -1,46 +1,71 @@
#include "MetroidPrime/Cameras/CPathCamera.hpp"
#include "MetroidPrime/Cameras/CCameraManager.hpp"
#include "MetroidPrime/TCastTo.hpp"
// #include "MetroidPrime/ScriptObjects/CScriptDoor.hpp"
CPathCamera::CPathCamera(TUniqueId uid, const rstl::string& name, const CEntityInfo& info,
const CTransform4f& xf, bool active, float lengthExtent, float filterMag,
float filterProportion, float minEaseDist, float maxEaseDist, u32 flags,
EInitialSplinePosition initPos)
#include "MetroidPrime/Cameras/CBallCamera.hpp"
#include "MetroidPrime/Cameras/CCameraManager.hpp"
#include "MetroidPrime/Player/CPlayer.hpp"
#include "MetroidPrime/ScriptObjects/CScriptDoor.hpp"
#include "MetroidPrime/Tweaks/CTweakPlayer.hpp"
#include "rstl/math.hpp"
static const CMaterialList kLineOfSightIncludeList = CMaterialList(kMT_Solid);
static const CMaterialList kLineOfSightExcludeList = CMaterialList(kMT_ProjectilePassthrough);
static const CMaterialFilter kLineOfSightFilter =
CMaterialFilter::MakeIncludeExclude(kLineOfSightIncludeList, kLineOfSightExcludeList);
CPathCamera::CPathCamera(const TUniqueId uid, const rstl::string& name, const CEntityInfo& info,
const CTransform4f& xf, const bool active, const float lengthExtent,
const float filterMag, const float filterProportion,
const float minEaseDist, const float maxEaseDist, const uint flags,
const EInitialSplinePosition initPos)
: CGameCamera(uid, active, name, info, xf, CCameraManager::GetDefaultThirdPersonVerticalFOV(),
CCameraManager::GetDefaultFirstPersonNearClipDistance(),
CCameraManager::GetDefaultFirstPersonFarClipDistance(),
CCameraManager::GetDefaultAspectRatio(), kInvalidUniqueId, false, 0)
, x188_spline(flags & 1)
, x1d4_pos(0.f)
, x1d8_time(0.f)
, x1dc_lengthExtent(lengthExtent)
, x1e0_filterMag(filterMag)
, x1e4_filterProportion(filterProportion)
, x1e8_initPos(initPos)
, x1ec_flags(flags)
, x1f0_minEaseDist(minEaseDist)
, x1f4_maxEaseDist(maxEaseDist) {}
, mSpline(flags & 1)
, mPos(0.f)
, mTime(0.f)
, mLengthExtent(lengthExtent)
, mFilterMag(filterMag)
, mFilterProportions(filterProportion)
, mInitialPosition(initPos)
, mFlags(flags)
, mMinEaseDist(minEaseDist)
, mMaxEaseDist(maxEaseDist) {}
CPathCamera::~CPathCamera() {}
void CPathCamera::Reset(const CTransform4f&, CStateManager& mgr) {}
void CPathCamera::Reset(const CTransform4f& xf, CStateManager& mgr) {
CVector3f ballPos1(
mgr.GetPlayer()->GetTranslation().GetX(), mgr.GetPlayer()->GetTranslation().GetY(),
mgr.GetPlayer()->GetTranslation().GetZ() + gpTweakPlayer->GetPlayerBallHalfExtent());
CVector3f ballPos = ballPos1;
float closestLength = mSpline.FindClosestLengthOnSpline(0.f, ballPos);
float closestLengthClamped = rstl::max_val(0.f, closestLength);
CVector3f interpolatedPoint =
mSpline.GetInterpolatedSplinePointByLength(closestLength).GetTranslation();
CTransform4f ballTransform = mgr.GetCameraManager()->GetBallCamera()->GetTransform();
}
CTransform4f CPathCamera::MoveAlongSpline(float t, CStateManager& mgr) {
return CTransform4f::Identity();
}
void CPathCamera::ClampToClosedDoor(CStateManager& mgr) {
/*
if (TCastToConstPtr<CScriptDoor> door =
mgr.GetObjectById(mgr.GetCameraManager()->GetBallCamera()->GetTooCloseActorId())) {
if (!door->IsOpen() && CBallCamera::IsBallNearDoor(GetTranslation(), mgr)) {
x1d4_pos = (x1d4_pos > x1d8_time) ? x1d8_time - x1dc_lengthExtent : x1d8_time +
x1dc_lengthExtent;
SetTranslation(x188_spline.GetInterpolatedSplinePointByLength(x1d4_pos).origin);
void CPathCamera::AvoidDoorCollisions(CStateManager& mgr) {
if (const CScriptDoor* door = TCastToConstPtr< CScriptDoor >(
mgr.GetObjectById(mgr.GetCameraManager()->GetBallCamera()->GetTooCloseActorId()))) {
if (!door->IsOpen() && CBallCamera::CheckDoorProximity(GetTranslation(), mgr)) {
float tmp = mTime + mLengthExtent;
if (mPos > mTime) {
tmp = mTime - mLengthExtent;
}
mPos = tmp;
const CVector3f tmpVec = mSpline.GetInterpolatedSplinePointByLength(tmp).GetTranslation();
SetTranslation(tmpVec);
}
}
*/
}
void CPathCamera::Think(float dt, CStateManager& mgr) {
@@ -51,19 +76,19 @@ void CPathCamera::Think(float dt, CStateManager& mgr) {
if (mgr.GetCameraManager()->GetPathCameraId() != GetUniqueId())
return;
if (x188_spline.GetSize() <= 0)
if (mSpline.GetSize() <= 0)
return;
zeus::CTransform xf = GetTransform();
zeus::CVector3f ballLook = mgr.GetCameraManager()->GetBallCamera()->GetLookPos();
if ((x1ec_flags & 0x10)) {
if ((mFlags & 0x10)) {
if (const CScriptCameraHint* hint = mgr.GetCameraManager()->GetCameraHint(mgr))
ballLook.z() = hint->GetTranslation().z();
}
if (!mgr.GetPlayer().GetVelocity().canBeNormalized() && (ballLook - GetTranslation()).canBeNormalized()) {
if (x1ec_flags & 4)
SetTransform(x188_spline.GetInterpolatedSplinePointByLength(x1d4_pos));
if (!mgr.GetPlayer().GetVelocity().CanBeNormalized() && (ballLook - GetTranslation()).CanBeNormalized()) {
if (mFlags & 4)
SetTransform(mSpline.GetInterpolatedSplinePointByLength(mPos));
else
SetTransform(zeus::lookAt(GetTranslation(), ballLook));
return;
@@ -72,15 +97,15 @@ void CPathCamera::Think(float dt, CStateManager& mgr) {
xf = MoveAlongSpline(dt, mgr);
SetTranslation(xf.origin);
if (x1ec_flags & 0x20)
ClampToClosedDoor(mgr);
if (mFlags & 0x20)
AvoidDoorCollisions(mgr);
CVector3f tmp = ballLook - GetTranslation();
tmp.SetZ(0.f);
if (tmp.CanBeNormalized())
SetTransform(zeus::lookAt(GetTranslation(), ballLook));
if (x1ec_flags & 4)
if (mFlags & 4)
SetTransform(xf);
#endif
}
@@ -99,5 +124,5 @@ void CPathCamera::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CStat
if (!GetActive() || msg != kSM_InitializedInArea) {
return;
}
x188_spline.Initialise(GetUniqueId(), GetConnectionList(), mgr);
mSpline.Initialise(GetUniqueId(), GetConnectionList(), mgr);
}