From b9722dcca1d62f22a3482c79a7fc090c05e6f580 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Thu, 27 Aug 2020 03:52:13 +0800 Subject: [PATCH] =?UTF-8?q?ghost=E5=92=8Ccenter=E9=80=8F=E6=98=8E=E5=BA=A6?= =?UTF-8?q?=E5=8F=AF=E8=B0=83=EF=BC=8C=E9=83=A8=E5=88=86=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E5=80=BC=E5=9F=9F=E6=94=B9=E4=B8=BA[0%,100%]=EF=BC=8C=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6=E4=BA=A4=E4=BA=92=E4=BC=98=E5=8C=96=EF=BC=8C=E6=BB=91?= =?UTF-8?q?=E6=9D=A1=E6=98=BE=E7=A4=BA=E5=BD=93=E5=89=8D=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/bgm.lua | 15 ++--- Zframework/init.lua | 4 +- Zframework/paint.lua | 11 ---- Zframework/sfx.lua | 8 +-- Zframework/voice.lua | 4 +- Zframework/widget.lua | 87 ++++++++++++++++++++----- Zframework/widgetList.lua | 49 ++++++++------- main.lua | 15 +++-- modes/blind_lunatic.lua | 2 +- modes/blind_ultimate.lua | 2 +- modes/blind_wtf.lua | 2 +- modes/classic_fast.lua | 2 +- parts/default_data.lua | 12 ++-- parts/player.lua | 129 +++++++++++++++++++------------------- 14 files changed, 198 insertions(+), 144 deletions(-) diff --git a/Zframework/bgm.lua b/Zframework/bgm.lua index f9270e54..77430ed1 100644 --- a/Zframework/bgm.lua +++ b/Zframework/bgm.lua @@ -3,7 +3,7 @@ local rem=table.remove local function fadeOut(id) local src=BGM.list[id] - local v=src:getVolume()-.025*setting.bgm*.01 + local v=src:getVolume()-.025*setting.bgm src:setVolume(v>0 and v or 0) if v<=0 then src:stop() @@ -12,10 +12,10 @@ local function fadeOut(id) end local function fadeIn(id) local src=BGM.list[id] - local v=setting.bgm*.01 + local v=setting.bgm v=min(v,src:getVolume()+.025*v) src:setVolume(v) - if v>=setting.bgm*.01 then return true end + if v>=setting.bgm then return true end end local BGM={ @@ -68,7 +68,7 @@ function BGM.play(s) end function BGM.freshVolume() if BGM.playing then - local v=setting.bgm*.01 + local v=setting.bgm if v>0 then BGM.playing:setVolume(v) if BGM.suspend then @@ -76,9 +76,10 @@ function BGM.freshVolume() BGM.nowPlay,BGM.suspend=BGM.suspend end else - BGM.playing:setVolume(0) - BGM.playing:pause() - BGM.suspend,BGM.nowPlay=BGM.nowPlay + if BGM.nowPlay then + BGM.playing:pause() + BGM.suspend,BGM.nowPlay=BGM.nowPlay + end end end end diff --git a/Zframework/init.lua b/Zframework/init.lua index 18c9a2f7..d60d8664 100644 --- a/Zframework/init.lua +++ b/Zframework/init.lua @@ -725,7 +725,7 @@ function touchDown.play(id,x,y) if t then players[1]:pressKey(t) if setting.VKSFX>0 then - SFX.play("virtualKey",setting.VKSFX*.25) + SFX.play("virtualKey",setting.VKSFX) end virtualkey[t].isDown=true virtualkey[t].pressTime=10 @@ -878,6 +878,7 @@ end function love.mousereleased(x,y,k,touch,num) if touch or SCN.swapping then return end mx,my=xOy:inverseTransformPoint(x,y) + WIDGET.release(mx,my) if mouseUp[SCN.cur]then mouseUp[SCN.cur](mx,my,k) end @@ -926,6 +927,7 @@ function love.touchreleased(id,x,y) x,y=xOy:inverseTransformPoint(x,y) if id==touching then WIDGET.press(x,y) + WIDGET.release(x,y) touching=nil WIDGET.sel=nil end diff --git a/Zframework/paint.lua b/Zframework/paint.lua index 3afb2236..91350b61 100644 --- a/Zframework/paint.lua +++ b/Zframework/paint.lua @@ -657,9 +657,6 @@ function Pnt.setting_sound() gc.translate(-x,-y) end -local function timeConv(t) - return t.."F "..int(t*16.67).."ms" -end function Pnt.setting_control() --Testing grid line gc.setLineWidth(4) @@ -680,14 +677,6 @@ function Pnt.setting_control() setFont(50) gc.printf(text.preview,320,540,200,"right") - --Floating number - setFont(30) - local _=setting - mStr(timeConv(_.das),226+35*_.das,145) - mStr(timeConv(_.arr),226+35*_.arr,235) - mStr(timeConv(_.sddas),226+35*_.sddas,325) - mStr(timeConv(_.sdarr),226+35*_.sdarr,415) - --Testing O mino _=blockSkin[setting.skin[6]] local x=550+40*sceneTemp.pos diff --git a/Zframework/sfx.lua b/Zframework/sfx.lua index d632ba0d..4b490322 100644 --- a/Zframework/sfx.lua +++ b/Zframework/sfx.lua @@ -52,13 +52,13 @@ function SFX.play(s,vol,pos) S=S[n]--AU_SRC if S:getChannelCount()==1 then if pos then - pos=pos*setting.stereo*.1 + pos=pos*setting.stereo S:setPosition(pos,1-pos^2,0) else S:setPosition(0,0,0) end end - S:setVolume(((vol or 1)*setting.sfx*.01)^1.626) + S:setVolume(((vol or 1)*setting.sfx)^1.626) S:play() end function SFX.fplay(s,vol,pos) @@ -76,13 +76,13 @@ function SFX.fplay(s,vol,pos) S=S[n]--AU_SRC if S:getChannelCount()==1 then if pos then - pos=pos*setting.stereo*.1 + pos=pos*setting.stereo S:setPosition(pos,1-pos^2,0) else S:setPosition(0,0,0) end end - S:setVolume((vol*.01)^1.626) + S:setVolume(vol^1.626) S:play() end function SFX.reset() diff --git a/Zframework/voice.lua b/Zframework/voice.lua index 1ceb59f4..8f85288b 100644 --- a/Zframework/voice.lua +++ b/Zframework/voice.lua @@ -91,13 +91,13 @@ function VOC.update() end elseif Q.s==1 then--Waiting load source Q[1]=getVoice(Q[1]) - Q[1]:setVolume(setting.voc*.01) + Q[1]:setVolume(setting.voc) Q[1]:play() Q.s=Q[2]and 2 or 4 elseif Q.s==2 then--Playing 1,ready 2 if Q[1]:getDuration()-Q[1]:tell()<.08 then Q[2]=getVoice(Q[2]) - Q[2]:setVolume(setting.voc*.01) + Q[2]:setVolume(setting.voc) Q[2]:play() Q.s=3 end diff --git a/Zframework/widget.lua b/Zframework/widget.lua index 22cb7c21..5937af40 100644 --- a/Zframework/widget.lua +++ b/Zframework/widget.lua @@ -4,6 +4,7 @@ local int,abs=math.floor,math.abs local format=string.format local color=color local setFont=setFont +local Timer=love.timer.getTime local button={ type="button", @@ -183,6 +184,21 @@ local slider={ ATV=0,--Activating time(0~8) pos=0,--Position shown } +local sliderShowFunc={ + int=function(S) + return S.disp() + end, + float=function(S) + return int(S.disp()*100)*.01 + end, + percent=function(S) + return int(S.disp()*100).."%" + end, + frame_time=function(S) + S=S.disp() + return S.."F "..int(S*16.67).."ms" + end, +} function slider:reset() self.ATV=0 self.pos=0 @@ -212,7 +228,7 @@ function slider:draw() gc.setColor(1,1,1,.5+ATV*.06) --Units - if self.showUnit then + if not self.smooth then gc.setLineWidth(2) for p=0,self.unit do local x=x+(x2-x)*p/self.unit @@ -225,17 +241,24 @@ function slider:draw() gc.line(x,y,x2,y) --Block - local bx,by,bw,bh=x+(x2-x)*self.pos/self.unit-10-ATV*.5,y-16-ATV,20+ATV,32+2*ATV + local cx=x+(x2-x)*self.pos/self.unit + local bx,by,bw,bh=cx-10-ATV*.5,y-16-ATV,20+ATV,32+2*ATV gc.setColor(.8,.8,.8) gc.rectangle("fill",bx,by,bw,bh) + + local t if ATV>0 then gc.setLineWidth(2) gc.setColor(1,1,1,ATV*.16) gc.rectangle("line",bx+1,by+1,bw-2,bh-2) + if self.show then + setFont(25) + mStr(self:show(),cx,by-30) + end end --Text - local t=self.text + t=self.text if t then gc.setColor(1,1,1) setFont(self.font) @@ -369,14 +392,34 @@ function WIDGET.newSlider(D) D.x+D.w,D.y, }, - unit= D.unit, - showUnit=not D.noUnit, + unit= D.unit or 1, + --smooth=nil, font= D.font, change= D.change, disp= D.disp, code= D.code, hide= D.hide, - }for k,v in next,slider do _[k]=v end return _ + --show= nil, + + lastTime=0, + } + if D.smooth~=nil then + _.smooth=D.smooth + else + _.smooth=_.unit<=1 + end + if D.show then + if type(D.show)=="function"then + _.show=D.show + else + _.show=sliderShowFunc[D.show] + end + elseif _.unit<=1 then + _.show=sliderShowFunc.percent + else + _.show=sliderShowFunc.int + end + for k,v in next,slider do _[k]=v end return _ end function WIDGET.moveCursor(x,y) @@ -402,11 +445,7 @@ function WIDGET.press(x,y) W.code() SFX.play("move",.6) elseif W.type=="slider"then - if not x then return end - local p,P=W.disp(),xW.x+W.w and W.unit or int((x-W.x)*W.unit/W.w+.5) - if p==P then return end - W.code(P) - if W.change then W.change()end + WIDGET.drag(x,y) end if W.hide and W.hide()then WIDGET.sel=nil end end @@ -414,14 +453,32 @@ function WIDGET.drag(x,y,dx,dy) local W=WIDGET.sel if not W then return end if W.type=="slider"then - local p,P=W.disp(),xW.x+W.w and W.unit or int((x-W.x)*W.unit/W.w+.5) - if p==P then return end - W.code(P) - if W.change then W.change()end + if not x then return end + local p=W.disp() + local P=xW.x+W.w and W.unit or(x-W.x)/W.w*W.unit + if not W.smooth then + P=int(P+.5) + end + if p~=P then + W.code(P) + end + if W.change and Timer()-W.lastTime>.18 then + W.lastTime=Timer() + W.change() + end elseif not W:isAbove(x,y)then WIDGET.sel=nil end end +function WIDGET.release(x,y) + local W=WIDGET.sel + if not W then return end + if W.type=="slider"then + W.lastTime=0 + WIDGET.drag(x,y) + end + WIDGET.sel=nil +end function WIDGET.keyPressed(i) if i=="space"or i=="return"then if WIDGET.sel then diff --git a/Zframework/widgetList.lua b/Zframework/widgetList.lua index b2ac2266..f29f3ec9 100644 --- a/Zframework/widgetList.lua +++ b/Zframework/widgetList.lua @@ -1,3 +1,4 @@ +local rnd=math.random local ins,rem=table.insert,table.remove local mobileHide=(system=="Android"or system=="iOS")and function()return true end local function BACK()SCN.back()end @@ -138,7 +139,7 @@ local Widgets={ newButton({name="back", x=1200,y=655,w=120,h=80,color="white", font=40,code=BACK}), }, music={ - newSlider({name="bgm", x=760, y=80, w=400,unit=100, noUnit=true, font=35,change=function()BGM.freshVolume()end,disp=SETval("bgm"),code=SETsto("bgm")}), + newSlider({name="bgm", x=760, y=80, w=400, font=35,disp=SETval("bgm"),code=function(v)setting.bgm=v;BGM.freshVolume()end}), newButton({name="up", x=1100, y=200, w=120,h=120, color="white", font=55,code=pressKey("up")}), newButton({name="play", x=1100, y=340, w=120,h=120, color="white", font=35,code=pressKey("space"),hide=function()return setting.bgm==0 end}), newButton({name="down", x=1100, y=480, w=120,h=120, color="white", font=55,code=pressKey("down")}), @@ -241,7 +242,7 @@ local Widgets={ newButton({name="ctrl", x=290, y=220, w=320,h=80, color="lYellow",font=35,code=function()SCN.go("setting_control")end}), newButton({name="key", x=640, y=220, w=320,h=80, color="lGreen", font=35,code=function()SCN.go("setting_key")end}), newButton({name="touch", x=990, y=220, w=320,h=80, color="lBlue", font=35,code=function()SCN.go("setting_touch")end}), - newSlider({name="reTime", x=350, y=340, w=300,unit=10, font=30,disp=SETval("reTime"), code=SETsto("reTime")}), + newSlider({name="reTime", x=350, y=340, w=300,unit=10, font=30,disp=SETval("reTime"), code=SETsto("reTime"),show=function(S)return(.5+S.disp()*.25).."s"end}), newSlider({name="maxNext", x=350, y=440, w=300,unit=6, font=30,disp=SETval("maxNext"), code=SETsto("maxNext")}), newButton({name="layout", x=460, y=540, w=140,h=70,color="white", font=35,code=function() SCN.go("setting_skin") @@ -255,11 +256,11 @@ local Widgets={ setting_video={ newButton({name="sound", x=200, y=80,w=240,h=80,color="lCyan",font=35,code=function()SCN.swapTo("setting_sound","swipe")end}), newButton({name="game", x=1080, y=80,w=240,h=80,color="lCyan",font=35,code=function()SCN.swapTo("setting_game","swipe")end}), - newSwitch({name="ghost", x=250, y=180,font=35, disp=SETval("ghost"), code=SETrev("ghost")}), - newSwitch({name="smooth", x=250, y=260,font=25, disp=SETval("smooth"), code=SETrev("smooth")}), - newSwitch({name="center", x=500, y=180,font=35, disp=SETval("center"), code=SETrev("center")}), - newSwitch({name="grid", x=500, y=260,font=35, disp=SETval("grid"), code=SETrev("grid")}), - newSwitch({name="bagLine", x=730, y=180,font=30, disp=SETval("bagLine"), code=SETrev("bagLine")}), + newSlider({name="ghost", x=250, y=180,w=200,unit=.6,noUnit=true,font=35,disp=SETval("ghost"),show="percent",code=SETsto("ghost")}), + newSlider({name="center", x=600, y=180,w=200,unit=1, font=35,disp=SETval("center"), code=SETsto("center")}), + newSwitch({name="smooth", x=260, y=260, font=25,disp=SETval("smooth"), code=SETrev("smooth")}), + newSwitch({name="grid", x=480, y=260, font=35,disp=SETval("grid"), code=SETrev("grid")}), + newSwitch({name="bagLine", x=700, y=260, font=30,disp=SETval("bagLine"), code=SETrev("bagLine")}), newSlider({name="lockFX", x=350, y=340,w=373,unit=5, font=32,disp=SETval("lockFX"), code=SETsto("lockFX")}), newSlider({name="dropFX", x=350, y=390,w=373,unit=5, font=32,disp=SETval("dropFX"), code=SETsto("dropFX")}), newSlider({name="moveFX", x=350, y=440,w=373,unit=5, font=32,disp=SETval("moveFX"), code=SETsto("moveFX")}), @@ -294,21 +295,21 @@ local Widgets={ newButton({name="back", x=1140, y=650,w=200,h=80,color="white",font=40,code=BACK}), }, setting_sound={ - newButton({name="game", x=200, y=80,w=240,h=80,color="lCyan",font=35,code=function()SCN.swapTo("setting_game","swipe")end}), - newButton({name="graphic", x=1080, y=80,w=240,h=80,color="lCyan",font=35,code=function()SCN.swapTo("setting_video","swipe")end}), - newSlider({name="sfx", x=180, y=200,w=400,unit=100,noUnit=true,font=35,change=function()SFX.play("blip_1")end, disp=SETval("sfx"), code=SETsto("sfx")}), - newSlider({name="stereo", x=180, y=500,w=400,unit=10, font=35,change=function()SFX.play("move",1,-1)SFX.play("lock",1,1)end, disp=SETval("stereo"), code=SETsto("stereo"),hide=function()return setting.sfx==0 end}), - newSlider({name="spawn", x=180, y=300,w=400,unit=100,noUnit=true,font=30,change=function()SFX.fplay("spawn_1",setting.spawn)end, disp=SETval("spawn"), code=SETsto("spawn")}), - newSlider({name="bgm", x=180, y=400,w=400,unit=100,noUnit=true,font=35,change=function()BGM.freshVolume()end, disp=SETval("bgm"), code=SETsto("bgm")}), - newSlider({name="vib", x=750, y=200,w=400,unit=5, font=28,change=function()VIB(2)end, disp=SETval("vib"), code=SETsto("vib")}), - newSlider({name="voc", x=750, y=300,w=400,unit=100,noUnit=true,font=32,change=function()VOC.play("nya")end, disp=SETval("voc"), code=SETsto("voc")}), - newButton({name="back", x=1140, y=650,w=200,h=80,color="white",font=40,code=BACK}), + newButton({name="game", x=200, y=80,w=240,h=80,color="lCyan", font=35,code=function()SCN.swapTo("setting_game","swipe")end}), + newButton({name="graphic", x=1080, y=80,w=240,h=80,color="lCyan", font=35,code=function()SCN.swapTo("setting_video","swipe")end}), + newSlider({name="sfx", x=180, y=200,w=400, font=35,change=function()SFX.play("blip_1")end, disp=SETval("sfx"), code=SETsto("sfx")}), + newSlider({name="stereo", x=180, y=500,w=400, font=35,change=function()SFX.play("move",1,-1)SFX.play("lock",1,1)end,disp=SETval("stereo"),code=SETsto("stereo"),hide=function()return setting.sfx==0 end}), + newSlider({name="spawn", x=180, y=300,w=400, font=30,change=function()SFX.fplay("spawn_"..rnd(7),setting.spawn)end,disp=SETval("spawn"), code=SETsto("spawn")}), + newSlider({name="bgm", x=180, y=400,w=400, font=35,change=function()BGM.freshVolume()end, disp=SETval("bgm"), code=SETsto("bgm")}), + newSlider({name="vib", x=750, y=200,w=400, unit=5, font=28,change=function()VIB(2)end, disp=SETval("vib"), code=SETsto("vib")}), + newSlider({name="voc", x=750, y=300,w=400, font=32,change=function()VOC.play("nya")end, disp=SETval("voc"), code=SETsto("voc")}), + newButton({name="back", x=1140, y=650,w=200,h=80,color="white", font=40,code=BACK}), }, setting_control={ - newSlider({name="das", x=226, y=200,w=910, unit=26, font=30,disp=SETval("das"), code=SETsto("das")}), - newSlider({name="arr", x=226, y=290,w=525, unit=15, font=30,disp=SETval("arr"), code=SETsto("arr")}), - newSlider({name="sddas", x=226, y=380,w=350, unit=10, font=30,disp=SETval("sddas"), code=SETsto("sddas")}), - newSlider({name="sdarr", x=226, y=470,w=140, unit=4, font=30,disp=SETval("sdarr"), code=SETsto("sdarr")}), + newSlider({name="das", x=226, y=200,w=910, unit=26, font=30,disp=SETval("das"), show="frame_time",code=SETsto("das")}), + newSlider({name="arr", x=226, y=290,w=525, unit=15, font=30,disp=SETval("arr"), show="frame_time",code=SETsto("arr")}), + newSlider({name="sddas", x=226, y=380,w=350, unit=10, font=30,disp=SETval("sddas"), show="frame_time",code=SETsto("sddas")}), + newSlider({name="sdarr", x=226, y=470,w=140, unit=4, font=30,disp=SETval("sdarr"), show="frame_time",code=SETsto("sdarr")}), newSwitch({name="ihs", x=1100, y=290,font=30, disp=SETval("ihs"), code=SETrev("ihs")}), newSwitch({name="irs", x=1100, y=380,font=30, disp=SETval("irs"), code=SETrev("irs")}), newSwitch({name="ims", x=1100, y=470,font=30, disp=SETval("ims"), code=SETrev("ims")}), @@ -394,7 +395,7 @@ local Widgets={ SCN.go("setting_touchSwitch") end}), newButton({name="back", x=760,y=180,w=170,h=80,color="white",font=40,code=BACK}), - newSlider({name="size", x=450,y=265,w=460,unit=14,font=40, + newSlider({name="size", x=450,y=265,w=460,unit=14,font=40,show="vkSize", disp=function() return VK_org[sceneTemp.sel].r/10-1 end, @@ -432,8 +433,8 @@ local Widgets={ newButton({name="pro", x=1120, y=100, w=240,h=80,color="white",font=35,code=function()for i=1,20 do VK_org[i].ava=true end end}), newSwitch({name="hide", x=1170, y=200, font=40,disp=SETval("VKSwitch"),code=SETrev("VKSwitch")}), newSwitch({name="track", x=1170, y=300, font=35,disp=SETval("VKTrack"),code=SETrev("VKTrack")}), - newSlider({name="sfx", x=800, y=380, w=180,unit=4,font=40,change=function()SFX.play("virtualKey",setting.VKSFX*.25)end,disp=SETval("VKSFX"),code=SETsto("VKSFX")}), - newSlider({name="vib", x=800, y=460, w=180,unit=2,font=40,change=function()VIB(setting.VKVIB)end,disp=SETval("VKVIB"),code=SETsto("VKVIB")}), + newSlider({name="sfx", x=800, y=380, w=180, font=40,change=function()SFX.play("virtualKey",setting.VKSFX)end,disp=SETval("VKSFX"),code=SETsto("VKSFX")}), + newSlider({name="vib", x=800, y=460, w=180,unit=2, font=40,change=function()VIB(setting.VKVIB)end,disp=SETval("VKVIB"),code=SETsto("VKVIB")}), newSwitch({name="icon", x=850, y=300, font=40,disp=SETval("VKIcon"),code=SETrev("VKIcon")}), newButton({name="tkset", x=1120, y=420, w=240,h=80,color="white",font=32, code=function() @@ -442,7 +443,7 @@ local Widgets={ hide=function() return not setting.VKTrack end}), - newSlider({name="alpha", x=840, y=540, w=400,unit=10,font=40,disp=SETval("VKAlpha"),code=SETsto("VKAlpha")}), + newSlider({name="alpha", x=840, y=540, w=400,font=40,disp=SETval("VKAlpha"),code=SETsto("VKAlpha")}), newButton({name="back", x=1120, y=620, w=200,h=80,color="white",font=45,code=BACK}), }, setting_trackSetting={ diff --git a/main.lua b/main.lua index b252532c..a8990f30 100644 --- a/main.lua +++ b/main.lua @@ -134,10 +134,17 @@ do end --Update data file - local S=stat - if type(setting.spawn)~="number"then - setting.spawn=0 - end + local S=setting + if type(S.spawn)~="number"then S.spawn=0 end + if type(S.ghost)~="number"then S.ghost=.3 end + if type(S.center)~="number"then S.center=1 end + if S.bgm>1 then S.bgm=S.bgm*.01 end + if S.sfx>1 then S.sfx=S.sfx*.01 end + if S.voc>1 then S.voc=S.voc*.01 end + if S.stereo>1 then S.stereo=S.stereo*.1 end + if S.VKSFX>1 then S.VKSFX=S.VKSFX*.25 end + if S.VKAlpha>1 then S.VKAlpha=S.VKAlpha*.1 end + S=stat if S.version~=gameVersion then S.version=gameVersion newVersionLaunch=true diff --git a/modes/blind_lunatic.lua b/modes/blind_lunatic.lua index 0c733469..169f515e 100644 --- a/modes/blind_lunatic.lua +++ b/modes/blind_lunatic.lua @@ -5,7 +5,7 @@ return{ env={ drop=10,lock=60, fall=5, - center=false,ghost=false, + center=0,ghost=0, dropFX=0,lockFX=0, visible="none", dropPiece=PLY.reach_winCheck, diff --git a/modes/blind_ultimate.lua b/modes/blind_ultimate.lua index c6fcf098..e96b3976 100644 --- a/modes/blind_ultimate.lua +++ b/modes/blind_ultimate.lua @@ -5,7 +5,7 @@ return{ env={ drop=30,lock=60, block=false, - center=false,ghost=false, + center=0,ghost=0, dropFX=0,lockFX=0, visible="none", dropPiece=PLY.reach_winCheck, diff --git a/modes/blind_wtf.lua b/modes/blind_wtf.lua index 243b2d82..430f3641 100644 --- a/modes/blind_wtf.lua +++ b/modes/blind_wtf.lua @@ -7,7 +7,7 @@ return{ drop=30,lock=60, next=1, block=false, - center=false,ghost=false, + center=0,ghost=0, dropFX=0,lockFX=0, visible="none", dropPiece=PLY.reach_winCheck, diff --git a/modes/classic_fast.lua b/modes/classic_fast.lua index 97963517..99389155 100644 --- a/modes/classic_fast.lua +++ b/modes/classic_fast.lua @@ -18,7 +18,7 @@ return{ env={ noFly=true, das=16,arr=6,sddas=2,sdarr=2, - ghost=false,center=false, + center=0,ghost=0, drop=3,lock=3,wait=10,fall=25, next=1,hold=false, sequence="rnd", diff --git a/parts/default_data.lua b/parts/default_data.lua index 9cd09c35..2d84af34 100644 --- a/parts/default_data.lua +++ b/parts/default_data.lua @@ -17,7 +17,7 @@ setting={ face={}, --Graphic - ghost=true,center=true, + ghost=.3,center=1, smooth=true,grid=false, bagLine=false, lockFX=2, @@ -35,15 +35,15 @@ setting={ powerInfo=false, --Sound - sfx=10, + sfx=1, spawn=0, - bgm=7, - stereo=6, + bgm=.7, + stereo=.6, vib=0, voc=0, --Virtualkey - VKSFX=3,--SFX volume + VKSFX=.2,--SFX volume VKVIB=0,--VIB VKSwitch=false,--If disp VKTrack=false,--If tracked @@ -51,7 +51,7 @@ setting={ VKTchW=3,--Touch-Pos Weight VKCurW=4,--Cur-Pos Weight VKIcon=true,--If disp icon - VKAlpha=3, + VKAlpha=.3, } for i=1,25 do setting.face[i]=0 diff --git a/parts/player.lua b/parts/player.lua index bcf2242e..8244fd1c 100644 --- a/parts/player.lua +++ b/parts/player.lua @@ -14,7 +14,7 @@ local gameEnv0={ ihs=true,irs=true,ims=true, swap=true, - ghost=true,center=true, + ghost=.3,center=1, smooth=false,grid=false, bagLine=false, text=true, @@ -588,6 +588,7 @@ local function drawFXs(P) end local function Pdraw_norm(P) local _ + local ENV=P.gameEnv gc.push("transform") --Camera @@ -598,7 +599,7 @@ local function Pdraw_norm(P) gc.setColor(0,0,0,.6)gc.rectangle("fill",0,-10,300,610) --Grid - if P.gameEnv.grid then + if ENV.grid then gc.setLineWidth(1) gc.setColor(1,1,1,.2) for x=1,9 do gc.line(30*x,-10,30*x,600)end @@ -622,8 +623,8 @@ local function Pdraw_norm(P) end end else--Field with falling animation - local dy,stepY=0,P.gameEnv.smooth and(P.falling/(P.gameEnv.fall+1))^2.5*30 or 30 - local A=P.falling/P.gameEnv.fall + local dy,stepY=0,ENV.smooth and(P.falling/(ENV.fall+1))^2.5*30 or 30 + local A=P.falling/ENV.fall local h,H=1,#P.field for j=int(P.fieldBeneath/30+1),H do while j==P.clearingRow[h]do @@ -649,8 +650,8 @@ local function Pdraw_norm(P) local curColor=P.cur.color --Ghost - if P.gameEnv.ghost then - gc.setColor(1,1,1,.3) + if ENV.ghost then + gc.setColor(1,1,1,ENV.ghost) for i=1,P.r do for j=1,P.c do if P.cur.bk[i][j]then drawPixel(i+P.imgY-1,j+P.curX-1,curColor) @@ -658,10 +659,10 @@ local function Pdraw_norm(P) end end end - local dy=P.gameEnv.smooth and P.imgY~=P.curY and(P.dropDelay/P.gameEnv.drop-1)*30 or 0 + local dy=ENV.smooth and P.imgY~=P.curY and(P.dropDelay/ENV.drop-1)*30 or 0 gc.translate(0,-dy) - local trans=P.lockDelay/P.gameEnv.lock - if P.gameEnv.block then + local trans=P.lockDelay/ENV.lock + if ENV.block then --White Boarder(indicate lockdelay) SHADER.alpha:send("a",trans) gc.setShader(SHADER.alpha) @@ -686,13 +687,13 @@ local function Pdraw_norm(P) end --Rotate center - if P.gameEnv.center then - gc.setColor(1,1,1,trans) + if ENV.center then + gc.setColor(1,1,1,trans*ENV.center) local x=30*(P.curX+P.sc[2])-15 gc.draw(IMG.spinCenter,x,600-30*(P.curY+P.sc[1])+15,nil,nil,nil,4,4) - if P.gameEnv.ghost then + if ENV.ghost then gc.translate(0,dy) - gc.setColor(1,1,1,.5) + gc.setColor(1,1,1,trans*ENV.center) gc.draw(IMG.spinCenter,x,600-30*(P.imgY+P.sc[1])+15,nil,nil,nil,4,4) goto E end @@ -709,16 +710,16 @@ local function Pdraw_norm(P) --LockDelay indicator - if P.gameEnv.easyFresh then + if ENV.easyFresh then gc.setColor(1,1,1) else gc.setColor(1,.26,.26) end if P.lockDelay>=0 then - gc.rectangle("fill",0,602,300*P.lockDelay/P.gameEnv.lock,6)--Lock delay indicator + gc.rectangle("fill",0,602,300*P.lockDelay/ENV.lock,6)--Lock delay indicator end _=3 - for i=1,min(P.gameEnv.freshLimit-P.freshTime,15)do + for i=1,min(ENV.freshLimit-P.freshTime,15)do gc.rectangle("fill",_,615,14,5) _=_+20 end @@ -769,7 +770,7 @@ local function Pdraw_norm(P) gc.translate(-P.fieldOff.x,-P.fieldOff.y) --Draw Hold - if P.gameEnv.hold then + if ENV.hold then gc.setColor(0,0,0,.4)gc.rectangle("fill",-140,36,124,80) gc.setColor(1,1,1)gc.rectangle("line",-140,36,124,80) mText(drawableText.hold,-78,-15) @@ -785,13 +786,13 @@ local function Pdraw_norm(P) end --Draw Next(s) - local N=P.gameEnv.next*72 - if P.gameEnv.next>0 then + local N=ENV.next*72 + if ENV.next>0 then gc.setColor(0,0,0,.4)gc.rectangle("fill",316,36,124,N) gc.setColor(1,1,1)gc.rectangle("line",316,36,124,N) mText(drawableText.next,378,-15) N=1 - while N<=P.gameEnv.next and P.next[N]do + while N<=ENV.next and P.next[N]do local b,c=P.next[N].bk,P.next[N].color for i=1,#b do for j=1,#b[1] do if b[i][j]then @@ -803,8 +804,8 @@ local function Pdraw_norm(P) end --Draw Bagline(s) - if P.gameEnv.bagLine then - local L=P.gameEnv.bagLen + if ENV.bagLine then + local L=ENV.bagLen local C=-P.pieceCount%L--Phase gc.setColor(.8,.5,.5) for i=C,N-1,L do @@ -914,6 +915,7 @@ local function Pdraw_small(P) end local function Pdraw_demo(P) local _ + local ENV=P.gameEnv local curColor=P.cur.color --Camera @@ -940,8 +942,8 @@ local function Pdraw_demo(P) end else --Field with falling animation - local dy,stepY=0,P.gameEnv.smooth and(P.falling/(P.gameEnv.fall+1))^2.5*30 or 30 - local A=P.falling/P.gameEnv.fall + local dy,stepY=0,ENV.smooth and(P.falling/(ENV.fall+1))^2.5*30 or 30 + local A=P.falling/ENV.fall local h,H=1,#P.field for j=int(P.fieldBeneath/30+1),H do while j==P.clearingRow[h]do @@ -993,7 +995,7 @@ local function Pdraw_demo(P) --Draw next local N=1 - while N<=P.gameEnv.next and P.next[N]do + while N<=ENV.next and P.next[N]do local id=P.next[N].id _=P.color[id] gc.setColor(_[1],_[2],_[3],.3) @@ -1040,7 +1042,7 @@ function player.createLockFX(P) end end end -function player.creatDropFX(P,x,y,w,h)--TODO, remake dropFX +function player.creatDropFX(P,x,y,w,h) ins(P.dropFX,{x,y,w,h,0,13-2*P.gameEnv.dropFX}) end function player.createMoveFX(P,dir) @@ -1049,40 +1051,32 @@ function player.createMoveFX(P,dir) local x=P.curX-1 local y=P.gameEnv.smooth and P.curY+P.dropDelay/P.gameEnv.drop-2 or P.curY-1 if dir=="left"then - for i=1,P.r do - for j=P.c,1,-1 do - if P.cur.bk[i][j]then - ins(P.moveFX,{C,x+j,y+i,0,T}) - break - end + for i=1,P.r do for j=P.c,1,-1 do + if P.cur.bk[i][j]then + ins(P.moveFX,{C,x+j,y+i,0,T}) + break end - end + end end elseif dir=="right"then - for i=1,P.r do - for j=1,P.c do - if P.cur.bk[i][j]then - ins(P.moveFX,{C,x+j,y+i,0,T}) - break - end + for i=1,P.r do for j=1,P.c do + if P.cur.bk[i][j]then + ins(P.moveFX,{C,x+j,y+i,0,T}) + break end - end + end end elseif dir=="down"then - for j=1,P.c do - for i=P.r,1,-1 do - if P.cur.bk[i][j]then - ins(P.moveFX,{C,x+j,y+i,0,T}) - break - end + for j=1,P.c do for i=P.r,1,-1 do + if P.cur.bk[i][j]then + ins(P.moveFX,{C,x+j,y+i,0,T}) + break end - end + end end else - for i=1,P.r do - for j=1,P.c do - if P.cur.bk[i][j]then - ins(P.moveFX,{C,x+j,y+i,0,T}) - end + for i=1,P.r do for j=1,P.c do + if P.cur.bk[i][j]then + ins(P.moveFX,{C,x+j,y+i,0,T}) end - end + end end end end function player.createBeam(P,R,send,time,target,color,clear,spin,combo) @@ -1367,9 +1361,10 @@ function player.changeAtk(P,R) end end function player.freshBlock(P,keepGhost,control,system) + local ENV=P.gameEnv if not keepGhost and P.cur then P.imgY=min(#P.field+1,P.curY) - if P.gameEnv._20G or P.keyPressing[7]and P.gameEnv.sdarr==0 then + if ENV._20G or P.keyPressing[7]and ENV.sdarr==0 then local _=P.imgY --Move ghost to bottom @@ -1384,11 +1379,11 @@ function player.freshBlock(P,keepGhost,control,system) --Create FX if dropped if P.curY>P.imgY then - if P.gameEnv.dropFX and P.gameEnv.block and P.curY-P.imgY-P.r>-1 then + if ENV.dropFX and ENV.block and P.curY-P.imgY-P.r>-1 then P:creatDropFX(P.curX,P.curY-1,P.c,P.curY-P.imgY-P.r+1) end - if P.gameEnv.shakeFX then - P.fieldOff.vy=P.gameEnv.shakeFX*.5 + if ENV.shakeFX then + P.fieldOff.vy=ENV.shakeFX*.5 end P.curY=P.imgY end @@ -1400,27 +1395,27 @@ function player.freshBlock(P,keepGhost,control,system) end if control then - if P.gameEnv.easyFresh then - local d0=P.gameEnv.lock - if P.lockDelay