allow disabling of autoplay in normal gameplay but enabling in edit gameplay
This commit is contained in:
@@ -49,7 +49,8 @@ public:
|
|||||||
g_pvpSubscribers->push_back( this );
|
g_pvpSubscribers->push_back( this );
|
||||||
}
|
}
|
||||||
virtual ~IDebugLine() { }
|
virtual ~IDebugLine() { }
|
||||||
virtual bool GameplayOnly() const { return false; }
|
enum Type { all_screens, gameplay_only, editor_gameplay_only };
|
||||||
|
virtual Type GetType() const { return all_screens; }
|
||||||
virtual RString GetDescription() = 0;
|
virtual RString GetDescription() = 0;
|
||||||
virtual RString GetValue() = 0;
|
virtual RString GetValue() = 0;
|
||||||
virtual bool IsEnabled() = 0;
|
virtual bool IsEnabled() = 0;
|
||||||
@@ -65,12 +66,22 @@ public:
|
|||||||
DeviceInput m_Button;
|
DeviceInput m_Button;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static bool IsGameplay()
|
static bool IsGameplay()
|
||||||
{
|
{
|
||||||
return SCREENMAN && SCREENMAN->GetTopScreen() && SCREENMAN->GetTopScreen()->GetScreenType() == gameplay;
|
return SCREENMAN && SCREENMAN->GetTopScreen() && SCREENMAN->GetTopScreen()->GetScreenType() == gameplay;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool IsEditorGameplay()
|
||||||
|
{
|
||||||
|
if( IsGameplay() )
|
||||||
|
{
|
||||||
|
RString s = SCREENMAN->GetTopScreen()->GetName();
|
||||||
|
if( s.find("ScreenEdit") != s.npos )
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
REGISTER_SCREEN_CLASS( ScreenDebugOverlay );
|
REGISTER_SCREEN_CLASS( ScreenDebugOverlay );
|
||||||
|
|
||||||
@@ -111,13 +122,22 @@ struct MapDebugToDI
|
|||||||
static MapDebugToDI g_Mappings;
|
static MapDebugToDI g_Mappings;
|
||||||
|
|
||||||
static LocalizedString IN_GAMEPLAY( "ScreenDebugOverlay", "%s in gameplay" );
|
static LocalizedString IN_GAMEPLAY( "ScreenDebugOverlay", "%s in gameplay" );
|
||||||
|
static LocalizedString IN_EDITOR_GAMEPLAY( "ScreenDebugOverlay", "%s in editor gameplay" );
|
||||||
static LocalizedString OR( "ScreenDebugOverlay", "or" );
|
static LocalizedString OR( "ScreenDebugOverlay", "or" );
|
||||||
static RString GetDebugButtonName( const IDebugLine *pLine )
|
static RString GetDebugButtonName( const IDebugLine *pLine )
|
||||||
{
|
{
|
||||||
if( pLine->GameplayOnly() )
|
RString s = INPUTMAN->GetDeviceSpecificInputString(pLine->m_Button);
|
||||||
return ssprintf( IN_GAMEPLAY.GetValue(), INPUTMAN->GetDeviceSpecificInputString(pLine->m_Button).c_str() );
|
switch( pLine->GetType() )
|
||||||
else
|
{
|
||||||
return INPUTMAN->GetDeviceSpecificInputString(pLine->m_Button);
|
case IDebugLine::all_screens:
|
||||||
|
return s;
|
||||||
|
case IDebugLine::gameplay_only:
|
||||||
|
return ssprintf( IN_GAMEPLAY.GetValue(), s.c_str() );
|
||||||
|
case IDebugLine::editor_gameplay_only:
|
||||||
|
return ssprintf( IN_EDITOR_GAMEPLAY.GetValue(), s.c_str() );
|
||||||
|
default:
|
||||||
|
ASSERT(0);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static LocalizedString DEBUG_MENU( "ScreenDebugOverlay", "Debug Menu" );
|
static LocalizedString DEBUG_MENU( "ScreenDebugOverlay", "Debug Menu" );
|
||||||
@@ -170,10 +190,16 @@ void ScreenDebugOverlay::Init()
|
|||||||
int iNextDebugButton = 0;
|
int iNextDebugButton = 0;
|
||||||
FOREACH( IDebugLine*, *g_pvpSubscribers, p )
|
FOREACH( IDebugLine*, *g_pvpSubscribers, p )
|
||||||
{
|
{
|
||||||
if( (*p)->GameplayOnly() )
|
switch( (*p)->GetType() )
|
||||||
(*p)->m_Button = g_Mappings.gameplayButton[iNextGameplayButton++];
|
{
|
||||||
else
|
case IDebugLine::all_screens:
|
||||||
(*p)->m_Button = g_Mappings.debugButton[iNextDebugButton++];
|
(*p)->m_Button = g_Mappings.debugButton[iNextDebugButton++];
|
||||||
|
break;
|
||||||
|
case IDebugLine::gameplay_only:
|
||||||
|
case IDebugLine::editor_gameplay_only:
|
||||||
|
(*p)->m_Button = g_Mappings.gameplayButton[iNextGameplayButton++];
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Quad.StretchTo( RectF( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) );
|
m_Quad.StretchTo( RectF( 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT ) );
|
||||||
@@ -330,10 +356,22 @@ bool ScreenDebugOverlay::OverlayInput( const InputEventPlus &input )
|
|||||||
|
|
||||||
// Gameplay buttons are available only in gameplay. Non-gameplay buttons are
|
// Gameplay buttons are available only in gameplay. Non-gameplay buttons are
|
||||||
// only available when the screen is displayed.
|
// only available when the screen is displayed.
|
||||||
if( (*p)->GameplayOnly() && !IsGameplay() )
|
switch( (*p)->GetType() )
|
||||||
continue;
|
{
|
||||||
if( !(*p)->GameplayOnly() && !g_bIsDisplayed )
|
case IDebugLine::all_screens:
|
||||||
continue;
|
if( !g_bIsDisplayed )
|
||||||
|
continue;
|
||||||
|
break;
|
||||||
|
case IDebugLine::gameplay_only:
|
||||||
|
if( !IsGameplay() )
|
||||||
|
continue;
|
||||||
|
break;
|
||||||
|
case IDebugLine::editor_gameplay_only:
|
||||||
|
if( !IsEditorGameplay() )
|
||||||
|
continue;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
if( input.DeviceI == (*p)->m_Button )
|
if( input.DeviceI == (*p)->m_Button )
|
||||||
{
|
{
|
||||||
if( input.type != IET_FIRST_PRESS )
|
if( input.type != IET_FIRST_PRESS )
|
||||||
@@ -431,12 +469,17 @@ class DebugLineAutoplay : public IDebugLine
|
|||||||
default: ASSERT(0); return RString();
|
default: ASSERT(0); return RString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual bool GameplayOnly() const { return true; }
|
virtual Type GetType() const { return IDebugLine::gameplay_only; }
|
||||||
virtual bool IsEnabled() { return PREFSMAN->m_AutoPlay.Get() != PC_HUMAN; }
|
virtual bool IsEnabled() { return PREFSMAN->m_AutoPlay.Get() != PC_HUMAN; }
|
||||||
virtual void Do( RString &sMessageOut )
|
virtual void Do( RString &sMessageOut )
|
||||||
{
|
{
|
||||||
PlayerController pc = (PlayerController)(PREFSMAN->m_AutoPlay+1);
|
ASSERT( GAMESTATE->m_MasterPlayerNumber != PLAYER_INVALID );
|
||||||
wrap( (int&)pc, NUM_PlayerController );
|
PlayerController pc = GAMESTATE->m_pPlayerState[GAMESTATE->m_MasterPlayerNumber]->m_PlayerController;
|
||||||
|
bool bHoldingShift = INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT) );
|
||||||
|
if( bHoldingShift )
|
||||||
|
pc = (pc==PC_CPU) ? PC_HUMAN : PC_CPU;
|
||||||
|
else
|
||||||
|
pc = (pc==PC_AUTOPLAY) ? PC_HUMAN : PC_AUTOPLAY;
|
||||||
PREFSMAN->m_AutoPlay.Set( pc );
|
PREFSMAN->m_AutoPlay.Set( pc );
|
||||||
FOREACH_HumanPlayer(p)
|
FOREACH_HumanPlayer(p)
|
||||||
GAMESTATE->m_pPlayerState[p]->m_PlayerController = PREFSMAN->m_AutoPlay;
|
GAMESTATE->m_pPlayerState[p]->m_PlayerController = PREFSMAN->m_AutoPlay;
|
||||||
@@ -450,7 +493,7 @@ class DebugLineAssistTick : public IDebugLine
|
|||||||
{
|
{
|
||||||
virtual RString GetDescription() { return ASSIST_TICK.GetValue(); }
|
virtual RString GetDescription() { return ASSIST_TICK.GetValue(); }
|
||||||
virtual RString GetValue() { return IsEnabled() ? ON.GetValue():OFF.GetValue(); }
|
virtual RString GetValue() { return IsEnabled() ? ON.GetValue():OFF.GetValue(); }
|
||||||
virtual bool GameplayOnly() const { return true; }
|
virtual Type GetType() const { return gameplay_only; }
|
||||||
virtual bool IsEnabled() { return GAMESTATE->m_SongOptions.m_bAssistTick; }
|
virtual bool IsEnabled() { return GAMESTATE->m_SongOptions.m_bAssistTick; }
|
||||||
virtual void Do( RString &sMessageOut )
|
virtual void Do( RString &sMessageOut )
|
||||||
{
|
{
|
||||||
@@ -475,7 +518,7 @@ class DebugLineAutosync : public IDebugLine
|
|||||||
default: ASSERT(0);
|
default: ASSERT(0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
virtual bool GameplayOnly() const { return true; }
|
virtual Type GetType() const { return IDebugLine::gameplay_only; }
|
||||||
virtual bool IsEnabled() { return GAMESTATE->m_SongOptions.m_AutosyncType!=SongOptions::AUTOSYNC_OFF; }
|
virtual bool IsEnabled() { return GAMESTATE->m_SongOptions.m_AutosyncType!=SongOptions::AUTOSYNC_OFF; }
|
||||||
virtual void Do( RString &sMessageOut )
|
virtual void Do( RString &sMessageOut )
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user