diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index e81e492cbb..d9d7a21451 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -117,8 +117,8 @@ void PlayerMinus::Load( PlayerNumber pn, const NoteData* pNoteData, LifeMeter* p m_pPrimaryScoreKeeper = pPrimaryScoreKeeper; m_pSecondaryScoreKeeper = pSecondaryScoreKeeper; m_pNoteField = pNoteField; - m_iRowLastCrossed = BeatToNoteRowNotRounded( GAMESTATE->m_fSongBeat ) - 1; - // m_iRowLastCrossed = -1; + m_iRowLastCrossed = BeatToNoteRowNotRounded( GAMESTATE->m_fSongBeat ) - 1; // why this? + m_iMineRowLastCrossed = BeatToNoteRowNotRounded( GAMESTATE->m_fSongBeat ) - 1; // why this? /* Ensure that this is up-to-date. */ GAMESTATE->m_pPosition->Load(pn); @@ -383,16 +383,32 @@ void PlayerMinus::Update( float fDeltaTime ) SetHoldNoteScore(hn, hns); } - // Why was this originally "BeatToNoteRowNotRounded"? It should be rounded. -Chris - /* We want to send the crossed row message exactly when we cross the row--not - * .5 before the row. Use a very slow song (around 2 BPM) as a test case: without - * rounding, autoplay steps early. -glenn */ - const int iRowNow = BeatToNoteRowNotRounded( GAMESTATE->m_fSongBeat ); - if( iRowNow >= 0 ) { - for( ; m_iRowLastCrossed <= iRowNow; m_iRowLastCrossed++ ) // for each index we crossed since the last update - if( GAMESTATE->IsPlayerEnabled(m_PlayerNumber) ) - CrossedRow( m_iRowLastCrossed ); + // Why was this originally "BeatToNoteRowNotRounded"? It should be rounded. -Chris + /* We want to send the crossed row message exactly when we cross the row--not + * .5 before the row. Use a very slow song (around 2 BPM) as a test case: without + * rounding, autoplay steps early. -glenn */ + const int iRowNow = BeatToNoteRowNotRounded( GAMESTATE->m_fSongBeat ); + if( iRowNow >= 0 ) + { + for( ; m_iRowLastCrossed <= iRowNow; m_iRowLastCrossed++ ) // for each index we crossed since the last update + if( GAMESTATE->IsPlayerEnabled(m_PlayerNumber) ) + CrossedRow( m_iRowLastCrossed ); + } + } + + { + // TRICKY: + float fPositionSeconds = GAMESTATE->m_fMusicSeconds; + fPositionSeconds -= PREFSMAN->m_fPadStickSeconds; + const float fSongBeat = GAMESTATE->m_pCurSong ? GAMESTATE->m_pCurSong->GetBeatFromElapsedTime( fPositionSeconds ) : 0; + const int iRowNow = BeatToNoteRowNotRounded( fSongBeat ); + if( iRowNow >= 0 ) + { + for( ; m_iMineRowLastCrossed <= iRowNow; m_iMineRowLastCrossed++ ) // for each index we crossed since the last update + if( GAMESTATE->IsPlayerEnabled(m_PlayerNumber) ) + CrossedMineRow( m_iMineRowLastCrossed ); + } } @@ -574,10 +590,14 @@ void PlayerMinus::Step( int col, RageTimer tm ) ASSERT( col >= 0 && col <= GetNumTracks() ); + float fPositionSeconds = GAMESTATE->m_fMusicSeconds; + fPositionSeconds -= tm.Ago(); + const float fSongBeat = GAMESTATE->m_pCurSong ? GAMESTATE->m_pCurSong->GetBeatFromElapsedTime( fPositionSeconds ) : GAMESTATE->m_fSongBeat; + // // Check for step on a TapNote // - int iIndexOverlappingNote = GetClosestNote( col, GAMESTATE->m_fSongBeat, + int iIndexOverlappingNote = GetClosestNote( col, fSongBeat, StepSearchDistanceForwards * GAMESTATE->m_fCurBPS * GAMESTATE->m_SongOptions.m_fMusicRate, StepSearchDistanceBackwards * GAMESTATE->m_fCurBPS * GAMESTATE->m_SongOptions.m_fMusicRate ); @@ -1036,18 +1056,22 @@ void PlayerMinus::CrossedRow( int iNoteRow ) if( GetTapNoteScore(t, iNoteRow) == TNS_NONE ) Step( t, now ); } +} +void PlayerMinus::CrossedMineRow( int iNoteRow ) +{ // Hold the panel while crossing a mine will cause the mine to explode + RageTimer now; for( int t=0; tGetCurrentStyleDef()->StyleInputToGameInput( StyleI ); - bool bIsHoldingButton = INPUTMAPPER->IsButtonDown( GameI ); + float fSecsHeld = INPUTMAPPER->GetSecsHeld( GameI ); - if( bIsHoldingButton ) - Step( t, now ); + if( fSecsHeld >= PREFSMAN->m_fPadStickSeconds ) + Step( t, now+(-PREFSMAN->m_fPadStickSeconds) ); } } } diff --git a/stepmania/src/Player.h b/stepmania/src/Player.h index 490119266f..4eedab2e78 100644 --- a/stepmania/src/Player.h +++ b/stepmania/src/Player.h @@ -50,6 +50,7 @@ public: void Load( PlayerNumber player_no, const NoteData* pNoteData, LifeMeter* pLM, CombinedLifeMeter* pCombinedLM, ScoreDisplay* pScoreDisplay, ScoreDisplay* pSecondaryScoreDisplay, Inventory* pInventory, ScoreKeeper* pPrimaryScoreKeeper, ScoreKeeper* pSecondaryScoreKeeper, NoteField* pNoteField ); void CrossedRow( int iNoteRow ); + void CrossedMineRow( int iNoteRow ); void Step( int col, RageTimer tm ); void RandomiseNotes( int iNoteRow ); void FadeToFail(); @@ -99,6 +100,7 @@ protected: Inventory* m_pInventory; int m_iRowLastCrossed; + int m_iMineRowLastCrossed; RageSound m_soundMine; RageSound m_soundAttackLaunch; diff --git a/stepmania/src/PrefsManager.cpp b/stepmania/src/PrefsManager.cpp index 4568d9e433..b885a1285b 100644 --- a/stepmania/src/PrefsManager.cpp +++ b/stepmania/src/PrefsManager.cpp @@ -62,14 +62,14 @@ PrefsManager::PrefsManager() m_bAutoPlay = false; m_fJudgeWindowScale = 1.0f; m_fLifeDifficultyScale = 1.0f; - m_fJudgeWindowSecondsMarvelous = 0.0225f; - m_fJudgeWindowSecondsPerfect = 0.045f; - m_fJudgeWindowSecondsGreat = 0.090f; - m_fJudgeWindowSecondsGood = 0.135f; - m_fJudgeWindowSecondsBoo = 0.180f; - m_fJudgeWindowSecondsOK = 0.250f; // allow enough time to take foot off and put back on - m_fJudgeWindowSecondsMine = 0.090f; // same as great - m_fJudgeWindowSecondsAttack = 0.135f; + m_fJudgeWindowSecondsMarvelous = 0.0225f; + m_fJudgeWindowSecondsPerfect = 0.045f; + m_fJudgeWindowSecondsGreat = 0.090f; + m_fJudgeWindowSecondsGood = 0.135f; + m_fJudgeWindowSecondsBoo = 0.180f; + m_fJudgeWindowSecondsOK = 0.250f; // allow enough time to take foot off and put back on + m_fJudgeWindowSecondsMine = 0.090f; // same as great + m_fJudgeWindowSecondsAttack = 0.135f; m_fLifeDeltaPercentChangeMarvelous = +0.008f; m_fLifeDeltaPercentChangePerfect = +0.008f; m_fLifeDeltaPercentChangeGreat = +0.004f; @@ -213,6 +213,7 @@ PrefsManager::PrefsManager() m_iAttractSoundFrequency = 1; m_bAllowExtraStage = true; + m_fPadStickSeconds = 0; g_bAutoRestart = false; m_bSignProfileData = false; @@ -490,6 +491,7 @@ void PrefsManager::ReadGlobalPrefsFromDisk() ini.GetValue( "Options", "CenterImageScaleY", m_fCenterImageScaleY ); ini.GetValue( "Options", "AttractSoundFrequency", m_iAttractSoundFrequency ); ini.GetValue( "Options", "AllowExtraStage", m_bAllowExtraStage ); + ini.GetValue( "Options", "PadStickSeconds", m_fPadStickSeconds ); ini.GetValue( "Options", "AutoRestart", g_bAutoRestart ); ini.GetValue( "Options", "SignProfileData", m_bSignProfileData ); @@ -701,6 +703,7 @@ void PrefsManager::SaveGlobalPrefsToDisk() const ini.SetValue( "Options", "CenterImageScaleY", m_fCenterImageScaleY ); ini.SetValue( "Options", "AttractSoundFrequency", m_iAttractSoundFrequency ); ini.SetValue( "Options", "AllowExtraStage", m_bAllowExtraStage ); + ini.SetValue( "Options", "PadStickSeconds", m_fPadStickSeconds ); ini.SetValue( "Options", "AutoRestart", g_bAutoRestart ); ini.SetValue( "Options", "SignProfileData", m_bSignProfileData ); diff --git a/stepmania/src/PrefsManager.h b/stepmania/src/PrefsManager.h index cc0bd4127c..f9450b5bb7 100644 --- a/stepmania/src/PrefsManager.h +++ b/stepmania/src/PrefsManager.h @@ -188,7 +188,11 @@ public: float m_fCenterImageScaleY; int m_iAttractSoundFrequency; // 0 = never, 1 = every time bool m_bAllowExtraStage; - + + // Number of seconds it takes for a button on the controller to release + // after pressed. + float m_fPadStickSeconds; + // If true, then signatures created when writing profile data // and verified when reading profile data. Leave this false if // you want to use a profile on different machines that don't