Skip to content

Commit

Permalink
made overdrive activation overhit protection work
Browse files Browse the repository at this point in the history
  • Loading branch information
3drosalia committed Apr 22, 2024
1 parent 8f226ff commit 3ef56aa
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions Encore/src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ static void handleInputs(int lane, int action){
overdriveActiveFill = overdriveFill;
overdrive = true;
overdriveHitAvailable = true;
overdriveHitTime = eventTime;
}
for (int i = curNoteIdx; i < curChart.notes.size(); i++) {
Note& curNote = curChart.notes[i];
Expand Down Expand Up @@ -152,7 +153,7 @@ static void handleInputs(int lane, int action){
!curNote.hit &&
!curNote.accounted &&
((curNote.time) - perfectBackend) + InputOffset > eventTime &&
eventTime > overdriveHitTime + 0.025
eventTime > overdriveHitTime + 0.05
&& !overhitFrets[lane]) {
player::OverHit();
if (curChart.odPhrases.size() >= 1 && eventTime >= curChart.odPhrases[curODPhrase].start && eventTime < curChart.odPhrases[curODPhrase].end) curChart.odPhrases[curODPhrase].missed = true;
Expand All @@ -166,17 +167,17 @@ static void handleInputs(int lane, int action){
else if (action == GLFW_RELEASE && overdriveHeld) {
overdriveHeld = false;
}
if (action == GLFW_PRESS && overdriveHitAvailable == true) {
if (action == GLFW_PRESS && overdriveHitAvailable) {
if ((curNote.time) - (goodBackend)+InputOffset < eventTime &&
(curNote.time) + (goodFrontend)+InputOffset > eventTime &&
!curNote.hit) {
for (int lane = 0; lane < 5; lane++) {
int chordLane = curChart.findNoteIdx(curNote.time, lane);
if (chordLane != -1) {
Note& chordNote = curChart.notes[chordLane];
if ((chordNote.time) - (goodBackend)+InputOffset < eventTime &&
(chordNote.time) + (goodFrontend)+InputOffset > eventTime &&
!chordNote.hit) {
if ((chordNote.time) - (goodBackend)+InputOffset < eventTime && //backend hitwindow
(chordNote.time) + (goodFrontend)+InputOffset > eventTime && //frontent hitwindow
!chordNote.hit) { //not hit
chordNote.hit = true;
overdriveLanesHit[lane] = true;
chordNote.hitTime = eventTime;
Expand Down Expand Up @@ -249,11 +250,12 @@ static void handleInputs(int lane, int action){
}
}

// what to check when a key changes states (what was the change? was it pressed? or released? what time? what window? were any modifiers pressed?)
static void keyCallback(GLFWwindow* wind, int key, int scancode, int action, int mods) {
if (!streamsLoaded) {
return;
}
if (action < 2) {
if (action < 2) { // if the key action is NOT release
int lane = -1;
if (key == settings.keybindOverdrive || key == settings.keybindOverdriveAlt) {
handleInputs(-1, action);
Expand Down

0 comments on commit 3ef56aa

Please sign in to comment.