Change MachineSyncBias prefs to an enum SyncBias, Changing this song triggers a reload of songs, added new option effect for reloading songs

This commit is contained in:
Crash Cringle
2025-03-16 15:42:41 -07:00
committed by teejusb
parent 8259a7cd84
commit 9529bfd142
17 changed files with 48 additions and 24 deletions
+1 -1
View File
@@ -49,7 +49,7 @@ Group::Group(const RString& sDir, const RString& sGroupDirName) {
m_sSortTitle = m_sGroupName;
m_sTranslitTitle = m_sGroupName;
m_sSeries = "";
m_fSyncOffset = PREFSMAN->m_fMachineSyncBias;
m_fSyncOffset = PREFSMAN->m_MachineSyncBias == SyncBias_NULL ? 0 : -0.009;
m_bHasPackIni = false;
m_iYearReleased = 0;
m_sBannerPath = "";
+9 -1
View File
@@ -134,6 +134,14 @@ XToString(ProfileSortOrder);
StringToX(ProfileSortOrder);
LuaXType(ProfileSortOrder);
static const char* SyncBiasNames[] = {
"NULL",
"ITG"
};
XToString(SyncBias);
StringToX(SyncBias);
LuaXType(SyncBias);
bool g_bAutoRestart = false;
#ifdef DEBUG
# define TRUE_IF_DEBUG true
@@ -237,7 +245,7 @@ PrefsManager::PrefsManager() :
m_ShowDancingCharacters ( "ShowDancingCharacters", SDC_Random ),
m_bUseUnlockSystem ( "UseUnlockSystem", false ),
m_fGlobalOffsetSeconds ( "GlobalOffsetSeconds", -0.008f ),
m_fMachineSyncBias ( "MachineSyncBias", -0.009f ),
m_MachineSyncBias ( "MachineSyncBias", SyncBias_ITG ),
m_iProgressiveLifebar ( "ProgressiveLifebar", 0 ),
m_iProgressiveStageLifebar ( "ProgressiveStageLifebar", 0 ),
m_iProgressiveNonstopLifebar ( "ProgressiveNonstopLifebar", 0 ),
+9 -1
View File
@@ -124,6 +124,14 @@ enum ProfileSortOrder
ProfileSortOrder_Invalid
};
enum SyncBias
{
SyncBias_NULL,
SyncBias_ITG,
NUM_SyncBias,
SyncBias_Invalid
};
/** @brief Holds user-chosen preferences that are saved between sessions. */
class PrefsManager
{
@@ -240,7 +248,7 @@ public:
Preference<ShowDancingCharacters> m_ShowDancingCharacters;
Preference<bool> m_bUseUnlockSystem;
Preference<float> m_fGlobalOffsetSeconds;
Preference<float> m_fMachineSyncBias;
Preference<SyncBias> m_MachineSyncBias;
Preference<int> m_iProgressiveLifebar;
Preference<int> m_iProgressiveStageLifebar;
Preference<int> m_iProgressiveNonstopLifebar;
+6
View File
@@ -161,6 +161,12 @@ void ScreenOptionsMaster::HandleScreenMessage( const ScreenMessage SM )
if( m_iChangeMask & OPT_APPLY_SONG )
SONGMAN->SetPreferences();
if( m_iChangeMask & OPT_RELOAD_SONGS )
{
SCREENMAN->GetTopScreen()->SetNextScreenName("ScreenReloadSongs");
StartTransitioningScreen( SM_GoToNextScreen );
}
CHECKPOINT_M("Transferring to the next screen now.");
this->HandleScreenMessage( SM_GoToNextScreen );
return;
+5 -8
View File
@@ -710,12 +710,6 @@ static void GlobalOffsetSeconds( int &sel, bool ToSel, const ConfOption *pConfOp
MoveMap( sel, pConfOption, ToSel, mapping, ARRAYLEN(mapping) );
}
static void MachineSyncBias( int &sel, bool ToSel, const ConfOption *pConfOption )
{
constexpr std::array<float, 2> mapping = { 0.0f, -0.009f };
MoveMap( sel, pConfOption, ToSel, mapping.data(), mapping.size() );
}
static void EditRecordModeLeadIn(int &sel, bool to_sel, const ConfOption* conf_option)
{
float mapping[32];
@@ -947,7 +941,9 @@ static void InitializeConfOptions()
c.AddOption( ssprintf("%+i ms", i) );
ADD( c );
}
ADD( ConfOption( "MachineSyncBias", MachineSyncBias, "NULL","|ITG" ) );
ADD( ConfOption( "MachineSyncBias", MovePref<SyncBias>, "NULL","|ITG" ) );
g_ConfOptions.back().m_iEffects = OPT_RELOAD_SONGS;
ADD( ConfOption( "EnableAttackSounds", MovePref<bool>, "No","Yes" ) );
ADD( ConfOption( "EnableMineHitSound", MovePref<bool>, "No","Yes" ) );
ADD( ConfOption( "RateModPreservesPitch", MovePref<bool>, "No","Yes") );
@@ -1001,7 +997,8 @@ static const char *OptEffectNames[] = {
"ApplySound",
"ApplySong",
"ApplyAspectRatio",
"ApplyProfiles"
"ApplyProfiles",
"ReloadSongs"
};
XToString( OptEffect );
StringToX( OptEffect );
+2 -1
View File
@@ -17,7 +17,8 @@ enum OptEffect
OPT_APPLY_SONG = (1<<5),
OPT_APPLY_ASPECT_RATIO = (1<<6),
OPT_APPLY_PROFILES = (1<<7),
NUM_OptEffect = 8,
OPT_RELOAD_SONGS = (1<<8),
NUM_OptEffect = 9,
OptEffect_Invalid = MAX_OPTIONS+1
};
const RString& OptEffectToString( OptEffect e );
+3 -3
View File
@@ -481,7 +481,7 @@ bool Song::ReloadFromSongDir( RString sDir )
if (SONGMAN->GetGroup(this) != nullptr) {
m_SongTiming.m_fBeat0GroupOffsetInSeconds = SONGMAN->GetGroup(this)->GetSyncOffset();
} else {
m_SongTiming.m_fBeat0GroupOffsetInSeconds = PREFSMAN->m_fMachineSyncBias;
m_SongTiming.m_fBeat0GroupOffsetInSeconds = PREFSMAN->m_MachineSyncBias == SyncBias_NULL ? 0 : -0.009;
LOG->Warn("Song %s has no group, using machine sync bias.", m_sMainTitle.c_str());
}
@@ -507,7 +507,7 @@ bool Song::ReloadFromSongDir( RString sDir )
}
else
{
m_SongTiming.m_fBeat0GroupOffsetInSeconds = PREFSMAN->m_fMachineSyncBias;
m_SongTiming.m_fBeat0GroupOffsetInSeconds = PREFSMAN->m_MachineSyncBias == SyncBias_NULL ? 0 : -0.009;
LOG->Warn("Song %s has no group, using machine sync bias.", m_sMainTitle.c_str());
}
}
@@ -672,7 +672,7 @@ void Song::TidyUpData( bool from_cache, bool /* duringCache */ )
m_SongTiming.TidyUpData(false);
// Apply the group offset to the song timing before we do anything else.
float fOffset = PREFSMAN->m_fMachineSyncBias;
float fOffset = PREFSMAN->m_MachineSyncBias == SyncBias_NULL ? 0 : -0.009;
if (SONGMAN->GetGroupFromName(m_sGroupName) != nullptr)
{
fOffset = SONGMAN->GetGroupFromName(m_sGroupName)->GetSyncOffset();