From 51ffc9bb48b43a93eb557b7eb1ccfed47c00c926 Mon Sep 17 00:00:00 2001 From: Luke Hubmayer-Werner Date: Sat, 22 Aug 2020 14:33:40 +0930 Subject: [PATCH] Small fixes --- main.tscn | 1 + scripts/FileLoader.gd | 50 ++++++------ scripts/Menu.gd | 2 +- scripts/NoteHandler.gd | 4 +- scripts/Rules.gd | 164 ++++++++++++++++++++++++++++++++++++++- shaders/notelines.shader | 7 +- 6 files changed, 194 insertions(+), 34 deletions(-) diff --git a/main.tscn b/main.tscn index cdef563..34d0c74 100644 --- a/main.tscn +++ b/main.tscn @@ -64,6 +64,7 @@ shader_param/dot_fullbright_thickness = 0.013 shader_param/max_angle = 1.0708 shader_param/max_dist = 1.25 shader_param/array_postmul = Vector3( 1, 1, 1 ) +shader_param/cols_div2 = 3.999 shader_param/array_sidelen = 16 shader_param/array_size = 256 diff --git a/scripts/FileLoader.gd b/scripts/FileLoader.gd index 19d73b4..452eb8e 100644 --- a/scripts/FileLoader.gd +++ b/scripts/FileLoader.gd @@ -86,31 +86,30 @@ func scan_library(): var song_defs = {} var collections = {} - var song_images = {} var genres = {} dir.open(rootdir) - for key in songslist.folders: - if dir.file_exists(key + '/song.json'): + for folder in songslist.folders: + var full_folder := '%s/%s' % [rootdir, folder] + + if dir.file_exists(folder + '/song.json'): # Our format - song_defs[key] = FileLoader.load_folder('%s/%s' % [rootdir, key]) - print('Loaded song directory: %s' % key) -# song_images[key] = FileLoader.load_image('%s/%s' % [key, song_defs[key]['tile_filename']]) - if song_defs[key]['genre'] in genres: - genres[song_defs[key]['genre']].append(key) + song_defs[folder] = FileLoader.load_folder(full_folder) + print('Loaded song directory: %s' % folder) + if song_defs[folder]['genre'] in genres: + genres[song_defs[folder]['genre']].append(folder) else: - genres[song_defs[key]['genre']] = [key] - if typeof(song_defs[key]['chart_difficulties']) == TYPE_ARRAY: - var diffs = song_defs[key]['chart_difficulties'] + genres[song_defs[folder]['genre']] = [folder] + if typeof(song_defs[folder]['chart_difficulties']) == TYPE_ARRAY: + var diffs = song_defs[folder]['chart_difficulties'] var chart_difficulties = {} for i in min(len(diffs), len(default_difficulty_keys)): chart_difficulties[default_difficulty_keys[i]] = diffs[i] - song_defs[key]['chart_difficulties'] = chart_difficulties + song_defs[folder]['chart_difficulties'] = chart_difficulties - elif dir.file_exists(key + '/collection.json'): - var dir_collection = '%s/%s' % [rootdir, key] - var collection = FileLoader.load_folder(dir_collection, 'collection') - collections[key] = collection - var base_dict = {'filepath': key+'/'} # Top level of the collection dict contains defaults for every song in it + elif dir.file_exists(folder + '/collection.json'): + var collection = FileLoader.load_folder(full_folder, 'collection') + collections[folder] = collection + var base_dict = {'filepath': folder+'/'} # Top level of the collection dict contains defaults for every song in it for key in collection.keys(): if key != 'songs': base_dict[key] = collection[key] @@ -122,26 +121,25 @@ func scan_library(): Library.add_song(song_key, song_def) # Legacy compat stuff song_defs[song_key] = song_def -# song_images[song_key] = FileLoader.load_image('%s/%s/%s.png' % [rootdir, key, song_key]) if song_defs[song_key]['genre'] in genres: genres[song_defs[song_key]['genre']].append(song_key) else: genres[song_defs[song_key]['genre']] = [song_key] else: - var files_by_ext = find_by_extensions(directory_list(rootdir + '/' + key, false).files) + var files_by_ext = find_by_extensions(directory_list(full_folder, false).files) if 'sm' in files_by_ext: var sm_filename = files_by_ext['sm'][0] print(sm_filename) - var thing = SM.load_file(rootdir + '/' + key + '/' + sm_filename) + var thing = SM.load_file(full_folder + '/' + sm_filename) print(thing) pass else: - print('Found non-song directory: ' + key) + print('Found non-song directory: ' + folder) for file in songslist.files: print('Found file: ' + file) - return {song_defs=song_defs, song_images=song_images, genres=genres} + return {song_defs=song_defs, genres=genres} @@ -581,8 +579,8 @@ func load_filelist(filelist: Array, directory=''): match extension: 'rgtm': # multiple charts var res = RGT.load_file(filename) - for key in res: - charts[key] = res[key] + for k in res: + charts[k] = res[k] 'rgts', 'rgtx': # single chart charts[key] = RGT.load_file(filename) key += 1 @@ -591,8 +589,8 @@ func load_filelist(filelist: Array, directory=''): key += 1 'sm': # Stepmania, multiple charts var res = SM.load_file(filename) - for key in res: - charts[key] = res[key] + for k in res: + charts[k] = res[k] _: pass return charts diff --git a/scripts/Menu.gd b/scripts/Menu.gd index eb2b0c9..3520fde 100644 --- a/scripts/Menu.gd +++ b/scripts/Menu.gd @@ -451,7 +451,7 @@ func _input(event): elif event.is_action_pressed('ui_up'): selected_genre = int(max(0, selected_genre - 1)) elif event.is_action_pressed('ui_down'): - selected_genre = int(min(1, selected_genre + 1)) + selected_genre = int(min(5, selected_genre + 1)) elif event.is_action_pressed('ui_page_up'): selected_difficulty = int(max(0, selected_difficulty - 1)) elif event.is_action_pressed('ui_page_down'): diff --git a/scripts/NoteHandler.gd b/scripts/NoteHandler.gd index 13fe821..8f364ec 100644 --- a/scripts/NoteHandler.gd +++ b/scripts/NoteHandler.gd @@ -399,7 +399,7 @@ func _draw(): noteline_data.set_pixel( i%16, i/16, Color( position/arr_div.x, - note.column/arr_div.y, + float(note.column)/arr_div.y, GameTheme.RADIAL_COL_ANGLES[note.column]/arr_div.z ) ) @@ -437,7 +437,7 @@ func _draw(): noteline_data.set_pixel( j%16, 15, Color( position_rel/arr_div.x, - note.column/arr_div.y, + float(note.column)/arr_div.y, GameTheme.RADIAL_COL_ANGLES[note.column]/arr_div.z ) ) diff --git a/scripts/Rules.gd b/scripts/Rules.gd index 48c4173..079ad15 100644 --- a/scripts/Rules.gd +++ b/scripts/Rules.gd @@ -7,7 +7,7 @@ const FIRST_COLUMN_ANGLE_DEG := (COLS_ANGLE_DEG/2.0 if !(COLS%2) else 0.0) - 90. const COLS_TOUCH_ARC_DEG := 240.0/COLS -const JUDGEMENT_STRINGS := ["Perfect", "Great", "Good", "Almost"] +const JUDGEMENT_STRINGS := ['Perfect', 'Great', 'Good', 'Almost'] const JUDGEMENT_TIERS := 4 const JUDGEMENT_TIMES_PRE := [0.040, 0.090, 0.125, 0.150] const JUDGEMENT_TIMES_POST := [0.040, 0.090, 0.125, 0.150] @@ -15,8 +15,168 @@ const JUDGEMENT_TIMES_RELEASE_PRE := [0.040, 0.090, 0.125, 0.150] const JUDGEMENT_TIMES_RELEASE_POST := [0.090, 0.140, 0.175, 0.200] # Small grace period const JUDGEMENT_TIMES_SLIDE_PRE := [0.090, 0.240, 0.4, 60.000] # Small grace period, sort-of. Just be generous, really. const JUDGEMENT_TIMES_SLIDE_POST := [0.090, 0.140, 0.175, 0.200] +const JUDGEMENT_SCORES = [1.0, 0.9, 0.75, 0.5, 0.0] +#var judge_scores = [1.0, 0.9, 0.75, 0.5, 0.0] +#var notetype_weights = [1.0, 1.0, 1.0, 1.0, 1.0] -const SCORE_STRINGS = ["SSS", "SS", "S", "A⁺", "A", "B⁺", "B", "C⁺", "C", "F"] +const SCORE_STRINGS = ['SSS', 'SS', 'S', 'A⁺', 'A', 'B⁺', 'B', 'C⁺', 'C', 'F'] const SCORE_CUTOFFS = [1.0, 0.975, 0.95, 0.9, 0.85, 0.8, 0.7, 0.6, 0.5] const SLIDE_RADIUS2 = 10000.0 # Radius of 100px + +# Not really a fan of Simply Love grading +# Scoring can probably be fine with a strictly positive scheme, but I really dislike having so many grades and the ± feels meaningless. +# I think a SSS/SS/S/A/B/C/D/E/F(ail) grading scheme is sufficient, perhaps with a + to signify a full combo clear +# * could also be used for full perfect clear, though these suffixes would be meaningless at the highest grades which practically require FC/PFC +const STEPMANIA_METRICS = { + 'Casual': { # Taken from Simply Love. + 'GRADE_STRINGS': ['****', '***', '**', '*', 'S⁺', 'S', 'S¯', 'A⁺', 'A', 'A¯', 'B⁺', 'B', 'B¯', 'C⁺', 'C', 'C¯', 'D'], + 'GRADE_CUTOFFS': [1.00, 0.99, 0.98, 0.96, 0.94, 0.92, 0.89, 0.86, 0.83, 0.80, 0.76, 0.72, 0.68, 0.64, 0.60, 0.55, -999], + 'JUDGEMENT_WEIGHTS': { + 1: 3, + 2: 2, + 3: 1, + 4: 0, + 5: 0, + 'Miss': 0, + 'Held': 3, + 'LetGo': 0, + }, + 'TIMING_SECONDS': { + 1: 0.0215, + 2: 0.0430, + 3: 0.1020, + 4: 0.1020, + 5: 0.1020, + 'Hold': 0.320, + 'Roll': 0.350, + }, + 'TIMING_SECONDS_ADD': 0.0015 + }, + 'ITG': { # In The Groove - taken from Simply Love. + 'GRADE_STRINGS': ['****', '***', '**', '*', 'S⁺', 'S', 'S¯', 'A⁺', 'A', 'A¯', 'B⁺', 'B', 'B¯', 'C⁺', 'C', 'C¯', 'D'], + 'GRADE_CUTOFFS': [1.00, 0.99, 0.98, 0.96, 0.94, 0.92, 0.89, 0.86, 0.83, 0.80, 0.76, 0.72, 0.68, 0.64, 0.60, 0.55, -999], + 'JUDGEMENT_WEIGHTS': { + 1: 5, + 2: 4, + 3: 2, + 4: 0, + 5: -6, + 'Miss': -12, + 'Held': 5, + 'LetGo': 0, + }, + 'TIMING_SECONDS': { + 1: 0.0215, + 2: 0.0430, + 3: 0.1020, + 4: 0.1350, + 5: 0.1800, + 'Hold': 0.320, + 'Roll': 0.350, + }, + 'TIMING_SECONDS_ADD': 0.0015 + }, + 'ITG+': { # My modification of ITG to be strictly positive. + 'GRADE_STRINGS': ['****', '***', '**', '*', 'S⁺', 'S', 'S¯', 'A⁺', 'A', 'A¯', 'B⁺', 'B', 'B¯', 'C⁺', 'C', 'C¯', 'D'], + 'GRADE_CUTOFFS': [1.00, 0.99, 0.98, 0.96, 0.94, 0.92, 0.89, 0.86, 0.83, 0.80, 0.76, 0.72, 0.68, 0.64, 0.60, 0.55, 0], + 'JUDGEMENT_WEIGHTS': { + 1: 17, + 2: 16, + 3: 14, + 4: 12, + 5: 6, + 'Miss': 0, + 'Held': 17, + 'LetGo': 12, + }, + 'TIMING_SECONDS': { + 1: 0.0215, + 2: 0.0430, + 3: 0.1020, + 4: 0.1350, + 5: 0.1800, + 'Hold': 0.320, + 'Roll': 0.350, + }, + 'TIMING_SECONDS_ADD': 0.0015 + }, + 'ECFA': { # Everybody Can Fantastic Attack - taken from Simply Love. Stricter than ITG. + 'GRADE_STRINGS': ['****', '***', '**', '*', 'S⁺', 'S', 'S¯', 'A⁺', 'A', 'A¯', 'B⁺', 'B', 'B¯', 'C⁺', 'C', 'C¯', 'D'], + 'GRADE_CUTOFFS': [1.00, 0.99, 0.98, 0.96, 0.94, 0.92, 0.89, 0.86, 0.83, 0.80, 0.76, 0.72, 0.68, 0.64, 0.60, 0.55, -999], + 'JUDGEMENT_WEIGHTS': { + 1: 5, + 2: 5, + 3: 4, + 4: 2, + 5: 0, + 'Miss': -12, + 'Held': 5, + 'LetGo': 0, + }, + 'TIMING_SECONDS': { + 1: 0.0110, + 2: 0.0215, + 3: 0.0430, + 4: 0.1020, + 5: 0.1350, + 'Hold': 0.320, + 'Roll': 0.350, + }, + 'TIMING_SECONDS_ADD': 0.0015 + } +} + +#ITG = { +# LifePercentChangeW1=0.008, +# LifePercentChangeW2=0.008, +# LifePercentChangeW3=0.004, +# LifePercentChangeW4=0.000, +# LifePercentChangeW5=-0.050, +# LifePercentChangeMiss=-0.100, +# LifePercentChangeLetGo=IsGame('pump') and 0.000 or -0.080, +# LifePercentChangeHeld=IsGame('pump') and 0.000 or 0.008, +# LifePercentChangeHitMine=-0.050, +#}, +#['FA+'] = { +# LifePercentChangeW1=0.008, +# LifePercentChangeW2=0.008, +# LifePercentChangeW3=0.008, +# LifePercentChangeW4=0.004, +# LifePercentChangeW5=0, +# LifePercentChangeMiss=-0.1, +# LifePercentChangeLetGo=-0.08, +# LifePercentChangeHeld=0.008, +# LifePercentChangeHitMine=-0.05, +#}, + +#['FA+'] = { +# TimingWindowAdd=0.0015, +# RegenComboAfterMiss=5, +# MaxRegenComboAfterMiss=10, +# MinTNSToHideNotes='TapNoteScore_W4', +# HarshHotLifePenalty=true, +# +# PercentageScoring=true, +# AllowW1='AllowW1_Everywhere', +# SubSortByNumSteps=true, +# +# TimingWindowSecondsW1=0.011000, +# TimingWindowSecondsW2=0.021500, +# TimingWindowSecondsW3=0.043000, +# TimingWindowSecondsW4=0.102000, +# TimingWindowSecondsW5=0.135000, +# TimingWindowSecondsHold=0.320000, +# TimingWindowSecondsMine=0.065000, +# TimingWindowSecondsRoll=0.350000, +#}, + + +# Might move this to a more general singleton later +func get_input_action_map() -> Dictionary: + var dict = {} + for key in InputMap.get_actions(): + dict[key] = InputMap.get_action_list(key) + return dict + +onready var action_map := get_input_action_map() diff --git a/shaders/notelines.shader b/shaders/notelines.shader index a29fa14..d3ad482 100644 --- a/shaders/notelines.shader +++ b/shaders/notelines.shader @@ -16,7 +16,8 @@ uniform float max_angle = 1.0708; //3.14159*0.5; //radians(90.0); uniform float max_dist = 1.25; // GLES2 clamps our color values that we send as makeshift arrays, so we need to divide them in code and multiply them in our shader -uniform vec3 array_postmul = vec3(1.0); +uniform vec3 array_postmul = vec3(2.0, 8.0, 6.283185307); +uniform float cols_div2 = 3.999; // Used to determine opposed notes //void vertex() { //} @@ -96,14 +97,14 @@ void fragment() { // This note is a double! last_double = true; // Check for special case: directly opposite columns - full-thickness line 360° - if (sample.y == mod(sample2.y+4.0, 8.0)){ +// if (sample.y == mod(sample2.y+4.0, 8.0)){ + if (abs(sample.y-sample2.y) >= cols_div2){ if (diff < line_thickness){ line_double_alpha += (line_thickness-diff)/line_thickness; } } else { // Find the smallest arc between them, make it fully thick float diff_a2 = angle_diff(angle, sample2.z); -// if ((diff_a<1.5708) && (diff_a2<1.5708)){ if ((diff_a+diff_a2-0.0001) <= angle_diff(sample.z, sample2.z)){ if (diff < line_thickness){ line_double_alpha += (line_thickness-diff)/line_thickness;