broadcast note crossed messages in beginner mode for BGAs

add FORCE_MODIFIERS_IN_BEGINNER
This commit is contained in:
Chris Danford
2005-04-24 11:03:02 +00:00
parent f6308e73fd
commit 9187aa2399
5 changed files with 67 additions and 7 deletions
+2
View File
@@ -1011,6 +1011,8 @@ BackGivesUp=0
GivingUpFails=1
InitialBackgroundBrightness=1
MusicFadeOutSeconds=0.5
UseForcedModifiersInBeginner=0
ForcedModifiersInBeginner=
SongBackgroundOnCommand=
SongForegroundOnCommand=
BPMDisplayX=-1000
+4
View File
@@ -21,6 +21,10 @@ static const CString MessageNames[NUM_MESSAGES] = {
"EditPreferredCourseDifficutyP2Changed",
"GoalCompleteP1",
"GoalCompleteP2",
"NoteCrossed",
"NoteWillCrossIn500Ms",
"NoteWillCrossIn1000Ms",
"NoteWillCrossIn1500Ms",
};
XToString( Message, NUM_MESSAGES );
+4
View File
@@ -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
};
+53 -6
View File
@@ -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,6 +971,12 @@ 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] =
@@ -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; i<NUM_MESSAGES_TO_SEND; i++ )
{
float fOffsetFromCurrentSeconds = MESSAGE_SPACING_SECONDS * i;
bool bCrossedABeat = false;
{
float fPositionSeconds = GAMESTATE->m_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;
+3
View File
@@ -52,6 +52,8 @@ protected:
ThemeMetric<bool> BACK_GIVES_UP;
ThemeMetric<bool> GIVING_UP_FAILS;
ThemeMetric<bool> GIVING_UP_GOES_TO_NEXT_SCREEN;
ThemeMetric<bool> USE_FORCED_MODIFIERS_IN_BEGINNER;
ThemeMetric<CString> 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();