void ScreenHowToPlay::Update( float fDelta ) { if( GAMESTATE->m_pCurSong != NULL ) { GAMESTATE->UpdateSongPosition( m_fFakeSecondsIntoSong, GAMESTATE->m_pCurSong->m_Timing ); m_fFakeSecondsIntoSong += fDelta; static int iLastNoteRowCounted = 0; int iCurNoteRow = BeatToNoteRowNotRounded( GAMESTATE->m_fSongBeat ); if( iCurNoteRow != iLastNoteRowCounted &&m_NoteData.IsThereATapAtRow(iCurNoteRow) ) { if( m_pLifeMeterBar && !m_Player ) { if ( m_iW2s < m_iNumW2s ) m_pLifeMeterBar->ChangeLife( TNS_W2 ); else m_pLifeMeterBar->ChangeLife( TNS_Miss ); } m_iW2s++; iLastNoteRowCounted = iCurNoteRow; } // once we hit the number of perfects we want, we want to fail. // switch the controller to HUMAN. since we aren't taking input, // the steps will always be misses. if( m_iW2s > m_iNumW2s ) GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerController = PC_HUMAN; if ( m_pmCharacter ) Step(); } ScreenAttract::Update( fDelta ); }
void BeginnerHelper::Update( float fDeltaTime ) { if(!m_bInitialized) return; // the row we want to check on this update int iCurRow = BeatToNoteRowNotRounded(GAMESTATE->m_fSongBeat + 0.4f); FOREACH_EnabledPlayer( pn ) { for(int iRow=m_iLastRowChecked; iRow<iCurRow; iRow++) { // Check if there are any notes at all on this row.. If not, save scanning. if(!m_NoteData[pn].IsThereATapAtRow(iRow)) continue; // Find all steps on this row, in order to show the correct animations int iStep = 0; const int iNumTracks = m_NoteData[pn].GetNumTracks(); for( int t=0; t<iNumTracks; t++ ) if( m_NoteData[pn].GetTapNote(t,iRow).type == TapNote::tap ) iStep |= 1 << t; // Assign new data this->Step(pn, iStep); } } // Make sure we don't accidentally scan a row 2x m_iLastRowChecked = iCurRow; // Update animations ActorFrame::Update(fDeltaTime); m_pDancePad->Update(fDeltaTime); m_sFlash.Update(fDeltaTime); float beat = (fDeltaTime*GAMESTATE->m_fCurBPS); // If this is not a human player, the dancer is not shown FOREACH_HumanPlayer( pu ) { // Update dancer's animation and StepCircles m_pDancer[pu]->Update( beat ); for(int scu=0; scu<NUM_PLAYERS; scu++) for(int scue=0; scue<4; scue++) m_sStepCircle[scu][scue].Update(beat); } }
void ScreenHowToPlay::Step() { #define ST_LEFT 0x01 #define ST_DOWN 0x02 #define ST_UP 0x04 #define ST_RIGHT 0x08 #define ST_JUMPLR (ST_LEFT | ST_RIGHT) #define ST_JUMPUD (ST_UP | ST_DOWN) int iStep = 0; const int iNoteRow = BeatToNoteRowNotRounded( GAMESTATE->m_fSongBeat + 0.6f ); // if we want to miss from here on out, don't process steps. if( m_iW2s < m_iNumW2s && m_NoteData.IsThereATapAtRow( iNoteRow ) ) { const int iNumTracks = m_NoteData.GetNumTracks(); for( int k=0; k<iNumTracks; k++ ) if( m_NoteData.GetTapNote(k, iNoteRow).type == TapNote::tap ) iStep |= 1 << k; switch( iStep ) { case ST_LEFT: m_pmCharacter->PlayAnimation( "Step-LEFT", 1.8f ); break; case ST_RIGHT: m_pmCharacter->PlayAnimation( "Step-RIGHT", 1.8f ); break; case ST_UP: m_pmCharacter->PlayAnimation( "Step-UP", 1.8f ); break; case ST_DOWN: m_pmCharacter->PlayAnimation( "Step-DOWN", 1.8f ); break; case ST_JUMPLR: m_pmCharacter->PlayAnimation( "Step-JUMPLR", 1.8f ); break; case ST_JUMPUD: // Until I can get an UP+DOWN jump animation, this will have to do. m_pmCharacter->PlayAnimation( "Step-JUMPLR", 1.8f ); m_pmCharacter->StopTweening(); m_pmCharacter->BeginTweening( GAMESTATE->m_fCurBPS /8, TWEEN_LINEAR ); m_pmCharacter->SetRotationY( 90 ); m_pmCharacter->BeginTweening( (1/(GAMESTATE->m_fCurBPS * 2) ) ); //sleep between jump-frames m_pmCharacter->BeginTweening( GAMESTATE->m_fCurBPS /6, TWEEN_LINEAR ); m_pmCharacter->SetRotationY( 0 ); break; } } }