From 3e2ea84c7e2f80392b4884cbd93a76e270200e25 Mon Sep 17 00:00:00 2001 From: Luke Street Date: Sat, 22 Oct 2022 11:56:07 -0400 Subject: [PATCH] Use private fields + getters for CEntity --- include/MetroidPrime/CEntity.hpp | 4 ++-- include/MetroidPrime/CStateManager.hpp | 2 +- include/MetroidPrime/CWorld.hpp | 4 ++-- src/MetroidPrime/BodyState/CABSFlinch.cpp | 2 +- src/MetroidPrime/CActor.cpp | 6 +++--- src/MetroidPrime/Enemies/CAmbientAI.cpp | 2 +- src/MetroidPrime/Enemies/CBurstFire.cpp | 4 ++-- src/MetroidPrime/Player/CFidget.cpp | 10 +++++----- src/MetroidPrime/Player/CPlayerGun.cpp | 4 ++-- .../ScriptObjects/CScriptAiJumpPoint.cpp | 4 ++-- .../ScriptObjects/CScriptAreaAttributes.cpp | 9 +++++---- .../ScriptObjects/CScriptCameraWaypoint.cpp | 11 +++++------ .../ScriptObjects/CScriptDistanceFog.cpp | 10 +++++----- .../ScriptObjects/CScriptDockAreaChange.cpp | 4 ++-- src/MetroidPrime/ScriptObjects/CScriptMazeNode.cpp | 2 +- src/MetroidPrime/ScriptObjects/CScriptPickup.cpp | 2 +- src/MetroidPrime/ScriptObjects/CScriptRelay.cpp | 2 +- src/MetroidPrime/ScriptObjects/CScriptRipple.cpp | 4 ++-- src/MetroidPrime/ScriptObjects/CScriptSpawnPoint.cpp | 2 +- .../ScriptObjects/CScriptSpecialFunction.cpp | 12 ++++++------ .../ScriptObjects/CScriptTargetingPoint.cpp | 2 +- src/MetroidPrime/ScriptObjects/CScriptTimer.cpp | 2 +- src/MetroidPrime/ScriptObjects/CScriptTrigger.cpp | 6 +++--- .../Weapons/GunController/CGSFreeLook.cpp | 2 +- .../Weapons/GunController/CGunMotion.cpp | 6 +++--- 25 files changed, 59 insertions(+), 59 deletions(-) diff --git a/include/MetroidPrime/CEntity.hpp b/include/MetroidPrime/CEntity.hpp index 1d0887ac..c0c16810 100644 --- a/include/MetroidPrime/CEntity.hpp +++ b/include/MetroidPrime/CEntity.hpp @@ -30,7 +30,7 @@ public: TUniqueId GetUniqueId() const { return x8_uid; } TEditorId GetEditorId() const { return xc_editorId; } TAreaId GetAreaId() const; - TAreaId GetAreaIdAlways() const { return x4_areaId; } + TAreaId GetCurrentAreaId() const { return x4_areaId; } bool GetActive() const { return x30_24_active; } bool IsScriptingBlocked() const { return x30_26_scriptingBlocked; } @@ -40,7 +40,7 @@ public: static rstl::vector< SConnection > NullConnectionList; -protected: +private: TAreaId x4_areaId; TUniqueId x8_uid; TEditorId xc_editorId; diff --git a/include/MetroidPrime/CStateManager.hpp b/include/MetroidPrime/CStateManager.hpp index aa317b5d..a8789778 100644 --- a/include/MetroidPrime/CStateManager.hpp +++ b/include/MetroidPrime/CStateManager.hpp @@ -152,7 +152,7 @@ public: const CEnvFxManager* GetEnvFxManager() const { return x880_envFxManager; } CRumbleManager* GetRumbleManager() { return x88c_rumbleManager; } - CRandom16* GetActiveRandom() const { return x900_random; } + CRandom16* Random() const { return x900_random; } CObjectList& GetObjectListById(EGameObjectList id) { return *x808_objectLists[id]; } diff --git a/include/MetroidPrime/CWorld.hpp b/include/MetroidPrime/CWorld.hpp index 81f42e61..fa2a6e75 100644 --- a/include/MetroidPrime/CWorld.hpp +++ b/include/MetroidPrime/CWorld.hpp @@ -61,9 +61,9 @@ public: int IGetAreaCount() const override; const CGameArea& GetAreaAlways(TAreaId id) const { return *x18_areas[id.Value()]; } - const CGameArea* GetArea(TAreaId id) const { return x18_areas[id.Value()].get(); } CGameArea* Area(TAreaId id) { return x18_areas[id.Value()].get(); } - bool IsAreaValid(TAreaId id) const { return x18_areas[id.Value()]->IsLoaded(); } + const CGameArea* GetArea(TAreaId id) const { return x18_areas[id.Value()].get(); } + bool IsAreaValid(TAreaId id) const { return GetArea(id)->IsLoaded(); } CAssetId GetWorldAssetId() const { return x8_mlvlId; } TAreaId GetAreaIdForSaveId(int saveId) const; diff --git a/src/MetroidPrime/BodyState/CABSFlinch.cpp b/src/MetroidPrime/BodyState/CABSFlinch.cpp index 7fea5279..6f214c49 100644 --- a/src/MetroidPrime/BodyState/CABSFlinch.cpp +++ b/src/MetroidPrime/BodyState/CABSFlinch.cpp @@ -21,7 +21,7 @@ void CABSFlinch::Start(CBodyController& bc, CStateManager& mgr) { const CPASDatabase& pasDB = bc.GetPASDatabase(); CPASAnimParmData parms(pas::kAS_AdditiveFlinch); - rstl::pair< float, int > best = pasDB.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); + rstl::pair< float, int > best = pasDB.FindBestAnimation(parms, *mgr.Random(), -1); x8_anim = best.second; CAnimData& animData = *bc.GetOwner().ModelData()->AnimationData(); diff --git a/src/MetroidPrime/CActor.cpp b/src/MetroidPrime/CActor.cpp index a5702947..19393887 100644 --- a/src/MetroidPrime/CActor.cpp +++ b/src/MetroidPrime/CActor.cpp @@ -110,7 +110,7 @@ CAdvancementDeltas CActor::UpdateAnimation(float dt, CStateManager& mgr, bool ad UpdateSfxEmitters(); if (HasAnimation()) { ushort maxVol = xd4_maxVol; - int aid = x4_areaId.Value(); + int aid = GetCurrentAreaId().Value(); const CGameCamera* camera = mgr.GetCameraManager()->GetCurrentCamera(mgr); const CVector3f origin = GetTranslation(); @@ -236,8 +236,8 @@ void CActor::PreRender(CStateManager& mgr, const CFrustumPlanes& planes) { ActorLights()->BuildConstantAmbientLighting(); } else { if (lightsDirty == true) { - if (x4_areaId != kInvalidAreaId) { - TAreaId aid = x4_areaId; + if (GetCurrentAreaId() != kInvalidAreaId) { + TAreaId aid = GetCurrentAreaId(); if (mgr.GetWorld()->IsAreaValid(aid)) { const CGameArea* area = mgr.GetWorld()->GetArea(aid); if (ActorLights()->BuildAreaLightList(mgr, *area, bounds)) { diff --git a/src/MetroidPrime/Enemies/CAmbientAI.cpp b/src/MetroidPrime/Enemies/CAmbientAI.cpp index 1cd7e876..83bd814b 100644 --- a/src/MetroidPrime/Enemies/CAmbientAI.cpp +++ b/src/MetroidPrime/Enemies/CAmbientAI.cpp @@ -44,7 +44,7 @@ rstl::optional_object< CAABox > CAmbientAI::GetTouchBounds() const { } void CAmbientAI::RandomizePlaybackRate(CStateManager& mgr) { - ModelData()->AnimationData()->MultiplyPlaybackRate(0.4f * mgr.GetActiveRandom()->Float() + 0.8f); + ModelData()->AnimationData()->MultiplyPlaybackRate(0.4f * mgr.Random()->Float() + 0.8f); } void CAmbientAI::Think(float dt, CStateManager& mgr) { diff --git a/src/MetroidPrime/Enemies/CBurstFire.cpp b/src/MetroidPrime/Enemies/CBurstFire.cpp index 70c46f38..3c818dd0 100644 --- a/src/MetroidPrime/Enemies/CBurstFire.cpp +++ b/src/MetroidPrime/Enemies/CBurstFire.cpp @@ -28,7 +28,7 @@ void CBurstFire::Start(CStateManager& mgr) { burstIdx = xc_firstBurstIdx >= 0 ? xc_firstBurstIdx : 0; } else { - int random = mgr.GetActiveRandom()->Range(0, 100); + int random = mgr.Random()->Range(0, 100); int advanceAccum = 0; do { burstIdx += 1; @@ -59,7 +59,7 @@ void CBurstFire::Update(CStateManager& mgr, float dt) { x14_24_shouldFire = true; x8_timeToNextShot = x18_curBursts->x24_timeToNextShot; x8_timeToNextShot += - (mgr.GetActiveRandom()->Float() - 0.5f) * x18_curBursts->x28_timeToNextShotVariance; + (mgr.Random()->Float() - 0.5f) * x18_curBursts->x28_timeToNextShotVariance; } else { x18_curBursts = nullptr; } diff --git a/src/MetroidPrime/Player/CFidget.cpp b/src/MetroidPrime/Player/CFidget.cpp index 38d5a229..1d4c6ec5 100644 --- a/src/MetroidPrime/Player/CFidget.cpp +++ b/src/MetroidPrime/Player/CFidget.cpp @@ -114,7 +114,7 @@ CFidget::EState CFidget::Update(int fireButtonStates, bool bobbing, bool inStrik if ((x8_delayTriggerBits & 0x3) == 0x3) { EState newState = kS_MinorFidget; - x0_state = 50 < (mgr.GetActiveRandom()->Next() % 100) ? kS_MajorFidget : kS_MinorFidget; + x0_state = 50 < (mgr.Random()->Next() % 100) ? kS_MajorFidget : kS_MinorFidget; } else if ((x8_delayTriggerBits & 0x1)) { x0_state = kS_MinorFidget; } else { @@ -131,17 +131,17 @@ CFidget::EState CFidget::Update(int fireButtonStates, bool bobbing, bool inStrik x34_24_loading = true; x10_delayTimerEnableBits = 2; x8_delayTriggerBits &= ~0x1; - kMinorFidgetDelay = mgr.GetActiveRandom()->Range(20.f, 29.f); + kMinorFidgetDelay = mgr.Random()->Range(20.f, 29.f); x4_type = SamusGun::kFT_Minor; - xc_animSet = mgr.GetActiveRandom()->Range(0, 4); + xc_animSet = mgr.Random()->Range(0, 4); break; case kS_MajorFidget: x34_24_loading = true; x10_delayTimerEnableBits = 1; x8_delayTriggerBits &= ~0x2; - kMajorFidgetDelay = mgr.GetActiveRandom()->Range(20.f, 30.f); + kMajorFidgetDelay = mgr.Random()->Range(20.f, 30.f); x4_type = SamusGun::kFT_Major; - xc_animSet = mgr.GetActiveRandom()->Range(0, 5); + xc_animSet = mgr.Random()->Range(0, 5); break; case kS_HolsterBeam: x4_type = SamusGun::kFT_Minor; diff --git a/src/MetroidPrime/Player/CPlayerGun.cpp b/src/MetroidPrime/Player/CPlayerGun.cpp index 4ff81cae..f34b942a 100644 --- a/src/MetroidPrime/Player/CPlayerGun.cpp +++ b/src/MetroidPrime/Player/CPlayerGun.cpp @@ -957,8 +957,8 @@ void CPlayerGun::CMotionState::Update(bool firing, float dt, CTransform4f& xf, C x18_startRotation = x1c_endRotation; x14_rotationT = 0.f; if (x24_fireState == kFS_StartFire) { - x1c_endRotation = mgr.GetActiveRandom()->Next() % 15; - x1c_endRotation *= (mgr.GetActiveRandom()->Next() % 100) > 45 ? 1.f : -1.f; + x1c_endRotation = mgr.Random()->Next() % 15; + x1c_endRotation *= (mgr.Random()->Next() % 100) > 45 ? 1.f : -1.f; } else { x1c_endRotation = 0.f; if (x18_startRotation == x1c_endRotation) { diff --git a/src/MetroidPrime/ScriptObjects/CScriptAiJumpPoint.cpp b/src/MetroidPrime/ScriptObjects/CScriptAiJumpPoint.cpp index 72fe56cc..4d760adc 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptAiJumpPoint.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptAiJumpPoint.cpp @@ -24,8 +24,8 @@ void CScriptAiJumpPoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId oth switch (msg) { case kSM_InitializedInArea: - rstl::vector< SConnection >::const_iterator conn = x20_conns.begin(); - for (; conn != x20_conns.end(); ++conn) { + rstl::vector< SConnection >::const_iterator conn = GetConnectionList().begin(); + for (; conn != GetConnectionList().end(); ++conn) { if (conn->x0_state != kSS_Arrived || conn->x4_msg != kSM_Next) { continue; } diff --git a/src/MetroidPrime/ScriptObjects/CScriptAreaAttributes.cpp b/src/MetroidPrime/ScriptObjects/CScriptAreaAttributes.cpp index 2572436d..fd44c620 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptAreaAttributes.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptAreaAttributes.cpp @@ -19,21 +19,22 @@ void CScriptAreaAttributes::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId CStateManager& stateMgr) override { CEntity::AcceptScriptMsg(msg, objId, stateMgr); - if (x4_areaId == kInvalidAreaId) { + if (GetCurrentAreaId() == kInvalidAreaId) { return; } switch (msg) { case kSM_InitializedInArea: { - stateMgr.World()->Area(GetAreaIdAlways())->SetAreaAttributes(this); + stateMgr.World()->Area(GetCurrentAreaId())->SetAreaAttributes(this); stateMgr.EnvFxManager()->SetFxDensity(500, x3c_envFxDensity); break; } case kSM_Deleted: { - if (stateMgr.World()->Area(GetAreaIdAlways())->IsLoaded()) { - stateMgr.World()->Area(GetAreaIdAlways())->SetAreaAttributes(nullptr); + if (stateMgr.World()->IsAreaValid(GetCurrentAreaId())) { + stateMgr.World()->Area(GetCurrentAreaId())->SetAreaAttributes(nullptr); } + break; } } } diff --git a/src/MetroidPrime/ScriptObjects/CScriptCameraWaypoint.cpp b/src/MetroidPrime/ScriptObjects/CScriptCameraWaypoint.cpp index f480dfe9..cfd525b0 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptCameraWaypoint.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptCameraWaypoint.cpp @@ -29,14 +29,13 @@ void CScriptCameraWaypoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId TUniqueId CScriptCameraWaypoint::GetRandomNextWaypointId(const CStateManager& mgr) const { rstl::vector< TUniqueId > candidateIds; - rstl::vector< SConnection >::const_iterator conn = x20_conns.begin(); - - for (; conn != x20_conns.end(); ++conn) { + rstl::vector< SConnection >::const_iterator conn = GetConnectionList().begin(); + for (; conn != GetConnectionList().end(); ++conn) { if (conn->x0_state == kSS_Arrived && conn->x4_msg == kSM_Next) { TUniqueId uid = mgr.GetIdForScript(conn->x8_objId); - if (uid == kInvalidUniqueId) + if (uid == kInvalidUniqueId) { continue; - + } candidateIds.reserve(candidateIds.size() + 1); candidateIds.push_back(uid); } @@ -45,7 +44,7 @@ TUniqueId CScriptCameraWaypoint::GetRandomNextWaypointId(const CStateManager& mg if (candidateIds.empty()) return kInvalidUniqueId; - return candidateIds[mgr.GetActiveRandom()->Range(0, s32(candidateIds.size() - 1))]; + return candidateIds[mgr.Random()->Range(0, s32(candidateIds.size() - 1))]; } void CScriptCameraWaypoint::AddToRenderer(const CFrustumPlanes&, diff --git a/src/MetroidPrime/ScriptObjects/CScriptDistanceFog.cpp b/src/MetroidPrime/ScriptObjects/CScriptDistanceFog.cpp index c2f8ec46..d1de0d41 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptDistanceFog.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptDistanceFog.cpp @@ -34,11 +34,11 @@ void CScriptDistanceFog::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId obj CStateManager& stateMgr) { CEntity::AcceptScriptMsg(msg, objId, stateMgr); - if (GetAreaIdAlways() != kInvalidAreaId && GetActive()) { + if (GetCurrentAreaId() != kInvalidAreaId && GetActive()) { switch (msg) { case kSM_InitializedInArea: if (x60_explicit) { - CAreaFog* fog = stateMgr.World()->Area(GetAreaIdAlways())->AreaFog(); + CAreaFog* fog = stateMgr.World()->Area(GetCurrentAreaId())->AreaFog(); if (x34_mode == kRFM_None) { fog->DisableFog(); } else { @@ -48,7 +48,7 @@ void CScriptDistanceFog::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId obj break; case kSM_Action: if (x61_nonZero) { - CAreaFog* fog = stateMgr.World()->Area(GetAreaIdAlways())->AreaFog(); + CAreaFog* fog = stateMgr.World()->Area(GetCurrentAreaId())->AreaFog(); if (x34_mode != kRFM_None) { fog->FadeFog(x34_mode, x38_color, x3c_range, x44_colorDelta, x48_rangeDelta); } else { @@ -57,10 +57,10 @@ void CScriptDistanceFog::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId obj } if (!close_enough(x54_thermalSpeed, 0.f)) { - stateMgr.World()->Area(GetAreaIdAlways())->SetThermalSpeedAndTarget(x54_thermalSpeed, x50_thermalTarget); + stateMgr.World()->Area(GetCurrentAreaId())->SetThermalSpeedAndTarget(x54_thermalSpeed, x50_thermalTarget); } if (!close_enough(x5c_xraySpeed, 0.f)) { - stateMgr.World()->Area(GetAreaIdAlways())->SetXRaySpeedAndTarget(x5c_xraySpeed, x58_xrayTarget); + stateMgr.World()->Area(GetCurrentAreaId())->SetXRaySpeedAndTarget(x5c_xraySpeed, x58_xrayTarget); } break; } diff --git a/src/MetroidPrime/ScriptObjects/CScriptDockAreaChange.cpp b/src/MetroidPrime/ScriptObjects/CScriptDockAreaChange.cpp index bca34a2d..a8074be9 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptDockAreaChange.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptDockAreaChange.cpp @@ -13,8 +13,8 @@ void CScriptDockAreaChange::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId switch (msg) { case kSM_Action: if (GetActive()) { - rstl::vector< SConnection >::const_iterator it = x20_conns.begin(); - for (; it != x20_conns.end(); ++it) { + rstl::vector< SConnection >::const_iterator it = GetConnectionList().begin(); + for (; it != GetConnectionList().end(); ++it) { if (it->x0_state != kSS_Play || it->x4_msg == kSM_UNKM0) { continue; } diff --git a/src/MetroidPrime/ScriptObjects/CScriptMazeNode.cpp b/src/MetroidPrime/ScriptObjects/CScriptMazeNode.cpp index 22abef93..71103c88 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptMazeNode.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptMazeNode.cpp @@ -338,7 +338,7 @@ void CScriptMazeNode::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, C if (mgr.CurrentMaze() == nullptr) { rstl::single_ptr< CMazeState > maze = new CMazeState(skEnterCol, skEnterRow, skTargetCol, skTargetRow); - maze->Reset(sMazeSeeds[mgr.GetActiveRandom()->Next() % 300]); + maze->Reset(sMazeSeeds[mgr.Random()->Next() % 300]); maze->Initialize(); maze->GenerateObstacles(); mgr.SetCurrentMaze(maze); diff --git a/src/MetroidPrime/ScriptObjects/CScriptPickup.cpp b/src/MetroidPrime/ScriptObjects/CScriptPickup.cpp index a984c8b2..c771d704 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptPickup.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptPickup.cpp @@ -155,7 +155,7 @@ void CScriptPickup::Touch(CActor& act, CStateManager& mgr) { if (mgr.GetPlayerState()->GetActiveVisor(mgr) != CPlayerState::kPV_Thermal) { mgr.AddObject(new CExplosion( *x27c_pickupParticleDesc, mgr.AllocateUniqueId(), true, - CEntityInfo(GetAreaIdAlways(), CEntity::NullConnectionList, kInvalidEditorId), + CEntityInfo(GetCurrentAreaId(), CEntity::NullConnectionList, kInvalidEditorId), rstl::string_l("Explosion - Pickup Effect"), GetTransform(), 0, CVector3f(1.f, 1.f, 1.f), CColor::White())); } diff --git a/src/MetroidPrime/ScriptObjects/CScriptRelay.cpp b/src/MetroidPrime/ScriptObjects/CScriptRelay.cpp index 1a1ebdd1..601dae8a 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptRelay.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptRelay.cpp @@ -25,7 +25,7 @@ void CScriptRelay::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objId, switch (msg) { case kSM_SetToZero: { - if (!x30_24_active) { + if (!GetActive()) { return; } diff --git a/src/MetroidPrime/ScriptObjects/CScriptRipple.cpp b/src/MetroidPrime/ScriptObjects/CScriptRipple.cpp index a2a29aa3..e42b79e7 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptRipple.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptRipple.cpp @@ -17,8 +17,8 @@ void CScriptRipple::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, CSt return; } - rstl::vector< SConnection >::const_iterator conn = x20_conns.begin(); - for (; conn != x20_conns.end(); ++conn) { + rstl::vector< SConnection >::const_iterator conn = GetConnectionList().begin(); + for (; conn != GetConnectionList().end(); ++conn) { if (conn->x0_state != kSS_Active || conn->x4_msg != kSM_Next) { continue; } diff --git a/src/MetroidPrime/ScriptObjects/CScriptSpawnPoint.cpp b/src/MetroidPrime/ScriptObjects/CScriptSpawnPoint.cpp index e48c3840..06430fff 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptSpawnPoint.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptSpawnPoint.cpp @@ -41,7 +41,7 @@ void CScriptSpawnPoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId objI case kSM_SetToZero: if (GetActive()) { CPlayer* player = stateMgr.Player(); - TAreaId thisAreaId = x4_areaId; + TAreaId thisAreaId = GetCurrentAreaId(); TAreaId nextAreaId = stateMgr.GetNextAreaId(); if (thisAreaId != nextAreaId) { diff --git a/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp b/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp index d8e84614..c0bbebfa 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptSpecialFunction.cpp @@ -566,7 +566,7 @@ void CScriptSpecialFunction::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId } case kSF_PlayerInAreaRelay: { if ((msg == kSM_Action || msg == kSM_SetToZero) && - GetAreaIdAlways() == mgr.GetPlayer()->GetAreaIdAlways()) { + GetCurrentAreaId() == mgr.GetPlayer()->GetCurrentAreaId()) { SendScriptMsgs(kSS_Zero, mgr, kSM_None); } break; @@ -627,7 +627,7 @@ void CScriptSpecialFunction::RingScramble(CStateManager& mgr) { float dir = x1b8_ringReverse ? 1.f : -1.f; for (int i = 0; i < x198_ringControllers.size(); ++i) { x198_ringControllers[i].x4_rotateSpeed = - dir * mgr.GetActiveRandom()->Range(x100_float2, x104_float3); + dir * mgr.Random()->Range(x100_float2, x104_float3); dir = -dir; x198_ringControllers[i].x8_reachedTarget = false; } @@ -994,7 +994,7 @@ void CScriptSpecialFunction::ThinkChaffTarget(float dt, CStateManager& mgr) { if (CEnergyProjectile* proj = TCastToPtr< CEnergyProjectile >(mgr.ObjectById(nearList[i]))) { if (proj->GetHomingTargetId() == GetUniqueId()) { proj->Set3d0_26(true); - if (mgr.GetPlayer()->GetAreaIdAlways() == GetAreaIdAlways()) { + if (mgr.GetPlayer()->GetCurrentAreaId() == GetCurrentAreaId()) { mgr.Player()->SetHudDisable(x100_float2); x194_ = xfc_float1; @@ -1009,7 +1009,7 @@ void CScriptSpecialFunction::ThinkChaffTarget(float dt, CStateManager& mgr) { bool addedInterference = false; x194_ = CMath::Max(0.f, x194_ - dt); - if (x194_ && mgr.GetPlayer()->GetAreaIdAlways() == GetAreaIdAlways()) { + if (x194_ && mgr.GetPlayer()->GetCurrentAreaId() == GetCurrentAreaId()) { addedInterference = true; float intfMag = x104_float3 * (0.5f + ((0.5f * x194_) / xfc_float1)); if (x194_ < 1.f) { @@ -1034,7 +1034,7 @@ void CScriptSpecialFunction::ThinkRainSimulator(float, CStateManager& mgr) { void CScriptSpecialFunction::ThinkAreaDamage(float dt, CStateManager& mgr) { const CPlayer* player = mgr.GetPlayer(); - bool inArea = player->GetAreaIdAlways() == GetAreaIdAlways(); + bool inArea = player->GetCurrentAreaId() == GetCurrentAreaId(); bool immune = mgr.GetPlayerState()->GetCurrentSuitRaw() > CPlayerState::kPS_Power; if (x1e4_31_inAreaDamage) { if (!inArea || immune) { @@ -1090,7 +1090,7 @@ void CScriptSpecialFunction::ThinkActorScale(float dt, CStateManager& mgr) { } void CScriptSpecialFunction::ThinkPlayerInArea(float dt, CStateManager& mgr) { - if (mgr.GetPlayer()->GetAreaIdAlways() == GetAreaIdAlways()) { + if (mgr.GetPlayer()->GetCurrentAreaId() == GetCurrentAreaId()) { if (x1e5_25_playerInArea) { return; } diff --git a/src/MetroidPrime/ScriptObjects/CScriptTargetingPoint.cpp b/src/MetroidPrime/ScriptObjects/CScriptTargetingPoint.cpp index 4e9094a4..c05d7f77 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptTargetingPoint.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptTargetingPoint.cpp @@ -24,7 +24,7 @@ void CScriptTargetingPoint::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId } bool CScriptTargetingPoint::GetLocked() const { - return x20_conns.size() > 0; + return GetConnectionList().size() > 0; } void CScriptTargetingPoint::Think(float dt, CStateManager&) { diff --git a/src/MetroidPrime/ScriptObjects/CScriptTimer.cpp b/src/MetroidPrime/ScriptObjects/CScriptTimer.cpp index 2baa1ae9..c36e9101 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptTimer.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptTimer.cpp @@ -16,7 +16,7 @@ CScriptTimer::CScriptTimer(TUniqueId uid, const rstl::string& name, const CEntit CScriptTimer::~CScriptTimer() {} void CScriptTimer::Reset(CStateManager& mgr) { - const float rDt = mgr.GetActiveRandom()->Float(); + const float rDt = mgr.Random()->Float(); x34_time = (x3c_maxRandDelay * rDt) + x38_startTime; } diff --git a/src/MetroidPrime/ScriptObjects/CScriptTrigger.cpp b/src/MetroidPrime/ScriptObjects/CScriptTrigger.cpp index da32a8d7..04b780ea 100644 --- a/src/MetroidPrime/ScriptObjects/CScriptTrigger.cpp +++ b/src/MetroidPrime/ScriptObjects/CScriptTrigger.cpp @@ -137,7 +137,7 @@ CAABox CScriptTrigger::GetTriggerBoundsWR() const { } rstl::optional_object< CAABox > CScriptTrigger::GetTouchBounds() const override { - if (x30_24_active) { + if (GetActive()) { return GetTriggerBoundsWR(); } return rstl::optional_object_null(); @@ -159,7 +159,7 @@ void CScriptTrigger::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, x148_29_didPhazonDamage = false; } - if (x8_uid == mgr.GetLastTriggerId()) { + if (GetUniqueId() == mgr.GetLastTriggerId()) { mgr.SetLastTriggerId(kInvalidUniqueId); } } @@ -174,7 +174,7 @@ void CScriptTrigger::AcceptScriptMsg(EScriptObjectMessage msg, TUniqueId uid, x148_29_didPhazonDamage = false; } - if (x8_uid == mgr.GetLastTriggerId()) { + if (GetUniqueId() == mgr.GetLastTriggerId()) { mgr.SetLastTriggerId(kInvalidUniqueId); } } diff --git a/src/MetroidPrime/Weapons/GunController/CGSFreeLook.cpp b/src/MetroidPrime/Weapons/GunController/CGSFreeLook.cpp index 02b3464e..70c03768 100644 --- a/src/MetroidPrime/Weapons/GunController/CGSFreeLook.cpp +++ b/src/MetroidPrime/Weapons/GunController/CGSFreeLook.cpp @@ -45,7 +45,7 @@ int CGSFreeLook::SetAnim(CAnimData& data, int gunId, int setId, int loopState, C rstl::pair< float, int > anim = pas.FindBestAnimation( CPASAnimParmData(pas::kAS_Step, CPASAnimParm::FromInt32(gunId), CPASAnimParm::FromInt32(setId), CPASAnimParm::FromEnum(useLoopState)), - *mgr.GetActiveRandom(), -1); + *mgr.Random(), -1); CPASAnimParm animParm = pas.GetAnimState(pas::kAS_Step)->GetAnimParmData(anim.second, 1); xc_gunId = gunId; diff --git a/src/MetroidPrime/Weapons/GunController/CGunMotion.cpp b/src/MetroidPrime/Weapons/GunController/CGunMotion.cpp index f93fd753..b16a5392 100644 --- a/src/MetroidPrime/Weapons/GunController/CGunMotion.cpp +++ b/src/MetroidPrime/Weapons/GunController/CGunMotion.cpp @@ -26,13 +26,13 @@ bool CGunMotion::PlayPasAnim(SamusGun::EAnimationState state, CStateManager& mgr switch (state) { case SamusGun::kAS_Wander: { CPASAnimParmData parms((pas::EAnimationState(state))); - rstl::pair< float, int > anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); + rstl::pair< float, int > anim = pas.FindBestAnimation(parms, *mgr.Random(), -1); animId = anim.second; break; } case SamusGun::kAS_Idle: { CPASAnimParmData parms(pas::EAnimationState(state), CPASAnimParm::FromEnum(0)); - rstl::pair< float, int > anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); + rstl::pair< float, int > anim = pas.FindBestAnimation(parms, *mgr.Random(), -1); animId = anim.second; break; } @@ -40,7 +40,7 @@ bool CGunMotion::PlayPasAnim(SamusGun::EAnimationState state, CStateManager& mgr CPASAnimParmData parms(pas::EAnimationState(state), CPASAnimParm::FromInt32(0), CPASAnimParm::FromReal32(angle), CPASAnimParm::FromBool(bigStrike), CPASAnimParm::FromBool(false)); - rstl::pair< float, int > anim = pas.FindBestAnimation(parms, *mgr.GetActiveRandom(), -1); + rstl::pair< float, int > anim = pas.FindBestAnimation(parms, *mgr.Random(), -1); animId = anim.second; loop = false; break;