diff options
| author | MegaMech <MegaMech@users.noreply.github.com> | 2023-10-09 20:46:56 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-10-09 20:46:56 -0600 |
| commit | 7f14bf80df88f3d04727f217012ddbafaeb4b09a (patch) | |
| tree | 93fa03a3a871829ff0b7bcb6b7608fe9dea090ce /src/code_80005FD0.c | |
| parent | 41a0471605e77c284a00b3af37cb720119559f46 (diff) | |
Rename wayPoint to waypoint (#448)
* Rename wayPoint to waypoint
* other
Diffstat (limited to 'src/code_80005FD0.c')
| -rw-r--r-- | src/code_80005FD0.c | 862 |
1 files changed, 436 insertions, 426 deletions
diff --git a/src/code_80005FD0.c b/src/code_80005FD0.c index 1785958ec..3b2777ae9 100644 --- a/src/code_80005FD0.c +++ b/src/code_80005FD0.c @@ -2014,7 +2014,7 @@ void func_80009B60(s32 playerId) { sp24 = temp_t6_2; temp_a2_2 = sp38 + D_80164510; temp_a3_2 = sp34 + &D_801631F8; - *temp_a2_2 = (f32) D_80164550[temp_v0_7][*temp_t6_2].wayPointY + 4.3f; + *temp_a2_2 = (f32) D_80164550[temp_v0_7][*temp_t6_2].posY + 4.3f; if ((*temp_a3_2 == 1) && (*temp_a1 == 0)) { sp2C = temp_a1; sp28 = temp_a2_2; @@ -2530,8 +2530,8 @@ block_40: GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000B140.s") #endif -s32 func_8000B7E4(UNUSED s32 arg0, u16 wayPointIndex) { - s16 thing = D_801645E0[wayPointIndex]; +s32 func_8000B7E4(UNUSED s32 arg0, u16 waypointIndex) { + s16 thing = D_801645E0[waypointIndex]; if (thing > 0) { return 1; } @@ -2546,23 +2546,23 @@ s32 func_8000B820(s32 playerIndex) { return 0; } -f32 func_8000B874(f32 posX, f32 posZ, u16 wayPointIndex, s32 pathIndex) { +f32 func_8000B874(f32 posX, f32 posZ, u16 waypointIndex, s32 pathIndex) { f32 x1; f32 z1; f32 x2; f32 z2; f32 squaredDistance; f32 math; - struct TrackWayPoint *thing1; - struct TrackWayPoint *thing2; + TrackWaypoint *thing1; + TrackWaypoint *thing2; - thing1 = &D_80164560[pathIndex][wayPointIndex]; - thing2 = &D_80164570[pathIndex][wayPointIndex]; + thing1 = &D_80164560[pathIndex][waypointIndex]; + thing2 = &D_80164570[pathIndex][waypointIndex]; - x1 = thing1->wayPointX; - z1 = thing1->wayPointZ; - x2 = thing2->wayPointX; - z2 = thing2->wayPointZ; + x1 = thing1->posX; + z1 = thing1->posZ; + x2 = thing2->posX; + z2 = thing2->posZ; squaredDistance = ((x2 - x1) * (x2 - x1)) + ((z2 - z1) * (z2 - z1)); if (squaredDistance < 0.01f) { @@ -2572,12 +2572,12 @@ f32 func_8000B874(f32 posX, f32 posZ, u16 wayPointIndex, s32 pathIndex) { return math; } -void func_8000B95C(s32 playerId, u16 wayPointIndex, s32 pathIndex) { +void func_8000B95C(s32 playerId, u16 waypointIndex, s32 pathIndex) { UNUSED Vec3f pad; D_80163068[playerId] = 0.0f; if ((s32) D_800DCA4C[gCurrentCourseId] >= 0) { if ((gPlayers[playerId].type & 0x8000) != 0) { - D_80163068[playerId] = func_8000B874(gPlayers[playerId].pos[0], gPlayers[playerId].pos[2], wayPointIndex, pathIndex); + D_80163068[playerId] = func_8000B874(gPlayers[playerId].pos[0], gPlayers[playerId].pos[2], waypointIndex, pathIndex); } } } @@ -2643,7 +2643,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000BA14.s") //generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de extern f32 D_80162FA8; -void func_8000BBD8(s32 wayPointIndex, f32 arg1, s16 pathIndex) { +void func_8000BBD8(s32 waypointIndex, f32 arg1, s16 pathIndex) { f32 sp14; f32 sp10; f32 sp8; @@ -2657,34 +2657,34 @@ void func_8000BBD8(s32 wayPointIndex, f32 arg1, s16 pathIndex) { f32 temp_f8_2; s32 temp_t6; s32 temp_t8; - struct TrackWayPoint *temp_a1; - struct TrackWayPoint *temp_t0; - struct TrackWayPoint *temp_t0_2; - struct TrackWayPoint *temp_t1; - struct TrackWayPoint *temp_v0; - struct TrackWayPoint *temp_v0_2; - - temp_t6 = wayPointIndex & 0xFFFF; + TrackWaypoint *temp_a1; + TrackWaypoint *temp_t0; + TrackWaypoint *temp_t0_2; + TrackWaypoint *temp_t1; + TrackWaypoint *temp_v0; + TrackWaypoint *temp_v0_2; + + temp_t6 = waypointIndex & 0xFFFF; temp_a1 = D_80164560[pathIndex]; temp_t1 = D_80164570[pathIndex]; temp_v0 = &temp_a1[temp_t6]; temp_t0 = &temp_t1[temp_t6]; - sp8 = (f32) temp_t0->wayPointZ; + sp8 = (f32) temp_t0->posZ; temp_t8 = ((s32) ((temp_t6 + 1) & 0xFFFF) % (s32) gWaypointCountByPathIndex[pathIndex]) & 0xFFFF; temp_v0_2 = &temp_a1[temp_t8]; temp_t0_2 = &temp_t1[temp_t8]; - temp_f8 = (f32) temp_v0_2->wayPointX; + temp_f8 = (f32) temp_v0_2->posX; sp14 = temp_f8; - temp_f4 = (f32) temp_v0_2->wayPointZ; + temp_f4 = (f32) temp_v0_2->posZ; sp10 = temp_f4; - temp_f8_2 = (f32) temp_t0_2->wayPointX; + temp_f8_2 = (f32) temp_t0_2->posX; sp4 = temp_f8_2; - temp_f4_2 = (f32) temp_t0_2->wayPointZ; + temp_f4_2 = (f32) temp_t0_2->posZ; sp0 = temp_f4_2; temp_f0 = 0.5f - (arg1 * 0.5f); temp_f12 = 1.0f - temp_f0; - *D_80162FA0 = (((f32) temp_v0->wayPointX + temp_f8) * temp_f0 * 0.5f) + (temp_f12 * ((f32) temp_t0->wayPointX + temp_f8_2) * 0.5f); - D_80162FA8 = (((f32) temp_v0->wayPointZ + temp_f4) * temp_f0 * 0.5f) + (temp_f12 * (sp8 + temp_f4_2) * 0.5f); + *D_80162FA0 = (((f32) temp_v0->posX + temp_f8) * temp_f0 * 0.5f) + (temp_f12 * ((f32) temp_t0->posX + temp_f8_2) * 0.5f); + D_80162FA8 = (((f32) temp_v0->posZ + temp_f4) * temp_f0 * 0.5f) + (temp_f12 * (sp8 + temp_f4_2) * 0.5f); } #else GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000BBD8.s") @@ -2696,67 +2696,67 @@ s16 func_8000BD94(f32 posX, f32 posY, f32 posZ, s32 pathIndex) { f32 z_dist; f32 considerSquaredDistance; f32 minimumSquaredDistance; - s32 considerWayPointIndex; - s32 pathWayPointCount; - s16 nearestWayPointIndex; - struct TrackWayPoint *pathWayPoints; - struct TrackWayPoint *considerWayPoint; - - pathWayPoints = D_80164550[pathIndex]; - pathWayPointCount = gWaypointCountByPathIndex[pathIndex]; - considerWayPoint = &pathWayPoints[0]; - x_dist = (f32) considerWayPoint->wayPointX - posX; - y_dist = (f32) considerWayPoint->wayPointY - posY; - z_dist = (f32) considerWayPoint->wayPointZ - posZ; + s32 considerWaypointIndex; + s32 pathWaypointCount; + s16 nearestWaypointIndex; + TrackWaypoint *pathWaypoints; + TrackWaypoint *considerWaypoint; + + pathWaypoints = D_80164550[pathIndex]; + pathWaypointCount = gWaypointCountByPathIndex[pathIndex]; + considerWaypoint = &pathWaypoints[0]; + x_dist = (f32) considerWaypoint->posX - posX; + y_dist = (f32) considerWaypoint->posY - posY; + z_dist = (f32) considerWaypoint->posZ - posZ; minimumSquaredDistance = (x_dist * x_dist) + (y_dist * y_dist) + (z_dist * z_dist); - nearestWayPointIndex = 0; - for (considerWayPointIndex = 1; considerWayPointIndex < pathWayPointCount; considerWayPoint++, considerWayPointIndex++) { - x_dist = (f32) considerWayPoint->wayPointX - posX; - y_dist = (f32) considerWayPoint->wayPointY - posY; - z_dist = (f32) considerWayPoint->wayPointZ - posZ; + nearestWaypointIndex = 0; + for (considerWaypointIndex = 1; considerWaypointIndex < pathWaypointCount; considerWaypoint++, considerWaypointIndex++) { + x_dist = (f32) considerWaypoint->posX - posX; + y_dist = (f32) considerWaypoint->posY - posY; + z_dist = (f32) considerWaypoint->posZ - posZ; considerSquaredDistance = (x_dist * x_dist) + (y_dist * y_dist) + (z_dist * z_dist); if (considerSquaredDistance < minimumSquaredDistance) { - nearestWayPointIndex = considerWayPointIndex; + nearestWaypointIndex = considerWaypointIndex; minimumSquaredDistance = considerSquaredDistance; } } - return nearestWayPointIndex; + return nearestWaypointIndex; } s16 func_8000C0BC(f32 posX, f32 posY, f32 posZ, u16 trackSegment, s32 *pathIndex) { - struct TrackWayPoint *pathWayPoints; - struct TrackWayPoint *considerWayPoint; + TrackWaypoint *pathWaypoints; + TrackWaypoint *considerWaypoint; f32 x_dist; f32 y_dist; f32 z_dist; f32 considerSquaredDistance; f32 minimumSquaredDistance; - s32 considerWayPointIndex; - s32 pathWayPointCount; + s32 considerWaypointIndex; + s32 pathWaypointCount; s32 temp_t0; s32 var_a1; s32 var_t1; s32 considerPathIndex; s32 var_t4; - s16 nearestWayPointIndex; + s16 nearestWaypointIndex; minimumSquaredDistance = 1000000.0f; temp_t0 = *pathIndex; - nearestWayPointIndex = 0; + nearestWaypointIndex = 0; var_t1 = 0; var_a1 = 0; - pathWayPoints = D_80164550[temp_t0]; - pathWayPointCount = gWaypointCountByPathIndex[temp_t0]; - considerWayPoint = &pathWayPoints[0]; - for (considerWayPointIndex = 0; considerWayPointIndex < pathWayPointCount; considerWayPointIndex++, considerWayPoint++) { - if ((considerWayPoint->wayPointTrackSegment == trackSegment) || (gCurrentCourseId == COURSE_AWARD_CEREMONY)) { + pathWaypoints = D_80164550[temp_t0]; + pathWaypointCount = gWaypointCountByPathIndex[temp_t0]; + considerWaypoint = &pathWaypoints[0]; + for (considerWaypointIndex = 0; considerWaypointIndex < pathWaypointCount; considerWaypointIndex++, considerWaypoint++) { + if ((considerWaypoint->trackSegment == trackSegment) || (gCurrentCourseId == COURSE_AWARD_CEREMONY)) { var_t1 = 1; - x_dist = (f32) considerWayPoint->wayPointX - posX; - y_dist = (f32) considerWayPoint->wayPointY - posY; - z_dist = (f32) considerWayPoint->wayPointZ - posZ; + x_dist = (f32) considerWaypoint->posX - posX; + y_dist = (f32) considerWaypoint->posY - posY; + z_dist = (f32) considerWaypoint->posZ - posZ; considerSquaredDistance = (x_dist * x_dist) + (y_dist * y_dist) + (z_dist * z_dist); if (considerSquaredDistance < minimumSquaredDistance) { - nearestWayPointIndex = considerWayPointIndex; + nearestWaypointIndex = considerWaypointIndex; var_a1 = 1; minimumSquaredDistance = considerSquaredDistance; } @@ -2765,17 +2765,17 @@ s16 func_8000C0BC(f32 posX, f32 posY, f32 posZ, u16 trackSegment, s32 *pathIndex if (var_t1 == 0) { for (considerPathIndex = 0; considerPathIndex < 4; considerPathIndex++) { if ((considerPathIndex != temp_t0) && (D_80163368[considerPathIndex] >= 2)) { - pathWayPoints = D_80164550[considerPathIndex]; - considerWayPoint = &pathWayPoints[0]; - pathWayPointCount = gWaypointCountByPathIndex[considerPathIndex]; - for (considerWayPointIndex = 0; considerWayPointIndex < pathWayPointCount; considerWayPointIndex++, considerWayPoint++) { - if (considerWayPoint->wayPointTrackSegment == trackSegment) { - x_dist = (f32) considerWayPoint->wayPointX - posX; - y_dist = (f32) considerWayPoint->wayPointY - posY; - z_dist = (f32) considerWayPoint->wayPointZ - posZ; + pathWaypoints = D_80164550[considerPathIndex]; + considerWaypoint = &pathWaypoints[0]; + pathWaypointCount = gWaypointCountByPathIndex[considerPathIndex]; + for (considerWaypointIndex = 0; considerWaypointIndex < pathWaypointCount; considerWaypointIndex++, considerWaypoint++) { + if (considerWaypoint->trackSegment == trackSegment) { + x_dist = (f32) considerWaypoint->posX - posX; + y_dist = (f32) considerWaypoint->posY - posY; + z_dist = (f32) considerWaypoint->posZ - posZ; considerSquaredDistance = (x_dist * x_dist) + (y_dist * y_dist) + (z_dist * z_dist); if (considerSquaredDistance < minimumSquaredDistance) { - nearestWayPointIndex = considerWayPointIndex; + nearestWaypointIndex = considerWaypointIndex; var_t4 = considerPathIndex; var_a1 = 2; minimumSquaredDistance = considerSquaredDistance; @@ -2786,21 +2786,21 @@ s16 func_8000C0BC(f32 posX, f32 posY, f32 posZ, u16 trackSegment, s32 *pathIndex } } if (var_a1 == 0) { - pathWayPoints = D_80164550[0]; - pathWayPointCount = gWaypointCountByPathIndex[0]; - considerWayPoint = &pathWayPoints[0]; - x_dist = (f32) considerWayPoint->wayPointX - posX; - y_dist = (f32) considerWayPoint->wayPointY - posY; - z_dist = (f32) considerWayPoint->wayPointZ - posZ; + pathWaypoints = D_80164550[0]; + pathWaypointCount = gWaypointCountByPathIndex[0]; + considerWaypoint = &pathWaypoints[0]; + x_dist = (f32) considerWaypoint->posX - posX; + y_dist = (f32) considerWaypoint->posY - posY; + z_dist = (f32) considerWaypoint->posZ - posZ; minimumSquaredDistance = (x_dist * x_dist) + (y_dist * y_dist) + (z_dist * z_dist); - nearestWayPointIndex = 0; - for (considerWayPointIndex = 1; considerWayPointIndex < pathWayPointCount; considerWayPoint++, considerWayPointIndex++) { - x_dist = (f32) considerWayPoint->wayPointX - posX; - y_dist = (f32) considerWayPoint->wayPointY - posY; - z_dist = (f32) considerWayPoint->wayPointZ - posZ; + nearestWaypointIndex = 0; + for (considerWaypointIndex = 1; considerWaypointIndex < pathWaypointCount; considerWaypoint++, considerWaypointIndex++) { + x_dist = (f32) considerWaypoint->posX - posX; + y_dist = (f32) considerWaypoint->posY - posY; + z_dist = (f32) considerWaypoint->posZ - posZ; considerSquaredDistance = (x_dist * x_dist) + (y_dist * y_dist) + (z_dist * z_dist); if (considerSquaredDistance < minimumSquaredDistance) { - nearestWayPointIndex = considerWayPointIndex; + nearestWaypointIndex = considerWaypointIndex; var_t4 = 0; var_a1 = 2; minimumSquaredDistance = considerSquaredDistance; @@ -2810,118 +2810,118 @@ s16 func_8000C0BC(f32 posX, f32 posY, f32 posZ, u16 trackSegment, s32 *pathIndex if (var_a1 == 2) { *pathIndex = var_t4; } - return nearestWayPointIndex; + return nearestWaypointIndex; } /** * Tries to find the waypoint nearest to (posX, posY, posZ) * Only consider waypoints in the same segment as trackSegment * Only considers waypoints within 500 units of (posX, posY, posZ) - * Looks 3 waypoints behind and 6 waypoints ahead of wayPointIndex + * Looks 3 waypoints behind and 6 waypoints ahead of waypointIndex **/ -s16 func_8000C884(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, s32 pathIndex, u16 trackSegment) { - s16 nearestWayPointIndex; +s16 func_8000C884(f32 posX, f32 posY, f32 posZ, s16 waypointIndex, s32 pathIndex, u16 trackSegment) { + s16 nearestWaypointIndex; s16 searchIndex; s16 considerIndex; - s32 pathWayPointCount; + s32 pathWaypointCount; f32 x_dist; f32 y_dist; f32 z_dist; f32 minimumDistance; f32 squaredDistance; - struct TrackWayPoint *pathWayPoints; - struct TrackWayPoint *considerWayPoint; + TrackWaypoint *pathWaypoints; + TrackWaypoint *considerWaypoint; - nearestWayPointIndex = -1; + nearestWaypointIndex = -1; minimumDistance = 250000.0f; - pathWayPointCount = gWaypointCountByPathIndex[pathIndex]; - pathWayPoints = D_80164550[pathIndex]; - for(searchIndex = wayPointIndex - 3; searchIndex < wayPointIndex + 7; searchIndex++) { + pathWaypointCount = gWaypointCountByPathIndex[pathIndex]; + pathWaypoints = D_80164550[pathIndex]; + for(searchIndex = waypointIndex - 3; searchIndex < waypointIndex + 7; searchIndex++) { // Its possible for searchIndex to be less than 0 or greater than the number of waypoints in a given path // This is done to ensure we access D_80164550 at a valid index - considerIndex = (searchIndex + pathWayPointCount) % pathWayPointCount; - considerWayPoint = &pathWayPoints[considerIndex]; - if (considerWayPoint->wayPointTrackSegment == trackSegment) { - x_dist = considerWayPoint->wayPointX - posX; - y_dist = considerWayPoint->wayPointY - posY; - z_dist = considerWayPoint->wayPointZ - posZ; + considerIndex = (searchIndex + pathWaypointCount) % pathWaypointCount; + considerWaypoint = &pathWaypoints[considerIndex]; + if (considerWaypoint->trackSegment == trackSegment) { + x_dist = considerWaypoint->posX - posX; + y_dist = considerWaypoint->posY - posY; + z_dist = considerWaypoint->posZ - posZ; squaredDistance = (x_dist * x_dist) + (y_dist * y_dist) + (z_dist * z_dist); if (squaredDistance < minimumDistance) { minimumDistance = squaredDistance; - nearestWayPointIndex = considerIndex; + nearestWaypointIndex = considerIndex; } } } - return nearestWayPointIndex; + return nearestWaypointIndex; } /** * Tries to find the waypoint nearest to (posX, posY, posZ) * Only considers waypoints within 400 units of (posX, posY, posZ) - * Looks 3 waypoints behind and 6 waypoints ahead of wayPointIndex + * Looks 3 waypoints behind and 6 waypoints ahead of waypointIndex **/ -s16 func_8000C9DC(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, s32 pathIndex) { - s16 nearestWayPointIndex; +s16 func_8000C9DC(f32 posX, f32 posY, f32 posZ, s16 waypointIndex, s32 pathIndex) { + s16 nearestWaypointIndex; s16 searchIndex; s16 considerIndex; - s32 wayPointFound; - s32 pathWayPointCount; + s32 waypointFound; + s32 pathWaypointCount; f32 x_dist; f32 y_dist; f32 z_dist; f32 minimumDistance; f32 squaredDistance; - struct TrackWayPoint *pathWayPoints; - struct TrackWayPoint *considerWayPoint; + TrackWaypoint *pathWaypoints; + TrackWaypoint *considerWaypoint; - wayPointFound = 0; - nearestWayPointIndex = -1; + waypointFound = 0; + nearestWaypointIndex = -1; minimumDistance = 160000.0f; - pathWayPointCount = gWaypointCountByPathIndex[pathIndex]; - pathWayPoints = D_80164550[pathIndex]; - for(searchIndex = wayPointIndex - 3; searchIndex < wayPointIndex + 7; searchIndex++) { + pathWaypointCount = gWaypointCountByPathIndex[pathIndex]; + pathWaypoints = D_80164550[pathIndex]; + for(searchIndex = waypointIndex - 3; searchIndex < waypointIndex + 7; searchIndex++) { // Its possible for searchIndex to be less than 0 or greater than the number of waypoints in a given path // This is done to ensure we access D_80164550 at a valid index - considerIndex = (searchIndex + pathWayPointCount) % pathWayPointCount; - considerWayPoint = &pathWayPoints[considerIndex]; - x_dist = considerWayPoint->wayPointX - posX; - y_dist = considerWayPoint->wayPointY - posY; - z_dist = considerWayPoint->wayPointZ - posZ; + considerIndex = (searchIndex + pathWaypointCount) % pathWaypointCount; + considerWaypoint = &pathWaypoints[considerIndex]; + x_dist = considerWaypoint->posX - posX; + y_dist = considerWaypoint->posY - posY; + z_dist = considerWaypoint->posZ - posZ; squaredDistance = (x_dist * x_dist) + (y_dist * y_dist) + (z_dist * z_dist); if (squaredDistance < minimumDistance) { minimumDistance = squaredDistance; - nearestWayPointIndex = considerIndex; - wayPointFound = 1; + nearestWaypointIndex = considerIndex; + waypointFound = 1; } } - if (wayPointFound == 0) { - for(searchIndex = wayPointIndex - 3; searchIndex < wayPointIndex + 7; searchIndex++) { - considerIndex = ((searchIndex + pathWayPointCount) % pathWayPointCount); - considerWayPoint = &pathWayPoints[considerIndex]; + if (waypointFound == 0) { + for(searchIndex = waypointIndex - 3; searchIndex < waypointIndex + 7; searchIndex++) { + considerIndex = ((searchIndex + pathWaypointCount) % pathWaypointCount); + considerWaypoint = &pathWaypoints[considerIndex]; /** - * This fake match is done to stop the compiler from optimzing out considerWayPoint. + * This fake match is done to stop the compiler from optimzing out considerWaypoint. * Maybe if no waypoint was found some debugging info was printed out, but come * production time they removed the debug printing but not the loop? **/ - if (considerWayPoint && considerWayPoint) {}; + if (considerWaypoint && considerWaypoint) {}; } } - return nearestWayPointIndex; + return nearestWaypointIndex; } -void func_8000CBA4(UNUSED f32 posX, f32 posY, UNUSED f32 posZ, s16 *wayPointIndex) { +void func_8000CBA4(UNUSED f32 posX, f32 posY, UNUSED f32 posZ, s16 *waypointIndex) { s16 var_v0; - var_v0 = *wayPointIndex; + var_v0 = *waypointIndex; if ((gCurrentCourseId == COURSE_WARIO_STADIUM) && (var_v0 >= 0x475) && (var_v0 < 0x480) && (posY < 0.0f)) { var_v0 = 0x0398; } - *wayPointIndex = var_v0; + *waypointIndex = var_v0; } -void func_8000CBF8(UNUSED f32 posX, UNUSED f32 posY, f32 posZ, s16 *wayPointIndex, s32 pathIndex) { +void func_8000CBF8(UNUSED f32 posX, UNUSED f32 posY, f32 posZ, s16 *waypointIndex, s32 pathIndex) { s16 temp; - temp = *wayPointIndex; + temp = *waypointIndex; if (temp == 0) { if (D_8016344C < posZ) { temp = gWaypointCountByPathIndex[pathIndex] - 1; @@ -2929,7 +2929,7 @@ void func_8000CBF8(UNUSED f32 posX, UNUSED f32 posY, f32 posZ, s16 *wayPointInde } else if (((temp + 1) == gWaypointCountByPathIndex[pathIndex]) && (posZ <= D_8016344C)) { temp = 0; } - *wayPointIndex = temp; + *waypointIndex = temp; } s16 func_8000CC88(f32 posX, f32 posY, f32 posZ, Player *player, s32 playerId, s32 *pathIndex) { @@ -2948,7 +2948,7 @@ s16 func_8000CC88(f32 posX, f32 posY, f32 posZ, Player *player, s32 playerId, s3 #ifdef MIPS_TO_C //generated by m2c commit b52d92c2340f6f4ba1aafb464188bb698752fbb0 on Jul-08-2023 -s16 func_8000CD24(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, Player *player, s32 playerId, s32 pathIndex) { +s16 func_8000CD24(f32 posX, f32 posY, f32 posZ, s16 waypointIndex, Player *player, s32 playerId, s32 pathIndex) { s16 sp5E; s32 sp48; s16 *sp44; @@ -2964,9 +2964,9 @@ s16 func_8000CD24(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, Player *playe s16 temp_v0_6; s16 temp_v0_7; s16 var_v0; - struct TrackWayPoint *temp_v1; - struct TrackWayPoint *temp_v1_3; - struct TrackWayPoint *temp_v1_4; + TrackWaypoint *temp_v1; + TrackWaypoint *temp_v1_3; + TrackWaypoint *temp_v1_4; u16 temp_v0; temp_v0 = player->type; @@ -2974,7 +2974,7 @@ s16 func_8000CD24(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, Player *playe var_f20 = posX; var_f22 = posY; if ((temp_v0 & 0x4000) && !(temp_v0 & 0x1000)) { - temp_v0_2 = func_8000C884(var_f20, var_f22, var_f24, wayPointIndex, pathIndex, (u16) func_802ABD40(player->unk_110.unk3A)); + temp_v0_2 = func_8000C884(var_f20, var_f22, var_f24, waypointIndex, pathIndex, (u16) func_802ABD40(player->unk_110.unk3A)); sp5E = temp_v0_2; if (temp_v0_2 == -1) { sp5E = func_8000CC88(var_f20, var_f22, var_f24, player, playerId, &pathIndex); @@ -2985,12 +2985,12 @@ s16 func_8000CD24(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, Player *playe if (D_801631E0[playerId] == 1) { temp_a0 = player->unk_0CA; if (temp_a0 & 1) { - temp_v1 = &D_80164550[pathIndex][wayPointIndex]; - player->pos[0] = (f32) temp_v1->wayPointX; - player->pos[1] = (f32) temp_v1->wayPointY; + temp_v1 = &D_80164550[pathIndex][waypointIndex]; + player->pos[0] = (f32) temp_v1->posX; + player->pos[1] = (f32) temp_v1->posY; player->unk_0CA = temp_a0 & 0xFFFE; - player->pos[2] = (f32) temp_v1->wayPointZ; - return wayPointIndex; + player->pos[2] = (f32) temp_v1->posZ; + return waypointIndex; } if (playerId == ((s32) D_80163488 % 8)) { func_802ADDC8(&player->unk_110, 10.0f, var_f20, var_f22, var_f24); @@ -2998,32 +2998,32 @@ s16 func_8000CD24(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, Player *playe temp_v1_2 = sp48 + D_80163318; *temp_v1_2 = temp_v0_3; sp44 = temp_v1_2; - var_v0 = func_8000C884(var_f20, var_f22, var_f24, wayPointIndex, pathIndex, (u16) (temp_v0_3 & 0xFFFF)); + var_v0 = func_8000C884(var_f20, var_f22, var_f24, waypointIndex, pathIndex, (u16) (temp_v0_3 & 0xFFFF)); sp5E = var_v0; if (var_v0 == -1) { sp44 = temp_v1_2; - var_v0 = func_8000C9DC(var_f20, var_f22, var_f24, wayPointIndex, pathIndex); + var_v0 = func_8000C9DC(var_f20, var_f22, var_f24, waypointIndex, pathIndex); sp5E = var_v0; } if (var_v0 == -1) { temp_v0_4 = func_8000C0BC(var_f20, var_f22, var_f24, (u16) *temp_v1_2, &pathIndex); sp5E = temp_v0_4; temp_v1_3 = &D_80164550[pathIndex][temp_v0_4]; - player->pos[0] = (f32) temp_v1_3->wayPointX; - player->pos[1] = (f32) temp_v1_3->wayPointY; - player->pos[2] = (f32) temp_v1_3->wayPointZ; + player->pos[0] = (f32) temp_v1_3->posX; + player->pos[1] = (f32) temp_v1_3->posY; + player->pos[2] = (f32) temp_v1_3->posZ; } } else { - temp_v0_5 = func_8000C9DC(var_f20, var_f22, var_f24, wayPointIndex, pathIndex); + temp_v0_5 = func_8000C9DC(var_f20, var_f22, var_f24, waypointIndex, pathIndex); sp5E = temp_v0_5; if (temp_v0_5 == -1) { temp_v0_6 = func_8000BD94(var_f20, var_f22, var_f24, pathIndex); sp5E = temp_v0_6; temp_v1_4 = &D_80164550[pathIndex][temp_v0_6]; - var_f20 = (f32) temp_v1_4->wayPointX; - var_f22 = (f32) temp_v1_4->wayPointY; + var_f20 = (f32) temp_v1_4->posX; + var_f22 = (f32) temp_v1_4->posY; player->pos[0] = var_f20; - var_f24 = (f32) temp_v1_4->wayPointZ; + var_f24 = (f32) temp_v1_4->posZ; player->pos[1] = var_f22; player->pos[2] = var_f24; func_802ADDC8(&player->unk_110, 10.0f, var_f20, var_f22, var_f24); @@ -3032,7 +3032,7 @@ s16 func_8000CD24(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, Player *playe } goto block_16; } - temp_v0_7 = func_8000C9DC(var_f20, var_f22, var_f24, wayPointIndex, pathIndex); + temp_v0_7 = func_8000C9DC(var_f20, var_f22, var_f24, waypointIndex, pathIndex); sp5E = temp_v0_7; if (temp_v0_7 == -1) { sp5E = func_8000CC88(var_f20, var_f22, var_f24, player, playerId, &pathIndex); @@ -3115,10 +3115,10 @@ s16 func_8000D24C(f32 posX, f32 posY, f32 posZ, s32 *pathIndex) { return func_8000C0BC(posX, posY, posZ, func_802ABD40(sp24.unk3A), pathIndex); } -s16 func_8000D2B4(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, s32 pathIndex) { +s16 func_8000D2B4(f32 posX, f32 posY, f32 posZ, s16 waypointIndex, s32 pathIndex) { s16 temp_v0; - temp_v0 = func_8000C9DC(posX, posY, posZ, wayPointIndex, pathIndex); + temp_v0 = func_8000C9DC(posX, posY, posZ, waypointIndex, pathIndex); if (temp_v0 == -1) { temp_v0 = func_8000D24C(posX, posY, posZ, &pathIndex); } @@ -3126,10 +3126,10 @@ s16 func_8000D2B4(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, s32 pathIndex return temp_v0; } -s16 func_8000D33C(f32 posX, f32 posY, f32 posZ, s16 wayPointIndex, s32 pathIndex) { +s16 func_8000D33C(f32 posX, f32 posY, f32 posZ, s16 waypointIndex, s32 pathIndex) { s16 var_v1; - var_v1 = func_8000C9DC(posX, posY, posZ, wayPointIndex, pathIndex); + var_v1 = func_8000C9DC(posX, posY, posZ, waypointIndex, pathIndex); if (var_v1 == -1) { var_v1 = func_8000D24C(posX, posY, posZ, &pathIndex); } @@ -3266,7 +3266,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000D438.s") void func_8000BBD8(u16, s32, s16, u16); /* extern */ extern f32 D_80162FA0; -void func_8000D6D0(Vec3f arg0, s16 *wayPointIndex, f32 arg2, s32 arg3, s16 pathIndex, s16 arg5) { +void func_8000D6D0(Vec3f arg0, s16 *waypointIndex, f32 arg2, s32 arg3, s16 pathIndex, s16 arg5) { s16 spA0; u16 sp9E; f32 sp98; @@ -3274,7 +3274,7 @@ void func_8000D6D0(Vec3f arg0, s16 *wayPointIndex, f32 arg2, s32 arg3, s16 pathI f32 sp58; f32 sp54; f32 sp50; - struct TrackWayPoint *sp4C; + TrackWaypoint *sp4C; f32 sp48; f32 sp44; f32 sp40; @@ -3301,8 +3301,8 @@ void func_8000D6D0(Vec3f arg0, s16 *wayPointIndex, f32 arg2, s32 arg3, s16 pathI temp_f24 = arg0->unk8; temp_f20 = arg0->unk0; temp_f22 = arg0->unk4; - temp_v0 = func_8000D2B4(temp_f20, temp_f22, temp_f24, *wayPointIndex, (s32) pathIndex); - *wayPointIndex = temp_v0; + temp_v0 = func_8000D2B4(temp_f20, temp_f22, temp_f24, *waypointIndex, (s32) pathIndex); + *waypointIndex = temp_v0; temp_a3 = gWaypointCountByPathIndex[pathIndex]; temp_v1 = temp_v0 + arg5; temp_hi = temp_v1 % (s32) temp_a3; @@ -3313,7 +3313,7 @@ void func_8000D6D0(Vec3f arg0, s16 *wayPointIndex, f32 arg2, s32 arg3, s16 pathI sp98 = D_80162FA0.unk0; sp90 = temp_f4; func_8000BBD8(sp9E, arg3, pathIndex); - temp_f18 = ((f32) (sp4C[(s16) sp9E].wayPointY + sp4C[spA0].wayPointY) * 0.5f) - temp_f22; + temp_f18 = ((f32) (sp4C[(s16) sp9E].posY + sp4C[spA0].posY) * 0.5f) - temp_f22; temp_f16 = ((sp98 + D_80162FA0.unk0) * 0.5f) - temp_f20; sp44 = temp_f18; sp48 = temp_f16; @@ -3370,7 +3370,7 @@ void func_8000D940(Vec3f arg0, s16 *arg1, f32 arg2, s32 arg3, s16 pathIndex) { s32 temp_a3; s32 temp_t2; s32 temp_v1; - struct TrackWayPoint *temp_v0_2; + TrackWaypoint *temp_v0_2; u16 temp_t0; sp54 = arg0->unk0; @@ -3394,7 +3394,7 @@ void func_8000D940(Vec3f arg0, s16 *arg1, f32 arg2, s32 arg3, s16 pathIndex) { sp98 = temp_f4; func_8000BBD8(spA6, arg3, pathIndex); temp_v0_2 = D_80164550[pathIndex]; - temp_f18 = ((f32) (temp_v0_2[(s16) spA6].wayPointY + temp_v0_2[spA8].wayPointY) * 0.5f) - temp_f22; + temp_f18 = ((f32) (temp_v0_2[(s16) spA6].posY + temp_v0_2[spA8].posY) * 0.5f) - temp_f22; temp_f16 = ((spA0 + D_80162FA0.unk0) * 0.5f) - temp_f20; sp4C = temp_f18; sp50 = temp_f16; @@ -3419,18 +3419,19 @@ void func_8000D940(Vec3f arg0, s16 *arg1, f32 arg2, s32 arg3, s16 pathIndex) { GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000D940.s") #endif +extern s32 D_8016359C; #ifdef MIPS_TO_C //generated by m2c commit 3b40ab93768f52ac241c5ae84ef58ef6bc4cb1de s16 func_8000D100(f32, f32, f32, s16); /* extern */ -extern s32 D_80163598; -extern s32 D_8016359C; +extern TrackWaypoint *D_80163598; + -void func_8000DBAC(Vec3f arg0, s16 *arg1, f32 arg2) { +s16 func_8000DBAC(Vec3f pos, s16 *waypointIndex, f32 speed) { f32 sp98; f32 sp94; - f32 sp40; - f32 sp3C; - f32 sp38; + //f32 sp40; + //f32 sp3C; + Vec3f sp38; f32 sp34; f32 sp30; f32 temp_f0; @@ -3447,36 +3448,44 @@ void func_8000DBAC(Vec3f arg0, s16 *arg1, f32 arg2) { void *temp_a0; void *temp_a2; - temp_f12 = arg0->unk0; - temp_f14 = arg0->unk4; - temp_f2 = arg0->unk8; - sp38 = temp_f12; - sp3C = arg0->unk4; - sp40 = arg0->unk8; + temp_f12 = pos[0]; + temp_f14 = pos[1]; + temp_f2 = pos[2]; + + sp38[0] = pos[0]; + sp38[1] = pos[1]; + sp38[2] = pos[2]; + sp98 = temp_f14; sp94 = temp_f2; - temp_v0 = func_8000D100(temp_f12, temp_f14, temp_f2, *arg1); - *arg1 = temp_v0; - temp_v1 = D_8016359C; - temp_a1 = D_80163598; - temp_a0 = ((s16) ((s32) (temp_v0 + 3) % temp_v1) * 4) + temp_a1; - temp_a2 = ((s16) ((s32) (temp_v0 + 4) % temp_v1) * 4) + temp_a1; - temp_f16 = ((f32) (temp_a0->unk0 + temp_a2->unk0) * 0.5f) - temp_f12; - temp_f18 = ((f32) (temp_a0->unk2 + temp_a2->unk2) * 0.5f) - temp_f2; + temp_v0 = func_8000D100(temp_f12, temp_f14, temp_f2, *waypointIndex); + *waypointIndex = temp_v0; + + temp_a0 = ((s16) ((s32) (temp_v0 + 3) % temp_v1)); + temp_a2 = ((s16) ((s32) (temp_v0 + 4) % temp_v1)); + + temp_v1 = D_8016359C[temp_a0]; + temp_a1 = D_80163598[temp_a2]; + + temp_f16 = ((f32) (temp_v1->waypointX + temp_a1->waypointX) * 0.5f) - temp_f12; + temp_f18 = ((f32) (temp_v1->waypointY + temp_a1->waypointY) * 0.5f) - temp_f2; + sp34 = temp_f16; sp30 = temp_f18; + temp_f0 = sqrtf((temp_f16 * temp_f16) + (temp_f18 * temp_f18)); + if (temp_f0 > 0.01f) { - var_f12 = ((temp_f16 * arg2) / temp_f0) + temp_f12; - var_f14 = ((temp_f18 * arg2) / temp_f0) + temp_f2; + var_f12 = ((temp_f16 * speed) / temp_f0) + temp_f12; + var_f14 = ((temp_f18 * speed) / temp_f0) + temp_f2; } else { var_f12 = temp_f12; var_f14 = temp_f2; } - arg0->unk0 = var_f12; - arg0->unk8 = var_f14; - arg0->unk4 = sp98; - func_80005FD0(&sp38, arg0); + pos[0] = var_f12; + pos[1] = sp98; + pos[2] = var_f14; + return func_80005FD0(&sp38, pos); } #else GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000DBAC.s") @@ -3488,7 +3497,7 @@ void func_8000DD78(void) { f32 startingZPos; f32 startingYPos; s32 var_s3; - struct TrackWayPoint *temp_v0; + TrackWaypoint *temp_v0; struct_D_80163DE8_entry *var_s0; BombKartSpawn *temp_s1; @@ -3501,16 +3510,16 @@ void func_8000DD78(void) { startingYPos = func_802AE1C0(startingXPos, 2000.0f, startingZPos); break; case COURSE_AWARD_CEREMONY: - temp_v0 = &D_80164550[3][temp_s1->wayPointIndex]; - startingXPos = temp_v0->wayPointX; - startingYPos = temp_v0->wayPointY; - startingZPos = temp_v0->wayPointZ; + temp_v0 = &D_80164550[3][temp_s1->waypointIndex]; + startingXPos = temp_v0->posX; + startingYPos = temp_v0->posY; + startingZPos = temp_v0->posZ; break; default: - temp_v0 = &D_80164550[0][temp_s1->wayPointIndex]; - startingXPos = temp_v0->wayPointX; - startingYPos = temp_v0->wayPointY; - startingZPos = temp_v0->wayPointZ; + temp_v0 = &D_80164550[0][temp_s1->waypointIndex]; + startingXPos = temp_v0->posX; + startingYPos = temp_v0->posY; + startingZPos = temp_v0->posZ; break; } D_80163DE8[var_s3].bombPos[0] = startingXPos; @@ -3528,7 +3537,7 @@ void func_8000DD78(void) { D_80163DE8[var_s3].wheel4Pos[0] = startingXPos; D_80163DE8[var_s3].wheel4Pos[1] = startingYPos; D_80163DE8[var_s3].wheel4Pos[2] = startingZPos; - D_80163DE8[var_s3].wayPointIndex = temp_s1->wayPointIndex; + D_80163DE8[var_s3].waypointIndex = temp_s1->waypointIndex; D_80163DE8[var_s3].unk_3C = temp_s1->unk_04; D_80163DE8[var_s3].bounceTimer = 0; D_80163DE8[var_s3].circleTimer = 0; @@ -3555,7 +3564,7 @@ s16 gCurrentCourseId; /* unable to generate initia void func_8000DF8C(s32 arg0) { f32 sp118; f32 sp114; - struct TrackWayPoint *sp110; + TrackWaypoint *sp110; f32 sp108; f32 spF8; f32 spF0; @@ -3615,10 +3624,10 @@ void func_8000DF8C(s32 arg0) { s32 temp_t9_2; s32 var_a0; s8 var_v1; - struct TrackWayPoint *temp_v0_2; - struct TrackWayPoint *temp_v0_4; - struct TrackWayPoint *temp_v0_7; - struct TrackWayPoint *temp_v1_2; + TrackWaypoint *temp_v0_2; + TrackWaypoint *temp_v0_4; + TrackWaypoint *temp_v0_7; + TrackWaypoint *temp_v1_2; struct_D_80163DE8_entry *temp_s0; u16 temp_t4; u16 temp_t9; @@ -3637,7 +3646,7 @@ void func_8000DF8C(s32 arg0) { var_f22 = temp_s0->bombPos[0]; var_f20 = temp_s0->bombPos[1]; var_f24 = temp_s0->bombPos[2]; - spCA = (u16) temp_s0->wayPointIndex; + spCA = (u16) temp_s0->waypointIndex; spC4 = temp_s0->unk_3C; spC2 = (u16) temp_s0->someRot; sp7C = (u16) temp_s0->bounceTimer; @@ -3697,18 +3706,18 @@ void func_8000DF8C(s32 arg0) { temp_v0_2 = &(*D_80164550)[spCA]; var_f20 = temp_s0->yPos + 3.5f; temp_t7 = ((s32) (((s32) (sp48 + 1) % 360) * 0xFFFF) / 360) & 0xFFFF; - var_f22 = (f32) temp_v0_2->wayPointX + sp118; + var_f22 = (f32) temp_v0_2->posX + sp118; D_80162FB0.unk4 = var_f20; D_80162FB0.unk0 = var_f22; sp44 = temp_t7; sp110 = temp_v0_2; - var_f24 = (f32) temp_v0_2->wayPointZ + (f32) ((f64) temp_f0_3 * 25.0); + var_f24 = (f32) temp_v0_2->posZ + (f32) ((f64) temp_f0_3 * 25.0); D_80162FB0.unk8 = var_f24; sp118 = (f32) ((f64) coss((u16) temp_t7) * 25.0); temp_f10 = (f64) sins((u16) sp44); - D_80162FC0.unk0 = (f32) temp_v0_2->wayPointX + sp118; - D_80162FC0.unk4 = (f32) temp_v0_2->wayPointY; - D_80162FC0.unk8 = (f32) ((f32) temp_v0_2->wayPointZ + (f32) (temp_f10 * 25.0)); + D_80162FC0.unk0 = (f32) temp_v0_2->posX + sp118; + D_80162FC0.unk4 = (f32) temp_v0_2->posY; + D_80162FC0.unk8 = (f32) ((f32) temp_v0_2->posZ + (f32) (temp_f10 * 25.0)); spC2 = (u16) ((s32) (get_angle_between_points(&D_80162FB0, &D_80162FC0) * 0xFFFF) / 65520); break; case 2: @@ -3719,7 +3728,7 @@ void func_8000DF8C(s32 arg0) { sp48 = (s32) temp_v0_3; sp118 = (f32) ((f64) coss((u16) temp_a0) * 25.0); temp_v0_4 = &(*D_80164550)[spCA]; - var_f22 = (f32) temp_v0_4->wayPointX + sp118; + var_f22 = (f32) temp_v0_4->posX + sp118; var_f20 = temp_s0->yPos + 3.5f; temp_f4 = (f64) sins((u16) temp_a0) * 25.0; temp_a0_2 = ((s32) (((s32) (sp48 + 1) % 360) * 0xFFFF) / 360) & 0xFFFF; @@ -3727,13 +3736,13 @@ void func_8000DF8C(s32 arg0) { D_80162FB0.unk4 = var_f20; sp44 = temp_a0_2; sp110 = temp_v0_4; - var_f24 = (f32) temp_v0_4->wayPointZ + (f32) temp_f4; + var_f24 = (f32) temp_v0_4->posZ + (f32) temp_f4; D_80162FB0.unk8 = var_f24; sp118 = (f32) ((f64) coss((u16) temp_a0_2) * 25.0); temp_f8 = (f64) sins((u16) temp_a0_2); - D_80162FC0.unk0 = (f32) temp_v0_4->wayPointX + sp118; - D_80162FC0.unk4 = (f32) temp_v0_4->wayPointY; - D_80162FC0.unk8 = (f32) ((f32) temp_v0_4->wayPointZ + (f32) (temp_f8 * 25.0)); + D_80162FC0.unk0 = (f32) temp_v0_4->posX + sp118; + D_80162FC0.unk4 = (f32) temp_v0_4->posY; + D_80162FC0.unk8 = (f32) ((f32) temp_v0_4->posZ + (f32) (temp_f8 * 25.0)); spC2 = (u16) ((s32) (get_angle_between_points(&D_80162FB0, &D_80162FC0) * 0xFFFF) / 65520); default: break; @@ -3794,14 +3803,14 @@ void func_8000DF8C(s32 arg0) { break; case 4: temp_v0_7 = &(*D_80164550)[spCA]; - D_80162FB0.unk0 = (f32) temp_v0_7->wayPointX; - D_80162FB0.unk4 = (f32) temp_v0_7->wayPointY; - D_80162FB0.unk8 = (f32) temp_v0_7->wayPointZ; + D_80162FB0.unk0 = (f32) temp_v0_7->posX; + D_80162FB0.unk4 = (f32) temp_v0_7->posY; + D_80162FB0.unk8 = (f32) temp_v0_7->posZ; temp_v1_2 = &(*D_80164550)[(s32) (spCA + 1) % (s32) *gWaypointCountByPathIndex]; - D_80162FC0.unk0 = (f32) temp_v1_2->wayPointX; - D_80162FC0.unk4 = (f32) temp_v1_2->wayPointY; + D_80162FC0.unk0 = (f32) temp_v1_2->posX; + D_80162FC0.unk4 = (f32) temp_v1_2->posY; var_f6 = (f32) var_s1; - D_80162FC0.unk8 = (f32) temp_v1_2->wayPointZ; + D_80162FC0.unk8 = (f32) temp_v1_2->posZ; if ((s32) var_s1 < 0) { var_f6 += 4294967296.0f; } @@ -3868,7 +3877,7 @@ void func_8000DF8C(s32 arg0) { temp_s0->bombPos[1] = var_f20; temp_s0->bombPos[2] = var_f24; temp_s0->wheel4Pos[1] = sp88; - temp_s0->wayPointIndex = (s16) spCA; + temp_s0->waypointIndex = (s16) spCA; temp_s0->unk_3C = spC4; temp_s0->someRot = (s16) spC2; temp_s0->state = (s16) sp7E; @@ -4124,7 +4133,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000F124.s") #endif // Delete track waypoints -void func_8000F2BC(struct TrackWayPoint *arg0, size_t size) { +void func_8000F2BC(TrackWaypoint *arg0, size_t size) { bzero((void *) arg0, size << 3); } @@ -4666,7 +4675,7 @@ void func_8000F628(void) { D_80163478 = 0; D_80163378 = 0; D_8016337C = 0; - D_8016344C = (f32) (*D_80164550)->wayPointZ; + D_8016344C = (f32) (*D_80164550)->posZ; D_801634F0 = 0; D_801634F4 = 0; D_80163488 = 0; @@ -4706,7 +4715,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8000F628.s") #endif // dest src size pathIndex -u16 func_80011014(struct TrackWayPoint *, struct TrackWayPoint *, s32, s32); /* extern */ +u16 func_80011014(TrackWaypoint *, TrackWaypoint *, s32, s32); /* extern */ extern uintptr_t gCoursePathTable[20][4]; extern uintptr_t D_800DC8D0[20][4]; @@ -4718,9 +4727,9 @@ extern uintptr_t D_800DC8D0[20][4]; // Each course can have 1-4 course paths. void func_800100F0(s32 pathIndex) { - struct TrackWayPoint *ptr; - struct TrackWayPoint *pathDest; - struct TrackWayPoint *path; + TrackWaypoint *ptr; + TrackWaypoint *pathDest; + TrackWaypoint *path; s32 var_v0; s32 sp24; s32 pad[2]; @@ -4741,7 +4750,7 @@ void func_800100F0(s32 pathIndex) { ptr = path; for (i = 0; i < 3000; i++, ptr++) { - if ((u16)ptr->wayPointX == 0x8000 ) { + if ((u16)ptr->posX == 0x8000 ) { sp24 = i - 1; bInvalidPath = 0; break; @@ -4760,7 +4769,7 @@ void func_800100F0(s32 pathIndex) { } void func_80010218(s32 pathIndex) { - f32 wayPointWidth; + f32 waypointWidth; f32 x1; f32 y1; f32 z1; @@ -4773,47 +4782,47 @@ void func_80010218(s32 pathIndex) { f32 neg_z_dist; f32 xz_dist; s32 temp_f16; - s32 wayPointIndex; - struct TrackWayPoint *wayPoint; - struct TrackWayPoint *nextWayPoint; - struct TrackWayPoint *var_s1; - struct TrackWayPoint *var_s2; + s32 waypointIndex; + TrackWaypoint *waypoint; + TrackWaypoint *nextWaypoint; + TrackWaypoint *var_s1; + TrackWaypoint *var_s2; if (((s32) D_800DCA4C[gCurrentCourseId]) >= 0) { - wayPointWidth = D_800DCA4C[gCurrentCourseId]; - wayPoint = &D_80164550[pathIndex][0]; + waypointWidth = D_800DCA4C[gCurrentCourseId]; + waypoint = &D_80164550[pathIndex][0]; var_s1 = &D_80164560[pathIndex][0]; var_s2 = &D_80164570[pathIndex][0]; - for (wayPointIndex = 0; wayPointIndex < gWaypointCountByPathIndex[pathIndex]; wayPointIndex++, var_s1++, var_s2++) { - x1 = wayPoint->wayPointX; - y1 = wayPoint->wayPointY; - z1 = wayPoint->wayPointZ; - wayPoint++; - nextWayPoint = &D_80164550[pathIndex][(wayPointIndex + 1) % ((s32) gWaypointCountByPathIndex[pathIndex])]; - x2 = nextWayPoint->wayPointX; - y2 = nextWayPoint->wayPointY; - z2 = nextWayPoint->wayPointZ; + for (waypointIndex = 0; waypointIndex < gWaypointCountByPathIndex[pathIndex]; waypointIndex++, var_s1++, var_s2++) { + x1 = waypoint->posX; + y1 = waypoint->posY; + z1 = waypoint->posZ; + waypoint++; + nextWaypoint = &D_80164550[pathIndex][(waypointIndex + 1) % ((s32) gWaypointCountByPathIndex[pathIndex])]; + x2 = nextWaypoint->posX; + y2 = nextWaypoint->posY; + z2 = nextWaypoint->posZ; x_dist = x2 - x1; z_dist = z2 - z1; neg_x_dist = x1 - x2; neg_z_dist = z1 - z2; xz_dist = sqrtf((x_dist * x_dist) + (z_dist * z_dist)); temp_f16 = (f32) ((y1 + y2) * 0.5); - var_s1->wayPointX = ((wayPointWidth * z_dist) / xz_dist) + x1; - var_s1->wayPointY = temp_f16; - var_s1->wayPointZ = ((wayPointWidth * neg_x_dist) / xz_dist) + z1; - var_s2->wayPointX = ((wayPointWidth * neg_z_dist) / xz_dist) + x1; - var_s2->wayPointY = temp_f16; - var_s2->wayPointZ = ((wayPointWidth * x_dist) / xz_dist) + z1; + var_s1->posX = ((waypointWidth * z_dist) / xz_dist) + x1; + var_s1->posY = temp_f16; + var_s1->posZ = ((waypointWidth * neg_x_dist) / xz_dist) + z1; + var_s2->posX = ((waypointWidth * neg_z_dist) / xz_dist) + x1; + var_s2->posY = temp_f16; + var_s2->posZ = ((waypointWidth * x_dist) / xz_dist) + z1; } } } -f32 func_80010480(s32 pathIndex, u16 wayPointIndex) { +f32 func_80010480(s32 pathIndex, u16 waypointIndex) { f32 temp_f10_2; f32 temp_f8; UNUSED f32 stackPadding; - struct TrackWayPoint *pathWaypoints; + TrackWaypoint *pathWaypoints; f32 x1; f32 z1; f32 x2; @@ -4822,38 +4831,38 @@ f32 func_80010480(s32 pathIndex, u16 wayPointIndex) { f32 z3; f32 temp_f8_2; f32 temp_f10; - s32 wayPointCount; - struct TrackWayPoint *wayPoint3; - struct TrackWayPoint *wayPoint2; - struct TrackWayPoint *wayPoint1; + s32 waypointCount; + TrackWaypoint *waypoint3; + TrackWaypoint *waypoint2; + TrackWaypoint *waypoint1; f32 root2; f32 root1; if ((s32) D_800DCA4C[gCurrentCourseId] < 0) { return 0.0f; } - wayPointCount = gWaypointCountByPathIndex[pathIndex]; + waypointCount = gWaypointCountByPathIndex[pathIndex]; pathWaypoints = D_80164550[pathIndex]; - wayPoint1 = &pathWaypoints[wayPointIndex]; - wayPoint2 = &pathWaypoints[(wayPointIndex + 1) % wayPointCount]; - wayPoint3 = &pathWaypoints[(wayPointIndex + 2) % wayPointCount]; - x1 = wayPoint1->wayPointX; - z1 = wayPoint1->wayPointZ; - x2 = wayPoint2->wayPointX; - z2 = wayPoint2->wayPointZ; - x3 = wayPoint3->wayPointX; - z3 = wayPoint3->wayPointZ; + waypoint1 = &pathWaypoints[waypointIndex]; + waypoint2 = &pathWaypoints[(waypointIndex + 1) % waypointCount]; + waypoint3 = &pathWaypoints[(waypointIndex + 2) % waypointCount]; + x1 = waypoint1->posX; + z1 = waypoint1->posZ; + x2 = waypoint2->posX; + z2 = waypoint2->posZ; + x3 = waypoint3->posX; + z3 = waypoint3->posZ; temp_f8_2 = (((x2 + x3) * 0.5) - x1); temp_f10 = (((z2 + z3) * 0.5) - z1); - wayPoint1 = &pathWaypoints[(wayPointIndex + 3) % wayPointCount]; - wayPoint2 = &pathWaypoints[(wayPointIndex + 4) % wayPointCount]; - wayPoint3 = &pathWaypoints[(wayPointIndex + 5) % wayPointCount]; - x1 = wayPoint1->wayPointX; - z1 = wayPoint1->wayPointZ; - x2 = wayPoint2->wayPointX; - z2 = wayPoint2->wayPointZ; - x3 = wayPoint3->wayPointX; - z3 = wayPoint3->wayPointZ; + waypoint1 = &pathWaypoints[(waypointIndex + 3) % waypointCount]; + waypoint2 = &pathWaypoints[(waypointIndex + 4) % waypointCount]; + waypoint3 = &pathWaypoints[(waypointIndex + 5) % waypointCount]; + x1 = waypoint1->posX; + z1 = waypoint1->posZ; + x2 = waypoint2->posX; + z2 = waypoint2->posZ; + x3 = waypoint3->posX; + z3 = waypoint3->posZ; temp_f10_2 = (((x2 + x3) * 0.5) - x1); temp_f8 = (((z2 + z3) * 0.5) - z1); root1 = sqrtf((temp_f10 * temp_f10) + (temp_f8_2 * temp_f8_2)); @@ -4915,33 +4924,33 @@ void func_800107C4(s32 pathIndex) { } } -// Seemingly calculates the atan2 angle between a wayPoint and its forward neighbor -s16 func_80010CB0(s32 pathIndex, s32 wayPointIndex) { +// Seemingly calculates the atan2 angle between a waypoint and its forward neighbor +s16 func_80010CB0(s32 pathIndex, s32 waypointIndex) { s16 ret; Vec3f sp30; Vec3f sp24; - struct TrackWayPoint *temp_v0; - - temp_v0 = &D_80164550[pathIndex][wayPointIndex]; - sp30[0] = temp_v0->wayPointX; - sp30[1] = temp_v0->wayPointY; - sp30[2] = temp_v0->wayPointZ; - temp_v0 = &D_80164550[pathIndex][(wayPointIndex + 1) % gWaypointCountByPathIndex[pathIndex]]; - sp24[0] = temp_v0->wayPointX; - sp24[1] = temp_v0->wayPointY; - sp24[2] = temp_v0->wayPointZ; + TrackWaypoint *temp_v0; + + temp_v0 = &D_80164550[pathIndex][waypointIndex]; + sp30[0] = temp_v0->posX; + sp30[1] = temp_v0->posY; + sp30[2] = temp_v0->posZ; + temp_v0 = &D_80164550[pathIndex][(waypointIndex + 1) % gWaypointCountByPathIndex[pathIndex]]; + sp24[0] = temp_v0->posX; + sp24[1] = temp_v0->posY; + sp24[2] = temp_v0->posZ; ret = get_angle_between_points(sp30, sp24); return -ret; } // Populates D_80164590 void func_80010DBC(s32 pathIndex) { - s32 wayPointIndex; + s32 waypointIndex; u16 *angle; if ((s32) D_800DCA4C[gCurrentCourseId] >= 0) { - for (angle = &D_80164590[pathIndex][0], wayPointIndex = 0; wayPointIndex < gWaypointCountByPathIndex[pathIndex]; wayPointIndex++, angle++) { - *angle = func_80010CB0(pathIndex, wayPointIndex); + for (angle = &D_80164590[pathIndex][0], waypointIndex = 0; waypointIndex < gWaypointCountByPathIndex[pathIndex]; waypointIndex++, angle++) { + *angle = func_80010CB0(pathIndex, waypointIndex); } } } @@ -5007,7 +5016,7 @@ f32 func_80010FA0(f32 arg0, f32 arg1, f32 arg2, UNUSED s32 arg3) { //generated by m2c commit bece1d6db17040749f77dbbd090363cc6fb926f9 s16 gCurrentCourseId; /* unable to generate initializer */ -s32 func_80011014(struct TrackWayPoint *arg0, struct TrackWayPoint *arg1, s32 arg2, s32 arg3) { +s32 func_80011014(TrackWaypoint *arg0, TrackWaypoint *arg1, s32 arg2, s32 arg3) { f32 spE0; f32 spDC; f32 spD8; @@ -5054,15 +5063,15 @@ s32 func_80011014(struct TrackWayPoint *arg0, struct TrackWayPoint *arg1, s32 ar s32 temp_a2; s32 var_s0; s32 var_s3; - struct TrackWayPoint *temp_a0; - struct TrackWayPoint *temp_v0; - struct TrackWayPoint *temp_v1; - struct TrackWayPoint *var_s1; + TrackWaypoint *temp_a0; + TrackWaypoint *temp_v0; + TrackWaypoint *temp_v1; + TrackWaypoint *var_s1; - temp_f22 = (f32) arg1->wayPointZ; + temp_f22 = (f32) arg1->posZ; var_f30 = 0.0f; var_s1 = arg0; - temp_f20 = (f32) arg1->wayPointX; + temp_f20 = (f32) arg1->posX; var_s0 = 0; var_f28 = func_80010F40(temp_f20, 2000.0f, temp_f22, (s32) gCurrentCourseId, /* extra? */ 0); var_s3 = 0; @@ -5075,17 +5084,17 @@ s32 func_80011014(struct TrackWayPoint *arg0, struct TrackWayPoint *arg1, s32 ar temp_v0 = &arg1[var_s3 % arg2]; temp_v1 = &arg1[temp_a2 % arg2]; temp_a0 = &arg1[(s32) (var_s3 + 2) % arg2]; - temp_f26 = (f32) temp_v0->wayPointX; - temp_f14 = (f32) temp_v0->wayPointZ; - temp_f20_2 = (f32) temp_v1->wayPointX; - temp_f22_2 = (f32) temp_v1->wayPointZ; - spD0 = (f32) temp_a0->wayPointX; + temp_f26 = (f32) temp_v0->posX; + temp_f14 = (f32) temp_v0->posZ; + temp_f20_2 = (f32) temp_v1->posX; + temp_f22_2 = (f32) temp_v1->posZ; + spD0 = (f32) temp_a0->posX; temp_f0 = temp_f20_2 - temp_f26; spDC = temp_f14; temp_f2 = temp_f22_2 - temp_f14; sp84 = temp_a2; spAC = 0.0f; - spCC = (f32) temp_a0->wayPointZ; + spCC = (f32) temp_a0->posZ; temp_f24 = sqrtf((temp_f0 * temp_f0) + (temp_f2 * temp_f2)); temp_f2_2 = spD0 - temp_f20_2; spD8 = temp_f20_2; @@ -5110,15 +5119,15 @@ s32 func_80011014(struct TrackWayPoint *arg0, struct TrackWayPoint *arg1, s32 ar if ((var_f30 > 20.0f) || ((var_s3 == 0) && (var_f20 == 0.0))) { if (gIsMirrorMode != 0) { temp_f12 = -temp_f24_2; - var_s1->wayPointX = (s16) (s32) temp_f12; + var_s1->posX = (s16) (s32) temp_f12; var_f0 = func_80010FA0(temp_f12, var_f28, temp_f26_2, (s32) gCurrentCourseId, /* extra? */ var_s0); } else { - var_s1->wayPointX = (s16) (s32) temp_f24_2; + var_s1->posX = (s16) (s32) temp_f24_2; var_f0 = func_80010FA0(temp_f24_2, var_f28, temp_f26_2, (s32) gCurrentCourseId, /* extra? */ var_s0); } var_f20_2 = var_f0; - var_s1->wayPointZ = (s16) (s32) temp_f26_2; - var_s1->wayPointTrackSegment = func_802ABD40(D_80162E70.unk3A); + var_s1->posZ = (s16) (s32) temp_f26_2; + var_s1->trackSegment = func_802ABD40(D_80162E70.unk3A); temp_f2_4 = (f64) var_f20_2; if (temp_f2_4 < -500.0) { var_f20_2 = var_f28; @@ -5181,7 +5190,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80011014.s") #endif // Returns number of waypoints processed. -s32 process_path_data(struct TrackWayPoint *dest, struct TrackWayPoint *src) { +s32 process_path_data(TrackWaypoint *dest, TrackWaypoint *src) { s16 temp_a0; s16 temp_a2; s16 temp_a3; @@ -5191,21 +5200,21 @@ s32 process_path_data(struct TrackWayPoint *dest, struct TrackWayPoint *src) { var_v1 = 0; for (var_v0 = 0; var_v0 < 0x7D0; var_v0++) { - temp_a0 = src->wayPointX; - temp_a2 = src->wayPointY; - temp_a3 = src->wayPointZ; - temp_t0 = src->wayPointTrackSegment; + temp_a0 = src->posX; + temp_a2 = src->posY; + temp_a3 = src->posZ; + temp_t0 = src->trackSegment; src++; if (((temp_a0 & 0xFFFF) == 0x8000) && ((temp_a2 & 0xFFFF) == 0x8000) && ((temp_a3 & 0xFFFF) == 0x8000)) { break; } if (gIsMirrorMode != 0) { - dest->wayPointX = -temp_a0; + dest->posX = -temp_a0; } else { - dest->wayPointX = temp_a0; + dest->posX = temp_a0; } var_v1++; - dest->wayPointY = temp_a2; - dest->wayPointZ = temp_a3; - dest->wayPointTrackSegment = temp_t0; + dest->posY = temp_a2; + dest->posZ = temp_a3; + dest->trackSegment = temp_t0; dest++; } return var_v1; @@ -5464,27 +5473,31 @@ void func_80011B14(s32 playerId, Player *player) { GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80011B14.s") #endif -#ifdef MIPS_TO_C +// Need to know more about D_801632B0 and D_80162EB8 and D_801632D0 +#ifdef NON_MATCHING //generated by mips_to_c commit bd0364fa19633bd6201f8007e2d0a7ed87825909 //extern ? D_80162EB8; extern s16 D_801630E8[]; -extern s32 D_801632B0; +extern s32 *D_801632B0; void func_80011D48(s32 playerIndex, Player *player) { //s32 temp_a2; //s32 temp_v0; //s32 temp_t3; //void *temp_v1; + u16 test; + s16 temp; // temp_v0 = playerIndex * 2; // * 8) ? //temp_t3 = D_801632D0[playerIndex] + D_80162EB8[gCurrentCourseId]; D_801632B0 = D_801632D0[playerIndex] + D_80162EB8[gCurrentCourseId]; + test = gNearestWaypointByPlayerId[playerIndex]; // temp_a2 = temp_t3; - if (gNearestWaypointByPlayerId[playerIndex] >= D_801632B0) { - switch (D_801632B0) { + if (test >= (u16)*D_801632B0) { + switch (*D_801632B0) { case 1: - player->unk_0BC &= ~0x10; + player->effects &= ~0x10; D_801630E8[playerIndex] = 0; D_801632E8[playerIndex] = 1; break; @@ -5584,7 +5597,6 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_80011EC0.s") #endif extern s16 D_80162EB0; -extern s32 D_8016359C; f32 func_802AE1C0(f32, f32, f32); s32 func_8001168C(void *, void *, s32); @@ -5593,12 +5605,12 @@ s32 func_8001168C(void *, void *, s32); void func_800120C8(void) { s32 i; s16 *temp; - struct TrackWayPoint *waypoint = (struct TrackWayPoint *) VIRTUAL_TO_PHYSICAL2( + TrackWaypoint *waypoint = (TrackWaypoint *) VIRTUAL_TO_PHYSICAL2( gSegmentTable[SEGMENT_NUMBER2(d_course_kalimari_desert_track_unknown_waypoints)] + SEGMENT_OFFSET(d_course_kalimari_desert_track_unknown_waypoints)); for (i = 0; ; i++) { - if ((u16)waypoint[i].wayPointX == 0x8000) { + if ((u16)waypoint[i].posX == 0x8000) { break; } } @@ -5609,13 +5621,13 @@ void func_800120C8(void) { } void func_80012190(void) { - struct TrackWayPoint *tree; + TrackWaypoint *tree; s32 i = 0; - tree = (struct TrackWayPoint *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[SEGMENT_NUMBER2(d_frappe_snowland_tree)] + (SEGMENT_OFFSET(d_frappe_snowland_tree))); + tree = (TrackWaypoint *) VIRTUAL_TO_PHYSICAL2(gSegmentTable[SEGMENT_NUMBER2(d_frappe_snowland_tree)] + (SEGMENT_OFFSET(d_frappe_snowland_tree))); for (i = 0; ; i++) { - if ((u16)tree[i].wayPointX == 0x8000) { + if ((u16)tree[i].posX == 0x8000) { break; } } @@ -5631,12 +5643,12 @@ void func_80012220(VehicleStuff *vehicle) { origXPos = vehicle->position[0]; origZPos = vehicle->position[2]; if (D_8016347A == 0) { - func_8000D6D0(vehicle->position, &vehicle->wayPointIndex, vehicle->someMultiplier, vehicle->someMultiplierTheSequel, 0, 3); + func_8000D6D0(vehicle->position, &vehicle->waypointIndex, vehicle->someMultiplier, vehicle->someMultiplierTheSequel, 0, 3); vehicle->rotation[0] = 0; vehicle->rotation[1] = -0x8000; vehicle->rotation[2] = 0; } else { - func_8000D940(vehicle->position, &vehicle->wayPointIndex, vehicle->someMultiplier, vehicle->someMultiplierTheSequel, 0); + func_8000D940(vehicle->position, &vehicle->waypointIndex, vehicle->someMultiplier, vehicle->someMultiplierTheSequel, 0); vehicle->rotation[0] = 0; vehicle->rotation[1] = 0; vehicle->rotation[2] = 0; @@ -5669,7 +5681,7 @@ void init_course_vehicles(void) { tempLocomotive = &sTrains[loopIndex].locomotive; origXPos = tempLocomotive->position[0]; origZPos = tempLocomotive->position[2]; - trainCarYRot = func_8000DBAC(tempLocomotive->position, &tempLocomotive->wayPointIndex, sTrains[loopIndex].someMultiplier); + trainCarYRot = func_8000DBAC(tempLocomotive->position, &tempLocomotive->waypointIndex, sTrains[loopIndex].someMultiplier); tempLocomotive->velocity[0] = tempLocomotive->position[0] - origXPos; tempLocomotive->velocity[2] = tempLocomotive->position[2] - origZPos; vec3s_set(trainCarRot, 0, trainCarYRot, 0); @@ -5679,7 +5691,7 @@ void init_course_vehicles(void) { if (tempTender->isActive == 1) { origXPos = tempTender->position[0]; origZPos = tempTender->position[2]; - trainCarYRot = func_8000DBAC(tempTender->position, &tempTender->wayPointIndex, sTrains[loopIndex].someMultiplier); + trainCarYRot = func_8000DBAC(tempTender->position, &tempTender->waypointIndex, sTrains[loopIndex].someMultiplier); tempTender->velocity[0] = tempTender->position[0] - origXPos; tempTender->velocity[2] = tempTender->position[2] - origZPos; vec3s_set(trainCarRot, 0, trainCarYRot, 0); @@ -5691,7 +5703,7 @@ void init_course_vehicles(void) { if (tempPassengerCar->isActive == 1) { origXPos = tempPassengerCar->position[0]; origZPos = tempPassengerCar->position[2]; - trainCarYRot = func_8000DBAC(tempPassengerCar->position, &tempPassengerCar->wayPointIndex, sTrains[loopIndex].someMultiplier); + trainCarYRot = func_8000DBAC(tempPassengerCar->position, &tempPassengerCar->waypointIndex, sTrains[loopIndex].someMultiplier); tempPassengerCar->velocity[0] = tempPassengerCar->position[0] - origXPos; tempPassengerCar->velocity[2] = tempPassengerCar->position[2] - origZPos; vec3s_set(trainCarRot, 0, trainCarYRot, 0); @@ -5706,7 +5718,7 @@ void init_course_vehicles(void) { if(tempPaddleWheelBoat->isActive == 1) { origXPos = tempPaddleWheelBoat->position[0]; origZPos = tempPaddleWheelBoat->position[2]; - tempPaddleWheelBoat->yRotation = func_8000DBAC(tempPaddleWheelBoat->position, &tempPaddleWheelBoat->wayPointIndex, tempPaddleWheelBoat->someMultiplier); + tempPaddleWheelBoat->yRotation = func_8000DBAC(tempPaddleWheelBoat->position, &tempPaddleWheelBoat->waypointIndex, tempPaddleWheelBoat->someMultiplier); tempPaddleWheelBoat->velocity[0] = tempPaddleWheelBoat->position[0] - origXPos; tempPaddleWheelBoat->velocity[2] = tempPaddleWheelBoat->position[2] - origZPos; vec3s_set(paddleWheelBoatRot, 0, tempPaddleWheelBoat->yRotation, 0); @@ -5746,7 +5758,7 @@ void func_80012780(TrainCarStuff *trainCar, s16 *arg1, u16 arg2) { trainCar->position[1] = (f32) D_80162EB0; trainCar->position[2] = (f32) arg1[1]; trainCar->actorIndex = -1; - trainCar->wayPointIndex = arg2; + trainCar->waypointIndex = arg2; trainCar->isActive = 0; trainCar->velocity[0] = 0.0f; trainCar->velocity[1] = 0.0f; @@ -5758,11 +5770,10 @@ void func_80012780(TrainCarStuff *trainCar, s16 *arg1, u16 arg2) { //void func_80012780(TrainStuff *, s32, s32); /* extern */ extern s16 D_80162FCC; //extern s32 D_80163598 -extern s32 D_8016359C; // This is really Vec2s D_80163598[465] but that does not match. // Likely because this is a shared pointer between courses. -extern uintptr_t *D_80163598; +//extern uintptr_t *D_80163598; /** * Set waypoint spawn locations for each rolling stock @@ -5868,21 +5879,21 @@ void func_80012AC0(void) { D_80162FCC += 1; for (i = 0; i < NUM_TRAINS; i++) { - temp_s0 = (u16) sTrains[i].locomotive.wayPointIndex; + temp_s0 = (u16) sTrains[i].locomotive.waypointIndex; temp_f20 = sTrains[i].locomotive.position[0]; temp_f22 = sTrains[i].locomotive.position[2]; - temp_v0 = func_8000DBAC(sTrains[i].locomotive.position, &sTrains[i].locomotive.wayPointIndex, sTrains[i].someMultiplier); + temp_v0 = func_8000DBAC(sTrains[i].locomotive.position, &sTrains[i].locomotive.waypointIndex, sTrains[i].someMultiplier); sTrains[i].locomotive.velocity[0] = sTrains[i].locomotive.position[0] - temp_f20; sTrains[i].locomotive.velocity[2] = sTrains[i].locomotive.position[2] - temp_f22; func_80012A48(&sTrains[i].locomotive, temp_v0); - if ((temp_s0 != sTrains[i].locomotive.wayPointIndex) - && ((sTrains[i].locomotive.wayPointIndex == 0x00BE) - || (sTrains[i].locomotive.wayPointIndex == 0x0140))) { + if ((temp_s0 != sTrains[i].locomotive.waypointIndex) + && ((sTrains[i].locomotive.waypointIndex == 0x00BE) + || (sTrains[i].locomotive.waypointIndex == 0x0140))) { func_800C98B8(sTrains[i].locomotive.position, sTrains[i].locomotive.velocity, 0x1901800E); } else if (random_int(100) == 0) { func_800C98B8(sTrains[i].locomotive.position, sTrains[i].locomotive.velocity, 0x1901800D); @@ -5902,7 +5913,7 @@ void func_80012AC0(void) { if (car->isActive == 1) { temp_f20 = car->position[0]; temp_f22 = car->position[2]; - temp_v0 = func_8000DBAC(car->position, &car->wayPointIndex, sTrains[i].someMultiplier); + temp_v0 = func_8000DBAC(car->position, &car->waypointIndex, sTrains[i].someMultiplier); car->velocity[0] = car->position[0] - temp_f20; car->velocity[2] = car->position[2] - temp_f22; func_80012A48(car, temp_v0); @@ -5914,7 +5925,7 @@ void func_80012AC0(void) { temp_f20 = car->position[0]; temp_f22 = car->position[2]; - temp_v0 = func_8000DBAC(car->position, &car->wayPointIndex, sTrains[i].someMultiplier); + temp_v0 = func_8000DBAC(car->position, &car->waypointIndex, sTrains[i].someMultiplier); car->velocity[0] = car->position[0] - temp_f20; car->velocity[2] = car->position[2] - temp_f22; func_80012A48(car, temp_v0); @@ -5973,7 +5984,6 @@ void func_80012DC0(s32 playerId, Player *player) { } } -extern s32 D_8016359C; extern u16 D_801637BC[2]; /** @@ -5989,7 +5999,7 @@ void func_80013054(void) { isCrossingTriggeredByIndex[1] = 0; for (i = 0; i < NUM_TRAINS; i++) { - temp_f16 = sTrains[i].locomotive.wayPointIndex / ((f32) D_8016359C); + temp_f16 = sTrains[i].locomotive.waypointIndex / ((f32) D_8016359C); temp_f18 = 0.72017354f; temp_f12 = 0.42299348f; @@ -6044,19 +6054,19 @@ extern s8 gPlayerCount; void func_800132F4(void) { PaddleWheelBoatStuff *var_a1; s32 i; - struct TrackWayPoint *temp_a2; + TrackWaypoint *temp_a2; u16 temp; for (i = 0; i < 1; i++) { temp = i * 0xB4; var_a1 = &D_801637C0[i]; temp_a2 = &D_80163598[temp]; - var_a1->position[0] = (f32) temp_a2->wayPointX; + var_a1->position[0] = (f32) temp_a2->posX; var_a1->position[1] = (f32) D_80162EB2; - // Shouldn't this be wayPointZ? Something doesn't seem right here. + // Shouldn't this be posZ? Something doesn't seem right here. // Unless temp_a2 has been converted to X,Z with no Y. In-that case our // struct is wrong or the member name is wrong. - var_a1->position[2] = (f32) temp_a2->wayPointY; - var_a1->wayPointIndex = i * 0xB4; + var_a1->position[2] = (f32) temp_a2->posY; + var_a1->waypointIndex = i * 0xB4; var_a1->actorIndex = -1; if (gPlayerCount >= 3) { @@ -6117,7 +6127,7 @@ void func_800133C4(void) { temp_f26 = var_s0->position[0]; temp_f28 = var_s0->position[1]; temp_f30 = var_s0->position[2]; - func_8000DBAC(temp_s2, &var_s0->wayPointIndex, var_s0->someMultiplier); + func_8000DBAC(temp_s2, &var_s0->waypointIndex, var_s0->someMultiplier); temp_v0 = func_800061DC(temp_s2, 2000.0f, var_s0->someFlags); var_s0->someFlags = temp_v0; if ((((s16) D_801630FC % 10) == 0) && (temp_v0 != 0)) { @@ -6143,7 +6153,7 @@ void func_800133C4(void) { sp94 = temp_f26; sp98 = temp_f28; sp9C = temp_f30; - temp_v0_2 = (((s32) ((u16) var_s0->wayPointIndex + 5) % (s32) D_8016359C) * 4) + D_80163598; + temp_v0_2 = (((s32) ((u16) var_s0->waypointIndex + 5) % (s32) D_8016359C) * 4) + D_80163598; sp88 = (f32) temp_v0_2->unk0; sp8C = (f32) D_80162EB0; sp90 = (f32) temp_v0_2->unk2; @@ -6238,21 +6248,21 @@ void func_80013854(Player *player) { extern s16 D_801631C8; extern s16 D_8016347A; -void func_800139E4(f32 arg0, f32 arg1, s32 arg2, s32 arg3, VehicleStuff *vehicle, struct TrackWayPoint *wayPointList) { +void func_800139E4(f32 arg0, f32 arg1, s32 arg2, s32 arg3, VehicleStuff *vehicle, TrackWaypoint *waypointList) { VehicleStuff *veh; - struct TrackWayPoint *temp_v0; + TrackWaypoint *temp_v0; s32 i; u16 waypointOffset; s32 numWaypoints = gWaypointCountByPathIndex[0]; for (i = 0; i < arg2; i++) { waypointOffset = (((i * numWaypoints) / arg2) + arg3) % numWaypoints; veh = &vehicle[i]; - temp_v0 = &wayPointList[waypointOffset]; - veh->position[0] = (f32) temp_v0->wayPointX; - veh->position[1] = (f32) temp_v0->wayPointY; - veh->position[2] = (f32) temp_v0->wayPointZ; + temp_v0 = &waypointList[waypointOffset]; + veh->position[0] = (f32) temp_v0->posX; + veh->position[1] = (f32) temp_v0->posY; + veh->position[2] = (f32) temp_v0->posZ; veh->actorIndex = -1; - veh->wayPointIndex = waypointOffset; + veh->waypointIndex = waypointOffset; veh->unused = 0; veh->velocity[0] = 0.0f; veh->velocity[1] = 0.0f; @@ -6273,9 +6283,9 @@ void func_800139E4(f32 arg0, f32 arg1, s32 arg2, s32 arg3, VehicleStuff *vehicle veh->rotation[0] = 0; veh->rotation[2] = 0; if (D_8016347A == 0) { - veh->rotation[1] = func_8000D6D0(veh->position, &veh->wayPointIndex, veh->someMultiplier, veh->someMultiplierTheSequel, 0, 3); + veh->rotation[1] = func_8000D6D0(veh->position, &veh->waypointIndex, veh->someMultiplier, veh->someMultiplierTheSequel, 0, 3); } else { - veh->rotation[1] = func_8000D940(veh->position, &veh->wayPointIndex, veh->someMultiplier, veh->someMultiplierTheSequel, 0); + veh->rotation[1] = func_8000D940(veh->position, &veh->waypointIndex, veh->someMultiplier, veh->someMultiplierTheSequel, 0); } } D_801631C8 = 10; @@ -6333,7 +6343,7 @@ void func_80013D20(VehicleStuff *vehicle) { sp40[0] = sp58; sp40[1] = 0.0f; sp40[2] = 0.0f; - temp_f0_2 = func_80013C74(vehicle->someType, vehicle->wayPointIndex); + temp_f0_2 = func_80013C74(vehicle->someType, vehicle->waypointIndex); if (vehicle->someMultiplierTheSequel < temp_f0_2) { vehicle->someMultiplierTheSequel = vehicle->someMultiplierTheSequel + 0.06; if (temp_f0_2 < vehicle->someMultiplierTheSequel) { @@ -6347,9 +6357,9 @@ void func_80013D20(VehicleStuff *vehicle) { } } if (D_8016347A == 0) { - var_a1 = func_8000D6D0(vehicle->position, &vehicle->wayPointIndex, vehicle->someMultiplier, vehicle->someMultiplierTheSequel, 0, 3); + var_a1 = func_8000D6D0(vehicle->position, &vehicle->waypointIndex, vehicle->someMultiplier, vehicle->someMultiplierTheSequel, 0, 3); } else { - var_a1 = func_8000D940(vehicle->position, &vehicle->wayPointIndex, vehicle->someMultiplier, vehicle->someMultiplierTheSequel, 0); + var_a1 = func_8000D940(vehicle->position, &vehicle->waypointIndex, vehicle->someMultiplier, vehicle->someMultiplierTheSequel, 0); } func_800224F0(&vehicle->rotation[1], var_a1, 100); temp_f0_3 = vehicle->position[0] - sp5C; @@ -6472,7 +6482,7 @@ void func_80013F7C(s32 playerId, Player *player, VehicleStuff *vehicle, f32 arg3 switch (temp_v1) { /* irregular */ case 0: sp9C = temp_s7 + &D_80163270; - temp_v0_6 = func_80007BF8((u16) var_s0->wayPointIndex, gNearestWaypointByPlayerId[playerId], 0x000AU, 0U, (u16) (s32) temp_v0_5); + temp_v0_6 = func_80007BF8((u16) var_s0->waypointIndex, gNearestWaypointByPlayerId[playerId], 0x000AU, 0U, (u16) (s32) temp_v0_5); temp_v1_2 = *sp9C; if ((temp_v1_2 == 0) && (temp_v0_6 > 0) && (player->unk_094 < var_s0->someMultiplier)) { var_s1 = 1; @@ -6482,7 +6492,7 @@ void func_80013F7C(s32 playerId, Player *player, VehicleStuff *vehicle, f32 arg3 } break; case 1: - if (func_80007BF8((u16) var_s0->wayPointIndex, gNearestWaypointByPlayerId[playerId], 0U, 0x000AU, (u16) (s32) temp_v0_5) > 0) { + if (func_80007BF8((u16) var_s0->waypointIndex, gNearestWaypointByPlayerId[playerId], 0U, 0x000AU, (u16) (s32) temp_v0_5) > 0) { if (random_int(2U) == 0) { temp_v1_3 = *(&D_80163270 + temp_s7); if (temp_v1_3 == 0) { @@ -6604,7 +6614,7 @@ void func_800146B8(s32 playerId, s32 arg1, VehicleStuff *vehicle) { var_s0 = vehicle; if (!((f64) *(&gPlayers->unk_094 + (playerId * 0xDD8)) < 1.6666666666666667) && (var_a2 = 0, (arg1 > 0))) { loop_3: - temp_a1 = (u16) var_s0->wayPointIndex; + temp_a1 = (u16) var_s0->waypointIndex; var_v0 = 0; var_v1 = D_80162FCE; loop_4: @@ -6738,12 +6748,12 @@ void func_80014D08(s32 playerId) { } void func_80014D30(s32 cameraId, s32 pathIndex) { - s16 cameraWayPoint; - struct TrackWayPoint *temp_v0; + s16 cameraWaypoint; + TrackWaypoint *temp_v0; - cameraWayPoint = gNearestWaypointByCameraId[cameraId]; - temp_v0 = &D_80164550[pathIndex][cameraWayPoint]; - func_802ADDC8(&cameras[cameraId].unk_54, 10.0f, (f32) temp_v0->wayPointX, (f32) temp_v0->wayPointY + 30.0f, (f32) temp_v0->wayPointZ); + cameraWaypoint = gNearestWaypointByCameraId[cameraId]; + temp_v0 = &D_80164550[pathIndex][cameraWaypoint]; + func_802ADDC8(&cameras[cameraId].unk_54, 10.0f, (f32) temp_v0->posX, (f32) temp_v0->posY + 30.0f, (f32) temp_v0->posZ); } #ifdef MIPS_TO_C @@ -7043,7 +7053,7 @@ void func_80015544(s32 playerId, f32 arg1, s32 cameraId, s32 pathIndex) { D_801645F8[cameraId] = D_80162FA0[0]; D_80164638[cameraId] = D_80162FA0[2]; - temp_f2 = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].wayPointY; + temp_f2 = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].posY; temp_f12 = func_802AE1C0(D_80162FA0[0], (f32) (temp_f2 + 30.0), D_80162FA0[2]); if ((temp_f12 < (temp_f2 - 20.0)) || (temp_f12 >= 3000.0)) { @@ -7165,7 +7175,7 @@ void func_80015A9C(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) { func_8000BBD8(gNearestWaypointByCameraId[cameraId], arg1, pathIndex); D_801645F8[cameraId] = D_80162FA0[0]; - D_80164618[cameraId] = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].wayPointY; + D_80164618[cameraId] = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].posY; D_80164638[cameraId] = D_80162FA0[2]; D_80164648[cameraId] = gPlayers[playerId].unk_094 / 5.0f; @@ -7237,7 +7247,7 @@ void func_80015C94(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { s32 temp_hi; s32 var_f12; s32 var_s1; - struct TrackWayPoint *temp_v0_2; + TrackWaypoint *temp_v0_2; u16 *temp_t1_2; u16 *temp_t2; u16 temp_t1; @@ -7300,7 +7310,7 @@ block_8: temp_t0 = var_s1 + &D_80164618; temp_f14 = (f32) ((f64) temp_f20 + ((f64) D_80162FA0.unk0 * 0.5)) - *temp_a3_3; temp_t1_2 = var_s1 + &D_80164638; - temp_f6 = (f32) ((f64) (temp_v0_2[(s16) sp78].wayPointY + temp_v0_2[sp7A].wayPointY) * 0.5); + temp_f6 = (f32) ((f64) (temp_v0_2[(s16) sp78].posY + temp_v0_2[sp7A].posY) * 0.5); sp54 = temp_t1_2; sp94 = temp_f6; sp8C = temp_f14; @@ -7366,7 +7376,7 @@ void func_800162CC(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) { func_8000BBD8(gNearestWaypointByCameraId[cameraId], arg1, pathIndex); D_801645F8[cameraId] = D_80162FA0[0]; - D_80164618[cameraId] = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].wayPointY; + D_80164618[cameraId] = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].posY; D_80164638[cameraId] = D_80162FA0[2]; D_80164658[cameraId] = gPlayers[playerId].unk_094; @@ -7456,7 +7466,7 @@ void func_80016494(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { s32 temp_a1; s32 temp_hi; s32 temp_ra; - struct TrackWayPoint *temp_v0_2; + TrackWaypoint *temp_v0_2; u16 *temp_t7; u16 temp_t3; u16 temp_v1_2; @@ -7552,7 +7562,7 @@ void func_80016494(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { sp50 = temp_t0; sp54 = temp_a3; temp_f14 = temp_f4 - *temp_a3; - temp_f6_2 = (f32) ((f64) (temp_v0_2[(s16) sp78].wayPointY + temp_v0_2[sp7A].wayPointY) * 0.5); + temp_f6_2 = (f32) ((f64) (temp_v0_2[(s16) sp78].posY + temp_v0_2[sp7A].posY) * 0.5); temp_f2_4 = (f32) ((f64) temp_f18 + ((f64) D_80162FA0.unk8 * 0.5)) - *temp_t1_3; sp94 = temp_f6_2; sp8C = temp_f14; @@ -7642,7 +7652,7 @@ void func_80016C3C(s32 arg0, s32 arg1, s32 cameraId) { s32 temp_t6_2; s32 temp_t8; s32 var_a3; - struct TrackWayPoint *temp_t7; + TrackWaypoint *temp_t7; u16 temp_s0; if (random_int(0x0064U) < 0x32) { @@ -7676,7 +7686,7 @@ void func_80016C3C(s32 arg0, s32 arg1, s32 cameraId) { *temp_v0 = D_80162FA0.unk0; temp_t3 = var_a3 + &D_80164638; *temp_t3 = D_80162FA0.unk8; - *temp_t2 = (f32) (*D_80164550)[temp_v1_2].wayPointY; + *temp_t2 = (f32) (*D_80164550)[temp_v1_2].posY; *(&D_80164658 + var_a3) = 16.666666f; *(&D_80164648 + var_a3) = 0.0f; sp44 = (u16) ((s32) (temp_v1_2 + 0xB) % (s32) temp_s0); @@ -7694,7 +7704,7 @@ void func_80016C3C(s32 arg0, s32 arg1, s32 cameraId) { temp_v0_2 = &cameras[cameraId]; temp_v0_2->lookAt[0] = (f32) ((f64) temp_f2 + ((f64) D_80162FA0.unk0 * 0.5)); temp_v0_2->lookAt[2] = (f32) ((f64) temp_f12 + ((f64) D_80162FA0.unk8 * 0.5)); - temp_v0_2->lookAt[1] = (f32) ((f64) ((f32) (temp_t7[(s16) ((s32) (temp_v1_3 + 6) % (s32) temp_s0)].wayPointY + temp_t7[(s16) ((s32) (temp_v1_3 + 5) % (s32) temp_s0)].wayPointY) * 0.5f) + 8.0); + temp_v0_2->lookAt[1] = (f32) ((f64) ((f32) (temp_t7[(s16) ((s32) (temp_v1_3 + 6) % (s32) temp_s0)].posY + temp_t7[(s16) ((s32) (temp_v1_3 + 5) % (s32) temp_s0)].posY) * 0.5f) + 8.0); temp_v0_2->pos[0] = (bitwise f32) *sp34; temp_v0_2->pos[1] = *sp2C; temp_v0_2->pos[2] = *sp28; @@ -7741,7 +7751,7 @@ void func_80017054(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { s32 *sp44; s16 *sp40; f32 *sp3C; - struct TrackWayPoint **sp2C; + TrackWaypoint **sp2C; f32 *temp_a2; f32 *temp_t1; f32 temp_f0; @@ -7771,9 +7781,9 @@ void func_80017054(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { s32 temp_t2; s32 temp_t6; s32 temp_v0; - struct TrackWayPoint **temp_t2_2; - struct TrackWayPoint *temp_t0_2; - struct TrackWayPoint *temp_t0_3; + TrackWaypoint **temp_t2_2; + TrackWaypoint *temp_t0_2; + TrackWaypoint *temp_t0_3; temp_t6 = cameraId * 4; temp_t1 = temp_t6 + &D_80164648; @@ -7816,7 +7826,7 @@ void func_80017054(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { temp_t2_2 = &D_80164550[sp5C]; temp_t0_2 = *temp_t2_2; temp_hi = (s32) (temp_a3_4 + 1) % sp58; - sp88 = (f32) (temp_t0_2[(s16) ((s32) (temp_a3_4 + 6) % sp58)].wayPointY + temp_t0_2[(s16) ((s32) (temp_a3_4 + 5) % sp58)].wayPointY) * 0.5f; + sp88 = (f32) (temp_t0_2[(s16) ((s32) (temp_a3_4 + 6) % sp58)].posY + temp_t0_2[(s16) ((s32) (temp_a3_4 + 5) % sp58)].posY) * 0.5f; sp2C = temp_t2_2; sp6C = (u16) ((s32) (temp_a3_4 + 2) % sp58); sp6E = (s16) temp_hi; @@ -7828,7 +7838,7 @@ void func_80017054(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { func_8000BBD8(sp6C, *sp44, unksp3E); temp_t0_3 = *sp2C; temp_a0 = sp4C + &D_801645F8; - temp_f10 = (f32) (temp_t0_3[(s16) sp6C].wayPointY + temp_t0_3[(s16) temp_hi].wayPointY) * 0.5f; + temp_f10 = (f32) (temp_t0_3[(s16) sp6C].posY + temp_t0_3[(s16) temp_hi].posY) * 0.5f; temp_a1_2 = sp4C + &D_80164618; temp_f18 = (f32) ((f64) temp_f14 + ((f64) D_80162FA0.unk0 * 0.5)) - *temp_a0; sp94 = temp_f10; @@ -7890,7 +7900,7 @@ void func_80017720(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) { func_8000BBD8(gNearestWaypointByCameraId[cameraId], D_80163068[playerId], pathIndex); D_801645F8[cameraId] = D_80162FA0[0]; - D_80164618[cameraId] = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].wayPointY; + D_80164618[cameraId] = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].posY; D_80164638[cameraId] = D_80162FA0[2]; D_80164658[cameraId] = gPlayers[playerId].unk_094; @@ -7966,7 +7976,7 @@ void func_800178F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { s32 temp_hi_2; s32 temp_t3; s32 temp_t4; - struct TrackWayPoint *temp_v0_3; + TrackWaypoint *temp_v0_3; u16 temp_ra; temp_v0 = camera->playerId; @@ -8037,7 +8047,7 @@ void func_800178F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { sp40 = temp_v1_2; sp74 = temp_f16_2; sp38 = temp_a2; - sp70 = (f32) ((f64) (temp_v0_3[(s16) sp60].wayPointY + temp_v0_3[sp62].wayPointY) * 0.5) - *temp_a2; + sp70 = (f32) ((f64) (temp_v0_3[(s16) sp60].posY + temp_v0_3[sp62].posY) * 0.5) - *temp_a2; sp6C = (f32) ((f64) temp_f14 + ((f64) D_80162FA0.unk8 * 0.5)) - *temp_a3; temp_f0 = sqrtf((temp_f16_2 * temp_f16_2) + (sp70 * sp70) + (sp6C * sp6C)); if ((f64) temp_f0 != 0.0) { @@ -8084,7 +8094,7 @@ void func_80017F10(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) { func_8000BBD8(gNearestWaypointByCameraId[cameraId], D_80163068[playerId], pathIndex); D_801645F8[cameraId] = D_80162FA0[0]; - D_80164618[cameraId] = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].wayPointY; + D_80164618[cameraId] = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].posY; D_80164638[cameraId] = D_80162FA0[2]; D_80164658[cameraId] = gPlayers[playerId].unk_094; @@ -8160,7 +8170,7 @@ void func_800180F0(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { s32 temp_hi_2; s32 temp_t3; s32 temp_t5; - struct TrackWayPoint *temp_v0_3; + TrackWaypoint *temp_v0_3; u16 temp_ra; u16 temp_t4; @@ -8234,7 +8244,7 @@ void func_800180F0(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { sp40 = temp_v1_2; sp74 = temp_f16_2; sp38 = temp_a2; - sp70 = (f32) ((f64) (temp_v0_3[(s16) sp60].wayPointY + temp_v0_3[sp62].wayPointY) * 0.5) - *temp_a2; + sp70 = (f32) ((f64) (temp_v0_3[(s16) sp60].posY + temp_v0_3[sp62].posY) * 0.5) - *temp_a2; sp6C = (f32) ((f64) temp_f14 + ((f64) D_80162FA0.unk8 * 0.5)) - *temp_a3; temp_f0 = sqrtf((temp_f16_2 * temp_f16_2) + (sp70 * sp70) + (sp6C * sp6C)); if ((f64) temp_f0 != 0.0) { @@ -8282,7 +8292,7 @@ void func_80018718(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) { func_8000BA14(gNearestWaypointByCameraId[cameraId], D_80163068[playerId], 60.0f, pathIndex); D_801645F8[cameraId] = D_80162FA0[0]; - D_80164618[cameraId] = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].wayPointY; + D_80164618[cameraId] = (f32) D_80164550[pathIndex][gNearestWaypointByCameraId[cameraId]].posY; D_80164638[cameraId] = D_80162FA0[2]; D_80164658[cameraId] = gPlayers[playerId].unk_094; @@ -8364,7 +8374,7 @@ void func_800188F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { s32 temp_hi; s32 temp_t4; s32 var_ra; - struct TrackWayPoint *temp_v0; + TrackWaypoint *temp_v0; u16 *temp_t8; u16 *temp_t8_2; u16 temp_t2; @@ -8471,7 +8481,7 @@ void func_800188F4(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { sp8C = temp_f14; sp50 = temp_a3_2; sp5C = temp_v1; - temp_f16 = (f32) ((f64) (temp_v0[(s16) sp78].wayPointY + temp_v0[sp7A].wayPointY) * 0.5) - *temp_a3_2; + temp_f16 = (f32) ((f64) (temp_v0[(s16) sp78].posY + temp_v0[sp7A].posY) * 0.5) - *temp_a3_2; temp_f0 = (f32) ((f64) temp_f18 + ((f64) D_80162FA0.unk8 * 0.5)) - *temp_t1; sp88 = temp_f16; sp84 = temp_f0; @@ -8534,7 +8544,7 @@ void func_80019118(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) { func_8000BBD8(gNearestWaypointByCameraId[cameraId], arg1, 0); D_801645F8[cameraId] = D_80162FA0[0]; D_80164638[cameraId] = D_80162FA0[2]; - temp_f2 = (f32) D_80164550[0][gNearestWaypointByCameraId[cameraId]].wayPointY; + temp_f2 = (f32) D_80164550[0][gNearestWaypointByCameraId[cameraId]].posY; temp_f12 = func_802AE1C0(D_80162FA0[0], (f32) (temp_f2 + 30.0), D_80162FA0[2]); @@ -8580,7 +8590,7 @@ void func_8001933C(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { s32 temp_v1_2; s32 temp_v1_3; s32 var_v1; - struct TrackWayPoint *temp_v0; + TrackWaypoint *temp_v0; u16 temp_a1; temp_v1 = camera->playerId; @@ -8620,9 +8630,9 @@ block_8: camera->pos[1] = *(&D_80164618 + var_v1); camera->pos[2] = *(&D_80164638 + var_v1); temp_v0 = &D_80164550[sp48][sp96]; - camera->lookAt[0] = (f32) (((f64) temp_s2->pos[0] * 0.8) + (0.2 * (f64) temp_v0->wayPointX)); - camera->lookAt[1] = (f32) (((f64) temp_s2->pos[1] * 0.8) + (0.2 * (f64) temp_v0->wayPointY)); - camera->lookAt[2] = (f32) (((f64) temp_s2->pos[2] * 0.8) + (0.2 * (f64) temp_v0->wayPointZ)); + camera->lookAt[0] = (f32) (((f64) temp_s2->pos[0] * 0.8) + (0.2 * (f64) temp_v0->posX)); + camera->lookAt[1] = (f32) (((f64) temp_s2->pos[1] * 0.8) + (0.2 * (f64) temp_v0->posY)); + camera->lookAt[2] = (f32) (((f64) temp_s2->pos[2] * 0.8) + (0.2 * (f64) temp_v0->posZ)); func_80014D30(cameraId, sp48); temp_f12 = camera->lookAt[0] - camera->pos[0]; sp88 = camera->lookAt[1] - camera->pos[1]; @@ -8642,16 +8652,16 @@ void func_8001968C(void) { } void func_8001969C(s32 playerId, f32 arg1, s32 cameraId, s16 pathIndex) { - struct TrackWayPoint *waypoint; + TrackWaypoint *waypoint; gNearestWaypointByCameraId[cameraId] = gWaypointCountByPathIndex[0] - 18; waypoint = &D_80164550[0][gNearestWaypointByCameraId[cameraId]]; - D_801645F8[cameraId] = waypoint->wayPointX; + D_801645F8[cameraId] = waypoint->posX; // @bug Adding an (f32) cast changes asm, why? - D_80164618[cameraId] = waypoint->wayPointY + 10.0; - D_80164638[cameraId] = waypoint->wayPointZ; + D_80164618[cameraId] = waypoint->posY + 10.0; + D_80164638[cameraId] = waypoint->posZ; D_80164648[cameraId] = 0.0f; D_80164678[cameraId] = 0; } @@ -8670,16 +8680,16 @@ void func_80019760(Camera *camera, s32 arg1, s32 arg2, s32 cameraId) { f32 temp_f12; f32 temp_f14; s32 temp_v0; - struct TrackWayPoint *temp_v1; + TrackWaypoint *temp_v1; temp_v0 = cameraId * 4; camera->pos[0] = *(&D_801645F8 + temp_v0); camera->pos[1] = *(&D_80164618 + temp_v0); camera->pos[2] = *(&D_80164638 + temp_v0); temp_v1 = &(*D_80164550)[gNearestWaypointByCameraId[cameraId]]; - camera->lookAt[0] = (f32) temp_v1->wayPointX; - camera->lookAt[1] = (f32) temp_v1->wayPointY; - camera->lookAt[2] = (f32) temp_v1->wayPointZ; + camera->lookAt[0] = (f32) temp_v1->posX; + camera->lookAt[1] = (f32) temp_v1->posY; + camera->lookAt[2] = (f32) temp_v1->posZ; func_80014D30(cameraId, 0); temp_f12 = camera->lookAt[0] - camera->pos[0]; sp28 = camera->lookAt[1] - camera->pos[1]; @@ -9504,7 +9514,7 @@ void func_8001AC10(s32 playerId) { struct Actor *temp_a3_7; struct Actor *temp_a3_8; struct Actor *temp_a3_9; - struct TrackWayPoint *temp_v0_2; + TrackWaypoint *temp_v0_2; struct struct_801642D8 *temp_s0; u16 temp_v0; @@ -9600,9 +9610,9 @@ void func_8001AC10(s32 playerId) { temp_s0->laps += 1; temp_a2 = D_80163478; temp_v0_2 = &D_80164550[*gPathIndexByPlayerId][(s32) (gNearestWaypointByPlayerId[temp_a2] + 0x1E) % (s32) gWaypointCountByPathIndex[gPathIndexByPlayerId[temp_a2]]]; - temp_a3_3->velocity[0] = (f32) ((f64) ((f32) temp_v0_2->wayPointX - sp2C->pos[0]) / 20.0); - temp_a3_3->velocity[1] = (f32) (((f64) ((f32) temp_v0_2->wayPointY - sp2C->pos[1]) / 20.0) + 4.0); - temp_a3_3->velocity[2] = (f32) ((f64) ((f32) temp_v0_2->wayPointZ - sp2C->pos[2]) / 20.0); + temp_a3_3->velocity[0] = (f32) ((f64) ((f32) temp_v0_2->posX - sp2C->pos[0]) / 20.0); + temp_a3_3->velocity[1] = (f32) (((f64) ((f32) temp_v0_2->posY - sp2C->pos[1]) / 20.0) + 4.0); + temp_a3_3->velocity[2] = (f32) ((f64) ((f32) temp_v0_2->posZ - sp2C->pos[2]) / 20.0); temp_a3_3->pos[1] = sp2C->pos[1]; func_800C92CC(playerId & 0xFF, 0x29008009, temp_a2 * 2, temp_a3_3); func_800C98B8(sp2C->pos, sp2C->velocity, 0x19018014U); @@ -9941,7 +9951,7 @@ extern u16 D_80163410[]; // One per player? void func_8001BE78(void) { Player* temp_s1; - struct TrackWayPoint* temp_s0; + TrackWaypoint* temp_s0; s32 i; func_8000F628(); @@ -9967,9 +9977,9 @@ void func_8001BE78(void) { break; } temp_s0 = &D_80164550[i][gNearestWaypointByPlayerId[i]]; - temp_s1->pos[0] = (f32) temp_s0->wayPointX; - temp_s1->pos[1] = func_802AE1C0((f32) temp_s0->wayPointX, 2000.0f, (f32) temp_s0->wayPointZ) + temp_s1->boundingBoxSize; - temp_s1->pos[2] = (f32) temp_s0->wayPointZ; + temp_s1->pos[0] = (f32) temp_s0->posX; + temp_s1->pos[1] = func_802AE1C0((f32) temp_s0->posX, 2000.0f, (f32) temp_s0->posZ) + temp_s1->boundingBoxSize; + temp_s1->pos[2] = (f32) temp_s0->posZ; temp_s1->unk_02C[1] = (s16) *D_80164590[i]; func_8003680C(temp_s1, 0); temp_s1++; @@ -10091,7 +10101,7 @@ GLOBAL_ASM("asm/non_matchings/code_80005FD0/func_8001C14C.s") void func_8001C3C4(s32 arg0) { if (gCurrentCourseId == COURSE_AWARD_CEREMONY) { - if (D_80163DE8[0].wayPointIndex >= 16) { + if (D_80163DE8[0].waypointIndex >= 16) { func_80057114(3); } } else { |
