diff --git a/call&sys.lua b/call&sys.lua index d889ec6e..d8a32d9a 100644 --- a/call&sys.lua +++ b/call&sys.lua @@ -37,12 +37,13 @@ local sceneInit={ BGM("blank") end, draw=function() + curBG="none" kb.setKeyRepeat(true) clearSureTime=0 - pen=1 - sx,sy=1,1 + pen,sx,sy=1,1,1 end, play=function() + restartCount=0 if needResetGameData then resetGameData() needResetGameData=nil @@ -89,7 +90,6 @@ local function getNewBlock() BGblock.next=BGblock.next%7+1 return t 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 onVirtualkey(x,y) local d2,nearest,distance @@ -110,7 +110,6 @@ function buttonControl_key(i) Buttons.sel=Buttons[scene][Buttons.sel[i]]or Buttons.sel else Buttons.sel=select(2,next(Buttons[scene])) - mouseShow=false end elseif i=="space"or i=="return"then if not sceneSwaping and Buttons.sel then @@ -126,7 +125,6 @@ function buttonControl_gamepad(i) Buttons.sel=Buttons[scene][Buttons.sel[i=="dpup"and"up"or i=="dpdown"and"down"or i=="dpleft"and"left"or"right"]]or Buttons.sel else Buttons.sel=select(2,next(Buttons[scene])) - mouseShow=false end elseif i=="start"then if not sceneSwaping and Buttons.sel then @@ -135,7 +133,6 @@ function buttonControl_gamepad(i) sysSFX("button") end end - mouseShow=false end mouseDown={} @@ -382,13 +379,10 @@ function keyDown.play(key) end local m=setting.keyMap for p=1,human do - local lib=setting.keyLib[p] - for s=1,#lib do - for k=1,12 do - if key==m[lib[s]][k]then - pressKey(k,players[p]) - return - end + for k=1,12 do + if key==m[2*p-1][k]or key==m[2*p][k]then + pressKey(k,players[p]) + return end end end @@ -404,13 +398,10 @@ keyUp={} function keyUp.play(key) local m=setting.keyMap for p=1,human do - local lib=setting.keyLib[p] - for s=1,#lib do - for k=1,12 do - if key==m[lib[s]][k]then - releaseKey(k,players[p]) - return - end + for k=1,12 do + if key==m[2*p-1][k]or key==m[2*p][k]then + releaseKey(k,players[p]) + return end end end @@ -466,14 +457,11 @@ end function gamepadDown.play(key) if key=="back"then back()return end local m=setting.keyMap - for p=1,4 do - local lib=setting.keyLib[p] - for s=1,#lib do - for k=1,12 do - if key==m[8+lib[s]][k]then - pressKey(k,players[p]) - return - end + for p=1,human do + for k=1,12 do + if key==m[2*p+7][k]or key==m[2*p+8][k]then + pressKey(k,players[p]) + return end end end @@ -481,14 +469,11 @@ end gamepadUp={} function gamepadUp.play(key) local m=setting.keyMap - for p=1,4 do - local lib=setting.keyLib[p] - for s=1,#lib do - for k=1,12 do - if key==m[8+lib[s]][k]then - releaseKey(k,players[p]) - return - end + for p=1,human do + for k=1,12 do + if key==m[2*p+7][k]or key==m[2*p+8][k]then + releaseKey(k,players[p]) + return end end end @@ -545,10 +530,10 @@ function love.wheelmoved(x,y) end function love.touchpressed(id,x,y) + mouseShow=false if not touching then touching=id love.touchmoved(id,x,y,0,0) - mouseShow=false end if touchDown[scene]then touchDown[scene](id,xOy:inverseTransformPoint(x,y)) @@ -566,7 +551,6 @@ function love.touchreleased(id,x,y) VIB(1) end Buttons.sel=nil - mouseShow=false end if touchUp[scene]then touchUp[scene](id,xOy:inverseTransformPoint(x,y)) @@ -592,6 +576,7 @@ function love.touchmoved(id,x,y,dx,dy) end function love.keypressed(i) + mouseShow=false if i=="f8"then devMode=not devMode end if devMode then if i=="k"then @@ -599,11 +584,7 @@ function love.keypressed(i) Event_gameover.lose() --Test code here elseif i=="q"then - for k,B in next,Buttons[scene]do - print(format("x=%d,y=%d,w=%d,h=%d",B.x,B.y,B.w,B.h)) - end - elseif i=="s"then - print(scr.x,scr.y,scr.w,scr.h,scr.k) + local B=Buttons.sel if B then print(format("x=%d,y=%d,w=%d,h=%d",B.x,B.y,B.w,B.h))end elseif Buttons.sel then local B=Buttons.sel if i=="left"then B.x=B.x-10 @@ -622,7 +603,6 @@ function love.keypressed(i) else buttonControl_key(i) end end - mouseShow=false end function love.keyreleased(i) if keyUp[scene]then keyUp[scene](i) @@ -630,11 +610,11 @@ function love.keyreleased(i) end function love.gamepadpressed(joystick,i) + mouseShow=false if gamepadDown[scene]then return gamepadDown[scene](i) elseif i=="back"then back() else buttonControl_gamepad(i) end - mouseShow=false end function love.gamepadreleased(joystick,i) if gamepadUp[scene]then gamepadUp[scene](i) @@ -667,13 +647,9 @@ function love.focus(f) if not f and wd.isMinimized()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) - ]] + -- 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 @@ -691,9 +667,9 @@ function love.update(dt) for k,B in next,Buttons[scene]do B.alpha=0 end--Reset buttons' alpha + Buttons.sel=nil scene=sceneSwaping.tar sceneInit[scene]() - Buttons.sel=nil elseif sceneSwaping.time==0 then sceneSwaping=nil end @@ -704,8 +680,13 @@ function love.update(dt) for i=#Task,1,-1 do Task[i]:update() end - updateButton() + 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 @@ -742,27 +745,28 @@ function love.draw() gc.rectangle("fill",0,0,-d,720) gc.rectangle("fill",1280,0,d,720) end--wide - end + end--Black side setFont(20)gc.setColor(1,1,1) gc.print(tm.getFPS(),5,700) if devMode then - gc.print(gcinfo(),5,680) + 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() - love.event.pump() - for name,a,b,c,d,e,f in love.event.poll()do - if name=="quit"then return 0 end - if love[name]then love[name](a,b,c,d,e,f)end + 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.receiveData(id,data) love.update(tm.getDelta()) readyDrawFrame=readyDrawFrame+setting.frameMul if readyDrawFrame>=100 then diff --git a/class.lua b/class.lua index 27270fc7..34915018 100644 --- a/class.lua +++ b/class.lua @@ -30,15 +30,8 @@ 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 - self:destroy() - return nil - end -end -function Task:destroy() - for i=#Task,1,-1 do - if Task[i]==self then - rem(Task,i) - return nil - end + for i=#Task,1,-1 do + if Task[i]==self then rem(Task,i)return end + end--Destroy end end \ No newline at end of file diff --git a/conf.lua b/conf.lua index 5e6131ae..1e1166cc 100644 --- a/conf.lua +++ b/conf.lua @@ -9,7 +9,7 @@ function love.conf(t) t.audio.mixwithsystem=true--Switch on to keep sysBGM local W=t.window - W.title="Techmino V0.7.17" + W.title="Techmino V0.7.18" W.icon="/image/icon.png" W.width,W.height=1280,720 W.minwidth,W.minheight=640,360 diff --git a/dataList.lua b/dataList.lua index f4107ac4..97dae8ab 100644 --- a/dataList.lua +++ b/dataList.lua @@ -83,22 +83,16 @@ loadmode={ pcchallenge=function() createPlayer(1,340,15) end, - techmino41=function() - createPlayer(1,340,15)--Player + techmino49=function() + createPlayer(1,340,15) if curMode.lv==5 then players[1].gameEnv.drop=15 end - local n,min,max=2 - if curMode.lv==1 then min,max=5,30 - elseif curMode.lv==2 then min,max=3,25 - elseif curMode.lv==3 then min,max=2,20 - elseif curMode.lv==4 then min,max=2,10 - elseif curMode.lv==5 then min,max=1,6 - end - for i=1,4 do for j=1,5 do - createPlayer(n,77*i-55,140*j-125,.2,rnd(min,max)) + local n,min,max=2,curMode.lv,35-6*curMode.lv + for i=1,4 do for j=1,6 do + createPlayer(n,78*i-54,115*j-98,.18,rnd(min,max)) n=n+1 end end - for i=9,12 do for j=1,5 do - createPlayer(n,77*i+275,140*j-125,.2,rnd(min,max)) + for i=9,12 do for j=1,6 do + createPlayer(n,78*i+267,115*j-98,.18,rnd(min,max)) n=n+1 end end --AIs @@ -156,23 +150,27 @@ loadmode={ modeEnv.target=nil createPlayer(2,965,360,.5,modeEnv.opponent) end - if curMode.lv==1 then - local h=20 - ::R:: - for i=1,10 do - if preField[h][i]>0 then goto L end - end - h=h-1 - if h>0 then goto R end - ::L:: - for _,P in next,players.alive do - local t=P.showTime*3 - for y=1,h do - P.field[y]=getNewRow(0) - P.visTime[y]=getNewRow(t) - for x=1,10 do P.field[y][x]=preField[y][x]end + preField.h=20 + ::R:: + for i=1,10 do + if preField[preField.h][i]>0 then + if curMode.lv==1 then + goto L + elseif curMode.lv==2 then + return + end end end + preField.h=preField.h-1 + if preField.h>0 then goto R end + ::L:: + for _,P in next,players.alive do + local t=P.showTime*3 + for y=1,preField.h do + P.field[y]=getNewRow(0) + P.visTime[y]=getNewRow(t) + for x=1,10 do P.field[y][x]=preField[y][x]end + end end end, } @@ -249,6 +247,14 @@ mesDisp={ setFont(30) mStr("Wave",-82,375) end, + tech=function() + setFont(50) + mStr(P.stat.atk,-82,310) + mStr(format("%.2f",2.5*P.stat.atk/P.stat.piece),-82,420) + setFont(20) + mStr("Attack",-82,363) + mStr("Efficiency",-82,475) + end, pctrain=function() setFont(22) mStr("Perfect Clear",-82,412) @@ -263,9 +269,9 @@ mesDisp={ setFont(50) mStr(max(100-P.stat.row,0),-82,250) end, - techmino41=function() + techmino49=function() setFont(40) - mStr(#players.alive.."/41",-82,175) + mStr(#players.alive.."/49",-82,175) mStr(P.ko,-70,215) setFont(25) gc.print("KO",-127,225) @@ -302,9 +308,10 @@ mesDisp={ setFont(75) mStr(max(P.gameEnv.target-P.stat.row,0),-82,280) end - if curMode.lv==2 and(P.keyPressing[9]or frame<180)then + if curMode.lv==2 and P.modeData.event==0 then + gc.setColor(1,1,1,.6) gc.setLineWidth(3) - for y=1,20 do for x=1,10 do + for y=1,preField.h do for x=1,10 do if preField[y][x]>0 then gc.setColor(blockColor[preField[y][x]]) gc.rectangle("line",30*x-25,605-30*y,20,20) @@ -363,6 +370,7 @@ Event={ if int(t*.01)>P.modeData.event then P.modeData.event=P.modeData.event+1 if P.modeData.event==5 then + curBG="game5" P.modeData.event=4 P.modeData.point=500 Event_gameover.win() @@ -1008,7 +1016,7 @@ defaultModeEnv={ bg="rgb",bgm="infinite", }, }, - techmino41={ + techmino49={ { fall=20, royaleMode=true, diff --git a/font.ttf b/font.ttf index 789481d9..ae483b85 100644 Binary files a/font.ttf and b/font.ttf differ diff --git a/gamefunc.lua b/gamefunc.lua index 4f8c4e8a..6f3ffb77 100644 --- a/gamefunc.lua +++ b/gamefunc.lua @@ -1079,23 +1079,28 @@ act={ P.swappingAtkMode=30 end end - if curMode.id=="custom"and curMode.lv==2 and#P.field>0 then - for y=1,#P.field do - for x=1,10 do - local a,b=preField[y][x],P.field[y][x] - if a==0 and b>0 or a<8 and a~=b or a>7 and b==0 then return end + if curMode.id=="custom"and curMode.lv==2 then + if #P.field>=preField.h then + for y=1,preField.h do + for x=1,10 do + local a,b=preField[y][x],P.field[y][x] + if a==0 and b>0 or a<8 and a~=b or a>7 and b==0 then + P.modeData.event=1-P.modeData.event + return + end + end end + P.modeData.event=1 + Event_gameover.win() + else + P.modeData.event=1-P.modeData.event end - Event_gameover.win() end end end, restart=function() - clearTask("play") - if frame>=180 then - updateStat() - resetGameData() - else + if frame<180 then + clearTask("play") resetPartGameData() end end, @@ -1109,7 +1114,7 @@ act={ local x0=cx ::L::if not ifoverlap(P.cur.bk,P.curX-1,P.curY)then P.curX=P.curX-1 - createShade(P.curX+1,P.curY+P.r-1,P.curX+P.c-1,P.curY) + createShade(P.curX+1,P.curY+P.r-1,P.curX+1,P.curY) freshgho() goto L end @@ -1119,7 +1124,7 @@ act={ local x0=cx ::L::if not ifoverlap(P.cur.bk,P.curX+1,P.curY)then P.curX=P.curX+1 - createShade(P.curX-1,P.curY+P.r-1,P.curX+P.c-1,P.curY) + createShade(P.curX+P.c-1,P.curY+P.r-1,P.curX+P.c-1,P.curY) freshgho() goto L end diff --git a/image/block.png b/image/block.png new file mode 100644 index 00000000..9ddeb8d6 Binary files /dev/null and b/image/block.png differ diff --git a/image/block/1.png b/image/block/1.png deleted file mode 100644 index d87015e8..00000000 Binary files a/image/block/1.png and /dev/null differ diff --git a/image/mess/paycode.png b/image/mess/paycode.png index 2f7df5ae..8418dae5 100644 Binary files a/image/mess/paycode.png and b/image/mess/paycode.png differ diff --git a/language/chi.lua b/language/chi.lua index 59f798ac..bfb5725d 100644 --- a/language/chi.lua +++ b/language/chi.lua @@ -62,7 +62,7 @@ return{ modeName={ [0]="自定义", "竞速","马拉松","大师","经典","禅","无尽","单挑","仅TSD","隐形","挖掘","生存","科研", - "全清训练","全清挑战","41人混战","99人混战","干旱","多人", + "全清训练","全清挑战","49人混战","99人混战","干旱","多人", }, modeInfo={ sprint="挑战世界纪录", @@ -79,7 +79,7 @@ return{ tech="尽可能不要普通消除", pctrain="熟悉全清定式的组合", pcchallenge="100行内尽可能多PC", - techmino41="41人混战", + techmino49="49人混战", techmino99="99人混战", drought="异常序列", hotseat="友尽模式", @@ -112,20 +112,20 @@ return{ "游戏运行次数:", "游戏局数:", "游戏时间:", - "总按键数:", - "总旋转数:", + "按键数:", + "旋转数:", "Hold次数:", "方块使用数:", - "总消行数:", - "总攻击数:", - "总发送数:", - "总接收数:", - "总上涨数:", - "总消除数:", - "总Spin数:", - "总B2B数:", - "总PC数:", - "平均效率:", + "消行数:", + "攻击数:", + "发送数:", + "接收数:", + "上涨数:", + "消除数:", + "Spin数:", + "B2B数:", + "PC数:", + "效率:", }, help={ "好像也没啥好帮助的吧?就当是关于了", @@ -204,15 +204,16 @@ return{ arrD="-",arrU="+", sddasD="-",sddasU="+", sdarrD="-",sdarrU="+", + 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, vib=function()return "震动强度:"..setting.vib end, fullscreen=function()return setting.fullscreen and"全屏:开"or"全屏:关"end, bgblock=function()return setting.bgblock and"背景动画:开"or"背景动画:关"end, frame=function()return"绘制帧:"..setting.frameMul.."%"end, - control="控制设置", - touch="触摸设置", - lang=function()return langName[setting.lang]end, + skin="切换方块皮肤", back="保存&返回", }, setting2={ @@ -236,4 +237,4 @@ return{ path="打开存储目录", }, }, -}-- \ 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 e7de8b3d..7d4162ea 100644 --- a/language/chi_full.lua +++ b/language/chi_full.lua @@ -62,7 +62,7 @@ return{ modeName={ [0]="自定义", "竞速","马拉松","大师","经典","禅","无尽","单挑","仅TSD","隐形","挖掘","生存","科研", - "全清训练","全清挑战","41人混战","99人混战","干旱","多人", + "全清训练","全清挑战","49人混战","99人混战","干旱","多人", }, modeInfo={ sprint="挑战世界纪录", @@ -79,7 +79,7 @@ return{ tech="尽可能不要普通消除!", pctrain="熟悉全清定式的组合", pcchallenge="100行内尽可能多全清", - techmino41="41人混战", + techmino49="49人混战", techmino99="99人混战", drought="异常序列", hotseat="友尽模式", @@ -112,20 +112,20 @@ return{ "游戏运行次数:", "游戏局数:", "游戏时间:", - "总按键数:", - "总旋转数:", + "按键数:", + "旋转数:", "暂存次数:", - "总方块使用:", - "总消行数:", - "总攻击行数:", - "总发送数:", - "总接收数:", - "总上涨数:", - "总消除数:", - "总旋转消行数:", - "总满贯数:", - "总全清数:", - "平均效率:", + "方块使用:", + "消行数:", + "攻击行数:", + "发送数:", + "接收数:", + "上涨数:", + "消除数:", + "旋转消行数:", + "满贯数:", + "全清数:", + "效率:", }, help={ "好像也没啥好帮助的吧?就当是关于了", @@ -204,15 +204,16 @@ return{ arrD="-",arrU="+", sddasD="-",sddasU="+", sdarrD="-",sdarrU="+", + 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, vib=function()return "震动强度:"..setting.vib end, fullscreen=function()return setting.fullscreen and"全屏:开"or"全屏:关"end, bgblock=function()return setting.bgblock and"背景动画:开"or"背景动画:关"end, frame=function()return"绘制帧:"..setting.frameMul.."%"end, - control="控制设置", - touch="触摸设置", - lang=function()return langName[setting.lang]end, + skin="切换方块皮肤", back="保存&返回", }, setting2={ @@ -236,4 +237,4 @@ return{ path="打开存储目录", }, }, -}--文全 \ No newline at end of file +}--文 \ No newline at end of file diff --git a/language/eng.lua b/language/eng.lua index 4153b8d3..e5504c48 100644 --- a/language/eng.lua +++ b/language/eng.lua @@ -62,7 +62,7 @@ return{ modeName={ [0]="Custom", "Sprint","Marathon","Master","Classic","Zen","Infinite","1v1","TSD-only","Blind","Dig","Survivor","Tech", - "PC Train","PC Challenge","Techmino41","Techmino99","Drought","Hotseat", + "PC Train","PC Challenge","Techmino49","Techmino99","Drought","Hotseat", }, modeInfo={ sprint="Speed run", @@ -79,7 +79,7 @@ return{ tech="Don't do normal clear", pctrain="Let's learn some PCs", pcchallenge="Make PCs in 100 Lines", - techmino41="Melee fight with 40 AIs", + techmino49="Melee fight with 48 AIs", techmino99="Melee fight with 98 AIs", drought="ERRSEQ flood attack", hotseat="", @@ -112,20 +112,20 @@ return{ "Games run:", "Games played:", "Game time:", - "Total key pressed:", - "Total rotate:", - "Total hold:", - "Total block used:", - "Total rows cleared:", - "Total attack:", - "Total sent:", - "Total receive:", - "Total pend:", - "Total clear:", - "Total spin:", - "Total B2B:", - "Total PC:", - "Total Efficiency", + "Key pressed:", + "Rotate:", + "Hold:", + "Block used:", + "Rows cleared:", + "Attack:", + "Sent:", + "Receive:", + "Pend:", + "Clear:", + "Spin:", + "B2B:", + "PC:", + "Efficiency:", }, help={ "I don't think you need \"help\".", @@ -204,15 +204,16 @@ return{ arrD="-",arrU="+", sddasD="-",sddasU="+", sdarrD="-",sdarrU="+", + 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, vib=function()return "Vibrate level:"..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, frame=function()return"FrameDraw:"..setting.frameMul.."%"end, - control="Control settings", - touch="Touch settings", - lang=function()return langName[setting.lang]end, + skin="Change Block Skin", back="Save&Back", }, setting2={ diff --git a/list.lua b/list.lua index 10f048cb..7e691bb6 100644 --- a/list.lua +++ b/list.lua @@ -114,7 +114,7 @@ percent0to5={[0]="0%","20%","40%","60%","80%","100%",} modeID={ [0]="custom", "sprint","marathon","master","classic","zen","infinite","solo","tsd","blind","dig","survivor","tech", - "pctrain","pcchallenge","techmino41","techmino99","drought","hotseat", + "pctrain","pcchallenge","techmino49","techmino99","drought","hotseat", } modeLevel={ sprint={"10L","20L","40L","100L","400L","1000L"}, @@ -131,7 +131,7 @@ modeLevel={ tech={"EASY","NORMAL","HARD","LUNATIC","ULTIMATE"}, pctrain={"NORMAL","EXTRA"}, pcchallenge={"NORMAL","HARD","LUNATIC"}, - techmino41={"EASY","NORMAL","HARD","LUNATIC","ULTIMATE"}, + techmino49={"EASY","NORMAL","HARD","LUNATIC","ULTIMATE"}, techmino99={"EASY","NORMAL","HARD","LUNATIC","ULTIMATE"}, drought={"NORMAL","MESS"}, hotseat={"2P","3P","4P",}, @@ -216,11 +216,11 @@ 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="help"}, - 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="setting",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"}, + 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="help"}, + 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="setting",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=64, code=function()keyDown.mode("up")end, hide=function()return modeSel==1 end,}, @@ -280,15 +280,21 @@ Buttons={ 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"}, - 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"}, arrU= {x=585, y=300, w=50, h=50, rgb=color.white,code=function()setting.arr=(setting.arr+1)%16 end,up="bg",down="sdarrU",left="arrD",right="bgblock"},--3~6 - sddasD= {x=210, y=370, w=50, h=50, rgb=color.white,code=function()setting.sddas=(setting.sddas-1)%11 end,up="dasD",down="lang",right="sddasU"}, - sddasU= {x=370, y=370, w=50, h=50, rgb=color.white,code=function()setting.sddas=(setting.sddas+1)%11 end,up="dasU",down="lang",left="sddasD",right="sdarrD"}, - sdarrD= {x=425, y=370, w=50, h=50, rgb=color.white,code=function()setting.sdarr=(setting.sdarr-1)%4 end,up="arrD",down="lang",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="lang",left="sdarrD",right="frame"}, + sddasD= {x=210, y=370, w=50, h=50, rgb=color.white,code=function()setting.sddas=(setting.sddas-1)%11 end,up="dasD",down="ctrl",right="sddasU"}, + sddasU= {x=370, y=370, w=50, h=50, rgb=color.white,code=function()setting.sddas=(setting.sddas+1)%11 end,up="dasU",down="ctrl",left="sddasD",right="sdarrD"}, + 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() + 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() @@ -318,14 +324,12 @@ Buttons={ 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="control",left="sdarrU"}, - control={x=850,y=440, w=340,h=60,rgb=color.green, code=function()gotoScene("setting2")end,up="frame",down="touch",left="lang"}, - touch= {x=850,y=510, w=340,h=60,rgb=color.yellow,code=function()gotoScene("setting3")end,up="control",down="back",left="lang"}, - lang= {x=280,y=510, w=200,h=60,rgb=color.red, code=function() - setting.lang=setting.lang%#langName+1 - swapLanguage(setting.lang) - end,up="sddasD",down="back",right="touch"}, - back= {x=640,y=620, w=300,h=70,rgb=color.white, code=back,up="touch"}, + end,up="bgblock",down="skin",left="sdarrU"}, + skin= {x=850,y=440, w=340,h=60,rgb=color.white, code=function() + setting.skin=setting.skin%4+1 + changeBlockSkin(setting.skin) + end,up="frame",down="back",left="ctrl"}, + back= {x=640,y=620, w=300,h=70,rgb=color.white, code=back,up="lang"}, }, setting2={--Control setting back={x=840,y=630,w=180,h=60,rgb=color.white,code=back}, diff --git a/main.lua b/main.lua index 72352be6..949ec5d6 100644 --- a/main.lua +++ b/main.lua @@ -52,19 +52,16 @@ gameEnv0={ bg="none",bgm="race" } customSel={ - drop=20, - lock=20, - wait=1, - fall=1, - next=7, - hold=1, + drop=22,lock=22, + wait=1,fall=1, + next=7,hold=3, sequence=1, visible=1, - target=4, - freshLimit=3, + target=8, + freshLimit=4, opponent=1, } -preField={}for i=1,20 do preField[i]={0,0,0,0,0,0,0,0,0,0}end +preField={h=20}for i=1,20 do preField[i]={0,0,0,0,0,0,0,0,0,0}end freeRow={} for i=1,40 do freeRow[i]={0,0,0,0,0,0,0,0,0,0} @@ -74,14 +71,14 @@ setting={ ghost=true,center=true, grid=F,swap=true, fxs=true,bg=true, - das=10,arr=2, sddas=0,sdarr=2, + lang=1, sfx=true,bgm=true,vib=3, fullscreen=F, bgblock=true, - lang=1, + skin=1, keyMap={ {"left","right","x","z","c","up","down","space","tab","r","","",""}, {"","","","","","","","","","","","",""}, @@ -100,12 +97,6 @@ setting={ {"","","","","","","","","","","","",""}, {"","","","","","","","","","","","",""}, },--keyboard & joystick - keyLib={ - {1}, - {2}, - {3}, - {4}, - },--Players' key setting(s) virtualkey={ {80,720-80,6400,80},--moveLeft {240,720-80,6400,80},--moveRight @@ -172,4 +163,6 @@ elseif system=="Android" or system=="iOS"then setting.virtualkeySwitch=true setting.swap=F end -swapLanguage(setting.lang) \ No newline at end of file + +swapLanguage(setting.lang) +changeBlockSkin(setting.skin) \ No newline at end of file diff --git a/paint.lua b/paint.lua index 1c517642..422406e5 100644 --- a/paint.lua +++ b/paint.lua @@ -37,13 +37,16 @@ local modeLevelColor={ ["400L"]=color.red, ["1000L"]=color.darkRed, } -local dataOptL={ - "key","rotate","hold","piece","row", - "atk","send","recv","pend", -} +local dataOptL={"key","rotate","hold",nil,nil,nil,"send","recv","pend"} local function dataOpt(i) local stat=players[1].stat - if i<10 then + if i==4 then + return stat.piece.." "..(int(stat.piece/stat.time*100)*.01).."PPS" + elseif i==5 then + return stat.row.." "..(int(stat.row/stat.time*600)*.1).."LPM" + elseif i==6 then + return stat.atk.." "..(int(stat.atk/stat.time*600)*.1).."APM" + elseif i<10 then return stat[dataOptL[i]] elseif i==10 then return stat.clear_1.."/"..stat.clear_2.."/"..stat.clear_3.."/"..stat.clear_4 @@ -168,39 +171,6 @@ FX={ end, } -function updateButton() - 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.alpha0 then + gc.setColor(0,0,0,restartCount/17) + gc.rectangle("fill",0,0,1280,720) + end end function Pnt.pause() Pnt.play() @@ -682,23 +663,23 @@ function Pnt.pause() gc.rectangle("fill",0,0,1280,720) gc.setColor(1,1,1,pauseTimer*.02) setFont(30) - gc.print(text.pauseTime..":["..pauseCount.."] "..format("%0.2f",pauseTime).."s",40,280) - setFont(40) + if pauseCount>0 then + gc.print(text.pauseTime..":["..pauseCount.."] "..format("%0.2f",pauseTime).."s",110,150) + end for i=1,7 do - gc.print(text.stat[i+3],40,40*i+285) - gc.print(dataOpt(i),400,40*i+285) + gc.print(text.stat[i+3],110,30*i+270) + gc.print(dataOpt(i),305,30*i+270) end for i=8,14 do - gc.print(text.stat[i+3],810,40*i+5) - gc.print(dataOpt(i),1060,40*i+5) + gc.print(text.stat[i+3],860,30*i+60) + gc.print(dataOpt(i),1000,30*i+60) end + setFont(40) if system~="Android"then mStr(text.space.."/"..text.enter,640,300) gc.print("ESC",610,598) end - gc.setColor(1,1,1) - setFont(120) - mStr(gamefinished and text.finish or text.pause,640,140-12*(5-pauseTimer*.1)^2) + mDraw(gamefinished and drawableText.finish or drawableText.pause,640,140-12*(5-pauseTimer*.1)^2) end function Pnt.setting() gc.setColor(1,1,1) @@ -708,6 +689,7 @@ function Pnt.setting() setFont(18) mStr(text.softdropdas..setting.sddas,290,361) mStr(text.softdroparr..setting.sdarr,506,361) + gc.draw(blockSkin[7-int(Timer()*2)%7],820,480,nil,2) end function Pnt.setting2() local a=.3+sin(Timer()*15)*.1 @@ -737,11 +719,12 @@ function Pnt.setting2() gc.line(200*x-160,30,200*x-160,550) end gc.line(40,550,640,550) - mStr(text.keyboard,340,0) - mStr(text.joystick,540,0) - gc.print(text.setting2Help,50,620) + mDraw(drawableText.keyboard,340,0) + mDraw(drawableText.joystick,540,0) + gc.draw(drawableText.setting2Help,50,620) setFont(40) - gc.print("< P"..curBoard.."/P8 >",430,570) + gc.print("P"..int(curBoard*.5+.5).."/P4",420,560) + gc.print(curBoard.."/8",580,560) end function Pnt.setting3() VirtualkeyPreview() @@ -764,6 +747,9 @@ function Pnt.help() gc.printf(text.help[i],140,15+43*i,1000,"center") end gc.draw(titleImage,180,600,.2,.7+.05*sin(Timer()*2),nil,140,100) + gc.setLineWidth(5) + gc.rectangle("line",17,17,260,260) + gc.rectangle("line",1077,17,186,186) gc.draw(payCode,20,20) gc.draw(groupCode,1080,20) gc.setColor(1,1,1,sin(Timer()*10)*.5+.5) diff --git a/texture.lua b/texture.lua index b17f6b08..e6bb53a6 100644 --- a/texture.lua +++ b/texture.lua @@ -8,17 +8,12 @@ local function C(x,y) end gc.setDefaultFilter("nearest","nearest") -local blockImg=N("/image/block/1.png") +blockImg=N("/image/block.png") blockSkin,blockSkinmini={},{} for i=1,13 do - C(30,30) - gc.draw(blockImg,30-30*i,0) - blockSkin[i]=c - C(6,6) - gc.draw(blockImg,6-6*i,0,nil,.2) - blockSkinmini[i]=c + blockSkin[i]=C(30,30) + blockSkinmini[i]=C(6,6) end -blockImg:release() virtualkeyIcon={} for i=1,10 do @@ -87,9 +82,12 @@ drawableText={ x=T(110,"×"), bpm=T(15,"BPM"), kpm=T(15,"KPM"), - modeName=T(30), - levelName=T(30), - next=T(40), - hold=T(40), + + modeName=T(30),levelName=T(30), + next=T(40),hold=T(40), + pause=T(120), + custom=T(80), + keyboard=T(25),joystick=T(25), + setting2Help=T(25), } c=gc.setCanvas() \ No newline at end of file diff --git a/timer.lua b/timer.lua index 455a8708..3b9da58c 100644 --- a/timer.lua +++ b/timer.lua @@ -52,7 +52,6 @@ end function Tmr.play(dt) frame=frame+1 stat.time=stat.time+dt - for i=#FX.beam,1,-1 do local b=FX.beam[i] b.t=b.t+1 @@ -93,8 +92,18 @@ function Tmr.play(dt) P.moving=0 end end + if restartCount>0 then restartCount=restartCount-1 end return - end--Counting,include pre-das,directy RETURN + elseif players[1].keyPressing[10]then + restartCount=restartCount+1 + if restartCount>17 then + clearTask("play") + updateStat() + resetGameData() + end + elseif restartCount>0 then + restartCount=max(restartCount-2,0) + end--Counting,include pre-das,directy RETURN,or restart counting for p=1,#players do P=players[p] if P.timing then P.stat.time=P.stat.time+dt end diff --git a/toolfunc.lua b/toolfunc.lua index 50a48653..81d6d713 100644 --- a/toolfunc.lua +++ b/toolfunc.lua @@ -16,6 +16,9 @@ end function mStr(s,x,y) gc.printf(s,x-320,y,640,"center") end +function mDraw(s,x,y) + gc.draw(s,x-s:getWidth()*.5,y) +end function getNewRow(val) local t=rem(freeRow) @@ -38,6 +41,15 @@ end --Single-usage funcs langName={"中文","全中文","English"} local langID={"chi","chi_full","eng"} +local drawableTextLoad={ + "next", + "hold", + "pause", + "custom", + "keyboard", + "joystick", + "setting2Help", +} function swapLanguage(l) text=require("language/"..langID[l]) Buttons.sel=nil @@ -47,8 +59,6 @@ function swapLanguage(l) B.t=text.ButtonText[S][N] end end - drawableText.next:set(text.next) - drawableText.hold:set(text.hold) if royaleCtrlPad then royaleCtrlPad:release()end gc.push("transform") gc.origin() @@ -63,8 +73,21 @@ function swapLanguage(l) end gc.setCanvas() gc.pop() + for _,s in next,drawableTextLoad do + drawableText[s]:set(text[s]) + end collectgarbage() end +function changeBlockSkin(n) + n=n-1 + for i=1,13 do + gc.setCanvas(blockSkin[i]) + gc.draw(blockImg,30-30*i,-30*n) + gc.setCanvas(blockSkinmini[i]) + gc.draw(blockImg,6-6*i,-6*n,nil,.2) + end + gc.setCanvas() +end local vibrateLevel={0,.02,.03,.04,.05,.06,.07,.08} function VIB(t) @@ -243,25 +266,6 @@ local dataOpt={ "spin_0","spin_1","spin_2","spin_3", "b2b","b3b","pc", } -local saveOpt={ - "ghost","center", - "grid","swap", - "fxs","bg", - - "das","arr", - "sddas","sdarr", - - "lang", - - "sfx","bgm", - "vib", - "fullscreen", - "bgblock", - "virtualkeyAlpha", - "virtualkeyIcon", - "virtualkeySwitch", - "frameMul", -} function loadData() userData:open("r") --local t=splitS(love.math.decompress(userdata,"zlib"),"\r\n") @@ -320,21 +324,6 @@ function loadSetting() setting.keyMap[i][j]=v1[j] end end - elseif t=="keylib"then - v=splitS(v,"/") - for i=1,4 do - local v1=splitS(v[i],",") - for j=1,#v1 do - setting.keyLib[i][j]=toN(v1[j]) - end - for j=1,#setting.keyLib[i]do - local v=setting.keyLib[i][j] - if int(v)~=v or v>=9 or v<=0 then - setting.keyLib[i]={i} - break - end - end - end elseif t=="virtualkey"then v=splitS(v,"/") for i=1,10 do @@ -358,10 +347,30 @@ function loadSetting() setting[t]=v=="true" elseif t=="lang"then setting[t]=toN(v:match("[123]"))or 1 + elseif t=="skin"then + setting[t]=toN(v:match("[1234]"))or 1 end end end end +local saveOpt={ + "ghost","center", + "grid","swap", + "fxs","bg", + "das","arr", + "sddas","sdarr", + "lang", + + "sfx","bgm", + "vib", + "fullscreen", + "bgblock", + "skin", + "virtualkeyAlpha", + "virtualkeyIcon", + "virtualkeySwitch", + "frameMul", +} function saveSetting() local vk={} for i=1,10 do @@ -374,13 +383,8 @@ function saveSetting() for i=1,16 do map[i]=concat(setting.keyMap[i],",") end - local lib={} - for i=1,4 do - lib[i]=concat(setting.keyLib[i],",") - end local t={ "keymap="..toS(concat(map,"/")), - "keylib="..toS(concat(lib,"/")), "virtualkey="..toS(concat(vk,"/")), } for i=1,#saveOpt do