2
0
mirror of https://github.com/AxioDL/metaforce.git synced 2025-12-14 14:06:09 +00:00

Spiderball fixes and cleanup

This commit is contained in:
2021-06-02 14:54:58 -07:00
parent deaf14bca6
commit a9858433b8
2 changed files with 52 additions and 43 deletions

View File

@@ -77,17 +77,16 @@ TUniqueId CScriptSpiderBallWaypoint::PreviousWaypoint(const CStateManager& mgr,
TUniqueId CScriptSpiderBallWaypoint::NextWaypoint(const CStateManager& mgr, ECheckActiveWaypoint checkActive) const {
for (const SConnection& conn : x20_conns) {
if (conn.x0_state == EScriptObjectState::Arrived && conn.x4_msg == EScriptObjectMessage::Next) {
const TUniqueId uid = mgr.GetIdForScript(conn.x8_objId);
if (uid != kInvalidUniqueId) {
if (const CEntity* ent = mgr.GetObjectById(uid)) {
if (checkActive == ECheckActiveWaypoint::SkipCheck) {
return ent->GetUniqueId();
}
if (ent->GetActive()) {
return ent->GetUniqueId();
}
}
if (conn.x0_state != EScriptObjectState::Arrived || conn.x4_msg != EScriptObjectMessage::Next) {
continue;
}
const TUniqueId uid = mgr.GetIdForScript(conn.x8_objId);
if (const CEntity* ent = mgr.GetObjectById(uid)) {
if (checkActive == ECheckActiveWaypoint::SkipCheck) {
return ent->GetUniqueId();
}
if (ent->GetActive()) {
return ent->GetUniqueId();
}
}
}
@@ -198,7 +197,7 @@ void CScriptSpiderBallWaypoint::GetClosestPointAlongWaypoints(CStateManager& mgr
closestPoint = lastPoint;
if (wp->PreviousWaypoint(mgr, ECheckActiveWaypoint::Check) != kInvalidUniqueId) {
wp = static_cast<const CScriptSpiderBallWaypoint*>(
mgr.GetObjectById(wp->PreviousWaypoint(mgr, ECheckActiveWaypoint::SkipCheck)));
mgr.GetObjectById(wp->PreviousWaypoint(mgr, ECheckActiveWaypoint::SkipCheck)));
deltaBetweenPoints = lastPoint - wp->GetTranslation();
interpDeltaBetweenPoints = deltaBetweenPoints;
}