Add camera transition smoothness

This commit is contained in:
2025-12-26 19:17:24 +01:00
parent 1961a08adc
commit d44e589b25

View File

@@ -28,6 +28,7 @@ static SetIntFn SetFOV = nullptr;
static SetIntFn SetHUDScale = nullptr; static SetIntFn SetHUDScale = nullptr;
static SetIntFn SetCameraOffset = nullptr; static SetIntFn SetCameraOffset = nullptr;
static SetFloatFn SetWorldTimeDilation = nullptr; static SetFloatFn SetWorldTimeDilation = nullptr;
static SetFloatFn SetCameraSmoothness = nullptr;
static GetGameInfosStruct GetGameInfos = nullptr; static GetGameInfosStruct GetGameInfos = nullptr;
// Plugin variables for checkboxes and sliders // Plugin variables for checkboxes and sliders
@@ -45,6 +46,7 @@ static int worldFOVValue = 0;
static int HUDScaleValue = 0; static int HUDScaleValue = 0;
static int cameraOffsetValue = 0; static int cameraOffsetValue = 0;
static float worldTimeDilationValue = 1.f; static float worldTimeDilationValue = 1.f;
static float cameraSmoothnessValue = 3.5f;
// Overlays popups // Overlays popups
static bool popup_Informations = false; static bool popup_Informations = false;
@@ -53,7 +55,7 @@ static std::string log_content;
// Plugin settings // Plugin settings
const std::string SETTINGS_FILE = "./pluginsettings.ini"; const std::string SETTINGS_FILE = "./pluginsettings.ini";
const char* FIX_VERSION = "0.9.3"; const char* FIX_VERSION = "0.9.4";
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Control camera distance.\n - Control HUD scaling.\n - Control world time dilation.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable fog.\n - Re enable dev console."; const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Control camera distance.\n - Control HUD scaling.\n - Control world time dilation.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable fog.\n - Re enable dev console.";
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44"; const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
@@ -84,6 +86,7 @@ static void LoadFixDLL()
SetHUDScale = (SetIntFn)GetProcAddress(fixLib, "SetHUDScale"); SetHUDScale = (SetIntFn)GetProcAddress(fixLib, "SetHUDScale");
SetCameraOffset = (SetIntFn)GetProcAddress(fixLib, "SetCameraOffset"); SetCameraOffset = (SetIntFn)GetProcAddress(fixLib, "SetCameraOffset");
SetWorldTimeDilation = (SetFloatFn)GetProcAddress(fixLib, "SetWorldTimeDilation"); SetWorldTimeDilation = (SetFloatFn)GetProcAddress(fixLib, "SetWorldTimeDilation");
SetCameraSmoothness = (SetFloatFn)GetProcAddress(fixLib, "SetCameraSmoothness");
GetGameInfos = (GetGameInfosStruct)GetProcAddress(fixLib, "GetGameInfos"); GetGameInfos = (GetGameInfosStruct)GetProcAddress(fixLib, "GetGameInfos");
// Apply initial values loaded from settings // Apply initial values loaded from settings
@@ -91,6 +94,7 @@ static void LoadFixDLL()
if (SetHUDScale) SetHUDScale(HUDScaleValue); if (SetHUDScale) SetHUDScale(HUDScaleValue);
if (SetCameraOffset) SetCameraOffset(cameraOffsetValue); if (SetCameraOffset) SetCameraOffset(cameraOffsetValue);
if (SetWorldTimeDilation) SetWorldTimeDilation(worldTimeDilationValue); if (SetWorldTimeDilation) SetWorldTimeDilation(worldTimeDilationValue);
if (SetCameraSmoothness) SetCameraSmoothness(cameraSmoothnessValue);
if (SetFixEnabled) SetFixEnabled(fix_enabled, true); if (SetFixEnabled) SetFixEnabled(fix_enabled, true);
if (SetFixesEnabled) { if (SetFixesEnabled) {
SetFixesEnabled(GameFixes::FOV, fov_fix_enabled); SetFixesEnabled(GameFixes::FOV, fov_fix_enabled);
@@ -129,6 +133,7 @@ static void SaveSettings()
pluginIniFile["3#Fixes tuning"]["HUD scale"] = HUDScaleValue; pluginIniFile["3#Fixes tuning"]["HUD scale"] = HUDScaleValue;
pluginIniFile["3#Fixes tuning"]["Camera offset"] = cameraOffsetValue; pluginIniFile["3#Fixes tuning"]["Camera offset"] = cameraOffsetValue;
pluginIniFile["3#Fixes tuning"]["World time dilation scale"] = worldTimeDilationValue; pluginIniFile["3#Fixes tuning"]["World time dilation scale"] = worldTimeDilationValue;
pluginIniFile["3#Fixes tuning"]["Camera smoothness"] = cameraSmoothnessValue;
pluginIniFile.save(SETTINGS_FILE); pluginIniFile.save(SETTINGS_FILE);
} }
@@ -297,15 +302,6 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
} }
} }
if (ImGui::CollapsingHeader("HUD scaling", ImGuiTreeNodeFlags_DefaultOpen))
{
ImGui::SetNextItemWidth(180 * scale);
if (ImGui::SliderInt("##HUDScale", &HUDScaleValue, 0, 40)) {
if (SetHUDScale) SetHUDScale(HUDScaleValue); SaveSettings();
}
}
ImGui::TableSetColumnIndex(1);
if (ImGui::CollapsingHeader("Camera offset (*)", ImGuiTreeNodeFlags_DefaultOpen)) if (ImGui::CollapsingHeader("Camera offset (*)", ImGuiTreeNodeFlags_DefaultOpen))
{ {
ImGui::SetNextItemWidth(200 * scale); ImGui::SetNextItemWidth(200 * scale);
@@ -331,6 +327,29 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
ImGui::Text("Default value is 1."); ImGui::Text("Default value is 1.");
ImGui::EndTooltip(); ImGui::EndTooltip();
} }
ImGui::TableSetColumnIndex(1);
if (ImGui::CollapsingHeader("HUD scaling", ImGuiTreeNodeFlags_DefaultOpen))
{
ImGui::SetNextItemWidth(180 * scale);
if (ImGui::SliderInt("##HUDScale", &HUDScaleValue, 0, 40)) {
if (SetHUDScale) SetHUDScale(HUDScaleValue); SaveSettings();
}
}
if (ImGui::CollapsingHeader("Camera smoothness (*)", ImGuiTreeNodeFlags_DefaultOpen))
{
ImGui::SetNextItemWidth(180 * scale);
if (ImGui::SliderFloat("##CameraSmoothnessValue", &cameraSmoothnessValue, 2, 10, "%.2f")) {
if (SetCameraSmoothness) SetCameraSmoothness(cameraSmoothnessValue); SaveSettings();
}
}
if (ImGui::IsItemHovered()) {
ImGui::BeginTooltip();
ImGui::Text("The higher the value, the quicker the camera transition is.");
ImGui::Text("Used in combination with camera distance fix.");
ImGui::EndTooltip();
}
ImGui::EndTable(); ImGui::EndTable();
} }
ImGui::PopStyleVar(); ImGui::PopStyleVar();