static void demo_play_timer(int id, float dt) { game_step_fade(dt); gui_timer(id, dt); hud_timer(dt); /* Pause briefly before starting playback. */ if (time_state() < prelude) return; if (!demo_replay_step(dt)) { demo_paused = 0; goto_state(&st_demo_end); } else { progress_step(); game_client_blend(demo_replay_blend()); } }
static void title_timer(int id, float dt) { static const char *demo = NULL; real_time += dt; switch (mode) { case MODE_LEVEL: /* Pan across title level. */ if (real_time <= 20.0f) { game_client_fly(fcosf(V_PI * real_time / 20.0f)); } else { game_fade(+1.0f); real_time = 0.0f; mode = MODE_LEVEL_FADE; } break; case MODE_LEVEL_FADE: /* Fade out. Load demo level. */ if (real_time > 1.0f) { if (!items) items = demo_dir_scan(); if ((demo = pick_demo(items))) { demo_replay_init(demo, NULL, NULL, NULL, NULL, NULL); game_client_fly(0.0f); real_time = 0.0f; mode = MODE_DEMO; } else { game_fade(-1.0f); real_time = 0.0f; mode = MODE_LEVEL; } } break; case MODE_DEMO: /* Run demo. */ if (!demo_replay_step(dt)) { demo_replay_stop(0); game_fade(+1.0f); real_time = 0.0f; mode = MODE_DEMO_FADE; } else game_client_blend(demo_replay_blend()); break; case MODE_DEMO_FADE: /* Fade out. Load title level. */ if (real_time > 1.0f) { init_title_level(); real_time = 0.0f; mode = MODE_LEVEL; } break; } gui_timer(id, dt); game_step_fade(dt); }