diff --git a/Runtime/World/CActor.hpp b/Runtime/World/CActor.hpp index 42ffe9fbc..8797c428b 100644 --- a/Runtime/World/CActor.hpp +++ b/Runtime/World/CActor.hpp @@ -194,5 +194,6 @@ public: CSimpleShadow* Shadow() { return x94_simpleShadow.get(); } void MoveScannableObjectInfoToActor(CActor*, CStateManager&); const zeus::CAABox& GetRenderBounds() const { return x9c_renderBounds; } + void SetNotInSortedLists(bool notIn) { xe4_27_notInSortedLists = notIn; } }; } // namespace metaforce diff --git a/Runtime/World/CScriptActorRotate.cpp b/Runtime/World/CScriptActorRotate.cpp index 842f59e3c..b465461e2 100644 --- a/Runtime/World/CScriptActorRotate.cpp +++ b/Runtime/World/CScriptActorRotate.cpp @@ -44,11 +44,11 @@ void CScriptActorRotate::Think(float dt, CStateManager& mgr) { for (const auto& actorPair : x48_actors) { if (const TCastToPtr act = mgr.ObjectById(actorPair.first)) { - const zeus::CTransform xf = zeus::CTransform::RotateZ(zeus::degToRad(timeOffset * x34_rotation.z())) * + const zeus::CTransform xf = zeus::CTransform::RotateX(zeus::degToRad(timeOffset * x34_rotation.x())) * zeus::CTransform::RotateY(zeus::degToRad(timeOffset * x34_rotation.y())) * - zeus::CTransform::RotateX(zeus::degToRad(timeOffset * x34_rotation.x())); + zeus::CTransform::RotateZ(zeus::degToRad(timeOffset * x34_rotation.z())); zeus::CTransform localRot = actorPair.second * xf; - localRot.origin = act->GetTranslation(); + localRot.origin += act->GetTranslation(); act->SetTransform(localRot); if (const TCastToPtr plat = mgr.ObjectById(actorPair.first)) { @@ -57,8 +57,8 @@ void CScriptActorRotate::Think(float dt, CStateManager& mgr) { } } - if (x58_24_updateRotation) { - if (!x58_25_skipSpiderBallWaypoints) { + if (!x58_24_updateRotation) { + if (x58_25_updateSpiderBallWaypoints) { UpdateSpiderBallWaypoints(mgr); } @@ -82,11 +82,11 @@ void CScriptActorRotate::UpdatePlatformRiders(std::vector& riders, CScr act->SetTransform(rider.x8_transform); act->SetTranslation(act->GetTranslation() + plat.GetTranslation()); - if (x58_24_updateRotation) { + if (!x58_24_updateRotation) { riderXf = {act->GetTransform().basis, act->GetTranslation() - plat.GetTranslation()}; if (TCastToConstPtr(act.GetPtr())) { - x58_25_skipSpiderBallWaypoints = true; + x58_25_updateSpiderBallWaypoints = true; } } @@ -128,22 +128,21 @@ void CScriptActorRotate::UpdateActors(bool next, CStateManager& mgr) { void CScriptActorRotate::UpdateSpiderBallWaypoints(CStateManager& mgr) { rstl::reserved_vector waypointIds; CObjectList& objectList = mgr.GetAllObjectList(); - for (const CEntity* ent : objectList) { - if (const TCastToConstPtr wp = ent) { + for (CEntity* ent : objectList) { + if (const TCastToPtr wp = ent) { waypointIds.push_back(wp->GetUniqueId()); + wp->ClearWaypoints(); } } for (const TUniqueId& uid : waypointIds) { auto* wp = static_cast(mgr.ObjectById(uid)); if (wp) { -#if 0 - wp->sub_801187B4(mgr); - wp->xe4_27_ = true; -#endif + wp->BuildWaypointListAndBounds(mgr); + wp->SetNotInSortedLists(false); } } - x58_25_skipSpiderBallWaypoints = false; + x58_25_updateSpiderBallWaypoints = false; } } // namespace metaforce diff --git a/Runtime/World/CScriptActorRotate.hpp b/Runtime/World/CScriptActorRotate.hpp index f904143bb..1dc288fd8 100644 --- a/Runtime/World/CScriptActorRotate.hpp +++ b/Runtime/World/CScriptActorRotate.hpp @@ -19,7 +19,7 @@ class CScriptActorRotate : public CEntity { float x44_currentTime = 0.f; std::map x48_actors; bool x58_24_updateRotation : 1 = false; - bool x58_25_skipSpiderBallWaypoints : 1 = false; + bool x58_25_updateSpiderBallWaypoints : 1 = false; bool x58_26_updateActors : 1; bool x58_27_updateOnCreation : 1; diff --git a/Runtime/World/CScriptSpiderBallWaypoint.hpp b/Runtime/World/CScriptSpiderBallWaypoint.hpp index ed295bd33..f9d5cae59 100644 --- a/Runtime/World/CScriptSpiderBallWaypoint.hpp +++ b/Runtime/World/CScriptSpiderBallWaypoint.hpp @@ -31,5 +31,9 @@ public: const CScriptSpiderBallWaypoint*& closestWaypoint, zeus::CVector3f& closestPoint, zeus::CVector3f& deltaBetweenPoints, float deltaBetweenInterpDist, zeus::CVector3f& interpDeltaBetweenPoints) const; + void ClearWaypoints() { + xfc_aabox.reset(); + xec_waypoints.clear(); + } }; } // namespace metaforce