self-registering DebugLines
This commit is contained in:
@@ -23,11 +23,34 @@ static bool g_bIsSlow = false;
|
||||
static bool g_bIsHalt = false;
|
||||
static RageTimer g_HaltTimer(RageZeroTimer);
|
||||
|
||||
|
||||
//
|
||||
// self-registering debug lines
|
||||
//
|
||||
class IDebugLine;
|
||||
static vector<IDebugLine*> *g_pvpSubscribers = NULL;
|
||||
class IDebugLine
|
||||
{
|
||||
public:
|
||||
IDebugLine()
|
||||
{
|
||||
if( g_pvpSubscribers == NULL )
|
||||
g_pvpSubscribers = new vector<IDebugLine*>;
|
||||
g_pvpSubscribers->push_back( this );
|
||||
}
|
||||
virtual CString GetDescription() = 0;
|
||||
virtual CString GetValue() = 0;
|
||||
virtual bool IsEnabled() = 0;
|
||||
virtual void Do() = 0;
|
||||
};
|
||||
|
||||
|
||||
static bool IsGameplay()
|
||||
{
|
||||
return SCREENMAN && SCREENMAN->GetTopScreen() && SCREENMAN->GetTopScreen()->GetScreenType() == gameplay;
|
||||
}
|
||||
|
||||
|
||||
REGISTER_SCREEN_CLASS( ScreenDebugOverlay );
|
||||
ScreenDebugOverlay::ScreenDebugOverlay( const CString &sName ) : Screen(sName)
|
||||
{
|
||||
@@ -35,19 +58,28 @@ ScreenDebugOverlay::ScreenDebugOverlay( const CString &sName ) : Screen(sName)
|
||||
|
||||
ScreenDebugOverlay::~ScreenDebugOverlay()
|
||||
{
|
||||
this->RemoveAllChildren();
|
||||
|
||||
FOREACH( BitmapText*, m_vptextButton, p )
|
||||
SAFE_DELETE( *p );
|
||||
m_vptextButton.clear();
|
||||
FOREACH( BitmapText*, m_vptextFunction, p )
|
||||
SAFE_DELETE( *p );
|
||||
m_vptextFunction.clear();
|
||||
}
|
||||
|
||||
const int MAX_DEBUG_LINES = 30;
|
||||
struct MapDebugToDI
|
||||
{
|
||||
DeviceInput holdForDebug1;
|
||||
DeviceInput holdForDebug2;
|
||||
DeviceInput debugButton[NUM_DEBUG_LINES];
|
||||
DeviceInput gameplayButton[NUM_DEBUG_LINES];
|
||||
DeviceInput debugButton[MAX_DEBUG_LINES];
|
||||
DeviceInput gameplayButton[MAX_DEBUG_LINES];
|
||||
void Clear()
|
||||
{
|
||||
holdForDebug1.MakeInvalid();
|
||||
holdForDebug2.MakeInvalid();
|
||||
FOREACH_DebugLine(i)
|
||||
for( int i=0; i<MAX_DEBUG_LINES; i++ )
|
||||
{
|
||||
debugButton[i].MakeInvalid();
|
||||
gameplayButton[i].MakeInvalid();
|
||||
@@ -56,7 +88,7 @@ struct MapDebugToDI
|
||||
};
|
||||
static MapDebugToDI g_Mappings;
|
||||
|
||||
static CString GetDebugButtonName( DebugLine i )
|
||||
static CString GetDebugButtonName( int i )
|
||||
{
|
||||
// TODO: Make arch appropriate.
|
||||
vector<CString> v;
|
||||
@@ -117,43 +149,26 @@ void ScreenDebugOverlay::Init()
|
||||
m_textHeader.SetText( "Debug Menu" );
|
||||
this->AddChild( &m_textHeader );
|
||||
|
||||
FOREACH_DebugLine( i )
|
||||
FOREACH_CONST( IDebugLine*, *g_pvpSubscribers, p )
|
||||
{
|
||||
BitmapText &txt1 = m_textButton[i];
|
||||
txt1.LoadFromFont( THEME->GetPathToF("Common normal") );
|
||||
txt1.SetHorizAlign( Actor::align_right );
|
||||
txt1.SetShadowLength( 2 );
|
||||
this->AddChild( &txt1 );
|
||||
BitmapText *pT1 = new BitmapText;
|
||||
pT1->LoadFromFont( THEME->GetPathToF("Common normal") );
|
||||
pT1->SetHorizAlign( Actor::align_right );
|
||||
pT1->SetText( "blah" );
|
||||
pT1->SetShadowLength( 2 );
|
||||
m_vptextButton.push_back( pT1 );
|
||||
this->AddChild( pT1 );
|
||||
|
||||
BitmapText &txt2 = m_textFunction[i];
|
||||
txt2.LoadFromFont( THEME->GetPathToF("Common normal") );
|
||||
txt2.SetHorizAlign( Actor::align_left );
|
||||
txt2.SetShadowLength( 2 );
|
||||
this->AddChild( &txt2 );
|
||||
BitmapText *pT2 = new BitmapText;
|
||||
pT2->LoadFromFont( THEME->GetPathToF("Common normal") );
|
||||
pT2->SetHorizAlign( Actor::align_left );
|
||||
pT2->SetText( "blah" );
|
||||
pT2->SetShadowLength( 2 );
|
||||
m_vptextFunction.push_back( pT2 );
|
||||
this->AddChild( pT2 );
|
||||
}
|
||||
|
||||
Update( 0 );
|
||||
}
|
||||
|
||||
static void SetSpeed()
|
||||
{
|
||||
if( g_bIsHalt )
|
||||
{
|
||||
INPUTFILTER->ButtonPressed( DeviceInput(DEVICE_KEYBOARD, KEY_TAB), true );
|
||||
INPUTFILTER->ButtonPressed( DeviceInput(DEVICE_KEYBOARD, KEY_ACCENT), true );
|
||||
}
|
||||
else if( g_bIsSlow )
|
||||
{
|
||||
INPUTFILTER->ButtonPressed( DeviceInput(DEVICE_KEYBOARD, KEY_TAB), false );
|
||||
INPUTFILTER->ButtonPressed( DeviceInput(DEVICE_KEYBOARD, KEY_ACCENT), true );
|
||||
}
|
||||
else
|
||||
{
|
||||
INPUTFILTER->ButtonPressed( DeviceInput(DEVICE_KEYBOARD, KEY_TAB), false );
|
||||
INPUTFILTER->ButtonPressed( DeviceInput(DEVICE_KEYBOARD, KEY_ACCENT), false );
|
||||
}
|
||||
|
||||
// PauseMusic( g_bIsHalt );
|
||||
Update( 0 );
|
||||
}
|
||||
|
||||
void ScreenDebugOverlay::Update( float fDeltaTime )
|
||||
@@ -173,120 +188,25 @@ void ScreenDebugOverlay::UpdateText()
|
||||
const RageColor off(0.6f, 0.6f, 0.6f, 1.0f);
|
||||
const RageColor on(1, 1, 1, 1);
|
||||
|
||||
FOREACH_DebugLine( i )
|
||||
const unsigned NUM_DEBUG_LINES = g_pvpSubscribers->size();
|
||||
FOREACH_CONST( IDebugLine*, *g_pvpSubscribers, p )
|
||||
{
|
||||
BitmapText &txt1 = m_textButton[i];
|
||||
int i = p-g_pvpSubscribers->begin();
|
||||
|
||||
BitmapText &txt1 = *m_vptextButton[i];
|
||||
txt1.SetX( SCREEN_CENTER_X-50 );
|
||||
txt1.SetY( SCALE(i, 0, NUM_DEBUG_LINES-1, SCREEN_TOP+60, SCREEN_BOTTOM-40) );
|
||||
txt1.SetZoom( 0.7f );
|
||||
|
||||
BitmapText &txt2 = m_textFunction[i];
|
||||
BitmapText &txt2 = *m_vptextFunction[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;
|
||||
switch( i )
|
||||
{
|
||||
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_Slow: s1="Slow"; break;
|
||||
case DebugLine_Halt: s1="Halt"; break;
|
||||
case DebugLine_LightsDebug: s1="Lights Debug"; break;
|
||||
case DebugLine_MonkeyInput: s1="MonkeyInput"; break;
|
||||
case DebugLine_Stats: s1="Rendering Stats"; break;
|
||||
case DebugLine_Vsync: s1="Vsync"; break;
|
||||
case DebugLine_ScreenTestMode: s1="Screen Test Mode"; break;
|
||||
case DebugLine_ClearMachineStats: s1="Clear Machine Stats"; break;
|
||||
case DebugLine_FillMachineStats: s1="Fill Machine Stats"; break;
|
||||
case DebugLine_SendNotesEnded: s1="Send Notes Ended"; break;
|
||||
case DebugLine_ReloadCurrentScreen: s1="Reload"; break;
|
||||
case DebugLine_ReloadTheme: s1="Reload Theme and Textures"; break;
|
||||
case DebugLine_WriteProfiles: s1="Write Profiles"; break;
|
||||
case DebugLine_WritePreferences: s1="Write Preferences"; break;
|
||||
case DebugLine_MenuTimer: s1="Menu Timer"; break;
|
||||
case DebugLine_FlushLog: s1="Flush Log"; break;
|
||||
case DebugLine_VolumeUp: s1="Volume Up"; break;
|
||||
case DebugLine_VolumeDown: s1="Volume Down"; break;
|
||||
case DebugLine_Uptime: s1="Uptime"; break;
|
||||
default: ASSERT(0);
|
||||
}
|
||||
CString s1 = (*p)->GetDescription();
|
||||
CString s2 = (*p)->GetValue();
|
||||
|
||||
bool bOn = false;
|
||||
switch( i )
|
||||
{
|
||||
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_Slow: bOn=g_bIsSlow; break;
|
||||
case DebugLine_Halt: bOn=g_bIsHalt; break;
|
||||
case DebugLine_LightsDebug: bOn=PREFSMAN->m_bDebugLights.Get(); break;
|
||||
case DebugLine_MonkeyInput: bOn=PREFSMAN->m_bMonkeyInput.Get(); break;
|
||||
case DebugLine_Stats: bOn=PREFSMAN->m_bShowStats.Get(); break;
|
||||
case DebugLine_Vsync: bOn=PREFSMAN->m_bVsync.Get(); break;
|
||||
case DebugLine_ScreenTestMode: bOn=PREFSMAN->m_bScreenTestMode.Get(); break;
|
||||
case DebugLine_ClearMachineStats: bOn=true; break;
|
||||
case DebugLine_FillMachineStats: bOn=true; break;
|
||||
case DebugLine_SendNotesEnded: bOn=true; break;
|
||||
case DebugLine_ReloadCurrentScreen: bOn=true; break;
|
||||
case DebugLine_ReloadTheme: bOn=true; break;
|
||||
case DebugLine_WriteProfiles: bOn=true; break;
|
||||
case DebugLine_WritePreferences: bOn=true; break;
|
||||
case DebugLine_MenuTimer: bOn=PREFSMAN->m_bMenuTimer.Get(); break;
|
||||
case DebugLine_FlushLog: bOn=true; break;
|
||||
case DebugLine_VolumeUp: bOn=true; break;
|
||||
case DebugLine_VolumeDown: bOn=true; break;
|
||||
case DebugLine_Uptime: bOn=false; break;
|
||||
default: ASSERT(0);
|
||||
}
|
||||
|
||||
CString s2;
|
||||
switch( i )
|
||||
{
|
||||
case DebugLine_Autoplay:
|
||||
switch( PREFSMAN->m_AutoPlay )
|
||||
{
|
||||
case PC_HUMAN: s2="off"; break;
|
||||
case PC_AUTOPLAY: s2="on"; break;
|
||||
case PC_CPU: s2="CPU"; break;
|
||||
default: ASSERT(0);
|
||||
}
|
||||
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_Slow: s2=bOn ? "on":"off"; break;
|
||||
case DebugLine_Halt: s2=bOn ? "on":"off"; break;
|
||||
case DebugLine_LightsDebug: s2=bOn ? "on":"off"; break;
|
||||
case DebugLine_MonkeyInput: s2=bOn ? "on":"off"; break;
|
||||
case DebugLine_Stats: s2=bOn ? "on":"off"; break;
|
||||
case DebugLine_Vsync: s2=bOn ? "on":"off"; break;
|
||||
case DebugLine_ScreenTestMode: s2=bOn ? "on":"off"; break;
|
||||
case DebugLine_ClearMachineStats: s2=""; break;
|
||||
case DebugLine_FillMachineStats: s2=""; break;
|
||||
case DebugLine_SendNotesEnded: s2=""; break;
|
||||
case DebugLine_ReloadCurrentScreen: s2=SCREENMAN ? SCREENMAN->GetTopScreen()->GetName():""; break;
|
||||
case DebugLine_ReloadTheme: s2=""; break;
|
||||
case DebugLine_WriteProfiles: s2=""; break;
|
||||
case DebugLine_WritePreferences: s2=""; break;
|
||||
case DebugLine_MenuTimer: s2=""; break;
|
||||
case DebugLine_FlushLog: s2=""; break;
|
||||
case DebugLine_VolumeUp: s2=ssprintf("%.0f%%",PREFSMAN->m_fSoundVolume.Get()*100); break;
|
||||
case DebugLine_VolumeDown: s2=""; break;
|
||||
case DebugLine_Uptime: s2=SecondsToMMSSMsMsMs(RageTimer::GetTimeSinceStart()); break;
|
||||
default: ASSERT(0);
|
||||
}
|
||||
bool bOn = (*p)->IsEnabled();
|
||||
|
||||
txt1.SetDiffuse( bOn ? on:off );
|
||||
txt2.SetDiffuse( bOn ? on:off );
|
||||
@@ -327,165 +247,27 @@ bool ScreenDebugOverlay::OverlayInput( const DeviceInput& DeviceI, const InputEv
|
||||
g_bIsDisplayed = false;
|
||||
}
|
||||
|
||||
FOREACH_DebugLine( i )
|
||||
FOREACH_CONST( IDebugLine*, *g_pvpSubscribers, p )
|
||||
{
|
||||
int i = p-g_pvpSubscribers->begin();
|
||||
|
||||
if( (g_bIsDisplayed && DeviceI == g_Mappings.debugButton[i]) ||
|
||||
(IsGameplay() && DeviceI == g_Mappings.gameplayButton[i]) )
|
||||
{
|
||||
if( type != IET_FIRST_PRESS )
|
||||
return true; /* eat the input but do nothing */
|
||||
|
||||
BitmapText &txt1 = m_textButton[i];
|
||||
BitmapText &txt1 = *m_vptextButton[i];
|
||||
txt1.FinishTweening();
|
||||
float fZoom = txt1.GetZoom();
|
||||
txt1.SetZoom( fZoom * 1.2f );
|
||||
txt1.BeginTweening( 0.2f, Actor::TWEEN_LINEAR );
|
||||
txt1.SetZoom( fZoom );
|
||||
|
||||
BitmapText &txt2 = m_textFunction[i];
|
||||
BitmapText &txt2 = *m_vptextFunction[i];
|
||||
|
||||
switch( i )
|
||||
{
|
||||
case DebugLine_Autoplay:
|
||||
{
|
||||
PlayerController pc = (PlayerController)(PREFSMAN->m_AutoPlay+1);
|
||||
wrap( (int&)pc, NUM_PLAYER_CONTROLLERS );
|
||||
PREFSMAN->m_AutoPlay.Set( pc );
|
||||
FOREACH_HumanPlayer(pn)
|
||||
GAMESTATE->m_pPlayerState[pn]->m_PlayerController = PREFSMAN->m_AutoPlay;
|
||||
}
|
||||
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_AssistTickChanged );
|
||||
}
|
||||
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_AutosyncChanged );
|
||||
}
|
||||
break;
|
||||
case DebugLine_CoinMode:
|
||||
{
|
||||
CoinMode cm = (CoinMode)(PREFSMAN->m_CoinMode+1);
|
||||
wrap( (int&)cm, NUM_COIN_MODES );
|
||||
PREFSMAN->m_CoinMode.Set( cm );
|
||||
SCREENMAN->RefreshCreditsMessages();
|
||||
}
|
||||
break;
|
||||
case DebugLine_Slow:
|
||||
g_bIsSlow = !g_bIsSlow;
|
||||
SetSpeed();
|
||||
break;
|
||||
case DebugLine_Halt:
|
||||
g_bIsHalt = !g_bIsHalt;
|
||||
g_HaltTimer.Touch();
|
||||
SetSpeed();
|
||||
break;
|
||||
case DebugLine_LightsDebug:
|
||||
PREFSMAN->m_bDebugLights.Set( !PREFSMAN->m_bDebugLights );
|
||||
break;
|
||||
case DebugLine_MonkeyInput:
|
||||
PREFSMAN->m_bMonkeyInput.Set( !PREFSMAN->m_bMonkeyInput );
|
||||
break;
|
||||
case DebugLine_Stats:
|
||||
PREFSMAN->m_bShowStats.Set( !PREFSMAN->m_bShowStats );
|
||||
break;
|
||||
case DebugLine_Vsync:
|
||||
PREFSMAN->m_bVsync.Set( !PREFSMAN->m_bVsync );
|
||||
ApplyGraphicOptions();
|
||||
break;
|
||||
case DebugLine_ScreenTestMode:
|
||||
PREFSMAN->m_bScreenTestMode.Set( !PREFSMAN->m_bScreenTestMode );
|
||||
break;
|
||||
case DebugLine_ClearMachineStats:
|
||||
{
|
||||
GameCommand gc;
|
||||
gc.Load( 0, ParseCommands("ClearMachineStats") );
|
||||
gc.ApplyToAllPlayers();
|
||||
}
|
||||
break;
|
||||
case DebugLine_FillMachineStats:
|
||||
{
|
||||
GameCommand gc;
|
||||
gc.Load( 0, ParseCommands("FillMachineStats") );
|
||||
gc.ApplyToAllPlayers();
|
||||
}
|
||||
break;
|
||||
case DebugLine_SendNotesEnded:
|
||||
SCREENMAN->PostMessageToTopScreen( SM_NotesEnded, 0 );
|
||||
break;
|
||||
case DebugLine_ReloadCurrentScreen:
|
||||
SOUND->StopMusic();
|
||||
ResetGame();
|
||||
SCREENMAN->SetNewScreen( SCREENMAN->GetTopScreen()->GetName() );
|
||||
break;
|
||||
case DebugLine_ReloadTheme:
|
||||
THEME->ReloadMetrics();
|
||||
TEXTUREMAN->ReloadAll();
|
||||
NOTESKIN->RefreshNoteSkinData( GAMESTATE->m_pCurGame );
|
||||
CodeDetector::RefreshCacheItems();
|
||||
SCREENMAN->SystemMessage( "Theme reloaded." );
|
||||
// HACK: Don't update text below. Return immediately because this screen.
|
||||
// was just destroyed as part of the them reload.
|
||||
return true;
|
||||
case DebugLine_WriteProfiles:
|
||||
// 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) )
|
||||
continue;
|
||||
(*p)->Do();
|
||||
|
||||
bool bWasMemoryCard = PROFILEMAN->ProfileWasLoadedFromMemoryCard(p);
|
||||
if( bWasMemoryCard )
|
||||
MEMCARDMAN->MountCard( p );
|
||||
PROFILEMAN->SaveProfile( p );
|
||||
if( bWasMemoryCard )
|
||||
MEMCARDMAN->UnmountCard( p );
|
||||
}
|
||||
break;
|
||||
case DebugLine_WritePreferences:
|
||||
PREFSMAN->SaveGlobalPrefsToDisk();
|
||||
break;
|
||||
case DebugLine_MenuTimer:
|
||||
PREFSMAN->m_bMenuTimer.Set( !PREFSMAN->m_bMenuTimer );
|
||||
break;
|
||||
case DebugLine_FlushLog:
|
||||
LOG->Flush();
|
||||
break;
|
||||
case DebugLine_VolumeUp:
|
||||
case DebugLine_VolumeDown:
|
||||
{
|
||||
float fVol = PREFSMAN->m_fSoundVolume;
|
||||
switch( i )
|
||||
{
|
||||
default: ASSERT(0);
|
||||
case DebugLine_VolumeUp: fVol += 0.1f; break;
|
||||
case DebugLine_VolumeDown: fVol -= 0.1f; break;
|
||||
}
|
||||
CLAMP( fVol, 0.0f, 1.0f );
|
||||
PREFSMAN->m_fSoundVolume.Set( fVol );
|
||||
SOUNDMAN->SetPrefs( PREFSMAN->m_fSoundVolume );
|
||||
}
|
||||
break;
|
||||
case DebugLine_Uptime:
|
||||
break;
|
||||
default: ASSERT(0);
|
||||
}
|
||||
|
||||
UpdateText();
|
||||
|
||||
SCREENMAN->SystemMessage( txt2.GetText() );
|
||||
@@ -498,6 +280,376 @@ bool ScreenDebugOverlay::OverlayInput( const DeviceInput& DeviceI, const InputEv
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
// DebugLine helpers
|
||||
//
|
||||
static void SetSpeed()
|
||||
{
|
||||
if( g_bIsHalt )
|
||||
{
|
||||
INPUTFILTER->ButtonPressed( DeviceInput(DEVICE_KEYBOARD, KEY_TAB), true );
|
||||
INPUTFILTER->ButtonPressed( DeviceInput(DEVICE_KEYBOARD, KEY_ACCENT), true );
|
||||
}
|
||||
else if( g_bIsSlow )
|
||||
{
|
||||
INPUTFILTER->ButtonPressed( DeviceInput(DEVICE_KEYBOARD, KEY_TAB), false );
|
||||
INPUTFILTER->ButtonPressed( DeviceInput(DEVICE_KEYBOARD, KEY_ACCENT), true );
|
||||
}
|
||||
else
|
||||
{
|
||||
INPUTFILTER->ButtonPressed( DeviceInput(DEVICE_KEYBOARD, KEY_TAB), false );
|
||||
INPUTFILTER->ButtonPressed( DeviceInput(DEVICE_KEYBOARD, KEY_ACCENT), false );
|
||||
}
|
||||
|
||||
// PauseMusic( g_bIsHalt );
|
||||
}
|
||||
|
||||
void ChangeVolume( float fDelta )
|
||||
{
|
||||
float fVol = PREFSMAN->m_fSoundVolume;
|
||||
fVol += fDelta;
|
||||
CLAMP( fVol, 0.0f, 1.0f );
|
||||
PREFSMAN->m_fSoundVolume.Set( fVol );
|
||||
SOUNDMAN->SetPrefs( PREFSMAN->m_fSoundVolume );
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// DebugLines
|
||||
//
|
||||
class DebugLineAutoplay : public IDebugLine
|
||||
{
|
||||
virtual CString GetDescription() { return "AutoPlay"; }
|
||||
virtual CString GetValue()
|
||||
{
|
||||
switch( PREFSMAN->m_AutoPlay )
|
||||
{
|
||||
case PC_HUMAN: return "off"; break;
|
||||
case PC_AUTOPLAY: return "on"; break;
|
||||
case PC_CPU: return "CPU"; break;
|
||||
default: ASSERT(0); return NULL;
|
||||
}
|
||||
}
|
||||
virtual bool IsEnabled() { return PREFSMAN->m_AutoPlay.Get() != PC_HUMAN; }
|
||||
virtual void Do()
|
||||
{
|
||||
PlayerController pc = (PlayerController)(PREFSMAN->m_AutoPlay+1);
|
||||
wrap( (int&)pc, NUM_PLAYER_CONTROLLERS );
|
||||
PREFSMAN->m_AutoPlay.Set( pc );
|
||||
FOREACH_HumanPlayer(pn)
|
||||
GAMESTATE->m_pPlayerState[pn]->m_PlayerController = PREFSMAN->m_AutoPlay;
|
||||
}
|
||||
};
|
||||
static DebugLineAutoplay g_DebugLineAutoplay;
|
||||
|
||||
class DebugLineAssistTick : public IDebugLine
|
||||
{
|
||||
virtual CString GetDescription() { return "AssistTick"; }
|
||||
virtual CString GetValue() { return IsEnabled() ? "on":"off"; }
|
||||
virtual bool IsEnabled() { return GAMESTATE->m_SongOptions.m_bAssistTick; }
|
||||
virtual void Do()
|
||||
{
|
||||
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_AssistTickChanged );
|
||||
}
|
||||
};
|
||||
static DebugLineAssistTick g_DebugLineAssistTick;
|
||||
|
||||
class DebugLineAutosync : public IDebugLine
|
||||
{
|
||||
virtual CString GetDescription() { return "Autosync"; }
|
||||
virtual CString GetValue()
|
||||
{
|
||||
switch( GAMESTATE->m_SongOptions.m_AutosyncType )
|
||||
{
|
||||
case SongOptions::AUTOSYNC_OFF: return "off"; break;
|
||||
case SongOptions::AUTOSYNC_SONG: return "Song"; break;
|
||||
case SongOptions::AUTOSYNC_MACHINE: return "Machine"; break;
|
||||
default: ASSERT(0);
|
||||
}
|
||||
}
|
||||
virtual bool IsEnabled() { return GAMESTATE->m_SongOptions.m_AutosyncType!=SongOptions::AUTOSYNC_OFF; }
|
||||
virtual void Do()
|
||||
{
|
||||
}
|
||||
};
|
||||
static DebugLineAutosync g_DebugLineAutosync;
|
||||
|
||||
class DebugLineCoinMode : public IDebugLine
|
||||
{
|
||||
virtual CString GetDescription() { return "CoinMode"; }
|
||||
virtual CString GetValue() { return CoinModeToString(PREFSMAN->m_CoinMode); }
|
||||
virtual bool IsEnabled() { return true; }
|
||||
virtual void Do()
|
||||
{
|
||||
CoinMode cm = (CoinMode)(PREFSMAN->m_CoinMode+1);
|
||||
wrap( (int&)cm, NUM_COIN_MODES );
|
||||
PREFSMAN->m_CoinMode.Set( cm );
|
||||
SCREENMAN->RefreshCreditsMessages();
|
||||
}
|
||||
};
|
||||
static DebugLineCoinMode g_DebugLineCoinMode;
|
||||
|
||||
class DebugLineSlow : public IDebugLine
|
||||
{
|
||||
virtual CString GetDescription() { return "Slow"; }
|
||||
virtual CString GetValue() { return IsEnabled() ? "on":"off"; }
|
||||
virtual bool IsEnabled() { return g_bIsSlow; }
|
||||
virtual void Do()
|
||||
{
|
||||
g_bIsSlow = !g_bIsSlow;
|
||||
SetSpeed();
|
||||
}
|
||||
};
|
||||
static DebugLineSlow g_DebugLineSlow;
|
||||
|
||||
class DebugLineHalt : public IDebugLine
|
||||
{
|
||||
virtual CString GetDescription() { return "Halt"; }
|
||||
virtual CString GetValue() { return IsEnabled() ? "on":"off"; }
|
||||
virtual bool IsEnabled() { return g_bIsHalt; }
|
||||
virtual void Do()
|
||||
{
|
||||
g_bIsHalt = !g_bIsHalt;
|
||||
g_HaltTimer.Touch();
|
||||
SetSpeed();
|
||||
}
|
||||
};
|
||||
static DebugLineHalt g_DebugLineHalt;
|
||||
|
||||
class DebugLineLightsDebug : public IDebugLine
|
||||
{
|
||||
virtual CString GetDescription() { return "Lights Debug"; }
|
||||
virtual CString GetValue() { return IsEnabled() ? "on":"off"; }
|
||||
virtual bool IsEnabled() { return PREFSMAN->m_bDebugLights.Get(); }
|
||||
virtual void Do()
|
||||
{
|
||||
PREFSMAN->m_bDebugLights.Set( !PREFSMAN->m_bDebugLights );
|
||||
}
|
||||
};
|
||||
static DebugLineLightsDebug g_DebugLineLightsDebug;
|
||||
|
||||
class DebugLineMonkeyInput : public IDebugLine
|
||||
{
|
||||
virtual CString GetDescription() { return "MonkeyInput"; }
|
||||
virtual CString GetValue() { return IsEnabled() ? "on":"off"; }
|
||||
virtual bool IsEnabled() { return PREFSMAN->m_bMonkeyInput.Get(); }
|
||||
virtual void Do()
|
||||
{
|
||||
PREFSMAN->m_bMonkeyInput.Set( !PREFSMAN->m_bMonkeyInput );
|
||||
}
|
||||
};
|
||||
static DebugLineMonkeyInput g_DebugLineMonkeyInput;
|
||||
|
||||
class DebugLineStats : public IDebugLine
|
||||
{
|
||||
virtual CString GetDescription() { return "Rendering Stats"; }
|
||||
virtual CString GetValue() { return IsEnabled() ? "on":"off"; }
|
||||
virtual bool IsEnabled() { return PREFSMAN->m_bShowStats.Get(); }
|
||||
virtual void Do()
|
||||
{
|
||||
PREFSMAN->m_bShowStats.Set( !PREFSMAN->m_bShowStats );
|
||||
}
|
||||
};
|
||||
static DebugLineStats g_DebugLineStats;
|
||||
|
||||
class DebugLineVsync : public IDebugLine
|
||||
{
|
||||
virtual CString GetDescription() { return "Vsync"; }
|
||||
virtual CString GetValue() { return IsEnabled() ? "on":"off"; }
|
||||
virtual bool IsEnabled() { return PREFSMAN->m_bVsync.Get(); }
|
||||
virtual void Do()
|
||||
{
|
||||
PREFSMAN->m_bVsync.Set( !PREFSMAN->m_bVsync );
|
||||
ApplyGraphicOptions();
|
||||
}
|
||||
};
|
||||
static DebugLineVsync g_DebugLineVsync;
|
||||
|
||||
class DebugLineScreenTestMode : public IDebugLine
|
||||
{
|
||||
virtual CString GetDescription() { return "Screen Test Mode"; }
|
||||
virtual CString GetValue() { return IsEnabled() ? "on":"off"; }
|
||||
virtual bool IsEnabled() { return PREFSMAN->m_bScreenTestMode.Get(); }
|
||||
virtual void Do()
|
||||
{
|
||||
PREFSMAN->m_bScreenTestMode.Set( !PREFSMAN->m_bScreenTestMode );
|
||||
}
|
||||
};
|
||||
static DebugLineScreenTestMode g_DebugLineScreenTestMode;
|
||||
|
||||
class DebugLineClearMachineStats : public IDebugLine
|
||||
{
|
||||
virtual CString GetDescription() { return "Clear Machine Stats"; }
|
||||
virtual CString GetValue() { return NULL; }
|
||||
virtual bool IsEnabled() { return true; }
|
||||
virtual void Do()
|
||||
{
|
||||
GameCommand gc;
|
||||
gc.Load( 0, ParseCommands("ClearMachineStats") );
|
||||
gc.ApplyToAllPlayers();
|
||||
}
|
||||
};
|
||||
static DebugLineClearMachineStats g_DebugClearMachineStats;
|
||||
|
||||
class DebugLineFillMachineStats : public IDebugLine
|
||||
{
|
||||
virtual CString GetDescription() { return "Fill Machine Stats"; }
|
||||
virtual CString GetValue() { return NULL; }
|
||||
virtual bool IsEnabled() { return true; }
|
||||
virtual void Do()
|
||||
{
|
||||
GameCommand gc;
|
||||
gc.Load( 0, ParseCommands("FillMachineStats") );
|
||||
gc.ApplyToAllPlayers();
|
||||
}
|
||||
};
|
||||
static DebugLineFillMachineStats g_DebugLineFillMachineStats;
|
||||
|
||||
class DebugLineSendNotesEnded : public IDebugLine
|
||||
{
|
||||
virtual CString GetDescription() { return "Send Notes Ended"; }
|
||||
virtual CString GetValue() { return NULL; }
|
||||
virtual bool IsEnabled() { return true; }
|
||||
virtual void Do()
|
||||
{
|
||||
SCREENMAN->PostMessageToTopScreen( SM_NotesEnded, 0 );
|
||||
}
|
||||
};
|
||||
static DebugLineSendNotesEnded g_DebugLineSendNotesEnded;
|
||||
|
||||
class DebugLineReloadCurrentScreen : public IDebugLine
|
||||
{
|
||||
virtual CString GetDescription() { return "Reload"; }
|
||||
virtual CString GetValue() { return SCREENMAN ? SCREENMAN->GetTopScreen()->GetName() : NULL; }
|
||||
virtual bool IsEnabled() { return true; }
|
||||
virtual void Do()
|
||||
{
|
||||
SOUND->StopMusic();
|
||||
ResetGame();
|
||||
SCREENMAN->SetNewScreen( SCREENMAN->GetTopScreen()->GetName() );
|
||||
}
|
||||
};
|
||||
static DebugLineStats g_DebugLineReloadCurrentScreen;
|
||||
|
||||
class DebugLineReloadTheme : public IDebugLine
|
||||
{
|
||||
virtual CString GetDescription() { return "Reload Theme and Textures"; }
|
||||
virtual CString GetValue() { return NULL; }
|
||||
virtual bool IsEnabled() { return true; }
|
||||
virtual void Do()
|
||||
{
|
||||
THEME->ReloadMetrics();
|
||||
TEXTUREMAN->ReloadAll();
|
||||
NOTESKIN->RefreshNoteSkinData( GAMESTATE->m_pCurGame );
|
||||
CodeDetector::RefreshCacheItems();
|
||||
SCREENMAN->SystemMessage( "Theme reloaded." );
|
||||
// HACK: Don't update text below. Return immediately because this screen.
|
||||
// was just destroyed as part of the them reload.
|
||||
}
|
||||
};
|
||||
static DebugLineReloadTheme g_DebugLineReloadTheme;
|
||||
|
||||
class DebugLineWriteProfiles : public IDebugLine
|
||||
{
|
||||
virtual CString GetDescription() { return "Write Profiles"; }
|
||||
virtual CString GetValue() { return NULL; }
|
||||
virtual bool IsEnabled() { return true; }
|
||||
virtual void Do()
|
||||
{
|
||||
// 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) )
|
||||
continue;
|
||||
|
||||
bool bWasMemoryCard = PROFILEMAN->ProfileWasLoadedFromMemoryCard(p);
|
||||
if( bWasMemoryCard )
|
||||
MEMCARDMAN->MountCard( p );
|
||||
PROFILEMAN->SaveProfile( p );
|
||||
if( bWasMemoryCard )
|
||||
MEMCARDMAN->UnmountCard( p );
|
||||
}
|
||||
}
|
||||
};
|
||||
static DebugLineWriteProfiles g_DebugLineWriteProfiles;
|
||||
|
||||
class DebugLineWritePreferences : public IDebugLine
|
||||
{
|
||||
virtual CString GetDescription() { return "Write Preferences"; }
|
||||
virtual CString GetValue() { return NULL; }
|
||||
virtual bool IsEnabled() { return true; }
|
||||
virtual void Do()
|
||||
{
|
||||
PREFSMAN->SaveGlobalPrefsToDisk();
|
||||
}
|
||||
};
|
||||
static DebugLineStats g_DebugLineWritePreferences;
|
||||
|
||||
class DebugLineMenuTimer : public IDebugLine
|
||||
{
|
||||
virtual CString GetDescription() { return "Menu Timer"; }
|
||||
virtual CString GetValue() { return NULL; }
|
||||
virtual bool IsEnabled() { return PREFSMAN->m_bMenuTimer.Get(); }
|
||||
virtual void Do()
|
||||
{
|
||||
PREFSMAN->m_bMenuTimer.Set( !PREFSMAN->m_bMenuTimer );
|
||||
}
|
||||
};
|
||||
static DebugLineMenuTimer g_DebugLineMenuTimer;
|
||||
|
||||
class DebugLineFlushLog : public IDebugLine
|
||||
{
|
||||
virtual CString GetDescription() { return "Flush Log"; }
|
||||
virtual CString GetValue() { return NULL; }
|
||||
virtual bool IsEnabled() { return true; }
|
||||
virtual void Do()
|
||||
{
|
||||
LOG->Flush();
|
||||
}
|
||||
};
|
||||
static DebugLineFlushLog g_DebugLineFlushLog;
|
||||
|
||||
class DebugLineVolumeUp : public IDebugLine
|
||||
{
|
||||
virtual CString GetDescription() { return "Volume Up"; }
|
||||
virtual CString GetValue() { return ssprintf("%.0f%%",PREFSMAN->m_fSoundVolume.Get()*100); }
|
||||
virtual bool IsEnabled() { return true; }
|
||||
virtual void Do()
|
||||
{
|
||||
ChangeVolume( +0.1f );
|
||||
}
|
||||
};
|
||||
static DebugLineVolumeUp g_DebugLineVolumeUp;
|
||||
|
||||
class DebugLineVolumeDown : public IDebugLine
|
||||
{
|
||||
virtual CString GetDescription() { return "Volume Down"; }
|
||||
virtual CString GetValue() { return NULL; }
|
||||
virtual bool IsEnabled() { return true; }
|
||||
virtual void Do()
|
||||
{
|
||||
ChangeVolume( -0.1f );
|
||||
}
|
||||
};
|
||||
static DebugLineVolumeDown g_DebugLineVolumeDown;
|
||||
|
||||
class DebugLineUptime : public IDebugLine
|
||||
{
|
||||
virtual CString GetDescription() { return "Uptime"; }
|
||||
virtual CString GetValue() { return SecondsToMMSSMsMsMs(RageTimer::GetTimeSinceStart()); }
|
||||
virtual bool IsEnabled() { return false; }
|
||||
virtual void Do() {}
|
||||
};
|
||||
static DebugLineUptime g_DebugLineUptime;
|
||||
|
||||
|
||||
/*
|
||||
* (c) 2001-2005 Chris Danford, Glenn Maynard
|
||||
* All rights reserved.
|
||||
|
||||
@@ -7,35 +7,6 @@
|
||||
#include "BitmapText.h"
|
||||
#include "Quad.h"
|
||||
|
||||
enum DebugLine
|
||||
{
|
||||
DebugLine_Autoplay,
|
||||
DebugLine_AssistTick,
|
||||
DebugLine_Autosync,
|
||||
DebugLine_CoinMode,
|
||||
DebugLine_Slow,
|
||||
DebugLine_Halt,
|
||||
DebugLine_LightsDebug,
|
||||
DebugLine_MonkeyInput,
|
||||
DebugLine_Stats,
|
||||
DebugLine_Vsync,
|
||||
DebugLine_ScreenTestMode,
|
||||
DebugLine_ClearMachineStats,
|
||||
DebugLine_FillMachineStats,
|
||||
DebugLine_SendNotesEnded,
|
||||
DebugLine_ReloadCurrentScreen,
|
||||
DebugLine_ReloadTheme,
|
||||
DebugLine_WriteProfiles,
|
||||
DebugLine_WritePreferences,
|
||||
DebugLine_MenuTimer,
|
||||
DebugLine_FlushLog,
|
||||
DebugLine_VolumeUp,
|
||||
DebugLine_VolumeDown,
|
||||
DebugLine_Uptime,
|
||||
NUM_DEBUG_LINES
|
||||
};
|
||||
#define FOREACH_DebugLine( i ) FOREACH_ENUM( DebugLine, NUM_DEBUG_LINES, i )
|
||||
|
||||
class ScreenDebugOverlay : public Screen
|
||||
{
|
||||
public:
|
||||
@@ -52,8 +23,8 @@ private:
|
||||
|
||||
Quad m_Quad;
|
||||
BitmapText m_textHeader;
|
||||
BitmapText m_textButton[NUM_DEBUG_LINES];
|
||||
BitmapText m_textFunction[NUM_DEBUG_LINES];
|
||||
vector<BitmapText*> m_vptextButton;
|
||||
vector<BitmapText*> m_vptextFunction;
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user