add global offset setting (remove when we add timestamped input)

This commit is contained in:
Chris Danford
2003-07-05 05:28:23 +00:00
parent da2daa28c2
commit 987c51c0b6
3 changed files with 11 additions and 2 deletions
+3
View File
@@ -97,6 +97,7 @@ PrefsManager::PrefsManager()
m_bUseUnlockSystem = false;
m_bFirstRun = true;
m_bAutoMapJoysticks = true;
m_fGlobalOffsetSeconds = 0;
/* DDR Extreme-style extra stage support.
* Default off so people used to the current behavior (or those with extra
@@ -213,6 +214,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk( bool bSwitchToLastPlayedGame )
ini.GetValue ( "Options", "LastSeenMemory", m_iLastSeenMemory );
#endif
ini.GetValueB( "Options", "AntiAliasing", m_bAntiAliasing );
ini.GetValueF( "Options", "GlobalOffsetSeconds", m_fGlobalOffsetSeconds );
m_asAdditionalSongFolders.clear();
CString sAdditionalSongFolders;
@@ -304,6 +306,7 @@ void PrefsManager::SaveGlobalPrefsToDisk()
ini.SetValue ( "Options", "LastSeenMemory", m_iLastSeenMemory );
#endif
ini.SetValueB( "Options", "AntiAliasing", m_bAntiAliasing );
ini.SetValueF( "Options", "GlobalOffsetSeconds", m_fGlobalOffsetSeconds );
/* Only write these if they aren't the default. This ensures that we can change
* the default and have it take effect for everyone (except people who
+1
View File
@@ -80,6 +80,7 @@ public:
bool m_bUseUnlockSystem;
bool m_bFirstRun;
bool m_bAutoMapJoysticks;
float m_fGlobalOffsetSeconds;
/* 0 = no; 1 = yes; -1 = auto (do whatever is appropriate for the arch). */
int m_iBoostAppPriority;
+7 -2
View File
@@ -28,6 +28,7 @@
#include "TitleSubstitution.h"
#include "BannerCache.h"
#include "Sprite.h"
#include "PrefsManager.h"
#include "NotesLoaderSM.h"
#include "NotesLoaderDWI.h"
@@ -148,7 +149,7 @@ void Song::AddLyricSegment( LyricSegment seg )
float Song::GetMusicStartBeat() const
{
float fBPS = m_BPMSegments[0].m_fBPM / 60.0f;
return -m_fBeat0OffsetInSeconds*fBPS;
return -(PREFSMAN->m_fGlobalOffsetSeconds+m_fBeat0OffsetInSeconds)*fBPS;
};
void Song::GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut, bool &bFreezeOut ) const
@@ -156,6 +157,8 @@ void Song::GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, fl
// LOG->Trace( "GetBeatAndBPSFromElapsedTime( fElapsedTime = %f )", fElapsedTime );
// This function is a nightmare. Don't even try to understand it. :-)
fElapsedTime += PREFSMAN->m_fGlobalOffsetSeconds;
fElapsedTime += m_fBeat0OffsetInSeconds;
@@ -225,7 +228,9 @@ void Song::GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, fl
float Song::GetElapsedTimeFromBeat( float fBeat ) const
{
float fElapsedTime = -m_fBeat0OffsetInSeconds;
float fElapsedTime = 0;
fElapsedTime -= PREFSMAN->m_fGlobalOffsetSeconds;
fElapsedTime -= m_fBeat0OffsetInSeconds;
for( unsigned j=0; j<m_StopSegments.size(); j++ ) // foreach freeze
{