Sound improvements
This commit is contained in:
parent
0b48599dac
commit
9628a249b4
|
@ -22,7 +22,7 @@ class SRT:
|
||||||
var slide_idxs = {}
|
var slide_idxs = {}
|
||||||
while (file.get_position() < (length-2)):
|
while (file.get_position() < (length-2)):
|
||||||
var noteline = file.get_csv_line()
|
var noteline = file.get_csv_line()
|
||||||
var time_hit := (float(noteline[0]) + float(noteline[1])) * beats_per_measure
|
var time_hit := (float(noteline[0]) + (float(noteline[1]))-1.0) * beats_per_measure
|
||||||
var duration := float(noteline[2]) * beats_per_measure
|
var duration := float(noteline[2]) * beats_per_measure
|
||||||
var column := int(noteline[3])
|
var column := int(noteline[3])
|
||||||
var id := int(noteline[4])
|
var id := int(noteline[4])
|
||||||
|
|
|
@ -9,17 +9,37 @@ var slide_trail_shadermaterial := preload("res://shaders/slidetrail.tres")
|
||||||
|
|
||||||
var snd_miss := preload("res://assets/miss.wav")
|
var snd_miss := preload("res://assets/miss.wav")
|
||||||
var snd_clap := preload("res://assets/softclap.wav")
|
var snd_clap := preload("res://assets/softclap.wav")
|
||||||
var snd_judgement = [snd_clap, snd_clap, snd_clap, snd_clap]
|
var snd_count_in := snd_clap
|
||||||
|
var snd_judgement := {
|
||||||
## Constants for the overall notefield
|
0: snd_clap,
|
||||||
#var GameTheme.RADIAL_COL_ANGLES := PoolRealArray() # ideally const
|
1: snd_clap,
|
||||||
#var GameTheme.RADIAL_UNIT_VECTORS := PoolVector2Array() # ideally const
|
-1: snd_clap,
|
||||||
#
|
2: snd_clap,
|
||||||
#func init_radial_values():
|
-2: snd_clap,
|
||||||
# for i in range(Rules.COLS):
|
3: snd_miss,
|
||||||
# var angle = deg2rad(fmod(Rules.FIRST_COLUMN_ANGLE_DEG + (i * Rules.COLS_ANGLE_DEG), 360.0))
|
-3: snd_miss,
|
||||||
# GameTheme.RADIAL_COL_ANGLES.push_back(angle)
|
"MISS": snd_miss
|
||||||
# GameTheme.RADIAL_UNIT_VECTORS.push_back(Vector2(cos(angle), sin(angle)))
|
}
|
||||||
|
var db_judgement := {
|
||||||
|
0: 0.0,
|
||||||
|
1: -1.5,
|
||||||
|
-1: -1.5,
|
||||||
|
2: -3.0,
|
||||||
|
-2: -3.0,
|
||||||
|
3: -6.0,
|
||||||
|
-3: -6.0,
|
||||||
|
"MISS": 0.0
|
||||||
|
}
|
||||||
|
var pitch_judgement := {
|
||||||
|
0: 1.0,
|
||||||
|
-1: 1.0/0.75,
|
||||||
|
1: 0.75,
|
||||||
|
-2: 1.0/0.60,
|
||||||
|
2: 0.60,
|
||||||
|
-3: 1.5,
|
||||||
|
3: 1.5,
|
||||||
|
"MISS": 1.0
|
||||||
|
}
|
||||||
|
|
||||||
const SQRT2 := sqrt(2)
|
const SQRT2 := sqrt(2)
|
||||||
const DEG45 := deg2rad(45.0)
|
const DEG45 := deg2rad(45.0)
|
||||||
|
@ -238,7 +258,7 @@ func make_slide_trail_mesh(note) -> ArrayMesh:
|
||||||
#----------------------------------------------------------------------------------------------------------------------------------------------
|
#----------------------------------------------------------------------------------------------------------------------------------------------
|
||||||
func activate_note(note, judgement):
|
func activate_note(note, judgement):
|
||||||
active_judgement_texts.append({col=note.column, judgement=judgement, time=t})
|
active_judgement_texts.append({col=note.column, judgement=judgement, time=t})
|
||||||
SFXPlayer.play(SFXPlayer.Type.NON_POSITIONAL, self, snd_judgement[judgement])
|
SFXPlayer.play(SFXPlayer.Type.NON_POSITIONAL, self, snd_judgement[judgement], db_judgement[judgement], pitch_judgement[judgement])
|
||||||
scores[note.type][judgement] += 1
|
scores[note.type][judgement] += 1
|
||||||
|
|
||||||
note.time_activated = t
|
note.time_activated = t
|
||||||
|
@ -255,7 +275,7 @@ func button_pressed(col):
|
||||||
continue
|
continue
|
||||||
if note.time_activated != INF:
|
if note.time_activated != INF:
|
||||||
continue
|
continue
|
||||||
var hit_delta = (t - note.time_hit) * 60.0/bpm # Judgement times are in seconds not gametime
|
var hit_delta = real_time(t - note.time_hit) # Judgement times are in seconds not gametime
|
||||||
if hit_delta >= 0.0:
|
if hit_delta >= 0.0:
|
||||||
if hit_delta > Rules.JUDGEMENT_TIMES_POST[-1]:
|
if hit_delta > Rules.JUDGEMENT_TIMES_POST[-1]:
|
||||||
continue # missed
|
continue # missed
|
||||||
|
@ -359,14 +379,6 @@ func _draw():
|
||||||
# draw_mesh(mesh, tex)
|
# draw_mesh(mesh, tex)
|
||||||
|
|
||||||
var textmesh := ArrayMesh.new()
|
var textmesh := ArrayMesh.new()
|
||||||
# make_judgement_text(textmesh, TextWord.PERFECT+TextStyle.ARC, 0, fmod(t, 1.0))
|
|
||||||
# make_judgement_text(textmesh, TextWord.GREAT+TextStyle.ARC_LATE, 1, ease(fmod(t, 1.0), 1.25))
|
|
||||||
# make_judgement_text(textmesh, TextWord.GOOD+TextStyle.ARC_EARLY, 2, clamp(fmod(t, 2.0)-1, 0, 1))
|
|
||||||
# make_judgement_text(textmesh, TextWord.ALMOST+TextStyle.ARC_LATE, 3, ease(clamp(fmod(t, 2.0)-1, 0, 1), 1.25))
|
|
||||||
# make_judgement_text(textmesh, TextWord.MISS+TextStyle.ARC, 4, clamp(fmod(t, 2.0)-0.5, 0, 1))
|
|
||||||
# make_judgement_text(textmesh, TextWord.NICE+TextStyle.ARC, 5, ease(clamp(fmod(t, 2.0)-0.5, 0, 1), 1.25))
|
|
||||||
# make_judgement_text(textmesh, TextWord.OK+TextStyle.ARC, 6, fmod(t, 2.0)*0.5)
|
|
||||||
# make_judgement_text(textmesh, TextWord.NG+TextStyle.ARC, 7, ease(fmod(t, 2.0)*0.5, 1.25))
|
|
||||||
for text in active_judgement_texts:
|
for text in active_judgement_texts:
|
||||||
make_judgement_text(textmesh, TextJudgement[text.judgement], text.col, (t-text.time)/GameTheme.judge_text_duration)
|
make_judgement_text(textmesh, TextJudgement[text.judgement], text.col, (t-text.time)/GameTheme.judge_text_duration)
|
||||||
$JudgeText.set_mesh(textmesh)
|
$JudgeText.set_mesh(textmesh)
|
||||||
|
@ -432,20 +444,23 @@ func _ready():
|
||||||
$"/root/main/InputHandler".connect("touchbutton_released", self, "touchbutton_released")
|
$"/root/main/InputHandler".connect("touchbutton_released", self, "touchbutton_released")
|
||||||
|
|
||||||
|
|
||||||
|
func intro_click():
|
||||||
|
SFXPlayer.play(SFXPlayer.Type.NON_POSITIONAL, self, snd_count_in)
|
||||||
|
|
||||||
func game_time(realtime: float) -> float:
|
func game_time(realtime: float) -> float:
|
||||||
return time * bpm / 60.0
|
return realtime * bpm / 60.0
|
||||||
|
|
||||||
|
func real_time(gametime: float) -> float:
|
||||||
|
return gametime * 60.0 / bpm
|
||||||
|
|
||||||
func video_start_time() -> float:
|
func video_start_time() -> float:
|
||||||
# We give a 4 beat delay until the first note of the chart. Should have a sound for each beat.
|
return -sync_offset_video
|
||||||
var four_beats := 4.0 * 60.0/bpm
|
|
||||||
return four_beats - sync_offset_video
|
|
||||||
|
|
||||||
func audio_start_time() -> float:
|
func audio_start_time() -> float:
|
||||||
var four_beats := 4.0 * 60.0/bpm
|
return -sync_offset_audio
|
||||||
return four_beats - sync_offset_audio
|
|
||||||
|
|
||||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||||
|
var timers_set := false
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
$meshinstance.material.set_shader_param("bps", bpm/60.0)
|
$meshinstance.material.set_shader_param("bps", bpm/60.0)
|
||||||
$notelines.material.set_shader_param("bps", bpm/60.0)
|
$notelines.material.set_shader_param("bps", bpm/60.0)
|
||||||
|
@ -454,6 +469,19 @@ func _process(delta):
|
||||||
time += delta
|
time += delta
|
||||||
t = game_time(time)
|
t = game_time(time)
|
||||||
|
|
||||||
|
if (not timers_set) and (t > -5.0):
|
||||||
|
timers_set = true
|
||||||
|
for i in [-4.0, -3.0, -2.0, -1.0]:
|
||||||
|
var delay := real_time(i) - time
|
||||||
|
var timer = Timer.new()
|
||||||
|
timer.set_one_shot(false)
|
||||||
|
# timer.set_timer_process_mode(Timer.TIMER_PROCESS_FIXED)
|
||||||
|
timer.set_wait_time(delay)
|
||||||
|
timer.connect("timeout", self, "intro_click")
|
||||||
|
timer.start()
|
||||||
|
add_child(timer)
|
||||||
|
timer.connect("timeout", timer, "queue_free")
|
||||||
|
|
||||||
# if (t_old < 0) and (t >= 0):
|
# if (t_old < 0) and (t >= 0):
|
||||||
# get_node("/root/main/video").play()
|
# get_node("/root/main/video").play()
|
||||||
var vt_delta := time - video_start_time()
|
var vt_delta := time - video_start_time()
|
||||||
|
@ -475,7 +503,7 @@ func _process(delta):
|
||||||
active_judgement_texts.append({col=note.column, judgement="MISS", time=t})
|
active_judgement_texts.append({col=note.column, judgement="MISS", time=t})
|
||||||
scores[note.type]["MISS"] += 1
|
scores[note.type]["MISS"] += 1
|
||||||
note.missed = true
|
note.missed = true
|
||||||
SFXPlayer.play(SFXPlayer.Type.NON_POSITIONAL, self, snd_miss)
|
SFXPlayer.play(SFXPlayer.Type.NON_POSITIONAL, self, snd_judgement["MISS"], db_judgement["MISS"])
|
||||||
|
|
||||||
# Clean out expired judgement texts
|
# Clean out expired judgement texts
|
||||||
# By design they will always be in order so we can ignore anything past the first index
|
# By design they will always be in order so we can ignore anything past the first index
|
||||||
|
|
12
Rules.gd
12
Rules.gd
|
@ -9,9 +9,9 @@ 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_TIERS := 4
|
||||||
const JUDGEMENT_TIMES_PRE := [0.040, 0.090, 0.135, 0.175]
|
const JUDGEMENT_TIMES_PRE := [0.040, 0.090, 0.125, 0.150]
|
||||||
const JUDGEMENT_TIMES_POST := [0.040, 0.090, 0.135, 0.175]
|
const JUDGEMENT_TIMES_POST := [0.040, 0.090, 0.125, 0.150]
|
||||||
const JUDGEMENT_TIMES_RELEASE_PRE := [0.050, 0.090, 0.135, 0.175]
|
const JUDGEMENT_TIMES_RELEASE_PRE := [0.040, 0.090, 0.125, 0.150]
|
||||||
const JUDGEMENT_TIMES_RELEASE_POST := [0.100, 0.140, 0.155, 0.225] # Small grace period
|
const JUDGEMENT_TIMES_RELEASE_POST := [0.090, 0.140, 0.175, 0.200] # Small grace period
|
||||||
const JUDGEMENT_TIMES_SLIDE_PRE := [0.090, 0.135, 0.180, 0.225] # Small grace period, sort-of
|
const JUDGEMENT_TIMES_SLIDE_PRE := [0.090, 0.140, 0.175, 0.200] # Small grace period, sort-of
|
||||||
const JUDGEMENT_TIMES_SLIDE_POST := [0.090, 0.135, 0.180, 0.225]
|
const JUDGEMENT_TIMES_SLIDE_POST := [0.090, 0.140, 0.175, 0.200]
|
Loading…
Reference in New Issue