Skip to content

Commit

Permalink
Add experimental support for chord cohesion-less gameplay.
Browse files Browse the repository at this point in the history
  • Loading branch information
xwidghet committed Mar 14, 2017
1 parent eeb2c4e commit 599f08a
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 24 deletions.
6 changes: 6 additions & 0 deletions src/GameState.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ static ThemeMetric<bool> ARE_STAGE_SONG_MODS_FORCED ("GameState","AreStageSongMo

static Preference<Premium> g_Premium( "Premium", Premium_DoubleFor1Credit );
Preference<bool> GameState::m_bAutoJoin( "AutoJoin", false );
Preference<bool> GameState::m_bOverrideChordCohesion("OverrideChordCohesion", false);

GameState::GameState() :
processedTiming( NULL ),
Expand Down Expand Up @@ -1918,6 +1919,11 @@ void GameState::AddStageToPlayer( PlayerNumber pn )
++m_iPlayerStageTokens[pn];
}

bool GameState::CountNotesSeparately()
{
return GetCurrentGame()->m_bCountNotesSeparately || m_bOverrideChordCohesion.Get();
}

template<class T>
void setmin( T &a, const T &b )
{
Expand Down
4 changes: 2 additions & 2 deletions src/GameState.h
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,7 @@ class GameState
int GetLoadingCourseSongIndex() const;

RString GetEtternaVersion() { return "0.54.1"; }


bool CountNotesSeparately();

// State Info used during gameplay

Expand Down Expand Up @@ -379,6 +378,7 @@ class GameState

// Preferences
static Preference<bool> m_bAutoJoin;
static Preference<bool> m_bOverrideChordCohesion;

// These options have weird interactions depending on m_bEventMode,
// so wrap them.
Expand Down
4 changes: 3 additions & 1 deletion src/NoteData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,9 @@ int NoteData::WifeTotalScoreCalc(TimingData *td, int iStartIndex, int iEndIndex)
TapNote tn = GetTapNote(t, r);
if (tn.type != TapNoteType_Empty && tn.type != TapNoteType_Mine && tn.type != TapNoteType_Fake && td->IsJudgableAtRow(r)) {
taps++;
break;

if( !GAMESTATE->CountNotesSeparately() )
break;
}
}
}
Expand Down
7 changes: 6 additions & 1 deletion src/NoteDataWithScoring.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,13 @@ int LastTapNoteScoreTrack( const NoteData &in, unsigned iRow, PlayerNumber pn )

TapNoteScore tns = tn.result.tns;

if( tns == TNS_Miss || tns == TNS_None )
if ( tns == TNS_Miss || (!GAMESTATE->CountNotesSeparately() && tns == TNS_None) )
{
return t;
}
if ( tns == TNS_None )
continue;


float tm = tn.result.fTapNoteOffset;
if(tm < scoretime) continue;
Expand Down
33 changes: 15 additions & 18 deletions src/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2412,7 +2412,7 @@ void Player::Step( int col, int row, const std::chrono::steady_clock::time_point
}

m_LastTapNoteScore = score;
if( GAMESTATE->GetCurrentGame()->m_bCountNotesSeparately )
if( GAMESTATE->CountNotesSeparately() )
{
if( pTN->type != TapNoteType_Mine )
{
Expand All @@ -2424,6 +2424,12 @@ void Player::Step( int col, int row, const std::chrono::steady_clock::time_point
m_pNoteField->DidTapNote( col, bBlind? TNS_W1:score, bBright );
if( score >= m_pPlayerState->m_PlayerOptions.GetCurrent().m_MinTNSToHideNotes || bBlind )
HideNote( col, iRowOfOverlappingNoteOrRow );

if ( pTN->result.tns != TNS_None )
{
SetJudgment(iRowOfOverlappingNoteOrRow, col, *pTN);
HandleTapRowScore(iRowOfOverlappingNoteOrRow);
}
}
}
else if( NoteDataWithScoring::IsRowCompletelyJudged(m_NoteData, iRowOfOverlappingNoteOrRow) )
Expand Down Expand Up @@ -2531,6 +2537,11 @@ void Player::UpdateTapNotesMissedOlderThan( float fMissIfOlderThanSeconds )
else
{
tn.result.tns = TNS_Miss;
if ( GAMESTATE->CountNotesSeparately() )
{
SetJudgment(iter.Row(), m_NoteData.GetFirstTrackWithTapOrHoldHead(iter.Row()), tn);
HandleTapRowScore(iter.Row());
}
}
}
}
Expand All @@ -2540,8 +2551,8 @@ void Player::UpdateJudgedRows(float fDeltaTime)
// Look into the future only as far as we need to
const int iEndRow = BeatToNoteRow( m_Timing->GetBeatFromElapsedTime( m_pPlayerState->m_Position.m_fMusicSeconds + GetMaxStepDistanceSeconds() ) );
bool bAllJudged = true;
const bool bSeparately = GAMESTATE->GetCurrentGame()->m_bCountNotesSeparately;

if( !GAMESTATE->CountNotesSeparately() )
{
NoteData::all_tracks_iterator iter = *m_pIterUnjudgedRows;
int iLastSeenRow = -1;
Expand Down Expand Up @@ -2573,22 +2584,8 @@ void Player::UpdateJudgedRows(float fDeltaTime)
if(lastTN.result.tns < TNS_Miss )
continue;

if( bSeparately )
{
for( int iTrack = 0; iTrack < m_NoteData.GetNumTracks(); ++iTrack )
{
const TapNote &tn = m_NoteData.GetTapNote( iTrack, iRow );
if (tn.type == TapNoteType_Empty ||
tn.type == TapNoteType_Mine ||
tn.type == TapNoteType_AutoKeysound ) continue;
SetJudgment( iRow, iTrack, tn );
}
}
else
{
SetJudgment( iRow, m_NoteData.GetFirstTrackWithTapOrHoldHead(iRow), lastTN );
}
HandleTapRowScore( iRow );
SetJudgment( iRow, m_NoteData.GetFirstTrackWithTapOrHoldHead(iRow), lastTN );
HandleTapRowScore(iRow);
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/ScoreKeeperNormal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ void ScoreKeeperNormal::GetRowCounts( const NoteData &nd, int iRow,
++iNumHitContinueCombo;
else if( tns >= m_MinScoreToMaintainCombo )
++iNumHitMaintainCombo;
else
else if( tns != TNS_None )
++iNumBreakCombo;
}
}
Expand All @@ -542,7 +542,7 @@ void ScoreKeeperNormal::HandleTapRowScore( const NoteData &nd, int iRow )
TapNoteScore scoreOfLastTap = NoteDataWithScoring::LastTapNoteWithResult( nd, iRow ).result.tns;
HandleTapNoteScoreInternal( scoreOfLastTap, TNS_W1, iRow );

if ( GAMESTATE->GetCurrentGame()->m_bCountNotesSeparately )
if ( GAMESTATE->CountNotesSeparately() )
{
HandleComboInternal( iNumHitContinueCombo, iNumHitMaintainCombo, iNumBreakCombo, iRow );
}
Expand Down

0 comments on commit 599f08a

Please sign in to comment.