From 9187aa23992061a99f4146523601db314fb1a9ae Mon Sep 17 00:00:00 2001 From: Chris Danford Date: Sun, 24 Apr 2005 11:03:02 +0000 Subject: [PATCH] broadcast note crossed messages in beginner mode for BGAs add FORCE_MODIFIERS_IN_BEGINNER --- stepmania/Themes/default/metrics.ini | 2 + stepmania/src/MessageManager.cpp | 4 ++ stepmania/src/MessageManager.h | 4 ++ stepmania/src/ScreenGameplay.cpp | 61 ++++++++++++++++++++++++---- stepmania/src/ScreenGameplay.h | 3 ++ 5 files changed, 67 insertions(+), 7 deletions(-) diff --git a/stepmania/Themes/default/metrics.ini b/stepmania/Themes/default/metrics.ini index 9c8cff886a..d43c1c4694 100644 --- a/stepmania/Themes/default/metrics.ini +++ b/stepmania/Themes/default/metrics.ini @@ -1011,6 +1011,8 @@ BackGivesUp=0 GivingUpFails=1 InitialBackgroundBrightness=1 MusicFadeOutSeconds=0.5 +UseForcedModifiersInBeginner=0 +ForcedModifiersInBeginner= SongBackgroundOnCommand= SongForegroundOnCommand= BPMDisplayX=-1000 diff --git a/stepmania/src/MessageManager.cpp b/stepmania/src/MessageManager.cpp index 9752a4ba18..0cdc5222df 100644 --- a/stepmania/src/MessageManager.cpp +++ b/stepmania/src/MessageManager.cpp @@ -21,6 +21,10 @@ static const CString MessageNames[NUM_MESSAGES] = { "EditPreferredCourseDifficutyP2Changed", "GoalCompleteP1", "GoalCompleteP2", + "NoteCrossed", + "NoteWillCrossIn500Ms", + "NoteWillCrossIn1000Ms", + "NoteWillCrossIn1500Ms", }; XToString( Message, NUM_MESSAGES ); diff --git a/stepmania/src/MessageManager.h b/stepmania/src/MessageManager.h index 21bfb8f6d2..1f37624e07 100644 --- a/stepmania/src/MessageManager.h +++ b/stepmania/src/MessageManager.h @@ -28,6 +28,10 @@ enum Message MESSAGE_EDIT_PREFERRED_COURSE_DIFFICULTY_P2_CHANGED, MESSAGE_GOAL_COMPLETE_P1, MESSAGE_GOAL_COMPLETE_P2, + MESSAGE_NOTE_CROSSED, + MESSAGE_NOTE_WILL_CROSS_IN_500MS, + MESSAGE_NOTE_WILL_CROSS_IN_1000MS, + MESSAGE_NOTE_WILL_CROSS_IN_1500MS, NUM_MESSAGES, MESSAGE_INVALID }; diff --git a/stepmania/src/ScreenGameplay.cpp b/stepmania/src/ScreenGameplay.cpp index 9fc37944f0..b12b38f80b 100644 --- a/stepmania/src/ScreenGameplay.cpp +++ b/stepmania/src/ScreenGameplay.cpp @@ -97,6 +97,8 @@ ScreenGameplay::ScreenGameplay( CString sName ) : ScreenWithMenuElements(sName) BACK_GIVES_UP.Load( sName, "BackGivesUp" ); GIVING_UP_FAILS.Load( sName, "GivingUpFails" ); GIVING_UP_GOES_TO_NEXT_SCREEN.Load( sName, "GivingUpGoesToNextScreen" ); + USE_FORCED_MODIFIERS_IN_BEGINNER.Load( sName, "UseForcedModifiersInBeginner" ); + FORCED_MODIFIERS_IN_BEGINNER.Load( sName, "ForcedModifiersInBeginner" ); } void ScreenGameplay::Init() @@ -969,8 +971,14 @@ void ScreenGameplay::LoadNextSong() { GAMESTATE->m_pPlayerState[p]->m_PlayerController = PC_HUMAN; } - } + if( pSteps->GetDifficulty() == DIFFICULTY_BEGINNER && (bool)USE_FORCED_MODIFIERS_IN_BEGINNER ) + { + GAMESTATE->ApplyModifiers( p, FORCED_MODIFIERS_IN_BEGINNER ); + GAMESTATE->StoreSelectedOptions(); + } + } + const bool bReverse[NUM_PLAYERS] = { GAMESTATE->m_pPlayerState[PLAYER_1]->m_PlayerOptions.m_fScrolls[PlayerOptions::SCROLL_REVERSE] == 1, @@ -1593,16 +1601,12 @@ void ScreenGameplay::Update( float fDeltaTime ) m_BPMDisplay.SetConstantBpm( GAMESTATE->m_fCurBPS * 60.0f ); } - // - // play assist ticks - // PlayTicks(); - // - // update lights - // UpdateLights(); + SendCrossedMessages(); + if( NSMAN->useSMserver ) { FOREACH_EnabledPlayer( pn2 ) @@ -1730,6 +1734,49 @@ void ScreenGameplay::UpdateLights() } } +void ScreenGameplay::SendCrossedMessages() +{ + const int NUM_MESSAGES_TO_SEND = 4; + const float MESSAGE_SPACING_SECONDS = 0.5f; + + PlayerNumber pn = PLAYER_INVALID; + FOREACH_EnabledPlayer( p ) + { + if( GAMESTATE->m_pCurSteps[p]->GetDifficulty() == DIFFICULTY_BEGINNER ) + pn = p; + } + if( pn == PLAYER_INVALID ) + return; + + for( int i=0; im_fMusicSeconds + fOffsetFromCurrentSeconds; // trigger the light a tiny bit early + float fSongBeat = GAMESTATE->m_pCurSong->GetBeatFromElapsedTime( fPositionSeconds ); + + int iRowNow = BeatToNoteRowNotRounded( fSongBeat ); + iRowNow = max( 0, iRowNow ); + static int iRowLastCrossedAll[NUM_MESSAGES_TO_SEND] = { 0, 0, 0, 0 }; + int &iRowLastCrossed = iRowLastCrossedAll[i]; + + FOREACH_NONEMPTY_ROW_ALL_TRACKS_RANGE( m_Player[pn].m_NoteData, r, iRowLastCrossed+1, iRowNow+1 ) + { + if( m_CabinetLightsNoteData.IsThereATapOrHoldHeadAtRow(r) ) + { + LOG->Trace( "r = %d", r ); + MESSAGEMAN->Broadcast( (Message)(MESSAGE_NOTE_CROSSED + i) ); + break; + } + } + + iRowLastCrossed = iRowNow; + } + } +} + void ScreenGameplay::BackOutFromGameplay() { m_DancingState = STATE_OUTRO; diff --git a/stepmania/src/ScreenGameplay.h b/stepmania/src/ScreenGameplay.h index a7e75ffec6..b3c1d02833 100644 --- a/stepmania/src/ScreenGameplay.h +++ b/stepmania/src/ScreenGameplay.h @@ -52,6 +52,8 @@ protected: ThemeMetric BACK_GIVES_UP; ThemeMetric GIVING_UP_FAILS; ThemeMetric GIVING_UP_GOES_TO_NEXT_SCREEN; + ThemeMetric USE_FORCED_MODIFIERS_IN_BEGINNER; + ThemeMetric FORCED_MODIFIERS_IN_BEGINNER; void TweenOnScreen(); void TweenOffScreen(); @@ -65,6 +67,7 @@ protected: void ShowSavePrompt( ScreenMessage SM_SendWhenDone ); void PlayAnnouncer( CString type, float fSeconds ); void UpdateLights(); + void SendCrossedMessages(); void BackOutFromGameplay(); void PlayTicks();