fix combos

This commit is contained in:
James Whiteman 2026-01-31 17:51:06 -08:00
parent 6a4c712f96
commit 4a1db37970

View File

@ -343,8 +343,10 @@ public:
bool music_loaded = false;
std::vector<Glyph> chart;
std::vector<Glyph*> spawned;
std::unordered_set<Glyph*> completed_notes_history;
std::unordered_set<Glyph*> completed_notes;
std::unordered_set<Glyph*> missed_notes;
std::unordered_set<Glyph*> missed_notes_history;
std::vector<PendingSound> pending_sounds;
std::vector<ActiveSustainedSound> active_sustained;
bool instrument_has_hits[MAX_INSTRUMENT_TYPES] = {false};
@ -583,6 +585,7 @@ public:
if (it != spawned.end())
{
hit_flash_timer[n->lane] = PRESS_FLASH_DURATION;
completed_notes_history.insert(n);
completed_notes.insert(n);
// n.time is when the bottom should hit the line
float bottom_hits_line_time = n->time + chart_time_offset;
@ -753,10 +756,14 @@ public:
if (!has_hits)
continue;
float bottom_y = glyph_bottom_y(*n);
if (bottom_y > hit_line_y + HIT_ZONE_MARGIN)
if (bottom_y > hit_line_y + HIT_ZONE_MARGIN &&
std::find(completed_notes_history.begin(), completed_notes_history.end(), n) == completed_notes_history.end() &&
std::find(missed_notes_history.begin(), missed_notes_history.end(), n) == missed_notes_history.end()
)
{
missed_notes_history.insert(n);
missed_notes.insert(n);
TraceLog(LOG_WARNING, "COMBO RESET -> 0 (missed note: lane %d, inst %d, is_auto=%d, has_hits=%d, PHYSICAL_GP[%d]=%d)",
TraceLog(LOG_WARNING, "COMBO RESET0 -> 0 (missed note: lane %d, inst %d, is_auto=%d, has_hits=%d, PHYSICAL_GP[%d]=%d)",
n->lane, n->instrument_slot, is_auto, has_hits, n->instrument_slot, INSTRUMENT_PHYSICAL_GAMEPAD[n->instrument_slot]);
combo = 0;
}
@ -843,7 +850,7 @@ public:
}
else
{
TraceLog(LOG_WARNING, "COMBO RESET -> 0 (lane %d pressed but no valid note found)", lane);
TraceLog(LOG_WARNING, "COMBO RESET2 -> 0 (lane %d pressed but no valid note found)", lane);
combo = 0;
score = std::max(0, score - 25);
}