diff --git a/parts/globalTables.lua b/parts/globalTables.lua index 8e49e749..f993de81 100644 --- a/parts/globalTables.lua +++ b/parts/globalTables.lua @@ -205,6 +205,7 @@ ROOMENV={ --Control nextCount=6, + holdMode='hold', holdCount=1, infHold=false, phyHold=false, @@ -249,6 +250,7 @@ SETTING={--Settings dascut=0,dropcut=0, sddas=0,sdarr=2, ihs=true,irs=true,ims=true, + holdMode='hold', RS='TRS', swap=true, FTLock=true, diff --git a/parts/language/lang_en.lua b/parts/language/lang_en.lua index a209e25a..b661944b 100644 --- a/parts/language/lang_en.lua +++ b/parts/language/lang_en.lua @@ -300,6 +300,7 @@ return{ eventSet="Rule Set", + holdMode="Hold Mode", nextCount="Next", holdCount="Hold", infHold="Infinite Hold", @@ -491,6 +492,7 @@ return{ eventSet="Rule Set", + holdMode="Hold Mode", nextCount="Next", holdCount="Hold", infHold="Infinite Hold", diff --git a/parts/language/lang_es.lua b/parts/language/lang_es.lua index 979db053..b2b30ed4 100644 --- a/parts/language/lang_es.lua +++ b/parts/language/lang_es.lua @@ -266,6 +266,7 @@ return{ -- eventSet="Rule Set", + -- holdMode="Hold Mode", nextCount="Siguiente", holdCount="Reserva", infHold="Reserva Inft.", @@ -455,6 +456,7 @@ return{ -- eventSet="Rule Set", + -- holdMode="Hold Mode", nextCount="Siguiente", holdCount="Reserva", infHold="Reserva Inft.", diff --git a/parts/language/lang_fr.lua b/parts/language/lang_fr.lua index 6a73ebed..239b84b5 100644 --- a/parts/language/lang_fr.lua +++ b/parts/language/lang_fr.lua @@ -262,6 +262,7 @@ return{ -- eventSet="Rule Set", + -- holdMode="Hold Mode", nextCount="Prévisualisations de pièces", holdCount="Réserve", infHold="Réserver une fois", @@ -457,6 +458,7 @@ return{ -- eventSet="Rule Set", + -- holdMode="Hold Mode", nextCount="Prévisualisations de pièces", holdCount="Réserve", infHold="Réserver une fois", diff --git a/parts/language/lang_pt.lua b/parts/language/lang_pt.lua index edced8b4..67e41561 100644 --- a/parts/language/lang_pt.lua +++ b/parts/language/lang_pt.lua @@ -288,6 +288,7 @@ return{ -- eventSet="Rule Set", + -- holdMode="Hold Mode", nextCount="Prox.", holdCount="Segurar", infHold="Segurar Infinito", @@ -479,6 +480,7 @@ return{ -- eventSet="Rule Set", + -- holdMode="Hold Mode", nextCount="Prox.", holdCount="Segurar", infHold="Segurar Infinito", diff --git a/parts/language/lang_symbol.lua b/parts/language/lang_symbol.lua index b010be6b..0f15c8c1 100644 --- a/parts/language/lang_symbol.lua +++ b/parts/language/lang_symbol.lua @@ -181,6 +181,7 @@ return{ eventSet="Rule Set", + holdMode="? [ ]", nextCount="→", holdCount="[ ]", infHold="∞*[ ]", @@ -370,6 +371,7 @@ return{ eventSet="Rule Set", + holdMode="? [ ]", nextCount="→", holdCount="[ ]", infHold="∞*[ ]", diff --git a/parts/language/lang_zh.lua b/parts/language/lang_zh.lua index 741b1ede..33f1f33e 100644 --- a/parts/language/lang_zh.lua +++ b/parts/language/lang_zh.lua @@ -300,6 +300,7 @@ return{ eventSet="规则包", + holdMode="Hold模式", nextCount="Next", holdCount="Hold", infHold="无限Hold", @@ -490,6 +491,7 @@ return{ eventSet="规则包", + holdMode="Hold模式", nextCount="Next", holdCount="Hold", infHold="无限Hold", diff --git a/parts/language/lang_zh2.lua b/parts/language/lang_zh2.lua index 9cf783e0..f9dbf857 100644 --- a/parts/language/lang_zh2.lua +++ b/parts/language/lang_zh2.lua @@ -56,6 +56,14 @@ return{ mod={ title="模组", }, + net_newRoom={ + ospin="O旋", + holdMode="暂存模式", + nextCount="预览个数", + holdCount="暂存个数", + infHold="无限暂存", + phyHold="物理暂存", + }, setting_control={ das="首次移动延迟",arr="移动重复延迟", sddas="首次软降延迟",sdarr="软降重复延迟", @@ -67,6 +75,8 @@ return{ customGame={ mod="模组(F1)", + ospin="O旋", + holdMode="暂存模式", nextCount="预览个数", holdCount="暂存个数", infHold="无限暂存", diff --git a/parts/language/lang_zh3.lua b/parts/language/lang_zh3.lua index 14230b22..8c6bd993 100644 --- a/parts/language/lang_zh3.lua +++ b/parts/language/lang_zh3.lua @@ -301,6 +301,7 @@ return{ eventSet="规则集", + holdMode="持有模式", nextCount="下一个", holdCount="持有", infHold="无限持有", @@ -491,6 +492,7 @@ return{ eventSet="规则集", + holdMode="持有模式", nextCount="下一个", holdCount="持有", infHold="无限持有", diff --git a/parts/net.lua b/parts/net.lua index c4ceebb6..604ed3d0 100644 --- a/parts/net.lua +++ b/parts/net.lua @@ -86,7 +86,7 @@ local function _parseNotice(str) str[m:sub(1,m:find("=")-1)]=m:sub(m:find("=")+1) end end - return str[SETTING.locale]or str[1] + return str[SETTING.locale]or str[SETTING.locale:find'zh'and'zh'or'en'] else return str end diff --git a/parts/player/draw.lua b/parts/player/draw.lua index b183edf5..e7b03bdf 100644 --- a/parts/player/draw.lua +++ b/parts/player/draw.lua @@ -386,6 +386,8 @@ local function _drawHold(holdQueue,holdCount,holdTime,skinLib) N=#holdQueue1 and .5 or 0,0,0,.4) + gc_rectangle('fill',0,0,100,N+8,5) + gc_setColor(.97,.97,.97) + if ENV.holdMode=='swap'then gc_rectangle('fill',1,72*ENV.holdCount+2,50,4)end + gc_rectangle('line',0,0,100,N+8,5) + gc_push('transform') + gc_translate(50,40) + + --Draw nexts + gc_setLineWidth(6) + gc_setColor(1,1,1,.2) + gc_setShader(shader_blockSatur) + gc_setColor(1,1,1,.8) + local queue=P.nextQueue + local hiding=true + local startNID=min(ENV.nextStartPos,P.pieceCount+1) + N=1 + while N<=ENV.nextCount and queue[N]do + if hiding and N==startNID then + gc_setColor(1,1,1) + hiding=false + end + if not hiding or repMode then + local bk,sprite=queue[N].bk,texture[queue[N].color] + local k=min(2.3/#bk,3/#bk[1],.85) + gc_scale(k) + for i=1,#bk do for j=1,#bk[1]do + if bk[i][j]then + gc_draw(sprite,30*(j-#bk[1]*.5)-30,-30*(i-#bk*.5)) + end + end end + gc_scale(1/k) + end + if ENV.holdMode=='swap'and N<=ENV.holdCount-P.holdTime then + gc_line(-40,-25,40,25) + end + gc_translate(0,72) + N=N+1 + end + gc_setShader() + + --Draw more nexts + if repMode then + gc_translate(50,-28) + local blockImg=TEXTURE.miniBlock + local skinSet=ENV.skin + local n=N + while n<=12 and queue[n]do + local id=queue[n].id + local _=minoColor[skinSet[id]] + gc_setColor(_[1],_[2],_[3],.2) + _=blockImg[id] + local h=_:getHeight() + gc_draw(_,-_:getWidth()*10,0,nil,10,nil) + gc_translate(0,10*h+3) + n=n+1 + end + end + gc_pop() + + if ENV.bagLine then + gc_setColor(.8,.8,.8,.8) + for i=-P.pieceCount%ENV.bagLine,N-1,ENV.bagLine do--i=phase + gc_rectangle('fill',1,72*i+3,98,2) + end + end + gc_translate(-488,-20) +end local function _drawDial(x,y,speed) gc_setColor(1,1,1,.7) gc_draw(dialFrame,x,y) @@ -506,129 +582,6 @@ local draw={} draw.drawGhost=drawGhost draw.applyField=_applyField draw.cancelField=_cancelField -function draw.drawNext_norm(P,repMode) - local ENV=P.gameEnv - local texture=P.skinLib - gc_translate(488,20) - gc_setLineWidth(2) - local N=ENV.nextCount*72 - gc_setColor(0,0,0,.4)gc_rectangle('fill',0,0,100,N+8,5) - gc_setColor(.97,.97,.97)gc_rectangle('line',0,0,100,N+8,5) - N=1 - gc_push('transform') - gc_translate(50,40) - gc_setColor(1,1,1) - - --Draw nexts - gc_setShader(shader_blockSatur) - local queue=P.nextQueue - while N<=ENV.nextCount and queue[N]do - local bk,sprite=queue[N].bk,texture[queue[N].color] - local k=min(2.3/#bk,3/#bk[1],.85) - gc_scale(k) - for i=1,#bk do for j=1,#bk[1]do - if bk[i][j]then - gc_draw(sprite,30*(j-#bk[1]*.5)-30,-30*(i-#bk*.5)) - end - end end - gc_scale(1/k) - N=N+1 - gc_translate(0,72) - end - gc_setShader() - - --Draw more nexts - if repMode then - gc_translate(50,-28) - local blockImg=TEXTURE.miniBlock - local skinSet=ENV.skin - local n=N - while n<=12 and queue[n]do - local id=queue[n].id - local _=minoColor[skinSet[id]] - gc_setColor(_[1],_[2],_[3],.2) - _=blockImg[id] - local h=_:getHeight() - gc_draw(_,-_:getWidth()*10,0,nil,10,nil) - gc_translate(0,10*h+3) - n=n+1 - end - end - gc_pop() - - if ENV.bagLine then - gc_setColor(.8,.8,.8,.8) - for i=-P.pieceCount%ENV.bagLine,N-1,ENV.bagLine do--i=phase - gc_rectangle('fill',1,72*i+3,98,2) - end - end - gc_translate(-488,-20) -end -function draw.drawNext_hidden(P,repMode) - local ENV=P.gameEnv - local texture=P.skinLib - gc_translate(488,20) - gc_setLineWidth(2) - local N=ENV.nextCount*72 - gc_setColor(.5,0,0,.4)gc_rectangle('fill',0,0,100,N+8,5) - gc_setColor(.97,.97,.97)gc_rectangle('line',0,0,100,N+8,5) - local startN=min(ENV.nextStartPos,P.pieceCount+1) - if repMode then - gc_setColor(1,1,1,.2) - N=1 - else - gc_setColor(1,1,1) - N=startN - end - gc_push('transform') - gc_translate(50,72*N-32) - - --Draw nexts - gc_setShader(shader_blockSatur) - local queue=P.nextQueue - while N<=ENV.nextCount and queue[N]do - if N==startN then gc_setColor(1,1,1)end - local bk,sprite=queue[N].bk,texture[queue[N].color] - local k=min(2.3/#bk,3/#bk[1],.85) - gc_scale(k) - for i=1,#bk do for j=1,#bk[1]do - if bk[i][j]then - gc_draw(sprite,30*(j-#bk[1]*.5)-30,-30*(i-#bk*.5)) - end - end end - gc_scale(1/k) - N=N+1 - gc_translate(0,72) - end - gc_setShader() - - --Draw more nexts - if repMode then - gc_translate(50,-28) - local blockImg=TEXTURE.miniBlock - local skinSet=ENV.skin - local n=N - while n<=12 and queue[n]do - local id=queue[n].id - local _=minoColor[skinSet[id]] - gc_setColor(_[1],_[2],_[3],.2) - _=blockImg[id] - local h=_:getHeight() - gc_draw(_,-_:getWidth()*10,0,nil,10,nil) - gc_translate(0,10*h+3) - n=n+1 - end - end - gc_pop() - - if ENV.bagLine then - gc_setColor(.8,.8,.8,.8) - for i=-P.pieceCount%ENV.bagLine,N-1,ENV.bagLine do--i=phase - gc_rectangle('fill',1,72*i+3,98,2) - end - end - gc_translate(-476,-20) -end function draw.drawTargetLine(P,r) if r<=20+(P.fieldBeneath+P.fieldUp+10)/30 and r>0 then gc_setLineWidth(3) @@ -680,9 +633,9 @@ function draw.norm(P,repMode) mStr(P.username,300,-60) --Draw HUD - P:drawNext(repMode) + if ENV.nextCount>0 then _drawNext(P,repMode)end + if ENV.holdMode=='hold'and ENV.holdCount>0 then _drawHold(P.holdQueue,ENV.holdCount,P.holdTime,P.skinLib)end if P.curMission then _drawMission(P.curMission,ENV.mission,ENV.missionKill)end - if ENV.holdCount>0 then _drawHold(P.holdQueue,ENV.holdCount,P.holdTime,P.skinLib)end _drawDial(499,505,P.dropSpeed) if P.life>0 then _drawLife(P.life)end diff --git a/parts/player/gameEnv0.lua b/parts/player/gameEnv0.lua index 46124d04..b436430d 100644 --- a/parts/player/gameEnv0.lua +++ b/parts/player/gameEnv0.lua @@ -34,7 +34,8 @@ return{ bone=false, fieldH=20,heightLimit=1e99, nextCount=6,nextStartPos=1, - holdCount=1,infHold=false,phyHold=false, + holdMode='hold',holdCount=1, + infHold=false,phyHold=false, ospin=true,deepDrop=false, RS='TRS', sequence='bag', diff --git a/parts/player/init.lua b/parts/player/init.lua index 15f15a72..cb88b1bd 100644 --- a/parts/player/init.lua +++ b/parts/player/init.lua @@ -362,7 +362,7 @@ local function _applyGameEnv(P)--Finish gameEnv processing ) P:set20G(P._20G) P:setHold(ENV.holdCount) - P:setNext(ENV.nextCount,ENV.nextStartPos>1) + P:setNext(ENV.nextCount) P:setRS(ENV.RS) if type(ENV.mission)=='table'then diff --git a/parts/player/player.lua b/parts/player/player.lua index 8a968f4a..747129a4 100644 --- a/parts/player/player.lua +++ b/parts/player/player.lua @@ -13,8 +13,6 @@ local SFX,BGM,VOC,VIB,SYSFX=SFX,BGM,VOC,VIB,SYSFX local FREEROW,TABLE,TEXT,TASK=FREEROW,TABLE,TEXT,TASK local PLAYERS,PLY_ALIVE,GAME=PLAYERS,PLY_ALIVE,GAME -local ply_draw=require"parts.player.draw" - ---------------------------------------------------- function Player:_showText(text,dx,dy,font,style,spd,stop) ins(self.bonus,TEXT.getText(text,150+dx,300+dy,font,style,spd,stop)) @@ -266,15 +264,8 @@ function Player:setHold(count)--Set hold count (false/true as 0/1) self.holdTime=count while self.holdQueue[count+1]do rem(self.holdQueue)end end -function Player:setNext(next,hidden)--Set next count (use hidden=true if set env.nextStartPos>1) +function Player:setNext(next)--Set next count self.gameEnv.nextCount=next - if next==0 then - self.drawNext=NULL - elseif not hidden then - self.drawNext=ply_draw.drawNext_norm - else - self.drawNext=ply_draw.drawNext_hidden - end end function Player:setInvisible(time)--Time in frames if time<0 then @@ -813,86 +804,155 @@ local phyHoldKickX={ [true]={0,-1,1},--X==?.0 tests [false]={-.5,.5},--X==?.5 tests } -function Player:hold(ifpre) +function Player:hold_norm(ifpre) local ENV=self.gameEnv - if self.holdTime>0 and(ifpre or self.waiting==-1)then - if #self.holdQueue All test failed, interrupt with sound - SFX.play('finesseError') - do return end - -- - ::BREAK_success:: + end + -- All test failed, interrupt with sound + SFX.play('finesseError') + do return end + -- + ::BREAK_success:: - self.spinLast=false + self.spinLast=false + + local hb=self:getBlock(C.id) + hb.name=C.name + hb.color=C.color + ins(self.holdQueue,hb) + self.cur=rem(self.holdQueue,1) + + self.curX,self.curY=x,y + else--Normal hold + self.spinLast=false + + if C then local hb=self:getBlock(C.id) - hb.name=C.name hb.color=C.color + hb.name=C.name ins(self.holdQueue,hb) - self.cur=rem(self.holdQueue,1) - self.curX,self.curY=x,y - else--Normal hold - self.spinLast=false + end + self.cur=rem(self.holdQueue,1) - if C then - local hb=self:getBlock(C.id) - hb.color=C.color - hb.name=C.name - ins(self.holdQueue,hb) + self:resetBlock() + end + self:freshBlock('move') + self.dropDelay=ENV.drop + self.lockDelay=ENV.lock + if self:ifoverlap(self.cur.bk,self.curX,self.curY)then + self:lock() + self:lose() + end + end + + 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 + + if self.sound then + SFX.play(ifpre and'prehold'or'hold') + end + + self.stat.hold=self.stat.hold+1 +end +function Player:hold_swap(ifpre) + local ENV=self.gameEnv + local hid=ENV.holdCount-self.holdTime+1 + if self.nextQueue[hid]then + local C,H=self.cur,self.nextQueue[hid] + self.ctrlCount=0 + + if ENV.phyHold and C and not ifpre then--Physical hold + local x,y=self.curX,self.curY + x=x+(#C.bk[1]-#H.bk[1])*.5 + y=y+(#C.bk-#H.bk)*.5 + + local iki=phyHoldKickX[x==int(x)] + for Y=int(y),ceil(y+.5)do + for i=1,#iki do + local X=x+iki[i] + if not self:ifoverlap(H.bk,X,Y)then + x,y=X,Y + goto BREAK_success + end end - self.cur=rem(self.holdQueue,1) - - self:resetBlock() end - self:freshBlock('move') - self.dropDelay=ENV.drop - self.lockDelay=ENV.lock - if self:ifoverlap(self.cur.bk,self.curX,self.curY)then - self:lock() - self:lose() - end - end + -- All test failed, interrupt with sound + SFX.play('finesseError') + do return end + -- + ::BREAK_success:: - 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 + self.spinLast=false - if self.sound then - SFX.play(ifpre and'prehold'or'hold') - end + local hb=self:getBlock(C.id) + hb.name=C.name + hb.color=C.color + self.cur,self.nextQueue[hid]=self.nextQueue[hid],hb - self.stat.hold=self.stat.hold+1 + self.curX,self.curY=x,y + else--Normal hold + self.spinLast=false + + local hb=self:getBlock(C.id) + hb.color=C.color + hb.name=C.name + self.cur,self.nextQueue[hid]=self.nextQueue[hid],hb + + self:resetBlock() + end + self:freshBlock('move') + self.dropDelay=ENV.drop + self.lockDelay=ENV.lock + if self:ifoverlap(self.cur.bk,self.curX,self.curY)then + self:lock() + self:lose() + end + end + + 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 + + if self.sound then + SFX.play(ifpre and'prehold'or'hold') + end + + self.stat.hold=self.stat.hold+1 +end +function Player:hold(ifpre) + if self.holdTime>0 and(ifpre or self.waiting==-1)then + if self.gameEnv.holdMode=='hold'then + self:hold_norm(ifpre) + elseif self.gameEnv.holdMode=='swap'then + self:hold_swap(ifpre) + end end end diff --git a/parts/scenes/customGame.lua b/parts/scenes/customGame.lua index 2d807121..7acc4931 100644 --- a/parts/scenes/customGame.lua +++ b/parts/scenes/customGame.lua @@ -236,18 +236,19 @@ scene.widgetList={ WIDGET.newButton{name="puzzle", x=1070,y=540,w=310,h=70,color='lM',font=35,code=pressKey"return2",hideF=function()return not initField end}, WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=pressKey"escape"}, + --Rule set + WIDGET.newSelector{name="eventSet", x=930, y=740,w=360,color='H',list=sList.eventSet,disp=CUSval('eventSet'),code=CUSsto('eventSet')}, + --Special rules - WIDGET.newSwitch{name="ospin", x=850, y=750,lim=210,disp=CUSval('ospin'), code=CUSrev('ospin')}, - WIDGET.newSwitch{name="fineKill", x=850, y=840,lim=210,disp=CUSval('fineKill'), code=CUSrev('fineKill')}, + WIDGET.newSwitch{name="ospin", x=850, y=810,lim=210,disp=CUSval('ospin'), code=CUSrev('ospin')}, + WIDGET.newSwitch{name="fineKill", x=850, y=870,lim=210,disp=CUSval('fineKill'), code=CUSrev('fineKill')}, WIDGET.newSwitch{name="b2bKill", x=850, y=930,lim=210,disp=CUSval('b2bKill'), code=CUSrev('b2bKill')}, - WIDGET.newSwitch{name="easyFresh", x=1170,y=750,lim=250,disp=CUSval('easyFresh'),code=CUSrev('easyFresh')}, - WIDGET.newSwitch{name="deepDrop", x=1170,y=840,lim=250,disp=CUSval('deepDrop'), code=CUSrev('deepDrop')}, + WIDGET.newSwitch{name="easyFresh", x=1170,y=810,lim=250,disp=CUSval('easyFresh'),code=CUSrev('easyFresh')}, + WIDGET.newSwitch{name="deepDrop", x=1170,y=870,lim=250,disp=CUSval('deepDrop'), code=CUSrev('deepDrop')}, WIDGET.newSwitch{name="bone", x=1170,y=930,lim=250,disp=CUSval('bone'), code=CUSrev('bone')}, - --Rule set - WIDGET.newSelector{name="eventSet", x=310, y=880,w=360,color='H',list=sList.eventSet,disp=CUSval('eventSet'),code=CUSsto('eventSet')}, - --Next & Hold + WIDGET.newSelector{name="holdMode", x=310, y=890, w=300,color='lY',list={'hold','swap'},disp=CUSval('holdMode'),code=CUSsto('holdMode')}, WIDGET.newSlider{name="nextCount", x=140, y=960, lim=130,w=180,unit=6,disp=CUSval('nextCount'),code=CUSsto('nextCount')}, WIDGET.newSlider{name="holdCount", x=140, y=1030,lim=130,w=180,unit=6,disp=CUSval('holdCount'),code=CUSsto('holdCount')}, WIDGET.newSwitch{name="infHold", x=560, y=960, lim=200, disp=CUSval('infHold'),code=CUSrev('infHold'),hideF=function()return CUSTOMENV.holdCount==0 end},