Add World time dilation
This commit is contained in:
@@ -18,6 +18,7 @@ static float aspectRatio = (float)screenWidth / screenHeight;
|
||||
typedef void (*SetBoolFn)(bool, bool);
|
||||
typedef void (*SetFixesFn)(GameFixes ,bool);
|
||||
typedef void (*SetIntFn)(int);
|
||||
typedef void (*SetFloatFn)(float);
|
||||
|
||||
static HMODULE fixLib = nullptr;
|
||||
static LONG g_coreInitialized = 0;
|
||||
@@ -26,6 +27,7 @@ static SetFixesFn SetFixesEnabled = nullptr;
|
||||
static SetIntFn SetFOV = nullptr;
|
||||
static SetIntFn SetHUDScale = nullptr;
|
||||
static SetIntFn SetCameraOffset = nullptr;
|
||||
static SetFloatFn SetWorldTimeDilation = nullptr;
|
||||
static GetGameInfosStruct GetGameInfos = nullptr;
|
||||
|
||||
// Plugin variables for checkboxes and sliders
|
||||
@@ -35,11 +37,13 @@ static bool HUD_fix_enabled = false;
|
||||
static bool CA_fix_enabled = false;
|
||||
static bool Vignetting_fix_enabled = false;
|
||||
static bool Fog_fix_enabled = false;
|
||||
static bool World_Time_Dilation_fix_enabled = false;
|
||||
static bool fix_enabled = false;
|
||||
static bool console = true;
|
||||
static int worldFOVValue = 0;
|
||||
static int HUDScaleValue = 0;
|
||||
static int cameraOffsetValue = 0;
|
||||
static float worldTimeDilationValue = 1.f;
|
||||
|
||||
// Overlays popups
|
||||
static bool popup_Informations = false;
|
||||
@@ -48,15 +52,15 @@ static std::string log_content;
|
||||
|
||||
// Plugin settings
|
||||
const std::string SETTINGS_FILE = "./pluginsettings.ini";
|
||||
const char* FIX_VERSION = "0.9.2";
|
||||
const char* FIX_INFORMATIONS = "This fix allows to:\n - Control FOV in game.\n - Control camera distance.\n - Control HUD scaling.\n - Disable chromatic aberrations.\n - Disable vignetting.\n - Disable fog.\n - Re enable dev console.";
|
||||
const char* FIX_VERSION = "0.9.3";
|
||||
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";
|
||||
|
||||
// Scaling factor based on screen resolution
|
||||
float scale = (float)screenHeight / 1200;
|
||||
|
||||
extern "C" __declspec(dllexport) const char* NAME = "The Callisto Protocol";
|
||||
extern "C" __declspec(dllexport) const char* DESCRIPTION = "Reshade addon to re-enable console, control FOV, camera distance, HUD and some effects.";
|
||||
extern "C" __declspec(dllexport) const char* DESCRIPTION = "Reshade addon to re-enable console, control FOV, camera distance, world time dilation, HUD and some effects.";
|
||||
|
||||
// Load and unload game core dll functions /!\ necessary
|
||||
static void LoadFixDLL()
|
||||
@@ -78,12 +82,14 @@ static void LoadFixDLL()
|
||||
SetFOV = (SetIntFn)GetProcAddress(fixLib, "SetFOV");
|
||||
SetHUDScale = (SetIntFn)GetProcAddress(fixLib, "SetHUDScale");
|
||||
SetCameraOffset = (SetIntFn)GetProcAddress(fixLib, "SetCameraOffset");
|
||||
SetWorldTimeDilation = (SetFloatFn)GetProcAddress(fixLib, "SetWorldTimeDilation");
|
||||
GetGameInfos = (GetGameInfosStruct)GetProcAddress(fixLib, "GetGameInfos");
|
||||
|
||||
// Apply initial values loaded from settings
|
||||
if (SetFOV) SetFOV(worldFOVValue);
|
||||
if (SetHUDScale) SetHUDScale(HUDScaleValue);
|
||||
if (SetCameraOffset) SetCameraOffset(cameraOffsetValue);
|
||||
if (SetWorldTimeDilation) SetWorldTimeDilation(worldTimeDilationValue);
|
||||
if (SetFixEnabled) SetFixEnabled(fix_enabled, true);
|
||||
if (SetFixesEnabled) {
|
||||
SetFixesEnabled(GameFixes::FOV, fov_fix_enabled);
|
||||
@@ -92,6 +98,7 @@ static void LoadFixDLL()
|
||||
SetFixesEnabled(GameFixes::ChromaticAberrations, CA_fix_enabled);
|
||||
SetFixesEnabled(GameFixes::Vignetting, Vignetting_fix_enabled);
|
||||
SetFixesEnabled(GameFixes::Fog, Fog_fix_enabled);
|
||||
SetFixesEnabled(GameFixes::WorldTimeDilation, World_Time_Dilation_fix_enabled);
|
||||
SetFixesEnabled(GameFixes::DevConsole, console);
|
||||
}
|
||||
}
|
||||
@@ -115,10 +122,12 @@ static void SaveSettings()
|
||||
pluginIniFile["2#Individual fix"]["Chromatic aberrations"] = CA_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["Vignetting"] = Vignetting_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["Fog"] = Fog_fix_enabled;
|
||||
pluginIniFile["2#Individual fix"]["World time dilation"] = World_Time_Dilation_fix_enabled;
|
||||
pluginIniFile["3#Fixes tuning"].setComment("Individual fix fine tune");
|
||||
pluginIniFile["3#Fixes tuning"]["World FOV"] = worldFOVValue;
|
||||
pluginIniFile["3#Fixes tuning"]["HUD scale"] = HUDScaleValue;
|
||||
pluginIniFile["3#Fixes tuning"]["Camera offset"] = cameraOffsetValue;
|
||||
pluginIniFile["3#Fixes tuning"]["World time dilation scale"] = worldTimeDilationValue;
|
||||
|
||||
pluginIniFile.save(SETTINGS_FILE);
|
||||
}
|
||||
@@ -136,9 +145,11 @@ static void LoadSettings()
|
||||
CA_fix_enabled = pluginIniFile["2#Individual fix"]["Chromatic aberrations"].as<bool>();
|
||||
Vignetting_fix_enabled = pluginIniFile["2#Individual fix"]["Vignetting"].as<bool>();
|
||||
Fog_fix_enabled = pluginIniFile["2#Individual fix"]["Fog"].as<bool>();
|
||||
World_Time_Dilation_fix_enabled = pluginIniFile["2#Individual fix"]["World time dilation"].as<bool>();
|
||||
worldFOVValue = pluginIniFile["3#Fixes tuning"]["World FOV"].as<int>();
|
||||
HUDScaleValue = pluginIniFile["3#Fixes tuning"]["HUD scale"].as<int>();
|
||||
cameraOffsetValue = pluginIniFile["3#Fixes tuning"]["Camera offset"].as<float>();
|
||||
worldTimeDilationValue = pluginIniFile["3#Fixes tuning"]["World time dilation scale"].as<float>();
|
||||
}
|
||||
catch (const std::exception& e) {}
|
||||
}
|
||||
@@ -246,6 +257,11 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("World time dilation", &World_Time_Dilation_fix_enabled)) {
|
||||
if (SetFixesEnabled) SetFixesEnabled(GameFixes::WorldTimeDilation, World_Time_Dilation_fix_enabled);
|
||||
SaveSettings();
|
||||
}
|
||||
|
||||
if (ImGui::Checkbox("HUD scaling", &HUD_fix_enabled)) {
|
||||
if (SetFixesEnabled) SetFixesEnabled(GameFixes::HUD, HUD_fix_enabled);
|
||||
SaveSettings();
|
||||
@@ -300,6 +316,18 @@ static void on_overlay_draw(reshade::api::effect_runtime* runtime)
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
|
||||
if (ImGui::CollapsingHeader("World time dilation", ImGuiTreeNodeFlags_DefaultOpen))
|
||||
{
|
||||
ImGui::SetNextItemWidth(180 * scale);
|
||||
if (ImGui::SliderFloat("##WorldTimeDilationValue", &worldTimeDilationValue, 0, 2, "%.2f")) {
|
||||
if (SetWorldTimeDilation) SetWorldTimeDilation(worldTimeDilationValue); SaveSettings();
|
||||
}
|
||||
}
|
||||
if (ImGui::IsItemHovered()) {
|
||||
ImGui::BeginTooltip();
|
||||
ImGui::Text("Default value is 1.");
|
||||
ImGui::EndTooltip();
|
||||
}
|
||||
ImGui::EndTable();
|
||||
}
|
||||
ImGui::PopStyleVar();
|
||||
|
||||
Reference in New Issue
Block a user