diff --git a/changelog.md b/changelog.md index e0256b2..6a6d34c 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,10 @@ Currently no announcements for the mod. +## 1.2.2 + +- Added Fix Momentum setting (off by default). + ## 1.2.1 - Fixed wave trail cutting/discontinuing. diff --git a/mod.json b/mod.json index c7a766d..f290efb 100644 --- a/mod.json +++ b/mod.json @@ -8,7 +8,7 @@ }, "id": "imes.wavefix", "name": "Wave Fix", - "version": "v1.2.1", + "version": "v1.2.2", "developer": "imes", "description": "Fixes the wave gamemode angle being off by ~0.1 degree and less.", "tags": [ @@ -35,6 +35,12 @@ "description": "Correct regular and mini wave movement using anchored trajectory projection.", "default": true }, + "fixMomentum": { + "type": "bool", + "name": "Fix Momentum", + "description": "Also force wave y-velocity to match horizontal speed. Changes exit velocity into other gamemodes.", + "default": false + }, "visualizer": { "type": "bool", "name": "Show Visualizer", diff --git a/src/WaveFixConfig.hpp b/src/WaveFixConfig.hpp index c0c85e4..be42bb6 100644 --- a/src/WaveFixConfig.hpp +++ b/src/WaveFixConfig.hpp @@ -8,6 +8,7 @@ using namespace geode::prelude; namespace wavefix { constexpr char const* kEnabledSetting = "enabled"; + constexpr char const* kFixMomentumSetting = "fixMomentum"; constexpr char const* kLoggingSetting = "logging"; constexpr char const* kStateLoggingSetting = "stateLogging"; constexpr char const* kVisualizerSetting = "visualizer"; @@ -19,6 +20,7 @@ namespace wavefix { constexpr int kWaveTrailRestartFrames = 2; inline bool g_fixEnabled = true; + inline bool g_fixMomentumEnabled = false; inline bool g_loggingEnabled = false; inline bool g_stateLoggingEnabled = false; inline bool g_visualizerEnabled = false; @@ -48,14 +50,18 @@ namespace wavefix { } $on_mod(Loaded) { - wavefix::g_fixEnabled = Mod::get()->getSettingValue(wavefix::kEnabledSetting); - wavefix::g_loggingEnabled = Mod::get()->getSettingValue(wavefix::kLoggingSetting); + wavefix::g_fixEnabled = Mod::get()->getSettingValue(wavefix::kEnabledSetting); + wavefix::g_fixMomentumEnabled = Mod::get()->getSettingValue(wavefix::kFixMomentumSetting); + wavefix::g_loggingEnabled = Mod::get()->getSettingValue(wavefix::kLoggingSetting); wavefix::g_stateLoggingEnabled = Mod::get()->getSettingValue(wavefix::kStateLoggingSetting); - wavefix::g_visualizerEnabled = Mod::get()->getSettingValue(wavefix::kVisualizerSetting); + wavefix::g_visualizerEnabled = Mod::get()->getSettingValue(wavefix::kVisualizerSetting); listenForSettingChanges(wavefix::kEnabledSetting, [](bool value) { wavefix::g_fixEnabled = value; }); + listenForSettingChanges(wavefix::kFixMomentumSetting, [](bool value) { + wavefix::g_fixMomentumEnabled = value; + }); listenForSettingChanges(wavefix::kLoggingSetting, [](bool value) { wavefix::g_loggingEnabled = value; }); diff --git a/src/WaveFixPlayerObject.cpp b/src/WaveFixPlayerObject.cpp index d45d6c9..789dbc7 100644 --- a/src/WaveFixPlayerObject.cpp +++ b/src/WaveFixPlayerObject.cpp @@ -341,17 +341,8 @@ class $modify(WaveFixPlayerObject, PlayerObject) { } void setYVelocity(double velocity, int type) { - if (shouldBypassWaveFix()) { - PlayerObject::setYVelocity(velocity, type); - return; - } - - if (m_isDashing) { - PlayerObject::setYVelocity(velocity, type); - return; - } - - if (!shouldFixWave() || std::abs(velocity) <= wavefix::kEpsilon) { + if (!wavefix::g_fixMomentumEnabled || shouldBypassWaveFix() || m_isDashing + || !shouldFixWave() || std::abs(velocity) <= wavefix::kEpsilon) { PlayerObject::setYVelocity(velocity, type); return; }