diff --git a/audio/sort_wheel/enter.wav b/audio/sort_wheel/enter.wav new file mode 100644 index 0000000..2a1785d Binary files /dev/null and b/audio/sort_wheel/enter.wav differ diff --git a/audio/sort_wheel/leave.wav b/audio/sort_wheel/leave.wav new file mode 100644 index 0000000..4ba003c Binary files /dev/null and b/audio/sort_wheel/leave.wav differ diff --git a/scripts/common/common.lua b/scripts/common/common.lua new file mode 100644 index 0000000..91427a1 --- /dev/null +++ b/scripts/common/common.lua @@ -0,0 +1,13 @@ + + +local stopMusic = function () + local musicPlaying = game.GetSkinSetting('_musicPlaying'); + if musicPlaying and musicPlaying ~= '' then + game.StopSample(musicPlaying); + game.SetSkinSetting("_musicPlaying", "") + end +end + +return { + stopMusic = stopMusic +} \ No newline at end of file diff --git a/scripts/multiplayerscreen.lua b/scripts/multiplayerscreen.lua index ad6b066..3df4f8a 100644 --- a/scripts/multiplayerscreen.lua +++ b/scripts/multiplayerscreen.lua @@ -1,5 +1,7 @@ json = require "json" +local common = require('common.common'); + local resX,resY = game.GetResolution() local mposx = 0; @@ -742,6 +744,7 @@ render = function(deltaTime) mposx,mposy = game.GetMousePos(); portrait = resY > resX + common.stopMusic(); doffset = doffset * 0.9 ioffset = ioffset * 0.9 diff --git a/scripts/result.lua b/scripts/result.lua index dd02f34..cd656ce 100644 --- a/scripts/result.lua +++ b/scripts/result.lua @@ -169,9 +169,8 @@ local handleSfx = function() if not bgSfxPlayed then game.PlaySample("result", true) bgSfxPlayed = true + game.SetSkinSetting('_musicPlaying', 'result'); end - if game.GetButton(game.BUTTON_STA) then game.StopSample("result") end - if game.GetButton(game.BUTTON_BCK) then game.StopSample("result") end end function drawTimingBar(y, value, max, type) diff --git a/scripts/songselect/songwheel.lua b/scripts/songselect/songwheel.lua index 3888ea0..52c99f8 100644 --- a/scripts/songselect/songwheel.lua +++ b/scripts/songselect/songwheel.lua @@ -1,6 +1,7 @@ require('common') local Easing = require('common.easings') local Background = require('components.background'); +local common = require('common.common') local VolforceCalc = require('components.volforceCalc'); @@ -749,6 +750,8 @@ render = function (deltaTime) tickTransitions(deltaTime); gfx.Scale(scale, scale); + common.stopMusic(); + if not difficultyNumbers then difficultyNumbers = load_number_image('diff_num') end diff --git a/scripts/songselect/sortwheel.lua b/scripts/songselect/sortwheel.lua index 0b7922b..cfe44ca 100644 --- a/scripts/songselect/sortwheel.lua +++ b/scripts/songselect/sortwheel.lua @@ -1,6 +1,10 @@ require('common') local Easing = require('common.easings'); +-- AUDIO +game.LoadSkinSample('sort_wheel/enter.wav'); +game.LoadSkinSample('sort_wheel/leave.wav'); + -- IMAGES local panelBgImage = gfx.CreateSkinImage('song_select/sort_wheel/bg.png', 0) local activeItemBgImage = gfx.CreateSkinImage( @@ -42,6 +46,8 @@ local transitionEnterReverse = false; local transitionEnterScale = 0; local transitionEnterOffsetX = 0; +local previousActiveState = false; + function resetLayoutInformation() resx, resy = game.GetResolution() scale = resx / desw @@ -185,6 +191,16 @@ function render(deltaTime, shown) resetLayoutInformation() gfx.Scale(scale, scale) + if (shown ~= previousActiveState) then + if (shown) then + game.PlaySample('sort_wheel/enter.wav'); + else + game.PlaySample('sort_wheel/leave.wav'); + end + + previousActiveState = shown; + end + if not shown then transitionEnterReverse = true if (transitionEnterScale > 0) then drawSortWheel(deltaTime) end diff --git a/scripts/transition.lua b/scripts/transition.lua index de4e3ba..11e5c7e 100644 --- a/scripts/transition.lua +++ b/scripts/transition.lua @@ -32,6 +32,7 @@ function render(deltaTime) game.PlaySample('transition_screen/transition_enter.wav'); wasEnterSfxPlayed = true; end + gfx.BeginPath(); gfx.ImageRect(0, 0, resx, resy, transitionEnterAnimation, 1, 0); gfx.GlobalAlpha(1); @@ -48,6 +49,7 @@ function render_out(deltaTime) local leaveAnimeTickRes = gfx.TickAnimation(transitionLeaveAnimation, deltaTime); if leaveAnimeTickRes == 0 then + gfx.BeginPath(); gfx.ImageRect(0, 0, resx, resy, transitionEnterAnimation, 1, 0); else if not wasLeaveSfxPlayed then @@ -55,6 +57,7 @@ function render_out(deltaTime) wasLeaveSfxPlayed = true; end + gfx.BeginPath(); gfx.ImageRect(0, 0, resx, resy, transitionLeaveAnimation, 1, 0); outTimer = outTimer + (1/60) / 0.5 end