Skip to content

Commit

Permalink
Add setting for disabling hispeed saving
Browse files Browse the repository at this point in the history
  • Loading branch information
Drewol committed Feb 16, 2020
1 parent c24696e commit eaac2b6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions Main/include/GameConfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ DefineEnum(GameConfigKeys,
HiSpeed,
SpeedMod,
ModSpeed,
AutoSaveSpeed,
SkipScore,
GlobalOffset,
InputOffset,
Expand Down
12 changes: 10 additions & 2 deletions Main/src/Game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class Game_Impl : public Game
bool m_paused = false;
bool m_ended = false;
bool m_transitioning = false;
bool m_saveSpeed = false;

bool m_renderDebugHUD = false;

Expand Down Expand Up @@ -207,7 +208,10 @@ class Game_Impl : public Game
if (m_fxSamples)
delete[] m_fxSamples;
// Save hispeed
g_gameConfig.Set(GameConfigKeys::HiSpeed, m_hispeed);
if (m_saveSpeed)
{
g_gameConfig.Set(GameConfigKeys::HiSpeed, m_hispeed);
}

//g_rootCanvas->Remove(m_canvas.As<GUIElementBase>());

Expand Down Expand Up @@ -326,6 +330,7 @@ class Game_Impl : public Game
m_audioOffset = g_gameConfig.GetInt(GameConfigKeys::GlobalOffset);
m_playback.audioOffset = m_audioOffset;

m_saveSpeed = g_gameConfig.GetBool(GameConfigKeys::AutoSaveSpeed);

/// TODO: Check if debugmute is enabled
g_audio->SetGlobalVolume(g_gameConfig.GetFloat(GameConfigKeys::MasterVolume));
Expand Down Expand Up @@ -608,7 +613,10 @@ class Game_Impl : public Game
m_hispeed = Math::Clamp(m_hispeed, 0.1f, 16.f);
if ((m_speedMod != SpeedMods::XMod) && change != 0.0f)
{
g_gameConfig.Set(GameConfigKeys::ModSpeed, m_hispeed * (float)m_currentTiming->GetBPM());
if (m_saveSpeed)
{
g_gameConfig.Set(GameConfigKeys::ModSpeed, m_hispeed * (float)m_currentTiming->GetBPM());
}
m_modSpeed = m_hispeed * (float)m_currentTiming->GetBPM();
m_playback.cModSpeed = m_modSpeed;
}
Expand Down
1 change: 1 addition & 0 deletions Main/src/GameConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ void GameConfig::InitDefaults()
Set(GameConfigKeys::GaugeDrainNormal, 180);
Set(GameConfigKeys::GaugeDrainHalf, 300);
Set(GameConfigKeys::ModSpeed, 300.0f);
Set(GameConfigKeys::AutoSaveSpeed, true);
Set(GameConfigKeys::SongFolder, "songs");
Set(GameConfigKeys::Skin, "Default");
Set(GameConfigKeys::Laser0Color, 200.0f);
Expand Down
2 changes: 1 addition & 1 deletion Main/src/SettingsScreen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ class SettingsScreen_Impl : public SettingsScreen
EnumSetting<Enum_SpeedMods>(GameConfigKeys::SpeedMod, "Speed mod:");
FloatSetting(GameConfigKeys::HiSpeed, "HiSpeed (%f):", 0.25, 20, 0.05);
FloatSetting(GameConfigKeys::ModSpeed, "ModSpeed (%f):", 50, 1500, 0.5);

ToggleSetting(GameConfigKeys::AutoSaveSpeed, "Save hispeed changes during gameplay");
nk_layout_row_dynamic(m_nctx, 150, 2);
if (nk_group_begin(m_nctx, "Hidden", NK_WINDOW_NO_SCROLLBAR))
{
Expand Down

0 comments on commit eaac2b6

Please sign in to comment.