Small fixes to enable proper MMF library playback
This commit is contained in:
parent
b9f43c24b8
commit
88dd909c0d
|
@ -97,7 +97,6 @@ __meta__ = {
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="ScreenFilter" type="Node2D" parent="."]
|
[node name="ScreenFilter" type="Node2D" parent="."]
|
||||||
visible = false
|
|
||||||
script = ExtResource( 3 )
|
script = ExtResource( 3 )
|
||||||
|
|
||||||
[node name="Receptors" type="MeshInstance2D" parent="."]
|
[node name="Receptors" type="MeshInstance2D" parent="."]
|
||||||
|
|
|
@ -57,7 +57,7 @@ window/stretch/aspect="keep_height"
|
||||||
|
|
||||||
[gdnative]
|
[gdnative]
|
||||||
|
|
||||||
singletons=[ "res://addons/videodecoder.gdnlib" ]
|
singletons=[ ]
|
||||||
singletons_disabled=[ ]
|
singletons_disabled=[ ]
|
||||||
|
|
||||||
[rendering]
|
[rendering]
|
||||||
|
|
|
@ -622,6 +622,9 @@ func load_video(filename):
|
||||||
var filename1 = root + filename
|
var filename1 = root + filename
|
||||||
if file.file_exists(filename1):
|
if file.file_exists(filename1):
|
||||||
return load(filename1)
|
return load(filename1)
|
||||||
|
# var videostream = VideoStreamGDNative.new()
|
||||||
|
# videostream.set_file(filename1)
|
||||||
|
# return videostream
|
||||||
return fallback_videostream
|
return fallback_videostream
|
||||||
|
|
||||||
func direct_load_image(filename) -> ImageTexture:
|
func direct_load_image(filename) -> ImageTexture:
|
||||||
|
|
|
@ -49,7 +49,7 @@ class Song:
|
||||||
var audio_preview_times: Array
|
var audio_preview_times: Array
|
||||||
var video_dimensions: Array
|
var video_dimensions: Array
|
||||||
var chart_difficulties: Dictionary
|
var chart_difficulties: Dictionary
|
||||||
const default_difficulty_keys = ['Z', 'B', 'A', 'E', 'M', 'R']
|
const default_difficulty_keys = ['Z', 'B', 'A', 'E', 'M', 'R', '宴']
|
||||||
|
|
||||||
func _init(values: Dictionary):
|
func _init(values: Dictionary):
|
||||||
title = MultilangStr.new(values.get('title', ''), values.get('title_transliteration', ''), values.get('title_english', ''))
|
title = MultilangStr.new(values.get('title', ''), values.get('title_transliteration', ''), values.get('title_english', ''))
|
||||||
|
@ -69,8 +69,8 @@ class Song:
|
||||||
tile_filename = values.get('tile_filename', '%s.png'%values.get('index', 'tile'))
|
tile_filename = values.get('tile_filename', '%s.png'%values.get('index', 'tile'))
|
||||||
audio_filelist = values.get('audio_filelist', ['%s.ogg'%values.get('index', 'audio')])
|
audio_filelist = values.get('audio_filelist', ['%s.ogg'%values.get('index', 'audio')])
|
||||||
video_filelist = values.get('video_filelist', ['%s.webm'%values.get('index', 'video')])
|
video_filelist = values.get('video_filelist', ['%s.webm'%values.get('index', 'video')])
|
||||||
audio_offsets = values.get('audio_filelist', [240.0/BPM])
|
audio_offsets = values.get('audio_filelist', [0.0, 240.0/BPM])
|
||||||
video_offsets = values.get('video_filelist', [240.0/BPM])
|
video_offsets = values.get('video_filelist', [0.0, 240.0/BPM])
|
||||||
video_dimensions = values.get('video_dimensions', [1.0, 1.0])
|
video_dimensions = values.get('video_dimensions', [1.0, 1.0])
|
||||||
audio_preview_times = values.get('video_dimensions', [1.0, 1.0])
|
audio_preview_times = values.get('video_dimensions', [1.0, 1.0])
|
||||||
genre = values.get('genre', 'None')
|
genre = values.get('genre', 'None')
|
||||||
|
|
|
@ -6,8 +6,6 @@ var NoteHandlerPath := @'/root/main/NoteHandler'
|
||||||
onready var NoteHandler := get_node(NoteHandlerPath)
|
onready var NoteHandler := get_node(NoteHandlerPath)
|
||||||
onready var ScoreText := $ScoreText
|
onready var ScoreText := $ScoreText
|
||||||
|
|
||||||
var song_defs = {}
|
|
||||||
var song_images = {}
|
|
||||||
var genres = {}
|
var genres = {}
|
||||||
|
|
||||||
enum ChartDifficulty {EASY, BASIC, ADV, EXPERT, MASTER}
|
enum ChartDifficulty {EASY, BASIC, ADV, EXPERT, MASTER}
|
||||||
|
@ -40,8 +38,6 @@ var snd_interact := preload('res://assets/softclap.wav')
|
||||||
|
|
||||||
func scan_library():
|
func scan_library():
|
||||||
var results = FileLoader.scan_library()
|
var results = FileLoader.scan_library()
|
||||||
song_defs = results.song_defs
|
|
||||||
song_images = results.song_images
|
|
||||||
genres = results.genres
|
genres = results.genres
|
||||||
|
|
||||||
func save_score() -> int:
|
func save_score() -> int:
|
||||||
|
@ -105,12 +101,11 @@ func draw_songtile(song_key, position, size, title_text:=false, difficulty=selec
|
||||||
var diff_color := GameTheme.COLOR_DIFFICULTY[difficulty*2]
|
var diff_color := GameTheme.COLOR_DIFFICULTY[difficulty*2]
|
||||||
var rect := Rect2(position.x, position.y, size, size)
|
var rect := Rect2(position.x, position.y, size, size)
|
||||||
draw_rect(Rect2(position.x - outline_px, position.y - outline_px, size + outline_px*2, size + outline_px*2), diff_color)
|
draw_rect(Rect2(position.x - outline_px, position.y - outline_px, size + outline_px*2, size + outline_px*2), diff_color)
|
||||||
# draw_texture_rect(song_images[song_key], rect, false)
|
|
||||||
draw_texture_rect(Library.get_song_tile_texture(song_key), rect, false)
|
draw_texture_rect(Library.get_song_tile_texture(song_key), rect, false)
|
||||||
# Draw track difficulty rating
|
# Draw track difficulty rating
|
||||||
draw_string_centered(DiffNumFont, Vector2(position.x+size-17, position.y+size-40), song_defs[song_key]['chart_difficulties'].get(Library.Song.default_difficulty_keys[difficulty], 0), diff_color)
|
draw_string_centered(DiffNumFont, Vector2(position.x+size-17, position.y+size-40), Library.all_songs[song_key]['chart_difficulties'].get(Library.Song.default_difficulty_keys[difficulty], '0'), diff_color)
|
||||||
if title_text:
|
if title_text:
|
||||||
draw_string_centered(TitleFont, Vector2(position.x+size/2.0, position.y+size), song_defs[song_key]['title'], Color(0.95, 0.95, 1.0))
|
draw_string_centered(TitleFont, Vector2(position.x+size/2.0, position.y+size), Library.all_songs[song_key].title.n, Color(0.95, 0.95, 1.0))
|
||||||
return rect
|
return rect
|
||||||
|
|
||||||
func diffstr(difficulty: float):
|
func diffstr(difficulty: float):
|
||||||
|
@ -145,9 +140,9 @@ func _draw_song_select(center: Vector2) -> Array:
|
||||||
|
|
||||||
var subsize = size * scales[0]
|
var subsize = size * scales[0]
|
||||||
var gx = center.x - (subsize + spacer_x) * selected_song_delta
|
var gx = center.x - (subsize + spacer_x) * selected_song_delta
|
||||||
var genre = genres.keys()[g]
|
var songslist = Library.genre_songs[g].keys()
|
||||||
draw_string_centered(GenreFont, Vector2(center.x, gy), genre)
|
var genre_str = genres.keys()[g] + ' (%d)'%len(songslist)
|
||||||
var songslist = genres[genre]
|
draw_string_centered(GenreFont, Vector2(center.x, gy), genre_str)
|
||||||
var s = len(songslist)
|
var s = len(songslist)
|
||||||
var key = songslist[selected_song_vis % s]
|
var key = songslist[selected_song_vis % s]
|
||||||
var y = gy + spacer_y
|
var y = gy + spacer_y
|
||||||
|
@ -182,7 +177,7 @@ func _draw_chart_select(center: Vector2) -> Array:
|
||||||
var r = draw_songtile(song_key, Vector2(x, center.y), size, false, diff, (9 if diff == selected_difficulty else 3))
|
var r = draw_songtile(song_key, Vector2(x, center.y), size, false, diff, (9 if diff == selected_difficulty else 3))
|
||||||
touchrects.append({rect=r, chart_idx=diff})
|
touchrects.append({rect=r, chart_idx=diff})
|
||||||
x += size + spacer_x
|
x += size + spacer_x
|
||||||
draw_string_centered(TitleFont, Vector2(center.x, center.y+size+64), song_defs[song_key]['title'], Color(0.95, 0.95, 1.0))
|
draw_string_centered(TitleFont, Vector2(center.x, center.y+size+64), Library.all_songs[song_key].title.n, Color(0.95, 0.95, 1.0))
|
||||||
touchrects.append({rect=Rect2(center.x-450.0, center.y+310.0, 900.0, 300.0), chart_idx=-1})
|
touchrects.append({rect=Rect2(center.x-450.0, center.y+310.0, 900.0, 300.0), chart_idx=-1})
|
||||||
|
|
||||||
|
|
||||||
|
@ -223,7 +218,7 @@ func _draw_score_screen(center: Vector2) -> Array:
|
||||||
var judgement_text_height = 64 * judgement_text_scale
|
var judgement_text_height = 64 * judgement_text_scale
|
||||||
|
|
||||||
draw_songtile(song_key, Vector2(x_songtile-size/2.0, y), size, false, selected_difficulty, 3)
|
draw_songtile(song_key, Vector2(x_songtile-size/2.0, y), size, false, selected_difficulty, 3)
|
||||||
draw_string_centered(TitleFont, Vector2(x_songtile, y+size), song_defs[song_key]['title'], Color(0.95, 0.95, 1.0))
|
draw_string_centered(TitleFont, Vector2(x_songtile, y+size), Library.all_songs[song_key].title.n, Color(0.95, 0.95, 1.0))
|
||||||
var notestrs = ['Taps:', 'Holds Hit:', 'Released:', 'Stars:', 'Slides:']
|
var notestrs = ['Taps:', 'Holds Hit:', 'Released:', 'Stars:', 'Slides:']
|
||||||
var notetypes = [0, 1, -1, 2, -2]
|
var notetypes = [0, 1, -1, 2, -2]
|
||||||
var note_spacing = [0.0, 1.25, 2.25, 3.5, 4.5]
|
var note_spacing = [0.0, 1.25, 2.25, 3.5, 4.5]
|
||||||
|
@ -316,7 +311,7 @@ func _draw_gameplay(center: Vector2) -> Array:
|
||||||
|
|
||||||
|
|
||||||
func _draw():
|
func _draw():
|
||||||
var songs = len(song_defs)
|
var songs = len(Library.all_songs)
|
||||||
var size = 216
|
var size = 216
|
||||||
var outline_px = 3
|
var outline_px = 3
|
||||||
var center = Vector2(540.0, 540.0-160.0) # Vector2(0.0, -160.0)
|
var center = Vector2(540.0, 540.0-160.0) # Vector2(0.0, -160.0)
|
||||||
|
|
|
@ -576,8 +576,9 @@ func load_track(song_key: String, difficulty_idx: int):
|
||||||
bpm = data.BPM
|
bpm = data.BPM
|
||||||
sync_offset_audio = data.audio_offsets[0]
|
sync_offset_audio = data.audio_offsets[0]
|
||||||
sync_offset_video = data.video_offsets[0]
|
sync_offset_video = data.video_offsets[0]
|
||||||
|
var videostream = FileLoader.load_video('songs/' + data.filepath.rstrip('/') + '/' + data.video_filelist[0])
|
||||||
MusicPlayer.set_stream(FileLoader.load_ogg('songs/' + data.filepath.rstrip('/') + '/' + data.audio_filelist[0]))
|
MusicPlayer.set_stream(FileLoader.load_ogg('songs/' + data.filepath.rstrip('/') + '/' + data.audio_filelist[0]))
|
||||||
VideoPlayer.set_stream(FileLoader.load_video('songs/' + data.filepath.rstrip('/') + '/' + data.video_filelist[0]))
|
VideoPlayer.set_stream(videostream)
|
||||||
VideoPlayer.update_aspect_ratio(data.video_dimensions[0]/data.video_dimensions[1])
|
VideoPlayer.update_aspect_ratio(data.video_dimensions[0]/data.video_dimensions[1])
|
||||||
# all_notes = FileLoader.Test.stress_pattern()
|
# all_notes = FileLoader.Test.stress_pattern()
|
||||||
|
|
||||||
|
@ -634,7 +635,7 @@ func _process(delta):
|
||||||
|
|
||||||
if (not timers_set) and (t > -5.0):
|
if (not timers_set) and (t > -5.0):
|
||||||
timers_set = true
|
timers_set = true
|
||||||
for i in [-4.0, -3.0, -2.0, -1.0]:
|
for i in [-4.0, -3.0, -2.0, -1.0, 0.0, 1.0, 2.0, 3.0]:
|
||||||
var delay := real_time(i) - time
|
var delay := real_time(i) - time
|
||||||
var timer = Timer.new()
|
var timer = Timer.new()
|
||||||
add_child(timer)
|
add_child(timer)
|
||||||
|
|
Loading…
Reference in New Issue