Skip to content

Commit

Permalink
fix song timer math
Browse files Browse the repository at this point in the history
  • Loading branch information
jnackmclain committed Nov 4, 2024
1 parent b664916 commit 8378bcd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions _ark/dx/track/hud_ui/dx_hud_ui_funcs.dta
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@
(down
{do
{set $curr_ms {beatmatch get_song_ms}} ;current time in ms
{set $total_ms {beat_to_seconds {int {* {+ $dx_final_note 1} 1000}}}} ;grab current song length in ms
{set $total_ms {int {* {+ {beat_to_seconds $dx_final_note} 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 @@ -271,7 +271,7 @@
(up
{do
{set $curr_ms {beatmatch get_song_ms}} ;current time in ms
{set $total_ms {beat_to_seconds {int {* {+ $dx_final_note 1} 1000}}}} ;grab current song length in ms
{set $total_ms {int {* {+ {beat_to_seconds $dx_final_note} 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 {beat_to_seconds {int {* {+ $dx_final_note 1} 1000}}}}
{set $total_ms {int {* {+ {beat_to_seconds $dx_final_note} 1} 1000}}}
{set $percent_complete {/ $curr_ms $total_ms}}
{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 {beat_to_seconds {int {* {+ $dx_final_note 1} 1000}}}} ;grab current song length in ms
{set $total_ms {int {* {+ {beat_to_seconds $dx_final_note} 1} 1000}}} ;grab current song length in ms
{set $percent_complete {/ $curr_ms $total_ms}}
{tour_meter_wipe.anim set_frame $percent_complete}
;{tour_meter_wipe.anim animate (period 20) (dest 1)}
Expand Down

0 comments on commit 8378bcd

Please sign in to comment.