diff --git a/BGM/8-bit happiness.ogg b/BGM/8-bit happiness.ogg index f429f2b9..8aa54438 100644 Binary files a/BGM/8-bit happiness.ogg and b/BGM/8-bit happiness.ogg differ diff --git a/BGM/blank.ogg b/BGM/blank.ogg index 477e9f81..c0153d55 100644 Binary files a/BGM/blank.ogg and b/BGM/blank.ogg differ diff --git a/BGM/cruelty.ogg b/BGM/cruelty.ogg index a9478e80..5ce469a4 100644 Binary files a/BGM/cruelty.ogg and b/BGM/cruelty.ogg differ diff --git a/BGM/end.ogg b/BGM/end.ogg index eae4a45e..333376b1 100644 Binary files a/BGM/end.ogg and b/BGM/end.ogg differ diff --git a/BGM/final.ogg b/BGM/final.ogg index 7ef90097..02b7ea14 100644 Binary files a/BGM/final.ogg and b/BGM/final.ogg differ diff --git a/BGM/infinite.ogg b/BGM/infinite.ogg index 8f32f656..d0817092 100644 Binary files a/BGM/infinite.ogg and b/BGM/infinite.ogg differ diff --git a/BGM/newera.ogg b/BGM/newera.ogg index cf29f755..8df49888 100644 Binary files a/BGM/newera.ogg and b/BGM/newera.ogg differ diff --git a/BGM/ogg 32000Hz 0.5q 1chn b/BGM/ogg 44100Hz 0.5q 1chn similarity index 100% rename from BGM/ogg 32000Hz 0.5q 1chn rename to BGM/ogg 44100Hz 0.5q 1chn diff --git a/BGM/push.ogg b/BGM/push.ogg index 06807a2b..370d2b18 100644 Binary files a/BGM/push.ogg and b/BGM/push.ogg differ diff --git a/BGM/race.ogg b/BGM/race.ogg index a6feecae..914dd44f 100644 Binary files a/BGM/race.ogg and b/BGM/race.ogg differ diff --git a/BGM/reason.ogg b/BGM/reason.ogg index c91c6f05..53188909 100644 Binary files a/BGM/reason.ogg and b/BGM/reason.ogg differ diff --git a/BGM/rockblock.ogg b/BGM/rockblock.ogg index 67d4dfea..086514d6 100644 Binary files a/BGM/rockblock.ogg and b/BGM/rockblock.ogg differ diff --git a/BGM/secret7th.ogg b/BGM/secret7th.ogg index cb98ad82..fab18ff7 100644 Binary files a/BGM/secret7th.ogg and b/BGM/secret7th.ogg differ diff --git a/BGM/secret8th.ogg b/BGM/secret8th.ogg index a798d693..1ee1cd83 100644 Binary files a/BGM/secret8th.ogg and b/BGM/secret8th.ogg differ diff --git a/BGM/way.ogg b/BGM/way.ogg index 430a4ef1..7138d82a 100644 Binary files a/BGM/way.ogg and b/BGM/way.ogg differ diff --git a/SFX/blip_1.ogg b/SFX/blip_1.ogg index 8fd85f48..70c3bf49 100644 Binary files a/SFX/blip_1.ogg and b/SFX/blip_1.ogg differ diff --git a/SFX/blip_2.ogg b/SFX/blip_2.ogg index cb1f1745..35415288 100644 Binary files a/SFX/blip_2.ogg and b/SFX/blip_2.ogg differ diff --git a/SFX/button.ogg b/SFX/button.ogg index 0780bd6e..2ef7892a 100644 Binary files a/SFX/button.ogg and b/SFX/button.ogg differ diff --git a/SFX/clear_1.ogg b/SFX/clear_1.ogg index 6de90963..b29f5a58 100644 Binary files a/SFX/clear_1.ogg and b/SFX/clear_1.ogg differ diff --git a/SFX/clear_2.ogg b/SFX/clear_2.ogg index a9f6c24e..b6f5f87d 100644 Binary files a/SFX/clear_2.ogg and b/SFX/clear_2.ogg differ diff --git a/SFX/clear_3.ogg b/SFX/clear_3.ogg index 4b5a9ff6..c48473ff 100644 Binary files a/SFX/clear_3.ogg and b/SFX/clear_3.ogg differ diff --git a/SFX/clear_4.ogg b/SFX/clear_4.ogg index 0ccda139..ead8370a 100644 Binary files a/SFX/clear_4.ogg and b/SFX/clear_4.ogg differ diff --git a/SFX/collect.ogg b/SFX/collect.ogg index 0478591d..99639a16 100644 Binary files a/SFX/collect.ogg and b/SFX/collect.ogg differ diff --git a/SFX/drop.ogg b/SFX/drop.ogg index fa93db46..56377365 100644 Binary files a/SFX/drop.ogg and b/SFX/drop.ogg differ diff --git a/SFX/fall.ogg b/SFX/fall.ogg index b050d74c..0df52ee4 100644 Binary files a/SFX/fall.ogg and b/SFX/fall.ogg differ diff --git a/SFX/hold.ogg b/SFX/hold.ogg index 8b90739a..49b2a0ab 100644 Binary files a/SFX/hold.ogg and b/SFX/hold.ogg differ diff --git a/SFX/lock.ogg b/SFX/lock.ogg index f50295bd..16b65bac 100644 Binary files a/SFX/lock.ogg and b/SFX/lock.ogg differ diff --git a/SFX/perfectclear.ogg b/SFX/perfectclear.ogg index feaf53a0..38a0c059 100644 Binary files a/SFX/perfectclear.ogg and b/SFX/perfectclear.ogg differ diff --git a/SFX/prehold.ogg b/SFX/prehold.ogg index 079aacff..8810fca6 100644 Binary files a/SFX/prehold.ogg and b/SFX/prehold.ogg differ diff --git a/SFX/prerotate.ogg b/SFX/prerotate.ogg index 26a85d1e..e7bef7bb 100644 Binary files a/SFX/prerotate.ogg and b/SFX/prerotate.ogg differ diff --git a/SFX/reach.ogg b/SFX/reach.ogg index 9cdd270d..48f3e65d 100644 Binary files a/SFX/reach.ogg and b/SFX/reach.ogg differ diff --git a/SFX/ready.ogg b/SFX/ready.ogg index f5674df7..0fcd417a 100644 Binary files a/SFX/ready.ogg and b/SFX/ready.ogg differ diff --git a/SFX/ren_1.ogg b/SFX/ren_1.ogg index 56d3b840..00959bc0 100644 Binary files a/SFX/ren_1.ogg and b/SFX/ren_1.ogg differ diff --git a/SFX/ren_10.ogg b/SFX/ren_10.ogg index 87a77a99..c3568ae3 100644 Binary files a/SFX/ren_10.ogg and b/SFX/ren_10.ogg differ diff --git a/SFX/ren_11.ogg b/SFX/ren_11.ogg index 6a23013a..00f19e5a 100644 Binary files a/SFX/ren_11.ogg and b/SFX/ren_11.ogg differ diff --git a/SFX/ren_2.ogg b/SFX/ren_2.ogg index 622b49c2..92c6b10d 100644 Binary files a/SFX/ren_2.ogg and b/SFX/ren_2.ogg differ diff --git a/SFX/ren_3.ogg b/SFX/ren_3.ogg index bfe8260b..f25700d3 100644 Binary files a/SFX/ren_3.ogg and b/SFX/ren_3.ogg differ diff --git a/SFX/ren_4.ogg b/SFX/ren_4.ogg index 22201954..ae064d91 100644 Binary files a/SFX/ren_4.ogg and b/SFX/ren_4.ogg differ diff --git a/SFX/ren_5.ogg b/SFX/ren_5.ogg index 76c8235d..7f760e1e 100644 Binary files a/SFX/ren_5.ogg and b/SFX/ren_5.ogg differ diff --git a/SFX/ren_6.ogg b/SFX/ren_6.ogg index 4b1b6dfb..5f4805c7 100644 Binary files a/SFX/ren_6.ogg and b/SFX/ren_6.ogg differ diff --git a/SFX/ren_7.ogg b/SFX/ren_7.ogg index 789cc3cb..0eb4a696 100644 Binary files a/SFX/ren_7.ogg and b/SFX/ren_7.ogg differ diff --git a/SFX/ren_8.ogg b/SFX/ren_8.ogg index 6bd290bd..8ab70e11 100644 Binary files a/SFX/ren_8.ogg and b/SFX/ren_8.ogg differ diff --git a/SFX/ren_9.ogg b/SFX/ren_9.ogg index 0cc721c8..23d45a53 100644 Binary files a/SFX/ren_9.ogg and b/SFX/ren_9.ogg differ diff --git a/SFX/ren_mega.ogg b/SFX/ren_mega.ogg index d9e26027..d12aee2d 100644 Binary files a/SFX/ren_mega.ogg and b/SFX/ren_mega.ogg differ diff --git a/SFX/rotate.ogg b/SFX/rotate.ogg index cdd1fc63..d96f0c99 100644 Binary files a/SFX/rotate.ogg and b/SFX/rotate.ogg differ diff --git a/SFX/rotatekick.ogg b/SFX/rotatekick.ogg index 8850fc4e..e8e99386 100644 Binary files a/SFX/rotatekick.ogg and b/SFX/rotatekick.ogg differ diff --git a/SFX/spin_0.ogg b/SFX/spin_0.ogg index 23da7cdd..399a281a 100644 Binary files a/SFX/spin_0.ogg and b/SFX/spin_0.ogg differ diff --git a/SFX/spin_1.ogg b/SFX/spin_1.ogg index a1aa8bb2..f7db4af0 100644 Binary files a/SFX/spin_1.ogg and b/SFX/spin_1.ogg differ diff --git a/SFX/spin_2.ogg b/SFX/spin_2.ogg index e0c3188c..6727ac3b 100644 Binary files a/SFX/spin_2.ogg and b/SFX/spin_2.ogg differ diff --git a/SFX/spin_3.ogg b/SFX/spin_3.ogg index 8007bdde..5b765d50 100644 Binary files a/SFX/spin_3.ogg and b/SFX/spin_3.ogg differ diff --git a/SFX/start.ogg b/SFX/start.ogg index cd774145..1a1d335c 100644 Binary files a/SFX/start.ogg and b/SFX/start.ogg differ diff --git a/SFX/swipe.ogg b/SFX/swipe.ogg index f7c66da4..0fd1196b 100644 Binary files a/SFX/swipe.ogg and b/SFX/swipe.ogg differ diff --git a/SFX/win.ogg b/SFX/win.ogg index 6f6ce48d..fdd74a10 100644 Binary files a/SFX/win.ogg and b/SFX/win.ogg differ diff --git a/ai.lua b/ai.lua index 6a2b32e4..3b19e7a6 100644 --- a/ai.lua +++ b/ai.lua @@ -8,8 +8,10 @@ 4deepShape BlockedWells; ]] -dirCount={1,1,3,3,3,0,1} -spinOffset={ +local abs=math.abs + +local dirCount={1,1,3,3,3,0,1} +local spinOffset={ {1,0,0},--S {1,0,0},--Z {1,0,0},--L @@ -24,7 +26,7 @@ spinOffset={ 6~10:hD,sD,H,A,R, 11~13:LL,RR,DD ]] -FCL={ +local FCL={ [1]={ {{11},{11,2},{1},{},{2},{2,2},{12,1},{12}}, {{11,4},{11,3},{11,2,3},{4},{3},{2,3},{2,2,3},{12,4},{12,3}}, @@ -46,15 +48,15 @@ FCL={ FCL[2]=FCL[1] FCL[4]=FCL[3] FCL[5]=FCL[3] -clearScore={[0]=0,0,2,4,12} -function ifoverlapAI(f,bk,x,y) +local clearScore={[0]=0,0,2,4,12} +local function ifoverlapAI(f,bk,x,y) if y<1 then return true end if y>#f then return end for i=1,#bk do for j=1,#bk[1]do if f[y+i-1]and bk[i][j]and f[y+i-1][x+j-1]>0 then return true end end end end -function resetField(f0,f,start) +local function resetField(f0,f,start) ::L::if f[start]then removeRow(f,start) goto L @@ -66,7 +68,7 @@ function resetField(f0,f,start) end end end -function getScore(field,bn,cb,cx,cy) +local function getScore(field,bn,cb,cx,cy) local score=0 local highest=0 local height=getNewRow(0) @@ -109,7 +111,8 @@ function getScore(field,bn,cb,cx,cy) h1=0 end end - ins(freeRow,height) + freeRow[#freeRow+1]=height + freeRow.L=freeRow.L+1 score= #field*20 -cy*35 @@ -163,12 +166,15 @@ function AI_getControls(ctrl) removeRow(Tfield,1) goto L end--Release cache + local p=#ctrl+1 if best.hold then - ins(ctrl,8) + ctrl[p]=8 + p=p+1 end local l=FCL[best.bn][best.dir+1][best.x] for i=1,#l do - ins(ctrl,l[i]) + ctrl[p]=l[i] + p=p+1 end - ins(ctrl,6) + ctrl[p]=6 end \ No newline at end of file diff --git a/call&sys.lua b/call&sys.lua deleted file mode 100644 index 3b128052..00000000 --- a/call&sys.lua +++ /dev/null @@ -1,824 +0,0 @@ -local gc,tm=love.graphics,love.timer -local ms,kb,tc=love.mouse,love.keyboard,love.touch -local wd=love.window -local setFont=setFont -local Timer=tm.getTime - -local scr=scr -local xOy=love.math.newTransform() -local focus=true -local mx,my,mouseShow=-20,-20,false -local touching=nil--1st touching ID - -local sceneInit={ - load=function() - loading=1--Loading mode - loadnum=1--Loading counter - loadprogress=0--Loading bar(0~1) - loadTip=text.tips[rnd(#text.tips)] - end, - intro=function() - count=0 - BGM("blank") - end, - main=function() - BGM("blank") - collectgarbage() - end, - music=function() - sel=1 - BGM() - end, - mode=function() - curBG="none" - saveData() - modeSel=modeSel or 1 - levelSel=levelSel or 3 - BGM("blank") - end, - custom=function() - optSel=optSel or 1 - curBG=customRange.bg[customSel[12]] - BGM(customRange.bgm[customSel[13]]) - end, - draw=function() - curBG="none" - kb.setKeyRepeat(true) - clearSureTime=0 - pen,sx,sy=1,1,1 - end, - play=function() - restartCount=0 - if needResetGameData then - resetGameData() - needResetGameData=nil - end - end, - pause=function() - end, - setting=function() - curBG="none" - end, - setting2=function() - curBoard=1 - keyboardSet=1 - joystickSet=1 - keyboardSetting=false - joystickSetting=false - end,--Control settings - setting3=function() - curBG="game1" - defaultSel=1 - sel=nil - snapLevel=1 - end,--Touch setting - help=function() - end, - stat=function() - end, - quit=function() - love.event.quit() - end, -} - -BGblockList={}for i=1,16 do BGblockList[i]={v=0}end -local BGblock={tm=150,next=7,ct=0} -local function getNewBlock() - BGblock.ct=BGblock.ct+1 - if BGblock.ct==17 then BGblock.ct=1 end - local t=BGblockList[BGblock.ct] - t.bn,t.size=BGblock.next,2+3*rnd() - t.b=blocks[t.bn][rnd(0,3)] - t.x=rnd(-#t.b[1]*t.size*30+100,1180) - t.y=-#t.b*30*t.size - t.v=t.size*(1+rnd()) - BGblock.next=BGblock.next%7+1 - return t -end - -function onVirtualkey(x,y) - local d2,nearest,distance - for K=1,#virtualkey do - local b=virtualkey[K] - d2=(x-b[1])^2+(y-b[2])^2 - if d20 and -1 or 1),1),#modeID) - levelSel=ceil(#modeLevel[modeID[modeSel]]*.5) -end -function keyDown.mode(key) - if key=="down"then - if modeSel<#modeID then - modeSel=modeSel+1 - levelSel=ceil(#modeLevel[modeID[modeSel]]*.5) - end - elseif key=="up"then - if modeSel>1 then - modeSel=modeSel-1 - levelSel=ceil(#modeLevel[modeID[modeSel]]*.5) - end - elseif key=="left"then - if levelSel>1 then - levelSel=levelSel-1 - end - elseif key=="right"then - if levelSel<#modeLevel[modeID[modeSel]]then - levelSel=levelSel+1 - end - elseif key=="return"then - loadGame(modeSel,levelSel) - elseif key=="c"then - gotoScene("custom") - elseif key=="escape"then - back() - end -end -function gamepadDown.mode(key) - if key=="dpdown"then - if modeSel<#modeID then modeSel=modeSel+1 end - elseif key=="dpup"then - if modeSel>1 then modeSel=modeSel-1 end - elseif key=="start"then - loadGame(modeSel,levelSel) - elseif key=="back"then - back() - end -end - -function keyDown.music(key) - if key=="down"then - sel=sel%#musicID+1 - elseif key=="up"then - sel=(sel-2)%#musicID+1 - elseif key=="return"or key=="space"then - BGM(musicID[sel]) - elseif key=="escape"then - back() - end -end - -function keyDown.custom(key) - if key=="left"then - customSel[optSel]=(customSel[optSel]-2)%#customRange[customID[optSel]]+1 - if optSel==12 then - curBG=customRange.bg[customSel[12]] - elseif optSel==13 then - BGM(customRange.bgm[customSel[13]]) - end - elseif key=="right"then - customSel[optSel]=customSel[optSel]%#customRange[customID[optSel]]+1 - if optSel==12 then - curBG=customRange.bg[customSel[optSel]] - elseif optSel==13 then - BGM(customRange.bgm[customSel[optSel]]) - end - elseif key=="down"then - optSel=optSel%#customID+1 - elseif key=="up"then - optSel=(optSel-2)%#customID+1 - elseif key=="d"then - gotoScene("draw") - elseif key=="return"then - loadGame(0,1) - elseif key=="space"then - loadGame(0,2) - elseif key=="escape"then - back() - end -end - -function mouseDown.draw(x,y,k) - mouseMove.draw(x,y) -end -function mouseMove.draw(x,y,dx,dy) - 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 - if sx and sy and ms.isDown(1,2,3)then - preField[sy][sx]=ms.isDown(1)and pen or ms.isDown(2)and 0 or -1 - end -end -function wheelmoved.draw(x,y) - 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 -end -function touchDown.draw(id,x,y) -end -function touchMove.draw(id,x,y,dx,dy) - 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 - if sx and sy then - preField[sy][sx]=pen - end -end -function keyDown.draw(key) - if key=="delete"then - Buttons.draw.clear.code() - elseif 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=="space"then - if sx and sy then - preField[sy][sx]=pen - end - elseif key=="tab"then - pen=-1 - elseif key=="backspace"then - pen=0 - elseif key=="escape"then - back() - else - pen=find("123qwea#sdzxc",key)or pen - end -end - -function keyDown.setting2(key) - if key=="escape"then - if keyboardSetting then - keyboardSetting=false - else - back() - end - elseif keyboardSetting then - for l=1,8 do - for y=1,13 do - if setting.keyMap[l][y]==key then - setting.keyMap[l][y]="" - end - end - end - setting.keyMap[curBoard][keyboardSet]=key - keyboardSetting=false - elseif key=="return"then - keyboardSetting=true - elseif key=="up"then - keyboardSet=max(keyboardSet-1,1) - elseif key=="down"then - keyboardSet=min(keyboardSet+1,13) - elseif key=="left"then - curBoard=max(curBoard-1,1) - elseif key=="right"then - curBoard=min(curBoard+1,8) - end -end -function gamepadDown.setting2(key) - if key=="back"then - if joystickSetting then - joystickSetting=false - else - back() - end - elseif joystickSetting then - for l=9,16 do - for y=1,12 do - if setting.keyMap[l][y]==key then - setting.keyMap[l][y]="" - end - end - end - setting.keyMap[8+curBoard][joystickSet]=key - joystickSetting=false - elseif key=="start"then - joystickSetting=true - elseif key=="up"then - joystickSet=max(joystickSet-1,1) - elseif key=="down"then - joystickSet=min(joystickSet+1,12) - elseif key=="left"then - curBoard=max(curBoard-1,1) - elseif key=="right"then - curBoard=min(curBoard+1,8) - end -end - -function mouseDown.setting3(x,y,k) - if k==2 then back()end - for K=1,#virtualkey do - local b=virtualkey[K] - if (x-b[1])^2+(y-b[2])^2=.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 - gc.origin() - xOy=xOy:setTransformation(w*.5,h*.5,nil,scr.k,nil,640,360) - gc.replaceTransform(xOy) - collectgarbage() -end -function love.focus(f) - if system~="Android" and not f and scene=="play"then pauseGame()end -end -function love.update(dt) - -- if players then for k,v in pairs(players[1])do - -- if rawget(_G,k)and k~="next"and k~="hold"and k~="stat"then print(k,_G[v])end - -- end end--check player data flew(debugging) - for i=#BGblock,1,-1 do - BGblock[i].y=BGblock[i].y+BGblock[i].v - if BGblock[i].y>720 then rem(BGblock,i)end - end - if setting.bgblock then - BGblock.tm=BGblock.tm-1 - if BGblock.tm==0 then - ins(BGblock,getNewBlock()) - BGblock.tm=rnd(20,30) - end - end - if sceneSwaping then - sceneSwaping.time=sceneSwaping.time-1 - if sceneSwaping.time==sceneSwaping.mid then - for k,B in next,Buttons[scene]do - B.alpha=0 - end--Reset buttons' alpha - Buttons.sel=nil - scene=sceneSwaping.tar - sceneInit[scene]() - elseif sceneSwaping.time==0 then - sceneSwaping=nil - end - end - if Tmr[scene]then - Tmr[scene](dt) - end - for i=#Task,1,-1 do - Task[i]:update() - end - if voicePlaying[1]then - if not voicePlaying[1]:isPlaying()then - rem(voicePlaying,1) - end - if voicePlaying[1] and not voicePlaying[1]:isPlaying()then voicePlaying[1]:play()end - end - for k,B in next,Buttons[scene]do - local t=B==Buttons.sel and .4 or 0 - B.alpha=abs(B.alpha-t)>.02 and(B.alpha+(B.alphat then B.alpha=B.alpha-.02 elseif B.alpha.5625 then - local d=(scr.h-scr.w*9/16)*.5/scr.k - gc.rectangle("fill",0,0,1280,-d) - gc.rectangle("fill",0,720,1280,d) - else--high - local d=(scr.w-scr.h*16/9)*.5/scr.k - gc.rectangle("fill",0,0,-d,720) - gc.rectangle("fill",1280,0,d,720) - end--wide - end--Black side - setFont(20)gc.setColor(1,1,1) - gc.print(tm.getFPS(),5,700) - if devMode then - gc.print(mx.." "..my,5,640) - gc.print(#freeRow or 0,5,660) - gc.print(gcinfo(),5,680) - end -end -function love.run() - local frameT=Timer() - local readyDrawFrame=0 - local PUMP,POLL=love.event.pump,love.event.poll - love.resize(gc.getWidth(),gc.getHeight()) - scene="load"sceneInit.load()--System Launch - return function() - PUMP() - for N,a,b,c,d,e in POLL()do - if N=="quit"then return 0 - elseif love[N]then love[N](a,b,c,d,e)end - end - tm.step() - love.update(tm.getDelta()) - if not wd.isMinimized()then - readyDrawFrame=readyDrawFrame+setting.frameMul - if readyDrawFrame>=100 then - readyDrawFrame=readyDrawFrame-100 - love.draw() - gc.present() - end - end - ::L::if Timer()-frameT<1/60 then goto L end - frameT=Timer() - tm.sleep(.001) - end -end \ No newline at end of file diff --git a/class.lua b/class.lua index a005c281..83fc0dd3 100644 --- a/class.lua +++ b/class.lua @@ -1,18 +1,24 @@ Task={} +local rem=table.remove + metatable_task={__index=Task} function newTask(code,P,data) + local id=#Task+1 local obj={ code=code, P=P, data=data, + id=id, } setmetatable(obj,metatable_task) - ins(Task,obj) + Task[id]=obj end function clearTask(opt) if opt=="all"then - while Task[1]do - rem(Task,i) + local i=#Task + while i>0 do + Task[i]=nil + i=i-1 end elseif opt=="play"then for i=#Task,1,-1 do @@ -22,7 +28,7 @@ function clearTask(opt) end else--Player table for i=#Task,1,-1 do - if Task[i].P==P then + if Task[i].P==opt then rem(Task,i) end end @@ -30,8 +36,12 @@ function clearTask(opt) end function Task:update() if(not self.P or self.P and scene=="play")and self:code(self.P,self.data)then - for i=#Task,1,-1 do - if Task[i]==self then rem(Task,i)return end - end--Destroy + local e=#Task + for i=1,e do + if Task[i]==self then + Task[e],Task[i]=nil,Task[e] + return + end + end end end \ No newline at end of file diff --git a/conf.lua b/conf.lua index 555fa824..57f9e4ce 100644 --- a/conf.lua +++ b/conf.lua @@ -1,23 +1,23 @@ +gameVersion="Alpha V0.7.22" function love.conf(t) - local X=nil t.identity="Techmino"--Save directory name - t.appendidentity=X--If search files in source before save directory t.version="11.1" t.console=X - t.accelerometerjoystick=X--If exposing accelerometer on iOS and Android as a Joystick t.gammacorrect=X + t.appendidentity=X--If search files in source before save directory + t.accelerometerjoystick=X--If exposing accelerometer on iOS and Android as a Joystick t.audio.mixwithsystem=true--Switch on to keep sysBGM local W=t.window - W.title="Techmino V0.7.21" + W.title="Techmino "..gameVersion W.icon="/image/icon.png" W.width,W.height=1280,720 W.minwidth,W.minheight=640,360 W.borderless=X - W.resizable=true - W.fullscreentype="desktop"--Choose between "desktop" fullscreen or "exclusive" fullscreen mode (string) + W.resizable=1 + W.fullscreentype="desktop"--"exclusive" W.fullscreen=X - W.vsync=0--0→∞fps + W.vsync=X--0→∞fps W.msaa=X--The number of samples to use with multi-sampled antialiasing (number) W.depth=X--Bits per sample in the depth buffer W.stencil=1--The number of bits per sample in the stencil buffer @@ -26,23 +26,10 @@ function love.conf(t) W.x,W.y=nil local M=t.modules - M.window=true - M.system=true - M.audio=true - M.data=true - M.event=true - M.font=true - M.graphics=true - M.image=true - M.joystick=true - M.keyboard=true - M.math=true - M.mouse=true - M.sound=true - M.timer=true - M.touch=true - - M.physics=X - M.thread=X - M.video=X + M.window,M.system,M.event=1,1,1 + M.audio,M.sound=1,1 + M.math,M.data=1,1 + M.timer,M.graphics,M.font,M.image=1,1,1,1 + M.mouse,M.touch,M.keyboard,M.joystick=1,1,1,1 + M.physics,M.thread,M.video=X end \ No newline at end of file diff --git a/dataList.lua b/dataList.lua index 35e1e724..be840bf9 100644 --- a/dataList.lua +++ b/dataList.lua @@ -1,6 +1,11 @@ local gc=love.graphics local setFont=setFont - +local int,rnd,max,min=math.floor,math.random,math.max,math.min +local format=string.format +local ins,rem=table.insert,table.remove +local function newNext(n) + P.next[#P.next+1]={bk=blocks[n][0],id=n,color=P.gameEnv.bone and 8 or n,name=n} +end local PCbase={ {3,3,3,0,0,0,0,0,2,2}, {3,6,6,0,0,0,0,2,2,5}, @@ -32,6 +37,21 @@ local death_fall={10,9,8,7,6} local pc_drop={50,45,40,35,30,26,22,18,15,12} local pc_lock={55,50,45,40,36,32,30} local pc_fall={18,16,14,12,10,9,8,7,6} +local blockColor=blockColor +local function throwBadge(S,R)--Sender/Receiver + local x1,y1,x2,y2 + if S.small then + x1,y1=S.centerX,S.centerY + else + x1,y1=S.x+308*S.size,S.y+450*S.size + end + if R.small then + x2,y2=R.centerX,R.centerY + else + x2,y2=R.x+66*R.size,R.y+344*R.size + end + FX.badge[#FX.badge+1]={x1,y1,x2,y2,t=0} +end loadmode={ sprint=function() createPlayer(1,340,15) @@ -74,7 +94,7 @@ loadmode={ end, survivor=function() createPlayer(1,340,15) - newTask(Event_task[curMode.lv==1 and"survivor_easy"or curMode.lv==2 and"survivor_normal"or curMode.lv==3 and"survivor_hard"or curMode.lv==4 and"survivor_lunatic"or curMode.lv==5 and"survivor_ultimate"],P) + newTask(Event_task[curMode.lv==1 and"survivor_easy"or curMode.lv==2 and"survivor_normal"or curMode.lv==3 and"survivor_hard"or curMode.lv==4 and"survivor_lunatic"or curMode.lv==5 and"survivor_ultimate"or curMode.lv==6 and"survivor_extra"],P) pushSpeed=curMode.lv>2 and 2 or 1 end, tech=function() @@ -101,7 +121,6 @@ loadmode={ createPlayer(1,340,15) P=players[1] Event.newPC() - P.freshNext() end, pcchallenge=function() createPlayer(1,340,15) @@ -170,14 +189,14 @@ loadmode={ createPlayer(2,965,360,.5,modeEnv.opponent) end preField.h=20 - ::R:: + repeat for i=1,10 do if preField[preField.h][i]>0 or curMode.lv==2 and preField[preField.h][i]==-1 then goto L end end preField.h=preField.h-1 - if preField.h>0 then goto R end + until preField.h==0 ::L:: if curMode.lv==1 then for _,P in next,players.alive do @@ -196,12 +215,12 @@ loadmode={ mesDisp={ --Default:font=35,white sprint=function() - setFont(70) + setFont(65) local r=max(P.gameEnv.target-P.stat.row,0) - mStr(r,-82,260) + mStr(r,-82,265) if r<21 and r>0 then - gc.setLineWidth(3) - gc.setColor(1,.5,.5) + gc.setLineWidth(4) + gc.setColor(1,r>10 and 0 or rnd(),.5) gc.line(0,600-30*r,300,600-30*r) end end, @@ -235,7 +254,7 @@ mesDisp={ infinite=function() setFont(50) mStr(P.stat.atk,-82,310) - mStr(format("%.2f",2.5*P.stat.atk/P.stat.piece),-82,420) + mStr(format("%.2f",P.stat.atk/P.stat.row),-82,420) setFont(20) mStr("Attack",-82,363) mStr("Efficiency",-82,475) @@ -250,6 +269,11 @@ mesDisp={ setFont(25) mStr("Rows",-82,300) mStr("Techrash",-82,420) + if curMode.lv==6 then + mStr("Point",-82,180) + setFont(60) + mStr(P.modeData.point*.1,-82,110) + end setFont(80) mStr(P.stat.row,-82,220) mStr(P.stat.clear_4,-82,340) @@ -269,13 +293,14 @@ mesDisp={ tech=function() setFont(50) mStr(P.stat.atk,-82,310) - mStr(format("%.2f",2.5*P.stat.atk/P.stat.piece),-82,420) + mStr(format("%.2f",P.stat.atk/P.stat.row),-82,420) setFont(20) mStr("Attack",-82,363) mStr("Efficiency",-82,475) end, c4wtrain=function() setFont(50) + mStr(max(200-P.stat.row,0),-82,220) mStr(P.combo,-82,310) mStr(P.modeData.point,-82,400) setFont(20) @@ -295,6 +320,9 @@ mesDisp={ mStr(P.stat.pc,-82,350) setFont(50) mStr(max(100-P.stat.row,0),-82,250) + gc.setColor(.5,.5,.5) + local y=72*(7-(P.stat.piece+1)%7)-36 + gc.line(320,y,442,y) end, techmino49=function() setFont(40) @@ -333,22 +361,26 @@ mesDisp={ custom=function() setFont(25) mStr("Rows",-82,300) - setFont(80) - mStr(P.stat.row,-82,220) + setFont(65) + mStr(P.stat.row,-82,225) if P.gameEnv.target<1e4 then setFont(75) mStr(max(P.gameEnv.target-P.stat.row,0),-82,280) end - if curMode.lv==2 and P.modeData.event==0 then - gc.setColor(1,1,1,.6) + if P.gameEnv.puzzle and P.modeData.event==0 then gc.setLineWidth(3) for y=1,preField.h do for x=1,10 do local B=preField[y][x] - if B>0 then + if B>7 then gc.setColor(blockColor[B]) + gc.rectangle("line",30*x-23,607-30*y,16,16) + elseif B>0 then + local c=blockColor[B] + gc.setColor(c[1],c[2],c[3],.6) gc.rectangle("line",30*x-25,605-30*y,20,20) + gc.rectangle("line",30*x-20,610-30*y,10,10) elseif B==0 then - gc.setColor(.8,.8,.8,.6) + gc.setColor(1,1,1,.4) gc.line(30*x-25,605-30*y,30*x-5,625-30*y) gc.line(30*x-25,625-30*y,30*x-5,605-30*y) end @@ -380,13 +412,13 @@ Event={ end if P.human then gamefinished=true - newTask(Event_task.finish,P) SFX("win") VOICE("win") if modeEnv.royaleMode then BGM("8-bit happiness") end end + newTask(Event_task.finish,P) showText(P,text.win,"beat",90,nil,.4,curMode.id~="custom") end, lose=function() @@ -398,7 +430,9 @@ Event={ clearTask(P) for i=1,#players.alive do if players.alive[i]==P then - rem(players.alive,i) + for k=i,#players.alive do + players.alive[k]=players.alive[k+1] + end break end end @@ -410,10 +444,10 @@ Event={ P.strength=0 if P.lastRecv then local A,i=P,0 - ::L:: + repeat A,i=A.lastRecv,i+1 - if A and not A.alive and A~=P and i<3 then goto L end - if A and A~=P then + until not A or A.alive or A==P or i==3 + if A and A.alive then if P.id==1 or A.id==1 then P.killMark=A.id==1 end @@ -486,7 +520,7 @@ Event={ master_reach_lunatic=function() local t=P.modeData.point local c=#P.clearing - if t%100==99 and c==0 then goto L end + if t%100==99 and c==0 then return end t=t+(c<3 and c+1 or c==3 and 5 or 7) if int(t*.01)>P.modeData.event then P.modeData.event=P.modeData.event+1 @@ -494,7 +528,7 @@ Event={ P.modeData.event=4 P.modeData.point=500 Event.win() - goto L + return else local s=P.modeData.event+1 curBG=s==2 and"game1"or s==3 and"game2"or s==4 and"game3"or s==5 and"game4" @@ -510,12 +544,11 @@ Event={ end P.modeData.point=t if t%100==99 then SFX("blip_1")end - ::L:: end, master_reach_ultimate=function() local t=P.modeData.point local c=#P.clearing - if t%100==99 and c==0 then goto L end + if t%100==99 and c==0 then return end t=t+(c<3 and c+1 or c==3 and 5 or 7) if int(t*.01)>P.modeData.event then P.modeData.event=P.modeData.event+1 @@ -524,7 +557,7 @@ Event={ P.modeData.event=4 P.modeData.point=500 Event.win() - goto L + return else local s=P.modeData.event+1 curBG=s==2 and"game3"or s==3 and"game4"or s==4 and"game5"or s==5 and"game6" @@ -539,7 +572,6 @@ Event={ end P.modeData.point=t if t%100==99 then SFX("blip_1")end - ::L:: end, classic_reach=function() P.gameEnv.target=P.gameEnv.target+10 @@ -555,6 +587,14 @@ Event={ end end end, + GM_reach=function() + local R=#P.clearing + if R==4 then R=10 end + P.modeData.point=P.modeData.point+R + if P.stat.time>=53.5 then + Event.win() + end + end, tsd_reach=function() if P.lastClear~=52 then Event.lose() @@ -565,6 +605,8 @@ Event={ tech_reach_easy=function() if P.b2b<40 then Event.lose() + elseif P.stat.row==3 then + Event.win() end end, tech_reach_hard=function() @@ -579,22 +621,38 @@ Event={ end, c4w_reach=function() for i=1,#P.clearing do - ins(P.field,getNewRow(10)) - ins(P.visTime,getNewRow(20)) + P.field[#P.field+1]=getNewRow(10) + P.visTime[#P.visTime+1]=getNewRow(20) for i=4,7 do P.field[#P.field][i]=0 end end if #P.clearing==0 then if curMode.lv==2 then Event.lose() end - elseif P.combo>P.modeData.point then - P.modeData.point=P.combo + else + if P.combo>P.modeData.point then + P.modeData.point=P.combo + end + if P.stat.row>=200 then + Event.win() + end end end, newPC=function() - local P=players[1] if P.stat.piece%4==0 then if #P.field==#P.clearing then + P.modeData.event=P.modeData.event==0 and 1 or 0 + local r=rnd(#PClist) + local f=P.modeData.event==0 + for i=1,4 do + local b=PClist[r][i] + if f then + if b<3 then b=3-b + elseif b<5 then b=7-b + end + end + newNext(b) + end P.counter=P.stat.piece==0 and 20 or 0 newTask(Event_task.PC,P) if curMode.lv==2 then @@ -604,17 +662,30 @@ Event={ P.gameEnv.lock=pc_lock[s]or 20 P.gameEnv.fall=pc_fall[s]or 5 if s==10 then - showText(P,text.maxspeed,"appear",80,-140) + showText(P,text.maxspeed,"appear",100,-140,.6) else - showText(P,text.speedup,"appear",30,-140) + showText(P,text.speedup,"appear",40,-140) end end end else Event.lose() end + elseif P.curY+P.r>5-P.stat.row%4+#P.clearing then + Event.lose() end end, + puzzleCheck=function() + for y=1,20 do + local L=P.field[y] + for x=1,10 do + local a,b=preField[y][x],L and L[x]or 0 + if a~=-1 and(a==0 and b>0 or a<8 and a~=b or a>7 and b==0)then return end + end + end + P.modeData.event=1 + Event.win() + end } Event_task={ finish=function(self,P) @@ -678,10 +749,10 @@ Event_task={ if not P.control then return end P.counter=P.counter+1 if P.counter>=max(60,150-2*P.modeData.event)and P.atkBuffer.sum<4 then - ins(P.atkBuffer,{pos=rnd(10),amount=1,countdown=30,cd0=30,time=0,sent=false,lv=1}) + P.atkBuffer[#P.atkBuffer+1]={pos=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 showText(P,text.maxspeed,"appear",80,-140)end + if P.modeData.event==45 then showText(P,text.maxspeed,"appear",100,-140,.6)end P.counter=0 P.modeData.event=P.modeData.event+1 end @@ -691,14 +762,14 @@ Event_task={ P.counter=P.counter+1 if P.counter>=max(90,180-2*P.modeData.event)and P.atkBuffer.sum<8 then local d=P.modeData.event+1 - if d%4==0 then ins(P.atkBuffer,{pos=rnd(10),amount=1,countdown=60,cd0=60,time=0,sent=false,lv=1}) - elseif d%4==1 then ins(P.atkBuffer,{pos=rnd(10),amount=2,countdown=70,cd0=70,time=0,sent=false,lv=1}) - elseif d%4==2 then ins(P.atkBuffer,{pos=rnd(10),amount=3,countdown=80,cd0=80,time=0,sent=false,lv=2}) - elseif d%4==3 then ins(P.atkBuffer,{pos=rnd(10),amount=4,countdown=90,cd0=90,time=0,sent=false,lv=3}) - end + 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} P.atkBuffer.sum=P.atkBuffer.sum+d%4+1 P.stat.recv=P.stat.recv+d%4+1 - if P.modeData.event==45 then showText(P,text.maxspeed,"appear",80,-140)end + if P.modeData.event==45 then showText(P,text.maxspeed,"appear",100,-140,.6)end P.counter=0 P.modeData.event=d end @@ -707,15 +778,15 @@ Event_task={ if not P.control then return end P.counter=P.counter+1 if P.counter>=max(60,180-2*P.modeData.event)and P.atkBuffer.sum<15 then - if P.modeData.event%3<2 then - ins(P.atkBuffer,{pos=rnd(10),amount=1,countdown=0,cd0=0,time=0,sent=false,lv=1}) - else - ins(P.atkBuffer,{pos=rnd(10),amount=3,countdown=60,cd0=60,time=0,sent=false,lv=2}) - end + P.atkBuffer[#P.atkBuffer+1]= + P.modeData.event%3<2 and + {pos=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} local R=(P.modeData.event%3<2 and 1 or 3) P.atkBuffer.sum=P.atkBuffer.sum+R P.stat.recv=P.stat.recv+R - if P.modeData.event==45 then showText(P,text.maxspeed,"appear",80,-140)end + if P.modeData.event==45 then showText(P,text.maxspeed,"appear",100,-140,.6)end P.counter=0 P.modeData.event=P.modeData.event+1 end @@ -725,10 +796,10 @@ Event_task={ P.counter=P.counter+1 if P.counter>=max(60,150-P.modeData.event)and P.atkBuffer.sum<20 then local t=max(60,90-P.modeData.event) - ins(P.atkBuffer,{pos=rnd(10),amount=4,countdown=t,cd0=t,time=0,sent=false,lv=3}) + P.atkBuffer[#P.atkBuffer+1]={pos=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 showText(P,text.maxspeed,"appear",80,-140)end + if P.modeData.event==60 then showText(P,text.maxspeed,"appear",100,-140,.6)end P.counter=0 P.modeData.event=P.modeData.event+1 end @@ -738,17 +809,52 @@ Event_task={ P.counter=P.counter+1 if P.counter>=max(300,600-10*P.modeData.event)and P.atkBuffer.sum<20 then local t=max(300,480-12*P.modeData.event) - ins(P.atkBuffer,{pos=rnd(10),amount=4,countdown=t,cd0=t,time=0,sent=false,lv=2}) - ins(P.atkBuffer,{pos=rnd(10),amount=4,countdown=t,cd0=t,time=0,sent=false,lv=3}) - ins(P.atkBuffer,{pos=rnd(10),amount=6,countdown=1.2*t,cd0=1.2*t,time=0,sent=false,lv=4}) - ins(P.atkBuffer,{pos=rnd(10),amount=6,countdown=1.5*t,cd0=1.5*t,time=0,sent=false,lv=5}) + 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.sum=P.atkBuffer.sum+20 - P.stat.recv=P.stat.recv+4 + P.stat.recv=P.stat.recv+20 P.counter=0 - if P.modeData.event==31 then showText(P,text.maxspeed,"appear",80,-140)end + if P.modeData.event==31 then showText(P,text.maxspeed,"appear",100,-140,.6)end P.modeData.event=P.modeData.event+1 end end, + survivor_extra=function(self,P) + if not P.control then return end + if P.atkBuffer.sum<3 then + local p=#P.atkBuffer+1 + local T=P.modeData.event + if T<15 then + local t=1200-20*T--1200~900 + P.atkBuffer[p] ={pos=rnd(5,6),amount=10,countdown=t,cd0=t,time=0,sent=false,lv=3} + P.atkBuffer[p+1]={pos=rnd(4,7),amount=10,countdown=t,cd0=t,time=0,sent=false,lv=4} + elseif T<30 then + local t=900-20*(T-15)--900~600 + P.atkBuffer[p] ={pos=rnd(3,8),amount=10,countdown=t,cd0=t,time=0,sent=false,lv=4} + P.atkBuffer[p+1]={pos=rnd(4,7),amount=12,countdown=t,cd0=t,time=0,sent=false,lv=5} + else + local t=max(480,720-16*(T-30))--720~480 + P.atkBuffer[p] ={pos=rnd(2)*9-8,amount=12,countdown=t,cd0=t,time=0,sent=false,lv=5} + P.atkBuffer[p+1]={pos=rnd(3,8),amount=12,countdown=t,cd0=t,time=0,sent=false,lv=5} + end + P.atkBuffer.sum=P.atkBuffer.sum+20 + P.stat.recv=P.stat.recv+20 + P.modeData.event=P.modeData.event+1 + if P.modeData.event==15 then + showText(P,text.awesome,"appear",100,-140,.6) + elseif P.modeData.event==16 then + pushSpeed=4 + elseif P.modeData.event==30 then + showText(P,text.continue,"appear",100,-140,.6) + elseif P.modeData.event==31 then + pushSpeed=6 + elseif P.modeData.event==45 then + showText(P,text.maxspeed,"appear",100,-140,.6) + end + end + end, PC=function(self,P) P.counter=P.counter+1 if P.counter==21 then @@ -960,10 +1066,10 @@ defaultModeEnv={ { _20G=true, drop=0,lock=15, - wait=10, - fall=15, + wait=10,fall=15, visible="fast", freshLimit=15, + target=1,reach=Event.GM_reach, arr=1, bg="game3",bgm="secret8th", }, @@ -1001,7 +1107,7 @@ defaultModeEnv={ bg="game2",bgm="secret8th", }, { - drop=5,lock=60, + drop=6,lock=60, fall=10, freshLimit=15, bg="game3",bgm="secret7th", @@ -1012,13 +1118,19 @@ defaultModeEnv={ freshLimit=15, bg="rgb",bgm="secret7th", }, + { + drop=3,lock=60, + fall=8, + freshLimit=15, + bg="game4",bgm="push", + }, }, tech={ { oncehold=false, drop=1e99,lock=1e99, target=1,reach=Event.tech_reach_easy, - bg="matrix",bgm="way", + bg="matrix",bgm="newera", }, { oncehold=false, @@ -1029,18 +1141,23 @@ defaultModeEnv={ { drop=10,lock=60, freshLimit=15, - target=1,reach=Event.tech_reach_hard, - bg="matrix",bgm="way", - }, - { - drop=3,lock=40, - target=1, - freshLimit=15, - reach=Event.tech_reach_hard, + target=1,reach=Event.tech_reach_easy, bg="matrix",bgm="secret8th", }, { - drop=1,lock=40, + drop=30,lock=60, + freshLimit=15, + target=1,reach=Event.tech_reach_ultimate, + bg="matrix",bgm="secret8th", + }, + { + _20G=true,lock=60, + freshLimit=15, + target=1,reach=Event.tech_reach_hard, + bg="matrix",bgm="secret7th", + }, + { + _20G=true,lock=60, freshLimit=15, target=1,reach=Event.tech_reach_ultimate, bg="matrix",bgm="secret7th", @@ -1065,7 +1182,7 @@ defaultModeEnv={ hold=false, drop=150,lock=150, fall=20, - sequence="pc", + sequence="none", target=0,reach=Event.newPC, ospin=false, bg="rgb",bgm="newera", @@ -1075,7 +1192,7 @@ defaultModeEnv={ hold=false, drop=60,lock=60, fall=20, - sequence="pc", + sequence="none", freshLimit=15, target=0,reach=Event.newPC, ospin=false, @@ -1160,8 +1277,8 @@ defaultModeEnv={ reach=Event.win, }, { - Fkey=true, - reach=Event.win, + Fkey=true,puzzle=true, + target=0,reach=Event.puzzleCheck, }, }, } \ No newline at end of file diff --git a/font.ttf b/font.ttf index fa8fb009..3653471e 100644 Binary files a/font.ttf and b/font.ttf differ diff --git a/gamefunc.lua b/gamefunc.lua index 5a7fdb8b..54055df8 100644 --- a/gamefunc.lua +++ b/gamefunc.lua @@ -1,9 +1,40 @@ local gc=love.graphics +local int,ceil,abs,rnd,max,min=math.floor,math.ceil,math.abs,math.random,math.max,math.min +local ins,rem=table.insert,table.remove + +local gameEnv0={ + das=10,arr=2, + sddas=0,sdarr=2, + ghost=true,center=true, + grid=false,swap=true, + _20G=false,bone=false, + drop=30,lock=45, + wait=0,fall=0, + next=6,hold=true,oncehold=true, + sequence="bag7", + + block=true, + keepVisible=true,visible="show", + Fkey=false,puzzle=false,ospin=true, + freshLimit=1e99,target=1e99,reach=null, + bg="none",bgm="race" +} local blockPos={4,4,4,4,4,5,4} local renATK={[0]=0,0,0,1,1,2,2,3,3,4,4}--3 else local b2bPoint={50,100,180} local b2bATK={3,5,8} -local testScore={[-1]=1,[-2]=0,[-3]=1,2,2,2} +local clearSCR={40,100,180} +local spinSCR={--[blockName][row] + {200,750,1600},--Z + {200,750,1600},--S + {220,700,1600},--L + {220,700,1600},--J + {250,800,1500},--T + {300,1000,2200},--O + {300,1000,1800},--I +}--MUL:1.2,2.0 +--Techrash:1K;MUL:1.3,1.8 +--Mini*=.5 local visible_opt={show=1e99,time=300,fast=20,none=5} local reAtk={0,0,1,1,1,2,2,3,3} local reDef={0,1,1,2,3,3,4,4,5} @@ -12,7 +43,6 @@ local clearName={"single","double","triple"} local spin_n={[0]="spin_0","spin_1","spin_2","spin_3"} local clear_n={"clear_1","clear_2","clear_3","clear_4"} local ren_n={}for i=1,11 do ren_n[i]="ren_"..i end - local scs={ {[0]={1,2},{2,1},{2,2},{2,2}}, {[0]={1,2},{2,1},{2,2},{2,2}}, @@ -81,7 +111,11 @@ local TRS={ } }TRS[3],TRS[4]=TRS[2],TRS[1] +local function newNext(n) + P.next[#P.next+1]={bk=blocks[n][0],id=n,color=P.gameEnv.bone and 8 or n,name=n} +end local freshMethod={ + none=function()end, bag7=function() if #P.next<6 then local bag={1,2,3,4,5,6,7} @@ -93,11 +127,11 @@ local freshMethod={ his4=function() if #P.next<6 then local j,i=0 - ::L:: + repeat i,j=rnd(7),j+1 - if(i==P.his[1]or i==P.his[2]or i==P.his[3]or i==P.his[4])then goto L end + until i~=P.his[1]and i~=P.his[2]and i~=P.his[3]and i~=P.his[4] newNext(i) - rem(P.his,1)ins(P.his,i) + rem(P.his,1)P.his[4]=i end end, rnd=function() @@ -107,22 +141,6 @@ local freshMethod={ if i==P.next[5]then goto L end newNext(i) end,--random - pc=function() - if P.stat.piece%4==0 then - local r=rnd(#PClist) - local f=P.modeData.event==1 - for i=1,4 do - local b=PClist[r][i] - if f then - if b<3 then b=3-b - elseif b<5 then b=7-b - end - end - newNext(b) - end - P.modeData.event=(P.modeData.event+1)%2 - end - end, drought1=function() if #P.next<6 then local bag={1,2,3,4,5,6} @@ -151,306 +169,10 @@ local shadeColor={ } local function createShade(x1,y1,x2,y2)--x1y2 if P.gameEnv.block and y1>=y2 then - ins(P.shade,{5,P.cur.color,x1,y1,x2,y2}) + P.shade[#P.shade+1]={5,P.cur.color,x1,y1,x2,y2} end end -function loadGame(mode,level) - --rec={} - curMode={id=modeID[mode],lv=level} - PTC.attack[1]:reset()PTC.attack[2]:reset()PTC.attack[3]:reset() - drawableText.modeName:set(text.modeName[mode]) - drawableText.levelName:set(modeLevel[modeID[mode]][level]) - needResetGameData=true - gotoScene("play","deck") -end -function resetPartGameData() - frame=30 - if players then - for _,P in next,players do if P.id then - while P.field[1]do - removeRow(P.field) - removeRow(P.visTime) - end - end end - end - players={alive={}}human=0 - loadmode[curMode.id]() - if modeEnv.royaleMode then - for i=1,#players do - changeAtk(players[i],randomTarget(players[i])) - end - end - for i=1,#virtualkey do - virtualkey[i].press=false - end - collectgarbage() -end -function resetGameData() - gamefinished=false - frame=0 - garbageSpeed=1 - pushSpeed=3 - pauseTime=0--Time paused - pauseCount=0--Times paused - if players then - for _,P in next,players do if P.id then - while P.field[1]do - removeRow(P.field) - removeRow(P.visTime) - end - end end - end - players={alive={}}human=0 - modeEnv=defaultModeEnv[curMode.id][curMode.lv]or defaultModeEnv[curMode.id][1] - loadmode[curMode.id]() - curBG=modeEnv.bg - BGM(modeEnv.bgm) - - FX.beam={} - for _,v in next,PTC.dust do - v:release() - end - for i=1,#players do - if not players[i].small then - PTC.dust[i]=PTC.dust0:clone() - PTC.dust[i]:start() - end - end - if modeEnv.royaleMode then - for i=1,#players do - changeAtk(players[i],randomTarget(players[i])) - end - mostBadge,mostDangerous,secBadge,secDangerous=nil - gameStage=1 - garbageSpeed=.3 - pushSpeed=2 - end - for i=1,#virtualkey do - virtualkey[i].press=false - end - stat.game=stat.game+1 - local p=60*#players - while freeRow[p]do - rem(freeRow) - end - SFX("ready") - collectgarbage() -end -function gameStart() - SFX("start") - for P=1,#players do - P=players[P] - _G.P=P - P.control=true - P.timing=true - resetblock() - end - setmetatable(_G,nil) -end -function createPlayer(id,x,y,size,AIspeed,data) - players[id]={id=id} - P=players[id] - local P=P - ins(players.alive,P) - P.index={__index=P} - P.x,P.y,P.size=x,y,size or 1 - P.fieldOffX,P.fieldOffY=0,0 - P.small=P.size<.1 - if P.small then - P.centerX,P.centerY=P.x+300*P.size,P.y+600*P.size - P.canvas=gc.newCanvas(60,120) - P.frameWait=rnd(30,120) - else - P.centerX,P.centerY=P.x+300*P.size,P.y+670*P.size - P.absFieldX=P.x+150*P.size - P.absFieldY=P.y+60*P.size - end - - if AIspeed then - P.ai={ - controls={}, - controlDelay=30, - controlDelay0=AIspeed, - } - else - P.human=true - human=human+1 - end - - P.alive=true - P.control=false - P.timing=false - P.stat={ - time=0, - key=0,rotate=0,hold=0,piece=0,row=0, - atk=0,send=0,recv=0,pend=0, - clear_1=0,clear_2=0,clear_3=0,clear_4=0, - spin_0=0,spin_1=0,spin_2=0,spin_3=0, - pc=0,b2b=0,b3b=0, - }--Current gamestat - P.modeData={point=0,event=0}--data use by mode - P.keyTime={}for i=1,10 do P.keyTime[i]=-1e5 end P.keySpeed=0 - P.dropTime={}for i=1,10 do P.dropTime[i]=-1e5 end P.dropSpeed=0 - - P.field,P.visTime={},{} - P.atkBuffer={sum=0} - - P.ko,P.badge,P.strength=0,0,0 - P.atkMode,P.swappingAtkMode=1,20 - P.atker,P.atking,P.lastRecv={} - --Royale-related - - P.gameEnv={}--Game setting vars,like dropDelay setting - for k,v in pairs(gameEnv0)do - if data and data[k]~=nil then - P.gameEnv[k]=data[k] - elseif modeEnv[k]~=nil then - P.gameEnv[k]=modeEnv[k] - elseif setting[k]~=nil then - P.gameEnv[k]=setting[k] - else - P.gameEnv[k]=v - end - end--reset current game settings - P.cur={bk={{}},id=0,color=0,name=0} - P.sc,P.dir,P.r,P.c={0,0},0,0,0 - P.curX,P.curY,P.y_img=0,0,0 - P.hold={bk={{}},id=0,color=0,name=0} - P.holded=false - P.next={} - - P.dropDelay,P.lockDelay=P.gameEnv.drop,P.gameEnv.lock - P.freshTime=0 - P.spinLast,P.lastClear=false,nil - - P.his={rnd(7),rnd(7),rnd(7),rnd(7)} - local s=P.gameEnv.sequence - if s=="bag7"or s=="his4"then - local bag1={1,2,3,4,5,6,7} - for i=1,7 do - newNext(rem(bag1,rnd(#bag1))) - end - elseif s=="rnd"then - for i=1,6 do - local r=rnd(7) - newNext(r) - end - elseif s=="drought1"then - local bag1={1,2,3,4,5,6} - for i=1,6 do - newNext(rem(bag1,rnd(#bag1))) - end - elseif s=="drought2"then - local bag1={1,2,3,4,6,7} - for i=1,6 do - newNext(rem(bag1,rnd(#bag1))) - end - end - - P.freshNext=freshMethod[P.gameEnv.sequence] - if P.gameEnv.sequence==1 then P.bag={}--Bag7 - elseif P.gameEnv.sequence==2 then P.his={}for i=1,4 do P.his[i]=P.next.id[i+3]end--History4 - elseif P.gameEnv.sequence==3 then--Pure random - end - - P.showTime=visible_opt[P.gameEnv.visible] - P.keepVisible=P.gameEnv.visible=="show" - P.keyPressing={}for i=1,12 do P.keyPressing[i]=false end - P.moving,P.downing=0,0 - P.waiting,P.falling=-1,-1 - P.clearing={} - P.fieldBeneath=0 - - P.combo,P.b2b=0,0 - P.shade,P.b2b1={},0 - - P.endCounter=0 - P.counter=0 - P.result=nil--string:win/lose - P.bonus={} -end -function showText(P,text,type,font,dy,spd,inf) - if not P.small then - ins(P.bonus,{t=0,text=text,draw=FX[type],font=font,dy=dy or 0,speed=spd or 1,inf=inf}) - end -end -function garbageSend(S,R,send,time) - createBeam(S,R,send<4 and 1 or send<7 and 2 or 3) - R.lastRecv=S - if R.atkBuffer.sum<20 then - send=min(send,20-R.atkBuffer.sum) - R.atkBuffer.sum=R.atkBuffer.sum+send - ins(R.atkBuffer,{ - pos=rnd(10), - amount=send, - countdown=time, - cd0=time, - time=0, - sent=false, - lv=min(int(send^.69),5), - }) - R.stat.recv=R.stat.recv+send - if R.human then - SFX(send<4 and "blip_1"or"blip_2",min(send+1,5)*.1) - end - end -end -function garbageRelease() - for i=1,#P.atkBuffer do - local A=P.atkBuffer[i] - if not A.sent and A.countdown<=0 then - garbageRise(8+A.lv,A.amount,A.pos) - P.atkBuffer.sum=P.atkBuffer.sum-A.amount - P.stat.pend=P.stat.pend+A.amount - A.sent=true - A.time=0 - end - end -end -function garbageRise(color,amount,pos) - local t=P.showTime*2 - for _=1,amount do - ins(P.field,1,getNewRow(color)) - ins(P.visTime,1,getNewRow(t)) - P.field[1][pos]=0 - end - P.fieldBeneath=P.fieldBeneath+amount*30 - P.curY=P.curY+amount - freshgho() - for i=1,#P.clearing do - P.clearing[i]=P.clearing[i]+amount - end - if #P.field>40 then Event.lose()end -end -function createBeam(S,R,lv)--Player id - local x1,y1,x2,y2 - if S.small then - x1,y1=S.centerX,S.centerY - else - x1,y1=S.x+(30*(P.curX+P.sc[2]-1)-30+15+150)*S.size,S.y+(600-30*(P.curY+P.sc[1]-1)+15+70)*S.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 - end - ins(FX.beam,{x1,y1,x2,y2,t=0,lv=lv}) -end -function throwBadge(S,R)--Sender/Receiver - local x1,y1,x2,y2 - if S.small then - x1,y1=S.centerX,S.centerY - else - x1,y1=S.x+308*S.size,S.y+450*S.size - end - if R.small then - x2,y2=R.centerX,R.centerY - else - x2,y2=R.x+70*R.size,R.y+344*R.size - end - ins(FX.badge,{x1,y1,x2,y2,t=0}) -end -function randomTarget(p) +local function randomTarget(p) if #players.alive>1 then local r ::L:: @@ -478,7 +200,7 @@ function freshTarget(P) end end function changeAtkMode(m) - if P.atkMode==m then goto L end + if P.atkMode==m then return end P.atkMode=m if m==1 then changeAtk(P,randomTarget(P)) @@ -504,7 +226,7 @@ function changeAtk(P,R) ::L:: if R then P.atking=R - ins(R.atker,P) + R.atker[#R.atker+1]=P else P.atking=nil end @@ -571,48 +293,360 @@ function royaleLevelup() end end end -function freshgho() - P.y_img=min(#P.field+1,P.curY) - if P.gameEnv._20G or P.keyPressing[7]and P.gameEnv.sdarr==0 then - ::L::if not ifoverlap(P.cur.bk,P.curX,P.y_img-1)then - P.y_img=P.y_img-1 - P.spinLast=false - goto L - end - if P.curY>P.y_img then - if P.human and setting.fxs then - createShade(P.curX,P.curY+1,P.curX+P.c-1,P.y_img+P.r-1) - P.fieldOffY=4 +function loadGame(mode,level) + --rec={} + curMode={id=modeID[mode],lv=level} + drawableText.modeName:set(text.modeName[mode]) + drawableText.levelName:set(modeLevel[modeID[mode]][level]) + needResetGameData=true + gotoScene("play","deck") +end +local function resetPartGameData() + frame=30 + if players then + for _,P in next,players do if P.id then + while P.field[1]do + removeRow(P.field) + removeRow(P.visTime) end - P.curY=P.y_img + end end + end + players={alive={}}human=0 + loadmode[curMode.id]() + if modeEnv.royaleMode then + for i=1,#players do + changeAtk(players[i],randomTarget(players[i])) + end + end + for i=1,#virtualkey do + virtualkey[i].press=false + end + collectgarbage() +end +function resetGameData() + gamefinished=false + frame=0 + garbageSpeed=1 + pushSpeed=3 + pauseTime=0--Time paused + pauseCount=0--Times paused + if players then + for _,P in next,players do if P.id then + while P.field[1]do + removeRow(P.field) + removeRow(P.visTime) + end + end end + end + players={alive={}}human=0 + modeEnv=defaultModeEnv[curMode.id][curMode.lv]or defaultModeEnv[curMode.id][1] + loadmode[curMode.id]() + curBG=modeEnv.bg + BGM(modeEnv.bgm) + + FX.badge={} + FX.attack={} + for _,v in next,PTC.dust do + v:release() + end + for i=1,#players do + if not players[i].small then + PTC.dust[i]=PTC.dust0:clone() + PTC.dust[i]:start() + end + end + if modeEnv.royaleMode then + for i=1,#players do + changeAtk(players[i],randomTarget(players[i])) + end + mostBadge,mostDangerous,secBadge,secDangerous=nil + gameStage=1 + garbageSpeed=.3 + pushSpeed=2 + end + for i=1,#virtualkey do + virtualkey[i].press=false + end + stat.game=stat.game+1 + local m,p=#freeRow,40*#players+1 + while freeRow[p]do + m,freeRow[m]=m-1 + end + freeRow.L=#freeRow + SFX("ready") + collectgarbage() +end +function gameStart() + SFX("start") + for P=1,#players do + P=players[P] + _G.P=P + P.control=true + P.timing=true + resetblock() + end + setmetatable(_G,nil) +end +function createPlayer(id,x,y,size,AIspeed,data) + players[id]={id=id} + P=players[id] + local P=P + players.alive[#players.alive+1]=P + P.index={__index=P} + P.x,P.y,P.size=x,y,size or 1 + P.fieldOffX,P.fieldOffY=0,0 + P.small=P.size<.1 + if P.small then + P.centerX,P.centerY=P.x+300*P.size,P.y+600*P.size + P.canvas=gc.newCanvas(60,120) + P.frameWait=rnd(30,120) + else + P.centerX,P.centerY=P.x+300*P.size,P.y+670*P.size + P.absFieldX=P.x+150*P.size + P.absFieldY=P.y+60*P.size + end + + if AIspeed then + P.ai={ + controls={}, + controlDelay=30, + controlDelay0=AIspeed, + } + else + P.human=true + human=human+1 + end + + P.alive=true + P.control=false + P.timing=false + P.stat={ + time=0, + key=0,rotate=0,hold=0,piece=0,row=0, + atk=0,send=0,recv=0,pend=0, + clear_1=0,clear_2=0,clear_3=0,clear_4=0, + spin_0=0,spin_1=0,spin_2=0,spin_3=0, + pc=0,b2b=0,b3b=0,score=0, + }--Current gamestat + P.modeData={point=0,event=0}--data use by mode + P.keyTime={}for i=1,10 do P.keyTime[i]=-1e5 end P.keySpeed=0 + P.dropTime={}for i=1,10 do P.dropTime[i]=-1e5 end P.dropSpeed=0 + + P.field,P.visTime={},{} + P.atkBuffer={sum=0} + + P.ko,P.badge,P.strength=0,0,0 + P.atkMode,P.swappingAtkMode=1,20 + P.atker,P.atking,P.lastRecv={} + --Royale-related + + P.gameEnv={}--Game setting vars,like dropDelay setting + for k,v in pairs(gameEnv0)do + if data and data[k]~=nil then + P.gameEnv[k]=data[k] + elseif modeEnv[k]~=nil then + P.gameEnv[k]=modeEnv[k] + elseif setting[k]~=nil then + P.gameEnv[k]=setting[k] + else + P.gameEnv[k]=v + end + end--reset current game settings + P.cur={bk={{}},id=0,color=0,name=0} + P.sc,P.dir,P.r,P.c={0,0},0,0,0 + P.curX,P.curY,P.y_img=0,0,0 + P.hold={bk={{}},id=0,color=0,name=0} + P.holded=false + P.next={} + + P.dropDelay,P.lockDelay=P.gameEnv.drop,P.gameEnv.lock + P.freshTime=0 + P.spinLast,P.lastClear=false,nil + + P.his={rnd(7),rnd(7),rnd(7),rnd(7)} + local s=P.gameEnv.sequence + if s=="bag7"or s=="his4"then + local bag1={1,2,3,4,5,6,7} + for i=1,7 do + newNext(rem(bag1,rnd(#bag1))) + end + elseif s=="rnd"then + for i=1,6 do + local r=rnd(7) + newNext(r) + end + elseif s=="drought1"then + local bag1={1,2,3,4,5,6} + for i=1,6 do + newNext(rem(bag1,rnd(#bag1))) + end + elseif s=="drought2"then + local bag1={1,2,3,4,6} + for i=1,6 do + newNext(rem(bag1,rnd(#bag1))) + end + end + + P.freshNext=freshMethod[P.gameEnv.sequence] + if P.gameEnv.sequence==1 then P.bag={}--Bag7 + elseif P.gameEnv.sequence==2 then P.his={}for i=1,4 do P.his[i]=P.next.id[i+3]end--History4 + elseif P.gameEnv.sequence==3 then--Pure random + end + + P.showTime=visible_opt[P.gameEnv.visible] + P.keepVisible=P.gameEnv.visible=="show" + P.keyPressing={}for i=1,12 do P.keyPressing[i]=false end + P.moving,P.downing=0,0 + P.waiting,P.falling=-1,-1 + P.clearing={} + P.combo,P.b2b=0,0 + P.fieldBeneath=0 + + P.shade={} + P.score1,P.b2b1=0,0 + P.bonus={}--texts + + P.endCounter=0--used after gameover + P.counter=0--many usage + P.result=nil--string:win/lose +end +function showText(P,text,type,font,dy,spd,inf) + if not P.small then + P.bonus[#P.bonus+1]={t=0,text=text,draw=FX[type],font=font,dy=dy or 0,speed=spd or 1,inf=inf} + end +end +local function createBeam(S,R,send,time,target,color,clear,spin,mini,combo) + local x1,y1,x2,y2 + if S.small then x1,y1=S.centerX,S.centerY + else x1,y1=S.x+(30*(P.curX+P.sc[2]-1)-30+15+150)*S.size,S.y+(600-30*(P.curY+P.sc[1]-1)+15+70)*S.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 + end + + local radius,corner + local a,r,g,b=1,unpack(blockColor[color]) + if clear>10 then + radius=30+3*(send-target) + local t=clear%10 + if t==1 then + corner=3 + r=.3+r*.4 + g=.3+g*.4 + b=.3+b*.4 + elseif t==2 then + corner=5 + r=.5+r*.5 + g=.5+g*.5 + b=.5+b*.5 + elseif t<6 then + corner=6 + r=.6+r*.4 + g=.6+g*.4 + b=.6+b*.4 + else + r=.8+r*.2 + g=.8+g*.2 + b=.8+b*.2 + corner=20 end else - ::L::if not ifoverlap(P.cur.bk,P.curX,P.y_img-1)then - P.y_img=P.y_img-1 - goto L + if combo>3 then + radius=min(15+combo,30) + corner=3 + else + radius=30 + corner=4 + end + r=1-r*.3 + g=1-g*.3 + b=1-b*.3 + end + if modeEnv.royaleMode then + if S.ai and R.ai then + radius=radius*.3 + a=.35 + end + end + FX.attack[#FX.attack+1]={ + x1=x1,y1=y1, + x2=x2,y2=y2, + rad=radius, + corner=corner, + type=type==1 and"fill"or"line", + r=r,g=g,b=b,a=a*(setting.fxs+1)*.25, + t=0, + } +end +local function garbageSend(S,R,send,time,...) + createBeam(S,R,send,time,...) + R.lastRecv=S + if R.atkBuffer.sum<20 then + local B=R.atkBuffer + send=min(send,20-B.sum) + B.sum=B.sum+send + local m,k=#B,1 + while k<=m and time>B[k].countdown do k=k+1 end + for i=k,m do + B[i+1]=B[i] + end + B[k]={ + pos=rnd(10), + amount=send, + countdown=time, + cd0=time, + time=0, + sent=false, + lv=min(int(send^.69),5), + }--Sorted insert + R.stat.recv=R.stat.recv+send + if R.human then + SFX(send<4 and "blip_1"or"blip_2",min(send+1,5)*.1) end end end -function freshLockDelay() - if P.lockDelay40 then Event.lose()end +end +local function ifoverlap(bk,x,y) if x<1 or x+#bk[1]>11 or y<1 then return true end if y>#P.field then return end for i=1,#bk do for j=1,#bk[1]do if P.field[y+i-1]and bk[i][j]and P.field[y+i-1][x+j-1]>0 then return true end end end end -function ckfull(i) +local function ckfull(i) for j=1,10 do if P.field[i][j]==0 then return end end return true end -function checkrow(start,height)--(cy,r) +local function checkrow(start,height)--(cy,r) local c=0 for i=start,start+height-1 do if ckfull(i)then @@ -630,36 +664,54 @@ function checkrow(start,height)--(cy,r) if c>0 then P.falling=P.gameEnv.fall end return c end -function solid(x,y) +local function solid(x,y) if x<1 or x>10 or y<1 then return true end if y>#P.field then return false end return P.field[y][x]>0 end -function newNext(n) - ins(P.next,{bk=blocks[n][0],id=n,color=P.gameEnv.bone and 8 or n,name=n}) +function freshgho() + P.y_img=min(#P.field+1,P.curY) + if P.gameEnv._20G or P.keyPressing[7]and P.gameEnv.sdarr==0 then + ::L::if not ifoverlap(P.cur.bk,P.curX,P.y_img-1)then + P.y_img=P.y_img-1 + P.spinLast=false + goto L + end + if P.curY>P.y_img then + if P.human and setting.fxs>0 then + createShade(P.curX,P.curY+1,P.curX+P.c-1,P.y_img+P.r-1) + P.fieldOffY=2*setting.fxs + end + P.curY=P.y_img + end + else + ::L::if not ifoverlap(P.cur.bk,P.curX,P.y_img-1)then + P.y_img=P.y_img-1 + goto L + end + end end -function resetblock() - P.holded,P.spinLast=false,false - P.cur=rem(P.next,1) - P.freshNext() - P.sc,P.dir=scs[P.cur.id][0],0--spin center/direction - P.r,P.c=#P.cur.bk,#P.cur.bk[1]--row/column - P.curX,P.curY=blockPos[P.cur.id],21+ceil(P.fieldBeneath/30)-P.r+min(int(#P.field*.2),2) - P.dropDelay,P.lockDelay,P.freshTime=P.gameEnv.drop,P.gameEnv.lock,0 - - if P.keyPressing[8]then hold(true)end - if P.keyPressing[3]then spin(1,true)end - if P.keyPressing[4]then spin(-1,true)end - if P.keyPressing[5]then spin(2,true)end - if abs(P.moving)-P.gameEnv.das>1 and not ifoverlap(P.cur.bk,P.curX+(P.moving>0 and 1 or -1),P.curY)then - P.curX=P.curX+(P.moving>0 and 1 or -1) - end--Initial SYSs - - if ifoverlap(P.cur.bk,P.curX,P.curY)then lock()Event.lose()end - freshgho() - if P.keyPressing[6]then act.hardDrop()P.keyPressing[6]=false end +local function freshLockDelay() + if P.lockDelay0 then createShade(P.curX,P.curY+P.r-1,P.curX+P.c-1,P.curY) end P.curX,P.curY,P.dir=ix,iy,idir P.sc,P.cur.bk=scs[P.cur.id][idir],icb P.r,P.c=ir,ic - P.spinLast=t==2 and testScore[-d]or 2 + P.spinLast=t==2 and d==2 and 0 or 1 freshgho() freshLockDelay() if P.human then SFX(ifpre and"prerotate"or ifoverlap(P.cur.bk,P.curX,P.curY+1)and ifoverlap(P.cur.bk,P.curX-1,P.curY)and ifoverlap(P.cur.bk,P.curX+1,P.curY)and"rotatekick"or"rotate") end P.stat.rotate=P.stat.rotate+1 - ::quit:: end -function hold(ifpre) +local function hold(ifpre) if not P.holded and P.waiting==-1 and P.gameEnv.hold then P.holded=P.gameEnv.oncehold P.cur,P.hold=P.hold,P.cur @@ -765,9 +816,30 @@ function hold(ifpre) P.stat.hold=P.stat.hold+1 end end +function resetblock() + P.holded,P.spinLast=false,false + P.cur=rem(P.next,1) + P.freshNext() + P.sc,P.dir=scs[P.cur.id][0],0--spin center/direction + P.r,P.c=#P.cur.bk,#P.cur.bk[1]--row/column + P.curX,P.curY=blockPos[P.cur.id],21+ceil(P.fieldBeneath/30)-P.r+min(int(#P.field*.2),2) + P.dropDelay,P.lockDelay,P.freshTime=P.gameEnv.drop,P.gameEnv.lock,0 + + if P.keyPressing[8]then hold(true)end + if P.keyPressing[3]then spin(1,true)end + if P.keyPressing[4]then spin(-1,true)end + if P.keyPressing[5]then spin(2,true)end + if abs(P.moving)-P.gameEnv.das>1 and not ifoverlap(P.cur.bk,P.curX+(P.moving>0 and 1 or -1),P.curY)then + P.curX=P.curX+(P.moving>0 and 1 or -1) + end--Initial SYSs + + if ifoverlap(P.cur.bk,P.curX,P.curY)then lock()Event.lose()end + freshgho() + if P.keyPressing[6]then act.hardDrop()P.keyPressing[6]=false end +end function drop() if P.curY==P.y_img then - ins(P.dropTime,1,frame)rem(P.dropTime,11)--update speed dial + P.dropTime[11]=ins(P.dropTime,1,frame)--update speed dial P.waiting=P.gameEnv.wait local dospin=0 if P.spinLast then @@ -787,7 +859,8 @@ function drop() end--Immobile end lock() - local cc,send,exblock,sendTime=checkrow(P.curY,P.r),0,0,0--Currect clear&send&sendTime + local cc,send,exblock=checkrow(P.curY,P.r),0,0--Currect clear&send&sendTime + local cscore,sendTime=0,0 local mini if P.spinLast and cc>0 and dospin>0 then dospin=dospin+P.spinLast @@ -806,11 +879,13 @@ function drop() P.combo=P.combo+1--combo=0 is under if cc==4 then + cscore=1000 if P.b2b>1000 then showText(P,text.techrashB3B,"fly",80,-30) send=6 sendTime=100 exblock=exblock+1 + cscore=cscore*1.8 P.stat.b3b=P.stat.b3b+1 if P.human then VOICE("b3b") @@ -819,6 +894,7 @@ function drop() showText(P,text.techrashB2B,"drive",80,-30) sendTime=80 send=5 + cscore=cscore*1.3 P.stat.b2b=P.stat.b2b+1 if P.human then VOICE("b2b") @@ -837,10 +913,12 @@ function drop() elseif cc>0 then local clearKey=clear_n if dospin then + cscore=spinSCR[P.cur.name][cc] if P.b2b>1000 then showText(P,text.b3b..text.spin[P.cur.name]..text.clear[cc],"spin",40,-30) send=b2bATK[cc]+1 exblock=exblock+1 + cscore=cscore*2 P.stat.b3b=P.stat.b3b+1 if P.human then VOICE("b3b") @@ -848,6 +926,7 @@ function drop() elseif P.b2b>=40 then showText(P,text.b2b..text.spin[P.cur.name]..text.clear[cc],"spin",40,-30) send=b2bATK[cc] + cscore=cscore*1.2 P.stat.b2b=P.stat.b2b+1 if P.human then VOICE("b2b") @@ -861,6 +940,7 @@ function drop() showText(P,text.mini,"appear",40,-80) send=ceil(send*.5) sendTime=sendTime+60 + cscore=cscore*.5 P.b2b=P.b2b+b2bPoint[cc]*.8 if P.human then VOICE("mini") @@ -880,6 +960,7 @@ function drop() showText(P,text.clear[cc],"appear",32+cc*3,-30,(8-cc)*.3) send=cc-1 sendTime=20+send*20 + cscore=cscore+clearSCR[cc] P.lastClear=cc end P.stat[clearKey[cc]]=P.stat[clearKey[cc]]+1 @@ -897,7 +978,9 @@ function drop() VOICE(blockName[P.cur.name]) VOICE("spin") end + cscore=cscore+20 end + cscore=cscore+5 end send=send+(renATK[P.combo]or 4) if #P.clearing==#P.field then @@ -905,7 +988,12 @@ function drop() send=min(send,4)+min(6+P.stat.pc,10) exblock=exblock+2 sendTime=sendTime+60 - if P.stat.row>4 then P.b2b=1200 end + if P.stat.row>4 then + P.b2b=1200 + cscore=cscore+500*min(6+P.stat.pc,10) + else + cscore=cscore+500 + end P.stat.pc=P.stat.pc+1 P.lastClear=P.cur.id*10+5 if P.human then @@ -915,6 +1003,7 @@ function drop() end if P.combo>2 then showText(P,text.cmb[min(P.combo,20)],P.combo<10 and"appear"or"flicker",20+min(P.combo,25)*3,60) + cscore=cscore+min(20*P.combo,300)*cc end sendTime=sendTime+20*P.combo if P.human and cc>0 then @@ -934,49 +1023,60 @@ function drop() end if send>0 then + P.stat.atk=P.stat.atk+send + --ATK statistics if exblock then exblock=int(exblock*(1+P.strength*.25))end send=send*(1+P.strength*.25) if mini then send=send end send=int(send) --Badge Buff - - P.stat.atk=P.stat.atk+send - --ATK statistics - if send==0 then goto L end showText(P,send,"zoomout",40,70) if exblock==0 then goto L end showText(P,exblock,"zoomout",20,115) ::L:: - if send>0 and P.atkBuffer[1]then - if exblock>0 then - exblock=exblock-1 + send=send+exblock + local k=0 + ::R:: + if P.atkBuffer.sum>0 and send>0 then + ::F:: + k=k+1 + local A=P.atkBuffer[k] + if not A then goto E end + if A.sent then goto F end + if send>=A.amount then + send=send-A.amount + P.atkBuffer.sum=P.atkBuffer.sum-A.amount + A.sent,A.time=true,0 + goto R else - send=send-1 + A.amount=A.amount-send + P.atkBuffer.sum=P.atkBuffer.sum-send end - P.atkBuffer[1].amount=P.atkBuffer[1].amount-1 - P.atkBuffer.sum=P.atkBuffer.sum-1 - if P.atkBuffer[1].amount==0 then - rem(P.atkBuffer,1) - end - goto L end + ::E:: + send=send-exblock if send>0 then + local T if modeEnv.royaleMode then if P.atkMode==4 then - if #P.atker>0 then - for i=1,#P.atker do - garbageSend(P,P.atker[i],send,sendTime) + local M=#P.atker + if M>0 then + for i=1,M do + garbageSend(P,P.atker[i],send,sendTime,M,P.cur.color,P.lastClear,dospin,mini,P.combo) end else - garbageSend(P,randomTarget(P),send,sendTime) + T=randomTarget(P) end else freshTarget(P) - garbageSend(P,P.atking,send,sendTime) + T=P.atking end elseif #players.alive>1 then - garbageSend(P,randomTarget(P),send,sendTime) + T=randomTarget(P) + end + if T then + garbageSend(P,T,send,sendTime,1,P.cur.color,P.lastClear,dospin,mini,P.combo) end P.stat.send=P.stat.send+send if P.human and send>3 then SFX("emit",min(send,8)*.125)end @@ -987,11 +1087,12 @@ function drop() end garbageRelease() end + P.stat.score=P.stat.score+cscore + P.spinLast=dospin and cc>0 P.stat.piece,P.stat.row=P.stat.piece+1,P.stat.row+cc if P.stat.row>=P.gameEnv.target then P.gameEnv.reach() end - P.spinLast=dospin and cc>0 if P.human then SFX("lock") end @@ -1000,18 +1101,6 @@ function drop() P.spinLast=false end end -function lock() - for i=1,P.r do - local y=P.curY+i-1 - if not P.field[y]then P.field[y],P.visTime[y]=getNewRow(0),getNewRow(0)end - for j=1,P.c do - if P.cur.bk[i][j]then - P.field[y][P.curX+j-1]=P.cur.color - P.visTime[y][P.curX+j-1]=P.showTime - end - end - end -end function pressKey(i,p) P=p P.keyPressing[i]=true @@ -1045,7 +1134,7 @@ function pressKey(i,p) P.moving=1 end end - ins(P.keyTime,1,frame)rem(P.keyTime,11) + P.keyTime[11]=ins(P.keyTime,1,frame) P.stat.key=P.stat.key+1 end --ins(rec,{i,frame}) @@ -1097,9 +1186,9 @@ act={ else if P.waiting==-1 then if P.curY~=P.y_img then - if P.human and setting.fxs then + if P.human and setting.fxs>0 then createShade(P.curX,P.curY+1,P.curX+P.c-1,P.y_img+P.r-1) - P.fieldOffY=5 + P.fieldOffY=2*setting.fxs+1 end P.curY=P.y_img P.spinLast=false @@ -1126,7 +1215,7 @@ act={ end, hold=function()hold()end, func=function() - if modeEnv.Fkey then + if P.gameEnv.Fkey then if modeEnv.royaleMode then for i=1,#P.keyPressing do if P.keyPressing[i]then @@ -1140,17 +1229,7 @@ act={ P.swappingAtkMode=30 end end - if curMode.id=="custom"and curMode.lv==2 and P.stat.row>0 then - for y=1,20 do - local L=P.field[y] - for x=1,10 do - local a,b=preField[y][x],L and L[x]or 0 - if a~=-1 and(a==0 and b>0 or a<8 and a~=b or a>7 and b==0)then goto change end - end - end - P.modeData.event=0 - Event.win() - ::change:: + if P.gameEnv.puzzle then P.modeData.event=1-P.modeData.event end end @@ -1163,12 +1242,12 @@ act={ end, insDown=function() if P.curY~=P.y_img then - if P.human and setting.fxs then + if P.human and setting.fxs>0 then createShade(P.curX,P.curY+1,P.curX+P.c-1,P.y_img+P.r-1) end P.curY,P.lockDelay,P.spinLast=P.y_img,P.gameEnv.lock,false - if P.human and setting.fxs then - P.fieldOffY=4 + if P.human and setting.fxs>0 then + P.fieldOffY=2*setting.fxs end end end, @@ -1176,15 +1255,15 @@ act={ local x0=P.curX ::L::if not ifoverlap(P.cur.bk,P.curX-1,P.curY)then P.curX=P.curX-1 - if P.human and setting.fxs then + if P.human and setting.fxs>0 then createShade(P.curX+1,P.curY+P.r-1,P.curX+1,P.curY) end freshgho() goto L end if x0~=P.curX then - if P.human and setting.fxs and P.curX==1 then - P.fieldOffX=-4 + if P.human and setting.fxs>0 then + P.fieldOffX=-2*setting.fxs end freshLockDelay() end @@ -1193,15 +1272,15 @@ act={ local x0=P.curX ::L::if not ifoverlap(P.cur.bk,P.curX+1,P.curY)then P.curX=P.curX+1 - if P.human and setting.fxs then + if P.human and setting.fxs>0 then createShade(P.curX+P.c-1,P.curY+P.r-1,P.curX+P.c-1,P.curY) end freshgho() goto L end if x0~=P.curX then - if P.human and setting.fxs and P.curX+P.c==11 then - P.fieldOffX=4 + if P.human and setting.fxs>0 then + P.fieldOffX=2*setting.fxs end freshLockDelay() end diff --git a/image/block.png b/image/block.png index f15f5008..c2bc4fa8 100644 Binary files a/image/block.png and b/image/block.png differ diff --git a/image/mess/atk1.png b/image/mess/atk1.png deleted file mode 100644 index 9db37acf..00000000 Binary files a/image/mess/atk1.png and /dev/null differ diff --git a/image/mess/atk2.png b/image/mess/atk2.png deleted file mode 100644 index 568f0a97..00000000 Binary files a/image/mess/atk2.png and /dev/null differ diff --git a/image/mess/atk3.png b/image/mess/atk3.png deleted file mode 100644 index 885ed090..00000000 Binary files a/image/mess/atk3.png and /dev/null differ diff --git a/image/mess/charge.png b/image/mess/charge.png new file mode 100644 index 00000000..785d3ce6 Binary files /dev/null and b/image/mess/charge.png differ diff --git a/image/mess/light.png b/image/mess/light.png deleted file mode 100644 index 0bb3a57b..00000000 Binary files a/image/mess/light.png and /dev/null differ diff --git a/image/mess/lightBulb.png b/image/mess/lightBulb.png deleted file mode 100644 index e31f75bc..00000000 Binary files a/image/mess/lightBulb.png and /dev/null differ diff --git a/image/mess/power.png b/image/mess/power.png new file mode 100644 index 00000000..64321f98 Binary files /dev/null and b/image/mess/power.png differ diff --git a/image/mess/title_old.png b/image/mess/title_old.png deleted file mode 100644 index 12041aa5..00000000 Binary files a/image/mess/title_old.png and /dev/null differ diff --git a/language/chi.lua b/language/chi.lua index 65c3dafa..ea133677 100644 --- a/language/chi.lua +++ b/language/chi.lua @@ -1,3 +1,5 @@ +local SWC={[true]="开",[false]="关"} +local BK="返回" return{ atkModeName={"随机","徽章","击杀","反击"}, royale_remain=function(n)return"剩余 "..n.." 名玩家"end, @@ -14,6 +16,8 @@ return{ hold="暂存",next="下一个", stage={"关卡 1","关卡 2","关卡 3","关卡 4","关卡 5",}, + awesome="精彩。", + continue="继续。", maxspeed="最高速度", speedup="速度加快", @@ -95,6 +99,7 @@ return{ "整个游戏都是MrZ完成的!", "大满贯10连击消四全清!", "<方块研究所>有一个Nspire-CX版本!", + "B2B2B???", "B2B2B2B存在吗?", "MEGACMB!", "ALLSPIN!", @@ -112,7 +117,7 @@ return{ "本游戏难度上限很高,做好心理准备", "方块可以不是个休闲游戏", "调到特殊的日期也不会发生什么的", - "[随机文本]", + "3.1415926535897932384", }, stat={ "游戏运行次数:", @@ -150,6 +155,7 @@ return{ group="官方QQ群", ButtonText={ main={ + qplay="快速开始", play="开始", setting="设置", music="音乐室", @@ -164,13 +170,14 @@ return{ right="→", start="开始", custom="自定义(C)", - back="返回", + back=BK, }, music={ + bgm=function()return"音乐:"..SWC[setting.bgm]end, up="↑", play="播放", down="↓", - back="返回", + back=BK, }, custom={ up="↑", @@ -185,25 +192,25 @@ return{ set3="无尽", set4="隐形", set5="极限", - back="返回", + back=BK, }, draw={ any="不定", - block1="■", - block2="■", - block3="■", - block4="■", - block5="■", - block6="■", - block7="■", + block1="Z", + block2="S", + block3="L", + block4="J", + block5="T", + block6="O", + block7="I", gb1="■", gb2="■", gb3="■", gb4="■", gb5="■", space="×", - clear="清空", - back="返回", + clear="清除", + back=BK, }, play={ pause="暂停", @@ -213,12 +220,12 @@ return{ quit="退出", }, setting={ - ghost=function()return setting.ghost and"阴影:开"or"阴影:关"end, - center=function()return setting.center and"旋转中心:开"or"旋转中心:关"end, - grid=function()return setting.grid and"网格:开"or"网格:关"end, + ghost=function()return"阴影:"..SWC[setting.ghost]end, + center=function()return"旋转中心:"..SWC[setting.center]end, + grid=function()return"网格:"..SWC[setting.grid]end, swap=function()return setting.swap and"目标选择:组合键"or"目标选择:循环"end, - fxs=function()return setting.fxs and"特效:开"or"特效:关"end, - bg=function()return setting.bg and"背景:开"or"背景:关"end, + fxs=function()return setting.fxs>0 and"特效等级:"..setting.fxs or"特效 关"end, + bg=function()return"背景:"..SWC[setting.bg]end, dasD="-",dasU="+", arrD="-",arrU="+", sddasD="-",sddasU="+", @@ -226,35 +233,42 @@ return{ ctrl="控制设置", touch="触摸设置", lang=function()return langName[setting.lang]end, - sfx=function()return setting.sfx and"音效:开"or"音效:关"end, - bgm=function()return setting.bgm and"音乐:开"or"音乐:关"end, + sfx=function()return"音效:"..SWC[setting.sfx]end, + bgm=function()return"音乐:"..SWC[setting.bgm]end, vib=function()return "震动:"..setting.vib end, - voc=function()return setting.voc and"语音:开"or"语音:关"end, - fullscreen=function()return setting.fullscreen and"全屏:开"or"全屏:关"end, - bgblock=function()return setting.bgblock and"背景动画:开"or"背景动画:关"end, + voc=function()return"语音:"..SWC[setting.voc]end, + fullscreen=function()return"全屏:"..SWC[setting.fullscreen]end, + bgblock=function()return"背景动画:"..SWC[setting.bgblock]end, frame=function()return"绘制帧:"..setting.frameMul.."%"end, - skin="切换方块皮肤", + skin="皮肤", + smo=function()return"平滑下落:"..SWC[setting.smo]end, back="保存&返回", }, setting2={ - back="返回", + back=BK, }, setting3={ - back="返回", + back=BK, hide=function()return setting.virtualkeySwitch and"隐藏虚拟按键"or"显示虚拟按键"end, default="默认组合", snap=function()return text.snapLevelName[snapLevel]end, - alpha=function()return percent0to5[setting.virtualkeyAlpha]end, + alpha=function()return setting.virtualkeyAlpha.."0%"end, icon="图标", size="大小", }, help={ - back="返回", + his="历史", qq="作者QQ", + back=BK, + }, + history={ + prev="←", + next="→", + back=BK, }, stat={ - back="返回", path="打开存储目录", + back=BK, }, }, -} \ No newline at end of file +}--文 \ No newline at end of file diff --git a/language/chi_full.lua b/language/chi_full.lua index 08fdc8db..614e7710 100644 --- a/language/chi_full.lua +++ b/language/chi_full.lua @@ -1,3 +1,5 @@ +local SWC={[true]="开",[false]="关"} +local BK="返回" return{ atkModeName={"随机","徽章","击杀","反击"}, royale_remain=function(n)return"剩余 "..n.." 名玩家"end, @@ -14,6 +16,8 @@ return{ hold="暂存",next="下一个", stage={"关卡 1","关卡 2","关卡 3","关卡 4","关卡 5",}, + awesome="精彩。", + continue="继续。", maxspeed="最高速度", speedup="速度加快", @@ -95,6 +99,7 @@ return{ "整个游戏都是MrZ完成的!", "大满贯10连击消四全清!", "<方块研究所>有一个Nspire-CX版本!", + "B2B2B???", "B2B2B2B存在吗?", "MEGACMB!", "ALLSPIN!", @@ -112,7 +117,7 @@ return{ "本游戏难度上限很高,做好心理准备", "方块可以不是个休闲游戏", "调到特殊的日期也不会发生什么的", - "[随机文本]", + "3.1415926535897932384", }, stat={ "游戏运行次数:", @@ -150,6 +155,7 @@ return{ group="官方QQ群", ButtonText={ main={ + qplay="快速开始", play="开始", setting="设置", music="音乐室", @@ -164,13 +170,14 @@ return{ right="→", start="开始", custom="自定义(C)", - back="返回", + back=BK, }, music={ + bgm=function()return"音乐:"..SWC[setting.bgm]end, up="↑", play="播放", down="↓", - back="返回", + back=BK, }, custom={ up="↑", @@ -185,25 +192,25 @@ return{ set3="无尽", set4="隐形", set5="极限", - back="返回", + back=BK, }, draw={ any="不定", - block1="■", - block2="■", - block3="■", - block4="■", - block5="■", - block6="■", - block7="■", + block1="Z", + block2="S", + block3="L", + block4="J", + block5="T", + block6="O", + block7="I", gb1="■", gb2="■", gb3="■", gb4="■", gb5="■", space="×", - clear="清空", - back="返回", + clear="清除", + back=BK, }, play={ pause="暂停", @@ -213,12 +220,12 @@ return{ quit="退出", }, setting={ - ghost=function()return setting.ghost and"阴影:开"or"阴影:关"end, - center=function()return setting.center and"旋转中心:开"or"旋转中心:关"end, - grid=function()return setting.grid and"网格:开"or"网格:关"end, + ghost=function()return"阴影:"..SWC[setting.ghost]end, + center=function()return"旋转中心:"..SWC[setting.center]end, + grid=function()return"网格:"..SWC[setting.grid]end, swap=function()return setting.swap and"目标选择:组合键"or"目标选择:循环"end, - fxs=function()return setting.fxs and"特效:开"or"特效:关"end, - bg=function()return setting.bg and"背景:开"or"背景:关"end, + fxs=function()return setting.fxs>0 and"特效等级:"..setting.fxs or"特效 关"end, + bg=function()return"背景:"..SWC[setting.bg]end, dasD="-",dasU="+", arrD="-",arrU="+", sddasD="-",sddasU="+", @@ -226,35 +233,42 @@ return{ ctrl="控制设置", touch="触摸设置", lang=function()return langName[setting.lang]end, - sfx=function()return setting.sfx and"音效:开"or"音效:关"end, - bgm=function()return setting.bgm and"音乐:开"or"音乐:关"end, + sfx=function()return"音效:"..SWC[setting.sfx]end, + bgm=function()return"音乐:"..SWC[setting.bgm]end, vib=function()return "震动:"..setting.vib end, - voc=function()return setting.voc and"语音:开"or"语音:关"end, - fullscreen=function()return setting.fullscreen and"全屏:开"or"全屏:关"end, - bgblock=function()return setting.bgblock and"背景动画:开"or"背景动画:关"end, + voc=function()return"语音:"..SWC[setting.voc]end, + fullscreen=function()return"全屏:"..SWC[setting.fullscreen]end, + bgblock=function()return"背景动画:"..SWC[setting.bgblock]end, frame=function()return"绘制帧:"..setting.frameMul.."%"end, - skin="切换方块皮肤", + skin="皮肤", + smo=function()return"平滑下落:"..SWC[setting.smo]end, back="保存&返回", }, setting2={ - back="返回", + back=BK, }, setting3={ - back="返回", + back=BK, hide=function()return setting.virtualkeySwitch and"隐藏虚拟按键"or"显示虚拟按键"end, default="默认组合", snap=function()return text.snapLevelName[snapLevel]end, - alpha=function()return percent0to5[setting.virtualkeyAlpha]end, + alpha=function()return setting.virtualkeyAlpha.."0%"end, icon="图标", size="大小", }, help={ - back="返回", + his="历史", qq="作者QQ", + back=BK, + }, + history={ + prev="←", + next="→", + back=BK, }, stat={ - back="返回", path="打开存储目录", + back=BK, }, }, -} \ No newline at end of file +}--部分译文 \ No newline at end of file diff --git a/language/eng.lua b/language/eng.lua index f059d195..ed8e64f1 100644 --- a/language/eng.lua +++ b/language/eng.lua @@ -1,3 +1,5 @@ +local SWC={[true]="ON",[false]="OFF"} +local BK="Back" return{ atkModeName={"Random","Badges","K.O.s","Counters"}, royale_remain=function(n)return n.." Players Remain"end, @@ -14,6 +16,8 @@ return{ hold="Hold",next="Next", stage={"STAGE 1","STAGE 2","STAGE 3","STAGE 4","STAGE 5",}, + awesome="Awesome.", + continue="Continue.", maxspeed="Max speed", speedup="Speed up", @@ -95,6 +99,7 @@ return{ "The WHOLE game is made by MrZ!", "Back to Back 10 combo Techrash PC!", "Techmino has a Nspire-CX edition!", + "B2B2B???", "Is B2B2B2B possible?", "MEGACMB!", "ALLSPIN!", @@ -112,7 +117,7 @@ return{ "This game can be very hard,be mentally perpared", "This in not a casual game", "Nothing will happen when some special day come", - "[random text]", + "3.1415926535897932384", }, stat={ "Games run:", @@ -150,6 +155,7 @@ return{ group="Official QQ Group", ButtonText={ main={ + qplay="Qplay", play="Play", setting="Settings", music="Music room", @@ -164,13 +170,14 @@ return{ right="→", start="Start", custom="Custom(C)", - back="Back", + back=BK, }, music={ + bgm=function()return"BGM:"..SWC[setting.bgm]end, up="↑", play="Play", down="↓", - back="Back", + back=BK, }, custom={ up="↑", @@ -184,26 +191,26 @@ return{ set2="1v1", set3="infinite", set4="blind", - set5="classic", - back="Back", + set5="master", + back=BK, }, draw={ any="ANY", - block1="■", - block2="■", - block3="■", - block4="■", - block5="■", - block6="■", - block7="■", + block1="Z", + block2="S", + block3="L", + block4="J", + block5="T", + block6="O", + block7="I", gb1="■", gb2="■", gb3="■", gb4="■", gb5="■", space="×", - clear="CLEAR", - back="Back", + clear="Clear", + back=BK, }, play={ pause="Pause", @@ -213,12 +220,12 @@ return{ quit="Quit", }, setting={ - ghost=function()return setting.ghost and"Ghost:ON"or"Ghost:OFF"end, - center=function()return setting.center and"Center:ON"or"Center:OFF"end, - grid=function()return setting.grid and"Grid:ON"or"Grid:OFF"end, + ghost=function()return"Ghost:"..SWC[setting.ghost]end, + center=function()return"Center:"..SWC[setting.center]end, + grid=function()return"Grid:"..SWC[setting.grid]end, swap=function()return setting.swap and"Swap:comboKey"or"Swap:loop"end, - fxs=function()return setting.fxs and"FXs:ON"or"FXs:OFF"end, - bg=function()return setting.bg and"BG:ON"or"BG:OFF"end, + fxs=function()return setting.fxs>0 and"FX level:"..setting.fxs or"NO FX"end, + bg=function()return"BG:"..SWC[setting.bg]end, dasD="-",dasU="+", arrD="-",arrU="+", sddasD="-",sddasU="+", @@ -226,35 +233,42 @@ return{ ctrl="Control settings", touch="Touch settings", lang=function()return langName[setting.lang]end, - sfx=function()return setting.sfx and"SFX:ON"or"SFX:OFF"end, - bgm=function()return setting.bgm and"BGM:ON"or"BGM:OFF"end, - voc=function()return setting.voc and"VOC:ON"or"VOC:OFF"end, + sfx=function()return"SFX:"..SWC[setting.sfx]end, + bgm=function()return"BGM:"..SWC[setting.bgm]end, + voc=function()return"VOC:"..SWC[setting.voc]end, vib=function()return "VIB:"..setting.vib end, - fullscreen=function()return setting.fullscreen and"Fullscreen:ON"or"Fullscreen:OFF"end, - bgblock=function()return setting.bgblock and"BG animation:ON"or"BG animation:OFF"end, + fullscreen=function()return"Fullscreen:"..SWC[setting.fullscreen]end, + bgblock=function()return"BG animation:"..SWC[setting.bgblock]end, frame=function()return"FrameDraw:"..setting.frameMul.."%"end, - skin="Change Block Skin", + skin="Skin", + smo=function()return"SmoothDrop:"..SWC[setting.smo]end, back="Save&Back", }, setting2={ - back="Back", + back=BK, }, setting3={ - back="Back", + back=BK, hide=function()return setting.virtualkeySwitch and"Hide Virtual Key"or"Show Virtual Key"end, default="Defaults", snap=function()return text.snapLevelName[snapLevel]end, - alpha=function()return percent0to5[setting.virtualkeyAlpha]end, + alpha=function()return setting.virtualkeyAlpha.."0%"end, icon="Icon", size="Size", }, help={ - back="Back", + his="History", qq="Author's qq", + back=BK, + }, + history={ + prev="←", + next="→", + back=BK, }, stat={ - back="Back", path="Open Data Folder", + back=BK, }, } } \ No newline at end of file diff --git a/list.lua b/list.lua index 8d2d96ba..a3a077d9 100644 --- a/list.lua +++ b/list.lua @@ -2,6 +2,8 @@ local gc=love.graphics local tc,kb=love.touch,love.keyboard local sys=love.system local fs=love.filesystem +local mobile=mobile + actName={"moveLeft","moveRight","rotRight","rotLeft","rotFlip","hardDrop","softDrop","hold","func","restart","insLeft","insRight","insDown"} color={ red={1,0,0}, @@ -44,8 +46,8 @@ blockColor={ color.yellow, color.cyan, color.darkGreen, - color.darkGrey, color.grey, + color.lightGrey, color.darkPurple, color.darkRed, color.darkGreen, @@ -155,7 +157,6 @@ customRange={ RCPB={10,33,200,33,105,5,105,60} snapLevelValue={1,10,20,40,60,80} up0to4={[0]="000%UP","025%UP","050%UP","075%UP","100%UP",} -percent0to5={[0]="0%","20%","40%","60%","80%","100%",} modeID={ [0]="custom", @@ -173,8 +174,8 @@ modeLevel={ tsd={"NORMAL","HARD"}, blind={"EASY","HARD","HARD+","LUNATIC","ULTIMATE","GM"}, dig={"NORMAL","LUNATIC"}, - survivor={"EASY","NORMAL","HARD","LUNATIC","ULTIMATE"}, - tech={"NORMAL","NORMAL+","HARD","LUNATIC","ULTIMATE"}, + survivor={"EASY","NORMAL","HARD","LUNATIC","ULTIMATE","EXTRA"}, + tech={"NORMAL","NORMAL+","HARD","HARD+","LUNATIC","LUNATIC+",}, c4wtrain={"NORMAL","LUNATIC"}, pctrain={"NORMAL","EXTRA"}, pcchallenge={"NORMAL","HARD","LUNATIC"}, @@ -260,9 +261,9 @@ local virtualkeySet={ },--PC key feedback } local customSet={ - {20,20,1,1,7,1,1,1,3,4,1,3,3}, + {20,20,1,1,7,1,1,1,3,4,1,2,3}, {18,20,1,1,7,1,1,1,8,3,8,3,3}, - {22,22,1,1,7,3,1,3,8,4,1,8,7}, + {22,22,1,1,7,3,1,1,8,4,1,7,7}, {20,20,1,1,7,1,1,3,8,3,1,7,8}, {23,11,8,11,4,1,2,1,8,3,1,4,9}, } @@ -277,34 +278,49 @@ Buttons={ load={}, intro={}, main={ - play= {x=380,y=300,w=240, h=240,rgb=color.red, f=70,code=function()gotoScene("mode")end,down="stat",right="setting"}, - setting={x=640,y=300,w=240, h=240,rgb=color.lightBlue, f=55,code=function()gotoScene("setting")end,down="stat",left="play",right="music"}, - music= {x=900,y=300,w=240, h=240,rgb=color.lightCyan, f=42,code=function()gotoScene("music")end,down="help",left="setting",right="quit"}, - stat= {x=640,y=560,w=240, h=240,rgb=color.cyan, f=55,code=function()gotoScene("stat")end,up="setting",left="play",right="help"}, - help= {x=900,y=560,w=240, h=240,rgb=color.yellow, f=55,code=function()gotoScene("help")end,up="music",left="stat",right="quit"}, - quit= {x=1180,y=620,w=120,h=120,rgb=color.lightGrey, f=50,code=function()gotoScene("quit")end,up="setting",left="help"}, + qplay= {x=160,y=300,w=150, h=150, rgb=color.lightRed, f=40,code=function()loadGame(modeSel,levelSel)end,down="stat",right="play"}, + play= {x=380,y=300,w=240, h=240, rgb=color.red, f=70,code=function()gotoScene("mode")end,down="stat",left="qplay",right="setting"}, + setting={x=640,y=300,w=240, h=240, rgb=color.lightBlue,f=55,code=function()gotoScene("setting")end,down="stat",left="play",right="music"}, + music= {x=900,y=300,w=240, h=240, rgb=color.lightCyan,f=42,code=function()gotoScene("music")end,down="help",left="setting",right="quit"}, + stat= {x=640,y=560,w=240, h=240, rgb=color.cyan, f=55,code=function()gotoScene("stat")end,up="setting",left="play",right="help"}, + help= {x=900,y=560,w=240, h=240, rgb=color.yellow, f=55,code=function()gotoScene("help")end,up="music",left="stat",right="quit"}, + quit= {x=1180,y=620,w=120,h=120, rgb=color.lightGrey,f=50,code=function()gotoScene("quit")end,up="setting",left="help"}, }, mode={ up= {x=1000,y=210,w=200,h=140, rgb=color.white, f=80, code=function()love.keypressed("up")end, hide=function()return modeSel==1 end,}, down= {x=1000,y=430,w=200,h=140, rgb=color.white, f=80, code=function()love.keypressed("down")end, hide=function()return modeSel==#modeID end,}, left= {x=190, y=160,w=100,h=80, rgb=color.white, code=function()love.keypressed("left")end, hide=function()return levelSel==1 end,}, - right= {x=350, y=160,w=100,h=80, rgb=color.white, code=function()love.keypressed("right")end,hide=function()return levelSel==#modeLevel[modeID[modeSel]]end,}, - start= {x=1000,y=600,w=250,h=100, rgb=color.green, f=50, code=function() - loadGame(modeSel,levelSel)end}, + right= {x=350, y=160,w=100,h=80, rgb=color.white, code=function()love.keypressed("right")end, hide=function()return levelSel==#modeLevel[modeID[modeSel]]end,}, + start= {x=1000,y=600,w=250,h=100, rgb=color.green, f=50, code=function()loadGame(modeSel,levelSel)end}, custom= {x=275, y=420,w=200,h=90, rgb=color.yellow, code=function()gotoScene("custom")end}, back= {x=640, y=630,w=230,h=90, rgb=color.white, f=45, code=back}, }, music={ - up= {x=1100,y=200,w=120,h=120, rgb=color.white,f=40,code=function()sel=(sel-2)%#musicID+1 end}, - play= {x=1100,y=340,w=120,h=120, rgb=color.white,f=40,code=function()BGM(musicID[sel])end}, - down= {x=1100,y=480,w=120,h=120, rgb=color.white,f=50,code=function()sel=sel%#musicID+1 end}, - back= {x=640, y=630,w=230,h=90, rgb=color.white,f=45,code=back}, + bgm= {x=1100,y=80, w=160, h=80, rgb=color.white,code=function()BGM()setting.bgm=not setting.bgm end}, + up= {x=1100,y=200, w=120, h=120, rgb=color.white,f=40,hide=function()return not setting.bgm end,code=function()sel=(sel-2)%#musicID+1 end}, + play= {x=1100,y=340, w=120, h=120, rgb=color.white,f=40,hide=function()return not setting.bgm end,code=function()BGM(musicID[sel])end}, + down= {x=1100,y=480, w=120, h=120, rgb=color.white,f=50,hide=function()return not setting.bgm end,code=function()sel=sel%#musicID+1 end}, + back= {x=640, y=630, w=230, h=90, rgb=color.white,f=45,code=back}, }, custom={ - up= {x=1000,y=220, w=100,h=100, rgb=color.white,f=50, code=function()optSel=(optSel-2)%#customID+1 end}, - down= {x=1000,y=460, w=100,h=100, rgb=color.white,f=50, code=function()optSel=optSel%#customID+1 end}, - left= {x=880, y=340, w=100,h=100, rgb=color.white,f=50, code=function()customSel[optSel]=(customSel[optSel]-2)%#customRange[customID[optSel]]+1 end}, - right= {x=1120,y=340, w=100,h=100, rgb=color.white,f=50, code=function()customSel[optSel]=customSel[optSel]%#customRange[customID[optSel]]+1 end}, + up= {x=1000,y=220, w=100,h=100, rgb=color.white,f=50, code=function()sel=(sel-2)%#customID+1 end}, + down= {x=1000,y=460, w=100,h=100, rgb=color.white,f=50, code=function()sel=sel%#customID+1 end}, + left= {x=880, y=340, w=100,h=100, rgb=color.white,f=50, code=function() + customSel[sel]=(customSel[sel]-2)%#customRange[customID[sel]]+1 + if sel==12 then + curBG=customRange.bg[customSel[12]] + elseif sel==13 then + BGM(customRange.bgm[customSel[13]]) + end + end}, + right= {x=1120,y=340, w=100,h=100, rgb=color.white,f=50, code=function() + customSel[sel]=customSel[sel]%#customRange[customID[sel]]+1 + if sel==12 then + curBG=customRange.bg[customSel[12]] + elseif sel==13 then + BGM(customRange.bgm[customSel[13]]) + end + end}, start1= {x=880, y=580, w=220,h=70, rgb=color.green, code=function()loadGame(0,1)end}, start2= {x=1120,y=580, w=220,h=70, rgb=color.lightPurple, code=function()loadGame(0,2)end}, draw= {x=1000,y=90, w=190,h=85, rgb=color.cyan, code=function()gotoScene("draw")end}, @@ -331,8 +347,8 @@ Buttons={ gb5= {x=1120,y=500,w=120,h=120, f=65, rgb=color.darkGreen,code=function()pen=13 end}, space= {x=840, y=640,w=120,h=120, f=70, rgb=color.grey, code=function()pen=0 end}, clear= {x=1120,y=640,w=120,h=120, f=45, rgb=color.white, code=function() - if clearSureTime>0 then - for y=1,20 do for x=1,10 do preField[y][x]=0 end end + if clearSureTime>15 then + for y=1,20 do for x=1,10 do preField[y][x]=-1 end end clearSureTime=0 else clearSureTime=50 @@ -352,8 +368,8 @@ Buttons={ center= {x=505, y=90, w=210, h=60, rgb=color.white,code=function()setting.center=not setting.center end,down="swap",left="ghost",right="sfx"}, grid= {x=290, y=160, w=210, h=60, rgb=color.white,code=function()setting.grid=not setting.grid end,up="ghost",down="fxs",right="swap"}, swap= {x=505, y=160, w=210, h=60,f=28, rgb=color.white,code=function()setting.swap=not setting.swap end,up="center",down="bg",left="grid",right="vib"}, - fxs= {x=290, y=230, w=210, h=60, rgb=color.white,code=function()setting.fxs=not setting.fxs end,up="grid",down="dasU",right="bg"}, - bg= {x=505, y=230, w=210, h=60, rgb=color.white,code=function()setting.bg=not setting.bg end,up="swap",down="arrD",right="fullscreen"}, + fxs= {x=290, y=230, w=210, h=60, rgb=color.white,code=function()setting.fxs=(setting.fxs+1)%4 end,up="grid",down="dasU",right="bg"}, + bg= {x=505, y=230, w=210, h=60, rgb=color.white,code=function()setting.bg=not setting.bg end,up="swap",down="arrD",left="fxs",right="fullscreen"}, dasD= {x=210, y=300, w=50, h=50, rgb=color.white,code=function()setting.das=(setting.das-1)%31 end,up="fxs",down="sddasD",right="dasU"}, dasU= {x=370, y=300, w=50, h=50, rgb=color.white,code=function()setting.das=(setting.das+1)%31 end,up="fxs",down="sddasU",left="dasD",right="arrD"}, arrD= {x=425, y=300, w=50, h=50, rgb=color.white,code=function()setting.arr=(setting.arr-1)%16 end,up="bg",down="sdarrD",left="dasU",right="arrU"}, @@ -363,51 +379,39 @@ Buttons={ sdarrD= {x=425, y=370, w=50, h=50, rgb=color.white,code=function()setting.sdarr=(setting.sdarr-1)%4 end,up="arrD",down="ctrl",left="sddasU",right="sdarrU"}, sdarrU= {x=585, y=370, w=50, h=50, rgb=color.white,code=function()setting.sdarr=(setting.sdarr+1)%4 end,up="arrU",down="ctrl",left="sdarrD",right="frame"}, - ctrl= {x=340,y=440, w=310,h=60,rgb=color.green, code=function()gotoScene("setting2")end,up="sddasU",down="touch",left="lang",right="skin"}, - touch= {x=340,y=510, w=310,h=60,rgb=color.yellow,code=function()gotoScene("setting3")end,up="ctrl",down="back",right="lang"}, - lang= {x=580,y=510, w=150,h=60,rgb=color.red, code=function() + ctrl= {x=340,y=440, w=310, h=60,rgb=color.green, code=function()gotoScene("setting2")end,up="sddasU",down="touch",left="lang",right="skin"}, + touch= {x=340,y=510, w=310, h=60,rgb=color.yellow,code=function()gotoScene("setting3")end,up="ctrl",down="back",right="lang"}, + lang= {x=580,y=510, w=150, h=60,rgb=color.red, code=function() setting.lang=setting.lang%#langName+1 swapLanguage(setting.lang) end,up="sdarrU",down="back",left="touch",right="skin"}, sfx= {x=760,y=90, w=160, h=60, rgb=color.white,code=function()setting.sfx=not setting.sfx end,down="vib",left="center",right="bgm"}, - bgm= {x=940,y=90, w=160, h=60, rgb=color.white,code=function() - BGM() - setting.bgm=not setting.bgm - BGM("blank") - end,down="voc",left="sfx"}, - vib= {x=760,y=160, w=160, h=60,rgb=color.white, code=function() - setting.vib=(setting.vib+1)%6 - VIB(1) - end,up="sfx",down="fullscreen",left="swap",right="voc"}, - voc= {x=940,y=160, w=160, h=60,rgb=color.white, - hide=function()return true end, - code=function() - setting.voc=not setting.voc - end,up="sfx",down="fullscreen",left="vib"}, - fullscreen= {x=850,y=230, w=340,h=60,rgb=color.white, code=function() + bgm= {x=940,y=90, w=160, h=60, rgb=color.white,code=function()BGM()setting.bgm=not setting.bgm BGM("blank")end,down="voc",left="sfx"}, + vib= {x=760,y=160, w=160, h=60,rgb=color.white, code=function()setting.vib=(setting.vib+1)%6 VIB(1)end,up="sfx",down="fullscreen",left="swap",right="voc"}, + voc= {x=940,y=160, w=160, h=60,rgb=color.white,code=function()setting.voc=not setting.voc end,up="sfx",down="fullscreen",left="vib"}, + fullscreen= {x=850,y=230,w=340, h=60,rgb=color.white, code=function() setting.fullscreen=not setting.fullscreen love.window.setFullscreen(setting.fullscreen) if not setting.fullscreen then love.resize(gc.getWidth(),gc.getHeight()) end end,up="vib",down="bgblock",left="bg"}, - bgblock={x=850,y=300, w=340,h=60,rgb=color.white, code=function() + bgblock={x=850,y=300, w=340, h=60,rgb=color.white, code=function() setting.bgblock=not setting.bgblock - if not setting.bgblock then - for i=1,16 do - BGblockList[i].v=3*BGblockList[i].v - end - end + --if not setting.bgblock then for i=1,16 do BGblockList[i].v=3*BGblockList[i].v end end end,up="fullscreen",down="frame",left="arrU"}, - frame= {x=850,y=370, w=340,h=60,rgb=color.white, code=function() + frame= {x=850,y=370, w=340, h=60,rgb=color.white, code=function() setting.frameMul=setting.frameMul+(setting.frameMul<50 and 5 or 10) if setting.frameMul>100 then setting.frameMul=25 end end,up="bgblock",down="skin",left="sdarrU"}, - skin= {x=850,y=440, w=340,h=60,rgb=color.white, code=function() + skin= {x=740,y=440, w=120, h=60,rgb=color.white, code=function() setting.skin=setting.skin%6+1 changeBlockSkin(setting.skin) - end,up="frame",down="back",left="ctrl"}, + end,up="frame",down="back",left="ctrl",right="smo"}, + smo= {x=920,y=440, w=200, h=60,f=27,rgb=color.white, code=function() + setting.smo=not setting.smo + end,up="frame",down="back",left="skin"}, back= {x=640,y=620, w=300,h=70,rgb=color.white, code=back,up="lang"}, }, setting2={--Control setting @@ -429,7 +433,7 @@ Buttons={ snapLevel=snapLevel%6+1 end}, alpha={x=830,y=310,w=170,h=80,f=45,code=function() - setting.virtualkeyAlpha=(setting.virtualkeyAlpha+1)%6 + setting.virtualkeyAlpha=(setting.virtualkeyAlpha+1)%11 --Adjust virtualkey alpha end}, icon={x=450,y=410,w=170,h=80,f=45,code=function() @@ -446,12 +450,18 @@ Buttons={ end}, }, help={ - back={x=640,y=590,w=180,h=60,rgb=color.white,code=back,right="qq"}, - qq={x=980,y=590,w=230,h=60,hide=function()return system=="Android"end,rgb=color.white,code=function()sys.openURL("tencent://message/?uin=1046101471&Site=&Menu=yes")end,left="back"}, + his={x=1050,y=520,w=230,h=60,rgb=color.white,code=function()gotoScene("history")end,down="qq",left="back"}, + qq={x=1050,y=600,w=230,h=60,hide=function()return mobile end,rgb=color.white,code=function()sys.openURL("tencent://message/?uin=1046101471&Site=&Menu=yes")end,up="his",left="back"}, + back={x=640,y=600,w=180,h=60,rgb=color.white,code=back,up="his",right="qq"}, + }, + history={ + prev= {x=75, y=320,w=100, h=300, rgb=color.white,hide=function()return sel==1 end,code=function()sel=sel-1 end}, + next= {x=1205,y=320,w=100, h=300, rgb=color.white,hide=function()return sel==#updateLog end,code=function()sel=sel+1 end}, + back= {x=640, y=640,w=200,h=70, rgb=color.white,code=back}, }, stat={ + path={x=980,y=590,w=250,h=60,f=30,rgb=color.white,hide=function()return mobile end,code=function()sys.openURL(fs.getSaveDirectory())end,left="back"}, back={x=640,y=590,w=180,h=60,rgb=color.white,code=back,right="path"}, - path={x=980,y=590,w=250,h=60,f=30,hide=function()return system=="Android"end,rgb=color.white,code=function()sys.openURL(fs.getSaveDirectory())end,left="back"}, }, sel=nil,--selected button id(integer) } \ No newline at end of file diff --git a/main.lua b/main.lua index 323d9403..c6e88ba5 100644 --- a/main.lua +++ b/main.lua @@ -1,25 +1,32 @@ +local love=love local gc,tm=love.graphics,love.timer -local ms,kb=love.mouse,love.keyboard -local fs,sys=love.filesystem,love.system -int,ceil,abs,rnd,max,min,sin,cos,atan=math.floor,math.ceil,math.abs,math.random,math.max,math.min,math.sin,math.cos,math.atan -sub,gsub,find,format,byte,char=string.sub,string.gsub,string.find,string.format,string.byte,string.char -ins,rem,concat=table.insert,table.remove,table.concat +local ms,kb,tc=love.mouse,love.keyboard,love.touch +local fs,sys,wd=love.filesystem,love.system,love.window +local int,abs,rnd,max,min=math.floor,math.abs,math.random,math.max,math.min +local find,format=string.find,string.format +local ins,rem=table.insert,table.remove +local Timer=tm.getTime -- sort=table.sort -math.randomseed(os.time()*626) +------------------------------------------------------------- null=function()end - system=sys.getOS() -scr={x=0,y=0,w=gc.getWidth(),h=gc.getHeight(),k=1} +local mobile=system=="Android"or system=="iOS" +local xOy=love.math.newTransform() +local mx,my,mouseShow=-20,-20,false +local touching--1st touching ID + +scr={x=0,y=0,w=gc.getWidth(),h=gc.getHeight(),k=1}local scr=scr scene="" bgmPlaying=nil curBG="none" voicePlaying={} +local devMode=0 local F=false kb.setKeyRepeat(F) kb.setTextInput(F) ms.setVisible(F) - +------------------------------------------------------------- local Fonts={} function setFont(s) if s~=currentFont then @@ -34,46 +41,25 @@ function setFont(s) end return Fonts[s] end - -gameEnv0={ - das=10,arr=2, - sddas=0,sdarr=2, - ghost=true,center=true, - grid=F,swap=true, - _20G=F,bone=F, - drop=30,lock=45, - wait=0,fall=0, - next=6,hold=true,oncehold=true, - sequence="bag7", - - block=true, - keepVisible=true,visible="show", - Fkey=F,puzzle=F,ospin=true, - freshLimit=1e99,target=1e99,reach=null, - bg="none",bgm="race" -} customSel={22,22,1,1,7,3,1,1,8,4,1,1,1} preField={h=20} for i=1,18 do preField[i]={0,0,0,0,0,0,0,0,0,0}end for i=19,20 do preField[i]={-1,-1,-1,-1,-1,-1,-1,-1,-1,-1}end -freeRow={} -for i=1,40 do - freeRow[i]={0,0,0,0,0,0,0,0,0,0} -end ---Game system Data +freeRow={L=40}for i=1,40 do freeRow[i]={0,0,0,0,0,0,0,0,0,0}end +--Game system Vars setting={ ghost=true,center=true, grid=F,swap=true, - fxs=true,bg=true, + fxs=3,bg=true, das=10,arr=2, sddas=0,sdarr=2, lang=1, sfx=true,bgm=true, - vib=3,voc=false, + vib=3,voc=F, fullscreen=F, bgblock=true, - skin=1, + skin=1,smo=true, keyMap={ {"left","right","x","z","c","up","down","space","tab","r","","",""}, {"","","","","","","","","","","","",""}, @@ -114,7 +100,7 @@ stat={ atk=0,send=0,recv=0,pend=0, clear_1=0,clear_2=0,clear_3=0,clear_4=0, spin_0=0,spin_1=0,spin_2=0,spin_3=0, - b2b=0,b3b=0,pc=0, + b2b=0,b3b=0,pc=0,score=0, } virtualkey={ {80,720-80,6400,80},--moveLeft @@ -136,17 +122,906 @@ virtualkey={ } virtualkeyDown={F,F,F,F,F,F,F,F,F,F,F,F,F} virtualkeyPressTime={0,0,0,0,0,0,0,0,0,0,0,0,0} ---User Data&User Setting -require("toolfunc") -require("list") +--User datas&settings +------------------------------------------------------------- require("class") +require("toolfunc") require("gamefunc") +require("list") require("ai") -require("timer") -require("paint") -require("call&sys") require("dataList") require("texture") +local Tmr=require("timer") +local Pnt=require("paint") +--Requires +------------------------------------------------------------- +local BGblockList={}for i=1,16 do BGblockList[i]={v=0}end +local BGblock={tm=150,next=7,ct=0} +local powerInfoCanvas,updatePowerInfo +if sys.getPowerInfo()~="unknown"then + powerInfoCanvas=gc.newCanvas(147,22) + updatePowerInfo=function() + local state,pow=sys.getPowerInfo() + if state~="unknown"then + gc.setCanvas(powerInfoCanvas)gc.push("transform")gc.origin() + gc.clear(0,0,0,.3) + gc.setLineWidth(4) + setFont(25) + if pow then + gc.setColor(1,1,1) + gc.draw(batteryImage,58,3) + if pow>90 then gc.setColor(color.lightGreen) + elseif pow<60 then gc.setColor(color.lightRed) + elseif pow<20 then gc.setColor(color.red) + elseif pow==26 then gc.setColor(color.purple) + end + gc.rectangle("fill",61,6,pow*.15,10) + gc.setColor(1,1,1) + gc.print(pow.."%",94,-3) + end + if state~="battery"then + gc.setColor(1,1,1) + if state=="nobattery"then + gc.setLineWidth(2) + gc.line(61.5,.5,83.5,22.5) + elseif state=="charging"or state=="charged"then + gc.draw(chargeImage,84,3) + end + end + gc.print(os.date("%H:%M",os.time()),2,-3) + gc.pop()gc.setCanvas() + end + end +end +local function getNewBlock() + BGblock.ct=BGblock.ct+1 + if BGblock.ct==17 then BGblock.ct=1 end + local t=BGblockList[BGblock.ct] + t.bn,t.size=BGblock.next,2+3*rnd() + t.b=blocks[t.bn][rnd(0,3)] + t.x=rnd(-#t.b[1]*t.size*30+100,1180) + t.y=-#t.b*30*t.size + t.v=t.size*(1+rnd()) + BGblock.next=BGblock.next%7+1 + return t +end +local sceneInit={ + load=function() + loading=1--Loading mode + loadnum=1--Loading counter + loadprogress=0--Loading bar(0~1) + loadTip=text.tips[rnd(#text.tips)] + end, + intro=function() + count=0 + BGM("blank") + updatePowerInfo() + end, + main=function() + modeSel,levelSel=modeSel or 1,levelSel or 3 + BGM("blank") + collectgarbage() + end, + music=function() + sel=1 + BGM() + end, + mode=function() + curBG="none" + saveData() + BGM("blank") + end, + custom=function() + sel=sel or 1 + curBG=customRange.bg[customSel[12]] + BGM(customRange.bgm[customSel[13]]) + end, + draw=function() + curBG="none" + kb.setKeyRepeat(true) + clearSureTime=0 + pen,sx,sy=1,1,1 + end, + play=function() + restartCount=0 + if needResetGameData then + resetGameData() + needResetGameData=nil + end + end, + pause=function() + end, + setting=function() + curBG="none" + end, + setting2=function() + curBoard=1 + keyboardSet=1 + joystickSet=1 + keyboardSetting=false + joystickSetting=false + end,--Control settings + setting3=function() + curBG="game1" + defaultSel=1 + sel=nil + snapLevel=1 + end,--Touch setting + help=function() + curBG="none" + end, + stat=function() + end, + history=function() + updateLog=require"updateLog" + curBG="lightGrey" + sel=2 + end, + quit=function() + love.event.quit() + end, +} +local function onVirtualkey(x,y) + local d2,nearest,distance + for K=1,#virtualkey do + local b=virtualkey[K] + d2=(x-b[1])^2+(y-b[2])^2 + if d20 then keyDown.mode("up") + elseif y<0 then keyDown.mode("down") + end +end +function keyDown.mode(key) + if key=="down"then + if modeSel<#modeID then + modeSel=modeSel+1 + levelSel=int(#modeLevel[modeID[modeSel]]*.4)+1 + SFX("move",.4) + end + elseif key=="up"then + if modeSel>1 then + modeSel=modeSel-1 + levelSel=int(#modeLevel[modeID[modeSel]]*.4)+1 + SFX("move",.4) + end + elseif key=="left"then + if levelSel>1 then + levelSel=levelSel-1 + end + elseif key=="right"then + if levelSel<#modeLevel[modeID[modeSel]]then + levelSel=levelSel+1 + end + elseif key=="return"then + loadGame(modeSel,levelSel) + elseif key=="c"then + gotoScene("custom") + elseif key=="escape"then + back() + 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 + sel=sel%#musicID+1 + elseif key=="up"then + sel=(sel-2)%#musicID+1 + elseif key=="return"or key=="space"then + BGM(musicID[sel]) + elseif key=="escape"then + back() + end +end + +function keyDown.custom(key) + if key=="left"then + customSel[sel]=(customSel[sel]-2)%#customRange[customID[sel]]+1 + if sel==12 then + curBG=customRange.bg[customSel[12]] + elseif sel==13 then + BGM(customRange.bgm[customSel[13]]) + end + elseif key=="right"then + customSel[sel]=customSel[sel]%#customRange[customID[sel]]+1 + if sel==12 then + curBG=customRange.bg[customSel[sel]] + elseif sel==13 then + BGM(customRange.bgm[customSel[sel]]) + end + elseif key=="down"then + sel=sel%#customID+1 + elseif key=="up"then + sel=(sel-2)%#customID+1 + elseif key=="d"then + gotoScene("draw") + elseif key=="return"then + loadGame(0,1) + elseif key=="space"then + loadGame(0,2) + elseif key=="escape"then + back() + end +end + +function mouseDown.draw(x,y,k) + mouseMove.draw(x,y) +end +function mouseMove.draw(x,y,dx,dy) + 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 + if sx and sy and ms.isDown(1,2,3)then + preField[sy][sx]=ms.isDown(1)and pen or ms.isDown(2)and -1 or 0 + end +end +function wheelmoved.draw(x,y) + 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 +end +function touchDown.draw(id,x,y) + mouseMove.draw(x,y) +end +function touchMove.draw(id,x,y,dx,dy) + 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 + if sx and sy then + preField[sy][sx]=pen + end +end +function keyDown.draw(key) + if key=="delete"then + Buttons.draw.clear.code() + elseif 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=="space"then + if sx and sy then + preField[sy][sx]=pen + end + elseif key=="tab"then + pen=-1 + elseif key=="backspace"or key=="lalt"then + pen=0 + elseif key=="escape"then + back() + else + pen=find("123qwea#sdzxc",key)or pen + end +end + +function keyDown.setting2(key) + if key=="escape"then + if keyboardSetting then + keyboardSetting=false + else + back() + end + elseif keyboardSetting then + for l=1,8 do + for y=1,13 do + if setting.keyMap[l][y]==key then + setting.keyMap[l][y]="" + end + end + end + setting.keyMap[curBoard][keyboardSet]=key + keyboardSetting=false + elseif key=="return"then + keyboardSetting=true + elseif key=="up"then + keyboardSet=max(keyboardSet-1,1) + elseif key=="down"then + keyboardSet=min(keyboardSet+1,13) + elseif key=="left"then + curBoard=max(curBoard-1,1) + elseif key=="right"then + curBoard=min(curBoard+1,8) + end +end +function gamepadDown.setting2(key) + if key=="back"then + if joystickSetting then + joystickSetting=false + else + back() + end + elseif joystickSetting then + for l=9,16 do + for y=1,12 do + if setting.keyMap[l][y]==key then + setting.keyMap[l][y]="" + end + end + end + setting.keyMap[8+curBoard][joystickSet]=key + joystickSetting=false + elseif key=="start"then + joystickSetting=true + elseif key=="up"then + joystickSet=max(joystickSet-1,1) + elseif key=="down"then + joystickSet=min(joystickSet+1,12) + elseif key=="left"then + curBoard=max(curBoard-1,1) + elseif key=="right"then + curBoard=min(curBoard+1,8) + end +end + +function mouseDown.setting3(x,y,k) + if k==2 then back()end + for K=1,#virtualkey do + local b=virtualkey[K] + if (x-b[1])^2+(y-b[2])^21 then sel=sel-1 end + elseif key=="right"then + if sel<#updateLog then sel=sel+1 end + elseif key=="escape"then + back() + end +end + +------------------------------------------------------------- + +function love.mousepressed(x,y,k,t,num) + if t then return end + mouseShow=true + mx,my=xOy:inverseTransformPoint(x,y) + if mouseDown[scene]then + mouseDown[scene](mx,my,k) + elseif k==2 then + back() + end + if k==1 then + if not sceneSwaping and Buttons.sel then + local B=Buttons.sel + B.code() + B.alpha=1 + Buttons.sel=nil + love.mousemoved(x,y,0,0) + SFX("button") + VOICE("nya") + VIB(1) + end + end +end +function love.mousemoved(x,y,dx,dy,t) + if t then return end + mouseShow=true + mx,my=xOy:inverseTransformPoint(x,y) + Buttons.sel=nil + if mouseMove[scene]then + mouseMove[scene](mx,my,dx/scr.k,dy/scr.k) + end + for _,B in next,Buttons[scene]do + if not(B.hide and B.hide())then + if abs(mx-B.x)=.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 + gc.origin() + xOy=xOy:setTransformation(w*.5,h*.5,nil,scr.k,nil,640,360) + gc.replaceTransform(xOy) + collectgarbage() +end +function love.focus(f) + if system~="Android" and not f and scene=="play"then pauseGame()end +end +function love.update(dt) + -- if players then for k,v in pairs(players[1])do + -- if rawget(_G,k)and k~="next"and k~="hold"and k~="stat"then print(k,_G[v])end + -- end end--check player data flew(debugging) + for i=#BGblock,1,-1 do + BGblock[i].y=BGblock[i].y+BGblock[i].v + if BGblock[i].y>720 then rem(BGblock,i)end + end + if setting.bgblock then + BGblock.tm=BGblock.tm-1 + if BGblock.tm==0 then + BGblock[#BGblock+1]=getNewBlock() + BGblock.tm=rnd(20,30) + end + end + if sceneSwaping then + sceneSwaping.time=sceneSwaping.time-1 + if sceneSwaping.time==sceneSwaping.mid then + for k,B in next,Buttons[scene]do + B.alpha=0 + end--Reset buttons' alpha + Buttons.sel=nil + scene=sceneSwaping.tar + sceneInit[scene]() + elseif sceneSwaping.time==0 then + sceneSwaping=nil + end + end + if Tmr[scene]then + Tmr[scene](dt) + end + for i=#Task,1,-1 do + Task[i]:update() + end + if voicePlaying[1]then + if not voicePlaying[1]:isPlaying()then + rem(voicePlaying,1) + end + if voicePlaying[1] and not voicePlaying[1]:isPlaying()then voicePlaying[1]:play()end + end + for k,B in next,Buttons[scene]do + local t=B==Buttons.sel and .4 or 0 + B.alpha=abs(B.alpha-t)>.02 and(B.alpha+(B.alphat then B.alpha=B.alpha-.02 elseif B.alpha.5625 then + local d=(scr.h-scr.w*9/16)*.5/scr.k + gc.rectangle("fill",0,0,1280,-d) + gc.rectangle("fill",0,720,1280,d) + else--high + local d=(scr.w-scr.h*16/9)*.5/scr.k + gc.rectangle("fill",0,0,-d,720) + gc.rectangle("fill",1280,0,d,720) + end--wide + end--Black side + gc.setColor(1,1,1) + if powerInfoCanvas and scene~="draw"then + gc.draw(powerInfoCanvas) + end + setFont(20) + gc.print(tm.getFPS(),5,700) + if devMode>0 then + gc.print(mx.." "..my,5,640) + gc.print(#freeRow.."/"..freeRow.L,5,660) + gc.print(gcinfo(),5,680) + end +end +function love.run() + local lastFrame,lastUpdatePowerInfo=Timer(),Timer() + local readyDrawFrame=0 + local PUMP,POLL=love.event.pump,love.event.poll + love.resize(gc.getWidth(),gc.getHeight()) + scene="load"sceneInit.load()--System Launch + return function() + PUMP() + for N,a,b,c,d,e in POLL()do + if N=="quit"then return 0 + elseif love[N]then love[N](a,b,c,d,e)end + end + tm.step() + love.update(tm.getDelta()) + if not wd.isMinimized()then + readyDrawFrame=readyDrawFrame+setting.frameMul + if readyDrawFrame>=100 then + readyDrawFrame=readyDrawFrame-100 + love.draw() + gc.present() + end + end + repeat + if Timer()-lastUpdatePowerInfo>5 then + updatePowerInfo() + lastUpdatePowerInfo=Timer() + end + until Timer()-lastFrame>.0133 + tm.sleep(.003) + lastFrame=Timer() + end +end userData,userSetting=fs.newFile("userdata"),fs.newFile("usersetting") if fs.getInfo("userdata")then @@ -158,6 +1033,6 @@ elseif system=="Android" or system=="iOS"then setting.virtualkeySwitch=true setting.swap=F end - +math.randomseed(os.time()*626) swapLanguage(setting.lang) changeBlockSkin(setting.skin) \ No newline at end of file diff --git a/paint.lua b/paint.lua index 2e793c07..3385fdcd 100644 --- a/paint.lua +++ b/paint.lua @@ -1,8 +1,12 @@ local gc=love.graphics local mt=love.math +local gmatch=string.gmatch local setFont=setFont -local Timer=love.timer.getTime +local int,abs,rnd,max,min,sin=math.floor,math.abs,math.random,math.max,math.min,math.sin +local format=string.format +local Timer=love.timer.getTime +local scr=scr local attackColor={ {color.darkGrey,color.white}, {color.grey,color.white}, @@ -20,10 +24,11 @@ local frameColor={ local modeLevelColor={ EASY=color.cyan, NORMAL=color.green, - ["NORMAL+"]=color.darkGreen, HARD=color.magenta, - ["HARD+"]=color.darkMagenta, LUNATIC=color.red, + ["NORMAL+"]=color.darkGreen, + ["HARD+"]=color.darkMagenta, + ["LUNATIC+"]=color.darkRed, EXTRA=color.lightMagenta, ULTIMATE=color.lightYellow, @@ -36,7 +41,7 @@ local modeLevelColor={ ["40L"]=color.green, ["100L"]=color.orange, ["400L"]=color.red, - ["1000L"]=color.darkRed, + ["1000L"]=color.lightGrey, } local dataOptL={"key","rotate","hold",nil,nil,nil,"send","recv","pend"} local function dataOpt(i) @@ -102,8 +107,9 @@ end FX={ flash=0,--Black screen(frame) shake=0,--Screen shake(frame) - beam={},--Attack beam + attack={},--Attack beam badge={},--badge thrown + appear=function(t,a) setFont(t.font) gc.setColor(1,1,1,a) @@ -172,17 +178,17 @@ FX={ end, } -function drawDial(x,y,speed) +local function drawDial(x,y,speed) gc.setColor(1,1,1) mStr(int(speed),x,y-18) gc.draw(dialCircle,x,y,nil,nil,nil,32,32) gc.setColor(1,1,1,.6) gc.draw(dialNeedle,x,y,2.094+(speed<=175 and .02094*speed or 4.712-52.36/(speed-125)),nil,nil,5,4) end -function drawPixel(y,x,id) +local function drawPixel(y,x,id) gc.draw(blockSkin[id],30*x-30,600-30*y) end -function drawAtkPointer(x,y) +local function drawAtkPointer(x,y) local t=sin(Timer()*20) gc.setColor(.2,.7+t*.2,1,.6+t*.4) gc.circle("fill",x,y,25,6) @@ -191,19 +197,18 @@ function drawAtkPointer(x,y) gc.circle("line",x,y,30*(1+a),6) end -function VirtualkeyPreview() +local function VirtualkeyPreview() for i=1,#virtualkey do local c=sel==i and .8 or 1 - gc.setColor(c,c,c,setting.virtualkeyAlpha*.2) + gc.setColor(c,c,c,setting.virtualkeyAlpha*.1) local b=virtualkey[i] gc.setLineWidth(b[4]*.07) gc.circle("line",b[1],b[2],b[4]-5) if setting.virtualkeyIcon then gc.draw(virtualkeyIcon[i],b[1],b[2],nil,b[4]*.025,nil,18,18)end end end -function drawVirtualkey() - local a=setting.virtualkeyAlpha*.2 - local P=players[1] +local function drawVirtualkey() + local a=setting.virtualkeyAlpha*.1 for i=1,#virtualkey do if i~=9 or modeEnv.Fkey then local p,b=virtualkeyDown[i],virtualkey[i] @@ -221,43 +226,48 @@ function drawVirtualkey() end end -Pnt={BG={}} -function Pnt.BG.none() +local scs={{1,2},nil,nil,nil,nil,{1.5,1.5},{0.5,2.5}}for i=2,5 do scs[i]=scs[1]end +local matrixT={}for i=0,15 do matrixT[i]={}for j=0,8 do matrixT[i][j]=mt.noise(i,j)+2 end end +local Pnt={} +Pnt.BG={ +none=function() gc.clear(.15,.15,.15) -end -function Pnt.BG.grey() +end, +grey=function() gc.clear(.3,.3,.3) -end -function Pnt.BG.glow() +end, +lightGrey=function() + gc.clear(.5,.5,.5) +end, +glow=function() local t=((sin(Timer()*.5)+sin(Timer()*.7)+sin(Timer()*.9+1)+sin(Timer()*1.5)+sin(Timer()*2+3))+5)*.05 gc.clear(t,t,t) -end -function Pnt.BG.game1() +end, +game1=function() gc.setColor(1,1,1) gc.draw(background1,640,360,Timer()*.15,12,nil,64,64) -end -function Pnt.BG.game2() +end, +game2=function() gc.setColor(1,.5,.5) gc.draw(background1,640,360,Timer()*.2,12,nil,64,64) -end -function Pnt.BG.game3() +end, +game3=function() gc.setColor(.6,.6,1) gc.draw(background1,640,360,Timer()*.25,12,nil,64,64) -end -function Pnt.BG.game4() +end, +game4=function() gc.setColor(.1,.5,.5) local x=Timer()%4*320 gc.draw(background2,x,0,nil,10) gc.draw(background2,x-1280,0,nil,10) -end -function Pnt.BG.game5() +end, +game5=function() local t=2.5-Timer()%20%6%2.5 if t<.5 then gc.clear(t,t,t) else gc.clear(0,0,0) end -end -local scs={{1,2},nil,nil,nil,nil,{1.5,1.5},{0.5,2.5}}for i=2,5 do scs[i]=scs[1]end -function Pnt.BG.game6() +end, +game6=function() local t=1.2-Timer()%10%3%1.2 if t<.5 then gc.clear(t,t,t) else gc.clear(0,0,0) @@ -265,22 +275,21 @@ function Pnt.BG.game6() gc.setColor(.3,.3,.3) local r=7-int(Timer()*.5)%7 gc.draw(mouseBlock[r],640,360,Timer()%3.1416*6,400,400,scs[r][2]-.5,#blocks[r][0]-scs[r][1]+.5) -end -function Pnt.BG.rgb() +end, +rgb=function() gc.clear( sin(Timer()*1.2)*.15+.5, sin(Timer()*1.5)*.15+.5, sin(Timer()*1.9)*.15+.5 ) -end -function Pnt.BG.strap() +end, +strap=function() gc.setColor(1,1,1) local x=Timer()%32*40 gc.draw(background2,x,0,nil,10) gc.draw(background2,x-1280,0,nil,10) -end -local matrixT={}for i=0,15 do matrixT[i]={}for j=0,8 do matrixT[i][j]=mt.noise(i,j)+2 end end -function Pnt.BG.matrix() +end, +matrix=function() gc.clear(.15,.15,.15) for i=0,15 do for j=0,8 do @@ -289,7 +298,8 @@ function Pnt.BG.matrix() gc.rectangle("fill",80*i,80*j,80,80) end end -end +end, +} function Pnt.load() gc.setLineWidth(4) @@ -322,12 +332,15 @@ function Pnt.main() gc.setColor(1,1,1) gc.draw(titleImage,280,30,nil,1.3) setFont(30) - gc.print("Alpha V0.7.21",290,125) + gc.print(gameVersion,290,125) gc.print(system,845,95) + setFont(35) + mStr(modeLevel[modeID[modeSel]][levelSel],160,180) + mStr(text.modeName[modeSel],160,380) end function Pnt.mode() gc.setColor(1,1,1) - gc.draw(titleImage,830,30) + gc.draw(titleImage,810,30) setFont(40) gc.setColor(modeLevelColor[modeLevel[modeID[modeSel]][levelSel]]or color.white) mStr(modeLevel[modeID[modeSel]][levelSel],270,215) @@ -364,7 +377,7 @@ function Pnt.music() end function Pnt.custom() gc.setColor(1,1,1,.3+sin(Timer()*8)*.2) - gc.rectangle("fill",25,95+40*optSel,465,40) + gc.rectangle("fill",25,95+40*sel,465,40) gc.setColor(.8,.8,.8)gc.draw(drawableText.custom,20,20) gc.setColor(1,1,1)gc.draw(drawableText.custom,22,23) setFont(40) @@ -436,11 +449,9 @@ function Pnt.play() if j==P.clearing[h]and P.falling>-1 then h=h-1 else - for i=1,10 do - if F[j][i]>0 then - gc.draw(blockSkinmini[F[j][i]],6*i-6,120-6*j) - end - end + for i=1,10 do if F[j][i]>0 then + gc.draw(blockSkinmini[F[j][i]],6*i-6,120-6*j) + end end end end--Field if P.alive then @@ -480,21 +491,22 @@ function Pnt.play() gc.setColor(1,1,1,.2) for x=1,9 do gc.line(30*x,-10,30*x,600)end for y=0,19 do - y=30*y+P.fieldBeneath + y=30*(y-int(P.fieldBeneath/30))+P.fieldBeneath gc.line(0,y,300,y) end - if P.fieldBeneath>20 then - gc.line(0,P.fieldBeneath-30,300,P.fieldBeneath-30) - end end--Grid lines gc.translate(0,P.fieldBeneath) gc.setScissor(scr.x+P.absFieldX*scr.k,scr.y+P.absFieldY*scr.k,300*P.size*scr.k,610*P.size*scr.k) + -- local dy=setting.smo and(P.y_img~=P.curY and min(P.dropDelay,8e98)/P.gameEnv.drop or min(P.lockDelay,8e98)/P.gameEnv.lock)^4*30 or 0 + local dy,stepY=0,setting.smo and (1-(P.falling/P.gameEnv.fall)^3)*30 or 0 local h=#P.clearing for j=int(P.fieldBeneath/30+1),#P.field do if j==P.clearing[h]and P.falling>-1 then h=h-1 + dy=dy+stepY + gc.translate(0,stepY) gc.setColor(1,1,1,P.falling/P.gameEnv.fall) - gc.rectangle("fill",0,600-30*j,320,30) + gc.rectangle("fill",0,600-30*j,320,30-stepY) else for i=1,10 do if P.field[j][i]>0 then @@ -504,6 +516,7 @@ function Pnt.play() end end end--Field + gc.translate(0,-dy) for i=1,#P.shade do local S=P.shade[i] gc.setColor(1,1,1,S[1]*.12) @@ -522,6 +535,8 @@ function Pnt.play() end end end end--Ghost + local dy=setting.smo and(P.y_img~=P.curY and min(P.dropDelay,8e98)/P.gameEnv.drop or min(P.lockDelay,8e98)/P.gameEnv.lock)^4*30 or 0 + gc.translate(0,-dy) if P.gameEnv.block then gc.setColor(1,1,1,P.lockDelay/P.gameEnv.lock) for i=1,P.r do for j=1,P.c do @@ -540,95 +555,102 @@ function Pnt.play() gc.setColor(1,1,1) local x=30*(P.curX+P.sc[2]-1)-30+15 gc.draw(spinCenter,x,600-30*(P.curY+P.sc[1]-1)+15,nil,nil,nil,4,4) + gc.translate(0,dy) gc.setColor(1,1,1,.5) gc.draw(spinCenter,x,600-30*(P.y_img+P.sc[1]-1)+15,nil,nil,nil,4,4) + goto E end--Rotate center + gc.translate(0,dy) end - --Draw game field - gc.setScissor()--In-playField mask + ::E:: + gc.setScissor()--In-playField things gc.setColor(1,1,1) gc.draw(PTC.dust[p]) gc.translate(0,-P.fieldBeneath) - gc.setLineWidth(3) - gc.rectangle("line",-1,-11,302,612)--Draw boarder - - gc.setLineWidth(2) - gc.rectangle("line",301,0,16,601.5)--Draw atkBuffer boarder - local h=0 - for i=1,#P.atkBuffer do - local a=P.atkBuffer[i] - local bar=a.amount*30 - if h+bar>600 then bar=600-h end - if not a.sent then - if a.time<20 then - bar=bar*(20*a.time)^.5*.05 - --Appear - end - if a.countdown>0 then - gc.setColor(attackColor[a.lv][1]) - gc.rectangle("fill",304,599-h,11,-bar+3) - gc.setColor(attackColor[a.lv][2]) - gc.rectangle("fill",304,599-h+(-bar+3),11,-(-bar+3)*(1-a.countdown/a.cd0)) - --Timing + gc.setBlendMode("replace","alphamultiply")--SPEED UPUP(?) + gc.setLineWidth(2) + gc.rectangle("line",-1,-11,302,612)--Draw boarder + gc.rectangle("line",301,0,15,601)--Draw atkBuffer boarder + local h=0 + for i=1,#P.atkBuffer do + local A=P.atkBuffer[i] + local bar=A.amount*30 + if h+bar>600 then bar=600-h end + if not A.sent then + if A.time<20 then + bar=bar*(20*A.time)^.5*.05 + --Appear + end + if A.countdown>0 then + 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 + local t=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 - local t=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",304,599-h,11,-bar+3) - --Warning + gc.setColor(attackColor[A.lv][1]) + bar=bar*(20-A.time)*.05 + gc.rectangle("fill",303,599-h,11,-bar+2) + --Disappear end - else - gc.setColor(attackColor[a.lv][1]) - bar=bar*(20-a.time)*.05 - gc.rectangle("fill",304,599-h,11,-bar+2) - --Disappear + h=h+bar + end--Buffer line + local a,b=P.b2b,P.b2b1 if a>b then a,b=b,a end + gc.setColor(.8,1,.2) + gc.rectangle("fill",-14,599,11,-b*.5) + gc.setColor(P.b2b<40 and color.white or P.b2b<=1e3 and color.lightRed or color.lightBlue) + gc.rectangle("fill",-14,599,11,-a*.5) + if Timer()%1<.5 then + gc.rectangle("fill",-15,b<40 and 578.5 or 98.5,13,3) end - h=h+bar - end--Buffer line - local a,b=P.b2b,P.b2b1 if a>b then a,b=b,a end - gc.setColor(.8,1,.2) - gc.rectangle("fill",-15,599.5,11,-b*.5) - gc.setColor(P.b2b<40 and color.white or P.b2b<=1e3 and color.lightRed or color.lightBlue) - gc.rectangle("fill",-15,599.5,11,-a*.5) - gc.setColor(1,1,1,.5+sin(Timer()*30)*.5) - gc.rectangle("fill",-16,b<40 and 578.5 or 98.5,13,3) - gc.setColor(1,1,1) - gc.rectangle("line",-17,-3,16,604.5)--Draw b2b bar boarder - --B2B indictator - gc.translate(-P.fieldOffX,-P.fieldOffY) + gc.setColor(1,1,1) + gc.rectangle("line",-16,-3,15,604)--Draw b2b bar boarder + --B2B indictator + gc.translate(-P.fieldOffX,-P.fieldOffY) + gc.setBlendMode("alpha") if P.gameEnv.hold then - gc.setColor(1,1,1) mDraw(drawableText.hold,-82,-10) + if P.holded then gc.setColor(.6,.6,.6)end for i=1,#P.hold.bk do - for j=1,#P.hold.bk[1] do - if P.hold.bk[i][j]then - drawPixel(i+17.5-#P.hold.bk*.5,j-2.7-#P.hold.bk[1]*.5,P.holded and 9 or P.hold.color) + local B=P.hold.bk + for j=1,#B[1]do + if B[i][j]then + drawPixel(i+17.5-#B*.5,j-2.7-#B[1]*.5,P.hold.color) end end end end--Hold + gc.setColor(1,1,1) mDraw(drawableText.next,381,-10) local N=1 ::L:: + if N<=P.gameEnv.next and P.next[N]then local b,c=P.next[N].bk,P.next[N].color - gc.setColor(1,1,1) for i=1,#b do for j=1,#b[1] do if b[i][j]then drawPixel(i+20-2.4*N-#b*.5,j+12.7-#b[1]*.5,c) end end end N=N+1 - if N<=P.gameEnv.next and P.next[N]then goto L end + goto L + end --Next gc.setColor(.8,.8,.8) gc.draw(drawableText.modeName,-135,-65) gc.draw(drawableText.levelName,437-drawableText.levelName:getWidth(),-65) + gc.setColor(1,1,1) if frame<180 then local count=179-frame gc.push("transform") gc.translate(155,220) - gc.setColor(1,1,1) setFont(100) if count%60>45 then gc.scale(1+(count%60-45)^2*.01,1)end mStr(int(count/60+1),0,0) @@ -637,19 +659,18 @@ function Pnt.play() for i=1,#P.bonus do P.bonus[i]:draw(min((30-abs(P.bonus[i].t-30))*.05,1)*(not P.bonus[i].inf and #P.field>(9-P.bonus[i].dy*.0333)and .7 or 1)) end--Effects - - gc.setColor(1,1,1) - setFont(35) - mStr(format("%.2f",P.stat.time),-82,520)--Draw time - if mesDisp[curMode.id]then mesDisp[curMode.id]()end--Draw other message - + setFont(30) gc.setColor(1,1,1) + mStr(format("%.2f",P.stat.time),-82,518)--Time + mStr(P.score1,-82,560)--Score gc.draw(drawableText.bpm,390,490) gc.draw(drawableText.kpm,350,583) setFont(30) drawDial(360,520,P.dropSpeed) drawDial(405,575,P.keySpeed) --Speed dials + gc.setColor(1,1,1) + if mesDisp[curMode.id]then mesDisp[curMode.id]()end--Other messages if modeEnv.royaleMode then if P.atkMode then gc.setColor(1,.8,0,P.swappingAtkMode*.02) @@ -661,17 +682,42 @@ function Pnt.play() gc.pop() end end--Draw players + gc.setLineWidth(5) + for i=1,#FX.attack do + local A=FX.attack[i] + gc.push("transform") + local a=A.a + if A.t<20 then + gc.translate(A.x1,A.y1) + a=a*A.t*.05 + elseif A.t<80 then + local t=((A.t-20)*.016667)t=(3-2*t)*t*t + gc.translate(A.x1*(1-t)+A.x2*t,A.y1*(1-t)+A.y2*t) + else + gc.translate(A.x2,A.y2) + a=a*(5-A.t*.05) + end + gc.rotate(A.t*.1) + gc.setColor(A.r,A.g,A.b,a*.5) + gc.circle("line",0,0,A.rad,A.corner) + gc.setColor(A.r,A.g,A.b,a) + gc.circle("fill",0,0,A.rad,A.corner) + gc.pop() + end gc.setColor(1,1,1) - gc.draw(PTC.attack[1]) - gc.draw(PTC.attack[2]) - gc.draw(PTC.attack[3]) if setting.virtualkeySwitch then drawVirtualkey()end if modeEnv.royaleMode then for i=1,#FX.badge do local b=FX.badge[i] - local t=b.t<10 and 0 or b.t<50 and .5+sin(1.5*(b.t/20-1.5))*.5 or 1 gc.setColor(1,1,1,b.t<10 and b.t*.1 or b.t<50 and 1 or(60-b.t)*.1) - gc.draw(badgeIcon,b[1]+(b[3]-b[1])*t,b[2]+(b[4]-b[2])*t,nil,nil,nil,14,14) + if b.t<10 then + gc.draw(badgeIcon,b[1]-14,b[2]-14) + elseif b.t<50 then + local t=((b.t-10)*.025)t=(3-2*t)*t*t + gc.draw(badgeIcon,b[1]*(1-t)+b[3]*t-14,b[2]*(1-t)+b[4]*t-14) + else + gc.draw(badgeIcon,b[3]-14,b[4]-14) + end end P=players[1] gc.setLineWidth(5) @@ -690,6 +736,8 @@ function Pnt.play() end end if restartCount>0 then + gc.setColor(1,.7,.7,.5+restartCount*.02) + gc.arc("fill",640,360,735,-1.5708,restartCount*0.3696-1.5708) gc.setColor(0,0,0,restartCount/17) gc.rectangle("fill",0,0,1280,720) end @@ -803,4 +851,14 @@ function Pnt.stat() gc.print(statOpt(i),720,30*i-5) end gc.draw(titleImage,260,600,.2+.07*sin(Timer()*3),nil,nil,212,35) -end \ No newline at end of file +end +function Pnt.history() + gc.setColor(.2,.2,.2,.7) + gc.rectangle("fill",150,35,980,530) + gc.setColor(1,1,1) + gc.setLineWidth(4) + gc.rectangle("line",150,35,980,530) + setFont(25) + gc.print(updateLog[sel],160,40) +end +return Pnt \ No newline at end of file diff --git a/texture.lua b/texture.lua index 6fac79b2..be77d4cb 100644 --- a/texture.lua +++ b/texture.lua @@ -44,34 +44,14 @@ PTC.dust0:setColors(1,1,1,.5,1,1,1,0) c:release() --Dust particles -PTC.attack={} -PTC.attack[1]=gc.newParticleSystem(N("/image/mess/atk1.png"),200) -PTC.attack[1]:setParticleLifetime(.25) -PTC.attack[1]:setEmissionRate(0) -PTC.attack[1]:setSpin(10) -PTC.attack[1]:setColors(1,1,1,.7,1,1,1,0) - -PTC.attack[2]=gc.newParticleSystem(N("/image/mess/atk2.png"),200) -PTC.attack[2]:setParticleLifetime(.3) -PTC.attack[2]:setEmissionRate(0) -PTC.attack[2]:setSpin(8) -PTC.attack[2]:setColors(1,1,1,.7,1,1,1,0) - -PTC.attack[3]=gc.newParticleSystem(N("/image/mess/atk3.png"),200) -PTC.attack[3]:setParticleLifetime(.4) -PTC.attack[3]:setEmissionRate(0) -PTC.attack[3]:setSpin(6) -PTC.attack[3]:setColors(1,1,1,.7,1,1,1,0) ---Attack particles - gc.setDefaultFilter("linear","linear") titleImage=N("/image/mess/title.png") dialCircle=N("/image/mess/dialCircle.png") dialNeedle=N("/image/mess/dialNeedle.png") badgeIcon=N("/image/mess/badge.png") spinCenter=N("/image/mess/spinCenter.png") -lightBulb=N("/image/mess/lightBulb.png") -light=N("/image/mess/light.png") +batteryImage=N("/image/mess/power.png") +chargeImage=N("/image/mess/charge.png") background1=N("/image/BG/bg1.jpg") background2=N("/image/BG/bg2.png") @@ -79,13 +59,11 @@ groupCode=N("/image/mess/groupcode.png") payCode=N("/image/mess/paycode.png") drawableText={ question=T(100,"?"), - bpm=T(15,"BPM"), - kpm=T(15,"KPM"), + bpm=T(15,"BPM"),kpm=T(15,"KPM"), modeName=T(30),levelName=T(30), next=T(40),hold=T(40), - pause=T(120), - finish=T(120), + pause=T(120),finish=T(120), custom=T(80), keyboard=T(25),joystick=T(25), setting2Help=T(25), diff --git a/timer.lua b/timer.lua index 039e77f5..6a6eb2dc 100644 --- a/timer.lua +++ b/timer.lua @@ -1,8 +1,10 @@ local wd=love.window local Timer=love.timer.getTime +local int,abs,rnd,max,min,sin=math.floor,math.abs,math.random,math.max,math.min,math.sin +local ins,rem=table.insert,table.remove -Tmr={} -function Tmr.load() +return{ +load=function() local t=Timer() ::R:: if loading==1 then @@ -47,26 +49,24 @@ function Tmr.load() gotoScene("intro","none") end end -end -function Tmr.intro() +end, +intro=function() count=count+1 if count==200 then count=80 end -end -function Tmr.draw() +end, +draw=function() if clearSureTime>0 then clearSureTime=clearSureTime-1 end -end -function Tmr.play(dt) +end, +play=function(dt) frame=frame+1 stat.time=stat.time+dt - for i=#FX.beam,1,-1 do - local b=FX.beam[i] + for i=#FX.attack,1,-1 do + local b=FX.attack[i] b.t=b.t+1 local t0=b.t*.025--t in [0,1] local t=(sin(1.5*(2*t0-1))+1)*.5 - PTC.attack[b.lv]:setPosition(b[1]+(b[3]-b[1])*t,b[2]+(b[4]-b[2])*t) - PTC.attack[b.lv]:emit(1) if t0==1 then - rem(FX.beam,i) + rem(FX.attack,i) end end for i=#FX.badge,1,-1 do @@ -81,13 +81,23 @@ function Tmr.play(dt) virtualkeyPressTime[i]=virtualkeyPressTime[i]-1 end end - PTC.attack[1]:update(dt) - PTC.attack[2]:update(dt) - PTC.attack[3]:update(dt) + local E=#FX.attack + for i=E,1,-1 do + local A=FX.attack[i] + A.t=A.t+1 + if A.t>=100 then + for j=i,E do + FX.attack[j]=FX.attack[j+1] + end--remove [i] + elseif A.t>80 then + A.rad=A.rad*1.08+.2 + end + end + if frame<180 then if frame==179 then gameStart() - elseif frame%60==0 then + elseif frame==60 or frame==120 then SFX("ready") end for p=1,#players do @@ -106,6 +116,7 @@ function Tmr.play(dt) clearTask("play") updateStat() resetGameData() + return end elseif restartCount>0 then restartCount=max(restartCount-2,0) @@ -133,9 +144,9 @@ function Tmr.play(dt) P.ai.controlDelay=P.ai.controlDelay-1 if P.ai.controlDelay==0 then if #P.ai.controls>0 then - pressKey(P.ai.controls[1],P) - releaseKey(P.ai.controls[1],P) - rem(P.ai.controls,1) + local C=P.ai.controls + pressKey(C[1],P)releaseKey(C[1],P) + local k=#C for i=1,k do C[i]=C[i+1]end--table.remove(C,1) P.ai.controlDelay=P.ai.controlDelay0+1 else AI_getControls(P.ai.controls) @@ -143,7 +154,7 @@ function Tmr.play(dt) if Timer()-P.modeData.point>P.modeData.event then P.modeData.point=Timer() P.modeData.event=P.ai.controlDelay0+rnd(2,10) - changeAtkMode(rnd()<.85 and 1 or #P.atker>3 and 4 or rnd()<.35 and 2 or 3) + changeAtkMode(rnd()<.85 and 1 or #P.atker>3 and 4 or rnd()<.3 and 2 or 3) end end end @@ -192,9 +203,9 @@ function Tmr.play(dt) removeRow(P.field,P.clearing[i]) removeRow(P.visTime,P.clearing[i]) end - ::L:: - rem(P.clearing) - if P.clearing[1]then goto L end + for i=1,#P.clearing do + P.clearing[i]=nil + end end if P.waiting>=0 then P.waiting=P.waiting-1 @@ -207,7 +218,9 @@ function Tmr.play(dt) if P.dropDelay>=0 then goto stop end end drop() - P.dropDelay=P.gameEnv.drop + if P.y_img~=P.curY then + P.dropDelay=P.gameEnv.drop + end if P.freshTime<=P.gameEnv.freshLimit then P.lockDelay=P.gameEnv.lock end @@ -241,9 +254,9 @@ function Tmr.play(dt) removeRow(P.field,P.clearing[i]) removeRow(P.visTime,P.clearing[i]) end - ::L:: - rem(P.clearing) - if P.clearing[1]then goto L end + for i=1,#P.clearing do + P.clearing[i]=nil + end end::stop:: if P.endCounter<40 then for j=1,#P.field do for i=1,10 do @@ -253,10 +266,17 @@ function Tmr.play(dt) if P.b2b1>0 then P.b2b1=max(0,P.b2b1*.92-1)end --Dead end + if P.stat.score>P.score1 then + if P.stat.score-P.score1<10 then + P.score1=P.score1+1 + else + P.score1=int(min(P.score1*.9+P.stat.score*.1+1)) + end + end for i=#P.shade,1,-1 do local S=P.shade[i] - S[1]=S[1]-1 - if S[1]==0 then + S[1]=S[1]-1+setting.fxs*.25 + if S[1]<=0 then rem(P.shade,i) end end @@ -296,12 +316,13 @@ function Tmr.play(dt) end end if modeEnv.royaleMode and frame%120==0 then freshMostDangerous()end -end -function Tmr.pause(dt) +end, +pause=function(dt) if not gamefinished then pauseTime=pauseTime+dt end if pauseTimer<50 and not wd.isMinimized()then pauseTimer=pauseTimer+1 end -end \ No newline at end of file +end, +} \ No newline at end of file diff --git a/toolfunc.lua b/toolfunc.lua index d51230ef..cff083b0 100644 --- a/toolfunc.lua +++ b/toolfunc.lua @@ -2,15 +2,20 @@ local tm=love.timer local gc=love.graphics local kb=love.keyboard local setFont=setFont +local int,abs,rnd,max,min=math.floor,math.abs,math.random,math.max,math.min +local sub,find=string.sub,string.find +local ins,rem=table.insert,table.remove local toN,toS=tonumber,tostring +local concat=table.concat local function splitS(s,sep) - local t={} - ::L:: - local i=find(s,sep)or #s+1 - ins(t,sub(s,1,i-1)) - s=sub(s,i+#sep) - if #s~=0 then goto L end + local t,n={},1 + repeat + local p=find(s,sep)or #s+1 + t[n]=sub(s,1,p-1) + n=n+1 + s=sub(s,p+#sep) + until #s==0 return t end function mStr(s,x,y) @@ -25,19 +30,21 @@ function getNewRow(val) for i=1,10 do t[i]=val end - --clear a row and move to active list - if #freeRow==0 then + freeRow.L=freeRow.L-1 + --get a row from buffer + if not freeRow[1]then for i=1,10 do - ins(freeRow,{0,0,0,0,0,0,0,0,0,0}) + freeRow[i]={0,0,0,0,0,0,0,0,0,0} end + freeRow.L=freeRow.L+10 end --prepare new rows return t end function removeRow(t,k) - ins(freeRow,rem(t,k)) + freeRow[#freeRow+1]=rem(t,k) + freeRow.L=freeRow.L+1 end - --Single-usage funcs langName={"中文","全中文","English"} local langID={"chi","chi_full","eng"} @@ -118,7 +125,7 @@ function SFX(s,v) end function VOICE(s,n) if setting.voc then - ins(voicePlaying,voice[s][n or rnd(#voice[s])]) + voicePlaying[#voicePlaying+1]=voice[s][n or rnd(#voice[s])] if #voicePlaying==1 then voicePlaying[1]:play() end @@ -227,6 +234,7 @@ local prevMenu={ setting2="setting", setting3="setting", help="main", + history="help", stat="main", }prevMenu.pause=prevMenu.play function back() @@ -263,51 +271,54 @@ local dataOpt={ "atk","send","recv","pend", "clear_1","clear_2","clear_3","clear_4", "spin_0","spin_1","spin_2","spin_3", - "b2b","b3b","pc", + "b2b","b3b","pc","score", } function loadData() userData:open("r") - --local t=splitS(love.math.decompress(userdata,"zlib"),"\r\n") - local t=splitS(userData:read(),"\r\n") + local t=userData:read() + if not find(t,"spin")then + t=love.data.decompress("string","zlib",t) + end + t=splitS(t,"\r\n") userData:close() for i=1,#t do - local i=t[i] - if find(i,"=")then - local t=sub(i,1,find(i,"=")-1) - local v=sub(i,find(i,"=")+1) + local p=find(t[i],"=") + if p then + local t,v=sub(t[i],1,p-1),sub(t[i],p+1) if t=="gametime"then t="time"end for i=1,#dataOpt do - if t==dataOpt[i]then goto L end + if t==dataOpt[i]then + v=toN(v)if not v or v<0 then v=0 end + stat[t]=v + break + end end - goto E - ::L:: - v=toN(v)if not v or v<0 then v=0 end - stat[t]=v - ::E:: end end end function saveData() local t={} for i=1,#dataOpt do - ins(t,dataOpt[i].."="..toS(stat[dataOpt[i]])) + t[i]=dataOpt[i].."="..toS(stat[dataOpt[i]]) end t=concat(t,"\r\n") - --t=love.math.compress(t,"zlib"):getString() + t=love.data.compress("string","zlib",t) userData:open("w") userData:write(t) userData:close() end function loadSetting() userSetting:open("r") - --local t=splitS(love.math.decompress(userdata,"zlib"),"\r\n") - local t=splitS(userSetting:read(),"\r\n") + local t=userSetting:read() + if not find(t,"virtual")then + t=love.data.decompress("string","zlib",t) + end + t=splitS(t,"\r\n") userSetting:close() for i=1,#t do - local i=t[i] - if find(i,"=")then - local t=sub(i,1,find(i,"=")-1) - local v=sub(i,find(i,"=")+1) + local p=find(t[i],"=") + if p then + local t,v=sub(t[i],1,p-1),sub(t[i],p+1) if t=="sfx"or t=="bgm"or t=="bgblock"or t=="voc"then setting[t]=v=="true" elseif t=="vib"then @@ -326,15 +337,15 @@ function loadSetting() elseif t=="virtualkey"then v=splitS(v,"/") for i=1,10 do - if not v[i]then goto c end - virtualkey[i]=splitS(v[i],",") - for j=1,4 do - virtualkey[i][j]=toN(virtualkey[i][j]) + if v[i]then + virtualkey[i]=splitS(v[i],",") + for j=1,4 do + virtualkey[i][j]=toN(virtualkey[i][j]) + end end - ::c:: end elseif t=="virtualkeyAlpha"then - setting.virtualkeyAlpha=int(abs(toN(v))) + setting.virtualkeyAlpha=min(int(abs(toN(v))),10) elseif t=="virtualkeyIcon"or t=="virtualkeySwitch"then setting[t]=v=="true" elseif t=="frameMul"then @@ -342,8 +353,10 @@ function loadSetting() elseif t=="das"or t=="arr"or t=="sddas"or t=="sdarr"then v=toN(v)if not v or v<0 then v=0 end setting[t]=int(v) - elseif t=="ghost"or t=="center"or t=="grid"or t=="swap"or t=="fxs"or t=="bg"then + elseif t=="ghost"or t=="center"or t=="grid"or t=="swap"or t=="bg"or t=="smo"then setting[t]=v=="true" + elseif t=="fxs"then + setting[t]=toN(v:match("[0123]"))or 0 elseif t=="lang"then setting[t]=toN(v:match("[123]"))or 1 elseif t=="skin"then @@ -364,7 +377,7 @@ local saveOpt={ "vib","voc", "fullscreen", "bgblock", - "skin", + "skin","smo", "virtualkeyAlpha", "virtualkeyIcon", "virtualkeySwitch", @@ -387,10 +400,11 @@ function saveSetting() "virtualkey="..toS(concat(vk,"/")), } for i=1,#saveOpt do - ins(t,saveOpt[i].."="..toS(setting[saveOpt[i]])) + t[i+2]=saveOpt[i].."="..toS(setting[saveOpt[i]]) + --not always i+2! end t=concat(t,"\r\n") - --t=love.math.compress(t,"zlib"):getString() + t=love.data.compress("string","zlib",t) userSetting:open("w") userSetting:write(t) userSetting:close() diff --git a/updateLog.lua b/updateLog.lua new file mode 100644 index 00000000..48b2d7d3 --- /dev/null +++ b/updateLog.lua @@ -0,0 +1,196 @@ +return{ +[=[Future outlook: + "classic" rule + backfire mode + Encrypt source code(JIT to byte code) + game recording + virtual key switch(all keys) + easier CTWC + fineese/bigbang mode + more FXs + TTT mode + smarter AI + infinite 1v1 + square mode + 3d features + layer-feeling + more animation]=],[=[ +0.7.22: + scoring system + smooth dropping + can change FX level + new attaking FX + new bone skin + baattery info/time display + in-game update log(this page) + fast game + much many more better GUI details + add EXTRA level of survivor mode + adjust difficulty of Tech mode + compressed setting/data + support 10% step alpha of virtual key + many code optimized&bugs fixed +0.7.21: + new title image + more GUI details + many bugs fixed]=],[=[ +0.7.20: + add music room + change block/space apperance in draw mode + field shake animation + default sets of custom options + can set BG/BGM in custom mode + bug fixed +0.7.19: + Secret option! + macOS version! + add C4W train mode + rendering of royale mode optimized again + add "free cell" in draw mode + add 2 new block skins + new difficulty in infinite mode + new background/sound effect in master mode + bug fixed]=],[=[ +0.7.18: + 3 new block skins!(one skin origional by Miya(nya~)) + better restarting(to prevent mistakenly touching) + switch display of puzzle mode + adjust UI + code optimized + default custom options changed to as infinite mode +0.7.17: + display game stats when pause + more options in statistics + better pausing + adjust difficulty of Tech mode + adjust difficulty of PC train mode + adjust vibrate level for mobile devices + little optimized + bugs fixed]=],[=[ +0.7.16: + bugs fixed + change rules of custom puzzle mode + change rules of TSD mode + better pausing + speed optimized + adjust difficulty of dig mode +0.7.15: + can make puzzle by drawing mode + can pause game with animation + change icon of "Functional key" + speed optimized + bugs fixed]=],[=[ +0.7.14: + drawing mode in custom game + can adjust virtual keys with mouse + speed optimized + rotate also create shade +0.7.13+: + change difficulty of survivor mode + little game rule change + bugs fixed(AI control error) +0.7.13: + Chniese 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]=],[=[ +0.7.12: + AI learned to switch attack mode + seperate master mode from marathon mode + master mode more interesting + countdown line in sprint mode + smooth BGM swapping + new garbage buffer + new harddrop&lock SFX feel + a bit change of rotate system + grid switch + swap target by combo key/press + some Chinese translaton editted + [reconstruct event system]]=],[=[ +0.7.11: + some Chinese translaton editted + add bone block in 2 hardest marathon(new block-fresh system) + play sound when get badges in royale mode + change b2b indicator display method + more difficulty of blind mode + colorful garbage lines + clearer attacking pointer + fix 6 next in classic mode + add QR code in help page + change some detials]=],[=[ +0.7.10: + 更完全的中文翻译 + add Classic mode + change O spin's behaviour + fix bugs +0.7.9: + O spin is a lie + better attacking pointer + language system + change rotate system + change BGM&BG set + code optimized + fix bugs]=],[=[ +0.7.8: + GPU usage decreased much more than before + add virtual key animation + display player's rank after death in royale mode + fix sequence error of PC train mode + adjust difficulty of suvivor mode + code optimized + fix bugs +0.7.7: + add dig mode + add survivor mode + combine some modes + change some GUI + more SFXs + fix bugs]=],[=[ +0.7.6: + new font + add DIFFICULTY selection + virtual keys give visual feedback(PC/phone) + add vibration + add default set of visual keys + add tech mode + add drought mode + better GUI&change speed&BGM in royale mode + more FXs in royale mode + fix all attacking bug of royale mode + change sequence of TSD-only mode to bag7]=],[=[ +0.7.5: + reduce difficuly of PC training mode,and add more patterns + reduce difficuly of death mode + add PC challenge mode + swapping attack mode for royale mode(AI always use 'Random') + royale mode use less GPU + new GUI of royale mode + add intro scene + soft scene swapping + adjust other details + change game icon + adjust GUI of royale mode + change sequence of TSD-only mode + royale mode use LESS GPU]=],[=[ +0.7.4: + add a lot of bugs +0.7.3: + add infinite target in custom + fix TSD-only mode result+1 when finishing with a wrong clear + change sequence generator of TSD-only mode + GUI position editted + Fix Screen flow + smarter AI +0.7.2: + add PC training mode + add TSD-only mode + remove non-sense s/z spin double + GUI position editted + grid BG changed + smarter AI]=] +} \ No newline at end of file