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

Function DoThumbstickCamera

TombEngine/Game/camera.cpp:96–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94float CinematicBarsSpeed = 0;
95
96void DoThumbstickCamera()
97{
98 // FIXME: IsHeld and IsClicked isn't working here for some reason.
99 if (IsReleased(In::Look))
100 {
101 Camera.extraAngle = 0;
102 Camera.extraElevation = 0;
103 return;
104 }
105
106 if (!g_Configuration.EnableThumbstickCamera)
107 return;
108
109 if (Camera.laraNode != NO_VALUE)
110 return;
111
112 // Only read axis values if overall magnitude is above threshold.
113 auto axisCoeff = Vector2::Zero;
114 if (AxisMap[AxisID::Camera].Length() > MANUAL_ROTATION_THRESHOLD)
115 axisCoeff = AxisMap[AxisID::Camera] * MANUAL_ROTATION_SPEED;
116
117 // Accumulate extra angles to gradually rotate camera around Lara over time.
118 Camera.extraAngle += ANGLE(axisCoeff.x);
119 Camera.extraElevation += ANGLE(axisCoeff.y);
120
121 // Limit vertical camera movement to avoid clipping.
122 Camera.extraElevation = std::clamp(Camera.extraElevation, MANUAL_ROTATION_LOWER_ANGLE_LIMIT, MANUAL_ROTATION_UPPER_ANGLE_LIMIT);
123
124 // Apply extra angles to target angles instead of actual angles for smooth movement.
125 Camera.targetAngle += Camera.extraAngle;
126 Camera.targetElevation += Camera.extraElevation;
127}
128
129static int GetLookCameraVerticalOffset(const ItemInfo& item, const CollisionInfo& coll)
130{

Callers 1

UpdateCameraElevationFunction · 0.85

Calls 3

IsReleasedFunction · 0.85
ANGLEFunction · 0.85
LengthMethod · 0.45

Tested by

no test coverage detected