Skip to content

Commit

Permalink
Start CPlayer
Browse files Browse the repository at this point in the history
  • Loading branch information
encounter committed Sep 26, 2024
1 parent a3b1ac1 commit c4f5b35
Show file tree
Hide file tree
Showing 37 changed files with 1,222 additions and 168 deletions.
71 changes: 38 additions & 33 deletions config/GM8E01_00/symbols.txt

Large diffs are not rendered by default.

22 changes: 11 additions & 11 deletions config/GM8E01_01/symbols.txt
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ __ct__11CObjectListF15EGameObjectList = .text:0x800100B4; // type:function size:
__ct__Q211CObjectList16SObjectListEntryFv = .text:0x800101A8; // type:function size:0x18 scope:weak
__dt__7CPlayerFv = .text:0x800101C0; // type:function size:0x730 scope:global
fn_80010874 = .text:0x800108F0; // type:function size:0x58 scope:global
__dt__10CMorphBallFv = .text:0x80010948; // type:function size:0x1CC scope:global
__dt__Q27CPlayer12CInputFilterFv = .text:0x80010948; // type:function size:0x1CC scope:global
IsTransparent__7CPlayerCFv = .text:0x80010B14; // type:function size:0x18 scope:global
IsEnergyLow__7CPlayerCFRC13CStateManager = .text:0x80010B2C; // type:function size:0x7C scope:global
FinishNewScan__7CPlayerFR13CStateManager = .text:0x80010BA8; // type:function size:0x12C scope:global
Expand Down Expand Up @@ -399,15 +399,15 @@ GetFirstPersonCameraTransform__7CPlayerCFR13CStateManager = .text:0x80019148; //
UpdateGunTransform__7CPlayerFRC9CVector3fR13CStateManager = .text:0x80019170; // type:function size:0x464 scope:global
UpdateAssistedAiming__7CPlayerFRC12CTransform4fR13CStateManager = .text:0x800195D4; // type:function size:0x3E8 scope:global
UpdateAimTargetPrediction__7CPlayerFRC12CTransform4fR13CStateManager = .text:0x800199BC; // type:function size:0x294 scope:global
GetAverage__31TReservedAverage<9CVector3f,20>CFv = .text:0x80019C50; // type:function size:0x74 scope:global
fn_80019C48 = .text:0x80019CC4; // type:function size:0x15C scope:global
ResetAimTargetPrediction__7CPlayerF9TUniqueId = .text:0x80019E20; // type:function size:0x7C scope:global
GetAverage__31TReservedAverage<9CVector3f,10>CFv = .text:0x80019C50; // type:function size:0x74 scope:global
AddValue__31TReservedAverage<9CVector3f,10>FRC9CVector3f = .text:0x80019CC4; // type:function size:0x15C scope:global
SetAimTargetId__7CPlayerF9TUniqueId = .text:0x80019E20; // type:function size:0x7C scope:global
UpdateGunState__7CPlayerFRC11CFinalInputR13CStateManager = .text:0x80019E9C; // type:function size:0x28C scope:global
DrawGun__7CPlayerFR13CStateManager = .text:0x8001A128; // type:function size:0x6C scope:global
ResetGun__7CPlayerFR13CStateManager = .text:0x8001A194; // type:function size:0x54 scope:global
HolsterGun__7CPlayerFR13CStateManager = .text:0x8001A1E8; // type:function size:0xA8 scope:global
IsMorphBallTransitioning__7CPlayerCFv = .text:0x8001A290; // type:function size:0x28 scope:global
__ct__7CPlayerF9TUniqueIdRC12CTransform4fRC6CAABoxUi9CVector3fffffRC13CMaterialList = .text:0x8001A2B8; // type:function size:0xBFC scope:global
__ct__7CPlayerF9TUniqueIdRC12CTransform4fRC6CAABoxUiRC9CVector3fffffRC13CMaterialList = .text:0x8001A2B8; // type:function size:0xBFC scope:global
None__16CActorParametersFv = .text:0x8001AEB4; // type:function size:0x20 scope:global
MakePlayerAnimres__FUiRC9CVector3f = .text:0x8001AED4; // type:function size:0x38 scope:global
SetMaterial__19CCollisionPrimitiveFRC13CMaterialList = .text:0x8001AF0C; // type:function size:0x14 scope:global
Expand Down Expand Up @@ -6267,7 +6267,7 @@ ComputeBallMovement__10CMorphBallFRC11CFinalInputR13CStateManagerf = .text:0x800
ForwardInput__10CMorphBallCFRC11CFinalInput = .text:0x800F8E08; // type:function size:0x6C scope:global
GetBallTouchRadius__10CMorphBallCFv = .text:0x800F8E74; // type:function size:0xC scope:global
GetBallRadius__10CMorphBallCFv = .text:0x800F8E80; // type:function size:0xC scope:global
fn_800F8E10 = .text:0x800F8E8C; // type:function size:0x764 scope:global
__dt__10CMorphBallFv = .text:0x800F8E8C; // type:function size:0x764 scope:global
__ct__10CMorphBallFR7CPlayerf = .text:0x800F95F0; // type:function size:0xE98 scope:global
fn_800FA40C = .text:0x800FA488; // type:function size:0x2C scope:global
fn_800FA438 = .text:0x800FA4B4; // type:function size:0x7C scope:global
Expand Down Expand Up @@ -6652,7 +6652,7 @@ __ct__12CBloodFlowerF9TUniqueIdRCQ24rstl66basic_string<c,Q24rstl14char_traits<c>
__ct__9TEditorIdFR12CInputStream = .text:0x8011A4DC; // type:function size:0x38 scope:global
__sinit_TGameTypes_cpp = .text:0x8011A514; // type:function size:0x20 scope:local
GetMaximumCollisionVelocity__13CPhysicsActorCFv = .text:0x8011A534; // type:function size:0x8 scope:global
SetMaximumCollisionVelocity__13CPhysicsActorFf = .text:0x8011A53C; // type:function size:0x8 scope:global
SetMaxVelocityAfterCollision__13CPhysicsActorFf = .text:0x8011A53C; // type:function size:0x8 scope:global
GetCollisionAccuracyModifier__13CPhysicsActorCFv = .text:0x8011A544; // type:function size:0x8 scope:global
SetCollisionAccuracyModifier__13CPhysicsActorFf = .text:0x8011A54C; // type:function size:0x8 scope:global
GetCoefficientOfRestitutionModifier__13CPhysicsActorCFv = .text:0x8011A554; // type:function size:0x8 scope:global
Expand Down Expand Up @@ -7983,7 +7983,7 @@ BeginGrapple__7CPlayerFR9CVector3fR13CStateManager = .text:0x8017B09C; // type:f
BreakGrapple__7CPlayerF19EPlayerOrbitRequestR13CStateManager = .text:0x8017B140; // type:function size:0xD8 scope:global
SetOrbitRequest__7CPlayerF19EPlayerOrbitRequestR13CStateManager = .text:0x8017B218; // type:function size:0xB8 scope:global
SetOrbitRequestForTarget__7CPlayerF9TUniqueId19EPlayerOrbitRequestR13CStateManager = .text:0x8017B2D0; // type:function size:0x54 scope:global
InGrappleJumpCooldown__7CPlayerCFv = .text:0x8017B324; // type:function size:0x38 scope:global
CheckPostGrapple__7CPlayerCFv = .text:0x8017B324; // type:function size:0x38 scope:global
PreventFallingCameraPitch__7CPlayerFv = .text:0x8017B35C; // type:function size:0x1C scope:global
OrbitCarcass__7CPlayerFR13CStateManager = .text:0x8017B378; // type:function size:0x3C scope:global
OrbitPoint__7CPlayerFQ27CPlayer16EPlayerOrbitTypeR13CStateManager = .text:0x8017B3B4; // type:function size:0x60 scope:global
Expand Down Expand Up @@ -19152,9 +19152,9 @@ lbl_80457908 = .bss:0x80457AE8; // type:object size:0xC0 scope:local data:float
lbl_804579C8 = .bss:0x80457BA8; // type:object size:0x20 scope:local data:4byte
lbl_804579E8 = .bss:0x80457BC8; // type:object size:0x10 scope:local data:float
lbl_804579F8 = .bss:0x80457BD8; // type:object size:0x18 scope:local data:4byte
lbl_80457A10 = .bss:0x80457BF0; // type:object size:0x838 scope:local
lbl_80458248 = .bss:0x80458428; // type:object size:0x108 scope:local
lbl_80458350 = .bss:0x80458530; // type:object size:0x1E58 scope:local
sAllocSpace$2944 = .bss:0x80457BF0; // type:object size:0x838 scope:local
sAllocSpace$2964 = .bss:0x80458428; // type:object size:0x108 scope:local
sAllocSpace$2980 = .bss:0x80458530; // type:object size:0x1E58 scope:local
lbl_8045A1A8 = .bss:0x8045A388; // type:object size:0xF98 scope:local
lbl_8045B140 = .bss:0x8045B320; // type:object size:0x40 scope:local
lbl_8045B180 = .bss:0x8045B360; // type:object size:0x5C scope:local
Expand Down
6 changes: 2 additions & 4 deletions include/Collision/CCollisionPrimitive.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,12 @@ class CCollisionPrimitive {
const char* mInfo;
};

