From 23ddf9c1558e7c61d826284f1b4ce786184e0441 Mon Sep 17 00:00:00 2001 From: teejusb <5017202+teejusb@users.noreply.github.com> Date: Mon, 29 May 2023 19:02:58 -0700 Subject: [PATCH] Add EarlyTapNoteOffset --- src/NoteTypes.h | 9 +++++++++ src/Player.cpp | 4 +++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/src/NoteTypes.h b/src/NoteTypes.h index a4f128bf67..f0f50783e7 100644 --- a/src/NoteTypes.h +++ b/src/NoteTypes.h @@ -29,6 +29,15 @@ struct TapNoteResult * (tns >= TNS_W5). */ float fTapNoteOffset; + /** + * @brief Offset, in seconds, for the early tap grade. + * + * Negative numbers mean the note was hit early; positive numbers mean + * it was hit late. These values are only meaningful for graded taps + * (tns >= TNS_W5). */ + float fEarlyTapNoteOffset; + + /** @brief If the whole row has been judged, all taps on the row will be set to hidden. */ bool bHidden; diff --git a/src/Player.cpp b/src/Player.cpp index 93ae7a7d3e..de46b1a211 100644 --- a/src/Player.cpp +++ b/src/Player.cpp @@ -2516,7 +2516,7 @@ void Player::Step( int col, int row, const RageTimer &tm, bool bHeld, bool bRele // want to change the life once. if (pTN->result.earlyTns == TNS_None) { pTN->result.earlyTns = score; - pTN->result.fTapNoteOffset = -fNoteOffset; + pTN->result.fEarlyTapNoteOffset = -fNoteOffset; ChangeLife( score ); // TODO: This should maybe also trigger a judgment change and a score // change on hit. If a player gets an early way off, and doesn't @@ -2531,6 +2531,7 @@ void Player::Step( int col, int row, const RageTimer &tm, bool bHeld, bool bRele msg.SetParam( "Player", m_pPlayerState->m_PlayerNumber ); msg.SetParam( "TapNoteScore", score ); msg.SetParam( "Column", col ); + msg.SetParam( "TapNoteOffset", -fNoteOffset); MESSAGEMAN->Broadcast( msg ); } } else { @@ -3292,6 +3293,7 @@ void Player::SetJudgment( int iRow, int iTrack, const TapNote &tn, TapNoteScore msg.SetParam( "Early", fTapNoteOffset < 0.0f ); msg.SetParam( "TapNoteOffset", tn.result.fTapNoteOffset ); msg.SetParam( "EarlyTapNoteScore", tn.result.earlyTns ); + msg.SetParam( "EarlyTapNoteOffset", tn.result.fEarlyTapNoteOffset ); if ( tns == TNS_Miss ) msg.SetParam( "HeldMiss", tn.result.bHeld );