From d3d629d40562a76f6c604f01844c689e221f4515 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Wed, 14 Aug 2019 06:04:11 -0400 Subject: [PATCH] RuntimeCommon: Use const on member functions where applicable Adds missing const qualifiers on class member functions that don't modify instance state. --- Runtime/AutoMapper/CAutoMapper.cpp | 2 +- Runtime/AutoMapper/CAutoMapper.hpp | 2 +- Runtime/AutoMapper/CMappableObject.cpp | 2 +- Runtime/AutoMapper/CMappableObject.hpp | 2 +- Runtime/CArchitectureQueue.hpp | 2 +- Runtime/CDvdFile.hpp | 2 +- Runtime/CGameState.hpp | 4 +- Runtime/CResLoader.cpp | 6 +-- Runtime/CResLoader.hpp | 6 +-- Runtime/CStateManager.cpp | 2 +- Runtime/CStateManager.hpp | 8 +++- Runtime/Camera/CCameraManager.cpp | 2 +- Runtime/Camera/CCameraManager.hpp | 7 +++- Runtime/Camera/CFirstPersonCamera.cpp | 2 +- Runtime/Camera/CFirstPersonCamera.hpp | 2 +- Runtime/Camera/CGameCamera.cpp | 3 +- Runtime/Camera/CGameCamera.hpp | 2 +- Runtime/Character/CAdditiveBodyState.cpp | 14 +++---- Runtime/Character/CAdditiveBodyState.hpp | 8 ++-- Runtime/Character/CBodyState.cpp | 34 ++++++++-------- Runtime/Character/CBodyState.hpp | 34 ++++++++-------- Runtime/Character/CBodyStateInfo.cpp | 14 +++---- Runtime/Character/CBodyStateInfo.hpp | 14 +++---- Runtime/Character/CFBStreamedCompression.cpp | 8 ++-- Runtime/Character/CFBStreamedCompression.hpp | 8 ++-- Runtime/Character/CModelData.cpp | 2 +- Runtime/Character/CModelData.hpp | 4 +- Runtime/Character/CSegStatementSet.hpp | 1 + Runtime/Collision/CMaterialList.hpp | 2 +- Runtime/Graphics/CBooRenderer.hpp | 10 ++--- Runtime/Graphics/CTexture.hpp | 4 +- Runtime/Graphics/CTextureBoo.cpp | 4 +- Runtime/GuiSys/CGuiFrame.hpp | 2 + Runtime/GuiSys/CGuiGroup.cpp | 2 + Runtime/GuiSys/CGuiGroup.hpp | 1 + Runtime/GuiSys/CGuiSys.hpp | 1 + Runtime/GuiSys/CHudMissileInterface.cpp | 2 +- Runtime/GuiSys/CHudMissileInterface.hpp | 2 +- Runtime/GuiSys/COrbitPointMarker.cpp | 2 +- Runtime/GuiSys/COrbitPointMarker.hpp | 2 +- Runtime/IVParamObj.hpp | 3 +- Runtime/MP1/CMemoryCardDriver.cpp | 4 +- Runtime/MP1/CMemoryCardDriver.hpp | 4 +- Runtime/MP1/CSaveGameScreen.hpp | 2 +- Runtime/MP1/MP1.hpp | 6 +-- Runtime/MP1/World/CBabygoth.cpp | 2 +- Runtime/MP1/World/CBabygoth.hpp | 8 ++-- Runtime/MP1/World/CFlaahgra.cpp | 14 +++---- Runtime/MP1/World/CFlaahgra.hpp | 14 +++---- Runtime/MP1/World/CJellyZap.cpp | 8 ++-- Runtime/MP1/World/CJellyZap.hpp | 2 +- Runtime/MP1/World/CParasite.cpp | 6 +-- Runtime/MP1/World/CParasite.hpp | 2 +- Runtime/MP1/World/CPuddleToadGamma.cpp | 20 ++++----- Runtime/MP1/World/CPuddleToadGamma.hpp | 2 +- Runtime/MP1/World/CSpacePirate.cpp | 18 ++++---- Runtime/MP1/World/CSpacePirate.hpp | 10 ++--- Runtime/MP1/World/CTryclops.cpp | 2 +- Runtime/MP1/World/CTryclops.hpp | 2 +- Runtime/MP1/World/CWarWasp.cpp | 43 ++++++++++---------- Runtime/MP1/World/CWarWasp.hpp | 20 ++++----- Runtime/Particle/CElementGen.cpp | 2 +- Runtime/Particle/CElementGen.hpp | 2 +- Runtime/Weapon/CGrappleArm.hpp | 1 + Runtime/Weapon/CPlayerGun.cpp | 2 +- Runtime/Weapon/CPlayerGun.hpp | 3 +- Runtime/Weapon/CProjectileInfo.cpp | 2 +- Runtime/Weapon/CProjectileInfo.hpp | 2 +- Runtime/World/CFishCloud.cpp | 2 +- Runtime/World/CFishCloud.hpp | 2 +- Runtime/World/CGameArea.cpp | 2 +- Runtime/World/CGameArea.hpp | 2 +- Runtime/World/CPathFindArea.cpp | 2 +- Runtime/World/CPathFindArea.hpp | 2 +- Runtime/World/CPathFindRegion.cpp | 4 +- Runtime/World/CPathFindRegion.hpp | 4 +- Runtime/World/CPatterned.cpp | 2 +- Runtime/World/CPatterned.hpp | 2 +- Runtime/World/CPhysicsActor.cpp | 2 +- Runtime/World/CPhysicsActor.hpp | 4 +- Runtime/World/CPlayer.cpp | 12 +++--- Runtime/World/CPlayer.hpp | 12 +++--- Runtime/World/CPlayerCameraBob.cpp | 4 +- Runtime/World/CPlayerCameraBob.hpp | 4 +- Runtime/World/CScriptDoor.cpp | 4 +- Runtime/World/CScriptDoor.hpp | 4 +- Runtime/World/CScriptEffect.cpp | 2 +- Runtime/World/CScriptEffect.hpp | 2 +- Runtime/World/CStateMachine.hpp | 2 +- Runtime/World/CVisorFlare.hpp | 2 +- Runtime/World/CWorldTransManager.hpp | 2 +- 91 files changed, 269 insertions(+), 248 deletions(-) diff --git a/Runtime/AutoMapper/CAutoMapper.cpp b/Runtime/AutoMapper/CAutoMapper.cpp index 544fbc488..c4d7336ce 100644 --- a/Runtime/AutoMapper/CAutoMapper.cpp +++ b/Runtime/AutoMapper/CAutoMapper.cpp @@ -972,7 +972,7 @@ float CAutoMapper::GetDesiredMiniMapCameraDistance(const CStateManager& mgr) con std::tan(M_PIF / 2.f - 0.5f * 2.f * M_PIF * (xa8_renderStates[0].x1c_camAngle / 360.f)); } -float CAutoMapper::GetClampedMapScreenCameraDistance(float v) { +float CAutoMapper::GetClampedMapScreenCameraDistance(float v) const { if (x1bc_state == EAutoMapperState::MapScreenUniverse) return zeus::clamp(g_tweakAutoMapper->GetMinUniverseCamDist(), v, g_tweakAutoMapper->GetMaxUniverseCamDist()); return zeus::clamp(g_tweakAutoMapper->GetMinCamDist(), v, g_tweakAutoMapper->GetMaxCamDist()); diff --git a/Runtime/AutoMapper/CAutoMapper.hpp b/Runtime/AutoMapper/CAutoMapper.hpp index e0e764962..4acdbf00a 100644 --- a/Runtime/AutoMapper/CAutoMapper.hpp +++ b/Runtime/AutoMapper/CAutoMapper.hpp @@ -202,7 +202,7 @@ private: static float GetMapAreaMiniMapDrawAlphaOutlineUnvisited(const CStateManager&); float GetDesiredMiniMapCameraDistance(const CStateManager&) const; static float GetBaseMapScreenCameraMoveSpeed(); - float GetClampedMapScreenCameraDistance(float); + float GetClampedMapScreenCameraDistance(float) const; float GetFinalMapScreenCameraMoveSpeed() const; void ProcessMapRotateInput(const CFinalInput& input, const CStateManager& mgr); void ProcessMapZoomInput(const CFinalInput& input, const CStateManager& mgr); diff --git a/Runtime/AutoMapper/CMappableObject.cpp b/Runtime/AutoMapper/CMappableObject.cpp index 0cf3ccdbb..79aecf4df 100644 --- a/Runtime/AutoMapper/CMappableObject.cpp +++ b/Runtime/AutoMapper/CMappableObject.cpp @@ -19,7 +19,7 @@ CMappableObject::CMappableObject(const void* buf) { x10_transform.read34RowMajor(r); } -zeus::CTransform CMappableObject::AdjustTransformForType() { +zeus::CTransform CMappableObject::AdjustTransformForType() const { const float doorCenterX = g_tweakAutoMapper->GetDoorCenter().x(); const float doorCenterZ = g_tweakAutoMapper->GetDoorCenter().z(); if (x0_type == EMappableObjectType::BigDoor1) { diff --git a/Runtime/AutoMapper/CMappableObject.hpp b/Runtime/AutoMapper/CMappableObject.hpp index 41334ed28..dde05b877 100644 --- a/Runtime/AutoMapper/CMappableObject.hpp +++ b/Runtime/AutoMapper/CMappableObject.hpp @@ -66,7 +66,7 @@ private: std::optional m_doorSurface; std::optional m_texQuadFilter; - zeus::CTransform AdjustTransformForType(); + zeus::CTransform AdjustTransformForType() const; std::pair GetDoorColors(int idx, const CMapWorldInfo& mwInfo, float alpha) const; public: diff --git a/Runtime/CArchitectureQueue.hpp b/Runtime/CArchitectureQueue.hpp index bceb8c2a5..ee2010b6f 100644 --- a/Runtime/CArchitectureQueue.hpp +++ b/Runtime/CArchitectureQueue.hpp @@ -16,7 +16,7 @@ public: return msg; } void Clear() { m_list.clear(); } - operator bool() { return m_list.size() != 0; } + operator bool() const { return m_list.size() != 0; } }; } // namespace urde diff --git a/Runtime/CDvdFile.hpp b/Runtime/CDvdFile.hpp index 48196ebea..668239c82 100644 --- a/Runtime/CDvdFile.hpp +++ b/Runtime/CDvdFile.hpp @@ -55,7 +55,7 @@ public: return AsyncSeekRead(buf, len, ESeekOrigin::Cur, 0, std::move(cb)); } u32 SyncRead(void* buf, u32 len) { return m_reader->readBytesToBuf(buf, len); } - u64 Length() { return m_reader->length(); } + u64 Length() const { return m_reader->length(); } std::string_view GetPath() const { return x18_path; } }; } // namespace urde diff --git a/Runtime/CGameState.hpp b/Runtime/CGameState.hpp index 760c75f33..2d573b706 100644 --- a/Runtime/CGameState.hpp +++ b/Runtime/CGameState.hpp @@ -90,8 +90,8 @@ public: CGameState(); CGameState(CBitStreamReader& stream, u32 saveIdx); void SetCurrentWorldId(CAssetId id); - std::shared_ptr GetPlayerState() { return x98_playerState; } - std::shared_ptr GetWorldTransitionManager() { return x9c_transManager; } + std::shared_ptr GetPlayerState() const { return x98_playerState; } + std::shared_ptr GetWorldTransitionManager() const { return x9c_transManager; } void SetTotalPlayTime(float time); CPersistentOptions& SystemOptions() { return xa8_systemOptions; } CGameOptions& GameOptions() { return x17c_gameOptions; } diff --git a/Runtime/CResLoader.cpp b/Runtime/CResLoader.cpp index db6d040c5..b4f0580f3 100644 --- a/Runtime/CResLoader.cpp +++ b/Runtime/CResLoader.cpp @@ -118,19 +118,19 @@ void CResLoader::GetTagListForFile(const char* pakName, std::vector& } } -bool CResLoader::GetResourceCompression(const SObjectTag& tag) { +bool CResLoader::GetResourceCompression(const SObjectTag& tag) const { if (FindResource(tag.id)) return x50_cachedResInfo->IsCompressed(); return false; } -u32 CResLoader::ResourceSize(const SObjectTag& tag) { +u32 CResLoader::ResourceSize(const SObjectTag& tag) const { if (FindResource(tag.id)) return x50_cachedResInfo->GetSize(); return 0; } -bool CResLoader::ResourceExists(const SObjectTag& tag) { return FindResource(tag.id); } +bool CResLoader::ResourceExists(const SObjectTag& tag) const { return FindResource(tag.id); } FourCC CResLoader::GetResourceTypeById(CAssetId id) const { if (id.IsValid() && FindResource(id)) diff --git a/Runtime/CResLoader.hpp b/Runtime/CResLoader.hpp index 618cfc884..85837d8f4 100644 --- a/Runtime/CResLoader.hpp +++ b/Runtime/CResLoader.hpp @@ -36,9 +36,9 @@ public: std::unique_ptr LoadResourceSync(const urde::SObjectTag& tag); std::unique_ptr LoadNewResourcePartSync(const urde::SObjectTag& tag, u32 off, u32 size); void GetTagListForFile(const char* pakName, std::vector& out) const; - bool GetResourceCompression(const SObjectTag& tag); - u32 ResourceSize(const SObjectTag& tag); - bool ResourceExists(const SObjectTag& tag); + bool GetResourceCompression(const SObjectTag& tag) const; + u32 ResourceSize(const SObjectTag& tag) const; + bool ResourceExists(const SObjectTag& tag) const; FourCC GetResourceTypeById(CAssetId id) const; const SObjectTag* GetResourceIdByName(std::string_view name) const; bool AreAllPaksLoaded() const; diff --git a/Runtime/CStateManager.cpp b/Runtime/CStateManager.cpp index d79a994ea..a8cdc8629 100644 --- a/Runtime/CStateManager.cpp +++ b/Runtime/CStateManager.cpp @@ -374,7 +374,7 @@ TAreaId CStateManager::GetVisAreaId() const { return curArea; } -s32 CStateManager::GetWeaponIdCount(TUniqueId uid, EWeaponType type) { +s32 CStateManager::GetWeaponIdCount(TUniqueId uid, EWeaponType type) const { return x878_weaponManager->GetNumActive(uid, type); } diff --git a/Runtime/CStateManager.hpp b/Runtime/CStateManager.hpp index 182036884..2a17c02cf 100644 --- a/Runtime/CStateManager.hpp +++ b/Runtime/CStateManager.hpp @@ -220,7 +220,7 @@ public: void AddDrawableActor(const CActor& actor, const zeus::CVector3f& vec, const zeus::CAABox& aabb) const; bool SpecialSkipCinematic(); TAreaId GetVisAreaId() const; - s32 GetWeaponIdCount(TUniqueId, EWeaponType); + s32 GetWeaponIdCount(TUniqueId, EWeaponType) const; void RemoveWeaponId(TUniqueId, EWeaponType); void AddWeaponId(TUniqueId, EWeaponType); void UpdateEscapeSequenceTimer(float); @@ -368,17 +368,23 @@ public: const std::shared_ptr& GetPlayerState() const { return x8b8_playerState; } CRandom16* GetActiveRandom() { return x900_activeRandom; } + const CRandom16* GetActiveRandom() const { return x900_activeRandom; } zeus::CVector3f Random2f(float scaleMin, float scaleMax); void SetActiveRandomToDefault() { x900_activeRandom = &x8fc_random; } void ClearActiveRandom() { x900_activeRandom = nullptr; } CRumbleManager& GetRumbleManager() { return *x88c_rumbleManager; } + const CRumbleManager& GetRumbleManager() const { return *x88c_rumbleManager; } CCameraFilterPassPoly& GetCameraFilterPass(int idx) { return xb84_camFilterPasses[idx]; } + const CCameraFilterPassPoly& GetCameraFilterPass(int idx) const { return xb84_camFilterPasses[idx]; } CCameraBlurPass& GetCameraBlurPass(int idx) { return xd14_camBlurPasses[idx]; } + const CCameraBlurPass& GetCameraBlurPass(int idx) const { return xd14_camBlurPasses[idx]; } CEnvFxManager* GetEnvFxManager() { return x880_envFxManager; } + const CEnvFxManager* GetEnvFxManager() const { return x880_envFxManager; } CWorld* WorldNC() { return x850_world.get(); } const CWorld* GetWorld() const { return x850_world.get(); } CRelayTracker* GetRelayTracker() { return x8bc_relayTracker.get(); } + const CRelayTracker* GetRelayTracker() const { return x8bc_relayTracker.get(); } CCameraManager* GetCameraManager() const { return x870_cameraManager; } CFluidPlaneManager* GetFluidPlaneManager() const { return x87c_fluidPlaneManager; } CActorModelParticles* GetActorModelParticles() const { return x884_actorModelParticles; } diff --git a/Runtime/Camera/CCameraManager.cpp b/Runtime/Camera/CCameraManager.cpp index 9c29dc271..bc9bc6166 100644 --- a/Runtime/Camera/CCameraManager.cpp +++ b/Runtime/Camera/CCameraManager.cpp @@ -533,7 +533,7 @@ void CCameraManager::UpdateListener(CStateManager& mgr) { CSfxManager::UpdateListener(xf.origin, zeus::skZero3f, xf.frontVector(), xf.upVector(), 1.f); } -float CCameraManager::CalculateFogDensity(CStateManager& mgr, const CScriptWater* water) { +float CCameraManager::CalculateFogDensity(CStateManager& mgr, const CScriptWater* water) const { float distanceFactor = 1.f - water->GetFluidPlane().GetAlpha(); float distance = 0; if (mgr.GetPlayerState()->HasPowerUp(CPlayerState::EItemType::GravitySuit)) diff --git a/Runtime/Camera/CCameraManager.hpp b/Runtime/Camera/CCameraManager.hpp index 873919645..7cc081244 100644 --- a/Runtime/Camera/CCameraManager.hpp +++ b/Runtime/Camera/CCameraManager.hpp @@ -116,8 +116,13 @@ public: void SkipCinematic(CStateManager& stateMgr); CFirstPersonCamera* GetFirstPersonCamera() { return x7c_fpCamera; } + const CFirstPersonCamera* GetFirstPersonCamera() const { return x7c_fpCamera; } + CBallCamera* GetBallCamera() { return x80_ballCamera; } + const CBallCamera* GetBallCamera() const { return x80_ballCamera; } + CGameArea::CAreaFog& Fog() { return x3c_fog; } + const CGameArea::CAreaFog& Fog() const { return x3c_fog; } float GetCameraBobMagnitude() const; @@ -127,7 +132,7 @@ public: void UpdateRumble(float dt, CStateManager& mgr); void UpdateListener(CStateManager& mgr); - float CalculateFogDensity(CStateManager&, const CScriptWater*); + float CalculateFogDensity(CStateManager&, const CScriptWater*) const; void SetFogDensity(float, float); void ProcessInput(const CFinalInput& input, CStateManager& stateMgr); diff --git a/Runtime/Camera/CFirstPersonCamera.cpp b/Runtime/Camera/CFirstPersonCamera.cpp index ecb686b96..4787309d9 100644 --- a/Runtime/Camera/CFirstPersonCamera.cpp +++ b/Runtime/Camera/CFirstPersonCamera.cpp @@ -67,7 +67,7 @@ void CFirstPersonCamera::SkipCinematic() { } void CFirstPersonCamera::CalculateGunFollowOrientationAndTransform(zeus::CTransform& gunXf, zeus::CQuaternion& gunQ, - float dt, zeus::CVector3f& rVec) { + float dt, zeus::CVector3f& rVec) const { zeus::CVector3f gunFrontVec = x190_gunFollowXf.frontVector(); gunFrontVec.z() = 0.f; if (gunFrontVec.canBeNormalized()) diff --git a/Runtime/Camera/CFirstPersonCamera.hpp b/Runtime/Camera/CFirstPersonCamera.hpp index 97f92b8d0..8ba630252 100644 --- a/Runtime/Camera/CFirstPersonCamera.hpp +++ b/Runtime/Camera/CFirstPersonCamera.hpp @@ -28,7 +28,7 @@ public: const zeus::CTransform& GetGunFollowTransform() const { return x190_gunFollowXf; } void UpdateTransform(CStateManager& mgr, float dt); void UpdateElevation(CStateManager& mgr); - void CalculateGunFollowOrientationAndTransform(zeus::CTransform&, zeus::CQuaternion&, float, zeus::CVector3f&); + void CalculateGunFollowOrientationAndTransform(zeus::CTransform&, zeus::CQuaternion&, float, zeus::CVector3f&) const; void SetScriptPitchId(TUniqueId uid) { x1c4_pitchId = uid; } void SetLockCamera(bool v) { x18c_lockCamera = v; } void DeferBallTransitionProcessing() { x1c6_24_deferBallTransitionProcessing = true; } diff --git a/Runtime/Camera/CGameCamera.cpp b/Runtime/Camera/CGameCamera.cpp index 67191410d..35db4f56c 100644 --- a/Runtime/Camera/CGameCamera.cpp +++ b/Runtime/Camera/CGameCamera.cpp @@ -63,7 +63,8 @@ zeus::CVector3f CGameCamera::ConvertToScreenSpace(const zeus::CVector3f& v) cons return mtx.multiplyOneOverW(rVec); } -zeus::CTransform CGameCamera::ValidateCameraTransform(const zeus::CTransform& newXf, const zeus::CTransform& oldXf) { +zeus::CTransform CGameCamera::ValidateCameraTransform(const zeus::CTransform& newXf, + const zeus::CTransform& oldXf) const { zeus::CTransform xfCpy(newXf); if (!zeus::close_enough(newXf.rightVector().magnitude(), 1.f) || !zeus::close_enough(newXf.frontVector().magnitude(), 1.f) || diff --git a/Runtime/Camera/CGameCamera.hpp b/Runtime/Camera/CGameCamera.hpp index f98ce69b6..aadd77397 100644 --- a/Runtime/Camera/CGameCamera.hpp +++ b/Runtime/Camera/CGameCamera.hpp @@ -39,7 +39,7 @@ public: zeus::CMatrix4f GetPerspectiveMatrix() const; zeus::CVector3f ConvertToScreenSpace(const zeus::CVector3f&) const; - zeus::CTransform ValidateCameraTransform(const zeus::CTransform&, const zeus::CTransform&); + zeus::CTransform ValidateCameraTransform(const zeus::CTransform&, const zeus::CTransform&) const; float GetNearClipDistance() const { return x160_znear; } float GetFarClipDistance() const { return x164_zfar; } float GetAspectRatio() const { return x168_aspect; } diff --git a/Runtime/Character/CAdditiveBodyState.cpp b/Runtime/Character/CAdditiveBodyState.cpp index 61f09953f..2a4f0cb1d 100644 --- a/Runtime/Character/CAdditiveBodyState.cpp +++ b/Runtime/Character/CAdditiveBodyState.cpp @@ -31,7 +31,7 @@ void CABSAim::Start(CBodyController& bc, CStateManager& mgr) { x4_needsIdle = true; } -pas::EAnimationState CABSAim::GetBodyStateTransition(float dt, CBodyController& bc) { +pas::EAnimationState CABSAim::GetBodyStateTransition(float dt, CBodyController& bc) const { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::AdditiveReaction)) return pas::EAnimationState::AdditiveReaction; if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::AdditiveFlinch)) @@ -42,7 +42,7 @@ pas::EAnimationState CABSAim::GetBodyStateTransition(float dt, CBodyController& } pas::EAnimationState CABSAim::UpdateBody(float dt, CBodyController& bc, CStateManager& mgr) { - pas::EAnimationState st = GetBodyStateTransition(dt, bc); + const pas::EAnimationState st = GetBodyStateTransition(dt, bc); if (st == pas::EAnimationState::Invalid) { const zeus::CVector3f& target = bc.GetCommandMgr().GetAdditiveTargetVector(); if (target.canBeNormalized()) { @@ -106,14 +106,14 @@ void CABSFlinch::Start(CBodyController& bc, CStateManager& mgr) { animData.AddAdditiveAnimation(x8_anim, x4_weight, false, true); } -pas::EAnimationState CABSFlinch::GetBodyStateTransition(float dt, CBodyController& bc) { +pas::EAnimationState CABSFlinch::GetBodyStateTransition(float dt, CBodyController& bc) const { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::AdditiveReaction)) return pas::EAnimationState::AdditiveReaction; return pas::EAnimationState::Invalid; } pas::EAnimationState CABSFlinch::UpdateBody(float dt, CBodyController& bc, CStateManager& mgr) { - pas::EAnimationState st = GetBodyStateTransition(dt, bc); + const pas::EAnimationState st = GetBodyStateTransition(dt, bc); if (st == pas::EAnimationState::Invalid) { CAnimData& animData = *bc.GetOwner().ModelData()->AnimationData(); CCharAnimTime rem = animData.GetAdditiveAnimationTree(x8_anim)->VGetTimeRemaining(); @@ -123,7 +123,7 @@ pas::EAnimationState CABSFlinch::UpdateBody(float dt, CBodyController& bc, CStat return st; } -pas::EAnimationState CABSIdle::GetBodyStateTransition(float dt, CBodyController& bc) { +pas::EAnimationState CABSIdle::GetBodyStateTransition(float dt, CBodyController& bc) const { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::AdditiveReaction)) return pas::EAnimationState::AdditiveReaction; if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::AdditiveFlinch)) @@ -154,14 +154,14 @@ void CABSReaction::Start(CBodyController& bc, CStateManager& mgr) { } } -pas::EAnimationState CABSReaction::GetBodyStateTransition(float dt, CBodyController& bc) { +pas::EAnimationState CABSReaction::GetBodyStateTransition(float dt, CBodyController& bc) const { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::AdditiveReaction) && xc_type == pas::EAdditiveReactionType::IceBreakout) return pas::EAnimationState::AdditiveReaction; return pas::EAnimationState::Invalid; } pas::EAnimationState CABSReaction::UpdateBody(float dt, CBodyController& bc, CStateManager& mgr) { - pas::EAnimationState st = GetBodyStateTransition(dt, bc); + const pas::EAnimationState st = GetBodyStateTransition(dt, bc); if (st == pas::EAnimationState::Invalid) { if (x8_anim == -1) return pas::EAnimationState::AdditiveIdle; diff --git a/Runtime/Character/CAdditiveBodyState.hpp b/Runtime/Character/CAdditiveBodyState.hpp index 1bdb65808..f65db08dd 100644 --- a/Runtime/Character/CAdditiveBodyState.hpp +++ b/Runtime/Character/CAdditiveBodyState.hpp @@ -26,7 +26,7 @@ class CABSAim : public CAdditiveBodyState { float x2c_hWeightVel = 0.f; float x30_vWeight = 0.f; float x34_vWeightVel = 0.f; - pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc); + pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; public: void Start(CBodyController& bc, CStateManager& mgr) override; @@ -37,7 +37,7 @@ public: class CABSFlinch : public CAdditiveBodyState { float x4_weight = 1.f; u32 x8_anim = 0; - pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc); + pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; public: void Start(CBodyController& bc, CStateManager& mgr) override; @@ -46,7 +46,7 @@ public: }; class CABSIdle : public CAdditiveBodyState { - pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc); + pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; public: void Start(CBodyController& bc, CStateManager& mgr) override {} @@ -59,7 +59,7 @@ class CABSReaction : public CAdditiveBodyState { s32 x8_anim = -1; pas::EAdditiveReactionType xc_type = pas::EAdditiveReactionType::Invalid; bool x10_active = false; - pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc); + pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; void StopAnimation(CBodyController& bc); public: diff --git a/Runtime/Character/CBodyState.cpp b/Runtime/Character/CBodyState.cpp index 0bdea5c66..d5b02ceda 100644 --- a/Runtime/Character/CBodyState.cpp +++ b/Runtime/Character/CBodyState.cpp @@ -242,7 +242,7 @@ void CBSGetup::Start(CBodyController& bc, CStateManager& mgr) { } } -pas::EAnimationState CBSGetup::GetBodyStateTransition(float dt, CBodyController& bc) { +pas::EAnimationState CBSGetup::GetBodyStateTransition(float dt, CBodyController& bc) const { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) return pas::EAnimationState::Hurled; if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockDown)) @@ -289,7 +289,7 @@ void CBSKnockBack::Start(CBodyController& bc, CStateManager& mgr) { x4_curTime = 0.f; } -pas::EAnimationState CBSKnockBack::GetBodyStateTransition(float dt, CBodyController& bc) { +pas::EAnimationState CBSKnockBack::GetBodyStateTransition(float dt, CBodyController& bc) const { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) return pas::EAnimationState::Hurled; if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockDown)) @@ -332,7 +332,7 @@ void CBSLieOnGround::Start(CBodyController& bc, CStateManager& mgr) { } } -pas::EAnimationState CBSLieOnGround::GetBodyStateTransition(float dt, CBodyController& bc) { +pas::EAnimationState CBSLieOnGround::GetBodyStateTransition(float dt, CBodyController& bc) const { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Die)) return pas::EAnimationState::Death; if (x4_24_hasGroundHit && bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockBack)) @@ -355,7 +355,7 @@ void CBSStep::Start(CBodyController& bc, CStateManager& mgr) { bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); } -pas::EAnimationState CBSStep::GetBodyStateTransition(float dt, CBodyController& bc) { +pas::EAnimationState CBSStep::GetBodyStateTransition(float dt, CBodyController& bc) const { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) return pas::EAnimationState::Hurled; if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockDown)) @@ -425,7 +425,7 @@ bool CBSTurn::FacingDest(CBodyController& bc) const { return false; } -pas::EAnimationState CBSTurn::GetBodyStateTransition(float dt, CBodyController& bc) { +pas::EAnimationState CBSTurn::GetBodyStateTransition(float dt, CBodyController& bc) const { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) return pas::EAnimationState::Hurled; if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockDown)) @@ -526,7 +526,7 @@ void CBSLoopAttack::Start(CBodyController& bc, CStateManager& mgr) { } } -pas::EAnimationState CBSLoopAttack::GetBodyStateTransition(float dt, CBodyController& bc) { +pas::EAnimationState CBSLoopAttack::GetBodyStateTransition(float dt, CBodyController& bc) const { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) return pas::EAnimationState::Hurled; if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockDown)) @@ -622,7 +622,7 @@ void CBSLoopReaction::Start(CBodyController& bc, CStateManager& mgr) { } } -pas::EAnimationState CBSLoopReaction::GetBodyStateTransition(float dt, CBodyController& bc) { +pas::EAnimationState CBSLoopReaction::GetBodyStateTransition(float dt, CBodyController& bc) const { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) return pas::EAnimationState::Hurled; if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockDown)) @@ -734,7 +734,7 @@ void CBSGroundHit::Start(CBodyController& bc, CStateManager& mgr) { xc_fallState = pas::EFallState(groundHitState->GetAnimParmData(best.second, 3).GetEnumValue()); } -pas::EAnimationState CBSGroundHit::GetBodyStateTransition(float dt, CBodyController& bc) { +pas::EAnimationState CBSGroundHit::GetBodyStateTransition(float dt, CBodyController& bc) const { if (bc.IsAnimationOver()) { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Die)) return pas::EAnimationState::Death; @@ -777,7 +777,7 @@ void CBSGenerate::Start(CBodyController& bc, CStateManager& mgr) { } } -pas::EAnimationState CBSGenerate::GetBodyStateTransition(float dt, CBodyController& bc) { +pas::EAnimationState CBSGenerate::GetBodyStateTransition(float dt, CBodyController& bc) const { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) return pas::EAnimationState::Hurled; if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockDown)) @@ -819,7 +819,7 @@ void CBSJump::Start(CBodyController& bc, CStateManager& mgr) { } } -pas::EAnimationState CBSJump::GetBodyStateTransition(float dt, CBodyController& bc) { +pas::EAnimationState CBSJump::GetBodyStateTransition(float dt, CBodyController& bc) const { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) return pas::EAnimationState::Hurled; if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockDown)) @@ -991,7 +991,7 @@ void CBSHurled::Start(CBodyController& bc, CStateManager& mgr) { x2c_24_needsRecover = false; } -pas::EAnimationState CBSHurled::GetBodyStateTransition(float dt, CBodyController& bc) { +pas::EAnimationState CBSHurled::GetBodyStateTransition(float dt, CBodyController& bc) const { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::NextState)) return pas::EAnimationState::LieOnGround; if (x18_curTime > 0.25f) { @@ -1165,7 +1165,7 @@ void CBSSlide::Start(CBodyController& bc, CStateManager& mgr) { } } -pas::EAnimationState CBSSlide::GetBodyStateTransition(float dt, CBodyController& bc) { +pas::EAnimationState CBSSlide::GetBodyStateTransition(float dt, CBodyController& bc) const { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) return pas::EAnimationState::Hurled; if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockDown)) @@ -1195,7 +1195,7 @@ void CBSTaunt::Start(CBodyController& bc, CStateManager& mgr) { bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); } -pas::EAnimationState CBSTaunt::GetBodyStateTransition(float dt, CBodyController& bc) { +pas::EAnimationState CBSTaunt::GetBodyStateTransition(float dt, CBodyController& bc) const { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) return pas::EAnimationState::Hurled; if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockDown)) @@ -1227,7 +1227,7 @@ void CBSScripted::Start(CBodyController& bc, CStateManager& mgr) { bc.SetCurrentAnimation(playParms, cmd->IsLooped(), false); } -pas::EAnimationState CBSScripted::GetBodyStateTransition(float dt, CBodyController& bc) { +pas::EAnimationState CBSScripted::GetBodyStateTransition(float dt, CBodyController& bc) const { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) return pas::EAnimationState::Hurled; if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockDown)) @@ -1275,7 +1275,7 @@ void CBSCover::Start(CBodyController& bc, CStateManager& mgr) { xc_needsExit = true; } -pas::EAnimationState CBSCover::GetBodyStateTransition(float dt, CBodyController& bc) { +pas::EAnimationState CBSCover::GetBodyStateTransition(float dt, CBodyController& bc) const { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) return pas::EAnimationState::Hurled; if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockDown)) @@ -1342,7 +1342,7 @@ void CBSWallHang::Start(CBodyController& bc, CStateManager& mgr) { bc.PlayBestAnimation(parms, *mgr.GetActiveRandom()); } -pas::EAnimationState CBSWallHang::GetBodyStateTransition(float dt, CBodyController& bc) { +pas::EAnimationState CBSWallHang::GetBodyStateTransition(float dt, CBodyController& bc) const { if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::Hurled)) return pas::EAnimationState::Hurled; if (bc.GetCommandMgr().GetCmd(EBodyStateCmd::KnockDown)) @@ -1595,7 +1595,7 @@ bool CBSWallHang::ApplyGravity() const { } } -float CBSLocomotion::GetStartVelocityMagnitude(CBodyController& bc) { +float CBSLocomotion::GetStartVelocityMagnitude(const CBodyController& bc) const { if (TCastToPtr act = bc.GetOwner()) { float maxSpeed = bc.GetBodyStateInfo().GetMaxSpeed(); float ret = 0.f; diff --git a/Runtime/Character/CBodyState.hpp b/Runtime/Character/CBodyState.hpp index fddd68fa9..dc2112efc 100644 --- a/Runtime/Character/CBodyState.hpp +++ b/Runtime/Character/CBodyState.hpp @@ -77,7 +77,7 @@ public: class CBSGetup : public CBodyState { pas::EFallState x4_fallState = pas::EFallState::Invalid; - pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc); + pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; public: void Start(CBodyController& bc, CStateManager& mgr) override; @@ -89,7 +89,7 @@ class CBSKnockBack : public CBodyState { float x4_curTime = 0.f; float x8_rotateSpeed = 0.f; float xc_remTime = 0.f; - pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc); + pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; public: bool IsMoving() const override { return true; } @@ -100,7 +100,7 @@ public: class CBSLieOnGround : public CBodyState { bool x4_24_hasGroundHit : 1; - pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc); + pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; public: CBSLieOnGround(CActor& actor); @@ -110,7 +110,7 @@ public: }; class CBSStep : public CBodyState { - pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc); + pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; public: bool IsMoving() const override { return true; } @@ -132,7 +132,7 @@ public: void Start(CBodyController& bc, CStateManager& mgr) override; pas::EAnimationState UpdateBody(float dt, CBodyController& bc, CStateManager& mgr) override; void Shutdown(CBodyController&) override {} - virtual pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc); + virtual pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; }; class CBSFlyerTurn : public CBSTurn { @@ -146,7 +146,7 @@ class CBSLoopAttack : public CBodyState { pas::ELoopAttackType x8_loopAttackType = pas::ELoopAttackType::Invalid; bool xc_24_waitForAnimOver : 1; bool xc_25_advance : 1; - pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc); + pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; public: CBSLoopAttack() { @@ -163,7 +163,7 @@ class CBSLoopReaction : public CBodyState { pas::ELoopState x4_state = pas::ELoopState::Invalid; pas::EReactionType x8_reactionType = pas::EReactionType::Invalid; bool xc_24_loopHit : 1; - pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc); + pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; bool PlayExitAnimation(CBodyController& bc, CStateManager& mgr) const; public: @@ -177,7 +177,7 @@ class CBSGroundHit : public CBodyState { float x4_rotateSpeed = 0.f; float x8_remTime = 0.f; pas::EFallState xc_fallState = pas::EFallState::Invalid; - pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc); + pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; public: void Start(CBodyController& bc, CStateManager& mgr) override; @@ -186,7 +186,7 @@ public: }; class CBSGenerate : public CBodyState { - pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc); + pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; public: void Start(CBodyController& bc, CStateManager& mgr) override; @@ -210,7 +210,7 @@ class CBSJump : public CBodyState { }; u32 _dummy = 0; }; - pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc); + pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; bool CheckForWallJump(CBodyController& bc, CStateManager& mgr); void CheckForLand(CBodyController& bc, CStateManager& mgr); void PlayJumpLoop(CStateManager& mgr, CBodyController& bc); @@ -236,7 +236,7 @@ class CBSHurled : public CBodyState { mutable zeus::CVector3f x1c_lastTranslation; mutable float x28_landedDur = 0.f; bool x2c_24_needsRecover : 1; - pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc); + pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; void Recover(CStateManager& mgr, CBodyController& bc, pas::EHurledState state); void PlayStrikeWallAnimation(CBodyController& bc, CStateManager& mgr); void PlayLandAnimation(CBodyController& bc, CStateManager& mgr); @@ -255,7 +255,7 @@ public: class CBSSlide : public CBodyState { float x4_rotateSpeed = 0.f; - pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc); + pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; public: bool ApplyHeadTracking() const override { return false; } @@ -266,7 +266,7 @@ public: }; class CBSTaunt : public CBodyState { - pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc); + pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; public: void Start(CBodyController& bc, CStateManager& mgr) override; @@ -283,7 +283,7 @@ class CBSScripted : public CBodyState { u32 _dummy = 0; }; float x8_remTime = 0.f; - pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc); + pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; public: bool ApplyHeadTracking() const override { return false; } @@ -296,7 +296,7 @@ class CBSCover : public CBodyState { pas::ECoverState x4_state = pas::ECoverState::Invalid; pas::ECoverDirection x8_coverDirection = pas::ECoverDirection::Invalid; bool xc_needsExit = false; - pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc); + pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; public: bool ApplyHeadTracking() const override { return false; } @@ -318,7 +318,7 @@ class CBSWallHang : public CBodyState { }; u32 _dummy = 0; }; - pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc); + pas::EAnimationState GetBodyStateTransition(float dt, CBodyController& bc) const; void FixInPlace(CBodyController& bc); bool CheckForLand(CBodyController& bc, CStateManager& mgr); bool CheckForWall(CBodyController& bc, CStateManager& mgr); @@ -339,7 +339,7 @@ public: class CBSLocomotion : public CBodyState { protected: pas::ELocomotionType x4_locomotionType = pas::ELocomotionType::Invalid; - float GetStartVelocityMagnitude(CBodyController& bc); + float GetStartVelocityMagnitude(const CBodyController& bc) const; void ReStartBodyState(CBodyController& bc, bool maintainVel); float ComputeWeightPercentage(const std::pair& a, const std::pair& b, float f) const; diff --git a/Runtime/Character/CBodyStateInfo.cpp b/Runtime/Character/CBodyStateInfo.cpp index d9fdfb335..a71e46753 100644 --- a/Runtime/Character/CBodyStateInfo.cpp +++ b/Runtime/Character/CBodyStateInfo.cpp @@ -47,7 +47,7 @@ CBodyStateInfo::CBodyStateInfo(CActor& actor, EBodyType type) { x1c_additiveStates.push_back({pas::EAnimationState::AdditiveReaction, std::make_unique()}); } -std::unique_ptr CBodyStateInfo::SetupRestrictedFlyerBodyStates(int stateId, CActor& actor) { +std::unique_ptr CBodyStateInfo::SetupRestrictedFlyerBodyStates(int stateId, CActor& actor) const { switch (stateId) { case 0: return std::make_unique(); @@ -92,7 +92,7 @@ std::unique_ptr CBodyStateInfo::SetupRestrictedFlyerBodyStates(int s } } -std::unique_ptr CBodyStateInfo::SetupNewFlyerBodyStates(int stateId, CActor& actor) { +std::unique_ptr CBodyStateInfo::SetupNewFlyerBodyStates(int stateId, CActor& actor) const { switch (stateId) { case 0: return std::make_unique(); @@ -137,7 +137,7 @@ std::unique_ptr CBodyStateInfo::SetupNewFlyerBodyStates(int stateId, } } -std::unique_ptr CBodyStateInfo::SetupWallWalkerBodyStates(int stateId, CActor& actor) { +std::unique_ptr CBodyStateInfo::SetupWallWalkerBodyStates(int stateId, CActor& actor) const { switch (stateId) { case 0: return std::make_unique(); @@ -182,7 +182,7 @@ std::unique_ptr CBodyStateInfo::SetupWallWalkerBodyStates(int stateI } } -std::unique_ptr CBodyStateInfo::SetupPitchableBodyStates(int stateId, CActor& actor) { +std::unique_ptr CBodyStateInfo::SetupPitchableBodyStates(int stateId, CActor& actor) const { switch (stateId) { case 0: return std::make_unique(); @@ -227,7 +227,7 @@ std::unique_ptr CBodyStateInfo::SetupPitchableBodyStates(int stateId } } -std::unique_ptr CBodyStateInfo::SetupFlyerBodyStates(int stateId, CActor& actor) { +std::unique_ptr CBodyStateInfo::SetupFlyerBodyStates(int stateId, CActor& actor) const { switch (stateId) { case 0: return std::make_unique(); @@ -272,7 +272,7 @@ std::unique_ptr CBodyStateInfo::SetupFlyerBodyStates(int stateId, CA } } -std::unique_ptr CBodyStateInfo::SetupRestrictedBodyStates(int stateId, CActor& actor) { +std::unique_ptr CBodyStateInfo::SetupRestrictedBodyStates(int stateId, CActor& actor) const { switch (stateId) { case 0: return std::make_unique(); @@ -319,7 +319,7 @@ std::unique_ptr CBodyStateInfo::SetupRestrictedBodyStates(int stateI } } -std::unique_ptr CBodyStateInfo::SetupBiPedalBodyStates(int stateId, CActor& actor) { +std::unique_ptr CBodyStateInfo::SetupBiPedalBodyStates(int stateId, CActor& actor) const { switch (stateId) { case 0: return std::make_unique(); diff --git a/Runtime/Character/CBodyStateInfo.hpp b/Runtime/Character/CBodyStateInfo.hpp index fad5e8554..df2bb3333 100644 --- a/Runtime/Character/CBodyStateInfo.hpp +++ b/Runtime/Character/CBodyStateInfo.hpp @@ -17,13 +17,13 @@ class CBodyStateInfo { pas::EAnimationState x2c_additiveState = pas::EAnimationState::AdditiveIdle; float x30_maxPitch = 0.f; bool x34_24_changeLocoAtEndOfAnimOnly; - std::unique_ptr SetupRestrictedFlyerBodyStates(int stateId, CActor& actor); - std::unique_ptr SetupNewFlyerBodyStates(int stateId, CActor& actor); - std::unique_ptr SetupWallWalkerBodyStates(int stateId, CActor& actor); - std::unique_ptr SetupPitchableBodyStates(int stateId, CActor& actor); - std::unique_ptr SetupFlyerBodyStates(int stateId, CActor& actor); - std::unique_ptr SetupRestrictedBodyStates(int stateId, CActor& actor); - std::unique_ptr SetupBiPedalBodyStates(int stateId, CActor& actor); + std::unique_ptr SetupRestrictedFlyerBodyStates(int stateId, CActor& actor) const; + std::unique_ptr SetupNewFlyerBodyStates(int stateId, CActor& actor) const; + std::unique_ptr SetupWallWalkerBodyStates(int stateId, CActor& actor) const; + std::unique_ptr SetupPitchableBodyStates(int stateId, CActor& actor) const; + std::unique_ptr SetupFlyerBodyStates(int stateId, CActor& actor) const; + std::unique_ptr SetupRestrictedBodyStates(int stateId, CActor& actor) const; + std::unique_ptr SetupBiPedalBodyStates(int stateId, CActor& actor) const; public: CBodyStateInfo(CActor& actor, EBodyType type); diff --git a/Runtime/Character/CFBStreamedCompression.cpp b/Runtime/Character/CFBStreamedCompression.cpp index b85a02654..f87bf18b8 100644 --- a/Runtime/Character/CFBStreamedCompression.cpp +++ b/Runtime/Character/CFBStreamedCompression.cpp @@ -54,7 +54,7 @@ const u8* CFBStreamedCompression::GetBitstreamPointer() const { return chans; } -std::unique_ptr CFBStreamedCompression::GetRotationsAndOffsets(u32 words, CInputStream& in) { +std::unique_ptr CFBStreamedCompression::GetRotationsAndOffsets(u32 words, CInputStream& in) const { std::unique_ptr ret(new u32[words]); Header head; @@ -80,7 +80,7 @@ std::unique_ptr CFBStreamedCompression::GetRotationsAndOffsets(u32 words, return ret; } -u8* CFBStreamedCompression::ReadBoneChannelDescriptors(u8* out, CInputStream& in) { +u8* CFBStreamedCompression::ReadBoneChannelDescriptors(u8* out, CInputStream& in) const { u32 boneChanCount = in.readUint32Big(); *reinterpret_cast(out) = boneChanCount; out += 4; @@ -142,7 +142,7 @@ u8* CFBStreamedCompression::ReadBoneChannelDescriptors(u8* out, CInputStream& in return out; } -u32 CFBStreamedCompression::ComputeBitstreamWords(const u8* chans) { +u32 CFBStreamedCompression::ComputeBitstreamWords(const u8* chans) const { u32 boneChanCount = *reinterpret_cast(chans); chans += 4; @@ -188,7 +188,7 @@ u32 CFBStreamedCompression::ComputeBitstreamWords(const u8* chans) { return (totalBits * keyCount + 31) / 32; } -float CFBStreamedCompression::CalculateAverageVelocity(const u8* chans) { +float CFBStreamedCompression::CalculateAverageVelocity(const u8* chans) const { u32 boneChanCount = *reinterpret_cast(chans); chans += 4; diff --git a/Runtime/Character/CFBStreamedCompression.hpp b/Runtime/Character/CFBStreamedCompression.hpp index d24b03337..2e9fa1a06 100644 --- a/Runtime/Character/CFBStreamedCompression.hpp +++ b/Runtime/Character/CFBStreamedCompression.hpp @@ -56,10 +56,10 @@ private: float x10_averageVelocity; zeus::CVector3f x14_rootOffset; - u8* ReadBoneChannelDescriptors(u8* out, CInputStream& in); - u32 ComputeBitstreamWords(const u8* chans); - std::unique_ptr GetRotationsAndOffsets(u32 words, CInputStream& in); - float CalculateAverageVelocity(const u8* chans); + u8* ReadBoneChannelDescriptors(u8* out, CInputStream& in) const; + u32 ComputeBitstreamWords(const u8* chans) const; + std::unique_ptr GetRotationsAndOffsets(u32 words, CInputStream& in) const; + float CalculateAverageVelocity(const u8* chans) const; public: CFBStreamedCompression(CInputStream& in, IObjectStore& objStore, bool pc); diff --git a/Runtime/Character/CModelData.cpp b/Runtime/Character/CModelData.cpp index 1fa97defa..a9a434b08 100644 --- a/Runtime/Character/CModelData.cpp +++ b/Runtime/Character/CModelData.cpp @@ -154,7 +154,7 @@ void CModelData::SetInfraModel(const std::pair& modelSkin) { } } -bool CModelData::IsDefinitelyOpaque(EWhichModel which) { +bool CModelData::IsDefinitelyOpaque(EWhichModel which) const { if (x10_animData) { CSkinnedModel& model = PickAnimatedModel(which); return model.GetModelInst()->IsOpaque(); diff --git a/Runtime/Character/CModelData.hpp b/Runtime/Character/CModelData.hpp index 60bf68e9d..9013317e4 100644 --- a/Runtime/Character/CModelData.hpp +++ b/Runtime/Character/CModelData.hpp @@ -100,7 +100,7 @@ public: const std::unique_ptr& PickStaticModel(EWhichModel which) const; void SetXRayModel(const std::pair& modelSkin); void SetInfraModel(const std::pair& modelSkin); - bool IsDefinitelyOpaque(EWhichModel); + bool IsDefinitelyOpaque(EWhichModel) const; bool GetIsLoop() const; float GetAnimationDuration(int) const; void EnableLooping(bool); @@ -144,7 +144,7 @@ public: void SetScale(const zeus::CVector3f& scale) { x0_scale = scale; } bool HasAnimData() const { return x10_animData != nullptr; } bool HasNormalModel() const { return x1c_normalModel; } - bool HasModel(EWhichModel which) { + bool HasModel(EWhichModel which) const { if (x10_animData) { switch (which) { case EWhichModel::Normal: diff --git a/Runtime/Character/CSegStatementSet.hpp b/Runtime/Character/CSegStatementSet.hpp index 77f96da87..7017de90f 100644 --- a/Runtime/Character/CSegStatementSet.hpp +++ b/Runtime/Character/CSegStatementSet.hpp @@ -15,6 +15,7 @@ public: void Add(const CSegIdList& list, const CCharLayoutInfo& layout, const CSegStatementSet& other, float weight); CAnimPerSegmentData& operator[](const CSegId& idx) { return x4_segData[idx]; } + const CAnimPerSegmentData& operator[](const CSegId& idx) const { return x4_segData[idx]; } }; } // namespace urde diff --git a/Runtime/Collision/CMaterialList.hpp b/Runtime/Collision/CMaterialList.hpp index b6bbbf7e4..863eb5f7b 100644 --- a/Runtime/Collision/CMaterialList.hpp +++ b/Runtime/Collision/CMaterialList.hpp @@ -116,7 +116,7 @@ public: bool HasMaterial(EMaterialTypes type) const { return (x0_list & (1ull << u64(type))) != 0; } - bool SharesMaterials(const CMaterialList& other) { + bool SharesMaterials(const CMaterialList& other) const { for (u32 i = 0; i < 64; i++) { if ((x0_list & (1ull << i)) != 0 && (other.x0_list & (1ull << i)) != 0) return true; diff --git a/Runtime/Graphics/CBooRenderer.hpp b/Runtime/Graphics/CBooRenderer.hpp index 1e73eb524..401b60aec 100644 --- a/Runtime/Graphics/CBooRenderer.hpp +++ b/Runtime/Graphics/CBooRenderer.hpp @@ -279,15 +279,15 @@ public: void ReallyRenderFogVolume(const zeus::CColor& color, const zeus::CAABox& aabb, const CModel* model, const CSkinnedModel* sModel); - const boo::ObjToken& GetThermoPalette() { return x288_thermoPalette; } - const boo::ObjToken& GetFogRampTex() { return x1b8_fogVolumeRamp; } + const boo::ObjToken& GetThermoPalette() const { return x288_thermoPalette; } + const boo::ObjToken& GetFogRampTex() const { return x1b8_fogVolumeRamp; } const boo::ObjToken& GetRandomStaticEntropyTex() const { return m_staticEntropy->GetBooTexture(); } const boo::ObjToken& GetScanLinesEvenVBO() const { return m_scanLinesEvenVBO; } const boo::ObjToken& GetScanLinesOddVBO() const { return m_scanLinesOddVBO; } - const boo::ObjToken& GetClearTexture() { return m_clearTexture; } - const boo::ObjToken& GetBlackTexture() { return m_blackTexture; } - const boo::ObjToken& GetWhiteTexture() { return m_whiteTexture; } + const boo::ObjToken& GetClearTexture() const { return m_clearTexture; } + const boo::ObjToken& GetBlackTexture() const { return m_blackTexture; } + const boo::ObjToken& GetWhiteTexture() const { return m_whiteTexture; } boo::ObjToken GetColorTexture(const zeus::CColor& color); diff --git a/Runtime/Graphics/CTexture.hpp b/Runtime/Graphics/CTexture.hpp index 278caac7c..41596c514 100644 --- a/Runtime/Graphics/CTexture.hpp +++ b/Runtime/Graphics/CTexture.hpp @@ -33,8 +33,8 @@ private: EFontType m_ftype = EFontType::None; std::string m_dolphinName; - size_t ComputeMippedTexelCount(); - size_t ComputeMippedBlockCountDXT1(); + size_t ComputeMippedTexelCount() const; + size_t ComputeMippedBlockCountDXT1() const; void BuildI4FromGCN(CInputStream& in); void BuildI8FromGCN(CInputStream& in); void BuildIA4FromGCN(CInputStream& in); diff --git a/Runtime/Graphics/CTextureBoo.cpp b/Runtime/Graphics/CTextureBoo.cpp index e5382a3c0..ae3f13fb4 100644 --- a/Runtime/Graphics/CTextureBoo.cpp +++ b/Runtime/Graphics/CTextureBoo.cpp @@ -27,7 +27,7 @@ constexpr uint8_t Convert6To8(uint8_t v) { return (v << 2) | (v >> 4); } -size_t CTexture::ComputeMippedTexelCount() { +size_t CTexture::ComputeMippedTexelCount() const { size_t w = x4_w; size_t h = x6_h; size_t ret = w * h; @@ -41,7 +41,7 @@ size_t CTexture::ComputeMippedTexelCount() { return ret; } -size_t CTexture::ComputeMippedBlockCountDXT1() { +size_t CTexture::ComputeMippedBlockCountDXT1() const { size_t w = x4_w / 4; size_t h = x6_h / 4; size_t ret = w * h; diff --git a/Runtime/GuiSys/CGuiFrame.hpp b/Runtime/GuiSys/CGuiFrame.hpp index 0f774e968..091081aca 100644 --- a/Runtime/GuiSys/CGuiFrame.hpp +++ b/Runtime/GuiSys/CGuiFrame.hpp @@ -56,6 +56,7 @@ public: ~CGuiFrame(); CGuiSys& GetGuiSys() { return x8_guiSys; } + const CGuiSys& GetGuiSys() const { return x8_guiSys; } CAssetId GetAssetId() const { return x0_id; } CGuiLight* GetFrameLight(int idx) const { return m_indexedLights[idx]; } @@ -100,6 +101,7 @@ public: void ResetMouseState(); CGuiWidgetIdDB& GetWidgetIdDB() { return x18_idDB; } + const CGuiWidgetIdDB& GetWidgetIdDB() const { return x18_idDB; } static std::unique_ptr CreateFrame(CAssetId frmeId, CGuiSys& sys, CInputStream& in, CSimplePool* sp); }; diff --git a/Runtime/GuiSys/CGuiGroup.cpp b/Runtime/GuiSys/CGuiGroup.cpp index 24b80a424..60c44af16 100644 --- a/Runtime/GuiSys/CGuiGroup.cpp +++ b/Runtime/GuiSys/CGuiGroup.cpp @@ -28,6 +28,8 @@ void CGuiGroup::SelectWorkerWidget(int workerId, bool setActive, bool setVisible CGuiWidget* CGuiGroup::GetSelectedWidget() { return GetWorkerWidget(xbc_selectedWorker); } +const CGuiWidget* CGuiGroup::GetSelectedWidget() const { return GetWorkerWidget(xbc_selectedWorker); } + bool CGuiGroup::AddWorkerWidget(CGuiWidget* worker) { ++xb8_workerCount; return true; diff --git a/Runtime/GuiSys/CGuiGroup.hpp b/Runtime/GuiSys/CGuiGroup.hpp index 93d75d4c9..aec2ed07e 100644 --- a/Runtime/GuiSys/CGuiGroup.hpp +++ b/Runtime/GuiSys/CGuiGroup.hpp @@ -15,6 +15,7 @@ public: void SelectWorkerWidget(int workerId, bool setActive, bool setVisible); CGuiWidget* GetSelectedWidget(); + const CGuiWidget* GetSelectedWidget() const; bool AddWorkerWidget(CGuiWidget* worker) override; void OnActiveChange() override; diff --git a/Runtime/GuiSys/CGuiSys.hpp b/Runtime/GuiSys/CGuiSys.hpp index 3663cf808..d64a84921 100644 --- a/Runtime/GuiSys/CGuiSys.hpp +++ b/Runtime/GuiSys/CGuiSys.hpp @@ -39,6 +39,7 @@ public: CGuiSys(IFactory& resFactory, CSimplePool& resStore, EUsageMode mode); CSimplePool& GetResStore() { return x4_resStore; } + const CSimplePool& GetResStore() const { return x4_resStore; } EUsageMode GetUsageMode() const { return x8_mode; } void OnViewportResize(); diff --git a/Runtime/GuiSys/CHudMissileInterface.cpp b/Runtime/GuiSys/CHudMissileInterface.cpp index b864b1a79..214ca1cb8 100644 --- a/Runtime/GuiSys/CHudMissileInterface.cpp +++ b/Runtime/GuiSys/CHudMissileInterface.cpp @@ -228,7 +228,7 @@ void CHudMissileInterface::SetNumMissiles(int numMissiles, const CStateManager& void CHudMissileInterface::SetMissileCapacity(int missileCapacity) { x4_missileCapacity = missileCapacity; } -CHudMissileInterface::EInventoryStatus CHudMissileInterface::GetMissileInventoryStatus() { +CHudMissileInterface::EInventoryStatus CHudMissileInterface::GetMissileInventoryStatus() const { if (x64_energybart01_missilebar->GetSetEnergy() == 0.f) return EInventoryStatus::Depleted; return EInventoryStatus(x64_energybart01_missilebar->GetActualFraction() < g_tweakGui->GetMissileWarningFraction()); diff --git a/Runtime/GuiSys/CHudMissileInterface.hpp b/Runtime/GuiSys/CHudMissileInterface.hpp index c0a70f35c..7f270eddc 100644 --- a/Runtime/GuiSys/CHudMissileInterface.hpp +++ b/Runtime/GuiSys/CHudMissileInterface.hpp @@ -55,7 +55,7 @@ public: void SetChargeBeamFactor(float t); void SetNumMissiles(int numMissiles, const CStateManager& mgr); void SetMissileCapacity(int missileCapacity); - EInventoryStatus GetMissileInventoryStatus(); + EInventoryStatus GetMissileInventoryStatus() const; static std::pair CombatMissileBarCoordFunc(float t); static std::pair XRayMissileBarCoordFunc(float t); static std::pair ThermalMissileBarCoordFunc(float t); diff --git a/Runtime/GuiSys/COrbitPointMarker.cpp b/Runtime/GuiSys/COrbitPointMarker.cpp index 7e1b00982..765732db4 100644 --- a/Runtime/GuiSys/COrbitPointMarker.cpp +++ b/Runtime/GuiSys/COrbitPointMarker.cpp @@ -14,7 +14,7 @@ COrbitPointMarker::COrbitPointMarker() { x28_orbitPointModel = g_SimplePool->GetObj("CMDL_OrbitPoint"); } -bool COrbitPointMarker::CheckLoadComplete() { return x28_orbitPointModel.IsLoaded(); } +bool COrbitPointMarker::CheckLoadComplete() const { return x28_orbitPointModel.IsLoaded(); } void COrbitPointMarker::Update(float dt, const CStateManager& mgr) { x24_curTime += dt; diff --git a/Runtime/GuiSys/COrbitPointMarker.hpp b/Runtime/GuiSys/COrbitPointMarker.hpp index 426a07f61..2764ea817 100644 --- a/Runtime/GuiSys/COrbitPointMarker.hpp +++ b/Runtime/GuiSys/COrbitPointMarker.hpp @@ -20,7 +20,7 @@ class COrbitPointMarker { public: COrbitPointMarker(); - bool CheckLoadComplete(); + bool CheckLoadComplete() const; void Update(float dt, const CStateManager& mgr); void Draw(const CStateManager& mgr) const; }; diff --git a/Runtime/IVParamObj.hpp b/Runtime/IVParamObj.hpp index 81239514f..424ec9a19 100644 --- a/Runtime/IVParamObj.hpp +++ b/Runtime/IVParamObj.hpp @@ -17,6 +17,7 @@ class TObjOwnerParam : public IVParamObj { public: TObjOwnerParam(T&& obj) : m_param(std::move(obj)) {} T& GetParam() { return m_param; } + const T& GetParam() const { return m_param; } }; class CVParamTransfer { @@ -27,7 +28,7 @@ public: CVParamTransfer(IVParamObj* obj) : m_ref(obj) {} CVParamTransfer(const CVParamTransfer& other) : m_ref(other.m_ref) {} IVParamObj* GetObj() const { return m_ref.get(); } - CVParamTransfer ShareTransferRef() { return CVParamTransfer(*this); } + CVParamTransfer ShareTransferRef() const { return CVParamTransfer(*this); } template T& GetOwnedObj() const { diff --git a/Runtime/MP1/CMemoryCardDriver.cpp b/Runtime/MP1/CMemoryCardDriver.cpp index 83af7e998..ccbc08a4b 100644 --- a/Runtime/MP1/CMemoryCardDriver.cpp +++ b/Runtime/MP1/CMemoryCardDriver.cpp @@ -57,7 +57,7 @@ ECardResult CMemoryCardDriver::SFileInfo::FileRead() { } } -ECardResult CMemoryCardDriver::SFileInfo::GetSaveDataOffset(u32& offOut) { +ECardResult CMemoryCardDriver::SFileInfo::GetSaveDataOffset(u32& offOut) const { CMemoryCardSys::CardStat stat = {}; ECardResult result = CMemoryCardSys::GetStatus(x0_fileInfo.slot, x0_fileInfo.getFileNo(), stat); if (result != ECardResult::READY) { @@ -135,7 +135,7 @@ void CMemoryCardDriver::NoCardFound() { static_cast(g_Main)->SetCardBusy(false); } -const CGameState::GameFileStateInfo* CMemoryCardDriver::GetGameFileStateInfo(int idx) { +const CGameState::GameFileStateInfo* CMemoryCardDriver::GetGameFileStateInfo(int idx) const { SGameFileSlot* slot = xe4_fileSlots[idx].get(); if (!slot) return nullptr; diff --git a/Runtime/MP1/CMemoryCardDriver.hpp b/Runtime/MP1/CMemoryCardDriver.hpp index a88113364..0618e7972 100644 --- a/Runtime/MP1/CMemoryCardDriver.hpp +++ b/Runtime/MP1/CMemoryCardDriver.hpp @@ -78,7 +78,7 @@ private: kabufuda::ECardResult StartRead(); kabufuda::ECardResult TryFileRead(); kabufuda::ECardResult FileRead(); - kabufuda::ECardResult GetSaveDataOffset(u32& offOut); + kabufuda::ECardResult GetSaveDataOffset(u32& offOut) const; }; struct SSaveHeader { @@ -126,7 +126,7 @@ public: bool importPersistent); void NoCardFound(); - const CGameState::GameFileStateInfo* GetGameFileStateInfo(int idx); + const CGameState::GameFileStateInfo* GetGameFileStateInfo(int idx) const; static SSaveHeader LoadSaveHeader(CMemoryInStream& in); static std::unique_ptr LoadSaveFile(CMemoryInStream& in); void ReadFinished(); diff --git a/Runtime/MP1/CSaveGameScreen.hpp b/Runtime/MP1/CSaveGameScreen.hpp index 81f413d79..13445044e 100644 --- a/Runtime/MP1/CSaveGameScreen.hpp +++ b/Runtime/MP1/CSaveGameScreen.hpp @@ -41,7 +41,7 @@ public: SaveReady = 16 }; - bool IsHiddenFromFrontEnd() { + bool IsHiddenFromFrontEnd() const { switch (x10_uiType) { case EUIType::SaveReady: case EUIType::Empty: diff --git a/Runtime/MP1/MP1.hpp b/Runtime/MP1/MP1.hpp index 5a91cede1..416b8feea 100644 --- a/Runtime/MP1/MP1.hpp +++ b/Runtime/MP1/MP1.hpp @@ -172,7 +172,7 @@ public: void Update(); void Draw(); - bool isRectDirty() { return m_rectIsDirty; } + bool isRectDirty() const { return m_rectIsDirty; } const boo::SWindowRect& getWindowRect() { m_rectIsDirty = false; return m_windowRect; @@ -278,8 +278,8 @@ public: void MemoryCardInitializePump(); - bool CheckReset() { return m_doQuit; } - bool CheckTerminate() { return m_doQuit; } + bool CheckReset() const { return m_doQuit; } + bool CheckTerminate() const { return m_doQuit; } void DrawDebugMetrics(double, CStopwatch&) {} void DoPredrawMetrics() {} void FillInAssetIDs(); diff --git a/Runtime/MP1/World/CBabygoth.cpp b/Runtime/MP1/World/CBabygoth.cpp index b924becfa..0894079ce 100644 --- a/Runtime/MP1/World/CBabygoth.cpp +++ b/Runtime/MP1/World/CBabygoth.cpp @@ -1131,7 +1131,7 @@ void CBabygoth::UpdateHealthInfo(CStateManager& mgr) { } } -float CBabygoth::CalculateShellCrackHP(EShellState state) { +float CBabygoth::CalculateShellCrackHP(EShellState state) const { if (state == EShellState::Default) return x570_babyData.GetShellHitPoints(); else if (state == EShellState::CrackOne) diff --git a/Runtime/MP1/World/CBabygoth.hpp b/Runtime/MP1/World/CBabygoth.hpp index 5d05ca855..d3b4cc98a 100644 --- a/Runtime/MP1/World/CBabygoth.hpp +++ b/Runtime/MP1/World/CBabygoth.hpp @@ -50,7 +50,7 @@ public: const CDamageInfo& GetFireBreathDamage() const { return x4c_fireBreathDamage; } const CDamageVulnerability& GetShellDamageVulnerability() const { return xd0_shellVulnerabilities; } float GetShellHitPoints() const { return x140_shellHitPoints; } - s16 GetShellCrackSfx() { return x144_shellCrackSfx; } + s16 GetShellCrackSfx() const { return x144_shellCrackSfx; } }; class CBabygoth final : public CPatterned { @@ -130,9 +130,9 @@ private: void ApplySeparationBehavior(CStateManager&); - bool IsMouthCollisionActor(TUniqueId uid) { return x9f6_mouthCollisionActor == uid; } + bool IsMouthCollisionActor(TUniqueId uid) const { return x9f6_mouthCollisionActor == uid; } - bool IsShell(TUniqueId uid) { + bool IsShell(TUniqueId uid) const { for (TUniqueId shellId : x9f8_shellIds) { if (shellId == uid) return true; @@ -172,7 +172,7 @@ private: void UpdateHealth(CStateManager&); - float CalculateShellCrackHP(EShellState state); + float CalculateShellCrackHP(EShellState state) const; void UpdateAttackTimeLeft(CStateManager& mgr); diff --git a/Runtime/MP1/World/CFlaahgra.cpp b/Runtime/MP1/World/CFlaahgra.cpp index 26fca64fd..70b8e591f 100644 --- a/Runtime/MP1/World/CFlaahgra.cpp +++ b/Runtime/MP1/World/CFlaahgra.cpp @@ -718,9 +718,9 @@ void CFlaahgra::TurnAround(CStateManager& mgr, EStateMsg msg, float) { x6cc_boneTracking->SetActive(false); } } -bool CFlaahgra::IsSphereCollider(TUniqueId uid) { - auto it = std::find(x7fc_sphereColliders.begin(), x7fc_sphereColliders.end(), uid); +bool CFlaahgra::IsSphereCollider(TUniqueId uid) const { + const auto it = std::find(x7fc_sphereColliders.cbegin(), x7fc_sphereColliders.cend(), uid); return it != x7fc_sphereColliders.end(); } @@ -800,7 +800,7 @@ void CFlaahgra::UpdateScale(float t, float min, float max) { ModelData()->SetScale(zeus::skOne3f * scale); } -float CFlaahgra::GetEndActionTime() { +float CFlaahgra::GetEndActionTime() const { CCharAnimTime eventTime = GetModelData()->GetAnimationData()->GetTimeOfUserEvent(EUserEventType::EndAction, CCharAnimTime::Infinity()); if (eventTime == CCharAnimTime::Infinity()) @@ -829,7 +829,7 @@ void CFlaahgra::Generate(CStateManager& mgr, EStateMsg msg, float) { x7c0_ = 11.f; } } -zeus::CVector3f CFlaahgra::GetAttacktargetPos(CStateManager& mgr) const { +zeus::CVector3f CFlaahgra::GetAttacktargetPos(const CStateManager& mgr) const { if (mgr.GetPlayer().GetMorphballTransitionState() == CPlayer::EPlayerMorphBallState::Morphed) return mgr.GetPlayer().GetMorphBall()->GetBallToWorld().origin; @@ -988,7 +988,7 @@ void CFlaahgra::Attack(CStateManager& mgr, EStateMsg msg, float arg) { } } -u32 CFlaahgra::sub801ae828(CStateManager& mgr) { +u32 CFlaahgra::sub801ae828(const CStateManager& mgr) const { const CPlayer& player = mgr.GetPlayer(); if (player.GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Morphed) { if (x7cc_ > 0.f || player.GetVelocity().magSquared() < 25.f) @@ -1000,7 +1000,7 @@ u32 CFlaahgra::sub801ae828(CStateManager& mgr) { return 0; } -zeus::CVector3f CFlaahgra::sub801ae754(CStateManager& mgr) { +zeus::CVector3f CFlaahgra::sub801ae754(const CStateManager& mgr) const { float dt = (sub801ae650() && mgr.GetPlayer().GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Morphed ? 0.75f : 0.5f); @@ -1170,7 +1170,7 @@ bool CFlaahgra::CoverCheck(CStateManager& mgr, float) { return false; } -TUniqueId CFlaahgra::GetMirrorNearestPlayer(CStateManager& mgr) { +TUniqueId CFlaahgra::GetMirrorNearestPlayer(const CStateManager& mgr) const { zeus::CVector3f playerPos = mgr.GetPlayer().GetTranslation(); TUniqueId nearId = kInvalidUniqueId; diff --git a/Runtime/MP1/World/CFlaahgra.hpp b/Runtime/MP1/World/CFlaahgra.hpp index 37cb7d6c8..f1bcf8cf0 100644 --- a/Runtime/MP1/World/CFlaahgra.hpp +++ b/Runtime/MP1/World/CFlaahgra.hpp @@ -164,23 +164,23 @@ class CFlaahgra : public CPatterned { void SetMaterialProperties(const std::unique_ptr&, CStateManager&); bool sub801ae650() const { return (x7a8_ == 0 || x7a8_ == 1); } bool sub801ae670() const { return (x7a8_ == 2 || x7a8_ == 3 || x7a8_ == 4); } - bool IsSphereCollider(TUniqueId); + bool IsSphereCollider(TUniqueId) const; void SetCollisionActorBounds(CStateManager& mgr, const std::unique_ptr& colMgr, const zeus::CVector3f& extendedBounds); void UpdateScale(float, float, float); - float GetEndActionTime(); + float GetEndActionTime() const; void SetupHealthInfo(CStateManager&); - zeus::CVector3f GetAttacktargetPos(CStateManager&) const; + zeus::CVector3f GetAttacktargetPos(const CStateManager&) const; void RattlePlayer(CStateManager& mgr, const zeus::CVector3f& vec); - bool sub801e4f8() { return x7a8_ == 0 || x7a8_ == 1; } + bool sub801e4f8() const { return x7a8_ == 0 || x7a8_ == 1; } void sub801ade80(); void UpdateHeadDamageVulnerability(CStateManager&, bool); - u32 sub801ae828(CStateManager&); - zeus::CVector3f sub801ae754(CStateManager&); + u32 sub801ae828(const CStateManager&) const; + zeus::CVector3f sub801ae754(const CStateManager&) const; - TUniqueId GetMirrorNearestPlayer(CStateManager&); + TUniqueId GetMirrorNearestPlayer(const CStateManager&) const; public: DEFINE_PATTERNED(Flaahgra); CFlaahgra(TUniqueId, std::string_view, const CEntityInfo&, const zeus::CTransform&, const CAnimRes&, diff --git a/Runtime/MP1/World/CJellyZap.cpp b/Runtime/MP1/World/CJellyZap.cpp index fb8f7e5a6..332742fab 100644 --- a/Runtime/MP1/World/CJellyZap.cpp +++ b/Runtime/MP1/World/CJellyZap.cpp @@ -164,16 +164,16 @@ void CJellyZap::RemoveSelfFromFishCloud(CStateManager&) {} void CJellyZap::RemoveAllAttractors(CStateManager& mgr) { RemoveSelfFromFishCloud(mgr); } -bool CJellyZap::ClosestToPlayer(CStateManager& mgr) { - zeus::CVector3f playerPos = mgr.GetPlayer().GetTranslation(); - float ourDistance = (playerPos - GetTranslation()).magnitude(); +bool CJellyZap::ClosestToPlayer(const CStateManager& mgr) const { + const zeus::CVector3f playerPos = mgr.GetPlayer().GetTranslation(); + const float ourDistance = (playerPos - GetTranslation()).magnitude(); float closestDistance = ourDistance; for (CEntity* ent : mgr.GetPhysicsActorObjectList()) { if (CJellyZap* zap = CPatterned::CastTo(ent)) { if (zap->GetAreaIdAlways() != GetAreaIdAlways()) continue; - float tmpDist = (playerPos - zap->GetTranslation()).magnitude(); + const float tmpDist = (playerPos - zap->GetTranslation()).magnitude(); if (tmpDist < closestDistance) closestDistance = tmpDist; diff --git a/Runtime/MP1/World/CJellyZap.hpp b/Runtime/MP1/World/CJellyZap.hpp index 601952bf9..ab89025c8 100644 --- a/Runtime/MP1/World/CJellyZap.hpp +++ b/Runtime/MP1/World/CJellyZap.hpp @@ -28,7 +28,7 @@ class CJellyZap : public CPatterned { void AddAttractor(CStateManager&); void RemoveSelfFromFishCloud(CStateManager&); void RemoveAllAttractors(CStateManager&); - bool ClosestToPlayer(CStateManager&); + bool ClosestToPlayer(const CStateManager&) const; public: DEFINE_PATTERNED(JellyZap) diff --git a/Runtime/MP1/World/CParasite.cpp b/Runtime/MP1/World/CParasite.cpp index 87fa9ad50..4c0fda628 100644 --- a/Runtime/MP1/World/CParasite.cpp +++ b/Runtime/MP1/World/CParasite.cpp @@ -785,13 +785,13 @@ bool CParasite::ShouldAttack(CStateManager& mgr, float arg) { return false; } -bool CParasite::CloseToWall(CStateManager& mgr) { +bool CParasite::CloseToWall(const CStateManager& mgr) const { static CMaterialFilter filter = CMaterialFilter::MakeInclude(EMaterialTypes::Solid); zeus::CAABox aabb = CPhysicsActor::GetBoundingBox(); - float margin = x590_colSphere.GetSphere().radius + x5b0_collisionCloseMargin; + const float margin = x590_colSphere.GetSphere().radius + x5b0_collisionCloseMargin; aabb.min -= zeus::CVector3f(margin); aabb.max += zeus::CVector3f(margin); - CCollidableAABox cAABB(aabb, x68_material); + const CCollidableAABox cAABB(aabb, x68_material); return CGameCollision::DetectStaticCollisionBoolean(mgr, cAABB, {}, filter); } diff --git a/Runtime/MP1/World/CParasite.hpp b/Runtime/MP1/World/CParasite.hpp index 379748915..744e0a34a 100644 --- a/Runtime/MP1/World/CParasite.hpp +++ b/Runtime/MP1/World/CParasite.hpp @@ -82,7 +82,7 @@ class CParasite : public CWallWalker { }; u16 _dummy = 0; }; - bool CloseToWall(CStateManager& mgr); + bool CloseToWall(const CStateManager& mgr) const; void FaceTarget(const zeus::CVector3f& target); TUniqueId RecursiveFindClosestWayPoint(CStateManager& mgr, TUniqueId id, float& dist); TUniqueId GetClosestWaypointForState(EScriptObjectState state, CStateManager& mgr); diff --git a/Runtime/MP1/World/CPuddleToadGamma.cpp b/Runtime/MP1/World/CPuddleToadGamma.cpp index 01c725258..6bb14a416 100644 --- a/Runtime/MP1/World/CPuddleToadGamma.cpp +++ b/Runtime/MP1/World/CPuddleToadGamma.cpp @@ -157,20 +157,20 @@ static CMaterialFilter kSolidFilter = CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, {EMaterialTypes::Character, EMaterialTypes::Player, EMaterialTypes::ProjectilePassthrough}); -bool CPuddleToadGamma::PlayerInVortexArea(const CStateManager& mgr) { - CPlayer& player = mgr.GetPlayer(); - zeus::CTransform xf = GetLctrTransform(mMouthLocatorName); +bool CPuddleToadGamma::PlayerInVortexArea(const CStateManager& mgr) const { + const CPlayer& player = mgr.GetPlayer(); + const zeus::CTransform xf = GetLctrTransform(mMouthLocatorName); - zeus::CVector3f playerOffset = + const zeus::CVector3f playerOffset = player.GetTranslation() + zeus::CVector3f{0.f, 0.f, player.GetMorphBall()->GetBallRadius()}; - zeus::CVector3f rotatedDir = GetTransform().rotate(zeus::skForward); + const zeus::CVector3f rotatedDir = GetTransform().rotate(zeus::skForward); - zeus::CVector3f suckPointToPlayer = (playerOffset - (xf.origin - (1.f * rotatedDir))); - float suckProj = suckPointToPlayer.normalized().dot(rotatedDir); - float playerDist = suckPointToPlayer.magnitude(); - float suckAngleProj = (player.GetTranslation() - (xf.origin - (4.f * rotatedDir))).normalized().dot(rotatedDir); + const zeus::CVector3f suckPointToPlayer = (playerOffset - (xf.origin - (1.f * rotatedDir))); + const float suckProj = suckPointToPlayer.normalized().dot(rotatedDir); + const float playerDist = suckPointToPlayer.magnitude(); + const float suckAngleProj = (player.GetTranslation() - (xf.origin - (4.f * rotatedDir))).normalized().dot(rotatedDir); if (playerDist > 2.f) { - CRayCastResult result = + const CRayCastResult result = mgr.RayStaticIntersection(suckPointToPlayer, 1.f / playerDist * suckPointToPlayer, playerDist - player.GetMorphBall()->GetBallRadius(), kSolidFilter); if (result.IsValid()) diff --git a/Runtime/MP1/World/CPuddleToadGamma.hpp b/Runtime/MP1/World/CPuddleToadGamma.hpp index 932668114..e09e346c4 100644 --- a/Runtime/MP1/World/CPuddleToadGamma.hpp +++ b/Runtime/MP1/World/CPuddleToadGamma.hpp @@ -32,7 +32,7 @@ class CPuddleToadGamma final : public CPatterned { static void CenterPlayer(CStateManager&, const zeus::CVector3f&, float); void ShootPlayer(CStateManager&, float); void SuckPlayer(CStateManager&, float); - bool PlayerInVortexArea(const CStateManager&); + bool PlayerInVortexArea(const CStateManager&) const; void SetPlayerPosition(CStateManager&, const zeus::CVector3f&); public: diff --git a/Runtime/MP1/World/CSpacePirate.cpp b/Runtime/MP1/World/CSpacePirate.cpp index 58ce860d6..432517bfa 100644 --- a/Runtime/MP1/World/CSpacePirate.cpp +++ b/Runtime/MP1/World/CSpacePirate.cpp @@ -516,7 +516,7 @@ void CSpacePirate::SquadRemove(CStateManager& mgr) { } } -bool CSpacePirate::CheckTargetable(CStateManager& mgr) { return GetModelAlphau8(mgr) > 127; } +bool CSpacePirate::CheckTargetable(const CStateManager& mgr) const { return GetModelAlphau8(mgr) > 127; } bool CSpacePirate::FireProjectile(float dt, CStateManager& mgr) { bool ret = false; @@ -619,7 +619,7 @@ void CSpacePirate::UpdateAttacks(float dt, CStateManager& mgr) { xe7_31_targetable = CheckTargetable(mgr); } -zeus::CVector3f CSpacePirate::GetTargetPos(CStateManager& mgr) { +zeus::CVector3f CSpacePirate::GetTargetPos(const CStateManager& mgr) { if (x7c0_targetId != mgr.GetPlayer().GetUniqueId()) { if (TCastToConstPtr act = mgr.GetObjectById(x7c0_targetId)) if (act->GetActive()) @@ -630,7 +630,7 @@ zeus::CVector3f CSpacePirate::GetTargetPos(CStateManager& mgr) { return mgr.GetPlayer().GetTranslation(); } -void CSpacePirate::UpdateAimBodyState(float dt, CStateManager& mgr) { +void CSpacePirate::UpdateAimBodyState(float dt, const CStateManager& mgr) { if (x400_25_alive && x637_25_enableAim && !x637_29_inWallHang && !x450_bodyController->IsFrozen() && !x634_27_melee && !x85c_ragDoll && (!x635_26_seated || x639_28_satUp) && x31c_faceVec.z() <= 0.f) { x8c4_aimDelayTimer = std::max(0.f, x8c4_aimDelayTimer - dt); @@ -1239,8 +1239,8 @@ void CSpacePirate::Dead(CStateManager& mgr, EStateMsg msg, float dt) { } } -bool CSpacePirate::LineOfSightTest(CStateManager& mgr, const zeus::CVector3f& eyePos, const zeus::CVector3f& targetPos, - const CMaterialList& excludeList) const { +bool CSpacePirate::LineOfSightTest(const CStateManager& mgr, const zeus::CVector3f& eyePos, + const zeus::CVector3f& targetPos, const CMaterialList& excludeList) const { return mgr.RayCollideWorld(eyePos, targetPos, CMaterialFilter::MakeIncludeExclude({EMaterialTypes::Solid}, excludeList), this); } @@ -1555,14 +1555,14 @@ void CSpacePirate::Attack(CStateManager& mgr, EStateMsg msg, float dt) { } } -bool CSpacePirate::CantJumpBack(CStateManager& mgr, const zeus::CVector3f& dir, float dist) const { - zeus::CVector3f center = GetBoundingBox().center(); +bool CSpacePirate::CantJumpBack(const CStateManager& mgr, const zeus::CVector3f& dir, float dist) const { + const zeus::CVector3f center = GetBoundingBox().center(); if (!LineOfSightTest(mgr, center, center + dist * dir, {})) return false; - zeus::CVector3f center2 = (dist * 0.5f) * dir + center; + const zeus::CVector3f center2 = (dist * 0.5f) * dir + center; if (LineOfSightTest(mgr, center2, center2 + 5.f * zeus::skDown, {})) return false; - zeus::CVector3f center3 = dist * dir + center; + const zeus::CVector3f center3 = dist * dir + center; if (LineOfSightTest(mgr, center3, center3 + 5.f * zeus::skDown, {})) return false; return true; diff --git a/Runtime/MP1/World/CSpacePirate.hpp b/Runtime/MP1/World/CSpacePirate.hpp index 4fe491e26..9255ea833 100644 --- a/Runtime/MP1/World/CSpacePirate.hpp +++ b/Runtime/MP1/World/CSpacePirate.hpp @@ -225,11 +225,11 @@ private: void SquadReset(CStateManager& mgr); void SquadAdd(CStateManager& mgr); void SquadRemove(CStateManager& mgr); - bool CheckTargetable(CStateManager& mgr); + bool CheckTargetable(const CStateManager& mgr) const; bool FireProjectile(float dt, CStateManager& mgr); void UpdateAttacks(float dt, CStateManager& mgr); - zeus::CVector3f GetTargetPos(CStateManager& mgr); - void UpdateAimBodyState(float dt, CStateManager& mgr); + zeus::CVector3f GetTargetPos(const CStateManager& mgr); + void UpdateAimBodyState(float dt, const CStateManager& mgr); void SetCinematicCollision(CStateManager& mgr); void SetNonCinematicCollision(CStateManager& mgr); void CheckForProjectiles(CStateManager& mgr); @@ -237,11 +237,11 @@ private: void SetVelocityForJump(); void AvoidActors(CStateManager& mgr); void UpdateCantSeePlayer(CStateManager& mgr); - bool LineOfSightTest(CStateManager& mgr, const zeus::CVector3f& eyePos, const zeus::CVector3f& targetPos, + bool LineOfSightTest(const CStateManager& mgr, const zeus::CVector3f& eyePos, const zeus::CVector3f& targetPos, const CMaterialList& excludeList) const; void UpdateHeldPosition(CStateManager& mgr, float dt); void CheckBlade(CStateManager& mgr); - bool CantJumpBack(CStateManager& mgr, const zeus::CVector3f& dir, float dist) const; + bool CantJumpBack(const CStateManager& mgr, const zeus::CVector3f& dir, float dist) const; void UpdateLeashTimer(float dt); pas::EStepDirection GetStrafeDir(CStateManager& mgr, float dist) const; diff --git a/Runtime/MP1/World/CTryclops.cpp b/Runtime/MP1/World/CTryclops.cpp index 40cc03294..3cddfeb70 100644 --- a/Runtime/MP1/World/CTryclops.cpp +++ b/Runtime/MP1/World/CTryclops.cpp @@ -543,7 +543,7 @@ void CTryclops::DragPlayer(CStateManager& mgr, const zeus::CVector3f& locOrig) { player.SetTransform(xf); } -bool CTryclops::InRangeToLocator(const zeus::CVector3f& vec, float arg) { +bool CTryclops::InRangeToLocator(const zeus::CVector3f& vec, float arg) const { return (vec - GetLctrTransform("ballGrab_locator"sv).origin).magSquared() <= arg; } diff --git a/Runtime/MP1/World/CTryclops.hpp b/Runtime/MP1/World/CTryclops.hpp index d831a49b9..8a9801460 100644 --- a/Runtime/MP1/World/CTryclops.hpp +++ b/Runtime/MP1/World/CTryclops.hpp @@ -27,7 +27,7 @@ class CTryclops : public CPatterned { void ApplySeparation(CStateManager&); void GrabBomb(CStateManager& mgr); void DragPlayer(CStateManager& mgr, const zeus::CVector3f& locOrig); - bool InRangeToLocator(const zeus::CVector3f& vec, float); + bool InRangeToLocator(const zeus::CVector3f& vec, float) const; bool sub80260180(const zeus::CVector3f&, const zeus::CVector3f&, const zeus::CAABox&, CStateManager&); void SuckPlayer(CStateManager& mgr, float); void AttractPlayer(CStateManager& mgr, const zeus::CVector3f& dest, float); diff --git a/Runtime/MP1/World/CWarWasp.cpp b/Runtime/MP1/World/CWarWasp.cpp index 55c8d0d3a..9ea9add1f 100644 --- a/Runtime/MP1/World/CWarWasp.cpp +++ b/Runtime/MP1/World/CWarWasp.cpp @@ -124,7 +124,7 @@ std::optional CWarWasp::GetTouchBounds() const { return {x570_cSphere.CalculateAABox(GetTransform())}; } -zeus::CVector3f CWarWasp::GetProjectileAimPos(CStateManager& mgr, float zBias) { +zeus::CVector3f CWarWasp::GetProjectileAimPos(const CStateManager& mgr, float zBias) const { zeus::CVector3f ret = mgr.GetPlayer().GetAimPosition(mgr, 0.f); if (mgr.GetPlayer().GetMorphballTransitionState() != CPlayer::EPlayerMorphBallState::Morphed) ret += zeus::CVector3f(0.f, 0.f, zBias); @@ -353,7 +353,7 @@ void CWarWasp::ApplySeparationBehavior(CStateManager& mgr, float sep) { } } -bool CWarWasp::PathToHiveIsClear(CStateManager& mgr) { +bool CWarWasp::PathToHiveIsClear(CStateManager& mgr) const { zeus::CVector3f delta = x3a0_latestLeashPosition - GetTranslation(); if (GetTransform().basis[1].dot(delta) > 0.f) { zeus::CAABox aabb(GetTranslation() - 10.f, GetTranslation() + 10.f); @@ -652,7 +652,7 @@ void CWarWasp::JumpBack(CStateManager& mgr, EStateMsg msg, float dt) { } } -zeus::CVector3f CWarWasp::CalcShuffleDest(CStateManager& mgr) { +zeus::CVector3f CWarWasp::CalcShuffleDest(const CStateManager& mgr) const { zeus::CVector2f aimPos2d = GetProjectileAimPos(mgr, -1.25f).toVec2f(); zeus::CVector3f playerDir2d = mgr.GetPlayer().GetTransform().basis[1]; playerDir2d.z() = 0.f; @@ -754,7 +754,7 @@ void CWarWasp::ProjectileAttack(CStateManager& mgr, EStateMsg msg, float dt) { } } -s32 CWarWasp::GetAttackTeamSize(CStateManager& mgr, s32 team) { +s32 CWarWasp::GetAttackTeamSize(const CStateManager& mgr, s32 team) const { s32 count = 0; if (TCastToConstPtr aimgr = mgr.GetObjectById(x674_aiMgr)) { if (aimgr->IsPartOfTeam(GetUniqueId())) { @@ -769,21 +769,20 @@ s32 CWarWasp::GetAttackTeamSize(CStateManager& mgr, s32 team) { return count; } -float CWarWasp::CalcTimeToNextAttack(CStateManager& mgr) { +float CWarWasp::CalcTimeToNextAttack(CStateManager& mgr) const { float mul = 1.f; if (TCastToConstPtr aimgr = mgr.GetObjectById(x674_aiMgr)) { - s32 maxCount = (x3fc_flavor == EFlavorType::Two) ? - aimgr->GetMaxRangedAttackerCount() : aimgr->GetMaxMeleeAttackerCount(); - s32 count = (x3fc_flavor == EFlavorType::Two) ? - aimgr->GetNumAssignedOfRole(CTeamAiRole::ETeamAiRole::Ranged) : - aimgr->GetNumAssignedOfRole(CTeamAiRole::ETeamAiRole::Melee); + const s32 maxCount = + (x3fc_flavor == EFlavorType::Two) ? aimgr->GetMaxRangedAttackerCount() : aimgr->GetMaxMeleeAttackerCount(); + const s32 count = (x3fc_flavor == EFlavorType::Two) ? aimgr->GetNumAssignedOfRole(CTeamAiRole::ETeamAiRole::Ranged) + : aimgr->GetNumAssignedOfRole(CTeamAiRole::ETeamAiRole::Melee); if (count <= maxCount) mul *= 0.5f; } return (mgr.GetActiveRandom()->Float() * x308_attackTimeVariation + x304_averageAttackTime) * mul; } -float CWarWasp::CalcOffTotemAngle(CStateManager& mgr) { +float CWarWasp::CalcOffTotemAngle(CStateManager& mgr) const { return mgr.GetActiveRandom()->Float() * zeus::degToRad(80.f) + zeus::degToRad(10.f); } @@ -833,7 +832,7 @@ void CWarWasp::SetUpCircleTelegraphTeam(CStateManager& mgr) { } } -TUniqueId CWarWasp::GetAttackTeamLeader(CStateManager& mgr, s32 team) { +TUniqueId CWarWasp::GetAttackTeamLeader(const CStateManager& mgr, s32 team) const { if (TCastToConstPtr aimgr = mgr.GetObjectById(x674_aiMgr)) { if (aimgr->IsPartOfTeam(GetUniqueId())) { for (const CTeamAiRole& role : aimgr->GetRoles()) { @@ -866,7 +865,7 @@ void CWarWasp::TryCircleTeamMerge(CStateManager& mgr) { } } -float CWarWasp::GetTeamZStratum(s32 team) { +float CWarWasp::GetTeamZStratum(s32 team) const { if (team > 0) { if ((team & 1) == 1) return -3.f - float(team / 2) * 3.f; @@ -878,19 +877,19 @@ float CWarWasp::GetTeamZStratum(s32 team) { static const float Table[] = {0.4f, 0.6f, 1.f}; -float CWarWasp::CalcSeekMagnitude(CStateManager& mgr) { - float ret = ((x708_circleAttackTeam >= 0 && x708_circleAttackTeam < 3) ? Table[x708_circleAttackTeam] : 1.f) * 0.9f; +float CWarWasp::CalcSeekMagnitude(const CStateManager& mgr) const { + const float ret = ((x708_circleAttackTeam >= 0 && x708_circleAttackTeam < 3) ? Table[x708_circleAttackTeam] : 1.f) * 0.9f; if (TCastToConstPtr aimgr = mgr.GetObjectById(x674_aiMgr)) { if (aimgr->IsPartOfTeam(GetUniqueId())) { if (aimgr->GetMaxMeleeAttackerCount() > 1) { if (GetAttackTeamLeader(mgr, x708_circleAttackTeam) != GetUniqueId()) { - zeus::CVector3f fromPlatformCenter = GetTranslation() - x6b0_circleBurstPos; + const zeus::CVector3f fromPlatformCenter = GetTranslation() - x6b0_circleBurstPos; float minAngle = zeus::degToRad(360.f); for (const CTeamAiRole& role : aimgr->GetRoles()) { if (const CWarWasp* other = CPatterned::CastTo(mgr.GetObjectById(role.GetOwnerId()))) { if (x708_circleAttackTeam == other->x708_circleAttackTeam && GetTransform().basis[1].dot(other->GetTranslation() - GetTranslation()) > 0.f) { - float angle = + const float angle = zeus::CVector3f::getAngleDiff(fromPlatformCenter, other->GetTranslation() - x6b0_circleBurstPos); if (angle < minAngle) minAngle = angle; @@ -1155,14 +1154,14 @@ bool CWarWasp::ShouldDodge(CStateManager& mgr, float arg) { return false; } -bool CWarWasp::CheckCircleAttackSpread(CStateManager& mgr, s32 team) { +bool CWarWasp::CheckCircleAttackSpread(const CStateManager& mgr, s32 team) const { if (TCastToConstPtr aimgr = mgr.GetObjectById(x674_aiMgr)) { - s32 teamSize = GetAttackTeamSize(mgr, team); + const s32 teamSize = GetAttackTeamSize(mgr, team); if (teamSize == 1) return true; - TUniqueId leaderId = GetAttackTeamLeader(mgr, team); + const TUniqueId leaderId = GetAttackTeamLeader(mgr, team); if (const CWarWasp* leaderWasp = CPatterned::CastTo(mgr.GetObjectById(leaderId))) { - zeus::CVector3f platformToLeaderWasp = leaderWasp->GetTranslation() - x6b0_circleBurstPos; + const zeus::CVector3f platformToLeaderWasp = leaderWasp->GetTranslation() - x6b0_circleBurstPos; float maxAng = 0.f; for (const CTeamAiRole& role : aimgr->GetRoles()) { if (role.GetOwnerId() == leaderId) @@ -1171,7 +1170,7 @@ bool CWarWasp::CheckCircleAttackSpread(CStateManager& mgr, s32 team) { if (wasp2->x708_circleAttackTeam == team) { if (leaderWasp->GetTransform().basis[1].dot(wasp2->GetTranslation() - leaderWasp->GetTranslation()) > 0.f) return false; - float angle = + const float angle = zeus::CVector3f::getAngleDiff(wasp2->GetTranslation() - x6b0_circleBurstPos, platformToLeaderWasp); if (angle > maxAng) maxAng = angle; diff --git a/Runtime/MP1/World/CWarWasp.hpp b/Runtime/MP1/World/CWarWasp.hpp index ca2e5e1d5..ac6b6bc44 100644 --- a/Runtime/MP1/World/CWarWasp.hpp +++ b/Runtime/MP1/World/CWarWasp.hpp @@ -47,26 +47,26 @@ class CWarWasp : public CPatterned { void SwarmRemove(CStateManager& mgr); void ApplyDamage(CStateManager& mgr); void SetUpCircleBurstWaypoint(CStateManager& mgr); - zeus::CVector3f GetProjectileAimPos(CStateManager& mgr, float zBias); + zeus::CVector3f GetProjectileAimPos(const CStateManager& mgr, float zBias) const; zeus::CVector3f GetCloseInPos(const CStateManager& mgr, const zeus::CVector3f& aimPos) const; float GetCloseInZBasis(const CStateManager& mgr) const; void SetUpPathFindBehavior(CStateManager& mgr); - s32 GetAttackTeamSize(CStateManager& mgr, s32 team); - float CalcTimeToNextAttack(CStateManager& mgr); - float CalcOffTotemAngle(CStateManager& mgr); + s32 GetAttackTeamSize(const CStateManager& mgr, s32 team) const; + float CalcTimeToNextAttack(CStateManager& mgr) const; + float CalcOffTotemAngle(CStateManager& mgr) const; void JoinCircleAttackTeam(s32 unit, CStateManager& mgr); void SetUpCircleTelegraphTeam(CStateManager& mgr); - TUniqueId GetAttackTeamLeader(CStateManager& mgr, s32 team); + TUniqueId GetAttackTeamLeader(const CStateManager& mgr, s32 team) const; void TryCircleTeamMerge(CStateManager& mgr); - float GetTeamZStratum(s32 team); - float CalcSeekMagnitude(CStateManager& mgr); + float GetTeamZStratum(s32 team) const; + float CalcSeekMagnitude(const CStateManager& mgr) const; void UpdateTelegraphMoveSpeed(CStateManager& mgr); - bool CheckCircleAttackSpread(CStateManager& mgr, s32 team); + bool CheckCircleAttackSpread(const CStateManager& mgr, s32 team) const; void ApplyNormalSteering(CStateManager& mgr); void ApplySeparationBehavior(CStateManager& mgr, float sep); - bool PathToHiveIsClear(CStateManager& mgr); + bool PathToHiveIsClear(CStateManager& mgr) const; bool SteerToDeactivatePos(CStateManager& mgr, EStateMsg msg, float dt); - zeus::CVector3f CalcShuffleDest(CStateManager& mgr); + zeus::CVector3f CalcShuffleDest(const CStateManager& mgr) const; public: DEFINE_PATTERNED(WarWasp) diff --git a/Runtime/Particle/CElementGen.cpp b/Runtime/Particle/CElementGen.cpp index e5041bb1e..0923e61c2 100644 --- a/Runtime/Particle/CElementGen.cpp +++ b/Runtime/Particle/CElementGen.cpp @@ -566,7 +566,7 @@ void CElementGen::UpdatePSTranslationAndOrientation() { sepo->GetValue(x74_curFrame, x2c0_SEPO); } -std::unique_ptr CElementGen::ConstructChildParticleSystem(const TToken& desc) { +std::unique_ptr CElementGen::ConstructChildParticleSystem(const TToken& desc) const { CElementGen* ret = new CElementGen(desc, EModelOrientationType::Normal, x26d_27_enableOPTS ? EOptionalSystemFlags::Two : EOptionalSystemFlags::One); ret->x26d_26_modelsUseLights = x26d_26_modelsUseLights; diff --git a/Runtime/Particle/CElementGen.hpp b/Runtime/Particle/CElementGen.hpp index 275b6aad8..1c64ce375 100644 --- a/Runtime/Particle/CElementGen.hpp +++ b/Runtime/Particle/CElementGen.hpp @@ -172,7 +172,7 @@ public: void CreateNewParticles(int); void UpdatePSTranslationAndOrientation(); void UpdateChildParticleSystems(double); - std::unique_ptr ConstructChildParticleSystem(const TToken&); + std::unique_ptr ConstructChildParticleSystem(const TToken&) const; void UpdateLightParameters(); void BuildParticleSystemBounds(); u32 GetEmitterTime() const { return x74_curFrame; } diff --git a/Runtime/Weapon/CGrappleArm.hpp b/Runtime/Weapon/CGrappleArm.hpp index 7a21823b7..4b7378ffe 100644 --- a/Runtime/Weapon/CGrappleArm.hpp +++ b/Runtime/Weapon/CGrappleArm.hpp @@ -133,6 +133,7 @@ public: void EnterComboFire(s32 gunId, CStateManager& mgr); void ReturnToDefault(CStateManager& mgr, float dt, bool setState); CGunController* GunController() { return x328_gunController.get(); } + const CGunController* GunController() const { return x328_gunController.get(); } }; } // namespace urde diff --git a/Runtime/Weapon/CPlayerGun.cpp b/Runtime/Weapon/CPlayerGun.cpp index 080863948..f178a14ab 100644 --- a/Runtime/Weapon/CPlayerGun.cpp +++ b/Runtime/Weapon/CPlayerGun.cpp @@ -811,7 +811,7 @@ void CPlayerGun::ChangeWeapon(const CPlayerState& playerState, CStateManager& mg } void CPlayerGun::GetLctrWithShake(zeus::CTransform& xfOut, const CModelData& mData, std::string_view lctrName, - bool shake, bool dyn) { + bool shake, bool dyn) const { if (dyn) xfOut = mData.GetScaledLocatorTransformDynamic(lctrName, nullptr); else diff --git a/Runtime/Weapon/CPlayerGun.hpp b/Runtime/Weapon/CPlayerGun.hpp index 772709998..870cfadc4 100644 --- a/Runtime/Weapon/CPlayerGun.hpp +++ b/Runtime/Weapon/CPlayerGun.hpp @@ -284,7 +284,7 @@ private: void ReturnToRestPose(); void ChangeWeapon(const CPlayerState& playerState, CStateManager& mgr); void GetLctrWithShake(zeus::CTransform& xfOut, const CModelData& mData, std::string_view lctrName, bool shake, - bool dyn); + bool dyn) const; void UpdateLeftArmTransform(const CModelData& mData, const CStateManager& mgr); void ProcessGunMorph(float dt, CStateManager& mgr); void SetPhazonBeamFeedback(bool active); @@ -338,6 +338,7 @@ public: void SetTransform(const zeus::CTransform& xf) { x3e8_xf = xf; } void SetAssistAimTransform(const zeus::CTransform& xf) { x478_assistAimXf = xf; } CGrappleArm& GetGrappleArm() { return *x740_grappleArm; } + const CGrappleArm& GetGrappleArm() const { return *x740_grappleArm; } void DamageRumble(const zeus::CVector3f& location, float damage, const CStateManager& mgr); void ResetCharge(CStateManager& mgr, bool resetBeam); void HandleBeamChange(const CFinalInput& input, CStateManager& mgr); diff --git a/Runtime/Weapon/CProjectileInfo.cpp b/Runtime/Weapon/CProjectileInfo.cpp index 10edb3e89..01152f8ee 100644 --- a/Runtime/Weapon/CProjectileInfo.cpp +++ b/Runtime/Weapon/CProjectileInfo.cpp @@ -62,7 +62,7 @@ float CProjectileInfo::GetProjectileSpeed() const { } zeus::CVector3f CProjectileInfo::PredictInterceptPos(const zeus::CVector3f& gunPos, const zeus::CVector3f& aimPos, - const CPlayer& player, bool gravity, float dt) { + const CPlayer& player, bool gravity, float dt) const { return PredictInterceptPos(gunPos, aimPos, player, gravity, GetProjectileSpeed(), dt); } diff --git a/Runtime/Weapon/CProjectileInfo.hpp b/Runtime/Weapon/CProjectileInfo.hpp index 530fc424e..6d33ea26e 100644 --- a/Runtime/Weapon/CProjectileInfo.hpp +++ b/Runtime/Weapon/CProjectileInfo.hpp @@ -19,7 +19,7 @@ public: static zeus::CVector3f PredictInterceptPos(const zeus::CVector3f& gunPos, const zeus::CVector3f& aimPos, const CPlayer& player, bool gravity, float speed, float dt); zeus::CVector3f PredictInterceptPos(const zeus::CVector3f& gunPos, const zeus::CVector3f& aimPos, - const CPlayer& player, bool gravity, float dt); + const CPlayer& player, bool gravity, float dt) const; const CDamageInfo& GetDamage() const { return xc_damageInfo; } TToken& Token() { return x0_weaponDescription; } diff --git a/Runtime/World/CFishCloud.cpp b/Runtime/World/CFishCloud.cpp index 2e0f97fd4..7b8ea56e9 100644 --- a/Runtime/World/CFishCloud.cpp +++ b/Runtime/World/CFishCloud.cpp @@ -212,7 +212,7 @@ void CFishCloud::BuildBoidNearPartitionList(const zeus::CVector3f& pos, float ra } } -void CFishCloud::PlaceBoid(CStateManager& mgr, CBoid& boid, const zeus::CAABox& aabb) { +void CFishCloud::PlaceBoid(CStateManager& mgr, CBoid& boid, const zeus::CAABox& aabb) const { auto plane = FindClosestPlane(aabb, boid.x0_pos); boid.x0_pos -= plane.pointToPlaneDist(boid.x0_pos) * plane.normal() + 0.0001f * plane.normal(); boid.xc_vel.y() = mgr.GetActiveRandom()->Float() - 0.5f; diff --git a/Runtime/World/CFishCloud.hpp b/Runtime/World/CFishCloud.hpp index 52033a382..10e571141 100644 --- a/Runtime/World/CFishCloud.hpp +++ b/Runtime/World/CFishCloud.hpp @@ -100,7 +100,7 @@ class CFishCloud : public CActor { void BuildBoidNearList(const zeus::CVector3f& pos, float radius, rstl::reserved_vector& nearList); void BuildBoidNearPartitionList(const zeus::CVector3f& pos, float radius, rstl::reserved_vector& nearList); - void PlaceBoid(CStateManager& mgr, CBoid& boid, const zeus::CAABox& aabb); + void PlaceBoid(CStateManager& mgr, CBoid& boid, const zeus::CAABox& aabb) const; void ApplySeparation(CBoid& boid, const rstl::reserved_vector& nearList) const; void ApplySeparation(CBoid& boid, const zeus::CVector3f& separateFrom, float separationRadius, float separationMagnitude) const; diff --git a/Runtime/World/CGameArea.cpp b/Runtime/World/CGameArea.cpp index 4fe7c7e0a..20d67b559 100644 --- a/Runtime/World/CGameArea.cpp +++ b/Runtime/World/CGameArea.cpp @@ -895,7 +895,7 @@ void CGameArea::LoadScriptObjects(CStateManager& mgr) { mgr.InitScriptObjects(objIds); } -std::pair CGameArea::GetLayerScriptBuffer(int layer) { +std::pair CGameArea::GetLayerScriptBuffer(int layer) const { if (!xf0_24_postConstructed) return {}; return x12c_postConstructed->x110c_layerPtrs[layer]; diff --git a/Runtime/World/CGameArea.hpp b/Runtime/World/CGameArea.hpp index a411c44c4..8cf38094c 100644 --- a/Runtime/World/CGameArea.hpp +++ b/Runtime/World/CGameArea.hpp @@ -315,7 +315,7 @@ public: void StartStreamIn(CStateManager& mgr); void Validate(CStateManager& mgr); void LoadScriptObjects(CStateManager& mgr); - std::pair GetLayerScriptBuffer(int layer); + std::pair GetLayerScriptBuffer(int layer) const; void PostConstructArea(); void FillInStaticGeometry(bool textures = true); void VerifyTokenList(CStateManager& stateMgr); diff --git a/Runtime/World/CPathFindArea.cpp b/Runtime/World/CPathFindArea.cpp index 01444e87d..e2e22a927 100644 --- a/Runtime/World/CPathFindArea.cpp +++ b/Runtime/World/CPathFindArea.cpp @@ -116,7 +116,7 @@ void CPFOpenList::Pop(CPFRegion* reg) { reg->Data()->SetOpenLess(nullptr); } -bool CPFOpenList::Test(CPFRegion* reg) { return x0_bitSet.Test(reg->GetIndex()); } +bool CPFOpenList::Test(const CPFRegion* reg) const { return x0_bitSet.Test(reg->GetIndex()); } CPFArea::CPFArea(std::unique_ptr&& buf, u32 len) { CMemoryInStream r(buf.get(), len); diff --git a/Runtime/World/CPathFindArea.hpp b/Runtime/World/CPathFindArea.hpp index d844566d3..7b3b1dfe3 100644 --- a/Runtime/World/CPathFindArea.hpp +++ b/Runtime/World/CPathFindArea.hpp @@ -53,7 +53,7 @@ public: void Push(CPFRegion* reg); CPFRegion* Pop(); void Pop(CPFRegion* reg); - bool Test(CPFRegion* reg); + bool Test(const CPFRegion* reg) const; }; class CPFArea { diff --git a/Runtime/World/CPathFindRegion.cpp b/Runtime/World/CPathFindRegion.cpp index cfb86be85..93518c335 100644 --- a/Runtime/World/CPathFindRegion.cpp +++ b/Runtime/World/CPathFindRegion.cpp @@ -66,7 +66,7 @@ float CPFRegion::PointHeight(const zeus::CVector3f& point) const { } bool CPFRegion::FindClosestPointOnPolygon(const std::vector& polyPoints, const zeus::CVector3f& normal, - const zeus::CVector3f& point, bool excludePolyPoints) { + const zeus::CVector3f& point, bool excludePolyPoints) const { bool found = false; size_t i; for (i = 0; i < polyPoints.size(); ++i) { @@ -122,7 +122,7 @@ bool CPFRegion::FindClosestPointOnPolygon(const std::vector& po } bool CPFRegion::FindBestPoint(std::vector& polyPoints, const zeus::CVector3f& point, u32 flags, - float paddingSq) { + float paddingSq) const { bool found = false; bool isFlyer = (flags & 0x2) != 0; x4c_regionData->SetBestPointDistanceSquared(paddingSq); diff --git a/Runtime/World/CPathFindRegion.hpp b/Runtime/World/CPathFindRegion.hpp index 8e000435e..ef669cd2d 100644 --- a/Runtime/World/CPathFindRegion.hpp +++ b/Runtime/World/CPathFindRegion.hpp @@ -65,9 +65,9 @@ public: const CPFNode* GetNode(u32 i) const { return x4_startNode + i; } float PointHeight(const zeus::CVector3f& point) const; bool FindClosestPointOnPolygon(const std::vector&, const zeus::CVector3f&, const zeus::CVector3f&, - bool); + bool) const; bool FindBestPoint(std::vector& polyPoints, const zeus::CVector3f& point, u32 flags, - float paddingSq); + float paddingSq) const; void SetLinkTo(s32 idx); void DropToGround(zeus::CVector3f& point) const; zeus::CVector3f GetLinkMidPoint(const CPFLink& link) const; diff --git a/Runtime/World/CPatterned.cpp b/Runtime/World/CPatterned.cpp index a78ec3528..ac3ddf786 100644 --- a/Runtime/World/CPatterned.cpp +++ b/Runtime/World/CPatterned.cpp @@ -1165,7 +1165,7 @@ void CPatterned::UpdateAlphaDelta(float dt, CStateManager& mgr) { x64_modelData->AnimationData()->GetParticleDB().SetModulationColorAllActiveEffects(zeus::CColor(1.f, alpha)); } -float CPatterned::CalcDyingThinkRate() { +float CPatterned::CalcDyingThinkRate() const { float f0 = (x401_28_burning ? (x3f4_burnThinkRateTimer / 1.5f) : 1.f); return zeus::max(0.1f, f0); } diff --git a/Runtime/World/CPatterned.hpp b/Runtime/World/CPatterned.hpp index f546c07f0..767ccfbf3 100644 --- a/Runtime/World/CPatterned.hpp +++ b/Runtime/World/CPatterned.hpp @@ -372,7 +372,7 @@ public: void SetDestPos(const zeus::CVector3f& pos) { x2e0_destPos = pos; } void UpdateAlphaDelta(float dt, CStateManager& mgr); void SetModelAlpha(float a) { x42c_color.a() = a; } - float CalcDyingThinkRate(); + float CalcDyingThinkRate() const; void UpdateDamageColor(float dt); CScriptCoverPoint* GetCoverPoint(CStateManager& mgr, TUniqueId id) const; void SetCoverPoint(CScriptCoverPoint* cp, TUniqueId& id); diff --git a/Runtime/World/CPhysicsActor.cpp b/Runtime/World/CPhysicsActor.cpp index 75b0f159f..3112855e2 100644 --- a/Runtime/World/CPhysicsActor.cpp +++ b/Runtime/World/CPhysicsActor.cpp @@ -218,7 +218,7 @@ void CPhysicsActor::ComputeDerivedQuantities() { x144_angularVelocity = xf4_inertiaTensorRecip * x108_angularMomentum; } -bool CPhysicsActor::WillMove(const CStateManager&) { +bool CPhysicsActor::WillMove(const CStateManager&) const { return !zeus::close_enough(zeus::skZero3f, x138_velocity) || !zeus::close_enough(zeus::skZero3f, x168_impulse) || !zeus::close_enough(zeus::skZero3f, x174_torque) || diff --git a/Runtime/World/CPhysicsActor.hpp b/Runtime/World/CPhysicsActor.hpp index 0db06d62e..0184e2264 100644 --- a/Runtime/World/CPhysicsActor.hpp +++ b/Runtime/World/CPhysicsActor.hpp @@ -150,7 +150,7 @@ public: void SetVelocityWR(const zeus::CVector3f& vel); void SetVelocityOR(const zeus::CVector3f& vel); void SetMomentumWR(const zeus::CVector3f& m) { x150_momentum = m; } - const zeus::CVector3f& GetConstantForce() { return xfc_constantForce; } + const zeus::CVector3f& GetConstantForce() const { return xfc_constantForce; } void SetConstantForce(const zeus::CVector3f& f) { xfc_constantForce = f; } void SetAngularMomentum(const zeus::CAxisAngle& m) { x108_angularMomentum = m; } const zeus::CVector3f& GetMomentum() const { return x150_momentum; } @@ -170,7 +170,7 @@ public: void ClearForcesAndTorques(); void Stop(); void ComputeDerivedQuantities(); - bool WillMove(const CStateManager&); + bool WillMove(const CStateManager&) const; void SetPhysicsState(const CPhysicsState& state); CPhysicsState GetPhysicsState() const; bool IsMovable() const { return xf8_24_movable; } diff --git a/Runtime/World/CPlayer.cpp b/Runtime/World/CPlayer.cpp index 7b39db952..6dfa7851b 100644 --- a/Runtime/World/CPlayer.cpp +++ b/Runtime/World/CPlayer.cpp @@ -915,7 +915,7 @@ void CPlayer::Accept(IVisitor& visitor) { visitor.Visit(this); } CHealthInfo* CPlayer::HealthInfo(CStateManager& mgr) { return &mgr.GetPlayerState()->HealthInfo(); } -bool CPlayer::IsUnderBetaMetroidAttack(CStateManager& mgr) const { +bool CPlayer::IsUnderBetaMetroidAttack(const CStateManager& mgr) const { if (x274_energyDrain.GetEnergyDrainIntensity() > 0.f) { for (const CEnergyDrainSource& source : x274_energyDrain.GetEnergyDrainSources()) if (CPatterned::CastTo(mgr.GetObjectById(source.GetEnergyDrainSourceId()))) @@ -1000,7 +1000,7 @@ void CPlayer::UpdateScanningState(const CFinalInput& input, CStateManager& mgr, } } -bool CPlayer::ValidateScanning(const CFinalInput& input, CStateManager& mgr) { +bool CPlayer::ValidateScanning(const CFinalInput& input, const CStateManager& mgr) const { if (ControlMapper::GetDigitalInput(ControlMapper::ECommands::ScanItem, input)) { if (x304_orbitState == EPlayerOrbitState::OrbitObject) { if (TCastToPtr act = mgr.ObjectById(x310_orbitTargetId)) { @@ -2660,7 +2660,7 @@ void CPlayer::UpdateFootstepSounds(const CFinalInput& input, CStateManager& mgr, } } -u16 CPlayer::GetMaterialSoundUnderPlayer(CStateManager& mgr, const u16* table, u32 length, u16 defId) { +u16 CPlayer::GetMaterialSoundUnderPlayer(const CStateManager& mgr, const u16* table, u32 length, u16 defId) const { u16 ret = defId; zeus::CAABox aabb = GetBoundingBox(); aabb.accumulateBounds(x34_transform.origin + zeus::skDown); @@ -3274,7 +3274,7 @@ void CPlayer::ApplyGrappleForces(const CFinalInput& input, CStateManager& mgr, f SetAngularVelocityOR(newAngVel); } -bool CPlayer::ValidateFPPosition(const zeus::CVector3f& pos, CStateManager& mgr) { +bool CPlayer::ValidateFPPosition(const zeus::CVector3f& pos, const CStateManager& mgr) const { CMaterialFilter solidFilter = CMaterialFilter::MakeInclude({EMaterialTypes::Solid}); zeus::CAABox aabb(x2d8_fpBounds.min - 1.f + pos, x2d8_fpBounds.max + 1.f + pos); rstl::reserved_vector nearList; @@ -3837,7 +3837,7 @@ static zeus::CAABox BuildNearListBox(bool cropBottom, const zeus::CTransform& xf return aabb.getTransformedAABox(xf); } -TUniqueId CPlayer::FindAimTargetId(CStateManager& mgr) { +TUniqueId CPlayer::FindAimTargetId(CStateManager& mgr) const { float dist = g_tweakPlayer->GetAimMaxDistance(); if (x9c6_24_extendTargetDistance) dist *= 5.f; @@ -3917,7 +3917,7 @@ TUniqueId CPlayer::CheckEnemiesAgainstOrbitZone(const rstl::reserved_vector GetTouchBounds() const override; void Touch(CActor& actor, CStateManager& mgr) override; void DoPreThink(float dt, CStateManager& mgr); void DoThink(float dt, CStateManager& mgr); void UpdateScanningState(const CFinalInput& input, CStateManager& mgr, float); - bool ValidateScanning(const CFinalInput& input, CStateManager& mgr); + bool ValidateScanning(const CFinalInput& input, const CStateManager& mgr) const; void FinishNewScan(CStateManager& mgr); void SetScanningState(EPlayerScanState, CStateManager& mgr); void SetSpawnedMorphBallState(EPlayerMorphBallState, CStateManager&); @@ -432,7 +432,7 @@ public: void AcceptScriptMsg(EScriptObjectMessage, TUniqueId, CStateManager&) override; void SetVisorSteam(float, float, float, CAssetId, bool); void UpdateFootstepSounds(const CFinalInput& input, CStateManager&, float); - u16 GetMaterialSoundUnderPlayer(CStateManager& mgr, const u16*, u32, u16); + u16 GetMaterialSoundUnderPlayer(const CStateManager& mgr, const u16*, u32, u16) const; static u16 SfxIdFromMaterial(const CMaterialList&, const u16*, u32, u16); void UpdateCrosshairsState(const CFinalInput&); void UpdateVisorTransition(float, CStateManager& mgr); @@ -460,7 +460,7 @@ public: void UpdateGrappleArmTransform(const zeus::CVector3f&, CStateManager& mgr, float); float GetGravity() const; void ApplyGrappleForces(const CFinalInput& input, CStateManager& mgr, float); - bool ValidateFPPosition(const zeus::CVector3f& pos, CStateManager& mgr); + bool ValidateFPPosition(const zeus::CVector3f& pos, const CStateManager& mgr) const; void UpdateGrappleState(const CFinalInput& input, CStateManager& mgr); void ApplyGrappleJump(CStateManager& mgr); void BeginGrapple(zeus::CVector3f&, CStateManager& mgr); @@ -482,11 +482,11 @@ public: void UpdateAimTargetTimer(float); bool ValidateAimTargetId(TUniqueId, CStateManager& mgr); bool ValidateObjectForMode(TUniqueId, CStateManager& mgr) const; - TUniqueId FindAimTargetId(CStateManager& mgr); + TUniqueId FindAimTargetId(CStateManager& mgr) const; TUniqueId GetAimTarget() const { return x3f4_aimTarget; } TUniqueId CheckEnemiesAgainstOrbitZone(const rstl::reserved_vector&, EPlayerZoneInfo, EPlayerZoneType, CStateManager& mgr) const; - TUniqueId FindOrbitTargetId(CStateManager& mgr); + TUniqueId FindOrbitTargetId(CStateManager& mgr) const; void UpdateOrbitableObjects(CStateManager& mgr); TUniqueId FindBestOrbitableObject(const std::vector&, EPlayerZoneInfo, CStateManager& mgr) const; void FindOrbitableObjects(const rstl::reserved_vector&, std::vector&, EPlayerZoneInfo, diff --git a/Runtime/World/CPlayerCameraBob.cpp b/Runtime/World/CPlayerCameraBob.cpp index 5fa49b8b6..a00c61b62 100644 --- a/Runtime/World/CPlayerCameraBob.cpp +++ b/Runtime/World/CPlayerCameraBob.cpp @@ -165,13 +165,13 @@ void CPlayerCameraBob::Update(float dt, CStateManager& mgr) { zeus::lookAt(zeus::skZero3f, {0.f, 2.f, x78_camTranslation}, zeus::skUp); } -zeus::CVector3f CPlayerCameraBob::CalculateRandomViewWanderPosition(CStateManager& mgr) { +zeus::CVector3f CPlayerCameraBob::CalculateRandomViewWanderPosition(CStateManager& mgr) const { const float angle = (2.f * (M_PIF * mgr.GetActiveRandom()->Float())); const float bias = kViewWanderRadius * mgr.GetActiveRandom()->Float(); return {(bias * std::sin(angle)), 1.f, (bias * std::cos(angle))}; } -float CPlayerCameraBob::CalculateRandomViewWanderPitch(CStateManager& mgr) { +float CPlayerCameraBob::CalculateRandomViewWanderPitch(CStateManager& mgr) const { return zeus::degToRad((2.f * (mgr.GetActiveRandom()->Float() - 0.5f)) * kViewWanderRollVariation); } diff --git a/Runtime/World/CPlayerCameraBob.hpp b/Runtime/World/CPlayerCameraBob.hpp index a596ce8a5..65b814257 100644 --- a/Runtime/World/CPlayerCameraBob.hpp +++ b/Runtime/World/CPlayerCameraBob.hpp @@ -87,8 +87,8 @@ public: void InitViewWander(CStateManager&); void UpdateViewWander(float, CStateManager&); void Update(float, CStateManager&); - zeus::CVector3f CalculateRandomViewWanderPosition(CStateManager&); - float CalculateRandomViewWanderPitch(CStateManager&); + zeus::CVector3f CalculateRandomViewWanderPosition(CStateManager&) const; + float CalculateRandomViewWanderPitch(CStateManager&) const; void CalculateMovingTranslation(float& x, float& y) const; float CalculateLandingTranslation() const; zeus::CTransform CalculateCameraBobTransformation() const; diff --git a/Runtime/World/CScriptDoor.cpp b/Runtime/World/CScriptDoor.cpp index fdb2c78c0..3e8625660 100644 --- a/Runtime/World/CScriptDoor.cpp +++ b/Runtime/World/CScriptDoor.cpp @@ -223,7 +223,7 @@ void CScriptDoor::ForceClosed(CStateManager& mgr) { } /* ORIGINAL 0-00 OFFSET: 8007E1C4 */ -bool CScriptDoor::IsConnectedToArea(const CStateManager& mgr, TAreaId areaId) { +bool CScriptDoor::IsConnectedToArea(const CStateManager& mgr, TAreaId areaId) const { const CScriptDock* dockEnt = TCastToConstPtr(mgr.GetObjectById(x282_dockId)); if (dockEnt) { if (dockEnt->GetAreaId() == areaId) @@ -286,7 +286,7 @@ void CScriptDoor::OpenDoor(TUniqueId uid, CStateManager& mgr) { } /* ORIGINAL 0-00 OFFSET: 8007ED4C */ -CScriptDoor::EDoorOpenCondition CScriptDoor::GetDoorOpenCondition(CStateManager& mgr) { +CScriptDoor::EDoorOpenCondition CScriptDoor::GetDoorOpenCondition(CStateManager& mgr) const { const TCastToPtr dock = mgr.ObjectById(x282_dockId); if (!dock) return EDoorOpenCondition::Ready; diff --git a/Runtime/World/CScriptDoor.hpp b/Runtime/World/CScriptDoor.hpp index a4d000e82..12551c41c 100644 --- a/Runtime/World/CScriptDoor.hpp +++ b/Runtime/World/CScriptDoor.hpp @@ -49,9 +49,9 @@ public: void AddToRenderer(const zeus::CFrustum&, const CStateManager& mgr) const override; void Render(const CStateManager&) const override {} void ForceClosed(CStateManager&); - bool IsConnectedToArea(const CStateManager& mgr, TAreaId area); + bool IsConnectedToArea(const CStateManager& mgr, TAreaId area) const; void OpenDoor(TUniqueId, CStateManager&); - EDoorOpenCondition GetDoorOpenCondition(CStateManager& mgr); + EDoorOpenCondition GetDoorOpenCondition(CStateManager& mgr) const; void SetDoorAnimation(EDoorAnimType); std::optional GetTouchBounds() const override; std::optional GetProjectileBounds() const; diff --git a/Runtime/World/CScriptEffect.cpp b/Runtime/World/CScriptEffect.cpp index a4fcbe31e..db7dc3fe0 100644 --- a/Runtime/World/CScriptEffect.cpp +++ b/Runtime/World/CScriptEffect.cpp @@ -353,7 +353,7 @@ zeus::CAABox CScriptEffect::GetSortingBounds(const CStateManager& mgr) const { return static_cast(mgr.GetObjectById(x13c_triggerId))->GetTriggerBoundsWR(); } -bool CScriptEffect::AreBothSystemsDeleteable() { +bool CScriptEffect::AreBothSystemsDeleteable() const { bool ret = true; if (x104_particleSystem && !x104_particleSystem->IsSystemDeletable()) ret = false; diff --git a/Runtime/World/CScriptEffect.hpp b/Runtime/World/CScriptEffect.hpp index 1d37e44a7..b8dca4a0c 100644 --- a/Runtime/World/CScriptEffect.hpp +++ b/Runtime/World/CScriptEffect.hpp @@ -65,7 +65,7 @@ public: } void CalculateRenderBounds() override; zeus::CAABox GetSortingBounds(const CStateManager&) const override; - bool AreBothSystemsDeleteable(); + bool AreBothSystemsDeleteable() const; static void ResetParticleCounts() { g_NumParticlesUpdating = 0; g_NumParticlesRendered = 0; diff --git a/Runtime/World/CStateMachine.hpp b/Runtime/World/CStateMachine.hpp index c4e77f2b6..18c81ccf5 100644 --- a/Runtime/World/CStateMachine.hpp +++ b/Runtime/World/CStateMachine.hpp @@ -20,7 +20,7 @@ public: CAiTrigger() = default; CAiTrigger* GetAnd() const { return x10_andTrig; } CAiState* GetState() const { return x14_state; } - bool CallFunc(CStateManager& mgr, CAi& ai) { + bool CallFunc(CStateManager& mgr, CAi& ai) const { if (x0_func) { bool ret = (ai.*x0_func)(mgr, xc_arg); return x18_lNot ? !ret : ret; diff --git a/Runtime/World/CVisorFlare.hpp b/Runtime/World/CVisorFlare.hpp index 54f26f6b4..2af7bd481 100644 --- a/Runtime/World/CVisorFlare.hpp +++ b/Runtime/World/CVisorFlare.hpp @@ -27,7 +27,7 @@ public: } TToken GetTexture() const; - zeus::CColor GetColor() { return x10_color; } + zeus::CColor GetColor() const { return x10_color; } float GetScale() const; float GetPosition() const; }; diff --git a/Runtime/World/CWorldTransManager.hpp b/Runtime/World/CWorldTransManager.hpp index df833b088..38e16740c 100644 --- a/Runtime/World/CWorldTransManager.hpp +++ b/Runtime/World/CWorldTransManager.hpp @@ -111,7 +111,7 @@ public: bool IsTransitionEnabled() const { return x30_type != ETransType::Disabled; } void DisableTransition(); void TouchModels(); - ETransType GetTransType() { return x30_type; } + ETransType GetTransType() const { return x30_type; } void SetSfx(u16 sfx, u8 volume, u8 panning) { x24_sfx = sfx; x2c_volume = volume;