Skip to content

Commit

Permalink
Add a Preference for using mods for Replays
Browse files Browse the repository at this point in the history
  • Loading branch information
poco0317 committed Oct 18, 2019
1 parent af59834 commit 3a3602d
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 12 deletions.
2 changes: 2 additions & 0 deletions Themes/_fallback/Languages/en.ini
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,7 @@ Remove=Remove arrows to make the song easier.
RemoveCombinations=Remove arrows to make the song easier.
RemoveFeatures=Remove arrows to make the song easier.
Rename=
ReplaysUseScoreMods=Replays will attempt to use the same modifiers that were in use when the score was set.
Reset To Defaults=Reset all options to default values.
SaveScores=Toggle score saving.
SaveReplays=Enable saving replays.
Expand Down Expand Up @@ -1169,6 +1170,7 @@ RemoveFeatures=
Remove Change=Remove Change
Remove Keysound=Remove Keysound
Rename=Rename
ReplaysUseScoreMods=Replay Mod Emulation
Reset To Defaults=Reset Options To Default Values
Revert from disk=Revert from disk
Revert to last save=Revert from cache
Expand Down
3 changes: 2 additions & 1 deletion Themes/_fallback/metrics.ini
Original file line number Diff line number Diff line change
Expand Up @@ -2350,7 +2350,7 @@ Line20="conf,VisualDelaySeconds"
Fallback="ScreenOptionsServiceChild"
NextScreen="ScreenOptionsService"
PrevScreen="ScreenOptionsService"
LineNames="3,4,8,SI,SM,HN,11,14,30,OsuLifts,PR"
LineNames="3,4,8,SI,SM,HN,11,14,30,OsuLifts,ReplayMods,PR"
#LineScore="lua,UserPrefScoringMode()"
Line3="conf,TimingWindowScale"
Line4="conf,LifeDifficulty"
Expand All @@ -2364,6 +2364,7 @@ Line30="conf,FastLoad"
#Line31="conf,FastLoadAdditionalSongs"
LinePR="conf,EnablePitchRates"
LineOsuLifts="conf,LiftsOnOsuHolds"
LineReplayMods="conf,ReplaysUseScoreMods"

[ScreenAppearanceOptions]
Fallback="ScreenOptionsServiceChild"
Expand Down
28 changes: 17 additions & 11 deletions src/Etterna/Screen/Gameplay/ScreenGameplayReplay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,17 @@ ScreenGameplayReplay::ScreenGameplayReplay()

// Set up rate
GAMESTATE->m_SongOptions.GetPreferred().m_fMusicRate = PlayerAI::replayRate;
// Set up mods
GAMESTATE->m_pPlayerState->m_PlayerOptions.Init();
GAMESTATE->m_pPlayerState->m_PlayerOptions.GetPreferred().FromString(
PlayerAI::replayModifiers);

// Undo noteskin change
GAMESTATE->m_pPlayerState->m_PlayerOptions.GetPreferred().FromOneModString(
ns, RString());

if (PREFSMAN->m_bReplaysUseScoreMods) {
// Set up mods
GAMESTATE->m_pPlayerState->m_PlayerOptions.Init();
GAMESTATE->m_pPlayerState->m_PlayerOptions.GetPreferred().FromString(
PlayerAI::replayModifiers);

// Undo noteskin change
GAMESTATE->m_pPlayerState->m_PlayerOptions.GetPreferred()
.FromOneModString(ns, RString());
}
}

void
Expand All @@ -74,13 +77,16 @@ ScreenGameplayReplay::~ScreenGameplayReplay()
LOG->Trace("ScreenGameplayReplay::~ScreenGameplayReplay()");

if (!GAMESTATE->m_bRestartedGameplay) {
GAMESTATE->m_pPlayerState->m_PlayerOptions.Init();
GAMESTATE->m_pPlayerState->m_PlayerOptions.GetPreferred().FromString(
PlayerAI::oldModifiers);
if (PREFSMAN->m_bReplaysUseScoreMods) {
GAMESTATE->m_pPlayerState->m_PlayerOptions.Init();
GAMESTATE->m_pPlayerState->m_PlayerOptions.GetPreferred()
.FromString(PlayerAI::oldModifiers);
}
GAMESTATE->m_SongOptions.Init();
GAMESTATE->m_SongOptions.GetPreferred().m_fMusicRate =
PlayerAI::oldRate;
GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate = PlayerAI::oldRate;
GAMESTATE->m_SongOptions.GetSong().m_fMusicRate = PlayerAI::oldRate;
PlayerAI::ResetScoreData();
} else
PlayerAI::SetScoreData();
Expand Down
1 change: 1 addition & 0 deletions src/Etterna/Screen/Options/ScreenOptionsMasterPrefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -744,6 +744,7 @@ InitializeConfOptions()
ADD(ConfOption("DefaultNoteSkin", DefaultNoteSkin, DefaultNoteSkinChoices));
ADD(ConfOption("NoGlow", MovePref<bool>, "On", "Off"));
ADD(ConfOption("FullTapExplosions", MovePref<bool>, "Short", "Full"));
ADD(ConfOption("ReplaysUseScoreMods", MovePref<bool>, "Off", "On"));
ADD(ConfOption("EnablePitchRates", MovePref<bool>, "Off", "On"));
ADD(ConfOption("LiftsOnOsuHolds", MovePref<bool>, "Off", "On"));
ADD(ConfOption("ShowInstructions", MovePref<bool>, "Skip", "Show"));
Expand Down
1 change: 1 addition & 0 deletions src/Etterna/Singletons/PrefsManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,7 @@ PrefsManager::PrefsManager()
, m_bShowCaution("ShowCaution", false)
, m_bFullTapExplosions("FullTapExplosions", true)
, m_bNoGlow("NoGlow", false)
, m_bReplaysUseScoreMods("ReplaysUseScoreMods", true)
, m_bShowNativeLanguage("ShowNativeLanguage", true)
, m_iArcadeOptionsNavigation("ArcadeOptionsNavigation", 0)
, m_ThreeKeyNavigation("ThreeKeyNavigation", false)
Expand Down
1 change: 1 addition & 0 deletions src/Etterna/Singletons/PrefsManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ class PrefsManager
Preference<bool> m_bShowNativeLanguage;
Preference<bool> m_bFullTapExplosions;
Preference<bool> m_bNoGlow;
Preference<bool> m_bReplaysUseScoreMods;
Preference<int> m_iArcadeOptionsNavigation;
Preference<bool> m_ThreeKeyNavigation;
Preference<MusicWheelUsesSections> m_MusicWheelUsesSections;
Expand Down

0 comments on commit 3a3602d

Please sign in to comment.