Skip to content

Commit

Permalink
automatic lead-in for beatmaps that start too early
Browse files Browse the repository at this point in the history
  • Loading branch information
fmang committed Sep 14, 2017
1 parent 5c89597 commit cfab4a1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/game/game.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,13 @@ int oshu_game_create(const char *beatmap_path, struct oshu_game **game)
SDL_SetTextureColorMod((*game)->background, 64, 64, 64);
}

(*game)->clock.now = - (*game)->beatmap->audio_lead_in;
if ((*game)->beatmap->audio_lead_in > 0) {
(*game)->clock.now = - (*game)->beatmap->audio_lead_in;
} else {
double first_hit = (*game)->beatmap->hits->time;
if (first_hit < 1.)
(*game)->clock.now = first_hit - 1.;
}
(*game)->clock.ticks = SDL_GetTicks();

return 0;
Expand Down

0 comments on commit cfab4a1

Please sign in to comment.