ghost和center透明度可调,部分设置值域改为[0%,100%],控件交互优化,滑条显示当前值

This commit is contained in:
MrZ626
2020-08-27 03:52:13 +08:00
parent f6ff36c142
commit b9722dcca1
14 changed files with 198 additions and 144 deletions

View File

@@ -3,7 +3,7 @@ local rem=table.remove
local function fadeOut(id) local function fadeOut(id)
local src=BGM.list[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) src:setVolume(v>0 and v or 0)
if v<=0 then if v<=0 then
src:stop() src:stop()
@@ -12,10 +12,10 @@ local function fadeOut(id)
end end
local function fadeIn(id) local function fadeIn(id)
local src=BGM.list[id] local src=BGM.list[id]
local v=setting.bgm*.01 local v=setting.bgm
v=min(v,src:getVolume()+.025*v) v=min(v,src:getVolume()+.025*v)
src:setVolume(v) src:setVolume(v)
if v>=setting.bgm*.01 then return true end if v>=setting.bgm then return true end
end end
local BGM={ local BGM={
@@ -68,7 +68,7 @@ function BGM.play(s)
end end
function BGM.freshVolume() function BGM.freshVolume()
if BGM.playing then if BGM.playing then
local v=setting.bgm*.01 local v=setting.bgm
if v>0 then if v>0 then
BGM.playing:setVolume(v) BGM.playing:setVolume(v)
if BGM.suspend then if BGM.suspend then
@@ -76,9 +76,10 @@ function BGM.freshVolume()
BGM.nowPlay,BGM.suspend=BGM.suspend BGM.nowPlay,BGM.suspend=BGM.suspend
end end
else else
BGM.playing:setVolume(0) if BGM.nowPlay then
BGM.playing:pause() BGM.playing:pause()
BGM.suspend,BGM.nowPlay=BGM.nowPlay BGM.suspend,BGM.nowPlay=BGM.nowPlay
end
end end
end end
end end

View File

@@ -725,7 +725,7 @@ function touchDown.play(id,x,y)
if t then if t then
players[1]:pressKey(t) players[1]:pressKey(t)
if setting.VKSFX>0 then if setting.VKSFX>0 then
SFX.play("virtualKey",setting.VKSFX*.25) SFX.play("virtualKey",setting.VKSFX)
end end
virtualkey[t].isDown=true virtualkey[t].isDown=true
virtualkey[t].pressTime=10 virtualkey[t].pressTime=10
@@ -878,6 +878,7 @@ end
function love.mousereleased(x,y,k,touch,num) function love.mousereleased(x,y,k,touch,num)
if touch or SCN.swapping then return end if touch or SCN.swapping then return end
mx,my=xOy:inverseTransformPoint(x,y) mx,my=xOy:inverseTransformPoint(x,y)
WIDGET.release(mx,my)
if mouseUp[SCN.cur]then if mouseUp[SCN.cur]then
mouseUp[SCN.cur](mx,my,k) mouseUp[SCN.cur](mx,my,k)
end end
@@ -926,6 +927,7 @@ function love.touchreleased(id,x,y)
x,y=xOy:inverseTransformPoint(x,y) x,y=xOy:inverseTransformPoint(x,y)
if id==touching then if id==touching then
WIDGET.press(x,y) WIDGET.press(x,y)
WIDGET.release(x,y)
touching=nil touching=nil
WIDGET.sel=nil WIDGET.sel=nil
end end

View File

@@ -657,9 +657,6 @@ function Pnt.setting_sound()
gc.translate(-x,-y) gc.translate(-x,-y)
end end
local function timeConv(t)
return t.."F "..int(t*16.67).."ms"
end
function Pnt.setting_control() function Pnt.setting_control()
--Testing grid line --Testing grid line
gc.setLineWidth(4) gc.setLineWidth(4)
@@ -680,14 +677,6 @@ function Pnt.setting_control()
setFont(50) setFont(50)
gc.printf(text.preview,320,540,200,"right") 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 --Testing O mino
_=blockSkin[setting.skin[6]] _=blockSkin[setting.skin[6]]
local x=550+40*sceneTemp.pos local x=550+40*sceneTemp.pos

View File

@@ -52,13 +52,13 @@ function SFX.play(s,vol,pos)
S=S[n]--AU_SRC S=S[n]--AU_SRC
if S:getChannelCount()==1 then if S:getChannelCount()==1 then
if pos then if pos then
pos=pos*setting.stereo*.1 pos=pos*setting.stereo
S:setPosition(pos,1-pos^2,0) S:setPosition(pos,1-pos^2,0)
else else
S:setPosition(0,0,0) S:setPosition(0,0,0)
end end
end end
S:setVolume(((vol or 1)*setting.sfx*.01)^1.626) S:setVolume(((vol or 1)*setting.sfx)^1.626)
S:play() S:play()
end end
function SFX.fplay(s,vol,pos) function SFX.fplay(s,vol,pos)
@@ -76,13 +76,13 @@ function SFX.fplay(s,vol,pos)
S=S[n]--AU_SRC S=S[n]--AU_SRC
if S:getChannelCount()==1 then if S:getChannelCount()==1 then
if pos then if pos then
pos=pos*setting.stereo*.1 pos=pos*setting.stereo
S:setPosition(pos,1-pos^2,0) S:setPosition(pos,1-pos^2,0)
else else
S:setPosition(0,0,0) S:setPosition(0,0,0)
end end
end end
S:setVolume((vol*.01)^1.626) S:setVolume(vol^1.626)
S:play() S:play()
end end
function SFX.reset() function SFX.reset()

View File

@@ -91,13 +91,13 @@ function VOC.update()
end end
elseif Q.s==1 then--Waiting load source elseif Q.s==1 then--Waiting load source
Q[1]=getVoice(Q[1]) Q[1]=getVoice(Q[1])
Q[1]:setVolume(setting.voc*.01) Q[1]:setVolume(setting.voc)
Q[1]:play() Q[1]:play()
Q.s=Q[2]and 2 or 4 Q.s=Q[2]and 2 or 4
elseif Q.s==2 then--Playing 1,ready 2 elseif Q.s==2 then--Playing 1,ready 2
if Q[1]:getDuration()-Q[1]:tell()<.08 then if Q[1]:getDuration()-Q[1]:tell()<.08 then
Q[2]=getVoice(Q[2]) Q[2]=getVoice(Q[2])
Q[2]:setVolume(setting.voc*.01) Q[2]:setVolume(setting.voc)
Q[2]:play() Q[2]:play()
Q.s=3 Q.s=3
end end

View File

@@ -4,6 +4,7 @@ local int,abs=math.floor,math.abs
local format=string.format local format=string.format
local color=color local color=color
local setFont=setFont local setFont=setFont
local Timer=love.timer.getTime
local button={ local button={
type="button", type="button",
@@ -183,6 +184,21 @@ local slider={
ATV=0,--Activating time(0~8) ATV=0,--Activating time(0~8)
pos=0,--Position shown 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() function slider:reset()
self.ATV=0 self.ATV=0
self.pos=0 self.pos=0
@@ -212,7 +228,7 @@ function slider:draw()
gc.setColor(1,1,1,.5+ATV*.06) gc.setColor(1,1,1,.5+ATV*.06)
--Units --Units
if self.showUnit then if not self.smooth then
gc.setLineWidth(2) gc.setLineWidth(2)
for p=0,self.unit do for p=0,self.unit do
local x=x+(x2-x)*p/self.unit local x=x+(x2-x)*p/self.unit
@@ -225,17 +241,24 @@ function slider:draw()
gc.line(x,y,x2,y) gc.line(x,y,x2,y)
--Block --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.setColor(.8,.8,.8)
gc.rectangle("fill",bx,by,bw,bh) gc.rectangle("fill",bx,by,bw,bh)
local t
if ATV>0 then if ATV>0 then
gc.setLineWidth(2) gc.setLineWidth(2)
gc.setColor(1,1,1,ATV*.16) gc.setColor(1,1,1,ATV*.16)
gc.rectangle("line",bx+1,by+1,bw-2,bh-2) 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 end
--Text --Text
local t=self.text t=self.text
if t then if t then
gc.setColor(1,1,1) gc.setColor(1,1,1)
setFont(self.font) setFont(self.font)
@@ -369,14 +392,34 @@ function WIDGET.newSlider(D)
D.x+D.w,D.y, D.x+D.w,D.y,
}, },
unit= D.unit, unit= D.unit or 1,
showUnit=not D.noUnit, --smooth=nil,
font= D.font, font= D.font,
change= D.change, change= D.change,
disp= D.disp, disp= D.disp,
code= D.code, code= D.code,
hide= D.hide, 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 end
function WIDGET.moveCursor(x,y) function WIDGET.moveCursor(x,y)
@@ -402,11 +445,7 @@ function WIDGET.press(x,y)
W.code() W.code()
SFX.play("move",.6) SFX.play("move",.6)
elseif W.type=="slider"then elseif W.type=="slider"then
if not x then return end WIDGET.drag(x,y)
local p,P=W.disp(),x<W.x and 0 or x>W.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
end end
if W.hide and W.hide()then WIDGET.sel=nil end if W.hide and W.hide()then WIDGET.sel=nil end
end end
@@ -414,14 +453,32 @@ function WIDGET.drag(x,y,dx,dy)
local W=WIDGET.sel local W=WIDGET.sel
if not W then return end if not W then return end
if W.type=="slider"then if W.type=="slider"then
local p,P=W.disp(),x<W.x and 0 or x>W.x+W.w and W.unit or int((x-W.x)*W.unit/W.w+.5) if not x then return end
if p==P then return end local p=W.disp()
W.code(P) local P=x<W.x and 0 or x>W.x+W.w and W.unit or(x-W.x)/W.w*W.unit
if W.change then W.change()end 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 elseif not W:isAbove(x,y)then
WIDGET.sel=nil WIDGET.sel=nil
end end
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) function WIDGET.keyPressed(i)
if i=="space"or i=="return"then if i=="space"or i=="return"then
if WIDGET.sel then if WIDGET.sel then

View File

@@ -1,3 +1,4 @@
local rnd=math.random
local ins,rem=table.insert,table.remove local ins,rem=table.insert,table.remove
local mobileHide=(system=="Android"or system=="iOS")and function()return true end local mobileHide=(system=="Android"or system=="iOS")and function()return true end
local function BACK()SCN.back()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}), newButton({name="back", x=1200,y=655,w=120,h=80,color="white", font=40,code=BACK}),
}, },
music={ 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="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="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")}), 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="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="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}), 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")}), 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() newButton({name="layout", x=460, y=540, w=140,h=70,color="white", font=35,code=function()
SCN.go("setting_skin") SCN.go("setting_skin")
@@ -255,11 +256,11 @@ local Widgets={
setting_video={ 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="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}), 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")}), newSlider({name="ghost", x=250, y=180,w=200,unit=.6,noUnit=true,font=35,disp=SETval("ghost"),show="percent",code=SETsto("ghost")}),
newSwitch({name="smooth", x=250, y=260,font=25, disp=SETval("smooth"), code=SETrev("smooth")}), newSlider({name="center", x=600, y=180,w=200,unit=1, font=35,disp=SETval("center"), code=SETsto("center")}),
newSwitch({name="center", x=500, y=180,font=35, disp=SETval("center"), code=SETrev("center")}), newSwitch({name="smooth", x=260, y=260, font=25,disp=SETval("smooth"), code=SETrev("smooth")}),
newSwitch({name="grid", x=500, y=260,font=35, disp=SETval("grid"), code=SETrev("grid")}), newSwitch({name="grid", x=480, 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")}), 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="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="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")}), 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}), newButton({name="back", x=1140, y=650,w=200,h=80,color="white",font=40,code=BACK}),
}, },
setting_sound={ 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="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}), 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="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,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="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,unit=100,noUnit=true,font=30,change=function()SFX.fplay("spawn_1",setting.spawn)end, disp=SETval("spawn"), code=SETsto("spawn")}), 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,unit=100,noUnit=true,font=35,change=function()BGM.freshVolume()end, disp=SETval("bgm"), code=SETsto("bgm")}), 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="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")}), 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}), newButton({name="back", x=1140, y=650,w=200,h=80,color="white", font=40,code=BACK}),
}, },
setting_control={ setting_control={
newSlider({name="das", x=226, y=200,w=910, unit=26, font=30,disp=SETval("das"), code=SETsto("das")}), 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"), code=SETsto("arr")}), 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"), code=SETsto("sddas")}), 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"), code=SETsto("sdarr")}), 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="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="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")}), 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") SCN.go("setting_touchSwitch")
end}), end}),
newButton({name="back", x=760,y=180,w=170,h=80,color="white",font=40,code=BACK}), 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() disp=function()
return VK_org[sceneTemp.sel].r/10-1 return VK_org[sceneTemp.sel].r/10-1
end, 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}), 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="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")}), 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="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")}), 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")}), 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, newButton({name="tkset", x=1120, y=420, w=240,h=80,color="white",font=32,
code=function() code=function()
@@ -442,7 +443,7 @@ local Widgets={
hide=function() hide=function()
return not setting.VKTrack return not setting.VKTrack
end}), 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}), newButton({name="back", x=1120, y=620, w=200,h=80,color="white",font=45,code=BACK}),
}, },
setting_trackSetting={ setting_trackSetting={

View File

@@ -134,10 +134,17 @@ do
end end
--Update data file --Update data file
local S=stat local S=setting
if type(setting.spawn)~="number"then if type(S.spawn)~="number"then S.spawn=0 end
setting.spawn=0 if type(S.ghost)~="number"then S.ghost=.3 end
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 if S.version~=gameVersion then
S.version=gameVersion S.version=gameVersion
newVersionLaunch=true newVersionLaunch=true

View File

@@ -5,7 +5,7 @@ return{
env={ env={
drop=10,lock=60, drop=10,lock=60,
fall=5, fall=5,
center=false,ghost=false, center=0,ghost=0,
dropFX=0,lockFX=0, dropFX=0,lockFX=0,
visible="none", visible="none",
dropPiece=PLY.reach_winCheck, dropPiece=PLY.reach_winCheck,

View File

@@ -5,7 +5,7 @@ return{
env={ env={
drop=30,lock=60, drop=30,lock=60,
block=false, block=false,
center=false,ghost=false, center=0,ghost=0,
dropFX=0,lockFX=0, dropFX=0,lockFX=0,
visible="none", visible="none",
dropPiece=PLY.reach_winCheck, dropPiece=PLY.reach_winCheck,

View File

@@ -7,7 +7,7 @@ return{
drop=30,lock=60, drop=30,lock=60,
next=1, next=1,
block=false, block=false,
center=false,ghost=false, center=0,ghost=0,
dropFX=0,lockFX=0, dropFX=0,lockFX=0,
visible="none", visible="none",
dropPiece=PLY.reach_winCheck, dropPiece=PLY.reach_winCheck,

View File

@@ -18,7 +18,7 @@ return{
env={ env={
noFly=true, noFly=true,
das=16,arr=6,sddas=2,sdarr=2, das=16,arr=6,sddas=2,sdarr=2,
ghost=false,center=false, center=0,ghost=0,
drop=3,lock=3,wait=10,fall=25, drop=3,lock=3,wait=10,fall=25,
next=1,hold=false, next=1,hold=false,
sequence="rnd", sequence="rnd",

View File

@@ -17,7 +17,7 @@ setting={
face={}, face={},
--Graphic --Graphic
ghost=true,center=true, ghost=.3,center=1,
smooth=true,grid=false, smooth=true,grid=false,
bagLine=false, bagLine=false,
lockFX=2, lockFX=2,
@@ -35,15 +35,15 @@ setting={
powerInfo=false, powerInfo=false,
--Sound --Sound
sfx=10, sfx=1,
spawn=0, spawn=0,
bgm=7, bgm=.7,
stereo=6, stereo=.6,
vib=0, vib=0,
voc=0, voc=0,
--Virtualkey --Virtualkey
VKSFX=3,--SFX volume VKSFX=.2,--SFX volume
VKVIB=0,--VIB VKVIB=0,--VIB
VKSwitch=false,--If disp VKSwitch=false,--If disp
VKTrack=false,--If tracked VKTrack=false,--If tracked
@@ -51,7 +51,7 @@ setting={
VKTchW=3,--Touch-Pos Weight VKTchW=3,--Touch-Pos Weight
VKCurW=4,--Cur-Pos Weight VKCurW=4,--Cur-Pos Weight
VKIcon=true,--If disp icon VKIcon=true,--If disp icon
VKAlpha=3, VKAlpha=.3,
} }
for i=1,25 do for i=1,25 do
setting.face[i]=0 setting.face[i]=0

View File

@@ -14,7 +14,7 @@ local gameEnv0={
ihs=true,irs=true,ims=true, ihs=true,irs=true,ims=true,
swap=true, swap=true,
ghost=true,center=true, ghost=.3,center=1,
smooth=false,grid=false, smooth=false,grid=false,
bagLine=false, bagLine=false,
text=true, text=true,
@@ -588,6 +588,7 @@ local function drawFXs(P)
end end
local function Pdraw_norm(P) local function Pdraw_norm(P)
local _ local _
local ENV=P.gameEnv
gc.push("transform") gc.push("transform")
--Camera --Camera
@@ -598,7 +599,7 @@ local function Pdraw_norm(P)
gc.setColor(0,0,0,.6)gc.rectangle("fill",0,-10,300,610) gc.setColor(0,0,0,.6)gc.rectangle("fill",0,-10,300,610)
--Grid --Grid
if P.gameEnv.grid then if ENV.grid then
gc.setLineWidth(1) gc.setLineWidth(1)
gc.setColor(1,1,1,.2) gc.setColor(1,1,1,.2)
for x=1,9 do gc.line(30*x,-10,30*x,600)end 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
end end
else--Field with falling animation 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 dy,stepY=0,ENV.smooth and(P.falling/(ENV.fall+1))^2.5*30 or 30
local A=P.falling/P.gameEnv.fall local A=P.falling/ENV.fall
local h,H=1,#P.field local h,H=1,#P.field
for j=int(P.fieldBeneath/30+1),H do for j=int(P.fieldBeneath/30+1),H do
while j==P.clearingRow[h]do while j==P.clearingRow[h]do
@@ -649,8 +650,8 @@ local function Pdraw_norm(P)
local curColor=P.cur.color local curColor=P.cur.color
--Ghost --Ghost
if P.gameEnv.ghost then if ENV.ghost then
gc.setColor(1,1,1,.3) gc.setColor(1,1,1,ENV.ghost)
for i=1,P.r do for j=1,P.c do for i=1,P.r do for j=1,P.c do
if P.cur.bk[i][j]then if P.cur.bk[i][j]then
drawPixel(i+P.imgY-1,j+P.curX-1,curColor) drawPixel(i+P.imgY-1,j+P.curX-1,curColor)
@@ -658,10 +659,10 @@ local function Pdraw_norm(P)
end end end 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) gc.translate(0,-dy)
local trans=P.lockDelay/P.gameEnv.lock local trans=P.lockDelay/ENV.lock
if P.gameEnv.block then if ENV.block then
--White Boarder(indicate lockdelay) --White Boarder(indicate lockdelay)
SHADER.alpha:send("a",trans) SHADER.alpha:send("a",trans)
gc.setShader(SHADER.alpha) gc.setShader(SHADER.alpha)
@@ -686,13 +687,13 @@ local function Pdraw_norm(P)
end end
--Rotate center --Rotate center
if P.gameEnv.center then if ENV.center then
gc.setColor(1,1,1,trans) gc.setColor(1,1,1,trans*ENV.center)
local x=30*(P.curX+P.sc[2])-15 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) 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.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) gc.draw(IMG.spinCenter,x,600-30*(P.imgY+P.sc[1])+15,nil,nil,nil,4,4)
goto E goto E
end end
@@ -709,16 +710,16 @@ local function Pdraw_norm(P)
--LockDelay indicator --LockDelay indicator
if P.gameEnv.easyFresh then if ENV.easyFresh then
gc.setColor(1,1,1) gc.setColor(1,1,1)
else else
gc.setColor(1,.26,.26) gc.setColor(1,.26,.26)
end end
if P.lockDelay>=0 then 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 end
_=3 _=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) gc.rectangle("fill",_,615,14,5)
_=_+20 _=_+20
end end
@@ -769,7 +770,7 @@ local function Pdraw_norm(P)
gc.translate(-P.fieldOff.x,-P.fieldOff.y) gc.translate(-P.fieldOff.x,-P.fieldOff.y)
--Draw Hold --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(0,0,0,.4)gc.rectangle("fill",-140,36,124,80)
gc.setColor(1,1,1)gc.rectangle("line",-140,36,124,80) gc.setColor(1,1,1)gc.rectangle("line",-140,36,124,80)
mText(drawableText.hold,-78,-15) mText(drawableText.hold,-78,-15)
@@ -785,13 +786,13 @@ local function Pdraw_norm(P)
end end
--Draw Next(s) --Draw Next(s)
local N=P.gameEnv.next*72 local N=ENV.next*72
if P.gameEnv.next>0 then if ENV.next>0 then
gc.setColor(0,0,0,.4)gc.rectangle("fill",316,36,124,N) 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) gc.setColor(1,1,1)gc.rectangle("line",316,36,124,N)
mText(drawableText.next,378,-15) mText(drawableText.next,378,-15)
N=1 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 local b,c=P.next[N].bk,P.next[N].color
for i=1,#b do for j=1,#b[1] do for i=1,#b do for j=1,#b[1] do
if b[i][j]then if b[i][j]then
@@ -803,8 +804,8 @@ local function Pdraw_norm(P)
end end
--Draw Bagline(s) --Draw Bagline(s)
if P.gameEnv.bagLine then if ENV.bagLine then
local L=P.gameEnv.bagLen local L=ENV.bagLen
local C=-P.pieceCount%L--Phase local C=-P.pieceCount%L--Phase
gc.setColor(.8,.5,.5) gc.setColor(.8,.5,.5)
for i=C,N-1,L do for i=C,N-1,L do
@@ -914,6 +915,7 @@ local function Pdraw_small(P)
end end
local function Pdraw_demo(P) local function Pdraw_demo(P)
local _ local _
local ENV=P.gameEnv
local curColor=P.cur.color local curColor=P.cur.color
--Camera --Camera
@@ -940,8 +942,8 @@ local function Pdraw_demo(P)
end end
else else
--Field with falling animation --Field with falling animation
local dy,stepY=0,P.gameEnv.smooth and(P.falling/(P.gameEnv.fall+1))^2.5*30 or 30 local dy,stepY=0,ENV.smooth and(P.falling/(ENV.fall+1))^2.5*30 or 30
local A=P.falling/P.gameEnv.fall local A=P.falling/ENV.fall
local h,H=1,#P.field local h,H=1,#P.field
for j=int(P.fieldBeneath/30+1),H do for j=int(P.fieldBeneath/30+1),H do
while j==P.clearingRow[h]do while j==P.clearingRow[h]do
@@ -993,7 +995,7 @@ local function Pdraw_demo(P)
--Draw next --Draw next
local N=1 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 local id=P.next[N].id
_=P.color[id] _=P.color[id]
gc.setColor(_[1],_[2],_[3],.3) gc.setColor(_[1],_[2],_[3],.3)
@@ -1040,7 +1042,7 @@ function player.createLockFX(P)
end end
end 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}) ins(P.dropFX,{x,y,w,h,0,13-2*P.gameEnv.dropFX})
end end
function player.createMoveFX(P,dir) function player.createMoveFX(P,dir)
@@ -1049,40 +1051,32 @@ function player.createMoveFX(P,dir)
local x=P.curX-1 local x=P.curX-1
local y=P.gameEnv.smooth and P.curY+P.dropDelay/P.gameEnv.drop-2 or P.curY-1 local y=P.gameEnv.smooth and P.curY+P.dropDelay/P.gameEnv.drop-2 or P.curY-1
if dir=="left"then if dir=="left"then
for i=1,P.r do for i=1,P.r do for j=P.c,1,-1 do
for j=P.c,1,-1 do if P.cur.bk[i][j]then
if P.cur.bk[i][j]then ins(P.moveFX,{C,x+j,y+i,0,T})
ins(P.moveFX,{C,x+j,y+i,0,T}) break
break
end
end end
end end end
elseif dir=="right"then elseif dir=="right"then
for i=1,P.r do for i=1,P.r do for j=1,P.c do
for j=1,P.c do if P.cur.bk[i][j]then
if P.cur.bk[i][j]then ins(P.moveFX,{C,x+j,y+i,0,T})
ins(P.moveFX,{C,x+j,y+i,0,T}) break
break
end
end end
end end end
elseif dir=="down"then elseif dir=="down"then
for j=1,P.c do for j=1,P.c do for i=P.r,1,-1 do
for i=P.r,1,-1 do if P.cur.bk[i][j]then
if P.cur.bk[i][j]then ins(P.moveFX,{C,x+j,y+i,0,T})
ins(P.moveFX,{C,x+j,y+i,0,T}) break
break
end
end end
end end end
else else
for i=1,P.r do for i=1,P.r do for j=1,P.c do
for j=1,P.c do if P.cur.bk[i][j]then
if P.cur.bk[i][j]then ins(P.moveFX,{C,x+j,y+i,0,T})
ins(P.moveFX,{C,x+j,y+i,0,T})
end
end end
end end end
end end
end end
function player.createBeam(P,R,send,time,target,color,clear,spin,combo) function player.createBeam(P,R,send,time,target,color,clear,spin,combo)
@@ -1367,9 +1361,10 @@ function player.changeAtk(P,R)
end end
end end
function player.freshBlock(P,keepGhost,control,system) function player.freshBlock(P,keepGhost,control,system)
local ENV=P.gameEnv
if not keepGhost and P.cur then if not keepGhost and P.cur then
P.imgY=min(#P.field+1,P.curY) 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 local _=P.imgY
--Move ghost to bottom --Move ghost to bottom
@@ -1384,11 +1379,11 @@ function player.freshBlock(P,keepGhost,control,system)
--Create FX if dropped --Create FX if dropped
if P.curY>P.imgY then 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) P:creatDropFX(P.curX,P.curY-1,P.c,P.curY-P.imgY-P.r+1)
end end
if P.gameEnv.shakeFX then if ENV.shakeFX then
P.fieldOff.vy=P.gameEnv.shakeFX*.5 P.fieldOff.vy=ENV.shakeFX*.5
end end
P.curY=P.imgY P.curY=P.imgY
end end
@@ -1400,27 +1395,27 @@ function player.freshBlock(P,keepGhost,control,system)
end end
if control then if control then
if P.gameEnv.easyFresh then if ENV.easyFresh then
local d0=P.gameEnv.lock local d0=ENV.lock
if P.lockDelay<d0 and P.freshTime<P.gameEnv.freshLimit then if P.lockDelay<d0 and P.freshTime<ENV.freshLimit then
if not system then if not system then
P.freshTime=P.freshTime+1 P.freshTime=P.freshTime+1
end end
P.lockDelay=d0 P.lockDelay=d0
P.dropDelay=P.gameEnv.drop P.dropDelay=ENV.drop
end end
if P.curY<P.minY then if P.curY<P.minY then
P.minY=P.curY P.minY=P.curY
P.dropDelay=P.gameEnv.drop P.dropDelay=ENV.drop
P.lockDelay=P.gameEnv.lock P.lockDelay=ENV.lock
end end
else else
if P.curY<P.minY then if P.curY<P.minY then
P.minY=P.curY P.minY=P.curY
if P.lockDelay<P.gameEnv.lock and P.freshTime<P.gameEnv.freshLimit then if P.lockDelay<ENV.lock and P.freshTime<ENV.freshLimit then
P.freshTime=P.freshTime+1 P.freshTime=P.freshTime+1
P.dropDelay=P.gameEnv.drop P.dropDelay=ENV.drop
P.lockDelay=P.gameEnv.lock P.lockDelay=ENV.lock
end end
end end
end end
@@ -2751,6 +2746,8 @@ local function applyGameEnv(P)--Finish gameEnv processing
if ENV.moveFX==0 then ENV.moveFX=nil end if ENV.moveFX==0 then ENV.moveFX=nil end
if ENV.clearFX==0 then ENV.clearFX=nil end if ENV.clearFX==0 then ENV.clearFX=nil end
if ENV.shakeFX==0 then ENV.shakeFX=nil end if ENV.shakeFX==0 then ENV.shakeFX=nil end
if ENV.ghost==0 then ENV.ghost=nil end
if ENV.center==0 then ENV.center=nil end
end end
local function prepareSequence(P)--Call freshPrepare and set newNext local function prepareSequence(P)--Call freshPrepare and set newNext
local ENV=P.gameEnv local ENV=P.gameEnv