Use accessor functions instead of direct calls.
This commit is contained in:
@@ -270,7 +270,7 @@ bool SSCLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
|
||||
|
||||
else if (sValueName == "LASTSECONDHINT")
|
||||
{
|
||||
out.specifiedLastSecond = StringToFloat(sParams[1]);
|
||||
out.SetSpecifiedLastSecond(StringToFloat(sParams[1]));
|
||||
}
|
||||
|
||||
else if( sValueName=="MUSICBYTES" )
|
||||
@@ -407,13 +407,13 @@ bool SSCLoader::LoadFromSimfile( const RString &sPath, Song &out, bool bFromCach
|
||||
else if (sValueName=="FIRSTSECOND")
|
||||
{
|
||||
if( bFromCache )
|
||||
out.firstSecond = StringToFloat( sParams[1] );
|
||||
out.SetFirstSecond(StringToFloat(sParams[1]));
|
||||
}
|
||||
|
||||
else if( sValueName=="LASTSECOND" )
|
||||
{
|
||||
if( bFromCache )
|
||||
out.lastSecond = StringToFloat( sParams[1] );
|
||||
out.SetLastSecond(StringToFloat(sParams[1]));
|
||||
}
|
||||
|
||||
else if( sValueName=="SONGFILENAME" )
|
||||
|
||||
@@ -66,8 +66,9 @@ static void WriteGlobalTags( RageFile &f, Song &out )
|
||||
f.PutLine( ssprintf( "#OFFSET:%.3f;", out.m_SongTiming.m_fBeat0OffsetInSeconds ) );
|
||||
f.PutLine( ssprintf( "#SAMPLESTART:%.3f;", out.m_fMusicSampleStartSeconds ) );
|
||||
f.PutLine( ssprintf( "#SAMPLELENGTH:%.3f;", out.m_fMusicSampleLengthSeconds ) );
|
||||
if( out.specifiedLastSecond > 0 )
|
||||
f.PutLine( ssprintf("#LASTBEATHINT:%.3f;", out.m_SongTiming.GetBeatFromElapsedTime(out.specifiedLastSecond)) );
|
||||
float specBeat = out.GetSpecifiedLastBeat();
|
||||
if( specBeat > 0 )
|
||||
f.PutLine( ssprintf("#LASTBEATHINT:%.3f;", specBeat) );
|
||||
|
||||
f.Write( "#SELECTABLE:" );
|
||||
switch(out.m_SelectionDisplay)
|
||||
|
||||
@@ -232,8 +232,8 @@ static void WriteGlobalTags( RageFile &f, const Song &out )
|
||||
|
||||
WriteTimingTags( f, out.m_SongTiming, true );
|
||||
|
||||
if( out.specifiedLastSecond > 0 )
|
||||
f.PutLine( ssprintf("#LASTSECONDHINT:%.6f;", out.specifiedLastSecond) );
|
||||
if( out.GetSpecifiedLastSecond() > 0 )
|
||||
f.PutLine( ssprintf("#LASTSECONDHINT:%.6f;", out.GetSpecifiedLastSecond()) );
|
||||
|
||||
FOREACH_BackgroundLayer( b )
|
||||
{
|
||||
|
||||
+4
-4
@@ -3436,7 +3436,7 @@ static void ChangeBeat0Offset( const RString &sNew )
|
||||
static void ChangeLastSecondHint( const RString &sNew )
|
||||
{
|
||||
Song &s = *GAMESTATE->m_pCurSong;
|
||||
s.specifiedLastSecond = StringToFloat(sNew);
|
||||
s.SetSpecifiedLastSecond(StringToFloat(sNew));
|
||||
}
|
||||
|
||||
static void ChangePreviewStart( const RString &sNew )
|
||||
@@ -3737,7 +3737,7 @@ void ScreenEdit::HandleMainMenuChoice( MainMenuChoice c, const vector<int> &iAns
|
||||
g_SongInformation.rows[main_title_transliteration].SetOneUnthemedChoice( pSong->m_sMainTitleTranslit );
|
||||
g_SongInformation.rows[sub_title_transliteration].SetOneUnthemedChoice( pSong->m_sSubTitleTranslit );
|
||||
g_SongInformation.rows[artist_transliteration].SetOneUnthemedChoice( pSong->m_sArtistTranslit );
|
||||
g_SongInformation.rows[last_second_hint].SetOneUnthemedChoice( ssprintf("%.6f", pSong->specifiedLastSecond) );
|
||||
g_SongInformation.rows[last_second_hint].SetOneUnthemedChoice( ssprintf("%.6f", pSong->GetSpecifiedLastSecond()) );
|
||||
g_SongInformation.rows[preview_start].SetOneUnthemedChoice( ssprintf("%.6f", pSong->m_fMusicSampleStartSeconds) );
|
||||
g_SongInformation.rows[preview_length].SetOneUnthemedChoice( ssprintf("%.6f", pSong->m_fMusicSampleLengthSeconds) );
|
||||
g_SongInformation.rows[display_bpm].iDefaultChoice = pSong->m_DisplayBPMType;
|
||||
@@ -4134,7 +4134,7 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, const vector<int> &iAns
|
||||
{
|
||||
TimingData &timing = GetAppropriateTiming();
|
||||
Song &s = *GAMESTATE->m_pCurSong;
|
||||
s.specifiedLastSecond = timing.GetElapsedTimeFromBeat(GetBeat());
|
||||
s.SetSpecifiedLastSecond(timing.GetElapsedTimeFromBeat(GetBeat()));
|
||||
break;
|
||||
}
|
||||
case undo:
|
||||
@@ -4255,7 +4255,7 @@ void ScreenEdit::HandleSongInformationChoice( SongInformationChoice c, const vec
|
||||
break;
|
||||
case last_second_hint:
|
||||
ScreenTextEntry::TextEntry( SM_None, ENTER_LAST_SECOND_HINT,
|
||||
ssprintf("%.6f", pSong->specifiedLastSecond), 20,
|
||||
ssprintf("%.6f", pSong->GetSpecifiedLastSecond()), 20,
|
||||
ScreenTextEntry::FloatValidate, ChangeLastSecondHint, NULL );
|
||||
break;
|
||||
case preview_start:
|
||||
|
||||
@@ -120,6 +120,31 @@ float Song::GetLastBeat() const
|
||||
return this->m_SongTiming.GetBeatFromElapsedTime(this->lastSecond);
|
||||
}
|
||||
|
||||
float Song::GetSpecifiedLastSecond() const
|
||||
{
|
||||
return this->specifiedLastSecond;
|
||||
}
|
||||
|
||||
float Song::GetSpecifiedLastBeat() const
|
||||
{
|
||||
return this->m_SongTiming.GetBeatFromElapsedTime(this->specifiedLastSecond);
|
||||
}
|
||||
|
||||
void Song::SetFirstSecond(const float f)
|
||||
{
|
||||
this->firstSecond = f;
|
||||
}
|
||||
|
||||
void Song::SetLastSecond(const float f)
|
||||
{
|
||||
this->lastSecond = f;
|
||||
}
|
||||
|
||||
void Song::SetSpecifiedLastSecond(const float f)
|
||||
{
|
||||
this->specifiedLastSecond = f;
|
||||
}
|
||||
|
||||
// Reset to an empty song.
|
||||
void Song::Reset()
|
||||
{
|
||||
|
||||
+12
-6
@@ -233,12 +233,6 @@ public:
|
||||
|
||||
/** @brief The length of the music file. */
|
||||
float m_fMusicLengthSeconds;
|
||||
/** @brief The first second that a note is hit. */
|
||||
float firstSecond;
|
||||
/** @brief The last second that a note is hit. */
|
||||
float lastSecond;
|
||||
/** @brief The last second of the song for playing purposes. */
|
||||
float specifiedLastSecond;
|
||||
float m_fMusicSampleStartSeconds;
|
||||
float m_fMusicSampleLengthSeconds;
|
||||
DisplayBPM m_DisplayBPMType;
|
||||
@@ -298,9 +292,21 @@ public:
|
||||
float GetFirstSecond() const;
|
||||
float GetLastBeat() const;
|
||||
float GetLastSecond() const;
|
||||
float GetSpecifiedLastBeat() const;
|
||||
float GetSpecifiedLastSecond() const;
|
||||
|
||||
void SetFirstSecond(const float f);
|
||||
void SetLastSecond(const float f);
|
||||
void SetSpecifiedLastSecond(const float f);
|
||||
|
||||
typedef vector<BackgroundChange> VBackgroundChange;
|
||||
private:
|
||||
/** @brief The first second that a note is hit. */
|
||||
float firstSecond;
|
||||
/** @brief The last second that a note is hit. */
|
||||
float lastSecond;
|
||||
/** @brief The last second of the song for playing purposes. */
|
||||
float specifiedLastSecond;
|
||||
/**
|
||||
* @brief The background changes (sorted by layer) that are for this Song.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user