diff --git a/BGM/rockblock.ogg b/BGM/rockblock.ogg index 697bb62c..99089d92 100644 Binary files a/BGM/rockblock.ogg and b/BGM/rockblock.ogg differ diff --git a/SFX/finesseError.ogg b/SFX/finesseError.ogg index 0943e660..656dfc7e 100644 Binary files a/SFX/finesseError.ogg and b/SFX/finesseError.ogg differ diff --git a/Zframework/bg.lua b/Zframework/bg.lua index 3c97de32..f4d4bf7a 100644 --- a/Zframework/bg.lua +++ b/Zframework/bg.lua @@ -1,6 +1,7 @@ local gc=love.graphics local int,ceil,rnd,abs=math.floor,math.ceil,math.random,math.abs local max,min,sin,cos=math.max,math.min,math.sin,math.cos +local ins,rem=table.insert,table.remove local BG local scr=scr @@ -28,7 +29,7 @@ back.glow={ local t=(sin(t*.5)+sin(t*.7)+sin(t*.9+1)+sin(t*1.5)+sin(t*2+10))*.08 gc.clear(t,t,t) end, -}--light-dark +}--Light-dark back.rgb={ init=function() t=0 @@ -57,14 +58,159 @@ back.flink={ else gc.clear(0,0,0) end end, -}--flash after random time +}--Flash after random time + +local wingColor={ + {0., .9, .9,.626}, + {.3, 1., .3,.626}, + {.9, .9, 0.,.626}, + {1., .5, 0.,.626}, + {1., .3, .3,.626}, + {.5, 0., 1.,.626}, + {.3, .3, 1.,.626}, + {0., .9, .9,.626}, +} +back.wing={ + init=function() + gc.setDefaultFilter("linear","linear") + bar=gc.newCanvas(41,1) + gc.push("transform") + gc.origin() + gc.setCanvas(bar) + for x=0,20 do + gc.setColor(1,1,1,x/11) + gc.rectangle("fill",x,0,1,1) + gc.rectangle("fill",41-x,0,1,1) + end + gc.setCanvas() + gc.pop() + BG.resize() + end, + resize=function() + crystal={} + W,H=scr.w,scr.h + for i=1,16 do + crystal[i]={ + x=i<9 and W*.05*i or W*.05*(28-i), + y=H*.1, + a=0, + va=0, + f=i<9 and .012-i*.0005 or .012-(17-i)*.0005 + } + end + end, + update=function() + for i=1,16 do + local B=crystal[i] + B.a=B.a+B.va + B.va=B.va*.986-B.a*B.f + end + end, + draw=function() + gc.clear(.06,.06,.06) + local sy=H*.8 + for i=1,8 do + gc.setColor(wingColor[i]) + local B=crystal[i] + gc.draw(bar,B.x,B.y,B.a,1,sy,20,0) + B=crystal[17-i] + gc.draw(bar,B.x,B.y,B.a,1,sy,20,0) + end + end, + event=function(level) + for i=1,8 do + local B=crystal[i] + B.va=B.va+.001*level*(1+rnd()) + B=crystal[17-i] + B.va=B.va-.001*level*(1+rnd()) + end + end, + discard=function() + bar,crystal=nil + end, +}--Flandre's wing + +local _ +back.fan={ + init=function() + fan=_G.title_fan + t=0 + petal={} + BG.resize() + end, + resize=function() + CX,CY=scr.w/2,scr.h/2 + W,H=scr.w,scr.h + end, + update=function() + t=t+1 + if t%10==0 then + ins(petal,{ + x=scr.w*rnd(), + y=0, + vy=2+rnd()*2, + vx=rnd()*2-.5, + rx=4+rnd()*4, + ry=4+rnd()*4, + }) + end + for i=#petal,1,-1 do + local P=petal[i] + P.y=P.y+P.vy + if P.y>H then + rem(petal,i) + else + P.x=P.x+P.vx + P.vx=P.vx+rnd()*.01 + P.rx=max(min(P.rx+rnd()-.5,10),2) + P.ry=max(min(P.ry+rnd()-.5,10),2) + end + end + end, + draw=function() + gc.push("transform") + gc.translate(CX,CY+20*sin(t*.02)) + gc.scale(scr.k) + gc.clear(.1,.1,.1) + gc.setLineWidth(320) + gc.setColor(.3,.2,.3) + gc.arc("line","open",0,420,500,-.8*3.1416,-.2*3.1416) + + gc.setLineWidth(4) + gc.setColor(.7,.5,.65) + gc.arc("line","open",0,420,660,-.799*3.1416,-.201*3.1416) + gc.arc("line","open",0,420,340,-.808*3.1416,-.192*3.1416) + gc.line(-281,224,-530,30.5) + gc.line(281,224,530,30.5) + + gc.setLineWidth(6) + gc.setColor(.55,.5,.6) + local F=fan + for i=1,8 do + gc.polygon("line",F[i]) + end + + gc.setLineWidth(2) + gc.setColor(.6,.3,.5) + gc.origin() + for i=1,#petal do + local P=petal[i] + gc.ellipse("fill",P.x,P.y,P.rx,P.ry) + end + gc.pop() + end, + discard=function() + petal=nil + end, +} + back.aura={ init=function() t=rnd()*3600 BG.resize(scr.w,scr.h) end, resize=function(w,h) - SHADER.aura:send("w",w*scr.dpi) + SHADER.aura:send("w",scr.W) SHADER.aura:send("h",h*scr.dpi) end, update=function(dt) @@ -76,14 +222,14 @@ back.aura={ gc.rectangle("fill",0,0,scr.w,scr.h) gc.setShader() end, -}--cool liquid background -back.game1={ +}--Cool liquid background +back.bg1={ init=function() t=0 BG.resize(scr.w) end, resize=function(w) - SHADER.gradient1:send("w",w*scr.dpi) + SHADER.gradient1:send("w",scr.W) end, update=function(dt) t=t+dt @@ -95,7 +241,7 @@ back.game1={ gc.setShader() end, }--Horizonal red-blue gradient -back.game2={ +back.bg2={ init=function() t=0 BG.resize(nil,scr.h) @@ -113,13 +259,13 @@ back.game2={ gc.setShader() end, }--Vertical red-green gradient -back.game3={ +back.rainbow={ init=function() t=0 BG.resize(scr.w,scr.h) end, resize=function(w,h) - SHADER.rgb1:send("w",w*scr.dpi) + SHADER.rgb1:send("w",scr.W) SHADER.rgb1:send("h",h*scr.dpi) end, update=function(dt) @@ -132,13 +278,13 @@ back.game3={ gc.setShader() end, }--Colorful RGB -back.game4={ +back.rainbow2={ init=function() t=0 BG.resize(scr.w,scr.h) end, resize=function(w,h) - SHADER.rgb2:send("w",w*scr.dpi) + SHADER.rgb2:send("w",scr.W) SHADER.rgb2:send("h",h*scr.dpi) end, update=function(dt) @@ -151,7 +297,7 @@ back.game4={ gc.setShader() end, }--Blue RGB -back.game5={ +back.lightning={ init=function() t=0 end, @@ -168,7 +314,7 @@ back.game5={ local blocks=require("parts/mino") local scs=require("parts/spinCenters") -back.game6={ +back.lightning2={ init=function() t=0 colorLib=_G.SKIN.libColor @@ -201,8 +347,8 @@ back.matrix={ draw=function() gc.scale(scr.k) gc.clear(.15,.15,.15) - local Y=ceil(scr.h*scr.dpi/80) - for x=1,ceil(scr.w*scr.dpi/80)do + local Y=ceil(scr.H/80) + for x=1,ceil(scr.W/80)do for y=1,Y do gc.setColor(1,1,1,sin(x+matrixT[x][y]*t)*.1+.1) gc.rectangle("fill",80*x,80*y,-80,-80) @@ -222,19 +368,20 @@ back.space={ local S=stars for i=1,1260,5 do local s=rnd(26,40)*.1 - S[i]=s*scr.k --size - S[i+1]=rnd(W)-10 --x - S[i+2]=rnd(H)-10 --y - S[i+3]=(rnd()-.5)*.01*s --vx - S[i+4]=(rnd()-.5)*.01*s --vy - end--800 var + S[i]=s*scr.k --Size + S[i+1]=rnd(W)-10 --X + S[i+2]=rnd(H)-10 --Y + S[i+3]=(rnd()-.5)*.01*s --Vx + S[i+4]=(rnd()-.5)*.01*s --Vy + end end, update=function(dt) local S=stars + --Star moving for i=1,1260,5 do S[i+1]=(S[i+1]+S[i+3])%W S[i+2]=(S[i+2]+S[i+4])%H - end--star moving + end end, draw=function() gc.clear(.2,.2,.2) @@ -250,17 +397,19 @@ back.space={ gc.translate(10,10) end, discard=function() - stars={} + stars=nil end, } +--Make BG vars invisible for _,bg in next,back do if not bg.init then bg.init= NULL end setfenv(bg.init ,BGvars) if not bg.resize then bg.resize= NULL end setfenv(bg.resize ,BGvars) if not bg.update then bg.update= NULL end setfenv(bg.update ,BGvars) - if not bg.discard then bg.discard=NULL end setfenv(bg.discard ,BGvars) if not bg.draw then bg.draw= NULL end setfenv(bg.draw ,BGvars) -end--make BG vars invisible + if not bg.event then bg.event= NULL end setfenv(bg.event ,BGvars) + if not bg.discard then bg.discard=NULL end setfenv(bg.discard ,BGvars) +end BG={ cur="none", @@ -268,6 +417,11 @@ BG={ update=NULL, draw=back.none.draw, } +function BG.send(data) + if BG.event then + BG.event(data) + end +end function BG.set(bg,data) if bg==BG.cur or not setting.bg then return end if BG.discard then @@ -280,8 +434,9 @@ function BG.set(bg,data) BG.init=bg.init or NULL BG.resize=bg.resize or NULL BG.update=bg.update or NULL - BG.discard=bg.discard or NULL BG.draw=bg.draw or NULL + BG.event=bg.event or NULL + BG.discard=bg.discard or NULL BG.init() end return BG \ No newline at end of file diff --git a/Zframework/bgm.lua b/Zframework/bgm.lua index d5fc4807..f9270e54 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*.1 + local v=src:getVolume()-.025*setting.bgm*.01 src:setVolume(v>0 and v or 0) if v<=0 then src:stop() @@ -12,9 +12,10 @@ local function fadeOut(id) end local function fadeIn(id) local src=BGM.list[id] - local v=min(src:getVolume()+.025*setting.bgm*.1,setting.bgm*.1) + local v=setting.bgm*.01 + v=min(v,src:getVolume()+.025*v) src:setVolume(v) - if v>=setting.bgm*.1 then return true end + if v>=setting.bgm*.01 then return true end end local BGM={ @@ -23,9 +24,11 @@ local BGM={ --playing=[src:playing SRC] } BGM.list={ - "blank","way","race","newera","push","reason","infinite", + "blank", + "race","push","way","reason", + "newera","oxygen","infinite", "secret7th","secret8th", - "shining terminal","oxygen","distortion","far", + "shining terminal","distortion","far", "rockblock","cruelty","final","8-bit happiness","end", "how feeling", } @@ -65,7 +68,7 @@ function BGM.play(s) end function BGM.freshVolume() if BGM.playing then - local v=setting.bgm*.1 + local v=setting.bgm*.01 if v>0 then BGM.playing:setVolume(v) if BGM.suspend then diff --git a/Zframework/color.lua b/Zframework/color.lua index 9da386e0..c8be4c4b 100644 --- a/Zframework/color.lua +++ b/Zframework/color.lua @@ -9,7 +9,7 @@ local color={ lRed={1,.5,.5}, lGreen={.5,1,.5}, - lBlue={.6,.6,1}, + lBlue={.6,.7,1}, lCyan={.5,1,1}, lMagenta={1,.5,1}, lYellow={1,1,.5}, @@ -32,7 +32,6 @@ local color={ pink={1,0,.6}, grass={.6,1,0}, water={0,1,.6}, - bronze={.7,.4,0}, white={1,1,1}, purple={.5,0,1}, } diff --git a/Zframework/file.lua b/Zframework/file.lua index 022d36ca..0bbdee9c 100644 --- a/Zframework/file.lua +++ b/Zframework/file.lua @@ -59,7 +59,7 @@ local function dumpTable(L,t) end return s..tabs[t-1].."}" end -local function addToTable(G,base)--refresh default base with G-values +local function addToTable(G,base)--Refresh default base with G-values for k,v in next,G do if type(v)==type(base[k])then if type(v)=="table"then @@ -79,8 +79,8 @@ local files={ unlock= fs.newFile("unlock.dat"), } -local File={} -function File.loadRecord(N) +local FILE={} +function FILE.loadRecord(N) local F=fs.newFile(N..".dat") if F:open("r")then local s=loadstring(F:read()) @@ -93,7 +93,7 @@ function File.loadRecord(N) end end end -function File.saveRecord(N,L) +function FILE.saveRecord(N,L) local F=fs.newFile(N..".dat") F:open("w") local _,mes=F:write(dumpTable(L)) @@ -102,11 +102,11 @@ function File.saveRecord(N,L) TEXT.show(text.recSavingError..(mes or"unknown error"),1140,650,20,"sudden",.5) end end -function File.delRecord(N) +function FILE.delRecord(N) fs.remove(N..".dat") end -function File.loadUnlock() +function FILE.loadUnlock() local F=files.unlock if F:open("r")then local s=F:read() @@ -119,7 +119,7 @@ function File.loadUnlock() end end end -function File.saveUnlock() +function FILE.saveUnlock() local F=files.unlock F:open("w") local _,mes=F:write(dumpTable(modeRanks)) @@ -129,7 +129,7 @@ function File.saveUnlock() end end -function File.loadData() +function FILE.loadData() local F=files.data if F:open("r")then local s=F:read() @@ -145,7 +145,7 @@ function File.loadData() end end end -function File.saveData() +function FILE.saveData() local F=files.data F:open("w") local _,mes=F:write(dumpTable(stat)) @@ -155,7 +155,7 @@ function File.saveData() end end -function File.loadSetting() +function FILE.loadSetting() local F=files.setting if F:open("r")then local s=F:read() @@ -170,7 +170,7 @@ function File.loadSetting() end end end -function File.saveSetting() +function FILE.saveSetting() local F=files.setting F:open("w") local _,mes=F:write(dumpTable(setting)) @@ -180,7 +180,7 @@ function File.saveSetting() end end -function File.loadKeyMap() +function FILE.loadKeyMap() local F=files.keyMap if F:open("r")then local s=loadstring(F:read()) @@ -191,7 +191,7 @@ function File.loadKeyMap() end end end -function File.saveKeyMap() +function FILE.saveKeyMap() local F=files.keyMap F:open("w") local _,mes=F:write(dumpTable(keyMap)) @@ -201,7 +201,7 @@ function File.saveKeyMap() end end -function File.loadVK() +function FILE.loadVK() local F=files.VK if F:open("r")then local s=loadstring(F:read()) @@ -212,7 +212,7 @@ function File.loadVK() end end end -function File.saveVK() +function FILE.saveVK() local F=files.VK F:open("w") local _,mes=F:write(dumpTable(VK_org)) @@ -221,4 +221,4 @@ function File.saveVK() else TEXT.show(text.VKSavingError..(mes or"unknown error"),1140,650,20,"sudden",.5) end end -return File \ No newline at end of file +return FILE \ No newline at end of file diff --git a/Zframework/init.lua b/Zframework/init.lua index 854d81da..f3be419b 100644 --- a/Zframework/init.lua +++ b/Zframework/init.lua @@ -25,11 +25,12 @@ local Timer=love.timer.getTime local int,rnd,max,min=math.floor,math.random,math.max,math.min local abs=math.abs local ins,rem=table.insert,table.remove +local byte=string.byte local scr=scr local xOy=love.math.newTransform() local mx,my,mouseShow=-20,-20,false -local touching=nil--first touching ID(userdata) +local touching=nil--First touching ID(userdata) local touchDist=nil joysticks={} @@ -127,12 +128,85 @@ local touchDown,touchUp,touchMove={},{},{} local keyDown,keyUp={},{} local gamepadDown,gamepadUp={},{} +function keyDown.calculator(k) + local S=sceneTemp + if byte(k)>=48 and byte(k)<=57 then + if S.sym=="="then + S.val=tonumber(k) + S.sym=false + elseif S.sym then + if not S.reg then + S.reg=S.val + S.val=tonumber(k) + elseif S.val<1e13 then + S.val=S.val*10+tonumber(k) + end + else + if S.val<1e13 then + S.val=S.val*10+tonumber(k) + end + end + elseif k=="backspace"then + if S.val>0 then + S.val=int(S.val/10) + end + elseif k=="+"or k=="="and kb.isDown("rshift","lshift")then + S.sym="+" + elseif k=="-"then + S.sym="-" + elseif k=="*"or k=="8"and kb.isDown("rshift","lshift")then + S.sym="*" + elseif k=="/"then + S.sym="/" + elseif k=="return"then + if S.val then + if S.sym and S.reg then + S.val= + S.sym=="+"and S.reg+S.val or + S.sym=="-"and S.reg-S.val or + S.sym=="*"and S.reg*S.val or + S.sym=="/"and S.reg/S.val or + -1 + end + S.sym="=" + S.reg=false + if S.val==626 then + S.pass=true + elseif S.val==196022 then + S.pass=true + marking=nil + TEXT.show("\68\69\86\58\87\97\116\101\114\109\97\114\107\32\82\101\109\111\118\101\100",640,360,60,"stretch",.6) + SFX.play("clear") + elseif S.val==72943816 then + S.pass=true + for name,M in next,Modes do + if not modeRanks[name]then + modeRanks[name]=M.score and 0 or 6 + end + end + FILE.saveUnlock() + TEXT.show("\68\69\86\58\85\78\76\79\67\75\65\76\76",640,360,60,"stretch",.6) + SFX.play("clear_2") + elseif S.val==137926261379 then + SCN.go("debug") + end + end + elseif k=="space"then + if S.pass then + SCN.swapTo("intro") + end + end +end + + function keyDown.load(k) if k=="a"then sceneTemp.skip=true elseif k=="s"then marking=nil sceneTemp.skip=true + elseif k=="escape"then + SCN.back() end end function touchDown.load(id,x,y) @@ -145,19 +219,22 @@ function mouseDown.intro(x,y,k) if k==2 then VOC.play("bye") SCN.back() + elseif newVersionLaunch then + SCN.push("main","fade") + SCN.swapTo("history","fade") + TEXT.show(text.newVersion,640,200,30,"fly",.3) else - SCN.goto("main") + SCN.go("main") end end function touchDown.intro(id,x,y) - SCN.goto("main") + mouseDown.intro() end function keyDown.intro(key) if key=="escape"then - VOC.play("bye") - SCN.back() + mouseDown.intro(nil,nil,2) else - SCN.goto("main") + mouseDown.intro() end end @@ -229,7 +306,7 @@ function touchMove.mode(id,x,y,dx,dy) mapCam.x,mapCam.y=mapCam.x-dx,mapCam.y-dy elseif not L[3]then x,y=xOy:inverseTransformPoint(tc.getPosition(L[1])) - dx,dy=xOy:inverseTransformPoint(tc.getPosition(L[2]))--not delta!!! + dx,dy=xOy:inverseTransformPoint(tc.getPosition(L[2]))--Not delta!!! local d=(x-dx)^2+(y-dy)^2 if d>100 then d=d^.5 @@ -270,7 +347,7 @@ function keyDown.mode(key) end elseif mapCam.sel=="custom_clear" or mapCam.sel=="custom_puzzle" then if key=="e"then - SCN.goto("custom") + SCN.go("custom") end end end @@ -327,9 +404,9 @@ function keyDown.custom(key) BGM.play(customRange.bgm[customSel[sel]]) end elseif key=="q"then - SCN.goto("sequence") + SCN.go("sequence") elseif key=="e"then - SCN.swapTo("draw") + SCN.swapTo("draw","swipe") elseif #key==1 then local T=tonumber(key) if T and T>=1 and T<=5 then @@ -360,8 +437,20 @@ function keyDown.sequence(key) local C=s.cur+1 ins(preBag,C,key) s.cur=C + elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then + if #preBag>0 then + love.system.setClipboardText("Techmino SEQ:"..copySequence()) + TEXT.show(text.copySuccess,640,225,50,"appear",.5) + end + elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then + local str=love.system.getClipboardText() + local p=string.find(str,":")--ptr* + if p then str=string.sub(str,p+1)end + if not pasteSequence(str)then + TEXT.show(text.dataCorrupted,640,225,45,"flicker",.5) + end elseif #key==1 then - local i=(kb.isDown("lctrl","lshift","lalt","rctrl","rshift","ralt")and minoKey2 or minoKey)[key] + local i=(kb.isDown("lshift","lalt","rshift","ralt")and minoKey2 or minoKey)[key] if i then local C=s.cur+1 ins(preBag,C,i) @@ -385,6 +474,7 @@ function keyDown.sequence(key) preBag={} sceneTemp.cur=0 sceneTemp.sure=0 + SFX.play("finesseError",.7) else sceneTemp.sure=50 end @@ -449,6 +539,7 @@ function keyDown.draw(key) if sceneTemp.sure>20 then for y=1,20 do for x=1,10 do preField[y][x]=0 end end sceneTemp.sure=0 + SFX.play("finesseError",.7) else sceneTemp.sure=50 end @@ -457,13 +548,19 @@ function keyDown.draw(key) preField[sy][sx]=pen end elseif key=="e"then - SCN.swapTo("custom") + SCN.swapTo("custom","swipe") elseif key=="escape"then SCN.back() - elseif key=="c"and kb.isDown("lctrl","rctrl")then - copyBoard() - elseif key=="v"and kb.isDown("lctrl","rctrl")then - pasteBoard() + elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then + love.system.setClipboardText("Techmino Field:"..copyBoard()) + TEXT.show(text.copySuccess,350,360,40,"appear",.5) + elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then + local str=love.system.getClipboardText() + local p=string.find(str,":")--ptr* + if p then str=string.sub(str,p+1)end + if not pasteBoard(str)then + TEXT.show(text.dataCorrupted,350,360,35,"flicker",.5) + end else pen=penKey[key]or pen end @@ -596,70 +693,73 @@ function keyDown.pause(key) elseif key=="escape"then resumeGame() elseif key=="s"then - SCN.goto("setting_sound") + SCN.go("setting_sound") elseif key=="r"then TASK.clear("play") - mergeStat(stat,players[1].stat) resetGameData() SCN.swapTo("play","none") + elseif key=="p"and(game.result or game.replaying)then + TASK.removeTask_code(TICK.autoPause) + resetPartGameData(true) + SCN.swapTo("play","none") end end function touchDown.play(id,x,y) - if setting.VKSwitch then - local t=onVirtualkey(x,y) - if t then - players[1]:pressKey(t) - if setting.VKSFX>0 then - SFX.play("virtualKey",setting.VKSFX*.25) - end - virtualkey[t].isDown=true - virtualkey[t].pressTime=10 - if setting.VKTrack then - local B=virtualkey[t] - if setting.VKDodge then--button collision (not accurate) - for i=1,#virtualkey do - local b=virtualkey[i] - local d=B.r+b.r-((B.x-b.x)^2+(B.y-b.y)^2)^.5--hit depth(Neg means distance) - if d>0 then - b.x=b.x+(b.x-B.x)*d*b.r*5e-4 - b.y=b.y+(b.y-B.y)*d*b.r*5e-4 - end + if not setting.VKSwitch or game.replaying then return end + + local t=onVirtualkey(x,y) + if t then + players[1]:pressKey(t) + if setting.VKSFX>0 then + SFX.play("virtualKey",setting.VKSFX*.25) + end + virtualkey[t].isDown=true + virtualkey[t].pressTime=10 + if setting.VKTrack then + local B=virtualkey[t] + if setting.VKDodge then--Button collision (not accurate) + for i=1,#virtualkey do + local b=virtualkey[i] + local d=B.r+b.r-((B.x-b.x)^2+(B.y-b.y)^2)^.5--Hit depth(Neg means distance) + if d>0 then + b.x=b.x+(b.x-B.x)*d*b.r*5e-4 + b.y=b.y+(b.y-B.y)*d*b.r*5e-4 end end - local O=VK_org[t] - local _FW,_CW=setting.VKTchW*.1,1-setting.VKCurW*.1 - local _OW=1-_FW-_CW - - --Auto follow: finger, current, origin (weight from setting) - B.x,B.y=x*_FW+B.x*_CW+O.x*_OW,y*_FW+B.y*_CW+O.y*_OW end - VIB(setting.VKVIB) + local O=VK_org[t] + local _FW,_CW=setting.VKTchW*.1,1-setting.VKCurW*.1 + local _OW=1-_FW-_CW + + --Auto follow: finger, current, origin (weight from setting) + B.x,B.y=x*_FW+B.x*_CW+O.x*_OW,y*_FW+B.y*_CW+O.y*_OW end + VIB(setting.VKVIB) end end function touchUp.play(id,x,y) - if setting.VKSwitch then - local t=onVirtualkey(x,y) - if t then - players[1]:releaseKey(t) - end + if not setting.VKSwitch or game.replaying then return end + + local t=onVirtualkey(x,y) + if t then + players[1]:releaseKey(t) end end function touchMove.play(id,x,y,dx,dy) - if setting.VKSwitch then - local l=tc.getTouches() - for n=1,#virtualkey do - local B=virtualkey[n] - for i=1,#l do - local x,y=xOy:inverseTransformPoint(tc.getPosition(l[i])) - if(x-B.x)^2+(y-B.y)^2<=B.r^2 then - goto next - end + if not setting.VKSwitch or game.replaying then return end + + local l=tc.getTouches() + for n=1,#virtualkey do + local B=virtualkey[n] + for i=1,#l do + local x,y=xOy:inverseTransformPoint(tc.getPosition(l[i])) + if(x-B.x)^2+(y-B.y)^2<=B.r^2 then + goto next end - players[1]:releaseKey(n) - ::next:: end + players[1]:releaseKey(n) + ::next:: end end function keyDown.play(key) @@ -667,6 +767,7 @@ function keyDown.play(key) pauseGame() return end + if game.replaying then return end local m=keyMap for k=1,20 do if key==m[1][k]or key==m[2][k]then @@ -678,6 +779,7 @@ function keyDown.play(key) end end function keyUp.play(key) + if game.replaying then return end local m=keyMap for k=1,20 do if key==m[1][k]or key==m[2][k]then @@ -689,6 +791,8 @@ function keyUp.play(key) end function gamepadDown.play(key) if key=="back"then SCN.back()return end + if game.replaying then return end + local m=keyMap for k=1,20 do if key==m[3][k]or key==m[4][k]then @@ -700,65 +804,37 @@ function gamepadDown.play(key) end end function gamepadUp.play(key) - local m=keyMap - for p=1,players.human do - for k=1,20 do - if key==m[3][k]or key==m[4][k]then - players[1]:releaseKey(k) - virtualkey[k].isDown=false - return - end - end - end -end + if game.replaying then return end -function keyDown.staff(key,RESET) - if key=="escape"then - SCN.back() - elseif key=="\122"then - if RESET or kb.isDown("\109")and kb.isDown("\114")then - SCN.goto("debug") + local m=keyMap + for k=1,20 do + if key==m[3][k]or key==m[4][k]then + players[1]:releaseKey(k) + virtualkey[k].isDown=false + return end end end -function touchDown.staff(id,x,y) - local pw=sceneTemp.pw - local t=pw%4 - if - t==0 and x<640 and y<360 or - t==1 and x>640 and y<360 or - t==2 and x<640 and y>360 or - t==3 and x>640 and y>360 - then - pw=pw+1 - if pw==8 then - SCN.goto("debug") - end - else - pw=x<640 and y<360==1 and 1 or 0 - end - sceneTemp.pw=pw -end function wheelMoved.history(x,y) wheelScroll(y) end function keyDown.history(key) if key=="up"then - sceneTemp[2]=max(sceneTemp[2]-1,1) + sceneTemp.pos=max(sceneTemp.pos-1,1) elseif key=="down"then - sceneTemp[2]=min(sceneTemp[2]+1,#sceneTemp[1]) + sceneTemp.pos=min(sceneTemp.pos+1,#sceneTemp.text) elseif key=="escape"then SCN.back() end end ------------------------------------------------------------- -local lastX,lastY=0,0--last clickDown pos -function love.mousepressed(x,y,k,t,num) - if t then return end +local lastX,lastY=0,0--Last clickDown pos +function love.mousepressed(x,y,k,touch,num) + if touch then return end mouseShow=true mx,my=xOy:inverseTransformPoint(x,y) - if devMode==1 then print(mx,my)end + if devMode==1 then DBP(mx,my)end if SCN.swapping then return end if mouseDown[SCN.cur]then mouseDown[SCN.cur](mx,my,k) @@ -769,6 +845,7 @@ function love.mousepressed(x,y,k,t,num) WIDGET.press(mx,my) end lastX,lastY=mx,my + sysFX.newRipple(.3,mx,my,30) end function love.mousemoved(x,y,dx,dy,t) if t then return end @@ -785,10 +862,9 @@ function love.mousemoved(x,y,dx,dy,t) WIDGET.moveCursor(mx,my) end end -function love.mousereleased(x,y,k,t,num) - if t then return end +function love.mousereleased(x,y,k,touch,num) + if touch or SCN.swapping then return end mx,my=xOy:inverseTransformPoint(x,y) - if t or SCN.swapping then return end if mouseUp[SCN.cur]then mouseUp[SCN.cur](mx,my,k) end @@ -808,7 +884,7 @@ function love.touchpressed(id,x,y) touching=id love.touchmoved(id,x,y,0,0) end - touchDist=nil--reset distance + touchDist=nil--Reset distance x,y=xOy:inverseTransformPoint(x,y) lastX,lastY=x,y if touchDown[SCN.cur]then @@ -843,27 +919,18 @@ function love.touchreleased(id,x,y) if touchUp[SCN.cur]then touchUp[SCN.cur](id,x,y) end - if(x-lastX)^2+(y-lastY)^2<26 and touchClick[SCN.cur]then - touchClick[SCN.cur](x,y,k) + if(x-lastX)^2+(y-lastY)^2<26 then + if touchClick[SCN.cur]then + touchClick[SCN.cur](x,y,k) + end + sysFX.newRipple(.3,x,y,30) end end function love.keypressed(i) mouseShow=false - if not devMode then - if i~="f8"then - if SCN.swapping then return end - - if keyDown[SCN.cur]then keyDown[SCN.cur](i) - elseif i=="escape"then SCN.back() - else WIDGET.keyPressed(i) - end - else - devMode=1 - TEXT.show("DEBUG ON",640,360,80,"fly",.8) - end - else + if devMode then if i=="f5"then - print("DEBUG:") + DBP("DEBUG:") elseif i=="f8"then devMode=nil TEXT.show("DEBUG OFF",640,360,80,"fly",.8) elseif i=="f9"then devMode=1 TEXT.show("DEBUG 1",640,360,80,"fly",.8) elseif i=="f10"then devMode=2 TEXT.show("DEBUG 2",640,360,80,"fly",.8) @@ -885,7 +952,7 @@ function love.keypressed(i) assert(false,"Techmino:挂了") elseif i=="e"then for k,v in next,_G do - print(k,v) + DBP(k,v) end elseif WIDGET.sel then local W=WIDGET.sel @@ -901,7 +968,22 @@ function love.keypressed(i) elseif i=="]"then W.font=W.font+1 end end + else + goto NORMAL end + return + end + ::NORMAL:: + if i~="f8"then + if SCN.swapping then return end + + if keyDown[SCN.cur]then keyDown[SCN.cur](i) + elseif i=="escape"then SCN.back() + else WIDGET.keyPressed(i) + end + else + devMode=1 + TEXT.show("DEBUG ON",640,360,80,"fly",.8) end end function love.keyreleased(i) @@ -970,10 +1052,11 @@ function love.lowmemory() collectgarbage() end function love.resize(w,h) - scr.w,scr.h=w,h + scr.w,scr.h,scr.dpi=w,h,gc.getDPIScale() + scr.W,scr.H=scr.w*scr.dpi,scr.h*scr.dpi scr.r=h/w scr.rad=(w^2+h^2)^.5 - scr.dpi=gc.getDPIScale() + if scr.r>=.5625 then scr.k=w/1280 scr.x,scr.y=0,(h-w*9/16)*.5 @@ -989,13 +1072,77 @@ function love.resize(w,h) end function love.focus(f) if f then - TASK.new(TICK.autoResize,{0}) love.timer.step() elseif SCN.cur=="play"and setting.autoPause then pauseGame() end end -local scs={1,2,1,2,1,2,1,2,1,2,1.5,1.5,.5,2.5} +function love.errorhandler(msg) + local PUMP,POLL=love.event.pump,love.event.poll + love.mouse.setVisible(true) + love.audio.stop() + local err={"Error:"..msg} + local trace=debug.traceback("",2) + local c=2 + for l in string.gmatch(trace,"(.-)\n")do + if c>2 then + if not string.find(l,"boot")then + err[c]=string.gsub(l,"^\t*","") + c=c+1 + end + else + err[2]="Traceback" + c=3 + end + end + print(table.concat(err,"\n"),1,c-2) + gc.reset() + local CAP + local function _(_)CAP=gc.newImage(_)end + gc.captureScreenshot(_) + gc.present() + setting.sfx=setting.voc--only for error "voice" played with voice volume,not saved + if SFX.list.error then SFX.play("error",.8)end + local BGcolor=rnd()>.026 and{.3,.5,.9}or{.62,.3,.926} + local needDraw=true + return function() + PUMP() + for E,a,b,c,d,e in POLL()do + if E=="quit"or a=="escape"then + destroyPlayers() + return 1 + elseif E=="resize"then + love.resize(a,b) + needDraw=true + elseif E=="focus"then + needDraw=true + end + end + if needDraw then + gc.discard() + gc.clear(BGcolor) + gc.setColor(1,1,1) + gc.push("transform") + gc.replaceTransform(xOy) + gc.draw(CAP,100,365,nil,512/CAP:getWidth(),288/CAP:getHeight()) + setFont(120)gc.print(":(",100,40) + setFont(38)gc.printf(text.errorMsg,100,200,1280-100) + setFont(20) + gc.print(system.."-"..gameVersion,100,660) + gc.print("scene:"..SCN.cur,400,660) + gc.printf(err[1],626,360,1260-626) + gc.print("TRACEBACK",626,426) + for i=4,#err-2 do + gc.print(err[i],626,370+20*i) + end + gc.pop() + gc.present() + needDraw=false + end + love.timer.sleep(.2) + end +end +local scs={.5,1.5,.5,1.5,.5,1.5,.5,1.5,.5,1.5,1,1,0,2} local devColor={ color.white, color.lMagenta, @@ -1012,9 +1159,10 @@ function love.run() local waitTime=1/60 local LIST={} - local lastFrame=T.getTime() + + local lastFrame=Timer() local lastFreshPow=lastFrame - local FCT=0--framedraw counter + local FCT=0--Framedraw counter love.resize(gc.getWidth(),gc.getHeight()) SCN.init("load")--Scene Launch @@ -1071,7 +1219,7 @@ function love.run() local R=int(r)%7+1 _=SKIN.libColor[setting.skin[R]] gc.setColor(_[1],_[2],_[3],min(1-abs(1-r%1*2),.3)) - gc.draw(TEXTURE.miniBlock[R],mx,my,Timer()%3.1416*4,20,20,scs[2*R]-.5,#blocks[R][0]-scs[2*R-1]+.5) + gc.draw(TEXTURE.miniBlock[R],mx,my,Timer()%3.1416*4,20,20,scs[2*R],#blocks[R][0]-scs[2*R-1]) gc.setColor(1,1,1,.5)gc.circle("fill",mx,my,5) gc.setColor(1,1,1)gc.circle("fill",mx,my,3) end @@ -1087,7 +1235,7 @@ function love.run() --Draw scene swapping animation if SCN.swapping then - _=SCN.swap + _=SCN.stat _.draw(_.time) end @@ -1109,8 +1257,8 @@ function love.run() for i=1,#LIST do gc.rectangle("fill",900+2*i,_,2,-LIST[i]*4000) end - if devMode==3 then WAIT(.26) - elseif devMode==4 then WAIT(.626) + if devMode==3 then WAIT(.1) + elseif devMode==4 then WAIT(.5) end end @@ -1119,13 +1267,18 @@ function love.run() end --Fresh power info. - if Timer()-lastFreshPow>3 and setting.powerInfo and SCN.cur~="load"then + if Timer()-lastFreshPow>2 and setting.powerInfo and loadingFinished then updatePowerInfo() lastFreshPow=Timer() + _=gc.getWidth() + if _~=scr.w then + love.resize(_,gc.getHeight()) + end end --Keep 60fps - if Timer()-lastFrame<.005 then WAIT(.01)end - while Timer()-lastFrame<.0159 do WAIT(.001)end + _=Timer()-lastFrame + if _<.016 then WAIT(.016-_)end + while Timer()-lastFrame<1/60-0.000005 do WAIT(0)end end end \ No newline at end of file diff --git a/Zframework/languages.lua b/Zframework/languages.lua index 63cbd9e5..617c995e 100644 --- a/Zframework/languages.lua +++ b/Zframework/languages.lua @@ -2,6 +2,7 @@ local langList={ { anykey="按任意键继续", newVersion="检测到更新!", + newBigVersion="检测到大更新!大量存档信息已修改", marking="游戏作者:MrZ_26\n任何视频/直播不得出现此水印\n任何转述声明无效", lang="中文", atkModeName={"随机","徽章","击杀","反击"}, @@ -12,17 +13,19 @@ local langList={ mini="Mini",b2b="B2B ",b3b="B2B2B ", PC="Perfect Clear",HPC="Half Clear", hold="暂存",next="下一个", + replaying="[回放]", stage=function(n)return"关卡 "..n end, great="Great!", awesome="Awesome.", + almost="Almost!", continue="Continue.", maxspeed="最高速度", speedup="速度加快", win="胜利", - finish="结束", - lose="失败", + finish="完成", + gameover="游戏结束", pause="暂停", pauseCount="暂停统计", @@ -83,8 +86,6 @@ local langList={ unlockSavingError="解锁保存失败:", recSavingError="纪录保存失败:", - ai_fixed="不能同时开启AI和固定序列", - ai_prebag="不能同时开启AI和自定义序列", switchSpawnSFX="请开启方块出生音效", needRestart="重新开始以生效", @@ -124,7 +125,7 @@ local langList={ radar={"DEF","OFF","ATK","SEND","SPD","DIG"}, radarData={ "D'PM", - "OPM", + "ADPM", "APM", "SPM", "L'PM", @@ -152,8 +153,8 @@ local langList={ "", "使用LOVE2D引擎", "错误或者建议请附带截图发送到内测群或者作者邮箱~", - "仅通过内测群1080457319进行免费下载/更新", - "其他渠道获得游戏皆有被修改/加广告/植入病毒的风险,程序只申请了震动&联网权限!", + "仅通过内测群1127702001进行免费下载/更新", + "其他渠道获得游戏皆有被修改/加广告/植入病毒的风险,程序只申请了振动&联网权限!", "若由于被修改的本游戏产生的各种损失作者不负责(我怎么负责啊跟我有啥关系)", "请从正规途径获得最新版,游戏现为免费,不过有打赏当然感谢啦~", }, @@ -161,16 +162,18 @@ local langList={ "作者:MrZ 邮箱:1046101471@qq.com", "使用LOVE2D引擎", "", - "程序:MrZ, FinnTenzor", - "美术:MrZ, (Gnyar)", - "音乐:MrZ, (T0722)", + "程序: MrZ, FinnTenzor", + "美术: MrZ, (Gnyar)", + "音乐: MrZ, (T0722)", "音效/语音: MrZ, Miya", - "演出: 模电, 吉备宏纯", + "演出: 模电, HBM", + "测试: 思竣", + "英文文案: User670", "官网: 渣渣120", "", "特别感谢:", "Flyz, Farter, 蕴空之灵,", - "茶管, 思竣, [所有内测人员]", + "茶管, [所有内测人员]", }, used=[[ 使用工具: @@ -182,8 +185,19 @@ local langList={ simple-love-lights[dylhunn] ]], support="支持作者", - group="官方QQ群(如果没有被暗改的话就是这个):1080457319", + group="官方QQ群(如果没有被暗改的话就是这个):1127702001", WidgetText={ + calculator={ + _1="1",_2="2",_3="3", + _4="4",_5="5",_6="6", + _7="7",_8="8",_9="9", + _0="0",["<"]="<",["="]="=", + ["+"]="+", + ["-"]="-", + ["*"]="*", + ["/"]="/", + play="开始", + }, main={ play="开始", setting="设置", @@ -228,9 +242,12 @@ local langList={ right="→", backsp="0 then gc.setColor(1,1,1,a*_*.08) gc.circle("fill",B.x,B.y,B.r*.94,10)--Glow @@ -94,6 +94,16 @@ end local Pnt={} +function Pnt.calculator() + local S=sceneTemp + gc.setLineWidth(4) + gc.rectangle("line",100,80,650,150) + setFont(45) + if S.reg then gc.printf(S.reg,0,100,720,"right")end + if S.val then gc.printf(S.val,0,150,720,"right")end + setFont(50) + if S.sym then gc.print(S.sym,126,150)end +end function Pnt.load() local S=sceneTemp gc.setLineWidth(4) @@ -101,13 +111,15 @@ function Pnt.load() gc.rectangle("fill",300,330,S.cur/S.tar*680,60,5) gc.setColor(1,1,1) gc.rectangle("line",300,330,680,60,5) - setFont(35) - gc.print(text.load[S.phase],340,335) - if S.phase~=0 then - gc.printf(S.cur.."/"..S.tar,795,335,150,"right") + if not setting.appLock then + setFont(35) + gc.print(text.load[S.phase],340,335) + if S.phase~=0 then + gc.printf(S.cur.."/"..S.tar,795,335,150,"right") + end + setFont(25) + mStr(S.tip,640,400) end - setFont(25) - mStr(S.tip,640,400) end local titleTransform={ @@ -186,6 +198,7 @@ function Pnt.mode() local sel=cam.sel setFont(30) + --Draw lines connecting modes gc.setLineWidth(8) gc.setColor(1,1,1,.2) for name,M in next,Modes do @@ -195,7 +208,7 @@ function Pnt.mode() gc.line(M.x,M.y,m.x,m.y) end end - end--lines connecting modes + end for name,M in next,Modes do if R[name]then @@ -217,7 +230,7 @@ function Pnt.mode() gc.setLineWidth(10) gc.rectangle("line",M.x-S+5,M.y-S+5,2*S-10,2*S-10) end - elseif M.shape==2 then--diamond + elseif M.shape==2 then--Diamond gc.circle("fill",M.x,M.y,S+5,4) if sel==name then gc.setColor(1,1,1) @@ -353,10 +366,14 @@ function Pnt.sequence() gc.print(len,120,300) local L=TEXTURE.miniBlock + local lib=SKIN.libColor + local set=setting.skin + local x,y=120,126 local cx,cy=120,126 for i=1,len do local B=L[bag[i]] + gc.setColor(lib[set[bag[i]]]) gc.draw(B,x,y,nil,15,15,0,B:getHeight()*.5) x=x+B:getWidth()*15+10 if x>1126 then @@ -373,10 +390,9 @@ function Pnt.sequence() --Confirm reset if s.sure>0 then gc.setColor(1,1,1,s.sure*.02) - gc.draw(drawableText.question,1035,570) + gc.draw(drawableText.question,980,470) end end - function Pnt.draw() local sx,sy=sceneTemp.x,sceneTemp.y gc.translate(200,60) @@ -441,6 +457,7 @@ function Pnt.play() for p=1,#players do players[p]:draw() end + gc.setLineWidth(5) for i=1,#FX_attack do local A=FX_attack[i] @@ -463,9 +480,11 @@ function Pnt.play() gc.rotate(A.t*.1) gc.circle("fill",0,0,A.rad,A.corner) gc.pop() - end--FX animation + end + gc.setColor(1,1,1) if setting.VKSwitch then drawVirtualkey()end + if modeEnv.royaleMode then for i=1,#FX_badge do local b=FX_badge[i] @@ -501,12 +520,18 @@ function Pnt.play() gc.draw(drawableText.modeName,485,10) gc.draw(drawableText.levelName,511+drawableText.modeName:getWidth(),10) - --Danger + --Replaying + if game.replaying then + gc.setColor(1,1,Timer()%1>.5 and 1 or 0) + mText(drawableText.replaying,410,17) + end + + --Warning gc.push("transform") gc.origin() if restartCount>0 then gc.setColor(0,0,0,restartCount*.05) - gc.rectangle("fill",0,0,scr.w*scr.dpi,scr.h*scr.dpi) + gc.rectangle("fill",0,0,scr.W,scr.H) end if game.warnLVL>0 then gc.setColor(0,0,0,0) @@ -517,10 +542,10 @@ function Pnt.play() end gc.pop() end + local hexList={1,0,.5,1.732*.5,-.5,1.732*.5}for i=1,6 do hexList[i]=hexList[i]*150 end local textPos={90,131,-90,131,-200,-25,-90,-181,90,-181,200,-25} local dataPos={90,143,-90,143,-200,-13,-90,-169,90,-169,200,-13} - function Pnt.pause() local S=sceneTemp local T=S.timer*.02 @@ -531,7 +556,7 @@ function Pnt.pause() gc.setColor(.15,.15,.15,_) gc.push("transform") gc.origin() - gc.rectangle("fill",0,0,scr.w*scr.dpi,scr.h*scr.dpi) + gc.rectangle("fill",0,0,scr.W,scr.H) gc.pop() --Pause Info @@ -611,14 +636,14 @@ end function Pnt.setting_game() gc.setColor(1,1,1) mText(drawableText.setting_game,640,15) - gc.draw(blockSkin[int(Timer()*2)%11+1],720,540,Timer()%6.28319,2,nil,15,15) + gc.draw(blockSkin[int(Timer()*2)%11+1],590,540,Timer()%6.28319,2,nil,15,15) end function Pnt.setting_video() gc.setColor(1,1,1) mText(drawableText.setting_video,640,15) end function Pnt.setting_sound() - gc.setColor(1,1,1,.8) + gc.setColor(1,1,1) mText(drawableText.setting_sound,640,15) local t=Timer() local _=sceneTemp.jump @@ -632,6 +657,7 @@ function Pnt.setting_sound() gc.draw(IMG.miyaF4,129,98+3*sin(t*.7)) gc.translate(-x,-y) end + local function timeConv(t) return t.."F "..int(t*16.67).."ms" end @@ -724,7 +750,7 @@ function Pnt.setting_skin() for N=1,7 do local face=setting.face[N] local B=blocks[N][face] - local x,y=-25+140*N-scs[N][face][2]*30,325+scs[N][face][1]*30 + local x,y=-55+140*N-scs[N][face][2]*30,355+scs[N][face][1]*30 local col=#B[1] for i=1,#B do for j=1,col do if B[i][j]then @@ -843,6 +869,6 @@ function Pnt.history() gc.rectangle("line",30,45,1000,632) setFont(20) local _=sceneTemp - gc.print(_[1][_[2]],40,50) + gc.print(_.text[_.pos],40,50) end return Pnt \ No newline at end of file diff --git a/Zframework/scene.lua b/Zframework/scene.lua index b1b72ce5..021402e4 100644 --- a/Zframework/scene.lua +++ b/Zframework/scene.lua @@ -1,23 +1,20 @@ local gc=love.graphics -local int,max,log=math.floor,math.max,math.log +local int,abs=math.floor,math.abs +local max,log=math.max,math.log local rnd,sin,cos=math.random,math.sin,math.cos local format=string.format local scr=scr -local SCN={ - cur="load",--Current scene - swapping=false,--ifSwapping - swap={ - tar=nil, --Swapping target - style=nil, --Swapping style - mid=nil, --Loading point - time=nil, --Full swap time - draw=nil, --Swap draw func - }, - seq={"quit","slowFade"},--Back sequence -}--scene datas,returned local sceneInit={} sceneInit.quit=love.event.quit +function sceneInit.calculator() + sceneTemp={ + reg=false, + val=0, + sym=false, + pass=false, + } +end function sceneInit.load() sceneTemp={ phase=1,--Loading stage @@ -50,11 +47,11 @@ end function sceneInit.main() BG.set("space") BGM.play("blank") - destroyPlayers() + modeEnv={} - if not players[1]then - PLY.newDemoPlayer(1,900,35,1.1) - end--Create demo player + --Create demo player + destroyPlayers() + PLY.newDemoPlayer(1,900,35,1.1) end function sceneInit.music() if BGM.nowPlay then @@ -120,27 +117,27 @@ function sceneInit.pause(org) timer=org=="play"and 0 or 50, list={ toTime(S.time), - S.key.."/"..S.rotate.."/"..S.hold, + format("%d/%d/%d",S.key,S.rotate,S.hold), format("%d %.2fPPS",S.piece,S.piece/S.time), format("%d(%d) %.2fLPM",S.row,S.dig,S.row/S.time*60), format("%d(%d) %.2fAPM",S.atk,S.digatk,S.atk/S.time*60), format("%d(%d-%d)",S.pend,S.recv,S.recv-S.pend), format("%d/%d/%d/%d",S.clears[1],S.clears[2],S.clears[3],S.clears[4]), format("(%d)/%d/%d/%d",S.spins[1],S.spins[2],S.spins[3],S.spins[4]), - format("%d/%d;%d/%d",S.b2b,S.b3b,S.pc,S.hpc), - format("%d[%.2f%%]",S.extraPiece,100*max(1-S.extraRate/S.piece,0)), + format("%d/%d ; %d/%d",S.b2b,S.b3b,S.pc,S.hpc), + format("%d [%.2f%%]",S.extraPiece,100*max(1-S.extraRate/S.piece,0)), }, - --from right-down, 60 degree each + --From right-down, 60 degree each radar={ (S.off+S.dig)/S.time*60,--DefPM - (S.off)/S.time*60, --OffPM + (S.send+S.dig)/S.time*60,--ADPM S.atk/S.time*60, --AtkPM S.send/S.time*60, --SendPM S.piece/S.time*24, --LinePM S.dig/S.time*60, --DigPM }, - val={1/80,1/40,1/60,1/60,1/100,1/40}, + val={1/80,1/80,1/80,1/60,1/100,1/40}, timing=org=="play", } local _=sceneTemp @@ -186,7 +183,10 @@ function sceneInit.setting_video() BG.set("space") end function sceneInit.setting_sound() - sceneTemp={last=0,jump=0}--last sound time,animation count(10 to 0) + sceneTemp={ + last=0,--Last sound time + jump=0,--Animation timer(10 to 0) + } BG.set("space") end function sceneInit.setting_control() @@ -197,7 +197,7 @@ function sceneInit.setting_control() dir=1, wait=30, } - BG.set("game1") + BG.set("bg1") end function sceneInit.setting_key() sceneTemp={ @@ -207,7 +207,7 @@ function sceneInit.setting_key() } end function sceneInit.setting_touch() - BG.set("game3") + BG.set("rainbow") sceneTemp={ default=1, snap=1, @@ -222,7 +222,6 @@ function sceneInit.help() end function sceneInit.staff() sceneTemp={ - pw=0, time=0, v=1, } @@ -265,12 +264,19 @@ function sceneInit.stat() end end function sceneInit.history() - BG.set("game3") - sceneTemp={require("parts/updateLog"),1}--scroll pos + BG.set("rainbow") + sceneTemp={ + text=require("parts/updateLog"),--Text list + pos=1,--Scroll pos + } + if newVersionLaunch then + newVersionLaunch=nil + sceneTemp.pos=4 + end end function sceneInit.debug() sceneTemp={ - ct=0, + reset=false, } end function sceneInit.quit() @@ -282,47 +288,55 @@ function sceneInit.quit() end end - -local swap={ - none={1,0,NULL}, - flash={8,1,function()gc.clear(1,1,1)end}, - fade={30,15,function(t) - local t=t>15 and 2-t/15 or t/15 - gc.setColor(0,0,0,t) - gc.rectangle("fill",0,0,scr.w*scr.dpi,scr.h*scr.dpi) - end}, - fade_togame={120,20,function(t) - local t=t>20 and (120-t)/100 or t/20 - gc.setColor(0,0,0,t) - gc.rectangle("fill",0,0,scr.w*scr.dpi,scr.h*scr.dpi) - end}, - slowFade={180,90,function(t) - local t=t>90 and 2-t/90 or t/90 - gc.setColor(0,0,0,t) - gc.rectangle("fill",0,0,scr.w*scr.dpi,scr.h*scr.dpi) - end}, -}--Scene swapping animations -local backFunc={ - load=love.event.quit, - pause=function() - love.keyboard.setKeyRepeat(true) +local sceneBack={} +function sceneBack.load() + love.event.quit() +end +function sceneBack.pause() + love.keyboard.setKeyRepeat(true) + if not game.replaying then mergeStat(stat,players[1].stat) - TASK.clear("play") - end, - setting_game= function()FILE.saveSetting()end, - setting_video= function()FILE.saveSetting()end, - setting_sound= function()FILE.saveSetting()end, - setting_touch= function()FILE.saveVK()end, - setting_key= function()FILE.saveKeyMap()end, - setting_lang= function()FILE.saveSetting()end, -} + end + FILE.saveData() + TASK.clear("play") +end +function sceneBack.setting_game() + FILE.saveSetting() +end +function sceneBack.setting_video() + FILE.saveSetting() +end +function sceneBack.setting_sound() + FILE.saveSetting() +end +function sceneBack.setting_touch() + FILE.saveVK() +end +function sceneBack.setting_key() + FILE.saveKeyMap() +end +function sceneBack.setting_lang() + FILE.saveSetting() +end + +local SCN={ + cur="load",--Current scene + swapping=false,--If Swapping + stat={ + tar=nil, --Swapping target + style=nil, --Swapping style + mid=nil, --Loading point + time=nil, --Full swap time + draw=nil, --Swap draw func + }, + seq={"quit","slowFade"},--Back sequence +}--Scene datas, returned + function SCN.swapUpdate() - local S=SCN.swap + local S=SCN.stat S.time=S.time-1 if S.time==S.mid then SCN.init(S.tar,SCN.cur) - SCN.cur=S.tar - WIDGET.set(Widgets[S.tar]) collectgarbage() --Scene swapped this moment end @@ -332,6 +346,8 @@ function SCN.swapUpdate() end function SCN.init(s,org) if sceneInit[s]then sceneInit[s](org)end + SCN.cur=s + WIDGET.set(Widgets[s]) end function SCN.push(tar,style) if not SCN.swapping then @@ -342,10 +358,37 @@ function SCN.push(tar,style) end function SCN.pop() local _=SCN.seq - _[#_-1]=nil + _[#_],_[#_-1]=nil end -function SCN.swapTo(tar,style) - local S=SCN.swap + +local swap={ + none={1,0,NULL},--swap time, change time, draw function + flash={8,1,function()gc.clear(1,1,1)end}, + fade={30,15,function(t) + local t=t>15 and 2-t/15 or t/15 + gc.setColor(0,0,0,t) + gc.rectangle("fill",0,0,scr.W,scr.H) + end}, + fade_togame={120,20,function(t) + local t=t>20 and(120-t)/100 or t/20 + gc.setColor(0,0,0,t) + gc.rectangle("fill",0,0,scr.W,scr.H) + end}, + slowFade={180,90,function(t) + local t=t>90 and 2-t/90 or t/90 + gc.setColor(0,0,0,t) + gc.rectangle("fill",0,0,scr.W,scr.H) + end}, + swipe={30,15,function(t) + t=t/30 + gc.setColor(.1,.1,.1,1-abs(t-.5)) + t=t*t*(3-2*t)*2-1 + local w=scr.W + gc.rectangle("fill",t*w,0,w,scr.H) + end}, +}--Scene swapping animations +function SCN.swapTo(tar,style)--Parallel scene swapping, cannot back + local S=SCN.stat if not SCN.swapping and tar~=SCN.cur then SCN.swapping=true if not style then style="fade"end @@ -357,17 +400,18 @@ function SCN.swapTo(tar,style) S.draw=swap[3] end end -function SCN.goto(tar,style) +function SCN.go(tar,style)--Normal scene swapping, can back SCN.push()SCN.swapTo(tar,style) end function SCN.back() - if backFunc[SCN.cur] then backFunc[SCN.cur]()end - --func when scene end + --Leave scene + if sceneBack[SCN.cur] then sceneBack[SCN.cur]()end + + --Poll&Back to previous Scene local m=#SCN.seq if m>0 then SCN.swapTo(SCN.seq[m-1],SCN.seq[m]) SCN.seq[m],SCN.seq[m-1]=nil - --Poll&Back to preScene end end return SCN \ No newline at end of file diff --git a/Zframework/sfx.lua b/Zframework/sfx.lua index 7265f06d..d632ba0d 100644 --- a/Zframework/sfx.lua +++ b/Zframework/sfx.lua @@ -34,11 +34,11 @@ function SFX.loadAll() end end function SFX.fieldPlay(s,v,P) - SFX.play(s,v,(P.curX+P.sc[2]-6.5)*.15) + SFX.play(s,v,(P.curX+P.sc[2]-5.5)*.15) end -function SFX.play(s,vol,pos,force) - if setting.sfx==0 and not force then return end - local S=SFX.list[s]--source list +function SFX.play(s,vol,pos) + if setting.sfx==0 then return end + local S=SFX.list[s]--Source list if not S then return end local n=1 while S[n]:isPlaying()do @@ -58,11 +58,31 @@ function SFX.play(s,vol,pos,force) S:setPosition(0,0,0) end end - if not force then - S:setVolume((vol or 1)*setting.sfx*.1) - else - S:setVolume(vol*.1) + S:setVolume(((vol or 1)*setting.sfx*.01)^1.626) + S:play() +end +function SFX.fplay(s,vol,pos) + local S=SFX.list[s]--Source list + if not S then return end + local n=1 + while S[n]:isPlaying()do + n=n+1 + if not S[n]then + S[n]=S[1]:clone() + S[n]:seek(0) + break + end end + S=S[n]--AU_SRC + if S:getChannelCount()==1 then + if pos then + pos=pos*setting.stereo*.1 + S:setPosition(pos,1-pos^2,0) + else + S:setPosition(0,0,0) + end + end + S:setVolume((vol*.01)^1.626) S:play() end function SFX.reset() diff --git a/Zframework/shader.lua b/Zframework/shader.lua index 174adbd6..3a6a4107 100644 --- a/Zframework/shader.lua +++ b/Zframework/shader.lua @@ -9,6 +9,6 @@ return{ aura=N("aura"), gradient1=N("grad1"),--Horizonal red-blue gradient gradient2=N("grad2"),--Vertical red-green gradient - rgb1=N("rgb1"),--colorful RGB - rgb2=N("rgb2"),--blue RGB + rgb1=N("rgb1"),--Colorful RGB + rgb2=N("rgb2"),--Blue RGB } \ No newline at end of file diff --git a/Zframework/shader/warning.glsl b/Zframework/shader/warning.glsl index 2a96757e..3b09273d 100644 --- a/Zframework/shader/warning.glsl +++ b/Zframework/shader/warning.glsl @@ -3,6 +3,6 @@ extern float level; vec4 effect(vec4 color,Image text,vec2 pos,vec2 scr_pos){ float dx=abs(scr_pos.x/w-0.5); float dy=abs(scr_pos.y/h-0.5); - float a=(max(dx,dy)*2.-.626)*level; + float a=(max(dx*2.6,dy*1.8)-.626)*level; return vec4(1.,0.,0.,a); } \ No newline at end of file diff --git a/Zframework/sysFX.lua b/Zframework/sysFX.lua index 2ef49937..fb302a21 100644 --- a/Zframework/sysFX.lua +++ b/Zframework/sysFX.lua @@ -1,31 +1,47 @@ local gc=love.graphics local setColor=gc.setColor local setWidth=gc.setLineWidth -local rect=gc.rectangle +local ins,rem=table.insert,table.remove local fx={} +local FXupdate={} +function FXupdate.ripple(S,dt) + S.t=S.t+dt*S.rate + return S.t>=1 +end +function FXupdate.rectRipple(S,dt) + S.t=S.t+dt*S.rate + return S.t>=1 +end +function FXupdate.shade(S,dt) + S.t=S.t+dt*S.rate + return S.t>=1 +end + local FXdraw={} function FXdraw.ripple(S) + setWidth(2) + local t=S.t + setColor(1,1,1,1-t) + gc.circle("line",S.x,S.y,t*(2-t)*S.r) +end +function FXdraw.rectRipple(S) setWidth(6) setColor(1,1,1,1-S.t) local r=(10*S.t)^1.2 - rect("line",S[1]-r,S[2]-r,S[3]+2*r,S[4]+2*r) + gc.rectangle("line",S.x-r,S.y-r,S.w+2*r,S.h+2*r) end function FXdraw.shade(S) - setColor(S[1],S[2],S[3],1-S.t) - rect("fill",S[4],S[5],S[6],S[7],2) + setColor(S.r,S.g,S.b,1-S.t) + gc.rectangle("fill",S.x,S.y,S.w,S.h,2) end local sysFX={} function sysFX.update(dt) for i=#fx,1,-1 do - local S=fx[i] - S.t=S.t+dt*S.rate - if S.t>=1 then - for i=i,#fx do - fx[i]=fx[i+1] - end + if fx[i]:update(dt) then + rem(fx,i) end end end @@ -34,9 +50,33 @@ function sysFX.draw() fx[i]:draw() end end ---0=ripple,x,y,w,h ---1=shade,r,g,b,x,y,w,h -function sysFX.new(type,duration,...) - fx[#fx+1]={draw=FXdraw[type],t=0,rate=1/duration,...} + +function sysFX.newRipple(duration,x,y,r) + fx[#fx+1]={ + update=FXupdate.ripple, + draw=FXdraw.ripple, + t=0, + rate=1/duration, + x=x,y=y,r=r, + } +end +function sysFX.newRectRipple(duration,x,y,w,h) + fx[#fx+1]={ + update=FXupdate.rectRipple, + draw=FXdraw.rectRipple, + t=0, + rate=1/duration, + x=x,y=y,w=w,h=h, + } +end +function sysFX.newShade(duration,r,g,b,x,y,w,h) + fx[#fx+1]={ + update=FXupdate.shade, + draw=FXdraw.shade, + t=0, + rate=1/duration, + r=r,g=g,b=b, + x=x,y=y,w=w,h=h, + } end return sysFX \ No newline at end of file diff --git a/Zframework/text.lua b/Zframework/text.lua index b69d68c6..bf3ec76a 100644 --- a/Zframework/text.lua +++ b/Zframework/text.lua @@ -74,7 +74,7 @@ local TEXT={} function TEXT.clear() texts={} end -function TEXT.getText(text,x,y,font,style,spd,stop) +function TEXT.getText(text,x,y,font,style,spd,stop)--Another version of TEXT() return{ c=0, text=text, @@ -85,17 +85,17 @@ function TEXT.getText(text,x,y,font,style,spd,stop) stop=stop, draw=textFX[style]or assert(false,"unavailable type:"..style), } -end--another version of TEXT() +end function TEXT.show(text,x,y,font,style,spd,stop) texts[#texts+1]={ - c=0, --timer - text=text, --string - x=x or 0, --x - y=y or 0, --y - font=font or 40, --font - spd=(spd or 1)/60, --timing speed(1=last 1 sec) - stop=stop, --stop time(sustained text) - draw=textFX[style]or assert(false,"unavailable type:"..style), --draw method + c=0, --Timer + text=text, --String + x=x or 0, --X + y=y or 0, --Y + font=font or 40, --Font + spd=(spd or 1)/60, --Timing speed(1=last 1 sec) + stop=stop, --Stop time(sustained text) + draw=textFX[style]or assert(false,"unavailable type:"..style), --Draw method } end function TEXT.update(list) diff --git a/Zframework/timer.lua b/Zframework/timer.lua index 0f1307fd..39e40441 100644 --- a/Zframework/timer.lua +++ b/Zframework/timer.lua @@ -18,13 +18,20 @@ function Tmr.load() elseif S.phase==4 then IMG.loadOne(S.cur) elseif S.phase==5 then - local m=Modes[S.cur]--mode template - local M=require("modes/"..m.name)--mode file + local m=Modes[S.cur]--Mode template + local M=require("modes/"..m.name)--Mode file Modes[m.name],Modes[S.cur]=M for k,v in next,m do M[k]=v end M.records=FILE.loadRecord(m.name)or M.score and{} + if M.score then + if modeRanks[M.name]==6 then + modeRanks[M.name]=0 + end + else + modeRanks[M.name]=6 + end -- M.icon=gc.newImage("image/modeIcon/"..m.icon..".png") -- M.icon=gc.newImage("image/modeIcon/custom.png") elseif S.phase==6 then @@ -32,14 +39,17 @@ function Tmr.load() SKIN.load() stat.run=stat.run+1 -------------------------- - SFX.play("welcome_sfx") - VOC.play("welcome") + if not setting.appLock then + SFX.play("welcome_sfx") + VOC.play("welcome") + end else S.cur=S.cur+1 S.tar=S.cur if S.cur>62.6 then - SCN.swapTo("intro","none") + SCN.swapTo(setting.appLock and "calculator"or"intro","none") end + loadingFinished=true return end S.cur=S.cur+1 @@ -113,12 +123,12 @@ function Tmr.mode(dt) elseif y<-1900*k then y=-1900*k end cam.x,cam.y=x,y - --keyboard controlling + --Keyboard controlling cam.x1=cam.x1*.85+x*.15 cam.y1=cam.y1*.85+y*.15 cam.k1=cam.k1*.85+k*.15 - local _=SCN.swap.tar + local _=SCN.stat.tar cam.zoomMethod=_=="play"and 1 or _=="mode"and 2 if cam.zoomMethod==1 then if cam.sel then @@ -141,9 +151,11 @@ function Tmr.draw() if sceneTemp.sure>0 then sceneTemp.sure=sceneTemp.sure-1 end end function Tmr.play(dt) + local _ game.frame=game.frame+1 stat.time=stat.time+dt - local P1=players[1] + + --Update attack FX for i=#FX_attack,1,-1 do local b=FX_attack[i] b.t=b.t+1 @@ -151,15 +163,16 @@ function Tmr.play(dt) b.rad=b.rad*1.05+.1 b.x,b.y=b.x2,b.y2 elseif b.t>10 then - local t=((b.t-10)*.025)t=(3-2*t)*t*t - b.x,b.y=b.x1*(1-t)+b.x2*t,b.y1*(1-t)+b.y2*t + _=(b.t-10)*.025 + _=(3-2*_)*_*_ + b.x,b.y=b.x1*(1-_)+b.x2*_,b.y1*(1-_)+b.y2*_ end if b.t<60 then - local L=FX_attack[i].drag - if #L==4*setting.atkFX then - rem(L,1)rem(L,1) + _=FX_attack[i].drag + if #_==4*setting.atkFX then + rem(_,1)rem(_,1) end - ins(L,b.x)ins(L,b.y) + ins(_,b.x)ins(_,b.y) else for i=i,#FX_attack do FX_attack[i]=FX_attack[i+1] @@ -167,6 +180,7 @@ function Tmr.play(dt) end end + --Update badge FX for i=#FX_badge,1,-1 do local b=FX_badge[i] b.t=b.t+1 @@ -174,14 +188,38 @@ function Tmr.play(dt) rem(FX_badge,i) end end - local _ - for i=1,#virtualkey do - _=virtualkey[i] - if _.pressTime>0 then - _.pressTime=_.pressTime-1 + + --Update virtualkey animation + if setting.VKSwitch then + for i=1,#virtualkey do + _=virtualkey[i] + if _.pressTime>0 then + _.pressTime=_.pressTime-1 + end end end + local P1=players[1] + + --Replay + if game.replaying then + _=game.replaying + local L=game.rec + while game.frame==L[_]do + local k=L[_+1] + if k>0 then + P1:pressKey(k) + virtualkey[k].isDown=true + virtualkey[k].pressTime=10 + else + virtualkey[-k].isDown=false + P1:releaseKey(-k) + end + _=_+2 + end + game.replaying=_ + end + --Counting,include pre-das,directy RETURN,or restart counting if game.frame<180 then if game.frame==179 then gameStart() @@ -204,27 +242,31 @@ function Tmr.play(dt) restartCount=restartCount+1 if restartCount>20 then TASK.clear("play") - mergeStat(stat,P1.stat) - resetGameData() + resetPartGameData() return end elseif restartCount>0 then restartCount=restartCount>2 and restartCount-2 or 0 - end--Counting,include pre-das,directy RETURN,or restart counting + end + + --Update players for p=1,#players do local P=players[p] P:update(dt) end + + --Fresh royale target if game.frame%120==0 then if modeEnv.royaleMode then freshMostDangerous()end end + + --Warning check if P1.alive then if game.frame%26==0 and setting.warn then local F=P1.field - local M=#F - local height=0--max height of row 4~7 + local height=0--Max height of row 4~7 for x=4,7 do - for y=M,1,-1 do + for y=#F,1,-1 do if F[y][x]>0 then if y>height then height=y @@ -235,13 +277,13 @@ function Tmr.play(dt) end game.warnLVL0=ln(height-15+P1.atkBuffer.sum*.8) end - local M=game.warnLVL - if M0 then - M=max(M-.026,0) + _=game.warnLVL + if _0 then + _=max(_-.026,0) end - game.warnLVL=M + game.warnLVL=_ elseif game.warnLVL>0 then game.warnLVL=max(game.warnLVL-.026,0) end @@ -273,7 +315,15 @@ function Tmr.setting_control() if T.das>0 then T.das=T.das-1 if T.das==0 then - T.pos=T.pos+T.dir + if T.arr==0 then + T.pos=T.pos+7*T.dir + T.das=setting.das + T.arr=setting.arr + T.dir=-T.dir + T.wait=26 + else + T.pos=T.pos+T.dir + end end else T.arr=T.arr-1 @@ -301,8 +351,6 @@ function Tmr.staff(dt) S.time=S.time+S.v*dt if S.time>45 then S.time=45 - elseif S.time<-10 then - S.time=-10 end end return Tmr \ No newline at end of file diff --git a/Zframework/voice.lua b/Zframework/voice.lua index ab8db2b0..1ceb59f4 100644 --- a/Zframework/voice.lua +++ b/Zframework/voice.lua @@ -57,7 +57,7 @@ local function getVoice(str) end end return L[n] - --load voice with string + --Load voice with string end function VOC.loadOne(_) local N=VOC.name[_] @@ -91,24 +91,24 @@ function VOC.update() end elseif Q.s==1 then--Waiting load source Q[1]=getVoice(Q[1]) - Q[1]:setVolume(setting.voc*.1) + Q[1]:setVolume(setting.voc*.01) Q[1]:play() 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 Q[2]=getVoice(Q[2]) - Q[2]:setVolume(setting.voc*.1) + Q[2]:setVolume(setting.voc*.01) Q[2]:play() Q.s=3 end - elseif Q.s==3 then--playing 12 same time + elseif Q.s==3 then--Playing 12 same time if not Q[1]:isPlaying()then for i=1,#Q do Q[i]=Q[i+1] end Q.s=Q[2]and 2 or 4 end - elseif Q.s==4 then--playing last + elseif Q.s==4 then--Playing last if not Q[1].isPlaying(Q[1])then Q[1]=nil Q.s=0 @@ -121,13 +121,13 @@ function VOC.play(s,chn) if chn then local L=voiceQueue[chn] local _=VOC.list[s] - if not _ then print("no VOC called:"..s)return end + if not _ then return end L[#L+1]=_[rnd(#_)] L.s=1 - --add to queue[chn] + --Add to queue[chn] else voiceQueue[VOC.getFreeChannel()]={s=1,VOC.list[s][rnd(#VOC.list[s])]} - --create new channel & play + --Create new channel & play end end end diff --git a/Zframework/widget.lua b/Zframework/widget.lua index c18c49f7..22cb7c21 100644 --- a/Zframework/widget.lua +++ b/Zframework/widget.lua @@ -3,48 +3,62 @@ local kb=love.keyboard local int,abs=math.floor,math.abs local format=string.format local color=color - -local EMPTY={} +local setFont=setFont local button={ type="button", - ATV=0,--activating time(0~8) + ATV=0,--Activating time(0~8) } function button:reset() self.ATV=0 end function button:isAbove(x,y) - return x>self.x-self.ATV and xself.y-self.ATV and yself.x-ATV and + y>self.y-ATV and + x0 then self.ATV=self.ATV-1 end + if ATV>0 then self.ATV=ATV-.5 end end end function button:draw() local x,y,w,h=self.x,self.y,self.w,self.h + local ATV=self.ATV local r,g,b=unpack(self.color) gc.setColor(.2+r*.8,.2+g*.8,.2+b*.8,.7) - gc.rectangle("fill",x-self.ATV,y-self.ATV,w+2*self.ATV,h+2*self.ATV) - if self.ATV>0 then + gc.rectangle("fill",x-ATV,y-ATV,w+2*ATV,h+2*ATV) + if ATV>0 then gc.setLineWidth(4) - gc.setColor(1,1,1,self.ATV*.125) - gc.rectangle("line",x-self.ATV+2,y-self.ATV+2,w+2*self.ATV-4,h+2*self.ATV-4) + gc.setColor(1,1,1,ATV*.125) + gc.rectangle("line",x-ATV+2,y-ATV+2,w+2*ATV-4,h+2*ATV-4) end local t=self.text if t then if type(t)=="function"then t=t()end setFont(self.font) - local y0=y+h*.5-self.font*.7 - gc.setColor(1,1,1,.3) + local y0=y+h*.5-self.font*.7-ATV*.5 + gc.setColor(1,1,1,.2+ATV*.05) gc.printf(t,x-2,y0-2,w,"center") gc.printf(t,x-2,y0+2,w,"center") gc.printf(t,x+2,y0-2,w,"center") @@ -54,13 +68,63 @@ function button:draw() end end function button:getInfo() - print(format("x=%d,y=%d,w=%d,h=%d,font=%d",self.x+self.w*.5,self.y+self.h*.5,self.w,self.h,self.font)) + DBP(format("x=%d,y=%d,w=%d,h=%d,font=%d",self.x+self.w*.5,self.y+self.h*.5,self.w,self.h,self.font)) +end + +local key={ + type="key", + ATV=0,--Activating time(0~4) +} +function key:reset() + self.ATV=0 +end +function key:isAbove(x,y) + local ATV=self.ATV + return + x>self.x and + y>self.y and + x0 then self.ATV=ATV-.5 end + end +end +function key:draw() + local x,y,w,h=self.x,self.y,self.w,self.h + local ATV=self.ATV + local r,g,b=unpack(self.color) + + gc.setColor(1,1,1,ATV*.125) + gc.rectangle("fill",x,y,w,h) + + gc.setColor(.2+r*.8,.2+g*.8,.2+b*.8,.7) + gc.setLineWidth(4) + gc.rectangle("line",x,y,w,h) + + local t=self.text + if t then + if type(t)=="function"then t=t()end + setFont(self.font) + gc.setColor(r,g,b,1.2) + gc.printf(t,x,y+h*.5-self.font*.7,w,"center") + end +end +function key:getInfo() + DBP(format("x=%d,y=%d,w=%d,h=%d,font=%d",self.x+self.w*.5,self.y+self.h*.5,self.w,self.h,self.font)) end local switch={ type="switch", - ATV=0,--activating time(0~8) - CHK=0,--check alpha(0~6) + ATV=0,--Activating time(0~8) + CHK=0,--Check alpha(0~6) } function switch:reset() self.ATV=0 @@ -75,7 +139,7 @@ end function switch:update() local _=self.ATV if WIDGET.sel==self then if _<8 then self.ATV=_+1 end - else if _>0 then self.ATV=_-1 end + else if _>0 then self.ATV=_-.5 end end _=self.CHK if self:disp()then if _<6 then self.CHK=_+1 end @@ -84,10 +148,11 @@ function switch:update() end function switch:draw() local x,y=self.x,self.y-25 + local ATV=self.ATV --Checked - if self.ATV>0 then - gc.setColor(1,1,1,self.ATV*.08) + if ATV>0 then + gc.setColor(1,1,1,ATV*.08) gc.rectangle("fill",x,y,50,50) end if self.CHK>0 then @@ -98,7 +163,7 @@ function switch:draw() --Frame gc.setLineWidth(4) - gc.setColor(1,1,1,.6+self.ATV*.05) + gc.setColor(1,1,1,.6+ATV*.05) gc.rectangle("line",x,y,50,50) --Text @@ -106,17 +171,17 @@ function switch:draw() if t then gc.setColor(1,1,1) setFont(self.font) - gc.printf(t,x-412,y+20-self.font*.7,400,"right") + gc.printf(t,x-412-ATV,y+20-self.font*.7,400,"right") end end function switch:getInfo() - print(format("x=%d,y=%d,font=%d",self.x,self.y,self.font)) + DBP(format("x=%d,y=%d,font=%d",self.x,self.y,self.font)) end local slider={ type="slider", - ATV=0,--activating time(0~8) - pos=0,--position shown + ATV=0,--Activating time(0~8) + pos=0,--Position shown } function slider:reset() self.ATV=0 @@ -133,7 +198,7 @@ function slider:update() if WIDGET.sel==self then if _<6 then self.ATV=_+1 end else - if _>0 then self.ATV=_-1 end + if _>0 then self.ATV=_-.5 end end if not(self.hide and self.hide())then self.pos=self.pos*.7+self.disp()*.3 @@ -141,52 +206,58 @@ function slider:update() end function slider:draw() local x,y=self.x,self.y + local ATV=self.ATV + local x2=x+self.w + + gc.setColor(1,1,1,.5+ATV*.06) --Units - gc.setColor(1,1,1,.5+self.ATV*.06) - gc.setLineWidth(2) - local x1,x2=x,x+self.w - for p=0,self.unit do - local x=x1+(x2-x1)*p/self.unit - gc.line(x,y+7,x,y-7) + if self.showUnit then + gc.setLineWidth(2) + for p=0,self.unit do + local x=x+(x2-x)*p/self.unit + gc.line(x,y+7,x,y-7) + end end --Axis gc.setLineWidth(4) - gc.line(x1,y,x2,y) + 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 + gc.setColor(.8,.8,.8) + gc.rectangle("fill",bx,by,bw,bh) + 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) + end --Text local t=self.text if t then gc.setColor(1,1,1) setFont(self.font) - gc.printf(t,x-312,y-self.font*.7,300,"right") - end - - --Block - local x,y,w,h=x1+(x2-x1)*self.pos/self.unit-10-self.ATV*.5,y-16-self.ATV,20+self.ATV,32+2*self.ATV - gc.setColor(.8,.8,.8) - gc.rectangle("fill",x,y,w,h) - if self.ATV>0 then - gc.setLineWidth(2) - gc.setColor(1,1,1,self.ATV*.16) - gc.rectangle("line",x+1,y+1,w-2,h-2) + gc.printf(t,x-312-ATV,y-self.font*.7,300,"right") end end function slider:getInfo() - print(format("x=%d,y=%d,w=%d",self.x,self.y,self.w)) + DBP(format("x=%d,y=%d,w=%d",self.x,self.y,self.w)) end local WIDGET={} -WIDGET.active=EMPTY--table, contains all active widgets -WIDGET.sel=nil--selected widget +WIDGET.active={}--Table, contains all active widgets +WIDGET.sel=nil--Selected widget function WIDGET.set(L) WIDGET.sel=nil - WIDGET.active=L or EMPTY + WIDGET.active=L or{} + + --Reset all widgets if L then for _,W in next,L do W:reset() - end--Reset all widgets + end end end @@ -238,6 +309,29 @@ function WIDGET.newButton(D) hide= D.hide, }for k,v in next,button do _[k]=v end return _ end +function WIDGET.newKey(D) + local _={ + name= D.name, + + x= D.x-D.w*.5, + y= D.y-D.h*.5, + w= D.w, + h= D.h, + + resCtr={ + D.x,D.y, + D.x-D.w*.35,D.y-D.h*.35, + D.x-D.w*.35,D.y+D.h*.35, + D.x+D.w*.35,D.y-D.h*.35, + D.x+D.w*.35,D.y+D.h*.35, + }, + + color= color[D.color]or D.color, + font= D.font, + code= D.code, + hide= D.hide, + }for k,v in next,key do _[k]=v end return _ +end function WIDGET.newSwitch(D) local _={ name= D.name, @@ -276,6 +370,7 @@ function WIDGET.newSlider(D) }, unit= D.unit, + showUnit=not D.noUnit, font= D.font, change= D.change, disp= D.disp, @@ -300,7 +395,9 @@ function WIDGET.press(x,y) W.code() W:FX() SFX.play("button") - VOC.play("nya") + elseif W.type=="key"then + W.code() + SFX.play("lock") elseif W.type=="switch"then W.code() SFX.play("move",.6) @@ -331,7 +428,7 @@ function WIDGET.keyPressed(i) WIDGET.press() end elseif kb.isDown("lshift","lalt","lctrl")then - --when hold [↑], control slider with left/right + --When hold [↑], control slider with left/right if i=="left"or i=="right"then local W=WIDGET.sel if W then @@ -354,7 +451,7 @@ function WIDGET.keyPressed(i) if i=="left"or i=="right"then for i=1,#WIDGET.active do local W1=WIDGET.active[i] - if W~=W1 then + if W~=W1 and W1.resCtr then local L=W1.resCtr for j=1,#L,2 do local x,y=L[j],L[j+1] @@ -372,7 +469,7 @@ function WIDGET.keyPressed(i) else for i=1,#WIDGET.active do local W1=WIDGET.active[i] - if W~=W1 then + if W~=W1 and W1.resCtr then local L=W1.resCtr for j=1,#L,2 do local x,y=L[j],L[j+1] @@ -412,7 +509,7 @@ function WIDGET.gamepadPressed(i) elseif i=="a"or i=="b"then local W=WIDGET.sel if W then - if W.type=="button"then + if W.type=="button"or W.type=="key"then WIDGET.press() elseif W.type=="slider"then local p=W.disp() diff --git a/Zframework/widgetList.lua b/Zframework/widgetList.lua index ecc731b9..b2ac2266 100644 --- a/Zframework/widgetList.lua +++ b/Zframework/widgetList.lua @@ -69,8 +69,8 @@ local virtualkeySet={ {16,970, 50,30},--down10 {17,1030, 50,30},--dropLeft {18,1090, 50,30},--dropRight - {19,1150, 50,30},--addLeft - {20,1210, 50,30},--addRight + {19,1150, 50,30},--zangiLeft + {20,1210, 50,30},--zangiRight },--PC key feedback(top&in a row) } @@ -87,29 +87,49 @@ local function VKAdisp(n) return function()return VK_org[n].ava end end local function VKAcode(n) return function()VK_org[n].ava=not VK_org[n].ava end end local function setLang(n) return function()LANG.set(n)setting.lang=n end end ---newXXX +--NewXXX newText=WIDGET.newText newImage=WIDGET.newImage newButton=WIDGET.newButton +newKey=WIDGET.newKey newSwitch=WIDGET.newSwitch newSlider=WIDGET.newSlider --All widgets local Widgets={ load={},intro={},quit={}, + calculator={ + newKey({name="_1", x=150,y=300,w=90,h=90, color="white", font=50,code=pressKey("1")}), + newKey({name="_2", x=250,y=300,w=90,h=90, color="white", font=50,code=pressKey("2")}), + newKey({name="_3", x=350,y=300,w=90,h=90, color="white", font=50,code=pressKey("3")}), + newKey({name="_4", x=150,y=400,w=90,h=90, color="white", font=50,code=pressKey("4")}), + newKey({name="_5", x=250,y=400,w=90,h=90, color="white", font=50,code=pressKey("5")}), + newKey({name="_6", x=350,y=400,w=90,h=90, color="white", font=50,code=pressKey("6")}), + newKey({name="_7", x=150,y=500,w=90,h=90, color="white", font=50,code=pressKey("7")}), + newKey({name="_8", x=250,y=500,w=90,h=90, color="white", font=50,code=pressKey("8")}), + newKey({name="_9", x=350,y=500,w=90,h=90, color="white", font=50,code=pressKey("9")}), + newKey({name="_0", x=150,y=600,w=90,h=90, color="white", font=50,code=pressKey("0")}), + newKey({name="<", x=250,y=600,w=90,h=90, color="lRed", font=50,code=pressKey("backspace")}), + newKey({name="=", x=350,y=600,w=90,h=90, color="lYellow",font=50,code=pressKey("return")}), + newKey({name="+", x=450,y=300,w=90,h=90, color="lBlue", font=50,code=pressKey("+")}), + newKey({name="-", x=450,y=400,w=90,h=90, color="lBlue", font=50,code=pressKey("-")}), + newKey({name="*", x=450,y=500,w=90,h=90, color="lBlue", font=50,code=pressKey("*")}), + newKey({name="/", x=450,y=600,w=90,h=90, color="lBlue", font=50,code=pressKey("/")}), + newButton({name="play", x=640,y=600,w=180,h=90, color="lGreen", font=40,code=pressKey("space"),hide=function()return not sceneTemp.pass end}), + }, main={ - newButton({name="play", x=150,y=280,w=200,h=160,color="lRed", font=55,code=function()SCN.goto("mode")end}), - newButton({name="setting", x=370,y=280,w=200,h=160,color="lBlue", font=45,code=function()SCN.goto("setting_game")end}), - newButton({name="music", x=590,y=280,w=200,h=160,color="lPurple",font=32,code=function()SCN.goto("music")end}), - newButton({name="help", x=150,y=460,w=200,h=160,color="lYellow",font=50,code=function()SCN.goto("help")end}), - newButton({name="stat", x=370,y=460,w=200,h=160,color="lCyan", font=43,code=function()SCN.goto("stat")end}), - newButton({name="qplay", x=590,y=460,w=200,h=160,color="lOrange",font=43,code=function()SCN.push()loadGame(stat.lastPlay)end}), - newButton({name="lang", x=150,y=610,w=160,h=100,color="lGreen", font=45,code=function()SCN.goto("setting_lang")end}), + newButton({name="play", x=150,y=280,w=200,h=160,color="lRed", font=55,code=function()SCN.go("mode")end}), + newButton({name="setting", x=370,y=280,w=200,h=160,color="lBlue", font=45,code=function()SCN.go("setting_game")end}), + newButton({name="music", x=590,y=280,w=200,h=160,color="lPurple",font=32,code=function()SCN.go("music")end}), + newButton({name="help", x=150,y=460,w=200,h=160,color="lYellow",font=50,code=function()SCN.go("help")end}), + newButton({name="stat", x=370,y=460,w=200,h=160,color="lCyan", font=43,code=function()SCN.go("stat")end}), + newButton({name="qplay", x=590,y=460,w=200,h=160,color="lOrange",font=43,code=function()SCN.push()loadGame(stat.lastPlay,true)end}), + newButton({name="lang", x=150,y=610,w=160,h=100,color="lGreen", font=45,code=function()SCN.go("setting_lang")end}), newButton({name="quit", x=590,y=610,w=160,h=100,color="lGrey", font=45,code=function()VOC.play("bye")SCN.swapTo("quit","slowFade")end}), }, mode={ - newButton({name="setting",x=1100,y=540,w=240,h=90,color="lGreen", font=40,code=function() - SCN.goto("custom") + newButton({name="setting", x=1100,y=540,w=240,h=90,color="lGreen", font=40,code=function() + SCN.go("custom") end, hide=function() return mapCam.sel~="custom_clear" and mapCam.sel~="custom_puzzle" @@ -118,17 +138,17 @@ 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=10, font=35,change=function()BGM.freshVolume()end,disp=SETval("bgm"),code=SETsto("bgm")}), + 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")}), 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")}), newButton({name="back", x=640, y=630, w=230,h=90, color="white", font=40,code=BACK}), }, custom={ - newButton({name="up", x=1140, y=100, w=100,h=100, color="white", font=45,code=function()sceneTemp=(sceneTemp-2)%#customID+1 end}), - newButton({name="down", x=1140, y=340, w=100,h=100, color="white", font=45,code=function()sceneTemp=sceneTemp%#customID+1 end}), - newButton({name="left", x=1080, y=220, w=100,h=100, color="white", font=45,code=pressKey("left")}), - newButton({name="right", x=1200, y=220, w=100,h=100, color="white", font=45,code=pressKey("right")}), + newKey({name="up", x=1140, y=100, w=100,h=100, color="white", font=45,code=function()sceneTemp=(sceneTemp-2)%#customID+1 end}), + newKey({name="down", x=1140, y=340, w=100,h=100, color="white", font=45,code=function()sceneTemp=sceneTemp%#customID+1 end}), + newKey({name="left", x=1080, y=220, w=100,h=100, color="white", font=45,code=pressKey("left")}), + newKey({name="right", x=1200, y=220, w=100,h=100, color="white", font=45,code=pressKey("right")}), newButton({name="set1", x=940, y=320, w=260,h=70, color="lYellow",font=32,code=pressKey("1")}), newButton({name="set2", x=940, y=400, w=260,h=70, color="lYellow",font=32,code=pressKey("2")}), @@ -141,116 +161,111 @@ local Widgets={ newButton({name="back", x=1200, y=640, w=120,h=120, color="white", font=35,code=BACK}), }, sequence={ - newButton({name="Z", x=150, y=440, w=90,h=90, color="white", font=50,code=pressKey(1)}), - newButton({name="S", x=250, y=440, w=90,h=90, color="white", font=50,code=pressKey(2)}), - newButton({name="J", x=350, y=440, w=90,h=90, color="white", font=50,code=pressKey(3)}), - newButton({name="L", x=450, y=440, w=90,h=90, color="white", font=50,code=pressKey(4)}), - newButton({name="T", x=550, y=440, w=90,h=90, color="white", font=50,code=pressKey(5)}), - newButton({name="O", x=650, y=440, w=90,h=90, color="white", font=50,code=pressKey(6)}), - newButton({name="I", x=750, y=440, w=90,h=90, color="white", font=50,code=pressKey(7)}), + newKey({name="Z", x=100, y=440, w=90,h=90, color="white", font=50,code=pressKey(1)}), + newKey({name="S", x=200, y=440, w=90,h=90, color="white", font=50,code=pressKey(2)}), + newKey({name="J", x=300, y=440, w=90,h=90, color="white", font=50,code=pressKey(3)}), + newKey({name="L", x=400, y=440, w=90,h=90, color="white", font=50,code=pressKey(4)}), + newKey({name="T", x=500, y=440, w=90,h=90, color="white", font=50,code=pressKey(5)}), + newKey({name="O", x=600, y=440, w=90,h=90, color="white", font=50,code=pressKey(6)}), + newKey({name="I", x=700, y=440, w=90,h=90, color="white", font=50,code=pressKey(7)}), - newButton({name="Z5", x=150, y=540, w=90,h=90, color="dGrey",font=50,code=pressKey(8)}), - newButton({name="S5", x=250, y=540, w=90,h=90, color="dGrey",font=50,code=pressKey(9)}), - newButton({name="P", x=350, y=540, w=90,h=90, color="dGrey",font=50,code=pressKey(10)}), - newButton({name="Q", x=450, y=540, w=90,h=90, color="dGrey",font=50,code=pressKey(11)}), - newButton({name="F", x=550, y=540, w=90,h=90, color="dGrey",font=50,code=pressKey(12)}), - newButton({name="E", x=650, y=540, w=90,h=90, color="dGrey",font=50,code=pressKey(13)}), - newButton({name="T5", x=750, y=540, w=90,h=90, color="dGrey",font=50,code=pressKey(14)}), - newButton({name="U", x=850, y=540, w=90,h=90, color="dGrey",font=50,code=pressKey(15)}), - newButton({name="V", x=950, y=540, w=90,h=90, color="dGrey",font=50,code=pressKey(16)}), - newButton({name="W", x=150, y=640, w=90,h=90, color="dGrey",font=50,code=pressKey(17)}), - newButton({name="X", x=250, y=640, w=90,h=90, color="dGrey",font=50,code=pressKey(18)}), - newButton({name="J5", x=350, y=640, w=90,h=90, color="dGrey",font=50,code=pressKey(19)}), - newButton({name="L5", x=450, y=640, w=90,h=90, color="dGrey",font=50,code=pressKey(20)}), - newButton({name="R", x=550, y=640, w=90,h=90, color="dGrey",font=50,code=pressKey(21)}), - newButton({name="Y", x=650, y=640, w=90,h=90, color="dGrey",font=50,code=pressKey(22)}), - newButton({name="N", x=750, y=640, w=90,h=90, color="dGrey",font=50,code=pressKey(23)}), - newButton({name="H", x=850, y=640, w=90,h=90, color="dGrey",font=50,code=pressKey(24)}), - newButton({name="I5", x=950, y=640, w=90,h=90, color="dGrey",font=50,code=pressKey(25)}), + newKey({name="Z5", x=100, y=540, w=90,h=90, color="grey", font=50,code=pressKey(8)}), + newKey({name="S5", x=200, y=540, w=90,h=90, color="grey", font=50,code=pressKey(9)}), + newKey({name="P", x=300, y=540, w=90,h=90, color="grey", font=50,code=pressKey(10)}), + newKey({name="Q", x=400, y=540, w=90,h=90, color="grey", font=50,code=pressKey(11)}), + newKey({name="F", x=500, y=540, w=90,h=90, color="grey", font=50,code=pressKey(12)}), + newKey({name="E", x=600, y=540, w=90,h=90, color="grey", font=50,code=pressKey(13)}), + newKey({name="T5", x=700, y=540, w=90,h=90, color="grey", font=50,code=pressKey(14)}), + newKey({name="U", x=800, y=540, w=90,h=90, color="grey", font=50,code=pressKey(15)}), + newKey({name="V", x=900, y=540, w=90,h=90, color="grey", font=50,code=pressKey(16)}), + newKey({name="W", x=100, y=640, w=90,h=90, color="grey", font=50,code=pressKey(17)}), + newKey({name="X", x=200, y=640, w=90,h=90, color="grey", font=50,code=pressKey(18)}), + newKey({name="J5", x=300, y=640, w=90,h=90, color="grey", font=50,code=pressKey(19)}), + newKey({name="L5", x=400, y=640, w=90,h=90, color="grey", font=50,code=pressKey(20)}), + newKey({name="R", x=500, y=640, w=90,h=90, color="grey", font=50,code=pressKey(21)}), + newKey({name="Y", x=600, y=640, w=90,h=90, color="grey", font=50,code=pressKey(22)}), + newKey({name="N", x=700, y=640, w=90,h=90, color="grey", font=50,code=pressKey(23)}), + newKey({name="H", x=800, y=640, w=90,h=90, color="grey", font=50,code=pressKey(24)}), + newKey({name="I5", x=900, y=640, w=90,h=90, color="grey", font=50,code=pressKey(25)}), - newButton({name="left", x=850, y=440, w=90,h=90, color="lGreen", font=55,code=pressKey("left")}), - newButton({name="right", x=950, y=440, w=90,h=90, color="lGreen", font=55,code=pressKey("right")}), - newButton({name="backsp", x=1050, y=440, w=90,h=90, color="lRed", font=50,code=pressKey("backspace")}), - newButton({name="reset", x=1050, y=540, w=90,h=90, color="lRed", font=50,code=pressKey("delete")}), - newButton({name="back", x=1200, y=640, w=120,h=120, color="white", font=35,code=BACK}), + newKey({name="left", x=800, y=440, w=90,h=90, color="lGreen", font=55,code=pressKey("left")}), + newKey({name="right", x=900, y=440, w=90,h=90, color="lGreen", font=55,code=pressKey("right")}), + newKey({name="backsp", x=1000, y=440, w=90,h=90, color="lYellow",font=50,code=pressKey("backspace")}), + newKey({name="reset", x=1000, y=540, w=90,h=90, color="lYellow",font=50,code=pressKey("delete")}), + newButton({name="copy", x=1140, y=440, w=170,h=90, color="lRed", font=40,code=pressKey("cC"),hide=function()return #preBag==0 end}), + newButton({name="paste", x=1140, y=540, w=170,h=90, color="lBlue", font=40,code=pressKey("cV")}), + newButton({name="back", x=1090, y=640, w=270,h=90, color="white", font=50,code=BACK}), }, draw={ - newButton({name="b1", x=500+65*1, y=150,w=58,h=58, color="red", font=30,code=setPen(1)}),--B1 - newButton({name="b2", x=500+65*2, y=150,w=58,h=58, color="orange", font=30,code=setPen(2)}),--B2 - newButton({name="b3", x=500+65*3, y=150,w=58,h=58, color="yellow", font=30,code=setPen(3)}),--B3 - newButton({name="b4", x=500+65*4, y=150,w=58,h=58, color="grass", font=30,code=setPen(4)}),--B4 - newButton({name="b5", x=500+65*5, y=150,w=58,h=58, color="green", font=30,code=setPen(5)}),--B5 - newButton({name="b6", x=500+65*6, y=150,w=58,h=58, color="water", font=30,code=setPen(6)}),--B6 - newButton({name="b7", x=500+65*7, y=150,w=58,h=58, color="cyan", font=30,code=setPen(7)}),--B7 - newButton({name="b8", x=500+65*8, y=150,w=58,h=58, color="blue", font=30,code=setPen(8)}),--B8 - newButton({name="b9", x=500+65*9, y=150,w=58,h=58, color="purple", font=30,code=setPen(9)}),--B9 - newButton({name="b10", x=500+65*10,y=150,w=58,h=58, color="magenta",font=30,code=setPen(10)}),--B10 - newButton({name="b11", x=500+65*11,y=150,w=58,h=58, color="pink", font=30,code=setPen(11)}),--B11 + newButton({name="b1", x=500+65*1, y=150, w=58, h=58, color="red", font=30,code=setPen(1)}),--B1 + newButton({name="b2", x=500+65*2, y=150, w=58, h=58, color="orange", font=30,code=setPen(2)}),--B2 + newButton({name="b3", x=500+65*3, y=150, w=58, h=58, color="yellow", font=30,code=setPen(3)}),--B3 + newButton({name="b4", x=500+65*4, y=150, w=58, h=58, color="grass", font=30,code=setPen(4)}),--B4 + newButton({name="b5", x=500+65*5, y=150, w=58, h=58, color="green", font=30,code=setPen(5)}),--B5 + newButton({name="b6", x=500+65*6, y=150, w=58, h=58, color="water", font=30,code=setPen(6)}),--B6 + newButton({name="b7", x=500+65*7, y=150, w=58, h=58, color="cyan", font=30,code=setPen(7)}),--B7 + newButton({name="b8", x=500+65*8, y=150, w=58, h=58, color="blue", font=30,code=setPen(8)}),--B8 + newButton({name="b9", x=500+65*9, y=150, w=58, h=58, color="purple", font=30,code=setPen(9)}),--B9 + newButton({name="b10", x=500+65*10,y=150, w=58, h=58, color="magenta",font=30,code=setPen(10)}),--B10 + newButton({name="b11", x=500+65*11,y=150, w=58, h=58, color="pink", font=30,code=setPen(11)}),--B11 - newButton({name="b12", x=500+65*1, y=230,w=58,h=58, color="dGrey", font=30,code=setPen(12)}),--Bone - newButton({name="b13", x=500+65*2, y=230,w=58,h=58, color="grey", font=30,code=setPen(13)}),--GB1 - newButton({name="b14", x=500+65*3, y=230,w=58,h=58, color="lGrey", font=30,code=setPen(14)}),--GB2 - newButton({name="b15", x=500+65*4, y=230,w=58,h=58, color="dPurple",font=30,code=setPen(15)}),--GB3 - newButton({name="b16", x=500+65*5, y=230,w=58,h=58, color="dRed", font=30,code=setPen(16)}),--GB4 - newButton({name="b17", x=500+65*6, y=230,w=58,h=58, color="dGreen", font=30,code=setPen(17)}),--GB5 + newButton({name="b12", x=500+65*1, y=230, w=58, h=58, color="dGrey", font=30,code=setPen(12)}),--Bone + newButton({name="b13", x=500+65*2, y=230, w=58, h=58, color="grey", font=30,code=setPen(13)}),--GB1 + newButton({name="b14", x=500+65*3, y=230, w=58, h=58, color="lGrey", font=30,code=setPen(14)}),--GB2 + newButton({name="b15", x=500+65*4, y=230, w=58, h=58, color="dPurple",font=30,code=setPen(15)}),--GB3 + newButton({name="b16", x=500+65*5, y=230, w=58, h=58, color="dRed", font=30,code=setPen(16)}),--GB4 + newButton({name="b17", x=500+65*6, y=230, w=58, h=58, color="dGreen", font=30,code=setPen(17)}),--GB5 - newButton({name="any", x=600, y=360, w=120,h=120, color="lGrey", font=40,code=setPen(0)}), - newButton({name="space", x=730, y=360, w=120,h=120, color="grey", font=65,code=setPen(-1)}), - newButton({name="clear", x=1200, y=500, w=120,h=120, color="white", font=40,code=pressKey("delete")}), - newSwitch({name="demo", x=755, y=640, font=30,disp=function()return sceneTemp.demo end,code=function()sceneTemp.demo=not sceneTemp.demo end}), - newButton({name="copy", x=920, y=640, w=120,h=120, color="lRed", font=35,code=function()copyBoard()end}), - newButton({name="paste", x=1060, y=640, w=120,h=120, color="lBlue", font=35,code=function()pasteBoard()end}), - newButton({name="custom", x=110, y=80, w=140,h=80, color="white", font=35,code=function()SCN.goto("custom")end}), - newButton({name="back", x=1200, y=640, w=120,h=120, color="white", font=35,code=BACK}), + newButton({name="any", x=600, y=360, w=120, h=120, color="lGrey", font=40,code=setPen(0)}), + newButton({name="space", x=730, y=360, w=120, h=120, color="grey", font=65,code=setPen(-1)}), + newButton({name="clear", x=1200, y=500, w=120, h=120, color="white", font=40,code=pressKey("delete")}), + newSwitch({name="demo", x=755, y=640, font=30,disp=function()return sceneTemp.demo end,code=function()sceneTemp.demo=not sceneTemp.demo end}), + newButton({name="copy", x=920, y=640, w=120, h=120, color="lRed", font=35,code=pressKey("cC")}), + newButton({name="paste", x=1060, y=640, w=120, h=120, color="lBlue", font=35,code=pressKey("cV")}), + newButton({name="custom", x=110, y=80, w=140, h=80, color="white", font=35,code=pressKey("e")}), + newButton({name="back", x=1200, y=640, w=120, h=120, color="white", font=35,code=BACK}), }, play={ newButton({name="pause", x=1235, y=45, w=80,h=80, color="white", font=25,code=function()pauseGame()end}), }, pause={ - newButton({name="resume", x=640,y=290,w=240,h=100,color="white",font=30,code=function()resumeGame()end}), - newButton({name="restart", x=640,y=445,w=240,h=100,color="white",font=33, - code=function() - TASK.removeTask_code(TICK.autoPause) - mergeStat(stat,players[1].stat) - resetGameData() - SCN.swapTo("play","none") - end}), - newButton({name="setting", x=1120, y=70, w=240,h=90, color="lBlue",font=35, - code=function() - SCN.goto("setting_sound") - end}), - newButton({name="quit", x=640, y=600, w=240,h=100,color="white",font=35,code=BACK}), + newButton({name="setting", x=1120, y=70, w=240,h=90, color="lBlue", font=35,code=pressKey("s")}), + newButton({name="replay", x=640, y=250, w=240,h=100,color="lYellow",font=30,code=pressKey("p"),hide=function()return not(game.result or game.replaying)end}), + newButton({name="resume", x=640, y=367, w=240,h=100,color="lGreen", font=30,code=pressKey("escape")}), + newButton({name="restart", x=640, y=483, w=240,h=100,color="lRed", font=33,code=pressKey("r")}), + newButton({name="quit", x=640, y=600, w=240,h=100,color="lGrey", font=35,code=BACK}), }, setting_game={ - newButton({name="graphic", x=200, y=80, w=240,h=80, color="lCyan", font=35,code=function()SCN.swapTo("setting_video")end}), - newButton({name="sound", x=1080, y=80, w=240,h=80, color="lCyan", font=35,code=function()SCN.swapTo("setting_sound")end}), - newButton({name="ctrl", x=290, y=220, w=320,h=80, color="lYellow",font=35,code=function()SCN.goto("setting_control")end}), - newButton({name="key", x=640, y=220, w=320,h=80, color="lGreen", font=35,code=function()SCN.goto("setting_key")end}), - newButton({name="touch", x=990, y=220, w=320,h=80, color="lBlue", font=35,code=function()SCN.goto("setting_touch")end}), + newButton({name="graphic", x=200, y=80, w=240,h=80, color="lCyan", font=35,code=function()SCN.swapTo("setting_video","swipe")end}), + newButton({name="sound", x=1080, y=80, w=240,h=80, color="lCyan", font=35,code=function()SCN.swapTo("setting_sound","swipe")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="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="maxNext", x=350, y=440, w=300,unit=6, font=30,disp=SETval("maxNext"), code=SETsto("maxNext")}), - newSwitch({name="autoPause",x=350, y=540, font=20,disp=SETval("autoPause"),code=SETrev("autoPause")}), - newButton({name="layout", x=590, y=540, w=140,h=70,color="white", font=35,code=function() - SCN.goto("setting_skin") + newButton({name="layout", x=460, y=540, w=140,h=70,color="white", font=35,code=function() + SCN.go("setting_skin") end}), - newSwitch({name="quickR", x=1050,y=320,font=35, disp=SETval("quickR"), code=SETrev("quickR")}), - newSwitch({name="swap", x=1050,y=400,font=20, disp=SETval("swap"), code=SETrev("swap")}), - newSwitch({name="fine", x=1050,y=480,font=20, disp=SETval("fine"), code=SETrev("fine")}), - newButton({name="back", x=1140,y=650,w=200,h=80,color="white",font=40,code=BACK}), + newSwitch({name="autoPause",x=1080, y=320, font=20,disp=SETval("autoPause"), code=SETrev("autoPause")}), + newSwitch({name="swap", x=1080, y=380, font=20,disp=SETval("swap"), code=SETrev("swap")}), + newSwitch({name="fine", x=1080, y=440, font=20,disp=SETval("fine"), code=SETrev("fine")}), + newSwitch({name="appLock", x=1080, y=500, font=20,disp=SETval("appLock"), code=SETrev("appLock")}), + newButton({name="back", x=1140, y=650, w=200,h=80,color="white", font=40,code=BACK}), }, setting_video={ - newButton({name="sound", x=200, y=80,w=240,h=80,color="lCyan",font=35,code=function()SCN.swapTo("setting_sound")end}), - newButton({name="game", x=1080, y=80,w=240,h=80,color="lCyan",font=35,code=function()SCN.swapTo("setting_game")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}), 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=30, disp=SETval("grid"), code=SETrev("grid")}), + 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="lockFX", x=350, y=340,w=373,unit=3, font=32,disp=SETval("lockFX"), code=SETsto("lockFX")}), - newSlider({name="dropFX", x=350, y=400,w=373,unit=5, font=32,disp=SETval("dropFX"), code=SETsto("dropFX")}), - newSlider({name="clearFX", x=350, y=460,w=373,unit=3, font=32,disp=SETval("clearFX"), code=SETsto("clearFX")}), - newSlider({name="shakeFX", x=350, y=520,w=373,unit=5, font=32,disp=SETval("shakeFX"), code=SETsto("shakeFX")}), - newSlider({name="atkFX", x=350, y=580,w=373,unit=5, font=32,disp=SETval("atkFX"), code=SETsto("atkFX")}), + 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")}), + newSlider({name="clearFX", x=350, y=490,w=373,unit=5, font=32,disp=SETval("clearFX"), code=SETsto("clearFX")}), + newSlider({name="shakeFX", x=350, y=540,w=373,unit=5, font=32,disp=SETval("shakeFX"), code=SETsto("shakeFX")}), + newSlider({name="atkFX", x=350, y=590,w=373,unit=5, font=32,disp=SETval("atkFX"), code=SETsto("atkFX")}), newSlider({name="frame", x=350, y=640,w=373,unit=10,font=30, disp=function() return setting.frameMul>35 and setting.frameMul/10 or setting.frameMul/5-4 @@ -258,15 +273,15 @@ local Widgets={ code=function(i) setting.frameMul=i<5 and 5*i+20 or 10*i end}), - newSwitch({name="text", x=1050, y=180, font=35,disp=SETval("text"),code=SETrev("text")}), - newSwitch({name="warn", x=1050, y=260, font=35,disp=SETval("warn"),code=SETrev("warn")}), - newSwitch({name="fullscreen",x=1050,y=340, font=35,disp=SETval("fullscreen"), + newSwitch({name="text", x=1050, y=180,font=35,disp=SETval("text"),code=SETrev("text")}), + newSwitch({name="warn", x=1050, y=260,font=35,disp=SETval("warn"),code=SETrev("warn")}), + newSwitch({name="fullscreen",x=1050,y=340,font=35,disp=SETval("fullscreen"), code=function() setting.fullscreen=not setting.fullscreen love.window.setFullscreen(setting.fullscreen) love.resize(love.graphics.getWidth(),love.graphics.getHeight()) end}), - newSwitch({name="bg", x=1050, y=420, font=35,disp=SETval("bg"), + newSwitch({name="bg", x=1050, y=420,font=35,disp=SETval("bg"), code=function() BG.set("none") setting.bg=not setting.bg @@ -279,14 +294,14 @@ 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")end}), - newButton({name="graphic", x=1080, y=80,w=240,h=80,color="lCyan",font=35,code=function()SCN.swapTo("setting_video")end}), - newSlider({name="sfx", x=180, y=200,w=400,unit=10,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=10,font=30,change=function()SFX.play("spawn_1",setting.spawn,nil,true)end, disp=SETval("spawn"), code=SETsto("spawn")}), - newSlider({name="bgm", x=180, y=400,w=400,unit=10,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=10,font=32,change=function()VOC.play("nya")end, disp=SETval("voc"), code=SETsto("voc")}), + 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}), }, setting_control={ @@ -333,7 +348,7 @@ local Widgets={ newButton({name="spin3", x=410,y=540,w=90,h=65,color="white",font=30,code=nextDir(3)}), newButton({name="spin4", x=550,y=540,w=90,h=65,color="white",font=30,code=nextDir(4)}), newButton({name="spin5", x=690,y=540,w=90,h=65,color="white",font=30,code=nextDir(5)}), - --newButton({name="spin6",x=825,y=540,w=90,h=65,color="white",font=30,code=nextDir(6)}),--cannot rotate O + --newButton({name="spin6",x=825,y=540,w=90,h=65,color="white",font=30,code=nextDir(6)}),--Cannot rotate O newButton({name="spin7", x=970,y=540,w=90,h=65,color="white",font=30,code=nextDir(7)}), newButton({name="skinR", x=200,y=640,w=220,h=80,color="lPurple",font=35, @@ -357,6 +372,8 @@ local Widgets={ for i=1,#VK_org do VK_org[i].ava=false end + + --Replace keys for n=1,#D do local T=D[n] if T[1]then @@ -364,7 +381,7 @@ local Widgets={ B.ava=true B.x,B.y,B.r=T[2],T[3],T[4] end - end--Replace keys + end sceneTemp.default=sceneTemp.default%5+1 sceneTemp.sel=nil end}), @@ -374,7 +391,7 @@ local Widgets={ end}), newButton({name="option", x=520,y=180,w=170,h=80,color="white",font=40, code=function() - SCN.goto("setting_touchSwitch") + 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, @@ -420,7 +437,7 @@ local Widgets={ 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() - SCN.goto("setting_trackSetting") + SCN.go("setting_trackSetting") end, hide=function() return not setting.VKTrack @@ -439,11 +456,12 @@ local Widgets={ newButton({name="chi2", x=380, y=100,w=200,h=120,color="white",font=45,code=setLang(2)}), newButton({name="eng", x=600, y=100,w=200,h=120,color="white",font=45,code=setLang(3)}), newButton({name="str", x=820, y=100,w=200,h=120,color="white",font=45,code=setLang(4)}), + newButton({name="yygq", x=1040, y=100,w=200,h=120,color="white",font=45,code=setLang(5)}), newButton({name="back", x=640, y=600,w=200,h=80,color="white",font=40,code=BACK}), }, help={ - newButton({name="staff", x=980, y=500,w=150,h=80,color="white",font=32,code=function()SCN.goto("staff")end}), - newButton({name="his", x=1160, y=500,w=150,h=80,color="white",font=32,code=function()SCN.goto("history")end}), + newButton({name="staff", x=980, y=500,w=150,h=80,color="white",font=32,code=function()SCN.go("staff")end}), + newButton({name="his", x=1160, y=500,w=150,h=80,color="white",font=32,code=function()SCN.go("history")end}), newButton({name="qq", x=1070, y=600,w=200,h=80,color="white",font=32,code=function()love.system.openURL("tencent://message/?uin=1046101471&Site=&Menu=yes")end,hide=mobileHide}), newButton({name="back", x=640, y=600,w=200,h=80,color="white",font=40,code=BACK}), }, @@ -451,8 +469,8 @@ local Widgets={ newButton({name="back", x=1160, y=630,w=150,h=80,color="white",font=40,code=BACK}), }, history={ - newButton({name="prev", x=1155, y=170,w=180,h=180,color="white",font=65,code=pressKey("up"),hide=function()return sceneTemp[2]==1 end}), - newButton({name="next", x=1155, y=400,w=180,h=180,color="white",font=65,code=pressKey("down"),hide=function()return sceneTemp[2]==#sceneTemp[1]end}), + newKey({name="prev", x=1155, y=170,w=180,h=180,color="white",font=65,code=pressKey("up"),hide=function()return sceneTemp.pos==1 end}), + newKey({name="next", x=1155, y=400,w=180,h=180,color="white",font=65,code=pressKey("down"),hide=function()return sceneTemp.pos==#sceneTemp.text end}), newButton({name="back", x=1155, y=600,w=180,h=90,color="white",font=40,code=BACK}), }, stat={ @@ -460,46 +478,51 @@ local Widgets={ newButton({name="back", x=640, y=620,w=200,h=80,color="white",font=40,code=BACK}), }, debug={ - newButton({name="killWTM", x=340, y=200,w=260,h=100,color="white",font=35, + newButton({name="reset", x=640,y=200,w=260,h=100,color="yellow",font=40, code=function() - marking=nil - TEXT.show("\68\69\86\58\87\97\116\101\114\109\97\114\107\32\82\101\109\111\118\101\100",640,360,60,"stretch",.6) - SFX.play("clear") + sceneTemp.reset=true end, hide=function() - return not marking + return sceneTemp.reset end}), - newButton({name="unlock", x=640,y=200,w=260,h=100,color="white",font=40, + newButton({name="reset1", x=340,y=400,w=260,h=100,color="red",font=40, code=function() - for name,M in next,Modes do - if not modeRanks[name]then - modeRanks[name]=M.score and 0 or 6 + love.filesystem.remove("unlock.dat") + SFX.play("finesseError_long") + TEXT.show("rank resetted",640,300,60,"stretch",.4) + TEXT.show("effected after restart game",640,360,60,"stretch",.4) + TEXT.show("play one game if you regret",640,390,40,"stretch",.4) + end, + hide=function() + return not sceneTemp.reset + end}), + newButton({name="reset2", x=640,y=400,w=260,h=100,color="red",font=40, + code=function() + love.filesystem.remove("data.dat") + SFX.play("finesseError_long") + TEXT.show("game data resetted",640,300,60,"stretch",.4) + TEXT.show("effected after restart game",640,360,60,"stretch",.4) + TEXT.show("play one game if you regret",640,390,40,"stretch",.4) + end, + hide=function() + return not sceneTemp.reset + end}), + newButton({name="reset3", x=940,y=400,w=260,h=100,color="red",font=40, + code=function() + local L=love.filesystem.getDirectoryItems("") + for i=1,#L do + local s=L[i] + if s:sub(-4)==".dat"then + love.filesystem.remove(s) end end - FILE.saveUnlock() - TEXT.show("\68\69\86\58\85\78\76\79\67\75\65\76\76",640,360,60,"stretch",.6) - SFX.play("clear_2") - end}), - newButton({name="reset", x=940,y=200,w=260,h=100,color="white",font=40, - code=function() - sceneTemp.ct=sceneTemp.ct+1 - if sceneTemp.ct==1 then - TEXT.show("RESET ALL DATA?",640,360,50,"appear",.5) - elseif sceneTemp.ct==5 then - TEXT.show("SURE?????",640,360,80,"beat",.5) - elseif sceneTemp.ct==10 then - local L=love.filesystem.getDirectoryItems("") - for i=1,#L do - local s=L[i] - if s:sub(-4)==".dat"then - love.filesystem.remove(s) - end - end - SFX.play("clear_4")SFX.play("finesseError_long") - TEXT.clear() - TEXT.show("ALL SAVING FILE DELETED",640,360,60,"stretch",.4) - SCN.back() - end + SFX.play("clear_4")SFX.play("finesseError_long") + TEXT.show("all file deleted",640,330,60,"stretch",.4) + TEXT.show("effected after restart game",640,390,60,"stretch",.4) + SCN.back() + end, + hide=function() + return not sceneTemp.reset end}), newButton({name="back", x=640,y=620,w=200,h=80,color="white",font=40,code=BACK}), }, diff --git a/conf.lua b/conf.lua index 37f86f52..06589a4a 100644 --- a/conf.lua +++ b/conf.lua @@ -1,10 +1,10 @@ -gameVersion="Alpha V0.9.3" +gameVersion="Alpha V0.10.4" function love.conf(t) - t.identity="Techmino"--saving folder + t.identity="Techmino"--Saving folder t.version="11.1" t.gammacorrect=false - t.appendidentity=true--search files in source then in save directory - t.accelerometerjoystick=false--accelerometer=joystick on ios/android + t.appendidentity=true--Search files in source then in save directory + t.accelerometerjoystick=false--Accelerometer=joystick on ios/android if t.audio then t.audio.mixwithsystem=true end local W=t.window @@ -16,12 +16,12 @@ function love.conf(t) W.resizable=true W.fullscreentype="desktop"--"exclusive" W.fullscreen=false - W.vsync=nil--60FPS - W.msaa=false--num of samples to use with multi-sampled antialiasing - W.depth=0--bits/samp of depth buffer - W.stencil=1--bits/samp of stencil buffer - W.display=1--monitor ID - W.highdpi=true--high-dpi mode for the window on a Retina display + W.vsync=0--Do not limit FPS + W.msaa=false--Num of samples to use with multi-sampled antialiasing + W.depth=0--Bits/samp of depth buffer + W.stencil=1--Bits/samp of stencil buffer + W.display=1--Monitor ID + W.highdpi=true--High-dpi mode for the window on a Retina display W.x,W.y=nil local M=t.modules diff --git a/document.txt b/document.txt index 6b6b0923..f29cb889 100644 --- a/document.txt +++ b/document.txt @@ -11,16 +11,15 @@ spin判定: 攻击系统: 普通消除: - 消1/2/3/4攻击0.25/1.25/2.25/4 + 消1/2/3/4攻击0.5/1.5/2.5/4 特殊消除: - spin1/2/3攻击2/4/6,若mini则减半 + spin1/2/3攻击2/4/6,若mini则减至一半 B2B:加1(techrash/spin1/spin2)或2(spin3)攻击 B3B:在B2B效果之上消四再加1,spin再加0.5*消行数攻击,二者都+1额外抵挡 - 堆楼连击:0,0,1,1,2,2,2,3,3,3,4,4,3, 之后都是2 - 挖掘连击:0,0,1,1,2,2,3,3,4,4,4, 之后都是5 + 连击:给予上述攻击[连击数*20%]的加成,上限200%,连消3次之后额外加1攻击 特殊消除会增加B2B点数,让之后的特殊消除获得B2B(B3B)增益(详细说明见下文) 半全消("下方有剩余方块"的全消,如果是I消1行则必须不剩余玩家放置的方块):伤害+2,额外抵挡+2 - 全消:将上述伤害之和开根号,再+6~12(本局内递增)+2额外抵挡(注:本局消行数>4时会将B2B点数拉满) + 全消:将上述伤害之和减半,再+6~12(本局内递增)+2额外抵挡(注:本局消行数>4时会将B2B点数拉满) 根据上述规则计算后,向下取整,攻击打出 分数系统: @@ -37,7 +36,7 @@ spin判定: back to back(B2B)点数说明: B2B点数的范围在0~1200,在点数>=40时进行特殊消除为B2B,>1000时特殊消除为B3B 普通消除-250 - spin1/2/3:+50/100/180(mini变为原来40%) + spin1/2/3:+50/100/180(mini变为原来25%) 消四:+100 空spin:+20,此法得到的点数不能超过1000 当点数在1000以上时空放一块-40(不减到低于1000) @@ -67,16 +66,15 @@ Spin detection: Attack system: Regular line clears: - Single/Double/Triple/Techrash sends 0.25/1.25/2.25/4 + Single/Double/Triple/Techrash sends 0.5/1.5/2.5/4 Special line clears: Spin Single/Double/Triple sends 2/4/6, half if Mini B2B: +1 (Techrash/Spin Single/Spin Double) or +2 (Spin Triple) B2B2B/B3B: In addition to B2B, +1 if Techrash, +(0.5 * lines cleared) if Spin, and in both cases +1 additional blocking - Wide Combo: 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 3, then 2 afterwards - Dig Combo: 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, then 5 afterwards + Combo: each combo gives 20% more attack (capped at 200%), extra 1 attack after 3 combo Special line clears will increase B2B gauge, making later special line clears have B2B or B2B2B bonus (see below) Half Perfect Clear (a Perfect Clear "with blocks left below". If it's an I clearing 1 line, then the remaining blocks must not be player-placed): Attack +2, Extra Blocking +2 - Perfect Clear: square root all damage above, then +6 to +12 attack (increases within a round) and +2 extra blocking. (note: if lines cleared in this round >4, then B2B gauge will be filled) + Perfect Clear: half all damage above, then +6 to +12 attack (increases within a round) and +2 extra blocking. (note: if lines cleared in this round >4, then B2B gauge will be filled) After calculating all above, the damage value will be rounded down then sent Score system: @@ -93,7 +91,7 @@ Countering: Back to Back (B2B) gauge: The B2B gauge ranges from 0 to 1,200. Special line clears are B2B if the gauge is >=40, B2B2B if >1,000. A regular line clear -250 - Spin Single/Double/Triple +50/100/180 (x40% if Mini) + Spin Single/Double/Triple +50/100/180 (x25% if Mini) Techrash +100 Spin without clearing lines +20, but gauge cannot exceed 1,000 with this method When gauge is above 1,000, a drop without clearing lines -40 (cannot drop below 1,000 with this method) diff --git a/font.ttf b/font.ttf index f12b1d68..1fcf3312 100644 Binary files a/font.ttf and b/font.ttf differ diff --git a/image/skin/retro(notypey).png b/image/skin/retro(notypey).png new file mode 100644 index 00000000..1901a23f Binary files /dev/null and b/image/skin/retro(notypey).png differ diff --git a/image/skin/retro_grey(notypey).png b/image/skin/retro_grey(notypey).png new file mode 100644 index 00000000..5caa70c4 Binary files /dev/null and b/image/skin/retro_grey(notypey).png differ diff --git a/main.lua b/main.lua index 22037299..41cfa7ad 100644 --- a/main.lua +++ b/main.lua @@ -1,12 +1,16 @@ --[[ - ______ __ _ - /_ __/___ _____ / /_ ____ ___ (_)____ ____ - / / / _ \ / ___// __ \ / __ `__ \ / // __ \ / __ \ - / / / __// /__ / / / // / / / / // // / / // /_/ / -/_/ \___/ \___//_/ /_//_/ /_/ /_//_//_/ /_/ \____/ -Techmino is my first "huge project" -optimization is welcomed if you also love tetromino game -]] + ______ __ _ + /_ __/___ _____ / /_ ____ ___ (_)____ ____ + / / / _ \ / ___// __ \ / __ `__ \ / // __ \ / __ \ + / / / __// /__ / / / // / / / / // // / / // /_/ / + /_/ \___/ \___//_/ /_//_/ /_/ /_//_//_/ /_/ \____/ + Techmino is my first "huge project" + optimization is welcomed if you also love tetromino game +]]-- + +--? +function NULL()end +DBP=print--use this if need debugging print --Global Setting & Vars math.randomseed(os.time()*626) @@ -14,32 +18,53 @@ love.keyboard.setKeyRepeat(true) love.keyboard.setTextInput(false) love.mouse.setVisible(false) -function NULL()end system=love.system.getOS() -game={} mapCam={ - sel=nil,--selected mode ID + sel=nil,--Selected mode ID - x=0,y=0,k=1,--camera pos/k - x1=0,y1=0,k1=1,--camera pos/k shown - --basic paras + --Basic paragrams + x=0,y=0,k=1,--Camera pos/k + x1=0,y1=0,k1=1,--Camera pos/k shown - keyCtrl=false,--if controlling with key + --If controlling with key + keyCtrl=false, + --For auto zooming when enter/leave scene zoomMethod=nil, zoomK=nil, - --for auto zooming when enter/leave scene } -scr={x=0,y=0,w=0,h=0,rad=0,k=1}--wid,hei,radius,scale K +scr={x=0,y=0,w=0,h=0,W=0,H=0,rad=0,k=1}--wid,hei,radius,scale K customSel={1,22,1,1,7,3,1,1,8,4,1,1,1} preField={h=20}for i=1,20 do preField[i]={0,0,0,0,0,0,0,0,0,0}end preBag={} -players={alive={},human=0} ---blockSkin,blockSkinMini={},{}--redefined in SKIN.change +game={ + frame=0, --Frame count + result=false, --Game result (string) + pauseTime=0, --Time paused + pauseCount=0, --Pausing count + garbageSpeed=1, --Garbage timing speed + warnLVL0=0, --Warning level + warnLVL=0, --Warning level (show) + recording=false, --If recording + replaying=false, --If replaying + seed=math.random(999999999),--Game seed + setting={}, --Game settings + rec={}, --Recording list, key,time,key,time... -require("Zframework")--load Zframework + --Data for royale mode + stage=nil, --Game stage + mostBadge=nil, --Most badge owner + secBadge=nil, --Second badge owner + mostDangerous=nil, --Most dangerous player + secDangerous=nil, --Second dangerous player +}--Global game data +players={alive={}}--Players data +curMode=nil--Current mode object +--blockSkin,blockSkinMini={},{}--Redefined in SKIN.change + +require("Zframework")--Load Zframework --Load modules blocks= require("parts/mino") @@ -58,7 +83,7 @@ Modes= require("parts/modes") TICK= require("parts/tick") ---load files & settings +--Load files & settings modeRanks={sprint_10=0} local fs=love.filesystem @@ -74,6 +99,9 @@ else setting.swap=false setting.vib=2 setting.powerInfo=true + setting.fullscreen=true + love.window.setFullscreen(true) + love.resize(love.graphics.getWidth(),love.graphics.getHeight()) end end LANG.set(setting.lang) @@ -87,23 +115,35 @@ if fs.getInfo("virtualkey.dat")then FILE.loadVK()end if fs.getInfo("tech_ultimate.dat")then fs.remove("tech_ultimate.dat")end if fs.getInfo("tech_ultimate+.dat")then fs.remove("tech_ultimate+.dat")end ---update data file -S=stat -while #modeRanks>73 do - table.remove(modeRanks) -end -if modeRanks[73]==6 then modeRanks[73]=0 end -if modeRanks[1]then--rename key of modeRanks - local L=modeRanks - for i=1,#L do - L[Modes[i].name],L[i]=L[i] +--Update modeRanks +R=modeRanks +for k,v in next,R do + if type(k)=="number"then + local save=v + if not R[Modes[k].name]then + R[Modes[k].name]=v + end + R[k]=nil end end -if S.version=="Alpha V0.9.1"or type(setting.spawn)~="number"then +if R.master_adavnce then + R.master_advance,R.master_adavnce=R.master_adavnce +end +if not text.modes[stat.lastPlay]then + stat.lastPlay="sprint_10" +end + +--Update data file +S=stat +if type(setting.spawn)~="number"then setting.spawn=0 end if S.version~=gameVersion then S.version=gameVersion - TEXT.show(text.newVersion,640,200,30,"fly",.3) + newVersionLaunch=true + + fs.remove("sprintPenta.dat") + fs.remove("master_adavnce.dat") + fs.remove("master_beginner.dat") end -S=nil \ No newline at end of file +R,S=nil \ No newline at end of file diff --git a/modes/GM.lua b/modes/GM.lua index 6da181d5..cccc8301 100644 --- a/modes/GM.lua +++ b/modes/GM.lua @@ -2,7 +2,8 @@ local int,max,min=math.floor,math.max,math.min local sectionName={"M7","M8","M9","M","MK","MV","MO","MM","GM"} local function score(P) local F=false - if P.modeData.point<70 then--if Less then MM + --If Less then MM + if P.modeData.point<70 then local R=#P.clearedRow if R==0 then return end if R==4 then R=10 end @@ -28,6 +29,7 @@ return{ P.modeData.point=min(P.modeData.point+16,80) P.modeData.event=sectionName[int(P.modeData.point*.1)+1] P:win("finish") + return true end end, bg="aura",bgm="far", diff --git a/modes/attacker_hard.lua b/modes/attacker_hard.lua index 08d134c0..7cac23ee 100644 --- a/modes/attacker_hard.lua +++ b/modes/attacker_hard.lua @@ -1,4 +1,4 @@ -local int,rnd=math.floor,math.random +local int=math.floor return{ color=color.magenta, env={ @@ -14,12 +14,12 @@ return{ local t if D.event<20 then t=1500-30*D.event--1500~900 - B[p]= {pos=rnd(4,7),amount=12,countdown=t,cd0=t,time=0,sent=false,lv=3} - B[p+1]= {pos=rnd(3,8),amount=10,countdown=t,cd0=t,time=0,sent=false,lv=4} + B[p]= {pos=P:RND(4,7),amount=12,countdown=t,cd0=t,time=0,sent=false,lv=3} + B[p+1]= {pos=P:RND(3,8),amount=10,countdown=t,cd0=t,time=0,sent=false,lv=4} else t=900-10*(D.event-20)--900~600 - B[p]= {pos=rnd(10),amount=14,countdown=t,cd0=t,time=0,sent=false,lv=4} - B[p+1]= {pos=rnd(4,7),amount=8,countdown=t,cd0=t,time=0,sent=false,lv=5} + B[p]= {pos=P:RND(10),amount=14,countdown=t,cd0=t,time=0,sent=false,lv=4} + B[p+1]= {pos=P:RND(4,7),amount=8,countdown=t,cd0=t,time=0,sent=false,lv=5} end B.sum=B.sum+22 P.stat.recv=P.stat.recv+22 @@ -34,7 +34,7 @@ return{ end end end, - bg="game4",bgm="push", + bg="rainbow2",bgm="way", }, pauseLimit=true, load=function() diff --git a/modes/attacker_ultimate.lua b/modes/attacker_ultimate.lua index 216a2458..84b257a3 100644 --- a/modes/attacker_ultimate.lua +++ b/modes/attacker_ultimate.lua @@ -1,4 +1,4 @@ -local int,rnd,min=math.floor,math.random,math.min +local int,min=math.floor,math.min return{ color=color.lYellow, env={ @@ -13,18 +13,18 @@ return{ local s,t if D.event<10 then t=800-10*D.event--800~700 - B[p]= {pos=rnd(5,6),amount=9,countdown=t,cd0=t,time=0,sent=false,lv=3} - B[p+1]= {pos=rnd(4,7),amount=11,countdown=t,cd0=t+62,time=0,sent=false,lv=4} + B[p]= {pos=P:RND(5,6),amount=9,countdown=t,cd0=t,time=0,sent=false,lv=3} + B[p+1]= {pos=P:RND(4,7),amount=11,countdown=t,cd0=t+62,time=0,sent=false,lv=4} s=20 elseif D.event<20 then t=800-10*D.event--700~600 - B[p]= {pos=rnd(3,8),amount=11,countdown=t,cd0=t,time=0,sent=false,lv=4} - B[p+1]= {pos=rnd(4,7),amount=13,countdown=t,cd0=t+62,time=0,sent=false,lv=5} + B[p]= {pos=P:RND(3,8),amount=11,countdown=t,cd0=t,time=0,sent=false,lv=4} + B[p+1]= {pos=P:RND(4,7),amount=13,countdown=t,cd0=t+62,time=0,sent=false,lv=5} s=24 else t=600-15*(min(D.event-20,10))--600~450 - B[p]= {pos=rnd(2)*9-8,amount=14,countdown=t,cd0=t,time=0,sent=false,lv=5} - B[p+1]= {pos=rnd(3,8),amount=14,countdown=t+62,cd0=t,time=0,sent=false,lv=5} + B[p]= {pos=P:RND(2)*9-8,amount=14,countdown=t,cd0=t,time=0,sent=false,lv=5} + B[p+1]= {pos=P:RND(3,8),amount=14,countdown=t+62,cd0=t,time=0,sent=false,lv=5} s=28 end B.sum=B.sum+s @@ -43,7 +43,7 @@ return{ end end end, - bg="game4",bgm="shining terminal", + bg="rainbow2",bgm="shining terminal", }, pauseLimit=true, load=function() diff --git a/modes/bigbang.lua b/modes/bigbang.lua index 6fbe730f..36464ad1 100644 --- a/modes/bigbang.lua +++ b/modes/bigbang.lua @@ -13,7 +13,7 @@ return{ hold=false, dropPiece=function(P)P:lose()end, task=nil, - bg="game1",bgm="newera", + bg="bg1",bgm="newera", }, pauseLimit=true, load=function() diff --git a/modes/blind_easy.lua b/modes/blind_easy.lua index 7500c719..a826c900 100644 --- a/modes/blind_easy.lua +++ b/modes/blind_easy.lua @@ -7,7 +7,7 @@ return{ dropPiece=PLY.reach_winCheck, freshLimit=10, target=200, - bg="glow",bgm="newera", + bg="glow",bgm="reason", }, pauseLimit=true, load=function() diff --git a/modes/blind_hard.lua b/modes/blind_hard.lua index 3d8d8cfc..a691ee4b 100644 --- a/modes/blind_hard.lua +++ b/modes/blind_hard.lua @@ -4,13 +4,13 @@ return{ color=color.magenta, env={ drop=15,lock=45, - fall=10,lock=60, + fall=10, center=false, visible="none", dropPiece=PLY.reach_winCheck, freshLimit=15, target=200, - bg="rgb",bgm="secret7th", + bg="rgb",bgm="reason", }, pauseLimit=true, load=function() diff --git a/modes/blind_lunatic.lua b/modes/blind_lunatic.lua index 866eb444..0c733469 100644 --- a/modes/blind_lunatic.lua +++ b/modes/blind_lunatic.lua @@ -11,7 +11,7 @@ return{ dropPiece=PLY.reach_winCheck, freshLimit=15, target=200, - bg="rgb",bgm="secret8th", + bg="rgb",bgm="reason", }, pauseLimit=true, load=function() diff --git a/modes/blind_normal.lua b/modes/blind_normal.lua index 374a2bc6..a6b5a5f3 100644 --- a/modes/blind_normal.lua +++ b/modes/blind_normal.lua @@ -7,7 +7,6 @@ return{ freshLimit=10, visible="fast", dropPiece=PLY.reach_winCheck, - freshLimit=10, target=200, bg="glow",bgm="reason", }, diff --git a/modes/blind_ultimate.lua b/modes/blind_ultimate.lua index 9427ac77..c6fcf098 100644 --- a/modes/blind_ultimate.lua +++ b/modes/blind_ultimate.lua @@ -11,7 +11,7 @@ return{ dropPiece=PLY.reach_winCheck, freshLimit=15, target=200, - bg="rgb",bgm="secret7th", + bg="rgb",bgm="way", }, pauseLimit=true, load=function() diff --git a/modes/blind_wtf.lua b/modes/blind_wtf.lua index fe1e0ad2..243b2d82 100644 --- a/modes/blind_wtf.lua +++ b/modes/blind_wtf.lua @@ -13,7 +13,7 @@ return{ dropPiece=PLY.reach_winCheck, freshLimit=15, target=100, - bg="none",bgm="secret7th", + bg="none",bgm="way", }, pauseLimit=true, load=function() diff --git a/modes/c4wtrain_lunatic.lua b/modes/c4wtrain_lunatic.lua index b7b647ed..8cfb347c 100644 --- a/modes/c4wtrain_lunatic.lua +++ b/modes/c4wtrain_lunatic.lua @@ -1,4 +1,4 @@ -local rnd,min=math.random,math.min +local min=math.min local function check_c4w(P) for i=1,#P.clearedRow do P.field[#P.field+1]=freeRow.get(13) @@ -35,7 +35,7 @@ return{ P.visTime[i]=freeRow.get(20) for x=4,7 do F[i][x]=0 end end - local r=rnd(6) + local r=P:RND(6) if r==1 then F[1][5],F[1][4],F[2][4]=13,13,13 elseif r==2 then F[1][6],F[1][7],F[2][7]=13,13,13 elseif r==3 then F[1][4],F[2][4],F[2][5]=13,13,13 @@ -59,7 +59,7 @@ return{ if L==100 then local T=P.stat.time return - T<=36 and 5 or + T<=40 and 5 or T<=60 and 4 or 3 else diff --git a/modes/c4wtrain_normal.lua b/modes/c4wtrain_normal.lua index 0db467be..08fdcfe9 100644 --- a/modes/c4wtrain_normal.lua +++ b/modes/c4wtrain_normal.lua @@ -1,4 +1,4 @@ -local rnd,min=math.random,math.min +local min=math.min local function check_c4w(P) for i=1,#P.clearedRow do P.field[#P.field+1]=freeRow.get(13) @@ -33,7 +33,7 @@ return{ P.visTime[i]=freeRow.get(20) for x=4,7 do F[i][x]=0 end end - local r=rnd(6) + local r=P:RND(6) if r==1 then F[1][5],F[1][4],F[2][4]=13,13,13 elseif r==2 then F[1][6],F[1][7],F[2][7]=13,13,13 elseif r==3 then F[1][4],F[2][4],F[2][5]=13,13,13 diff --git a/modes/custom_puzzle.lua b/modes/custom_puzzle.lua index 39a04850..c9d4bad6 100644 --- a/modes/custom_puzzle.lua +++ b/modes/custom_puzzle.lua @@ -31,7 +31,11 @@ return{ end modeEnv._20G=modeEnv.drop==0 modeEnv.oncehold=customSel[6]==1 - if preBag[1]then modeEnv.bag=preBag end + if preBag[1]then + modeEnv.bag=preBag + else + modeEnv.bag=nil + end modeEnv.target=0 PLY.newPlayer(1,340,15) local L=modeEnv.opponent diff --git a/modes/defender_lunatic.lua b/modes/defender_lunatic.lua index dcbbf657..0d0643db 100644 --- a/modes/defender_lunatic.lua +++ b/modes/defender_lunatic.lua @@ -1,4 +1,4 @@ -local int,rnd=math.floor,math.random +local int=math.floor return{ color=color.red, env={ @@ -14,7 +14,7 @@ return{ if P.modeData.counter>=t then P.modeData.counter=0 for _=1,4 do - P.atkBuffer[#P.atkBuffer+1]={pos=rnd(10),amount=1,countdown=5*t,cd0=5*t,time=0,sent=false,lv=2} + P.atkBuffer[#P.atkBuffer+1]={pos=P:RND(10),amount=1,countdown=5*t,cd0=5*t,time=0,sent=false,lv=2} end P.atkBuffer.sum=P.atkBuffer.sum+4 P.stat.recv=P.stat.recv+4 @@ -37,7 +37,7 @@ return{ end end end, - bg="game4",bgm="shining terminal", + bg="rainbow2",bgm="shining terminal", }, pauseLimit=true, load=function() diff --git a/modes/defender_normal.lua b/modes/defender_normal.lua index 6c2de052..33b442aa 100644 --- a/modes/defender_normal.lua +++ b/modes/defender_normal.lua @@ -1,4 +1,4 @@ -local int,rnd=math.floor,math.random +local int=math.floor return{ color=color.green, env={ @@ -14,7 +14,7 @@ return{ if P.modeData.counter>=t then P.modeData.counter=0 for _=1,3 do - P.atkBuffer[#P.atkBuffer+1]={pos=rnd(2,9),amount=1,countdown=2*t,cd0=2*t,time=0,sent=false,lv=1} + P.atkBuffer[#P.atkBuffer+1]={pos=P:RND(2,9),amount=1,countdown=2*t,cd0=2*t,time=0,sent=false,lv=1} end P.atkBuffer.sum=P.atkBuffer.sum+3 P.stat.recv=P.stat.recv+3 @@ -37,7 +37,7 @@ return{ end end end, - bg="game4",bgm="way", + bg="rainbow2",bgm="way", }, pauseLimit=true, load=function() diff --git a/modes/dig_hard.lua b/modes/dig_hard.lua index db901cb6..41a0bf2a 100644 --- a/modes/dig_hard.lua +++ b/modes/dig_hard.lua @@ -1,4 +1,4 @@ -local max,rnd=math.max,math.random +local max=math.max return{ color=color.magenta, env={ @@ -10,13 +10,13 @@ return{ local D=P.modeData D.counter=D.counter+1 if D.counter>=max(90,180-D.event)then - P:garbageRise(10,1,rnd(10)) + P:garbageRise(10,1,P:RND(10)) P.stat.recv=P.stat.recv+1 D.counter=0 D.event=D.event+1 end end, - bg="game2",bgm="push", + bg="bg2",bgm="way", }, pauseLimit=true, load=function() diff --git a/modes/dig_ultimate.lua b/modes/dig_ultimate.lua index 9e6c82a1..03ec1118 100644 --- a/modes/dig_ultimate.lua +++ b/modes/dig_ultimate.lua @@ -1,4 +1,4 @@ -local max,rnd=math.max,math.random +local max=math.max return{ color=color.lYellow, env={ @@ -9,13 +9,13 @@ return{ local D=P.modeData D.counter=D.counter+1 if D.counter>=max(30,80-.3*D.event)then - P:garbageRise(13+D.event%5,1,rnd(10)) + P:garbageRise(13+D.event%5,1,P:RND(10)) P.stat.recv=P.stat.recv+1 D.counter=0 D.event=D.event+1 end end, - bg="game2",bgm="secret7th", + bg="bg2",bgm="shining terminal", }, pauseLimit=true, load=function() diff --git a/modes/drought_lunatic.lua b/modes/drought_lunatic.lua index 9c2ec97e..0cff057f 100644 --- a/modes/drought_lunatic.lua +++ b/modes/drought_lunatic.lua @@ -1,4 +1,4 @@ -local rnd,min,rem=math.random,math.min,table.remove +local min,rem=math.min,table.remove return{ color=color.red, env={ @@ -11,13 +11,14 @@ return{ local height=freeRow.get(0) local max=#P.field if max>0 then + --Get heights for x=1,10 do local h=max while P.field[h][x]==0 and h>1 do h=h-1 end height[x]=h - end--get heights + end else for x=1,10 do height[x]=0 @@ -42,8 +43,8 @@ return{ goto END end - --give I when no hole - d=-999--height difference + --Give I when no hole + d=-999--Height difference --A=hole mark for x=2,11 do local _=height[x]-height[x-1] @@ -59,7 +60,7 @@ return{ res[A+2]=7 end - --give O when no d=0/give T when no d=1 + --Give O when no d=0/give T when no d=1 d=0--d=0 count A=0--d=1 count for x=2,10 do @@ -87,7 +88,7 @@ return{ ::END:: freeRow.discard(height) - P:getNext(res[rnd(#res)]) + P:getNext(res[P:RND(#res)]) end end, target=100,dropPiece=PLY.reach_winCheck, diff --git a/modes/infinite_dig.lua b/modes/infinite_dig.lua index fc5a5f44..f1382fed 100644 --- a/modes/infinite_dig.lua +++ b/modes/infinite_dig.lua @@ -1,8 +1,27 @@ -local format,rnd=string.format,math.random +local format=string.format local function check_rise(P) if #P.clearedRow==0 then + local L=P.garbageBeneath + if L>0 then + if L<3 then + P:showTextF(text.almost,0,-120,80,"beat",.8) + elseif L<5 then + P:showTextF(text.great,0,-120,80,"fly",.8) + end + end for i=1,8-P.garbageBeneath do - P:garbageRise(13,1,rnd(10)) + P:garbageRise(13,1,P:RND(10)) + end + else + if P.garbageBeneath==0 then + P:showTextF(text.awesome,0,-120,80,"beat",.6) + SFX.play("clear") + BG.send(26) + for i=1,8-P.garbageBeneath do + P:garbageRise(13,1,P:RND(10)) + end + else + BG.send(#P.clearedRow) end end end @@ -13,13 +32,14 @@ return{ drop=1e99,lock=1e99, oncehold=false, dropPiece=check_rise, - pushSpeed=1, - bg="glow",bgm="infinite", + pushSpeed=1.2, + bg="wing",bgm="infinite", }, load=function() PLY.newPlayer(1,340,15) + local P=players[1] for _=1,8 do - players[1]:garbageRise(13,1,rnd(10)) + P:garbageRise(13,1,P:RND(10)) end end, mesDisp=function(P,dx,dy) diff --git a/modes/marathon_hard.lua b/modes/marathon_hard.lua index 8e91de96..a2f039fe 100644 --- a/modes/marathon_hard.lua +++ b/modes/marathon_hard.lua @@ -21,7 +21,7 @@ return{ mindas=7,minarr=1,minsdarr=1, drop=.5,wait=8,fall=20, target=50,dropPiece=check, - bg="game2",bgm="push", + bg="bg2",bgm="push", }, pauseLimit=true, slowMark=true, diff --git a/modes/marathon_normal.lua b/modes/marathon_normal.lua index f73a5d15..2b90d802 100644 --- a/modes/marathon_normal.lua +++ b/modes/marathon_normal.lua @@ -17,11 +17,10 @@ return{ color=color.green, env={ noFly=true, - minsdarr=1, wait=8,fall=20, target=10,dropPiece=check_LVup, mindas=7,minarr=1,minsdarr=1, - bg="game2",bgm="push", + bg="bg2",bgm="push", }, pauseLimit=true, slowMark=true, diff --git a/modes/master_adavnce.lua b/modes/master_advance.lua similarity index 78% rename from modes/master_adavnce.lua rename to modes/master_advance.lua index 107bdbec..9e12421e 100644 --- a/modes/master_adavnce.lua +++ b/modes/master_advance.lua @@ -14,9 +14,10 @@ local function score(P) if P.modeData.point%100==99 then SFX.play("blip_1") elseif P.modeData.point>=100*(P.modeData.event+1)then - local s=P.modeData.event+1;P.modeData.event=s--level up! + --Level up! + local s=P.modeData.event+1;P.modeData.event=s local E=P.gameEnv - BG.set(s==1 and"game3"or s==2 and"game4"or s==3 and"game5"or s==4 and"game6"or"game5") + BG.set(s==1 and"rainbow"or s==2 and"rainbow2"or s==3 and"lightning"or s==4 and"lightning2"or"lightning") E.lock=death_lock[s] E.wait=death_wait[s] E.fall=death_fall[s] @@ -43,7 +44,7 @@ return{ fall=death_fall[1], dropPiece=score, freshLimit=15, - bg="game2",bgm="secret7th", + bg="bg2",bgm="secret7th", }, slowMark=true, load=function() @@ -55,10 +56,10 @@ return{ mStr((P.modeData.event+1)*100,-81,370) gc.rectangle("fill",-125,375,90,4) end, - score=function(P)return{P.modeData.point,P.stat.row,P.stat.time}end, - scoreDisp=function(D)return D[1].."P "..D[2].."L "..toTime(D[3])end, + score=function(P)return{P.modeData.point,P.stat.time}end, + scoreDisp=function(D)return D[1].."P "..toTime(D[2])end, comp=function(a,b) - return a[1]>b[1]or(a[1]==b[1]and(a[2]b[1]or(a[1]==b[1]and a[2]=100*(P.modeData.event+1)then - local s=P.modeData.event+1;P.modeData.event=s--level up! + --Level up! + local s=P.modeData.event+1;P.modeData.event=s local E=P.gameEnv - BG.set(s==1 and"game1"or s==2 and"game2"or s==3 and"game3"or "game4") + BG.set(s==1 and"bg1"or s==2 and"bg2"or s==3 and"rainbow"or "rainbow2") E.lock=rush_lock[s] E.wait=rush_wait[s] E.fall=rush_fall[s] @@ -47,7 +48,7 @@ return{ fall=rush_fall[1], dropPiece=score, freshLimit=15, - bg="game1",bgm="secret8th", + bg="bg1",bgm="secret8th", }, slowMark=true, load=function() @@ -59,25 +60,25 @@ return{ mStr((P.modeData.event+1)*100,-81,370) gc.rectangle("fill",-125,375,90,4) end, - score=function(P)return{P.modeData.point,P.stat.row,P.stat.time}end, - scoreDisp=function(D)return D[1].."P "..D[2].."L "..toTime(D[3])end, + score=function(P)return{P.modeData.point,P.stat.time}end, + scoreDisp=function(D)return D[1].."P "..toTime(D[2])end, comp=function(a,b) - return a[1]>b[1]or(a[1]==b[1]and(a[2]b[1]or(a[1]==b[1]and a[2]=30 and 5 or - L>=25 and 4 or + T<=170 and 5 or + T<=200 and 4 or 3 else return - S>=420 and 3 or - S>=250 and 2 or - S>=120 and 1 or - S>=30 and 0 + S>=460 and 3 or + S>=350 and 2 or + S>=200 and 1 or + S>=50 and 0 end end, } \ No newline at end of file diff --git a/modes/master_final.lua b/modes/master_final.lua index 119a11f1..9b132400 100644 --- a/modes/master_final.lua +++ b/modes/master_final.lua @@ -11,21 +11,23 @@ local function score(P) MD.point=MD.point+s if MD.point%100==99 then SFX.play("blip_1")end if int(MD.point*.01)>MD.event then - local s=MD.event+1;MD.event=s--level up! + --Level up! + local s=MD.event+1;MD.event=s local E=P.gameEnv - if s<4 then--first 300 + if s<4 then + P:showTextF(text.stage(s),0,-120,80,"fly") + --First 300 if s~=1 then E.lock=E.lock-1 end if s~=2 then E.wait=E.wait-1 end if s~=3 then E.fall=E.fall-1 end - P:showTextF(text.stage(s),0,-120,80,"fly") elseif s<10 then + P:showTextF(text.stage(s),0,-120,60,"fly",1.26) if s==4 or s==7 then E.das=E.das-1 end s=s%3 if s==0 then E.lock=E.lock-1 elseif s==1 then E.wait=E.wait-1 elseif s==2 then E.fall=E.fall-1 end - P:showTextF(text.stage(s),0,-120,80,"fly") else MD.point,MD.event=1000,9 P:win("finish") @@ -44,7 +46,7 @@ return{ dropPiece=score, freshLimit=15, easyFresh=false,bone=true, - bg="none",bgm="distortion", + bg="lightning",bgm="distortion", }, slowMark=true, load=function() diff --git a/modes/pcchallenge_hard.lua b/modes/pcchallenge_hard.lua index eb71a038..92f6c68c 100644 --- a/modes/pcchallenge_hard.lua +++ b/modes/pcchallenge_hard.lua @@ -7,7 +7,7 @@ return{ target=100,dropPiece=PLY.reach_winCheck, freshLimit=15, ospin=false, - bg="rgb",bgm="infinite", + bg="rgb",bgm="newera", }, pauseLimit=true, load=function() diff --git a/modes/pcchallenge_lunatic.lua b/modes/pcchallenge_lunatic.lua index ec78e882..7dc61dbc 100644 --- a/modes/pcchallenge_lunatic.lua +++ b/modes/pcchallenge_lunatic.lua @@ -7,7 +7,7 @@ return{ target=100,dropPiece=PLY.reach_winCheck, freshLimit=15, ospin=false, - bg="rgb",bgm="infinite", + bg="rgb",bgm="newera", }, pauseLimit=true, load=function() diff --git a/modes/pctrain_lunatic.lua b/modes/pctrain_lunatic.lua index f91c5fc3..d45a471b 100644 --- a/modes/pctrain_lunatic.lua +++ b/modes/pctrain_lunatic.lua @@ -1,4 +1,4 @@ -local int,rnd=math.floor,math.random +local int=math.floor local ins=table.insert local pc_drop={50,45,40,35,30,26,22,18,15,12} local pc_lock={55,50,45,40,36,32,30} @@ -11,7 +11,7 @@ local function task_PC(P) P.modeData.counter=P.modeData.counter+1 if P.modeData.counter==26 then local base=PCbase[P.modeData.type] - P:pushLine(base[rnd(#base)],P.modeData.symmetry) + P:pushLine(base[P:RND(#base)],P.modeData.symmetry) return true end end @@ -24,9 +24,9 @@ local function newPC(P) if c<5 then P:lose()end end if #P.field==0 then - local type=PCtype[P.stat.pc]or rnd(2,3) - local L=PClist[type][rnd(#PClist[1])] - local symmetry=rnd()>.5 + local type=PCtype[P.stat.pc]or P:RND(2,3) + local L=PClist[type][P:RND(#PClist[1])] + local symmetry=P:RND()>.5 P.modeData.type=type P.modeData.symmetry=symmetry P:pushNext(L,symmetry) diff --git a/modes/pctrain_normal.lua b/modes/pctrain_normal.lua index 876a921e..0e7c512d 100644 --- a/modes/pctrain_normal.lua +++ b/modes/pctrain_normal.lua @@ -1,4 +1,3 @@ -local rnd=math.random local PCbase=require("parts/PCbase") local PClist=require("parts/PClist") local PCtype={ @@ -17,7 +16,7 @@ local function task_PC(P) P.modeData.counter=P.modeData.counter+1 if P.modeData.counter==26 then local base=PCbase[P.modeData.type] - P:pushLine(base[rnd(#base)],P.modeData.symmetry) + P:pushLine(base[P:RND(#base)],P.modeData.symmetry) return true end end @@ -30,9 +29,9 @@ local function newPC(P) if c<5 then P:lose()end end if #P.field==0 then - local type=PCtype[P.stat.pc]or rnd(2,3) - local L=PClist[type][rnd(#PClist[1])] - local symmetry=rnd()>.5 + local type=PCtype[P.stat.pc]or P:RND(2,3) + local L=PClist[type][P:RND(#PClist[1])] + local symmetry=P:RND()>.5 P.modeData.type=type P.modeData.symmetry=symmetry P:pushNext(L,symmetry) diff --git a/modes/round_1.lua b/modes/round_1.lua index 7af56ac3..43d37c75 100644 --- a/modes/round_1.lua +++ b/modes/round_1.lua @@ -16,7 +16,7 @@ return{ drop=1e99,lock=1e99, oncehold=false, dropPiece=update_round, - bg="game3",bgm="push", + bg="rainbow",bgm="push", }, load=function() PLY.newPlayer(1,340,15) diff --git a/modes/round_2.lua b/modes/round_2.lua index ca908e8c..981eea08 100644 --- a/modes/round_2.lua +++ b/modes/round_2.lua @@ -16,7 +16,7 @@ return{ drop=1e99,lock=1e99, oncehold=false, dropPiece=update_round, - bg="game3",bgm="push", + bg="rainbow",bgm="push", }, load=function() PLY.newPlayer(1,340,15) diff --git a/modes/round_3.lua b/modes/round_3.lua index 341313e0..e7318c6f 100644 --- a/modes/round_3.lua +++ b/modes/round_3.lua @@ -16,7 +16,7 @@ return{ drop=1e99,lock=1e99, oncehold=false, dropPiece=update_round, - bg="game3",bgm="push", + bg="rainbow",bgm="push", }, load=function() PLY.newPlayer(1,340,15) diff --git a/modes/round_4.lua b/modes/round_4.lua index 997e1d7f..94cd2402 100644 --- a/modes/round_4.lua +++ b/modes/round_4.lua @@ -16,7 +16,7 @@ return{ drop=1e99,lock=1e99, oncehold=false, dropPiece=update_round, - bg="game3",bgm="push", + bg="rainbow",bgm="push", }, load=function() PLY.newPlayer(1,340,15) diff --git a/modes/round_5.lua b/modes/round_5.lua index cc39ccc0..c2d709c8 100644 --- a/modes/round_5.lua +++ b/modes/round_5.lua @@ -16,7 +16,7 @@ return{ drop=1e99,lock=1e99, oncehold=false, dropPiece=update_round, - bg="game3",bgm="push", + bg="rainbow",bgm="push", }, load=function() PLY.newPlayer(1,340,15) diff --git a/modes/solo_1.lua b/modes/solo_1.lua index 7e3a9363..58a5796d 100644 --- a/modes/solo_1.lua +++ b/modes/solo_1.lua @@ -3,7 +3,7 @@ return{ env={ drop=60,lock=60, freshLimit=15, - bg="game2",bgm="race", + bg="bg2",bgm="race", }, pauseLimit=true, load=function() diff --git a/modes/solo_2.lua b/modes/solo_2.lua index fd0d76c7..6c1e75e9 100644 --- a/modes/solo_2.lua +++ b/modes/solo_2.lua @@ -3,7 +3,7 @@ return{ env={ drop=60,lock=60, freshLimit=15, - bg="game2",bgm="race", + bg="bg2",bgm="race", }, pauseLimit=true, load=function() diff --git a/modes/solo_3.lua b/modes/solo_3.lua index 276d33be..8cc3fbed 100644 --- a/modes/solo_3.lua +++ b/modes/solo_3.lua @@ -3,7 +3,7 @@ return{ env={ drop=60,lock=60, freshLimit=15, - bg="game2",bgm="race", + bg="bg2",bgm="race", }, pauseLimit=true, load=function() diff --git a/modes/solo_4.lua b/modes/solo_4.lua index 9c65d847..d8a7bf67 100644 --- a/modes/solo_4.lua +++ b/modes/solo_4.lua @@ -3,7 +3,7 @@ return{ env={ drop=60,lock=60, freshLimit=15, - bg="game2",bgm="race", + bg="bg2",bgm="race", }, pauseLimit=true, load=function() diff --git a/modes/solo_5.lua b/modes/solo_5.lua index f27788c5..97748f54 100644 --- a/modes/solo_5.lua +++ b/modes/solo_5.lua @@ -3,7 +3,7 @@ return{ env={ drop=60,lock=60, freshLimit=15, - bg="game2",bgm="race", + bg="bg2",bgm="race", }, pauseLimit=true, load=function() diff --git a/modes/sprintPenta.lua b/modes/sprintPenta.lua index 603609a7..3cdd14a7 100644 --- a/modes/sprintPenta.lua +++ b/modes/sprintPenta.lua @@ -25,20 +25,16 @@ return{ end, score=function(P)return{P.stat.time,P.stat.piece}end, scoreDisp=function(D)return toTime(D[1]).." "..D[2].." Pieces"end, - comp=function(a,b)return a[2]>b[2]or a[2]==b[2]and a[1]=max(60,150-2*P.modeData.event)and P.atkBuffer.sum<4 then - P.atkBuffer[#P.atkBuffer+1]={pos=rnd(10),amount=1,countdown=30,cd0=30,time=0,sent=false,lv=1} + P.atkBuffer[#P.atkBuffer+1]={pos=P:RND(10),amount=1,countdown=30,cd0=30,time=0,sent=false,lv=1} P.atkBuffer.sum=P.atkBuffer.sum+1 P.stat.recv=P.stat.recv+1 if P.modeData.event==45 then P:showTextF(text.maxspeed,0,-140,100,"appear",.6)end diff --git a/modes/survivor_hard.lua b/modes/survivor_hard.lua index 3435bf8f..07322dff 100644 --- a/modes/survivor_hard.lua +++ b/modes/survivor_hard.lua @@ -1,4 +1,4 @@ -local max,rnd=math.max,math.random +local max=math.max return{ color=color.magenta, env={ @@ -11,9 +11,9 @@ return{ if P.modeData.counter>=max(60,180-2*P.modeData.event)and B.sum<15 then B[#B+1]= P.modeData.event%3<2 and - {pos=rnd(10),amount=1,countdown=0,cd0=0,time=0,sent=false,lv=1} + {pos=P:RND(10),amount=1,countdown=0,cd0=0,time=0,sent=false,lv=1} or - {pos=rnd(10),amount=3,countdown=60,cd0=60,time=0,sent=false,lv=2} + {pos=P:RND(10),amount=3,countdown=60,cd0=60,time=0,sent=false,lv=2} local R=(P.modeData.event%3<2 and 1 or 3) B.sum=B.sum+R P.stat.recv=P.stat.recv+R diff --git a/modes/survivor_lunatic.lua b/modes/survivor_lunatic.lua index 4ff20115..1fb971d2 100644 --- a/modes/survivor_lunatic.lua +++ b/modes/survivor_lunatic.lua @@ -1,4 +1,4 @@ -local max,rnd=math.max,math.random +local max=math.max return{ color=color.red, env={ @@ -9,7 +9,7 @@ return{ P.modeData.counter=P.modeData.counter+1 if P.modeData.counter>=max(60,150-P.modeData.event)and P.atkBuffer.sum<20 then local t=max(60,90-P.modeData.event) - P.atkBuffer[#P.atkBuffer+1]={pos=rnd(10),amount=4,countdown=t,cd0=t,time=0,sent=false,lv=3} + P.atkBuffer[#P.atkBuffer+1]={pos=P:RND(10),amount=4,countdown=t,cd0=t,time=0,sent=false,lv=3} P.atkBuffer.sum=P.atkBuffer.sum+4 P.stat.recv=P.stat.recv+4 if P.modeData.event==60 then P:showTextF(text.maxspeed,0,-140,100,"appear",.6)end @@ -17,7 +17,7 @@ return{ P.modeData.event=P.modeData.event+1 end end, - bg="glow",bgm="newera", + bg="glow",bgm="secret8th", }, pauseLimit=true, load=function() diff --git a/modes/survivor_normal.lua b/modes/survivor_normal.lua index e1e6c6ae..3a1527a7 100644 --- a/modes/survivor_normal.lua +++ b/modes/survivor_normal.lua @@ -1,4 +1,4 @@ -local max,rnd=math.max,math.random +local max=math.max return{ color=color.green, env={ @@ -10,10 +10,10 @@ return{ if P.modeData.counter>=max(90,180-2*P.modeData.event)and P.atkBuffer.sum<8 then local d=P.modeData.event+1 P.atkBuffer[#P.atkBuffer+1]= - d%4==0 and{pos=rnd(10),amount=1,countdown=60,cd0=60,time=0,sent=false,lv=1}or - d%4==1 and{pos=rnd(10),amount=2,countdown=70,cd0=70,time=0,sent=false,lv=1}or - d%4==2 and{pos=rnd(10),amount=3,countdown=80,cd0=80,time=0,sent=false,lv=2}or - d%4==3 and{pos=rnd(10),amount=4,countdown=90,cd0=90,time=0,sent=false,lv=3} + d%4==0 and{pos=P:RND(10),amount=1,countdown=60,cd0=60,time=0,sent=false,lv=1}or + d%4==1 and{pos=P:RND(10),amount=2,countdown=70,cd0=70,time=0,sent=false,lv=1}or + d%4==2 and{pos=P:RND(10),amount=3,countdown=80,cd0=80,time=0,sent=false,lv=2}or + d%4==3 and{pos=P:RND(10),amount=4,countdown=90,cd0=90,time=0,sent=false,lv=3} P.atkBuffer.sum=P.atkBuffer.sum+d%4+1 P.stat.recv=P.stat.recv+d%4+1 if P.modeData.event==45 then P:showTextF(text.maxspeed,0,-140,100,"appear",.6)end diff --git a/modes/survivor_ultimate.lua b/modes/survivor_ultimate.lua index 8617162e..ad7454a6 100644 --- a/modes/survivor_ultimate.lua +++ b/modes/survivor_ultimate.lua @@ -1,4 +1,4 @@ -local max,rnd=math.max,math.random +local max=math.max return{ color=color.lYellow, env={ @@ -12,10 +12,10 @@ return{ if P.modeData.counter>=max(300,600-10*P.modeData.event)and P.atkBuffer.sum<20 then local t=max(300,480-12*P.modeData.event) local p=#P.atkBuffer+1 - P.atkBuffer[p] ={pos=rnd(10),amount=4,countdown=t,cd0=t,time=0,sent=false,lv=2} - P.atkBuffer[p+1]={pos=rnd(10),amount=4,countdown=t,cd0=t,time=0,sent=false,lv=3} - P.atkBuffer[p+2]={pos=rnd(10),amount=6,countdown=1.2*t,cd0=1.2*t,time=0,sent=false,lv=4} - P.atkBuffer[p+3]={pos=rnd(10),amount=6,countdown=1.5*t,cd0=1.5*t,time=0,sent=false,lv=5} + P.atkBuffer[p] ={pos=P:RND(10),amount=4,countdown=t,cd0=t,time=0,sent=false,lv=2} + P.atkBuffer[p+1]={pos=P:RND(10),amount=4,countdown=t,cd0=t,time=0,sent=false,lv=3} + P.atkBuffer[p+2]={pos=P:RND(10),amount=6,countdown=1.2*t,cd0=1.2*t,time=0,sent=false,lv=4} + P.atkBuffer[p+3]={pos=P:RND(10),amount=6,countdown=1.5*t,cd0=1.5*t,time=0,sent=false,lv=5} P.atkBuffer.sum=P.atkBuffer.sum+20 P.stat.recv=P.stat.recv+20 if P.modeData.event==31 then P:showTextF(text.maxspeed,0,-140,100,"appear",.6)end diff --git a/modes/tech_hard+.lua b/modes/tech_hard+.lua index 643bc159..d174a6b5 100644 --- a/modes/tech_hard+.lua +++ b/modes/tech_hard+.lua @@ -15,7 +15,7 @@ return{ freshLimit=15, target=200, dropPiece=tech_check_hard, - bg="matrix",bgm="secret8th", + bg="matrix",bgm="newera", }, load=function() PLY.newPlayer(1,340,15) diff --git a/modes/tech_hard.lua b/modes/tech_hard.lua index 667e4d02..a46e78c7 100644 --- a/modes/tech_hard.lua +++ b/modes/tech_hard.lua @@ -15,7 +15,7 @@ return{ freshLimit=15, target=200, dropPiece=tech_check_easy, - bg="matrix",bgm="secret8th", + bg="matrix",bgm="newera", }, load=function() PLY.newPlayer(1,340,15) diff --git a/modes/tech_lunatic+.lua b/modes/tech_lunatic+.lua index 8ce97785..e634c66d 100644 --- a/modes/tech_lunatic+.lua +++ b/modes/tech_lunatic+.lua @@ -15,7 +15,7 @@ return{ freshLimit=15, target=200, dropPiece=tech_check_hard, - bg="matrix",bgm="secret7th", + bg="matrix",bgm="push", }, load=function() PLY.newPlayer(1,340,15) diff --git a/modes/tech_lunatic.lua b/modes/tech_lunatic.lua index 0a279044..f17bfd6d 100644 --- a/modes/tech_lunatic.lua +++ b/modes/tech_lunatic.lua @@ -15,7 +15,7 @@ return{ freshLimit=15, target=200, dropPiece=tech_check_easy, - bg="matrix",bgm="secret7th", + bg="matrix",bgm="push", }, load=function() PLY.newPlayer(1,340,15) diff --git a/modes/tech_normal+.lua b/modes/tech_normal+.lua index c1f83021..a10bb63d 100644 --- a/modes/tech_normal+.lua +++ b/modes/tech_normal+.lua @@ -15,7 +15,7 @@ return{ drop=1e99,lock=1e99, target=200, dropPiece=tech_check_hard, - bg="matrix",bgm="newera", + bg="matrix",bgm="way", }, load=function() PLY.newPlayer(1,340,15) diff --git a/modes/tech_normal.lua b/modes/tech_normal.lua index 120e9dd1..8c7d9c4a 100644 --- a/modes/tech_normal.lua +++ b/modes/tech_normal.lua @@ -15,7 +15,7 @@ return{ drop=1e99,lock=1e99, target=200, dropPiece=tech_check_easy, - bg="matrix",bgm="newera", + bg="matrix",bgm="way", }, load=function() PLY.newPlayer(1,340,15) diff --git a/modes/techmino49_easy.lua b/modes/techmino49_easy.lua index 7e4a7a6a..93cf2512 100644 --- a/modes/techmino49_easy.lua +++ b/modes/techmino49_easy.lua @@ -24,7 +24,7 @@ return{ Fkey=selectTarget, pushSpeed=2, freshLimit=15, - bg="game3",bgm="rockblock", + bg="rainbow",bgm="rockblock", }, load=function() royaleData={ diff --git a/modes/techmino49_hard.lua b/modes/techmino49_hard.lua index 2cd0660f..7abcaa71 100644 --- a/modes/techmino49_hard.lua +++ b/modes/techmino49_hard.lua @@ -24,7 +24,7 @@ return{ Fkey=selectTarget, pushSpeed=2, freshLimit=15, - bg="game3",bgm="rockblock", + bg="rainbow",bgm="rockblock", }, load=function() royaleData={ diff --git a/modes/techmino49_ultimate.lua b/modes/techmino49_ultimate.lua index 5b548aef..5150029a 100644 --- a/modes/techmino49_ultimate.lua +++ b/modes/techmino49_ultimate.lua @@ -24,7 +24,7 @@ return{ Fkey=selectTarget, pushSpeed=2, freshLimit=15, - bg="game3",bgm="rockblock", + bg="rainbow",bgm="rockblock", }, load=function() royaleData={ diff --git a/modes/techmino99_easy.lua b/modes/techmino99_easy.lua index b32ceb0a..3bcd885f 100644 --- a/modes/techmino99_easy.lua +++ b/modes/techmino99_easy.lua @@ -24,7 +24,7 @@ return{ Fkey=selectTarget, pushSpeed=2, freshLimit=15, - bg="game3",bgm="rockblock", + bg="rainbow",bgm="rockblock", }, load=function() royaleData={ diff --git a/modes/techmino99_hard.lua b/modes/techmino99_hard.lua index 941d3fff..c2543d48 100644 --- a/modes/techmino99_hard.lua +++ b/modes/techmino99_hard.lua @@ -24,7 +24,7 @@ return{ Fkey=selectTarget, pushSpeed=2, freshLimit=15, - bg="game3",bgm="rockblock", + bg="rainbow",bgm="rockblock", }, load=function() royaleData={ diff --git a/modes/techmino99_ultimate.lua b/modes/techmino99_ultimate.lua index 5812298c..78a7aff4 100644 --- a/modes/techmino99_ultimate.lua +++ b/modes/techmino99_ultimate.lua @@ -24,7 +24,7 @@ return{ Fkey=selectTarget, pushSpeed=2, freshLimit=15, - bg="game3",bgm="rockblock", + bg="rainbow",bgm="rockblock", }, load=function() royaleData={ diff --git a/modes/ultra.lua b/modes/ultra.lua index 71d81d5e..92a84b47 100644 --- a/modes/ultra.lua +++ b/modes/ultra.lua @@ -20,7 +20,7 @@ return{ end end end, - bg="matrix",bgm="infinite", + bg="fan",bgm="infinite", }, slowMark=true, pauseLimit=true, @@ -29,10 +29,10 @@ return{ end, mesDisp=function(P,dx,dy) gc.setLineWidth(2) - gc.rectangle("line",-95,112,32,402) + gc.rectangle("line",-95,120,32,402) local T=P.stat.time/120 gc.setColor(2*T,2-2*T,.2) - gc.rectangle("fill",-94,513,30,(T-1)*400) + gc.rectangle("fill",-94,521,30,(T-1)*400) end, score=function(P)return{P.stat.score}end, scoreDisp=function(D)return tostring(D[1])end, diff --git a/modes/zen.lua b/modes/zen.lua index 8928a019..a8a5ffc1 100644 --- a/modes/zen.lua +++ b/modes/zen.lua @@ -4,7 +4,7 @@ return{ drop=120,lock=120, oncehold=false,target=200, dropPiece=PLY.reach_winCheck, - bg="game2",bgm="infinite", + bg="bg2",bgm="infinite", }, load=function() PLY.newPlayer(1,340,15) diff --git a/parts/ai.lua b/parts/ai.lua index 49e673aa..6bd2db01 100644 --- a/parts/ai.lua +++ b/parts/ai.lua @@ -16,7 +16,7 @@ local Timer=love.timer.getTime -- 6~10:hD,sD,H,A,R, -- 11~13:LL,RR,DD local blockPos={4,4,4,4,4,5,4} -local scs={{1,2},{1,2},{1,2},{1,2},{1,2},{1.5,1.5},{0.5,2.5}} +local scs={{0,1},{0,1},{0,1},{0,1},{0,1},{.5,.5},{-.5,1.5}} -------------------------------------------------Cold clear local CCblockID={6,5,4,3,2,1,0} if system=="Windows"then @@ -198,7 +198,8 @@ end return{ ["9S"]={ function(P,ctrl) - local Tfield={}--test field + local Tfield={}--Test field + local best={x=1,dir=0,hold=false,score=-1e99}--Best method local field_org=P.field for i=1,#field_org do Tfield[i]=freeRow.get(0) @@ -206,7 +207,7 @@ return{ Tfield[i][j]=field_org[i][j] end end - local best={x=1,dir=0,hold=false,score=-1e99} + for ifhold=0,P.gameEnv.hold and 1 or 0 do --Get block id local bn @@ -217,13 +218,17 @@ return{ end if not bn then goto CTN end - for dir=0,dirCount[bn] do--each dir + for dir=0,dirCount[bn] do--Each dir local cb=blocks[bn][dir] - for cx=1,11-#cb[1]do--each pos + for cx=1,11-#cb[1]do--Each pos local cy=#Tfield+1 + + --Move to bottom while not ifoverlapAI(Tfield,cb,cx,cy-1)do cy=cy-1 - end--move to bottom + end + + --Simulate lock for i=1,#cb do local y=cy+i-1 if not Tfield[y]then Tfield[y]=freeRow.get(0)end @@ -232,7 +237,7 @@ return{ Tfield[y][cx+j-1]=1 end end - end--simulate lock + end local score=getScore(Tfield,cb,cy) if score>best.score then best={bn=bn,x=cx,dir=dir,hold=ifhold==1,score=score} @@ -243,9 +248,11 @@ return{ ::CTN:: end if not best.bn then return 1 end + + --Release cache while #Tfield>0 do freeRow.discard(rem(Tfield,1)) - end--Release cache + end local p=#ctrl+1 if best.hold then ctrl[p]=8 @@ -270,11 +277,11 @@ return{ end, }, ["CC"]={ - function(P) + function(P)--Start thinking BOT.think(P.AI_bot) return 2 - end,--start thinking - function(P,ctrl) + end, + function(P,ctrl)--Poll keys local success,dest,hold,move=BOT.getMove(P.AI_bot) if success == 2 then ins(ctrl,6) @@ -298,10 +305,11 @@ return{ ins(ctrl,6) return 3 else - return 2--stay this stage + --Stay this stage + return 2 end - end,--poll keys - function(P) + end, + function(P)--Check if time to change target P.AI_delay=P.AI_delay0 if Timer()-P.modeData.point>P.modeData.event then P.modeData.point=Timer() @@ -309,6 +317,6 @@ return{ P:changeAtkMode(rnd()<.85 and 1 or #P.atker>3 and 4 or rnd()<.3 and 2 or 3) end return 1 - end,--check if time to change target + end, }, }--AI think stage \ No newline at end of file diff --git a/parts/default_data.lua b/parts/default_data.lua index 0ba3449c..9cd09c35 100644 --- a/parts/default_data.lua +++ b/parts/default_data.lua @@ -1,25 +1,28 @@ setting={ - --game + --Game das=10,arr=2, sddas=0,sdarr=2, ihs=true,irs=true,ims=true, - reTime=4, maxNext=6, - autoPause=true, - quickR=true, swap=true, + + --System + reTime=4, + autoPause=true, fine=false, + appLock=false, lang=1, skinSet=1, skin={1,5,8,2,10,3,7,1,5,1,5,8,2,10,3,7,10,7,8,2,8,2,1,5,3}, face={}, - --graphic + --Graphic ghost=true,center=true, smooth=true,grid=false, bagLine=false, lockFX=2, - dropFX=3, + dropFX=2, + moveFX=2, clearFX=2, shakeFX=2, atkFX=3, @@ -31,7 +34,7 @@ setting={ bg=true, powerInfo=false, - --sound + --Sound sfx=10, spawn=0, bgm=7, @@ -39,15 +42,15 @@ setting={ vib=0, voc=0, - --virtualkey + --Virtualkey VKSFX=3,--SFX volume VKVIB=0,--VIB - VKSwitch=false,--if disp - VKTrack=false,--if tracked - VKDodge=false,--if dodge + VKSwitch=false,--If disp + VKTrack=false,--If tracked + VKDodge=false,--If dodge VKTchW=3,--Touch-Pos Weight VKCurW=4,--Cur-Pos Weight - VKIcon=true,--if disp icon + VKIcon=true,--If disp icon VKAlpha=3, } for i=1,25 do @@ -64,7 +67,7 @@ stat={ send=0,recv=0,pend=0,off=0, clear={},spin={}, pc=0,hpc=0,b2b=0,b3b=0,score=0, - lastPlay="sprint_10",--last played mode ID + lastPlay="sprint_10",--Last played mode ID } for i=1,25 do stat.clear[i]={0,0,0,0,0} @@ -73,9 +76,9 @@ end keyMap={ {"left","right","x","z","c","up","down","space","tab","r"},{}, - --keyboard + --Keyboard {"dpleft","dpright","a","b","y","dpup","dpdown","rightshoulder","x","leftshoulder"},{}, - --joystick + --Joystick } for i=1,#keyMap do for j=1,20 do if not keyMap[i][j]then keyMap[i][j]=""end diff --git a/parts/freeRow.lua b/parts/freeRow.lua index a6d1b04c..52a60557 100644 --- a/parts/freeRow.lua +++ b/parts/freeRow.lua @@ -1,6 +1,6 @@ local freeRow={} -local L={}--storage -local _=0--lenth +local L={}--Storage +local _=0--Lenth function freeRow.reset(num) if num<_ then for i=_,num+1,-1 do diff --git a/parts/gametoolfunc.lua b/parts/gametoolfunc.lua index 35fc3785..c91a316c 100644 --- a/parts/gametoolfunc.lua +++ b/parts/gametoolfunc.lua @@ -6,6 +6,25 @@ local sub,find=string.sub,string.find local char,byte=string.char,string.byte local ins,rem=table.insert,table.remove +local default_setting={ + "das","arr", + "sddas","sdarr", + "ihs","irs","ims", + "maxNext", + "swap", + -- "face", +} +local function copyGameSetting() + local S={face={}} + for _,v in next,default_setting do + S[v]=setting[v] + end + for i=1,25 do + S.face[i]=setting.face[i] + end + return S +end + function destroyPlayers() for i=#players,1,-1 do local P=players[i] @@ -25,7 +44,6 @@ function destroyPlayers() for i=#players.alive,1,-1 do players.alive[i]=nil end - players.human=0 collectgarbage() end @@ -43,18 +61,22 @@ function restoreVirtualKey() virtualkey[9].ava=false end end + function copyBoard() local str="" local H=0 + for y=20,1,-1 do for x=1,10 do if preField[y][x]~=0 then H=y - goto L + goto topFound end end end - ::L:: + ::topFound:: + + --Encode field for y=1,H do local S="" local L=preField[y] @@ -63,38 +85,36 @@ function copyBoard() end str=str..S end - love.system.setClipboardText("Techmino sketchpad:"..data.encode("string","base64",data.compress("string","deflate",str))) - TEXT.show(text.copySuccess,350,360,40,"appear",.5) + return data.encode("string","base64",data.compress("string","deflate",str)) end -function pasteBoard() +function pasteBoard(str) local _ - local fX,fY=1,1--*ptr for Field(r*10+(c-1)) - --Read data - local str=love.system.getClipboardText() - local p=find(str,":")--ptr* - if p then str=sub(str,p+1)end + --Decode _,str=pcall(data.decode,"string","base64",str) - if not _ then goto ERROR end + if not _ then return end _,str=pcall(data.decompress,"string","deflate",str) - if not _ then goto ERROR end - - p=1 + if not _ then return end + local fX,fY=1,1--*ptr for Field(r*10+(c-1)) + local p=1 while true do _=byte(str,p)--1byte + + --Str end if not _ then if fX~=1 then - goto ERROR + return else fY=fY+1 break end - end--str end + end + + __=_%32-1--Block id + if __>17 then return end--Illegal blockid + _=int(_/32)--Mode id - __=_%32-1--block id - if __>17 then goto ERROR end--illegal blockid - _=int(_/32)--mode id preField[fY][fX]=__ if fX<10 then fX=fX+1 @@ -111,8 +131,41 @@ function pasteBoard() preField[y][x]=0 end end - do return end - ::ERROR::TEXT.show(text.dataCorrupted,350,360,35,"flicker",.5) + + return true +end + +function copySequence() + local str="" + + for i=1,#preBag do + str=str..char(preBag[i]-1) + end + + return data.encode("string","base64",data.compress("string","deflate",str)) +end +function pasteSequence(str) + local _ + + --Decode + _,str=pcall(data.decode,"string","base64",str) + if not _ then return end + _,str=pcall(data.decompress,"string","deflate",str) + if not _ then return end + + local bag={} + for i=1,#str do + _=byte(str,i) + if _<25 then + bag[i]=_+1 + else + return + end + end + + preBag=bag + sceneTemp.cur=#preBag + return true end function mergeStat(stat,delta) @@ -128,7 +181,8 @@ function mergeStat(stat,delta) end end end -function randomTarget(P) + +function randomTarget(P)--Return a random opponent for P if #players.alive>1 then local R repeat @@ -136,7 +190,7 @@ function randomTarget(P) until R~=P return R end -end--return a random opponent for P +end function freshMostDangerous() game.mostDangerous,game.secDangerous=nil local m,m2=0,0 @@ -196,24 +250,27 @@ function royaleLevelup() local P=players.alive[i] P.gameEnv.drop=int(P.gameEnv.drop*.3) if P.gameEnv.drop==0 then - P.curY=P.y_img + P.curY=P.imgY P.gameEnv._20G=true - if P.AI_mode=="CC"then CC_switch20G(P)end--little cheating,never mind + if P.AI_mode=="CC"then CC_switch20G(P)end end end end end + function pauseGame() if not SCN.swapping then restartCount=0--Avoid strange darkness if not game.result then game.pauseCount=game.pauseCount+1 end - for i=1,#players do - local l=players[i].keyPressing - for j=1,#l do - if l[j]then - players[i]:releaseKey(j) + if not game.replaying then + for i=1,#players do + local l=players[i].keyPressing + for j=1,#l do + if l[j]then + players[i]:releaseKey(j) + end end end end @@ -223,65 +280,38 @@ end function resumeGame() SCN.swapTo("play","none") end -function loadGame(M) - --rec={} +function loadGame(M,ifQuickPlay) stat.lastPlay=M curMode=Modes[M] local lang=setting.lang drawableText.modeName:set(text.modes[M][1]) drawableText.levelName:set(text.modes[M][2]) needResetGameData=true - SCN.swapTo("play","fade_togame") + SCN.swapTo("play",ifQuickPlay and"swipe"or"fade_togame") SFX.play("enter") end -function resetPartGameData() - game={ - frame=150-setting.reTime*15, - result=false, - pauseTime=0, - pauseCount=0, - garbageSpeed=1, - warnLVL0=0, - warnLVL=0, - } - destroyPlayers() - curMode.load() - TEXT.clear() - if modeEnv.task then - for i=1,#players do - players[i]:newTask(modeEnv.task) - end - end - if modeEnv.royaleMode then - for i=1,#players do - players[i]:changeAtk(randomTarget(players[i])) - end - end - BG.set(modeEnv.bg) - BGM.play(modeEnv.bgm) - if modeEnv.royaleMode then - for i=1,#players do - players[i]:changeAtk(randomTarget(players[i])) - end - game.stage=1 - game.garbageSpeed=.3 - end - restoreVirtualKey() - collectgarbage() -end function resetGameData() - game={ - frame=150-setting.reTime*15, - result=false, - pauseTime=0,--Time paused - pauseCount=0,--Pausing count - garbageSpeed=1,--garbage timing speed - warnLVL0=0, - warnLVL=0, - } + if players[1]and not game.replaying then + mergeStat(stat,players[1].stat) + end + + game.frame=150-setting.reTime*15 + game.result=false + game.pauseTime=0 + game.pauseCount=0 + game.garbageSpeed=1 + game.warnLVL0=0 + game.warnLVL=0 + game.recording=true + game.replaying=false + game.setting=copyGameSetting() + game.rec={} + math.randomseed(tm.getTime()) + game.seed=rnd(261046101471026) + destroyPlayers() modeEnv=curMode.env - curMode.load()--bg/bgm need redefine in custom,so up here + curMode.load()--BG/BGM need redefine in custom,so up here if modeEnv.task then for i=1,#players do players[i]:newTask(modeEnv.task) @@ -306,12 +336,59 @@ function resetGameData() SFX.play("ready") collectgarbage() end +function resetPartGameData(replaying) + if players[1]and not game.replaying then + mergeStat(stat,players[1].stat) + end + + game.result=false + game.garbageSpeed=1 + game.warnLVL0=0 + game.warnLVL=0 + if replaying then + game.frame=0 + game.recording=false + game.replaying=1 + else + game.frame=150-setting.reTime*15 + game.pauseTime=0 + game.pauseCount=0 + game.recording=true + game.replaying=false + game.setting=copyGameSetting() + game.rec={} + math.randomseed(tm.getTime()) + game.seed=rnd(1046101471,2662622626) + end + + destroyPlayers() + modeEnv=curMode.env + curMode.load() + if modeEnv.task then + for i=1,#players do + players[i]:newTask(modeEnv.task) + end + end + BG.set(modeEnv.bg) + BGM.play(modeEnv.bgm) + + TEXT.clear() + if modeEnv.royaleMode then + for i=1,#players do + players[i]:changeAtk(randomTarget(players[i])) + end + game.stage=1 + game.garbageSpeed=.3 + end + restoreVirtualKey() + collectgarbage() +end function gameStart() SFX.play("start") for P=1,#players do P=players[P] - P:popNext() - P.timing=true P.control=true + P.timing=true + P:popNext() end end \ No newline at end of file diff --git a/parts/getTip.lua b/parts/getTip.lua index 77853a73..66b7de21 100644 --- a/parts/getTip.lua +++ b/parts/getTip.lua @@ -4,6 +4,7 @@ if setting.lang==1 or setting.lang==2 then "ZS JL T O I", "VVVVVV好玩!", "uid:225238922", + "tetralegends也很好玩!", "tetr.js也很好玩!", "tetr.io也很好玩!", "Techminohaowan", @@ -13,9 +14,9 @@ if setting.lang==1 or setting.lang==2 then "osu好玩!", "O spin Triple!", "nullpomino也很好玩!", - "Naki 可爱", - "Miya:喵!", + "Naki 可爱!", "Miya 可爱!", + "Lua天下第一", "LrL RlR LLr RRl RRR LLL FFF RfR RRf rFF", "Let-The-Bass-Kick!", "l-=-1", @@ -27,7 +28,6 @@ if setting.lang==1 or setting.lang==2 then "DT炮=TSD+TST炮", "Cultris II也很好玩!", "COOL!!", - "CLASSIC SEXY RUSSIAN BLOCKS", "BT炮=beta炮", "B2B2B2B存在吗?", "B2B2B???", @@ -36,9 +36,9 @@ if setting.lang==1 or setting.lang==2 then "注意到\"旋转\"到底对方块做了些什么吗?", "有疑问? 先看设置有没有你想要的", "有建议的话可以把信息反馈给作者~", - "音乐都是瞎写的,觉得不好听就把BGM关了罢", "学会使用两个旋转键, 三个更好", - "享受特色旋转系统!", + "新人请千万记住,打好基础,不要太早学那些花里胡哨的", + "享受Tech的特色旋转系统!", "无聊翻翻设置是好习惯", "我的世界好玩!", "提前旋转等设置可以用来救命", @@ -48,16 +48,21 @@ if setting.lang==1 or setting.lang==2 then "少女祈祷中", "扫雷好玩!", "哦,我的上帝", + "你可以长按R键重新开始游戏(也不是很长)", "你可以从统计页面打开游戏存档目录", "你好 世界!", "魔方好玩!", + "喵!", "免费吃鸡方块", "秘密数字:626", "每个虚拟按键都可以隐藏/显示", "每个块的出现方向可以自定义", "没专业美术,程序员审美警告", + "没学过编曲,音乐都是自己凭感觉写的,觉得不好听就设置里关了吧", "联网还没做呢, 别急", "键位是可以自定义的", + "健康小贴士:上厕所太用力容易脑出血(尤其是老年人!)", + "健康小贴士:不要熬夜,真的容易猝死", "合群了就会消失, 但是消失不代表没有意义", "更小的DAS和ARR拥有更高的操作上限(如果你还能控制得了的话)", "俄罗斯方块环游记也不错!", @@ -65,8 +70,8 @@ if setting.lang==1 or setting.lang==2 then "低帧率会降低游戏体验", "戴上耳机以获得最佳体验", "大满贯10连击消四全清!", - "车车人在此", - "茶娘可爱", + "打好块没有捷径,多练", + "茶娘 可爱!", "草(日本语)", "不要在上课时玩游戏!", "不要盯着bug不放", @@ -75,6 +80,7 @@ if setting.lang==1 or setting.lang==2 then "别问游戏名怎么取的,问就是随便想的", "本游戏难度上限很高, 做好心理准备", "本游戏可不是休闲游戏", + "报时机器人:新的一天开始了", "626r/s", "40行世界纪录:15.654s", "4+4+4+4+2+2+1=17", @@ -86,10 +92,12 @@ if setting.lang==1 or setting.lang==2 then "2.7182818284590452353", "15puzzle好玩!", "11renPC!", + "100行内23PC来一个?", "1, 2, 9!!!!!", "<方块研究所>有一个Nspire-CX版本!", "↑↑↓↓←→←→BABA", "(RUR'U')R'FR2U'R'U'(RUR'F')", + -- "Z酱 可爱!", } elseif setting.lang==3 then L={ @@ -106,6 +114,7 @@ elseif setting.lang==3 then "This in not a casual game", "This game can be very hard,be mentally perpared", "Tetris journey has network battle!", + "Tetralegends is fun!", "Terraria is fun!", "Techmino=Technique+Tetromino", "Techmino is so fun!", @@ -117,7 +126,7 @@ elseif setting.lang==3 then "REGRET!!", "Powered by love2d", "Playing too much = taking drugs", - "osu is fun!", + "OSU is fun!", "Only offline game now", "OHHHHHHHHHHHHHH", "O spin triple!", @@ -127,13 +136,14 @@ elseif setting.lang==3 then "Miya so cute!", "Minesweeper is fun!", "Minecraft is fun!", + "Lua No.1", "LrL RlR LLr RRl RRR LLL FFF RfR RRf rFF", - "lower fps causes lower game experience", + "Lower fps causes lower game experience", "Let-The-Bass-Kick!", "l-=-1", "Is B2B2B2B possible?", "Initial Rotation etc. can save your life", - "iced so bully", + "Hold R key to restart game", "Hello world!", "Headphones for better experience", "Have you noticed what does \"rotating\" do to block?", @@ -146,10 +156,9 @@ elseif setting.lang==3 then "DO NOT PRESS F10", "Do not play game in class!", "Disappearing doesn't mean useless", - "diao so bully", + "Diao so bully", "COOL!!", - "CLASSIC SEXY RUSSIAN BLOCKS", - "BT cannon=beta", + "BT cannon=beta cannon", "Back to Back 10 combo Techrash PC!", "B2B2B???", "Any suggestions to author!", @@ -157,9 +166,9 @@ elseif setting.lang==3 then "Also try VVVVVV!", "Also try Tetr.js!", "Also try Tetr.io!", + "Also try Nullpomino!", "Also try Jstris!", "Also try Cultris II!", - "Also try Bullpomino!", "ALLSPIN!", "少女祈禱中", "40L WR: 15.654s", @@ -186,5 +195,79 @@ elseif setting.lang==4 then s=s..L[math.random(#L)] end return s +elseif setting.lang==5 then + local R=math.random() + if R<.05 then + local time={ + --[[00]]"大半夜的在这干啥呢?不睡觉是会猝死的", + --[[01]]"大半夜的在这干啥呢?不睡觉是会猝死的", + --[[02]]"现在打块你是认真的?", + --[[03]]"现在打块你是认真的?", + --[[04]]"早起是好的,但是你不应该打块", + --[[05]]"早起是好的,但是你不应该打块", + --[[06]]"早饭吃好了?", + --[[07]]"早饭吃好了?", + --[[08]]"九点多了,没自己的事情要做?", + --[[09]]"十点多了,没自己的事情要做?", + --[[10]]"十一点多了,午饭有的吃么", + --[[11]]"十二点多了,午饭有的吃么", + --[[12]]"累了累了,现在不想说你", + --[[13]]"累了累了,现在不想说你", + --[[14]]"累了累了,现在不想说你", + --[[15]]"累了累了,现在不想说你", + --[[16]]"累了累了,现在不想说你", + --[[17]]"晚饭吃好了?", + --[[18]]"晚饭吃好了?", + --[[19]]"累了累了,现在不想说你", + --[[20]]"累了累了,现在不想说你", + --[[21]]"好睡了,作息健康活得久", + --[[22]]"好睡了,作息健康活得久", + --[[23]]"大半夜的在这干啥呢?不睡觉是会猝死的", + } + return time[tonumber(os.date("%H"))+1] + elseif R<.1 then + local int=math.floor + L={ + "平均"..int(stat.row/stat.time*60).."LPM,那可真强呢", + "平均"..int(stat.atk/stat.time*60).."APM,好厉害哦", + "平均"..(int(stat.atk/stat.row*10)*.1).."效,你看这数据能看么", + "平均"..(int(stat.atk/stat.row*10)*.1).."效,我就不说你多菜了", + "才玩"..stat.game.."把,跟几十万局的没法比", + "才玩"..stat.game.."把,玩了不下几万局的人可不在少数", + "才玩了"..int(stat.time/3600).."小时,人家总时长是你不知道多少倍", + "才玩了"..int(stat.time/3600).."小时,别人总时长跟你都不在一个数量级", + } + else + L={ + "Diao?上次被我c4w秒了的那人?", + "隐形难吗?那个节目上的谁,水平那么菜也打得还行,就是你菜", + "一口一个wtcl还不赶紧去练,你是不思进取还是不想好好说话?", + "我一个滑铲就挖了个11renPC", + "我曾经在极度愤怒的时候15秒消了40行", + "天天F3F3,怕别人不知道你菜?", + "天天卖弱,你一定把把150apm吧?", + "天天催更催更,你咋不来帮忙开发啊,真以为作者很强催催啥都有?", + "设置都看过一遍了吗?明明都能调还嫌这嫌那,可牛逼了您", + "少玩点,多眨眼,到时候瞎了别怪我没提醒你", + "人只用一只手都能玩,你呢?", + "没那水平别天天整什么花里胡哨的,人玩几年你想几天赶上?", + "满口PCDT信天翁,还会点别的么?", + "叫你多练消四不听,现在要速度没速度,spin打完地形一塌糊涂,开心了?", + "叫你多练就多练,想着几天变神仙,当自己是谁?", + "还搁这玩手机呢,作业做完了?", + "除了雨宫太阳你还认识谁?Jonas知道吗?Ajanba听过吗?", + "不会吧不会吧,真的还有人不能随手Tspin?", + "别会个c4w就以为自己多强,这是基本功罢了", + "60lpm?拍硬降刷的吧", + "4pps不是人均水平?", + "40行还要40多秒,就这?", + "20G很难?是个人都能玩吧", + "20连pc不是随手?", + "100apm?定式刷的吧", + "0202年了,还在玩这种小孩子玩的游戏?", + "极限20G?那不是随手通", + "全隐40行全消四很难吗??", + } + end end return L[math.random(#L)] \ No newline at end of file diff --git a/parts/kickList.lua b/parts/kickList.lua index 75c8a4dd..cb8f545d 100644 --- a/parts/kickList.lua +++ b/parts/kickList.lua @@ -4,7 +4,7 @@ local ZERO={[01]=Zero,[10]=Zero,[03]=Zero,[30]=Zero,[12]=Zero,[21]=Zero,[32]=Zer local map={} for x=-3,3 do map[x]={}for y=-3,3 do map[x][y]={x,y}end end -local function collect(T)--make all vec point to the same vec +local function collect(T)--Make all vec point to the same vec if type(T)=="table"then for _,T in next,T do for k,vec in next,T do @@ -14,11 +14,11 @@ local function collect(T)--make all vec point to the same vec end end -local function C_sym(L)--use this if the block is centrosymmetry, *PTR!!! +local function C_sym(L)--Use this if the block is centrosymmetry, *PTR!!! L[23]=L[01]L[32]=L[10] L[21]=L[03]L[12]=L[30] end -local function flipList(O)--use this to copy a symmetry list +local function flipList(O)--Use this to copy a symmetry list if not O then return end local L={} for i=1,#O do @@ -84,14 +84,14 @@ local TRS={ },--Z {},--S { - [01]={{-1, 0},{-1, 1},{ 0,-2},{ 1, 1}}, - [10]={{ 1, 0},{ 1,-1},{ 0, 2},{ 1, 2}}, + [01]={{-1, 0},{-1, 1},{ 1, 0},{ 0,-2},{ 1, 1}}, + [10]={{ 1, 0},{ 1,-1},{-1, 0},{ 0, 2},{ 1, 2}}, [03]={{ 1, 0},{ 1, 1},{ 0,-2},{ 1,-2},{ 1,-1},{ 0, 1}}, [30]={{-1, 0},{-1,-1},{ 0, 2},{-1, 2},{ 0,-1},{-1, 1}}, [12]={{ 1, 0},{ 1,-1},{ 1, 1},{-1, 0},{ 0,-1},{ 0, 2},{ 1, 2}}, - [21]={{-1, 0},{-1, 1},{ 1, 0},{ 0,-2},{-1,-2}}, - [32]={{-1, 0},{-1,-1},{ 0, 2},{-1, 2},{-1, 1}}, - [23]={{ 1, 0},{ 1,-1},{ 1, 1},{ 0,-2},{ 1,-2}}, + [21]={{-1, 0},{-1, 1},{-1,-1},{ 1, 0},{ 0, 1},{ 0,-2},{-1,-2}}, + [32]={{-1, 0},{-1,-1},{ 1, 0},{ 0, 2},{-1, 2},{-1, 1}}, + [23]={{ 1, 0},{ 1,-1},{-1, 0},{ 1, 1},{ 0,-2},{ 1,-2}}, [02]={{-1, 0},{ 1, 0},{ 0,-1},{ 0, 1}}, [20]={{ 1, 0},{-1, 0},{ 0, 1},{ 0,-1}}, [13]={{ 0,-1},{ 0, 1},{ 1, 0}}, @@ -99,14 +99,14 @@ local TRS={ },--J {},--L { - [01]={{-1, 0},{-1, 1},{ 0,-2},{-1,-2},{-1,-1}}, - [10]={{ 1, 0},{ 1,-1},{ 0, 2},{ 1, 2},{ 0,-1},{ 1, 1}}, - [03]={{ 1, 0},{ 1, 1},{ 0,-2},{ 1,-2}}, + [01]={{-1, 0},{-1, 1},{ 0,-2},{-1,-2},{ 0, 1}}, + [10]={{ 1, 0},{ 1,-1},{ 0, 2},{ 1, 2},{ 0,-1}}, + [03]={{ 1, 0},{ 1, 1},{ 0,-2},{ 1,-2},{ 0, 1}}, [30]={{-1, 0},{-1,-1},{ 0, 2},{-1, 2},{ 0,-1}}, [12]={{ 1, 0},{ 1,-1},{ 0,-1},{-1,-1},{ 0, 2},{ 1, 2}}, - [21]={{-1, 0},{ 0,-2},{-1,-2},{ 1, 1}}, + [21]={{-1, 0},{ 0,-2},{-1,-2},{ 1, 1},{ 1, 0}}, [32]={{-1, 0},{-1,-1},{ 0,-1},{ 1,-1},{ 0, 2},{-1, 2}}, - [23]={{ 1, 0},{ 0,-2},{ 1,-2},{-1, 1}}, + [23]={{ 1, 0},{ 0,-2},{ 1,-2},{-1, 1},{-1, 0}}, [02]={{-1, 0},{ 1, 0},{ 0, 1}}, [20]={{ 1, 0},{-1, 0},{ 0,-1}}, [13]={{ 0,-1},{ 0, 1},{ 1, 0},{ 0,-2},{ 0, 2}}, @@ -114,10 +114,9 @@ local TRS={ },--T function(P,d) if P.human then SFX.fieldPlay("rotate",nil,P)end - if P.gameEnv.easyFresh then P:freshLockDelay()end if not P.gameEnv.ospin then return end local x,y=P.curX,P.curY - if y==P.y_img and((P:solid(x-1,y)or P:solid(x-1,y+1)))and(P:solid(x+2,y)or P:solid(x+2,y+1))then + if y==P.imgY and((P:solid(x-1,y)or P:solid(x-1,y+1)))and(P:solid(x+2,y)or P:solid(x+2,y+1))then local D=P.spinSeq%100*10+d P.spinSeq=D if D<100 then return end @@ -136,7 +135,7 @@ local TRS={ P.dir,P.sc=dir,scs[id][dir] P.spinLast=2 P.stat.rotate=P.stat.rotate+1 - P:freshgho() + P:freshBlock(false,true) P.spinSeq=0 SFX.fieldPlay("rotatekick",nil,P) return @@ -146,16 +145,17 @@ local TRS={ else P.spinSeq=0 end + P:freshBlock(true,true) end,--O { [01]={{ 0, 1},{ 1, 0},{-2, 0},{-2,-1},{ 1, 2}}, - [10]={{ 2, 0},{-1, 0},{-1,-2},{ 2, 1},{ 0, 2}}, + [10]={{ 2, 0},{-1, 0},{-1,-2},{ 2, 1},{ 0, 1}}, [03]={{ 0, 1},{-1, 0},{ 2, 0},{ 2,-1},{-1, 2}}, - [30]={{-2, 0},{ 1, 0},{ 1,-2},{-2, 1},{ 0, 2}}, - [12]={{-1, 0},{ 2, 0},{ 0,-1},{-1, 2},{ 2,-1}}, - [21]={{-2, 0},{ 1, 0},{ 0, 1},{ 1,-2},{-2, 1}}, - [32]={{ 1, 0},{-2, 0},{ 0,-1},{ 1, 2},{-2,-1}}, - [23]={{ 2, 0},{-1, 0},{ 0, 1},{-1,-2},{ 2, 1}}, + [30]={{-2, 0},{ 1, 0},{ 1,-2},{-2, 1},{ 0, 1}}, + [12]={{-1, 0},{ 2, 0},{ 2,-1},{ 0,-1},{-1, 2}}, + [21]={{-2, 0},{ 1, 0},{ 1,-2},{-2, 1},{ 0, 1}}, + [32]={{ 1, 0},{-2, 0},{-2,-1},{ 0,-1},{ 1, 2}}, + [23]={{ 2, 0},{-1, 0},{-1,-2},{ 2, 1},{ 0, 1}}, [02]={{-1, 0},{ 1, 0},{ 0,-1},{ 0, 1}}, [20]={{ 1, 0},{-1, 0},{ 0, 1},{ 0,-1}}, [13]={{ 0,-1},{-1, 0},{ 1, 0},{ 0, 1}}, @@ -186,23 +186,23 @@ local TRS={ { [01]={{-1, 0},{ 1, 0},{-1, 1},{ 0,-2},{ 0,-3}}, [10]={{ 1, 0},{ 1,-1},{-1, 0},{ 0, 2},{ 0, 3}}, - [03]={{ 1, 0},{ 1,-1}, { 0, 1},{ 0,-2},{ 0,-3}}, - [30]={{-1, 0},{-1, 1},{ 1, 0},{ 0,-1},{ 0, 2},{ 0, 3}}, + [03]={{ 1, 0},{ 1,-1},{ 0, 1},{ 0,-2},{ 0,-3}}, + [30]={{-1, 1},{ 1, 0},{ 0,-1},{ 0, 2},{ 0, 3}}, [12]={{ 1, 0},{ 0,-1},{-1, 0},{ 0, 2}}, [21]={{-1, 0},{ 0, 1},{ 1, 0},{ 0,-2}}, - [32]={{-1, 0},{-1, 1},{ 0, 1},{ 0,-1},{ 1, 0},{ 0, 2},{-2, 0}}, - [23]={{ 1, 0},{ 1,-1},{ 0,-1},{ 0, 1},{-1, 0},{ 0,-2},{ 2, 0}}, - [02]={{ 1, 0},{-1, 0},{ 0, 1}}, - [20]={{-1, 0},{ 1, 0},{ 0,-1}}, - [13]={{ 0,-1},{ 1, 0},{ 0, 1}}, - [31]={{ 0,-1},{-1, 0},{ 0, 1}}, + [32]={{-1, 0},{ 0, 1},{-1, 1},{ 1, 0},{ 0, 2},{-2, 0}}, + [23]={{ 1, 0},{ 1,-1},{ 0,-1},{-1, 0},{ 0,-2},{ 2, 0}}, + [02]={{ 1, 0},{-1, 0},{-1,-1}}, + [20]={{-1, 0},{ 1, 0},{ 1, 1}}, + [13]={{ 0,-1},{-1, 1},{ 0, 1}}, + [31]={{ 0,-1},{ 1,-1},{ 0, 1}}, },--F {},--E { - [01]={{ 0,-1},{-1,-1},{ 1,-1},{ 1, 0},{ 1,-3},{-1, 0},{ 0, 2},{-1, 2}}, - [10]={{ 1, 0},{ 0,-1},{-1,-1},{ 0,-2},{ 0,-3},{ 1,-2},{ 0, 1}}, + [01]={{ 0,-1},{-1,-1},{ 1, 1},{ 1, 0},{ 1,-3},{-1, 0},{ 0, 2},{-1, 2}}, + [10]={{ 1, 0},{ 0,-1},{-1,-1},{ 0,-2},{-1, 1},{ 0,-3},{ 1,-2},{ 0, 1}}, [03]={{ 0,-1},{ 1,-1},{-1,-1},{-1, 0},{-1,-3},{ 1, 0},{ 0, 2},{ 1, 2}}, - [30]={{-1, 0},{ 0,-1},{ 1,-1},{ 0,-2},{ 0,-3},{-1,-2},{ 0, 1}}, + [30]={{-1, 0},{ 0,-1},{ 1,-1},{ 0,-2},{ 1, 1},{ 0,-3},{-1,-2},{ 0, 1}}, [12]={{ 1, 0},{-1, 0},{ 0,-2},{ 0,-3},{ 0, 1},{-1, 1}}, [21]={{ 1,-1},{-1, 0},{ 1, 0},{ 0,-1},{ 0, 2},{ 0, 3}}, [32]={{-1, 0},{ 1, 0},{ 0,-2},{ 0,-3},{ 0, 1},{ 1, 1}}, @@ -213,10 +213,10 @@ local TRS={ [31]={{-1, 0},{ 1, 1},{ 2, 0}}, },--T5 { - [01]={{-1, 0},{-1, 1},{ 0,-2},{-1,-1},{-1,-2}}, - [10]={{ 1, 0},{ 1,-1}}, - [03]={{ 1, 0},{ 1, 1},{ 0,-2},{ 1,-1},{ 1,-2}}, - [30]={{-1, 0},{-1,-1}}, + [01]={{-1, 0},{-1, 1},{ 0,-2},{-1,-2},{-1,-3}}, + [10]={{ 1, 0},{ 1,-1},{ 0, 2},{ 1, 2},{ 1, 3}}, + [03]={{ 1, 0},{ 1, 1},{ 0,-2},{ 1,-2},{ 1,-3}}, + [30]={{-1, 0},{-1,-1},{ 0,-2},{-1, 2},{-1, 3}}, [12]={{ 1, 0},{ 1,-1},{ 1, 1}}, [21]={{-1,-1},{-1, 1},{-1,-1}}, [32]={{-1, 0},{-1,-1},{-1, 1}}, @@ -256,18 +256,18 @@ local TRS={ },--W function(P,d) if P.human then SFX.fieldPlay("rotate",nil,P)end - if P.gameEnv.easyFresh then P:freshLockDelay()end local iki=XspinList[d] for test=1,#iki do local x,y=P.curX+iki[test][1],P.curY+iki[test][2] if not P:ifoverlap(P.cur.bk,x,y)then P.curX,P.curY=x,y P.spinLast=1 - P:freshgho() + P:freshBlock(false,true) P.stat.rotate=P.stat.rotate+1 return end end + P:freshBlock(true,true) end,--X { [01]={{-1, 0},{-1, 1},{ 0,-3},{-1, 1},{-1, 2},{ 0, 1}}, diff --git a/parts/list.lua b/parts/list.lua index 61410710..9426b8a9 100644 --- a/parts/list.lua +++ b/parts/list.lua @@ -1,3 +1,4 @@ +local sin,cos=math.sin,math.cos snapLevelValue={1,10,20,40,60,80} title={ { @@ -114,6 +115,12 @@ title={ 5878, 463, }, } +for _,C in next,title do + for i=1,#C do + C[i]=C[i]*.1626 + end +end +--[[ title2={} for i=1,#title do title2[i]=title[i]end title2[5]={ @@ -140,12 +147,22 @@ title2[5]={ 3001, 1280, 2779, 1280, } - -for _,C in next,title do - for i=1,#C do - C[i]=C[i]*.1626 +]] +title_fan={} +for i=1,8 do + local L={} + title_fan[i]=L + for j=1,#title[i]do + L[j]=title[i][j] + end + for j=1,#L,2 do + local x,y=L[j],L[j+1]--0-------------------------- local gameEnv0={ noFly=false, das=10,arr=2, sddas=2,sdarr=2, ihs=true,irs=true,ims=true, - quickR=true,swap=true, + swap=true, + ghost=true,center=true, smooth=false,grid=false, bagLine=false, text=true, - lockFX=2,dropFX=3, - clearFX=2,shakeFX=3, + lockFX=2, + dropFX=2, + moveFX=2, + clearFX=2, + shakeFX=3, drop=60,lock=60, wait=0,fall=0, @@ -39,20 +45,18 @@ local gameEnv0={ bg="none",bgm="race" } -local WidComboAtk={0,0,1,1,2,2,2,3,3,3,4,4,3}--2 else -local DigComboAtk={0,0,1,1,2,2,3,3,4,4,4}--5 else local b2bPoint={50,100,180,300} local b2bATK={3,5,8,10} local clearSCR={80,200,400} local spinSCR={--[blockName][row] - {200,750,1600},--Z - {200,750,1600},--S - {220,700,1600},--L - {220,700,1600},--J - {250,800,1500},--T - {260,900,1800},--O + {200,750,1300},--Z + {200,750,1300},--S + {220,700,1300},--L + {220,700,1300},--J + {250,800,1400},--T + {260,900,1700},--O {300,1200,1700},--I - {220,800,2000,3000},--else + {220,800,2000,3000},--Else } --B2BMUL:1.2/2.0 --Techrash:1K;MUL:1.3/1.8 @@ -91,18 +95,18 @@ local freshPrepare={ local L repeat L={}for i=1,#bag do L[i]=i end - repeat P:getNext(bag[rem(L,rnd(#L))])until not L[1] + repeat P:getNext(bag[rem(L,P:RND(#L))])until not L[1] until #P.next>5 end, his4=function(P) local bag=P.gameEnv.bag local L=#bag - P.his={bag[rnd(L)],bag[rnd(L)],bag[rnd(L)],bag[rnd(L)]} + P.his={bag[P:RND(L)],bag[P:RND(L)],bag[P:RND(L)],bag[P:RND(L)]} for _=1,6 do local i local j=0 repeat - i=bag[rnd(L)] + i=bag[P:RND(L)] j=j+1 until i~=P.his[1]and i~=P.his[2]and i~=P.his[3]and i~=P.his[4]or j==6 P:getNext(i) @@ -112,12 +116,12 @@ local freshPrepare={ rnd=function(P) local bag=P.gameEnv.bag local L=#bag - P:getNext(bag[rnd(L)]) + P:getNext(bag[P:RND(L)]) for i=1,5 do local count=0 local i repeat - i=bag[rnd(L)] + i=bag[P:RND(L)] count=count+1 until i~=P.next[#P.next].id or count>=L P:getNext(i) @@ -144,7 +148,7 @@ local freshMethod={ if #P.next<6 then local bag0,bag=P.gameEnv.bag,{} for i=1,#bag0 do bag[i]=bag0[i]end - repeat P:getNext(rem(bag,rnd(#bag)))until not bag[1] + repeat P:getNext(rem(bag,P:RND(#bag)))until not bag[1] end end, his4=function(P) @@ -154,7 +158,7 @@ local freshMethod={ for n=1,4 do local j,i=0 repeat - i=bag[rnd(L)] + i=bag[P:RND(L)] j=j+1 until i~=P.his[1]and i~=P.his[2]and i~=P.his[3]and i~=P.his[4]or j==4 P:getNext(i) @@ -170,7 +174,7 @@ local freshMethod={ local count=0 local i repeat - i=bag[rnd(L)] + i=bag[P:RND(L)] count=count+1 until i~=P.next[#P.next].id or count>=L P:getNext(i) @@ -196,11 +200,31 @@ local ren_n={}for i=1,11 do ren_n[i]="ren_"..i end ---------------------------------------------------- ---------------------------------------------------- -local player={}--player object -local PLY={}--lib +local player={}--Player object +local PLY={}--Lib ---------------------------------------------------- ---------------------------------------------------- +local function updateLine(P,dt) + local bf=P.atkBuffer + for i=#bf,1,-1 do + local A=bf[i] + A.time=A.time+1 + if not A.sent then + if A.countdown>0 then + A.countdown=max(A.countdown-game.garbageSpeed,0) + end + else + if A.time>20 then + rem(bf,i) + end + end + end + bf=P.fieldBeneath + if bf>0 then + P.fieldBeneath=max(bf-P.gameEnv.pushSpeed,0) + end +end local function updateFXs(P,dt) if P.stat.score>P.score1 then if P.stat.score-P.score1<10 then @@ -210,55 +234,54 @@ local function updateFXs(P,dt) end end + --LockFX for i=#P.lockFX,1,-1 do local S=P.lockFX[i] S[3]=S[3]+S[4]*dt if S[3]>1 then rem(P.lockFX,i) end - end--lockFX + end + --DropFX for i=#P.dropFX,1,-1 do local S=P.dropFX[i] - S[6]=S[6]+S[7]*dt - if S[6]>1 then + S[5]=S[5]+S[6]*dt + if S[5]>1 then rem(P.dropFX,i) end - end--dropFX + end + --MoveFX + for i=#P.moveFX,1,-1 do + local S=P.moveFX[i] + S[4]=S[4]+S[5]*dt + if S[4]>1 then + rem(P.moveFX,i) + end + end + + --ClearFX for i=#P.clearFX,1,-1 do local S=P.clearFX[i] S[2]=S[2]+S[3]*dt if S[2]>1 then rem(P.clearFX,i) end - end--clearFX + end + --Field shaking if P.gameEnv.shakeFX then local O=P.fieldOff O.vx,O.vy=O.vx*.8-abs(O.x)^1.2*(O.x>0 and .1 or -.1),O.vy*.8-abs(O.y)^1.2*(O.y>0 and .1 or -.1) O.x,O.y=O.x+O.vx,O.y+O.vy if abs(O.x)<.3 then O.x=0 end if abs(O.y)<.3 then O.y=0 end - end--field shaking + end if P.bonus then TEXT.update(P.bonus) end - for i=#P.atkBuffer,1,-1 do - local A=P.atkBuffer[i] - A.time=A.time+1 - if not A.sent then - if A.countdown>0 then - A.countdown=max(A.countdown-game.garbageSpeed,0) - end - else - if A.time>20 then - rem(P.atkBuffer,i) - end - end - end - if P.fieldBeneath>0 then P.fieldBeneath=max(P.fieldBeneath-P.gameEnv.pushSpeed,0)end end local function updateTasks(P) local L=P.tasks @@ -295,12 +318,15 @@ local function Pupdate_alive(P,dt) P.AI_delay=P.AI_delay0*2 end end + + --Fresh visible time if not P.keepVisible then for j=1,#P.field do for i=1,10 do if P.visTime[j][i]>0 then P.visTime[j][i]=P.visTime[j][i]-1 end end end - end--Fresh visible time + end + --Moving pressed if P.movDir~=0 then local das,arr=P.gameEnv.das,P.gameEnv.arr local mov=P.moving @@ -362,6 +388,7 @@ local function Pupdate_alive(P,dt) P.moving=mov end + --Drop pressed if P.keyPressing[7]and not P.keyPressing[9]then local d=P.downing-P.gameEnv.sddas P.downing=P.downing+1 @@ -380,6 +407,8 @@ local function Pupdate_alive(P,dt) else P.downing=0 end + + --Falling animation if P.falling>=0 then P.falling=P.falling-1 if P.falling>=0 then @@ -390,33 +419,40 @@ local function Pupdate_alive(P,dt) P.clearingRow={} end end + + --Try spawn new block if not P.control then goto stop end - if P.waiting==0 then P:popNext()end if P.waiting>=0 then P.waiting=P.waiting-1 + if P.waiting<0 then P:popNext()end goto stop end + + --Natural block falling if P.cur then - if P.curY~=P.y_img then + if P.curY>P.imgY then local D=P.dropDelay if D>1 then P.dropDelay=D-1 goto stop end + if D==1 then P.curY=P.curY-1 else - local _=P.curY-P.y_img--max fall dist - D=1/D--fall dist + local _=P.curY-P.imgY--Max fall dist + D=1/D--Fall dist if D<_ then P.curY=P.curY-D - assert(P.curY==int(P.curY),"y:"..P.curY.." fall:"..D.." D_env:"..P.gameEnv.drop) + -- assert(P.curY==int(P.curY),"y:"..P.curY.." fall:"..D.." D_env:"..P.gameEnv.drop) else - P.curY=P.y_img + P.curY=P.imgY end end + P:freshBlock(true,true) P.spinLast=false - if P.y_img~=P.curY then + + if P.imgY~=P.curY then P.dropDelay=P.gameEnv.drop elseif P.AI_mode=="CC"then CC_updateField(P) @@ -424,9 +460,6 @@ local function Pupdate_alive(P,dt) CC_switch20G(P) end end - if P.freshTime<=P.gameEnv.freshLimit then - P.lockDelay=P.gameEnv.lock - end else P.lockDelay=P.lockDelay-1 if P.lockDelay>=0 then goto stop end @@ -443,6 +476,7 @@ local function Pupdate_alive(P,dt) else P.b2b1=max(P.b2b1*.95+P.b2b*.05-.6,P.b2b) end + updateLine(P,dt) updateFXs(P,dt) updateTasks(P) end @@ -468,6 +502,7 @@ local function Pupdate_dead(P,dt) end ::stop:: if P.b2b1>0 then P.b2b1=max(0,P.b2b1*.92-1)end + updateLine(P,dt) updateFXs(P,dt) updateTasks(P) end @@ -508,27 +543,34 @@ local function drawDial(x,y,speed) gc.draw(IMG.dialNeedle,x,y,2.094+(speed<=175 and .02094*speed or 4.712-52.36/(speed-125)),nil,nil,5,4) end local function drawFXs(P) + --LockFX for i=1,#P.lockFX do - _=P.lockFX[i] - if _[3]<.5 then - gc.setColor(1,1,1,2*_[3]) - gc.rectangle("fill",_[1],_[2],60*_[3],30) + local S=P.lockFX[i] + if S[3]<.5 then + gc.setColor(1,1,1,2*S[3]) + gc.rectangle("fill",S[1],S[2],60*S[3],30) else - gc.setColor(1,1,1,2-2*_[3]) - gc.rectangle("fill",_[1]+30,_[2],60*_[3]-60,30) + gc.setColor(1,1,1,2-2*S[3]) + gc.rectangle("fill",S[1]+30,S[2],60*S[3]-60,30) end - end--lockFX + end + --DropFX for i=1,#P.dropFX do - _=P.dropFX[i] - gc.setColor(1,1,1,.6-_[6]*.6) - for x=_[2],_[4]do - for y=_[5],_[3]do - drawPixel(y,x,_[1]) - end - end - end--dropFX + local S=P.dropFX[i] + gc.setColor(1,1,1,.6-S[5]*.6) + local w=30*S[3]*(1-S[5]*.5) + gc.rectangle("fill",30*S[1]-30+15*S[3]-w*.5,600-30*S[2],w,30*S[4]) + end + + --MoveFX + for i=1,#P.moveFX do + local S=P.moveFX[i] + gc.setColor(1,1,1,.6-S[4]*.6) + drawPixel(S[3],S[2],S[1]) + end + --ClearFX for i=1,#P.clearFX do local S=P.clearFX[i] local t=S[2] @@ -536,7 +578,7 @@ local function drawFXs(P) local y=t<.2 and 5*t or 1-1.25*(t-.2) gc.setColor(1,1,1,y) gc.rectangle("fill",150-x*150,615-S[1]*30-y*15,300*x,y*30) - end--clearFX + end end local function Pdraw_norm(P) local _ @@ -564,7 +606,7 @@ local function Pdraw_norm(P) gc.setLineWidth(2) gc.translate(0,P.fieldBeneath) gc.setScissor(scr.x+(P.absFieldX+P.fieldOff.x)*scr.k,scr.y+(P.absFieldY+P.fieldOff.y)*scr.k,300*P.size*scr.k,610*P.size*scr.k) - if P.falling==-1 then--field block only + if P.falling==-1 then--Field block only for j=int(P.fieldBeneath/30+1),#P.field do for i=1,10 do if P.field[j][i]>0 then @@ -605,12 +647,12 @@ local function Pdraw_norm(P) gc.setColor(1,1,1,.3) for i=1,P.r do for j=1,P.c do if P.cur.bk[i][j]then - drawPixel(i+P.y_img-1,j+P.curX-1,curColor) + drawPixel(i+P.imgY-1,j+P.curX-1,curColor) end end end end - local dy=P.gameEnv.smooth and P.y_img~=P.curY and (min(P.dropDelay,1e99)/P.gameEnv.drop-1)*30 or 0 + local dy=P.gameEnv.smooth and P.imgY~=P.curY and (min(P.dropDelay,1e99)/P.gameEnv.drop-1)*30 or 0 gc.translate(0,-dy) local trans=P.lockDelay/P.gameEnv.lock if P.gameEnv.block then @@ -640,12 +682,12 @@ local function Pdraw_norm(P) --Rotate center if P.gameEnv.center then gc.setColor(1,1,1,trans) - local x=30*(P.curX+P.sc[2]-1)-15 - gc.draw(IMG.spinCenter,x,600-30*(P.curY+P.sc[1]-1)+15,nil,nil,nil,4,4) + 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 gc.translate(0,dy) gc.setColor(1,1,1,.5) - gc.draw(IMG.spinCenter,x,600-30*(P.y_img+P.sc[1]-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 end end @@ -654,10 +696,26 @@ local function Pdraw_norm(P) ::E:: gc.setScissor() gc.translate(0,-P.fieldBeneath) - gc.setColor(1,1,1) + gc.setColor(P.frameColor) gc.rectangle("line",-1,-11,302,612)--Boarder gc.rectangle("line",301,0,15,601)--AtkBuffer boarder gc.rectangle("line",-16,-3,15,604)--B2b bar boarder + + + --LockDelay indicator + if P.gameEnv.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 + end + _=3 + for i=1,min(P.gameEnv.freshLimit-P.freshTime,15)do + gc.rectangle("fill",_,615,14,5) + _=_+20 + end --Buffer line local h=0 @@ -666,22 +724,22 @@ local function Pdraw_norm(P) local bar=A.amount*30 if h+bar>600 then bar=600-h end if not A.sent then + --Appear if A.time<20 then bar=bar*(20*A.time)^.5*.05 - --Appear end if A.countdown>0 then + --Timing gc.setColor(attackColor[A.lv][1]) gc.rectangle("fill",303,599-h,11,-bar+3) gc.setColor(attackColor[A.lv][2]) gc.rectangle("fill",303,599-h+(-bar+3),11,-(-bar+3)*(1-A.countdown/A.cd0)) - --Timing else + --Warning local t=math.sin((Timer()-i)*30)*.5+.5 local c1,c2=attackColor[A.lv][1],attackColor[A.lv][2] gc.setColor(c1[1]*t+c2[1]*(1-t),c1[2]*t+c2[2]*(1-t),c1[3]*t+c2[3]*(1-t)) gc.rectangle("fill",303,599-h,11,-bar+3) - --Warning end else gc.setColor(attackColor[A.lv][1]) @@ -741,7 +799,7 @@ local function Pdraw_norm(P) --Draw Bagline(s) if P.gameEnv.bagLine then local L=P.gameEnv.bagLen - local C=-P.pieceCount%L--phase + local C=-P.pieceCount%L--Phase gc.setColor(.8,.5,.5) for i=C,N-1,L do local y=72*i+36 @@ -749,6 +807,7 @@ local function Pdraw_norm(P) end end + --Draw starting counter gc.setColor(1,1,1) if game.frame<180 then local count=179-game.frame @@ -758,7 +817,7 @@ local function Pdraw_norm(P) if count%60>45 then gc.scale(1+(count%60-45)^2*.01,1)end mStr(int(count/60+1),0,0) gc.pop() - end--Draw starting counter + end --Bonus texts TEXT.draw(P.bonus) @@ -773,6 +832,12 @@ local function Pdraw_norm(P) mStr(format("%.2f",P.stat.time),-81,518)--Time mStr(P.score1,-81,560)--Score + --Display Ys + -- gc.setLineWidth(6) + -- if P.curY then gc.setColor(1,.4,0,.626)gc.line(0,611-P.curY*30,300,611-P.curY*30)end + -- if P.imgY then gc.setColor(0,1,.4,.626)gc.line(0,615-P.imgY*30,300,615-P.imgY*30)end + -- if P.minY then gc.setColor(0,.4,1,.626)gc.line(0,619-P.minY*30,300,619-P.minY*30)end + --Other messages gc.setColor(1,1,1) curMode.mesDisp(P) @@ -792,7 +857,7 @@ local function Pdraw_norm(P) gc.pop() end local function Pdraw_small(P) - --draw content + --Draw content P.frameWait=P.frameWait-1 if P.frameWait==0 then P.frameWait=10 @@ -813,7 +878,8 @@ local function Pdraw_small(P) --Draw boarder if P.alive then gc.setLineWidth(2) - gc.setColor(frameColor[P.strength])gc.rectangle("line",1,1,58,118) + gc.setColor(P.frameColor) + gc.rectangle("line",1,1,58,118) end if modeEnv.royaleMode then gc.setColor(1,1,1) @@ -830,7 +896,7 @@ local function Pdraw_small(P) gc.setCanvas() end - --draw Canvas + --Draw Canvas gc.setColor(1,1,1) gc.draw(P.canvas,P.x,P.y,nil,P.size*10) if P.killMark then @@ -843,15 +909,21 @@ end local function Pdraw_demo(P) local _ local curColor=P.cur.color + + --Camera gc.push("transform") gc.translate(P.x,P.y)gc.scale(P.size)gc.translate(P.fieldOff.x,P.fieldOff.y) - --Camera - gc.setColor(.1,.1,.1,.8)gc.rectangle("fill",0,0,300,600) - gc.setLineWidth(2)gc.setColor(1,1,1)gc.rectangle("line",-1,-1,302,602) --Frame + gc.setColor(.1,.1,.1,.8) + gc.rectangle("fill",0,0,300,600) + + gc.setLineWidth(2) + gc.setColor(1,1,1) + gc.rectangle("line",-1,-1,302,602) if P.falling==-1 then + --Field block only for j=int(P.fieldBeneath/30+1),#P.field do for i=1,10 do if P.field[j][i]>0 then @@ -860,7 +932,8 @@ local function Pdraw_demo(P) end end end - else--field block only + 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 h,H=1,#P.field @@ -880,7 +953,7 @@ local function Pdraw_demo(P) end end gc.translate(0,dy) - end--Field with falling animation + end drawFXs(P) @@ -889,7 +962,7 @@ local function Pdraw_demo(P) gc.setColor(1,1,1,.3) for i=1,P.r do for j=1,P.c do if P.cur.bk[i][j]then - drawPixel(i+P.y_img-1,j+P.curX-1,curColor) + drawPixel(i+P.imgY-1,j+P.curX-1,curColor) end end end @@ -933,11 +1006,11 @@ end ---------------------------------------------------- function player.showText(P,text,dx,dy,font,style,spd,stop) if P.gameEnv.text then - P.bonus[#P.bonus+1]=TEXT.getText(text,150+dx,300+dy,font*P.size,style,spd,stop) + ins(P.bonus,TEXT.getText(text,150+dx,300+dy,font*P.size,style,spd,stop)) end end function player.showTextF(P,text,dx,dy,font,style,spd,stop) - P.bonus[#P.bonus+1]=TEXT.getText(text,150+dx,300+dy,font*P.size,style,spd,stop) + ins(P.bonus,TEXT.getText(text,150+dx,300+dy,font*P.size,style,spd,stop)) end local function without(L,e) for i=1,#L do @@ -947,7 +1020,7 @@ local function without(L,e) end function player.createLockFX(P) local BK=P.cur.bk - local t=12-P.gameEnv.lockFX*3 + local t=12-P.gameEnv.lockFX*2 for i=1,P.r do local y=P.curY+i-1 @@ -961,15 +1034,25 @@ function player.createLockFX(P) end end end -function player.createDropFX(P,x1,y1,x2,y2)--x1y2! - if P.gameEnv.block and y1>=y2 then - P.dropFX[#P.dropFX+1]={P.cur.color,x1,y1,x2,y2,0,12-2*P.gameEnv.dropFX} +function player.creatDropFX(P,x,y,w,h)--TODO, remake dropFX + ins(P.dropFX,{x,y,w,h,0,13-2*P.gameEnv.dropFX}) +end +function player.createMoveFX(P) + local T=12-2*P.gameEnv.moveFX + local C=P.cur.color + local x,y=P.curX-1,P.curY-1 + 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 -function player.createBeam(P,R,send,time,target,color,clear,spin,mini,combo) +function player.createBeam(P,R,send,time,target,color,clear,spin,combo) local x1,y1,x2,y2 if P.small then x1,y1=P.centerX,P.centerY - else x1,y1=P.x+(30*(P.curX+P.sc[2]-1)-30+15+150)*P.size,P.y+(600-30*(P.curY+P.sc[1]-1)+15+70)*P.size + else x1,y1=P.x+(30*(P.curX+P.sc[2])-30+15+150)*P.size,P.y+(600-30*(P.curY+P.sc[1])+15+70)*P.size end if R.small then x2,y2=R.centerX,R.centerY else x2,y2=R.x+308*R.size,R.y+450*R.size @@ -1017,28 +1100,33 @@ function player.createBeam(P,R,send,time,target,color,clear,spin,mini,combo) radius=radius*.4 a=.35 end - FX_attack[#FX_attack+1]={ - x=x1,y=y1,--current pos - x1=x1,y1=y1,--start pos - x2=x2,y2=y2,--end pos + ins(FX_attack,{ + x=x1,y=y1,--Current pos + x1=x1,y1=y1,--Start pos + x2=x2,y2=y2,--End pos rad=radius*(setting.atkFX+3)*.12, corner=corner, type=type==1 and"fill"or"line", r=r,g=g,b=b,a=a*(setting.atkFX+5)*.1, t=0, drag={},--Afterimage coordinate list - } + }) end function player.newTask(P,code,data) local L=P.tasks - L[#L+1]={ + ins(L,{ code=code, data=data, - } + }) end ---------------------------------------------------- ---------------------------------------------------- +function player.RND(P,a,b) + local R=P.randGen + return R:random(a,b) +end + local function getNewStatTable() local T={ time=0,score=0, @@ -1079,35 +1167,35 @@ function player.ckfull(P,i) for j=1,10 do if P.field[i][j]<=0 then return end end return true end -function player.fineError(P,rate) +function player.finesseError(P,rate) P.stat.extraPiece=P.stat.extraPiece+1 P.stat.extraRate=P.stat.extraRate+rate if P.human then if P.gameEnv.fineKill then - SFX.play("finesseError_long") + SFX.play("finesseError_long",.6) P:lose() elseif setting.fine then - SFX.play("finesseError") + SFX.play("finesseError",.8) end elseif P.gameEnv.fineKill then P:lose() end end -function player.garbageSend(P,R,send,time,...) +function player.attack(P,R,send,time,...) if setting.atkFX>0 then P:createBeam(R,send,time,...) end R.lastRecv=P if R.atkBuffer.sum<20 then local B=R.atkBuffer - if B.sum+send>20 then send=20-B.sum end--no more then 20 + if send>20-B.sum then send=20-B.sum end--No more then 20 local m,k=#B,1 while k<=m and time>B[k].countdown do k=k+1 end for i=m,k,-1 do B[i+1]=B[i] end B[k]={ - pos=rnd(10), + pos=P:RND(10), amount=send, countdown=time, cd0=time, @@ -1148,9 +1236,11 @@ function player.garbageRise(P,color,amount,pos) P.field[1][pos]=0 end P.fieldBeneath=P.fieldBeneath+amount*30 - P.curY=P.curY+amount + if P.cur then + P.curY=P.curY+amount + P.imgY=P.imgY+amount + end P.garbageBeneath=P.garbageBeneath+amount - P.y_img=P.y_img+amount for i=1,#P.clearingRow do P.clearingRow[i]=P.clearingRow[i]+amount end @@ -1162,7 +1252,7 @@ function player.garbageRise(P,color,amount,pos) _=P.dropFX[i] _[3],_[5]=_[3]+amount,_[5]+amount end - if #P.field>40 then P:lose()end + if #P.field>42 then P:lose()end end local invList={2,1,4,3,5,6,7} @@ -1184,8 +1274,8 @@ function player.pushLine(P,L,mir) end P.fieldBeneath=P.fieldBeneath+120 P.curY=P.curY+#L - P.y_img=P.y_img+#L - P:freshgho() + P.imgY=P.imgY+#L + P:freshBlock(false,false) end function player.pushNext(P,L,mir) for i=1,#L do @@ -1235,40 +1325,68 @@ function player.changeAtk(P,R) end if R then P.atking=R - R.atker[#R.atker+1]=P + ins(R.atker,P) else P.atking=nil end end -function player.freshgho(P) - if not P.cur then return end - P.y_img=min(#P.field+1,P.curY) - if P.gameEnv._20G or P.keyPressing[7]and P.gameEnv.sdarr==0 then - while not P:ifoverlap(P.cur.bk,P.curX,P.y_img-1)do - P.y_img=P.y_img-1 - P.spinLast=false - end - if P.curY>P.y_img then - if P.gameEnv.dropFX then - P:createDropFX(P.curX,P.curY+1,P.curX+P.c-1,P.y_img+P.r-1) +function player.freshBlock(P,keepGhost,control,system) + 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 + local _=P.imgY + + --Move ghost to bottom + while not P:ifoverlap(P.cur.bk,P.curX,P.imgY-1)do + P.imgY=P.imgY-1 end - if P.gameEnv.shakeFX then - P.fieldOff.vy=P.gameEnv.shakeFX*.5 + + --Cancel spinLast + if _~=P.imgY then + P.spinLast=false + end + + --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 + 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 + end + P.curY=P.imgY + end + else + while not P:ifoverlap(P.cur.bk,P.curX,P.imgY-1)do + P.imgY=P.imgY-1 end - P.curY=P.y_img - end - else - while not P:ifoverlap(P.cur.bk,P.curX,P.y_img-1)do - P.y_img=P.y_img-1 end end -end -function player.freshLockDelay(P) - if P.lockDelayP.curY then P:freshLockDelay()end + if not ifpre then + P:freshBlock(false,true) + end + if iki[test][2]>0 and not P.gameEnv.easyFresh then + P.freshTime=P.freshTime+1 + end + if P.human then SFX.fieldPlay(ifpre and"prerotate"or P:ifoverlap(P.cur.bk,P.curX,P.curY+1)and P:ifoverlap(P.cur.bk,P.curX-1,P.curY)and P:ifoverlap(P.cur.bk,P.curX+1,P.curY)and"rotatekick"or"rotate",nil,P) end @@ -1346,21 +1470,43 @@ function player.resetBlock(P) local id=C.id local face=P.gameEnv.face[id] local sc=scs[id][face] - P.sc=sc --spin center - P.dir=face --block direction - P.r,P.c=#C.bk,#C.bk[1] --row/column + P.sc=sc --Spin center + P.dir=face --Block direction + P.r,P.c=#C.bk,#C.bk[1] --Row/column P.curX=int(6-P.c*.5) local y=21+ceil(P.fieldBeneath/30) P.curY=y - if P.gameEnv.ims and(P.keyPressing[1]and P.movDir==-1 or P.keyPressing[2]and P.movDir==1)and P.moving>=P.gameEnv.das then + P.minY=y+sc[2] + + local _=P.keyPressing + --IMS + if P.gameEnv.ims and(_[1]and P.movDir==-1 or _[2]and P.movDir==1)and P.moving>=P.gameEnv.das then local x=P.curX+P.movDir if not P:ifoverlap(C.bk,x,y)then P.curX=x end - end--IMS + end + --IRS + if P.gameEnv.irs then + if _[5]then + P:spin(2,true) + else + if _[3]then + if _[4]then + P:spin(2,true) + else + P:spin(1,true) + end + elseif _[4]then + P:spin(3,true) + end + end + end + + --Spawn SFX if P.human and id<8 then - SFX.play("spawn_"..id,setting.spawn,nil,true) + SFX.fplay("spawn_"..id,setting.spawn) end end function player.hold(P,ifpre) @@ -1370,7 +1516,7 @@ function player.hold(P,ifpre) --Finesse check if H and C and H.id==C.id and H.name==C.name or P.ctrlCount>1 then - P:fineError(1) + P:finesseError(1) end P.holded=P.gameEnv.oncehold @@ -1403,8 +1549,10 @@ function player.hold(P,ifpre) end if C then P:resetBlock() - P:freshgho() - P.dropDelay,P.lockDelay,P.freshTime=P.gameEnv.drop,P.gameEnv.lock,max(P.freshTime-5,0) + P:freshBlock(false,true) + P.dropDelay=P.gameEnv.drop + P.lockDelay=P.gameEnv.lock + P.freshTime=max(P.freshTime-5,0) if P:ifoverlap(P.cur.bk,P.curX,P.curY)then P:lock()P:lose()end end @@ -1417,9 +1565,9 @@ end function player.getNext(P,n) local E=P.gameEnv - P.next[#P.next+1]={bk=blocks[n][E.face[n]],id=n,color=E.bone and 12 or E.skin[n],name=n} + ins(P.next,{bk=blocks[n][E.face[n]],id=n,color=E.bone and 12 or E.skin[n],name=n}) end -function player.popNext(P)--pop next queue to hand +function player.popNext(P)--Pop next queue to hand P.holded=false P.spinLast=false P.spinSeq=0 @@ -1435,58 +1583,84 @@ function player.popNext(P)--pop next queue to hand BOT.addNext(P.AI_bot,CCblockID[next.id]) end end + local _=P.keyPressing + --IHS if _[8]and P.gameEnv.hold and P.gameEnv.ihs then P:hold(true) _[8]=false else P:resetBlock() - end--IHS - - P.dropDelay,P.lockDelay,P.freshTime=P.gameEnv.drop,P.gameEnv.lock,0 - if P.gameEnv.irs then - if _[5]then - P:spin(2,true) - else - if _[3]then - if _[4]then - P:spin(2,true) - else - P:spin(1,true) - end - elseif _[4]then - P:spin(3,true) - end - end - end--IRS - - if P.cur then - if P:ifoverlap(P.cur.bk,P.curX,P.curY)then P:lock()P:lose()end - P:freshgho() end - if _[6]then P.act.hardDrop(P)_[6]=false end--IHdS + P.dropDelay=P.gameEnv.drop + P.lockDelay=P.gameEnv.lock + P.freshTime=0 + + if P.cur then + if P:ifoverlap(P.cur.bk,P.curX,P.curY)then + P:lock() + P:lose() + end + P:freshBlock(false,true,true) + end + + --IHdS + if _[6]then + P.act.hardDrop(P) + _[6]=false + end end end + +function player.cancel(P,N)--Cancel Garbage + local k=0 --Pointer, attack bar selected + local off=0 --Lines offseted + local bf=P.atkBuffer + ::R:: + if bf.sum>0 then + local A + repeat + k=k+1 + A=bf[k] + if not A then return off end + until not A.sent + if N>=A.amount then + local O=A.amount--Cur Offset + N=N-O + off=off+O + bf.sum=bf.sum-O + A.sent,A.time=true,0 + if N>0 then goto R end + else + off=off+N + A.amount=A.amount-N + bf.sum=bf.sum-N + end + end + return off +end function player.drop(P)--Place piece local _ local CHN=VOC.getFreeChannel() - P.dropTime[11]=ins(P.dropTime,1,game.frame)--update speed dial + P.dropTime[11]=ins(P.dropTime,1,game.frame)--Update speed dial local cmb=P.combo P.waiting=P.gameEnv.wait local STAT=P.stat - local clear--if (perfect)clear - local cc,gbcc=0,0--row/garbage-row cleared,full-part - local atk,exblock=0,0--attack & extra defense - local send,off=0,0--sending lines remain & offset - local cscore,sendTime=0,0--score & send Time + local clear--If (perfect)clear + local cc,gbcc=0,0--Row/garbage-row cleared,full-part + local atk,exblock=0,0--Attack & extra defense + local send,off=0,0--Sending lines remain & offset + local cscore,sendTime=0,0--Score & send Time local dospin=0 local mini - --spin check + --Spin check if P.spinLast then + + --Tri-corner if P.cur.id<6 then - local x,y=P.curX+P.sc[2]-1,P.curY+P.sc[1]-1 + local x,y=P.curX+P.sc[2],P.curY+P.sc[1] local c=0 if P:solid(x-1,y+1)then c=c+1 end if P:solid(x+1,y+1)then c=c+1 end @@ -1494,18 +1668,22 @@ function player.drop(P)--Place piece if P:solid(x-1,y-1)then c=c+1 end if P:solid(x+1,y-1)then c=c+1 end if c>2 then dospin=dospin+1 end - end--tri-corner + end ::NTC:: + + --Immovable if P:ifoverlap(P.cur.bk,P.curX-1,P.curY)and P:ifoverlap(P.cur.bk,P.curX+1,P.curY)and P:ifoverlap(P.cur.bk,P.curX,P.curY+1)then dospin=dospin+2 - end--immovable + end end - --lock block to field + --Lock block to field P:lock() - --clear list of cleared-rows + + --Clear list of cleared-rows if P.clearedRow[1]then P.clearedRow={}end - --check rows to be cleared + + --Check rows to be cleared for i=0,P.r-1 do local h=P.curY+i if P:ckfull(h)then @@ -1515,25 +1693,30 @@ function player.drop(P)--Place piece end end - --create clearing FX + --Create clearing FX if cc>0 and P.gameEnv.clearFX then local l=P.clearedRow - local t=6-P.gameEnv.clearFX*1.5 + local t=7-P.gameEnv.clearFX*1 for i=1,cc do ins(P.clearFX,{l[i],0,t}) end end - --create locking FX + --Create locking FX if P.gameEnv.lockFX then if cc==0 then P:createLockFX() - elseif P.lockFX[1]then - P.lockFX={} + else + _=#P.lockFX + if _>0 then + for i=1,_ do + rem(P.lockFX) + end + end end end - --final spin check + --Final spin check if P.spinLast then if cc>0 then if dospin>0 then @@ -1553,7 +1736,7 @@ function player.drop(P)--Place piece dospin=false end - --finesse: roof check + --Finesse: roof check local finesse if P.cur.id>7 then finesse=true @@ -1571,10 +1754,11 @@ function player.drop(P)--Place piece if y then x=P.curX+x-1 for y=y0+y,#P.field do + --Roof=finesse if P:solid(x,y)then finesse=true goto L2 - end--roof=finesse + end end end end @@ -1583,7 +1767,7 @@ function player.drop(P)--Place piece end ::L2:: - --remove rows need to be cleared + --Remove rows need to be cleared if cc>0 then for i=cc,1,-1 do _=P.clearedRow[i] @@ -1596,7 +1780,7 @@ function player.drop(P)--Place piece end end - --cancel no-sense clearing FX + --Cancel no-sense clearing FX _=#P.clearingRow while _>0 and P.clearingRow[_]>#P.field do P.clearingRow[_]=nil @@ -1608,13 +1792,16 @@ function player.drop(P)--Place piece clear=true end - if not finesse then--finesse: control - if dospin then P.ctrlCount=P.ctrlCount-2 end--allow 2 more step for roof-less spin + --Finesse check (control) + if not finesse then + if dospin then P.ctrlCount=P.ctrlCount-2 end--Allow 2 more step for roof-less spin local id=P.cur.id local d=P.ctrlCount-finesseList[id][P.dir+1][P.curX] - if d>=2 then P:fineError(2) - elseif d>0 then P:fineError(d) - end--not finesse + if d>=2 then + P:finesseError(2) + elseif d>0 then + P:finesseError(d) + end end if cc>0 then @@ -1645,10 +1832,10 @@ function player.drop(P)--Place piece sendTime=20+atk*20 if mini then P:showText(text.mini,0,-80,35,"appear") - atk=atk*.5 + atk=atk*.25 sendTime=sendTime+60 cscore=cscore*.6 - P.b2b=P.b2b+b2bPoint[cc]*.4 + P.b2b=P.b2b+b2bPoint[cc]*.5 if P.human then VOC.play("mini",CHN) end @@ -1688,23 +1875,15 @@ function player.drop(P)--Place piece end P.b2b=P.b2b+cc*80-220 P.lastClear=P.cur.name*10+cc - else - if not clear then - P.b2b=max(P.b2b-250,0) - P:showText(text.clear[cc],0,-30,27+cc*3,"appear",(8-cc)*.3) - atk=cc-.75 - sendTime=20+atk*20 - cscore=cscore+clearSCR[cc] - end - P.lastClear=cc end if P.human then VOC.play(clearName[cc],CHN) end + if clear then if #P.field==0 then P:showText(text.PC,0,-80,50,"flicker") - atk=atk^.5+min(6+STAT.pc,12) + atk=atk*.5+min(6+STAT.pc,12) exblock=exblock+2 sendTime=sendTime+120 if STAT.row+cc>4 then @@ -1725,91 +1904,86 @@ function player.drop(P)--Place piece sendTime=sendTime+60 cscore=cscore+626 STAT.hpc=STAT.hpc+1 - P.lastClear=cc if P.human then SFX.play("clear") end + else + goto checkB2Breduce end P.lastClear=P.cur.name*10+5 + goto skipB2Breduce end + + ::checkB2Breduce:: + if not(dospin or cc>3)then + P.b2b=max(P.b2b-250,0) + P:showText(text.clear[cc],0,-30,27+cc*3,"appear",(8-cc)*.3) + atk=cc-.5 + sendTime=20+atk*20 + cscore=cscore+clearSCR[cc] + P.lastClear=cc + end + ::skipB2Breduce:: + sendTime=sendTime+25*cmb if cmb>1 then - atk=atk+(gbcc>0 and(DigComboAtk[cmb]or 5)or(WidComboAtk[cmb]or 2)) + atk=atk*(.8+.2*min(cmb,11)) + if cmb>=3 then + atk=atk+1 + end P:showText(text.cmb[min(cmb,21)],0,25,15+min(cmb,25)*3,cmb<10 and"appear"or"flicker") - cscore=cscore+min(20*cmb,300)*cc + cscore=cscore+min(50*cmb,500)*(2*cc-1) end if P.b2b>1200 then P.b2b=1200 end + --Bonus atk/def when focused if modeEnv.royaleMode then local i=min(#P.atker,9) if i>1 then atk=atk+reAtk[i] exblock=exblock+reDef[i] end - end--Bonus atk/def when focused + end send=atk if send>0 then - if exblock then exblock=int(exblock*(1+P.strength*.25))end - send=int(send*(1+P.strength*.25)) - --Badge Buff + if exblock>0 then + exblock=int(exblock*(1+P.strength*.25))--Badge Buff + P:showText(exblock,0,120,20,"zoomout") + off=off+P:cancel(exblock) + end + send=int(send*(1+P.strength*.25))--Badge Buff if send>0 then P:showText(send,0,80,35,"zoomout") - if exblock>0 then - P:showText(exblock,0,120,20,"zoomout") - end - end - send=send+exblock - local k=0 - ::R:: - if send>0 and P.atkBuffer.sum>0 then - local A - repeat - k=k+1 - A=P.atkBuffer[k] - if not A then goto E end - until not A.sent - if send>=A.amount then - local O=A.amount--cur Offset - send=send-O - P.atkBuffer.sum=P.atkBuffer.sum-O - off=off+O - A.sent,A.time=true,0 - if send>0 then goto R end - else - A.amount=A.amount-send - off=off+send - P.atkBuffer.sum=P.atkBuffer.sum-send - send=0 - end - end - ::E:: - send=send-exblock - if send>0 then - local T - if modeEnv.royaleMode then - if P.atkMode==4 then - local M=#P.atker - if M>0 then - for i=1,M do - P:garbageSend(P.atker[i],send,sendTime,M,P.cur.color,P.lastClear,dospin,mini,cmb) + _=P:cancel(send) + send=send-_ + off=off+_ + if send>0 then + local T + if modeEnv.royaleMode then + if P.atkMode==4 then + local M=#P.atker + if M>0 then + for i=1,M do + P:attack(P.atker[i],send,sendTime,M,P.cur.color,P.lastClear,dospin,cmb) + end + else + T=randomTarget(P) end else - T=randomTarget(P) + P:freshTarget() + T=P.atking end - else - P:freshTarget() - T=P.atking + elseif #players.alive>1 then + T=randomTarget(P) + end + if T then + P:attack(T,send,sendTime,1,P.cur.color,P.lastClear,dospin,cmb) end - elseif #players.alive>1 then - T=randomTarget(P) end - if T then - P:garbageSend(T,send,sendTime,1,P.cur.color,P.lastClear,dospin,mini,cmb) - end - if P.human and send>3 then SFX.play("emit",min(send,8)*.1)end + if P.human and send>3 then SFX.play("emit",min(send,7)*.1)end end end @@ -1822,6 +1996,8 @@ function player.drop(P)--Place piece else cmb=0 local dropScore=10 + + --Spin bonus if dospin then P:showText(text.block[P.cur.name]..text.spin,0,-30,45,"appear") P.b2b=P.b2b+20 @@ -1829,22 +2005,24 @@ function player.drop(P)--Place piece SFX.play("spin_0") VOC.play(spinName[P.cur.name],CHN) end - dropScore=25--spin bonus + dropScore=25 end + --DropSpeed bonus if P.gameEnv._20G then dropScore=dropScore*2 elseif P.gameEnv.drop<3 then dropScore=dropScore*1.5 - end--dropSpeed bonus + end + --Speed bonus if P.dropSpeed>60 then dropScore=dropScore*P.dropSpeed/60 elseif P.dropSpeed>120 then - dropScore=dropScore*1,2*P.dropSpeed/120 + dropScore=dropScore*1.2*P.dropSpeed/120 elseif P.dropSpeed>180 then dropScore=dropScore*1.5*P.dropSpeed/180 - end--speed bonus + end cscore=cscore+dropScore if P.b2b>1000 then @@ -1858,7 +2036,7 @@ function player.drop(P)--Place piece STAT.piece=STAT.piece+1 STAT.row=STAT.row+cc if atk>0 then - STAT.atk=STAT.atk+int(atk) + STAT.atk=STAT.atk+atk if send>0 then STAT.send=STAT.send+int(send) end @@ -1870,23 +2048,29 @@ function player.drop(P)--Place piece STAT.dig=STAT.dig+gbcc STAT.digatk=STAT.digatk+atk*gbcc/cc end + + --Update stat local n=P.cur.name if dospin then - _=STAT.spin[n] _[cc+1]=_[cc+1]+1--spin[1~25][0~4] - _=STAT.spins _[cc+1]=_[cc+1]+1--spin[0~4] + _=STAT.spin[n] _[cc+1]=_[cc+1]+1--Spin[1~25][0~4] + _=STAT.spins _[cc+1]=_[cc+1]+1--Spin[0~4] elseif cc>0 then - _=STAT.clear[n] _[cc]=_[cc]+1--clear[1~25][1~5] - _=STAT.clears _[cc]=_[cc]+1--clear[1~5] + _=STAT.clear[n] _[cc]=_[cc]+1--Clear[1~25][1~5] + _=STAT.clears _[cc]=_[cc]+1--Clear[1~5] end - --Update stat + --Drop event _=P.gameEnv.dropPiece if _ then _(P)end - --drop event + + --Stereo SFX if P.human then SFX.fieldPlay("lock",nil,P)end - --stereo SFX end -function player.pressKey(P,i) +---------------------------------------------------- + +---------------------------------------------------- +local AM={} +function AM.pressKey(P,i) P.keyPressing[i]=true P.act[i](P) if P.control then @@ -1896,26 +2080,45 @@ function player.pressKey(P,i) end P.stat.key=P.stat.key+1 end - --ins(rec,{i,game.frame}) end -function player.releaseKey(P,i) - if P.keyPressing[i]then - P.keyPressing[i]=false - -- if recording then ins(rec,{-i,game.frame})end +function AM.releaseKey(P,i) + P.keyPressing[i]=false +end +function AM.pressKey_Rec(P,i) + if game.recording then + ins(game.rec,game.frame) + ins(game.rec,i) + end + P.keyPressing[i]=true + P.act[i](P) + if P.control then + if P.keyRec then + ins(P.keyTime,1,game.frame) + P.keyTime[11]=nil + end + P.stat.key=P.stat.key+1 end end ----------------------------------------------------- +function AM.releaseKey_Rec(P,i) + if game.recording then + ins(game.rec,game.frame) + ins(game.rec,-i) + end + P.keyPressing[i]=false +end +---------------------------------------------------- ---------------------------------------------------- -local function gameOver() +local function gameOver()--Save record + if game.replaying then return end FILE.saveData() local M=curMode local R=M.getRank if R then local P=players[1] - R=R(P)--new rank + R=R(P)--New rank if R then - local r=modeRanks[M.name]--old rank + local r=modeRanks[M.name]--Old rank local _ if R>r then modeRanks[M.name]=R @@ -1936,7 +2139,7 @@ local function gameOver() local L=M.records local p=#L--Rank-1 if p>0 then - while M.comp(D,L[p])do--if higher rank + while M.comp(D,L[p])do--If higher rank p=p-1 if p==0 then break end end @@ -1952,7 +2155,7 @@ local function gameOver() end end end -end--Save record +end function player.die(P)--Called when win/lose,not really die! P.alive=false @@ -2039,6 +2242,7 @@ function player.lose(P) for i=A.strength+1,4 do if A.badge>=royaleData.powerUp[i]then A.strength=i + A.frameColor=frameColor[A.strength] end end P.lastRecv=A @@ -2063,9 +2267,9 @@ function player.lose(P) P:showTextF(P.modeData.event,0,120,60,"appear",.26,.9) end P.gameEnv.keepVisible=P.gameEnv.visible~="show" - P:showTextF(text.lose,0,0,90,"appear",.26,.9) + P:showTextF(text.gameover,0,0,60,"appear",.26,.9) if P.human then - game.result="lose" + game.result="gameover" SFX.play("fail") VOC.play("lose") if modeEnv.royaleMode then @@ -2110,11 +2314,12 @@ function player.act.moveLeft(P,auto) end elseif P.control and P.waiting==-1 then if P.cur and not P:ifoverlap(P.cur.bk,P.curX-1,P.curY)then + if P.gameEnv.moveFX and P.gameEnv.block then + P:createMoveFX() + end P.curX=P.curX-1 - local y0=P.curY - P:freshgho() - if P.gameEnv.easyFresh or y0~=P.curY then P:freshLockDelay()end - if P.human and P.curY==P.y_img then SFX.play("move")end + P:freshBlock(false,true) + if P.human and P.curY==P.imgY then SFX.play("move")end if not auto then P.moving=0 end P.spinLast=false else @@ -2136,11 +2341,12 @@ function player.act.moveRight(P,auto) end elseif P.control and P.waiting==-1 then if P.cur and not P:ifoverlap(P.cur.bk,P.curX+1,P.curY)then + if P.gameEnv.moveFX and P.gameEnv.block then + P:createMoveFX() + end P.curX=P.curX+1 - local y0=P.curY - P:freshgho() - if P.gameEnv.easyFresh or y0~=P.curY then P:freshLockDelay()end - if P.human and P.curY==P.y_img then SFX.play("move")end + P:freshBlock(false,true) + if P.human and P.curY==P.imgY then SFX.play("move")end if not auto then P.moving=0 end P.spinLast=false else @@ -2178,11 +2384,11 @@ function player.act.hardDrop(P) end P.keyPressing[6]=false elseif P.control and P.waiting==-1 and P.cur then - if P.curY~=P.y_img then - if P.gameEnv.dropFX then - P:createDropFX(P.curX,P.curY+1,P.curX+P.c-1,P.y_img+P.r-1) + if P.curY>P.imgY then + if P.gameEnv.dropFX and P.gameEnv.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 - P.curY=P.y_img + P.curY=P.imgY P.spinLast=false if P.gameEnv.shakeFX then P.fieldOff.vy=P.gameEnv.shakeFX*.6 @@ -2205,8 +2411,9 @@ function player.act.softDrop(P) else P.downing=1 if P.control and P.waiting==-1 and P.cur then - if P.curY~=P.y_img then + if P.curY>P.imgY then P.curY=P.curY-1 + P:freshBlock(true,true) P.spinLast=false end end @@ -2221,23 +2428,22 @@ function player.act.func(P) P.gameEnv.Fkey(P) end function player.act.restart(P) - if P.gameEnv.quickR or game.frame<180 then + if game.frame<240 or game.result then TASK.removeTask_code(TICK.autoPause) resetPartGameData() end end function player.act.insLeft(P,auto) if P.gameEnv.nofly or not P.cur then return end - local x0,y0=P.curX,P.curY + local x0=P.curX while not P:ifoverlap(P.cur.bk,P.curX-1,P.curY)do P.curX=P.curX-1 - if P.gameEnv.dropFX then - P:createDropFX(P.curX+P.c,P.curY+P.r-1,P.curX+P.c,P.curY) + if P.gameEnv.moveFX and P.gameEnv.block then + P:createMoveFX() end - P:freshgho() + P:freshBlock(false,true) end - if x0~=P.curX then - if P.gameEnv.easyFresh or y0~=P.curY then P:freshLockDelay()end + if P.curX~=x0 then P.spinLast=false end if P.gameEnv.shakeFX then @@ -2251,16 +2457,15 @@ function player.act.insLeft(P,auto) end function player.act.insRight(P,auto) if P.gameEnv.nofly or not P.cur then return end - local x0,y0=P.curX,P.curY + local x0=P.curX while not P:ifoverlap(P.cur.bk,P.curX+1,P.curY)do P.curX=P.curX+1 - if P.gameEnv.dropFX then - P:createDropFX(P.curX-1,P.curY+P.r-1,P.curX-1,P.curY) + if P.gameEnv.moveFX and P.gameEnv.block then + P:createMoveFX() end - P:freshgho() + P:freshBlock(false,true) end - if x0~=P.curX then - if P.gameEnv.easyFresh or y0~=P.curY then P:freshLockDelay()end + if P.curX~=x0 then P.spinLast=false end if P.gameEnv.shakeFX then @@ -2273,40 +2478,44 @@ function player.act.insRight(P,auto) end end function player.act.insDown(P) - if P.curY~=P.y_img and P.cur then - if P.gameEnv.dropFX then - P:createDropFX(P.curX,P.curY+1,P.curX+P.c-1,P.y_img+P.r-1) + if P.curY>P.imgY and P.cur then + if P.gameEnv.dropFX and P.gameEnv.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 end - P.curY,P.lockDelay,P.spinLast=P.y_img,P.gameEnv.lock,false + P.curY,P.lockDelay,P.spinLast=P.imgY,P.gameEnv.lock,false + P:freshBlock(true,true) end end function player.act.down1(P) - if P.curY~=P.y_img and P.cur then + if P.curY>P.imgY and P.cur then P.curY=P.curY-1 + P:freshBlock(true,true) P.spinLast=false end end function player.act.down4(P) for _=1,4 do - if P.curY~=P.y_img and P.cur then + if P.curY>P.imgY and P.cur then P.curY=P.curY-1 + P:freshBlock(true,true) P.spinLast=false else - break + return end end end function player.act.down10(P) if P.cur then for _=1,10 do - if P.curY~=P.y_img then + if P.curY>P.imgY then P.curY=P.curY-1 + P:freshBlock(true,true) P.spinLast=false else - break + return end end end @@ -2321,28 +2530,28 @@ function player.act.dropRight(P) P.act.insRight(P) P.act.hardDrop(P) end -function player.act.addLeft(P) +function player.act.zangiLeft(P) if P.gameEnv.nofly or not P.cur then return end P.act.insLeft(P) P.act.insDown(P) P.act.insRight(P) P.act.hardDrop(P) end -function player.act.addRight(P) +function player.act.zangiRight(P) if P.gameEnv.nofly or not P.cur then return end P.act.insRight(P) P.act.insDown(P) P.act.insLeft(P) P.act.hardDrop(P) end ---give operations a num name +--Give operations a num name A=player.act T={ A.moveLeft ,A.moveRight, A.rotRight, A.rotLeft, A.rot180 ,A.hardDrop, A.softDrop, A.hold, A.func ,A.restart, A.insLeft, A.insRight, A.insDown ,A.down1, A.down4, A.down10, - A.dropLeft ,A.dropRight, A.addLeft, A.addRight + A.dropLeft ,A.dropRight, A.zangiLeft,A.zangiRight }for i=1,20 do A[i]=T[i]end;A,T=nil ---------------------------------------------------- @@ -2350,29 +2559,38 @@ T={ local function newEmptyPlayer(id,x,y,size) local P={id=id} players[id]=P - players.alive[#players.alive+1]=P + players.alive[id]=P - P.fieldOff={x=0,y=0,vx=0,vy=0}--for shake FX + --Inherit functions of player class + for k,v in next,player do P[k]=v end + if P.id==1 and game.recording then + P.pressKey=AM.pressKey_Rec + P.releaseKey=AM.releaseKey_Rec + else + P.pressKey=AM.pressKey + P.releaseKey=AM.releaseKey + end + P.update=Pupdate_alive + + P.fieldOff={x=0,y=0,vx=0,vy=0}--For shake FX P.x,P.y,P.size=x,y,size or 1 + P.frameColor=frameColor[0] - P.small=P.size<.1--if draw in small mode + P.small=P.size<.1--If draw in small mode if P.small then P.centerX,P.centerY=P.x+300*P.size,P.y+600*P.size P.canvas=love.graphics.newCanvas(60,120) P.frameWait=rnd(30,120) P.draw=Pdraw_small else - P.keyRec=true--if calculate keySpeed + P.keyRec=true--If calculate keySpeed P.centerX,P.centerY=P.x+300*P.size,P.y+370*P.size P.absFieldX=P.x+150*P.size P.absFieldY=P.y+60*P.size P.draw=Pdraw_norm - P.bonus={}--text objects + P.bonus={}--Text objects end - P.update=Pupdate_alive - - --inherit functions of player class - for k,v in next,player do P[k]=v end + P.randGen=mt.newRandomGenerator(game.seed) P.small=false P.life=0 @@ -2381,7 +2599,7 @@ local function newEmptyPlayer(id,x,y,size) P.timing=false P.stat=getNewStatTable() - P.modeData={point=0,event=0,counter=0}--data use by mode + P.modeData={point=0,event=0,counter=0}--Data use by mode P.keyTime={}P.keySpeed=0 P.dropTime={}P.dropSpeed=0 for i=1,10 do P.keyTime[i]=-1e5 end @@ -2401,55 +2619,64 @@ local function newEmptyPlayer(id,x,y,size) P.keepVisible=true --P.cur={bk=matrix[2], id=shapeID, color=colorID, name=nameID} - --P.sc,P.dir={0,0},0--spinCenterCoord, direction + --P.sc,P.dir={0,0},0--SpinCenterCoord, direction --P.r,P.c=0,0--row, col --P.hd={...},same as P.cur - P.curX,P.curY,P.y_img=0,0,0--x,y,ghostY + -- P.curX,P.curY,P.imgY,P.minY=0,0,0,0--x,y,ghostY P.holded=false P.next={} P.freshTime=0 P.spinLast,P.lastClear=false,nil - P.spinSeq=0--for Ospin, each digit mean a spin - P.ctrlCount=0--key press time, for finesse check - P.pieceCount=0--count pieces from next, for drawing bagline + P.spinSeq=0--For Ospin, each digit mean a spin + P.ctrlCount=0--Key press time, for finesse check + P.pieceCount=0--Count pieces from next, for drawing bagline P.human=false P.RS=kickList.TRS - -- P.newNext=nil--call prepareSequence()to get a function to get new next + -- P.newNext=nil--Call prepareSequence()to get a function to get new next P.keyPressing={}for i=1,12 do P.keyPressing[i]=false end - P.movDir,P.moving,P.downing=0,0,0--last move key,DAS charging,downDAS charging + P.movDir,P.moving,P.downing=0,0,0--Last move key,DAS charging,downDAS charging P.waiting,P.falling=-1,-1 - P.clearingRow,P.clearedRow={},{}--clearing animation height,cleared row mark + P.clearingRow,P.clearedRow={},{}--Clearing animation height,cleared row mark P.combo,P.b2b=0,0 P.garbageBeneath=0 P.fieldBeneath=0 P.score1,P.b2b1=0,0 - P.dropFX,P.lockFX,P.clearFX={},{},{} - P.tasks={}--tasks - P.bonus={}--texts + P.dropFX,P.moveFX,P.lockFX,P.clearFX={},{},{},{} + P.tasks={}--Tasks + P.bonus={}--Texts - P.endCounter=0--used after gameover - P.result=nil--string:"WIN"/"K.O." + P.endCounter=0--Used after gameover + P.result=nil--String:"WIN"/"K.O." return P end -local function loadGameEnv(P)--load gameEnv +local function loadGameEnv(P)--Load gameEnv P.gameEnv={}--Current game setting environment local ENV=P.gameEnv + local E + --Load game settings for k,v in next,gameEnv0 do if modeEnv[k]~=nil then - v=modeEnv[k] + v=modeEnv[k] --Mode setting + -- DBP("mode-"..k..":"..tostring(v)) + elseif game.setting[k]~=nil then + v=game.setting[k] --Game setting + -- DBP("game-"..k..":"..tostring(v)) elseif setting[k]~=nil then - v=setting[k] + v=setting[k] --Global setting + -- DBP("global-"..k..":"..tostring(v)) + -- else + -- DBP("default-"..k..":"..tostring(v)) end - ENV[k]=v - end--load game settings + ENV[k]=v --Default setting + end end -local function applyGameEnv(P)--finish gameEnv processing +local function applyGameEnv(P)--Finish gameEnv processing local ENV=P.gameEnv P.dropDelay=ENV.drop @@ -2480,10 +2707,11 @@ local function applyGameEnv(P)--finish gameEnv processing if ENV.lockFX==0 then ENV.lockFX=nil end if ENV.dropFX==0 then ENV.dropFX=nil end + if ENV.moveFX==0 then ENV.moveFX=nil end if ENV.clearFX==0 then ENV.clearFX=nil end if ENV.shakeFX==0 then ENV.shakeFX=nil end end -local function prepareSequence(P)--call freshPrepare and set newNext +local function prepareSequence(P)--Call freshPrepare and set newNext local ENV=P.gameEnv if type(ENV.sequence)=="string"then freshPrepare[ENV.sequence](P) @@ -2494,7 +2722,7 @@ local function prepareSequence(P)--call freshPrepare and set newNext P.newNext=ENV.freshMethod end end -local function loadAI(P,AIdata)--load AI params +local function loadAI(P,AIdata)--Load AI params local ENV=P.gameEnv P.AI_mode=AIdata.type P.AI_stage=1 @@ -2549,12 +2777,15 @@ function PLY.newDemoPlayer(id,x,y,size) noFly=false, das=10,arr=2, sddas=2,sdarr=2, - quickR=true,swap=true, + swap=true, ghost=setting.ghost,center=setting.center, smooth=setting.smooth,grid=setting.grid, text=setting.text, - lockFX=setting.lockFX,dropFX=setting.dropFX, - clearFX=setting.clearFX,shakeFX=setting.shakeFX, + lockFX=setting.lockFX, + dropFX=setting.dropFX, + moveFX=setting.moveFX, + clearFX=setting.clearFX, + shakeFX=setting.shakeFX, _20G=false,bone=false, drop=1e99,lock=1e99, @@ -2582,7 +2813,7 @@ function PLY.newDemoPlayer(id,x,y,size) P.showTime=1e99 P.keepVisible=true - --always use "bag" + --Always use "bag" freshPrepare.bag(P) P.newNext=freshMethod.bag @@ -2602,9 +2833,9 @@ end function PLY.newRemotePlayer(id,x,y,size,actions) local P=newEmptyPlayer(id,x,y,size) - P.human=false -- 录像不是人为操作 - P.remote=true -- 远程操作 - -- 开发中 + P.human=false + P.remote=true + -- P.updateAction=buildActionFunctionFromActions(P, actions) loadGameEnv(P) @@ -2618,6 +2849,7 @@ function PLY.newAIPlayer(id,x,y,size,AIdata) ENV.text=false ENV.lockFX=nil ENV.dropFX=nil + ENV.moveFX=nil ENV.shakeFX=nil end @@ -2641,7 +2873,6 @@ function PLY.newPlayer(id,x,y,size) P.human=true P.RS=kickList.TRS - players.human=players.human+1 end ---------------------------------------------------- return PLY \ No newline at end of file diff --git a/parts/skin.lua b/parts/skin.lua index a811b2c1..843d166b 100644 --- a/parts/skin.lua +++ b/parts/skin.lua @@ -18,6 +18,8 @@ local list={ "paper(mrz)", "classic(_)", "brick(notypey)", + "retro(notypey)", + "retro_grey(notypey)", "text_bone(mrz)", "colored_bone(mrz)", "white_bone(mrz)", @@ -97,33 +99,33 @@ function SKIN.load() gc.pop() end local L=#list -function SKIN.prevSet()--prev skin_set +function SKIN.prevSet()--Prev skin_set local _=(setting.skinSet-2)%L+1 setting.skinSet=_ SKIN.change(_) _=list[_] TEXT.show(_,1100,100,int(300/#_)+5,"fly") end -function SKIN.nextSet()--next skin_set +function SKIN.nextSet()--Next skin_set local _=setting.skinSet%L+1 setting.skinSet=_ SKIN.change(_) _=list[_] TEXT.show(_,1100,100,int(300/#_)+5,"fly") end -function SKIN.prev(i)--prev skin for [i] +function SKIN.prev(i)--Prev skin for [i] local _=setting.skin _[i]=(_[i]-2)%11+1 end -function SKIN.next(i)--next skin for [i] +function SKIN.next(i)--Next skin for [i] local _=setting.skin _[i]=_[i]%11+1 end -function SKIN.rotate(i)--change direction of [i] +function SKIN.rotate(i)--Change direction of [i] setting.face[i]=(setting.face[i]+1)%4 SFX.play("rotate") end -function SKIN.change(i)--change to skin_set[i] +function SKIN.change(i)--Change to skin_set[i] blockSkin=SKIN.lib[i] blockSkinMini=SKIN.libMini[i] end diff --git a/parts/spinCenters.lua b/parts/spinCenters.lua index 123cfbf0..afb9ac7f 100644 --- a/parts/spinCenters.lua +++ b/parts/spinCenters.lua @@ -1,9 +1,9 @@ -local N1,N2={1,2},{2,1} -local N3,N4={2,2},{1.5,1.5} -local I1,I2={0.5,2.5},{2.5,0.5} -local I3,I4={1.5,2.5},{2.5,1.5} -local V4={2.5,2.5} -local L1,L2={1,3},{3,1} +local N1,N2={0,1},{1,0} +local N3,N4={1,1},{.5,.5} +local I1,I2={-.5,1.5},{1.5,-.5} +local I3,I4={.5,1.5},{1.5,.5} +local V4={1.5,1.5} +local L1,L2={0,2},{2,0} local scs={ --Tetramino {[0]=N1,N2,N3,N3},--Z diff --git a/parts/tick.lua b/parts/tick.lua index f2ce8543..813c642e 100644 --- a/parts/tick.lua +++ b/parts/tick.lua @@ -3,9 +3,10 @@ local Tick={} function Tick.finish(P) P.endCounter=P.endCounter+1 if P.endCounter<40 then + --Make field visible for j=1,#P.field do for i=1,10 do if P.visTime[j][i]<20 then P.visTime[j][i]=P.visTime[j][i]+.5 end - end end--Make field visible + end end elseif P.endCounter==60 then return true end @@ -13,9 +14,10 @@ end function Tick.lose(P) P.endCounter=P.endCounter+1 if P.endCounter<40 then + --Make field visible for j=1,#P.field do for i=1,10 do if P.visTime[j][i]<20 then P.visTime[j][i]=P.visTime[j][i]+.5 end - end end--Make field visible + end end elseif P.endCounter>80 then for i=1,#P.field do for j=1,10 do @@ -35,6 +37,7 @@ function Tick.lose(P) end if not modeEnv.royaleMode and #players>1 then P.y=P.y+P.endCounter*.26 + P.absFieldY=P.absFieldY+P.endCounter*.26 end end function Tick.throwBadge(data)--{ifAI,Sender,timer} @@ -52,8 +55,9 @@ function Tick.throwBadge(data)--{ifAI,Sender,timer} else x2,y2=R.x+66*R.size,R.y+344*R.size end + + --Generate badge object FX_badge[#FX_badge+1]={x1,y1,x2,y2,t=0} - --generate badge object if not data[1]and data[3]%8==0 then SFX.play("collect") @@ -63,6 +67,7 @@ function Tick.throwBadge(data)--{ifAI,Sender,timer} end function Tick.autoPause(data) data[1]=data[1]+1 + if SCN.cur~="play"then return true end if data[1]==120 then if SCN.cur=="play"then pauseGame() @@ -70,14 +75,4 @@ function Tick.autoPause(data) return true end end -function Tick.autoResize(data) - data[1]=data[1]+1 - if data[1]==62 then - local w,h=gc.getWidth(),gc.getHeight() - if w