Player-side Autoplay modifier (allows one player to play normally, while the other is in autoplay mode)

This commit is contained in:
Mike Hawkins
2008-07-08 00:56:24 +00:00
parent d1f939f486
commit 3fc4f1ea94
8 changed files with 44 additions and 14 deletions
+8 -2
View File
@@ -29,6 +29,7 @@ void PlayerOptions::Init()
m_fCover = 0; m_SpeedfCover = 1.0f;
m_fRandAttack = 0; m_SpeedfRandAttack = 1.0f;
m_fSongAttack = 0; m_SpeedfSongAttack = 1.0f;
m_fPlayerAutoPlay = 0; m_SpeedfPlayerAutoPlay = 1.0f;
m_bSetTiltOrSkew = false;
m_fPerspectiveTilt = 0; m_SpeedfPerspectiveTilt = 1.0f;
m_fSkew = 0; m_SpeedfSkew = 1.0f;
@@ -65,6 +66,7 @@ void PlayerOptions::Approach( const PlayerOptions& other, float fDeltaSeconds )
APPROACH( fCover );
APPROACH( fRandAttack );
APPROACH( fSongAttack );
APPROACH( fPlayerAutoPlay );
APPROACH( fPerspectiveTilt );
APPROACH( fSkew );
APPROACH( fPassmark );
@@ -167,8 +169,9 @@ void PlayerOptions::GetMods( vector<RString> &AddTo, bool bForceNoteSkin ) const
AddPart( AddTo, m_fBlind, "Blind" );
AddPart( AddTo, m_fCover, "Cover" );
AddPart( AddTo, m_fRandAttack, "RandomAttacks" );
AddPart( AddTo, m_fSongAttack, "SongAttacks" );
AddPart( AddTo, m_fRandAttack, "RandomAttacks" );
AddPart( AddTo, m_fSongAttack, "SongAttacks" );
AddPart( AddTo, m_fPlayerAutoPlay, "PlayerAutoPlay" );
AddPart( AddTo, m_fPassmark, "Passmark" );
@@ -384,6 +387,7 @@ bool PlayerOptions::FromOneModString( const RString &sOneMod, RString &sErrorOut
else if( sBit == "cover" ) SET_FLOAT( fCover )
else if( sBit == "randomattacks" ) SET_FLOAT( fRandAttack )
else if( sBit == "songattacks" ) SET_FLOAT( fSongAttack )
else if( sBit == "playerautoplay" ) SET_FLOAT( fPlayerAutoPlay )
else if( sBit == "passmark" ) SET_FLOAT( fPassmark )
else if( sBit == "overhead" ) { m_bSetTiltOrSkew = true; m_fSkew = 0; m_fPerspectiveTilt = 0; m_SpeedfSkew = m_SpeedfPerspectiveTilt = speed; }
else if( sBit == "incoming" ) { m_bSetTiltOrSkew = true; m_fSkew = level; m_fPerspectiveTilt = -level; m_SpeedfSkew = m_SpeedfPerspectiveTilt = speed; }
@@ -624,6 +628,7 @@ bool PlayerOptions::operator==( const PlayerOptions &other ) const
COMPARE(m_fCover);
COMPARE(m_fRandAttack);
COMPARE(m_fSongAttack);
COMPARE(m_fPlayerAutoPlay);
COMPARE(m_fPerspectiveTilt);
COMPARE(m_fSkew);
COMPARE(m_sNoteSkin);
@@ -674,6 +679,7 @@ bool PlayerOptions::IsEasierForSongAndSteps( Song* pSong, Steps* pSteps, PlayerN
if( m_bTransforms[TRANSFORM_ECHO] ) return true;
if( m_fCover ) return true;
if( m_fPlayerAutoPlay ) return true;
return false;
}
+1
View File
@@ -135,6 +135,7 @@ public:
float m_fCover, m_SpeedfCover; // hide the background per-player--can't think of a good name
float m_fRandAttack, m_SpeedfRandAttack;
float m_fSongAttack, m_SpeedfSongAttack;
float m_fPlayerAutoPlay, m_SpeedfPlayerAutoPlay;
bool m_bSetTiltOrSkew; // true if the tilt or skew was set by FromString
float m_fPerspectiveTilt, m_SpeedfPerspectiveTilt; // -1 = near, 0 = overhead, +1 = space
float m_fSkew, m_SpeedfSkew; // 0 = vanish point is in center of player, 1 = vanish point is in center of screen
+2 -1
View File
@@ -654,7 +654,8 @@ void ScoreKeeperNormal::HandleTapRowScore( const NoteData &nd, int iRow )
// handle combo logic
//
#ifndef DEBUG
if( GamePreferences::m_AutoPlay != PC_HUMAN && !GAMESTATE->m_bDemonstrationOrJukebox ) // cheaters never prosper
if( (GamePreferences::m_AutoPlay != PC_HUMAN || m_pPlayerState->m_PlayerOptions.GetCurrent().m_fPlayerAutoPlay != 0)
&& !GAMESTATE->m_bDemonstrationOrJukebox ) // cheaters never prosper
{
m_iCurToastyCombo = 0;
return;
+6 -2
View File
@@ -2084,7 +2084,7 @@ void ScreenEdit::InputPlay( const InputEventPlus &input, EditButton EditB )
GameButtonType gbt = GAMESTATE->m_pCurGame->GetPerButtonInfo(input.GameI.button)->m_gbt;
if( GamePreferences::m_AutoPlay == PC_HUMAN )
if( GamePreferences::m_AutoPlay == PC_HUMAN && GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetCurrent().m_fPlayerAutoPlay == 0 )
{
const int iCol = GAMESTATE->GetCurrentStyle()->GameInputToColumn( input.GameI );
bool bRelease = input.type == IET_RELEASE;
@@ -2291,7 +2291,11 @@ m_pSoundMusic->StopPlaying();
SetupCourseAttacks();
m_Player.Load( m_NoteDataEdit );
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = GamePreferences::m_AutoPlay;
if( GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetCurrent().m_fPlayerAutoPlay != 0 )
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PC_AUTOPLAY;
else
GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = GamePreferences::m_AutoPlay;
if( g_bEditorShowBGChangesPlay )
{
+5 -2
View File
@@ -1113,7 +1113,10 @@ void ScreenGameplay::LoadNextSong()
}
else
{
pi->GetPlayerState()->m_PlayerController = GamePreferences::m_AutoPlay;
if( pi->GetPlayerState()->m_PlayerOptions.GetCurrent().m_fPlayerAutoPlay != 0 )
pi->GetPlayerState()->m_PlayerController = PC_AUTOPLAY;
else
pi->GetPlayerState()->m_PlayerController = GamePreferences::m_AutoPlay;
}
}
}
@@ -2238,7 +2241,7 @@ void ScreenGameplay::Input( const InputEventPlus &input )
{
AbortGiveUp( true );
if( GamePreferences::m_AutoPlay == PC_HUMAN )
if( GamePreferences::m_AutoPlay == PC_HUMAN && GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.GetCurrent().m_fPlayerAutoPlay == 0 )
{
PlayerInfo& pi = GetPlayerInfoForInput( input );
+9 -1
View File
@@ -167,7 +167,15 @@ void ScreenGameplayLesson::ChangeLessonPage( int iDir )
// Change back to the current autoplay setting (in most cases, human controlled).
FOREACH_EnabledPlayerInfo( m_vPlayerInfo, pi )
pi->GetPlayerState()->m_PlayerController = GamePreferences::m_AutoPlay;
{
/* Mike: I'm not sure if you can actually have the player options enabled in this mode,
* but I'm putting the check here anyways to play it safe. If it's unnecessary, then it
* should be removed. */
if( pi->GetPlayerState()->m_PlayerOptions.GetCurrent().m_fPlayerAutoPlay != 0 )
pi->GetPlayerState()->m_PlayerController = PC_AUTOPLAY;
else
pi->GetPlayerState()->m_PlayerController = GamePreferences::m_AutoPlay;
}
}
else
{