| 611 | } |
| 612 | |
| 613 | static void DoUserInput(ItemInfo* minecartItem, ItemInfo* laraItem) |
| 614 | { |
| 615 | auto* minecart = GetMinecartInfo(minecartItem); |
| 616 | auto* lara = GetLaraInfo(laraItem); |
| 617 | |
| 618 | int floorHeight; |
| 619 | |
| 620 | switch (laraItem->Animation.ActiveState) |
| 621 | { |
| 622 | case MINECART_STATE_MOVE: |
| 623 | if (IsHeld(In::Action) || IsHeld(In::Draw)) |
| 624 | laraItem->Animation.TargetState = MINECART_STATE_SWIPE; |
| 625 | else if (IsHeld(In::Crouch)) |
| 626 | laraItem->Animation.TargetState = MINECART_STATE_DUCK; |
| 627 | else if (IsHeld(In::Brake) || IsHeld(In::Slower)) |
| 628 | laraItem->Animation.TargetState = MINECART_STATE_BRAKE; |
| 629 | else if (minecart->Velocity <= MINECART_STOP_VELOCITY_MIN || minecart->Flags & MINECART_FLAG_STOPPED) |
| 630 | laraItem->Animation.TargetState = MINECART_STATE_IDLE; |
| 631 | else if (minecart->Gradient < MINECART_FORWARD_GRADIENT) |
| 632 | laraItem->Animation.TargetState = MINECART_STATE_FORWARD; |
| 633 | else if (minecart->Gradient > MINECART_BACK_GRADIENT) |
| 634 | laraItem->Animation.TargetState = MINECART_STATE_BACK; |
| 635 | else if (IsHeld(In::Left)) |
| 636 | laraItem->Animation.TargetState = MINECART_STATE_LEFT; |
| 637 | else if (IsHeld(In::Right)) |
| 638 | laraItem->Animation.TargetState = MINECART_STATE_RIGHT; |
| 639 | |
| 640 | break; |
| 641 | |
| 642 | case MINECART_STATE_FORWARD: |
| 643 | if (IsHeld(In::Action) || IsHeld(In::Draw)) |
| 644 | laraItem->Animation.TargetState = MINECART_STATE_SWIPE; |
| 645 | else if (IsHeld(In::Crouch)) |
| 646 | laraItem->Animation.TargetState = MINECART_STATE_DUCK; |
| 647 | else if (IsHeld(In::Brake) || IsHeld(In::Slower)) |
| 648 | laraItem->Animation.TargetState = MINECART_STATE_BRAKE; |
| 649 | else if (minecart->Gradient > MINECART_FORWARD_GRADIENT) |
| 650 | laraItem->Animation.TargetState = MINECART_STATE_MOVE; |
| 651 | |
| 652 | break; |
| 653 | |
| 654 | case MINECART_STATE_BACK: |
| 655 | if (IsHeld(In::Action) || IsHeld(In::Draw)) |
| 656 | laraItem->Animation.TargetState = MINECART_STATE_SWIPE; |
| 657 | else if (IsHeld(In::Crouch)) |
| 658 | laraItem->Animation.TargetState = MINECART_STATE_DUCK; |
| 659 | else if (IsHeld(In::Brake) || IsHeld(In::Slower)) |
| 660 | laraItem->Animation.TargetState = MINECART_STATE_BRAKE; |
| 661 | else if (minecart->Gradient < MINECART_BACK_GRADIENT) |
| 662 | laraItem->Animation.TargetState = MINECART_STATE_MOVE; |
| 663 | |
| 664 | break; |
| 665 | |
| 666 | case MINECART_STATE_LEFT: |
| 667 | if (IsHeld(In::Action) || IsHeld(In::Draw)) |
| 668 | laraItem->Animation.TargetState = MINECART_STATE_SWIPE; |
| 669 | else if (IsHeld(In::Crouch)) |
| 670 | laraItem->Animation.TargetState = MINECART_STATE_DUCK; |
no test coverage detected