Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
8 changes: 7 additions & 1 deletion mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
Expand All @@ -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",
Expand Down
12 changes: 9 additions & 3 deletions src/WaveFixConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -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;
Expand Down Expand Up @@ -48,14 +50,18 @@ namespace wavefix {
}

$on_mod(Loaded) {
wavefix::g_fixEnabled = Mod::get()->getSettingValue<bool>(wavefix::kEnabledSetting);
wavefix::g_loggingEnabled = Mod::get()->getSettingValue<bool>(wavefix::kLoggingSetting);
wavefix::g_fixEnabled = Mod::get()->getSettingValue<bool>(wavefix::kEnabledSetting);
wavefix::g_fixMomentumEnabled = Mod::get()->getSettingValue<bool>(wavefix::kFixMomentumSetting);
wavefix::g_loggingEnabled = Mod::get()->getSettingValue<bool>(wavefix::kLoggingSetting);
wavefix::g_stateLoggingEnabled = Mod::get()->getSettingValue<bool>(wavefix::kStateLoggingSetting);
wavefix::g_visualizerEnabled = Mod::get()->getSettingValue<bool>(wavefix::kVisualizerSetting);
wavefix::g_visualizerEnabled = Mod::get()->getSettingValue<bool>(wavefix::kVisualizerSetting);

listenForSettingChanges<bool>(wavefix::kEnabledSetting, [](bool value) {
wavefix::g_fixEnabled = value;
});
listenForSettingChanges<bool>(wavefix::kFixMomentumSetting, [](bool value) {
wavefix::g_fixMomentumEnabled = value;
});
listenForSettingChanges<bool>(wavefix::kLoggingSetting, [](bool value) {
wavefix::g_loggingEnabled = value;
});
Expand Down
13 changes: 2 additions & 11 deletions src/WaveFixPlayerObject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading