[fix] Fixed an issue that debug-music-offset-beat option had no meanings.

This commit is contained in:
falsycat 2019-10-16 00:00:00 +00:00
parent d98d0be7b7
commit 2ad131534f
5 changed files with 6 additions and 5 deletions

View File

@ -51,7 +51,8 @@ class Game : AbstractGame {
if (args.debug_music_index >= 0) {
enforce(args.debug_music_index < music_list.length);
load_.Initialize(music_list_[args.debug_music_index]);
load_.Initialize(
music_list_[args.debug_music_index], args.debug_music_offset_beat);
super(load_);
} else {

View File

@ -35,7 +35,7 @@ class LoadingScene : SceneInterface {
}
///
void Initialize(Music music, float offset_beat = 0) {
void Initialize(Music music, float offset_beat) {
music_ = music;
offset_beat_ = offset_beat;

View File

@ -66,7 +66,7 @@ class Music {
///
void PlayForGame(float offset_beat) {
sfMusic_setPlayingOffset(music_,
sfMilliseconds((offset_beat*bpm_ / 60f / 1e-6f).to!int));
sfMilliseconds((offset_beat / bpm_ * 60f * 1000f).to!int));
sfMusic_play(music_);
}
///

View File

@ -35,7 +35,7 @@ class PlayScene : SceneInterface {
}
///
void Initialize(Music music, sjplayer.Context context, float offset_beat = 0) {
void Initialize(Music music, sjplayer.Context context, float offset_beat) {
music_ = music;
context_ = context;

View File

@ -389,7 +389,7 @@ private class MusicPlayState : AbstractSceneState {
if (anime_.isFinished) {
music_.StopPlaying();
owner.load_scene_.Initialize(music_);
owner.load_scene_.Initialize(music_, 0);
return CreateResult(owner.load_scene_);
}
return CreateResult(this);