| 63 | }; |
| 64 | |
| 65 | void PoleCollision(short itemNumber, ItemInfo* laraItem, CollisionInfo* coll) |
| 66 | { |
| 67 | auto& poleItem = g_Level.Items[itemNumber]; |
| 68 | auto& player = GetLaraInfo(*laraItem); |
| 69 | |
| 70 | bool isFacingPole = Geometry::IsPointInFront(laraItem->Pose, poleItem.Pose.Position.ToVector3()); |
| 71 | |
| 72 | g_Hud.InteractionHighlighter.Test(*laraItem, poleItem); |
| 73 | |
| 74 | // Mount while grounded. |
| 75 | if (IsHeld(In::Action) && isFacingPole && |
| 76 | TestState(laraItem->Animation.ActiveState, VPoleGroundedMountStates) && |
| 77 | player.Control.HandStatus == HandStatus::Free || |
| 78 | (player.Control.IsMoving && player.Context.InteractedItem == itemNumber)) |
| 79 | { |
| 80 | // Temporarily reorient pole. |
| 81 | short yOrient = poleItem.Pose.Orientation.y; |
| 82 | poleItem.Pose.Orientation.y = laraItem->Pose.Orientation.y; |
| 83 | |
| 84 | if (TestLaraPosition(VPoleBounds, &poleItem, laraItem)) |
| 85 | { |
| 86 | if (MoveLaraPosition(VPolePos, &poleItem, laraItem)) |
| 87 | { |
| 88 | SetAnimation(laraItem, LA_STAND_TO_POLE); |
| 89 | player.Control.IsMoving = false; |
| 90 | player.Control.HandStatus = HandStatus::Busy; |
| 91 | } |
| 92 | else |
| 93 | { |
| 94 | player.Context.InteractedItem = itemNumber; |
| 95 | } |
| 96 | |
| 97 | poleItem.Pose.Orientation.y = yOrient; |
| 98 | } |
| 99 | else |
| 100 | { |
| 101 | if (player.Control.IsMoving && player.Context.InteractedItem == itemNumber) |
| 102 | { |
| 103 | player.Control.IsMoving = false; |
| 104 | player.Control.HandStatus = HandStatus::Free; |
| 105 | } |
| 106 | |
| 107 | poleItem.Pose.Orientation.y = yOrient; |
| 108 | } |
| 109 | |
| 110 | return; |
| 111 | } |
| 112 | |
| 113 | // Mount while airborne. |
| 114 | if (IsHeld(In::Action) && isFacingPole && |
| 115 | TestState(laraItem->Animation.ActiveState, VPoleAirborneMountStates) && |
| 116 | laraItem->Animation.IsAirborne && |
| 117 | laraItem->Animation.Velocity.y > 0.0f && |
| 118 | player.Control.HandStatus == HandStatus::Free) |
| 119 | { |
| 120 | // Test sphere collision. |
| 121 | if (!TestLaraPoleCollision(laraItem, coll, true, -CLICK(1)) || !TestLaraPoleCollision(laraItem, coll, false)) |
| 122 | return; |
nothing calls this directly
no test coverage detected