Skip to content

Commit

Permalink
use end of song, track break after last note
Browse files Browse the repository at this point in the history
  • Loading branch information
jnackmclain committed Nov 5, 2024
1 parent a16bcb5 commit 55bec79
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 29 deletions.
3 changes: 2 additions & 1 deletion _ark/config/midi_parsers.dta
Original file line number Diff line number Diff line change
Expand Up @@ -2702,7 +2702,8 @@
$banddirector}
{$banddirector
set_end
{beat_to_seconds $mp.start}}})}
{beat_to_seconds $mp.start}}
{set $dx_end_of_song $mp.start}})}
{new
MidiParser
trainer_events_pro_drums
Expand Down
77 changes: 51 additions & 26 deletions _ark/dx/track/hud_ui/dx_hud_ui_funcs.dta
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,18 @@
}
$outarray
}
{func
dx_get_final_note
{beatmatch foreach_active_player $player
{switch {$player instrument}
((real_guitar guitar) {set $out_end $dx_final_note_guitar})
((real_bass bass) {set $out_end $dx_final_note_bass})
((real_drum drum) {set $out_end $dx_final_note_drum})
((real_keys keys) {set $out_end $dx_final_note_keys})
}
}
$out_end
}
{func
dx_new_set_song_progress
($enabled)
Expand All @@ -184,7 +196,9 @@
{if {&& $enabled $dx_mtvup {! {gamemode in_mode trainer}}}
{set_this {coop_track_panel find scoreboard}}
{set $curr_beat {dx_get_current_beat}}
{set $total_beat $dx_final_note}
{set $total_beat $dx_end_of_song}
{set $this_final_note {* {/ {dx_get_final_note} $total_beat} 100}}
{set $this_checked_final_note {int {* $this_final_note 2}}}
{if {>= $curr_beat 1}
{set $this_percent_complete {* {/ $curr_beat $total_beat} 100}}
{if {> $this_percent_complete 100}
Expand All @@ -198,24 +212,27 @@
{set $addspace "<alt>.</alt>"}
{set $this_highest_start 0}
{set $this_highest_end 0}
;progress bar
{foreach_int $i 0 $this_checked_complete ;check every number from 0-200 (100% with 200 ticks)
{if {< $i {- $this_checked_complete 2}} ;don't check the final two numbers
{if_else $outbar ;make sure the bar has a string to sprint with
{do
{set $out_needle {sprint $outbar $addspace}} ;set the needle to our current position
{foreach $entry {dx_get_this_countdown_array} ;check every entry in the guitar note tracker array
{if_else {== {int {/ $i 2}} {int {* {/ {elem $entry 1} $total_beat} 100}}} ;if our current int percent matches the int percent of the start of the break
{do
{if_else {== {elem $entry 1} 0}
{set $this_percent_start 0} ;set this current break to 0 without any math bits
{set $this_percent_start {int {* {* {/ {elem $entry 1} $total_beat} 100} 2}}} ;set this current break in and out points
{if {has_substr {elem $entry 0} "delay_"}
{if_else {== {int {/ $i 2}} {int {* {/ {elem $entry 1} $total_beat} 100}}} ;if our current int percent matches the int percent of the start of the break
{do
{if_else {== {elem $entry 1} 0}
{set $this_percent_start 0} ;set this current break to 0 without any math bits
{set $this_percent_start {int {* {* {/ {elem $entry 1} $total_beat} 100} 2}}} ;set this current break in and out points
}
{set $this_percent_end {int {* {* {/ {elem $entry 2} $total_beat} 100} 2}}}
}
{set $this_percent_end {int {* {* {/ {elem $entry 2} $total_beat} 100} 2}}}
{set $this_set FALSE} ;do nothing
}
{set $this_set FALSE} ;do nothing
}
}
{if_else {&& {>= $i $this_percent_start} {<= $i $this_percent_end}} ;if we within our current break in and out points
{if_else {|| {>= $i $this_checked_final_note} {&& {>= $i $this_percent_start} {<= $i $this_percent_end}}} ;if we within our current break in and out points
{set $outbar {sprint $outbar $addspace}} ;add a space
{set $outbar {sprint $outbar $addchar}} ;add a character if we are not in a break
}
Expand All @@ -224,27 +241,35 @@
}
}
}
;progress bar backer
{foreach_int $i 0 200
{if_else $out_backer
{do
{foreach $entry {dx_get_this_countdown_array}
{if_else {== {int {/ $i 2}} {int {* {/ {elem $entry 1} $total_beat} 100}}}
{do
{if_else {== {elem $entry 1} 0}
{set $this_percent_start 0} ;set this current break to 0 without any math bits
{set $this_percent_start {int {* {* {/ {elem $entry 1} $total_beat} 100} 2}}} ;set this current break in and out points
{if_else {>= $i 198}
{if {&& {!= $i 199} {!= $i 200}}
{set $out_backer {sprint $out_backer $addchar $addchar}} ;ensure the last line is always a char
}
{if_else $out_backer
{do
{foreach $entry {dx_get_this_countdown_array}
{if {has_substr {elem $entry 0} "delay_"}
{if_else {== {int {/ $i 2}} {int {* {/ {elem $entry 1} $total_beat} 100}}}
{do
{if_else {== {elem $entry 1} 0}
{set $this_percent_start 0} ;set this current break to 0 without any math bits
{set $this_percent_start {int {* {* {/ {elem $entry 1} $total_beat} 100} 2}}} ;set this current break in and out points
}
{set $this_percent_end {int {* {* {/ {elem $entry 2} $total_beat} 100} 2}}}
}
{set $this_set FALSE}
}
{set $this_percent_end {int {* {* {/ {elem $entry 2} $total_beat} 100} 2}}}
}
{set $this_set FALSE}
}
{if_else {|| {>= $i $this_checked_final_note} {&& {>= $i $this_percent_start} {<= $i $this_percent_end}}}
{set $out_backer {sprint $out_backer $addspace}}
{set $out_backer {sprint $out_backer $addchar}}
}
}
{if_else {&& {>= $i $this_percent_start} {<= $i $this_percent_end}}
{set $out_backer {sprint $out_backer $addspace}}
{set $out_backer {sprint $out_backer $addchar}}
}
{set $out_backer $addchar}
}
{set $out_backer $addchar}
}
}
{if_else $outbar
Expand Down Expand Up @@ -304,7 +329,7 @@
(down
{do
{set $curr_ms {beatmatch get_song_ms}} ;current time in ms
{set $total_ms {int {* {+ {beat_to_seconds $dx_final_note} 1} 1000}}} ;grab current song length in ms
{set $total_ms {int {* {+ {beat_to_seconds $dx_end_of_song} 1} 1000}}} ;grab current song length in ms
{set $timer_ms {- $total_ms $curr_ms}} ;calc remaining time
{if {< $timer_ms 0} {set $timer_ms 0}} ;failsafe, if less than 0, force to 0
{if {> $timer_ms $total_ms} {set $timer_ms $total_ms}} ;failsafe, if greater than total, force to total
Expand Down Expand Up @@ -338,7 +363,7 @@
(up
{do
{set $curr_ms {beatmatch get_song_ms}} ;current time in ms
{set $total_ms {int {* {+ {beat_to_seconds $dx_final_note} 1} 1000}}} ;grab current song length in ms
{set $total_ms {int {* {+ {beat_to_seconds $dx_end_of_song} 1} 1000}}} ;grab current song length in ms
;{set $timer_ms $dx_current_progress_ms} ;calc remaining time
{if {< $curr_ms 0} {set $curr_ms 0}} ;failsafe, if less than 0, force to 0
{if {> $curr_ms $total_ms} {set $curr_ms $total_ms}} ;failsafe, if greater than total, force to total
Expand Down
2 changes: 1 addition & 1 deletion _ark/dx/track/track_ui/dx_track_overdrive_ui_funcs.dta
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{if $dx_mtvup
{set_this {find_obj DX_GEMTRACKDIR band_power_meter}}
{set $curr_ms {beatmatch get_song_ms}}
{set $total_ms {int {* {+ {beat_to_seconds $dx_final_note} 1} 1000}}}
{set $total_ms {int {* {+ {beat_to_seconds $dx_end_of_song} 1} 1000}}}
{set $percent_complete {/ $curr_ms $total_ms}}
{tour_meter_wipe.anim set_frame 0}
;{tour_meter_wipe.anim set_frame $percent_complete}
Expand Down
2 changes: 1 addition & 1 deletion _ark/dx/track/track_ui/dx_track_ui_funcs.dta
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{set_this {find_obj DX_GEMTRACKDIR band_power_meter}}
{tour_configure_challenge.anim set_frame 1}
{set $curr_ms {beatmatch get_song_ms}} ;current time in ms
{set $total_ms {int {* {+ {beat_to_seconds $dx_final_note} 1} 1000}}} ;grab current song length in ms
{set $total_ms {int {* {+ {beat_to_seconds $dx_end_of_song} 1} 1000}}} ;grab current song length in ms
{set $percent_complete {/ $curr_ms $total_ms}}
{tour_meter_wipe.anim set_frame 0} ;disabled for now
;{tour_meter_wipe.anim set_frame $percent_complete}
Expand Down

0 comments on commit 55bec79

Please sign in to comment.