Skip to content

Commit

Permalink
slight optimization for pattern mod application
Browse files Browse the repository at this point in the history
  • Loading branch information
MinaciousGrace committed Apr 25, 2020
1 parent 0e5d263 commit c22ae05
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/Etterna/Globals/MinaCalc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,11 @@ Calc::InitializeHands(const vector<NoteInfo>& NoteInfo, float music_rate)
left_hand.stam_adj_diff.resize(numitv);
right_hand.stam_adj_diff.resize(numitv);

// at least for the moment there are a few mods we want to apply evenly
// to all skillset, so pre-multiply them in these after they're generated
left_hand.pre_multiplied_pattern_mod_group_a.resize(numitv);
right_hand.pre_multiplied_pattern_mod_group_a.resize(numitv);

ProcessedFingers fingers;
for (int i = 0; i < 4; i++)
fingers.emplace_back(ProcessFinger(NoteInfo, i, music_rate));
Expand Down Expand Up @@ -458,6 +463,18 @@ Calc::InitializeHands(const vector<NoteInfo>& NoteInfo, float music_rate)
}
}

// it's probably time to loop over hands more sensibly or
// do this stuff inside the class
for (int i = 0; i < numitv; ++i) {
left_hand.pre_multiplied_pattern_mod_group_a[i] =
left_hand.doot[Roll][i] * left_hand.doot[OHJump][i] *
left_hand.doot[Anchor][i];
right_hand.pre_multiplied_pattern_mod_group_a[i] =
right_hand.doot[Roll][i] * right_hand.doot[OHJump][i] *
right_hand.doot[Anchor][i];
}


j0 = SequenceJack(NoteInfo, 0, music_rate);
j1 = SequenceJack(NoteInfo, 1, music_rate);
j2 = SequenceJack(NoteInfo, 2, music_rate);
Expand Down Expand Up @@ -738,7 +755,7 @@ Hand::CalcInternal(float& gotpoints,
}

// we always want to apply these mods, i think
adj_diff[i] *= doot[Roll][i] * doot[OHJump][i] * doot[Anchor][i];
adj_diff[i] *= pre_multiplied_pattern_mod_group_a[i];
}

if (stam) {
Expand Down
3 changes: 3 additions & 0 deletions src/Etterna/Globals/MinaCalc.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,9 @@ class Hand
std::vector<int> v_itvpoints; // Point allotment for each interval
std::vector<float> soap[NUM_CalcDiffValue]; // Calculated difficulty for each interval


// self extraplanetary
std::vector<float> pre_multiplied_pattern_mod_group_a;
// pattern adjusted difficulty, allocate only once
std::vector<float> adj_diff;
// pattern adjusted difficulty, allocate only once, stam needs to be based
Expand Down

0 comments on commit c22ae05

Please sign in to comment.