sync controls cleanup:

move sync display/saving out of complicated ScreenGameplay
  show sync UI in editor playback as well as gameplay
  revert sync from in-memory backup, not from disk
  move more functions into debug overlay
This commit is contained in:
Chris Danford
2005-05-19 23:29:39 +00:00
parent f20e5915b0
commit d67d60e178
34 changed files with 902 additions and 383 deletions
+41 -3
View File
@@ -63,7 +63,6 @@ GameState::GameState() :
m_pCurGame = NULL; m_pCurGame = NULL;
m_iCoins = 0; m_iCoins = 0;
m_timeGameStarted.SetZero(); m_timeGameStarted.SetZero();
m_bIsOnSystemMenu = false;
ReloadCharacters(); ReloadCharacters();
@@ -82,6 +81,8 @@ GameState::GameState() :
m_Environment = new LuaTable; m_Environment = new LuaTable;
m_pTimingDataOriginal = new TimingData;
/* Don't reset yet; let the first screen do it, so we can /* Don't reset yet; let the first screen do it, so we can
* use PREFSMAN and THEME. */ * use PREFSMAN and THEME. */
// Reset(); // Reset();
@@ -95,7 +96,9 @@ GameState::~GameState()
FOREACH_PlayerNumber( p ) FOREACH_PlayerNumber( p )
SAFE_DELETE( m_pPlayerState[p] ); SAFE_DELETE( m_pPlayerState[p] );
delete m_Environment; SAFE_DELETE( m_Environment );
SAFE_DELETE( m_pTimingDataOriginal );
} }
void GameState::ApplyGameCommand( const CString &sCommand, PlayerNumber pn ) void GameState::ApplyGameCommand( const CString &sCommand, PlayerNumber pn )
@@ -300,7 +303,7 @@ void GameState::PlayersFinalized()
if( MEMCARDMAN->GetCardsLocked() ) if( MEMCARDMAN->GetCardsLocked() )
return; return;
MESSAGEMAN->Broadcast( PLAYERS_FINALIZED ); MESSAGEMAN->Broadcast( MESSAGE_PLAYERS_FINALIZED );
MEMCARDMAN->LockCards(); MEMCARDMAN->LockCards();
@@ -678,6 +681,8 @@ void GameState::ResetStageStatistics()
// Reset the round seed. Do this here and not in FinishStage so that players // Reset the round seed. Do this here and not in FinishStage so that players
// get new shuffle patterns if they Back out of gameplay and play again. // get new shuffle patterns if they Back out of gameplay and play again.
GAMESTATE->m_iStageSeed = rand(); GAMESTATE->m_iStageSeed = rand();
ResetOriginalSyncData();
} }
void GameState::UpdateSongPosition( float fPositionSeconds, const TimingData &timing, const RageTimer &timestamp ) void GameState::UpdateSongPosition( float fPositionSeconds, const TimingData &timing, const RageTimer &timestamp )
@@ -1906,6 +1911,37 @@ bool GameState::PlayerIsUsingModifier( PlayerNumber pn, const CString &sModifier
return po == GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions && so == GAMESTATE->m_SongOptions; return po == GAMESTATE->m_pPlayerState[pn]->m_PlayerOptions && so == GAMESTATE->m_SongOptions;
} }
void GameState::ResetOriginalSyncData()
{
if( m_pCurSong )
*m_pTimingDataOriginal = m_pCurSong->m_Timing;
else
*m_pTimingDataOriginal = TimingData();
m_fGlobalOffsetSecondsOriginal = PREFSMAN->m_fGlobalOffsetSeconds;
}
bool GameState::IsSyncDataChanged()
{
if( m_pCurSong && *m_pTimingDataOriginal != m_pCurSong->m_Timing )
return true;
if( m_fGlobalOffsetSecondsOriginal != PREFSMAN->m_fGlobalOffsetSeconds )
return true;
return false;
}
void GameState::SaveSyncChanges()
{
GAMESTATE->m_pCurSong->Save();
PREFSMAN->SaveGlobalPrefsToDisk();
}
void GameState::RevertSyncChanges()
{
PREFSMAN->m_fGlobalOffsetSeconds.Set( GAMESTATE->m_fGlobalOffsetSecondsOriginal );
GAMESTATE->m_pCurSong->m_Timing = *GAMESTATE->m_pTimingDataOriginal;
}
// lua start // lua start
#include "LuaBinding.h" #include "LuaBinding.h"
@@ -2014,6 +2050,7 @@ public:
static int GetNumSidesJoined( T* p, lua_State *L ) { lua_pushnumber(L, p->GetNumSidesJoined() ); return 1; } static int GetNumSidesJoined( T* p, lua_State *L ) { lua_pushnumber(L, p->GetNumSidesJoined() ); return 1; }
static int GetCoinMode( T* p, lua_State *L ) { lua_pushnumber(L, p->GetCoinMode() ); return 1; } static int GetCoinMode( T* p, lua_State *L ) { lua_pushnumber(L, p->GetCoinMode() ); return 1; }
static int GetPremium( T* p, lua_State *L ) { lua_pushnumber(L, p->GetPremium() ); return 1; } static int GetPremium( T* p, lua_State *L ) { lua_pushnumber(L, p->GetPremium() ); return 1; }
static int IsSyncDataChanged( T* p, lua_State *L ) { lua_pushboolean(L, p->IsSyncDataChanged() ); return 1; }
static void Register(lua_State *L) static void Register(lua_State *L)
{ {
@@ -2058,6 +2095,7 @@ public:
ADD_METHOD( GetNumSidesJoined ) ADD_METHOD( GetNumSidesJoined )
ADD_METHOD( GetCoinMode ) ADD_METHOD( GetCoinMode )
ADD_METHOD( GetPremium ) ADD_METHOD( GetPremium )
ADD_METHOD( IsSyncDataChanged )
Luna<T>::Register( L ); Luna<T>::Register( L );
+8 -1
View File
@@ -55,7 +55,6 @@ public:
PlayMode m_PlayMode; // many screens display different info depending on this value PlayMode m_PlayMode; // many screens display different info depending on this value
int m_iCoins; // not "credits" int m_iCoins; // not "credits"
PlayerNumber m_MasterPlayerNumber; // used in Styles where one player controls both sides PlayerNumber m_MasterPlayerNumber; // used in Styles where one player controls both sides
bool m_bIsOnSystemMenu; // system screens will not be effected by the operator key -- Miryokuteki
BroadcastOnChange1D<CourseDifficulty,NUM_PLAYERS> m_PreferredCourseDifficulty;// used in nonstop BroadcastOnChange1D<CourseDifficulty,NUM_PLAYERS> m_PreferredCourseDifficulty;// used in nonstop
bool DifficultiesLocked(); bool DifficultiesLocked();
bool ChangePreferredDifficulty( PlayerNumber pn, Difficulty dc ); bool ChangePreferredDifficulty( PlayerNumber pn, Difficulty dc );
@@ -302,6 +301,14 @@ public:
float GetGoalPercentComplete( PlayerNumber pn ); float GetGoalPercentComplete( PlayerNumber pn );
bool IsGoalComplete( PlayerNumber pn ) { return GetGoalPercentComplete( pn ) >= 1; } 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 // Lua
void PushSelf( lua_State *L ); void PushSelf( lua_State *L );
}; };
+3 -1
View File
@@ -42,7 +42,9 @@ ScreenNameEntry.cpp ScreenNameEntry.h ScreenNameEntryTraditional.cpp ScreenNameE
ScreenOptions.cpp ScreenOptions.h ScreenOptionsMaster.cpp ScreenOptionsMaster.h \ ScreenOptions.cpp ScreenOptions.h ScreenOptionsMaster.cpp ScreenOptionsMaster.h \
ScreenOptionsMasterPrefs.cpp ScreenOptionsMasterPrefs.h ScreenPackages.cpp ScreenPackages.h ScreenPlayerOptions.cpp ScreenPlayerOptions.h ScreenNetworkOptions.h \ ScreenOptionsMasterPrefs.cpp ScreenOptionsMasterPrefs.h ScreenPackages.cpp ScreenPackages.h ScreenPlayerOptions.cpp ScreenPlayerOptions.h ScreenNetworkOptions.h \
ScreenNetworkOptions.cpp ScreenProfileOptions.cpp ScreenProfileOptions.h ScreenPrompt.cpp ScreenPrompt.h ScreenRanking.cpp ScreenRanking.h \ ScreenNetworkOptions.cpp ScreenProfileOptions.cpp ScreenProfileOptions.h ScreenPrompt.cpp ScreenPrompt.h ScreenRanking.cpp ScreenRanking.h \
ScreenReloadSongs.cpp ScreenReloadSongs.h ScreenSandbox.cpp ScreenSandbox.h \ ScreenReloadSongs.cpp ScreenReloadSongs.h \
ScreenSandbox.cpp ScreenSandbox.h \
ScreenSaveSync.cpp ScreenSaveSync.h \
ScreenSelect.cpp ScreenSelect.h ScreenSelectCharacter.cpp ScreenSelectCharacter.h \ ScreenSelect.cpp ScreenSelect.h ScreenSelectCharacter.cpp ScreenSelectCharacter.h \
ScreenSelectDifficulty.cpp ScreenSelectDifficulty.h ScreenSelectGroup.cpp ScreenSelectGroup.h \ ScreenSelectDifficulty.cpp ScreenSelectDifficulty.h ScreenSelectGroup.cpp ScreenSelectGroup.h \
ScreenSelectMaster.cpp ScreenSelectMaster.h ScreenSelectMode.cpp ScreenSelectMode.h \ ScreenSelectMaster.cpp ScreenSelectMaster.h ScreenSelectMode.cpp ScreenSelectMode.h \
+2
View File
@@ -46,6 +46,8 @@ static const CString MessageNames[] = {
"SideJoinedP1", "SideJoinedP1",
"SideJoinedP2", "SideJoinedP2",
"PlayersFinalized", "PlayersFinalized",
"AssistTickChanged",
"AutosyncChanged",
}; };
XToString( Message, NUM_MESSAGES ); XToString( Message, NUM_MESSAGES );
+4 -2
View File
@@ -52,7 +52,9 @@ enum Message
MESSAGE_COIN_INSERTED, MESSAGE_COIN_INSERTED,
MESSAGE_SIDE_JOINED_P1, MESSAGE_SIDE_JOINED_P1,
MESSAGE_SIDE_JOINED_P2, MESSAGE_SIDE_JOINED_P2,
PLAYERS_FINALIZED, MESSAGE_PLAYERS_FINALIZED,
MESSAGE_ASSIST_TICK_CHANGED,
MESSAGE_AUTOSYNC_CHANGED,
NUM_MESSAGES, NUM_MESSAGES,
MESSAGE_INVALID MESSAGE_INVALID
}; };
@@ -118,7 +120,7 @@ private:
Message mSendWhenChanged; Message mSendWhenChanged;
T *val; T *val;
public: public:
BroadcastOnChangePtr( Message m ) { mSendWhenChanged = m; } BroadcastOnChangePtr( Message m ) { mSendWhenChanged = m; val = NULL; }
const T* Get() const { return val; } const T* Get() const { return val; }
void Set( T* t ) { val = t; if(MESSAGEMAN) MESSAGEMAN->Broadcast( MessageToString(mSendWhenChanged) ); } void Set( T* t ) { val = t; if(MESSAGEMAN) MESSAGEMAN->Broadcast( MessageToString(mSendWhenChanged) ); }
operator T* () const { return val; } operator T* () const { return val; }
+15 -3
View File
@@ -77,6 +77,8 @@ Player::Player()
PlayerAI::InitFromDisk(); PlayerAI::InitFromDisk();
m_pNoteField = new NoteField; m_pNoteField = new NoteField;
this->SubscribeToMessage( MESSAGE_AUTOSYNC_CHANGED );
} }
Player::~Player() Player::~Player()
@@ -1140,7 +1142,9 @@ void Player::HandleAutosync(float fNoteOffset)
if( GAMESTATE->m_SongOptions.m_AutosyncType == SongOptions::AUTOSYNC_OFF ) if( GAMESTATE->m_SongOptions.m_AutosyncType == SongOptions::AUTOSYNC_OFF )
return; return;
m_fOffset[m_iOffsetSample++] = fNoteOffset; m_fOffset[m_iOffsetSample] = fNoteOffset;
m_iOffsetSample++;
if( m_iOffsetSample < SAMPLE_COUNT ) if( m_iOffsetSample < SAMPLE_COUNT )
return; /* need more */ return; /* need more */
@@ -1174,11 +1178,11 @@ void Player::HandleAutosync(float fNoteOffset)
ASSERT(0); ASSERT(0);
} }
SCREENMAN->SystemMessage( ssprintf(sAutosyncType+": Offset corrected by %f. Error in steps: %f seconds.", mean, stddev) ); SCREENMAN->SystemMessage( "Autosync: Correction applied." );
} }
else else
{ {
SCREENMAN->SystemMessage( ssprintf(sAutosyncType+": Offset NOT corrected. Average offset: %f seconds. Error: %f seconds.", mean, stddev) ); SCREENMAN->SystemMessage( "Autosync: Correction NOT applied.\n Timing deviation too high." );
} }
m_iOffsetSample = 0; m_iOffsetSample = 0;
@@ -1646,6 +1650,14 @@ bool Player::IsPlayingBeginner() const
} }
} }
void Player::HandleMessage( const CString& sMessage )
{
// Reset autosync samples when toggling
if( sMessage == MessageToString(MESSAGE_AUTOSYNC_CHANGED) )
m_iOffsetSample = 0;
}
/* /*
* (c) 2001-2004 Chris Danford * (c) 2001-2004 Chris Danford
* All rights reserved. * All rights reserved.
+1
View File
@@ -31,6 +31,7 @@ public:
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void DrawPrimitives(); virtual void DrawPrimitives();
virtual void HandleMessage( const CString& sMessage );
void Init( void Init(
const CString &sType, const CString &sType,
+2 -2
View File
@@ -1,6 +1,6 @@
#include "global.h" #include "global.h"
#include "RageMath.h"
#include "RageUtil.h" #include "RageUtil.h"
#include "RageMath.h"
#include "RageLog.h" #include "RageLog.h"
#include "RageFile.h" #include "RageFile.h"
@@ -179,7 +179,7 @@ CString Commify( int iNum )
return sReturn; return sReturn;
} }
CString AddNumberSuffix( int i ) CString FormatNumberAndSuffix( int i )
{ {
CString sSuffix; CString sSuffix;
switch( i%10 ) switch( i%10 )
+1 -1
View File
@@ -219,7 +219,7 @@ CString SecondsToMMSSMsMsMs( float fSecs );
CString PrettyPercent( float fNumerator, float fDenominator ); CString PrettyPercent( float fNumerator, float fDenominator );
inline CString PrettyPercent( int fNumerator, int fDenominator ) { return PrettyPercent( float(fNumerator), float(fDenominator) ); } inline CString PrettyPercent( int fNumerator, int fDenominator ) { return PrettyPercent( float(fNumerator), float(fDenominator) ); }
CString Commify( int iNum ); CString Commify( int iNum );
CString AddNumberSuffix( int i ); CString FormatNumberAndSuffix( int i );
struct tm GetLocalTime(); struct tm GetLocalTime();
+2
View File
@@ -17,6 +17,8 @@ Screen::Screen( CString sName )
{ {
SetName( sName ); SetName( sName );
m_bIsTransparent = false; m_bIsTransparent = false;
ALLOW_OPERATOR_MENU_BUTTON.Load( sName, "AllowOperatorMenuButton" );
} }
Screen::~Screen() Screen::~Screen()
+12
View File
@@ -10,6 +10,7 @@
#include "MenuInput.h" #include "MenuInput.h"
#include "StyleInput.h" #include "StyleInput.h"
#include "ScreenManager.h" #include "ScreenManager.h"
#include "ThemeMetric.h"
// Each Screen class should have a REGISTER_SCREEN_CLASS in its CPP file. // Each Screen class should have a REGISTER_SCREEN_CLASS in its CPP file.
#define REGISTER_SCREEN_CLASS( className ) \ #define REGISTER_SCREEN_CLASS( className ) \
@@ -20,6 +21,14 @@
}; \ }; \
static Register##className register_##className; static Register##className register_##className;
enum ScreenType
{
attract,
game_menu,
gameplay,
system_menu
};
class Screen : public ActorFrame class Screen : public ActorFrame
{ {
public: public:
@@ -40,6 +49,7 @@ public:
bool IsTransparent() const { return m_bIsTransparent; } bool IsTransparent() const { return m_bIsTransparent; }
virtual bool UsesBackground() const { return true; } // override and set false if this screen shouldn't load a background virtual bool UsesBackground() const { return true; } // override and set false if this screen shouldn't load a background
virtual ScreenType GetScreenType() const { return ALLOW_OPERATOR_MENU_BUTTON ? system_menu : game_menu; }
static bool JoinInput( const MenuInput &MenuI ); // return true if a player joined static bool JoinInput( const MenuInput &MenuI ); // return true if a player joined
@@ -54,6 +64,8 @@ protected:
bool m_bIsTransparent; // screens below us need to be drawn first bool m_bIsTransparent; // screens below us need to be drawn first
ThemeMetric<bool> ALLOW_OPERATOR_MENU_BUTTON;
public: public:
// let subclass override if they want // let subclass override if they want
+2
View File
@@ -21,6 +21,8 @@ public:
virtual void Update( float fDelta ); virtual void Update( float fDelta );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
virtual ScreenType GetScreenType() const { return attract; }
protected: protected:
virtual void StartPlayingMusic(); virtual void StartPlayingMusic();
}; };
+153 -55
View File
@@ -9,6 +9,12 @@
#include "GameCommand.h" #include "GameCommand.h"
#include "ScreenGameplay.h" #include "ScreenGameplay.h"
#include "RageSoundManager.h" #include "RageSoundManager.h"
#include "GameSoundManager.h"
#include "RageTextureManager.h"
#include "NoteSkinManager.h"
#include "Bookkeeper.h"
#include "ProfileManager.h"
#include "CodeDetector.h"
static bool g_bIsDisplayed = false; static bool g_bIsDisplayed = false;
static bool g_bIsSlow = false; static bool g_bIsSlow = false;
@@ -16,6 +22,11 @@ static bool g_bIsHalt = false;
static RageTimer g_HaltTimer(RageZeroTimer); static RageTimer g_HaltTimer(RageZeroTimer);
static bool g_bMute = false; static bool g_bMute = false;
static bool IsGameplay()
{
return SCREENMAN && SCREENMAN->GetTopScreen() && SCREENMAN->GetTopScreen()->GetScreenType() == gameplay;
}
REGISTER_SCREEN_CLASS( ScreenDebugOverlay ); REGISTER_SCREEN_CLASS( ScreenDebugOverlay );
ScreenDebugOverlay::ScreenDebugOverlay( const CString &sName ) : Screen(sName) ScreenDebugOverlay::ScreenDebugOverlay( const CString &sName ) : Screen(sName)
{ {
@@ -27,13 +38,17 @@ ScreenDebugOverlay::~ScreenDebugOverlay()
struct MapDebugToDI struct MapDebugToDI
{ {
DeviceInput holdForMenu; DeviceInput holdForDebug;
DeviceInput button[NUM_DEBUG_LINES]; DeviceInput debugButton[NUM_DEBUG_LINES];
DeviceInput gameplayButton[NUM_DEBUG_LINES];
void Clear() void Clear()
{ {
holdForMenu.MakeInvalid(); holdForDebug.MakeInvalid();
FOREACH_DebugLine(i) FOREACH_DebugLine(i)
button[i].MakeInvalid(); {
debugButton[i].MakeInvalid();
gameplayButton[i].MakeInvalid();
}
} }
}; };
static MapDebugToDI g_Mappings; static MapDebugToDI g_Mappings;
@@ -41,7 +56,12 @@ static MapDebugToDI g_Mappings;
static CString GetDebugButtonName( DebugLine i ) static CString GetDebugButtonName( DebugLine i )
{ {
// TODO: Make arch appropriate. // TODO: Make arch appropriate.
return g_Mappings.button[i].toString(); vector<CString> v;
if( g_Mappings.debugButton[i].IsValid() )
v.push_back( g_Mappings.debugButton[i].toString() );
if( g_Mappings.gameplayButton[i].IsValid() )
v.push_back( g_Mappings.gameplayButton[i].toString()+" in gameplay" );
return join( " or ", v );
} }
void ScreenDebugOverlay::Init() void ScreenDebugOverlay::Init()
@@ -53,20 +73,26 @@ void ScreenDebugOverlay::Init()
{ {
g_Mappings.Clear(); g_Mappings.Clear();
g_Mappings.holdForMenu = DeviceInput(DEVICE_KEYBOARD, KEY_F3); g_Mappings.holdForDebug = DeviceInput(DEVICE_KEYBOARD, KEY_F3);
g_Mappings.button[0] = DeviceInput(DEVICE_KEYBOARD, KEY_C1);
g_Mappings.button[1] = DeviceInput(DEVICE_KEYBOARD, KEY_C2); g_Mappings.gameplayButton[0] = DeviceInput(DEVICE_KEYBOARD, KEY_F8);
g_Mappings.button[2] = DeviceInput(DEVICE_KEYBOARD, KEY_C3); g_Mappings.gameplayButton[1] = DeviceInput(DEVICE_KEYBOARD, KEY_F7);
g_Mappings.button[3] = DeviceInput(DEVICE_KEYBOARD, KEY_C4); g_Mappings.gameplayButton[2] = DeviceInput(DEVICE_KEYBOARD, KEY_F6);
g_Mappings.button[4] = DeviceInput(DEVICE_KEYBOARD, KEY_C5); g_Mappings.debugButton[3] = DeviceInput(DEVICE_KEYBOARD, KEY_C1);
g_Mappings.button[5] = DeviceInput(DEVICE_KEYBOARD, KEY_C6); g_Mappings.debugButton[4] = DeviceInput(DEVICE_KEYBOARD, KEY_C2);
g_Mappings.button[6] = DeviceInput(DEVICE_KEYBOARD, KEY_C7); g_Mappings.debugButton[5] = DeviceInput(DEVICE_KEYBOARD, KEY_C3);
g_Mappings.button[7] = DeviceInput(DEVICE_KEYBOARD, KEY_C8); g_Mappings.debugButton[6] = DeviceInput(DEVICE_KEYBOARD, KEY_C4);
g_Mappings.button[8] = DeviceInput(DEVICE_KEYBOARD, KEY_C9); g_Mappings.debugButton[7] = DeviceInput(DEVICE_KEYBOARD, KEY_C5);
g_Mappings.button[9] = DeviceInput(DEVICE_KEYBOARD, KEY_C0); g_Mappings.debugButton[8] = DeviceInput(DEVICE_KEYBOARD, KEY_C6);
g_Mappings.button[10] = DeviceInput(DEVICE_KEYBOARD, KEY_UNDERSCORE); g_Mappings.debugButton[9] = DeviceInput(DEVICE_KEYBOARD, KEY_C7);
g_Mappings.button[11] = DeviceInput(DEVICE_KEYBOARD, KEY_EQUAL); g_Mappings.debugButton[10] = DeviceInput(DEVICE_KEYBOARD, KEY_C8);
g_Mappings.button[12] = DeviceInput(DEVICE_KEYBOARD, KEY_PAUSE); g_Mappings.debugButton[11] = DeviceInput(DEVICE_KEYBOARD, KEY_C9);
g_Mappings.debugButton[12] = DeviceInput(DEVICE_KEYBOARD, KEY_C0);
g_Mappings.debugButton[13] = DeviceInput(DEVICE_KEYBOARD, KEY_HYPHEN);
g_Mappings.debugButton[14] = DeviceInput(DEVICE_KEYBOARD, KEY_EQUAL);
g_Mappings.debugButton[15] = DeviceInput(DEVICE_KEYBOARD, KEY_LBRACKET);
g_Mappings.debugButton[16] = DeviceInput(DEVICE_KEYBOARD, KEY_RBRACKET);
g_Mappings.debugButton[17] = DeviceInput(DEVICE_KEYBOARD, KEY_BACKSLASH);
} }
@@ -74,20 +100,27 @@ void ScreenDebugOverlay::Init()
m_Quad.SetDiffuse( RageColor(0, 0, 0, 0.5f) ); m_Quad.SetDiffuse( RageColor(0, 0, 0, 0.5f) );
this->AddChild( &m_Quad ); this->AddChild( &m_Quad );
m_Header.LoadFromFont( THEME->GetPathToF("Common normal") ); m_textHeader.LoadFromFont( THEME->GetPathToF("Common normal") );
m_Header.SetHorizAlign( Actor::align_left ); m_textHeader.SetHorizAlign( Actor::align_left );
m_Header.SetX( 20 ); m_textHeader.SetX( SCREEN_LEFT+20 );
m_Header.SetY( SCREEN_TOP+20 ); m_textHeader.SetY( SCREEN_TOP+20 );
m_Header.SetZoom( 1.0f ); m_textHeader.SetZoom( 1.0f );
m_Header.SetText( "Debug Menu" ); m_textHeader.SetText( "Debug Menu" );
this->AddChild( &m_Header ); this->AddChild( &m_textHeader );
FOREACH_DebugLine( i ) FOREACH_DebugLine( i )
{ {
BitmapText &txt = m_Text[i]; BitmapText &txt1 = m_textButton[i];
txt.LoadFromFont( THEME->GetPathToF("Common normal") ); txt1.LoadFromFont( THEME->GetPathToF("Common normal") );
txt.SetHorizAlign( Actor::align_left ); txt1.SetHorizAlign( Actor::align_right );
this->AddChild( &txt ); txt1.SetShadowLength( 2 );
this->AddChild( &txt1 );
BitmapText &txt2 = m_textFunction[i];
txt2.LoadFromFont( THEME->GetPathToF("Common normal") );
txt2.SetHorizAlign( Actor::align_left );
txt2.SetShadowLength( 2 );
this->AddChild( &txt2 );
} }
Update( 0 ); Update( 0 );
@@ -133,28 +166,37 @@ void ScreenDebugOverlay::UpdateText()
FOREACH_DebugLine( i ) FOREACH_DebugLine( i )
{ {
BitmapText &txt = m_Text[i]; BitmapText &txt1 = m_textButton[i];
txt.SetX( 100 ); txt1.SetX( SCREEN_CENTER_X-50 );
txt.SetY( SCALE(i, 0, NUM_DEBUG_LINES-1, SCREEN_TOP+60, SCREEN_BOTTOM-40) ); txt1.SetY( SCALE(i, 0, NUM_DEBUG_LINES-1, SCREEN_TOP+60, SCREEN_BOTTOM-40) );
txt.SetZoom( 0.8f ); txt1.SetZoom( 0.7f );
BitmapText &txt2 = m_textFunction[i];
txt2.SetX( SCREEN_CENTER_X-30 );
txt2.SetY( SCALE(i, 0, NUM_DEBUG_LINES-1, SCREEN_TOP+60, SCREEN_BOTTOM-40) );
txt2.SetZoom( 0.7f );
CString s1; CString s1;
switch( i ) switch( i )
{ {
case DebugLine_Autoplay: s1="AutoPlay"; break; case DebugLine_Autoplay: s1="AutoPlay"; break;
case DebugLine_AssistTick: s1="AssistTick"; break;
case DebugLine_Autosync: s1="AutoSync"; break;
case DebugLine_CoinMode: s1="CoinMode"; break; case DebugLine_CoinMode: s1="CoinMode"; break;
case DebugLine_Slow: s1="Slow"; break; case DebugLine_Slow: s1="Slow"; break;
case DebugLine_Halt: s1="Halt"; break; case DebugLine_Halt: s1="Halt"; break;
case DebugLine_LightsDebug: s1="Lights Debug"; break; case DebugLine_LightsDebug: s1="Lights Debug"; break;
case DebugLine_MonkeyInput: s1="MonkeyInput"; break; case DebugLine_MonkeyInput: s1="MonkeyInput"; break;
case DebugLine_Stats: s1="Stats"; break; case DebugLine_Stats: s1="Rendering Stats"; break;
case DebugLine_Vsync: s1="Vsync"; break; case DebugLine_Vsync: s1="Vsync"; break;
case DebugLine_ScreenTestMode: s1="Screen Test Mode"; break; case DebugLine_ScreenTestMode: s1="Screen Test Mode"; break;
case DebugLine_ClearMachineStats: s1="Clear Machine Stats"; break; case DebugLine_ClearMachineStats: s1="Clear Machine Stats"; break;
case DebugLine_FillMachineStats: s1="Fill Machine Stats"; break; case DebugLine_FillMachineStats: s1="Fill Machine Stats"; break;
case DebugLine_SendNotesEnded: s1="Send Notes Ended"; break; case DebugLine_SendNotesEnded: s1="Send Notes Ended"; break;
case DebugLine_Volume: s1="Mute"; break; case DebugLine_Volume: s1="Mute"; break;
case DebugLine_CurrentScreen: s1="Screen"; break; case DebugLine_ReloadCurrentScreen: s1="Reload"; break;
case DebugLine_ReloadTheme: s1="Reload Theme"; break;
case DebugLine_WriteProfiles: s1="Write Profiles"; break;
case DebugLine_Uptime: s1="Uptime"; break; case DebugLine_Uptime: s1="Uptime"; break;
default: ASSERT(0); default: ASSERT(0);
} }
@@ -163,6 +205,8 @@ void ScreenDebugOverlay::UpdateText()
switch( i ) switch( i )
{ {
case DebugLine_Autoplay: bOn=PREFSMAN->m_AutoPlay.Get() != PC_HUMAN; break; case DebugLine_Autoplay: bOn=PREFSMAN->m_AutoPlay.Get() != PC_HUMAN; break;
case DebugLine_AssistTick: bOn=GAMESTATE->m_SongOptions.m_bAssistTick; break;
case DebugLine_Autosync: bOn=GAMESTATE->m_SongOptions.m_AutosyncType!=SongOptions::AUTOSYNC_OFF; break;
case DebugLine_CoinMode: bOn=true; break; case DebugLine_CoinMode: bOn=true; break;
case DebugLine_Slow: bOn=g_bIsSlow; break; case DebugLine_Slow: bOn=g_bIsSlow; break;
case DebugLine_Halt: bOn=g_bIsHalt; break; case DebugLine_Halt: bOn=g_bIsHalt; break;
@@ -175,7 +219,9 @@ void ScreenDebugOverlay::UpdateText()
case DebugLine_FillMachineStats: bOn=true; break; case DebugLine_FillMachineStats: bOn=true; break;
case DebugLine_SendNotesEnded: bOn=true; break; case DebugLine_SendNotesEnded: bOn=true; break;
case DebugLine_Volume: bOn=g_bMute; break; case DebugLine_Volume: bOn=g_bMute; break;
case DebugLine_CurrentScreen: bOn=false; break; case DebugLine_ReloadCurrentScreen: bOn=true; break;
case DebugLine_ReloadTheme: bOn=true; break;
case DebugLine_WriteProfiles: bOn=true; break;
case DebugLine_Uptime: bOn=false; break; case DebugLine_Uptime: bOn=false; break;
default: ASSERT(0); default: ASSERT(0);
} }
@@ -192,6 +238,16 @@ void ScreenDebugOverlay::UpdateText()
default: ASSERT(0); default: ASSERT(0);
} }
break; break;
case DebugLine_AssistTick: s2=bOn ? "on":"off"; break;
case DebugLine_Autosync:
switch( GAMESTATE->m_SongOptions.m_AutosyncType )
{
case SongOptions::AUTOSYNC_OFF: s2="off"; break;
case SongOptions::AUTOSYNC_SONG: s2="Song"; break;
case SongOptions::AUTOSYNC_MACHINE: s2="Machine"; break;
default: ASSERT(0);
}
break;
case DebugLine_CoinMode: s2=CoinModeToString(PREFSMAN->m_CoinMode); break; case DebugLine_CoinMode: s2=CoinModeToString(PREFSMAN->m_CoinMode); break;
case DebugLine_Slow: s2=bOn ? "on":"off"; break; case DebugLine_Slow: s2=bOn ? "on":"off"; break;
case DebugLine_Halt: s2=bOn ? "on":"off"; break; case DebugLine_Halt: s2=bOn ? "on":"off"; break;
@@ -204,19 +260,23 @@ void ScreenDebugOverlay::UpdateText()
case DebugLine_FillMachineStats: s2=""; break; case DebugLine_FillMachineStats: s2=""; break;
case DebugLine_SendNotesEnded: s2=""; break; case DebugLine_SendNotesEnded: s2=""; break;
case DebugLine_Volume: s2=bOn ? "on":"off"; break; case DebugLine_Volume: s2=bOn ? "on":"off"; break;
case DebugLine_CurrentScreen: s2=SCREENMAN ? SCREENMAN->GetTopScreen()->m_sName:""; break; case DebugLine_ReloadCurrentScreen: s2=SCREENMAN ? SCREENMAN->GetTopScreen()->m_sName:""; break;
case DebugLine_ReloadTheme: s2=""; break;
case DebugLine_WriteProfiles: s2=""; break;
case DebugLine_Uptime: s2=SecondsToMMSSMsMsMs(RageTimer::GetTimeSinceStart()); break; case DebugLine_Uptime: s2=SecondsToMMSSMsMsMs(RageTimer::GetTimeSinceStart()); break;
default: ASSERT(0); default: ASSERT(0);
} }
txt.SetDiffuse( bOn ? on:off ); txt1.SetDiffuse( bOn ? on:off );
txt2.SetDiffuse( bOn ? on:off );
CString sButton = GetDebugButtonName(i); CString sButton = GetDebugButtonName(i);
if( !sButton.empty() ) if( !sButton.empty() )
sButton += ": "; sButton += ": ";
txt1.SetText( sButton );
if( !s2.empty() ) if( !s2.empty() )
s1 += " - "; s1 += " - ";
txt.SetText( sButton + s1 + s2 ); txt2.SetText( s1 + s2 );
} }
if( g_bIsHalt ) if( g_bIsHalt )
@@ -233,7 +293,7 @@ void ScreenDebugOverlay::UpdateText()
bool ScreenDebugOverlay::OverlayInput( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ) bool ScreenDebugOverlay::OverlayInput( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
{ {
if( DeviceI == g_Mappings.holdForMenu ) if( DeviceI == g_Mappings.holdForDebug )
{ {
if( type == IET_FIRST_PRESS ) if( type == IET_FIRST_PRESS )
g_bIsDisplayed = true; g_bIsDisplayed = true;
@@ -241,23 +301,22 @@ bool ScreenDebugOverlay::OverlayInput( const DeviceInput& DeviceI, const InputEv
g_bIsDisplayed = false; g_bIsDisplayed = false;
} }
if( !g_bIsDisplayed )
return false;
if( type != IET_FIRST_PRESS ) if( type != IET_FIRST_PRESS )
return false; /* eat the input but do nothing */ return true; /* eat the input but do nothing */
FOREACH_DebugLine( i ) FOREACH_DebugLine( i )
{ {
if( DeviceI == g_Mappings.button[i] ) if( (g_bIsDisplayed && DeviceI == g_Mappings.debugButton[i]) ||
(IsGameplay() && DeviceI == g_Mappings.gameplayButton[i]) )
{ {
BitmapText &txt = m_Text[i]; BitmapText &txt1 = m_textButton[i];
txt1.FinishTweening();
float fZoom = txt1.GetZoom();
txt1.SetZoom( fZoom * 1.2f );
txt1.BeginTweening( 0.2f, Actor::TWEEN_LINEAR );
txt1.SetZoom( fZoom );
txt.FinishTweening(); BitmapText &txt2 = m_textFunction[i];
float fZoom = txt.GetZoom();
txt.SetZoom( fZoom * 1.2f );
txt.BeginTweening( 0.2f, Actor::TWEEN_LINEAR );
txt.SetZoom( fZoom );
switch( i ) switch( i )
{ {
@@ -270,6 +329,26 @@ bool ScreenDebugOverlay::OverlayInput( const DeviceInput& DeviceI, const InputEv
GAMESTATE->m_pPlayerState[pn]->m_PlayerController = PREFSMAN->m_AutoPlay; GAMESTATE->m_pPlayerState[pn]->m_PlayerController = PREFSMAN->m_AutoPlay;
} }
break; break;
case DebugLine_AssistTick:
{
if( type != IET_FIRST_PRESS )
return true; /* eat the input but do nothing */
GAMESTATE->m_SongOptions.m_bAssistTick = !GAMESTATE->m_SongOptions.m_bAssistTick;
/* Store this change, so it sticks if we change songs: */
GAMESTATE->m_StoredSongOptions.m_bAssistTick = GAMESTATE->m_SongOptions.m_bAssistTick;
MESSAGEMAN->Broadcast( MESSAGE_ASSIST_TICK_CHANGED );
}
break;
case DebugLine_Autosync:
{
if( type != IET_FIRST_PRESS )
return true; /* eat the input but do nothing */
SongOptions::AutosyncType as = (SongOptions::AutosyncType)(GAMESTATE->m_SongOptions.m_AutosyncType+1);
wrap( (int&)as, SongOptions::NUM_AUTOSYNC_TYPES );
GAMESTATE->m_SongOptions.m_AutosyncType = as;
MESSAGEMAN->Broadcast( MESSAGE_AUTOSYNC_CHANGED );
}
break;
case DebugLine_CoinMode: case DebugLine_CoinMode:
{ {
CoinMode cm = (CoinMode)(PREFSMAN->m_CoinMode+1); CoinMode cm = (CoinMode)(PREFSMAN->m_CoinMode+1);
@@ -324,7 +403,24 @@ bool ScreenDebugOverlay::OverlayInput( const DeviceInput& DeviceI, const InputEv
g_bMute = !g_bMute; g_bMute = !g_bMute;
SOUNDMAN->SetPrefs( g_bMute ? 0 : PREFSMAN->GetSoundVolume() ); SOUNDMAN->SetPrefs( g_bMute ? 0 : PREFSMAN->GetSoundVolume() );
break; break;
case DebugLine_CurrentScreen: case DebugLine_ReloadCurrentScreen:
SOUND->StopMusic();
ResetGame( true );
break;
case DebugLine_ReloadTheme:
THEME->ReloadMetrics();
TEXTUREMAN->ReloadAll();
NOTESKIN->RefreshNoteSkinData( GAMESTATE->m_pCurGame );
CodeDetector::RefreshCacheItems();
break;
case DebugLine_WriteProfiles:
// HACK: Also save bookkeeping and profile info for debugging
// so we don't have to play through a whole song to get new output.
BOOKKEEPER->WriteToDisk();
PROFILEMAN->SaveMachineProfile();
FOREACH_PlayerNumber( p )
if( PROFILEMAN->IsPersistentProfile(p) )
PROFILEMAN->SaveProfile( p );
break; break;
case DebugLine_Uptime: case DebugLine_Uptime:
break; break;
@@ -333,11 +429,13 @@ bool ScreenDebugOverlay::OverlayInput( const DeviceInput& DeviceI, const InputEv
UpdateText(); UpdateText();
SCREENMAN->SystemMessage( txt.GetText() ); SCREENMAN->SystemMessage( txt2.GetText() );
return true;
} }
} }
return true; return false;
} }
+8 -3
View File
@@ -10,6 +10,8 @@
enum DebugLine enum DebugLine
{ {
DebugLine_Autoplay, DebugLine_Autoplay,
DebugLine_AssistTick,
DebugLine_Autosync,
DebugLine_CoinMode, DebugLine_CoinMode,
DebugLine_Slow, DebugLine_Slow,
DebugLine_Halt, DebugLine_Halt,
@@ -22,7 +24,9 @@ enum DebugLine
DebugLine_FillMachineStats, DebugLine_FillMachineStats,
DebugLine_SendNotesEnded, DebugLine_SendNotesEnded,
DebugLine_Volume, DebugLine_Volume,
DebugLine_CurrentScreen, DebugLine_ReloadCurrentScreen,
DebugLine_ReloadTheme,
DebugLine_WriteProfiles,
DebugLine_Uptime, DebugLine_Uptime,
NUM_DEBUG_LINES NUM_DEBUG_LINES
}; };
@@ -43,8 +47,9 @@ private:
void UpdateText(); void UpdateText();
Quad m_Quad; Quad m_Quad;
BitmapText m_Header; BitmapText m_textHeader;
BitmapText m_Text[NUM_DEBUG_LINES]; BitmapText m_textButton[NUM_DEBUG_LINES];
BitmapText m_textFunction[NUM_DEBUG_LINES];
}; };
+2
View File
@@ -13,6 +13,8 @@ public:
virtual void Init(); virtual void Init();
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
virtual ScreenType GetScreenType() const { return attract; }
}; };
#endif #endif
+8 -2
View File
@@ -477,13 +477,13 @@ static Menu g_CourseMode(
int g_iLastInsertAttackTrack = -1; int g_iLastInsertAttackTrack = -1;
float g_fLastInsertAttackDurationSeconds = -1; float g_fLastInsertAttackDurationSeconds = -1;
#define PREV_SCREEN THEME->GetMetric(m_sName,"PrevScreen")
REGISTER_SCREEN_CLASS( ScreenEdit ); REGISTER_SCREEN_CLASS( ScreenEdit );
ScreenEdit::ScreenEdit( CString sName ) : ScreenWithMenuElements( sName ) ScreenEdit::ScreenEdit( CString sName ) : ScreenWithMenuElements( sName )
{ {
LOG->Trace( "ScreenEdit::ScreenEdit()" ); LOG->Trace( "ScreenEdit::ScreenEdit()" );
PREV_SCREEN.Load( sName, "PrevScreen" );
ASSERT( GAMESTATE->m_pCurSong ); ASSERT( GAMESTATE->m_pCurSong );
ASSERT( GAMESTATE->m_pCurSteps[0] ); ASSERT( GAMESTATE->m_pCurSteps[0] );
} }
@@ -1482,6 +1482,11 @@ void ScreenEdit::TransitionEditState( EditState em )
{ {
EditState old = m_EditState; EditState old = m_EditState;
if( old == STATE_PLAYING )
{
SCREENMAN->AddNewScreenToTop( "ScreenSaveSync" );
}
switch( em ) switch( em )
{ {
case STATE_EDITING: case STATE_EDITING:
@@ -1522,6 +1527,7 @@ void ScreenEdit::TransitionEditState( EditState em )
case STATE_RECORDING: case STATE_RECORDING:
break; break;
case STATE_PLAYING: case STATE_PLAYING:
GAMESTATE->ResetOriginalSyncData();
break; break;
default: default:
ASSERT(0); ASSERT(0);
+1 -1
View File
@@ -139,7 +139,7 @@ public:
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
protected: protected:
ThemeMetric<CString> PREV_SCREEN; virtual ScreenType GetScreenType() const { return m_EditState==STATE_PLAYING ? gameplay : system_menu; }
enum EditState { STATE_EDITING, STATE_RECORDING, STATE_PLAYING, NUM_EDIT_STATES, STATE_INVALID }; enum EditState { STATE_EDITING, STATE_RECORDING, STATE_PLAYING, NUM_EDIT_STATES, STATE_INVALID };
void TransitionEditState( EditState em ); void TransitionEditState( EditState em );
+1 -245
View File
@@ -65,9 +65,6 @@
static ThemeMetric<float> INITIAL_BACKGROUND_BRIGHTNESS ("ScreenGameplay","InitialBackgroundBrightness"); static ThemeMetric<float> INITIAL_BACKGROUND_BRIGHTNESS ("ScreenGameplay","InitialBackgroundBrightness");
static ThemeMetric<float> SECONDS_BETWEEN_COMMENTS ("ScreenGameplay","SecondsBetweenComments"); static ThemeMetric<float> SECONDS_BETWEEN_COMMENTS ("ScreenGameplay","SecondsBetweenComments");
/* Global, so it's accessible from ShowSavePrompt: */
static float g_fOldOffset; // used on offset screen to calculate difference
AutoScreenMessage( SM_PlayGo ) AutoScreenMessage( SM_PlayGo )
// received while STATE_DANCING // received while STATE_DANCING
@@ -76,7 +73,6 @@ AutoScreenMessage( SM_StartLoadingNextSong )
// received while STATE_OUTRO // received while STATE_OUTRO
AutoScreenMessage( SM_SaveChangedBeforeGoingBack )
AutoScreenMessage( SM_GoToScreenAfterBack ) AutoScreenMessage( SM_GoToScreenAfterBack )
AutoScreenMessage( SM_BeginFailed ) AutoScreenMessage( SM_BeginFailed )
@@ -102,8 +98,6 @@ ScreenGameplay::ScreenGameplay( CString sName ) : ScreenWithMenuElements(sName)
FAIL_AFTER_30_MISSES.Load( sName, "FailAfter30Misses" ); FAIL_AFTER_30_MISSES.Load( sName, "FailAfter30Misses" );
USE_FORCED_MODIFIERS_IN_BEGINNER.Load( sName, "UseForcedModifiersInBeginner" ); USE_FORCED_MODIFIERS_IN_BEGINNER.Load( sName, "UseForcedModifiersInBeginner" );
FORCED_MODIFIERS_IN_BEGINNER.Load( sName, "ForcedModifiersInBeginner" ); FORCED_MODIFIERS_IN_BEGINNER.Load( sName, "ForcedModifiersInBeginner" );
this->SubscribeToMessage( PREFSMAN->m_AutoPlay.GetName()+"Changed" );
} }
void ScreenGameplay::Init() void ScreenGameplay::Init()
@@ -212,8 +206,6 @@ void ScreenGameplay::Init()
} }
} }
m_bChangedOffsetOrBPM = GAMESTATE->m_SongOptions.m_AutosyncType == SongOptions::AUTOSYNC_SONG;
m_DancingState = STATE_INTRO; m_DancingState = STATE_INTRO;
// Set this in LoadNextSong() // Set this in LoadNextSong()
@@ -221,12 +213,6 @@ void ScreenGameplay::Init()
m_bZeroDeltaOnNextUpdate = false; m_bZeroDeltaOnNextUpdate = false;
// init old offset in case offset changes in song
if( GAMESTATE->IsCourseMode() )
g_fOldOffset = -1000;
else
g_fOldOffset = GAMESTATE->m_pCurSong->m_Timing.m_fBeat0OffsetInSeconds;
m_SongBackground.SetName( "SongBackground" ); m_SongBackground.SetName( "SongBackground" );
m_SongBackground.SetDrawOrder( DRAW_ORDER_BEFORE_EVERYTHING ); m_SongBackground.SetDrawOrder( DRAW_ORDER_BEFORE_EVERYTHING );
@@ -548,14 +534,6 @@ void ScreenGameplay::Init()
this->AddChild( &m_LyricDisplay ); this->AddChild( &m_LyricDisplay );
m_textAutoPlay.LoadFromFont( THEME->GetPathF(m_sName,"autoplay") );
m_textAutoPlay.SetName( "AutoPlay" );
SET_XY( m_textAutoPlay );
if( !GAMESTATE->m_bDemonstrationOrJukebox ) // only load if we're not in demonstration or jukebox
this->AddChild( &m_textAutoPlay );
UpdateAutoPlayText();
m_BPMDisplay.SetName( "BPMDisplay" ); m_BPMDisplay.SetName( "BPMDisplay" );
m_BPMDisplay.Load(); m_BPMDisplay.Load();
SET_XY( m_BPMDisplay ); SET_XY( m_BPMDisplay );
@@ -1834,7 +1812,7 @@ void ScreenGameplay::BackOutFromGameplay()
m_soundAssistTick.StopPlaying(); /* Stop any queued assist ticks. */ m_soundAssistTick.StopPlaying(); /* Stop any queued assist ticks. */
this->ClearMessageQueue(); this->ClearMessageQueue();
m_Cancel.StartTransitioning( SM_SaveChangedBeforeGoingBack ); m_Cancel.StartTransitioning( SM_GoToScreenAfterBack );
} }
void ScreenGameplay::AbortGiveUp( bool bShowText ) void ScreenGameplay::AbortGiveUp( bool bShowText )
@@ -1936,102 +1914,6 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
/* Nothing below cares about releases. */ /* Nothing below cares about releases. */
if(type == IET_RELEASE) return; if(type == IET_RELEASE) return;
// Handle special keys to adjust the offset
if( DeviceI.device == DEVICE_KEYBOARD )
{
switch( DeviceI.button )
{
case KEY_F6:
{
bool bHoldingShift =
INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_RSHIFT)) ||
INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT));
// toggle
if( GAMESTATE->m_SongOptions.m_AutosyncType != SongOptions::AUTOSYNC_OFF )
GAMESTATE->m_SongOptions.m_AutosyncType = SongOptions::AUTOSYNC_OFF;
else
GAMESTATE->m_SongOptions.m_AutosyncType = bHoldingShift ? SongOptions::AUTOSYNC_MACHINE : SongOptions::AUTOSYNC_SONG;
m_bChangedOffsetOrBPM |= !bHoldingShift;
UpdateAutoPlayText();
}
break;
case KEY_F7:
GAMESTATE->m_SongOptions.m_bAssistTick ^= 1;
/* Store this change, so it sticks if we change songs: */
GAMESTATE->m_StoredSongOptions.m_bAssistTick = GAMESTATE->m_SongOptions.m_bAssistTick;
m_textDebug.SetText( ssprintf("Assist Tick is %s", GAMESTATE->m_SongOptions.m_bAssistTick?"ON":"OFF") );
m_textDebug.StopTweening();
m_textDebug.SetDiffuse( RageColor(1,1,1,1) );
m_textDebug.BeginTweening( 3 ); // sleep
m_textDebug.BeginTweening( 0.5f ); // fade out
m_textDebug.SetDiffuse( RageColor(1,1,1,0) );
break;
case KEY_F9:
case KEY_F10:
{
m_bChangedOffsetOrBPM = true;
float fOffsetDelta;
switch( DeviceI.button )
{
case KEY_F9: fOffsetDelta = -0.020f; break;
case KEY_F10: fOffsetDelta = +0.020f; break;
default: ASSERT(0); return;
}
if( INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_RALT)) ||
INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LALT)) )
fOffsetDelta /= 2; /* .010 */
else if( type == IET_FAST_REPEAT )
fOffsetDelta *= 10;
BPMSegment& seg = GAMESTATE->m_pCurSong->GetBPMSegmentAtBeat( GAMESTATE->m_fSongBeat );
seg.m_fBPS += fOffsetDelta;
m_textDebug.SetText( ssprintf("Cur BPM = %.2f", seg.GetBPM()) );
m_textDebug.StopTweening();
m_textDebug.SetDiffuse( RageColor(1,1,1,1) );
m_textDebug.BeginTweening( 3 ); // sleep
m_textDebug.BeginTweening( 0.5f ); // fade out
m_textDebug.SetDiffuse( RageColor(1,1,1,0) );
}
break;
case KEY_F11:
case KEY_F12:
{
m_bChangedOffsetOrBPM = true;
float fOffsetDelta;
switch( DeviceI.button )
{
case KEY_F11: fOffsetDelta = -0.02f; break;
case KEY_F12: fOffsetDelta = +0.02f; break;
default: ASSERT(0); return;
}
if( INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_RALT)) ||
INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LALT)) )
fOffsetDelta /= 20; /* 1ms */
else switch( type )
{
case IET_SLOW_REPEAT: fOffsetDelta *= 10; break;
case IET_FAST_REPEAT: fOffsetDelta *= 40; break;
}
GAMESTATE->m_pCurSong->m_Timing.m_fBeat0OffsetInSeconds += fOffsetDelta;
m_textDebug.SetText( ssprintf("Offset = %.3f", GAMESTATE->m_pCurSong->m_Timing.m_fBeat0OffsetInSeconds) );
m_textDebug.StopTweening();
m_textDebug.SetDiffuse( RageColor(1,1,1,1) );
m_textDebug.BeginTweening( 3 ); // sleep
m_textDebug.BeginTweening( 0.5f ); // fade out
m_textDebug.SetDiffuse( RageColor(1,1,1,0) );
}
break;
}
}
// //
// handle a step or battle item activate // handle a step or battle item activate
@@ -2045,111 +1927,9 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
if( PREFSMAN->m_AutoPlay == PC_HUMAN ) if( PREFSMAN->m_AutoPlay == PC_HUMAN )
m_Player[StyleI.player].Step( StyleI.col, DeviceI.ts ); m_Player[StyleI.player].Step( StyleI.col, DeviceI.ts );
} }
// else if( type==IET_FIRST_PRESS &&
// !PREFSMAN->m_bAutoPlay &&
// MenuI.IsValifd() &&
// GAMESTATE->IsPlayerEnabled( MenuI.player ) &&
// GAMESTATE->IsBattleMode() )
// {
// int iItemSlot;
// switch( MenuI.button )
// {
// case MENU_BUTTON_LEFT: iItemSlot = 0; break;
// case MENU_BUTTON_START: iItemSlot = 1; break;
// case MENU_BUTTON_RIGHT: iItemSlot = 2; break;
// default: iItemSlot = -1; break;
// }
//
// if( iItemSlot != -1 )
// m_pInventory[MenuI.player]->UseItem( iItemSlot );
// }
} }
void ScreenGameplay::UpdateAutoPlayText()
{
vector<CString> vsText;
switch( PREFSMAN->m_AutoPlay )
{
case PC_HUMAN: break;
case PC_AUTOPLAY: vsText.push_back("AutoPlay"); break;
case PC_CPU: vsText.push_back("AutoPlay CPU"); break;
default: ASSERT(0);
}
switch( GAMESTATE->m_SongOptions.m_AutosyncType )
{
case SongOptions::AUTOSYNC_OFF: break;
case SongOptions::AUTOSYNC_SONG: vsText.push_back("AutosyncSong"); break;
case SongOptions::AUTOSYNC_MACHINE: vsText.push_back("AutosyncMachine"); break;
default: ASSERT(0);
}
CString sText = join( " ", vsText );
m_textAutoPlay.SetText( sText );
}
void SaveChanges( void* papSongsQueue )
{
vector<Song*>& apSongsQueue = *(vector<Song*>*)papSongsQueue;
for( unsigned i=0; i<apSongsQueue.size(); i++ )
apSongsQueue[i]->Save();
}
void RevertChanges( void* papSongsQueue )
{
vector<Song*>& apSongsQueue = *(vector<Song*>*)papSongsQueue;
FOREACH( Song*, apSongsQueue, pSong )
{
SONGMAN->RevertFromDisk( *pSong );
}
}
void ScreenGameplay::ShowSavePrompt( ScreenMessage SM_SendWhenDone )
{
CString sMessage;
switch( GAMESTATE->m_PlayMode )
{
case PLAY_MODE_REGULAR:
case PLAY_MODE_BATTLE:
case PLAY_MODE_RAVE:
sMessage = ssprintf(
"You have changed the offset or BPM of\n"
"%s\n",
GAMESTATE->m_pCurSong->GetFullDisplayTitle().c_str() );
if( fabs(GAMESTATE->m_pCurSong->m_Timing.m_fBeat0OffsetInSeconds - g_fOldOffset) > 0.001 )
{
sMessage += ssprintf(
"\n"
"Offset was changed from %.3f to %.3f (%.3f).\n",
g_fOldOffset,
GAMESTATE->m_pCurSong->m_Timing.m_fBeat0OffsetInSeconds,
GAMESTATE->m_pCurSong->m_Timing.m_fBeat0OffsetInSeconds - g_fOldOffset );
}
sMessage +=
"\n"
"Would you like to save these changes back\n"
"to the song file?\n"
"Choosing NO will discard your changes.";
break;
case PLAY_MODE_NONSTOP:
case PLAY_MODE_ONI:
case PLAY_MODE_ENDLESS:
sMessage = ssprintf(
"You have changed the offset or BPM of\n"
"one or more songs in this course.\n"
"Would you like to save these changes back\n"
"to the song file(s)?\n"
"Choosing NO will discard your changes." );
break;
default:
ASSERT(0);
}
SCREENMAN->Prompt( SM_SendWhenDone, sMessage, PROMPT_YES_NO, ANSWER_NO, SaveChanges, RevertChanges, &m_apSongsQueue );
}
/* /*
* Saving StageStats that are affected by the note pattern is a little tricky: * Saving StageStats that are affected by the note pattern is a little tricky:
@@ -2461,18 +2241,6 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
int iDamageLevel = SM-SM_BattleDamageLevel1+1; int iDamageLevel = SM-SM_BattleDamageLevel1+1;
PlayAnnouncer( ssprintf("gameplay battle damage level%d",iDamageLevel), 3 ); PlayAnnouncer( ssprintf("gameplay battle damage level%d",iDamageLevel), 3 );
} }
else if( SM == SM_SaveChangedBeforeGoingBack )
{
if( m_bChangedOffsetOrBPM )
{
m_bChangedOffsetOrBPM = false;
ShowSavePrompt( SM_GoToScreenAfterBack );
}
else
{
HandleScreenMessage( SM_GoToScreenAfterBack );
}
}
else if( SM == SM_GoToScreenAfterBack ) else if( SM == SM_GoToScreenAfterBack )
{ {
SongFinished(); SongFinished();
@@ -2484,13 +2252,6 @@ void ScreenGameplay::HandleScreenMessage( const ScreenMessage SM )
} }
else if( SM == SM_GoToNextScreen ) else if( SM == SM_GoToNextScreen )
{ {
if( m_bChangedOffsetOrBPM )
{
m_bChangedOffsetOrBPM = false;
ShowSavePrompt( SM_GoToNextScreen );
return;
}
SongFinished(); SongFinished();
StageFinished( false ); StageFinished( false );
} }
@@ -2626,11 +2387,6 @@ void ScreenGameplay::ShowOniGameOver( PlayerNumber pn )
m_sprOniGameOver[pn].PlayCommand( "Die" ); m_sprOniGameOver[pn].PlayCommand( "Die" );
} }
void ScreenGameplay::HandleMessage( const CString& sMessage )
{
if( sMessage == PREFSMAN->m_AutoPlay.GetName()+"Changed" )
UpdateAutoPlayText();
}
/* /*
* (c) 2001-2004 Chris Danford, Glenn Maynard * (c) 2001-2004 Chris Danford, Glenn Maynard
+1 -6
View File
@@ -40,9 +40,9 @@ public:
virtual void Update( float fDeltaTime ); virtual void Update( float fDeltaTime );
virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI ); virtual void Input( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
virtual void HandleScreenMessage( const ScreenMessage SM ); virtual void HandleScreenMessage( const ScreenMessage SM );
virtual void HandleMessage( const CString& sMessage );
virtual bool UsesBackground() const { return false; } virtual bool UsesBackground() const { return false; }
virtual ScreenType GetScreenType() const { return gameplay; }
protected: protected:
ThemeMetric<CString> PLAYER_TYPE; ThemeMetric<CString> PLAYER_TYPE;
@@ -67,7 +67,6 @@ protected:
float StartPlayingSong(float MinTimeToNotes, float MinTimeToMusic); float StartPlayingSong(float MinTimeToNotes, float MinTimeToMusic);
void LoadLights(); void LoadLights();
void PauseGame( bool bPause, GameController gc = GAME_CONTROLLER_INVALID ); void PauseGame( bool bPause, GameController gc = GAME_CONTROLLER_INVALID );
void ShowSavePrompt( ScreenMessage SM_SendWhenDone );
void PlayAnnouncer( CString type, float fSeconds ); void PlayAnnouncer( CString type, float fSeconds );
void UpdateLights(); void UpdateLights();
void SendCrossedMessages(); void SendCrossedMessages();
@@ -93,7 +92,6 @@ protected:
vector<Steps*> m_vpStepsQueue[NUM_PLAYERS]; // size may be >1 if playing a course vector<Steps*> m_vpStepsQueue[NUM_PLAYERS]; // size may be >1 if playing a course
vector<AttackArray> m_asModifiersQueue[NUM_PLAYERS];// size may be >1 if playing a course vector<AttackArray> m_asModifiersQueue[NUM_PLAYERS];// size may be >1 if playing a course
bool m_bChangedOffsetOrBPM;
float m_fTimeSinceLastDancingComment; // this counter is only running while STATE_DANCING float m_fTimeSinceLastDancingComment; // this counter is only running while STATE_DANCING
LyricDisplay m_LyricDisplay; LyricDisplay m_LyricDisplay;
@@ -133,9 +131,6 @@ protected:
RageTimer m_GiveUpTimer; RageTimer m_GiveUpTimer;
void AbortGiveUp( bool bShowText ); void AbortGiveUp( bool bShowText );
BitmapText m_textAutoPlay; // for AutoPlay, AutoAdjust
void UpdateAutoPlayText();
BitmapText m_MaxCombo; BitmapText m_MaxCombo;
Transition m_Ready; Transition m_Ready;
+4 -8
View File
@@ -446,15 +446,11 @@ retry:
m_sLastLoadedBackgroundPath = sNewBGA; m_sLastLoadedBackgroundPath = sNewBGA;
} }
bool bWasOnSystemMenu = GAMESTATE->m_bIsOnSystemMenu; bool bWasOnSystemMenu = pOldTopScreen && pOldTopScreen->GetScreenType() == system_menu;
bool bIsOnSystemMenu = pNewScreen->GetScreenType() == system_menu;
if( THEME->HasMetric(sScreenName,"AllowOperatorMenuButton") )
GAMESTATE->m_bIsOnSystemMenu = !THEME->GetMetricB( sScreenName,"AllowOperatorMenuButton" );
else
GAMESTATE->m_bIsOnSystemMenu = false;
// If we're exiting a system menu, persist settings in case we don't exit normally // If we're exiting a system menu, persist settings in case we don't exit normally
if( bWasOnSystemMenu && !GAMESTATE->m_bIsOnSystemMenu ) if( bWasOnSystemMenu && !bIsOnSystemMenu )
PREFSMAN->SaveGlobalPrefsToDisk(); PREFSMAN->SaveGlobalPrefsToDisk();
LOG->Trace("... SetFromNewScreen"); LOG->Trace("... SetFromNewScreen");
@@ -484,7 +480,7 @@ void ScreenManager::Prompt( ScreenMessage smSendOnPop, const CString &sText, Pro
m_ScreenStack.back()->HandleScreenMessage( SM_LoseFocus ); m_ScreenStack.back()->HandleScreenMessage( SM_LoseFocus );
// add the new state onto the back of the array // add the new state onto the back of the array
Screen *pNewScreen = new ScreenPrompt( smSendOnPop, sText, type, defaultAnswer, OnYes, OnNo, pCallbackData); Screen *pNewScreen = new ScreenPrompt( "ScreenPrompt", smSendOnPop, sText, type, defaultAnswer, OnYes, OnNo, pCallbackData);
pNewScreen->Init(); pNewScreen->Init();
this->ZeroNextUpdate(); this->ZeroNextUpdate();
SetFromNewScreen( pNewScreen, true ); SetFromNewScreen( pNewScreen, true );
+14 -2
View File
@@ -17,6 +17,7 @@ bool ScreenPrompt::s_bCancelledLast = false;
//REGISTER_SCREEN_CLASS( ScreenPrompt ); //REGISTER_SCREEN_CLASS( ScreenPrompt );
ScreenPrompt::ScreenPrompt( ScreenPrompt::ScreenPrompt(
const CString &sScreenName,
ScreenMessage smSendOnPop, ScreenMessage smSendOnPop,
CString sText, CString sText,
PromptType type, PromptType type,
@@ -25,7 +26,7 @@ ScreenPrompt::ScreenPrompt(
void(*OnNo)(void*), void(*OnNo)(void*),
void* pCallbackData void* pCallbackData
) : ) :
Screen("ScreenPrompt") Screen( sScreenName )
{ {
m_bIsTransparent = true; // draw screens below us m_bIsTransparent = true; // draw screens below us
@@ -130,9 +131,14 @@ void ScreenPrompt::HandleScreenMessage( const ScreenMessage SM )
case SM_DoneOpeningWipingLeft: case SM_DoneOpeningWipingLeft:
break; break;
case SM_DoneOpeningWipingRight: case SM_DoneOpeningWipingRight:
SCREENMAN->PopTopScreen( m_smSendOnPop ); if( SCREENMAN->IsStackedScreen(this) )
SCREENMAN->PopTopScreen( m_smSendOnPop );
else
this->HandleScreenMessage( SM_GoToNextScreen );
break; break;
} }
Screen::HandleScreenMessage( SM );
} }
void ScreenPrompt::Change( int dir ) void ScreenPrompt::Change( int dir )
@@ -160,11 +166,17 @@ void ScreenPrompt::MenuRight( PlayerNumber pn )
void ScreenPrompt::MenuStart( PlayerNumber pn ) void ScreenPrompt::MenuStart( PlayerNumber pn )
{ {
if( m_Out.IsTransitioning() || m_Cancel.IsTransitioning() )
return;
End( false ); End( false );
} }
void ScreenPrompt::MenuBack( PlayerNumber pn ) void ScreenPrompt::MenuBack( PlayerNumber pn )
{ {
if( m_Out.IsTransitioning() || m_Cancel.IsTransitioning() )
return;
switch( m_PromptType ) switch( m_PromptType )
{ {
case PROMPT_OK: case PROMPT_OK:
+2 -1
View File
@@ -15,9 +15,10 @@
class ScreenPrompt : public Screen class ScreenPrompt : public Screen
{ {
public: public:
ScreenPrompt( CString sName ); ScreenPrompt( const CString &sScreenName );
virtual void Init(); virtual void Init();
ScreenPrompt( ScreenPrompt(
const CString &sScreenName,
ScreenMessage smSendOnPop, ScreenMessage smSendOnPop,
CString sText, CString sText,
PromptType type = PROMPT_OK, PromptType type = PROMPT_OK,
+135
View File
@@ -0,0 +1,135 @@
#include "global.h"
#include "ScreenSaveSync.h"
#include "GameState.h"
#include "song.h"
#include "PrefsManager.h"
static CString GetPromptText()
{
CString s;
{
float fOld = GAMESTATE->m_fGlobalOffsetSecondsOriginal;
float fNew = PREFSMAN->m_fGlobalOffsetSeconds;
float fDelta = fNew - fOld;
if( fabs(fDelta) > 0.00001 )
{
s += ssprintf(
"You have changed the Machine Global Offset\nfrom %.3f to %.3f (%+.3f).\n\n",
fOld,
fNew,
fDelta );
}
}
s += ssprintf(
"You have changed the timing of\n\n"
"%s:\n\n",
GAMESTATE->m_pCurSong->GetFullDisplayTitle().c_str() );
{
float fOld = GAMESTATE->m_pTimingDataOriginal->m_fBeat0OffsetInSeconds;
float fNew = GAMESTATE->m_pCurSong->m_Timing.m_fBeat0OffsetInSeconds;
float fDelta = fNew - fOld;
if( fabs(fDelta) > 0.00001 )
{
s += ssprintf(
"The song offset changed from %.3f to %.3f (%+.3f).\n\n",
fOld,
fNew,
fDelta );
}
}
for( int i=0; i<GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments.size(); i++ )
{
float fOld = GAMESTATE->m_pTimingDataOriginal->m_BPMSegments[i].m_fBPS;
float fNew = GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments[i].m_fBPS;
float fDelta = fNew - fOld;
if( fabs(fDelta) > 0.00001 )
{
s += ssprintf(
"The %s BPM segment changed from %.3f BPS to %.3f BPS (%+.3f).\n\n",
FormatNumberAndSuffix(i+1).c_str(),
fOld,
fNew,
fDelta );
}
}
for( int i=0; i<GAMESTATE->m_pCurSong->m_Timing.m_StopSegments.size(); i++ )
{
float fOld = GAMESTATE->m_pTimingDataOriginal->m_StopSegments[i].m_fStopSeconds;
float fNew = GAMESTATE->m_pCurSong->m_Timing.m_StopSegments[i].m_fStopSeconds;
float fDelta = fNew - fOld;
if( fabs(fDelta) > 0.00001 )
{
s += ssprintf(
"The %s Stop segment changed from %.3f seconds to %.3f seconds (%+.3f).\n\n",
FormatNumberAndSuffix(i+1).c_str(),
fOld,
fNew,
fDelta );
}
}
s +="\n\nWould you like to save these changes to the song file?\n"
"Choosing NO will discard your changes.";
return s;
}
static void SaveSyncChanges( void* pThrowAway )
{
GAMESTATE->SaveSyncChanges();
}
static void RevertSyncChanges( void* pThrowAway )
{
GAMESTATE->RevertSyncChanges();
}
REGISTER_SCREEN_CLASS( ScreenSaveSync );
ScreenSaveSync::ScreenSaveSync( const CString &sScreenName ) :
ScreenPrompt(
sScreenName,
SM_None,
GetPromptText(),
PROMPT_YES_NO,
ANSWER_YES,
SaveSyncChanges,
RevertSyncChanges,
NULL )
{
}
/*
* (c) 2001-2005 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.
*/
+40
View File
@@ -0,0 +1,40 @@
/* ScreenSaveSync - */
#ifndef ScreenSaveSync_H
#define ScreenSaveSync_H
#include "ScreenPrompt.h"
class ScreenSaveSync : public ScreenPrompt
{
public:
ScreenSaveSync( const CString &sScreenName );
};
#endif
/*
* (c) 2001-2005 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.
*/
+2 -2
View File
@@ -1618,7 +1618,7 @@ void ScreenSelectMusic::AfterMusicChange()
const vector<Song*> best = SONGMAN->GetBestSongs( PROFILE_SLOT_MACHINE ); const vector<Song*> best = SONGMAN->GetBestSongs( PROFILE_SLOT_MACHINE );
const int index = FindIndex( best.begin(), best.end(), pSong ); const int index = FindIndex( best.begin(), best.end(), pSong );
if( index != -1 ) if( index != -1 )
m_MachineRank.SetText( AddNumberSuffix( index+1 ) ); m_MachineRank.SetText( FormatNumberAndSuffix( index+1 ) );
m_DifficultyDisplay.SetDifficulties( pSong, GAMESTATE->GetCurrentStyle()->m_StepsType ); m_DifficultyDisplay.SetDifficulties( pSong, GAMESTATE->GetCurrentStyle()->m_StepsType );
@@ -1753,7 +1753,7 @@ void ScreenSelectMusic::AfterMusicChange()
const vector<Course*> best = SONGMAN->GetBestCourses( ct, PROFILE_SLOT_MACHINE ); const vector<Course*> best = SONGMAN->GetBestCourses( ct, PROFILE_SLOT_MACHINE );
const int index = FindCourseIndexOfSameMode( best.begin(), best.end(), pCourse ); const int index = FindCourseIndexOfSameMode( best.begin(), best.end(), pCourse );
if( index != -1 ) if( index != -1 )
m_MachineRank.SetText( AddNumberSuffix( index+1 ) ); m_MachineRank.SetText( FormatNumberAndSuffix( index+1 ) );
+297
View File
@@ -0,0 +1,297 @@
#include "global.h"
#include "ScreenSyncOverlay.h"
#include "ScreenDimensions.h"
#include "GameState.h"
#include "song.h"
#include "PrefsManager.h"
static bool IsGameplay()
{
return SCREENMAN && SCREENMAN->GetTopScreen() && SCREENMAN->GetTopScreen()->GetScreenType() == gameplay;
}
REGISTER_SCREEN_CLASS( ScreenSyncOverlay );
ScreenSyncOverlay::ScreenSyncOverlay( const CString &sName ) : Screen(sName)
{
}
ScreenSyncOverlay::~ScreenSyncOverlay()
{
}
void ScreenSyncOverlay::Init()
{
Screen::Init();
m_quad.SetDiffuse( RageColor(0,0,0,0) );
m_quad.SetHorizAlign( Actor::align_left );
m_quad.SetXY( SCREEN_CENTER_X+10, SCREEN_TOP+100 );
this->AddChild( &m_quad );
m_textHelp.LoadFromFont( THEME->GetPathToF("Common normal") );
m_textHelp.SetHorizAlign( Actor::align_left );
m_textHelp.SetXY( SCREEN_CENTER_X+20, SCREEN_TOP+100 );
m_textHelp.SetDiffuseAlpha( 0 );
m_textHelp.SetZoom( 0.6f );
m_textHelp.SetShadowLength( 2 );
m_textHelp.SetText(
"Revert sync changes:\n"
" F4\n"
"Adjust current BPM:\n"
" F9/F10 (hold Alt for smaller)\n"
"Adjust song offset:\n"
" F11/F12 (hold Alt for smaller)\n"
"Adjust machine offset:\n"
" Shift + F11/F12 (hold Alt for smaller)" );
this->AddChild( &m_textHelp );
m_quad.ZoomToWidth( m_textHelp.GetZoomedWidth()+20 );
m_quad.ZoomToHeight( m_textHelp.GetZoomedHeight()+20 );
m_textStatus.LoadFromFont( THEME->GetPathToF("Common normal") );
m_textStatus.SetHorizAlign( Actor::align_center );
m_textStatus.SetXY( SCREEN_CENTER_X, SCREEN_CENTER_Y+150 );
m_textStatus.SetZoom( 0.8f );
m_textStatus.SetShadowLength( 2 );
this->AddChild( &m_textStatus );
Update( 0 );
}
void ScreenSyncOverlay::Update( float fDeltaTime )
{
this->SetVisible( IsGameplay() );
if( !IsGameplay() )
{
m_quad.SetDiffuseAlpha( 0 );
m_textHelp.SetDiffuseAlpha( 0 );
return;
}
Screen::Update(fDeltaTime);
// TODO: Only update when changed.
UpdateText();
}
void ScreenSyncOverlay::UpdateText()
{
CString s;
switch( PREFSMAN->m_AutoPlay )
{
case PC_HUMAN: break;
case PC_AUTOPLAY: s+="AutoPlay\n"; break;
case PC_CPU: s+="AutoPlayCPU\n"; break;
default: ASSERT(0);
}
switch( GAMESTATE->m_SongOptions.m_AutosyncType )
{
case SongOptions::AUTOSYNC_OFF: break;
case SongOptions::AUTOSYNC_SONG: s+="AutoSync Song\n"; break;
case SongOptions::AUTOSYNC_MACHINE: s+="AutoSync Machine\n";break;
default: ASSERT(0);
}
if( GAMESTATE->m_pCurSong == NULL )
{
m_textStatus.SetText( "" );
return;
}
{
float fOld = GAMESTATE->m_fGlobalOffsetSecondsOriginal;
float fNew = PREFSMAN->m_fGlobalOffsetSeconds;
float fDelta = fNew - fOld;
if( fabs(fDelta) > 0.00001 )
{
s += ssprintf(
"Machine global offset: %.3fs (%+.3f)\n",
fNew,
fDelta );
}
}
{
float fOld = GAMESTATE->m_pTimingDataOriginal->m_fBeat0OffsetInSeconds;
float fNew = GAMESTATE->m_pCurSong->m_Timing.m_fBeat0OffsetInSeconds;
float fDelta = fNew - fOld;
if( fabs(fDelta) > 0.00001 )
{
s += ssprintf(
"Song offset: %.3fs (%+.3f)\n",
fNew,
fDelta );
}
}
ASSERT( GAMESTATE->m_pTimingDataOriginal->m_BPMSegments.size() == GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments.size() );
for( int i=0; i<GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments.size(); i++ )
{
float fOld = GAMESTATE->m_pTimingDataOriginal->m_BPMSegments[i].m_fBPS;
float fNew = GAMESTATE->m_pCurSong->m_Timing.m_BPMSegments[i].m_fBPS;
float fDelta = fNew - fOld;
if( fabs(fDelta) > 0.00001 )
{
s += ssprintf(
"%s tempo segment: %.3f BPS (%+.3f)\n",
FormatNumberAndSuffix(i+1).c_str(),
fNew,
fDelta );
}
}
m_textStatus.SetText( s );
}
bool ScreenSyncOverlay::OverlayInput( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI )
{
if( !IsGameplay() )
return false;
if( DeviceI.device != DEVICE_KEYBOARD )
return false;
switch( DeviceI.button )
{
case KEY_F4:
SCREENMAN->SystemMessage( "Sync changes reverted." );
break;
case KEY_F9:
case KEY_F10:
case KEY_F11:
case KEY_F12:
if( GAMESTATE->IsCourseMode() )
{
SCREENMAN->SystemMessage( "Can't sync while playing a course." );
return true;
}
break;
default:
return false;
}
switch( DeviceI.button )
{
case KEY_F4:
GAMESTATE->RevertSyncChanges();
break;
case KEY_F9:
case KEY_F10:
{
float fDelta;
switch( DeviceI.button )
{
case KEY_F9: fDelta = -0.02f; break;
case KEY_F10: fDelta = +0.02f; break;
default: ASSERT(0);
}
if( INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_RALT)) ||
INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LALT)) )
fDelta /= 20;
switch( type )
{
case IET_RELEASE: fDelta *= 0; break;
case IET_SLOW_REPEAT: fDelta *= 0; break;
case IET_FAST_REPEAT: fDelta *= 10; break;
}
if( GAMESTATE->m_pCurSong != NULL )
{
BPMSegment& seg = GAMESTATE->m_pCurSong->GetBPMSegmentAtBeat( GAMESTATE->m_fSongBeat );
seg.m_fBPS += fDelta;
}
}
break;
case KEY_F11:
case KEY_F12:
{
float fDelta;
switch( DeviceI.button )
{
case KEY_F11: fDelta = -0.02f; break;
case KEY_F12: fDelta = +0.02f; break;
default: ASSERT(0);
}
if( INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_RALT)) ||
INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LALT)) )
fDelta /= 20; /* 1ms */
switch( type )
{
case IET_RELEASE: fDelta *= 0; break;
case IET_SLOW_REPEAT: fDelta *= 0; break;
case IET_FAST_REPEAT: fDelta *= 10; break;
}
if( INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_RSHIFT)) ||
INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT)) )
{
PREFSMAN->m_fGlobalOffsetSeconds.Set( PREFSMAN->m_fGlobalOffsetSeconds + fDelta );
}
else
{
if( GAMESTATE->m_pCurSong != NULL )
GAMESTATE->m_pCurSong->m_Timing.m_fBeat0OffsetInSeconds += fDelta;
}
}
break;
default:
ASSERT(0);
}
ShowHelp();
UpdateText();
return true;
}
void ScreenSyncOverlay::ShowHelp()
{
m_quad.StopTweening();
m_quad.BeginTweening( 0.3f, Actor::TWEEN_LINEAR );
m_quad.SetDiffuseAlpha( 0.5f );
m_textHelp.StopTweening();
m_textHelp.BeginTweening( 0.3f, Actor::TWEEN_LINEAR );
m_textHelp.SetDiffuseAlpha( 1 );
if( !GAMESTATE->IsSyncDataChanged() )
{
m_quad.Sleep( 4 );
m_quad.BeginTweening( 0.3f, Actor::TWEEN_LINEAR );
m_quad.SetDiffuseAlpha( 0 );
m_textHelp.Sleep( 4 );
m_textHelp.BeginTweening( 0.3f, Actor::TWEEN_LINEAR );
m_textHelp.SetDiffuseAlpha( 0 );
}
}
/*
* (c) 2001-2005 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.
*/
+56
View File
@@ -0,0 +1,56 @@
/* ScreenSyncOverlay - credits and statistics drawn on top of everything else. */
#ifndef ScreenSyncOverlay_H
#define ScreenSyncOverlay_H
#include "Screen.h"
#include "BitmapText.h"
#include "Quad.h"
class ScreenSyncOverlay : public Screen
{
public:
ScreenSyncOverlay( const CString &sName );
virtual ~ScreenSyncOverlay();
virtual void Init();
bool OverlayInput( const DeviceInput& DeviceI, const InputEventType type, const GameInput &GameI, const MenuInput &MenuI, const StyleInput &StyleI );
void Update( float fDeltaTime );
private:
void UpdateText();
void ShowHelp();
Quad m_quad;
BitmapText m_textHelp;
BitmapText m_textStatus;
};
#endif
/*
* (c) 2001-2005 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.
*/
+1 -1
View File
@@ -118,7 +118,7 @@ CString ScreenSystemLayer::GetCreditsMessage( PlayerNumber pn ) const
return ""; return "";
bool bShowCreditsMessage; bool bShowCreditsMessage;
if( GAMESTATE->m_bIsOnSystemMenu ) if( SCREENMAN && SCREENMAN->GetTopScreen() && SCREENMAN->GetTopScreen()->GetScreenType() == system_menu )
bShowCreditsMessage = true; bShowCreditsMessage = true;
else if( MEMCARDMAN->GetCardsLocked() ) else if( MEMCARDMAN->GetCardsLocked() )
bShowCreditsMessage = !GAMESTATE->IsPlayerEnabled( pn ); bShowCreditsMessage = !GAMESTATE->IsPlayerEnabled( pn );
+2 -1
View File
@@ -31,7 +31,8 @@ struct SongOptions
enum AutosyncType { enum AutosyncType {
AUTOSYNC_OFF, AUTOSYNC_OFF,
AUTOSYNC_SONG, AUTOSYNC_SONG,
AUTOSYNC_MACHINE AUTOSYNC_MACHINE,
NUM_AUTOSYNC_TYPES
}; };
AutosyncType m_AutosyncType; AutosyncType m_AutosyncType;
bool m_bSaveScore; bool m_bSaveScore;
+1 -36
View File
@@ -1281,7 +1281,7 @@ bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput Gam
/* Global operator key, to get quick access to the options menu. Don't /* Global operator key, to get quick access to the options menu. Don't
* do this if we're on a "system menu", which includes the editor * do this if we're on a "system menu", which includes the editor
* (to prevent quitting without storing changes). */ * (to prevent quitting without storing changes). */
if( !GAMESTATE->m_bIsOnSystemMenu ) if( SCREENMAN->GetTopScreen()->GetScreenType() != system_menu )
{ {
SCREENMAN->DeletePreparedScreens(); SCREENMAN->DeletePreparedScreens();
SCREENMAN->SystemMessage( "Service switch pressed" ); SCREENMAN->SystemMessage( "Service switch pressed" );
@@ -1301,41 +1301,6 @@ bool HandleGlobalInputs( DeviceInput DeviceI, InputEventType type, GameInput Gam
return false; // Attract need to know because they go to TitleMenu on > 1 credit return false; // Attract need to know because they go to TitleMenu on > 1 credit
} }
if(DeviceI == DeviceInput(DEVICE_KEYBOARD, KEY_F2))
{
bool bShift = INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT) );
bool bCtrl = INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LCTRL) );
if( bShift )
{
// HACK: Also save bookkeeping and profile info for debugging
// so we don't have to play through a whole song to get new output.
BOOKKEEPER->WriteToDisk();
PROFILEMAN->SaveMachineProfile();
FOREACH_PlayerNumber( p )
if( PROFILEMAN->IsPersistentProfile(p) )
PROFILEMAN->SaveProfile( p );
SCREENMAN->SystemMessage( "Stats saved" );
}
else
{
THEME->ReloadMetrics();
TEXTUREMAN->ReloadAll();
NOTESKIN->RefreshNoteSkinData( GAMESTATE->m_pCurGame );
CodeDetector::RefreshCacheItems();
/* If we're in screen test mode, reload the screen. */
if( PREFSMAN->m_bScreenTestMode || bCtrl )
{
SOUND->StopMusic();
ResetGame( true );
}
else
SCREENMAN->SystemMessage( "Reloaded metrics and textures" );
}
return true;
}
#ifndef DARWIN #ifndef DARWIN
if(DeviceI == DeviceInput(DEVICE_KEYBOARD, KEY_F4)) if(DeviceI == DeviceInput(DEVICE_KEYBOARD, KEY_F4))
{ {
+18 -2
View File
@@ -62,7 +62,7 @@ IntDir=.\../Debug6
TargetDir=\stepmania\stepmania\Program TargetDir=\stepmania\stepmania\Program
TargetName=StepMania-debug TargetName=StepMania-debug
SOURCE="$(InputPath)" SOURCE="$(InputPath)"
PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
# End Special Build Tool # End Special Build Tool
@@ -99,7 +99,7 @@ IntDir=.\../Release6
TargetDir=\stepmania\stepmania\Program TargetDir=\stepmania\stepmania\Program
TargetName=StepMania TargetName=StepMania
SOURCE="$(InputPath)" SOURCE="$(InputPath)"
PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\ PreLink_Cmds=archutils\Win32\verinc cl /Zl /nologo /c verstub.cpp /Fo$(IntDir)\
PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi PostBuild_Cmds=archutils\Win32\mapconv $(IntDir)\$(TargetName).map $(TargetDir)\StepMania.vdi
# End Special Build Tool # End Special Build Tool
@@ -2836,6 +2836,14 @@ SOURCE=.\ScreenSandbox.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\ScreenSaveSync.cpp
# End Source File
# Begin Source File
SOURCE=.\ScreenSaveSync.h
# End Source File
# Begin Source File
SOURCE=.\ScreenSelect.cpp SOURCE=.\ScreenSelect.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -2948,6 +2956,14 @@ SOURCE=.\ScreenStyleSplash.h
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\ScreenSyncOverlay.cpp
# End Source File
# Begin Source File
SOURCE=.\ScreenSyncOverlay.h
# End Source File
# Begin Source File
SOURCE=.\ScreenSystemLayer.cpp SOURCE=.\ScreenSystemLayer.cpp
# End Source File # End Source File
# Begin Source File # Begin Source File
+12
View File
@@ -505,6 +505,12 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File <File
RelativePath="ScreenSandbox.h"> RelativePath="ScreenSandbox.h">
</File> </File>
<File
RelativePath="ScreenSaveSync.cpp">
</File>
<File
RelativePath="ScreenSaveSync.h">
</File>
<File <File
RelativePath="ScreenSelect.cpp"> RelativePath="ScreenSelect.cpp">
</File> </File>
@@ -583,6 +589,12 @@ cl /Zl /nologo /c verstub.cpp /Fo&quot;$(IntDir)&quot;\
<File <File
RelativePath="ScreenStyleSplash.h"> RelativePath="ScreenStyleSplash.h">
</File> </File>
<File
RelativePath="ScreenSyncOverlay.cpp">
</File>
<File
RelativePath="ScreenSyncOverlay.h">
</File>
<File <File
RelativePath="ScreenSystemLayer.cpp"> RelativePath="ScreenSystemLayer.cpp">
</File> </File>
+16 -4
View File
@@ -165,16 +165,28 @@ float TimingData::GetBPMAtBeat( float fBeat ) const
return m_BPMSegments[i].GetBPM(); return m_BPMSegments[i].GetBPM();
} }
BPMSegment& TimingData::GetBPMSegmentAtBeat( float fBeat ) int TimingData::GetBPMSegmentIndexAtBeat( float fBeat )
{ {
int iIndex = BeatToNoteRow( fBeat ); int iIndex = BeatToNoteRow( fBeat );
unsigned i; int i;
for( i=0; i<m_BPMSegments.size()-1; i++ ) for( i=0; i<(int)(m_BPMSegments.size())-1; i++ )
if( m_BPMSegments[i+1].m_iStartIndex > iIndex ) if( m_BPMSegments[i+1].m_iStartIndex > iIndex )
break; break;
return m_BPMSegments[i]; return i;
} }
BPMSegment& TimingData::GetBPMSegmentAtBeat( float fBeat )
{
static BPMSegment empty;
if( m_BPMSegments.empty() )
{
empty = BPMSegment();
return empty;
}
int i = GetBPMSegmentIndexAtBeat( fBeat );
return m_BPMSegments[i];
}
void TimingData::GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut, bool &bFreezeOut ) const void TimingData::GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut, bool &bFreezeOut ) const
{ {
+34
View File
@@ -5,6 +5,8 @@
#include "NoteTypes.h" #include "NoteTypes.h"
#define COMPARE(x) if(x!=other.x) return false;
struct BPMSegment struct BPMSegment
{ {
BPMSegment() { m_iStartIndex = -1; m_fBPS = -1; } BPMSegment() { m_iStartIndex = -1; m_fBPS = -1; }
@@ -14,6 +16,14 @@ struct BPMSegment
void SetBPM( float f ); void SetBPM( float f );
float GetBPM() const; float GetBPM() const;
bool operator==( const BPMSegment &other )
{
COMPARE( m_iStartIndex );
COMPARE( m_fBPS );
return true;
}
bool operator!=( const BPMSegment &other ) { return !operator==(other); }
}; };
struct StopSegment struct StopSegment
@@ -22,6 +32,14 @@ struct StopSegment
StopSegment( int s, float f ) { m_iStartRow = s; m_fStopSeconds = f; } StopSegment( int s, float f ) { m_iStartRow = s; m_fStopSeconds = f; }
int m_iStartRow; int m_iStartRow;
float m_fStopSeconds; float m_fStopSeconds;
bool operator==( const StopSegment &other )
{
COMPARE( m_iStartRow );
COMPARE( m_fStopSeconds );
return true;
}
bool operator!=( const StopSegment &other ) { return !operator==(other); }
}; };
class TimingData class TimingData
@@ -36,6 +54,7 @@ public:
void MultiplyBPMInBeatRange( int iStartIndex, int iEndIndex, float fFactor ); void MultiplyBPMInBeatRange( int iStartIndex, int iEndIndex, float fFactor );
void AddBPMSegment( const BPMSegment &seg ); void AddBPMSegment( const BPMSegment &seg );
void AddStopSegment( const StopSegment &seg ); void AddStopSegment( const StopSegment &seg );
int GetBPMSegmentIndexAtBeat( float fBeat );
BPMSegment& GetBPMSegmentAtBeat( float fBeat ); BPMSegment& GetBPMSegmentAtBeat( float fBeat );
void GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut, bool &bFreezeOut ) const; void GetBeatAndBPSFromElapsedTime( float fElapsedTime, float &fBeatOut, float &fBPSOut, bool &bFreezeOut ) const;
@@ -49,6 +68,19 @@ public:
float GetElapsedTimeFromBeat( float fBeat ) const; float GetElapsedTimeFromBeat( float fBeat ) const;
bool HasBpmChangesOrStops() const; bool HasBpmChangesOrStops() const;
bool operator==( const TimingData &other )
{
COMPARE( m_BPMSegments.size() );
for( int i=0; i<m_BPMSegments.size(); i++ )
COMPARE( m_BPMSegments[i] );
COMPARE( m_StopSegments.size() );
for( int i=0; i<m_StopSegments.size(); i++ )
COMPARE( m_StopSegments[i] );
COMPARE( m_fBeat0OffsetInSeconds );
return true;
}
bool operator!=( const TimingData &other ) { return !operator==(other); }
// used for editor fix - expand/contract needs to move BPMSegments // used for editor fix - expand/contract needs to move BPMSegments
// and StopSegments that land during/after the edited range. // and StopSegments that land during/after the edited range.
// in addition, we need to be able to shift them otherwise as well // in addition, we need to be able to shift them otherwise as well
@@ -68,6 +100,8 @@ public:
float m_fBeat0OffsetInSeconds; float m_fBeat0OffsetInSeconds;
}; };
#undef COMPARE
#endif #endif
/* /*