From fb1ce432aac35ad4719d242d266100f9e92ec412 Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Sun, 14 Aug 2016 15:19:04 -1000 Subject: [PATCH] CStateManager::InitializeResources() dependencies all in --- Runtime/CStateManager.cpp | 13 +- Runtime/CStateManager.hpp | 12 + Runtime/Camera/CBallCamera.cpp | 22 ++ Runtime/Camera/CBallCamera.hpp | 3 + Runtime/Camera/CCameraManager.cpp | 16 + Runtime/Camera/CCameraManager.hpp | 1 + Runtime/Camera/CCinematicCamera.cpp | 8 + Runtime/Camera/CCinematicCamera.hpp | 3 + Runtime/Camera/CFirstPersonCamera.cpp | 22 ++ Runtime/Camera/CFirstPersonCamera.hpp | 3 + Runtime/Camera/CGameCamera.hpp | 7 +- Runtime/Camera/CPathCamera.cpp | 27 ++ Runtime/Camera/CPathCamera.hpp | 3 + Runtime/Character/CModelData.hpp | 2 + Runtime/GameGlobalObjects.cpp | 2 + Runtime/World/CEnvFxManager.cpp | 10 + Runtime/World/CEnvFxManager.hpp | 3 + Runtime/World/CGrappleArm.cpp | 14 + Runtime/World/CGrappleArm.hpp | 1 + Runtime/World/CGunWeapon.cpp | 4 + Runtime/World/CGunWeapon.hpp | 2 + Runtime/World/CPlayer.cpp | 473 ++++++++++++++++++++++++++ Runtime/World/CPlayer.hpp | 178 ++++++++++ Runtime/World/CPlayerGun.cpp | 11 + Runtime/World/CPlayerGun.hpp | 90 ++++- 25 files changed, 916 insertions(+), 14 deletions(-) diff --git a/Runtime/CStateManager.cpp b/Runtime/CStateManager.cpp index 3c2a6f82e..3ea91cb05 100644 --- a/Runtime/CStateManager.cpp +++ b/Runtime/CStateManager.cpp @@ -503,6 +503,9 @@ void CStateManager::FrameBegin() void CStateManager::InitializeState(ResId mlvlId, TAreaId aid, ResId mreaId) { + bool hadRandom = x900_activeRandom != nullptr; + x900_activeRandom = &x8fc_random; + if (xb3c_initPhase == InitPhase::LoadWorld) { CreateStandardGameObjects(); @@ -577,7 +580,15 @@ void CStateManager::InitializeState(ResId mlvlId, TAreaId aid, ResId mreaId) entId = x80c_allObjs->GetNextObjectIndex(entId); } - /* TODO: Finish */ + x84c_player->AsyncLoadSuit(*this); + x870_cameraManager->ResetCameras(*this); + + if (!hadRandom) + x900_activeRandom = nullptr; + else + x900_activeRandom = &x8fc_random; + + x880_envFxManager->AsyncLoadResources(*this); } void CStateManager::CreateStandardGameObjects() diff --git a/Runtime/CStateManager.hpp b/Runtime/CStateManager.hpp index d7d3f6fe0..e7bba9868 100644 --- a/Runtime/CStateManager.hpp +++ b/Runtime/CStateManager.hpp @@ -111,6 +111,7 @@ class CStateManager TLockedToken x8f0_shadowTex; /* DefaultShadow in MiscData */ CRandom16 x8fc_random; + CRandom16* x900_activeRandom = nullptr; FScriptLoader x904_loaderFuncs[int(EScriptObjectType::ScriptObjectTypeMAX)] = {}; @@ -284,6 +285,17 @@ public: std::shared_ptr MapWorldInfo() { return x8c0_mapWorldInfo; } bool IsLayerActive(TAreaId area, int layerIdx) { return false; } + + CPlayer& GetPlayer() const { return *x84c_player; } + + CObjectList& GetAllObjectList() const { return *x80c_allObjs; } + CActorList& GetActorObjectList() const { return *x814_actorObjs; } + CPhysicsActorList& GetPhysicsActorObjectList() const { return *x81c_physActorObjs; } + CGameCameraList& GetCameraObjectList() const { return *x824_cameraObjs; } + CGameLightList& GetLightObjectList() const { return *x82c_lightObjs; } + CListeningAiList& GetListeningAiObjectList() const { return *x834_listenAiObjs; } + CAiWaypointList& GetAiWaypointObjectList() const { return *x83c_aiWaypointObjs; } + CPlatformAndDoorList& GetPlatformAndDoorObjectList() const { return *x844_platformAndDoorObjs; } }; } diff --git a/Runtime/Camera/CBallCamera.cpp b/Runtime/Camera/CBallCamera.cpp index e69de29bb..ee5d1b95c 100644 --- a/Runtime/Camera/CBallCamera.cpp +++ b/Runtime/Camera/CBallCamera.cpp @@ -0,0 +1,22 @@ +#include "CBallCamera.hpp" + +namespace urde +{ + +CBallCamera::CBallCamera(TUniqueId uid, TUniqueId id2, const zeus::CTransform& xf, + float a, float b, float c, float d) +: CGameCamera(uid, true, "Ball Camera", + CEntityInfo(kInvalidAreaId, CEntity::NullConnectionList), + xf, a, b, c, d, id2, 0, 0) +{ +} + +void CBallCamera::ProcessInput(const CFinalInput&, CStateManager& mgr) +{ +} + +void CBallCamera::Reset(const zeus::CTransform&, CStateManager& mgr) +{ +} + +} diff --git a/Runtime/Camera/CBallCamera.hpp b/Runtime/Camera/CBallCamera.hpp index 750d6536e..f8e4eed26 100644 --- a/Runtime/Camera/CBallCamera.hpp +++ b/Runtime/Camera/CBallCamera.hpp @@ -10,6 +10,9 @@ class CBallCamera : public CGameCamera { public: CBallCamera(TUniqueId, TUniqueId, const zeus::CTransform& xf, float, float, float, float); + + void ProcessInput(const CFinalInput&, CStateManager& mgr); + void Reset(const zeus::CTransform&, CStateManager& mgr); }; } diff --git a/Runtime/Camera/CCameraManager.cpp b/Runtime/Camera/CCameraManager.cpp index f899e2b8c..96dcb33a8 100644 --- a/Runtime/Camera/CCameraManager.cpp +++ b/Runtime/Camera/CCameraManager.cpp @@ -5,6 +5,7 @@ #include "CStateManager.hpp" #include "Input/CRumbleManager.hpp" #include "World/CScriptWater.hpp" +#include "World/CPlayer.hpp" namespace urde { @@ -136,4 +137,19 @@ const CGameCamera* CCameraManager::GetCurrentCamera(const CStateManager& stateMg return static_cast(camList->GetObjectById(GetCurrentCameraId())); } +void CCameraManager::ResetCameras(CStateManager& mgr) +{ + CGameCameraList& camList = mgr.GetCameraObjectList(); + zeus::CTransform xf = mgr.GetPlayer().CreateTransformFromMovementDirection(); + xf.origin = mgr.GetPlayer().GetEyePosition(); + + TUniqueId camId = camList.GetFirstObjectIndex(); + while (camId != kInvalidUniqueId) + { + CGameCamera* camObj = static_cast(camList.GetObjectById(camId)); + camObj->Reset(xf, mgr); + camId = camList.GetNextObjectIndex(camId); + } +} + } diff --git a/Runtime/Camera/CCameraManager.hpp b/Runtime/Camera/CCameraManager.hpp index e26210ef5..c125b76f2 100644 --- a/Runtime/Camera/CCameraManager.hpp +++ b/Runtime/Camera/CCameraManager.hpp @@ -47,6 +47,7 @@ public: static float DefaultFirstPersonFOV() {return 55.0f;} static float DefaultThirdPersonFOV() {return 60.0f;} + void ResetCameras(CStateManager& mgr); void SetSpecialCameras(CFirstPersonCamera& fp, CBallCamera& ball) { x7c_fpCamera = &fp; diff --git a/Runtime/Camera/CCinematicCamera.cpp b/Runtime/Camera/CCinematicCamera.cpp index 6a5e7053c..a7634b81b 100644 --- a/Runtime/Camera/CCinematicCamera.cpp +++ b/Runtime/Camera/CCinematicCamera.cpp @@ -9,4 +9,12 @@ CCinematicCamera::CCinematicCamera(TUniqueId uid, const std::string& name, const { } +void CCinematicCamera::ProcessInput(const CFinalInput&, CStateManager& mgr) +{ +} + +void CCinematicCamera::Reset(const zeus::CTransform&, CStateManager& mgr) +{ +} + } diff --git a/Runtime/Camera/CCinematicCamera.hpp b/Runtime/Camera/CCinematicCamera.hpp index becdeb3c1..7e270ca58 100644 --- a/Runtime/Camera/CCinematicCamera.hpp +++ b/Runtime/Camera/CCinematicCamera.hpp @@ -11,6 +11,9 @@ class CCinematicCamera : public CGameCamera public: CCinematicCamera(TUniqueId, const std::string& name, const CEntityInfo& info, const zeus::CTransform& xf, bool, float, float, float, float, float, u32); + + void ProcessInput(const CFinalInput&, CStateManager& mgr); + void Reset(const zeus::CTransform&, CStateManager& mgr); }; } diff --git a/Runtime/Camera/CFirstPersonCamera.cpp b/Runtime/Camera/CFirstPersonCamera.cpp index e69de29bb..528839444 100644 --- a/Runtime/Camera/CFirstPersonCamera.cpp +++ b/Runtime/Camera/CFirstPersonCamera.cpp @@ -0,0 +1,22 @@ +#include "CFirstPersonCamera.hpp" + +namespace urde +{ + +CFirstPersonCamera::CFirstPersonCamera(TUniqueId uid, const zeus::CTransform& xf, TUniqueId id2, + float, float a, float b, float c, float d) +: CGameCamera(uid, true, "First Person Camera", + CEntityInfo(kInvalidAreaId, CEntity::NullConnectionList), + xf, a, b, c, d, id2, 0, 0) +{ +} + +void CFirstPersonCamera::ProcessInput(const CFinalInput&, CStateManager& mgr) +{ +} + +void CFirstPersonCamera::Reset(const zeus::CTransform&, CStateManager& mgr) +{ +} + +} diff --git a/Runtime/Camera/CFirstPersonCamera.hpp b/Runtime/Camera/CFirstPersonCamera.hpp index 6d1802787..cf2e54bd4 100644 --- a/Runtime/Camera/CFirstPersonCamera.hpp +++ b/Runtime/Camera/CFirstPersonCamera.hpp @@ -10,6 +10,9 @@ class CFirstPersonCamera : public CGameCamera { public: CFirstPersonCamera(TUniqueId, const zeus::CTransform& xf, TUniqueId, float, float, float, float, float); + + void ProcessInput(const CFinalInput&, CStateManager& mgr); + void Reset(const zeus::CTransform&, CStateManager& mgr); }; } diff --git a/Runtime/Camera/CGameCamera.hpp b/Runtime/Camera/CGameCamera.hpp index c1d54e6b2..cc53e4894 100644 --- a/Runtime/Camera/CGameCamera.hpp +++ b/Runtime/Camera/CGameCamera.hpp @@ -6,13 +6,18 @@ namespace urde { +class CFinalInput; class CGameCamera : public CActor { public: CGameCamera(TUniqueId, bool active, const std::string& name, const CEntityInfo& info, - const zeus::CTransform& xf, float, float, float, float, TUniqueId, bool, u32); + const zeus::CTransform& xf, float fov, float nearz, float farz, float aspect, + TUniqueId, bool, u32); const zeus::CTransform& GetTransform() const {return x34_transform;} + + virtual void ProcessInput(const CFinalInput&, CStateManager& mgr)=0; + virtual void Reset(const zeus::CTransform&, CStateManager& mgr)=0; }; } diff --git a/Runtime/Camera/CPathCamera.cpp b/Runtime/Camera/CPathCamera.cpp index e69de29bb..ca33153d3 100644 --- a/Runtime/Camera/CPathCamera.cpp +++ b/Runtime/Camera/CPathCamera.cpp @@ -0,0 +1,27 @@ +#include "CPathCamera.hpp" +#include "CCameraManager.hpp" + +namespace urde +{ + +CPathCamera::CPathCamera(TUniqueId uid, const std::string& name, const CEntityInfo& info, + const zeus::CTransform& xf, bool active, bool, bool, bool, bool, + 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) +{ +} + +void CPathCamera::ProcessInput(const CFinalInput&, CStateManager& mgr) +{ +} + +void CPathCamera::Reset(const zeus::CTransform&, CStateManager& mgr) +{ +} + +} diff --git a/Runtime/Camera/CPathCamera.hpp b/Runtime/Camera/CPathCamera.hpp index 31c2effbd..51947ad4e 100644 --- a/Runtime/Camera/CPathCamera.hpp +++ b/Runtime/Camera/CPathCamera.hpp @@ -16,6 +16,9 @@ public: const zeus::CTransform& xf, bool, bool, bool, bool, bool, float, float, float, float, float, float, float, u32, EInitialSplinePosition); + + void ProcessInput(const CFinalInput&, CStateManager& mgr); + void Reset(const zeus::CTransform&, CStateManager& mgr); }; } diff --git a/Runtime/Character/CModelData.hpp b/Runtime/Character/CModelData.hpp index 27b5c029d..8da8861c3 100644 --- a/Runtime/Character/CModelData.hpp +++ b/Runtime/Character/CModelData.hpp @@ -89,6 +89,8 @@ public: Thermal }; + void SetSortThermal(bool v) { x14_25_sortThermal = v; } + ~CModelData(); CModelData(const CStaticRes& res); CModelData(const CAnimRes& res); diff --git a/Runtime/GameGlobalObjects.cpp b/Runtime/GameGlobalObjects.cpp index ae7745865..3d7284ded 100644 --- a/Runtime/GameGlobalObjects.cpp +++ b/Runtime/GameGlobalObjects.cpp @@ -15,5 +15,7 @@ class CBooRenderer* g_Renderer = nullptr; DataSpec::ITweakGame* g_tweakGame = nullptr; DataSpec::ITweakPlayer* g_tweakPlayer = nullptr; DataSpec::ITweakPlayerControl* g_tweakPlayerControl = nullptr; +DataSpec::ITweakPlayerGun* g_tweakPlayerGun = nullptr; +DataSpec::ITweakGunRes* g_tweakGunRes = nullptr; } diff --git a/Runtime/World/CEnvFxManager.cpp b/Runtime/World/CEnvFxManager.cpp index e69de29bb..83cb825a1 100644 --- a/Runtime/World/CEnvFxManager.cpp +++ b/Runtime/World/CEnvFxManager.cpp @@ -0,0 +1,10 @@ +#include "CEnvFxManager.hpp" + +namespace urde +{ + +void CEnvFxManager::AsyncLoadResources(CStateManager& mgr) +{ +} + +} diff --git a/Runtime/World/CEnvFxManager.hpp b/Runtime/World/CEnvFxManager.hpp index 762c5b688..42e3b33fb 100644 --- a/Runtime/World/CEnvFxManager.hpp +++ b/Runtime/World/CEnvFxManager.hpp @@ -3,6 +3,7 @@ namespace urde { +class CStateManager; enum class EEnvFxType { @@ -20,6 +21,8 @@ enum class EPhazonType class CEnvFxManager { +public: + void AsyncLoadResources(CStateManager& mgr); }; } diff --git a/Runtime/World/CGrappleArm.cpp b/Runtime/World/CGrappleArm.cpp index e69de29bb..5b6bb9fea 100644 --- a/Runtime/World/CGrappleArm.cpp +++ b/Runtime/World/CGrappleArm.cpp @@ -0,0 +1,14 @@ +#include "CGrappleArm.hpp" + +namespace urde +{ + +CGrappleArm::CGrappleArm(const zeus::CVector3f& vec) +{ +} + +void CGrappleArm::AsyncLoadSuit(CStateManager& mgr) +{ +} + +} diff --git a/Runtime/World/CGrappleArm.hpp b/Runtime/World/CGrappleArm.hpp index d52a19428..6051b17dd 100644 --- a/Runtime/World/CGrappleArm.hpp +++ b/Runtime/World/CGrappleArm.hpp @@ -14,6 +14,7 @@ class CGrappleArm public: CGrappleArm(const zeus::CVector3f& vec); + void AsyncLoadSuit(CStateManager& mgr); }; } diff --git a/Runtime/World/CGunWeapon.cpp b/Runtime/World/CGunWeapon.cpp index dc9729c83..f5be6e77f 100644 --- a/Runtime/World/CGunWeapon.cpp +++ b/Runtime/World/CGunWeapon.cpp @@ -7,4 +7,8 @@ CGunWeapon::CGunWeapon(u32, EWeaponType type, TUniqueId, EMaterialTypes, const z { } +void CGunWeapon::AsyncLoadSuitArm(CStateManager& mgr) +{ +} + } diff --git a/Runtime/World/CGunWeapon.hpp b/Runtime/World/CGunWeapon.hpp index 5761def20..9f309d26e 100644 --- a/Runtime/World/CGunWeapon.hpp +++ b/Runtime/World/CGunWeapon.hpp @@ -8,11 +8,13 @@ namespace urde { +class CStateManager; class CGunWeapon { public: CGunWeapon(u32, EWeaponType type, TUniqueId, EMaterialTypes, const zeus::CVector3f& vec); + void AsyncLoadSuitArm(CStateManager& mgr); }; } diff --git a/Runtime/World/CPlayer.cpp b/Runtime/World/CPlayer.cpp index aed651f59..1f999815d 100644 --- a/Runtime/World/CPlayer.cpp +++ b/Runtime/World/CPlayer.cpp @@ -19,8 +19,481 @@ CPlayer::CPlayer(TUniqueId uid, const zeus::CTransform& xf, const zeus::CAABox& x768_morphball.reset(new CMorphBall(*this, f4)); } +bool CPlayer::IsTransparent() const +{ +} + +void CPlayer::Update(float, CStateManager& mgr) +{ +} + +bool CPlayer::IsPlayerDeadEnough() const +{ +} + +void CPlayer::AsyncLoadSuit(CStateManager& mgr) +{ + x490_gun->AsyncLoadSuit(mgr); +} + +void CPlayer::LoadAnimationTokens() +{ +} + +bool CPlayer::CanRenderUnsorted(CStateManager& mgr) const +{ +} + +const CDamageVulnerability& CPlayer::GetDamageVulnerability(const zeus::CVector3f& v1, + const zeus::CVector3f& v2, + const CDamageInfo& info) const +{ +} + +const CDamageVulnerability& CPlayer::GetDamageVulnerability() const +{ +} + +zeus::CVector3f CPlayer::GetHomingPosition(CStateManager& mgr, float) const +{ +} + +zeus::CVector3f CPlayer::GetAimPosition(CStateManager& mgr, float) const +{ +} + +void CPlayer::FluidFXThink(CActor::EFluidState, CScriptWater& water, CStateManager& mgr) +{ +} + +zeus::CVector3f CPlayer::GetDamageLocationWR() const +{ +} + +float CPlayer::GetPrevDamageAmount() const +{ +} + +float CPlayer::GetDamageAmount() const +{ +} + +bool CPlayer::WasDamaged() const +{ +} + +void CPlayer::TakeDamage(bool, const zeus::CVector3f&, float, EWeaponType, CStateManager& mgr) +{ +} + +void CPlayer::Accept(IVisitor& visitor) +{ +} + +CHealthInfo& CPlayer::HealthInfo(CStateManager& mgr) +{ +} + +bool CPlayer::IsUnderBetaMetroidAttack(CStateManager& mgr) const +{ +} + +rstl::optional_object CPlayer::GetTouchBounds() const +{ +} + +void CPlayer::Touch(CActor&, CStateManager& mgr) +{ +} + +void CPlayer::UpdateScanningState(const CFinalInput& input, CStateManager& mgr, float) +{ +} + +void CPlayer::ValidateScanning(const CFinalInput& input, CStateManager& mgr) +{ +} + +void CPlayer::SetScanningState(EPlayerScanState, CStateManager& mgr) +{ +} + +bool CPlayer::GetExplorationMode() const +{ +} + +bool CPlayer::GetCombatMode() const +{ +} + +void CPlayer::RenderGun(CStateManager& mgr, const zeus::CVector3f&) const +{ +} + +void CPlayer::Render(CStateManager& mgr) const +{ +} + +void CPlayer::RenderReflectedPlayer(CStateManager& mgr) const +{ +} + +void CPlayer::PreRender(CStateManager& mgr, const zeus::CFrustum&) +{ +} + +void CPlayer::CalculateRenderBounds() +{ +} + +void CPlayer::AddToRenderer(const zeus::CFrustum&, CStateManager&) +{ +} + +void CPlayer::ComputeFreeLook(const CFinalInput& input) +{ +} + +void CPlayer::UpdateFreeLook(float dt) +{ +} + +float CPlayer::GetMaximumPlayerPositiveVerticalVelocity(CStateManager&) const +{ +} + +void CPlayer::ProcessInput(const CFinalInput&, CStateManager&) +{ +} + +bool CPlayer::GetFrozenState() const +{ +} + +void CPlayer::Think(float, CStateManager&) +{ +} + +void CPlayer::PreThink(float, CStateManager&) +{ +} + +void CPlayer::AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) +{ +} + +void CPlayer::SetVisorSteam(float, float, float, u32, bool) +{ +} + +void CPlayer::UpdateFootstepBounds(const CFinalInput& input, CStateManager&, float) +{ +} + +u16 CPlayer::GetMaterialSoundUnderPlayer(CStateManager& mgr, const u16*, int, u16) +{ +} + +u16 CPlayer::SfxIdFromMaterial(const CMaterialList&, const u16*, u16) +{ +} + +void CPlayer::UpdateCrosshairsState(const CFinalInput&) +{ +} + +void CPlayer::UpdateVisorTransition(float, CStateManager& mgr) +{ +} + +void CPlayer::UpdateVisorState(const CFinalInput&, float, CStateManager& mgr) +{ +} + +void CPlayer::ForceGunOrientation(const zeus::CTransform&, CStateManager& mgr) +{ +} + +void CPlayer::UpdateDebugCamera(CStateManager& mgr) +{ +} + +CFirstPersonCamera& CPlayer::GetFirstPersonCamera(CStateManager& mgr) +{ +} + +void CPlayer::UpdateGunTransform(const zeus::CVector3f&, float, CStateManager& mgr, bool) +{ +} + +void CPlayer::DrawGun(CStateManager& mgr) +{ +} + +void CPlayer::HolsterGun(CStateManager& mgr) +{ +} + +bool CPlayer::GetMorphballTransitionState() const +{ +} + +void CPlayer::UpdateGrappleArmTransform(const zeus::CVector3f&, CStateManager& mgr, float) +{ +} + +void CPlayer::ApplyGrappleForces(const CFinalInput& input, CStateManager& mgr, float) +{ +} + +bool CPlayer::ValidateFPPosition(const zeus::CVector3f& pos, CStateManager& mgr) +{ +} + +void CPlayer::UpdateGrappleState(const CFinalInput& input, CStateManager& mgr) +{ +} + +void CPlayer::ApplyGrappleJump(CStateManager& mgr) +{ +} + +void CPlayer::BeginGrapple(zeus::CVector3f&, CStateManager& mgr) +{ +} + +void CPlayer::BreakGrapple(CStateManager& mgr) +{ +} + +void CPlayer::PreventFallingCameraPitch() +{ +} + +void CPlayer::OrbitCarcass(CStateManager&) +{ +} + +void CPlayer::OrbitPoint(EPlayerOrbitType, CStateManager& mgr) +{ +} + +zeus::CVector3f CPlayer::GetHUDOrbitTargetPosition() const +{ +} + +void CPlayer::SetOrbitState(EPlayerOrbitState, CStateManager& mgr) +{ +} + +void CPlayer::SetOrbitTargetId(TUniqueId) +{ +} + +void CPlayer::UpdateOrbitPosition(float, CStateManager& mgr) +{ +} + +void CPlayer::UpdateOrbitZPosition() +{ +} + +void CPlayer::UpdateOrbitFixedPosition() +{ +} + +void CPlayer::SetOrbitPosition(float, CStateManager& mgr) +{ +} + +void CPlayer::UpdateAimTarget(CStateManager& mgr) +{ +} + +void CPlayer::UpdateAimTargetTimer(float) +{ +} + +bool CPlayer::ValidateAimTargetId(TUniqueId, CStateManager& mgr) +{ +} + +bool CPlayer::ValidateObjectForMode(TUniqueId, CStateManager& mgr) const +{ +} + +TUniqueId CPlayer::FindAimTargetId(CStateManager& mgr) +{ +} + +TUniqueId CPlayer::CheckEnemiesAgainstOrbitZone(const std::vector&, EPlayerZoneInfo, + EPlayerZoneType, CStateManager& mgr) const +{ +} + +TUniqueId CPlayer::FindOrbitTargetId(CStateManager& mgr) +{ +} + +void CPlayer::UpdateOrbitableObjects(CStateManager& mgr) +{ +} + +TUniqueId CPlayer::FindBestOrbitableObject(const std::vector&, EPlayerZoneInfo, CStateManager& mgr) const +{ +} + +void CPlayer::FindOrbitableObjects(const std::vector&, std::vector&, EPlayerZoneInfo, + EPlayerZoneType, CStateManager& mgr, bool) const +{ +} + +bool CPlayer::WithinOrbitScreenBox(const zeus::CVector3f&, EPlayerZoneInfo, EPlayerZoneType) const +{ +} + +bool CPlayer::WithinOrbitScreenEllipse(const zeus::CVector3f&, EPlayerZoneInfo) const +{ +} + +void CPlayer::CheckOrbitDisableSourceList(CStateManager& mgr) +{ +} + +void CPlayer::CheckOrbitDisableSourceList() const +{ +} + +void CPlayer::RemoveOrbitDisableSource(TUniqueId) +{ +} + +void CPlayer::AddOrbitDisableSource(CStateManager& mgr, TUniqueId) +{ +} + +void CPlayer::UpdateOrbitPreventionTimer(float) +{ +} + +void CPlayer::UpdateOrbitModeTimer(float) +{ +} + +void CPlayer::UpdateOrbitZone(CStateManager& mgr) +{ +} + +void CPlayer::UpdateOrbitInput(const CFinalInput& input, CStateManager& mgr) +{ +} + +void CPlayer::UpdateOrbitSelection(const CFinalInput& input, CStateManager& mgr) +{ +} + +void CPlayer::UpdateOrbitOrientation(CStateManager& mgr) +{ +} + +void CPlayer::UpdateOrbitTarget(CStateManager& mgr) +{ +} + +float CPlayer::GetOrbitMaxLockDistance(CStateManager& mgr) const +{ +} + +float CPlayer::GetOrbitMaxTargetDistance(CStateManager& mgr) const +{ +} + +bool CPlayer::ValidateOrbitTargetId(TUniqueId, CStateManager& mgr) const +{ +} + +bool CPlayer::ValidateCurrentOrbitTargetId(CStateManager& mgr) +{ +} + +bool CPlayer::ValidateOrbitTargetIdAndPointer(TUniqueId, CStateManager& mgr) const +{ +} + +zeus::CVector3f CPlayer::GetBallPosition() const +{ +} + +zeus::CVector3f CPlayer::GetEyePosition() const +{ +} + +float CPlayer::GetEyeHeight() const +{ +} + +float CPlayer::GetStepUpHeight() const +{ +} + +float CPlayer::GetStepDownHeight() const +{ +} + void CPlayer::Teleport(const zeus::CTransform& xf, CStateManager& mgr, bool) { } +zeus::CTransform CPlayer::CreateTransformFromMovementDirection() const +{ +} + +const CCollisionPrimitive& CPlayer::GetCollisionPrimitive() const +{ +} + +zeus::CTransform CPlayer::GetPrimitiveTransform() const +{ +} + +bool CPlayer::CollidedWith(TUniqueId, const CCollisionInfoList&, CStateManager& mgr) +{ +} + +float CPlayer::GetActualFirstPersonMaxVelocity() const +{ +} + +void CPlayer::SetMoveState(EPlayerMovementState, CStateManager& mgr) +{ +} + +float CPlayer::JumpInput(const CFinalInput& input, CStateManager& mgr) +{ +} + +float CPlayer::TurnInput(const CFinalInput& input) const +{ +} + +float CPlayer::StrafeInput(const CFinalInput& input) const +{ +} + +float CPlayer::ForwardInput(const CFinalInput& input, float) const +{ +} + +void CPlayer::ComputeMovement(const CFinalInput& input, CStateManager& mgr, float) +{ +} + +float CPlayer::GetWeight() const +{ +} + +float CPlayer::GetDampedClampedVelocityWR() const +{ +} + } diff --git a/Runtime/World/CPlayer.hpp b/Runtime/World/CPlayer.hpp index a50b0ec6c..131f871c7 100644 --- a/Runtime/World/CPlayer.hpp +++ b/Runtime/World/CPlayer.hpp @@ -4,16 +4,73 @@ #include "CPhysicsActor.hpp" #include "zeus/CAABox.hpp" #include "zeus/CTransform.hpp" +#include "CWeaponMgr.hpp" namespace urde { class CMaterialList; class CMorphBall; class CPlayerGun; +class CDamageInfo; +class CScriptWater; +class IVisitor; +class CFinalInput; +class CFirstPersonCamera; class CPlayer : public CPhysicsActor { friend class CStateManager; +public: + enum class EPlayerScanState + { + }; + enum class EPlayerOrbitType + { + }; + enum class EPlayerOrbitState + { + }; + enum class EPlayerZoneInfo + { + }; + enum class EPlayerZoneType + { + }; + enum class EPlayerMovementState + { + }; + +private: + + struct CVisorSteam + { + float x0_; + float x4_; + float x8_; + u32 xc_; + float x10_ = 0.f; + float x14_ = 0.f; + float x18_ = 0.f; + u32 x1c_ = 0; + float x20_ = 0.f; + float x24_ = 0.f; + bool x28_ = false; + + void SetSteam(float a, float b, float c, u32 d, bool e) + { + if (x1c_ == -1 || a > x10_) + { + x10_ = a; + x14_ = b; + x18_ = c; + x1c_ = d; + } + x28_ = e; + } + void Update(float dt); + CVisorSteam(float a, float b, float c, u32 d, bool e) + : x0_(a), x4_(b), x8_(c), xc_(d), x1c_(e) {} + }; std::unique_ptr x490_gun; std::unique_ptr x768_morphball; @@ -22,7 +79,128 @@ public: CPlayer(TUniqueId, const zeus::CTransform&, const zeus::CAABox&, unsigned int, const zeus::CVector3f&, float, float, float, float, const CMaterialList&); + bool IsTransparent() const; + void Update(float, CStateManager& mgr); + bool IsPlayerDeadEnough() const; + void AsyncLoadSuit(CStateManager& mgr); + void LoadAnimationTokens(); + bool CanRenderUnsorted(CStateManager& mgr) const; + const CDamageVulnerability& GetDamageVulnerability(const zeus::CVector3f& v1, + const zeus::CVector3f& v2, + const CDamageInfo& info) const; + const CDamageVulnerability& GetDamageVulnerability() const; + zeus::CVector3f GetHomingPosition(CStateManager& mgr, float) const; + zeus::CVector3f GetAimPosition(CStateManager& mgr, float) const; + void FluidFXThink(CActor::EFluidState, CScriptWater& water, CStateManager& mgr); + zeus::CVector3f GetDamageLocationWR() const; + float GetPrevDamageAmount() const; + float GetDamageAmount() const; + bool WasDamaged() const; + void TakeDamage(bool, const zeus::CVector3f&, float, EWeaponType, CStateManager& mgr); + void Accept(IVisitor& visitor); + CHealthInfo& HealthInfo(CStateManager& mgr); + bool IsUnderBetaMetroidAttack(CStateManager& mgr) const; + rstl::optional_object GetTouchBounds() const; + void Touch(CActor&, CStateManager& mgr); + void UpdateScanningState(const CFinalInput& input, CStateManager& mgr, float); + void ValidateScanning(const CFinalInput& input, CStateManager& mgr); + void SetScanningState(EPlayerScanState, CStateManager& mgr); + bool GetExplorationMode() const; + bool GetCombatMode() const; + void RenderGun(CStateManager& mgr, const zeus::CVector3f&) const; + void Render(CStateManager& mgr) const; + void RenderReflectedPlayer(CStateManager& mgr) const; + void PreRender(CStateManager& mgr, const zeus::CFrustum&); + void CalculateRenderBounds(); + void AddToRenderer(const zeus::CFrustum&, CStateManager&); + void ComputeFreeLook(const CFinalInput& input); + void UpdateFreeLook(float dt); + float GetMaximumPlayerPositiveVerticalVelocity(CStateManager&) const; + void ProcessInput(const CFinalInput&, CStateManager&); + bool GetFrozenState() const; + void Think(float, CStateManager&); + void PreThink(float, CStateManager&); + void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&); + void SetVisorSteam(float, float, float, u32, bool); + void UpdateFootstepBounds(const CFinalInput& input, CStateManager&, float); + u16 GetMaterialSoundUnderPlayer(CStateManager& mgr, const u16*, int, u16); + u16 SfxIdFromMaterial(const CMaterialList&, const u16*, u16); + void UpdateCrosshairsState(const CFinalInput&); + void UpdateVisorTransition(float, CStateManager& mgr); + void UpdateVisorState(const CFinalInput&, float, CStateManager& mgr); + void ForceGunOrientation(const zeus::CTransform&, CStateManager& mgr); + void UpdateDebugCamera(CStateManager& mgr); + CFirstPersonCamera& GetFirstPersonCamera(CStateManager& mgr); + void UpdateGunTransform(const zeus::CVector3f&, float, CStateManager& mgr, bool); + void DrawGun(CStateManager& mgr); + void HolsterGun(CStateManager& mgr); + bool GetMorphballTransitionState() const; + void UpdateGrappleArmTransform(const zeus::CVector3f&, CStateManager& mgr, float); + void ApplyGrappleForces(const CFinalInput& input, CStateManager& mgr, float); + bool ValidateFPPosition(const zeus::CVector3f& pos, CStateManager& mgr); + void UpdateGrappleState(const CFinalInput& input, CStateManager& mgr); + void ApplyGrappleJump(CStateManager& mgr); + void BeginGrapple(zeus::CVector3f&, CStateManager& mgr); + void BreakGrapple(CStateManager& mgr); + void PreventFallingCameraPitch(); + void OrbitCarcass(CStateManager&); + void OrbitPoint(EPlayerOrbitType, CStateManager& mgr); + zeus::CVector3f GetHUDOrbitTargetPosition() const; + void SetOrbitState(EPlayerOrbitState, CStateManager& mgr); + void SetOrbitTargetId(TUniqueId); + void UpdateOrbitPosition(float, CStateManager& mgr); + void UpdateOrbitZPosition(); + void UpdateOrbitFixedPosition(); + void SetOrbitPosition(float, CStateManager& mgr); + void UpdateAimTarget(CStateManager& mgr); + void UpdateAimTargetTimer(float); + bool ValidateAimTargetId(TUniqueId, CStateManager& mgr); + bool ValidateObjectForMode(TUniqueId, CStateManager& mgr) const; + TUniqueId FindAimTargetId(CStateManager& mgr); + TUniqueId CheckEnemiesAgainstOrbitZone(const std::vector&, EPlayerZoneInfo, + EPlayerZoneType, CStateManager& mgr) const; + TUniqueId FindOrbitTargetId(CStateManager& mgr); + void UpdateOrbitableObjects(CStateManager& mgr); + TUniqueId FindBestOrbitableObject(const std::vector&, EPlayerZoneInfo, CStateManager& mgr) const; + void FindOrbitableObjects(const std::vector&, std::vector&, EPlayerZoneInfo, + EPlayerZoneType, CStateManager& mgr, bool) const; + bool WithinOrbitScreenBox(const zeus::CVector3f&, EPlayerZoneInfo, EPlayerZoneType) const; + bool WithinOrbitScreenEllipse(const zeus::CVector3f&, EPlayerZoneInfo) const; + void CheckOrbitDisableSourceList(CStateManager& mgr); + void CheckOrbitDisableSourceList() const; + void RemoveOrbitDisableSource(TUniqueId); + void AddOrbitDisableSource(CStateManager& mgr, TUniqueId); + void UpdateOrbitPreventionTimer(float); + void UpdateOrbitModeTimer(float); + void UpdateOrbitZone(CStateManager& mgr); + void UpdateOrbitInput(const CFinalInput& input, CStateManager& mgr); + void UpdateOrbitSelection(const CFinalInput& input, CStateManager& mgr); + void UpdateOrbitOrientation(CStateManager& mgr); + void UpdateOrbitTarget(CStateManager& mgr); + float GetOrbitMaxLockDistance(CStateManager& mgr) const; + float GetOrbitMaxTargetDistance(CStateManager& mgr) const; + bool ValidateOrbitTargetId(TUniqueId, CStateManager& mgr) const; + bool ValidateCurrentOrbitTargetId(CStateManager& mgr); + bool ValidateOrbitTargetIdAndPointer(TUniqueId, CStateManager& mgr) const; + zeus::CVector3f GetBallPosition() const; + zeus::CVector3f GetEyePosition() const; + float GetEyeHeight() const; + float GetStepUpHeight() const; + float GetStepDownHeight() const; void Teleport(const zeus::CTransform& xf, CStateManager& mgr, bool); + zeus::CTransform CreateTransformFromMovementDirection() const; + const CCollisionPrimitive& GetCollisionPrimitive() const; + zeus::CTransform GetPrimitiveTransform() const; + bool CollidedWith(TUniqueId, const CCollisionInfoList&, CStateManager& mgr); + float GetActualFirstPersonMaxVelocity() const; + void SetMoveState(EPlayerMovementState, CStateManager& mgr); + float JumpInput(const CFinalInput& input, CStateManager& mgr); + float TurnInput(const CFinalInput& input) const; + float StrafeInput(const CFinalInput& input) const; + float ForwardInput(const CFinalInput& input, float) const; + void ComputeMovement(const CFinalInput& input, CStateManager& mgr, float); + float GetWeight() const; + float GetDampedClampedVelocityWR() const; }; } diff --git a/Runtime/World/CPlayerGun.cpp b/Runtime/World/CPlayerGun.cpp index df326d655..239d9624f 100644 --- a/Runtime/World/CPlayerGun.cpp +++ b/Runtime/World/CPlayerGun.cpp @@ -15,7 +15,18 @@ CPlayerGun::CPlayerGun(TUniqueId id) x668_ = g_tweakPlayerGun->GetSomething1(); x66c_ = g_tweakPlayerGun->GetSomething2(); + x832_31_ = true; + x833_24_ = true; + x833_30_ = true; + x6e0_.SetSortThermal(true); + /* TODO: Finish */ } +void CPlayerGun::AsyncLoadSuit(CStateManager& mgr) +{ + x72c_currentBeam->AsyncLoadSuitArm(mgr); + x740_grappleArm->AsyncLoadSuit(mgr); +} + } diff --git a/Runtime/World/CPlayerGun.hpp b/Runtime/World/CPlayerGun.hpp index 5e0f46b04..f758ee25e 100644 --- a/Runtime/World/CPlayerGun.hpp +++ b/Runtime/World/CPlayerGun.hpp @@ -26,7 +26,28 @@ class CPlayerGun { struct CGunMorph { - CGunMorph(float, float); + float x0_ = 0.f; + float x4_; + float x8_ = 0.f; + float xc_ = 0.1f; + float x10_; + float x14_ = 2.f; + float x18_ = 1.f; + u32 x1c_ = 2; + u32 x20_ = 1; + + union + { + struct + { + bool x24_24_ : 1; + bool x24_25_ : 1; + }; + u8 _dummy = 0; + }; + + CGunMorph(float a, float b) + : x4_(a), x10_(std::fabs(b)) {} }; CActorLights x0_lights; @@ -116,24 +137,69 @@ class CPlayerGun u32 x6c4_ = 0; zeus::CAABox x6c8_; CModelData x6e0_; - u32 x72c_ = 0; + CGunWeapon* x72c_currentBeam = nullptr; u32 x730_ = 0; u32 x734_ = 0; u32 x738_ = 0; - std::unique_ptr x73c_; - std::unique_ptr x740_; - std::unique_ptr x744_; - std::unique_ptr x74c_; - std::unique_ptr x750_; - std::unique_ptr x754_; - std::unique_ptr x758_; - std::unique_ptr x75c_; - u32 x760_[4] = {}; + std::unique_ptr x73c_gunMotion; + std::unique_ptr x740_grappleArm; + std::unique_ptr x744_auxWeapon; + std::unique_ptr x74c_powerBeam; + std::unique_ptr x750_iceBeam; + std::unique_ptr x754_waveBeam; + std::unique_ptr x758_plasmaBeam; + std::unique_ptr x75c_phazonBeam; + CGunWeapon* x760_selectableBeams[4] = {}; std::unique_ptr x774_; - std::unique_ptr x82c_; + std::unique_ptr x82c_shadow; + + union + { + struct + { + bool x832_24_ : 1; + bool x832_25_ : 1; + bool x832_26_ : 1; + bool x832_27_ : 1; + bool x832_28_ : 1; + bool x832_29_ : 1; + bool x832_30_ : 1; + bool x832_31_ : 1; + + bool x833_24_ : 1; + bool x833_25_ : 1; + bool x833_26_ : 1; + bool x833_27_ : 1; + bool x833_28_ : 1; + bool x833_29_ : 1; + bool x833_30_ : 1; + bool x833_31_ : 1; + + bool x834_24_ : 1; + bool x834_25_ : 1; + bool x834_26_ : 1; + bool x834_27_ : 1; + bool x834_28_ : 1; + bool x834_29_ : 1; + bool x834_30_ : 1; + bool x834_31_ : 1; + + bool x835_24_ : 1; + bool x835_25_ : 1; + bool x835_26_ : 1; + bool x835_27_ : 1; + bool x835_28_ : 1; + bool x835_29_ : 1; + bool x835_30_ : 1; + bool x835_31_ : 1; + }; + u32 _dummy = 0; + }; public: CPlayerGun(TUniqueId id); + + void AsyncLoadSuit(CStateManager& mgr); }; }