From 45db2de31d995e71d97ca51d4cd0d770de1f00f3 Mon Sep 17 00:00:00 2001 From: Steve Checkoway Date: Mon, 14 Aug 2006 09:09:24 +0000 Subject: [PATCH] Pass release to Step(). Doesn't do anything yet. --- stepmania/src/Player.cpp | 13 +++++--- stepmania/src/Player.h | 2 +- stepmania/src/ScreenEdit.cpp | 56 +++++++++++++++++--------------- stepmania/src/ScreenGameplay.cpp | 11 +++---- 4 files changed, 43 insertions(+), 39 deletions(-) diff --git a/stepmania/src/Player.cpp b/stepmania/src/Player.cpp index d8aac25937..4308d0653c 100644 --- a/stepmania/src/Player.cpp +++ b/stepmania/src/Player.cpp @@ -572,7 +572,7 @@ void Player::Update( float fDeltaTime ) if( tn.HoldResult.fLife >= 0.5f ) continue; - Step( iTrack, iSongRow, now, false ); + Step( iTrack, iSongRow, now, false, false ); if( m_pPlayerState->m_PlayerController == PC_AUTOPLAY ) STATSMAN->m_CurStageStats.bUsedAutoplay = true; } @@ -923,8 +923,11 @@ int Player::GetClosestNote( int col, int iNoteRow, int iMaxRowsAhead, int iMaxRo return iNextIndex; } -void Player::Step( int col, int row, const RageTimer &tm, bool bHeld ) +void Player::Step( int col, int row, const RageTimer &tm, bool bHeld, bool bRelease ) { + // XXX: Ignore for now. + if( bRelease ) + return; // If we're playing on oni and we've died, do nothing. if( GAMESTATE->m_SongOptions.GetCurrent().m_LifeType == SongOptions::LIFE_BATTERY && m_pPlayerStageStats && m_pPlayerStageStats->bFailed ) return; @@ -1464,7 +1467,7 @@ void Player::CrossedRow( int iNoteRow, const RageTimer &now ) const TapNote &tn = m_NoteData.GetTapNote( t, iNoteRow ); if( tn.type != TapNote::empty && tn.result.tns == TNS_None ) { - Step( t, iNoteRow, now ); + Step( t, iNoteRow, now, false, false ); if( m_pPlayerState->m_PlayerController == PC_AUTOPLAY ) STATSMAN->m_CurStageStats.bUsedAutoplay = true; } @@ -1487,13 +1490,13 @@ void Player::CrossedMineRow( int iNoteRow, const RageTimer &now ) { float fSecsHeld = INPUTMAPPER->GetSecsHeld( StyleI, m_pPlayerState->m_mp ); if( fSecsHeld >= PREFSMAN->m_fPadStickSeconds ) - Step( t, -1, now+(-PREFSMAN->m_fPadStickSeconds), true ); + Step( t, -1, now+(-PREFSMAN->m_fPadStickSeconds), true, false ); } else { bool bIsDown = INPUTMAPPER->IsButtonDown( StyleI, m_pPlayerState->m_mp ); if( bIsDown ) - Step( t, iNoteRow, now, true ); + Step( t, iNoteRow, now, true, false ); } } } diff --git a/stepmania/src/Player.h b/stepmania/src/Player.h index 07b9a18128..078ac44f56 100644 --- a/stepmania/src/Player.h +++ b/stepmania/src/Player.h @@ -113,7 +113,7 @@ public: void Load(); void CrossedRow( int iNoteRow, const RageTimer &now ); void CrossedMineRow( int iNoteRow, const RageTimer &now ); - void Step( int col, int row, const RageTimer &tm, bool bHeld = false ); + void Step( int col, int row, const RageTimer &tm, bool bHeld, bool bRelease ); void RandomizeNotes( int iNoteRow ); void FadeToFail(); void CacheAllUsedNoteSkins(); diff --git a/stepmania/src/ScreenEdit.cpp b/stepmania/src/ScreenEdit.cpp index 12f2ef9922..0d64c5ed59 100644 --- a/stepmania/src/ScreenEdit.cpp +++ b/stepmania/src/ScreenEdit.cpp @@ -2014,37 +2014,36 @@ void ScreenEdit::InputRecordPaused( const InputEventPlus &input, EditButton Edit void ScreenEdit::InputPlay( const InputEventPlus &input, EditButton EditB ) { - if( input.type != IET_FIRST_PRESS ) - return; - - switch( EditB ) + if( input.type == IET_FIRST_PRESS ) { - case EDIT_BUTTON_RETURN_TO_EDIT: - /* When exiting play mode manually, leave the cursor where it is. */ - m_fBeatToReturnTo = GAMESTATE->m_fSongBeat; - TransitionEditState( STATE_EDITING ); - break; - case EDIT_BUTTON_TOGGLE_ASSIST_TICK: - SO_GROUP_ASSIGN( GAMESTATE->m_SongOptions, ModsLevel_Stage, m_bAssistTick, !GAMESTATE->m_SongOptions.GetStage().m_bAssistTick ); - break; - case EDIT_BUTTON_TOGGLE_AUTOPLAY: + switch( EditB ) + { + case EDIT_BUTTON_RETURN_TO_EDIT: + /* When exiting play mode manually, leave the cursor where it is. */ + m_fBeatToReturnTo = GAMESTATE->m_fSongBeat; + TransitionEditState( STATE_EDITING ); + break; + case EDIT_BUTTON_TOGGLE_ASSIST_TICK: + SO_GROUP_ASSIGN( GAMESTATE->m_SongOptions, ModsLevel_Stage, m_bAssistTick, !GAMESTATE->m_SongOptions.GetStage().m_bAssistTick ); + break; + case EDIT_BUTTON_TOGGLE_AUTOPLAY: { PREFSMAN->m_AutoPlay.Set( PREFSMAN->m_AutoPlay!=PC_HUMAN ? PC_HUMAN:PC_AUTOPLAY ); FOREACH_HumanPlayer( p ) GAMESTATE->m_pPlayerState[p]->m_PlayerController = PREFSMAN->m_AutoPlay; } - break; - case EDIT_BUTTON_OFFSET_UP: - case EDIT_BUTTON_OFFSET_DOWN: + break; + case EDIT_BUTTON_OFFSET_UP: + case EDIT_BUTTON_OFFSET_DOWN: { float fOffsetDelta; switch( EditB ) { - DEFAULT_FAIL( EditB ); - case EDIT_BUTTON_OFFSET_DOWN: fOffsetDelta = -0.020f; break; - case EDIT_BUTTON_OFFSET_UP: fOffsetDelta = +0.020f; break; + DEFAULT_FAIL( EditB ); + case EDIT_BUTTON_OFFSET_DOWN: fOffsetDelta = -0.020f; break; + case EDIT_BUTTON_OFFSET_UP: fOffsetDelta = +0.020f; break; } - + if( EditIsBeingPressed( EDIT_BUTTON_ADJUST_FINE ) ) { fOffsetDelta /= 20; /* 1ms */ @@ -2053,21 +2052,26 @@ void ScreenEdit::InputPlay( const InputEventPlus &input, EditButton EditB ) { switch( input.type ) { - case IET_SLOW_REPEAT: fOffsetDelta *= 10; break; - case IET_FAST_REPEAT: fOffsetDelta *= 40; break; + case IET_SLOW_REPEAT: fOffsetDelta *= 10; break; + case IET_FAST_REPEAT: fOffsetDelta *= 40; break; } } - + m_pSong->m_Timing.m_fBeat0OffsetInSeconds += fOffsetDelta; } - break; + break; + } } - + else if( input.type != IET_RELEASE ) + { + return; + } + switch( input.StyleI.player ) { case PLAYER_1: if( PREFSMAN->m_AutoPlay == PC_HUMAN ) - m_Player->Step( input.StyleI.col, -1, input.DeviceI.ts ); + m_Player->Step( input.StyleI.col, -1, input.DeviceI.ts, false, input.type == IET_RELEASE ); break; } diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 3bcc4e757c..98f0388369 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -2144,11 +2144,8 @@ void ScreenGameplay::Input( const InputEventPlus &input ) return; } } - - /* Nothing below cares about releases. */ - if( input.type == IET_RELEASE ) - return; - + + bool bRelease = input.type == IET_RELEASE; if( GAMESTATE->m_bMultiplayer ) { @@ -2157,7 +2154,7 @@ void ScreenGameplay::Input( const InputEventPlus &input ) input.StyleI.IsValid() && GAMESTATE->IsMultiPlayerEnabled(input.mp) ) { - m_vPlayerInfo[input.mp].m_pPlayer->Step( input.StyleI.col, -1, input.DeviceI.ts ); + m_vPlayerInfo[input.mp].m_pPlayer->Step( input.StyleI.col, -1, input.DeviceI.ts, false, bRelease ); } } else @@ -2174,7 +2171,7 @@ void ScreenGameplay::Input( const InputEventPlus &input ) if( PREFSMAN->m_AutoPlay == PC_HUMAN ) { PlayerInfo& pi = GetPlayerInfoForInput( input ); - pi.m_pPlayer->Step( input.StyleI.col, -1, input.DeviceI.ts ); + pi.m_pPlayer->Step( input.StyleI.col, -1, input.DeviceI.ts, false, bRelease ); } } }