Skip to content

Commit

Permalink
Merge branch 'MStiming'
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Feeney committed Oct 26, 2016
2 parents e778a35 + b802564 commit 0e02141
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/NoteData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@ int NoteData::GetNumTapNotesNoTiming( int iStartIndex, int iEndIndex ) const
{
FOREACH_NONEMPTY_ROW_IN_TRACK_RANGE( *this, t, r, iStartIndex, iEndIndex )
{
if(GetTapNote(t, r).type != TapNoteType_Empty)
if(GetTapNote(t, r).type != TapNoteType_Empty && GetTapNote(t, r).type != TapNoteType_Mine)
{ iNumNotes++; }
}
}
Expand Down
37 changes: 37 additions & 0 deletions src/Player.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -669,6 +669,7 @@ void Player::Load()
m_Timing = GAMESTATE->m_pCurSteps[pn]->GetTimingData();
m_Timing->NegStopAndBPMCheck();
m_Timing->SetElapsedTimesAtAllRows(GAMESTATE->m_pCurSteps[pn]->ElapsedTimesAtAllRows);
totalwifescore = 2 * m_NoteData.GetNumTapNotesNoTiming();

/* Apply transforms. */
NoteDataUtil::TransformNoteData(m_NoteData, *m_Timing, m_pPlayerState->m_PlayerOptions.GetStage(), GAMESTATE->GetCurrentStyle(GetPlayerState()->m_PlayerNumber)->m_StepsType);
Expand Down Expand Up @@ -3120,6 +3121,15 @@ void Player::SetMineJudgment( TapNoteScore tns , int iTrack )
msg.SetParam( "FirstTrack", iTrack );
msg.SetParam( "Judgment", tns);
msg.SetParam( "Type", static_cast<RString>("Mine"));

// Ms scoring implemenation - Mina
if (tns == TNS_HitMine)
curwifescore -= 8.f;

msg.SetParam("WifePercent", 100 * curwifescore / maxwifescore);
msg.SetParam("WifeDifferential", curwifescore - maxwifescore*0.93f);
msg.SetParam("TotalPercent", 100 * curwifescore / totalwifescore);

MESSAGEMAN->Broadcast( msg );
if( m_pPlayerStageStats &&
( ( tns == TNS_AvoidMine && AVOID_MINE_INCREMENTS_COMBO ) ||
Expand All @@ -3131,6 +3141,12 @@ void Player::SetMineJudgment( TapNoteScore tns , int iTrack )
}
}

float Player::wife2(float maxms, float avedeviation, float power, int upperbound, int lowerbound) {
float y = 1 - pow(2, -1*maxms*maxms / (avedeviation*avedeviation));
y = pow(y, power);
return (upperbound - lowerbound)*(1 - y) + lowerbound;
}

void Player::SetJudgment( int iRow, int iTrack, const TapNote &tn, TapNoteScore tns, float fTapNoteOffset )
{
if( m_bSendJudgmentAndComboMessages )
Expand All @@ -3150,6 +3166,19 @@ void Player::SetJudgment( int iRow, int iTrack, const TapNote &tn, TapNoteScore
if (tns != TNS_Miss)
msg.SetParam("Offset", tn.result.fTapNoteOffset * 1000); // don't send out 0 ms offsets for misses, multiply by 1000 for convenience - Mina

// Ms scoring implementation - Mina
if (tns == TNS_Miss) {
curwifescore -= 8;
}
else
{
curwifescore += wife2(tn.result.fTapNoteOffset * 1000.f, 80.f, 2.f, 2, -8);
}
maxwifescore += 2;
msg.SetParam("WifePercent", 100*curwifescore/maxwifescore);
msg.SetParam("WifeDifferential", curwifescore - maxwifescore*0.93f);
msg.SetParam("TotalPercent", 100 * curwifescore / totalwifescore);

Lua* L= LUA->Get();
lua_createtable( L, 0, m_NoteData.GetNumTracks() ); // TapNotes this row
lua_createtable( L, 0, m_NoteData.GetNumTracks() ); // HoldHeads of tracks held at this row.
Expand Down Expand Up @@ -3200,6 +3229,14 @@ void Player::SetHoldJudgment( TapNote &tn, int iTrack )
msg.SetParam( "Type", static_cast<RString>("Hold"));
msg.SetParam( "Val", m_pPlayerStageStats->m_iHoldNoteScores[tn.HoldResult.hns] + 1);

// Ms scoring implemenation - Mina
if( tn.HoldResult.hns == HNS_LetGo || tn.HoldResult.hns == HNS_Missed)
curwifescore -= 6.f;

msg.SetParam("WifePercent", 100 * curwifescore / maxwifescore);
msg.SetParam("WifeDifferential", curwifescore - maxwifescore*0.93f);
msg.SetParam("TotalPercent", 100 * curwifescore / totalwifescore);

Lua* L = LUA->Get();
tn.PushSelf(L);
msg.SetParamFromStack( L, "TapNote" );
Expand Down
10 changes: 8 additions & 2 deletions src/Player.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,6 @@ class Player: public ActorFrame
void ScoreAllActiveHoldsLetGo();
void DoTapScoreNone();

size_t nervpos = 0; // hacky way to keep track of where we are in the non-empty row vector - Mina

void Step( int col, int row, const RageTimer &tm, bool bHeld, bool bRelease );

void FadeToFail();
Expand All @@ -134,6 +132,14 @@ class Player: public ActorFrame
void SetLife(float value);
bool m_inside_lua_set_life;

// Mina temp stuff
size_t nervpos = 0; // hacky way to keep track of where we are in the non-empty row vector - Mina
float wife2(float maxms, float avedeviation, float power, int upperbound, int lowerbound);
float maxwifescore = 0;
float curwifescore = 0;
int totalwifescore;
vector<float> wifedeviance;

protected:
void UpdateTapNotesMissedOlderThan( float fMissIfOlderThanThisBeat );
void UpdateJudgedRows(float fDeltaTime);
Expand Down
29 changes: 29 additions & 0 deletions src/Steps.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,35 @@ RString Steps::GenerateChartKey(HiddenPtr<NoteData> nd, vector<float>& etar)
k.append(to_string(et));
et = lround(etar[row] * m - fso);
}

vector<vector<int>> doot;
vector<int> scoot;
int intN = 1;
float intI = 0.5f;
int intT = 0;
vector<int> intervaltaps;

for (size_t r = 0; r < NonEmptyRowVector.size(); r++)
{
int row = NonEmptyRowVector[r];
if (etar[row] >= intN * intI) {
doot.push_back(scoot);
scoot.clear();
intN += 1;

intervaltaps.push_back(intT/intI);
intT = 0;
}
scoot.push_back(row);
for (int t = 0; t < nd->GetNumTracks(); ++t)
{
const TapNote &tn = nd->GetTapNote(t, row);
if (tn.type == TapNoteType_Tap || tn.type == TapNoteType_HoldHead) {
intT += 1;
}

}
}

//ChartKeyRecord = k;
o.append("X"); // I was thinking of using "C" to indicate chart.. however.. X is cooler... - Mina
Expand Down

0 comments on commit 0e02141

Please sign in to comment.