Fixed from merge
This commit is contained in:
parent
d8f35df012
commit
7686391ff9
@ -349,11 +349,12 @@ public:
|
|||||||
std::unordered_set<Glyph*> missed_notes_history;
|
std::unordered_set<Glyph*> missed_notes_history;
|
||||||
std::vector<PendingSound> pending_sounds;
|
std::vector<PendingSound> pending_sounds;
|
||||||
std::vector<ActiveSustainedSound> active_sustained;
|
std::vector<ActiveSustainedSound> active_sustained;
|
||||||
bool instrument_has_hits[MAX_INSTRUMENT_TYPES] = {false};
|
|
||||||
float song_time = 0.0f;
|
float song_time = 0.0f;
|
||||||
float chart_time_offset = 0.0f;
|
float chart_time_offset = 0.0f;
|
||||||
int score = 0;
|
int score = 0;
|
||||||
int combo = 0;
|
int combo = 0;
|
||||||
|
int longest_combo = 0;
|
||||||
|
int notes_hit_by_player[MAX_GAMEPADS] = {0};
|
||||||
float upper_bar_y = 0.0f;
|
float upper_bar_y = 0.0f;
|
||||||
float hit_line_y = 0.0f;
|
float hit_line_y = 0.0f;
|
||||||
float lane_width = 0.0f;
|
float lane_width = 0.0f;
|
||||||
@ -383,6 +384,9 @@ public:
|
|||||||
song_time = 0.0f;
|
song_time = 0.0f;
|
||||||
score = 0;
|
score = 0;
|
||||||
combo = 0;
|
combo = 0;
|
||||||
|
longest_combo = 0;
|
||||||
|
for (int i = 0; i < MAX_GAMEPADS; i++)
|
||||||
|
notes_hit_by_player[i] = 0;
|
||||||
game_ended = false;
|
game_ended = false;
|
||||||
dev_auto_hit_mode = false;
|
dev_auto_hit_mode = false;
|
||||||
spawned.clear();
|
spawned.clear();
|
||||||
@ -390,10 +394,6 @@ public:
|
|||||||
missed_notes.clear();
|
missed_notes.clear();
|
||||||
pending_sounds.clear();
|
pending_sounds.clear();
|
||||||
active_sustained.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++)
|
for (int i = 0; i < LANE_COUNT; i++)
|
||||||
{
|
{
|
||||||
press_flash_timer[i] = 0.0f;
|
press_flash_timer[i] = 0.0f;
|
||||||
@ -611,16 +611,13 @@ public:
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
combo++;
|
combo++;
|
||||||
|
longest_combo = std::max(longest_combo, combo);
|
||||||
score += 100 + std::min(combo * 10, 50);
|
score += 100 + std::min(combo * 10, 50);
|
||||||
// Only mark as "has hits" if this was actual player input
|
|
||||||
if (is_player_input)
|
if (is_player_input)
|
||||||
{
|
{
|
||||||
if (!instrument_has_hits[n->instrument_slot])
|
int pid = INSTRUMENT_PHYSICAL_GAMEPAD[n->instrument_slot];
|
||||||
{
|
if (pid >= 0 && pid < MAX_GAMEPADS)
|
||||||
TraceLog(LOG_INFO, "Marking instrument %d as actively played (PHYSICAL_GP=%d)",
|
notes_hit_by_player[pid]++;
|
||||||
n->instrument_slot, INSTRUMENT_PHYSICAL_GAMEPAD[n->instrument_slot]);
|
|
||||||
}
|
|
||||||
instrument_has_hits[n->instrument_slot] = true;
|
|
||||||
}
|
}
|
||||||
TraceLog(LOG_INFO, "COMBO++ -> %d (lane %d, inst %d, player_input=%d)", combo, n->lane, n->instrument_slot, is_player_input);
|
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);
|
bool is_auto = is_instrument_auto_played(n->instrument_slot);
|
||||||
if (is_auto)
|
if (is_auto)
|
||||||
continue;
|
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);
|
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(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_history.insert(n);
|
||||||
missed_notes.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)",
|
TraceLog(LOG_WARNING, "COMBO RESET -> 0 (missed note: lane %d, inst %d)",
|
||||||
n->lane, n->instrument_slot, is_auto, has_hits, n->instrument_slot, INSTRUMENT_PHYSICAL_GAMEPAD[n->instrument_slot]);
|
n->lane, n->instrument_slot);
|
||||||
combo = 0;
|
combo = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -826,14 +819,18 @@ public:
|
|||||||
}
|
}
|
||||||
Glyph* best = nullptr;
|
Glyph* best = nullptr;
|
||||||
float best_dist = 1e9f;
|
float best_dist = 1e9f;
|
||||||
|
bool any_hittable_note_exists = false;
|
||||||
for (Glyph* n : spawned)
|
for (Glyph* n : spawned)
|
||||||
{
|
{
|
||||||
if (n->lane != lane)
|
if (n->lane != lane)
|
||||||
continue;
|
continue;
|
||||||
|
if (completed_notes.count(n) != 0)
|
||||||
|
continue;
|
||||||
if (!is_note_hittable(*n))
|
if (!is_note_hittable(*n))
|
||||||
continue;
|
continue;
|
||||||
if (is_instrument_auto_played(n->instrument_slot))
|
if (is_instrument_auto_played(n->instrument_slot))
|
||||||
continue;
|
continue;
|
||||||
|
any_hittable_note_exists = true;
|
||||||
if (!lane_pressed_by_instrument_owner(lane, n->instrument_slot))
|
if (!lane_pressed_by_instrument_owner(lane, n->instrument_slot))
|
||||||
continue;
|
continue;
|
||||||
float bottom_y = glyph_bottom_y(*n);
|
float bottom_y = glyph_bottom_y(*n);
|
||||||
@ -848,9 +845,9 @@ public:
|
|||||||
{
|
{
|
||||||
consume_note(best, true); // Player input
|
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;
|
combo = 0;
|
||||||
score = std::max(0, score - 25);
|
score = std::max(0, score - 25);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user