move more of autoplay into debugOverlay

This commit is contained in:
Chris Danford
2005-05-18 07:15:56 +00:00
parent e504fb4e98
commit dd98a6bc7e
11 changed files with 68 additions and 48 deletions
+8
View File
@@ -84,6 +84,14 @@ XToString( RankingCategory, NUM_RANKING_CATEGORIES );
StringToX( RankingCategory ); StringToX( RankingCategory );
static const CString PlayerControllerNames[] = {
"Human",
"Autoplay",
"Cpu",
};
XToString( PlayerController, NUM_PLAYER_CONTROLLERS );
static const CString CoinModeNames[] = { static const CString CoinModeNames[] = {
"home", "home",
"pay", "pay",
+2 -1
View File
@@ -224,10 +224,11 @@ const int NUM_RANKING_LINES = 5;
enum PlayerController enum PlayerController
{ {
PC_HUMAN, PC_HUMAN,
PC_CPU,
PC_AUTOPLAY, PC_AUTOPLAY,
PC_CPU,
NUM_PLAYER_CONTROLLERS NUM_PLAYER_CONTROLLERS
}; };
const CString& PlayerControllerToString( PlayerController pc );
const int MIN_SKILL = 0; const int MIN_SKILL = 0;
const int MAX_SKILL = 10; const int MAX_SKILL = 10;
+1
View File
@@ -76,6 +76,7 @@ READFROM_AND_WRITETO( PrefsManager::CourseSortOrders, int& )
READFROM_AND_WRITETO( PrefsManager::GetRankingName, int& ) READFROM_AND_WRITETO( PrefsManager::GetRankingName, int& )
READFROM_AND_WRITETO( PrefsManager::ScoringTypes, int& ) READFROM_AND_WRITETO( PrefsManager::ScoringTypes, int& )
READFROM_AND_WRITETO( PrefsManager::BoostAppPriority, int& ) READFROM_AND_WRITETO( PrefsManager::BoostAppPriority, int& )
READFROM_AND_WRITETO( PlayerController, int& )
READFROM_AND_WRITETO( RageSoundReader_Resample::ResampleQuality, int& ) READFROM_AND_WRITETO( RageSoundReader_Resample::ResampleQuality, int& )
void IPreference::ReadFrom( const IniFile &ini ) void IPreference::ReadFrom( const IniFile &ini )
+1 -1
View File
@@ -175,7 +175,7 @@ PrefsManager::PrefsManager() :
m_fTimeMeterSecondsChangeOK ( Options, "TimeMeterSecondsChangeOK", -0.0f ), m_fTimeMeterSecondsChangeOK ( Options, "TimeMeterSecondsChangeOK", -0.0f ),
m_fTimeMeterSecondsChangeNG ( Options, "TimeMeterSecondsChangeNG", -4.0f ), m_fTimeMeterSecondsChangeNG ( Options, "TimeMeterSecondsChangeNG", -4.0f ),
m_bAutoPlay ( Options, "AutoPlay", false ), m_AutoPlay ( Options, "AutoPlay", PC_HUMAN ),
m_bDelayedBack ( Options, "DelayedBack", true ), m_bDelayedBack ( Options, "DelayedBack", true ),
m_bShowInstructions ( Options, "ShowInstructions", true ), m_bShowInstructions ( Options, "ShowInstructions", true ),
m_bShowSelectGroup ( Options, "ShowSelectGroup", true ), m_bShowSelectGroup ( Options, "ShowSelectGroup", true ),
+1 -1
View File
@@ -150,7 +150,7 @@ public:
Preference<float> m_fTimeMeterSecondsChangeOK; Preference<float> m_fTimeMeterSecondsChangeOK;
Preference<float> m_fTimeMeterSecondsChangeNG; Preference<float> m_fTimeMeterSecondsChangeNG;
Preference<bool> m_bAutoPlay; Preference<PlayerController> m_AutoPlay;
Preference<bool> m_bDelayedBack; Preference<bool> m_bDelayedBack;
Preference<bool> m_bShowInstructions; Preference<bool> m_bShowInstructions;
Preference<bool> m_bShowSelectGroup; Preference<bool> m_bShowSelectGroup;
+23 -4
View File
@@ -122,6 +122,11 @@ void ScreenDebugOverlay::Update( float fDeltaTime )
if( !g_bIsDisplayed ) if( !g_bIsDisplayed )
return; return;
UpdateText();
}
void ScreenDebugOverlay::UpdateText()
{
/* Highlight options that aren't the default. */ /* Highlight options that aren't the default. */
const RageColor off(0.6f, 0.6f, 0.6f, 1.0f); const RageColor off(0.6f, 0.6f, 0.6f, 1.0f);
const RageColor on(1, 1, 1, 1); const RageColor on(1, 1, 1, 1);
@@ -157,7 +162,7 @@ void ScreenDebugOverlay::Update( float fDeltaTime )
bool bOn = false; bool bOn = false;
switch( i ) switch( i )
{ {
case DebugLine_Autoplay: bOn=PREFSMAN->m_bAutoPlay.Get(); break; case DebugLine_Autoplay: bOn=PREFSMAN->m_AutoPlay.Get() != PC_HUMAN; 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;
@@ -178,7 +183,15 @@ void ScreenDebugOverlay::Update( float fDeltaTime )
CString s2; CString s2;
switch( i ) switch( i )
{ {
case DebugLine_Autoplay: s2=bOn ? "on":"off"; break; 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_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;
@@ -249,9 +262,13 @@ bool ScreenDebugOverlay::OverlayInput( const DeviceInput& DeviceI, const InputEv
switch( i ) switch( i )
{ {
case DebugLine_Autoplay: case DebugLine_Autoplay:
PREFSMAN->m_bAutoPlay.Set( !PREFSMAN->m_bAutoPlay ); {
PlayerController pc = (PlayerController)(PREFSMAN->m_AutoPlay+1);
wrap( (int&)pc, NUM_PLAYER_CONTROLLERS );
PREFSMAN->m_AutoPlay.Set( pc );
FOREACH_HumanPlayer(pn) FOREACH_HumanPlayer(pn)
GAMESTATE->m_pPlayerState[pn]->m_PlayerController = PREFSMAN->m_bAutoPlay ? PC_AUTOPLAY : PC_HUMAN; GAMESTATE->m_pPlayerState[pn]->m_PlayerController = PREFSMAN->m_AutoPlay;
}
break; break;
case DebugLine_CoinMode: case DebugLine_CoinMode:
{ {
@@ -314,6 +331,8 @@ bool ScreenDebugOverlay::OverlayInput( const DeviceInput& DeviceI, const InputEv
default: ASSERT(0); default: ASSERT(0);
} }
UpdateText();
SCREENMAN->SystemMessage( txt.GetText() ); SCREENMAN->SystemMessage( txt.GetText() );
} }
} }
+2
View File
@@ -40,6 +40,8 @@ public:
void Update( float fDeltaTime ); void Update( float fDeltaTime );
private: private:
void UpdateText();
Quad m_Quad; Quad m_Quad;
BitmapText m_Header; BitmapText m_Header;
BitmapText m_Text[NUM_DEBUG_LINES]; BitmapText m_Text[NUM_DEBUG_LINES];
+4 -4
View File
@@ -1439,9 +1439,9 @@ void ScreenEdit::InputPlay( const DeviceInput& DeviceI, const InputEventType typ
break; break;
case EDIT_BUTTON_TOGGLE_AUTOPLAY: case EDIT_BUTTON_TOGGLE_AUTOPLAY:
{ {
PREFSMAN->m_bAutoPlay.Set( !PREFSMAN->m_bAutoPlay ); PREFSMAN->m_AutoPlay.Set( PREFSMAN->m_AutoPlay!=PC_HUMAN ? PC_HUMAN:PC_AUTOPLAY );
FOREACH_HumanPlayer( p ) FOREACH_HumanPlayer( p )
GAMESTATE->m_pPlayerState[p]->m_PlayerController = PREFSMAN->m_bAutoPlay?PC_AUTOPLAY:PC_HUMAN; GAMESTATE->m_pPlayerState[p]->m_PlayerController = PREFSMAN->m_AutoPlay;
} }
break; break;
case EDIT_BUTTON_OFFSET_UP: case EDIT_BUTTON_OFFSET_UP:
@@ -1471,7 +1471,7 @@ void ScreenEdit::InputPlay( const DeviceInput& DeviceI, const InputEventType typ
switch( StyleI.player ) switch( StyleI.player )
{ {
case PLAYER_1: case PLAYER_1:
if( !PREFSMAN->m_bAutoPlay ) if( PREFSMAN->m_AutoPlay == PC_HUMAN )
m_Player.Step( StyleI.col, DeviceI.ts ); m_Player.Step( StyleI.col, DeviceI.ts );
break; break;
} }
@@ -2402,7 +2402,7 @@ void ScreenEdit::HandleAreaMenuChoice( AreaMenuChoice c, const vector<int> &iAns
SetupCourseAttacks(); SetupCourseAttacks();
m_Player.Load( m_NoteDataEdit ); m_Player.Load( m_NoteDataEdit );
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PREFSMAN->m_bAutoPlay?PC_AUTOPLAY:PC_HUMAN; GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PREFSMAN->m_AutoPlay;
const float fStartSeconds = m_pSong->GetElapsedTimeFromBeat(GAMESTATE->m_fSongBeat) ; const float fStartSeconds = m_pSong->GetElapsedTimeFromBeat(GAMESTATE->m_fSongBeat) ;
LOG->Trace( "Starting playback at %f", fStartSeconds ); LOG->Trace( "Starting playback at %f", fStartSeconds );
+21 -33
View File
@@ -102,6 +102,8 @@ 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()
@@ -963,13 +965,9 @@ void ScreenGameplay::LoadNextSong()
iNewSkill = clamp( iNewSkill, 0, NUM_SKILL_LEVELS-1 ); iNewSkill = clamp( iNewSkill, 0, NUM_SKILL_LEVELS-1 );
GAMESTATE->m_pPlayerState[p]->m_iCpuSkill = iNewSkill; GAMESTATE->m_pPlayerState[p]->m_iCpuSkill = iNewSkill;
} }
else if( PREFSMAN->m_bAutoPlay )
{
GAMESTATE->m_pPlayerState[p]->m_PlayerController = PC_AUTOPLAY;
}
else else
{ {
GAMESTATE->m_pPlayerState[p]->m_PlayerController = PC_HUMAN; GAMESTATE->m_pPlayerState[p]->m_PlayerController = PREFSMAN->m_AutoPlay;
} }
} }
@@ -1943,9 +1941,6 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
{ {
switch( DeviceI.button ) switch( DeviceI.button )
{ {
case KEY_F5:
this->HandleScreenMessage( SM_NotesEnded );
break;
case KEY_F6: case KEY_F6:
{ {
bool bHoldingShift = bool bHoldingShift =
@@ -1975,22 +1970,6 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
m_textDebug.BeginTweening( 0.5f ); // fade out m_textDebug.BeginTweening( 0.5f ); // fade out
m_textDebug.SetDiffuse( RageColor(1,1,1,0) ); m_textDebug.SetDiffuse( RageColor(1,1,1,0) );
break; break;
case KEY_F8:
{
PREFSMAN->m_bAutoPlay.Set( !PREFSMAN->m_bAutoPlay );
UpdateAutoPlayText();
bool bIsHoldingShift =
INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_RSHIFT)) ||
INPUTFILTER->IsBeingPressed( DeviceInput(DEVICE_KEYBOARD, KEY_LSHIFT));
FOREACH_HumanPlayer(p)
{
if( bIsHoldingShift )
GAMESTATE->m_pPlayerState[p]->m_PlayerController = PREFSMAN->m_bAutoPlay ? PC_CPU : PC_HUMAN;
else
GAMESTATE->m_pPlayerState[p]->m_PlayerController = PREFSMAN->m_bAutoPlay ? PC_AUTOPLAY : PC_HUMAN;
}
}
break;
case KEY_F9: case KEY_F9:
case KEY_F10: case KEY_F10:
{ {
@@ -2063,7 +2042,7 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
{ {
AbortGiveUp( true ); AbortGiveUp( true );
if( !PREFSMAN->m_bAutoPlay ) 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 && // else if( type==IET_FIRST_PRESS &&
@@ -2088,21 +2067,24 @@ void ScreenGameplay::Input( const DeviceInput& DeviceI, const InputEventType typ
void ScreenGameplay::UpdateAutoPlayText() void ScreenGameplay::UpdateAutoPlayText()
{ {
CString sText; vector<CString> vsText;
if( PREFSMAN->m_bAutoPlay ) switch( PREFSMAN->m_AutoPlay )
sText += "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 ) switch( GAMESTATE->m_SongOptions.m_AutosyncType )
{ {
case SongOptions::AUTOSYNC_OFF: break; case SongOptions::AUTOSYNC_OFF: break;
case SongOptions::AUTOSYNC_SONG: sText += "AutosyncSong "; break; case SongOptions::AUTOSYNC_SONG: vsText.push_back("AutosyncSong"); break;
case SongOptions::AUTOSYNC_MACHINE: sText += "AutosyncMachine "; break; case SongOptions::AUTOSYNC_MACHINE: vsText.push_back("AutosyncMachine"); break;
default: ASSERT(0); default: ASSERT(0);
} }
if( sText.length() > 0 ) CString sText = join( " ", vsText );
sText.resize( sText.length()-5 );
m_textAutoPlay.SetText( sText ); m_textAutoPlay.SetText( sText );
} }
@@ -2644,6 +2626,12 @@ 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
* All rights reserved. * All rights reserved.
+1
View File
@@ -40,6 +40,7 @@ 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; }
+2 -2
View File
@@ -298,7 +298,7 @@ static void NumBackgrounds( int &sel, bool ToSel, const ConfOption *pConfOption
/* Input options */ /* Input options */
MOVE( AutoMapOnJoyChange, PREFSMAN->m_bAutoMapOnJoyChange ); MOVE( AutoMapOnJoyChange, PREFSMAN->m_bAutoMapOnJoyChange );
MOVE( AutoPlay, PREFSMAN->m_bAutoPlay ); MOVE( AutoPlay, (int&)PREFSMAN->m_AutoPlay );
MOVE( BackDelayed, PREFSMAN->m_bDelayedBack ); MOVE( BackDelayed, PREFSMAN->m_bDelayedBack );
MOVE( OptionsNavigation, PREFSMAN->m_bArcadeOptionsNavigation ); MOVE( OptionsNavigation, PREFSMAN->m_bArcadeOptionsNavigation );
@@ -558,7 +558,7 @@ static void InitializeConfOptions()
/* Input options */ /* Input options */
ADD( ConfOption( "AutoMapOnJoyChange", AutoMapOnJoyChange, "OFF","ON (recommended)" ) ); ADD( ConfOption( "AutoMapOnJoyChange", AutoMapOnJoyChange, "OFF","ON (recommended)" ) );
ADD( ConfOption( "OnlyDedicatedMenuButtons", MovePref, "USE GAMEPLAY BUTTONS","ONLY DEDICATED BUTTONS" ) ); ADD( ConfOption( "OnlyDedicatedMenuButtons", MovePref, "USE GAMEPLAY BUTTONS","ONLY DEDICATED BUTTONS" ) );
ADD( ConfOption( "AutoPlay", AutoPlay, "OFF","ON" ) ); ADD( ConfOption( "AutoPlay", AutoPlay, "OFF","ON","CPU-Controlled" ) );
ADD( ConfOption( "BackDelayed", BackDelayed, "INSTANT","HOLD" ) ); ADD( ConfOption( "BackDelayed", BackDelayed, "INSTANT","HOLD" ) );
ADD( ConfOption( "OptionsNavigation", OptionsNavigation, "SM STYLE","ARCADE STYLE" ) ); ADD( ConfOption( "OptionsNavigation", OptionsNavigation, "SM STYLE","ARCADE STYLE" ) );
ADD( ConfOption( "WheelSpeed", WheelSpeed, "SLOW","NORMAL","FAST","REALLY FAST" ) ); ADD( ConfOption( "WheelSpeed", WheelSpeed, "SLOW","NORMAL","FAST","REALLY FAST" ) );