MCPcopy Create free account
hub / github.com/TombEngine/TombEngine / ConfirmCameraTargetPos

Function ConfirmCameraTargetPos

TombEngine/Game/camera.cpp:1025–1057  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1023}
1024
1025void ConfirmCameraTargetPos()
1026{
1027 auto pos = Vector3i(
1028 LaraItem->Pose.Position.x,
1029 LaraItem->Pose.Position.y - (LaraCollision.Setup.Height / 2),
1030 LaraItem->Pose.Position.z);
1031
1032 if (Camera.laraNode != NO_VALUE)
1033 {
1034 Camera.target.x = pos.x;
1035 Camera.target.y = pos.y;
1036 Camera.target.z = pos.z;
1037 }
1038 else
1039 {
1040 Camera.target.x = LaraItem->Pose.Position.x;
1041 Camera.target.y = (Camera.target.y + pos.y) / 2;
1042 Camera.target.z = LaraItem->Pose.Position.z;
1043 }
1044
1045 int y = Camera.target.y;
1046 auto pointColl = GetPointCollision(Vector3i(Camera.target.x, y, Camera.target.z), Camera.target.RoomNumber);
1047 if (y < pointColl.GetCeilingHeight() ||
1048 pointColl.GetFloorHeight() < y ||
1049 pointColl.GetFloorHeight() <= pointColl.GetCeilingHeight() ||
1050 pointColl.GetFloorHeight() == NO_HEIGHT ||
1051 pointColl.GetCeilingHeight() == NO_HEIGHT)
1052 {
1053 Camera.target.x = pos.x;
1054 Camera.target.y = pos.y;
1055 Camera.target.z = pos.z;
1056 }
1057}
1058
1059// HACK: Temporary fix for camera bouncing on slopes during player death.
1060static bool CalculateDeathCamera(const ItemInfo& item)

Callers 1

CalculateCameraFunction · 0.85

Calls 4

GetPointCollisionFunction · 0.85
Vector3iClass · 0.70
GetCeilingHeightMethod · 0.45
GetFloorHeightMethod · 0.45

Tested by

no test coverage detected