* * rct2: 0x006DAB4C */
| 1453 | * rct2: 0x006DAB4C |
| 1454 | */ |
| 1455 | int32_t Vehicle::UpdateTrackMotion(int32_t* outStation) |
| 1456 | { |
| 1457 | auto curRide = GetRide(); |
| 1458 | if (curRide == nullptr) |
| 1459 | return 0; |
| 1460 | |
| 1461 | const auto* rideEntry = GetRideEntry(); |
| 1462 | const auto* carEntry = Entry(); |
| 1463 | |
| 1464 | if (carEntry == nullptr) |
| 1465 | { |
| 1466 | return 0; |
| 1467 | } |
| 1468 | |
| 1469 | if (carEntry->flags.has(CarEntryFlag::isMiniGolf)) |
| 1470 | { |
| 1471 | return UpdateTrackMotionMiniGolf(outStation); |
| 1472 | } |
| 1473 | |
| 1474 | _vehicleF64E2C = 0; |
| 1475 | gCurrentVehicle = this; |
| 1476 | _vehicleMotionTrackFlags = 0; |
| 1477 | _vehicleStationIndex = StationIndex::GetNull(); |
| 1478 | |
| 1479 | UpdateTrackMotionUpStopCheck(); |
| 1480 | CheckAndApplyBlockSectionStopSite(); |
| 1481 | UpdateVelocity(); |
| 1482 | |
| 1483 | Vehicle* vehicle = this; |
| 1484 | if (_vehicleVelocityF64E08 < 0 && !vehicle->flags.has(VehicleFlag::moveSingleCar)) |
| 1485 | { |
| 1486 | vehicle = vehicle->TrainTail(); |
| 1487 | } |
| 1488 | // This will be the front vehicle even when traveling |
| 1489 | // backwards. |
| 1490 | _vehicleFrontVehicle = vehicle; |
| 1491 | |
| 1492 | auto spriteId = vehicle->id; |
| 1493 | while (!spriteId.IsNull()) |
| 1494 | { |
| 1495 | Vehicle* car = getGameState().entities.GetEntity<Vehicle>(spriteId); |
| 1496 | if (car == nullptr) |
| 1497 | { |
| 1498 | break; |
| 1499 | } |
| 1500 | carEntry = car->Entry(); |
| 1501 | if (carEntry != nullptr) |
| 1502 | { |
| 1503 | UpdateTrackMotionPreUpdate(*car, *curRide, *rideEntry, carEntry); |
| 1504 | } |
| 1505 | |
| 1506 | car->Sub6DBF3E(); |
| 1507 | |
| 1508 | // Loc6DC0F7 |
| 1509 | if (car->flags.has(VehicleFlag::onLiftHill)) |
| 1510 | { |
| 1511 | _vehicleMotionTrackFlags |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_VEHICLE_ON_LIFT_HILL; |
| 1512 | } |
no test coverage detected