diff options
Diffstat (limited to 'src/main.cc')
| -rw-r--r-- | src/main.cc | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/main.cc b/src/main.cc index 9f61f07..3d05822 100644 --- a/src/main.cc +++ b/src/main.cc @@ -101,6 +101,37 @@ int main(int argc, char** argv) { int beat_count = 0; auto update_game_logic = [&](double t) { + // Variable tempo test: Accelerate and decelerate based on physical time + // Phase 1 (0-10s): Steady at 1.0x + // Phase 2 (10-15s): Accelerate from 1.0x to 2.0x + // Phase 3 (15-20s): Reset to 1.0x (with denser patterns in track) + // Phase 4 (20-25s): Decelerate from 1.0x to 0.5x + // Phase 5 (25s+): Reset to 1.0x (back to normal) + const float prev_tempo = g_tempo_scale; + if (t < 10.0) { + g_tempo_scale = 1.0f; // Phase 1: Steady + } else if (t < 15.0) { + // Phase 2: Linear acceleration + const float progress = (float)(t - 10.0) / 5.0f; + g_tempo_scale = 1.0f + progress * 1.0f; // 1.0 → 2.0 + } else if (t < 20.0) { + g_tempo_scale = 1.0f; // Phase 3: Reset to normal + } else if (t < 25.0) { + // Phase 4: Linear deceleration + const float progress = (float)(t - 20.0) / 5.0f; + g_tempo_scale = 1.0f - progress * 0.5f; // 1.0 → 0.5 + } else { + g_tempo_scale = 1.0f; // Phase 5: Reset to normal + } + +#if !defined(STRIP_ALL) + // Debug output when tempo changes significantly + if (fabsf(g_tempo_scale - prev_tempo) > 0.05f) { + printf("[Tempo] t=%.2fs, tempo=%.3fx, music_time=%.3fs\n", (float)t, + g_tempo_scale, g_music_time); + } +#endif + // Calculate delta time and advance music time at scaled rate const float dt = (float)(t - g_last_physical_time); g_last_physical_time = t; |
