Fixed from merge

This commit is contained in:
Gordon Weeks 2026-01-31 18:00:43 -08:00
parent d8f35df012
commit 7686391ff9

View File

@ -349,11 +349,12 @@ public:
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};
float song_time = 0.0f;
float chart_time_offset = 0.0f;
int score = 0;
int combo = 0;
int longest_combo = 0;
int notes_hit_by_player[MAX_GAMEPADS] = {0};
float upper_bar_y = 0.0f;
float hit_line_y = 0.0f;
float lane_width = 0.0f;
@ -383,6 +384,9 @@ public:
song_time = 0.0f;
score = 0;
combo = 0;
longest_combo = 0;
for (int i = 0; i < MAX_GAMEPADS; i++)
notes_hit_by_player[i] = 0;
game_ended = false;
dev_auto_hit_mode = false;
spawned.clear();
@ -390,10 +394,6 @@ public:
missed_notes.clear();
pending_sounds.clear();
active_sustained.clear();
for (int i = 0; i < MAX_INSTRUMENT_TYPES; i++)
{
instrument_has_hits[i] = false;
}
for (int i = 0; i < LANE_COUNT; i++)
{
press_flash_timer[i] = 0.0f;
@ -611,16 +611,13 @@ public:
}
}
combo++;
longest_combo = std::max(longest_combo, combo);
score += 100 + std::min(combo * 10, 50);
// Only mark as "has hits" if this was actual player input
if (is_player_input)
{
if (!instrument_has_hits[n->instrument_slot])
{
TraceLog(LOG_INFO, "Marking instrument %d as actively played (PHYSICAL_GP=%d)",
n->instrument_slot, INSTRUMENT_PHYSICAL_GAMEPAD[n->instrument_slot]);
}
instrument_has_hits[n->instrument_slot] = true;
int pid = INSTRUMENT_PHYSICAL_GAMEPAD[n->instrument_slot];
if (pid >= 0 && pid < MAX_GAMEPADS)
notes_hit_by_player[pid]++;
}
TraceLog(LOG_INFO, "COMBO++ -> %d (lane %d, inst %d, player_input=%d)", combo, n->lane, n->instrument_slot, is_player_input);
}
@ -751,10 +748,6 @@ public:
bool is_auto = is_instrument_auto_played(n->instrument_slot);
if (is_auto)
continue;
// Only reset combo for instruments that the player is actively playing
bool has_hits = instrument_has_hits[n->instrument_slot];
if (!has_hits)
continue;
float bottom_y = glyph_bottom_y(*n);
if (bottom_y > hit_line_y + HIT_ZONE_MARGIN &&
std::find(completed_notes_history.begin(), completed_notes_history.end(), n) == completed_notes_history.end() &&
@ -763,8 +756,8 @@ public:
{
missed_notes_history.insert(n);
missed_notes.insert(n);
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]);
TraceLog(LOG_WARNING, "COMBO RESET -> 0 (missed note: lane %d, inst %d)",
n->lane, n->instrument_slot);
combo = 0;
}
}
@ -826,14 +819,18 @@ public:
}
Glyph* best = nullptr;
float best_dist = 1e9f;
bool any_hittable_note_exists = false;
for (Glyph* n : spawned)
{
if (n->lane != lane)
continue;
if (completed_notes.count(n) != 0)
continue;
if (!is_note_hittable(*n))
continue;
if (is_instrument_auto_played(n->instrument_slot))
continue;
any_hittable_note_exists = true;
if (!lane_pressed_by_instrument_owner(lane, n->instrument_slot))
continue;
float bottom_y = glyph_bottom_y(*n);
@ -848,9 +845,9 @@ public:
{
consume_note(best, true); // Player input
}
else
else if (!any_hittable_note_exists)
{
TraceLog(LOG_WARNING, "COMBO RESET2 -> 0 (lane %d pressed but no valid note found)", lane);
TraceLog(LOG_WARNING, "COMBO RESET -> 0 (lane %d pressed but no valid note found)", lane);
combo = 0;
score = std::max(0, score - 25);
}