Skip to content

Commit

Permalink
Fix bug with second act GH3 CoP squeeze
Browse files Browse the repository at this point in the history
Early whammy in SP phrases was sometimes ignored, meaning chopt didn't
realise the second activation could go from the Y in the first solo to
the RBO.
  • Loading branch information
GenericMadScientist committed Apr 28, 2020
1 parent d4d3e39 commit 01db7b5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/optimiser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,10 @@ Optimiser::CacheKey Optimiser::advance_cache_key(CacheKey key) const
if (key.point == m_song->points().cend()) {
return key;
}
const auto pos = key.point->hit_window_start;
auto pos = key.point->hit_window_start;
if (key.point != m_song->points().cbegin()) {
pos = std::prev(key.point)->hit_window_start;
}
if (pos.beat >= key.position.beat) {
key.position = pos;
}
Expand Down
17 changes: 17 additions & 0 deletions tests/optimiser_unittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,21 @@ TEST_CASE("optimal_path produces the correct path")
REQUIRE(opt_path.score_boost == 750);
REQUIRE(opt_path.activations.size() == 1);
}

// There was a bug where sustains at the start of an SP phrase right after
// an activation/start of song had their early whammy discounted, if that
// note didn't also grant SP. This affected a squeeze in GH3 Cult of
// Personality. This test is to catch that.
SECTION("Early whammy at start of an SP phrase is always counted")
{
std::vector<Note> notes {{0, 1420}, {1500}, {1600}};
std::vector<StarPower> phrases {{0, 1550}};
NoteTrack note_track {notes, phrases, {}};
ProcessedSong track {note_track, 192, {}, 1.0, 1.0};
Optimiser optimiser {&track};
auto opt_path = optimiser.optimal_path();

REQUIRE(opt_path.score_boost == 50);
REQUIRE(opt_path.activations.size() == 1);
}
}

0 comments on commit 01db7b5

Please sign in to comment.