Note constructor order fixup, GLES2 fix
This commit is contained in:
parent
accec1d9dc
commit
be9f750a69
|
@ -0,0 +1 @@
|
|||
.import/*
|
140
FileLoader.gd
140
FileLoader.gd
|
@ -120,9 +120,9 @@ class SRT:
|
|||
|
||||
match id:
|
||||
ID_HOLD:
|
||||
notes.push_back(Note.make_hold(time_hit, duration, column))
|
||||
notes.push_back(Note.NoteHold.new(time_hit, column, duration))
|
||||
ID_BREAK:
|
||||
notes.push_back(Note.make_break(time_hit, column))
|
||||
notes.push_back(Note.NoteTap.new(time_hit, column, true))
|
||||
ID_SLIDE_END:
|
||||
# id2 is slide ID
|
||||
if id2 in slide_idxs:
|
||||
|
@ -130,7 +130,7 @@ class SRT:
|
|||
notes[slide_idxs[id2]].update_slide_variables()
|
||||
_:
|
||||
if id2 == 0:
|
||||
notes.push_back(Note.make_tap(time_hit, column))
|
||||
notes.push_back(Note.NoteTap.new(time_hit, column))
|
||||
else:
|
||||
# id2 is slide ID, id3 is slide pattern
|
||||
# In order to properly declare the slide, we need the paired endcap which may not be the next note
|
||||
|
@ -145,13 +145,103 @@ class SRT:
|
|||
slide_type = Note.SlideType.ARC_ACW
|
||||
_:
|
||||
print("Unknown slide type: ", id3)
|
||||
notes.push_back(Note.NoteSlide.new(time_hit, duration, column, -1, slide_type))
|
||||
notes.push_back(Note.NoteSlide.new(time_hit, column, duration, -1, slide_type))
|
||||
return notes
|
||||
|
||||
|
||||
class SRB:
|
||||
static func load_file(filename):
|
||||
class RGT:
|
||||
# RhythmGameText formats
|
||||
# .rgts - simplified format cutting out redundant data, should be easy to write charts in
|
||||
# .rgtx - a lossless representation of MM in-memory format
|
||||
# .rgtm - a collection of rgts charts, with a [title] at the start of each one
|
||||
enum Format{RGTS, RGTX, RGTM}
|
||||
const EXTENSIONS = {
|
||||
'rgts': Format.RGTS,
|
||||
'rgtx': Format.RGTX,
|
||||
'rgtm': Format.RGTM,
|
||||
}
|
||||
const NOTE_TYPES = {
|
||||
't': Note.NOTE_TAP,
|
||||
'h': Note.NOTE_HOLD,
|
||||
's': Note.NOTE_SLIDE,
|
||||
'e': Note.NOTE_SLIDE,
|
||||
'b': Note.NOTE_TAP # Break
|
||||
}
|
||||
const SLIDE_TYPES = {
|
||||
'0': null, # Seems to be used for stars without slides attached
|
||||
'1': Note.SlideType.CHORD,
|
||||
'2': Note.SlideType.ARC_ACW, # From Cirno master
|
||||
'3': Note.SlideType.ARC_CW, # From Cirno master
|
||||
'4': Note.SlideType.CHORD, # Probably some weird loop etc.
|
||||
'5': Note.SlideType.CHORD, # Probably some weird loop etc.
|
||||
}
|
||||
static func load_file(filename: String):
|
||||
var extension = filename.rsplit('.', false, 1)[1]
|
||||
if not EXTENSIONS.has(extension):
|
||||
return -1
|
||||
var format = EXTENSIONS[extension]
|
||||
var file := File.new()
|
||||
var err := file.open(filename, File.READ)
|
||||
if err != OK:
|
||||
print(err)
|
||||
return err
|
||||
var length = file.get_len()
|
||||
var lines = [[]]
|
||||
while (file.get_position() < (length-1)): # Could probably replace this with file.eof_reached()
|
||||
var line : String = file.get_line()
|
||||
if line.begins_with('['): # Split to a new list for each chart definition
|
||||
lines.append([])
|
||||
lines[-1].append(line)
|
||||
file.close()
|
||||
|
||||
match format:
|
||||
Format.RGTS:
|
||||
pass
|
||||
Format.RGTX:
|
||||
pass
|
||||
Format.RGTM:
|
||||
pass
|
||||
return format
|
||||
|
||||
static func parse_rgts(lines):
|
||||
var notes = []
|
||||
var slide_ids = {}
|
||||
for line in lines:
|
||||
if len(line) < 4: # shortest legal line would be like '1:1t'
|
||||
continue
|
||||
var s = line.split(':')
|
||||
var time = float(s[0])
|
||||
var note_hits = []
|
||||
var note_nonhits = []
|
||||
for i in range(1, len(s)):
|
||||
var n = s[i]
|
||||
var column = n[0]
|
||||
var ntype = n[1]
|
||||
n = n.substr(2)
|
||||
|
||||
match ntype:
|
||||
't': # tap
|
||||
note_hits.append(Note.NoteTap.new(time, column))
|
||||
'b': # break
|
||||
note_hits.append(Note.NoteTap.new(time, column, true))
|
||||
'h': # hold
|
||||
var duration = float(n)
|
||||
note_hits.append(Note.NoteHold.new(time, column, duration))
|
||||
's': # slide star
|
||||
var slide_type = n[0] # numeric digit, left as str just in case
|
||||
var slide_id = int(n.substr(1))
|
||||
# var note = Note.NoteSlide.new(time, column)
|
||||
# if slide_id > 0:
|
||||
# slide_ids[slide_id] = note
|
||||
'e': # slide end
|
||||
var slide_type = n[0] # numeric digit, left as str just in case
|
||||
var slide_id = int(n.substr(1))
|
||||
'x': # not sure
|
||||
pass
|
||||
|
||||
if len(note_hits) > 1:
|
||||
pass # Set multihit on each one
|
||||
return notes
|
||||
|
||||
|
||||
class SM:
|
||||
|
@ -257,14 +347,14 @@ class SM:
|
|||
for col in len(line):
|
||||
match line[col]:
|
||||
'1':
|
||||
notes.append(Note.make_tap(time, col))
|
||||
notes.append(Note.NoteTap.new(time, col))
|
||||
'2': # Hold
|
||||
ongoing_holds[col] = len(notes)
|
||||
notes.append(Note.make_hold(time, 0.0, col))
|
||||
notes.append(Note.NoteHold.new(time, col, 0.0))
|
||||
num_holds += 1
|
||||
'4': # Roll
|
||||
ongoing_holds[col] = len(notes)
|
||||
notes.append(Note.make_roll(time, 0.0, col))
|
||||
notes.append(Note.NoteRoll.new(time, col, 0.0))
|
||||
num_rolls += 1
|
||||
'3': # End Hold/Roll
|
||||
assert(ongoing_holds.has(col))
|
||||
|
@ -318,33 +408,33 @@ class Test:
|
|||
static func stress_pattern():
|
||||
var notes = []
|
||||
for bar in range(8):
|
||||
notes.push_back(Note.make_hold(bar*4, 1, bar%8))
|
||||
notes.push_back(Note.NoteHold.new(bar*4, bar%8, 1))
|
||||
for i in range(1, 8):
|
||||
notes.push_back(Note.make_tap(bar*4 + (i/2.0), (bar + i)%8))
|
||||
notes.push_back(Note.make_tap(bar*4 + (7/2.0), (bar + 3)%8))
|
||||
notes.push_back(Note.NoteTap.new(bar*4 + (i/2.0), (bar + i)%8))
|
||||
notes.push_back(Note.NoteTap.new(bar*4 + (7/2.0), (bar + 3)%8))
|
||||
for bar in range(8, 16):
|
||||
notes.push_back(Note.make_hold(bar*4, 2, bar%8))
|
||||
notes.push_back(Note.NoteHold.new(bar*4, bar%8, 2))
|
||||
for i in range(1, 8):
|
||||
notes.push_back(Note.make_tap(bar*4 + (i/2.0), (bar + i)%8))
|
||||
notes.push_back(Note.make_tap(bar*4 + ((i+0.5)/2.0), (bar + i)%8))
|
||||
notes.push_back(Note.NoteTap.new(bar*4 + (i/2.0), (bar + i)%8))
|
||||
notes.push_back(Note.NoteTap.new(bar*4 + ((i+0.5)/2.0), (bar + i)%8))
|
||||
notes.push_back(Note.make_slide(bar*4 + ((i+1)/2.0), 1, (bar + i)%8, 0))
|
||||
for bar in range(16, 24):
|
||||
notes.push_back(Note.make_hold(bar*4, 2, bar%8))
|
||||
notes.push_back(Note.make_hold(bar*4, 1, (bar+1)%8))
|
||||
notes.push_back(Note.NoteHold.new(bar*4, bar%8, 2))
|
||||
notes.push_back(Note.NoteHold.new(bar*4, (bar+1)%8, 1))
|
||||
for i in range(2, 8):
|
||||
notes.push_back(Note.make_tap(bar*4 + (i/2.0), (bar + i)%8))
|
||||
notes.push_back(Note.make_hold(bar*4 + ((i+1)/2.0), 0.5, (bar + i)%8))
|
||||
notes.push_back(Note.NoteTap.new(bar*4 + (i/2.0), (bar + i)%8))
|
||||
notes.push_back(Note.NoteHold.new(bar*4 + ((i+1)/2.0), (bar + i)%8, 0.5))
|
||||
for bar in range(24, 32):
|
||||
notes.push_back(Note.make_hold(bar*4, 1, bar%8))
|
||||
notes.push_back(Note.NoteHold.new(bar*4, bar%8, 1))
|
||||
for i in range(1, 32):
|
||||
notes.push_back(Note.make_tap(bar*4 + (i/8.0), (bar + i)%8))
|
||||
notes.push_back(Note.NoteTap.new(bar*4 + (i/8.0), (bar + i)%8))
|
||||
if (i%2) > 0:
|
||||
notes.push_back(Note.make_tap(bar*4 + (i/8.0), (bar + i + 4)%8))
|
||||
notes.push_back(Note.NoteTap.new(bar*4 + (i/8.0), (bar + i + 4)%8))
|
||||
for bar in range(32, 48):
|
||||
notes.push_back(Note.make_hold(bar*4, 1, bar%8))
|
||||
notes.push_back(Note.NoteHold.new(bar*4, bar%8, 1))
|
||||
for i in range(1, 32):
|
||||
notes.push_back(Note.make_tap(bar*4 + (i/8.0), (bar + i)%8))
|
||||
notes.push_back(Note.make_tap(bar*4 + (i/8.0), (bar + i + 3)%8))
|
||||
notes.push_back(Note.NoteTap.new(bar*4 + (i/8.0), (bar + i)%8))
|
||||
notes.push_back(Note.NoteTap.new(bar*4 + (i/8.0), (bar + i + 3)%8))
|
||||
return notes
|
||||
|
||||
func load_folder(folder):
|
||||
|
|
2
Menu.gd
2
Menu.gd
|
@ -254,7 +254,7 @@ func _draw_score_screen(center: Vector2) -> Array:
|
|||
|
||||
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))
|
||||
var notestrs = ["Taps:", "Holds Hit:", "Released:", "Slides Hit:", "Slid:"]
|
||||
var notestrs = ["Taps:", "Holds Hit:", "Released:", "Stars:", "Slides:"]
|
||||
var notetypes = [0, 1, -1, 2, -2]
|
||||
var note_spacing = [0.0, 1.25, 2.25, 3.5, 4.5]
|
||||
var judgestrs = Array(Rules.JUDGEMENT_STRINGS + ["Miss"])
|
||||
|
|
32
Note.gd
32
Note.gd
|
@ -15,6 +15,7 @@ class NoteBase:
|
|||
var double_hit := false
|
||||
var time_activated := INF
|
||||
var missed := false
|
||||
var is_break := false
|
||||
|
||||
func set_time_hit(value: float):
|
||||
time_hit = value
|
||||
|
@ -22,19 +23,20 @@ class NoteBase:
|
|||
|
||||
class NoteTap extends NoteBase:
|
||||
var type := NOTE_TAP
|
||||
func _init(time_hit: float, column: int):
|
||||
func _init(time_hit: float, column: int, is_break:=false):
|
||||
self.time_hit = time_hit
|
||||
self.column = column
|
||||
self.is_break = is_break
|
||||
|
||||
class NoteHoldBase extends NoteBase:
|
||||
var time_release: float setget set_time_release
|
||||
var time_released := INF
|
||||
var duration: float setget set_duration
|
||||
var is_held: bool
|
||||
func _init(time_hit: float, duration: float, column: int):
|
||||
func _init(time_hit: float, column: int, duration: float):
|
||||
self.time_hit = time_hit
|
||||
self.duration = duration
|
||||
self.column = column
|
||||
self.duration = duration
|
||||
self.is_held = false
|
||||
|
||||
func set_time_hit(value: float):
|
||||
|
@ -54,12 +56,12 @@ class NoteHoldBase extends NoteBase:
|
|||
|
||||
class NoteHold extends NoteHoldBase:
|
||||
var type := NOTE_HOLD
|
||||
func _init(time_hit: float, duration: float, column: int).(time_hit, duration, column):
|
||||
func _init(time_hit: float, column: int, duration: float).(time_hit, column, duration):
|
||||
pass
|
||||
|
||||
class NoteRoll extends NoteHoldBase:
|
||||
var type := NOTE_ROLL
|
||||
func _init(time_hit: float, duration: float, column: int).(time_hit, duration, column):
|
||||
func _init(time_hit: float, column: int, duration: float).(time_hit, column, duration):
|
||||
pass
|
||||
|
||||
class NoteSlide extends NoteBase:
|
||||
|
@ -73,12 +75,12 @@ class NoteSlide extends NoteBase:
|
|||
var missed_slide := false
|
||||
var values: Dictionary
|
||||
|
||||
func _init(time_hit: float, duration: float, column: int, column_release: int, slide_type: int):
|
||||
func _init(time_hit: float, column: int, duration: float, column_release: int, slide_type: int):
|
||||
self.time_hit = time_hit
|
||||
self.column = column
|
||||
self.duration = duration
|
||||
self.time_release = time_hit + duration
|
||||
self.time_death = time_release + DEATH_DELAY
|
||||
self.column = column
|
||||
self.column_release = column_release
|
||||
self.slide_type = slide_type
|
||||
self.values = {}
|
||||
|
@ -152,22 +154,8 @@ class NoteSlide extends NoteBase:
|
|||
return 0.0
|
||||
|
||||
|
||||
|
||||
static func make_tap(time_hit: float, column: int) -> NoteTap:
|
||||
# return {type=NOTE_TAP, time_hit=time_hit, time_death=time_hit+DEATH_DELAY, column=column, double_hit=false}
|
||||
return NoteTap.new(time_hit, column)
|
||||
|
||||
static func make_break(time_hit: float, column: int): # -> Dictionary:
|
||||
# return {type=NOTE_TAP, time_hit=time_hit, time_death=time_hit+DEATH_DELAY, column=column, double_hit=false}
|
||||
return NoteTap.new(time_hit, column)
|
||||
|
||||
static func make_hold(time_hit: float, duration: float, column: int) -> NoteHold:
|
||||
# var time_release := time_hit + duration
|
||||
# return {type=NOTE_HOLD, time_hit=time_hit, time_release=time_release, time_death=time_release+DEATH_DELAY, column=column, double_hit=false}
|
||||
return NoteHold.new(time_hit, duration, column)
|
||||
|
||||
static func make_slide(time_hit: float, duration: float, column: int, column_release: int, slide_type:=SlideType.CHORD) -> NoteSlide:
|
||||
return NoteSlide.new(time_hit, duration, column, column_release, slide_type)
|
||||
return NoteSlide.new(time_hit, column, duration, column_release, slide_type)
|
||||
|
||||
static func make_touch(time_hit: float, location: Vector2) -> Dictionary:
|
||||
return {type=NOTE_TOUCH, time_hit=time_hit, time_death=time_hit+DEATH_DELAY, location=location, double_hit=false}
|
||||
|
|
|
@ -422,7 +422,13 @@ func _draw():
|
|||
var position_rel : float = (t+GameTheme.note_forecast_beats-note.time_release)/GameTheme.note_forecast_beats
|
||||
if position_rel > 0:
|
||||
var note_rel_center := (GameTheme.RADIAL_UNIT_VECTORS[note.column] * position_rel * GameTheme.receptor_ring_radius)
|
||||
noteline_data.set_pixel(j%16, 15, Color(position_rel, note.column, GameTheme.RADIAL_COL_ANGLES[note.column]))
|
||||
noteline_data.set_pixel(
|
||||
j%16, 15, Color(
|
||||
position_rel/arr_div.x,
|
||||
note.column/arr_div.y,
|
||||
GameTheme.RADIAL_COL_ANGLES[note.column]/arr_div.z
|
||||
)
|
||||
)
|
||||
j += 1
|
||||
if position_rel < GameTheme.INNER_NOTE_CIRCLE_RATIO:
|
||||
position_rel = GameTheme.INNER_NOTE_CIRCLE_RATIO
|
||||
|
@ -711,10 +717,6 @@ func _process(delta):
|
|||
|
||||
next_note_to_load += 1
|
||||
|
||||
# DEBUG: Reset after all notes are done
|
||||
# if (len(active_notes) < 1) and (next_note_to_load >= len(all_notes)) and (time > 10.0) and not get_node("/root/main/video").is_playing():
|
||||
# time = -10.0
|
||||
# next_note_to_load = 0
|
||||
if (len(active_notes) < 1) and (next_note_to_load >= len(all_notes)) and not get_node("/root/main/music").is_playing() and (len(active_judgement_texts) < 1):
|
||||
self.running = false
|
||||
self.timers_set = false
|
||||
|
|
|
@ -45,7 +45,7 @@ gdscript/warnings/integer_division=false
|
|||
|
||||
[display]
|
||||
|
||||
window/size/width=1920
|
||||
window/size/width=1080
|
||||
window/size/height=1080
|
||||
window/size/fullscreen=true
|
||||
window/handheld/orientation="sensor"
|
||||
|
|
Loading…
Reference in New Issue