From e14307045dccdec23eb325736a4cd8411ccb9915 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 2 May 2021 14:53:49 +0800 Subject: [PATCH 01/45] =?UTF-8?q?=E5=8D=87=E7=BA=A7table=E6=89=A9=E5=B1=95?= =?UTF-8?q?=E6=A8=A1=E5=9D=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/tableExtend.lua | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Zframework/tableExtend.lua b/Zframework/tableExtend.lua index cabf8627..db9cca90 100644 --- a/Zframework/tableExtend.lua +++ b/Zframework/tableExtend.lua @@ -1,6 +1,15 @@ local next,type=next,type local TABLE={} +--Get a new filled table +function TABLE.new(val,count) + local L={} + for i=1,count do + L[i]=val + end + return L +end + --Get a copy of [1~#] elements function TABLE.shift(org) local L={} From 32403078bc42e5aa0ba498902d0404248beeacdf Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 2 May 2021 20:24:03 +0800 Subject: [PATCH 02/45] =?UTF-8?q?=E4=BC=98=E5=8C=96=E4=B8=80=E7=82=B9?= =?UTF-8?q?=E7=BB=98=E5=88=B6=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/init.lua | 32 +++++----- parts/player/draw.lua | 145 ++++++++++++++++++++---------------------- 2 files changed, 86 insertions(+), 91 deletions(-) diff --git a/Zframework/init.lua b/Zframework/init.lua index 88a620b8..d629e587 100644 --- a/Zframework/init.lua +++ b/Zframework/init.lua @@ -54,11 +54,12 @@ local setFont=setFont local int,rnd,abs=math.floor,math.random,math.abs local min,sin=math.min,math.sin local ins,rem=table.insert,table.remove -local SCR=SCR + +local WIDGET,SCR,SCN=WIDGET,SCR,SCN +local xOy=SCR.xOy local mx,my,mouseShow=-20,-20,false local touching--First touching ID(userdata) -local xOy=SCR.xOy joysticks={} local devMode @@ -457,16 +458,15 @@ love.draw,love.update=nil--remove default draw/update function love.run() local love=love - local SCN,WIDGET=SCN,WIDGET local VOC,BG,SYSFX=VOC,BG,SYSFX local TASK,LOG,TEXT=TASK,LOG,TEXT - local SETTING=SETTING - local TIME=TIME + local TEXTURE,TIME=TEXTURE,TIME + local SETTING,VERSION=SETTING,VERSION + local destroyPlayers=destroyPlayers local STEP,WAIT=love.timer.step,love.timer.sleep - local FPS=love.timer.getFPS - local MINI=love.window.isMinimized + local FPS,MINI=love.timer.getFPS,love.window.isMinimized local PUMP,POLL=love.event.pump,love.event.poll local frameTimeList={} @@ -485,9 +485,9 @@ function love.run() return function() local _ - local t=TIME() - local dt=t-lastFrame - lastFrame=t + local time=TIME() + local dt=time-lastFrame + lastFrame=time --EVENT PUMP() @@ -533,11 +533,11 @@ function love.run() --Draw cursor if mouseShow then - local R=int((t+1)/2)%7+1 + local R=int((time+1)/2)%7+1 _=minoColor[SETTING.skin[R]] - gc_setColor(_[1],_[2],_[3],min(abs(1-t%2),.3)) + gc_setColor(_[1],_[2],_[3],min(abs(1-time%2),.3)) _=SCS[R][0] - gc_draw(TEXTURE.miniBlock[R],mx,my,t%3.14159265359*4,16,16,_[2]+.5,#BLOCKS[R][0]-_[1]-.5) + gc_draw(TEXTURE.miniBlock[R],mx,my,time%3.14159265359*4,16,16,_[2]+.5,#BLOCKS[R][0]-_[1]-.5) gc_setColor(1,1,1) gc_draw(TEXTURE[ms.isDown(1)and'cursor_hold'or'cursor'],mx,my,nil,nil,nil,8,8) end @@ -594,7 +594,7 @@ function love.run() gc_setColor(1,1,1) gc_draw(TEXTURE.ws_dead,-20,20*i-20) elseif status=='connecting'then - gc_setColor(1,1,1,.5+.3*sin(t*6.26)) + gc_setColor(1,1,1,.5+.3*sin(time*6.26)) gc_draw(TEXTURE.ws_connecting,-20,20*i-20) elseif status=='running'then gc_setColor(1,1,1) @@ -622,10 +622,10 @@ function love.run() end --Fresh power info. - if t-lastFreshPow>2.6 then + if time-lastFreshPow>2.6 then if SETTING.powerInfo and LOADED then updatePowerInfo() - lastFreshPow=t + lastFreshPow=time end if gc.getWidth()~=SCR.w then love.resize(gc.getWidth(),gc.getHeight()) diff --git a/parts/player/draw.lua b/parts/player/draw.lua index f152ea96..279e88df 100644 --- a/parts/player/draw.lua +++ b/parts/player/draw.lua @@ -9,32 +9,13 @@ local gc_stencil,gc_setStencilTest=gc.stencil,gc.setStencilTest local int,ceil,rnd=math.floor,math.ceil,math.random local max,min,sin,modf=math.max,math.min,math.sin,math.modf -local setFont,mDraw,mStr=setFont,mDraw,mStr -local TIME=TIME +local setFont,mDraw,mStr,mText=setFont,mDraw,mStr,mText +local SKIN,TEXTURE,IMG=SKIN,TEXTURE,IMG +local TEXT,COLOR,GAME,TIME=TEXT,COLOR,GAME,TIME +local shader_alpha,shader_lighter=SHADER.alpha,SHADER.lighter +local drawableText,missionEnum,minoColor=drawableText,missionEnum,minoColor -local frameColorList={ - [0]=COLOR.Z, - COLOR.lG, - COLOR.lB, - COLOR.lV, - COLOR.lO, -} ---local function drawCell(y,x,id)gc_draw(SKIN.curText[id],30*x-30,-30*y)end -local function stencilBoard()gc_rectangle('fill',0,-10,300,610)end -local function drawGrid(P) - local d=P.fieldBeneath+P.fieldUp - gc_setLineWidth(1) - gc_setColor(1,1,1,P.gameEnv.grid) - for x=1,9 do - gc_line(30*x,-10,30*x,600) - end - gc_push('transform') - gc_translate(0,d-30*int(d/30)) - for y=0,19 do - gc_line(0,30*y,300,30*y) - end - gc_pop() -end +local frameColorList={[0]=COLOR.Z,COLOR.lG,COLOR.lB,COLOR.lV,COLOR.lO} local function boardTransform(mode) if mode then if mode=="U-D"then @@ -49,15 +30,35 @@ local function boardTransform(mode) end end end +local function applyFieldOffset(P,notNorm) + if not notNorm then gc_translate(150,0)end + local O=P.fieldOff + gc_translate(O.x+150,O.y+300) + gc_rotate(O.a) + gc_translate(-150,-300) +end +local function stencilBoard()gc_rectangle('fill',0,-10,300,610)end + +local function drawGrid(P) + gc_setLineWidth(1) + + gc_setColor(1,1,1,P.gameEnv.grid) + for x=1,9 do gc_line(30*x,-10,30*x,600)end + + local dx=P.fieldBeneath+P.fieldUp + dx=dx-30*int(dx/30) + gc_translate(0,dx) + for y=0,19 do gc_line(0,30*y,300,30*y)end + gc_translate(0,-dx) +end local function drawRow(h,V,L,showInvis) local texture=SKIN.curText local t=TIME()*4 for i=1,10 do if L[i]>0 then if V[i]>0 then - local a=V[i]*.05 - gc_setColor(1,1,1,a) - gc_draw(texture[L[i]],30*i-30,-30*h)-- drawCell(j,i,L[i]) + gc_setColor(1,1,1,V[i]*.05) + gc_draw(texture[L[i]],30*i-30,-30*h) elseif showInvis then gc_setColor(1,1,1,.3+.08*sin(.5*(h-i)+t)) gc_rectangle('fill',30*i-30,-30*h,30,30) @@ -72,7 +73,7 @@ local function drawField(P) if P.falling==-1 then--Blocks only if ENV.upEdge then - gc_setShader(SHADER.lighter) + gc_setShader(shader_lighter) gc_translate(0,-4) -- for j=start,min(start+21,#F)do drawRow(j,V[j],F[j])end @@ -90,7 +91,7 @@ local function drawField(P) local h=1 if ENV.upEdge then gc_push('transform') - gc_setShader(SHADER.lighter) + gc_setShader(shader_lighter) gc_translate(0,-4) -- for j=start,min(start+21,#F)do @@ -149,7 +150,7 @@ local function drawFXs(P) for i=1,#P.moveFX do local S=P.moveFX[i] gc_setColor(1,1,1,.6-S[4]*.6) - gc_draw(texture[S[1]],30*S[2]-30,-30*S[3])-- drawCell(S[3],S[2],S[1]) + gc_draw(texture[S[1]],30*S[2]-30,-30*S[3]) end --ClearFX @@ -168,13 +169,13 @@ local function drawGhost(P,clr) local CB=P.cur.bk for i=1,#CB do for j=1,#CB[1]do if CB[i][j]then - gc_draw(texture[clr],30*(j+P.curX-1)-30,-30*(i+P.ghoY-1))-- drawCell(i+P.ghoY-1,j+P.curX-1,clr) + gc_draw(texture[clr],30*(j+P.curX-1)-30,-30*(i+P.ghoY-1)) end end end end local function drawBlockOutline(P,texture,trans) - SHADER.alpha:send("a",trans) - gc_setShader(SHADER.alpha) + shader_alpha:send("a",trans) + gc_setShader(shader_alpha) local CB=P.cur.bk for i=1,#CB do for j=1,#CB[1]do if CB[i][j]then @@ -190,11 +191,11 @@ local function drawBlockOutline(P,texture,trans) end local function drawBlock(P,clr) gc_setColor(1,1,1) - local texture=SKIN.curText + local texture=SKIN.curText[clr] local CB=P.cur.bk for i=1,#CB do for j=1,#CB[1]do if CB[i][j]then - gc_draw(texture[clr],30*(j+P.curX-1)-30,-30*(i+P.curY-1))-- drawCell(i+P.curY-1,j+P.curX-1,clr) + gc_draw(texture,30*(j+P.curX-1)-30,-30*(i+P.curY-1)) end end end end @@ -287,8 +288,8 @@ local function drawHold(P) local ENV=P.gameEnv if ENV.holdCount==0 then return end + local holdQueue=P.holdQueue local N=ENV.holdCount*72 - local texture=SKIN.curText gc_push('transform') gc_translate(-140,36) gc_setColor(0,0,0,.4)gc_rectangle('fill',0,0,124,N+8) @@ -297,21 +298,22 @@ local function drawHold(P) mText(drawableText.hold,62,-51) gc_setColor(1,1,1) - if #P.holdQueue2 and 2.2/#bk or 1 gc_scale(k) for i=1,#bk do for j=1,#bk[1]do if bk[i][j]then - gc_draw(texture[clr],30*(j-#bk[1]*.5)-30,-30*(i-#bk*.5))-- drawCell(i+1.36-#B*.5,j+2.06-#B[1]*.5,clr) + gc_draw(texture,30*(j-#bk[1]*.5)-30,-30*(i-#bk*.5)) end end end gc_scale(1/k) @@ -343,25 +345,25 @@ end local function drawFinesseCombo_norm(P) if P.finesseCombo>2 then local S=P.stat - local _=P.finesseComboTime + local t=P.finesseComboTime local str=P.finesseCombo.."x" if S.finesseRate==5*S.piece then - gc_setColor(.9,.9,.3,_*.2) + gc_setColor(.9,.9,.3,t*.2) gc_print(str,20,570) - gc_setColor(.9,.9,.3,1.2-_*.1) + gc_setColor(.9,.9,.3,1.2-t*.1) elseif S.maxFinesseCombo==S.piece then - gc_setColor(.7,.7,1,_*.2) + gc_setColor(.7,.7,1,t*.2) gc_print(str,20,570) - gc_setColor(.7,.7,1,1.2-_*.1) + gc_setColor(.7,.7,1,1.2-t*.1) else - gc_setColor(1,1,1,_*.2) + gc_setColor(1,1,1,t*.2) gc_print(str,20,570) - gc_setColor(1,1,1,1.2-_*.1) + gc_setColor(1,1,1,1.2-t*.1) end - if _>0 then + if t>0 then gc_push('transform') gc_translate(20,600) - gc_scale(1+_*.08) + gc_scale(1+t*.08) gc_print(str,0,-30) gc_pop() else @@ -399,7 +401,6 @@ local function drawLife(life) end local function drawMission(P) if not P.curMission then return end - local missionEnum=missionEnum local L=P.gameEnv.mission local cur=P.curMission @@ -456,7 +457,7 @@ function draw.drawNext_norm(P) gc_scale(k) for i=1,#bk do for j=1,#bk[1]do if bk[i][j]then - gc_draw(texture[clr],30*(j-#bk[1]*.5)-30,-30*(i-#bk*.5))-- drawCell(i-#bk*.5,j-#bk[1]*.5,clr) + gc_draw(texture[clr],30*(j-#bk[1]*.5)-30,-30*(i-#bk*.5)) end end end gc_scale(1/k) @@ -494,7 +495,7 @@ function draw.drawNext_hidden(P) gc_scale(k) for i=1,#bk do for j=1,#bk[1]do if bk[i][j]then - gc_draw(texture[clr],30*(j-#bk[1]*.5)-30,-30*(i-#bk*.5))-- drawCell(i-#bk*.5,j-#bk[1]*.5,clr) + gc_draw(texture[clr],30*(j-#bk[1]*.5)-30,-30*(i-#bk*.5)) end end end gc_scale(1/k) @@ -514,21 +515,14 @@ function draw.drawNext_hidden(P) end gc_pop() end +draw.applyFieldOffset=applyFieldOffset -function draw.applyFieldOffset(P,notNorm) - if not notNorm then gc_translate(150,0)end - local O=P.fieldOff - gc_translate(O.x,O.y) - gc_translate(150,300) - gc_rotate(O.a) - gc_translate(-150,-300) -end function draw.drawTargetLine(P,r) if r<21+(P.fieldBeneath+P.fieldUp)/30 and r>0 then gc_setLineWidth(4) gc_setColor(1,r>10 and 0 or rnd(),.5) gc_push('transform') - draw.applyFieldOffset(P) + applyFieldOffset(P) gc_line(0,600-30*r,300,600-30*r) gc_pop() end @@ -543,7 +537,7 @@ function draw.norm(P) --Field-related things gc_push('transform') - draw.applyFieldOffset(P) + applyFieldOffset(P) --Fill field gc_setColor(0,0,0,.6) @@ -585,10 +579,12 @@ function draw.norm(P) local centerX=30*(P.curX+P.cur.sc[2])-15 --Draw ghost & rotation center - if ENV.ghost then drawGhost(P,curColor)end - if ENV.center and ENV.ghost then - gc_setColor(1,1,1,trans*ENV.center) - gc_draw(IMG.spinCenter,centerX,-30*(P.ghoY+P.cur.sc[1])+15,nil,nil,nil,4,4) + if ENV.ghost then + drawGhost(P,curColor) + if ENV.center then + gc_setColor(1,1,1,trans*ENV.center) + gc_draw(IMG.spinCenter,centerX,-30*(P.ghoY+P.cur.sc[1])+15,nil,nil,nil,4,4) + end end local dy=ENV.smooth and P.ghoY~=P.curY and(P.dropDelay/ENV.drop-1)*30 or 0 @@ -697,7 +693,7 @@ function draw.norm_remote(P) --Field-related things gc_push('transform') - draw.applyFieldOffset(P) + applyFieldOffset(P) --Draw username setFont(30) @@ -816,12 +812,12 @@ function draw.norm_remote(P) --Score & Time setFont(25) - local tm=int(P.stat.time*100)*.01 + local time=int(P.stat.time*100)*.01 gc_setColor(0,0,0,.3) gc_print(P.score1,18,509) - gc_print(tm,18,539) + gc_print(time,18,539) gc_setColor(COLOR.lY)gc_print(P.score1,20,510) - gc_setColor(COLOR.N)gc_print(tm,20,540) + gc_setColor(COLOR.N)gc_print(time,20,540) drawFinesseCombo_remote(P) drawLife(P.life) @@ -894,7 +890,7 @@ function draw.demo(P) gc_translate(P.x,P.y) gc_scale(P.size) gc_push('transform') - draw.applyFieldOffset(P,true) + applyFieldOffset(P,true) --Frame gc_setColor(0,0,0,.6) @@ -920,13 +916,12 @@ function draw.demo(P) gc_pop() local blockImg=TEXTURE.miniBlock - local libColor=minoColor local skinSet=ENV.skin --Draw hold local N=1 while P.holdQueue[N]do local id=P.holdQueue[N].id - _=libColor[skinSet[id]] + _=minoColor[skinSet[id]] gc_setColor(_[1],_[2],_[3],.3) _=blockImg[id] gc_draw(_,15,40*N-10,nil,16,nil,0,_:getHeight()*.5) @@ -937,7 +932,7 @@ function draw.demo(P) N=1 while N<=ENV.nextCount and P.nextQueue[N]do local id=P.nextQueue[N].id - _=libColor[skinSet[id]] + _=minoColor[skinSet[id]] gc_setColor(_[1],_[2],_[3],.3) _=blockImg[id] gc_draw(_,285,40*N-10,nil,16,nil,_:getWidth(),_:getHeight()*.5) From 0012788eb15265b017eab4c56826cc7242b538b9 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 2 May 2021 23:13:02 +0800 Subject: [PATCH 03/45] =?UTF-8?q?=E6=9B=B4=E6=97=A9=E5=8A=A0=E8=BD=BDSHADE?= =?UTF-8?q?R=E6=A8=A1=E5=9D=97=EF=BC=8C=E9=85=8D=E5=90=88=E4=B9=8B?= =?UTF-8?q?=E5=89=8D=E4=BC=98=E5=8C=96=E7=BB=98=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.lua | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/main.lua b/main.lua index eca51bfb..fc5a418a 100644 --- a/main.lua +++ b/main.lua @@ -59,6 +59,15 @@ require"parts.list" require"parts.globalTables" require"parts.gametoolfunc" +--Load shader files from SOURCE ONLY +SHADER={} +for _,v in next,fs.getDirectoryItems("parts/shaders")do + if fs.getRealDirectory("parts/shaders/"..v)~=SAVEDIR then + local name=v:sub(1,-6) + SHADER[name]=love.graphics.newShader("parts/shaders/"..name..".glsl") + end +end + FREEROW= require"parts.freeRow" DATA= require"parts.data" @@ -204,16 +213,6 @@ LANG.init( }, } ) - ---Load shader files from SOURCE ONLY -SHADER={} -for _,v in next,fs.getDirectoryItems("parts/shaders")do - if fs.getRealDirectory("parts/shaders/"..v)~=SAVEDIR then - local name=v:sub(1,-6) - SHADER[name]=love.graphics.newShader("parts/shaders/"..name..".glsl") - end -end - --Load background files from SOURCE ONLY for _,v in next,fs.getDirectoryItems("parts/backgrounds")do if fs.getRealDirectory("parts/backgrounds/"..v)~=SAVEDIR then From 445b0167fabf6f41a5605cc3a930c4f845a3fa35 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 2 May 2021 23:55:57 +0800 Subject: [PATCH 04/45] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dtable=E6=89=A9=E5=B1=95?= =?UTF-8?q?=E6=A8=A1=E5=9D=97complete=E6=96=B9=E6=B3=95=E7=9A=84=E4=B8=80?= =?UTF-8?q?=E4=B8=AA=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/tableExtend.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Zframework/tableExtend.lua b/Zframework/tableExtend.lua index db9cca90..bcc1f7f8 100644 --- a/Zframework/tableExtend.lua +++ b/Zframework/tableExtend.lua @@ -36,7 +36,7 @@ function TABLE.copy(org) return L end ---For all things in G if same type in base, push to base +--For all things in new if same type in base, push to old function TABLE.update(new,old) for k,v in next,new do if type(v)==type(old[k])then @@ -49,13 +49,14 @@ function TABLE.update(new,old) end end ---For all things in G if no val in base, push to base +--For all things in new if no val in base, push to old function TABLE.complete(new,old) for k,v in next,new do - if old[k]==nil then - old[k]=v - elseif type(v)=='table'and type(old[k])=='table'then + if type(v)=='table'then + if old[k]==nil then old[k]={}end TABLE.complete(v,old[k]) + elseif old[k]==nil then + old[k]=v end end end From d605e5fbb8f08074a5b7bf6bc433ab5f14b98290 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Mon, 3 May 2021 01:54:12 +0800 Subject: [PATCH 05/45] =?UTF-8?q?=E5=9C=BA=E6=99=AF=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=8B=96=E6=8B=BD=E6=96=87=E4=BB=B6=E4=BA=8B?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/init.lua | 3 +++ Zframework/scene.lua | 2 ++ 2 files changed, 5 insertions(+) diff --git a/Zframework/init.lua b/Zframework/init.lua index d629e587..51a11ebb 100644 --- a/Zframework/init.lua +++ b/Zframework/init.lua @@ -326,6 +326,9 @@ end function love.sendData(data)end function love.receiveData(id,data)end ]] +function love.filedropped(file) + if SCN.fileDropped then SCN.fileDropped(file)end +end local lastGCtime=0 function love.lowmemory() if TIME()-lastGCtime>6.26 then diff --git a/Zframework/scene.lua b/Zframework/scene.lua index c1b671c0..5f66ea3e 100644 --- a/Zframework/scene.lua +++ b/Zframework/scene.lua @@ -34,6 +34,7 @@ local SCN={ keyUp=false, gamepadDown=false, gamepadUp=false, + fileDropped=false, socketRead=false, }--Scene datas, returned @@ -78,6 +79,7 @@ function SCN.init(s,org) SCN.keyUp=S.keyUp SCN.gamepadDown=S.gamepadDown SCN.gamepadUp=S.gamepadUp + SCN.fileDropped=S.fileDropped SCN.socketRead=S.socketRead if S.sceneInit then S.sceneInit(org)end end From 2627e55229a2e2c1f6b70119c09d815b7bb37bc8 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Mon, 3 May 2021 02:08:37 +0800 Subject: [PATCH 06/45] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/init.lua | 4 ++-- parts/data.lua | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Zframework/init.lua b/Zframework/init.lua index 51a11ebb..af088977 100644 --- a/Zframework/init.lua +++ b/Zframework/init.lua @@ -119,7 +119,7 @@ function love.mousepressed(x,y,k,touch) if SCN.mouseDown then SCN.mouseDown(mx,my,k)end WIDGET.press(mx,my,k) lastX,lastY=mx,my - if SETTING.clickFX then SYSFX.newTap(3,mx,my,30)end + if SETTING.clickFX then SYSFX.newTap(3,mx,my)end end function love.mousemoved(x,y,dx,dy,touch) if touch then return end @@ -189,7 +189,7 @@ function love.touchreleased(id,x,y) if SCN.touchUp then SCN.touchUp(x,y)end if(x-lastX)^2+(y-lastY)^2<62 then if SCN.touchClick then SCN.touchClick(x,y)end - if SETTING.clickFX then SYSFX.newTap(3,x,y,30)end + if SETTING.clickFX then SYSFX.newTap(3,x,y)end end end diff --git a/parts/data.lua b/parts/data.lua index 9f58e82d..d56d98a6 100644 --- a/parts/data.lua +++ b/parts/data.lua @@ -368,7 +368,7 @@ do--function DATA.saveRecording() end --Write file - local fileName="replay/"..os.date("%Y_%m_%d_%a_%H%M%S.rep") + local fileName=os.date("replay/%Y_%m_%d_%a_%H%M%S.rep") if not love.filesystem.getInfo(fileName)then local fileHead= os.date("%Y/%m/%d %A %H:%M:%S\n").. From 18b5efcc0ead09e17bf77e22aa6fce7bcc9096b5 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Mon, 3 May 2021 12:58:21 +0800 Subject: [PATCH 07/45] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=87=86=E5=A4=87?= =?UTF-8?q?=E6=A0=87=E8=AE=B0=E7=8A=B6=E6=80=81=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/net.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/parts/net.lua b/parts/net.lua index 10e2a52d..c5f7fd83 100644 --- a/parts/net.lua +++ b/parts/net.lua @@ -374,12 +374,14 @@ function NET.updateWS_play() config=d.config, }) if SCN.socketRead then SCN.socketRead('Join',d)end + NET.allReady=false end elseif res.action==3 then--Player leave if not d.uid then + NET.allReady=false NET.wsclose_stream() - SCN.back() NET.unlock('quit') + SCN.back() else for i=1,#PLY_NET do if PLY_NET[i].sid==d.sid then From d90f0f3e86e428c6a02e1a2947aec7de0fcc03b8 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Mon, 3 May 2021 13:17:36 +0800 Subject: [PATCH 08/45] =?UTF-8?q?=E6=8B=86=E5=88=86=E5=85=A8=E5=91=98?= =?UTF-8?q?=E5=87=86=E5=A4=87=E5=92=8C=E8=BF=9E=E6=8E=A5ws=E5=87=86?= =?UTF-8?q?=E5=A4=87=E5=BC=80=E5=B1=80=E7=9A=84=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/language/lang_en.lua | 1 + parts/language/lang_fr.lua | 1 + parts/language/lang_pt.lua | 1 + parts/language/lang_sp.lua | 1 + parts/language/lang_yygq.lua | 1 - parts/language/lang_zh.lua | 3 ++- parts/net.lua | 3 +++ parts/scenes/net_game.lua | 10 ++++++---- 8 files changed, 15 insertions(+), 6 deletions(-) diff --git a/parts/language/lang_en.lua b/parts/language/lang_en.lua index ee20a478..9d14c1d3 100644 --- a/parts/language/lang_en.lua +++ b/parts/language/lang_en.lua @@ -101,6 +101,7 @@ return{ joinRoom="has joined the room.", leaveRoom="has left the room.", ready="READY", + set="SET", champion="$1 won", chatRemain="Online: ", chatStart="------Beginning of log------", diff --git a/parts/language/lang_fr.lua b/parts/language/lang_fr.lua index 63b7ece4..77dcc603 100644 --- a/parts/language/lang_fr.lua +++ b/parts/language/lang_fr.lua @@ -102,6 +102,7 @@ return{ joinRoom="a rejoint le salon.", leaveRoom="a quitté le salon.", -- ready="READY", + -- set="SET", champion="$1 a gagné", chatRemain="En ligne : ", chatStart="--------Début des logs--------", diff --git a/parts/language/lang_pt.lua b/parts/language/lang_pt.lua index 583da9b8..0eefd685 100644 --- a/parts/language/lang_pt.lua +++ b/parts/language/lang_pt.lua @@ -102,6 +102,7 @@ return{ joinRoom="Entrou a sala.", leaveRoom="Saiu da sala.", -- ready="READY", + -- set="SET", -- champion="$1 won", chatRemain="Online: ", chatStart="------Começo do log------", diff --git a/parts/language/lang_sp.lua b/parts/language/lang_sp.lua index 41f60507..b09773f0 100644 --- a/parts/language/lang_sp.lua +++ b/parts/language/lang_sp.lua @@ -102,6 +102,7 @@ return{ joinRoom="entró a la sala.", leaveRoom="salió de la sala.", -- ready="READY", + -- set="SET", champion="$1 ganó!", chatRemain="Usuarios en línea: ", chatStart="------Comienzo del historial------", diff --git a/parts/language/lang_yygq.lua b/parts/language/lang_yygq.lua index c1e4dfc5..4f4f7281 100644 --- a/parts/language/lang_yygq.lua +++ b/parts/language/lang_yygq.lua @@ -46,7 +46,6 @@ return{ createRoomTooFast="手痒要开这么多房间?", createRoomSuccessed="创好了", started="开了", - ready="预备!", champion="神仙是 $1", stat={ diff --git a/parts/language/lang_zh.lua b/parts/language/lang_zh.lua index 3d78166f..4d0d1b5f 100644 --- a/parts/language/lang_zh.lua +++ b/parts/language/lang_zh.lua @@ -100,7 +100,8 @@ return{ started="游戏中", joinRoom="进入房间", leaveRoom="离开房间", - ready="准备!", + ready="各就各位!", + set="预备!", champion="$1 获胜", chatRemain="人数:", chatStart="------消息的开头------", diff --git a/parts/net.lua b/parts/net.lua index c5f7fd83..6e01aa4c 100644 --- a/parts/net.lua +++ b/parts/net.lua @@ -6,6 +6,7 @@ local NET={ allow_online=false, allReady=false, serverGaming=false, + connectingStream=false, roomList={}, accessToken=false, rid=false, @@ -441,6 +442,7 @@ function NET.updateWS_play() NET.allReady=true elseif res.action==8 then--Set NET.rsid=d.rid + NET.connectingStream=true NET.wsconn_stream() elseif res.action==9 then--Game finished NET.allReady=false @@ -474,6 +476,7 @@ function NET.updateWS_stream() if res.type=='Connect'then NET.unlock('wsc_stream') elseif res.action==0 then--Game start + NET.connectingStream=false SCN.socketRead('Go',d) elseif res.action==1 then--Game finished --? diff --git a/parts/scenes/net_game.lua b/parts/scenes/net_game.lua index c9b6e1f1..3f43d691 100644 --- a/parts/scenes/net_game.lua +++ b/parts/scenes/net_game.lua @@ -268,10 +268,12 @@ function scene.draw() gc.print(p.username,240,60+50*i) end - --All-ready mark - if NET.allReady then - gc.setColor(.1,1,0,.9) - setFont(60) + --Ready & Set mark + gc.setColor(.1,1,0,.9) + setFont(60) + if NET.connectingStream then + mStr(text.set,640,10) + elseif NET.allReady then mStr(text.ready,640,10) end From 1038e75a6493730c101fd6f75cbc7037a63f2607 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Mon, 3 May 2021 13:23:13 +0800 Subject: [PATCH 09/45] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dtextbox=E6=8E=A7?= =?UTF-8?q?=E4=BB=B6clear=E5=90=8E=E5=BF=98=E4=BA=86=E9=87=8D=E7=BD=AEnew?= =?UTF-8?q?=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/widget.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/Zframework/widget.lua b/Zframework/widget.lua index 8734d4be..ae71b52e 100644 --- a/Zframework/widget.lua +++ b/Zframework/widget.lua @@ -741,6 +741,7 @@ function inputBox:reset() end function inputBox:clear() self.value="" + self.new=false end function inputBox:isAbove(x,y) return From 42f3cd8e313654e24d6819c5a823ff853192b353 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Tue, 4 May 2021 02:07:12 +0800 Subject: [PATCH 10/45] =?UTF-8?q?=E5=9C=BA=E6=99=AF=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E6=94=AF=E6=8C=81=E7=AA=97=E5=8F=A3resize=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/init.lua | 1 + Zframework/scene.lua | 2 ++ 2 files changed, 3 insertions(+) diff --git a/Zframework/init.lua b/Zframework/init.lua index af088977..525e4ce0 100644 --- a/Zframework/init.lua +++ b/Zframework/init.lua @@ -340,6 +340,7 @@ end function love.resize(w,h) SCR.resize(w,h) if BG.resize then BG.resize(w,h)end + if SCN.resize then SCN.resize(w,h)end SHADER.warning:send("w",w*SCR.dpi) SHADER.warning:send("h",h*SCR.dpi) diff --git a/Zframework/scene.lua b/Zframework/scene.lua index 5f66ea3e..360123fa 100644 --- a/Zframework/scene.lua +++ b/Zframework/scene.lua @@ -35,6 +35,7 @@ local SCN={ gamepadDown=false, gamepadUp=false, fileDropped=false, + resize=false, socketRead=false, }--Scene datas, returned @@ -80,6 +81,7 @@ function SCN.init(s,org) SCN.gamepadDown=S.gamepadDown SCN.gamepadUp=S.gamepadUp SCN.fileDropped=S.fileDropped + SCN.resize=S.resize SCN.socketRead=S.socketRead if S.sceneInit then S.sceneInit(org)end end From a21e7a5e8d1f0508331e451d77be01aafefaa632 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Tue, 4 May 2021 02:16:43 +0800 Subject: [PATCH 11/45] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/log.lua | 2 +- parts/gametoolfunc.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Zframework/log.lua b/Zframework/log.lua index 5cee9182..1dc40fe6 100644 --- a/Zframework/log.lua +++ b/Zframework/log.lua @@ -35,7 +35,7 @@ function LOG.draw() end end end -function LOG.print(text,T,C)--text,type/time,color +function LOG.print(text,T,C)--text,type/time/color,color local time local his if T=='warn'then diff --git a/parts/gametoolfunc.lua b/parts/gametoolfunc.lua index c5c1a413..de15ecee 100644 --- a/parts/gametoolfunc.lua +++ b/parts/gametoolfunc.lua @@ -1,4 +1,5 @@ local gc=love.graphics +local rem=table.remove @@ -164,7 +165,6 @@ function scoreValid()--Check if any unranked mods are activated return true end function destroyPlayers()--Destroy all player objects, restore freerows and free CCs - local rem=table.remove for i=#PLAYERS,1,-1 do local P=PLAYERS[i] if P.canvas then P.canvas:release()end From 9836bda5028526cb3cf2e22ceacb79879e53e3fd Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Tue, 4 May 2021 02:21:52 +0800 Subject: [PATCH 12/45] =?UTF-8?q?=E6=88=BF=E9=97=B4=E5=86=85=E7=8E=A9?= =?UTF-8?q?=E5=AE=B6=E5=AF=B9=E8=B1=A1=E7=AE=A1=E7=90=86=E5=8D=95=E7=8B=AC?= =?UTF-8?q?=E5=81=9A=E8=BF=9B=E6=96=B0=E6=A8=A1=E5=9D=97netPlayer=EF=BC=8C?= =?UTF-8?q?=E4=B8=BA=E6=9C=AA=E6=9D=A5=E6=B6=88=E6=81=AF=E6=B0=94=E6=B3=A1?= =?UTF-8?q?=E5=92=8C=E5=8F=91=E8=A1=A8=E6=83=85=E5=81=9A=E5=87=86=E5=A4=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.lua | 1 + parts/globalTables.lua | 1 - parts/modes/netBattle.lua | 11 +-- parts/net.lua | 51 +++--------- parts/netPlayer.lua | 158 ++++++++++++++++++++++++++++++++++++++ parts/player/init.lua | 12 +-- parts/scenes/net_game.lua | 88 ++++++++------------- 7 files changed, 211 insertions(+), 111 deletions(-) create mode 100644 parts/netPlayer.lua diff --git a/main.lua b/main.lua index fc5a418a..d72e43a5 100644 --- a/main.lua +++ b/main.lua @@ -77,6 +77,7 @@ USERS= require"parts.users" NET= require"parts.net" VK= require"parts.virtualKey" PLY= require"parts.player" +netPLY= require"parts.netPlayer" AIFUNC= require"parts.ai" AIBUILDER= require"parts.AITemplate" MODES= require"parts.modes" diff --git a/parts/globalTables.lua b/parts/globalTables.lua index b8b67020..a0268579 100644 --- a/parts/globalTables.lua +++ b/parts/globalTables.lua @@ -144,7 +144,6 @@ end --Game tables PLAYERS={}--Players data PLY_ALIVE={} -PLY_NET={} FIELD={}--Field(s) for custom game BAG={}--Sequence for custom game MISSION={}--Clearing mission for custom game diff --git a/parts/modes/netBattle.lua b/parts/modes/netBattle.lua index 8f292f10..022d1976 100644 --- a/parts/modes/netBattle.lua +++ b/parts/modes/netBattle.lua @@ -10,14 +10,9 @@ return{ }, load=function() PLY.newPlayer(1) - local N=2 - for i=1,#PLY_NET do - if PLY_NET[i].uid==USER.uid then - PLAYERS[1].sid=PLY_NET[1].sid - else - PLY.newRemotePlayer(N,false,PLY_NET[i]) - N=N+1 - end + PLAYERS[1].sid=netPLY.getSID(1) + for i=2,netPLY.getCount()do + PLY.newRemotePlayer(i,false,netPLY.getUID(i)) end end, } \ No newline at end of file diff --git a/parts/net.lua b/parts/net.lua index 6e01aa4c..4f8ed041 100644 --- a/parts/net.lua +++ b/parts/net.lua @@ -1,6 +1,7 @@ local data=love.data -local ins,rem=table.insert,table.remove +local rem=table.remove local WS,TIME=WS,TIME + local NET={ connected=false, allow_online=false, @@ -352,28 +353,28 @@ function NET.updateWS_play() elseif res.action==2 then--Player join if res.type=='Self'then --Enter new room - TABLE.cut(PLY_NET) + netPLY.clear() if d.players then for _,p in next,d.players do - ins(PLY_NET,p.uid==USER.uid and 1 or #PLY_NET+1,{ + netPLY.add{ uid=p.uid, username=p.username, sid=p.sid, ready=p.ready, config=p.config, - }) + } end end loadGame('netBattle',true,true) else --Load other players - ins(PLY_NET,{ + netPLY.add{ uid=d.uid, username=d.username, sid=d.sid, ready=d.ready, config=d.config, - }) + } if SCN.socketRead then SCN.socketRead('Join',d)end NET.allReady=false end @@ -384,12 +385,7 @@ function NET.updateWS_play() NET.unlock('quit') SCN.back() else - for i=1,#PLY_NET do - if PLY_NET[i].sid==d.sid then - rem(PLY_NET,i) - break - end - end + netPLY.remove(d.sid) for i=1,#PLAYERS do if PLAYERS[i].sid==d.sid then rem(PLAYERS,i) @@ -407,36 +403,9 @@ function NET.updateWS_play() elseif res.action==4 then--Player talk if SCN.socketRead then SCN.socketRead('Talk',d)end elseif res.action==5 then--Player change settings - if tostring(USER.uid)~=d.uid then - for i=1,#PLY_NET do - if PLY_NET[i].uid==d.uid then - PLY_NET[i].config=d.config - break - end - end - end + netPLY.setConf(d.uid,d.config) elseif res.action==6 then--One ready - for i,p in next,PLY_NET do - if p.uid==d.uid then - if p.ready~=d.ready then - p.ready=d.ready - if not d.ready then NET.allReady=false end - SFX.play('spin_0',.6) - if i==1 then - NET.unlock('ready') - elseif not PLY_NET[1].ready then - for j=2,#PLY_NET do - if not PLY_NET[j].ready then - goto BREAK_notAllReady - end - end - SFX.play('blip_2',.5) - ::BREAK_notAllReady:: - end - end - break - end - end + netPLY.setReady(d.uid,d.ready) elseif res.action==7 then--All Ready SFX.play('reach',.6) NET.allReady=true diff --git a/parts/netPlayer.lua b/parts/netPlayer.lua new file mode 100644 index 00000000..b43738cd --- /dev/null +++ b/parts/netPlayer.lua @@ -0,0 +1,158 @@ +local gc=love.graphics +local ins,rem=table.insert,table.remove + +local posLists={ + --1~5 + (function() + local L={} + for i=1,5 do + L[i]={x=40,y=65+50*i,w=1000,h=46} + end + return L + end)(), + --6~17 + (function() + local L={} + for i=1,17 do + L[i]={x=40,y=65+50*i,w=1000,h=46} + end + return L + end)(), + --18~31 + (function() + local L={} + for i=1,31 do + L[i]={x=40,y=65+50*i,w=1000,h=46} + end + return L + end)(), + --32~49 + (function() + local L={} + for i=1,49 do + L[i]={x=40,y=65+50*i,w=1000,h=46} + end + return L + end)(), +} +local posList + +local PLY=setmetatable({},{ + __index=function(self,uid) + for _,p in next,self do + if p.uid==uid then + return p + end + end + end +}) + +local netPLY={list=PLY} + +local function freshPosList() + if #PLY<=5 then + posList=posLists[1] + elseif #PLY<=15 then + posList=posLists[2] + elseif #PLY<=30 then + posList=posLists[3] + end +end + +function netPLY.clear() + while PLY[1]do rem(PLY)end +end +function netPLY.add(p) + ins(PLY,p.uid==USER.uid and 1 or #PLY+1,p) + p.x,p.y,p.w,p.h=640,2600,0,0 + freshPosList() +end +function netPLY.remove(sid) + for i=1,#PLY do + if PLY[i].sid==sid then + rem(PLY,i) + break + end + end + freshPosList() +end + +function netPLY.getCount()return #PLY end +function netPLY.getUID(i)return PLY[i].uid end +function netPLY.getUsername(uid)return PLY[uid].username end +function netPLY.getSID(i)return PLY[i].sid end +function netPLY.getReady(i)return PLY[i].ready end +function netPLY.getConfig(i)return PLY[i].config end + +function netPLY.setPlayerObj(uid,p) + PLY[uid].p=p +end +function netPLY.setConf(uid,config) + if tostring(USER.uid)~=uid then + PLY[uid].config=config + end +end +function netPLY.setReady(uid,ready) + for i,p in next,PLY do + if p.uid==uid then + if p.ready~=ready then + p.ready=ready + if not ready then NET.allReady=false end + SFX.play('spin_0',.6) + if i==1 then + NET.unlock('ready') + elseif not PLY[1].ready then + for j=2,#PLY do + if not PLY[j].ready then + return + end + end + SFX.play('blip_2',.5) + end + end + return + end + end +end +function netPLY.resetReady() + for i=1,#PLY do + PLY[i].ready=false + end +end + +function netPLY.update(dt) + for i=1,#PLY do + local p=PLY[i] + local t=posList[i] + p.x=p.x*.9+t.x*.1 + p.y=p.y*.9+t.y*.1 + p.w=p.w*.9+t.w*.1 + p.h=p.h*.9+t.h*.1 + end +end + +function netPLY.draw() + for i=1,#PLY do + local p=PLY[i] + gc.translate(p.x,p.y) + --Rectangle + gc.setColor(COLOR[p.ready and'G'or'Z']) + gc.setLineWidth(2) + gc.rectangle('line',0,0,p.w,p.h) + + --UID + setFont(40) + gc.setColor(.5,.5,.5) + gc.print("#"..p.uid,10,-5) + + --Avatar + gc.setColor(1,1,1) + gc.draw(USERS.getAvatar(p.uid),160,3,nil,.3125) + + --Username + gc.print(p.username,210,-5) + gc.translate(-p.x,-p.y) + end +end + +return netPLY \ No newline at end of file diff --git a/parts/player/init.lua b/parts/player/init.lua index 789b7271..f9205c04 100644 --- a/parts/player/init.lua +++ b/parts/player/init.lua @@ -372,7 +372,7 @@ function PLY.newDemoPlayer(id) } P:popNext() end -function PLY.newRemotePlayer(id,mini,data) +function PLY.newRemotePlayer(id,mini,uid) local P=newEmptyPlayer(id,mini) P.type='remote' P.update=PLY.update.remote_alive @@ -382,11 +382,11 @@ function PLY.newRemotePlayer(id,mini,data) P.stream={} P.streamProgress=1 - data.p=P - P.uid=data.uid - P.username=data.username - P.sid=data.sid - loadRemoteEnv(P,data.config) + netPLY.setPlayerObj(uid,P) + P.uid=uid + P.username=netPLY.getUsername(uid) + P.sid=netPLY.getSID(uid) + loadRemoteEnv(P,netPLY.getConfig(uid)) applyGameEnv(P) end diff --git a/parts/scenes/net_game.lua b/parts/scenes/net_game.lua index 3f43d691..18262631 100644 --- a/parts/scenes/net_game.lua +++ b/parts/scenes/net_game.lua @@ -1,7 +1,7 @@ local gc,tc=love.graphics,love.touch local ins=table.insert -local SCR,VK,NET=SCR,VK,NET -local PLAYERS,PLY_NET,GAME=PLAYERS,PLY_NET,GAME +local SCR,VK,NET,netPLY=SCR,VK,NET,netPLY +local PLAYERS,GAME=PLAYERS,GAME local textBox=WIDGET.newTextBox{name="texts",x=340,y=80,w=600,h=550,hide=false} @@ -93,9 +93,9 @@ function scene.keyDown(key) end else if key=="space"then - NET.signal_ready(not PLY_NET[1].ready) + NET.signal_ready(not netPLY.getReady(1)) elseif key=="s"then - if not(PLY_NET[1].ready or NET.getlock('ready'))then + if not(netPLY.getReady(1)or NET.getlock('ready'))then SCN.go('setting_game') end end @@ -159,9 +159,7 @@ function scene.socketRead(cmd,d) elseif cmd=="Go"then if not playing then playing=true - for i=1,#PLY_NET do - PLY_NET[i].ready=false - end + netPLY.resetReady() lastUpstreamTime=0 upstreamProgress=1 resetGameData('n',d.seed) @@ -177,12 +175,8 @@ function scene.socketRead(cmd,d) break end end - if not winnerUID then return end - for _,p in next,PLY_NET do - if p.uid==winnerUID then - TEXT.show(text.champion:gsub("$1",p.username),640,260,80,'zoomout',.26) - break - end + if winnerUID then + TEXT.show(text.champion:gsub("$1",netPLY.getUsername(winnerUID)),640,260,80,'zoomout',.26) end elseif cmd=="Stream"then if d.uid~=USER.uid and playing then @@ -205,30 +199,32 @@ function scene.update(dt) NET.wsclose_stream() SCN.back() end - if not playing then return end + if playing then + local P1=PLAYERS[1] - local P1=PLAYERS[1] + touchMoveLastFrame=false + VK.update() - touchMoveLastFrame=false - VK.update() + --Update players + for p=1,#PLAYERS do PLAYERS[p]:update(dt)end - --Update players - for p=1,#PLAYERS do PLAYERS[p]:update(dt)end + --Warning check + checkWarning() - --Warning check - checkWarning() - - --Upload stream - if P1.frameRun-lastUpstreamTime>8 then - local stream - stream,upstreamProgress=DATA.dumpRecording(GAME.rep,upstreamProgress) - if #stream>0 then - NET.uploadRecStream(stream) - else - ins(GAME.rep,P1.frameRun) - ins(GAME.rep,0) + --Upload stream + if P1.frameRun-lastUpstreamTime>8 then + local stream + stream,upstreamProgress=DATA.dumpRecording(GAME.rep,upstreamProgress) + if #stream>0 then + NET.uploadRecStream(stream) + else + ins(GAME.rep,P1.frameRun) + ins(GAME.rep,0) + end + lastUpstreamTime=PLAYERS[1].alive and P1.frameRun or 1e99 end - lastUpstreamTime=PLAYERS[1].alive and P1.frameRun or 1e99 + else + netPLY.update(dt) end end @@ -247,26 +243,8 @@ function scene.draw() --Warning drawWarning() else - for i=1,#PLY_NET do - local p=PLY_NET[i] - - --Rectangle - gc.setColor(COLOR[p.ready and'G'or'Z']) - gc.setLineWidth(2) - gc.rectangle('line',40,65+50*i,1000,46) - - --UID - setFont(40) - gc.setColor(.5,.5,.5) - gc.print("#"..p.uid,50,60+50*i) - - --Avatar - gc.setColor(1,1,1) - gc.draw(USERS.getAvatar(p.uid),200,68+50*i,nil,.3125) - - --Username - gc.print(p.username,240,60+50*i) - end + --Users + netPLY.draw() --Ready & Set mark gc.setColor(.1,1,0,.9) @@ -290,13 +268,13 @@ function scene.draw() end scene.widgetList={ textBox, - WIDGET.newKey{name="setting",fText=TEXTURE.setting,x=1200,y=160,w=90,h=90,code=pressKey"s",hide=function()return playing or PLY_NET[1].ready or NET.getlock('ready')end}, + WIDGET.newKey{name="setting",fText=TEXTURE.setting,x=1200,y=160,w=90,h=90,code=pressKey"s",hide=function()return playing or netPLY.getReady(1)or NET.getlock('ready')end}, WIDGET.newKey{name="ready",x=900,y=560,w=400,h=100,color='lB',font=40,code=pressKey"space", hide=function() return playing or NET.serverGaming or - PLY_NET[1].ready or + netPLY.getReady(1)or NET.getlock('ready') end}, WIDGET.newKey{name="cancel",x=900,y=560,w=400,h=100,color='H',font=40,code=pressKey"space", @@ -304,7 +282,7 @@ scene.widgetList={ return playing or NET.serverGaming or - not PLY_NET[1].ready or + not netPLY.getReady(1)or NET.getlock('ready') end}, WIDGET.newKey{name="hideChat",fText="...",x=380,y=35,w=60,font=35,code=pressKey"\\"}, From 175d9bd7d7fd6ff8e35ab049c49cef169e03e75e Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Tue, 4 May 2021 16:19:34 +0800 Subject: [PATCH 13/45] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=BA=9Btip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/language/lang_zh.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/parts/language/lang_zh.lua b/parts/language/lang_zh.lua index 4d0d1b5f..eadd62d4 100644 --- a/parts/language/lang_zh.lua +++ b/parts/language/lang_zh.lua @@ -768,7 +768,10 @@ return{ "(a+b)³=a³+3a²b+3ab²+b³", "(RUR'U')R'FR2U'R'U'(RUR'F')", "《多练的力量》", + "《教育的力量》", + "《梦想的意义》", "《天赋的力量》", + "《游戏的意义》", "《知识的力量》", "\"TechminOS\"", "↑↑↓↓←→←→BA", @@ -791,6 +794,7 @@ return{ "6next 1hold!", "6next 6hold?!", "7宽三SZ架空捐了解一下", + "9999in1", "按钮风格进化史", "把手机调到特殊的日期也许会发生什么", "报时机器人:新的一天开始了", @@ -837,11 +841,10 @@ return{ "方块默认出现的方向都是重心在下哦", "方块能吃吗", "服务器随时爆炸", - "开启省流模式后将不会加载用户头像(应该能省不少流吧)", "感觉自己明明按键了但是没反应?你真的按到了吗?", "感觉自己速度到上限了?试着把das调低一点", "感谢群友帮忙想tip", - "感谢Orzmic为这个tip显示框提供灵感", + "感谢Orzmic为这个tip显示框提出意见", "刚接触方块的话多玩玩就行,40行两分钟以外没啥好针对性练习的", "刚开始练全隐形可以尽量堆平,留一列消四", "隔断消除即将到来!", @@ -865,6 +868,7 @@ return{ "健康小贴士:玩游戏多眨眼,不然会干眼病", "键位是可以自定义的", "觉得移动速度太慢或太快,手感不好?快去设置调整DAS/ARR", + "开启省流模式后将不会加载用户头像(应该能省不少流吧)", "快去打一把100%极简看看会怎样", "来学编程,好玩的", "六连块总共有…?那不重要,不会做的", @@ -903,6 +907,7 @@ return{ "去玩别的方块的时候记得没有Ospin!", "全球应该没人能全S评价(大爆炸不算)", "群友翻译的中文方块百科全书! tetris.huijiwiki.com", + "让他三尺又何妨", "如果打开简洁模式那这个菜单就没有彩蛋了", "三连块只有2种", "三岁通关困难马拉松", @@ -916,6 +921,7 @@ return{ "虽然极简连击和极简率计算看着很怪,但以后你会发现还挺科学!", "提前旋转等功能可以用来救命", "天哪,我竟然是一条凑数tip", + "退一步海阔天空", "挖掘能力在对战里非常非常非常重要!!!!", "玩到一半弹出消息框?快去设置禁止弹窗", "玩得开心的话游戏作者也会很开心哦", @@ -1061,7 +1067,6 @@ return{ {C.lC,"26连T2来一个?"}, {C.lC,"Xspin",C.Z,"是啥"}, {C.lH,"腱鞘炎警告"}, - {C.lH,"看起来是个计算器,其实…"}, {C.lH,"没学过编曲,音乐都是自己瞎写的,觉得不好听就去设置关了吧"}, {C.lH,"秘密数字:626"}, {C.lH,"你有一个好"}, From f68aa26278c0a1fd7bf217a78683ad8d016e3269 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Tue, 4 May 2021 17:37:22 +0800 Subject: [PATCH 14/45] =?UTF-8?q?=E6=88=BF=E9=97=B4=E5=86=85=E7=8E=A9?= =?UTF-8?q?=E5=AE=B6=E5=B8=83=E5=B1=80=E5=9F=BA=E6=9C=AC=E5=AE=8C=E6=88=90?= =?UTF-8?q?=EF=BC=8C=E6=B7=BB=E5=8A=A0=E9=BC=A0=E6=A0=87=E6=82=AC=E6=B5=AE?= =?UTF-8?q?=E6=98=BE=E7=A4=BA=E8=AF=A6=E7=BB=86=E4=BF=A1=E6=81=AF=E6=A1=86?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/netPlayer.lua | 119 +++++++++++++++++++++++++++++-------- parts/scenes/net_game.lua | 9 ++- parts/scenes/net_rooms.lua | 2 +- 3 files changed, 101 insertions(+), 29 deletions(-) diff --git a/parts/netPlayer.lua b/parts/netPlayer.lua index b43738cd..feb7d316 100644 --- a/parts/netPlayer.lua +++ b/parts/netPlayer.lua @@ -1,4 +1,6 @@ local gc=love.graphics +local max,min=math.max,math.min + local ins,rem=table.insert,table.remove local posLists={ @@ -6,32 +8,52 @@ local posLists={ (function() local L={} for i=1,5 do - L[i]={x=40,y=65+50*i,w=1000,h=46} + L[i]={x=70,y=20+90*i,w=1000,h=80} end return L end)(), --6~17 (function() local L={} - for i=1,17 do - L[i]={x=40,y=65+50*i,w=1000,h=46} + for i=1,10 do + L[i]={x=40,y=60+55*i,w=520,h=50} + end + for i=1,7 do + L[10+i]={x=600,y=60+55*i,w=520,h=50} end return L end)(), --18~31 (function() local L={} - for i=1,31 do - L[i]={x=40,y=65+50*i,w=1000,h=46} - end + for i=1,11 do L[i]= {x=40,y=65+50*i,w=330,h=45}end + for i=1,11 do L[11+i]= {x=400,y=65+50*i,w=330,h=45}end + for i=1,9 do L[22+i]= {x=760,y=65+50*i,w=330,h=45}end return L end)(), --32~49 (function() local L={} - for i=1,49 do - L[i]={x=40,y=65+50*i,w=1000,h=46} - end + for i=1,10 do L[i]= {x=30,y=60+50*i,w=200,h=45}end + for i=1,10 do L[10+i]= {x=240,y=60+50*i,w=200,h=45}end + for i=1,10 do L[20+i]= {x=450,y=60+50*i,w=200,h=45}end + for i=1,10 do L[30+i]= {x=660,y=60+50*i,w=200,h=45}end + for i=1,9 do L[40+i]= {x=870,y=60+50*i,w=200,h=45}end + return L + end)(), + --50~99 + (function() + local L={} + for i=1,11 do L[i]= {x=30,y=60+50*i,w=100,h=45}end + for i=1,11 do L[i+11]= {x=135,y=60+50*i,w=100,h=45}end + for i=1,11 do L[i+22]= {x=240,y=60+50*i,w=100,h=45}end + for i=1,11 do L[i+33]= {x=345,y=60+50*i,w=100,h=45}end + for i=1,11 do L[i+44]= {x=450,y=60+50*i,w=100,h=45}end + for i=1,11 do L[i+55]= {x=555,y=60+50*i,w=100,h=45}end + for i=1,11 do L[i+66]= {x=660,y=60+50*i,w=100,h=45}end + for i=1,11 do L[i+77]= {x=765,y=60+50*i,w=100,h=45}end + for i=1,7 do L[i+88]= {x=870,y=60+50*i,w=100,h=45}end + for i=1,4 do L[i+95]= {x=975,y=60+50*i,w=100,h=45}end return L end)(), } @@ -52,10 +74,14 @@ local netPLY={list=PLY} local function freshPosList() if #PLY<=5 then posList=posLists[1] - elseif #PLY<=15 then + elseif #PLY<=17 then posList=posLists[2] - elseif #PLY<=30 then + elseif #PLY<=31 then posList=posLists[3] + elseif #PLY<=49 then + posList=posLists[4] + else--if #PLY<=99 then + posList=posLists[5] end end @@ -64,7 +90,7 @@ function netPLY.clear() end function netPLY.add(p) ins(PLY,p.uid==USER.uid and 1 or #PLY+1,p) - p.x,p.y,p.w,p.h=640,2600,0,0 + p.x,p.y,p.w,p.h=2600,2600,0,0 freshPosList() end function netPLY.remove(sid) @@ -120,6 +146,19 @@ function netPLY.resetReady() end end +local selP,mouseX,mouseY +function netPLY.mouseMove(x,y) + selP=nil + for i=1,#PLY do + local p=PLY[i] + if x>p.x and y>p.y and x=47 then + setFont(40) + gc.print("#"..p.uid,50,-5) + gc.print(p.username,210,-5) + else + setFont(159) + gc.print("#"..p.uid,p.h,-2) + setFont(30) + gc.print(p.username,p.h,8) + end + gc.setStencilTest() gc.translate(-p.x,-p.y) end + if selP then + gc.translate(min(mouseX,880),min(mouseY,460)) + gc.setColor(.2,.2,.2,.7) + gc.rectangle('fill',0,0,400,260) + gc.setColor(1,1,1) + gc.setLineWidth(2) + gc.rectangle('line',0,0,400,260) + + gc.draw(USERS.getAvatar(selP.uid),5,5,nil,.5) + setFont(30) + gc.print("#"..selP.uid,75,0) + setFont(35) + gc.print(selP.username,75,25) + gc.translate(-min(mouseX,880),-min(mouseY,460)) + end end return netPLY \ No newline at end of file diff --git a/parts/scenes/net_game.lua b/parts/scenes/net_game.lua index 18262631..b7978e9f 100644 --- a/parts/scenes/net_game.lua +++ b/parts/scenes/net_game.lua @@ -33,6 +33,7 @@ function scene.sceneInit(org) end scene.mouseDown=NULL +function scene.mouseMove(x,y)netPLY.mouseMove(x,y)end function scene.touchDown(x,y) if noTouch or not playing then return end @@ -51,8 +52,9 @@ function scene.touchUp(x,y) VK.release(n) end end -function scene.touchMove() - if noTouch or touchMoveLastFrame or not playing then return end +function scene.touchMove(x,y) + if not playing then netPLY.mouseMove(x,y)return end + if noTouch or touchMoveLastFrame then return end touchMoveLastFrame=true local L=tc.getTouches() @@ -160,6 +162,7 @@ function scene.socketRead(cmd,d) if not playing then playing=true netPLY.resetReady() + netPLY.mouseMove(0,0) lastUpstreamTime=0 upstreamProgress=1 resetGameData('n',d.seed) @@ -269,7 +272,7 @@ end scene.widgetList={ textBox, WIDGET.newKey{name="setting",fText=TEXTURE.setting,x=1200,y=160,w=90,h=90,code=pressKey"s",hide=function()return playing or netPLY.getReady(1)or NET.getlock('ready')end}, - WIDGET.newKey{name="ready",x=900,y=560,w=400,h=100,color='lB',font=40,code=pressKey"space", + WIDGET.newKey{name="ready",x=1060,y=630,w=300,h=80,color='lB',font=40,code=pressKey"space", hide=function() return playing or diff --git a/parts/scenes/net_rooms.lua b/parts/scenes/net_rooms.lua index 87ba410b..4f2c48c3 100644 --- a/parts/scenes/net_rooms.lua +++ b/parts/scenes/net_rooms.lua @@ -139,7 +139,7 @@ function scene.draw() end if R.start then gc.setColor(0,1,0) - gc.print(text.started,620,66+40*i) + gc.print(text.started,660,66+40*i) end gc.setColor(.9,.9,1) gc.print(pos+i,95,66+40*i) From 1c342d0327dc884b1fcb9c0b0fd1e852db8b1a55 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Tue, 4 May 2021 18:01:25 +0800 Subject: [PATCH 15/45] =?UTF-8?q?=E6=88=BF=E9=97=B4=E5=86=85=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=88=BF=E9=97=B4=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/net.lua | 40 +++++++++++++++++++++++++------------- parts/scenes/net_game.lua | 8 ++++++++ parts/scenes/net_menu.lua | 2 +- parts/scenes/net_rooms.lua | 2 +- 4 files changed, 37 insertions(+), 15 deletions(-) diff --git a/parts/net.lua b/parts/net.lua index 4f8ed041..de4943ad 100644 --- a/parts/net.lua +++ b/parts/net.lua @@ -5,13 +5,20 @@ local WS,TIME=WS,TIME local NET={ connected=false, allow_online=false, - allReady=false, - serverGaming=false, - connectingStream=false, - roomList={}, accessToken=false, - rid=false, - rsid=false, + roomList={}, + roomInfo={ + -- rid=false, + name=false, + -- type=false, + private=false, + -- count=false, + capacity=false, + }, + allReady=false, + streamRoomID=false, + connectingStream=false, + serverGaming=false, } local mesType={ @@ -109,7 +116,7 @@ function NET.wsconn_stream() WS.connect('stream','/stream',JSON.encode{ uid=USER.uid, accessToken=NET.accessToken, - rid=NET.rsid, + rid=NET.streamRoomID, }) TASK.new(NET.updateWS_stream) end @@ -169,27 +176,34 @@ function NET.fetchRoom() }) end end -function NET.createRoom(roomType,name) +function NET.createRoom(roomType,roomName) if NET.lock('enterRoom',1.26)then + NET.roomInfo.name=roomName or"?" + NET.roomInfo.type=roomType or"?" + NET.roomInfo.private=false + NET.roomInfo.capacity="?" WS.send('play',JSON.encode{ action=1, data={ type=roomType, - name=name, + name=roomName, password=nil, config=dumpBasicConfig(), } }) end end -function NET.enterRoom(roomID,password) +function NET.enterRoom(room,password) if NET.lock('enterRoom',1.26)then SFX.play('reach',.6) - NET.rid=roomID + NET.roomInfo.name=room.name or"?" + NET.roomInfo.type=room.type or"?" + NET.roomInfo.private=not not password + NET.roomInfo.capacity=room.capacity or"?" WS.send('play',JSON.encode{ action=2, data={ - rid=roomID, + rid=room.rid, config=dumpBasicConfig(), password=password, } @@ -410,7 +424,7 @@ function NET.updateWS_play() SFX.play('reach',.6) NET.allReady=true elseif res.action==8 then--Set - NET.rsid=d.rid + NET.streamRoomID=d.rid NET.connectingStream=true NET.wsconn_stream() elseif res.action==9 then--Game finished diff --git a/parts/scenes/net_game.lua b/parts/scenes/net_game.lua index b7978e9f..62c6cb58 100644 --- a/parts/scenes/net_game.lua +++ b/parts/scenes/net_game.lua @@ -258,6 +258,14 @@ function scene.draw() mStr(text.ready,640,10) end + --Room info. + gc.setColor(1,1,1) + setFont(25) + mStr(NET.roomInfo.name,640,685) + setFont(40) + gc.print(netPLY.getCount().."/"..NET.roomInfo.capacity,70,655) + if NET.roomInfo.private then gc.draw(IMG.lock,30,668)end + --Profile drawSelfProfile() end diff --git a/parts/scenes/net_menu.lua b/parts/scenes/net_menu.lua index 923d9550..a0b7cc24 100644 --- a/parts/scenes/net_menu.lua +++ b/parts/scenes/net_menu.lua @@ -16,7 +16,7 @@ end scene.widgetList={ WIDGET.newKey{name="setting",fText=TEXTURE.setting,x=1200,y=160,w=90,h=90,code=goScene"setting_game"}, - WIDGET.newButton{name="ffa", x=640, y=200,w=350,h=120,font=40,code=function()NET.enterRoom("ffa")end}, + WIDGET.newButton{name="ffa", x=640, y=200,w=350,h=120,font=40,code=function()NET.enterRoom({name="ffa"})end}, WIDGET.newButton{name="rooms", x=640, y=360,w=350,h=120,font=40,code=goScene"net_rooms"}, WIDGET.newButton{name="chat", x=640, y=540,w=350,h=120,color='D',font=40,code=NULL}, WIDGET.newButton{name="logout", x=880, y=40,w=180,h=60,color='dR', diff --git a/parts/scenes/net_rooms.lua b/parts/scenes/net_rooms.lua index 4f2c48c3..0410b7fa 100644 --- a/parts/scenes/net_rooms.lua +++ b/parts/scenes/net_rooms.lua @@ -66,7 +66,7 @@ function scene.keyDown(k) LOG.print("Can't enter private room now") return end - NET.enterRoom(NET.roomList[selected].rid)--,password + NET.enterRoom(NET.roomList[selected])--,password end end end From 2ce1ca6bf8ee2fc1db3d1dd4ec891b4d61452aea Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Wed, 5 May 2021 00:27:38 +0800 Subject: [PATCH 16/45] =?UTF-8?q?=E6=8E=A7=E5=88=B6=E5=8F=B0=E9=87=8C?= =?UTF-8?q?=E7=9A=84demo=E6=94=B9=E4=B8=BAtest?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/scenes/app_console.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/parts/scenes/app_console.lua b/parts/scenes/app_console.lua index 01573edd..405f868f 100644 --- a/parts/scenes/app_console.lua +++ b/parts/scenes/app_console.lua @@ -218,12 +218,12 @@ do--commands.help(arg) "Usage: theme ", }, }, - demo={ - description="Go to an empty demo scene", + test={ + description="Go to an empty test scene", details={ - "Go to an empty demo scene", + "Go to an empty test scene", "", - "Usage: demo", + "Usage: test", }, }, applet={ @@ -263,7 +263,7 @@ do--commands.help(arg) "stopbgm", "setbg", "theme", - "demo", + "test", "applet", } function commands.help(arg) @@ -556,7 +556,7 @@ function commands.theme(name) log{C.aqua,"Usage: theme [themeName]"} end end -function commands.demo() +function commands.test() SCN.go('test','none') end do--commands.applet(name) From e984ce39c3a8e3a04a8f5affb1242111f644301f Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Wed, 5 May 2021 01:18:05 +0800 Subject: [PATCH 17/45] =?UTF-8?q?=E4=BC=98=E5=8C=96=E7=8E=A9=E5=AE=B6?= =?UTF-8?q?=E7=BB=98=E5=88=B6=EF=BC=8C=E7=AE=80=E5=8C=96=E5=87=BB=E6=9D=80?= =?UTF-8?q?=E6=A0=87=E8=AE=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/player/draw.lua | 99 ++++++++++++++++++++++--------------------- parts/player/init.lua | 1 + 2 files changed, 51 insertions(+), 49 deletions(-) diff --git a/parts/player/draw.lua b/parts/player/draw.lua index 279e88df..733b3fe5 100644 --- a/parts/player/draw.lua +++ b/parts/player/draw.lua @@ -2,7 +2,7 @@ local gc=love.graphics local gc_push,gc_pop,gc_clear,gc_origin=gc.push,gc.pop,gc.clear,gc.origin local gc_translate,gc_scale,gc_rotate=gc.translate,gc.scale,gc.rotate local gc_setCanvas,gc_setShader=gc.setCanvas,gc.setShader -local gc_draw,gc_line,gc_rectangle,gc_circle=gc.draw,gc.line,gc.rectangle,gc.circle +local gc_draw,gc_line,gc_rectangle=gc.draw,gc.line,gc.rectangle local gc_print,gc_printf=gc.print,gc.printf local gc_setColor,gc_setLineWidth=gc.setColor,gc.setLineWidth local gc_stencil,gc_setStencilTest=gc.stencil,gc.setStencilTest @@ -15,7 +15,34 @@ local TEXT,COLOR,GAME,TIME=TEXT,COLOR,GAME,TIME local shader_alpha,shader_lighter=SHADER.alpha,SHADER.lighter local drawableText,missionEnum,minoColor=drawableText,missionEnum,minoColor +local RCPB={5,33,195,33,100,5,100,60} local frameColorList={[0]=COLOR.Z,COLOR.lG,COLOR.lB,COLOR.lV,COLOR.lO} +local attackColor={ + {COLOR.dH,COLOR.Z}, + {COLOR.H,COLOR.Z}, + {COLOR.lV,COLOR.Z}, + {COLOR.lR,COLOR.Z}, + {COLOR.dG,COLOR.C}, +} +local hideBoardStencil={ + up=function()gc_rectangle('fill',0,0,300,300)end, + down=function()gc_rectangle('fill',0,300,300,300)end, + all=function()gc_rectangle('fill',0,0,300,600)end, +} +local dialFrame=DOGC{70,70, + {'setLW',2}, + {'dCirc',35,35,30,6}, + {'setCL',1,1,1,.6}, + {'setLW',4}, + {'dCirc',35,35,30,6}, +} +local gridLines do + local L={300,640,{'setLW',2}} + for x=1,9 do table.insert(L,{'line',30*x,0,30*x,640})end + for y=0,19 do table.insert(L,{'line',0,40+30*y,300,40+30*y})end + gridLines=DOGC(L) +end + local function boardTransform(mode) if mode then if mode=="U-D"then @@ -39,17 +66,9 @@ local function applyFieldOffset(P,notNorm) end local function stencilBoard()gc_rectangle('fill',0,-10,300,610)end -local function drawGrid(P) - gc_setLineWidth(1) - - gc_setColor(1,1,1,P.gameEnv.grid) - for x=1,9 do gc_line(30*x,-10,30*x,600)end - - local dx=P.fieldBeneath+P.fieldUp - dx=dx-30*int(dx/30) - gc_translate(0,dx) - for y=0,19 do gc_line(0,30*y,300,30*y)end - gc_translate(0,-dx) +local function drawGrid(P,alpha) + gc_setColor(1,1,1,alpha) + gc_draw(gridLines,0,-10+(P.fieldBeneath+P.fieldUp)%30) end local function drawRow(h,V,L,showInvis) local texture=SKIN.curText @@ -218,13 +237,6 @@ local function drawBoarders(P) gc_rectangle('line',301,-3,15,604)--AtkBuffer boarder gc_rectangle('line',-16,-3,15,604)--B2b bar boarder end -local attackColor={ - {COLOR.dH,COLOR.Z}, - {COLOR.H,COLOR.Z}, - {COLOR.lV,COLOR.Z}, - {COLOR.lR,COLOR.Z}, - {COLOR.dG,COLOR.C}, -} local function drawBuffer(P) local h=0 for i=1,#P.atkBuffer do @@ -322,25 +334,11 @@ local function drawHold(P) gc_pop() gc_pop() end -local RCPB={5,33,195,33,100,5,100,60} -local hideBoardStencil={ - up=function()gc_rectangle('fill',0,0,300,300)end, - down=function()gc_rectangle('fill',0,300,300,300)end, - all=function()gc_rectangle('fill',0,0,300,600)end, -} local function drawDial(x,y,speed) gc_setColor(1,1,1) - setFont(25) - mStr(int(speed),x,y-18) - - gc_setLineWidth(2) - gc_circle('line',x,y,30,6) - + setFont(25)mStr(int(speed),x,y-18) + gc_draw(dialFrame,x,y,nil,nil,nil,35,35) gc_draw(IMG.dialNeedle,x,y,2.094+(speed<=175 and .02094*speed or 4.712-52.36/(speed-125)),nil,nil,5,4) - - gc_setLineWidth(4) - gc_setColor(1,1,1,.4) - gc_circle('line',x,y,30,6) end local function drawFinesseCombo_norm(P) if P.finesseCombo>2 then @@ -533,7 +531,8 @@ function draw.norm(P) local FBN,FUP=P.fieldBeneath,P.fieldUp local t=TIME() gc_push('transform') - gc_translate(P.x,P.y)gc_scale(P.size) + gc_translate(P.x,P.y) + gc_scale(P.size) --Field-related things gc_push('transform') @@ -550,7 +549,7 @@ function draw.norm(P) boardTransform(ENV.flipBoard) --Draw grid - if ENV.grid then drawGrid(P)end + if ENV.grid then drawGrid(P,ENV.grid)end --Move camera gc_translate(0,600+FBN+FUP) @@ -689,7 +688,8 @@ function draw.norm_remote(P) local FBN,FUP=P.fieldBeneath,P.fieldUp local t=TIME() gc_push('transform') - gc_translate(P.x,P.y)gc_scale(P.size) + gc_translate(P.x,P.y) + gc_scale(P.size) --Field-related things gc_push('transform') @@ -711,7 +711,7 @@ function draw.norm_remote(P) boardTransform(ENV.flipBoard) --Draw grid - if ENV.grid then drawGrid(P)end + if ENV.grid then drawGrid(P,ENV.grid)end --Move camera gc_translate(0,600+FBN+FUP) @@ -740,10 +740,12 @@ function draw.norm_remote(P) local centerX=30*(P.curX+P.cur.sc[2])-15 --Draw ghost & rotation center - if ENV.ghost then drawGhost(P,curColor)end - if ENV.center and ENV.ghost then - gc_setColor(1,1,1,trans*ENV.center) - gc_draw(IMG.spinCenter,centerX,-30*(P.ghoY+P.cur.sc[1])+15,nil,nil,nil,4,4) + if ENV.ghost then + drawGhost(P,curColor) + if ENV.center then + gc_setColor(1,1,1,trans*ENV.center) + gc_draw(IMG.spinCenter,centerX,-30*(P.ghoY+P.cur.sc[1])+15,nil,nil,nil,4,4) + end end local dy=ENV.smooth and P.ghoY~=P.curY and(P.dropDelay/ENV.drop-1)*30 or 0 @@ -826,7 +828,7 @@ function draw.norm_remote(P) gc_pop() end function draw.small(P) - --Draw content + --Update canvas P.frameWait=P.frameWait-1 if P.frameWait==0 then P.frameWait=10 @@ -872,13 +874,12 @@ function draw.small(P) --Draw Canvas gc_setColor(1,1,1) - gc_draw(P.canvas,P.x,P.y,nil,P.size*10) + local size=P.size + gc_draw(P.canvas,P.x,P.y,nil,size*10) if P.killMark then - gc_setLineWidth(3) - gc_setColor(1,0,0,min(P.endCounter,25)*.04) - gc_circle('line',P.centerX,P.centerY,(840-20*min(P.endCounter,30))*P.size) + gc_setColor(1,0,0) + gc_rectangle('fill',P.x+40*size,P.y+40*size,160*size,160*size) end - setFont(30) end function draw.demo(P) local _ diff --git a/parts/player/init.lua b/parts/player/init.lua index f9205c04..7a8b37a1 100644 --- a/parts/player/init.lua +++ b/parts/player/init.lua @@ -334,6 +334,7 @@ local function applyGameEnv(P)--Finish gameEnv processing if ENV.shakeFX==0 then ENV.shakeFX=false end if ENV.atkFX==0 then ENV.atkFX=false end if ENV.ghost==0 then ENV.ghost=false end + if ENV.grid==0 then ENV.grid=false end if ENV.center==0 then ENV.center=false end end ---------------------------------------------------- From 2e7df49c4f623d8f721d867f4f897ee1f5e6f88a Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Wed, 5 May 2021 02:09:44 +0800 Subject: [PATCH 18/45] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=A4=9A=E5=A4=84?= =?UTF-8?q?=E7=8E=A9=E5=AE=B6=E7=BB=98=E5=88=B6=E4=BB=A3=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E6=96=B0=E6=8A=80=E6=9C=AF=E4=BD=BF=E7=94=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/player/draw.lua | 112 ++++++++++++++++++------------------------ 1 file changed, 49 insertions(+), 63 deletions(-) diff --git a/parts/player/draw.lua b/parts/player/draw.lua index 733b3fe5..a133e76d 100644 --- a/parts/player/draw.lua +++ b/parts/player/draw.lua @@ -36,12 +36,19 @@ local dialFrame=DOGC{70,70, {'setLW',4}, {'dCirc',35,35,30,6}, } +local multiple=DOGC{15,15, + {'setLW',3}, + {'line',2,2,12,12}, + {'line',2,12,12,2}, +} local gridLines do local L={300,640,{'setLW',2}} for x=1,9 do table.insert(L,{'line',30*x,0,30*x,640})end for y=0,19 do table.insert(L,{'line',0,40+30*y,300,40+30*y})end gridLines=DOGC(L) end +local LDmarks=gc.newSpriteBatch(DOGC{14,5,{'clear',1,1,1}},15,'static') +for i=0,14 do LDmarks:add(3+20*i,615)end local function boardTransform(mode) if mode then @@ -280,8 +287,8 @@ local function drawB2Bbar(P) gc_setColor(1,1,1) gc_rectangle('fill',-15,b<40 and 568.5 or 118.5,13,3) end - - --LockDelay indicator +end +local function drawLDI(P)--Lock Delay Indicator if P.gameEnv.easyFresh then gc_setColor(1,1,1) else @@ -290,10 +297,9 @@ local function drawB2Bbar(P) if P.lockDelay>=0 then gc_rectangle('fill',0,602,300*P.lockDelay/P.gameEnv.lock,6)--Lock delay indicator end - local x=3 - for _=1,min(P.freshTime,15)do - gc_rectangle('fill',x,615,14,5) - x=x+20 + if P.freshTime>0 then + LDmarks:setDrawRange(1,min(P.freshTime,15)) + gc_draw(LDmarks) end end local function drawHold(P) @@ -316,7 +322,7 @@ local function drawHold(P) N=P.holdTime+1 end gc_push('transform') - gc_translate(62,40) + gc_translate(62,40) for n=1,#holdQueue do if n==N then gc_setColor(.6,.4,.4)end local bk,clr=holdQueue[n].bk,holdQueue[n].color @@ -358,21 +364,12 @@ local function drawFinesseCombo_norm(P) gc_print(str,20,570) gc_setColor(1,1,1,1.2-t*.1) end - if t>0 then - gc_push('transform') - gc_translate(20,600) - gc_scale(1+t*.08) - gc_print(str,0,-30) - gc_pop() - else - gc_print(str,20,570) - end + gc_print(str,20,600,nil,1+t*.08,nil,0,30) end end local function drawFinesseCombo_remote(P) if P.finesseCombo>2 then local S=P.stat - local str=P.finesseCombo.."x" if S.finesseRate==5*S.piece then gc_setColor(.9,.9,.3) elseif S.maxFinesseCombo==S.piece then @@ -380,21 +377,18 @@ local function drawFinesseCombo_remote(P) else gc_setColor(1,1,1) end - gc_print(str,20,570) + gc_print(P.finesseCombo.."x",20,570) end end local function drawLife(life) + gc_setColor(1,1,1) + gc_draw(IMG.lifeIcon,475,595,nil,.8) if life>3 then - gc_setColor(1,1,1) - gc_draw(IMG.lifeIcon,475,595,nil,.8) - setFont(20) - gc_print("x",503,595) - gc_print(life,517,595) - elseif life>0 then - gc_setColor(1,1,1) - for i=1,life do - gc_draw(IMG.lifeIcon,450+25*i,595,nil,.8) - end + gc_draw(multiple,502,602) + setFont(20)gc_print(life,517,595) + else + if life>1 then gc_draw(IMG.lifeIcon,500,595,nil,.8)end + if life>2 then gc_draw(IMG.lifeIcon,525,595,nil,.8)end end end local function drawMission(P) @@ -423,24 +417,20 @@ local function drawMission(P) end end end -local function drawStartCounter(P) +local function drawStartCounter(count) gc_setColor(1,1,1) - if P.frameRun<180 then - local count=179-P.frameRun - gc_push('transform') - gc_translate(305,220) - setFont(95) - if count%60>45 then gc_scale(1+(count%60-45)^2*.01,1)end - mStr(int(count/60+1),0,0) - gc_pop() - end + gc_push('transform') + gc_translate(305,220) + if count%60>45 then gc_scale(1+(count%60-45)^2*.01,1)end + setFont(95) + mStr(int(count/60+1),0,0) + gc_pop() end local draw={} function draw.drawNext_norm(P) local ENV=P.gameEnv local texture=SKIN.curText - gc_push('transform') gc_translate(316,36) local N=ENV.nextCount*72 gc_setColor(0,0,0,.4)gc_rectangle('fill',0,0,124,N+8) @@ -448,14 +438,14 @@ function draw.drawNext_norm(P) mText(drawableText.next,62,-51) N=1 gc_push('transform') - gc_translate(62,40) + gc_translate(62,40) while N<=ENV.nextCount and P.nextQueue[N]do - local bk,clr=P.nextQueue[N].bk,P.nextQueue[N].color + local bk,sprite=P.nextQueue[N].bk,texture[P.nextQueue[N].color] local k=#bk>2 and 2.2/#bk or 1 gc_scale(k) for i=1,#bk do for j=1,#bk[1]do if bk[i][j]then - gc_draw(texture[clr],30*(j-#bk[1]*.5)-30,-30*(i-#bk*.5)) + gc_draw(sprite,30*(j-#bk[1]*.5)-30,-30*(i-#bk*.5)) end end end gc_scale(1/k) @@ -465,20 +455,16 @@ function draw.drawNext_norm(P) gc_pop() if ENV.bagLine then - local len=ENV.bagLen - local phase=-P.pieceCount%len gc_setColor(.8,.5,.5) - for i=phase,N-1,len do - local y=72*i+3 - gc_line(2+P.fieldOff.x,y,120,y) + for i=-P.pieceCount%ENV.bagLen,N-1,ENV.bagLen do--i=phase + gc_rectangle('fill',2,72*i+3,120,2) end end - gc_pop() + gc_translate(-316,-36) end function draw.drawNext_hidden(P) local ENV=P.gameEnv local texture=SKIN.curText - gc_push('transform') gc_translate(316,36) local N=ENV.nextCount*72 gc_setColor(.5,0,0,.4)gc_rectangle('fill',0,0,124,N+8) @@ -486,14 +472,15 @@ function draw.drawNext_hidden(P) mText(drawableText.next,62,-51) N=min(ENV.nextStartPos,P.pieceCount+1) gc_push('transform') - gc_translate(62,40) - while N<=ENV.nextCount and P.nextQueue[N]do - local bk,clr=P.nextQueue[N].bk,P.nextQueue[N].color + gc_translate(62,40) + local queue=P.nextQueue + while N<=ENV.nextCount and queue[N]do + local bk,sprite=queue[N].bk,texture[queue[N].color] local k=#bk>2 and 2.2/#bk or 1 gc_scale(k) for i=1,#bk do for j=1,#bk[1]do if bk[i][j]then - gc_draw(texture[clr],30*(j-#bk[1]*.5)-30,-30*(i-#bk*.5)) + gc_draw(sprite,30*(j-#bk[1]*.5)-30,-30*(i-#bk*.5)) end end end gc_scale(1/k) @@ -503,15 +490,12 @@ function draw.drawNext_hidden(P) gc_pop() if ENV.bagLine then - local len=ENV.bagLen - local phase=-P.pieceCount%len gc_setColor(.8,.5,.5) - for i=phase,N-1,len do - local y=72*i+3 - gc_line(2+P.fieldOff.x,y,120,y) + for i=-P.pieceCount%ENV.bagLen,N-1,ENV.bagLen do--i=phase + gc_rectangle('fill',2,72*i+3,120,2) end end - gc_pop() + gc_translate(-316,-36) end draw.applyFieldOffset=applyFieldOffset @@ -619,6 +603,7 @@ function draw.norm(P) drawBoarders(P) drawBuffer(P) drawB2Bbar(P) + drawLDI(P) drawHold(P) P:drawNext() @@ -678,9 +663,9 @@ function draw.norm(P) gc_setColor(COLOR.N)gc_print(tm,20,540) drawFinesseCombo_norm(P) - drawLife(P.life) + if P.life>0 then drawLife(P.life)end drawMission(P) - drawStartCounter(P) + if P.frameRun<180 then drawStartCounter(179-P.frameRun)end gc_pop() end function draw.norm_remote(P) @@ -772,6 +757,7 @@ function draw.norm_remote(P) drawBoarders(P) drawBuffer(P) drawB2Bbar(P) + drawLDI(P) drawHold(P) P:drawNext() @@ -822,9 +808,9 @@ function draw.norm_remote(P) gc_setColor(COLOR.N)gc_print(time,20,540) drawFinesseCombo_remote(P) - drawLife(P.life) + if P.life>0 then drawLife(P.life)end drawMission(P) - drawStartCounter(P) + if P.frameRun<180 then drawStartCounter(179-P.frameRun)end gc_pop() end function draw.small(P) From 58305a969012c9894477c9ae2c7f07ad876f6903 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Wed, 5 May 2021 10:21:07 +0800 Subject: [PATCH 19/45] =?UTF-8?q?=E5=BA=8F=E5=88=97=E7=94=9F=E6=88=90?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E6=94=B9=E5=90=8D=EF=BC=8C=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?his4=E7=9A=84=E2=80=9D=E9=87=8D=E5=A4=8D=E2=80=9C=E6=A6=82?= =?UTF-8?q?=E5=BF=B5=E4=B8=BA=E5=BA=8F=E5=88=97=E9=87=8C=E7=9A=84id?= =?UTF-8?q?=E9=87=8D=E5=A4=8D=E8=80=8C=E4=B8=8D=E6=98=AF=E6=96=B9=E5=9D=97?= =?UTF-8?q?=E9=87=8D=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/player/init.lua | 4 ++-- parts/player/{getSeqGen.lua => seqGenerators.lua} | 12 ++++++------ 2 files changed, 8 insertions(+), 8 deletions(-) rename parts/player/{getSeqGen.lua => seqGenerators.lua} (94%) diff --git a/parts/player/init.lua b/parts/player/init.lua index 7a8b37a1..d0114c45 100644 --- a/parts/player/init.lua +++ b/parts/player/init.lua @@ -1,5 +1,5 @@ local Player=require"parts.player.player" -local getSeqGen=require"parts.player.getSeqGen" +local seqGenerators=require"parts.player.seqGenerators" local gameEnv0=require"parts.player.gameEnv0" local rnd,max=math.random,math.max @@ -314,7 +314,7 @@ local function applyGameEnv(P)--Finish gameEnv processing if ENV.nextCount==0 then ENV.nextPos=false end - P.newNext=coroutine.wrap(getSeqGen(P)) + P.newNext=coroutine.wrap(seqGenerators(P)) P.newNext(P,P.gameEnv.seqData) if P.mini then diff --git a/parts/player/getSeqGen.lua b/parts/player/seqGenerators.lua similarity index 94% rename from parts/player/getSeqGen.lua rename to parts/player/seqGenerators.lua index 06b9e237..d52a68c2 100644 --- a/parts/player/getSeqGen.lua +++ b/parts/player/seqGenerators.lua @@ -1,7 +1,7 @@ local ins,rem=table.insert,table.remove local yield=YIELD -local seqGens={ +local seqGenerators={ none=function()while true do yield()end end, bag=function(P,seq0) local len=#seq0 @@ -26,10 +26,10 @@ local seqGens={ for n=1,4 do local j,i=0 repeat - i=seq0[P:RND(len)] + i=P:RND(len) j=j+1 until i~=his[1]and i~=his[2]and i~=his[3]and i~=his[4]or j==4 - his[n]=i + his[n]=seq0[i] P:getNext(i) end end @@ -143,8 +143,8 @@ return function(P)--Return a piece-generating funtion for player P local s=P.gameEnv.sequence if type(s)=='function'then return s - elseif type(s)=='string'and seqGens[s]then - return seqGens[s] + elseif type(s)=='string'and seqGenerators[s]then + return seqGenerators[s] else LOG.print( type(s)=='string'and @@ -152,6 +152,6 @@ return function(P)--Return a piece-generating funtion for player P "Wrong sequence generator", 'warn') P.gameEnv.sequence='bag' - return seqGens.bag + return seqGenerators.bag end end \ No newline at end of file From c0d97939fa005b7ec6911375140b9489be3e7bb6 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Wed, 5 May 2021 10:35:46 +0800 Subject: [PATCH 20/45] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dhold=E4=BC=9A=E8=AE=A9?= =?UTF-8?q?=E9=94=81=E5=BB=B6=E5=88=B7=E6=96=B0=E6=AC=A1=E6=95=B0=E8=B6=85?= =?UTF-8?q?=E5=87=BA=E4=B8=8A=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/player/player.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/parts/player/player.lua b/parts/player/player.lua index 5b2562f3..29d2944b 100644 --- a/parts/player/player.lua +++ b/parts/player/player.lua @@ -705,7 +705,7 @@ function Player:hold(ifpre) end end - self.freshTime=int(min(self.freshTime+ENV.freshLimit*.25,ENV.freshLimit*((self.holdTime+1)/ENV.holdCount))) + self.freshTime=int(min(self.freshTime+ENV.freshLimit*.25,ENV.freshLimit*((self.holdTime+1)/ENV.holdCount),ENV.freshLimit)) if not ENV.infHold then self.holdTime=self.holdTime-1 end From 9a99f5d851b31870847c85811dfb2e420217e28a Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Wed, 5 May 2021 10:40:56 +0800 Subject: [PATCH 21/45] =?UTF-8?q?=E5=BE=AE=E8=B0=83=E5=85=B3=E4=BA=8E?= =?UTF-8?q?=E7=95=8C=E9=9D=A2ui=EF=BC=8C=E6=95=B4=E7=90=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/language/lang_en.lua | 1 + parts/language/lang_fr.lua | 1 + parts/language/lang_pt.lua | 1 + parts/language/lang_sp.lua | 1 + parts/language/lang_zh.lua | 2 ++ parts/scenes/about.lua | 16 +++++++++------- 6 files changed, 15 insertions(+), 7 deletions(-) diff --git a/parts/language/lang_en.lua b/parts/language/lang_en.lua index 9d14c1d3..244dba67 100644 --- a/parts/language/lang_en.lua +++ b/parts/language/lang_en.lua @@ -202,6 +202,7 @@ return{ Beepbox GFIE Goldwave + FL Mobile Libs used: Cold_Clear [MinusKelvin] json.lua [rxi] diff --git a/parts/language/lang_fr.lua b/parts/language/lang_fr.lua index 77dcc603..ca83b770 100644 --- a/parts/language/lang_fr.lua +++ b/parts/language/lang_fr.lua @@ -179,6 +179,7 @@ return{ Beepbox GFIE Goldwave + FL Mobile Libs utilisées: Cold_Clear [MinusKelvin] json.lua [rxi] diff --git a/parts/language/lang_pt.lua b/parts/language/lang_pt.lua index 0eefd685..dda8f940 100644 --- a/parts/language/lang_pt.lua +++ b/parts/language/lang_pt.lua @@ -203,6 +203,7 @@ return{ Beepbox GFIE Goldwave + FL Mobile Libs used: Cold_Clear [MinusKelvin] json.lua [rxi] diff --git a/parts/language/lang_sp.lua b/parts/language/lang_sp.lua index b09773f0..c9005136 100644 --- a/parts/language/lang_sp.lua +++ b/parts/language/lang_sp.lua @@ -180,6 +180,7 @@ return{ Beepbox GFIE Goldwave + FL Mobile Librerías usadas: Cold_Clear [MinusKelvin] json.lua [rxi] diff --git a/parts/language/lang_zh.lua b/parts/language/lang_zh.lua index eadd62d4..8f4cd479 100644 --- a/parts/language/lang_zh.lua +++ b/parts/language/lang_zh.lua @@ -202,6 +202,7 @@ return{ Beepbox GFIE Goldwave + FL Mobile 使用库: Cold_Clear [MinusKelvin] json.lua [rxi] @@ -917,6 +918,7 @@ return{ "手机玩也可以外接键盘哦", "术语不认识?去帮助-词典里查查吧", "水平是随着时间一点点提升的,不是几天几星期就能玩好的哦", + "睡眠不足会引起不可逆的脑损伤(变傻)", "四连块总共7种", "虽然极简连击和极简率计算看着很怪,但以后你会发现还挺科学!", "提前旋转等功能可以用来救命", diff --git a/parts/scenes/about.lua b/parts/scenes/about.lua index c7402dd0..a3b6a418 100644 --- a/parts/scenes/about.lua +++ b/parts/scenes/about.lua @@ -9,28 +9,30 @@ function scene.sceneInit() end function scene.draw() - --Draw all texts + --Texts setFont(20) gc.setColor(1,1,1) for i=1,#text.help do gc.printf(text.help[i],150,35*i+40,1000,'center') end + --Group + setFont(20) + mStr(text.group,640,480) + --Lib used setFont(15) - gc.print(text.used,30,330) + gc.print(text.used,30,320) + --Logo local t=TIME() - --Sponsor code gc.draw(TEXTURE.title,280,610,.1,.4+.03*sin(t*2.6),nil,580,118) gc.setLineWidth(3) + + --QR Code frame gc.rectangle('line',18,18,263,263) gc.rectangle('line',1012,18,250,250) - --Group code - setFont(20) - mStr(text.group,640,490) - --Support text gc.setColor(1,1,1,sin(t*20)*.3+.6) setFont(30) From 871e04204433207e182d6585b9ab8c6d95738b70 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Wed, 5 May 2021 10:44:08 +0800 Subject: [PATCH 22/45] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E6=A1=86=E6=8E=A7=E4=BB=B6new=E5=B1=9E=E6=80=A7=E5=9C=A8?= =?UTF-8?q?=E6=B8=85=E7=A9=BA=E5=90=8E=E4=BB=8D=E4=BF=9D=E7=95=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/widget.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Zframework/widget.lua b/Zframework/widget.lua index ae71b52e..453a11c4 100644 --- a/Zframework/widget.lua +++ b/Zframework/widget.lua @@ -741,7 +741,6 @@ function inputBox:reset() end function inputBox:clear() self.value="" - self.new=false end function inputBox:isAbove(x,y) return @@ -883,6 +882,7 @@ function textBox:press(x,y) if not self.fix and x>self.x+self.w-40 and y0 then self:clear() + self.new=false self.sure=0 else self.sure=60 @@ -908,6 +908,7 @@ end function textBox:clear() self.texts={} self.scrollPos=0 + self.new=false SFX.play('fall') end function textBox:draw() From 1d36d50fcab8869df829ff75fcb8bf1602e2b151 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Wed, 5 May 2021 10:51:11 +0800 Subject: [PATCH 23/45] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E7=A7=BB=E9=99=A4=E4=B8=BB=E8=8F=9C=E5=8D=95ai?= =?UTF-8?q?=E8=A7=92=E6=A1=86=EF=BC=8C=E4=BF=AE=E5=A4=8D=E8=A7=A6=E5=B1=8F?= =?UTF-8?q?=E5=9C=A8=E6=88=BF=E9=97=B4=E5=86=85=E4=BC=9A=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/player/update.lua | 12 ++++++------ parts/scenes/main.lua | 8 -------- parts/scenes/net_game.lua | 13 +++++-------- 3 files changed, 11 insertions(+), 22 deletions(-) diff --git a/parts/player/update.lua b/parts/player/update.lua index c004358b..3ce16ebb 100644 --- a/parts/player/update.lua +++ b/parts/player/update.lua @@ -280,7 +280,7 @@ function update.alive(P,dt) if P.falling>=0 then P.falling=P.falling-1 if P.falling>=0 then - goto stop + goto THROW_stop else local L=#P.clearingRow if P.sound and ENV.fall>0 and #P.field+L>P.clearingRow[L]then SFX.play('fall')end @@ -289,11 +289,11 @@ function update.alive(P,dt) end --Try spawn new block - if not P.control then goto stop end + if not P.control then goto THROW_stop end if P.waiting>=0 then P.waiting=P.waiting-1 if P.waiting<0 then P:popNext()end - goto stop + goto THROW_stop end --Natural block falling @@ -302,7 +302,7 @@ function update.alive(P,dt) local D=P.dropDelay if D>1 then P.dropDelay=D-1 - goto stop + goto THROW_stop end if D==1 then @@ -335,14 +335,14 @@ function update.alive(P,dt) end else P.lockDelay=P.lockDelay-1 - if P.lockDelay>=0 then goto stop end + if P.lockDelay>=0 then goto THROW_stop end P:drop() if P.AI_mode=='CC'and P.AI_bot then CC.updateField(P) end end end - ::stop:: + ::THROW_stop:: --B2B bar animation if P.b2b1==P.b2b then diff --git a/parts/scenes/main.lua b/parts/scenes/main.lua index bdc894a0..0c028e76 100644 --- a/parts/scenes/main.lua +++ b/parts/scenes/main.lua @@ -161,14 +161,6 @@ function scene.draw() --Player PLAYERS[1]:draw() - --Special area - gc.setColor(1,1,1,.8) - gc.setLineWidth(10) - gc.line(515,215,515,135,595,135) - gc.line(765,215,765,135,685,135) - gc.line(515,545,515,625,595,625) - gc.line(765,545,765,625,685,625) - --Profile drawSelfProfile() end diff --git a/parts/scenes/net_game.lua b/parts/scenes/net_game.lua index 62c6cb58..81d8c046 100644 --- a/parts/scenes/net_game.lua +++ b/parts/scenes/net_game.lua @@ -35,7 +35,7 @@ end scene.mouseDown=NULL function scene.mouseMove(x,y)netPLY.mouseMove(x,y)end function scene.touchDown(x,y) - if noTouch or not playing then return end + if not playing or noTouch then return end local t=VK.on(x,y) if t then @@ -44,7 +44,7 @@ function scene.touchDown(x,y) end end function scene.touchUp(x,y) - if noTouch or not playing then return end + if not playing or noTouch then return end local n=VK.on(x,y) if n then @@ -53,8 +53,8 @@ function scene.touchUp(x,y) end end function scene.touchMove(x,y) - if not playing then netPLY.mouseMove(x,y)return end - if noTouch or touchMoveLastFrame then return end + if not playing then netPLY.mouseMove(x,y)end + if touchMoveLastFrame or noTouch then return end touchMoveLastFrame=true local L=tc.getTouches() @@ -120,7 +120,6 @@ function scene.gamepadDown(key) LOG.print(text.sureQuit,COLOR.O) end else - if noKey then return end local k=keyMap.joystick[key] if k and k>0 then PLAYERS[1]:pressKey(k) @@ -129,12 +128,10 @@ function scene.gamepadDown(key) end end function scene.gamepadUp(key) - if noKey then return end local k=keyMap.joystick[key] if k and k>0 then PLAYERS[1]:releaseKey(k) VK.release(k) - return end end @@ -288,7 +285,7 @@ scene.widgetList={ netPLY.getReady(1)or NET.getlock('ready') end}, - WIDGET.newKey{name="cancel",x=900,y=560,w=400,h=100,color='H',font=40,code=pressKey"space", + WIDGET.newKey{name="cancel",x=1060,y=630,w=300,h=80,color='H',font=40,code=pressKey"space", hide=function() return playing or From 9af190529c6892e0fecbb9fc91a61d114d1747d7 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Wed, 5 May 2021 11:12:43 +0800 Subject: [PATCH 24/45] =?UTF-8?q?=E7=95=A5=E5=BE=AE=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E6=80=A7=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/player/update.lua | 18 +++++++++++------- parts/scenes/mode.lua | 3 +-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/parts/player/update.lua b/parts/player/update.lua index 3ce16ebb..3b8620d7 100644 --- a/parts/player/update.lua +++ b/parts/player/update.lua @@ -3,7 +3,11 @@ local int,abs,rnd=math.floor,math.abs,math.random local rem=table.remove local assert,resume,status=assert,coroutine.resume,coroutine.status -local function updateLine(P)--Attacks, line pushing, cam moving +local TEXT,GAME=TEXT,GAME +local PLAYERS,PLY_ALIVE=PLAYERS,PLY_ALIVE + + +local function updateLine(P)--Attacks, line pushing, camear moving local bf=P.atkBuffer for i=#bf,1,-1 do local A=bf[i] @@ -280,7 +284,7 @@ function update.alive(P,dt) if P.falling>=0 then P.falling=P.falling-1 if P.falling>=0 then - goto THROW_stop + goto stop else local L=#P.clearingRow if P.sound and ENV.fall>0 and #P.field+L>P.clearingRow[L]then SFX.play('fall')end @@ -289,11 +293,11 @@ function update.alive(P,dt) end --Try spawn new block - if not P.control then goto THROW_stop end + if not P.control then goto stop end if P.waiting>=0 then P.waiting=P.waiting-1 if P.waiting<0 then P:popNext()end - goto THROW_stop + goto stop end --Natural block falling @@ -302,7 +306,7 @@ function update.alive(P,dt) local D=P.dropDelay if D>1 then P.dropDelay=D-1 - goto THROW_stop + goto stop end if D==1 then @@ -335,14 +339,14 @@ function update.alive(P,dt) end else P.lockDelay=P.lockDelay-1 - if P.lockDelay>=0 then goto THROW_stop end + if P.lockDelay>=0 then goto stop end P:drop() if P.AI_mode=='CC'and P.AI_bot then CC.updateField(P) end end end - ::THROW_stop:: + ::stop:: --B2B bar animation if P.b2b1==P.b2b then diff --git a/parts/scenes/mode.lua b/parts/scenes/mode.lua index fe6065dd..2da29463 100644 --- a/parts/scenes/mode.lua +++ b/parts/scenes/mode.lua @@ -21,8 +21,7 @@ local scene={} function scene.sceneInit(org) BG.set() destroyPlayers() - local cam=mapCam - cam.zoomK=org=="main"and 5 or 1 + mapCam.zoomK=org=="main"and 5 or 1 end local function getK() From 5afba67c1d5dcdb337082f2f77a734dbd5e01da6 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Wed, 5 May 2021 14:39:02 +0800 Subject: [PATCH 25/45] =?UTF-8?q?=E5=8F=96=E6=B6=88=E8=BD=AF=E4=BB=B6?= =?UTF-8?q?=E9=94=81=E5=8A=9F=E8=83=BD=EF=BC=8C=E8=B0=83=E6=95=B4=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E7=95=8C=E9=9D=A2=E5=B8=83=E5=B1=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.lua | 2 +- parts/globalTables.lua | 1 - parts/language/lang_en.lua | 3 +- parts/language/lang_fr.lua | 3 +- parts/language/lang_pt.lua | 3 +- parts/language/lang_sp.lua | 3 +- parts/language/lang_symbol.lua | 3 +- parts/language/lang_zh.lua | 3 +- parts/scenes/load.lua | 58 +++++++++++----------------------- parts/scenes/setting_game.lua | 3 +- 10 files changed, 27 insertions(+), 55 deletions(-) diff --git a/main.lua b/main.lua index d72e43a5..086f9fa3 100644 --- a/main.lua +++ b/main.lua @@ -263,7 +263,6 @@ do if STAT.version<1400 then fs.remove("conf/user") fs.remove("conf/key") - SETTING.appLock=false needSave=true autoRestart=true end @@ -271,6 +270,7 @@ do fs.remove("conf/user") autoRestart=true end + SETTING.appLock=nil for _,v in next,VK_org do if not v.color then diff --git a/parts/globalTables.lua b/parts/globalTables.lua index a0268579..44074def 100644 --- a/parts/globalTables.lua +++ b/parts/globalTables.lua @@ -246,7 +246,6 @@ SETTING={--Settings reTime=4, autoPause=true, fine=false, - appLock=false, simpMode=false, lang=1, skinSet=1, diff --git a/parts/language/lang_en.lua b/parts/language/lang_en.lua index 244dba67..e21655da 100644 --- a/parts/language/lang_en.lua +++ b/parts/language/lang_en.lua @@ -277,11 +277,10 @@ return{ reTime="Start Delay", RS="Rotation System", layout="Layout", - dataSaving="Data saving", autoPause="Pause while unfocused", swap="Key Combination (Change Atk. Mode)", fine="Finesse Error SFX", - appLock="App Lock (Password: 6+26)", + dataSaving="Data saving", simpMode="Simplistic Style", }, setting_video={ diff --git a/parts/language/lang_fr.lua b/parts/language/lang_fr.lua index ca83b770..b7121727 100644 --- a/parts/language/lang_fr.lua +++ b/parts/language/lang_fr.lua @@ -249,11 +249,10 @@ return{ reTime="Délai de démarrage", RS="Système de rotation", layout="Disposition", - -- dataSaving="Data saving", autoPause="Mettre en pause en cas de perte de focus", swap="Combinaison de touches (changer le mode d'attaque)", fine="Son d'erreur de Finesse", - appLock="Verrouillage d'appli (MDP : 6+26)", + -- dataSaving="Data saving", -- simpMode="Simple mode", }, setting_video={ diff --git a/parts/language/lang_pt.lua b/parts/language/lang_pt.lua index dda8f940..b8224e99 100644 --- a/parts/language/lang_pt.lua +++ b/parts/language/lang_pt.lua @@ -278,11 +278,10 @@ return{ reTime="Demora iniciação", RS="Sistema de rotação", layout="Layout", - -- dataSaving="Data saving", autoPause="Pausar quando foco for perco", swap="Combinação de tecla(Mudar modo de atk)", fine="Som Falha de destreza", - appLock="App Lock (Senha: 6+26)", + -- dataSaving="Data saving", -- simpMode="Simple mode", }, setting_video={ diff --git a/parts/language/lang_sp.lua b/parts/language/lang_sp.lua index c9005136..7d44a74d 100644 --- a/parts/language/lang_sp.lua +++ b/parts/language/lang_sp.lua @@ -255,11 +255,10 @@ return{ reTime="Retraso de Inicio", RS="Sistema de Rotación", layout="Diseño", - -- dataSaving="Data saving", autoPause="Pausar cuando la ventana no está enfocada", swap="Combinación de Teclas (Cambiar Modo de Ataque)", fine="Sonido de Error de Finesse", - appLock="Bloqueo de App (Contraseña: 6+26)", + -- dataSaving="Data saving", simpMode="Modo Sencillo", }, setting_video={ diff --git a/parts/language/lang_symbol.lua b/parts/language/lang_symbol.lua index 1f41eb44..3e377c93 100644 --- a/parts/language/lang_symbol.lua +++ b/parts/language/lang_symbol.lua @@ -134,11 +134,10 @@ return{ reTime="3-2-1", RS="''?", layout="=-=-=", - dataSaving="XX.", autoPause="A||", swap="=+=+=", fine="12 X 21", - appLock="?XX(=6+26)", + dataSaving="XX.", simpMode=".", }, setting_video={ diff --git a/parts/language/lang_zh.lua b/parts/language/lang_zh.lua index 8f4cd479..47fdc557 100644 --- a/parts/language/lang_zh.lua +++ b/parts/language/lang_zh.lua @@ -277,11 +277,10 @@ return{ reTime="开局等待时间", RS="旋转系统", layout="外观", - dataSaving="省流模式", autoPause="失去焦点自动暂停", swap="组合键切换攻击模式", fine="极简操作提示音", - appLock="软件锁(密码6+26)", + dataSaving="省流模式", simpMode="简洁模式", }, setting_video={ diff --git a/parts/scenes/load.lua b/parts/scenes/load.lua index 23975120..2e67da12 100644 --- a/parts/scenes/load.lua +++ b/parts/scenes/load.lua @@ -10,7 +10,7 @@ local shadePhase1,shadePhase2 local progress=0 local studioLogo--Studio logo text object local logoColor1,logoColor2 -local skip,locked +local skip local light={} for i=0,26 do @@ -21,13 +21,6 @@ end for _=1,3 do light[math.random(7,25)*3]=true end -local function switchLight(i) - light[3*i]=not light[3*i] - if light[6*3]and light[26*3]then - locked=false - skip=0 - end -end local function upFloor() progress=progress+1 @@ -212,9 +205,8 @@ function scene.sceneInit() shadePhase1=6.26*math.random() shadePhase2=6.26*math.random() skip=0--Skip time - locked=SETTING.appLock consoleLaunchKey=0 - if not locked then light[6*3],light[26*3]=true,true end + light[6*3],light[26*3]=true,true kb.setKeyRepeat(false) end function scene.sceneBack() @@ -226,21 +218,11 @@ function scene.keyDown(key) SCN.back() elseif key=="s"then skip=999 - elseif locked and #key==1 and key:byte()>=97 and key:byte()<=122 then - switchLight(key:byte()-96) else skip=skip+1 end end -function scene.mouseDown(x,y) - if locked then - for i=1,27 do - if(x-light[3*i-2])^2+(y-light[3*i-1])^2<=626 then - switchLight(i) - return - end - end - end +function scene.mouseDown() scene.keyDown("mouse") end scene.touchDown=scene.mouseDown @@ -251,23 +233,21 @@ function scene.update(dt) if blackTime>0 then blackTime=blackTime-dt end - if not locked then - if progress<25 then - local p=progress - repeat - loadingThread() - until LOADED or skip<=0 or progress~=p - if skip>0 then skip=skip-1 end - else - openTime=openTime+dt - if skip>0 then - openTime=openTime+.26 - skip=skip-1 - end - if openTime>=3.26 and not SCN.swapping then - SCN.swapTo('intro') - love.keyboard.setKeyRepeat(true) - end + if progress<25 then + local p=progress + repeat + loadingThread() + until LOADED or skip<=0 or progress~=p + if skip>0 then skip=skip-1 end + else + openTime=openTime+dt + if skip>0 then + openTime=openTime+.26 + skip=skip-1 + end + if openTime>=3.26 and not SCN.swapping then + SCN.swapTo('intro') + love.keyboard.setKeyRepeat(true) end end end @@ -345,7 +325,7 @@ function scene.draw() gc.setColor(1,1,1) gc.draw(TEXTURE.pixelNum[d2],1040,40,nil,8) gc.draw(TEXTURE.pixelNum[d1],1100,40,nil,8) - if not locked and progress~=25 then + if progress~=25 then setFont(40) gc.setColor(1,.9,.8) gc.print("↑",1150,26) diff --git a/parts/scenes/setting_game.lua b/parts/scenes/setting_game.lua index c73b1aeb..fe796a53 100644 --- a/parts/scenes/setting_game.lua +++ b/parts/scenes/setting_game.lua @@ -30,11 +30,10 @@ scene.widgetList={ WIDGET.newSlider{name="reTime", x=350, y=340, w=300,unit=10,disp=SETval("reTime"),code=SETsto("reTime"),show=function(S)return(.5+S.disp()*.25).."s"end}, WIDGET.newSelector{name="RS", x=500, y=420, w=300,color='S',list={'TRS','SRS','C2','C2sym','Classic','None'},disp=SETval("RS"),code=SETsto("RS")}, WIDGET.newButton{name="layout", x=250, y=540, w=200,h=70,font=35, code=goScene"setting_skin"}, - WIDGET.newSwitch{name="dataSaving", x=750, y=550, font=20,disp=SETval("dataSaving"), code=function()SETTING.dataSaving=not SETTING.dataSaving if not SETTING.dataSaving then USERS.forceFreshAvatar()end end}, WIDGET.newSwitch{name="autoPause", x=1060, y=310, font=20,disp=SETval("autoPause"), code=SETrev("autoPause")}, WIDGET.newSwitch{name="swap", x=1060, y=370, font=20,disp=SETval("swap"), code=SETrev("swap")}, WIDGET.newSwitch{name="fine", x=1060, y=430, font=20,disp=SETval("fine"), code=function()SETTING.fine=not SETTING.fine if SETTING.fine then SFX.play('finesseError',.6)end end}, - WIDGET.newSwitch{name="appLock", x=1060, y=490, font=20,disp=SETval("appLock"), code=SETrev("appLock")}, + WIDGET.newSwitch{name="dataSaving", x=1060, y=490, font=20,disp=SETval("dataSaving"), code=function()SETTING.dataSaving=not SETTING.dataSaving if not SETTING.dataSaving then USERS.forceFreshAvatar()end end}, WIDGET.newSwitch{name="simpMode", x=1060, y=550, font=25,disp=SETval("simpMode"), code=function() SETTING.simpMode=not SETTING.simpMode From 29a5556c33229d68b23939541fbe0ac3abcc5da8 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Wed, 5 May 2021 14:39:52 +0800 Subject: [PATCH 26/45] =?UTF-8?q?=E5=B8=B8=E9=A9=BB=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=98=BE=E7=A4=BA=E7=A7=BB=E5=8A=A8=E5=88=B0?= =?UTF-8?q?=E5=B1=8F=E5=B9=95=E4=B8=AD=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/init.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Zframework/init.lua b/Zframework/init.lua index 525e4ce0..10b7070a 100644 --- a/Zframework/init.lua +++ b/Zframework/init.lua @@ -535,6 +535,11 @@ function love.run() --Draw widgets WIDGET.draw() + --Draw Version string + gc_setColor(.8,.8,.8,.4) + setFont(20) + mStr(VERSION.string,640,693) + --Draw cursor if mouseShow then local R=int((time+1)/2)%7+1 @@ -564,8 +569,6 @@ function love.run() --Draw FPS setFont(15) _=SCR.h - gc_setColor(.8,.8,.8,.4) - gc_print(VERSION.string,SCR.safeX+50,_-20) gc_setColor(1,1,1) gc_print(FPS(),SCR.safeX+5,_-20) From 65a4bd36656f9ac733ff5dffe68e90913bd2c76a Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Wed, 5 May 2021 15:51:45 +0800 Subject: [PATCH 27/45] =?UTF-8?q?=E5=88=A0=E9=99=A4=E8=99=9A=E6=8B=9F?= =?UTF-8?q?=E6=8C=89=E9=94=AE=E9=A2=9C=E8=89=B2=EF=BC=8C=E6=81=A2=E5=A4=8D?= =?UTF-8?q?=E6=9C=80=E6=97=A9=E7=9A=84=E7=99=BD=E8=89=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.lua | 8 +-- parts/globalTables.lua | 40 ++++++------- parts/virtualKey.lua | 125 +++++++++++++++++++---------------------- 3 files changed, 78 insertions(+), 95 deletions(-) diff --git a/main.lua b/main.lua index 086f9fa3..595df176 100644 --- a/main.lua +++ b/main.lua @@ -272,13 +272,7 @@ do end SETTING.appLock=nil - for _,v in next,VK_org do - if not v.color then - fs.remove("conf/virtualkey") - autoRestart=true - break - end - end + for _,v in next,VK_org do v.color=nil end if STAT.version~=VERSION.code then newVersionLaunch=true diff --git a/parts/globalTables.lua b/parts/globalTables.lua index 44074def..b865009c 100644 --- a/parts/globalTables.lua +++ b/parts/globalTables.lua @@ -337,25 +337,25 @@ keyMap=FILE.load("conf/key")or{--Key setting }, } VK_org=FILE.load("conf/virtualkey")or{--Virtualkey layout, refresh all VKs' position with this before each game - {ava=true, x=80, y=720-200, r=80,color=COLOR.L},--moveLeft - {ava=true, x=320, y=720-200, r=80,color=COLOR.L},--moveRight - {ava=true, x=1280-80, y=720-200, r=80,color=COLOR.R},--rotRight - {ava=true, x=1280-200, y=720-80, r=80,color=COLOR.O},--rotLeft - {ava=true, x=1280-200, y=720-320, r=80,color=COLOR.M},--rot180 - {ava=true, x=200, y=720-320, r=80,color=COLOR.C},--hardDrop - {ava=true, x=200, y=720-80, r=80,color=COLOR.S},--softDrop - {ava=true, x=1280-320, y=720-200, r=80,color=COLOR.Y},--hold - {ava=true, x=1280-80, y=280, r=80,color=COLOR.lR},--func1 - {ava=true, x=80, y=280, r=80,color=COLOR.lM},--func2 - {ava=false, x=100, y=50, r=80,color=COLOR.A},--insLeft - {ava=false, x=200, y=50, r=80,color=COLOR.A},--insRight - {ava=false, x=300, y=50, r=80,color={COLOR.rainbow(3.5)}},--insDown - {ava=false, x=400, y=50, r=80,color={COLOR.rainbow(3.3)}},--down1 - {ava=false, x=500, y=50, r=80,color={COLOR.rainbow(3.1)}},--down4 - {ava=false, x=600, y=50, r=80,color={COLOR.rainbow(2.9)}},--down10 - {ava=false, x=700, y=50, r=80,color=COLOR.lL},--dropLeft - {ava=false, x=800, y=50, r=80,color=COLOR.lL},--dropRight - {ava=false, x=900, y=50, r=80,color=COLOR.lA},--addToLeft - {ava=false, x=1000, y=50, r=80,color=COLOR.lA},--addToRight + {ava=true, x=80, y=720-200, r=80},--moveLeft + {ava=true, x=320, y=720-200, r=80},--moveRight + {ava=true, x=1280-80, y=720-200, r=80},--rotRight + {ava=true, x=1280-200, y=720-80, r=80},--rotLeft + {ava=true, x=1280-200, y=720-320, r=80},--rot180 + {ava=true, x=200, y=720-320, r=80},--hardDrop + {ava=true, x=200, y=720-80, r=80},--softDrop + {ava=true, x=1280-320, y=720-200, r=80},--hold + {ava=true, x=1280-80, y=280, r=80},--func1 + {ava=true, x=80, y=280, r=80},--func2 + {ava=false, x=100, y=50, r=80},--insLeft + {ava=false, x=200, y=50, r=80},--insRight + {ava=false, x=300, y=50, r=80},--insDown + {ava=false, x=400, y=50, r=80},--down1 + {ava=false, x=500, y=50, r=80},--down4 + {ava=false, x=600, y=50, r=80},--down10 + {ava=false, x=700, y=50, r=80},--dropLeft + {ava=false, x=800, y=50, r=80},--dropRight + {ava=false, x=900, y=50, r=80},--addToLeft + {ava=false, x=1000, y=50, r=80},--addToRight } REPLAY=FILE.load("conf/replay")or{} \ No newline at end of file diff --git a/parts/virtualKey.lua b/parts/virtualKey.lua index 641d18ba..573763b6 100644 --- a/parts/virtualKey.lua +++ b/parts/virtualKey.lua @@ -1,6 +1,7 @@ local gc=love.graphics - -local SETTING=SETTING +local next=next +local SETTING,TIME=SETTING,TIME +local VK_org=VK_org --Virtualkey icons local VKIcon={} @@ -17,13 +18,12 @@ local VK={keys=keys} function VK.on(x,y) local dist,nearest=1e10 - for K=1,#keys do - local B=keys[K] + for id,B in next,keys do if B.ava then local d1=(x-B.x)^2+(y-B.y)^2 if d10 then b.x=b.x+(b.x-B.x)*d*b.r*2.6e-5 @@ -81,23 +80,21 @@ function VK.restore() B.x=O.x B.y=O.y B.r=O.r - B.color=O.color B.isDown=false B.pressTime=0 end - for k,v in next,PLAYERS[1].keyAvailable do + for id,v in next,PLAYERS[1].keyAvailable do if not v then - keys[k].ava=false + keys[id].ava=false end end end function VK.update() if SETTING.VKSwitch then - for i=1,#keys do - local _=keys[i] - if _.pressTime>0 then - _.pressTime=_.pressTime-1 + for _,B in next,keys do + if B.pressTime>0 then + B.pressTime=B.pressTime-1 end end end @@ -105,72 +102,64 @@ end local gc_circle,gc_draw,gc_setColor,gc_setLineWidth=gc.circle,gc.draw,gc.setColor,gc.setLineWidth function VK.draw() - if SETTING.VKSwitch then - local a=SETTING.VKAlpha - if SETTING.VKIcon then - for i=1,#keys do - if keys[i].ava then - local B=keys[i] + if not SETTING.VKSwitch then return end + local a=SETTING.VKAlpha + if SETTING.VKIcon then + for i,B in next,keys do + if B.ava then + --Button outline + gc_setColor(1,1,1,a) + gc_setLineWidth(B.r*.07) + gc_circle('line',B.x,B.y,B.r,10) - --Button outline - gc_setColor(1,1,1,a) - gc_setLineWidth(B.r*.07) - gc_circle('line',B.x,B.y,B.r,10) + --Icon + local _=B.pressTime + gc_setColor(1,1,1,a) + gc_draw(VKIcon[i],B.x,B.y,nil,B.r*.026+_*.08,nil,18,18) - --Icon - local _=keys[i].pressTime - local c=B.color - gc_setColor(c[1],c[2],c[3],a) - gc_draw(VKIcon[i],B.x,B.y,nil,B.r*.026+_*.08,nil,18,18) + --Ripple + if _>0 then + gc_setColor(1,1,1,a*_*.08) + gc_circle('line',B.x,B.y,B.r*(1.4-_*.04),10) + end - --Ripple - if _>0 then - gc_setColor(1,1,1,a*_*.08) - gc_circle('line',B.x,B.y,B.r*(1.4-_*.04),10) - end - - --Glow when press - if B.isDown then - gc_setColor(1,1,1,a*.4) - gc_circle('fill',B.x,B.y,B.r*.94,10) - end + --Glow when press + if B.isDown then + gc_setColor(1,1,1,a*.4) + gc_circle('fill',B.x,B.y,B.r*.94,10) end end - else - for i=1,#keys do - if keys[i].ava then - local B=keys[i] - gc_setColor(1,1,1,a) - gc_setLineWidth(B.r*.07) - gc_circle('line',B.x,B.y,B.r,10) - local _=keys[i].pressTime - if _>0 then - gc_setColor(1,1,1,a*_*.08) - gc_circle('fill',B.x,B.y,B.r*.94,10) - gc_circle('line',B.x,B.y,B.r*(1.4-_*.04),10) - end + end + else + for _,B in next,keys do + if B.ava then + gc_setColor(1,1,1,a) + gc_setLineWidth(B.r*.07) + gc_circle('line',B.x,B.y,B.r,10) + local _=B.pressTime + if _>0 then + gc_setColor(1,1,1,a*_*.08) + gc_circle('fill',B.x,B.y,B.r*.94,10) + gc_circle('line',B.x,B.y,B.r*(1.4-_*.04),10) end end end end end function VK.preview(selected) - if SETTING.VKSwitch then - for i=1,#VK_org do - local B=VK_org[i] - if B.ava then + if not SETTING.VKSwitch then return end + for id,B in next,VK_org do + if B.ava then + gc_setColor(1,1,1,SETTING.VKAlpha) + gc_setLineWidth(B.r*.07) + gc_circle('line',B.x,B.y,B.r,10) + if selected==id and TIME()%.26<.13 then + gc_setColor(1,1,1,SETTING.VKAlpha*.62) + gc_circle('fill',B.x,B.y,B.r,10) + end + if SETTING.VKIcon then gc_setColor(1,1,1,SETTING.VKAlpha) - gc_setLineWidth(B.r*.07) - gc_circle('line',B.x,B.y,B.r,10) - if selected==i and TIME()%.26<.13 then - gc_setColor(1,1,1,SETTING.VKAlpha*.62) - gc_circle('fill',B.x,B.y,B.r,10) - end - if SETTING.VKIcon then - local c=B.color - gc_setColor(c[1],c[2],c[3],SETTING.VKAlpha) - gc_draw(VKIcon[i],B.x,B.y,nil,B.r*.025,nil,18,18) - end + gc_draw(VKIcon[id],B.x,B.y,nil,B.r*.025,nil,18,18) end end end From fa745cca61b767841183111dbb8bcbeab742d4cb Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Wed, 5 May 2021 16:20:26 +0800 Subject: [PATCH 28/45] =?UTF-8?q?=E9=99=8D=E4=BD=8E=E9=83=A8=E5=88=86?= =?UTF-8?q?=E8=83=8C=E6=99=AF=E5=BA=95=E8=89=B2=E4=BA=AE=E5=BA=A6=EF=BC=8C?= =?UTF-8?q?blockspace=E6=9B=B4=E7=9C=9F=E5=AE=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/backgrounds/blockfall.lua | 2 +- parts/backgrounds/blockrain.lua | 2 +- parts/backgrounds/blockspace.lua | 10 +++++----- parts/backgrounds/matrix.lua | 2 +- parts/backgrounds/space.lua | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/parts/backgrounds/blockfall.lua b/parts/backgrounds/blockfall.lua index 94cb91d0..2d2d6857 100644 --- a/parts/backgrounds/blockfall.lua +++ b/parts/backgrounds/blockfall.lua @@ -32,7 +32,7 @@ function back.update() end end function back.draw() - gc.clear(.15,.15,.15) + gc.clear(.1,.1,.1) gc.push('transform') gc.origin() gc.setColor(1,1,1,.4) diff --git a/parts/backgrounds/blockrain.lua b/parts/backgrounds/blockrain.lua index 383e5770..3841c3ca 100644 --- a/parts/backgrounds/blockrain.lua +++ b/parts/backgrounds/blockrain.lua @@ -40,7 +40,7 @@ function back.update() end end function back.draw() - gc.clear(.15,.15,.15) + gc.clear(.1,.1,.1) gc.push('transform') gc.origin() for i=1,#mino do diff --git a/parts/backgrounds/blockspace.lua b/parts/backgrounds/blockspace.lua index 1892652c..4095d882 100644 --- a/parts/backgrounds/blockspace.lua +++ b/parts/backgrounds/blockspace.lua @@ -13,16 +13,16 @@ function back.init() end function back.update() t=t+1 - if t%2==0 then + if t%3==0 then local r=rnd(29) ins(mino,{ block=TEXTURE.miniBlock[r], color=minoColor[SETTING.skin[r]], ang=6.2832*rnd(), rotate=6.2832*rnd(), - vr=.03-rnd()*.06, + vr=.05-rnd()*.1, d=0, - v=1, + v=.5+rnd(), }) end local rad=SCR.rad @@ -33,12 +33,12 @@ function back.update() rem(mino,i) else M.rotate=M.rotate+M.vr - M.v=M.v*(1+M.d/SCR.rad*.2) + M.v=M.v*(1+M.d/SCR.rad*.05) end end end function back.draw() - gc.clear(.15,.15,.15) + gc.clear(.1,.1,.1) gc.push('transform') gc.origin() gc.translate(SCR.w/2,SCR.h/2) diff --git a/parts/backgrounds/matrix.lua b/parts/backgrounds/matrix.lua index d15231e1..de816013 100644 --- a/parts/backgrounds/matrix.lua +++ b/parts/backgrounds/matrix.lua @@ -13,7 +13,7 @@ function back.update(dt) t=t+dt end function back.draw() - gc.clear(.15,.15,.15) + gc.clear(.1,.1,.1) gc.push('transform') local k=SCR.k gc.scale(k) diff --git a/parts/backgrounds/space.lua b/parts/backgrounds/space.lua index eaad92e0..bf4b1388 100644 --- a/parts/backgrounds/space.lua +++ b/parts/backgrounds/space.lua @@ -31,7 +31,7 @@ function back.update() end end function back.draw() - gc.clear(.15,.15,.15) + gc.clear(.1,.1,.1) if not stars[1]then return end gc.translate(-10,-10) gc.setColor(.8,.8,.8) From a2c610e8774572bdbe1e934527af75e02a0e47bf Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Thu, 6 May 2021 13:34:00 +0800 Subject: [PATCH 29/45] =?UTF-8?q?=E6=88=BF=E9=97=B4=E5=90=8D=E7=A7=BB?= =?UTF-8?q?=E5=8A=A8=E5=88=B0=E5=8F=B3=E4=B8=8B=E8=A7=92=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E6=B6=88=E6=81=AF=E6=8F=90=E9=86=92=E4=B8=8D=E5=86=8D=E9=97=AA?= =?UTF-8?q?=E7=83=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/scenes/net_game.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/parts/scenes/net_game.lua b/parts/scenes/net_game.lua index 81d8c046..85b1cf21 100644 --- a/parts/scenes/net_game.lua +++ b/parts/scenes/net_game.lua @@ -258,7 +258,7 @@ function scene.draw() --Room info. gc.setColor(1,1,1) setFont(25) - mStr(NET.roomInfo.name,640,685) + gc.printf(NET.roomInfo.name,0,685,1270,'right') setFont(40) gc.print(netPLY.getCount().."/"..NET.roomInfo.capacity,70,655) if NET.roomInfo.private then gc.draw(IMG.lock,30,668)end @@ -270,7 +270,7 @@ function scene.draw() --New message if textBox.new then setFont(40) - gc.setColor(1,.5+.5*math.sin(TIME()*26),0) + gc.setColor(1,1,0) gc.print("M",430,10) end end From 192607f874a8419c0defe9e7e369f53456e48ac4 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Thu, 6 May 2021 15:23:03 +0800 Subject: [PATCH 30/45] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=8E=A7=E5=88=B6?= =?UTF-8?q?=E5=8F=B0=E5=86=85rmwtm=E7=9A=84=E8=AF=B4=E6=98=8E=EF=BC=8Crmwt?= =?UTF-8?q?m=E4=B9=9F=E4=B8=8D=E5=86=8D=E4=BB=A5=E6=98=8E=E6=96=87?= =?UTF-8?q?=E5=AD=98=E5=9C=A8=E4=BA=8E=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/scenes/app_console.lua | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/parts/scenes/app_console.lua b/parts/scenes/app_console.lua index 405f868f..c3ee82ad 100644 --- a/parts/scenes/app_console.lua +++ b/parts/scenes/app_console.lua @@ -159,13 +159,12 @@ do--commands.help(arg) "Usage: gammacorrect ", }, }, - rmwtm={ - description="Remove the \"no recording\" watermark.", + ["\114\109\119\116\109"]={ + description="Remove something", details={ - "Remove the \"no recording\" watermark.", - "You will need a password to do that.", + "Remove something", "", - "Usage: rmwtm [password]", + "Usage: ?", }, }, unlockall={ @@ -256,7 +255,7 @@ do--commands.help(arg) "scrinfo", "wireframe", "gammacorrect", - "rmwtm", + "\114\109\119\116\109", "unlockall", "play", "playbgm", @@ -478,13 +477,11 @@ function commands.gammacorrect(bool) log{C.aqua,"Usage: gammacorrect "} end end -function commands.rmwtm(pw) +commands["\114\109\119\116\109"]=function(pw) if pw==the_secret then _G["\100\114\97\119\70\87\77"]=NULL log{C.lC,"\87\97\116\101\114\109\97\114\107\32\82\101\109\111\118\101\100"} SFX.play('clear') - else - log{C.aqua,"Usage: rmwtm [password]"} end end function commands.unlockall(bool) From ed6c6dc7934560c2be954f176b62e4dd1b555c8d Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Thu, 6 May 2021 21:38:45 +0800 Subject: [PATCH 31/45] =?UTF-8?q?=E5=BE=AE=E8=B0=83his=E8=AF=8D=E6=9D=A1?= =?UTF-8?q?=EF=BC=8C=E8=8B=B1=E6=96=87=E7=AD=89=E5=BE=85=E7=BF=BB=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/language/dict_en.lua | 2 +- parts/language/dict_zh.lua | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/parts/language/dict_en.lua b/parts/language/dict_en.lua index d36610a6..de5030cd 100644 --- a/parts/language/dict_en.lua +++ b/parts/language/dict_en.lua @@ -554,7 +554,7 @@ return{ {"His generator", "history hisgenerator", "term", - "A way to generate pieces, notably used in Tetris: The Grand Master games. Every time a random Tetrimino is selected, but if this Tetrimino is the same as one of the few previous pieces, then reroll until a different piece is rolled or until a reroll limit is reached.\nFor example, a \"his 4 roll 6\" (h4r6) generator rerolls when the piece is the same as one of the 4 previous pieces, and rerolls up to 6 times.", + "A way to generate pieces, notably used in Tetris: The Grand Master games. Every time a random Tetrimino is selected, but if this Tetrimino is the same as one of the few previous pieces, then reroll until a different piece is rolled or until a reroll limit is reached.\nFor example, a \"his 4 roll 6\" (h4r6) generator rerolls when the piece is the same as one of the 4 previous pieces, and rerolls up to 6 times.",--TODO }, {"Hypertapping", "hypertapping", diff --git a/parts/language/dict_zh.lua b/parts/language/dict_zh.lua index c457464a..cb0a96ea 100644 --- a/parts/language/dict_zh.lua +++ b/parts/language/dict_zh.lua @@ -489,7 +489,7 @@ return{ {"C4W", "连击 ·c4w center4wide", "term", - "Center 4 Wide\n中间空四列,一种连击打法,能打出很高的连击,利用了大多数专业对战方块游戏的死亡判定机制,可以放心堆高不担心被顶死,然后开始连击。是一种利用游戏机制的不平衡策略(尤其在开局时),观赏性不是很强还可以以弱胜强,成本太低所以成为了部分游戏中约定的类似 禁招 的东西,请在了解情况后再使用,不然可能会被别人骂。\n\n本游戏里考虑到了平衡问题,所以c4w的强度没有别的游戏那么夸张。", + "Center 4 Wide\n中间空四列,一种连击打法,能打出很高的连击,利用了大多数专业对战方块游戏的死亡判定机制,可以放心堆高不担心被顶死,然后开始连击。是一种利用游戏机制的不平衡策略(尤其在开局时),观赏性不是很强还可以以弱胜强,成本太低所以成为了部分游戏中约定的类似 禁招 的东西,请在了解情况后再使用,不然可能会被别人骂。\n本游戏里考虑到了平衡问题,所以c4w的强度没有别的游戏那么夸张。", }, {"N-res", "连击 ·residual c4w s4w", @@ -564,7 +564,7 @@ return{ {"His出块", "his出块 history", "term", - "一种出块方式,例如his 4 roll 6 (h4r6) 就是在随机生成新的next的时候,随机一个跟最后4次生成的next中有一样的,就重新随机,直到已经尝试6次或和那4个都不一样。", + "一种出块方式,例如his4 roll6 (h4r6) 就是在随机生成新的next的时候,随机一个跟最后4次生成的next中有一样的,就重新随机,直到已经尝试6次或和那4个都不一样。另有拓展算法his4 roll6 pool35等更复杂的算法,能让序列更稳定,更接近bag。\n本游戏的his序列模式中最大roll次数为序列长度的一半(向上取整)", }, {"Hypertap", "超连点 hypertap", From 152e248a158e525774e5aa3c5bf73c0b37999286 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Fri, 7 May 2021 01:00:30 +0800 Subject: [PATCH 32/45] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E7=89=88=E6=9D=83?= =?UTF-8?q?=E6=97=B6=E9=97=B4=EF=BC=8C=E7=94=A8=E6=88=B7=E7=8E=AF=E5=A2=83?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E4=B8=80=E4=B8=AA=E8=8E=B7=E5=8F=96=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E7=9A=84=E5=87=BD=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/scenes/app_console.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/parts/scenes/app_console.lua b/parts/scenes/app_console.lua index c3ee82ad..05eeee92 100644 --- a/parts/scenes/app_console.lua +++ b/parts/scenes/app_console.lua @@ -8,7 +8,7 @@ local outputBox=WIDGET.newTextBox{name="output",x=40,y=30,w=1200,h=610,font=25,l local function log(str)outputBox:push(str)end log{C.lP,"Techmino Console"} -log{C.lC,"©2020 26F Studio some rights reserved"} +log{C.lC,"©2021 26F Studio some rights reserved"} log{C.dR,"DO NOT RUN ANY CODE YOU DON'T UNDERSTAND"} local history,hisPtr={"?"} @@ -623,6 +623,8 @@ local function log_user(str) log(noLog and"CHEATER."or tostring(str)) end local userG={ + timer=TIME, + _VERSION=VERSION.code, assert=assert,error=error, tonumber=tonumber,tostring=tostring, From 6a335d9c312ebefc79bfb993443a62e7e7a2a28e Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Fri, 7 May 2021 02:31:57 +0800 Subject: [PATCH 33/45] =?UTF-8?q?=E6=96=B0=E5=A2=9EhisPool=E5=87=BA?= =?UTF-8?q?=E5=9D=97=E7=AE=97=E6=B3=95=EF=BC=8C=E5=BE=AE=E8=B0=83his?= =?UTF-8?q?=E5=87=BA=E5=9D=97=E7=AE=97=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/globalTables.lua | 2 +- parts/modes/master_extra.lua | 1 + parts/modes/master_phantasm.lua | 2 +- parts/player/seqGenerators.lua | 76 +++++++++++++++++++++++++++----- parts/scenes/custom_sequence.lua | 3 +- 5 files changed, 70 insertions(+), 14 deletions(-) diff --git a/parts/globalTables.lua b/parts/globalTables.lua index b865009c..a8d3c480 100644 --- a/parts/globalTables.lua +++ b/parts/globalTables.lua @@ -119,7 +119,7 @@ MODOPT={--Mod options }, {no=19,id="CS",name="customSeq", key="b",x=680,y=470,color='B', - list={'bag','his4','c2','rnd','mess','reverb'}, + list={'bag','his','hisPool','c2','rnd','mess','reverb'}, func=function(P,O)P.gameEnv.sequence=O end, unranked=true, }, diff --git a/parts/modes/master_extra.lua b/parts/modes/master_extra.lua index 302c655d..0ef3c34d 100644 --- a/parts/modes/master_extra.lua +++ b/parts/modes/master_extra.lua @@ -19,6 +19,7 @@ return{ drop=0,lock=15, wait=15,fall=6, nextCount=3, + sequence='hisPool', visible='fast', freshLimit=15, dropPiece=score, diff --git a/parts/modes/master_phantasm.lua b/parts/modes/master_phantasm.lua index d427a4f3..ea0b30e7 100644 --- a/parts/modes/master_phantasm.lua +++ b/parts/modes/master_phantasm.lua @@ -8,7 +8,7 @@ return{ drop=0,lock=15, wait=10,fall=10, nextCount=2, - sequence='his4', + sequence='his', task=function(P)P.modeData.target=12 end, dropPiece=function(P) local p=P.modeData.pt+P.lastPiece.row diff --git a/parts/player/seqGenerators.lua b/parts/player/seqGenerators.lua index d52a68c2..7e272907 100644 --- a/parts/player/seqGenerators.lua +++ b/parts/player/seqGenerators.lua @@ -1,4 +1,5 @@ local ins,rem=table.insert,table.remove +local ceil=math.ceil local yield=YIELD local seqGenerators={ @@ -18,20 +19,75 @@ local seqGenerators={ yield() end end, - his4=function(P,seq0) + his=function(P,seq0) local len=#seq0 - local his={0,0,0,0} + local hisLen=ceil(len*.5) + local history=TABLE.new(0,hisLen) while true do while #P.nextQueue<6 do - for n=1,4 do - local j,i=0 - repeat - i=P:RND(len) - j=j+1 - until i~=his[1]and i~=his[2]and i~=his[3]and i~=his[4]or j==4 - his[n]=seq0[i] - P:getNext(i) + local r + for _=1,hisLen do--Reroll up to [hisLen] times + r=P:RND(len) + for i=1,hisLen do + if r==history[i]then + goto CONTINUE_rollAgain + end + end + do break end + ::CONTINUE_rollAgain:: end + if history[1]~=0 then P:getNext(r)end + rem(history,1)ins(history,r) + end + yield() + end + end, + hisPool=function(P,seq0) + local len=#seq0 + local hisLen=ceil(len*.5) + local poolLen=5*len + + local history=TABLE.new(0,hisLen)--Indexes of pool + local droughtTimes=TABLE.new(len,len)--Drought times of seq0 + local pool={}for i=1,len do for _=1,5 do ins(pool,i)end end--5 times indexes of seq0 + + while true do + while #P.nextQueue<6 do + --Roll mino + local r--Random index of pool + for _=1,hisLen do + r=P:RND(poolLen) + for i=1,hisLen do + if pool[r]==history[i]then + goto CONTINUE_rollAgain + end + end + do break end + ::CONTINUE_rollAgain:: + end + + --Give mino to player & update history + if history[1]~=0 then P:getNext(seq0[pool[r]])end + rem(history,1)ins(history,pool[r]) + + --Find droughtest(s) minoes + local droughtList={1}--Droughtst minoes' indexes of seq0 + local maxTime=droughtTimes[1] + for i=2,len do + if droughtTimes[i]>maxTime then + maxTime=droughtTimes[i] + if #droughtList==1 then droughtList[1]=i else droughtList={i}end + elseif droughtTimes[i]==maxTime then + ins(droughtList,i) + end + end + + --Update droughtTimes + for i=1,len do droughtTimes[i]=droughtTimes[i]+1 end + droughtTimes[pool[r]]=0 + + --Update pool + pool[r]=droughtList[P:RND(#droughtList)] end yield() end diff --git a/parts/scenes/custom_sequence.lua b/parts/scenes/custom_sequence.lua index c16dfd60..6b9f21ec 100644 --- a/parts/scenes/custom_sequence.lua +++ b/parts/scenes/custom_sequence.lua @@ -3,7 +3,6 @@ local kb=love.keyboard local sin=math.sin local ins,rem=table.insert,table.remove -local sub=string.sub local scene={} @@ -194,7 +193,7 @@ scene.widgetList={ WIDGET.newText{name="subTitle",x=530,y=50,font=35,align='L',color='H'}, WIDGET.newSelector{name="sequence",x=1080,y=60,w=200,color='Y', - list={'bag','his4','c2','rnd','mess','reverb','loop','fixed'}, + list={'bag','his','hisPool','c2','rnd','mess','reverb','loop','fixed'}, disp=CUSval("sequence"), code=CUSsto("sequence") }, From 177edbf7d63b1edf82d9b292e2aeb1e535b7c813 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Fri, 7 May 2021 02:37:28 +0800 Subject: [PATCH 34/45] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=8E=A9=E5=AE=B6?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E7=9A=84=E9=87=8D=E5=A4=A7=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/modes/netBattle.lua | 4 ++-- parts/netPlayer.lua | 21 ++++++--------------- parts/player/init.lua | 12 ++++++------ parts/scenes/net_game.lua | 10 +++++----- 4 files changed, 19 insertions(+), 28 deletions(-) diff --git a/parts/modes/netBattle.lua b/parts/modes/netBattle.lua index 022d1976..ba8f2da5 100644 --- a/parts/modes/netBattle.lua +++ b/parts/modes/netBattle.lua @@ -10,9 +10,9 @@ return{ }, load=function() PLY.newPlayer(1) - PLAYERS[1].sid=netPLY.getSID(1) + PLAYERS[1].sid=netPLY.getSID(USER.uid) for i=2,netPLY.getCount()do - PLY.newRemotePlayer(i,false,netPLY.getUID(i)) + PLY.newRemotePlayer(i,false,netPLY.getPLY(i)) end end, } \ No newline at end of file diff --git a/parts/netPlayer.lua b/parts/netPlayer.lua index feb7d316..8f77a3bc 100644 --- a/parts/netPlayer.lua +++ b/parts/netPlayer.lua @@ -85,9 +85,7 @@ local function freshPosList() end end -function netPLY.clear() - while PLY[1]do rem(PLY)end -end +function netPLY.clear()for _=1,netPLY.getCount()do rem(PLY)end end function netPLY.add(p) ins(PLY,p.uid==USER.uid and 1 or #PLY+1,p) p.x,p.y,p.w,p.h=2600,2600,0,0 @@ -104,20 +102,13 @@ function netPLY.remove(sid) end function netPLY.getCount()return #PLY end -function netPLY.getUID(i)return PLY[i].uid end +function netPLY.getPLY(i)return PLY[i]end function netPLY.getUsername(uid)return PLY[uid].username end -function netPLY.getSID(i)return PLY[i].sid end -function netPLY.getReady(i)return PLY[i].ready end -function netPLY.getConfig(i)return PLY[i].config end +function netPLY.getSID(uid)return PLY[uid].sid end +function netPLY.getSelfReady()return PLY[1].ready end -function netPLY.setPlayerObj(uid,p) - PLY[uid].p=p -end -function netPLY.setConf(uid,config) - if tostring(USER.uid)~=uid then - PLY[uid].config=config - end -end +function netPLY.setPlayerObj(ply,p) ply.p=p end +function netPLY.setConf(uid,config)PLY[uid].config=config end function netPLY.setReady(uid,ready) for i,p in next,PLY do if p.uid==uid then diff --git a/parts/player/init.lua b/parts/player/init.lua index d0114c45..dcb2e3a5 100644 --- a/parts/player/init.lua +++ b/parts/player/init.lua @@ -373,7 +373,7 @@ function PLY.newDemoPlayer(id) } P:popNext() end -function PLY.newRemotePlayer(id,mini,uid) +function PLY.newRemotePlayer(id,mini,ply) local P=newEmptyPlayer(id,mini) P.type='remote' P.update=PLY.update.remote_alive @@ -383,11 +383,11 @@ function PLY.newRemotePlayer(id,mini,uid) P.stream={} P.streamProgress=1 - netPLY.setPlayerObj(uid,P) - P.uid=uid - P.username=netPLY.getUsername(uid) - P.sid=netPLY.getSID(uid) - loadRemoteEnv(P,netPLY.getConfig(uid)) + netPLY.setPlayerObj(ply,P) + P.uid=ply.uid + P.username=ply.username + P.sid=ply.sid + loadRemoteEnv(P,ply.config) applyGameEnv(P) end diff --git a/parts/scenes/net_game.lua b/parts/scenes/net_game.lua index 85b1cf21..c2c58c34 100644 --- a/parts/scenes/net_game.lua +++ b/parts/scenes/net_game.lua @@ -95,9 +95,9 @@ function scene.keyDown(key) end else if key=="space"then - NET.signal_ready(not netPLY.getReady(1)) + NET.signal_ready(not netPLY.getSelfReady()) elseif key=="s"then - if not(netPLY.getReady(1)or NET.getlock('ready'))then + if not(netPLY.getSelfReady()or NET.getlock('ready'))then SCN.go('setting_game') end end @@ -276,13 +276,13 @@ function scene.draw() end scene.widgetList={ textBox, - WIDGET.newKey{name="setting",fText=TEXTURE.setting,x=1200,y=160,w=90,h=90,code=pressKey"s",hide=function()return playing or netPLY.getReady(1)or NET.getlock('ready')end}, + WIDGET.newKey{name="setting",fText=TEXTURE.setting,x=1200,y=160,w=90,h=90,code=pressKey"s",hide=function()return playing or netPLY.getSelfReady()or NET.getlock('ready')end}, WIDGET.newKey{name="ready",x=1060,y=630,w=300,h=80,color='lB',font=40,code=pressKey"space", hide=function() return playing or NET.serverGaming or - netPLY.getReady(1)or + netPLY.getSelfReady()or NET.getlock('ready') end}, WIDGET.newKey{name="cancel",x=1060,y=630,w=300,h=80,color='H',font=40,code=pressKey"space", @@ -290,7 +290,7 @@ scene.widgetList={ return playing or NET.serverGaming or - not netPLY.getReady(1)or + not netPLY.getSelfReady()or NET.getlock('ready') end}, WIDGET.newKey{name="hideChat",fText="...",x=380,y=35,w=60,font=35,code=pressKey"\\"}, From b11e5e12d390048822e66349c8c910c0f474c9fd Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Fri, 7 May 2021 02:41:53 +0800 Subject: [PATCH 35/45] =?UTF-8?q?=E7=8E=A9=E5=AE=B6=E4=BC=9A=E4=BB=8E?= =?UTF-8?q?=E5=90=84=E4=B8=AA=E6=96=B9=E5=90=91=E5=87=BA=E7=8E=B0=E5=B9=B6?= =?UTF-8?q?=E4=B8=94=E5=88=9D=E5=A7=8B=E9=AB=98=E5=BA=A6=E8=AE=BE=E4=B8=BA?= =?UTF-8?q?=E4=B8=B4=E7=95=8C=E5=80=BC=EF=BC=8C=E8=BF=9B=E6=88=BF=E6=97=B6?= =?UTF-8?q?=E4=B8=8D=E4=BC=9A=E7=9C=8B=E5=88=B0=E5=AD=97=E5=8F=B7=E5=8F=98?= =?UTF-8?q?=E5=8C=96=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/netPlayer.lua | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/parts/netPlayer.lua b/parts/netPlayer.lua index 8f77a3bc..f1f05b09 100644 --- a/parts/netPlayer.lua +++ b/parts/netPlayer.lua @@ -1,5 +1,7 @@ local gc=love.graphics -local max,min=math.max,math.min +local rnd,min=math.random,math.min +local sin,cos=math.sin,math.cos + local ins,rem=table.insert,table.remove @@ -88,7 +90,8 @@ end function netPLY.clear()for _=1,netPLY.getCount()do rem(PLY)end end function netPLY.add(p) ins(PLY,p.uid==USER.uid and 1 or #PLY+1,p) - p.x,p.y,p.w,p.h=2600,2600,0,0 + local a=rnd()*6.2832 + p.x,p.y,p.w,p.h=640+2600*cos(a),360+2600*sin(a),47,47 freshPosList() end function netPLY.remove(sid) From b4be31361ef756064210051229367917b24cb0dd Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sat, 8 May 2021 13:14:01 +0800 Subject: [PATCH 36/45] =?UTF-8?q?=E4=BF=AE=E6=AD=A3hisPool=E5=BA=8F?= =?UTF-8?q?=E5=88=97=E7=94=9F=E6=88=90=E7=AE=97=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/player/seqGenerators.lua | 78 ++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 33 deletions(-) diff --git a/parts/player/seqGenerators.lua b/parts/player/seqGenerators.lua index 7e272907..21524ad4 100644 --- a/parts/player/seqGenerators.lua +++ b/parts/player/seqGenerators.lua @@ -45,49 +45,61 @@ local seqGenerators={ hisPool=function(P,seq0) local len=#seq0 local hisLen=ceil(len*.5) - local poolLen=5*len + local history=TABLE.new(0,hisLen)--Indexes of mino-index - local history=TABLE.new(0,hisLen)--Indexes of pool + local poolLen=5*len local droughtTimes=TABLE.new(len,len)--Drought times of seq0 local pool={}for i=1,len do for _=1,5 do ins(pool,i)end end--5 times indexes of seq0 + local function poolPick() + local r=P:RND(poolLen) + local res=pool[r] + + --Find droughtest(s) minoes + local droughtList={1}--Droughtst minoes' indexes of seq0 + local maxTime=droughtTimes[1] + for i=2,len do + if droughtTimes[i]>maxTime then + maxTime=droughtTimes[i] + if #droughtList==1 then droughtList[1]=i else droughtList={i}end + elseif droughtTimes[i]==maxTime then + ins(droughtList,i) + end + end + + --Update droughtTimes + for i=1,len do droughtTimes[i]=droughtTimes[i]+1 end + droughtTimes[res]=0 + + --Update pool + -- print("Rem "..res) + pool[r]=droughtList[P:RND(#droughtList)] + -- print("Add "..pool[r]) + + return res + end while true do while #P.nextQueue<6 do - --Roll mino - local r--Random index of pool - for _=1,hisLen do - r=P:RND(poolLen) - for i=1,hisLen do - if pool[r]==history[i]then - goto CONTINUE_rollAgain - end + -- print"======================" + --Pick a mino from pool + local tryTime=0 + ::REPEAT_pickAgain:: + local r=poolPick()--Random mino-index in pool + for i=1,len do + if r==history[i]then + tryTime=tryTime+1 + if tryTimemaxTime then - maxTime=droughtTimes[i] - if #droughtList==1 then droughtList[1]=i else droughtList={i}end - elseif droughtTimes[i]==maxTime then - ins(droughtList,i) - end - end - - --Update droughtTimes - for i=1,len do droughtTimes[i]=droughtTimes[i]+1 end - droughtTimes[pool[r]]=0 - - --Update pool - pool[r]=droughtList[P:RND(#droughtList)] + if history[1]~=0 then P:getNext(seq0[r])end + rem(history,1)ins(history,r) + -- print("Player GET: "..r) + -- print("History: "..table.concat(history,",")) + -- local L={"","","","","","","",} + -- for _,v in next,pool do L[v]=L[v].."+"end + -- for i=1,#L do print(i,droughtTimes[i],L[i])end end yield() end From 46b3ad8a707c5b06fbd4a79f5afed273d22c5804 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 9 May 2021 02:26:03 +0800 Subject: [PATCH 37/45] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E4=BF=AE=E5=A4=8D=E6=88=BF=E9=97=B4=E9=87=8C=E7=9A=84?= =?UTF-8?q?=E5=90=84=E5=B0=B1=E5=90=84=E4=BD=8D/=E9=A2=84=E5=A4=87?= =?UTF-8?q?=E6=A0=87=E8=AE=B0=E6=98=BE=E7=A4=BA=E6=97=B6=E6=9C=BA=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/net.lua | 17 ++++++++--------- parts/scenes/net_game.lua | 12 ++++++------ parts/scenes/net_rooms.lua | 2 ++ 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/parts/net.lua b/parts/net.lua index de4943ad..1a468f09 100644 --- a/parts/net.lua +++ b/parts/net.lua @@ -16,8 +16,8 @@ local NET={ capacity=false, }, allReady=false, - streamRoomID=false, connectingStream=false, + streamRoomID=false, serverGaming=false, } @@ -389,12 +389,11 @@ function NET.updateWS_play() ready=d.ready, config=d.config, } - if SCN.socketRead then SCN.socketRead('Join',d)end + if SCN.socketRead then SCN.socketRead('join',d)end NET.allReady=false end elseif res.action==3 then--Player leave if not d.uid then - NET.allReady=false NET.wsclose_stream() NET.unlock('quit') SCN.back() @@ -412,10 +411,10 @@ function NET.updateWS_play() break end end - if SCN.socketRead then SCN.socketRead('Leave',d)end + if SCN.socketRead then SCN.socketRead('leave',d)end end elseif res.action==4 then--Player talk - if SCN.socketRead then SCN.socketRead('Talk',d)end + if SCN.socketRead then SCN.socketRead('talk',d)end elseif res.action==5 then--Player change settings netPLY.setConf(d.uid,d.config) elseif res.action==6 then--One ready @@ -425,12 +424,12 @@ function NET.updateWS_play() NET.allReady=true elseif res.action==8 then--Set NET.streamRoomID=d.rid + NET.allReady=false NET.connectingStream=true NET.wsconn_stream() elseif res.action==9 then--Game finished - NET.allReady=false NET.wsclose_stream() - if SCN.socketRead then SCN.socketRead('Finish',d)end + if SCN.socketRead then SCN.socketRead('finish',d)end end else WS.alert('play') @@ -460,7 +459,7 @@ function NET.updateWS_stream() NET.unlock('wsc_stream') elseif res.action==0 then--Game start NET.connectingStream=false - SCN.socketRead('Go',d) + SCN.socketRead('go',d) elseif res.action==1 then--Game finished --? elseif res.action==2 then--Player join @@ -475,7 +474,7 @@ function NET.updateWS_stream() end end elseif res.action==5 then--Receive stream - SCN.socketRead('Stream',d) + SCN.socketRead('stream',d) end else WS.alert('stream') diff --git a/parts/scenes/net_game.lua b/parts/scenes/net_game.lua index c2c58c34..a810a5e6 100644 --- a/parts/scenes/net_game.lua +++ b/parts/scenes/net_game.lua @@ -136,26 +136,26 @@ function scene.gamepadUp(key) end function scene.socketRead(cmd,d) - if cmd=="Join"then + if cmd=='join'then textBox:push{ COLOR.lR,d.username, COLOR.dY,"#"..d.uid.." ", COLOR.Y,text.joinRoom, } SFX.play('click') - elseif cmd=="Leave"then + elseif cmd=='leave'then textBox:push{ COLOR.lR,d.username, COLOR.dY,"#"..d.uid.." ", COLOR.Y,text.leaveRoom, } - elseif cmd=="Talk"then + elseif cmd=='talk'then textBox:push{ COLOR.Z,d.username, COLOR.dY,"#"..d.uid.." ", COLOR.N,d.message or"[_]", } - elseif cmd=="Go"then + elseif cmd=='go'then if not playing then playing=true netPLY.resetReady() @@ -166,7 +166,7 @@ function scene.socketRead(cmd,d) else LOG.print("Redundant [Go]",30,COLOR.G) end - elseif cmd=="Finish"then + elseif cmd=='finish'then playing=false local winnerUID for _,p in next,d.result do @@ -178,7 +178,7 @@ function scene.socketRead(cmd,d) if winnerUID then TEXT.show(text.champion:gsub("$1",netPLY.getUsername(winnerUID)),640,260,80,'zoomout',.26) end - elseif cmd=="Stream"then + elseif cmd=='stream'then if d.uid~=USER.uid and playing then for _,P in next,PLAYERS do if P.uid==d.uid then diff --git a/parts/scenes/net_rooms.lua b/parts/scenes/net_rooms.lua index 0410b7fa..0e492261 100644 --- a/parts/scenes/net_rooms.lua +++ b/parts/scenes/net_rooms.lua @@ -17,6 +17,8 @@ local scene={} function scene.sceneInit() BG.set() + NET.allReady=false + NET.connectingStream=false scrollPos=0 selected=1 fetchRoom() From 0886bfe8f9431ad1ed193b015dc600b6103e039f Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 9 May 2021 15:29:09 +0800 Subject: [PATCH 38/45] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=89=B9=E6=AE=8A?= =?UTF-8?q?=E6=83=85=E5=86=B5=E4=B8=8B=E5=B0=9D=E8=AF=95=E6=98=BE=E7=A4=BA?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E5=A4=B4=E5=83=8F=E6=97=B6=E4=BC=9A=E6=8A=A5?= =?UTF-8?q?=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/users.lua | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/parts/users.lua b/parts/users.lua index bfc23475..50c2436c 100644 --- a/parts/users.lua +++ b/parts/users.lua @@ -29,10 +29,7 @@ end local db_img={} local db=setmetatable({},{__index=function(self,uid) - if not uid then - db_img[uid]=defaultAvatar[1] - return emptyUser - end + if not uid then return emptyUser end local file="cache/user"..uid..".dat" local d=fs.getInfo(file)and JSON.decode(fs.read(file))or TABLE.copy(emptyUser) rawset(self,uid,d) @@ -65,11 +62,15 @@ function USERS.getUsername(uid)return db[uid].username end function USERS.getMotto(uid)return db[uid].motto end function USERS.getHash(uid)return db[uid].hash end function USERS.getAvatar(uid) - if not db[uid].new then - NET.getUserInfo(uid) - db[uid].new=true + if uid then + if not db[uid].new then + NET.getUserInfo(uid) + db[uid].new=true + end + return db_img[uid] + else + return defaultAvatar[1] end - return db_img[uid] end function USERS.forceFreshAvatar() for _,U in next,db do From de7f1b92f6fafbd79608a4e5d677f2966826457f Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 9 May 2021 17:24:46 +0800 Subject: [PATCH 39/45] =?UTF-8?q?=E5=A2=9E=E5=88=A0=E4=B8=AD=E6=96=87tips?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/language/lang_zh.lua | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/parts/language/lang_zh.lua b/parts/language/lang_zh.lua index 47fdc557..bb5f0915 100644 --- a/parts/language/lang_zh.lua +++ b/parts/language/lang_zh.lua @@ -790,7 +790,7 @@ return{ "3.1415926535897932384 ? ? ?", "3next 1hold?", "40行世界纪录:15.654s by VinceHD", - "626r/s", + "6236326236327175", "6next 1hold!", "6next 6hold?!", "7宽三SZ架空捐了解一下", @@ -882,18 +882,6 @@ return{ "魔方也是方块(确信", "你的双手是为了你的一生服务的,而不是Techmino", "你今天的人品值是:"..math.random(100), - "你今天的人品值是:0.22", - "你今天的人品值是:0.26", - "你今天的人品值是:12.7", - "你今天的人品值是:2.6", - "你今天的人品值是:22", - "你今天的人品值是:26", - "你今天的人品值是:28.3", - "你今天的人品值是:6.26", - "你今天的人品值是:6.26", - "你今天的人品值是:62.6", - "你今天的人品值是:87.2", - "你今天的人品值是:9999%", "你可以从统计页面打开游戏存档目录", "你们考虑过Z酱的感受吗?没有!你们只考虑你自己。", "你说彩蛋?嗯…算是有,可以找找", @@ -909,6 +897,7 @@ return{ "群友翻译的中文方块百科全书! tetris.huijiwiki.com", "让他三尺又何妨", "如果打开简洁模式那这个菜单就没有彩蛋了", + "如何O-spin: 一秒转626圈(误", "三连块只有2种", "三岁通关困难马拉松", "上面这个不是录像,是机器人实时在玩", @@ -929,11 +918,13 @@ return{ "为了保护玩家们的健康,本游戏有一个临时的简易防沉迷系统!(不过估计你也触发不了/笑)", "为什么关卡那么少!因为前一模式成绩连D都没达到,再加把劲吧~", "我曾经在极度愤怒的时候15秒消了40行", + "我们联合!", "我们是不是第一个在方块游戏做tip的?", "我是一条凑数tip", "我也不知道分数有啥用应该只是好看的,建议别管他,只看关卡要求你做啥", "我也是一条凑数tip", "我一个滑铲就挖了个11renPC", + "我永远喜…", "无聊翻翻设置是好习惯", "五连块总共18种", "物理hold了解一下", From db53da509d46de35e0b69d7fdeba8747a0fb58dd Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 9 May 2021 19:22:11 +0800 Subject: [PATCH 40/45] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8CgameOver=E5=87=BD=E6=95=B0=E6=94=BE=E5=85=A5gameToolFu?= =?UTF-8?q?nc=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/gametoolfunc.lua | 59 ++++++++++++++++++++++++++++++++++++++- parts/player/player.lua | 62 +++-------------------------------------- 2 files changed, 62 insertions(+), 59 deletions(-) diff --git a/parts/gametoolfunc.lua b/parts/gametoolfunc.lua index de15ecee..9dda328c 100644 --- a/parts/gametoolfunc.lua +++ b/parts/gametoolfunc.lua @@ -1,5 +1,5 @@ local gc=love.graphics -local rem=table.remove +local ins,rem=table.insert,table.remove @@ -234,6 +234,63 @@ function loadGame(M,ifQuickPlay,ifNet)--Load a mode and go to game scene end end end +function gameOver()--Save record + if GAME.replaying then return end + FILE.save(STAT,'conf/data') + local M=GAME.curMode + local R=M.getRank + if R then + local P=PLAYERS[1] + R=R(P)--New rank + if R then + if R>0 then + GAME.rank=R + end + if scoreValid()and M.score then + if RANKS[M.name]then--Old rank exist + local needSave + if R>RANKS[M.name]then + RANKS[M.name]=R + needSave=true + end + if R>0 then + if M.unlock then + for i=1,#M.unlock do + local m=M.unlock[i] + local n=MODES[m].name + if not RANKS[n]then + RANKS[n]=MODES[m].getRank and 0 or 6 + needSave=true + end + end + end + end + if needSave then + FILE.save(RANKS,'conf/unlock','q') + end + end + local D=M.score(P) + local L=M.records + local p=#L--Rank-1 + if p>0 then + while M.comp(D,L[p])do--If higher rank + p=p-1 + if p==0 then break end + end + end + if p<10 then + if p==0 then + P:showTextF(text.newRecord,0,-100,100,'beat',.5) + end + D.date=os.date("%Y/%m/%d %H:%M") + ins(L,p+1,D) + if L[11]then L[11]=nil end + FILE.save(L,('record/%s.rec'):format(M.name),'lq') + end + end + end + end +end function initPlayerPosition(sudden)--Set initial position for every player local L=PLY_ALIVE if not sudden then diff --git a/parts/player/player.lua b/parts/player/player.lua index 29d2944b..0876bf19 100644 --- a/parts/player/player.lua +++ b/parts/player/player.lua @@ -7,6 +7,10 @@ local int,ceil,rnd=math.floor,math.ceil,math.random local max,min,modf=math.max,math.min,math.modf local ins,rem=table.insert,table.remove local resume,yield,status=coroutine.resume,coroutine.yield,coroutine.status +local SFX,BGM,VOC,VIB,SYSFX,SKIN=SFX,BGM,VOC,VIB,SYSFX,SKIN +local FREEROW,TABLE,TEXT,NET,TASK=FREEROW,TABLE,TEXT,NET,TASK +local PLAYERS,PLY_ALIVE,GAME=PLAYERS,PLY_ALIVE,GAME + local kickList=require"parts.kickList" @@ -1607,64 +1611,6 @@ end ---------------------------------------------------- ---------------------------------------------------- -local function gameOver()--Save record - if GAME.replaying then return end - FILE.save(STAT,'conf/data') - local M=GAME.curMode - local R=M.getRank - if R then - local P=PLAYERS[1] - R=R(P)--New rank - if R then - if R>0 then - GAME.rank=R - end - if scoreValid()and M.score then - if RANKS[M.name]then--Old rank exist - local needSave - if R>RANKS[M.name]then - RANKS[M.name]=R - needSave=true - end - if R>0 then - if M.unlock then - for i=1,#M.unlock do - local m=M.unlock[i] - local n=MODES[m].name - if not RANKS[n]then - RANKS[n]=MODES[m].getRank and 0 or 6 - needSave=true - end - end - end - end - if needSave then - FILE.save(RANKS,'conf/unlock','q') - end - end - local D=M.score(P) - local L=M.records - local p=#L--Rank-1 - if p>0 then - while M.comp(D,L[p])do--If higher rank - p=p-1 - if p==0 then break end - end - end - if p<10 then - if p==0 then - P:showTextF(text.newRecord,0,-100,100,'beat',.5) - end - D.date=os.date("%Y/%m/%d %H:%M") - ins(L,p+1,D) - if L[11]then L[11]=nil end - FILE.save(L,('record/%s.rec'):format(M.name),'lq') - end - end - end - end -end - function Player:die()--Called both when win/lose! self.alive=false self.timing=false From e44964696ab86b70d8e2ca6feac4e76b01d9e370 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 9 May 2021 19:56:46 +0800 Subject: [PATCH 41/45] =?UTF-8?q?=E8=AE=A2=E6=AD=A3=E5=B0=8F=E9=97=AE?= =?UTF-8?q?=E9=A2=98=EF=BC=8Cren=E5=91=BD=E4=BB=A4=E6=94=B9=E5=90=8Dmv?= =?UTF-8?q?=EF=BC=88ren=E4=BB=8D=E5=8F=AF=E7=94=A8=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/scenes/app_console.lua | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/parts/scenes/app_console.lua b/parts/scenes/app_console.lua index 05eeee92..f362ff9a 100644 --- a/parts/scenes/app_console.lua +++ b/parts/scenes/app_console.lua @@ -36,8 +36,7 @@ do--commands.help(arg) "help", "help [command_name]", }, - }, - ["?"]="help", + },["?"]="help", ["#"]={ description="Run arbitrary Lua code.", details={ @@ -95,21 +94,23 @@ do--commands.help(arg) details={ "Attempt to delete a file or directory (in saving directory)", "", - "Aliases: rm", + "Aliases: del rm", "", "Usage: del [filename|dirname]", "Usage: del -s [dirname]", }, },rm="del", - ren={ - description="Rename a file (in saving directory)", + mv={ + description="Rename or move a file (in saving directory)", details={ - "Rename a file (in saving directory)", + "Rename or move a file (in saving directory)", {C.lY,"Warning: file name with space is not allowed"}, "", - "Usage: ren [oldfilename] [newfilename]", + "Aliases: mv ren", + "", + "Usage: mv [oldfilename] [newfilename]", }, - }, + },ren="mv", cls={ description="Clear the log output.", details={ @@ -236,7 +237,7 @@ do--commands.help(arg) "applet -list", "applet [appName]", }, - }, + },app="applet", }TABLE.reIndex(command_help_messages) local command_help_list={ @@ -248,7 +249,7 @@ do--commands.help(arg) "url", "tree", "del", - "ren", + "mv", "cls", "rst", "fn", @@ -410,7 +411,7 @@ do--function commands.del(name) end commands.rm=commands.del end -function commands.ren(arg) +function commands.mv(arg) --Check arguments arg=STRING.split(arg," ") if #arg>2 then @@ -441,6 +442,8 @@ function commands.ren(arg) log{C.Y,("Succesfully renamed file '%s' to '%s'"):format(arg[1],arg[2])} end +commands.ren=commands.mv + commands.exit=backScene commands.quit=backScene commands.bye=backScene @@ -770,8 +773,8 @@ function scene.keyDown(k) inputBox.value=res[1] end end - elseif k=="scrollup"then outputBox:scroll(-1) - elseif k=="scrolldown"then outputBox:scroll(1) + elseif k=="scrollup"then outputBox:scroll(-5) + elseif k=="scrolldown"then outputBox:scroll(5) elseif k=="pageup"then outputBox:scroll(-20) elseif k=="pagedown"then outputBox:scroll(20) elseif k=="home"then outputBox:scroll(-1e99) From 7ff13b286e85ab9ad026d873837801009c543174 Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 9 May 2021 21:01:35 +0800 Subject: [PATCH 42/45] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=EF=BC=8C=E5=BE=AE=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/player/init.lua | 26 ++++++++++++-------------- parts/player/player.lua | 10 ++++++---- 2 files changed, 18 insertions(+), 18 deletions(-) diff --git a/parts/player/init.lua b/parts/player/init.lua index dcb2e3a5..7457bd38 100644 --- a/parts/player/init.lua +++ b/parts/player/init.lua @@ -5,10 +5,9 @@ local gameEnv0=require"parts.player.gameEnv0" local rnd,max=math.random,math.max local ins=table.insert -local PLY={ - update=require"parts.player.update", - draw=require"parts.player.draw", -} +local ply_draw=require"parts.player.draw" +local ply_update=require"parts.player.update" +local PLY={draw=ply_draw} ---------------------------------------------------- local modeDataMeta do @@ -87,7 +86,7 @@ local function newEmptyPlayer(id,mini) P.pressKey=pressKey P.releaseKey=releaseKey end - P.update=PLY.update.alive + P.update=ply_update.alive P.fieldOff={--Shake FX x=0,y=0, @@ -107,9 +106,9 @@ local function newEmptyPlayer(id,mini) if mini then P.canvas=love.graphics.newCanvas(60,120) P.frameWait=rnd(26,62) - P.draw=PLY.draw.small + P.draw=ply_draw.small else - P.draw=PLY.draw.norm + P.draw=ply_draw.norm end P.randGen=love.math.newRandomGenerator(GAME.seed) @@ -136,9 +135,9 @@ local function newEmptyPlayer(id,mini) P.atker,P.atking,P.lastRecv={} --Network-related - P.username='_' - P.uid=-1 - P.sid=-1 + P.username="_" + P.uid=false + P.sid=false P.dropDelay,P.lockDelay=0,0 P.showTime=false @@ -357,7 +356,7 @@ function PLY.newDemoPlayer(id) P.demo=true P.frameRun=180 - P.draw=PLY.draw.demo + P.draw=ply_draw.demo P.control=true GAME.modeEnv=DemoEnv loadGameEnv(P) @@ -376,9 +375,9 @@ end function PLY.newRemotePlayer(id,mini,ply) local P=newEmptyPlayer(id,mini) P.type='remote' - P.update=PLY.update.remote_alive + P.update=ply_update.remote_alive - P.draw=PLY.draw.norm_remote + P.draw=ply_draw.norm_remote P.stream={} P.streamProgress=1 @@ -409,7 +408,6 @@ function PLY.newPlayer(id,mini) P.sound=true P.uid=USER.uid - P.sid=-1 loadGameEnv(P) applyGameEnv(P) diff --git a/parts/player/player.lua b/parts/player/player.lua index 0876bf19..680e4631 100644 --- a/parts/player/player.lua +++ b/parts/player/player.lua @@ -7,12 +7,14 @@ local int,ceil,rnd=math.floor,math.ceil,math.random local max,min,modf=math.max,math.min,math.modf local ins,rem=table.insert,table.remove local resume,yield,status=coroutine.resume,coroutine.yield,coroutine.status + local SFX,BGM,VOC,VIB,SYSFX,SKIN=SFX,BGM,VOC,VIB,SYSFX,SKIN local FREEROW,TABLE,TEXT,NET,TASK=FREEROW,TABLE,TEXT,NET,TASK local PLAYERS,PLY_ALIVE,GAME=PLAYERS,PLY_ALIVE,GAME - local kickList=require"parts.kickList" +local ply_draw=require"parts.player.draw" +local ply_update=require"parts.player.update" ---------------------------------------------------- function Player:showText(text,dx,dy,font,style,spd,stop) @@ -199,9 +201,9 @@ function Player:setNext(next,hidden)--Set next count (use hidden=true if set e if next==0 then self.drawNext=NULL elseif not hidden then - self.drawNext=PLY.draw.drawNext_norm + self.drawNext=ply_draw.drawNext_norm else - self.drawNext=PLY.draw.drawNext_hidden + self.drawNext=ply_draw.drawNext_hidden end end function Player:setInvisible(time)--Time in frames @@ -1615,7 +1617,7 @@ function Player:die()--Called both when win/lose! self.alive=false self.timing=false self.control=false - self.update=PLY.update.dead + self.update=ply_update.dead self.waiting=1e99 self.b2b=0 self.tasks={} From 2663e4d62965dffaef467df3e8a151b94774b8df Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 9 May 2021 21:22:39 +0800 Subject: [PATCH 43/45] =?UTF-8?q?=E5=9C=BA=E6=99=AF=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E6=94=AF=E6=8C=81directoryDropped=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework/init.lua | 3 +++ Zframework/scene.lua | 2 ++ 2 files changed, 5 insertions(+) diff --git a/Zframework/init.lua b/Zframework/init.lua index 10b7070a..a50514ae 100644 --- a/Zframework/init.lua +++ b/Zframework/init.lua @@ -329,6 +329,9 @@ function love.receiveData(id,data)end function love.filedropped(file) if SCN.fileDropped then SCN.fileDropped(file)end end +function love.directorydropped(dir) + if SCN.directoryDropped then SCN.directoryDropped(dir)end +end local lastGCtime=0 function love.lowmemory() if TIME()-lastGCtime>6.26 then diff --git a/Zframework/scene.lua b/Zframework/scene.lua index 360123fa..7d03a638 100644 --- a/Zframework/scene.lua +++ b/Zframework/scene.lua @@ -35,6 +35,7 @@ local SCN={ gamepadDown=false, gamepadUp=false, fileDropped=false, + directoryDropped=false, resize=false, socketRead=false, }--Scene datas, returned @@ -81,6 +82,7 @@ function SCN.init(s,org) SCN.gamepadDown=S.gamepadDown SCN.gamepadUp=S.gamepadUp SCN.fileDropped=S.fileDropped + SCN.directoryDropped=S.directoryDropped SCN.resize=S.resize SCN.socketRead=S.socketRead if S.sceneInit then S.sceneInit(org)end From ac546e4f8dac0694b1d12f9371a70c9be26aa57f Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 9 May 2021 21:22:59 +0800 Subject: [PATCH 44/45] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E5=93=8D=E5=BA=94=E6=8B=96=E5=85=A5=E6=96=87?= =?UTF-8?q?=E4=BB=B6/=E6=96=87=E4=BB=B6=E5=A4=B9=E4=BA=8B=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/scenes/test.lua | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/parts/scenes/test.lua b/parts/scenes/test.lua index 77d50694..edeb680a 100644 --- a/parts/scenes/test.lua +++ b/parts/scenes/test.lua @@ -60,6 +60,12 @@ end function scene.wheelMoved(dx,dy) push(("[wheelMoved] <%d, %d>"):format(dx,dy)) end +function scene.fileDropped(file) + push(("[fileDropped] <%s>"):format(file:getFilename())) +end +function scene.directoryDropped(path) + push(("[directoryDropped] <%s>"):format(path)) +end function scene.update(dt) if timer>0 then From 16e7dd71f1aec0a68a673d281e653ee162ab9c5a Mon Sep 17 00:00:00 2001 From: MrZ626 <1046101471@qq.com> Date: Sun, 9 May 2021 21:29:50 +0800 Subject: [PATCH 45/45] =?UTF-8?q?test=E5=9C=BA=E6=99=AF=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- parts/scenes/test.lua | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/parts/scenes/test.lua b/parts/scenes/test.lua index edeb680a..949d3447 100644 --- a/parts/scenes/test.lua +++ b/parts/scenes/test.lua @@ -32,14 +32,19 @@ end function scene.keyUp(key) push{COLOR.H,"[keyUp] <"..key..">"} end +function scene.mouseClick(x,y) + SYSFX.newRipple(.5,x,y,50) + push("[mouseClick]") +end function scene.mouseDown(x,y,k) + SYSFX.newShade(.5,x-10,y-10,20,20) push(("[mouseDown] <%d: %d, %d>"):format(k,x,y)) end function scene.mouseMove(x,y) - SYSFX.newShade(.5,x-3,y-3,7,7) + SYSFX.newShade(.5,x-3,y-3,6,6) end function scene.mouseUp(x,y,k) - SYSFX.newRectRipple(1,x-10,y-10,21,21) + SYSFX.newRectRipple(1,x-10,y-10,20,20) push{COLOR.H,"[mouseUp] <"..k..">"} end function scene.touchClick(x,y) @@ -47,14 +52,14 @@ function scene.touchClick(x,y) push("[touchClick]") end function scene.touchDown(x,y) - SYSFX.newRipple(.5,x,y,50) + SYSFX.newShade(.5,x-10,y-10,20,20) push(("[touchDown] <%d, %d>"):format(x,y)) end function scene.touchMove(x,y) - SYSFX.newRipple(.5,x,y,50) + SYSFX.newShade(.5,x-3,y-3,6,6) end function scene.touchUp(x,y) - SYSFX.newRipple(.5,x,y,50) + SYSFX.newRectRipple(1,x-10,y-10,20,20) push{COLOR.H,"[touchUp]"} end function scene.wheelMoved(dx,dy)