| 805 | } |
| 806 | |
| 807 | void SpeedboatControl(short itemNumber) |
| 808 | { |
| 809 | auto* speedboatItem = &g_Level.Items[itemNumber]; |
| 810 | auto* speedboat = GetSpeedboatInfo(speedboatItem); |
| 811 | auto* laraItem = LaraItem.Get(); |
| 812 | auto* lara = GetLaraInfo(laraItem); |
| 813 | |
| 814 | int collide = SpeedboatDynamics(itemNumber, laraItem); |
| 815 | |
| 816 | Vector3i frontLeft, frontRight; |
| 817 | int heightFrontLeft = GetVehicleWaterHeight(speedboatItem, SPEEDBOAT_FRONT, -SPEEDBOAT_SIDE, true, &frontLeft); |
| 818 | int heightFrontRight = GetVehicleWaterHeight(speedboatItem, SPEEDBOAT_FRONT, SPEEDBOAT_SIDE, true, &frontRight); |
| 819 | |
| 820 | auto probe = GetPointCollision(*speedboatItem); |
| 821 | |
| 822 | if (lara->Context.Vehicle == itemNumber) |
| 823 | { |
| 824 | TestTriggers(speedboatItem, true); |
| 825 | TestTriggers(speedboatItem, false); |
| 826 | } |
| 827 | |
| 828 | auto water = GetPointCollision(Vector3i(speedboatItem->Pose.Position.x, speedboatItem->Pose.Position.y, speedboatItem->Pose.Position.z), probe.GetRoomNumber()).GetWaterTopHeight(); |
| 829 | speedboat->Water = water; |
| 830 | |
| 831 | bool noTurn = true; |
| 832 | bool drive = false; |
| 833 | bool idle = !speedboatItem->Animation.Velocity.z; |
| 834 | |
| 835 | if (lara->Context.Vehicle == itemNumber && laraItem->HitPoints > 0) |
| 836 | { |
| 837 | switch (laraItem->Animation.ActiveState) |
| 838 | { |
| 839 | case SPEEDBOAT_STATE_MOUNT: |
| 840 | case SPEEDBOAT_STATE_DISMOUNT_RIGHT: |
| 841 | case SPEEDBOAT_STATE_DISMOUNT_LEFT: |
| 842 | break; |
| 843 | |
| 844 | default: |
| 845 | drive = true; |
| 846 | noTurn = SpeedboatUserControl(speedboatItem, laraItem); |
| 847 | HandleVehicleSpeedometer(speedboatItem->Animation.Velocity.z, SPEEDBOAT_FAST_VELOCITY_MAX); |
| 848 | break; |
| 849 | } |
| 850 | } |
| 851 | else |
| 852 | { |
| 853 | if (speedboatItem->Animation.Velocity.z > SPEEDBOAT_VELOCITY_DECEL) |
| 854 | speedboatItem->Animation.Velocity.z -= SPEEDBOAT_VELOCITY_DECEL; |
| 855 | else |
| 856 | speedboatItem->Animation.Velocity.z = 0; |
| 857 | } |
| 858 | |
| 859 | if (noTurn) |
| 860 | { |
| 861 | if (speedboat->TurnRate < -SPEEDBOAT_TURN_RATE_DECEL) |
| 862 | speedboat->TurnRate += SPEEDBOAT_TURN_RATE_DECEL; |
| 863 | else if (speedboat->TurnRate > SPEEDBOAT_TURN_RATE_DECEL) |
| 864 | speedboat->TurnRate -= SPEEDBOAT_TURN_RATE_DECEL; |
nothing calls this directly
no test coverage detected