| 672 | } |
| 673 | |
| 674 | void CombatCamera(ItemInfo* item) |
| 675 | { |
| 676 | static const unsigned int maxSwivelSteps = 5; |
| 677 | |
| 678 | auto& player = GetLaraInfo(*item); |
| 679 | |
| 680 | Camera.target.x = item->Pose.Position.x; |
| 681 | Camera.target.z = item->Pose.Position.z; |
| 682 | |
| 683 | if (player.TargetEntity) |
| 684 | { |
| 685 | Camera.targetAngle = player.TargetArmOrient.y; |
| 686 | Camera.targetElevation = player.TargetArmOrient.x + item->Pose.Orientation.x; |
| 687 | } |
| 688 | else |
| 689 | { |
| 690 | Camera.targetAngle = player.ExtraHeadRot.y + player.ExtraTorsoRot.y; |
| 691 | Camera.targetElevation = player.ExtraHeadRot.x + player.ExtraTorsoRot.x + item->Pose.Orientation.x - ANGLE(15.0f); |
| 692 | } |
| 693 | |
| 694 | auto pointColl = GetPointCollision(Vector3i(Camera.target.x, Camera.target.y + CLICK(1), Camera.target.z), Camera.target.RoomNumber); |
| 695 | if (TestEnvironment(ENV_FLAG_SWAMP, pointColl.GetRoomNumber())) |
| 696 | Camera.target.y = g_Level.Rooms[pointColl.GetRoomNumber()].TopHeight - CLICK(1); |
| 697 | |
| 698 | pointColl = GetPointCollision(Camera.target.ToVector3i(), Camera.target.RoomNumber); |
| 699 | Camera.target.RoomNumber = pointColl.GetRoomNumber(); |
| 700 | |
| 701 | int buffer = CLICK(0.25f); |
| 702 | if ((pointColl.GetCeilingHeight() + buffer) > (pointColl.GetFloorHeight() - buffer) && |
| 703 | pointColl.GetFloorHeight() != NO_HEIGHT && |
| 704 | pointColl.GetCeilingHeight() != NO_HEIGHT) |
| 705 | { |
| 706 | Camera.target.y = (pointColl.GetCeilingHeight() + pointColl.GetFloorHeight()) / 2; |
| 707 | Camera.targetElevation = 0; |
| 708 | } |
| 709 | else if (Camera.target.y > (pointColl.GetFloorHeight() - buffer) && |
| 710 | pointColl.GetFloorHeight() != NO_HEIGHT) |
| 711 | { |
| 712 | Camera.target.y = pointColl.GetFloorHeight() - buffer; |
| 713 | Camera.targetElevation = 0; |
| 714 | } |
| 715 | else if (Camera.target.y < (pointColl.GetCeilingHeight() + buffer) && |
| 716 | pointColl.GetCeilingHeight() != NO_HEIGHT) |
| 717 | { |
| 718 | Camera.target.y = pointColl.GetCeilingHeight() + buffer; |
| 719 | Camera.targetElevation = 0; |
| 720 | } |
| 721 | |
| 722 | int y = Camera.target.y; |
| 723 | pointColl = GetPointCollision(Vector3i(Camera.target.x, y, Camera.target.z), Camera.target.RoomNumber); |
| 724 | Camera.target.RoomNumber = pointColl.GetRoomNumber(); |
| 725 | |
| 726 | if (y < pointColl.GetCeilingHeight() || |
| 727 | y > pointColl.GetFloorHeight() || |
| 728 | pointColl.GetCeilingHeight() >= pointColl.GetFloorHeight() || |
| 729 | pointColl.GetFloorHeight() == NO_HEIGHT || |
| 730 | pointColl.GetCeilingHeight() == NO_HEIGHT) |
| 731 | { |
no test coverage detected