30 for (i = 0; i < 3000; i++, ptr++) {
31 if ((
u16) ptr->
posX == 0x8000) {
75 pathPointIndex++, var_s1++, var_s2++) {
81 x2 = nextPathPoint->
posX;
82 y2 = nextPathPoint->
posY;
83 z2 = nextPathPoint->
posZ;
88 xz_dist =
sqrtf((x_dist * x_dist) + (z_dist * z_dist));
89 temp_f16 = (
f32) ((y1 + y2) * 0.5);
93 var_s1->posX = ((pathPointWidth * z_dist) / xz_dist) + x1;
94 var_s1->posY = temp_f16;
95 var_s1->posZ = ((pathPointWidth * neg_x_dist) / xz_dist) + z1;
99 var_s2->
posX = ((pathPointWidth * neg_z_dist) / xz_dist) + x1;
100 var_s2->
posY = temp_f16;
101 var_s2->
posZ = ((pathPointWidth * x_dist) / xz_dist) + z1;
143 pathPoint1 = &pathPathPoints[pathPointIndex];
144 pathPoint2 = &pathPathPoints[(pathPointIndex + 1) % pathPointCount];
145 pathPoint3 = &pathPathPoints[(pathPointIndex + 2) % pathPointCount];
147 x1 = pathPoint1->
posX;
148 z1 = pathPoint1->
posZ;
149 x2 = pathPoint2->
posX;
150 z2 = pathPoint2->
posZ;
151 x3 = pathPoint3->
posX;
152 z3 = pathPoint3->
posZ;
154 firstVectorX = (((x2 + x3) * 0.5) - x1);
155 firstVectorZ = (((z2 + z3) * 0.5) - z1);
157 pathPoint1 = &pathPathPoints[(pathPointIndex + 3) % pathPointCount];
158 pathPoint2 = &pathPathPoints[(pathPointIndex + 4) % pathPointCount];
159 pathPoint3 = &pathPathPoints[(pathPointIndex + 5) % pathPointCount];
161 x1 = pathPoint1->
posX;
162 z1 = pathPoint1->
posZ;
163 x2 = pathPoint2->
posX;
164 z2 = pathPoint2->
posZ;
165 x3 = pathPoint3->
posX;
166 z3 = pathPoint3->
posZ;
168 secondVectorX = (((x2 + x3) * 0.5) - x1);
169 secondVectorZ = (((z2 + z3) * 0.5) - z1);
171 firstLength =
sqrtf((firstVectorZ * firstVectorZ) + (firstVectorX * firstVectorX));
172 secondLength =
sqrtf((secondVectorX * secondVectorX) + (secondVectorZ * secondVectorZ));
173 return -((firstVectorZ * secondVectorX) - (firstVectorX * secondVectorZ)) / (secondLength * firstLength);
177 f64 sectionCurvature;
189 for (i = 0; i < pathPointCount; i++, currentSection++) {
192 if (sectionCurvature > 0.1) {
195 if (sectionCurvature < -0.1) {
200 for (i = 0; i < pathPointCount; i++, currentSection++) {
203 for (
j = 1;
j < pathPointCount;
j++) {
205 switch (*nextSection) {
208 for (k = 0; k <
j; k++) {
217 for (k = 0; k <
j; k++) {
239 sp30[0] = temp_v0->
posX;
240 sp30[1] = temp_v0->
posY;
241 sp30[2] = temp_v0->
posZ;
243 sp24[0] = temp_v0->
posX;
244 sp24[1] = temp_v0->
posY;
245 sp24[2] = temp_v0->
posZ;
264 s16* trackCurveCount;
268 s16* trackSectionType;
275 for (i = 0; i < pathPointCount; i++) {
277 for (
j = 0;
j < pathPointCount;
j++) {
278 temp_t0 = trackSectionType[(i +
j) % pathPointCount];
288 *trackCurveCount = curveCount;
337 temp_f20 = (
f32) path[0].posX;
338 temp_f22 = (
f32) path[0].posZ;
341 for (i = 0; i < numPathPoints; i++) {
342 point1 = &path[i % numPathPoints];
343 point2 = &path[(i + 1) % numPathPoints];
344 point3 = &path[(
s32) (i + 2) % numPathPoints];
349 x3 = (
f32) point3->posX;
350 z3 = (
f32) point3->posZ;
352 temp = 0.05 / (
sqrtf(((x2 - x1) * (x2 - x1)) + ((z2 - z1) * (z2 - z1))) +
353 (
sqrtf(((x3 - x2) * (x3 - x2)) + ((z3 - z2) * (z3 - z2)))));
355 for (
j = 0.0f;
j <= 1.0;
j += temp) {
357 temp_f2_3 = (
f32) ((1.0 -
j) * 0.5 * (1.0 -
j));
358 z1_3 = (
f32) (((1.0 -
j) *
j) + 0.5);
359 temp_f16 = (
f32) (
j * 0.5 *
j);
361 temp_f24_2 = (temp_f2_3 * x1) + (z1_3 * x2) + (temp_f16 * x3);
362 x1_2 = (temp_f2_3 * z1) + (z1_3 * z2) + (temp_f16 * z3);
365 sqrtf(((temp_f24_2 - temp_f20) * (temp_f24_2 - temp_f20)) + ((x1_2 - temp_f22) * (x1_2 - temp_f22)));
367 temp_f20 = temp_f24_2;
370 if ((var_f30 > 20.0f) || ((i == 0) && (
j == 0.0))) {
373 pathDest->
posX = (
s16) -temp_f24_2;
376 pathDest->
posX = (
s16) temp_f24_2;
380 pathDest->
posZ = (
s16) temp_f22;
383 if (var_f20_2 < -500.0) {
389 if (var_f20_2 < (var_f28 - 15.0)) {
390 var_f20_2 = (
f32) var_f28 - 15.0;
394 if ((var_s0 >= 1140) && (var_s0 <= 1152)) {
397 if (var_f20_2 < (var_f28 - 10.0)) {
398 var_f20_2 = (
f32) (var_f28 - 4.0);
403 if ((var_s0 > 204) && (var_s0 < 220)) {
406 if (var_f20_2 < (var_f28 - 10.0)) {
407 var_f20_2 = (
f32) (var_f28 - 4.0);
412 if (var_f20_2 < (var_f28 - 10.0)) {
413 var_f20_2 = (
f32) var_f28 - 10.0;
439 for (var_v0 = 0; var_v0 < 0x7D0; var_v0++) {
445 if (((temp_a0 & 0xFFFF) == 0x8000) && ((temp_a2 & 0xFFFF) == 0x8000) && ((temp_a3 & 0xFFFF) == 0x8000)) {
449 dest->
posX = -temp_a0;
451 dest->
posX = temp_a0;
454 dest->
posY = temp_a2;
455 dest->
posZ = temp_a3;
492 spA8 = pathSrc[0].
posX;
493 spA0 = pathSrc[0].
posZ;
496 for (i = 0; i < numPathPoints; i++) {
497 point1 = &pathSrc[((i % numPathPoints))];
498 point2 = &pathSrc[(((i + 1) % numPathPoints))];
499 point3 = &pathSrc[(((i + 2) % numPathPoints))];
507 sp7C = 0.05 / (
sqrtf(((x2 - x1) * (x2 - x1)) + ((z2 - z1) * (z2 - z1))) +
508 sqrtf(((x3 - x2) * (x3 - x2)) + ((z3 - z2) * (z3 - z2))));
510 for (
j = 0.0f;
j <= 1.0;
j += sp7C) {
511 temp_f2_3 = (1.0 -
j) * 0.5 * (1.0 -
j);
512 temp_f14_3 = ((1.0 -
j) *
j) + 0.5;
513 temp_f16_2 =
j * 0.5 *
j;
515 temp_f24 = (temp_f2_3 * x1) + (temp_f14_3 * x2) + (temp_f16_2 * x3);
516 temp_f26 = (temp_f2_3 * z1) + (temp_f14_3 * z2) + (temp_f16_2 * z3);
517 temp_f6 +=
sqrtf(((temp_f24 - spA8) * (temp_f24 - spA8)) + ((temp_f26 - spA0) * (temp_f26 - spA0)));
520 if ((temp_f6 > 20.0f) || ((i == 0) && (
j == 0.0))) {
522 pathDest->
x = (
s16) -spA8;
524 pathDest->
x = (
s16) spA8;
s16 gCurrentCourseId
Definition code_800029B0.c:30
s32 gIsMirrorMode
Definition code_800029B0.c:64
s16 get_track_section_id(u16 index)
Definition collision.c:509
u16 check_bounding_collision(Collision *collision, f32 boundingBoxSize, f32 posX, f32 posY, f32 posZ)
Definition collision.c:1358
f32 get_surface_height(f32 posX, f32 posY, f32 posZ)
Returns the height of the surface below the provided position. Used to set actors onto the course mes...
Definition collision.c:1470
f32 Vec3f[3]
Definition common_structs.h:6
#define GET_COURSE_PathTable2(p)
Definition course.h:97
@ COURSE_WARIO_STADIUM
Definition course.h:45
@ COURSE_RAINBOW_ROAD
Definition course.h:44
@ COURSE_DK_JUNGLE
Definition course.h:49
@ COURSE_AWARD_CEREMONY
Definition course.h:51
#define GET_COURSE_AIMaximumSeparation
Definition course.h:87
#define GET_COURSE_PathTable(p)
Definition course.h:95
Collision D_80162E70
Definition cpu_vehicles_camera_path.c:36
u16 gPathCountByPathIndex[4]
Definition cpu_vehicles_camera_path.c:181
s16 * gTrackSectionTypes[4]
Definition cpu_vehicles_camera_path.c:177
s16 * gPathExpectedRotation[4]
Definition cpu_vehicles_camera_path.c:178
TrackPathPoint * gTrackPaths[4]
Definition cpu_vehicles_camera_path.c:174
TrackPathPoint * gTrackRightPaths[4]
Definition cpu_vehicles_camera_path.c:176
s16 * gTrackConsecutiveCurveCounts[4]
Definition cpu_vehicles_camera_path.c:179
TrackPathPoint * gTrackLeftPaths[4]
Definition cpu_vehicles_camera_path.c:175
#define UNUSED
Definition macros.h:23
s32 get_angle_between_two_vectors(Vec3f arg0, Vec3f arg1)
Definition math_util.c:84
@ STRAIGHT
Definition path.h:18
@ RIGHT_LEANING_CURVE
Definition path.h:14
@ RIGHT_CURVE
Definition path.h:16
@ LEFT_LEANING_CURVE
Definition path.h:15
@ LEFT_CURVE
Definition path.h:17
s16 calculate_angle_path(s32 pathIndex, s32 pathPointIndex)
Definition path_calc.inc.c:232
void analize_track_section(s32 pathIndex)
Definition path_calc.inc.c:176
void analisze_curved_path(s32 pathIndex)
Definition path_calc.inc.c:263
s32 process_path_data(TrackPathPoint *dest, TrackPathPoint *src)
Definition path_calc.inc.c:430
void calculate_track_boundaries(s32 pathIndex)
Definition path_calc.inc.c:49
s32 generate_2d_path(Path2D *pathDest, TrackPathPoint *pathSrc, s32 numPathPoints)
Definition path_calc.inc.c:462
f32 func_80010F40(f32 arg0, f32 arg1, f32 arg2, UNUSED s32 arg3, UNUSED s32 arg4)
Definition path_calc.inc.c:293
s32 func_80011014(TrackPathPoint *pathDest, TrackPathPoint *path, s32 numPathPoints, UNUSED s32 pathIndex)
Definition path_calc.inc.c:308
f32 calculate_track_curvature(s32 pathIndex, u16 pathPointIndex)
Definition path_calc.inc.c:117
f32 func_80010FA0(f32 arg0, f32 arg1, f32 arg2, UNUSED s32 arg3, UNUSED s32 arg4)
Definition path_calc.inc.c:299
void load_track_path(s32 pathIndex)
Definition path_calc.inc.c:6
void analyse_angle_path(s32 pathIndex)
Definition path_calc.inc.c:251
u16 meshIndexZX
Definition common_structs.h:139
Definition cpu_vehicles_camera_path.h:47
s16 z
Definition cpu_vehicles_camera_path.h:49
s16 x
Definition cpu_vehicles_camera_path.h:48
s16 posX
Definition path.h:7
u16 trackSectionId
Definition path.h:10
s16 posZ
Definition path.h:9
s16 posY
Definition path.h:8
signed int s32
Definition ultratypes.h:15
signed short int s16
Definition ultratypes.h:13
float f32
Definition ultratypes.h:34
double f64
Definition ultratypes.h:35
unsigned short int u16
Definition ultratypes.h:14