class Comparison {

};
class Comparison {};

CCollisionPrimitive(const CMaterialList& list);

virtual uint GetTableIndex() const = 0;
virtual void SetMaterial(const CMaterialList&);
virtual void SetMaterial(const CMaterialList& other) { x8_material = other; }
virtual const CMaterialList& GetMaterial() const;
virtual CAABox CalculateAABox(const CTransform4f&) const = 0;
virtual CAABox CalculateLocalAABox() const = 0;
Expand Down
2 changes: 1 addition & 1 deletion include/Collision/CRayCastResult.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class CRayCastResult {
};
CRayCastResult(float time, const CVector3f& point, const CPlane& plane, const CMaterialList& list)
: x0_time(time), x4_point(point), x10_plane(plane), x20_valid(kI_Valid), x28_material(list) {}
CRayCastResult(EInvalid invalid)
CRayCastResult(EInvalid invalid = kI_Invalid)
: x0_time(0)
, x4_point(CVector3f(0.f, 0.f, 0.f))
, x10_plane(CPlane(0.f, CUnitVector3f(1.f, 0.f, 0.f, CUnitVector3f::kN_Yes)))
Expand Down
4 changes: 2 additions & 2 deletions include/Kyoto/Audio/CSfxManager.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ class CSfxManager {
static void SetDuration(CSfxHandle handle, float duration);
static ushort GetReverbAmount();

static CSfxHandle SfxStart(const ushort id, const short vol, const short pan,
const bool useAcoustics = false, const short prio = kMaxPriority,
static CSfxHandle SfxStart(const ushort id, const short vol = 127, const short pan = 64,
const bool useAcoustics = false, const short prio = kMedPriority,
const bool looped = false, const int areaId = kAllAreas);
static void SfxStop(CSfxHandle handle);
static void SfxVolume(CSfxHandle handle, uchar volume);
Expand Down
31 changes: 16 additions & 15 deletions include/Kyoto/Math/CVector3f.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,15 @@ class CVector3f {
}
inline float MagSquared() const { return GetX() * GetX() + GetY() * GetY() + GetZ() * GetZ(); }
static CVector3f Cross(const CVector3f& lhs, const CVector3f& rhs) {
const float x = (lhs.GetY() * rhs.GetZ()) - (rhs.GetY() * lhs.GetZ());
const float y = (lhs.GetZ() * rhs.GetX()) - (rhs.GetZ() * lhs.GetX());
const float z = (lhs.GetX() * rhs.GetY()) - (rhs.GetX() * lhs.GetY());
const float lX = lhs.mX;
const float lY = lhs.mY;
const float lZ = lhs.mZ;
const float rX = rhs.mX;
const float rY = rhs.mY;
const float rZ = rhs.mZ;
float z = lX * rY - rX * lY;
float y = lZ * rX - rZ * lX;
float x = lY * rZ - rY * lZ;
return CVector3f(x, y, z);
}

Expand Down Expand Up @@ -92,16 +98,9 @@ class CVector3f {
mZ *= v;
return *this;
}
CVector3f& operator/=(const float v) {
mX /= v;
mY /= v;
mZ /= v;
return *this;
}
CVector3f& operator/=(const float v) { return *this *= (1.f / v); }

CVector2f ToVec2f() const {
return CVector2f(mX, mY);
}
CVector2f ToVec2f() const { return CVector2f(mX, mY); }

static float Dot(const CVector3f& a, const CVector3f& b) {
return (a.GetX() * b.GetX()) + (a.GetY() * b.GetY()) + (a.GetZ() * b.GetZ());
Expand Down Expand Up @@ -176,11 +175,13 @@ inline CVector3f operator*(const float f, const CVector3f& vec) {
}

inline CVector3f operator/(const CVector3f& vec, const float f) {
float x = vec.GetX() / f;
float y = vec.GetY() / f;
float z = vec.GetZ() / f;
float n = (1.f / f);
float x = vec.GetX() * n;
float y = vec.GetY() * n;
float z = vec.GetZ() * n;
return CVector3f(x, y, z);
}

inline CVector3f operator-(const CVector3f& vec) {
return CVector3f(-vec.GetX(), -vec.GetY(), -vec.GetZ());
}
Expand Down
9 changes: 8 additions & 1 deletion include/Kyoto/TAverage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,14 @@
#include "rstl/vector.hpp"

template < typename T >
T GetAverageValue(const T* ptr, int count); // TODO
T GetAverageValue(const T* ptr, int count) {
const T* end = ptr + count;
T ret = *ptr++;
for (; ptr < end; ++ptr) {
ret = ret + *ptr;
}
return ret / count;
}

template < typename T >
class TAverage : rstl::vector< T > {
Expand Down
28 changes: 21 additions & 7 deletions include/Kyoto/TReservedAverage.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,28 @@ class TReservedAverage : public rstl::reserved_vector< T, N > {
TReservedAverage(const T& value) {
// resize(value, N); TODO
}
void AddValue(const T& value) {
this->push_back(value);
for (int i = this->size() - 1; i > 0; --i) {
this->operator[](i) = this->operator[](i - 1);
}
this->operator[](0) = value;
}
void AddValue(const T& value);
rstl::optional_object< T > GetAverage() const;
};

template < typename T, int N >
/* inline */ void TReservedAverage< T, N >::AddValue(const T& value) {
if (this->size() < this->capacity()) {
this->push_back(value);
}
for (int i = this->size() - 1; i > 0; --i) {
this->operator[](i) = this->operator[](i - 1);
}
this->operator[](0) = value;
}

template < typename T, int N >
rstl::optional_object< T > TReservedAverage< T, N >::GetAverage() const {
if (this->empty()) {
return rstl::optional_object_null();
} else {
return GetAverageValue(this->data(), this->size());
}
}

#endif // _TRESERVEDAVERAGE
2 changes: 1 addition & 1 deletion include/MetroidPrime/CActorParameters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class CActorParameters {
float GetFadeInTime() const { return x5c_fadeInTime; }
float GetFadeOutTime() const { return x60_fadeOutTime; }

static CActorParameters None();
static CActorParameters None() { return CActorParameters(); }

private:
CLightParameters x0_lighting;
Expand Down
8 changes: 7 additions & 1 deletion include/MetroidPrime/CAnimRes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,13 @@ class CAnimRes {
, x14_canLoop(loop)
, x18_defaultAnim(defaultAnim) {}

// name?
CAssetId GetId() const { return x0_ancsId; }
// or GetBodyType__8CAnimResCFv ?
int GetCharacterNodeId() const { return x4_charIdx; }
const CVector3f& GetScale() const { return x8_scale; }
int GetDefaultAnim() const { return x18_defaultAnim; }
bool CanLoop() const { return x14_canLoop; }

static const int kDefaultCharIdx;
};
CHECK_SIZEOF(CAnimRes, 0x1c)
Expand Down
10 changes: 9 additions & 1 deletion include/MetroidPrime/CModelData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,15 @@ class CModelData {
CModelData();
CModelData(const CAnimRes&);
CModelData(const CStaticRes&);
CModelData(const CModelData& other);
CModelData(const CModelData& other)
: x0_scale(other.x0_scale)
, xc_animData(other.xc_animData)
, x14_24_renderSorted(other.x14_24_renderSorted)
, x14_25_sortThermal(other.x14_25_sortThermal)
, x18_ambientColor(other.x18_ambientColor)
, x1c_normalModel(other.x1c_normalModel)
, x2c_xrayModel(other.x2c_xrayModel)
, x3c_infraModel(other.x3c_infraModel) {}
~CModelData();

CAdvancementDeltas AdvanceAnimation(float dt, CStateManager& mgr, TAreaId aid, bool advTree);
Expand Down
5 changes: 3 additions & 2 deletions include/MetroidPrime/CPhysicsActor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,14 @@ class CPhysicsActor : public CActor {
void SetAngularImpulseWR(const CAxisAngle& angularImpulse) {
x180_angularImpulse = angularImpulse;
}
void SetLastNonCollidingState(const CMotionState& state) { x1f4_lastNonCollidingState = state; }

float GetCoefficientOfRestitutionModifier() const;
void SetCoefficientOfRestitutionModifier(float modifier);
float GetCollisionAccuracyModifier() const;
void SetCollisionAccuracyModifier(float modifier);
float GetMaximumCollisionVelocity() const;
void SetMaximumCollisionVelocity(float velocity);
void SetMaxVelocityAfterCollision(float velocity);

CPhysicsState GetPhysicsState() const;
void SetPhysicsState(const CPhysicsState& state);
Expand All @@ -155,7 +156,7 @@ class CPhysicsActor : public CActor {
CVector3f GetMoveToORImpulseWR(const CVector3f& impulse, float d) const;
CVector3f GetRotateToORAngularMomentumWR(const CQuaternion& q, float d) const;
void RotateToWR(const CQuaternion&, float);

void MoveInOneFrameOR(const CVector3f& trans, float d);
void RotateInOneFrameOR(const CQuaternion&, float);

Expand Down
2 changes: 1 addition & 1 deletion include/MetroidPrime/Cameras/CFirstPersonCamera.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class CFirstPersonCamera : public CGameCamera {
void SetScriptPitchId(TUniqueId uid) { x1c4_pitchId = uid; }
// UpdateElevation__18CFirstPersonCameraFR13CStateManager
// UpdateTransform__18CFirstPersonCameraFR13CStateManagerf
// GetGunFollowTransform__18CFirstPersonCameraCFv
const CTransform4f& GetGunFollowTransform() const;
// SetLockCamera__18CFirstPersonCameraFb
void CancelCinematicOffset();

Expand Down
11 changes: 8 additions & 3 deletions include/MetroidPrime/Player/CGrappleArm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@
#define _CGRAPPLEARM

#include "types.h"
#include "rstl/single_ptr.hpp"

#include "Kyoto/Audio/CSfxHandle.hpp"
#include "Kyoto/Math/CTransform4f.hpp"

#include "rstl/single_ptr.hpp"

class CVector3f;
class CStateManager;
Expand Down Expand Up @@ -34,6 +37,8 @@ class CGrappleArm {
void EnterStruck(CStateManager&, float, bool, bool);
void DisconnectGrappleBeam();

void SetTransform(const CTransform4f& xf) { *(CTransform4f*)(&x0_pad[0x220]) = xf; }

// EArmState GetAnimState() const { return x334_animState; }
bool GetActive() const { return x3b2_24_active; }
bool BeamActive() const { return x3b2_25_beamActive; }
Expand All @@ -42,8 +47,8 @@ class CGrappleArm {
bool IsSuitLoading() const { return x3b2_29_suitLoading; }

private:
uchar x0_pad[0x328];
rstl::single_ptr<CGunController> x328_gunController;
uchar x0_pad[0x328]; // TODO
rstl::single_ptr< CGunController > x328_gunController;
CSfxHandle x32c_grappleLoopSfx;
CSfxHandle x330_swooshSfx;
EArmState x334_animState;
Expand Down
Loading

0 comments on commit c4f5b35

Please sign in to comment.