mirror of
https://github.com/coop-deluxe/sm64coopdx.git
synced 2025-10-30 08:01:01 +00:00
Revert "Fixed crash in cur_obj_follow_path()"
This reverts commit 394d1970c5.
This commit is contained in:
parent
c2177b4eec
commit
202bd1964c
1 changed files with 7 additions and 15 deletions
|
|
@ -2138,24 +2138,17 @@ s32 cur_obj_follow_path(UNUSED s32 unusedArg) {
|
||||||
startWaypoint = o->oPathedStartWaypoint;
|
startWaypoint = o->oPathedStartWaypoint;
|
||||||
lastWaypoint = o->oPathedPrevWaypoint;
|
lastWaypoint = o->oPathedPrevWaypoint;
|
||||||
|
|
||||||
struct Waypoint *tmpWaypoint = (lastWaypoint + 1);
|
if ((lastWaypoint + 1)->flags != WAYPOINT_FLAGS_END) {
|
||||||
if (tmpWaypoint != NULL && tmpWaypoint->flags != WAYPOINT_FLAGS_END) {
|
targetWaypoint = lastWaypoint + 1;
|
||||||
targetWaypoint = tmpWaypoint;
|
|
||||||
} else {
|
} else {
|
||||||
targetWaypoint = startWaypoint;
|
targetWaypoint = startWaypoint;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetWaypoint == NULL) {
|
o->oPathedPrevWaypointFlags = lastWaypoint->flags | WAYPOINT_FLAGS_INITIALIZED;
|
||||||
return PATH_NONE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lastWaypoint != NULL) {
|
prevToNextX = targetWaypoint->pos[0] - lastWaypoint->pos[0];
|
||||||
o->oPathedPrevWaypointFlags = lastWaypoint->flags | WAYPOINT_FLAGS_INITIALIZED;
|
prevToNextY = targetWaypoint->pos[1] - lastWaypoint->pos[1];
|
||||||
}
|
prevToNextZ = targetWaypoint->pos[2] - lastWaypoint->pos[2];
|
||||||
|
|
||||||
prevToNextX = targetWaypoint->pos[0] - (lastWaypoint != NULL) ? lastWaypoint->pos[0] : 0;
|
|
||||||
prevToNextY = targetWaypoint->pos[1] - (lastWaypoint != NULL) ? lastWaypoint->pos[1] : 0;
|
|
||||||
prevToNextZ = targetWaypoint->pos[2] - (lastWaypoint != NULL) ? lastWaypoint->pos[2] : 0;
|
|
||||||
|
|
||||||
objToNextX = targetWaypoint->pos[0] - o->oPosX;
|
objToNextX = targetWaypoint->pos[0] - o->oPosX;
|
||||||
objToNextY = targetWaypoint->pos[1] - o->oPosY;
|
objToNextY = targetWaypoint->pos[1] - o->oPosY;
|
||||||
|
|
@ -2168,8 +2161,7 @@ s32 cur_obj_follow_path(UNUSED s32 unusedArg) {
|
||||||
// If dot(prevToNext, objToNext) <= 0 (i.e. reached other side of target waypoint)
|
// If dot(prevToNext, objToNext) <= 0 (i.e. reached other side of target waypoint)
|
||||||
if (prevToNextX * objToNextX + prevToNextY * objToNextY + prevToNextZ * objToNextZ <= 0.0f) {
|
if (prevToNextX * objToNextX + prevToNextY * objToNextY + prevToNextZ * objToNextZ <= 0.0f) {
|
||||||
o->oPathedPrevWaypoint = targetWaypoint;
|
o->oPathedPrevWaypoint = targetWaypoint;
|
||||||
tmpWaypoint = (targetWaypoint + 1);
|
if ((targetWaypoint + 1)->flags == WAYPOINT_FLAGS_END) {
|
||||||
if (tmpWaypoint != NULL && tmpWaypoint->flags == WAYPOINT_FLAGS_END) {
|
|
||||||
return PATH_REACHED_END;
|
return PATH_REACHED_END;
|
||||||
} else {
|
} else {
|
||||||
return PATH_REACHED_WAYPOINT;
|
return PATH_REACHED_WAYPOINT;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue