move autosync logic out of Player and GameState, into a separate file
This commit is contained in:
@@ -0,0 +1,140 @@
|
||||
#include "global.h"
|
||||
#include "AdjustSync.h"
|
||||
#include "GameState.h"
|
||||
#include "song.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "LocalizedString.h"
|
||||
#include "ScreenManager.h"
|
||||
|
||||
TimingData *AdjustSync::s_pTimingDataOriginal = NULL;
|
||||
float AdjustSync::s_fGlobalOffsetSecondsOriginal = 0;
|
||||
int AdjustSync::s_iAutosyncOffsetSample = 0;
|
||||
float AdjustSync::s_fAutosyncOffset[SAMPLE_COUNT];
|
||||
|
||||
void AdjustSync::ResetOriginalSyncData()
|
||||
{
|
||||
if( s_pTimingDataOriginal == NULL )
|
||||
s_pTimingDataOriginal = new TimingData;
|
||||
|
||||
if( GAMESTATE->m_pCurSong )
|
||||
*s_pTimingDataOriginal = GAMESTATE->m_pCurSong->m_Timing;
|
||||
else
|
||||
*s_pTimingDataOriginal = TimingData();
|
||||
s_fGlobalOffsetSecondsOriginal = PREFSMAN->m_fGlobalOffsetSeconds;
|
||||
|
||||
s_iAutosyncOffsetSample = 0;
|
||||
}
|
||||
|
||||
bool AdjustSync::IsSyncDataChanged()
|
||||
{
|
||||
// Can't sync in course modes
|
||||
if( GAMESTATE->IsCourseMode() )
|
||||
return false;
|
||||
|
||||
if( GAMESTATE->m_pCurSong && *s_pTimingDataOriginal != GAMESTATE->m_pCurSong->m_Timing )
|
||||
return true;
|
||||
if( s_fGlobalOffsetSecondsOriginal != PREFSMAN->m_fGlobalOffsetSeconds )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void AdjustSync::SaveSyncChanges()
|
||||
{
|
||||
if( GAMESTATE->IsCourseMode() )
|
||||
return;
|
||||
if( GAMESTATE->m_pCurSong && *s_pTimingDataOriginal != GAMESTATE->m_pCurSong->m_Timing )
|
||||
GAMESTATE->m_pCurSong->Save();
|
||||
if( s_fGlobalOffsetSecondsOriginal != PREFSMAN->m_fGlobalOffsetSeconds )
|
||||
PREFSMAN->SavePrefsToDisk();
|
||||
ResetOriginalSyncData();
|
||||
}
|
||||
|
||||
void AdjustSync::RevertSyncChanges()
|
||||
{
|
||||
if( GAMESTATE->IsCourseMode() )
|
||||
return;
|
||||
PREFSMAN->m_fGlobalOffsetSeconds.Set( s_fGlobalOffsetSecondsOriginal );
|
||||
GAMESTATE->m_pCurSong->m_Timing = *s_pTimingDataOriginal;
|
||||
}
|
||||
|
||||
static LocalizedString AUTOSYNC_CORRECTION_APPLIED ( "AdjustSync", "Autosync: Correction applied." );
|
||||
static LocalizedString AUTOSYNC_CORRECTION_NOT_APPLIED ( "AdjustSync", "Autosync: Correction NOT applied. Deviation too high." );
|
||||
static LocalizedString AUTOSYNC_SONG ( "AdjustSync", "Autosync Song" );
|
||||
static LocalizedString AUTOSYNC_MACHINE ( "AdjustSync", "Autosync Machine" );
|
||||
void AdjustSync::HandleAutosync( float fNoteOffBySeconds )
|
||||
{
|
||||
if( GAMESTATE->m_SongOptions.m_AutosyncType == SongOptions::AUTOSYNC_OFF )
|
||||
return;
|
||||
|
||||
s_fAutosyncOffset[s_iAutosyncOffsetSample] = fNoteOffBySeconds;
|
||||
s_iAutosyncOffsetSample++;
|
||||
|
||||
if( s_iAutosyncOffsetSample < SAMPLE_COUNT )
|
||||
return; /* need more */
|
||||
|
||||
const float mean = calc_mean( s_fAutosyncOffset, s_fAutosyncOffset+SAMPLE_COUNT );
|
||||
const float stddev = calc_stddev( s_fAutosyncOffset, s_fAutosyncOffset+SAMPLE_COUNT );
|
||||
|
||||
RString sAutosyncType;
|
||||
switch( GAMESTATE->m_SongOptions.m_AutosyncType )
|
||||
{
|
||||
case SongOptions::AUTOSYNC_SONG:
|
||||
sAutosyncType = AUTOSYNC_SONG;
|
||||
break;
|
||||
case SongOptions::AUTOSYNC_MACHINE:
|
||||
sAutosyncType = AUTOSYNC_MACHINE;
|
||||
break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
if( stddev < .03 && stddev < fabsf(mean) ) // If they stepped with less than .03 error
|
||||
{
|
||||
switch( GAMESTATE->m_SongOptions.m_AutosyncType )
|
||||
{
|
||||
case SongOptions::AUTOSYNC_SONG:
|
||||
GAMESTATE->m_pCurSong->m_Timing.m_fBeat0OffsetInSeconds += mean;
|
||||
break;
|
||||
case SongOptions::AUTOSYNC_MACHINE:
|
||||
PREFSMAN->m_fGlobalOffsetSeconds.Set( PREFSMAN->m_fGlobalOffsetSeconds + mean );
|
||||
break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
SCREENMAN->SystemMessage( AUTOSYNC_CORRECTION_APPLIED.GetValue() );
|
||||
}
|
||||
else
|
||||
{
|
||||
SCREENMAN->SystemMessage( AUTOSYNC_CORRECTION_NOT_APPLIED.GetValue() );
|
||||
}
|
||||
|
||||
s_iAutosyncOffsetSample = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (c) 2003-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -0,0 +1,48 @@
|
||||
#ifndef AdjustSync_H
|
||||
#define AdjustSync_H
|
||||
|
||||
class TimingData;
|
||||
|
||||
const int SAMPLE_COUNT = 32;
|
||||
|
||||
class AdjustSync
|
||||
{
|
||||
public:
|
||||
static TimingData *s_pTimingDataOriginal;
|
||||
static float s_fGlobalOffsetSecondsOriginal;
|
||||
static void ResetOriginalSyncData();
|
||||
static bool IsSyncDataChanged();
|
||||
static void SaveSyncChanges();
|
||||
static void RevertSyncChanges();
|
||||
static void HandleAutosync( float fNoteOffBySeconds );
|
||||
|
||||
static float s_fAutosyncOffset[SAMPLE_COUNT];
|
||||
static int s_iAutosyncOffsetSample;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/*
|
||||
* (c) 2003-2004 Chris Danford
|
||||
* All rights reserved.
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the
|
||||
* "Software"), to deal in the Software without restriction, including
|
||||
* without limitation the rights to use, copy, modify, merge, publish,
|
||||
* distribute, and/or sell copies of the Software, and to permit persons to
|
||||
* whom the Software is furnished to do so, provided that the above
|
||||
* copyright notice(s) and this permission notice appear in all copies of
|
||||
* the Software and that both the above copyright notice(s) and this
|
||||
* permission notice appear in supporting documentation.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
||||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF
|
||||
* THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS
|
||||
* INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT
|
||||
* OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
|
||||
* OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
||||
* OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||
* PERFORMANCE OF THIS SOFTWARE.
|
||||
*/
|
||||
@@ -35,6 +35,7 @@
|
||||
#include "CommonMetrics.h"
|
||||
#include "CharacterManager.h"
|
||||
#include "Game.h"
|
||||
#include "AdjustSync.h"
|
||||
|
||||
#include <ctime>
|
||||
#include <set>
|
||||
@@ -108,8 +109,6 @@ GameState::GameState() :
|
||||
|
||||
m_Environment = new LuaTable;
|
||||
|
||||
m_pTimingDataOriginal = new TimingData;
|
||||
|
||||
/* Don't reset yet; let the first screen do it, so we can
|
||||
* use PREFSMAN and THEME. */
|
||||
// Reset();
|
||||
@@ -123,8 +122,6 @@ GameState::~GameState()
|
||||
SAFE_DELETE( m_pMultiPlayerState[p] );
|
||||
|
||||
SAFE_DELETE( m_Environment );
|
||||
|
||||
SAFE_DELETE( m_pTimingDataOriginal );
|
||||
}
|
||||
|
||||
void GameState::ApplyGameCommand( const RString &sCommand, PlayerNumber pn )
|
||||
@@ -640,7 +637,7 @@ void GameState::ResetStageStatistics()
|
||||
// get new shuffle patterns if they Back out of gameplay and play again.
|
||||
GAMESTATE->m_iStageSeed = rand();
|
||||
|
||||
ResetOriginalSyncData();
|
||||
AdjustSync::ResetOriginalSyncData();
|
||||
}
|
||||
|
||||
void GameState::UpdateSongPosition( float fPositionSeconds, const TimingData &timing, const RageTimer ×tamp )
|
||||
@@ -1742,48 +1739,6 @@ Profile* GameState::GetEditLocalProfile()
|
||||
return PROFILEMAN->GetLocalProfile( m_sEditLocalProfileID );
|
||||
}
|
||||
|
||||
void GameState::ResetOriginalSyncData()
|
||||
{
|
||||
if( m_pCurSong )
|
||||
*m_pTimingDataOriginal = m_pCurSong->m_Timing;
|
||||
else
|
||||
*m_pTimingDataOriginal = TimingData();
|
||||
m_fGlobalOffsetSecondsOriginal = PREFSMAN->m_fGlobalOffsetSeconds;
|
||||
}
|
||||
|
||||
bool GameState::IsSyncDataChanged()
|
||||
{
|
||||
// Can't sync in course modes
|
||||
if( IsCourseMode() )
|
||||
return false;
|
||||
|
||||
if( m_pCurSong && *m_pTimingDataOriginal != m_pCurSong->m_Timing )
|
||||
return true;
|
||||
if( m_fGlobalOffsetSecondsOriginal != PREFSMAN->m_fGlobalOffsetSeconds )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void GameState::SaveSyncChanges()
|
||||
{
|
||||
if( IsCourseMode() )
|
||||
return;
|
||||
if( m_pCurSong && *m_pTimingDataOriginal != m_pCurSong->m_Timing )
|
||||
GAMESTATE->m_pCurSong->Save();
|
||||
if( m_fGlobalOffsetSecondsOriginal != PREFSMAN->m_fGlobalOffsetSeconds )
|
||||
PREFSMAN->SavePrefsToDisk();
|
||||
ResetOriginalSyncData();
|
||||
}
|
||||
|
||||
void GameState::RevertSyncChanges()
|
||||
{
|
||||
if( IsCourseMode() )
|
||||
return;
|
||||
PREFSMAN->m_fGlobalOffsetSeconds.Set( GAMESTATE->m_fGlobalOffsetSecondsOriginal );
|
||||
GAMESTATE->m_pCurSong->m_Timing = *GAMESTATE->m_pTimingDataOriginal;
|
||||
}
|
||||
|
||||
|
||||
// lua start
|
||||
#include "LuaBinding.h"
|
||||
|
||||
@@ -292,14 +292,6 @@ public:
|
||||
float GetGoalPercentComplete( PlayerNumber pn );
|
||||
bool IsGoalComplete( PlayerNumber pn ) { return GetGoalPercentComplete( pn ) >= 1; }
|
||||
|
||||
// Sync changes stuff
|
||||
TimingData *m_pTimingDataOriginal;
|
||||
float m_fGlobalOffsetSecondsOriginal;
|
||||
void ResetOriginalSyncData();
|
||||
bool IsSyncDataChanged();
|
||||
void SaveSyncChanges();
|
||||
void RevertSyncChanges();
|
||||
|
||||
// Lua
|
||||
void PushSelf( lua_State *L );
|
||||
};
|
||||
|
||||
@@ -43,6 +43,7 @@
|
||||
#include "Steps.h"
|
||||
#include "GameCommand.h"
|
||||
#include "LocalizedString.h"
|
||||
#include "AdjustSync.h"
|
||||
|
||||
RString COMBO_X_NAME( size_t p, size_t both_sides ) { return "ComboXOffset" + (both_sides ? RString("BothSides") : ssprintf("OneSideP%d",int(p+1)) ); }
|
||||
RString ATTACK_DISPLAY_X_NAME( size_t p, size_t both_sides ){ return "AttackDisplayXOffset" + (both_sides ? RString("BothSides") : ssprintf("OneSideP%d",int(p+1)) ); }
|
||||
@@ -81,7 +82,6 @@ Player::Player( bool bShowNoteField, bool bShowJudgment )
|
||||
m_pInventory = NULL;
|
||||
|
||||
m_bPaused = false;
|
||||
m_iOffsetSample = 0;
|
||||
|
||||
m_pJudgment = NULL;
|
||||
if( bShowJudgment )
|
||||
@@ -117,8 +117,6 @@ Player::Player( bool bShowNoteField, bool bShowJudgment )
|
||||
{
|
||||
m_pNoteField = new NoteField;
|
||||
}
|
||||
|
||||
this->SubscribeToMessage( Message_AutosyncChanged );
|
||||
}
|
||||
|
||||
Player::~Player()
|
||||
@@ -1242,7 +1240,7 @@ void Player::HandleStep( int col, const RageTimer &tm, bool bHeld )
|
||||
}
|
||||
|
||||
if( m_pPlayerState->m_PlayerController == PC_HUMAN && score >= TNS_W3 )
|
||||
HandleAutosync( fNoteOffset );
|
||||
AdjustSync::HandleAutosync( fNoteOffset );
|
||||
|
||||
// Do game-specific and mode-specific score mapping.
|
||||
score = GAMESTATE->GetCurrentGame()->MapTapNoteScore( score );
|
||||
@@ -1325,61 +1323,6 @@ void Player::HandleStep( int col, const RageTimer &tm, bool bHeld )
|
||||
}
|
||||
}
|
||||
|
||||
static LocalizedString AUTOSYNC_CORRECTION_APPLIED ( "Player", "Autosync: Correction applied." );
|
||||
static LocalizedString AUTOSYNC_CORRECTION_NOT_APPLIED ( "Player", "Autosync: Correction NOT applied. Deviation too high." );
|
||||
static LocalizedString AUTOSYNC_SONG ( "Player", "Autosync Song" );
|
||||
static LocalizedString AUTOSYNC_MACHINE ( "Player", "Autosync Machine" );
|
||||
void Player::HandleAutosync(float fNoteOffset)
|
||||
{
|
||||
if( GAMESTATE->m_SongOptions.m_AutosyncType == SongOptions::AUTOSYNC_OFF )
|
||||
return;
|
||||
|
||||
m_fOffset[m_iOffsetSample] = fNoteOffset;
|
||||
m_iOffsetSample++;
|
||||
|
||||
if( m_iOffsetSample < SAMPLE_COUNT )
|
||||
return; /* need more */
|
||||
|
||||
const float mean = calc_mean( m_fOffset, m_fOffset+SAMPLE_COUNT );
|
||||
const float stddev = calc_stddev( m_fOffset, m_fOffset+SAMPLE_COUNT );
|
||||
|
||||
RString sAutosyncType;
|
||||
switch( GAMESTATE->m_SongOptions.m_AutosyncType )
|
||||
{
|
||||
case SongOptions::AUTOSYNC_SONG:
|
||||
sAutosyncType = AUTOSYNC_SONG;
|
||||
break;
|
||||
case SongOptions::AUTOSYNC_MACHINE:
|
||||
sAutosyncType = AUTOSYNC_MACHINE;
|
||||
break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
if( stddev < .03 && stddev < fabsf(mean) ) // If they stepped with less than .03 error
|
||||
{
|
||||
switch( GAMESTATE->m_SongOptions.m_AutosyncType )
|
||||
{
|
||||
case SongOptions::AUTOSYNC_SONG:
|
||||
GAMESTATE->m_pCurSong->m_Timing.m_fBeat0OffsetInSeconds += mean;
|
||||
break;
|
||||
case SongOptions::AUTOSYNC_MACHINE:
|
||||
PREFSMAN->m_fGlobalOffsetSeconds.Set( PREFSMAN->m_fGlobalOffsetSeconds + mean );
|
||||
break;
|
||||
default:
|
||||
ASSERT(0);
|
||||
}
|
||||
|
||||
SCREENMAN->SystemMessage( AUTOSYNC_CORRECTION_APPLIED.GetValue() );
|
||||
}
|
||||
else
|
||||
{
|
||||
SCREENMAN->SystemMessage( AUTOSYNC_CORRECTION_NOT_APPLIED.GetValue() );
|
||||
}
|
||||
|
||||
m_iOffsetSample = 0;
|
||||
}
|
||||
|
||||
void Player::DisplayJudgedRow( int iIndexThatWasSteppedOn, TapNoteScore score, int iTrack )
|
||||
{
|
||||
TapNote tn = m_NoteData.GetTapNote(iTrack, iIndexThatWasSteppedOn);
|
||||
@@ -1860,13 +1803,6 @@ bool Player::IsPlayingBeginner() const
|
||||
return pSteps && pSteps->GetDifficulty() == DIFFICULTY_BEGINNER;
|
||||
}
|
||||
|
||||
void Player::HandleMessage( const RString& sMessage )
|
||||
{
|
||||
// Reset autosync samples when toggling
|
||||
if( sMessage == MessageToString(Message_AutosyncChanged) )
|
||||
m_iOffsetSample = 0;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* (c) 2001-2004 Chris Danford
|
||||
|
||||
@@ -22,8 +22,6 @@ class RageTimer;
|
||||
class NoteField;
|
||||
class PlayerStageStats;
|
||||
|
||||
#define SAMPLE_COUNT 32
|
||||
|
||||
class Player: public ActorFrame
|
||||
{
|
||||
public:
|
||||
@@ -33,7 +31,6 @@ public:
|
||||
virtual void Update( float fDeltaTime );
|
||||
virtual void ProcessMessages( float fDeltaTime );
|
||||
virtual void DrawPrimitives();
|
||||
virtual void HandleMessage( const RString& sMessage );
|
||||
|
||||
void Init(
|
||||
const RString &sType,
|
||||
@@ -70,7 +67,6 @@ protected:
|
||||
void OnRowCompletelyJudged( int iStepIndex );
|
||||
void HandleTapRowScore( unsigned row );
|
||||
void HandleHoldScore( HoldNoteScore holdScore, TapNoteScore tapScore );
|
||||
void HandleAutosync(float fNoteOffset);
|
||||
void DrawTapJudgments();
|
||||
void DrawHoldJudgments();
|
||||
|
||||
@@ -86,8 +82,6 @@ protected:
|
||||
float m_fNoteFieldHeight;
|
||||
|
||||
bool m_bPaused;
|
||||
float m_fOffset[SAMPLE_COUNT]; // for AutoSync
|
||||
int m_iOffsetSample;
|
||||
|
||||
NoteField *m_pNoteField;
|
||||
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include "InputEventPlus.h"
|
||||
#include "NotesWriterSM.h"
|
||||
#include "LocalizedString.h"
|
||||
#include "AdjustSync.h"
|
||||
|
||||
static Preference<float> g_iDefaultRecordLength( "DefaultRecordLength", 4 );
|
||||
static Preference<bool> g_bEditorShowBGChangesPlay( "EditorShowBGChangesPlay", false );
|
||||
@@ -1987,7 +1988,7 @@ void ScreenEdit::TransitionEditState( EditState em )
|
||||
break;
|
||||
|
||||
case STATE_PLAYING:
|
||||
if( GAMESTATE->IsSyncDataChanged() )
|
||||
if( AdjustSync::IsSyncDataChanged() )
|
||||
ScreenSaveSync::PromptSaveSync();
|
||||
break;
|
||||
|
||||
@@ -2048,7 +2049,7 @@ void ScreenEdit::TransitionEditState( EditState em )
|
||||
case STATE_PLAYING:
|
||||
case STATE_RECORDING:
|
||||
{
|
||||
GAMESTATE->ResetOriginalSyncData();
|
||||
AdjustSync::ResetOriginalSyncData();
|
||||
|
||||
/* Give a 1 second lead-in. If we're loading Player, this must be done first. */
|
||||
float fSeconds = m_pSong->m_Timing.GetElapsedTimeFromBeat( NoteRowToBeat(m_iStartPlayingAt) ) - 1;
|
||||
|
||||
@@ -53,6 +53,7 @@
|
||||
#include "Background.h"
|
||||
#include "Foreground.h"
|
||||
#include "ScreenSaveSync.h"
|
||||
#include "AdjustSync.h"
|
||||
|
||||
//
|
||||
// Defines
|
||||
@@ -2504,7 +2505,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
|
||||
|
||||
GAMESTATE->CancelStage();
|
||||
|
||||
if( GAMESTATE->IsSyncDataChanged() )
|
||||
if( AdjustSync::IsSyncDataChanged() )
|
||||
ScreenSaveSync::PromptSaveSync( SM_GoToPrevScreen );
|
||||
else
|
||||
HandleScreenMessage( SM_GoToPrevScreen );
|
||||
@@ -2515,7 +2516,7 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
|
||||
StageFinished( false );
|
||||
//SaveRecordedResults();
|
||||
|
||||
if( GAMESTATE->IsSyncDataChanged() )
|
||||
if( AdjustSync::IsSyncDataChanged() )
|
||||
ScreenSaveSync::PromptSaveSync( SM_GoToNextScreen );
|
||||
else
|
||||
HandleScreenMessage( SM_GoToNextScreen );
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "GameState.h"
|
||||
#include "GameManager.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "AdjustSync.h"
|
||||
|
||||
REGISTER_SCREEN_CLASS( ScreenGameplaySyncMachine );
|
||||
|
||||
@@ -11,7 +12,7 @@ void ScreenGameplaySyncMachine::Init()
|
||||
{
|
||||
GAMESTATE->m_PlayMode.Set( PLAY_MODE_REGULAR );
|
||||
GAMESTATE->m_pCurStyle.Set( GAMEMAN->GetHowToPlayStyleForGame(GAMESTATE->m_pCurGame) );
|
||||
GAMESTATE->ResetOriginalSyncData();
|
||||
AdjustSync::ResetOriginalSyncData();
|
||||
|
||||
SMLoader ld;
|
||||
RString sFile = THEME->GetPathO("ScreenGameplaySyncMachine","music.sm");
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
#include "CommonMetrics.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "InputEventPlus.h"
|
||||
#include "AdjustSync.h"
|
||||
|
||||
#define SHOW_COURSE_MODIFIERS_PROBABILITY THEME->GetMetricF(m_sName,"ShowCourseModifiersProbability")
|
||||
|
||||
@@ -95,7 +96,7 @@ void ScreenJukebox::SetSong()
|
||||
// Found something we can use!
|
||||
GAMESTATE->m_pCurSong.Set( pSong );
|
||||
// We just changed the song. Reset the original sync data.
|
||||
GAMESTATE->ResetOriginalSyncData();
|
||||
AdjustSync::ResetOriginalSyncData();
|
||||
FOREACH_PlayerNumber( p )
|
||||
GAMESTATE->m_pCurSteps[p].Set( pSteps );
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include "song.h"
|
||||
#include "PrefsManager.h"
|
||||
#include "LocalizedString.h"
|
||||
|
||||
#include "AdjustSync.h"
|
||||
|
||||
static LocalizedString EARLIER ("ScreenSaveSync","earlier");
|
||||
static LocalizedString LATER ("ScreenSaveSync","later");
|
||||
@@ -20,7 +20,7 @@ static RString GetPromptText()
|
||||
RString s;
|
||||
|
||||
{
|
||||
float fOld = GAMESTATE->m_fGlobalOffsetSecondsOriginal;
|
||||
float fOld = AdjustSync::s_fGlobalOffsetSecondsOriginal;
|
||||
float fNew = PREFSMAN->m_fGlobalOffsetSeconds;
|
||||
float fDelta = fNew - fOld;
|
||||
|
||||
@@ -40,7 +40,7 @@ static RString GetPromptText()
|
||||
if( GAMESTATE->m_pCurSong.Get() )
|
||||
{
|
||||
{
|
||||
float fOld = GAMESTATE->m_pTimingDataOriginal->m_fBeat0OffsetInSeconds;
|
||||
float fOld = AdjustSync::s_pTimingDataOriginal->m_fBeat0OffsetInSeconds;
|
||||
float fNew = GAMESTATE->m_pCurSong->m_Timing.m_fBeat0OffsetInSeconds;
|
||||
float fDelta = fNew - fOld;
|
||||
|
||||
@@ -57,7 +57,7 @@ static RString GetPromptText()
|
||||
|
||||
for( unsigned i=0; i<GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments.size(); i++ )
|
||||
{
|
||||
float fOld = GAMESTATE->m_pTimingDataOriginal->m_BPMSegments[i].m_fBPS;
|
||||
float fOld = AdjustSync::s_pTimingDataOriginal->m_BPMSegments[i].m_fBPS;
|
||||
float fNew = GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments[i].m_fBPS;
|
||||
float fDelta = fNew - fOld;
|
||||
|
||||
@@ -74,7 +74,7 @@ static RString GetPromptText()
|
||||
|
||||
for( unsigned i=0; i<GAMESTATE->m_pCurSong->m_Timing.m_StopSegments.size(); i++ )
|
||||
{
|
||||
float fOld = GAMESTATE->m_pTimingDataOriginal->m_StopSegments[i].m_fStopSeconds;
|
||||
float fOld = AdjustSync::s_pTimingDataOriginal->m_StopSegments[i].m_fStopSeconds;
|
||||
float fNew = GAMESTATE->m_pCurSong->m_Timing.m_StopSegments[i].m_fStopSeconds;
|
||||
float fDelta = fNew - fOld;
|
||||
|
||||
@@ -109,12 +109,12 @@ static RString GetPromptText()
|
||||
|
||||
static void SaveSyncChanges( void* pThrowAway )
|
||||
{
|
||||
GAMESTATE->SaveSyncChanges();
|
||||
AdjustSync::SaveSyncChanges();
|
||||
}
|
||||
|
||||
static void RevertSyncChanges( void* pThrowAway )
|
||||
{
|
||||
GAMESTATE->RevertSyncChanges();
|
||||
AdjustSync::RevertSyncChanges();
|
||||
}
|
||||
|
||||
void ScreenSaveSync::Init()
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
#include "PrefsManager.h"
|
||||
#include "InputEventPlus.h"
|
||||
#include "LocalizedString.h"
|
||||
#include "AdjustSync.h"
|
||||
|
||||
static bool IsGameplay()
|
||||
{
|
||||
@@ -103,7 +104,7 @@ void ScreenSyncOverlay::UpdateText()
|
||||
if( GAMESTATE->m_pCurSong != NULL && !GAMESTATE->IsCourseMode() ) // sync controls available
|
||||
{
|
||||
{
|
||||
float fOld = GAMESTATE->m_fGlobalOffsetSecondsOriginal;
|
||||
float fOld = AdjustSync::s_fGlobalOffsetSecondsOriginal;
|
||||
float fNew = PREFSMAN->m_fGlobalOffsetSeconds;
|
||||
float fDelta = fNew - fOld;
|
||||
|
||||
@@ -118,7 +119,7 @@ void ScreenSyncOverlay::UpdateText()
|
||||
}
|
||||
|
||||
{
|
||||
float fOld = GAMESTATE->m_pTimingDataOriginal->m_fBeat0OffsetInSeconds;
|
||||
float fOld = AdjustSync::s_pTimingDataOriginal->m_fBeat0OffsetInSeconds;
|
||||
float fNew = GAMESTATE->m_pCurSong->m_Timing.m_fBeat0OffsetInSeconds;
|
||||
float fDelta = fNew - fOld;
|
||||
|
||||
@@ -132,11 +133,11 @@ void ScreenSyncOverlay::UpdateText()
|
||||
}
|
||||
}
|
||||
|
||||
ASSERT( GAMESTATE->m_pTimingDataOriginal->m_BPMSegments.size() == GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments.size() );
|
||||
ASSERT( AdjustSync::s_pTimingDataOriginal->m_BPMSegments.size() == GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments.size() );
|
||||
|
||||
for( unsigned i=0; i<GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments.size(); i++ )
|
||||
{
|
||||
float fOldBpm = GAMESTATE->m_pTimingDataOriginal->m_BPMSegments[i].m_fBPS;
|
||||
float fOldBpm = AdjustSync::s_pTimingDataOriginal->m_BPMSegments[i].m_fBPS;
|
||||
float fNewBpm = GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments[i].m_fBPS;
|
||||
float fDelta = fNewBpm - fOldBpm;
|
||||
|
||||
@@ -203,7 +204,7 @@ bool ScreenSyncOverlay::OverlayInput( const InputEventPlus &input )
|
||||
{
|
||||
case RevertSyncChanges:
|
||||
SCREENMAN->SystemMessage( SYNC_CHANGES_REVERTED );
|
||||
GAMESTATE->RevertSyncChanges();
|
||||
AdjustSync::RevertSyncChanges();
|
||||
break;
|
||||
case ChangeSongBPM:
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user