Skip to content

Commit

Permalink
Attach wifetwirl chart preview logic to sample music playing
Browse files Browse the repository at this point in the history
the order of operations is basically
- song switch -> settle -> check to see if we play sample music -> delayed chart update message -> play sample music -> play sample music message
  • Loading branch information
poco0317 committed Jul 20, 2020
1 parent 0434bf6 commit 373667a
Showing 1 changed file with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ local songChanged2 = false
local previewVisible = false
local justChangedStyles = false
local onlyChangedSteps = false
local shouldPlayMusic = false
local prevtab = 0

local itsOn = false
Expand Down Expand Up @@ -189,7 +190,7 @@ local t =
local s = GAMESTATE:GetCurrentSong()
local unexpectedlyChangedSong = s ~= song

local shouldPlayMusic = false
shouldPlayMusic = false
-- should play the music because the notefield is visible
shouldPlayMusic = shouldPlayMusic or (noteField and mcbootlarder:GetChild("NoteField") and mcbootlarder:GetChild("NoteField"):IsVisible())
-- should play the music if we switched songs while on a different tab
Expand All @@ -200,17 +201,27 @@ local t =
-- should play the music if we already should and we either jumped song or we didnt change the style/song
shouldPlayMusic = shouldPlayMusic and ((not justChangedStyles and not onlyChangedSteps) or unexpectedlyChangedSong) and not tryingToStart

if s and shouldPlayMusic then
if mcbootlarder and mcbootlarder:GetChild("NoteField") then mcbootlarder:GetChild("NoteField"):diffusealpha(1) end
playMusicForPreview(s)
end
ms.ok(shouldPlayMusic and 1 or 0)
-- at this point the music will or will not play ....

boolthatgetssettotrueonsongchangebutonlyifonatabthatisntthisone = false
hackysack = false
justChangedStyles = false
tryingToStart = false
songChanged = false
onlyChangedSteps = true
end,
PlayingSampleMusicMessageCommand = function(self)
-- delay setting the music for preview up until after the sample music starts (smoothness)
if shouldPlayMusic then
shouldPlayMusic = false
local s = GAMESTATE:GetCurrentSong()
if s then
if mcbootlarder and mcbootlarder:GetChild("NoteField") then mcbootlarder:GetChild("NoteField"):diffusealpha(1) end
playMusicForPreview(s)
end
end
end,
MintyFreshCommand = function(self)
self:finishtweening()
local bong = GAMESTATE:GetCurrentSong()
Expand Down

0 comments on commit 373667a

Please sign in to comment.