Merge branch 'master' of mx.cogentleman.com:cogentleman/guitarHeroButBetter
This commit is contained in:
commit
27c371e97e
@ -346,6 +346,7 @@ public:
|
|||||||
std::unordered_set<Glyph*> missed_notes;
|
std::unordered_set<Glyph*> missed_notes;
|
||||||
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;
|
||||||
@ -386,6 +387,10 @@ 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;
|
||||||
@ -571,7 +576,7 @@ public:
|
|||||||
return bottom_y >= upper_bar_y - HIT_ZONE_MARGIN && bottom_y <= hit_line_y + HIT_ZONE_MARGIN;
|
return bottom_y >= upper_bar_y - HIT_ZONE_MARGIN && bottom_y <= hit_line_y + HIT_ZONE_MARGIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
void consume_note(Glyph* n)
|
void consume_note(Glyph* n, bool is_player_input = false)
|
||||||
{
|
{
|
||||||
auto it = std::find_if(spawned.begin(), spawned.end(), [n](Glyph* p) { return p == n; });
|
auto it = std::find_if(spawned.begin(), spawned.end(), [n](Glyph* p) { return p == n; });
|
||||||
if (it != spawned.end())
|
if (it != spawned.end())
|
||||||
@ -603,6 +608,17 @@ public:
|
|||||||
}
|
}
|
||||||
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 (!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;
|
||||||
|
}
|
||||||
|
TraceLog(LOG_INFO, "COMBO++ -> %d (lane %d, inst %d, player_input=%d)", combo, n->lane, n->instrument_slot, is_player_input);
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_layout()
|
void update_layout()
|
||||||
@ -728,12 +744,19 @@ public:
|
|||||||
continue;
|
continue;
|
||||||
if (missed_notes.count(n) != 0)
|
if (missed_notes.count(n) != 0)
|
||||||
continue;
|
continue;
|
||||||
if (is_instrument_auto_played(n->instrument_slot))
|
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;
|
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)
|
||||||
{
|
{
|
||||||
missed_notes.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)",
|
||||||
|
n->lane, n->instrument_slot, is_auto, has_hits, n->instrument_slot, INSTRUMENT_PHYSICAL_GAMEPAD[n->instrument_slot]);
|
||||||
combo = 0;
|
combo = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -815,10 +838,11 @@ public:
|
|||||||
}
|
}
|
||||||
if (best != nullptr && pressed)
|
if (best != nullptr && pressed)
|
||||||
{
|
{
|
||||||
consume_note(best);
|
consume_note(best, true); // Player input
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
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