Add camera distance fix
This commit is contained in:
@@ -23,8 +23,10 @@ static GetGameInfosStruct GetGameInfos = nullptr;
|
|||||||
// Plugin variables for checkboxes and sliders
|
// Plugin variables for checkboxes and sliders
|
||||||
static bool fov_fix_enabled = false;
|
static bool fov_fix_enabled = false;
|
||||||
static bool ultrawide_fix_enabled = false;
|
static bool ultrawide_fix_enabled = false;
|
||||||
|
static bool camera_fix_enabled = false;
|
||||||
static bool fix_enabled = false;
|
static bool fix_enabled = false;
|
||||||
static int worldFOVvalue = 0;
|
static int worldFOVvalue = 0;
|
||||||
|
static float cameraDistancevalue = 1.f;
|
||||||
|
|
||||||
// Overlays popups
|
// Overlays popups
|
||||||
static bool popup_Informations = false;
|
static bool popup_Informations = false;
|
||||||
@@ -33,8 +35,8 @@ 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 = "1.0.1";
|
const char* FIX_VERSION = "1.0.2";
|
||||||
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Enable ultrawide.";
|
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Control camera distance.\n - Enable ultrawide.";
|
||||||
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
|
const char* DONATION_URL = "https://buymeacoffee.com/k4sh44";
|
||||||
|
|
||||||
// Scaling factor based on screen resolution
|
// Scaling factor based on screen resolution
|
||||||
@@ -45,7 +47,8 @@ static FixToggle individualFixes[] = {
|
|||||||
{ "FOV", &fov_fix_enabled, GameFixes::FOV },
|
{ "FOV", &fov_fix_enabled, GameFixes::FOV },
|
||||||
{ "Ultrawide", &ultrawide_fix_enabled, GameFixes::UltraWide, "This fix is only intended for aspect ratio higher than 32/9.\n"
|
{ "Ultrawide", &ultrawide_fix_enabled, GameFixes::UltraWide, "This fix is only intended for aspect ratio higher than 32/9.\n"
|
||||||
"You will have every run to change aspect ratio in the settings,\n"
|
"You will have every run to change aspect ratio in the settings,\n"
|
||||||
"from (16/9, 21/9, 32/9) to Auto to have it take effect."} };
|
"from (16/9, 21/9, 32/9) to Auto to have it take effect."},
|
||||||
|
{ "Camera", &camera_fix_enabled, GameFixes::Camera } };
|
||||||
|
|
||||||
// Prepare array of sliders for ImGui
|
// Prepare array of sliders for ImGui
|
||||||
static SliderFix2 sliders[2];
|
static SliderFix2 sliders[2];
|
||||||
@@ -71,14 +74,19 @@ static void LoadFixDLL(reshade::api::effect_runtime* runtime) {
|
|||||||
// Apply initial values loaded from settings
|
// Apply initial values loaded from settings
|
||||||
if (SetValues) {
|
if (SetValues) {
|
||||||
SetValues(GameSetting::FOV, worldFOVvalue);
|
SetValues(GameSetting::FOV, worldFOVvalue);
|
||||||
|
SetValues(GameSetting::CameraDistance, cameraDistancevalue);
|
||||||
}
|
}
|
||||||
if (SetFixEnabled) SetFixEnabled(fix_enabled, true);
|
if (SetFixEnabled) SetFixEnabled(fix_enabled, true);
|
||||||
if (SetFixes) {
|
if (SetFixes) {
|
||||||
SetFixes(GameFixes::FOV, fov_fix_enabled);
|
SetFixes(GameFixes::FOV, fov_fix_enabled);
|
||||||
SetFixes(GameFixes::UltraWide, ultrawide_fix_enabled);
|
SetFixes(GameFixes::UltraWide, ultrawide_fix_enabled);
|
||||||
|
SetFixes(GameFixes::Camera, camera_fix_enabled);
|
||||||
|
SetFixes(GameFixes::None, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
sliders[0] = { "In game additional FOV", "##FOVValue", SliderType::Int, &worldFOVvalue, -20, 50, GameSetting::FOV, SetValues };
|
sliders[0] = { "In game additional FOV", "##FOVValue", SliderType::Int, &worldFOVvalue, -20, 50, GameSetting::FOV, SetValues };
|
||||||
|
sliders[1] = { "Camera distance", "##CamValue", SliderType::Float, &cameraDistancevalue, 0, 5, GameSetting::CameraDistance, SetValues, "%.1f",
|
||||||
|
"Value is a multiplier.\nFinal value reported below is in meters."};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,8 +101,10 @@ static void SaveSettings() {
|
|||||||
pluginIniFile["2#Individual fix"].setComment("Controls each fix individually");
|
pluginIniFile["2#Individual fix"].setComment("Controls each fix individually");
|
||||||
pluginIniFile["2#Individual fix"]["FOV"] = fov_fix_enabled;
|
pluginIniFile["2#Individual fix"]["FOV"] = fov_fix_enabled;
|
||||||
pluginIniFile["2#Individual fix"]["UltraWide"] = ultrawide_fix_enabled;
|
pluginIniFile["2#Individual fix"]["UltraWide"] = ultrawide_fix_enabled;
|
||||||
|
pluginIniFile["2#Individual fix"]["Camera"] = camera_fix_enabled;
|
||||||
pluginIniFile["3#Fixes tuning"].setComment("Individual fix fine tune");
|
pluginIniFile["3#Fixes tuning"].setComment("Individual fix fine tune");
|
||||||
pluginIniFile["3#Fixes tuning"]["World FOV"] = worldFOVvalue;
|
pluginIniFile["3#Fixes tuning"]["World FOV"] = worldFOVvalue;
|
||||||
|
pluginIniFile["3#Fixes tuning"]["Camera distance"] = cameraDistancevalue;
|
||||||
|
|
||||||
pluginIniFile.save(SETTINGS_FILE);
|
pluginIniFile.save(SETTINGS_FILE);
|
||||||
}
|
}
|
||||||
@@ -106,7 +116,9 @@ static void LoadSettings() {
|
|||||||
fix_enabled = pluginIniFile["1#General fix"]["Enabled"].as<bool>();
|
fix_enabled = pluginIniFile["1#General fix"]["Enabled"].as<bool>();
|
||||||
fov_fix_enabled = pluginIniFile["2#Individual fix"]["FOV"].as<bool>();
|
fov_fix_enabled = pluginIniFile["2#Individual fix"]["FOV"].as<bool>();
|
||||||
ultrawide_fix_enabled = pluginIniFile["2#Individual fix"]["UltraWide"].as<bool>();
|
ultrawide_fix_enabled = pluginIniFile["2#Individual fix"]["UltraWide"].as<bool>();
|
||||||
|
camera_fix_enabled = pluginIniFile["2#Individual fix"]["Camera"].as<bool>();
|
||||||
worldFOVvalue = pluginIniFile["3#Fixes tuning"]["World FOV"].as<int>();
|
worldFOVvalue = pluginIniFile["3#Fixes tuning"]["World FOV"].as<int>();
|
||||||
|
cameraDistancevalue = pluginIniFile["3#Fixes tuning"]["Camera distance"].as<float>();
|
||||||
}
|
}
|
||||||
catch (const std::exception& e) {}
|
catch (const std::exception& e) {}
|
||||||
}
|
}
|
||||||
@@ -182,6 +194,7 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime) {
|
|||||||
DrawFixCheckbox(individualFixes[0]);
|
DrawFixCheckbox(individualFixes[0]);
|
||||||
ImGui::TableSetColumnIndex(1);
|
ImGui::TableSetColumnIndex(1);
|
||||||
DrawFixCheckbox(individualFixes[1]);
|
DrawFixCheckbox(individualFixes[1]);
|
||||||
|
DrawFixCheckbox(individualFixes[2]);
|
||||||
|
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
@@ -194,6 +207,8 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime) {
|
|||||||
ImGui::TableNextRow();
|
ImGui::TableNextRow();
|
||||||
ImGui::TableSetColumnIndex(0);
|
ImGui::TableSetColumnIndex(0);
|
||||||
DrawSlider2(sliders[0], 200);
|
DrawSlider2(sliders[0], 200);
|
||||||
|
ImGui::TableSetColumnIndex(1);
|
||||||
|
DrawSlider2(sliders[1], 200);
|
||||||
ImGui::EndTable();
|
ImGui::EndTable();
|
||||||
}
|
}
|
||||||
ImGui::PopStyleVar();
|
ImGui::PopStyleVar();
|
||||||
@@ -207,6 +222,7 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime) {
|
|||||||
GetGameInfos(&infos);
|
GetGameInfos(&infos);
|
||||||
ImGui::Text("Screen width: %d, height: %d, aspect ratio: %.2f", infos.screenWidth, infos.screenHeight, infos.aspectRatio);
|
ImGui::Text("Screen width: %d, height: %d, aspect ratio: %.2f", infos.screenWidth, infos.screenHeight, infos.aspectRatio);
|
||||||
ImGui::TextColored(ImColor(48, 179, 25), "FOV In: %.2f, Out: %.2f", infos.FOVIn, infos.FOVOut);
|
ImGui::TextColored(ImColor(48, 179, 25), "FOV In: %.2f, Out: %.2f", infos.FOVIn, infos.FOVOut);
|
||||||
|
ImGui::TextColored(ImColor(48, 179, 25), "Camera distance In: %.2f, Out: %.2f", infos.cameraIn, infos.cameraOut);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user