diff --git a/include/Kyoto/Input/CRumbleGenerator.hpp b/include/Kyoto/Input/CRumbleGenerator.hpp new file mode 100644 index 00000000..22869299 --- /dev/null +++ b/include/Kyoto/Input/CRumbleGenerator.hpp @@ -0,0 +1,23 @@ +#ifndef _CRUMBLEGENERATOR_HPP +#define _CRUMBLEGENERATOR_HPP + +#include "types.h" + +#include "Kyoto/Input/CRumbleVoice.hpp" + +enum EMotorState { + kMS_Stop, // = PAD_MOTOR_STOP, + kMS_Rumble, // = PAD_MOTOR_RUMBLE, + kMS_StopHard, // = PAD_MOTOR_STOP_HARD, +}; + +class CRumbleGenerator { +private: + CRumbleVoice x0_voices[4]; + f32 xc0_periodTime[4]; + f32 xd0_onTime[4]; + EMotorState xe0_commandArray[4]; + bool xf0_24_disabled : 1; +}; + +#endif \ No newline at end of file diff --git a/include/Kyoto/Input/CRumbleVoice.hpp b/include/Kyoto/Input/CRumbleVoice.hpp new file mode 100644 index 00000000..ea55875a --- /dev/null +++ b/include/Kyoto/Input/CRumbleVoice.hpp @@ -0,0 +1,57 @@ +#ifndef _CRUMBLEVOICE_HPP +#define _CRUMBLEVOICE_HPP + +#include "types.h" + +#include "rstl/reserved_vector.hpp" +#include "rstl/vector.hpp" + +enum ERumblePriority { + kRP_None, + kRP_One, + kRP_Two, + kRP_Three, +}; + +struct SAdsrData { + f32 x0_attackGain; + f32 x4_autoReleaseDur; + f32 x8_attackDur; + f32 xc_decayDur; + f32 x10_sustainGain; + f32 x14_releaseDur; + bool x18_24_hasSustain : 1; + bool x18_25_autoRelease : 1; +}; + +struct SAdsrDelta { + enum EPhase { + kP_Stop, + kP_PrePulse, + kP_Attack, + kP_Decay, + kP_Sustain, + kP_Release, + }; + + f32 x0_curIntensity; + f32 x4_attackTime; + f32 x8_decayTime; + f32 xc_releaseTime; + f32 x10_autoReleaseTime; + f32 x14_attackIntensity; + f32 x18_sustainIntensity; + ERumblePriority x1c_priority; + EPhase x20_phase; +}; + +class CRumbleVoice { +private: + rstl::vector< SAdsrData > x0_datas; + rstl::vector< SAdsrDelta > x10_deltas; + rstl::reserved_vector< s16, 4 > x20_handleIds; + s16 x2c_usedChannels; + u8 x2e_lastId; +}; + +#endif \ No newline at end of file diff --git a/include/Kyoto/Math/CMatrix4f.hpp b/include/Kyoto/Math/CMatrix4f.hpp new file mode 100644 index 00000000..4988df76 --- /dev/null +++ b/include/Kyoto/Math/CMatrix4f.hpp @@ -0,0 +1,27 @@ +#ifndef _CMATRIX4F_HPP +#define _CMATRIX4F_HPP + +#include "types.h" + +class CMatrix4f { +private: + f32 m00; + f32 m01; + f32 m02; + f32 m03; + f32 m10; + f32 m11; + f32 m12; + f32 m13; + f32 m20; + f32 m21; + f32 m22; + f32 m23; + f32 m30; + f32 m31; + f32 m32; + f32 m33; +}; +CHECK_SIZEOF(CMatrix4f, 0x40); + +#endif \ No newline at end of file diff --git a/include/Kyoto/Math/CQuaternion.hpp b/include/Kyoto/Math/CQuaternion.hpp new file mode 100644 index 00000000..3cf0a543 --- /dev/null +++ b/include/Kyoto/Math/CQuaternion.hpp @@ -0,0 +1,14 @@ +#ifndef _CQUATERNION_HPP +#define _CQUATERNION_HPP + +#include "types.h" + +class CQuaternion { +private: + f32 w; + f32 x; + f32 y; + f32 z; +}; + +#endif \ No newline at end of file diff --git a/include/Kyoto/Math/CVector2i.hpp b/include/Kyoto/Math/CVector2i.hpp new file mode 100644 index 00000000..950571bc --- /dev/null +++ b/include/Kyoto/Math/CVector2i.hpp @@ -0,0 +1,12 @@ +#ifndef _CVECTOR2I_HPP +#define _CVECTOR2I_HPP + +#include "types.h" + +class CVector2i { +private: + s32 x; + s32 y; +}; + +#endif \ No newline at end of file diff --git a/include/MetroidPrime/CActor.hpp b/include/MetroidPrime/CActor.hpp index 270d1b48..83fdde26 100644 --- a/include/MetroidPrime/CActor.hpp +++ b/include/MetroidPrime/CActor.hpp @@ -13,6 +13,7 @@ #include "Kyoto/Graphics/CColor.hpp" #include "Kyoto/Math/CAABox.hpp" #include "Kyoto/Math/CTransform4f.hpp" +#include "Kyoto/Math/CQuaternion.hpp" #include "Kyoto/TToken.hpp" #include "rstl/pair.hpp" @@ -26,7 +27,11 @@ class CScannableObjectInfo; class CSimpleShadow; // TODO move -struct SAdvancementDeltas {}; +struct SAdvancementDeltas { + CVector3f x0_posDelta; + CQuaternion xc_rotDelta; +}; +CHECK_SIZEOF(SAdvancementDeltas, 0x1c) class CActor : public CEntity { public: diff --git a/include/MetroidPrime/CActorModelParticles.hpp b/include/MetroidPrime/CActorModelParticles.hpp new file mode 100644 index 00000000..38a17451 --- /dev/null +++ b/include/MetroidPrime/CActorModelParticles.hpp @@ -0,0 +1,11 @@ +#ifndef _CACTORMODELPARTICLES_HPP +#define _CACTORMODELPARTICLES_HPP + +#include "types.h" + +class CActorModelParticles { +private: + // TODO +}; + +#endif \ No newline at end of file diff --git a/include/MetroidPrime/CAreaFog.hpp b/include/MetroidPrime/CAreaFog.hpp index ce057766..671580b3 100644 --- a/include/MetroidPrime/CAreaFog.hpp +++ b/include/MetroidPrime/CAreaFog.hpp @@ -24,7 +24,6 @@ private: unkptr x30_; f32 x34_colorDelta; }; - CHECK_SIZEOF(CAreaFog, 0x38) #endif \ No newline at end of file diff --git a/include/MetroidPrime/CEnvFxManager.hpp b/include/MetroidPrime/CEnvFxManager.hpp new file mode 100644 index 00000000..28b88667 --- /dev/null +++ b/include/MetroidPrime/CEnvFxManager.hpp @@ -0,0 +1,64 @@ +#ifndef _CENVFXMANAGER_HPP +#define _CENVFXMANAGER_HPP + +#include "types.h" + +#include "MetroidPrime/CSfxHandle.hpp" +#include "MetroidPrime/TGameTypes.hpp" + +#include "Kyoto/Math/CAABox.hpp" +#include "Kyoto/Math/CVector2i.hpp" +#include "Kyoto/Math/CVector3f.hpp" +#include "Kyoto/TToken.hpp" + +#include "rstl/pair.hpp" +#include "rstl/reserved_vector.hpp" +#include "rstl/vector.hpp" + +class CGenDescription; +class CTexture; + +class CVectorFixed8_8 { +private: + s16 x; + s16 y; + s16 z; +}; + +class CEnvFxManagerGrid { +private: + bool x0_24_blockDirty; + CVector2i x4_position; /* 8.8 fixed point */ + CVector2i xc_extent; /* 8.8 fixed point */ + rstl::pair< bool, f32 > x14_block; /* Blocked-bool, Z-coordinate */ + rstl::vector< CVectorFixed8_8 > x1c_particles; +}; + +class CEnvFxManager { +private: + CAABox x0_particleBounds; + CVector3f x18_focusCellPosition; + bool x24_enableSplash; + f32 x28_firstSnowForce; + s32 x2c_lastBlockedGridIdx; + f32 x30_fxDensity; + f32 x34_targetFxDensity; + f32 x38_maxDensityDeltaSpeed; + bool x3c_snowflakeTextureMipBlanked; + TLockedToken< CTexture > x40_txtrEnvGradient; + rstl::reserved_vector< CEnvFxManagerGrid, 64 > x50_grids; + f32 xb54_baseSplashRate; + TLockedToken< CGenDescription > xb58_envRainSplash; + bool xb64_ = true; + TUniqueId xb68_envRainSplashId = kInvalidUniqueId; + bool xb6a_rainSoundActive; + CSfxHandle xb6c_leftRainSound; + CSfxHandle xb70_rightRainSound; + TLockedToken< CTexture > xb74_txtrSnowFlake; + bool xb80_; + rstl::reserved_vector< CVector3f, 16 > xb84_snowZDeltas; + TLockedToken< CTexture > xc48_underwaterFlake; + bool xc54_; +}; + +#endif \ No newline at end of file diff --git a/include/MetroidPrime/CFluidPlaneManager.hpp b/include/MetroidPrime/CFluidPlaneManager.hpp new file mode 100644 index 00000000..d708fcf2 --- /dev/null +++ b/include/MetroidPrime/CFluidPlaneManager.hpp @@ -0,0 +1,25 @@ +#ifndef _CFLUIDPLANEMANAGER_HPP +#define _CFLUIDPLANEMANAGER_HPP + +#include "types.h" + +#include "MetroidPrime/CRippleManager.hpp" +#include "MetroidPrime/TGameTypes.hpp" + +#include "rstl/reserved_vector.hpp" + +class CFluidPlaneManager { +private: + class CSplashRecord { + f32 x0_time; + TUniqueId x4_id; + }; + + CRippleManager x0_rippleManager; + rstl::reserved_vector< CSplashRecord, 32 > x18_splashes; + float x11c_uvT; + bool x120_; + bool x121_; +}; + +#endif \ No newline at end of file diff --git a/include/MetroidPrime/CRippleManager.hpp b/include/MetroidPrime/CRippleManager.hpp new file mode 100644 index 00000000..bbc546d3 --- /dev/null +++ b/include/MetroidPrime/CRippleManager.hpp @@ -0,0 +1,17 @@ +#ifndef _CRIPPLEMANAGER_HPP +#define _CRIPPLEMANAGER_HPP + +#include "types.h" + +#include "rstl/vector.hpp" + +class CRipple; + +class CRippleManager { +private: + f32 x0_maxTimeFalloff; + rstl::vector< CRipple > x4_ripples; + f32 x14_alpha; +}; + +#endif \ No newline at end of file diff --git a/include/MetroidPrime/CRumbleManager.hpp b/include/MetroidPrime/CRumbleManager.hpp new file mode 100644 index 00000000..5827c36f --- /dev/null +++ b/include/MetroidPrime/CRumbleManager.hpp @@ -0,0 +1,13 @@ +#ifndef _CRUMBLEMANAGER_HPP +#define _CRUMBLEMANAGER_HPP + +#include "types.h" + +#include "Kyoto/Input/CRumbleGenerator.hpp" + +class CRumbleManager { +private: + CRumbleGenerator x0_rumbleGenerator; +}; + +#endif \ No newline at end of file diff --git a/include/MetroidPrime/CSortedLists.hpp b/include/MetroidPrime/CSortedLists.hpp new file mode 100644 index 00000000..22e1213d --- /dev/null +++ b/include/MetroidPrime/CSortedLists.hpp @@ -0,0 +1,35 @@ +#ifndef _CSORTEDLISTS_HPP +#define _CSORTEDLISTS_HPP + +#include "types.h" + +#include "MetroidPrime/CObjectList.hpp" + +#include "Kyoto/Math/CAABox.hpp" + +class CActor; + +namespace SL { +struct SNode { + CActor* x0_actor; + CAABox x4_box; + s16 x1c_selfIdxs[6]; + s16 x28_next; + bool x2a_populated; +}; +CHECK_SIZEOF(SNode, 0x2c); + +struct SSortedList { + s16 x0_ids[kMaxObjects]; + u32 x800_size; +}; +CHECK_SIZEOF(SSortedList, 0x804); + +class CSortedListManager { + SNode x0_nodes[kMaxObjects]; + SSortedList xb000_sortedLists[6]; +}; +CHECK_SIZEOF(CSortedListManager, 0xe018); +} // namespace SL + +#endif \ No newline at end of file diff --git a/include/MetroidPrime/CStateManager.hpp b/include/MetroidPrime/CStateManager.hpp index eac6e716..2df37c08 100644 --- a/include/MetroidPrime/CStateManager.hpp +++ b/include/MetroidPrime/CStateManager.hpp @@ -11,15 +11,27 @@ #include "rstl/reserved_vector.hpp" #include "rstl/single_ptr.hpp" +class CActorModelParticles; +class CCameraManager; +class CEnvFxManager; +class CFluidPlaneManager; class CObjectList; class CPlayer; -class CWorld; +class CRumbleManager; class CStateManagerContainer; +class CWeaponMgr; +class CWorld; + +namespace SL { +class CSortedListManager; +} // namespace SL class CStateManager { public: void SendScriptMsg(TUniqueId uid, TEditorId target, EScriptObjectMessage msg, EScriptObjectState state); + CCameraManager& GetCameraManager() { return *x870_cameraManager; } + private: u16 x0_nextFreeIndex; rstl::reserved_vector< u16, 1024 > x8_objectIndexArray; @@ -28,6 +40,13 @@ private: rstl::single_ptr< CWorld > x850_world; rstl::list< rstl::reserved_vector< TUniqueId, 32 > > x854_graveyard; rstl::single_ptr< CStateManagerContainer > x86c_stateManagerContainer; + CCameraManager* x870_cameraManager; + SL::CSortedListManager* x874_sortedListManager; + CWeaponMgr* x878_weaponMgr; + CFluidPlaneManager* x87c_fluidPlaneManager; + CEnvFxManager* x880_envFxManager; + rstl::auto_ptr< CActorModelParticles > x884_actorModelParticles; + CRumbleManager* x88c_rumbleManager; }; #endif diff --git a/include/MetroidPrime/CStateManagerContainer.hpp b/include/MetroidPrime/CStateManagerContainer.hpp index 310d25fa..73eba8ad 100644 --- a/include/MetroidPrime/CStateManagerContainer.hpp +++ b/include/MetroidPrime/CStateManagerContainer.hpp @@ -3,8 +3,14 @@ #include "types.h" -#include "MetroidPrime/TGameTypes.hpp" +#include "MetroidPrime/CActorModelParticles.hpp" +#include "MetroidPrime/CEnvFxManager.hpp" +#include "MetroidPrime/CFluidPlaneManager.hpp" +#include "MetroidPrime/CRumbleManager.hpp" +#include "MetroidPrime/CSortedLists.hpp" +#include "MetroidPrime/CWeaponMgr.hpp" #include "MetroidPrime/Cameras/CCameraManager.hpp" +#include "MetroidPrime/TGameTypes.hpp" #include "rstl/reserved_vector.hpp" diff --git a/include/MetroidPrime/CWeaponMgr.hpp b/include/MetroidPrime/CWeaponMgr.hpp new file mode 100644 index 00000000..e9bbd833 --- /dev/null +++ b/include/MetroidPrime/CWeaponMgr.hpp @@ -0,0 +1,17 @@ +#ifndef _CWEAPONMANAGER_HPP +#define _CWEAPONMANAGER_HPP + +#include "types.h" + +#include "MetroidPrime/TGameTypes.hpp" + +#include "rstl/map.hpp" +#include "rstl/reserved_vector.hpp" + +class CWeaponMgr { +private: + rstl::map< TUniqueId, rstl::reserved_vector< s32, 15 > > x0_weapons; +}; +CHECK_SIZEOF(CWeaponMgr, 0x14); + +#endif \ No newline at end of file diff --git a/include/MetroidPrime/Cameras/CCameraManager.hpp b/include/MetroidPrime/Cameras/CCameraManager.hpp index b43988c5..752b9619 100644 --- a/include/MetroidPrime/Cameras/CCameraManager.hpp +++ b/include/MetroidPrime/Cameras/CCameraManager.hpp @@ -16,9 +16,14 @@ class CBallCamera; class CCameraShakeData; class CFirstPersonCamera; +class CGameCamera; class CInterpolationCamera; +class CStateManager; class CCameraManager { +public: + CGameCamera* GetCurrentCamera(CStateManager& mgr); + private: TUniqueId x0_curCameraId; rstl::vector< TUniqueId > x4_cineCameras; @@ -32,6 +37,7 @@ private: CBallCamera* x80_ballCamera; s32 x84_rumbleId; CInterpolationCamera* x88_interpCamera; + s16 x8c_; f32 x90_rumbleCooldown; f32 x94_fogDensityFactor; f32 x98_fogDensitySpeed; @@ -48,9 +54,8 @@ private: rstl::reserved_vector< TUniqueId, 64 > x334_activeCameraHints; bool x3b8_24_ : 1; bool x3b8_25_ : 1; - float x3bc_curFov; + f32 x3bc_curFov; }; - CHECK_SIZEOF(CCameraManager, 0x3c0) #endif \ No newline at end of file diff --git a/include/MetroidPrime/Cameras/CGameCamera.hpp b/include/MetroidPrime/Cameras/CGameCamera.hpp new file mode 100644 index 00000000..d5e66297 --- /dev/null +++ b/include/MetroidPrime/Cameras/CGameCamera.hpp @@ -0,0 +1,31 @@ +#ifndef _CGAMECAMERA_HPP +#define _CGAMECAMERA_HPP + +#include "types.h" + +#include "MetroidPrime/CActor.hpp" + +#include "Kyoto/Math/CTransform4f.hpp" +#include "Kyoto/Math/CMatrix4f.hpp" + +class CGameCamera : public CActor { +private: + TUniqueId xe8_watchedObject; + mutable CMatrix4f xec_perspectiveMatrix; + CTransform4f x12c_origXf; + f32 x15c_currentFov; + f32 x160_znear; + f32 x164_zfar; + f32 x168_aspect; + u32 x16c_controllerIdx; + mutable bool x170_24_perspDirty : 1; + bool x170_25_disablesInput : 1; + f32 x174_delayTime; + f32 x178_perspInterpRemTime; + f32 x17c_perspInterpDur; + f32 x180_perspInterpStartFov; + f32 x184_perspInterpEndFov; +}; +CHECK_SIZEOF(CGameCamera, 0x188) + +#endif \ No newline at end of file diff --git a/include/rstl/map.hpp b/include/rstl/map.hpp index 0a4eb5ce..59729ece 100644 --- a/include/rstl/map.hpp +++ b/include/rstl/map.hpp @@ -6,7 +6,10 @@ #include "rstl/rmemory_allocator.hpp" namespace rstl { -template < typename K, typename V, typename Alloc = rmemory_allocator > +template < typename T > +struct less {}; + +template < typename K, typename V, typename Cmp = less< K >, typename Alloc = rmemory_allocator > class map { u8 pad[0x10]; };