Etterna 0.74.4
Loading...
Searching...
No Matches
OHJSequencing.h
1#pragma once
2
8{
9 // COUNT TAPS IN JUMPS
10 int cur_seq_taps = 0;
11 int max_seq_taps = 0;
12
13 auto get_largest_seq_taps() -> int
14 {
15 return cur_seq_taps > max_seq_taps ? cur_seq_taps : max_seq_taps;
16 }
17
18 void complete_seq()
19 {
20 // negative values should not be possible
21 assert(cur_seq_taps >= 0);
22
23 // set the largest ohj sequence
24 max_seq_taps = get_largest_seq_taps();
25 // reset
26 cur_seq_taps = 0;
27 }
28
29 void zero()
30 {
31 cur_seq_taps = 0;
32 max_seq_taps = 0;
33 }
34
35 void operator()(const col_type& ct, const base_type& bt)
36 {
37 if (cur_seq_taps == 0) {
38 // if we aren't in a sequence and aren't going to start one, bail
39 if (ct != col_ohjump) {
40 return;
41 }
42 { // allow sequences of 1 by starting any time we hit an ohjump
43 cur_seq_taps += 2;
44 }
45 }
46
47 // we know between the following that the latter is more
48 // difficult [12][12][12]222[12][12][12]
49 // [12][12][12]212[12][12][12]
50 // so we want to penalize not only any break in the ohj
51 // sequence but further penalize breaks which contain
52 // cross column taps this should also reflect the
53 // difference between [12]122[12], [12]121[12] cases
54 // like 121[12][12]212[12][12]121 should probably have
55 // some penalty but likely won't with this setup, but
56 // everyone hates that anyway and it would be quite
57 // difficult to force the current setup to do so without
58 // increasing complexity significantly (probably)
59
60 // don't reset immediately on a single note, wait to see
61 // what comes next, if now.last_cc == base_jump_single, we have just
62 // broken a sequence (technically this can be simply something like
63 // [12]2[12]2[12]2 so the ohjumps wouldn't really be a sequence
64 switch (bt) {
65 case base_jump_jump:
66 // continuing sequence
67 cur_seq_taps += 2;
68 break;
69 case base_jump_single:
70 // just came out of a jump seq, do nothing... wait to see what
71 // happens
72 break;
73 case base_left_right:
74 case base_right_left:
75 // if we have an actual cross column tap now, and if we just
76 // came from a jump -> single, then we have something like
77 // [12]21, which is much harder than [12]22, so penalize the
78 // sequence slightly before completing
79 if (cur_seq_taps == 2) {
80 cur_seq_taps -= 1;
81 } else {
82 cur_seq_taps -= 3;
83 }
84 complete_seq();
85 break;
86 case base_single_single:
87 // we have something like [12]22, complete the sequence
88 // without the penalty that the cross column incurs
89 complete_seq();
90 break;
91 case base_single_jump:
92 // [12]1[12]... we broke a sequence and went right back into
93 // one.. reset sequence for now but come back to revsit this, we
94 // might want to have different behavior, but we'd need to track
95 // the columns of the single notes in the chain
96 // if (now.last_cc == base_jump_single)
97 // complete_seq();
98 // else
99 complete_seq();
100 break;
101 case base_type_init:
102 // do nothing, we don't have enough info yet
103 break;
104 default:
105 assert(0);
106 break;
107 }
108 }
109};
Definition OHJSequencing.h:8