- Fixed Slow Motion not changing back to the original game speed when deactivated

- Fixed certain features like Use TPP Model or Player Variables not working at all for some users
This commit is contained in:
EricPlayZ
2024-02-20 00:55:34 +02:00
parent 8d46c28837
commit 52dc7b65b7
6 changed files with 35 additions and 15 deletions

View File

@ -3,8 +3,9 @@
namespace ImGui {
std::unordered_map<std::string_view, float> AnimValueStack{};
const float AnimEaseInSine(const float blendPoint) { return 1 - std::cos((blendPoint * static_cast<float>(M_PI)) / 2); }
const float AnimEaseInSine(const float blendPoint) { return 1.0f - std::cos((blendPoint * static_cast<float>(M_PI)) / 2.0f); }
const float AnimEaseOutSine(const float blendPoint) { return std::sin((blendPoint * static_cast<float>(M_PI)) / 2.0f); }
const float AnimEaseInOutSine(const float blendPoint) { return -(std::cos(static_cast<float>(M_PI) * blendPoint) - 1.0f) / 2.0f; }
static const float SetAnimTime(const std::string_view& valueName, const float animSpeed, const bool resetBlendPoint = false, const float (*easingFunction)(float) = nullptr) {
const ImGuiContext& g = *GImGui;

View File

@ -8,6 +8,7 @@ namespace ImGui {
const float AnimEaseInSine(const float blendPoint);
const float AnimEaseOutSine(const float blendPoint);
const float AnimEaseInOutSine(const float blendPoint);
extern const float AnimateLerp(const std::string_view& valueName, const float a, const float b, const float animSpeed, const bool resetBlendPoint = false, const float (*easingFunction)(float) = nullptr);
}

View File

@ -24,6 +24,12 @@ R"(- You can now load custom mod files from "EGameTools\UserModFiles"! Please re
- Fixed player dying from switching FreeCam off after flying to high altitudes/through walls with "Teleport Player to Camera" option
- Fixed FOV slider not changing FOV while using FreeCam
That's it for this update! The next few updates will include some more bug fixes rather than new, big features, so stay tuned!)" }
That's it for this update! The next few updates will include some more bug fixes rather than new, big features, so stay tuned!)" },
{ "v1.1.1",
R"(- Fixed frequent crashes when using DX12, sometimes DX11 too.
- Fixed frequent crashing at game startup
- Fixed crashing when trying to use ".model" mods with the custom file loading system; PLEASE keep in mind that I haven't found a fix for this yet! Custom ".model" files will not get loaded from "UserModFiles"
- Fixed Slow Motion not changing back to the original game speed when deactivated
- Fixed certain features like Use TPP Model or Player Variables not working at all for some users)" }
};
}

View File

@ -16,8 +16,8 @@
#define VK_MWHEELUP 0x101
#endif
constexpr auto MOD_VERSION_STR = "v1.1.0";
constexpr auto MOD_VERSION = 10100;
constexpr auto MOD_VERSION_STR = "v1.1.1";
constexpr auto MOD_VERSION = 10101;
constexpr auto GAME_VER_COMPAT_STR = ">= v1.14.0";
constexpr auto GAME_VER_COMPAT = 11400;

View File

@ -1,4 +1,6 @@
#pragma once
#pragma pack(1)
template<size_t size, typename T> class buffer {
char buffer[size];
T data;
@ -14,4 +16,6 @@ public:
T operator+(const T& other) const { return data + other; }
T& operator-=(const T& other) { data -= other; return data; }
T operator-(const T& other) const { return data - other; }
};
};
#pragma pack()

View File

@ -52,9 +52,13 @@ namespace Menu {
freezeTime.SetPrevValue(false);
}
static bool slowMoHasChanged = true;
if (slowMotion.HasChangedTo(false)) {
static bool slowMoHasChanged = true;
slowMotionSpeedLerp = ImGui::AnimateLerp("slowMotionSpeedLerp", slowMotionSpeed, gameSpeedBeforeSlowMo, slowMotionTransitionTime, slowMoHasChanged, &ImGui::AnimEaseOutSine);
static float gameSpeedAfterChange = 0.0f;
if (slowMoHasChanged)
gameSpeedAfterChange = gameSpeed;
slowMotionSpeedLerp = ImGui::AnimateLerp("slowMotionSpeedLerp", gameSpeedAfterChange, gameSpeedBeforeSlowMo, slowMotionTransitionTime, slowMoHasChanged, &ImGui::AnimEaseInOutSine);
iLevel->TimerSetSpeedUp(slowMotionSpeedLerp);
slowMoHasChanged = false;
@ -63,14 +67,20 @@ namespace Menu {
slowMotion.SetPrevValue(false);
}
} else if (slowMotion.GetValue()) {
static float gameSpeedAfterChange = 0.0f;
if (slowMotion.HasChanged()) {
gameSpeedBeforeSlowMo = gameSpeed;
slowMotionSpeedLerp = gameSpeed;
if (slowMoHasChanged)
gameSpeedBeforeSlowMo = gameSpeed;
gameSpeedAfterChange = gameSpeed;
}
slowMotionSpeedLerp = ImGui::AnimateLerp("slowMotionSpeedLerp", gameSpeedBeforeSlowMo, slowMotionSpeed, slowMotionTransitionTime, slowMotion.HasChanged(), &ImGui::AnimEaseOutSine);
slowMotionSpeedLerp = ImGui::AnimateLerp("slowMotionSpeedLerp", gameSpeedAfterChange, slowMotionSpeed, slowMotionTransitionTime, slowMotion.HasChanged(), &ImGui::AnimEaseInOutSine);
iLevel->TimerSetSpeedUp(slowMotionSpeedLerp);
if (slowMotion.HasChanged())
if (slowMotion.HasChanged()) {
slowMoHasChanged = true;
slowMotion.SetPrevValue(slowMotion.GetValue());
}
}
if (!menuToggle.GetValue()) {
@ -80,8 +90,7 @@ namespace Menu {
if (!slowMotion.GetValue() && !slowMotion.HasChanged())
iLevel->TimerSetSpeedUp(gameSpeed);
if (!Utils::Values::are_samef(iLevel->TimerGetSpeedUp(), 1.0f))
gameSpeed = iLevel->TimerGetSpeedUp();
gameSpeed = iLevel->TimerGetSpeedUp();
}
}
void Tab::Render() {
@ -109,8 +118,7 @@ namespace Menu {
else if (iLevel && iLevel->IsLoaded()) {
if (!slowMotion.GetValue() && !slowMotion.HasChanged())
iLevel->TimerSetSpeedUp(gameSpeed);
if (!Utils::Values::are_samef(iLevel->TimerGetSpeedUp(), 1.0f))
gameSpeed = iLevel->TimerGetSpeedUp();
gameSpeed = iLevel->TimerGetSpeedUp();
}
ImGui::EndDisabled();
}