Assist clapping respects Split Timing.

Versus mode still follows the first player though.
That is a holdover from previous versions.
This commit is contained in:
Jason Felds
2011-05-23 11:22:32 -04:00
parent 6b4f1eb93f
commit d076b13894
5 changed files with 17 additions and 10 deletions
+11 -7
View File
@@ -14,7 +14,7 @@ void GameplayAssist::Init()
m_soundAssistMetronomeBeat.Load( THEME->GetPathS("GameplayAssist","metronome beat"), true );
}
void GameplayAssist::PlayTicks( const NoteData &nd )
void GameplayAssist::PlayTicks( const NoteData &nd, const PlayerState *ps )
{
bool bClap = GAMESTATE->m_SongOptions.GetCurrent().m_bAssistClap;
bool bMetronome = GAMESTATE->m_SongOptions.GetCurrent().m_bAssistMetronome;
@@ -25,9 +25,13 @@ void GameplayAssist::PlayTicks( const NoteData &nd )
* will start coming out the speaker. Compensate for this by boosting fPositionSeconds
* ahead. This is just to make sure that we request the sound early enough for it to
* come out on time; the actual precise timing is handled by SetStartTime. */
float fPositionSeconds = GAMESTATE->m_Position.m_fMusicSeconds;
SongPosition &position = GAMESTATE->m_pPlayerState[ps->m_PlayerNumber]->m_Position;
float fPositionSeconds = position.m_fMusicSeconds;
//float fPositionSeconds = GAMESTATE->m_Position.m_fMusicSeconds;
fPositionSeconds += SOUNDMAN->GetPlayLatency() + (float)CommonMetrics::TICK_EARLY_SECONDS + 0.250f;
const TimingData &timing = GAMESTATE->m_pCurSong->m_SongTiming;
const TimingData &timing = GAMESTATE->m_pCurSteps[ps->m_PlayerNumber]->m_Timing;
const float fSongBeat = timing.GetBeatFromElapsedTimeNoOffset( fPositionSeconds );
const int iSongRow = max( 0, BeatToNoteRowNotRounded( fSongBeat ) );
@@ -47,11 +51,11 @@ void GameplayAssist::PlayTicks( const NoteData &nd )
{
const float fTickBeat = NoteRowToBeat( iClapRow );
const float fTickSecond = timing.GetElapsedTimeFromBeatNoOffset( fTickBeat );
float fSecondsUntil = fTickSecond - GAMESTATE->m_Position.m_fMusicSeconds;
float fSecondsUntil = fTickSecond - position.m_fMusicSeconds;
fSecondsUntil /= GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate; /* 2x music rate means the time until the tick is halved */
RageSoundParams p;
p.m_StartTime = GAMESTATE->m_Position.m_LastBeatUpdate + (fSecondsUntil - (float)CommonMetrics::TICK_EARLY_SECONDS);
p.m_StartTime = position.m_LastBeatUpdate + (fSecondsUntil - (float)CommonMetrics::TICK_EARLY_SECONDS);
m_soundAssistClap.Play( &p );
}
}
@@ -83,11 +87,11 @@ void GameplayAssist::PlayTicks( const NoteData &nd )
{
const float fTickBeat = NoteRowToBeat( iMetronomeRow );
const float fTickSecond = timing.GetElapsedTimeFromBeatNoOffset( fTickBeat );
float fSecondsUntil = fTickSecond - GAMESTATE->m_Position.m_fMusicSeconds;
float fSecondsUntil = fTickSecond - position.m_fMusicSeconds;
fSecondsUntil /= GAMESTATE->m_SongOptions.GetCurrent().m_fMusicRate; /* 2x music rate means the time until the tick is halved */
RageSoundParams p;
p.m_StartTime = GAMESTATE->m_Position.m_LastBeatUpdate + (fSecondsUntil - (float)CommonMetrics::TICK_EARLY_SECONDS);
p.m_StartTime = position.m_LastBeatUpdate + (fSecondsUntil - (float)CommonMetrics::TICK_EARLY_SECONDS);
if( bIsMeasure )
m_soundAssistMetronomeMeasure.Play( &p );
else
+2 -1
View File
@@ -2,6 +2,7 @@
#define GameplayAssist_H
#include "RageSound.h"
#include "PlayerState.h"
class NoteData;
/** @brief The handclaps and metronomes ready to assist the player. */
@@ -13,7 +14,7 @@ public:
/**
* @brief Play the sounds in question for the particular chart.
* @param nd the note data used for playing the ticks. */
void PlayTicks( const NoteData &nd );
void PlayTicks( const NoteData &nd, const PlayerState *ps );
/** @brief Stop playing the sounds. */
void StopPlaying();
private:
+2
View File
@@ -107,6 +107,8 @@ public:
// Lua
virtual void PushSelf( lua_State *L );
PlayerState * GetPlayerState() { return this->m_pPlayerState; }
protected:
void UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat );
+1 -1
View File
@@ -892,7 +892,7 @@ void ScreenEdit::PlayTicks()
if( m_EditState != STATE_PLAYING )
return;
m_GameplayAssist.PlayTicks( m_Player->GetNoteData() );
m_GameplayAssist.PlayTicks( m_Player->GetNoteData(), m_Player->GetPlayerState() );
}
void ScreenEdit::PlayPreviewMusic()
+1 -1
View File
@@ -1388,7 +1388,7 @@ void ScreenGameplay::PlayTicks()
{
Player &player = *m_vPlayerInfo[0].m_pPlayer;
const NoteData &nd = player.GetNoteData();
m_GameplayAssist.PlayTicks( nd );
m_GameplayAssist.PlayTicks( nd, player.GetPlayerState() );
}
/* Play announcer "type" if it's been at least fSeconds since the last announcer. */