diff --git a/assets/gamefunc.lua b/assets/gamefunc.lua index 1565ad77..e4428eb6 100644 --- a/assets/gamefunc.lua +++ b/assets/gamefunc.lua @@ -6,24 +6,28 @@ function sureCheck(event) end end -function drawInteriorGlitch() - GC.replaceTransform(SCR.origin) +function drawGlitch() local setc,rect=GC.setColor,GC.rectangle local t=love.timer.getTime() local cellSize=math.min(SCR.w,SCR.h)/26 + GC.replaceTransform(SCR.origin) for x=0,SCR.w,cellSize do for y=0,SCR.h,cellSize do setc(1,1,1,(math.floor(t*2.6)*(x*26+62)*(y*42+24))/10%2.6%.042) rect('fill',x,y,cellSize,cellSize) end end - - -- GC.scale(1,SCR.h) - -- local a=1/26 - -- for i=0,26 do - -- setc(1,1,1,(math.floor(t*2.6+i/6)*(26+i))%0.026) - -- rect('fill',0,a*(i-t%1),SCR.w,a*.42) - -- end +end +function drawGlitch2() + local setc,rect=GC.setColor,GC.rectangle + local t=love.timer.getTime() + local a=1/26 + GC.replaceTransform(SCR.origin) + GC.scale(1,SCR.h) + for i=0,26 do + setc(1,1,1,(math.floor(t*2.6+i/6)*(26+i))%0.0355) + rect('fill',0,a*(i-2.6*t%1),SCR.w,a*.355) + end end local _bgmPlaying ---@type string? diff --git a/assets/progress.lua b/assets/progress.lua index 8f3f3719..eb6201ba 100644 --- a/assets/progress.lua +++ b/assets/progress.lua @@ -206,6 +206,7 @@ function PROGRESS.applyExteriorBG() BG.set(prgs.main==3 and 'space' or 'galaxy') local function fuse() repeat TASK.yieldT(6.26) until SCN.cur~='main_in' FMOD.effect.keyOff('music_glitch') + TASK.unlock('musicroom_glitchFX') end function PROGRESS.applyInteriorBGM() playBgm('blank',prgs.main~=1) diff --git a/assets/scene/keyset_in.lua b/assets/scene/keyset_in.lua index 469cef27..1dd552cb 100644 --- a/assets/scene/keyset_in.lua +++ b/assets/scene/keyset_in.lua @@ -63,7 +63,7 @@ end function scene.overDraw() -- Glitch effect after III if PROGRESS.get('main')>=3 then - drawInteriorGlitch() + drawGlitch() end end diff --git a/assets/scene/keyset_touch_in.lua b/assets/scene/keyset_touch_in.lua index 8c302c37..13588599 100644 --- a/assets/scene/keyset_touch_in.lua +++ b/assets/scene/keyset_touch_in.lua @@ -52,7 +52,7 @@ function scene.draw() VCTRL.draw(true) end function scene.overDraw() -- Glitch effect after III if PROGRESS.get('main')>=3 then - drawInteriorGlitch() + drawGlitch() end end diff --git a/assets/scene/lang_in.lua b/assets/scene/lang_in.lua index 113e4d3e..778ccdcf 100644 --- a/assets/scene/lang_in.lua +++ b/assets/scene/lang_in.lua @@ -57,7 +57,7 @@ end function scene.overDraw() -- Glitch effect after III if PROGRESS.get('main')>=3 then - drawInteriorGlitch() + drawGlitch() end end diff --git a/assets/scene/main_in.lua b/assets/scene/main_in.lua index 8d9bc095..443cab9c 100644 --- a/assets/scene/main_in.lua +++ b/assets/scene/main_in.lua @@ -99,7 +99,7 @@ function scene.overDraw() -- Glitch effect after III if PROGRESS.get('main')>=3 then - drawInteriorGlitch() + drawGlitch() end end diff --git a/assets/scene/musicroom.lua b/assets/scene/musicroom.lua index af4b8935..0d68aacf 100644 --- a/assets/scene/musicroom.lua +++ b/assets/scene/musicroom.lua @@ -131,6 +131,13 @@ local function searchMusic(str) musicListBox:select(bestID) end end +local function timeBomb() + TASK.yieldT(26) + if TASK.getLock('musicroom_glitchFX') then + FMOD.effect.keyOff('music_glitch') + TASK.unlock('musicroom_glitchFX') + end +end function scene.keyDown(key,isRep) scene.focus(true) local act=KEYMAP.sys:getAction(key) @@ -140,7 +147,7 @@ function scene.keyDown(key,isRep) if FMOD.music.getPlaying() then local now=FMOD.music.tell() local dur=FMOD.music.getDuration() - FMOD.music.seek(key=='left' and max(now-5,0) or (now+5)%dur) + FMOD.music.seek(act=='left' and max(now-5,0) or (now+5)%dur) end elseif key=='backspace' or key=='delete' then searchStr="" @@ -183,6 +190,11 @@ function scene.keyDown(key,isRep) elseif key=='`' and isAltPressed() then noProgress=true scene.load() + elseif key=='f3' then + if TASK.lock('musicroom_glitchFX') then + FMOD.effect('music_glitch') + TASK.new(timeBomb) + end end end return true @@ -331,6 +343,12 @@ function scene.draw() end end +function scene.overDraw() + if TASK.getLock('musicroom_glitchFX') then + drawGlitch2() + end +end + scene.widgetList={ {type='button_fill',pos={0,0},x=120,y=60,w=180,h=70,color='B',cornerR=15,sound_trigger='button_back',fontSize=40,text=backText,code=WIDGET.c_backScn'fadeHeader'}, {type='text',pos={0,0},x=240,y=60,alignX='left',fontType='bold',fontSize=60,text=LANG'musicroom_title'}, diff --git a/assets/scene/setting_in.lua b/assets/scene/setting_in.lua index 29bb8e4d..dc7fb91b 100644 --- a/assets/scene/setting_in.lua +++ b/assets/scene/setting_in.lua @@ -39,7 +39,7 @@ function scene.overDraw() -- Glitch effect after III if PROGRESS.get('main')>=3 then - drawInteriorGlitch() + drawGlitch() end end diff --git a/assets/scene/tutorial_in.lua b/assets/scene/tutorial_in.lua index bf41d42a..33e9e9b6 100644 --- a/assets/scene/tutorial_in.lua +++ b/assets/scene/tutorial_in.lua @@ -84,7 +84,7 @@ end function scene.overDraw() -- Glitch effect after III if PROGRESS.get('main')>=3 then - drawInteriorGlitch() + drawGlitch() end end