diff --git a/callback.lua b/callback.lua new file mode 100644 index 00000000..afe9d0c7 --- /dev/null +++ b/callback.lua @@ -0,0 +1,1231 @@ +local ms,kb,tc=love.mouse,love.keyboard,love.touch +local gc,sys=love.graphics,love.system +local Timer=love.timer.getTime +local int,rnd,max,min=math.floor,math.random,math.max,math.min +local abs=math.abs +local rem=table.remove + +kb.setKeyRepeat(true) +kb.setTextInput(false) +ms.setVisible(false) + +local scr=scr +local xOy=love.math.newTransform() +local mx,my,mouseShow=-20,-20,false +local touching=nil--第一触摸ID +local touchDist=nil +joysticks={} + +local devMode +players={alive={},human=0} + +local Tmr=require("timer") +local Pnt=require("paint") + +local infoCanvas=gc.newCanvas(108,27) +local function updatePowerInfo() + local state,pow=sys.getPowerInfo() + gc.setCanvas(infoCanvas)gc.push("transform")gc.origin() + gc.clear(0,0,0,.25) + if state~="unknown"then + gc.setLineWidth(4) + local charging=state=="charging" + if state=="nobattery"then + gc.setColor(1,1,1) + gc.setLineWidth(2) + gc.line(74,5,100,22) + elseif pow then + if charging then gc.setColor(0,1,0) + elseif pow>50 then gc.setColor(1,1,1) + elseif pow>26 then gc.setColor(1,1,0) + elseif pow<26 then gc.setColor(1,0,0) + else gc.setColor(.5,0,1) + end + gc.rectangle("fill",76,6,pow*.22,14) + if pow<100 then + setFont(14) + gc.setColor(0,0,0) + gc.print(pow,77,2) + gc.print(pow,77,4) + gc.print(pow,79,2) + gc.print(pow,79,4) + gc.setColor(1,1,1) + gc.print(pow,78,3) + end + end + gc.draw(batteryImage,73,3) + end + setFont(25) + gc.print(os.date("%H:%M",os.time()),3,-5) + gc.pop()gc.setCanvas() +end +local function onVirtualkey(x,y) + local dist,nearest=1e10 + for K=1,#virtualkey do + local b=virtualkey[K] + if b.ava then + local d1=(x-b.x)^2+(y-b.y)^2 + if d10 then + if floatWheel<0 then floatWheel=0 end + floatWheel=floatWheel+y^1.2 + elseif y<0 then + if floatWheel>0 then floatWheel=0 end + floatWheel=floatWheel-(-y)^1.2 + end + while floatWheel>=1 do + love.keypressed("up") + floatWheel=floatWheel-1 + end + while floatWheel<=-1 do + love.keypressed("down") + floatWheel=floatWheel+1 + end +end +local mouseClick,touchClick={},{} +local mouseDown,mouseMove,mouseUp,wheelMoved={},{},{},{} +local touchDown,touchUp,touchMove={},{},{} +local keyDown,keyUp={},{} +local gamepadDown,gamepadUp={},{} + +function keyDown.load(k) + if k=="s"then + marking=nil + sceneTemp.skip=true + end +end +function touchDown.load() + if #tc.getTouches()>2 then + sceneTemp.skip=true + end +end + +function mouseDown.intro(x,y,k) + if k==2 then + VOC.play("bye") + SCN.back() + else + SCN.push() + SCN.swapTo("main") + end +end +function touchDown.intro(id,x,y) + SCN.push() + SCN.swapTo("main") +end +function keyDown.intro(key) + if key=="escape"then + VOC.play("bye") + SCN.back() + else + SCN.push() + SCN.swapTo("main") + end +end + +local function onMode(x,y) + local cam=mapCam + x=(cam.x1-640+x)/cam.k1 + y=(cam.y1-360+y)/cam.k1 + local MM,R=modes,modeRanks + for _=1,#MM do + if R[_]then + local M=MM[_] + local s=M.size + if M.shape==1 then + if x>M.x-s and xM.y-s and y1.5 then k=1.5 + elseif k<.3 then k=.3 + end + t=k/t + if cam.sel then + cam.x=(cam.x-180)*t+180;cam.y=cam.y*t + else + cam.x=cam.x*t;cam.y=cam.y*t + end + cam.k=k + cam.keyCtrl=false +end +function mouseMove.mode(x,y,dx,dy) + if ms.isDown(1)then + mapCam.x,mapCam.y=mapCam.x-dx,mapCam.y-dy + end + mapCam.keyCtrl=false +end +function mouseClick.mode(x,y,k) + local cam=mapCam + local _=cam.sel + if not cam.sel or x<920 then + local __=onMode(x,y) + if _~=__ then + if __ then + SFX.play("click") + cam.moving=true + _=modes[__] + cam.x=_.x*cam.k+180 + cam.y=_.y*cam.k + cam.sel=__ + else + cam.sel=nil + cam.x=cam.x-180 + end + end + end + cam.keyCtrl=false +end +function touchMove.mode(id,x,y,dx,dy) + local L=tc.getTouches() + if not L[2]then + 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]))--dx,dy not Δ! + local d=(x-dx)^2+(y-dy)^2 + if d>100 then + d=d^.5 + if touchDist then + wheelMoved.mode(nil,(d-touchDist)*.02) + end + touchDist=d + end + end + mapCam.keyCtrl=false +end +function touchClick.mode(x,y,id) + mouseClick.mode(x,y,1) +end +function keyDown.mode(key) + if key=="return"then + if mapCam.sel then + mapCam.keyCtrl=false + SCN.push()loadGame(mapCam.sel) + end + elseif key=="escape"then + if mapCam.sel then + mapCam.sel=nil + else + SCN.back() + end + elseif mapCam.sel==71 or mapCam.sel==72 then + if key=="q"then + SCN.push()SCN.swapTo("draw") + elseif key=="e"then + SCN.push()SCN.swapTo("custom") + end + end +end + +function wheelMoved.music(x,y) + if y>0 then + keyDown.music("up") + elseif y<0 then + keyDown.music("down") + end +end +function keyDown.music(key) + if key=="down"then + sceneTemp=sceneTemp%#musicID+1 + elseif key=="up"then + sceneTemp=(sceneTemp-2)%#musicID+1 + elseif key=="return"or key=="space"then + if BGM.nowPlay~=musicID[sceneTemp]then + SFX.play("click") + BGM.play(musicID[sceneTemp]) + else + BGM.stop() + end + elseif key=="escape"then + SCN.back() + end +end + +function keyDown.custom(key) + local sel=sceneTemp + if key=="left"then + customSel[sel]=(customSel[sel]-2)%#customRange[customID[sel]]+1 + if sel==12 then + BG.set(customRange.bg[customSel[12]]) + elseif sel==13 then + BGM.play(customRange.bgm[customSel[13]]) + end + elseif key=="right"then + customSel[sel]=customSel[sel]%#customRange[customID[sel]]+1 + if sel==12 then + BG.set(customRange.bg[customSel[sel]]) + elseif sel==13 then + BGM.play(customRange.bgm[customSel[sel]]) + end + elseif key=="down"then + sceneTemp=sel%#customID+1 + elseif key=="up"then + sceneTemp=(sel-2)%#customID+1 + elseif key=="1"then + Widget.custom.set1.code() + elseif key=="2"then + Widget.custom.set2.code() + elseif key=="3"then + Widget.custom.set3.code() + elseif key=="4"then + Widget.custom.set4.code() + elseif key=="5"then + Widget.custom.set5.code() + elseif key=="escape"then + SCN.back() + end +end + +function mouseDown.draw(x,y,k) + mouseMove.draw(x,y) +end +function mouseMove.draw(x,y,dx,dy) + local sx,sy=int((x-200)/30)+1,20-int((y-60)/30) + if sx<1 or sx>10 then sx=nil end + if sy<1 or sy>20 then sy=nil end + sceneTemp.x,sceneTemp.y=sx,sy + if sx and sy and ms.isDown(1,2,3)then + preField[sy][sx]=ms.isDown(1)and sceneTemp.pen or ms.isDown(2)and -1 or 0 + end +end +function wheelMoved.draw(x,y) + local pen=sceneTemp.pen + if y<0 then + pen=pen+1 + if pen==8 then pen=9 elseif pen==14 then pen=0 end + else + pen=pen-1 + if pen==8 then pen=7 elseif pen==-1 then pen=13 end + end + sceneTemp.pen=pen +end +function touchDown.draw(id,x,y) + mouseMove.draw(x,y) +end +function touchMove.draw(id,x,y,dx,dy) + local sx,sy=int((x-200)/30)+1,20-int((y-60)/30) + if sx<1 or sx>10 then sx=nil end + if sy<1 or sy>20 then sy=nil end + sceneTemp.x,sceneTemp.y=sx,sy + if sx and sy then + preField[sy][sx]=sceneTemp.pen + end +end +local penKey={ + q=1,w=2,e=3,r=4,t=5,y=6,u=7,i=8,o=9,p=10,["["]=11, + a=12,s=13,d=14,f=15,g=16,h=17, + z=0,x=-1, +} +function keyDown.draw(key) + local sx,sy,pen=sceneTemp.x,sceneTemp.y,sceneTemp.pen + if key=="up"or key=="down"or key=="left"or key=="right"then + if not sx then sx=1 end + if not sy then sy=1 end + if key=="up"and sy<20 then sy=sy+1 + elseif key=="down"and sy>1 then sy=sy-1 + elseif key=="left"and sx>1 then sx=sx-1 + elseif key=="right"and sx<10 then sx=sx+1 + end + if kb.isDown("space")then + preField[sy][sx]=pen + end + elseif key=="delete"then + if sceneTemp.sure>20 then + for y=1,20 do for x=1,10 do preField[y][x]=0 end end + sceneTemp.sure=0 + else + sceneTemp.sure=50 + end + elseif key=="space"then + if sx and sy then + preField[sy][sx]=pen + end + 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() + else + pen=penKey[key]or pen + end + sceneTemp.x,sceneTemp.y,sceneTemp.pen=sx,sy,pen +end + +function mouseDown.setting_sound(x,y,k) + if x>780 and x<980 and y>470 and sceneTemp.jump==0 then + sceneTemp.jump=10 + local t=Timer()-sceneTemp.last + if t>1 then + VOC.play((t<1.5 or t>15)and"doubt"or rnd()<.8 and"happy"or"egg") + sceneTemp.last=Timer() + if rnd()<.0626 then + for i=1,#modes do + local M=modes[i] + for i=1,#M.unlock do + local m=M.unlock[i] + if not modeRanks[m]then + modeRanks[m]=modes[m].score and 0 or 6 + end + end + end + FILE.saveUnlock() + TEXT.show("DEVMODE:UNLOCKALL",640,360,50,"stretch",.6) + end + end + end +end +function touchDown.setting_sound(id,x,y) + mouseDown.setting_sound(x,y) +end + +function keyDown.setting_key(key) + local s=sceneTemp + if key=="escape"then + if s.kS then + s.kS=false + SFX.play("finesseError",.5) + else + SCN.back() + end + elseif s.kS then + for l=1,8 do + for y=1,20 do + if keyMap[l][y]==key then + keyMap[l][y]="" + goto L + end + end + end + ::L:: + keyMap[s.board][s.kb]=key + SFX.play("reach",.5) + s.kS=false + elseif key=="return"then + s.kS=true + SFX.play("lock",.5) + elseif key=="up"then + if s.kb>1 then + s.kb=s.kb-1 + SFX.play("move",.5) + end + elseif key=="down"then + if s.kb<20 then + s.kb=s.kb+1 + SFX.play("move",.5) + end + elseif key=="left"then + if s.board>1 then + s.board=s.board-1 + SFX.play("rotate",.5) + end + elseif key=="right"then + if s.board<8 then + s.board=s.board+1 + SFX.play("rotate",.5) + end + end +end +function gamepadDown.setting_key(key) + local s=sceneTemp + if key=="back"then + if s.jS then + s.jS=false + SFX.play("finesseError",.5) + else + SCN.back() + end + elseif s.jS then + for l=9,16 do + for y=1,20 do + if keyMap[l][y]==key then + keyMap[l][y]="" + goto L + end + end + end + ::L:: + keyMap[8+s.board][s.js]=key + SFX.play("reach",.5) + s.jS=false + elseif key=="start"then + s.jS=true + SFX.play("lock",.5) + elseif key=="dpup"then + if s.js>1 then + s.js=s.js-1 + SFX.play("move",.5) + end + elseif key=="dpdown"then + if s.js<20 then + s.js=s.js+1 + SFX.play("move",.5) + end + elseif key=="dpleft"then + if s.board>1 then + s.board=s.board-1 + SFX.play("rotate",.5) + end + elseif key=="dpright"then + if s.board<8 then + s.board=s.board+1 + SFX.play("rotate",.5) + end + end +end + +function mouseDown.setting_touch(x,y,k) + if k==2 then SCN.back()end + sceneTemp.sel=onVK_org(x,y)or sceneTemp.sel +end +function mouseMove.setting_touch(x,y,dx,dy) + if sceneTemp.sel and ms.isDown(1)and not widget_sel then + local B=VK_org[sceneTemp.sel] + B.x,B.y=B.x+dx,B.y+dy + end +end +function mouseUp.setting_touch(x,y,k) + if sceneTemp.sel then + local B=VK_org[sceneTemp.sel] + local k=snapLevelValue[sceneTemp.snap] + B.x,B.y=int(B.x/k+.5)*k,int(B.y/k+.5)*k + end +end +function touchDown.setting_touch(id,x,y) + sceneTemp.sel=onVK_org(x,y)or sceneTemp.sel +end +function touchUp.setting_touch(id,x,y) + if sceneTemp.sel then + local B=VK_org[sceneTemp.sel] + local k=snapLevelValue[sceneTemp.snap] + B.x,B.y=int(B.x/k+.5)*k,int(B.y/k+.5)*k + end +end +function touchMove.setting_touch(id,x,y,dx,dy) + if sceneTemp.sel and not widget_sel then + local B=VK_org[sceneTemp.sel] + B.x,B.y=B.x+dx,B.y+dy + end +end + +function keyDown.pause(key) + if key=="escape"then + SCN.back() + elseif key=="space"then + resumeGame() + elseif key=="s"then + SCN.push() + SCN.swapTo("setting_sound") + elseif key=="r"then + TASK.clear("play") + mergeStat(stat,players[1].stat) + resetGameData() + 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--按钮软碰撞(做不来hhh随便做一个,效果还行!) + 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--碰撞深度(负数=间隔距离) + if d>0 then + b.x=b.x+(b.x-B.x)*d*b.r*.00005 + b.y=b.y+(b.y-B.y)*d*b.r*.00005 + end + end + end + local O=VK_org[t] + local _FW,_CW=setting.VKTchW*.1,1-setting.VKCurW*.1 + local _OW=1-_FW-_CW + --按钮自动跟随:手指位置,当前位置,原始位置,权重取决于设置 + 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 +end +function touchUp.play(id,x,y) + if setting.VKSwitch then + local t=onVirtualkey(x,y) + if t then + players[1]:releaseKey(t) + end + 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 + end + players[1]:releaseKey(n) + ::next:: + end + end +end +function keyDown.play(key) + if key=="escape"then + pauseGame() + return + end + local m=keyMap + for p=1,players.human do + for k=1,20 do + if key==m[2*p-1][k]or key==m[2*p][k]then + players[p]:pressKey(k) + if p==1 then + virtualkey[k].isDown=true + virtualkey[k].pressTime=10 + end + return + end + end + end +end +function keyUp.play(key) + local m=keyMap + for p=1,players.human do + for k=1,20 do + if key==m[2*p-1][k]or key==m[2*p][k]then + players[p]:releaseKey(k) + if p==1 then virtualkey[k].isDown=false end + return + end + end + end +end +function gamepadDown.play(key) + if key=="back"then SCN.back()return end + local m=keyMap + for p=1,players.human do + for k=1,20 do + if key==m[2*p+7][k]or key==m[2*p+8][k]then + players[p]:pressKey(k) + if p==1 then + virtualkey[k].isDown=true + virtualkey[k].pressTime=10 + end + return + end + end + end +end +function gamepadUp.play(key) + local m=keyMap + for p=1,players.human do + for k=1,20 do + if key==m[2*p+7][k]or key==m[2*p+8][k]then + players[p]:releaseKey(k) + if p==1 then virtualkey[k].isDown=false end + return + end + end + end +end + +function touchDown.help(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 + marking=nil + SFX.play("reach") + 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]-3,1) + elseif key=="down"then + sceneTemp[2]=min(sceneTemp[2]+3,#sceneTemp[1]-22) + elseif key=="escape"then + SCN.back() + end +end +------------------------------------------------------------- +local function widgetPress(W,x,y) + if W.type=="button"then + W.code() + W:FX() + SFX.play("button") + VOC.play("nya") + elseif W.type=="switch"then + W.code() + SFX.play("move",.6) + elseif W.type=="slider"then + if not x then return end + local p,P=W.disp(),xW.x+W.w and W.unit or int((x-W.x)*W.unit/W.w+.5) + if p==P then return end + W.code(P) + if W.change then W.change()end + end + if W.hide and W.hide()then widget_sel=nil end +end +local function widgetDrag(W,x,y,dx,dy) + if W.type=="slider"then + local p,P=W.disp(),xW.x+W.w and W.unit or int((x-W.x)*W.unit/W.w+.5) + if p==P then return end + W.code(P) + if W.change then W.change()end + elseif not W:isAbove(x,y)then + widget_sel=nil + end +end +local function widgetControl_key(i) + if i=="tab"then + if widget_sel then + widget_sel=kb.isDown("lshift")and widget_sel.prev or widget_sel.next or widget_sel + else + widget_sel=select(2,next(Widget[SCN.cur])) + end + elseif i=="space"or i=="return"then + if widget_sel then + widgetPress(widget_sel) + end + elseif i=="left"or i=="right"then + if widget_sel then + local W=widget_sel + if W.type=="slider"then + local p=W.disp() + local P=i=="left"and(p>0 and p-1)or p0 and p-1)or p=.5625 then + scr.k=w/1280 + scr.x,scr.y=0,(h-w*9/16)*.5 + else + scr.k=h/720 + scr.x,scr.y=(w-h*16/9)*.5,0 + end + xOy=xOy:setTransformation(w*.5,h*.5,nil,scr.k,nil,640,360) + BG.resize(w,h) +end +function love.focus(f) + if SCN.cur=="play"and not f 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} +local devColor={ + color.white, + color.lightMagenta, + color.lightGreen, + color.lightBlue, +} +local FPS=love.timer.getFPS +love.draw,love.update=nil +function love.run() + local T=love.timer + local STEP,GETΔ,WAIT=T.step,T.getDelta,T.sleep + local lastFrame=T.getTime() + local lastFreshPow=lastFrame + local FCT=0--framedraw counter + local mini=love.window.isMinimized + local PUMP,POLL=love.event.pump,love.event.poll + love.resize(gc.getWidth(),gc.getHeight()) + SCN.init("load")--Scene Launch + marking=true + return function() + --EVENT + PUMP() + for N,a,b,c,d,e in POLL()do + if love[N]then + love[N](a,b,c,d,e) + elseif N=="quit"then + destroyPlayers() + return 1 + end + end + + --UPDATE + STEP()local dt=GETΔ() + TASK.update() + VOC.update() + BG.update(dt) + sysFX.update(dt) + TEXT.update() + local _=Tmr[SCN.cur]if _ then _(dt)end + if SCN.swapping then SCN.swapUpdate()end + for _,W in next,Widget[SCN.cur]do + W:update() + end--更新控件 + + --DRAW + if not mini()then + FCT=FCT+setting.frameMul + if FCT>=100 then + FCT=FCT-100 + gc.discard()--SPEED UPUPUP! + + BG.draw() + gc.push("transform") + gc.replaceTransform(xOy) + if Pnt[SCN.cur]then Pnt[SCN.cur]()end + for k,W in next,Widget[SCN.cur]do + if not(W.hide and W.hide())then + W:draw() + end + end--Draw widgets + if mouseShow then + local r=Timer()*.5 + 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(miniBlock[R],mx,my,Timer()%3.1416*4,20,20,scs[2*R]-.5,#blocks[R][0]-scs[2*R-1]+.5) + gc.setColor(1,1,1,.5)gc.circle("fill",mx,my,5) + gc.setColor(1,1,1)gc.circle("fill",mx,my,3) + end--Awesome mouse! + sysFX.draw() + TEXT.draw() + gc.pop() + + gc.setColor(1,1,1) + gc.draw(infoCanvas,0,0,0,scr.k) + --Power Info + + if SCN.swapping then + _=SCN.swap + _.draw(_.time) + end--Scene swapping animation + + setFont(15) + gc.setColor(1,1,1) + _=scr.h-20 + gc.print(FPS(),5,_) + if devMode then + gc.setColor(devColor[devMode]) + gc.print("Cache used:"..gcinfo(),5,_-20) + gc.print("Free Row:"..freeRow.getCount(),5,_-40) + gc.print("Mouse:"..mx.." "..my,5,_-60) + gc.print("Voices:"..VOC.getCount(),5,_-80) + gc.print("Tasks:"..TASK.getCount(),5,_-100) + if devMode==3 then love.timer.sleep(.26) + elseif devMode==4 then love.timer.sleep(.626) + end + end--DEV info + + gc.present() + end + end + + --FRAME TIME CTRL + if Timer()-lastFrame<.058 then WAIT(.01)end + while Timer()-lastFrame<.0159 do WAIT(.001)end + + --FRESH POWER + lastFrame=Timer() + if Timer()-lastFreshPow>1 then + updatePowerInfo() + lastFreshPow=Timer() + end + end +end +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},{.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 \ No newline at end of file diff --git a/conf.lua b/conf.lua index 8407ad6f..c437ea65 100644 --- a/conf.lua +++ b/conf.lua @@ -1,4 +1,4 @@ -gameVersion="Alpha V0.8.17" +gameVersion="Alpha V0.8.18" function love.conf(t) t.identity="Techmino"--SaveDir name t.version="11.1" diff --git a/default_data.lua b/default_data.lua index eae49d4d..099ca1df 100644 --- a/default_data.lua +++ b/default_data.lua @@ -2,7 +2,7 @@ setting={ das=10,arr=2, sddas=0,sdarr=2, ihs=true,irs=true,ims=true, - reTime=10, + reTime=4, maxNext=6, quickR=true, swap=true, @@ -34,7 +34,8 @@ setting={ stereo=6, --sound - VKSound=true,--if SFX + VKSFX=3,--SFX volume + VKVIB=0,--VIB VKSwitch=false,--if disp VKTrack=false,--if tracked VKDodge=false,--if dodge diff --git a/document.txt b/document.txt index 68585000..25214daa 100644 --- a/document.txt +++ b/document.txt @@ -3,12 +3,10 @@ 活到最后或者完成目标即胜利. 旋转系统: - 使用Techmino专属旋转系统 - 细节懒得写(?) + 使用Techmino专属旋转系统,细节懒得写( spin判定: - 结合了不可移动判定和三角判定,是否为mini也与判定过程数据有关 - 细节也懒得写(?) + 结合了不可移动判定和三角判定,是否为mini也与判定过程数据有关,细节也懒得写( 攻击系统: 普通消除: @@ -48,11 +46,11 @@ back to back(B2B)点数说明: 1.随机:每次攻击后10%随机挑选一个玩家锁定 2.最多徽章:攻击后或者锁定玩家死亡时锁定徽章最多的玩家 3.最高:攻击后或者锁定玩家死亡时锁定场地最高的玩家(每秒刷新) - 4.反击:攻击所有锁定自己的玩家(攻击AOE),若未被任何人锁定则伏击随机玩家 + 4.反击:攻击所有锁定自己的玩家(攻击AOE),若未被任何人锁定则攻击随机玩家(不锁定) 坚持到最后的玩家就是胜利者. 自定义模式说明: 玩家可以自由调整大多数参数(不包括上述各种游戏模式的特殊效果),也可以画一个场地去消除或者是作为提示模板来进行拼图模式. 在拼图模式下,按功能键切换是否展示提示.其中打"X"的格子不允许有方块,空的格子可以是任何状态,普通的七种彩色方块必须颜色对应,垃圾行方块的为止只要有方块就可以,但是不能是空气,玩家拼出自己画的图后就会判定胜利. 附录: -ZXC的Ospin地图:XY0BCgAwCAIR7v9vHtUSt8AS0xKqgpnNGyXkrmFNePf6qi3BbQPrHT2Owxe6D66NeKi86dwB \ No newline at end of file +ZXC的Ospin地图:XY0BCgAwCAIR7v9vHtUSt8AS0xKqgpnNGyXkrmFNePf6qi3BbQPrHT2Owxe6D66NeKi86dwB \ No newline at end of file diff --git a/main.lua b/main.lua index 4a2218d1..f05010f5 100644 --- a/main.lua +++ b/main.lua @@ -1,29 +1,10 @@ --[[ -第一次搞这么大的工程,参考价值不是很大 +第一次搞这么大的工程,参考价值也许不是很大 如果你有时间并且也热爱俄罗斯方块的话,来看代码或者帮助优化的话欢迎! ]] math.randomseed(os.time()*626) -local love=love -local ms,kb,tc=love.mouse,love.keyboard,love.touch -local gc,sys,fs=love.graphics,love.system,love.filesystem -local Timer=love.timer.getTime -local int,rnd,max,min=math.floor,math.random,math.max,math.min -local abs=math.abs -local rem=table.remove -function NULL()end ---LIBs -------------------------------------------------------------- -system=sys.getOS() -local xOy=love.math.newTransform() -local mx,my,mouseShow=-20,-20,false -local touching=nil--第一触摸ID -local touchDist=nil -joysticks={} - -local devMode -players={alive={},human=0} -scr={x=0,y=0,w=0,h=0,rad=0,k=1}--x,y,wid,hei,radius,scale K -local scr=scr +--Global vars +system=love.system.getOS() mapCam={ sel=nil,--selected mode ID @@ -37,1270 +18,53 @@ mapCam={ zoomK=nil, --for auto zooming when enter/leave scene } -texts={} -widget_sel=nil--selected widget object - -kb.setKeyRepeat(true) -kb.setTextInput(false) -ms.setVisible(false) ---Application Vars -------------------------------------------------------------- +scr={x=0,y=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 --- blockSkin,blockSkinMini={},{}--redefined in skin.change ---Game system Vars -------------------------------------------------------------- +preField={h=20}for i=1,20 do preField[i]={0,0,0,0,0,0,0,0,0,0}end +function NULL()end +--[[ +blockSkin,blockSkinMini={},{}--redefined in SKIN.change +widget_sel=nil--selected widget obj +]] + +--Load modules +setFont=require("parts/setfont") color=require("parts/color") +blocks=require("parts/mino") +SHADER=require("parts/shader") +AITemplate=require("parts/AITemplate") +freeRow=require("parts/freeRow") +tickEvent=require("parts/tickEvent") + require("parts/list") require("toolfunc") - -setFont=require("parts/setfont") -freeRow=require("parts/freeRow") -blocks=require("parts/mino") require("texture") -FILE=require("file") + +SCN=require("scene") VIB=require("parts/vib") SFX=require("parts/sfx") sysFX=require("parts/sysFX") BGM=require("parts/bgm") VOC=require("parts/voice") +SKIN=require("parts/skin") LANG=require("parts/languages") +FILE=require("parts/file") TEXT=require("parts/text") TASK=require("parts/task") -tickEvent=require("parts/tickEvent") -AITemplate=require("parts/AITemplate") -SCN=require("scene") -skin=require("parts/skin") BG=require("parts/bg") IMG=require("parts/img") -SHADER=require("parts/shader") --- require("parts/light") +require("parts/light") require("parts/modes") require("default_data") require("parts/widget") require("parts/ai") require("player") Widget=require("widgetList") -local Tmr=require("timer") -local Pnt=require("paint") ---Modules -------------------------------------------------------------- -local infoCanvas=gc.newCanvas(108,27) -local function updatePowerInfo() - local state,pow=sys.getPowerInfo() - gc.setCanvas(infoCanvas)gc.push("transform")gc.origin() - gc.clear(0,0,0,.25) - if state~="unknown"then - gc.setLineWidth(4) - local charging=state=="charging" - if state=="nobattery"then - gc.setColor(1,1,1) - gc.setLineWidth(2) - gc.line(74,5,100,22) - elseif pow then - if charging then gc.setColor(0,1,0) - elseif pow>50 then gc.setColor(1,1,1) - elseif pow>26 then gc.setColor(1,1,0) - elseif pow<26 then gc.setColor(1,0,0) - else gc.setColor(.5,0,1) - end - gc.rectangle("fill",76,6,pow*.22,14) - if pow<100 then - setFont(14) - gc.setColor(0,0,0) - gc.print(pow,77,2) - gc.print(pow,77,4) - gc.print(pow,79,2) - gc.print(pow,79,4) - gc.setColor(1,1,1) - gc.print(pow,78,3) - end - end - gc.draw(batteryImage,73,3) - end - setFont(25) - gc.print(os.date("%H:%M",os.time()),3,-5) - gc.pop()gc.setCanvas() -end -local function onVirtualkey(x,y) - local dist,nearest=1e10 - for K=1,#virtualkey do - local b=virtualkey[K] - if b.ava then - local d1=(x-b.x)^2+(y-b.y)^2 - if d10 then - if floatWheel<0 then floatWheel=0 end - floatWheel=floatWheel+y^1.2 - elseif y<0 then - if floatWheel>0 then floatWheel=0 end - floatWheel=floatWheel-(-y)^1.2 - end - while floatWheel>=1 do - love.keypressed("up") - floatWheel=floatWheel-1 - end - while floatWheel<=-1 do - love.keypressed("down") - floatWheel=floatWheel+1 - end -end -local mouseClick,touchClick={},{} -local mouseDown,mouseMove,mouseUp,wheelMoved={},{},{},{} -local touchDown,touchUp,touchMove={},{},{} -local keyDown,keyUp={},{} -local gamepadDown,gamepadUp={},{} +require("callback") -function keyDown.load(k) - if k=="s"then - marking=nil - sceneTemp.skip=true - end -end -function touchDown.load() - if #tc.getTouches()>2 then - sceneTemp.skip=true - end -end - -function mouseDown.intro(x,y,k) - if k==2 then - VOC.play("bye") - SCN.back() - else - SCN.push() - SCN.swapTo("main") - end -end -function touchDown.intro(id,x,y) - SCN.push() - SCN.swapTo("main") -end -function keyDown.intro(key) - if key=="escape"then - VOC.play("bye") - SCN.back() - else - SCN.push() - SCN.swapTo("main") - end -end - -local function onMode(x,y) - local cam=mapCam - x=(cam.x1-640+x)/cam.k1 - y=(cam.y1-360+y)/cam.k1 - local MM,R=modes,modeRanks - for _=1,#MM do - if R[_]then - local M=MM[_] - local s=M.size - if M.shape==1 then - if x>M.x-s and xM.y-s and y1.5 then k=1.5 - elseif k<.3 then k=.3 - end - t=k/t - if cam.sel then - cam.x=(cam.x-180)*t+180;cam.y=cam.y*t - else - cam.x=cam.x*t;cam.y=cam.y*t - end - cam.k=k - cam.keyCtrl=false -end -function mouseMove.mode(x,y,dx,dy) - if ms.isDown(1)then - mapCam.x,mapCam.y=mapCam.x-dx,mapCam.y-dy - end - mapCam.keyCtrl=false -end -function mouseClick.mode(x,y,k) - local cam=mapCam - local _=cam.sel - if not cam.sel or x<920 then - local __=onMode(x,y) - if _~=__ then - if __ then - SFX.play("click") - cam.moving=true - _=modes[__] - cam.x=_.x*cam.k+180 - cam.y=_.y*cam.k - cam.sel=__ - else - cam.sel=nil - cam.x=cam.x-180 - end - end - end - cam.keyCtrl=false -end -function touchMove.mode(id,x,y,dx,dy) - local L=tc.getTouches() - if not L[2]then - 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]))--dx,dy not Δ! - local d=(x-dx)^2+(y-dy)^2 - if d>100 then - d=d^.5 - if touchDist then - wheelMoved.mode(nil,(d-touchDist)*.02) - end - touchDist=d - end - end - mapCam.keyCtrl=false -end -function touchClick.mode(x,y,id) - mouseClick.mode(x,y,1) -end -function keyDown.mode(key) - if key=="return"then - if mapCam.sel then - mapCam.keyCtrl=false - SCN.push()loadGame(mapCam.sel) - end - elseif key=="escape"then - if mapCam.sel then - mapCam.sel=nil - else - SCN.back() - end - elseif mapCam.sel==71 or mapCam.sel==72 then - if key=="q"then - SCN.push()SCN.swapTo("draw") - elseif key=="e"then - SCN.push()SCN.swapTo("custom") - end - end -end - -function wheelMoved.music(x,y) - if y>0 then - keyDown.music("up") - elseif y<0 then - keyDown.music("down") - end -end -function keyDown.music(key) - if key=="down"then - sceneTemp=sceneTemp%#musicID+1 - elseif key=="up"then - sceneTemp=(sceneTemp-2)%#musicID+1 - elseif key=="return"or key=="space"then - if BGM.nowPlay~=musicID[sceneTemp]then - SFX.play("click") - BGM.play(musicID[sceneTemp]) - else - BGM.stop() - end - elseif key=="escape"then - SCN.back() - end -end - -function keyDown.custom(key) - local sel=sceneTemp - if key=="left"then - customSel[sel]=(customSel[sel]-2)%#customRange[customID[sel]]+1 - if sel==12 then - BG.set(customRange.bg[customSel[12]]) - elseif sel==13 then - BGM.play(customRange.bgm[customSel[13]]) - end - elseif key=="right"then - customSel[sel]=customSel[sel]%#customRange[customID[sel]]+1 - if sel==12 then - BG.set(customRange.bg[customSel[sel]]) - elseif sel==13 then - BGM.play(customRange.bgm[customSel[sel]]) - end - elseif key=="down"then - sceneTemp=sel%#customID+1 - elseif key=="up"then - sceneTemp=(sel-2)%#customID+1 - elseif key=="1"then - Widget.custom.set1.code() - elseif key=="2"then - Widget.custom.set2.code() - elseif key=="3"then - Widget.custom.set3.code() - elseif key=="4"then - Widget.custom.set4.code() - elseif key=="5"then - Widget.custom.set5.code() - elseif key=="escape"then - SCN.back() - end -end - -function mouseDown.draw(x,y,k) - mouseMove.draw(x,y) -end -function mouseMove.draw(x,y,dx,dy) - local sx,sy=int((x-200)/30)+1,20-int((y-60)/30) - if sx<1 or sx>10 then sx=nil end - if sy<1 or sy>20 then sy=nil end - sceneTemp.x,sceneTemp.y=sx,sy - if sx and sy and ms.isDown(1,2,3)then - preField[sy][sx]=ms.isDown(1)and sceneTemp.pen or ms.isDown(2)and -1 or 0 - end -end -function wheelMoved.draw(x,y) - local pen=sceneTemp.pen - if y<0 then - pen=pen+1 - if pen==8 then pen=9 elseif pen==14 then pen=0 end - else - pen=pen-1 - if pen==8 then pen=7 elseif pen==-1 then pen=13 end - end - sceneTemp.pen=pen -end -function touchDown.draw(id,x,y) - mouseMove.draw(x,y) -end -function touchMove.draw(id,x,y,dx,dy) - local sx,sy=int((x-200)/30)+1,20-int((y-60)/30) - if sx<1 or sx>10 then sx=nil end - if sy<1 or sy>20 then sy=nil end - sceneTemp.x,sceneTemp.y=sx,sy - if sx and sy then - preField[sy][sx]=sceneTemp.pen - end -end -local penKey={ - q=1,w=2,e=3,r=4,t=5,y=6,u=7,i=8,o=9,p=10,["["]=11, - a=12,s=13,d=14,f=15,g=16,h=17, - z=0,x=-1, -} -function keyDown.draw(key) - local sx,sy,pen=sceneTemp.x,sceneTemp.y,sceneTemp.pen - if key=="up"or key=="down"or key=="left"or key=="right"then - if not sx then sx=1 end - if not sy then sy=1 end - if key=="up"and sy<20 then sy=sy+1 - elseif key=="down"and sy>1 then sy=sy-1 - elseif key=="left"and sx>1 then sx=sx-1 - elseif key=="right"and sx<10 then sx=sx+1 - end - if kb.isDown("space")then - preField[sy][sx]=pen - end - elseif key=="delete"then - if sceneTemp.sure>20 then - for y=1,20 do for x=1,10 do preField[y][x]=0 end end - sceneTemp.sure=0 - else - sceneTemp.sure=50 - end - elseif key=="space"then - if sx and sy then - preField[sy][sx]=pen - end - 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() - else - pen=penKey[key]or pen - end - sceneTemp.x,sceneTemp.y,sceneTemp.pen=sx,sy,pen -end - -function mouseDown.setting_sound(x,y,k) - if x>780 and x<980 and y>470 and sceneTemp.jump==0 then - sceneTemp.jump=10 - local t=Timer()-sceneTemp.last - if t>1 then - VOC.play((t<1.5 or t>15)and"doubt"or rnd()<.8 and"happy"or"egg") - sceneTemp.last=Timer() - if rnd()<.0626 then - for i=1,#modes do - local M=modes[i] - for i=1,#M.unlock do - local m=M.unlock[i] - if not modeRanks[m]then - modeRanks[m]=modes[m].score and 0 or 6 - end - end - end - FILE.saveUnlock() - TEXT.show("DEVMODE:UNLOCKALL",640,360,50,"stretch",.6) - end - end - end -end -function touchDown.setting_sound(id,x,y) - mouseDown.setting_sound(x,y) -end - -function keyDown.setting_key(key) - local s=sceneTemp - if key=="escape"then - if s.kS then - s.kS=false - SFX.play("finesseError",.5) - else - SCN.back() - end - elseif s.kS then - for l=1,8 do - for y=1,20 do - if keyMap[l][y]==key then - keyMap[l][y]="" - goto L - end - end - end - ::L:: - keyMap[s.board][s.kb]=key - SFX.play("reach",.5) - s.kS=false - elseif key=="return"then - s.kS=true - SFX.play("lock",.5) - elseif key=="up"then - if s.kb>1 then - s.kb=s.kb-1 - SFX.play("move",.5) - end - elseif key=="down"then - if s.kb<20 then - s.kb=s.kb+1 - SFX.play("move",.5) - end - elseif key=="left"then - if s.board>1 then - s.board=s.board-1 - SFX.play("rotate",.5) - end - elseif key=="right"then - if s.board<8 then - s.board=s.board+1 - SFX.play("rotate",.5) - end - end -end -function gamepadDown.setting_key(key) - local s=sceneTemp - if key=="back"then - if s.jS then - s.jS=false - SFX.play("finesseError",.5) - else - SCN.back() - end - elseif s.jS then - for l=9,16 do - for y=1,20 do - if keyMap[l][y]==key then - keyMap[l][y]="" - goto L - end - end - end - ::L:: - keyMap[8+s.board][s.js]=key - SFX.play("reach",.5) - s.jS=false - elseif key=="start"then - s.jS=true - SFX.play("lock",.5) - elseif key=="dpup"then - if s.js>1 then - s.js=s.js-1 - SFX.play("move",.5) - end - elseif key=="dpdown"then - if s.js<20 then - s.js=s.js+1 - SFX.play("move",.5) - end - elseif key=="dpleft"then - if s.board>1 then - s.board=s.board-1 - SFX.play("rotate",.5) - end - elseif key=="dpright"then - if s.board<8 then - s.board=s.board+1 - SFX.play("rotate",.5) - end - end -end - -function mouseDown.setting_touch(x,y,k) - if k==2 then SCN.back()end - sceneTemp.sel=onVK_org(x,y)or sceneTemp.sel -end -function mouseMove.setting_touch(x,y,dx,dy) - if sceneTemp.sel and ms.isDown(1)and not widget_sel then - local B=VK_org[sceneTemp.sel] - B.x,B.y=B.x+dx,B.y+dy - end -end -function mouseUp.setting_touch(x,y,k) - if sceneTemp.sel then - local B=VK_org[sceneTemp.sel] - local k=snapLevelValue[sceneTemp.snap] - B.x,B.y=int(B.x/k+.5)*k,int(B.y/k+.5)*k - end -end -function touchDown.setting_touch(id,x,y) - sceneTemp.sel=onVK_org(x,y)or sceneTemp.sel -end -function touchUp.setting_touch(id,x,y) - if sceneTemp.sel then - local B=VK_org[sceneTemp.sel] - local k=snapLevelValue[sceneTemp.snap] - B.x,B.y=int(B.x/k+.5)*k,int(B.y/k+.5)*k - end -end -function touchMove.setting_touch(id,x,y,dx,dy) - if sceneTemp.sel and not widget_sel then - local B=VK_org[sceneTemp.sel] - B.x,B.y=B.x+dx,B.y+dy - end -end - -function keyDown.pause(key) - if key=="escape"then - SCN.back() - elseif key=="space"then - resumeGame() - elseif key=="s"then - SCN.push() - SCN.swapTo("setting_sound") - elseif key=="r"then - TASK.clear("play") - mergeStat(stat,players[1].stat) - resetGameData() - 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.VKSound then - SFX.play("virtualKey") - end - virtualkey[t].isDown=true - virtualkey[t].pressTime=10 - if setting.VKTrack then - local B=virtualkey[t] - if setting.VKDodge then--按钮软碰撞(做不来hhh随便做一个,效果还行!) - 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--碰撞深度(负数=间隔距离) - if d>0 then - b.x=b.x+(b.x-B.x)*d*b.r*.00005 - b.y=b.y+(b.y-B.y)*d*b.r*.00005 - end - end - end - local O=VK_org[t] - local _FW,_CW=setting.VKTchW*.1,1-setting.VKCurW*.1 - local _OW=1-_FW-_CW - --按钮自动跟随:手指位置,当前位置,原始位置,权重取决于设置 - B.x,B.y=x*_FW+B.x*_CW+O.x*_OW,y*_FW+B.y*_CW+O.y*_OW - end - VIB(0) - end - 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 - 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 nextButton - end - end - players[1]:releaseKey(n) - ::nextButton:: - end - end -end -function keyDown.play(key) - if key=="escape"then - pauseGame() - return - end - local m=keyMap - for p=1,players.human do - for k=1,20 do - if key==m[2*p-1][k]or key==m[2*p][k]then - players[p]:pressKey(k) - if p==1 then - virtualkey[k].isDown=true - virtualkey[k].pressTime=10 - end - return - end - end - end -end -function keyUp.play(key) - local m=keyMap - for p=1,players.human do - for k=1,20 do - if key==m[2*p-1][k]or key==m[2*p][k]then - players[p]:releaseKey(k) - if p==1 then virtualkey[k].isDown=false end - return - end - end - end -end -function gamepadDown.play(key) - if key=="back"then SCN.back()return end - local m=keyMap - for p=1,players.human do - for k=1,20 do - if key==m[2*p+7][k]or key==m[2*p+8][k]then - players[p]:pressKey(k) - if p==1 then - virtualkey[k].isDown=true - virtualkey[k].pressTime=10 - end - return - end - end - end -end -function gamepadUp.play(key) - local m=keyMap - for p=1,players.human do - for k=1,20 do - if key==m[2*p+7][k]or key==m[2*p+8][k]then - players[p]:releaseKey(k) - if p==1 then virtualkey[k].isDown=false end - return - end - end - end -end - -function touchDown.help(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 - marking=nil - SFX.play("reach") - 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]-3,1) - elseif key=="down"then - sceneTemp[2]=min(sceneTemp[2]+3,#sceneTemp[1]-22) - elseif key=="escape"then - SCN.back() - end -end -------------------------------------------------------------- -local function widgetPress(W,x,y) - if W.type=="button"then - W.code() - W:FX() - SFX.play("button") - VOC.play("nya") - elseif W.type=="switch"then - W.code() - SFX.play("move",.6) - elseif W.type=="slider"then - if not x then return end - local p,P=W.disp(),xW.x+W.w and W.unit or int((x-W.x)*W.unit/W.w+.5) - if p==P then return end - W.code(P) - if W.change then W.change()end - end - if W.hide and W.hide()then widget_sel=nil end -end -local function widgetDrag(W,x,y,dx,dy) - if W.type=="slider"then - local p,P=W.disp(),xW.x+W.w and W.unit or int((x-W.x)*W.unit/W.w+.5) - if p==P then return end - W.code(P) - if W.change then W.change()end - elseif not W:isAbove(x,y)then - widget_sel=nil - end -end -local function widgetControl_key(i) - if i=="tab"then - if widget_sel then - widget_sel=kb.isDown("lshift")and widget_sel.prev or widget_sel.next or widget_sel - else - widget_sel=select(2,next(Widget[SCN.cur])) - end - elseif i=="space"or i=="return"then - if widget_sel then - widgetPress(widget_sel) - end - elseif i=="left"or i=="right"then - if widget_sel then - local W=widget_sel - if W.type=="slider"then - local p=W.disp() - local P=i=="left"and(p>0 and p-1)or p0 and p-1)or p=.5625 then - scr.k=w/1280 - scr.x,scr.y=0,(h-w*9/16)*.5 - else - scr.k=h/720 - scr.x,scr.y=(w-h*16/9)*.5,0 - end - xOy=xOy:setTransformation(w*.5,h*.5,nil,scr.k,nil,640,360) - BG.resize(w,h) -end -function love.focus(f) - if SCN.cur=="play"and not f 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} -local devColor={ - color.white, - color.lightMagenta, - color.lightGreen, - color.lightBlue, -} -local FPS=love.timer.getFPS -love.draw,love.update=nil -function love.run() - local T=love.timer - local STEP,GETΔ,WAIT=T.step,T.getDelta,T.sleep - local lastFrame=T.getTime() - local lastFreshPow=lastFrame - local FCT=0--framedraw counter - local mini=love.window.isMinimized - local PUMP,POLL=love.event.pump,love.event.poll - love.resize(gc.getWidth(),gc.getHeight()) - SCN.init("load")--Scene Launch - marking=true - return function() - --EVENT - PUMP() - for N,a,b,c,d,e in POLL()do - if love[N]then - love[N](a,b,c,d,e) - elseif N=="quit"then - destroyPlayers() - return 1 - end - end - - --UPDATE - STEP()local dt=GETΔ() - TASK.update() - VOC.update() - BG.update(dt) - sysFX.update(dt) - TEXT.update(texts) - local _=Tmr[SCN.cur]if _ then _(dt)end - if SCN.swapping then SCN.swapUpdate()end - for _,W in next,Widget[SCN.cur]do - W:update() - end--更新控件 - - --DRAW - if not mini()then - FCT=FCT+setting.frameMul - if FCT>=100 then - FCT=FCT-100 - gc.discard()--SPEED UPUPUP! - - BG.draw() - gc.push("transform") - gc.replaceTransform(xOy) - if Pnt[SCN.cur]then Pnt[SCN.cur]()end - for k,W in next,Widget[SCN.cur]do - if not(W.hide and W.hide())then - W:draw() - end - end--Draw widgets - if mouseShow then - local r=Timer()*.5 - 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(miniBlock[R],mx,my,Timer()%3.1416*4,20,20,scs[2*R]-.5,#blocks[R][0]-scs[2*R-1]+.5) - gc.setColor(1,1,1,.5)gc.circle("fill",mx,my,5) - gc.setColor(1,1,1)gc.circle("fill",mx,my,3) - end--Awesome mouse! - sysFX.draw() - for i=1,#texts do - local t=texts[i] - local p=t.c - gc.setColor(1,1,1,p<.2 and p*5 or p<.8 and 1 or 5-p*5) - setFont(t.font) - t:draw() - end--Floating Texts - gc.pop() - - gc.setColor(1,1,1) - gc.draw(infoCanvas,0,0,0,scr.k) - --Power Info - - if SCN.swapping then - _=SCN.swap - _.draw(_.time) - end--Scene swapping animation - - setFont(15) - gc.setColor(1,1,1) - _=scr.h-20 - gc.print(FPS(),5,_) - if devMode then - gc.setColor(devColor[devMode]) - gc.print("Cache used:"..gcinfo(),5,_-20) - gc.print("Free Row:"..freeRow.getCount(),5,_-40) - gc.print("Mouse:"..mx.." "..my,5,_-60) - gc.print("Voices:"..VOC.getCount(),5,_-80) - gc.print("Tasks:"..TASK.getCount(),5,_-100) - if devMode==3 then love.timer.sleep(.26) - elseif devMode==4 then love.timer.sleep(.626) - end - end--DEV info - - gc.present() - end - end - - --FRAME TIME CTRL - if Timer()-lastFrame<.058 then WAIT(.01)end - while Timer()-lastFrame<.0159 do WAIT(.001)end - - --FRESH POWER - lastFrame=Timer() - if Timer()-lastFreshPow>1 then - updatePowerInfo() - lastFreshPow=Timer() - end - end -end -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},{.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 --------------------------------------------------------------Reset data relied on setting +--load files & settings +local fs=love.filesystem if fs.getInfo("keymap.dat")then fs.remove("keymap.dat")end if fs.getInfo("setting.dat")then FILE.loadSetting() diff --git a/modes/round_2.lua b/modes/round_2.lua index 539da646..f3b28b09 100644 --- a/modes/round_2.lua +++ b/modes/round_2.lua @@ -32,10 +32,10 @@ return{ if P.result=="WIN"then local T=P.stat.piece return - T<=30 and 5 or - T<=40 and 4 or - T<=55 and 3 or - T<=70 and 2 or + T<=23 and 5 or + T<=26 and 4 or + T<=40 and 3 or + T<=60 and 2 or 1 end end, diff --git a/modes/round_3.lua b/modes/round_3.lua index 90038a3c..c733bd08 100644 --- a/modes/round_3.lua +++ b/modes/round_3.lua @@ -32,10 +32,10 @@ return{ if P.result=="WIN"then local T=P.stat.piece return - T<=35 and 5 or - T<=45 and 4 or - T<=65 and 3 or - T<=85 and 2 or + T<=30 and 5 or + T<=40 and 4 or + T<=55 and 3 or + T<=75 and 2 or 1 end end, diff --git a/modes/round_4.lua b/modes/round_4.lua index 582d65c5..ef5cad8a 100644 --- a/modes/round_4.lua +++ b/modes/round_4.lua @@ -32,10 +32,10 @@ return{ if P.result=="WIN"then local T=P.stat.piece return - T<=40 and 5 or - T<=50 and 4 or - T<=75 and 3 or - T<=100 and 2 or + T<=30 and 5 or + T<=40 and 4 or + T<=55 and 3 or + T<=75 and 2 or 1 end end, diff --git a/modes/round_5.lua b/modes/round_5.lua index b405aaaf..71265fdf 100644 --- a/modes/round_5.lua +++ b/modes/round_5.lua @@ -32,10 +32,10 @@ return{ if P.result=="WIN"then local T=P.stat.piece return - T<=50 and 5 or - T<=60 and 4 or - T<=80 and 3 or - T<=100 and 2 or + T<=30 and 5 or + T<=40 and 4 or + T<=55 and 3 or + T<=75 and 2 or 1 end end, diff --git a/modes/solo_1.lua b/modes/solo_1.lua index bc90f177..14f2af0e 100644 --- a/modes/solo_1.lua +++ b/modes/solo_1.lua @@ -19,10 +19,10 @@ return{ if P.result=="WIN"then local T=P.stat.time return - T<=15 and 5 or + T<=20 and 5 or T<=25 and 4 or - T<=40 and 3 or - T<=80 and 2 or + T<=35 and 3 or + T<=60 and 2 or 1 end end, diff --git a/modes/solo_2.lua b/modes/solo_2.lua index cc9ca351..144df766 100644 --- a/modes/solo_2.lua +++ b/modes/solo_2.lua @@ -19,10 +19,10 @@ return{ if P.result=="WIN"then local T=P.stat.time return - T<=16 and 5 or - T<=28 and 4 or - T<=45 and 3 or - T<=90 and 2 or + T<=20 and 5 or + T<=25 and 4 or + T<=40 and 3 or + T<=62 and 2 or 1 end end, diff --git a/modes/solo_3.lua b/modes/solo_3.lua index 5ea899b7..6ee0d1f0 100644 --- a/modes/solo_3.lua +++ b/modes/solo_3.lua @@ -19,9 +19,9 @@ return{ if P.result=="WIN"then local T=P.stat.time return - T<=17 and 5 or - T<=26 and 4 or - T<=45 and 3 or + T<=20 and 5 or + T<=25 and 4 or + T<=35 and 3 or T<=60 and 2 or 1 end diff --git a/modes/solo_4.lua b/modes/solo_4.lua index aa98d28a..09d7cf82 100644 --- a/modes/solo_4.lua +++ b/modes/solo_4.lua @@ -19,10 +19,10 @@ return{ if P.result=="WIN"then local T=P.stat.time return - T<=18 and 5 or - T<=30 and 4 or - T<=50 and 3 or - T<=70 and 2 or + T<=20 and 5 or + T<=25 and 4 or + T<=35 and 3 or + T<=60 and 2 or 1 end end, diff --git a/modes/solo_5.lua b/modes/solo_5.lua index 35b02fb6..c0252c2c 100644 --- a/modes/solo_5.lua +++ b/modes/solo_5.lua @@ -20,8 +20,8 @@ return{ local T=P.stat.time return T<=20 and 5 or - T<=30 and 4 or - T<=45 and 3 or + T<=25 and 4 or + T<=35 and 3 or T<=60 and 2 or 1 end diff --git a/modes/sprint_100.lua b/modes/sprint_100.lua index a5da9827..ae02ceee 100644 --- a/modes/sprint_100.lua +++ b/modes/sprint_100.lua @@ -33,7 +33,7 @@ return{ T<=90 and 4 or T<=130 and 3 or T<=200 and 2 or - T<=270 and 1 or + T<=360 and 1 or 0 end, } \ No newline at end of file diff --git a/modes/sprint_1000.lua b/modes/sprint_1000.lua index 0a2897b8..82e50ed9 100644 --- a/modes/sprint_1000.lua +++ b/modes/sprint_1000.lua @@ -32,8 +32,8 @@ return{ T<=626 and 5 or T<=1000 and 4 or T<=1400 and 3 or - T<=2200 and 2 or - T<=3000 and 1 or + T<=2260 and 2 or + T<=3260 and 1 or 0 end, } \ No newline at end of file diff --git a/modes/sprint_20.lua b/modes/sprint_20.lua index fc538106..ba3e87da 100644 --- a/modes/sprint_20.lua +++ b/modes/sprint_20.lua @@ -31,8 +31,8 @@ return{ return T<=13 and 5 or T<=18 and 4 or - T<=45 and 3 or - T<=80 and 2 or + T<=32.6 and 3 or + T<=62.6 and 2 or T<=126 and 1 or 0 end, diff --git a/modes/sprint_40.lua b/modes/sprint_40.lua index 0d07ffd3..d1c1226d 100644 --- a/modes/sprint_40.lua +++ b/modes/sprint_40.lua @@ -31,8 +31,8 @@ return{ return T<=26 and 5 or T<=32.6 and 4 or - T<=40 and 3 or - T<=62 and 2 or + T<=52.6 and 3 or + T<=92.9 and 2 or T<=183 and 1 or 0 end, diff --git a/modes/sprint_400.lua b/modes/sprint_400.lua index 139b8f19..36739f08 100644 --- a/modes/sprint_400.lua +++ b/modes/sprint_400.lua @@ -29,11 +29,11 @@ return{ if P.stat.row<400 then return end local T=P.stat.time return - T<=255 and 5 or - T<=330 and 4 or - T<=420 and 3 or - T<=626 and 2 or - T<=1000 and 1 or + T<=62,255 and 5 or + T<=90,326 and 4 or + T<=130,462 and 3 or + T<=200,626 and 2 or + T<=360,1260 and 1 or 0 end, } \ No newline at end of file diff --git a/paint.lua b/paint.lua index 9f77029a..03b08270 100644 --- a/paint.lua +++ b/paint.lua @@ -338,7 +338,7 @@ function Pnt.draw() local pen=sceneTemp.pen if pen>0 then gc.setLineWidth(13) - gc.setColor(skin.libColor[pen]) + gc.setColor(SKIN.libColor[pen]) gc.rectangle("line",565,460,70,70) elseif pen==-1 then gc.setLineWidth(5) @@ -354,7 +354,7 @@ function Pnt.draw() local _ for i=1,7 do _=setting.skin[i] - gc.setColor(skin.libColor[_]) + gc.setColor(SKIN.libColor[_]) mStr(text.block[i],500+65*_,65) end end @@ -434,7 +434,7 @@ function Pnt.pause() if T<1 or gameResult then Pnt.play()end --Dark BG local _=T - if gameResult then _=_*.6 end + if gameResult then _=_*.7 end gc.setColor(.15,.15,.15,_) gc.push("transform") gc.origin() @@ -689,7 +689,7 @@ end function Pnt.stat() local chart=sceneTemp.chart setFont(24) - local _,__=skin.libColor,setting.skin + local _,__=SKIN.libColor,setting.skin local A,B=chart.A1,chart.A2 for x=1,7 do gc.setColor(_[__[x]]) diff --git a/parts/ai.lua b/parts/ai.lua index c241046a..6deff192 100644 --- a/parts/ai.lua +++ b/parts/ai.lua @@ -19,64 +19,64 @@ 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}} -------------------------------------------------Cold clear local CCblockID={4,3,5,6,1,2,0} -if system~="Windows"then goto SKIP end -require("CCloader") -BOT={ - getConf= cc.get_default_config ,--()options,weights - --setConf= cc.set_options ,--(options,hold,20g,bag7) +if system=="Windows"then + require("CCloader") + BOT={ + getConf= cc.get_default_config ,--()options,weights + --setConf= cc.set_options ,--(options,hold,20g,bag7) - new= cc.launch_async ,--(options,weights)bot - addNext= cc.add_next_piece_async ,--(bot,piece) - update= cc.reset_async ,--(bot,field,b2b,combo) - think= cc.request_next_move ,--(bot) - getMove= cc.poll_next_move ,--(bot)success,hold,move - ifDead= cc.is_dead_async ,--(bot)dead - destroy= cc.destroy_async ,--(bot) + new= cc.launch_async ,--(options,weights)bot + addNext= cc.add_next_piece_async ,--(bot,piece) + update= cc.reset_async ,--(bot,field,b2b,combo) + think= cc.request_next_move ,--(bot) + getMove= cc.poll_next_move ,--(bot)success,hold,move + ifDead= cc.is_dead_async ,--(bot)dead + destroy= cc.destroy_async ,--(bot) - setHold= cc.set_hold ,--(opt,bool) - set20G= cc.set_20g ,--(opt,bool) - setBag= cc.set_bag7 ,--(opt,bool) - setNode= cc.set_max_nodes ,--(opt,bool) - free= cc.free ,--(opt/wei) -} -function CC_updateField(P) - local F,i={},1 - for y=1,#P.field do - for x=1,10 do - F[i],i=P.field[y][x]>0,i+1 + setHold= cc.set_hold ,--(opt,bool) + set20G= cc.set_20g ,--(opt,bool) + setBag= cc.set_bag7 ,--(opt,bool) + setNode= cc.set_max_nodes ,--(opt,bool) + free= cc.free ,--(opt/wei) + } + function CC_updateField(P) + local F,i={},1 + for y=1,#P.field do + for x=1,10 do + F[i],i=P.field[y][x]>0,i+1 + end end + while i<400 do + F[i],i=false,i+1 + end + BOT.update(P.AI_bot,F,P.b2b>=100,P.combo) end - while i<400 do - F[i],i=false,i+1 - end - BOT.update(P.AI_bot,F,P.b2b>=100,P.combo) -end -function CC_switch20G(P) - P.AIdata._20G=true - P.AI_keys={} - BOT.destroy(P.AI_bot) - local opt,wei=BOT.getConf() - BOT.setHold(opt,P.AIdata.hold) - BOT.set20G(opt,P.AIdata._20G) - BOT.setBag(opt,P.AIdata.bag7) - BOT.setNode(opt,P.AIdata.node) - P.AI_bot=BOT.new(opt,wei) - BOT.free(opt)BOT.free(wei) - for i=1,P.AIdata.next do - BOT.addNext(P.AI_bot,CCblockID[P.next[i].id]) - end - CC_updateField(P) - P.hd={bk={{}},id=0,color=0,name=0}P.holded=false - P.cur=rem(P.next,1) - P.sc,P.dir=scs[P.cur.id],0 - P.r,P.c=#P.cur.bk,#P.cur.bk[1] - P.curX,P.curY=blockPos[P.cur.id],21+ceil(P.fieldBeneath/30)-P.r+min(int(#P.field*.2),2) + function CC_switch20G(P) + P.AIdata._20G=true + P.AI_keys={} + BOT.destroy(P.AI_bot) + local opt,wei=BOT.getConf() + BOT.setHold(opt,P.AIdata.hold) + BOT.set20G(opt,P.AIdata._20G) + BOT.setBag(opt,P.AIdata.bag7) + BOT.setNode(opt,P.AIdata.node) + P.AI_bot=BOT.new(opt,wei) + BOT.free(opt)BOT.free(wei) + for i=1,P.AIdata.next do + BOT.addNext(P.AI_bot,CCblockID[P.next[i].id]) + end + CC_updateField(P) + P.hd={bk={{}},id=0,color=0,name=0}P.holded=false + P.cur=rem(P.next,1) + P.sc,P.dir=scs[P.cur.id],0 + P.r,P.c=#P.cur.bk,#P.cur.bk[1] + P.curX,P.curY=blockPos[P.cur.id],21+ceil(P.fieldBeneath/30)-P.r+min(int(#P.field*.2),2) - P:newNext() - BOT.addNext(P.AI_bot,CCblockID[P.next[P.AIdata.next].id]) - collectgarbage() + P:newNext() + BOT.addNext(P.AI_bot,CCblockID[P.next[P.AIdata.next].id]) + collectgarbage() + end end -::SKIP:: -------------------------------------------------⑨Stack setup local dirCount={1,1,3,3,3,0,1} local spinOffset={ @@ -231,10 +231,8 @@ AI_think={ end end - ::L:: - if #Tfield>0 then + while #Tfield>0 do freeRow.discard(rem(Tfield,1)) - goto L end--Release cache local p=#ctrl+1 if best.hold then diff --git a/parts/bg.lua b/parts/bg.lua index bec61b34..1b3c4db0 100644 --- a/parts/bg.lua +++ b/parts/bg.lua @@ -3,7 +3,6 @@ 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 scr=scr - local BGinit,BGresize,BGupdate,BGdraw,BGdiscard={},{},{},{},{} local BGvars={_G=_G} @@ -136,7 +135,7 @@ end--Lightning function BGinit.game6() t=0 - colorLib=_G.skin.libColor + colorLib=_G.SKIN.libColor colorSet=_G.setting.skin miniBlock=_G.miniBlock end @@ -180,34 +179,37 @@ end function BGinit.space() stars={} for i=1,2600,5 do - local s=0.75*2^(rnd()*1.5) + local s=rnd(4) stars[i]=s --size - stars[i+1]=rnd(W) --x - stars[i+2]=rnd(H) --y + stars[i+1]=rnd(W)-10 --x + stars[i+2]=rnd(H)-10 --y stars[i+3]=(rnd()-.5)*.01*s --vx stars[i+4]=(rnd()-.5)*.01*s --vy end--800 var end function BGresize.space(w,h) - W,H=w+100,h+100 + W,H=w+20,h+20 + BGinit.space() end function BGupdate.space(dt) + local s=stars for i=1,2600,5 do - stars[i+1]=(stars[i+1]+stars[i+3])%W - stars[i+2]=(stars[i+2]+stars[i+4])%H + s[i+1]=(s[i+1]+s[i+3])%W + s[i+2]=(s[i+2]+s[i+4])%H end--star moving end - function BGdraw.space() gc.clear(.2,.2,.2) if not stars[1]then return end - gc.translate(-50,-50) + gc.translate(-10,-10) gc.setColor(.8,.8,.8) for i=1,2600,5 do - local x,y=stars[i+1],stars[i+2] - gc.circle("fill",x,y,stars[i]) + local s=stars + local x,y=s[i+1],s[i+2] + s=s[i] + gc.rectangle("fill",x,y,s,s) end - gc.translate(50,50) + gc.translate(10,10) end function BGdiscard.space() stars={} diff --git a/parts/bgm.lua b/parts/bgm.lua index 29074b21..ec9f3bdd 100644 --- a/parts/bgm.lua +++ b/parts/bgm.lua @@ -23,6 +23,7 @@ function BGM.loadAll() end function BGM.play(s) if setting.bgm==0 then + BGM.playing=BGM.list[s] BGM.suspend,BGM.nowPlay=s return elseif not s then diff --git a/file.lua b/parts/file.lua similarity index 100% rename from file.lua rename to parts/file.lua diff --git a/parts/languages.lua b/parts/languages.lua index f7e56031..e440e797 100644 --- a/parts/languages.lua +++ b/parts/languages.lua @@ -2,6 +2,7 @@ local langList={ { anykey="按任意键继续", newVersion="检测到更新!存档格式可能更新", + marking="游戏作者:MrZ_26\n出现此水印则为非法录屏上传", lang="中文", atkModeName={"随机","徽章","击杀","反击"}, royale_remain=function(n)return"剩余 "..n.." 名玩家"end, @@ -146,10 +147,10 @@ local langList={ "使用LOVE2D引擎", "作者:MrZ 邮箱:1046101471@qq.com", "程序:MrZ 美术:MrZ 音乐:MrZ 音效:MrZ 语音:MrZ/Miya", - "特别感谢:Flyz,Farter,196,Teatube,T830,[所有内测人员]和 你!", + "特别感谢:Flyz,Farter,196,Teatube,[所有内测人员]和 你!", "", "错误或者建议请附带截图发送到内测群或者作者邮箱~", - "仅通过唯一内测群1057456078进行免费下载/更新", + "仅通过唯一内测群822023725进行免费下载/更新", "其他渠道获得游戏皆有被修改/植入病毒的风险,程序只申请了震动&联网权限!", "若由于被修改的本游戏产生的各种损失作者不负责(我怎么负责啊跟我有啥关系)", "请从正规途径获得最新版,游戏现为免费,不过有打赏当然感谢啦~", @@ -305,7 +306,8 @@ local langList={ pro="专业", hide="显示虚拟按键", track="按键自动跟踪", - sound="按键音效", + sfx="按键音效", + vib="按键震动", icon="图标", tkset="跟踪设置", alpha="透明度", @@ -411,6 +413,7 @@ local langList={ { anykey="按任意键继续", newVersion="检测到更新!存档格式可能更新", + marking="游戏作者:MrZ_26\n出现此水印则为非法录屏上传", lang="全中文", atkModeName={"随机","徽章","击杀","反击"}, royale_remain=function(n)return"剩余 "..n.." 名玩家"end, @@ -465,7 +468,7 @@ local langList={ freshLimit={0,8,15,"∞"}, opponent={"无电脑","9S Lv1","9S Lv2","9S Lv3","9S Lv4","9S Lv5","CC Lv1","CC Lv2","CC Lv3","CC Lv4","CC Lv5","CC Lv6"}, }, - snapLevelName={"无吸附","10px吸附","20px吸附","40px吸附","60px吸附","80px吸附"}, + snapLevelName={"无吸附","10像素吸附","20像素吸附","40像素吸附","60像素吸附","80像素吸附"}, setting_game="游戏设置", setting_graphic="画面设置", setting_sound="声音设置", @@ -508,7 +511,7 @@ local langList={ "落在最左:","落在最右:","列在最左:","列在最右:", }, - load={[0]="加载完成","加载语音ing","加载音乐ing","加载音效ing","加载图片ing","加载模式ing","加载乱七八糟的东西ing"}, + load={[0]="加载完成","正在加载语音","正在加载音乐","正在加载音效","正在加载图片","正在加载模式","正在加载乱七八糟的东西"}, pauseStat={ "时间:", "按键/旋转/暂存:", @@ -553,10 +556,10 @@ local langList={ "使用LOVE2D引擎", "作者:MrZ 邮箱:1046101471@qq.com", "程序:MrZ 美术:MrZ 音乐:MrZ 音效:MrZ 语音:MrZ/Miya", - "特别感谢:Flyz,Farter,196,Teatube,T830,[所有内测人员]和 你!", + "特别感谢:Flyz,Farter,196,Teatube,[所有内测人员]和 你!", "", "错误或者建议请附带截图发送到内测群或者作者邮箱~", - "仅通过唯一内测群1057456078进行免费下载/更新", + "仅通过内测群822023725进行免费下载/更新", "其他渠道获得游戏皆有被修改/植入病毒的风险,程序只申请了震动&联网权限!", "若由于被修改的本游戏产生的各种损失作者不负责(我怎么负责啊跟我有啥关系)", "请从正规途径获得最新版,游戏现为免费,不过有打赏当然感谢啦~", @@ -711,7 +714,8 @@ local langList={ pro="专业", hide="显示虚拟按键", track="按键自动跟踪", - sound="按键音效", + sfx="按键音效", + vib="按键震动", icon="图标", tkset="跟踪设置", alpha="透明度", @@ -817,6 +821,7 @@ local langList={ { anykey="Any Key to Continue", newVersion="Updating detected! Saving format may changed", + marking="Author:MrZ_26\nIllegal recording if u see this", lang="English", atkModeName={"Random","Badges","K.O.s","Counters"}, royale_remain=function(n)return n.." Players Remain"end, @@ -956,10 +961,10 @@ local langList={ "Powered by LOVE2D", "Author:MrZ E-mail:1046101471@qq.com", "Program:MrZ Art:MrZ Music:MrZ SFX:MrZ VOICE:MrZ/Miya", - "Special thanks:Flyz,Farter,196,Teatube,T830,[all test staff] and YOU!", + "Special thanks:Flyz,Farter,196,Teatube,[all test staff] and YOU!", "", "Any bugs/suggestions to my E-mail.(may with screenshot)", - "Only released in test group for FREE", + "Only released in discord.gg/f9pUvkh for FREE", "Game downloaded from other way may implanted with virus", "Only network/vibrating permission applied", "Author is not responsible for any loss by edited game", @@ -1115,7 +1120,8 @@ local langList={ pro="Professioanl", hide="Show Virtual Key", track="Auto track", - sound="SFX", + sfx="SFX", + vib="VIB", icon="Icon", tkset="Track setting", alpha="Alpha", diff --git a/parts/light.lua b/parts/light.lua index a3c17a3b..e4c6f739 100644 --- a/parts/light.lua +++ b/parts/light.lua @@ -1,3 +1,4 @@ +do return end --LIGHT MODULE(Optimized by MrZ,Original on github/love2d community/simple-love-lights) --Heavily based on mattdesl's libGDX implementation: --https://github.com/mattdesl/lwjgl-basics/wiki/2D-Pixel-Perfect-Shadows diff --git a/parts/skin.lua b/parts/skin.lua index 7f1703ba..8d519621 100644 --- a/parts/skin.lua +++ b/parts/skin.lua @@ -19,10 +19,10 @@ local list={ "colored_bone(mrz)", "white_bone(mrz)", } -local skin={} -skin.lib={} -skin.libMini={} -skin.libColor={ +local SKIN={} +SKIN.lib={} +SKIN.libMini={} +SKIN.libColor={ color.red, color.orange, color.yellow, @@ -41,7 +41,7 @@ skin.libColor={ color.darkRed, color.darkGreen, } -function skin.load() +function SKIN.load() local _ gc.push() gc.origin() @@ -49,36 +49,36 @@ function skin.load() gc.setColor(1,1,1) for i=1,#list do local I=gc.newImage("/image/skin/"..list[i]..".png") - skin.lib[i],skin.libMini[i]={},{}--30/6 + SKIN.lib[i],SKIN.libMini[i]={},{}--30/6 for j=1,11 do - skin.lib[i][j]=C(30,30) + SKIN.lib[i][j]=C(30,30) gc.draw(I,30-30*j,0) - skin.libMini[i][j]=C(6,6) + SKIN.libMini[i][j]=C(6,6) gc.draw(I,6-6*j,0,nil,.2) end for j=1,6 do - skin.lib[i][11+j]=C(30,30) + SKIN.lib[i][11+j]=C(30,30) gc.draw(I,30-30*j,-30) - skin.libMini[i][11+j]=C(6,6) + SKIN.libMini[i][11+j]=C(6,6) gc.draw(I,6-6*j,-6,nil,.2) end I:release() end - skin.change(setting.skinSet) + SKIN.change(setting.skinSet) puzzleMark={} gc.setLineWidth(3) for i=1,11 do puzzleMark[i]=C(30,30) - _=skin.libColor[i] + _=SKIN.libColor[i] gc.setColor(_[1],_[2],_[3],.6) gc.rectangle("line",5,5,20,20) gc.rectangle("line",10,10,10,10) end for i=12,17 do puzzleMark[i]=C(30,30) - gc.setColor(skin.libColor[i]) + gc.setColor(SKIN.libColor[i]) gc.rectangle("line",7,7,16,16) end _=C(30,30) @@ -93,34 +93,34 @@ 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(_) + 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(_) + 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] - blockSkin=skin.lib[i] - blockSkinMini=skin.libMini[i] +function SKIN.change(i)--change to skin_set[i] + blockSkin=SKIN.lib[i] + blockSkinMini=SKIN.libMini[i] end -return skin \ No newline at end of file +return SKIN \ No newline at end of file diff --git a/parts/text.lua b/parts/text.lua index af210c78..51db7689 100644 --- a/parts/text.lua +++ b/parts/text.lua @@ -3,6 +3,8 @@ local rnd=math.random local mStr=mStr local rem=table.remove +local texts={} + local textFX={} function textFX.appear(t) mStr(t.text,t.x,t.y-t.font*.7) @@ -64,11 +66,14 @@ function textFX.beat(t) end function textFX.mark(t) local _,_,_,T=gc.getColor() - gc.setColor(1,1,1,T*.06626) + gc.setColor(1,1,1,T*.08) mStr(t.text,t.x,t.y-t.font*.7) end local TEXT={} +function TEXT.clear() + texts={} +end function TEXT.getText(text,x,y,font,style,spd,stop) return{ c=0, @@ -94,6 +99,7 @@ function TEXT.show(text,x,y,font,style,spd,stop) } end function TEXT.update(list) + if not list then list=texts end for i=#list,1,-1 do local t=list[i] t.c=t.c+t.spd @@ -108,6 +114,7 @@ function TEXT.update(list) end end function TEXT.draw(list) + if not list then list=texts end for i=1,#list do local t=list[i] local p=t.c diff --git a/parts/vib.lua b/parts/vib.lua index 1c2fcd37..7668ee0a 100644 --- a/parts/vib.lua +++ b/parts/vib.lua @@ -1,4 +1,4 @@ -local level={0,.015,.02,.03,.04,.05,.06,.07,.08,.09} +local level={0,0,.015,.02,.03,.04,.05,.06,.07,.08} local _=love.system.vibrate return function(t) local L=setting.vib diff --git a/player.lua b/player.lua index e63b23c7..8fe70846 100644 --- a/player.lua +++ b/player.lua @@ -547,15 +547,13 @@ local function Pdraw_demo(P) gc.draw(_,15,30,nil,16,nil,0,_:getHeight()*.5) end local N=1 - ::L:: - if N<=P.gameEnv.next and P.next[N]then + while N<=P.gameEnv.next and P.next[N]do local id=P.next[N].id _=P.color[id] gc.setColor(_[1],_[2],_[3],.3) _=miniBlock[id] gc.draw(_,285,40*N-10,nil,16,nil,_:getWidth(),_:getHeight()*.5) N=N+1 - goto L end --Next gc.setColor(1,1,1) @@ -811,7 +809,8 @@ local function Pupdate_dead(P,dt) if P.human and P.gameEnv.fall>0 and #P.field+L>P.clearingRow[L]then SFX.play("fall")end P.clearingRow={} end - end::stop:: + end + ::stop:: if P.endCounter<40 then 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 @@ -867,7 +866,7 @@ function player.createBeam(P,R,send,time,target,color,clear,spin,mini,combo) end local radius,corner - local a,r,g,b=1,unpack(skin.libColor[color]) + local a,r,g,b=1,unpack(SKIN.libColor[color]) if clear>10 then radius=10+3*send+100/(target+4) local t=clear%10 @@ -992,7 +991,7 @@ function player.garbageSend(P,R,send,time,...) end function player.garbageRelease(P) local n,flag=1 - ::L:: + while true do local A=P.atkBuffer[n] if A and A.countdown<=0 and not A.sent then P:garbageRise(12+A.lv,A.amount,A.pos) @@ -1002,10 +1001,9 @@ function player.garbageRelease(P) n=n+1 flag=true else - goto E + break end - goto L - ::E:: + end if flag and P.AI_mode=="CC"then CC_updateField(P)end end function player.garbageRise(P,color,amount,pos) @@ -1435,12 +1433,9 @@ function player.drop(P)--Place piece end --清除超高特效 _=#P.clearingRow - ::L::if _>0 then - if P.clearingRow[_]>#P.field then - P.clearingRow[_]=nil - _=_-1 - goto L - end + while _>0 and P.clearingRow[_]>#P.field do + P.clearingRow[_]=nil + _=_-1 end if P.clearingRow[1]then P.falling=P.gameEnv.fall @@ -1595,20 +1590,22 @@ function player.drop(P)--Place piece if exblock then exblock=int(exblock*(1+P.strength*.25))end send=int(send*(1+P.strength*.25)) --Badge Buff - if send==0 then goto L end + if send>0 then P:showText(send,0,80,35,"zoomout") - if exblock==0 then goto L end - P:showText(exblock,0,120,20,"zoomout") - ::L:: + if exblock>0 then + P:showText(exblock,0,120,20,"zoomout") + end + end send=send+exblock local k=0 ::R:: - if P.atkBuffer.sum>0 and send>0 then - ::F:: + if send>0 and P.atkBuffer.sum>0 then + local A + repeat k=k+1 - local A=P.atkBuffer[k] + A=P.atkBuffer[k] if not A then goto E end - if A.sent then goto F end + until not A.sent if send>=A.amount then send=send-A.amount P.atkBuffer.sum=P.atkBuffer.sum-A.amount @@ -1771,12 +1768,9 @@ local function gameOver() local L=M.records local p=#L--排名数-1 if p>0 then - ::L:: - if M.comp(D,L[p])then--是否靠前 + while M.comp(D,L[p])do--是否靠前 p=p-1 - if p>0 then - goto L - end + if p==0 then break end end end if p<10 then @@ -1791,6 +1785,7 @@ local function gameOver() end end end--Save record + function player.die(P)--Same thing when win/lose,not really die! P.alive=false P.timing=false @@ -2228,7 +2223,7 @@ function newDemoPlayer(id,x,y,size) if ENV.shakeFX==0 then ENV.shakeFX=nil end P.color={} for _=1,7 do - P.color[_]=skin.libColor[ENV.skin[_]] + P.color[_]=SKIN.libColor[ENV.skin[_]] end P.cur={bk={{}},id=0,color=0,name=0} P.sc,P.dir,P.r,P.c={0,0},0,0,0 @@ -2430,7 +2425,7 @@ function newAIPlayer(id,x,y,size,AIdata) P.color={} for _=1,7 do - P.color[_]=skin.libColor[ENV.skin[_]] + P.color[_]=SKIN.libColor[ENV.skin[_]] end P.showTime=visible_opt[ENV.visible] @@ -2550,7 +2545,7 @@ function newPlayer(id,x,y,size) P.color={} for _=1,7 do - P.color[_]=skin.libColor[ENV.skin[_]] + P.color[_]=SKIN.libColor[ENV.skin[_]] end P.showTime=visible_opt[ENV.visible] diff --git a/scene.lua b/scene.lua index 2181eecc..f57b6906 100644 --- a/scene.lua +++ b/scene.lua @@ -1,6 +1,8 @@ +local gc=love.graphics local int,log=math.floor,math.log local sin,cos=math.sin,math.cos local max,format=math.max,string.format +local scr=scr local SCN={ cur="load",--Current scene swapping=false,--ifSwapping @@ -235,7 +237,6 @@ local sceneInit={ love.event.quit() end, } -local gc=love.graphics local swap={ none={1,0,NULL}, flash={8,1,function()gc.clear(1,1,1)end}, diff --git a/timer.lua b/timer.lua index 97888619..432aa84e 100644 --- a/timer.lua +++ b/timer.lua @@ -8,52 +8,51 @@ local Tmr={} function Tmr.load() local t=Timer() local S=sceneTemp - ::R:: - --L={stage,curPos,curLen} - if S.phase==1 then - VOC.loadOne(S.cur) - elseif S.phase==2 then - BGM.loadOne(S.cur) - elseif S.phase==3 then - SFX.loadOne(S.cur) - elseif S.phase==4 then - IMG.loadOne(S.cur) - elseif S.phase==5 then - local m=modes[S.cur] - modes[S.cur]=require("modes/"..m[1]) - local M=modes[S.cur] - M.saveFileName,M.id=m[1],m.id - M.x,M.y,M.size,M.shape=m.x,m.y,m.size,m.shape - M.unlock=m.unlock - M.records=FILE.loadRecord(m[1])or M.score and{} - -- M.icon=gc.newImage("image/modeIcon/"..m.icon..".png") - -- M.icon=gc.newImage("image/modeIcon/custom.png") - elseif S.phase==6 then - --------------------------Loading some other things here? - skin.load() - stat.run=stat.run+1 - -------------------------- - SFX.play("welcome_sfx") - VOC.play("welcome") - else + repeat + if S.phase==1 then + VOC.loadOne(S.cur) + elseif S.phase==2 then + BGM.loadOne(S.cur) + elseif S.phase==3 then + SFX.loadOne(S.cur) + elseif S.phase==4 then + IMG.loadOne(S.cur) + elseif S.phase==5 then + local m=modes[S.cur] + modes[S.cur]=require("modes/"..m[1]) + local M=modes[S.cur] + M.saveFileName,M.id=m[1],m.id + M.x,M.y,M.size,M.shape=m.x,m.y,m.size,m.shape + M.unlock=m.unlock + M.records=FILE.loadRecord(m[1])or M.score and{} + -- M.icon=gc.newImage("image/modeIcon/"..m.icon..".png") + -- M.icon=gc.newImage("image/modeIcon/custom.png") + elseif S.phase==6 then + --------------------------Loading some other things here? + SKIN.load() + stat.run=stat.run+1 + -------------------------- + SFX.play("welcome_sfx") + VOC.play("welcome") + else + S.cur=S.cur+1 + S.tar=S.cur + if S.cur>62.6 then + SCN.swapTo("intro","none") + end + return + end S.cur=S.cur+1 - S.tar=S.cur - if S.cur>62.6 then - SCN.swapTo("intro","none") + if S.cur>S.tar then + S.phase=S.phase+1 + S.cur=1 + S.tar=S.list[S.phase] + if not S.tar then + S.phase=0 + S.tar=1 + end end - return - end - S.cur=S.cur+1 - if S.cur>S.tar then - S.phase=S.phase+1 - S.cur=1 - S.tar=S.list[S.phase] - if not S.tar then - S.phase=0 - S.tar=1 - end - end - if S.skip and not SCN.swapping then goto R end + until not S.skip or SCN.swapping end function Tmr.intro() sceneTemp=sceneTemp+1 @@ -235,7 +234,7 @@ function Tmr.play(dt) if frame%120==0 then if modeEnv.royaleMode then freshMostDangerous()end if marking and rnd()<.2 then - TEXT.show("游戏作者:MrZ_26\n出现此水印则为非法录屏上传",rnd(162,scr.w-162),rnd(126,scr.h-200),40,"mark",.626) + TEXT.show(text.marking,rnd(162,scr.w-162),rnd(126,scr.h-200),40,"mark",.626) end--mark 2s each 10s end end diff --git a/toolfunc.lua b/toolfunc.lua index 3272e711..36fb8500 100644 --- a/toolfunc.lua +++ b/toolfunc.lua @@ -98,11 +98,11 @@ function pasteBoard() _,str=pcall(data.decompress,"string","deflate",str) if not _ then goto ERROR end p=1 - ::LOOP:: + while true do _=byte(str,p)--1byte if not _ then if fX~=1 then goto ERROR - else goto FINISH + else break end end--str end __=_%32-1--block id @@ -112,22 +112,19 @@ function pasteBoard() if fX<10 then fX=fX+1 else - if fY==20 then goto FINISH end + if fY==20 then break end fX=1;fY=fY+1 end p=p+1 - goto LOOP + end - ::FINISH:: - for y=fY+1,20 do - for x=1,10 do - preField[y][x]=0 - end + for y=fY+1,20 do + for x=1,10 do + preField[y][x]=0 end - goto END - ::ERROR:: - TEXT.show(text.dataCorrupted,350,360,35,"flicker",.5) - ::END:: + end + do return end + ::ERROR::TEXT.show(text.dataCorrupted,350,360,35,"flicker",.5) end function mergeStat(stat,Δ) @@ -252,7 +249,7 @@ function resetPartGameData() pauseCount=0 destroyPlayers() curMode.load() - texts={} + TEXT.clear() for i=1,#players do if players.dust then players.dust:reset() @@ -298,7 +295,7 @@ function resetGameData() BG.set(modeEnv.bg) BGM.play(modeEnv.bgm) - texts={} + TEXT.clear() FX_badge={} FX_attack={} if modeEnv.royaleMode then diff --git a/updateLog.lua b/updateLog.lua index 5499ddf7..d71fcb16 100644 --- a/updateLog.lua +++ b/updateLog.lua @@ -43,14 +43,14 @@ Future outlook: New mode: game Abbr. test backfire - finesse exam(3next,1pt/mino,drop to score) + finesse exam(3next, 1pt/mino, drop to score) round-based dig - Infinite battle - Bigbang - Rhythm - Combo - Square - Shifting field(left/right) + bigbang + rhythm + combo + aquare + field shifting(left/right) + task-based survival Other: mod system with: block hidden @@ -59,18 +59,33 @@ Future outlook: low-hidden next hidden field flip(LR/UD) - no fail(infinite revive) + no fail(∞ lives) 防沉迷系统 + lang setting page warning FX(Graphic) game recording powerinfo switch new virtualWidgets like joysticks custom sequence splashing block - more FXs & 3d features & animations + cool backgrounds + more graphic FXs & 3D features & animations Encrypt source code(compile to byte code) new AI: task-Z - CC smarter(think of garbage buffer) + smarter CC(think of garbage buffer) + +0.8.18:Details Update II + new: + adjustable virtualkey SFX & VIB + changed: + add discord link in ENG mode + change par time/piece of sprint/battle/round mode + info on pause page more clearly + faster spaceBG rendering + updateLog editted + code: + delete all removable "goto"s! + callback system moduled, main.lua easy to read 0.8.17:Details Update new: @@ -84,11 +99,14 @@ Future outlook: no drop/lock FX in two hardest hidden modes, make them harder TSD-easy will auto finish when reach 20TSDs solo/round AI setting changed - debug mode text&SFX when enter recording mode - launching sound is divided to SFX&VOC two parts + show text when entering debug mode + SFX when enter recording mode + remove full speed loading + code: + launching sound divided to SFX&VOC two parts delete many "goto"s vocal system moduled - language system moduled + language system moduled, easier to add new languages fixed: forgot to load language error animation in control setting @@ -117,9 +135,9 @@ Future outlook: new randomizer for drought2 half-clear judging method changed new background system(well, it doesn't look much different but space BG) - better sequence randomizer now can loading at full speed with Dblclick/space/enter add alipay paycode to help page + better sequence randomizer code: first shader applied for white frame of falling block many many module packed, easy to manage @@ -136,7 +154,7 @@ Future outlook: give every update a name! changed: animation time of lock effect little changed - bone block of skin: ball changed + bone block of ball-skin changed AI change target more slowly Author.dignity-=1 fixed: @@ -218,10 +236,11 @@ Future outlook: some O-spin error error line counting when pc(full b2b) -0.8.10: - new BGM:Distortion(master-final) - all background darker - better error page +0.8.10:Cool Update + new: + new BGM:Distortion(master-final) + all background darker + cooler error page fixed: error when finish master/ultra mode shakeFX no effect when below 3 @@ -456,15 +475,19 @@ Future outlook: bugs fixed(AI control error) 0.7.13: - Chinese game name: 方块研究所 - SUPER COOL instant moving effect - new b2b bar style & animation - new transition animation - change difficulty of master mode - adjust delay algorithm(probably cause controlfeel changing, please reset your DAS setting) - code reconstructed - bugs fixed(error when seq=his, size of custom oppo) - debug key change to F8 + new: + Chinese game name: 方块研究所 + SUPER COOL instant moving effect + new b2b bar style & animation + new transition animation + change: + change difficulty of master mode + adjust delay algorithm(probably cause controlfeel changing, please reset your DAS setting) + code reconstructed + debug key change to F8 + fixed: + error when seq=his + error game area size of custom opponent 0.7.12:Total Update AI learned to switch attack mode diff --git a/widgetList.lua b/widgetList.lua index 0f1658f1..c640aee7 100644 --- a/widgetList.lua +++ b/widgetList.lua @@ -93,9 +93,9 @@ function SETsto(k) return function(i)setting[k]=i end end function SETrev(k) return function()setting[k]=not setting[k] end end function pressKey(k)return function()love.keypressed(k) end end function setPen(i) return function()sceneTemp.pen=i end end -function prevSkin(n)return function()skin.prev(n) end end -function nextSkin(n)return function()skin.next(n) end end -function nextDir(n) return function()skin.rotate(n) end end +function prevSkin(n)return function()SKIN.prev(n) end end +function nextSkin(n)return function()SKIN.next(n) end end +function nextDir(n) return function()SKIN.rotate(n) end end function VKAdisp(n) return function()return VK_org[n].ava end end function VKAcode(n) return function()VK_org[n].ava=not VK_org[n].ava end end @@ -235,7 +235,7 @@ local Widget={ graphic=newButton(1080,80,240,80,C.lightCyan,35,function()SCN.swapTo("setting_graphic")end, nil,"sfx"), sfx= newSlider(180,250,400,10,35,function()SFX.play("blip_1")end, SETval("sfx"), SETsto("sfx"), nil,"bgm"), bgm= newSlider(750,250,400,10,35,function()BGM.freshVolume()end, SETval("bgm"), SETsto("bgm"), nil,"vib"), - vib= newSlider(180,440,400,5 ,28,function()VIB(1)end, SETval("vib"), SETsto("vib"), nil,"voc"), + vib= newSlider(180,440,400,5 ,28,function()VIB(2)end, SETval("vib"), SETsto("vib"), nil,"voc"), voc= newSlider(750,440,400,10,32,function()VOC.play("nya")end, SETval("voc"), SETsto("voc"), nil,"stereo"), stereo= newSlider(180,630,400,10,35,function()SFX.play("move",1,-1)SFX.play("lock",1,1)end, SETval("stereo"), SETsto("stereo"),function()return setting.sfx==0 end,"back"), back= newButton(1140,650,200,80,C.white,40,SCN.back,nil,"game"), @@ -260,8 +260,8 @@ local Widget={ back=newButton(1140,650,200,80,C.white,45,SCN.back), }, setting_skin={ - prev= newButton(700,100,140,100,C.white,50,function()skin.prevSet()end), - next= newButton(860,100,140,100,C.white,50,function()skin.nextSet()end), + prev= newButton(700,100,140,100,C.white,50,function()SKIN.prevSet()end), + next= newButton(860,100,140,100,C.white,50,function()SKIN.nextSet()end), prev1= newButton(130,230,90,65,C.white,30,prevSkin(1)), prev2= newButton(270,230,90,65,C.white,30,prevSkin(2)), prev3= newButton(410,230,90,65,C.white,30,prevSkin(3)), @@ -350,14 +350,15 @@ local Widget={ pro= newButton(1120,100, 240,80,C.white,35,function()for i=1,20 do VK_org[i].ava=true end end), hide= newSwitch(1170,200, 40,SETval("VKSwitch"),SETrev("VKSwitch")), track= newSwitch(1170,300, 35,SETval("VKTrack"),SETrev("VKTrack")), - sound= newSwitch(850,400, 35,SETval("VKSound"),SETrev("VKSound")), + sfx= newSlider(800,380,180,4,40,function()SFX.play("virtualKey",setting.VKSFX*.25)end,SETval("VKSFX"),SETsto("VKSFX")), + vib= newSlider(800,460,180,2,40,function()VIB(setting.VKVIB)end,SETval("VKVIB"),SETsto("VKVIB")), icon= newSwitch(850,300, 40,SETval("VKIcon"),SETrev("VKIcon")), - tkset= newButton(1120,400,240,80,C.white,32,function() + tkset= newButton(1120,420,240,80,C.white,32,function() SCN.push() SCN.swapTo("setting_trackSetting") end,function()return not setting.VKTrack end), - alpha= newSlider(840,490,400,10,40,nil,SETval("VKAlpha"),SETsto("VKAlpha")), - back= newButton(1100,600,240,80,C.white,45,SCN.back), + alpha= newSlider(840,540,400,10,40,nil,SETval("VKAlpha"),SETsto("VKAlpha")), + back= newButton(1120,620,200,80,C.white,45,SCN.back), }, setting_trackSetting={ VKDodge=newSwitch(400,200, 35,SETval("VKDodge"),SETrev("VKDodge")),