1#define GET_PATH_LENGTH(pathPoint) \
3 if ((u16) pathPoint[i].posX == 0x8000) { \
72 Vec3s paddleWheelBoatRot;
78#if !ENABLE_CUSTOM_COURSE_ENGINE
81 for (loopIndex = 0; loopIndex <
NUM_TRAINS; loopIndex++) {
83 origXPos = tempLocomotive->
position[0];
84 origZPos = tempLocomotive->
position[2];
89 vec3s_set(trainCarRot, 0, trainCarYRot, 0);
101 vec3s_set(trainCarRot, 0, trainCarYRot, 0);
108 if (tempPassengerCar->
isActive == 1) {
109 origXPos = tempPassengerCar->
position[0];
110 origZPos = tempPassengerCar->
position[2];
116 vec3s_set(trainCarRot, 0, trainCarYRot, 0);
127 if (tempPaddleWheelBoat->
isActive == 1) {
128 origXPos = tempPaddleWheelBoat->
position[0];
129 origZPos = tempPaddleWheelBoat->
position[2];
132 tempPaddleWheelBoat->
speed);
133 tempPaddleWheelBoat->
velocity[0] = tempPaddleWheelBoat->
position[0] - origXPos;
134 tempPaddleWheelBoat->
velocity[2] = tempPaddleWheelBoat->
position[2] - origZPos;
135 vec3s_set(paddleWheelBoatRot, 0, tempPaddleWheelBoat->
rotY, 0);
162 for (loopIndex = 0; loopIndex <
NUM_RACE_CARS; loopIndex++) {
206 pathPointOffset += 4;
212 pathPointOffset += 3;
217 pathPointOffset += 4;
270 trainCarActor->
rot[1] = -orientationY;
272 trainCarActor->
rot[1] = orientationY;
282 u16 oldPathPointIndex;
283 s16 orientationYUpdate;
292 oldPathPointIndex = (
u16)
gTrainList[i].locomotive.pathPointIndex;
305 if ((oldPathPointIndex !=
gTrainList[i].locomotive.pathPointIndex) &&
361 s32 passengerCarIndex;
365 playerPosX = player->
pos[0];
366 playerPosZ = player->
pos[2];
367 for (trainIndex = 0; trainIndex <
NUM_TRAINS; trainIndex++) {
369 x_dist = playerPosX - trainCar->
position[0];
370 z_dist = playerPosZ - trainCar->
position[2];
371 if ((x_dist > -100.0) && (x_dist < 100.0)) {
372 if ((z_dist > -100.0) && (z_dist < 100.0)) {
374 trainCar->
velocity[2], 60.0f, 20.0f, playerPosX, playerPosZ) == 1) {
381 playerPosX, playerPosZ) == 1) {
390 x_dist = playerPosX - trainCar->
position[0];
391 z_dist = playerPosZ - trainCar->
position[2];
393 if ((x_dist > -100.0) && (x_dist < 100.0)) {
394 if ((z_dist > -100.0) && (z_dist < 100.0)) {
397 playerPosX, playerPosZ) == 1) {
423 temp_f18 = 0.72017354f;
424 temp_f12 = 0.42299348f;
426 if (((temp_f12 - 0.1) < temp_f16) &&
427 (temp_f16 < ((((
f64)
gTrainList[i].numCars) * 0.01) + (temp_f12 + 0.01)))) {
431 if (((temp_f18 - 0.1) < temp_f16) &&
432 (temp_f16 < ((((
f64)
gTrainList[i].numCars) * 0.01) + (temp_f18 + 0.01)))) {
491 paddleBoat->
speed = 1.6666666f;
492 paddleBoat->
rotY = 0;
501 struct Actor* paddleBoatActor;
546 sp88[0] = (
f32) pathPoint->
x;
548 sp88[2] = (
f32) pathPoint->
z;
550 temp = temp_a1 - paddleBoat->
rotY;
555 if (var_v1 >= 0x1771) {
556 if (paddleBoat->
speed > 0.2) {
557 paddleBoat->
speed -= 0.04;
559 if (var_v1 >= 0x3D) {
563 if (paddleBoat->
speed < 2.0) {
564 paddleBoat->
speed += 0.02;
566 if (var_v1 >= 0x1F) {
570 if (temp >= 0x8000) {
571 paddleBoat->
rotY -= var_v1;
572 }
else if (temp > 0) {
573 paddleBoat->
rotY += var_v1;
574 }
else if (temp < -0x7FFF) {
575 paddleBoat->
rotY += var_v1;
576 }
else if (temp < 0) {
577 paddleBoat->
rotY -= var_v1;
587 paddleBoatActor->
rot[1] = -paddleBoat->
rotY;
589 paddleBoatActor->
rot[1] = paddleBoat->
rotY;
609 playerX = player->
pos[0];
610 playerY = player->
pos[1];
611 playerZ = player->
pos[2];
614 if (tempPaddleWheelBoat->
isActive == 1) {
615 x_diff = playerX - tempPaddleWheelBoat->
position[0];
616 y_diff = playerY - tempPaddleWheelBoat->
position[1];
617 z_diff = playerZ - tempPaddleWheelBoat->
position[2];
618 if ((x_diff > -300.0) && (x_diff < 300.0)) {
619 if ((z_diff > -300.0) && (z_diff < 300.0)) {
622 200.0f, 60.0f, playerX, playerZ) == 1) &&
640 for (i = 0; i < numVehicles; i++) {
641 pathPointOffset = (((i * numPathPoints) / numVehicles) + arg3) % numPathPoints;
642 veh = &vehicleList[i];
643 temp_v0 = &pathPointList[pathPointOffset];
683 if (pathPointIndex < 0x28A) {
723 struct Actor* vehicleActor;
734 if (temp_f0_2 < vehicle->someMultiplierTheSequel) {
738 if (temp_f0_2 < vehicle->someMultiplierTheSequel) {
752 temp_f0_3 = vehicle->
position[0] - sp5C;
753 temp_f2_2 = vehicle->
position[2] - sp54;
756 sp34[2] =
sqrtf((temp_f0_3 * temp_f0_3) + (temp_f2_2 * temp_f2_2));
779 s32 vehicleCount,
u32 soundBits) {
793 playerX = player->
pos[0];
794 playerY = player->
pos[1];
795 playerZ = player->
pos[2];
797 for (i = 0; i < vehicleCount; i++) {
798 deltaX = playerX - vehicle->
position[0];
799 deltaY = playerY - vehicle->
position[1];
800 deltaZ = playerZ - vehicle->
position[2];
802 if (((deltaX) > -100.0) && ((deltaX) < 100.0)) {
803 if ((deltaY > -20.0) && (deltaY < 20.0)) {
804 if (((deltaZ) > -100.0) && ((deltaZ) < 100.0)) {
806 vehicle->
velocity[2], distanceX, distanceY, playerX,
807 playerZ) == (
s32) 1) {
816 if (((deltaX) > -300.0) && ((deltaX) < 300.0) && ((deltaY > -20.0)) && (deltaY < 20.0) &&
817 (((deltaZ) > -300.0)) && ((deltaZ) < 300.0)) {
833 if (((deltaX) > -200.0) && ((deltaX) < 200.0) && ((deltaY > -20.0)) && (deltaY < 20.0) &&
834 (((deltaZ) > -200.0)) && ((deltaZ) < 200.0)) {
837 bool shouldInteract =
false;
848 shouldInteract =
true;
851 shouldInteract =
true;
861 shouldInteract =
true;
865 shouldInteract =
true;
873 if (shouldInteract ==
true) {
922 if (pathIndex < 0x28A) {
965 u16 vehiclePathPoint;
969 if (!(
gPlayers[playerId].speed < 1.6666666666666667)) {
970 for (var_s2 = 0; var_s2 < vehicleCount; var_s2++, vehicle++) {
972 for (pathPointOffset = 0; pathPointOffset < 0x18; pathPointOffset += 3) {
1079 for (loopIndex = 0; loopIndex <
NUM_RACE_CARS; loopIndex++) {
@ ACTOR_PADDLE_BOAT
Definition actor_types.h:76
@ ACTOR_SCHOOL_BUS
Definition actor_types.h:78
@ ACTOR_TRAIN_ENGINE
Definition actor_types.h:53
@ ACTOR_TRAIN_TENDER
Definition actor_types.h:54
@ ACTOR_TANKER_TRUCK
Definition actor_types.h:79
@ ACTOR_TRAIN_PASSENGER_CAR
Definition actor_types.h:55
@ ACTOR_CAR
Definition actor_types.h:82
@ ACTOR_BOX_TRUCK
Definition actor_types.h:75
s16 add_actor_to_empty_slot(Vec3f pos, Vec3s rot, Vec3f velocity, s16 actorType)
Definition actors.c:1448
s16 gCurrentCourseId
Definition code_800029B0.c:30
struct Actor gActorList[ACTOR_LIST_SIZE]
Definition code_800029B0.c:150
s32 gIsMirrorMode
Definition code_800029B0.c:64
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
s16 Vec3s[3]
Definition common_structs.h:11
@ COURSE_KALAMARI_DESERT
Definition course.h:42
@ COURSE_TOADS_TURNPIKE
Definition course.h:41
@ COURSE_DK_JUNGLE
Definition course.h:49
TrainStuff gTrainList[NUM_TRAINS]
Definition cpu_vehicles_camera_path.c:140
u16 gPathCountByPathIndex[4]
Definition cpu_vehicles_camera_path.c:181
u16 D_801631E0[12]
Definition cpu_vehicles_camera_path.c:86
VehicleStuff gSchoolBusList[NUM_RACE_SCHOOL_BUSES]
Definition cpu_vehicles_camera_path.c:145
s32 gVehicle2DPathLength
Definition cpu_vehicles_camera_path.c:139
u16 gIsPlayerWrongDirection[12]
Definition cpu_vehicles_camera_path.c:93
void adjust_position_by_angle(Vec3f newPos, Vec3f oldPos, s16 orientationY)
Definition cpu_vehicles_camera_path.c:588
s16 D_80162EB2
Definition cpu_vehicles_camera_path.c:38
s32 set_vehicle_render_distance_flags(Vec3f vehiclePos, f32 renderDistance, s32 flags)
Definition cpu_vehicles_camera_path.c:609
s16 get_angle_between_path(Vec3f arg0, Vec3f arg1)
Definition cpu_vehicles_camera_path.c:555
TrackPathPoint * gTrackPaths[4]
Definition cpu_vehicles_camera_path.c:174
u16 isCrossingTriggeredByIndex[NUM_CROSSINGS]
Definition cpu_vehicles_camera_path.c:141
bool is_collide_with_vehicle(f32 vehicleX, f32 vehicleY, f32 vehicleVelocityX, f32 vehicleVelocityZ, f32 distanceX, f32 distanceY, f32 playerX, f32 playerZ)
Definition cpu_vehicles_camera_path.c:567
f32 gTrackPositionFactor[10]
Definition cpu_vehicles_camera_path.c:68
VehicleStuff gCarList[NUM_RACE_CARS]
Definition cpu_vehicles_camera_path.c:147
Path2D * gVehicle2DPathPoint
Definition cpu_vehicles_camera_path.c:138
u16 sCrossingActiveTimer[NUM_CROSSINGS]
Definition cpu_vehicles_camera_path.c:142
s16 gTrainSmokeTimer
Definition cpu_vehicles_camera_path.c:54
s16 gIsInExtra
Definition cpu_vehicles_camera_path.c:123
TrackPositionFactorInstruction gPlayerTrackPositionFactorInstruction[10]
Definition cpu_vehicles_camera_path.c:137
s32 is_path_point_in_range(u16 pathPoint, u16 currentPathPoint, u16 backwardRange, u16 forwardRange, u16 totalPathPoints)
Definition cpu_vehicles_camera_path.c:933
s16 bStopAICrossing[10]
Definition cpu_vehicles_camera_path.c:133
s16 sSomeNearestPathPoint
Definition cpu_vehicles_camera_path.c:55
s16 sVehicleSoundRenderCounter
Definition cpu_vehicles_camera_path.c:80
PaddleBoatStuff gPaddleBoats[NUM_PADDLE_BOATS]
Definition cpu_vehicles_camera_path.c:143
s16 gFerrySmokeTimer
Definition cpu_vehicles_camera_path.c:74
s16 D_80162EB0
Definition cpu_vehicles_camera_path.c:37
u16 gNearestPathPointByPlayerId[12]
Definition cpu_vehicles_camera_path.c:163
VehicleStuff gTankerTruckList[NUM_RACE_TANKER_TRUCKS]
Definition cpu_vehicles_camera_path.c:146
VehicleStuff gBoxTruckList[NUM_RACE_BOX_TRUCKS]
Definition cpu_vehicles_camera_path.c:144
s16 func_8000D6D0(Vec3f, s16 *, f32, f32, s16, s16)
Definition path_utils.inc.c:662
s16 func_8000D940(Vec3f, s16 *, f32, f32, s16)
Definition path_utils.inc.c:728
s16 update_vehicle_following_path(Vec3f, s16 *, f32)
Definition path_utils.inc.c:794
s32 generate_2d_path(Path2D *, TrackPathPoint *, s32)
Definition path_calc.inc.c:462
#define HIT_BY_ITEM_EFFECT
Definition defines.h:342
#define UNKNOWN_EFFECT_0x1000000
Definition defines.h:341
#define SCREEN_MODE_2P_SPLITSCREEN_VERTICAL
Definition defines.h:200
#define SCREEN_MODE_2P_SPLITSCREEN_HORIZONTAL
Definition defines.h:199
#define SCREEN_MODE_1P
Options for gScreenModeSelection and gActiveScreenMode.
Definition defines.h:198
#define CC_50
Options for gCCSelection CC stands for cubic-centimetres. It measures engine displacement composed fr...
Definition defines.h:134
#define REVERSE_SOUND_EFFECT
Definition defines.h:318
#define GRAND_PRIX
Options for gModeSelection.
Definition defines.h:121
#define PLAYER_HUMAN
Definition defines.h:79
#define PLAYER_CPU
Definition defines.h:77
#define TIME_TRIALS
Definition defines.h:122
TrackPathPoint d_course_dks_jungle_parkway_ferry_path[]
Definition course_data.c:4003
void func_800C9EF4(Vec3f arg0, u32 soundBits)
Definition external.c:3137
void func_800C9D80(Vec3f position, Vec3f velocity, u32 soundBits)
Definition external.c:3118
void func_800C98B8(Vec3f position, Vec3f velocity, u32 soundBits)
Definition external.c:3030
TrackPathPoint d_course_kalimari_desert_train_path[]
Definition course_data.c:3005
#define VIRTUAL_TO_PHYSICAL2(addr)
Definition macros.h:93
#define UNUSED
Definition macros.h:23
Player gPlayers[NUM_PLAYERS]
Definition main.c:68
s32 gScreenModeSelection
Definition main.c:174
s32 gCCSelection
Definition main.c:181
uintptr_t gSegmentTable[16]
Definition main.c:128
s32 gModeSelection
Definition main.c:178
u16 random_int(u16 arg0)
Definition math_util.c:1064
s32 get_angle_between_two_vectors(Vec3f arg0, Vec3f arg1)
Definition math_util.c:84
void vec3s_set(Vec3s arg0, s16 arg1, s16 arg2, s16 arg3)
Definition math_util.c:109
#define SEGMENT_OFFSET(a)
Definition mbi.h:89
#define SEGMENT_NUMBER2(a)
Definition mbi.h:91
bool adjust_angle(s16 *angle, s16 targetAngle, s16 step)
Definition render_player.c:807
#define SOUND_ARG_LOAD(sound_bank, byte2, byte3, sound_id)
Definition sounds.h:14
Definition actor_types.h:120
Vec3s rot
Definition actor_types.h:127
Vec3f velocity
Definition actor_types.h:130
Vec3f pos
Definition actor_types.h:129
s32 someFlags
Definition vehicles.h:72
Vec3f velocity
Definition vehicles.h:62
s16 isActive
Definition vehicles.h:59
u16 pathPointIndex
Definition vehicles.h:63
f32 speed
Definition vehicles.h:65
s16 rotY
Definition vehicles.h:66
s16 actorIndex
Definition vehicles.h:64
Vec3f position
Definition vehicles.h:61
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
Definition common_structs.h:249
f32 speed
Definition common_structs.h:284
u32 effects
Definition common_structs.h:298
u16 type
Definition common_structs.h:250
s32 soundEffects
Definition common_structs.h:256
Vec3f pos
Definition common_structs.h:259
s16 posX
Definition path.h:7
s16 posZ
Definition path.h:9
s16 posY
Definition path.h:8
f32 target
Definition cpu_vehicles_camera_path.h:23
Vec3f position
Definition vehicles.h:41
Vec3f velocity
Definition vehicles.h:42
s16 actorIndex
Definition vehicles.h:44
u16 pathPointIndex
Definition vehicles.h:43
s16 isActive
Definition vehicles.h:39
Definition actor_types.h:144
Vec3f pos
Definition actor_types.h:153
Vec3f velocity
Definition actor_types.h:154
Vec3s rot
Definition actor_types.h:151
s32 someFlags
Definition vehicles.h:53
TrainCarStuff locomotive
Definition vehicles.h:49
f32 speed
Definition vehicles.h:52
s32 numCars
Definition vehicles.h:54
TrainCarStuff passengerCars[NUM_PASSENGER_CAR_ENTRIES]
Definition vehicles.h:51
TrainCarStuff tender
Definition vehicles.h:50
s16 someType
Definition vehicles.h:85
Vec3f velocity
Definition vehicles.h:79
s16 unused
Definition vehicles.h:76
Vec3f position
Definition vehicles.h:78
Vec3s rotation
Definition vehicles.h:84
s16 actorIndex
Definition vehicles.h:81
s8 someFlags
Definition vehicles.h:91
f32 speed
Definition vehicles.h:82
f32 someMultiplierTheSequel
Definition vehicles.h:83
s8 someFlagsTheSequel
Definition vehicles.h:92
u16 pathPointIndex
Definition vehicles.h:80
signed int s32
Definition ultratypes.h:15
unsigned int u32
Definition ultratypes.h:16
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
s32 spawn_ferry_smoke(s32 ferryIndex, Vec3f pos, f32 velocity)
Definition update_objects.c:1682
s32 spawn_train_smoke(s32 trainIndex, Vec3f pos, f32 velocity)
Definition update_objects.c:1562
void generate_train_path(void)
Definition vehicle_utils.inc.c:8
void update_player_track_position_factor_from_tanker_truck(s32 playerId)
Definition vehicle_utils.inc.c:1061
void init_vehicles_cars(void)
Definition vehicle_utils.inc.c:1065
void spawn_course_vehicles(void)
Definition vehicle_utils.inc.c:60
void update_player_track_position_factor_from_cars(s32 playerId)
Definition vehicle_utils.inc.c:1089
void handle_tanker_trucks_interactions(s32 playerId, Player *player)
Definition vehicle_utils.inc.c:1056
#define GET_PATH_LENGTH(pathPoint)
Definition vehicle_utils.inc.c:1
void handle_paddleBoats_interactions(Player *player)
Definition vehicle_utils.inc.c:598
void update_vehicle_tanker_trucks(void)
Definition vehicle_utils.inc.c:1049
void init_vehicles_school_buses(void)
Definition vehicle_utils.inc.c:1009
void func_80013054(void)
Definition vehicle_utils.inc.c:413
void handle_box_trucks_interactions(s32 playerId, Player *player)
Definition vehicle_utils.inc.c:1000
void init_vehicles_box_trucks(void)
Definition vehicle_utils.inc.c:983
void init_vehicles_ferry(void)
Definition vehicle_utils.inc.c:468
void update_vehicle_box_trucks(void)
Definition vehicle_utils.inc.c:993
void handle_trains_interactions(s32 playerId, Player *player)
Definition vehicle_utils.inc.c:354
f32 func_80013C74(s16 someType, s16 pathPointIndex)
Definition vehicle_utils.inc.c:679
void handle_cars_interactions(s32 playerId, Player *player)
Definition vehicle_utils.inc.c:1084
void update_player_track_position_factor_from_buses(s32 playerId)
Definition vehicle_utils.inc.c:1033
void sync_train_components(TrainCarStuff *trainCar, s16 orientationY)
sync the train components vehicle with the actor
Definition vehicle_utils.inc.c:262
void update_vehicle_paddle_boats(void)
Definition vehicle_utils.inc.c:497
void update_vehicle_school_bus(void)
Definition vehicle_utils.inc.c:1021
void update_player_track_position_factor_from_vehicle(s32 playerId, s32 vehicleCount, VehicleStuff *vehicle)
Definition vehicle_utils.inc.c:960
void handle_school_buses_interactions(s32 playerId, Player *player)
Definition vehicle_utils.inc.c:1028
void update_vehicle_follow_pathPoint(VehicleStuff *vehicle)
Definition vehicle_utils.inc.c:712
void update_vehicle_cars(void)
Definition vehicle_utils.inc.c:1077
void spawn_vehicle_on_road(VehicleStuff *vehicle)
Definition vehicle_utils.inc.c:36
void update_vehicle_trains(void)
Definition vehicle_utils.inc.c:278
void update_player_track_position_factor_from_box_trucks(s32 playerId)
Definition vehicle_utils.inc.c:1005
void set_vehicle_pos_pathPoint(TrainCarStuff *trainCar, Path2D *posXZ, u16 pathPoint)
Definition vehicle_utils.inc.c:175
void generate_ferry_path(void)
Definition vehicle_utils.inc.c:22
void handle_vehicle_interactions(s32 playerId, Player *player, VehicleStuff *vehicle, f32 distanceX, f32 distanceY, s32 vehicleCount, u32 soundBits)
Definition vehicle_utils.inc.c:778
f32 player_track_position_factor_vehicle(s16 someType, f32 arg1, s16 pathIndex)
Definition vehicle_utils.inc.c:921
void initialize_toads_turnpike_vehicle(f32 speedA, f32 speedB, s32 numVehicles, s32 arg3, VehicleStuff *vehicleList, TrackPathPoint *pathPointList)
Definition vehicle_utils.inc.c:633
void init_vehicles_trains(void)
Definition vehicle_utils.inc.c:191
void check_ai_crossing_distance(s32 playerId)
Definition vehicle_utils.inc.c:447
void init_vehicles_trucks(void)
Definition vehicle_utils.inc.c:1037
#define NUM_RACE_CARS
Definition vehicles.h:25
#define NUM_CROSSINGS
Definition vehicles.h:13
#define NUM_RACE_SCHOOL_BUSES
Definition vehicles.h:23
#define NUM_TIME_TRIAL_TANKER_TRUCKS
Definition vehicles.h:29
#define NUM_TRAINS
Definition vehicles.h:10
#define TRAIN_CROSSING_AI_DISTANCE
Definition vehicles.h:33
#define RENDER_VEHICLE
Definition vehicles.h:36
#define FRAMES_SINCE_CROSSING_ACTIVATED
Definition vehicles.h:16
#define LOCOMOTIVE_ONLY
Definition vehicles.h:11
#define NUM_TIME_TRIAL_BOX_TRUCKS
Definition vehicles.h:27
#define NUM_TENDERS
Definition vehicles.h:9
#define NUM_RACE_TANKER_TRUCKS
Definition vehicles.h:24
#define BOAT_SMOKE_RENDER_DISTANCE
Definition vehicles.h:34
#define TRAIN_SMOKE_RENDER_DISTANCE
Definition vehicles.h:32
#define NUM_TIME_TRIAL_CARS
Definition vehicles.h:30
#define NUM_ACTIVE_PADDLE_BOATS
Definition vehicles.h:19
#define NUM_TIME_TRIAL_SCHOOL_BUSES
Definition vehicles.h:28
#define NUM_2P_PASSENGER_CARS
Definition vehicles.h:7
#define NUM_PASSENGER_CAR_ENTRIES
Definition vehicles.h:8
#define NUM_RACE_BOX_TRUCKS
Definition vehicles.h:22