Smooth Camera -> Smooth Dynamic Camera, only show if dyncam active

As suggested by Pipou
This commit is contained in:
def 2020-11-07 11:29:23 +01:00
parent 677ea1f98f
commit d0437df51d
3 changed files with 18 additions and 15 deletions

View file

@ -129,10 +129,10 @@ void CCamera::OnRender()
static vec2 s_CurrentCameraOffset[2] = {vec2(0, 0), vec2(0, 0)};
static float s_SpeedBias = 0.5f;
if(g_Config.m_ClCameraSmoothness > 0)
if(g_Config.m_ClDyncamSmoothness > 0)
{
float CameraSpeed = (1.0f - (g_Config.m_ClCameraSmoothness / 100.0f)) * 9.5f + 0.5f;
float CameraStabilizingFactor = 1 + g_Config.m_ClCameraStabilizing / 100.0f;
float CameraSpeed = (1.0f - (g_Config.m_ClDyncamSmoothness / 100.0f)) * 9.5f + 0.5f;
float CameraStabilizingFactor = 1 + g_Config.m_ClDyncamStabilizing / 100.0f;
s_SpeedBias += CameraSpeed * DeltaTime;
if(g_Config.m_ClDyncam)
@ -158,7 +158,7 @@ void CCamera::OnRender()
TargetCameraOffset = normalize(m_pClient->m_pControls->m_MousePos[g_Config.m_ClDummy]) * OffsetAmount;
}
if(g_Config.m_ClCameraSmoothness > 0)
if(g_Config.m_ClDyncamSmoothness > 0)
s_CurrentCameraOffset[g_Config.m_ClDummy] += (TargetCameraOffset - s_CurrentCameraOffset[g_Config.m_ClDummy]) * minimum(DeltaTime * s_SpeedBias, 1.0f);
else
s_CurrentCameraOffset[g_Config.m_ClDummy] = TargetCameraOffset;

View file

@ -107,19 +107,22 @@ void CMenus::RenderSettingsGeneral(CUIRect MainView)
}
}
// smooth camera
// smooth dynamic camera
Left.HSplitTop(5.0f, 0, &Left);
Left.HSplitTop(20.0f, &Button, &Left);
if(DoButton_CheckBox(&g_Config.m_ClCameraSmoothness, Localize("Smooth Camera"), g_Config.m_ClCameraSmoothness, &Button))
if(g_Config.m_ClDyncam)
{
if(g_Config.m_ClCameraSmoothness)
if(DoButton_CheckBox(&g_Config.m_ClDyncamSmoothness, Localize("Smooth Dynamic Camera"), g_Config.m_ClDyncamSmoothness, &Button))
{
g_Config.m_ClCameraSmoothness = 0;
}
else
{
g_Config.m_ClCameraSmoothness = 50;
g_Config.m_ClCameraStabilizing = 50;
if(g_Config.m_ClDyncamSmoothness)
{
g_Config.m_ClDyncamSmoothness = 0;
}
else
{
g_Config.m_ClDyncamSmoothness = 50;
g_Config.m_ClDyncamStabilizing = 50;
}
}
}

View file

@ -71,8 +71,8 @@ MACRO_CONFIG_INT(ClDyncamMousesens, cl_dyncam_mousesens, 0, 0, 100000, CFGFLAG_C
MACRO_CONFIG_INT(ClDyncamDeadzone, cl_dyncam_deadzone, 300, 1, 1300, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Dynamic camera dead zone")
MACRO_CONFIG_INT(ClDyncamFollowFactor, cl_dyncam_follow_factor, 60, 0, 200, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Dynamic camera follow factor")
MACRO_CONFIG_INT(ClCameraSmoothness, cl_camera_smoothness, 0, 0, 100, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Transition amount of the camera movement, 0=instant, 100=slow and smooth")
MACRO_CONFIG_INT(ClCameraStabilizing, cl_camera_stabilizing, 0, 0, 100, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Amount of camera slowdown during fast cursor movement. High value can cause delay in camera movement")
MACRO_CONFIG_INT(ClDyncamSmoothness, cl_dyncam_smoothness, 0, 0, 100, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Transition amount of the camera movement, 0=instant, 100=slow and smooth")
MACRO_CONFIG_INT(ClDyncamStabilizing, cl_dyncam_stabilizing, 0, 0, 100, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Amount of camera slowdown during fast cursor movement. High value can cause delay in camera movement")
MACRO_CONFIG_INT(EdZoomTarget, ed_zoom_target, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "Zoom to the current mouse target")
MACRO_CONFIG_INT(EdShowkeys, ed_showkeys, 0, 0, 1, CFGFLAG_CLIENT | CFGFLAG_SAVE, "")