整理代码
This commit is contained in:
@@ -430,7 +430,7 @@ function royaleLevelup()
|
||||
local P=PLAYERS.alive[i]
|
||||
P.gameEnv.drop=int(P.gameEnv.drop*.3)
|
||||
if P.gameEnv.drop==0 then
|
||||
P.curY=P.imgY
|
||||
P.curY=P.ghoY
|
||||
P:set20G(true)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -122,11 +122,11 @@ do
|
||||
if P.type=="human"then SFX.fieldPlay("rotate",nil,P)end
|
||||
if not P.gameEnv.ospin then return end
|
||||
local x,y=P.curX,P.curY
|
||||
if y==P.imgY and((P:solid(x-1,y)or P:solid(x-1,y+1)))and(P:solid(x+2,y)or P:solid(x+2,y+1))then
|
||||
if y==P.ghoY and((P:solid(x-1,y)or P:solid(x-1,y+1)))and(P:solid(x+2,y)or P:solid(x+2,y+1))then
|
||||
local D=P.spinSeq%100*10+d
|
||||
P.spinSeq=D
|
||||
if D<100 then
|
||||
P:freshBlock(true,true)
|
||||
P:freshBlock("fresh")
|
||||
return
|
||||
end
|
||||
for i=1,#OspinList do
|
||||
@@ -144,7 +144,7 @@ do
|
||||
P.dir,P.sc=dir,spinCenters[id][dir]
|
||||
P.spinLast=2
|
||||
P.stat.rotate=P.stat.rotate+1
|
||||
P:freshBlock(false,true)
|
||||
P:freshBlock("move")
|
||||
P.spinSeq=0
|
||||
SFX.fieldPlay("rotatekick",nil,P)
|
||||
return
|
||||
@@ -153,7 +153,7 @@ do
|
||||
end
|
||||
else
|
||||
P.spinSeq=0
|
||||
P:freshBlock(true,true)
|
||||
P:freshBlock("fresh")
|
||||
end
|
||||
end,--O
|
||||
{
|
||||
@@ -271,12 +271,12 @@ do
|
||||
if not P:ifoverlap(P.cur.bk,x,y)then
|
||||
P.curX,P.curY=x,y
|
||||
P.spinLast=1
|
||||
P:freshBlock(false,true)
|
||||
P:freshBlock("move")
|
||||
P.stat.rotate=P.stat.rotate+1
|
||||
return
|
||||
end
|
||||
end
|
||||
P:freshBlock(true,true)
|
||||
P:freshBlock("fresh")
|
||||
end,--X
|
||||
{
|
||||
[01]={{-1, 0},{-1, 1},{ 0,-3},{-1, 1},{-1, 2},{ 0, 1}},
|
||||
|
||||
@@ -119,7 +119,7 @@ local function drawGhost(P,clr)
|
||||
local texture=SKIN.curText
|
||||
for i=1,P.r do for j=1,P.c do
|
||||
if P.cur.bk[i][j]then
|
||||
Draw(texture[clr],30*(j+P.curX-1)-30,-30*(i+P.imgY-1))-- drawCell(i+P.imgY-1,j+P.curX-1,clr)
|
||||
Draw(texture[clr],30*(j+P.curX-1)-30,-30*(i+P.ghoY-1))-- drawCell(i+P.ghoY-1,j+P.curX-1,clr)
|
||||
end
|
||||
end end
|
||||
end
|
||||
@@ -371,7 +371,7 @@ function draw.norm(P)
|
||||
--Draw ghost
|
||||
if ENV.ghost then drawGhost(P,curColor)end
|
||||
|
||||
local dy=ENV.smooth and P.imgY~=P.curY and(P.dropDelay/ENV.drop-1)*30 or 0
|
||||
local dy=ENV.smooth and P.ghoY~=P.curY and(P.dropDelay/ENV.drop-1)*30 or 0
|
||||
gc.translate(0,-dy)
|
||||
local trans=P.lockDelay/ENV.lock
|
||||
|
||||
@@ -390,7 +390,7 @@ function draw.norm(P)
|
||||
gc.translate(0,dy)
|
||||
if ENV.center and ENV.ghost then
|
||||
gc_setColor(1,1,1,trans*ENV.center)
|
||||
gc.draw(IMG.spinCenter,x,-30*(P.imgY+P.sc[1])+15,nil,nil,nil,4,4)
|
||||
gc.draw(IMG.spinCenter,x,-30*(P.ghoY+P.sc[1])+15,nil,nil,nil,4,4)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -504,7 +504,7 @@ function draw.norm(P)
|
||||
--Display Ys
|
||||
-- gc.setLineWidth(6)
|
||||
-- if P.curY then gc_setColor(1,.4,0,.42)gc.line(0,611-P.curY*30,300,611-P.curY*30)end
|
||||
-- if P.imgY then gc_setColor(0,1,.4,.42)gc.line(0,615-P.imgY*30,300,615-P.imgY*30)end
|
||||
-- if P.ghoY then gc_setColor(0,1,.4,.42)gc.line(0,615-P.ghoY*30,300,615-P.ghoY*30)end
|
||||
-- if P.minY then gc_setColor(0,.4,1,.42)gc.line(0,619-P.minY*30,300,619-P.minY*30)end
|
||||
-- gc_setColor(0,.4,1,.42)gc.line(0,600-P.garbageBeneath*30,300,600-P.garbageBeneath*30)
|
||||
gc.pop()
|
||||
@@ -688,7 +688,7 @@ function draw.demo(P)
|
||||
if P.cur and P.waiting==-1 then
|
||||
if ENV.ghost then drawGhost(P,curColor)end
|
||||
if ENV.block then
|
||||
local dy=ENV.smooth and P.imgY~=P.curY and(P.dropDelay/ENV.drop-1)*30 or 0
|
||||
local dy=ENV.smooth and P.ghoY~=P.curY and(P.dropDelay/ENV.drop-1)*30 or 0
|
||||
gc.translate(0,-dy)
|
||||
drawBlockOutline(P,SKIN.curText[curColor],P.lockDelay/ENV.lock)
|
||||
drawBlock(P,curColor)
|
||||
|
||||
@@ -137,7 +137,7 @@ local function newEmptyPlayer(id,mini)
|
||||
--P.cur={bk=matrix[2], id=shapeID, color=colorID, name=nameID}
|
||||
--P.sc,P.dir={0,0},0--SpinCenterCoord, direction
|
||||
--P.r,P.c=0,0--row, col
|
||||
-- P.curX,P.curY,P.imgY,P.minY=0,0,0,0--x,y,ghostY
|
||||
-- P.curX,P.curY,P.ghoY,P.minY=0,0,0,0--x,y,ghostY
|
||||
P.holdQueue={}
|
||||
P.holdTime=0
|
||||
P.nextQueue={}
|
||||
|
||||
@@ -262,13 +262,13 @@ function Player.garbageRise(P,color,amount,pos)--Release n-lines garbage to fiel
|
||||
P.fieldBeneath=P.fieldBeneath+amount*30
|
||||
if P.cur then
|
||||
P.curY=P.curY+amount
|
||||
P.imgY=P.imgY+amount
|
||||
P.ghoY=P.ghoY+amount
|
||||
end
|
||||
P.garbageBeneath=P.garbageBeneath+amount
|
||||
for i=1,#P.clearingRow do
|
||||
P.clearingRow[i]=P.clearingRow[i]+amount
|
||||
end
|
||||
P:freshBlock(false,false)
|
||||
P:freshBlock("push")
|
||||
for i=1,#P.lockFX do
|
||||
_=P.lockFX[i]
|
||||
_[2]=_[2]-30*amount--Shift 30px per line cleared
|
||||
@@ -300,8 +300,8 @@ function Player.pushLineList(P,L,mir)--Push some lines to field
|
||||
end
|
||||
P.fieldBeneath=P.fieldBeneath+30*l
|
||||
P.curY=P.curY+l
|
||||
P.imgY=P.imgY+l
|
||||
P:freshBlock(false,false)
|
||||
P.ghoY=P.ghoY+l
|
||||
P:freshBlock("push")
|
||||
end
|
||||
function Player.pushNextList(P,L,mir)--Push some nexts to nextQueue
|
||||
for i=1,#L do
|
||||
@@ -403,62 +403,65 @@ function Player.changeAtk(P,R)
|
||||
P.atking=nil
|
||||
end
|
||||
end
|
||||
function Player.freshBlock(P,keepGhost,control,system)
|
||||
function Player.freshBlock(P,mode)--string mode: push/move/fresh/newBlock
|
||||
local ENV=P.gameEnv
|
||||
if not keepGhost and P.cur then
|
||||
P.imgY=min(#P.field+1,P.curY)
|
||||
|
||||
--Fresh ghost
|
||||
if(mode=="push"or mode=="move"or mode=="newBlock")and P.cur then
|
||||
P.ghoY=min(#P.field+1,P.curY)
|
||||
if P._20G or P.keyPressing[7]and ENV.sdarr==0 then
|
||||
local _=P.imgY
|
||||
local _=P.ghoY
|
||||
|
||||
--Move ghost to bottom
|
||||
while not P:ifoverlap(P.cur.bk,P.curX,P.imgY-1)do
|
||||
P.imgY=P.imgY-1
|
||||
while not P:ifoverlap(P.cur.bk,P.curX,P.ghoY-1)do
|
||||
P.ghoY=P.ghoY-1
|
||||
end
|
||||
|
||||
--Cancel spinLast
|
||||
if _~=P.imgY then
|
||||
if _~=P.ghoY then
|
||||
P.spinLast=false
|
||||
end
|
||||
|
||||
--Create FX if dropped
|
||||
if P.curY>P.imgY then
|
||||
if ENV.dropFX and ENV.block and P.curY-P.imgY-P.r>-1 then
|
||||
P:createDropFX(P.curX,P.curY-1,P.c,P.curY-P.imgY-P.r+1)
|
||||
if P.curY>P.ghoY then
|
||||
if ENV.dropFX and ENV.block and P.curY-P.ghoY-P.r>-1 then
|
||||
P:createDropFX(P.curX,P.curY-1,P.c,P.curY-P.ghoY-P.r+1)
|
||||
end
|
||||
if ENV.shakeFX then
|
||||
P.fieldOff.vy=ENV.shakeFX*.5
|
||||
end
|
||||
P.curY=P.imgY
|
||||
P.curY=P.ghoY
|
||||
end
|
||||
else
|
||||
while not P:ifoverlap(P.cur.bk,P.curX,P.imgY-1)do
|
||||
P.imgY=P.imgY-1
|
||||
while not P:ifoverlap(P.cur.bk,P.curX,P.ghoY-1)do
|
||||
P.ghoY=P.ghoY-1
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if control then
|
||||
--Fresh delays
|
||||
if mode=="move"or mode=="fresh"or mode=="newBlock"then
|
||||
local d0,l0=ENV.drop,ENV.lock
|
||||
if ENV.easyFresh then
|
||||
local d0=ENV.lock
|
||||
if P.lockDelay<d0 and P.freshTime>0 then
|
||||
if not system then
|
||||
if P.lockDelay<l0 and P.freshTime>0 then
|
||||
if mode~="newBlock"then
|
||||
P.freshTime=P.freshTime-1
|
||||
end
|
||||
P.lockDelay=d0
|
||||
P.dropDelay=ENV.drop
|
||||
P.lockDelay=l0
|
||||
P.dropDelay=d0
|
||||
end
|
||||
if P.curY<P.minY then
|
||||
P.minY=P.curY
|
||||
P.dropDelay=ENV.drop
|
||||
P.lockDelay=ENV.lock
|
||||
P.dropDelay=d0
|
||||
P.lockDelay=l0
|
||||
end
|
||||
else
|
||||
if P.curY<P.minY then
|
||||
P.minY=P.curY
|
||||
if P.lockDelay<ENV.lock and P.freshTime>0 then
|
||||
if P.lockDelay<l0 and P.freshTime>0 then
|
||||
P.freshTime=P.freshTime-1
|
||||
P.dropDelay=ENV.drop
|
||||
P.lockDelay=ENV.lock
|
||||
P.dropDelay=d0
|
||||
P.lockDelay=l0
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -557,7 +560,7 @@ function Player.spin(P,d,ifpre)
|
||||
iki=iki[P.dir*10+idir]
|
||||
if not iki then
|
||||
if P.gameEnv.easyFresh then
|
||||
P:freshBlock(false,true)
|
||||
P:freshBlock("move")
|
||||
end
|
||||
SFX.fieldPlay(ifpre and"prerotate"or"rotate",nil,P)
|
||||
return
|
||||
@@ -574,7 +577,7 @@ function Player.spin(P,d,ifpre)
|
||||
P.r,P.c=ir,ic
|
||||
P.spinLast=test==2 and 0 or 1
|
||||
if not ifpre then
|
||||
P:freshBlock(false,true)
|
||||
P:freshBlock("move")
|
||||
end
|
||||
if iki[test][2]>0 and not P.gameEnv.easyFresh then
|
||||
P.freshTime=P.freshTime-1
|
||||
@@ -621,7 +624,7 @@ function Player.hold(P,ifpre)
|
||||
P.cur=rem(P.holdQueue,1)
|
||||
|
||||
P:resetBlock()
|
||||
P:freshBlock(false,true)
|
||||
P:freshBlock("move")
|
||||
P.dropDelay=P.gameEnv.drop
|
||||
P.lockDelay=P.gameEnv.lock
|
||||
if P:ifoverlap(P.cur.bk,P.curX,P.curY)then
|
||||
@@ -692,7 +695,7 @@ function Player.popNext(P,ifhold)--Pop nextQueue to hand
|
||||
P:lock()
|
||||
P:lose()
|
||||
end
|
||||
P:freshBlock(false,true,true)
|
||||
P:freshBlock("newBlock")
|
||||
end
|
||||
|
||||
--IHdS
|
||||
@@ -1728,8 +1731,8 @@ function Player.act_moveLeft(P,auto)
|
||||
P:createMoveFX("left")
|
||||
end
|
||||
P.curX=P.curX-1
|
||||
P:freshBlock(false,true)
|
||||
if P.sound and P.curY==P.imgY then SFX.play("move")end
|
||||
P:freshBlock("move")
|
||||
if P.sound and P.curY==P.ghoY then SFX.play("move")end
|
||||
if not auto then P.moving=0 end
|
||||
P.spinLast=false
|
||||
else
|
||||
@@ -1755,8 +1758,8 @@ function Player.act_moveRight(P,auto)
|
||||
P:createMoveFX("right")
|
||||
end
|
||||
P.curX=P.curX+1
|
||||
P:freshBlock(false,true)
|
||||
if P.sound and P.curY==P.imgY then SFX.play("move")end
|
||||
P:freshBlock("move")
|
||||
if P.sound and P.curY==P.ghoY then SFX.play("move")end
|
||||
if not auto then P.moving=0 end
|
||||
P.spinLast=false
|
||||
else
|
||||
@@ -1794,11 +1797,11 @@ function Player.act_hardDrop(P)
|
||||
end
|
||||
P.keyPressing[6]=false
|
||||
elseif P.control and P.waiting==-1 and P.cur then
|
||||
if P.curY>P.imgY then
|
||||
if P.gameEnv.dropFX and P.gameEnv.block and P.curY-P.imgY-P.r>-1 then
|
||||
P:createDropFX(P.curX,P.curY-1,P.c,P.curY-P.imgY-P.r+1)
|
||||
if P.curY>P.ghoY then
|
||||
if P.gameEnv.dropFX and P.gameEnv.block and P.curY-P.ghoY-P.r>-1 then
|
||||
P:createDropFX(P.curX,P.curY-1,P.c,P.curY-P.ghoY-P.r+1)
|
||||
end
|
||||
P.curY=P.imgY
|
||||
P.curY=P.ghoY
|
||||
P.spinLast=false
|
||||
if P.gameEnv.shakeFX then
|
||||
P.fieldOff.vy=P.gameEnv.shakeFX*.6
|
||||
@@ -1821,9 +1824,9 @@ function Player.act_softDrop(P)
|
||||
else
|
||||
P.downing=1
|
||||
if P.control and P.waiting==-1 and P.cur then
|
||||
if P.curY>P.imgY then
|
||||
if P.curY>P.ghoY then
|
||||
P.curY=P.curY-1
|
||||
P:freshBlock(true,true)
|
||||
P:freshBlock("fresh")
|
||||
P.spinLast=false
|
||||
end
|
||||
end
|
||||
@@ -1855,7 +1858,7 @@ function Player.act_insLeft(P,auto)
|
||||
P:createMoveFX("left")
|
||||
end
|
||||
P.curX=P.curX-1
|
||||
P:freshBlock(false,true)
|
||||
P:freshBlock("move")
|
||||
end
|
||||
if P.curX~=x0 then
|
||||
P.spinLast=false
|
||||
@@ -1877,7 +1880,7 @@ function Player.act_insRight(P,auto)
|
||||
P:createMoveFX("right")
|
||||
end
|
||||
P.curX=P.curX+1
|
||||
P:freshBlock(false,true)
|
||||
P:freshBlock("move")
|
||||
end
|
||||
if P.curX~=x0 then
|
||||
P.spinLast=false
|
||||
@@ -1892,48 +1895,48 @@ function Player.act_insRight(P,auto)
|
||||
end
|
||||
end
|
||||
function Player.act_insDown(P)
|
||||
if P.cur and P.curY>P.imgY then
|
||||
if P.gameEnv.dropFX and P.gameEnv.block and P.curY-P.imgY-P.r>-1 then
|
||||
P:createDropFX(P.curX,P.curY-1,P.c,P.curY-P.imgY-P.r+1)
|
||||
if P.cur and P.curY>P.ghoY then
|
||||
if P.gameEnv.dropFX and P.gameEnv.block and P.curY-P.ghoY-P.r>-1 then
|
||||
P:createDropFX(P.curX,P.curY-1,P.c,P.curY-P.ghoY-P.r+1)
|
||||
end
|
||||
if P.gameEnv.shakeFX then
|
||||
P.fieldOff.vy=P.gameEnv.shakeFX*.5
|
||||
end
|
||||
P.curY=P.imgY
|
||||
P.curY=P.ghoY
|
||||
P.lockDelay=P.gameEnv.lock
|
||||
P.spinLast=false
|
||||
P:freshBlock(true,true)
|
||||
P:freshBlock("fresh")
|
||||
end
|
||||
end
|
||||
function Player.act_down1(P)
|
||||
if P.cur and P.curY>P.imgY then
|
||||
if P.cur and P.curY>P.ghoY then
|
||||
if P.gameEnv.moveFX and P.gameEnv.block then
|
||||
P:createMoveFX("down")
|
||||
end
|
||||
P.curY=P.curY-1
|
||||
P:freshBlock(true,true)
|
||||
P:freshBlock("fresh")
|
||||
P.spinLast=false
|
||||
end
|
||||
end
|
||||
function Player.act_down4(P)
|
||||
if P.cur and P.curY>P.imgY then
|
||||
local y=max(P.curY-4,P.imgY)
|
||||
if P.cur and P.curY>P.ghoY then
|
||||
local y=max(P.curY-4,P.ghoY)
|
||||
if P.gameEnv.dropFX and P.gameEnv.block and P.curY-y-P.r>-1 then
|
||||
P:createDropFX(P.curX,P.curY-1,P.c,P.curY-y-P.r+1)
|
||||
end
|
||||
P.curY=y
|
||||
P:freshBlock(true,true)
|
||||
P:freshBlock("fresh")
|
||||
P.spinLast=false
|
||||
end
|
||||
end
|
||||
function Player.act_down10(P)
|
||||
if P.cur and P.curY>P.imgY then
|
||||
local y=max(P.curY-10,P.imgY)
|
||||
if P.cur and P.curY>P.ghoY then
|
||||
local y=max(P.curY-10,P.ghoY)
|
||||
if P.gameEnv.dropFX and P.gameEnv.block and P.curY-y-P.r>-1 then
|
||||
P:createDropFX(P.curX,P.curY-1,P.c,P.curY-y-P.r+1)
|
||||
end
|
||||
P.curY=y
|
||||
P:freshBlock(true,true)
|
||||
P:freshBlock("fresh")
|
||||
P.spinLast=false
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
local int,max,min,abs=math.floor,math.max,math.min,math.abs
|
||||
local rem=table.remove
|
||||
local ct=coroutine
|
||||
local resume=coroutine.resume
|
||||
local status=coroutine.status
|
||||
local assert=assert
|
||||
|
||||
local function updateLine(P)--Attacks, line pushing, cam moving
|
||||
@@ -29,7 +30,7 @@ local function updateLine(P)--Attacks, line pushing, cam moving
|
||||
if not P.alive then
|
||||
y=0
|
||||
else
|
||||
y=30*max(min(#P.field-19.5-P.fieldBeneath/30,P.imgY-17),0)
|
||||
y=30*max(min(#P.field-19.5-P.fieldBeneath/30,P.ghoY-17),0)
|
||||
end
|
||||
if f~=y then
|
||||
P.fieldUp=f>y and max(f*.95+y*.05-2,y)or min(f*.97+y*.03+1,y)
|
||||
@@ -98,14 +99,15 @@ local function updateTasks(P)
|
||||
local L=P.tasks
|
||||
for i=#L,1,-1 do
|
||||
local tr=L[i].thread
|
||||
assert(ct.resume(tr))
|
||||
if ct.status(tr)=="dead"then
|
||||
assert(resume(tr))
|
||||
if status(tr)=="dead"then
|
||||
rem(L,i)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local function update_alive(P,dt)
|
||||
local ENV=P.gameEnv
|
||||
if P.timing then
|
||||
local S=P.stat
|
||||
S.time=S.time+dt
|
||||
@@ -160,7 +162,7 @@ local function update_alive(P,dt)
|
||||
|
||||
--Moving pressed
|
||||
if P.movDir~=0 then
|
||||
local das,arr=P.gameEnv.das,P.gameEnv.arr
|
||||
local das,arr=ENV.das,ENV.arr
|
||||
local mov=P.moving
|
||||
if P.waiting==-1 then
|
||||
if P.movDir==1 then
|
||||
@@ -182,8 +184,8 @@ local function update_alive(P,dt)
|
||||
mov=mov+1
|
||||
end
|
||||
end
|
||||
if mov>=das and P.gameEnv.shakeFX and P.cur and P:ifoverlap(P.cur.bk,P.curX+1,P.curY)then
|
||||
P.fieldOff.vx=P.gameEnv.shakeFX*.5
|
||||
if mov>=das and ENV.shakeFX and P.cur and P:ifoverlap(P.cur.bk,P.curX+1,P.curY)then
|
||||
P.fieldOff.vx=ENV.shakeFX*.5
|
||||
end
|
||||
else
|
||||
P.movDir=0
|
||||
@@ -207,8 +209,8 @@ local function update_alive(P,dt)
|
||||
mov=mov+1
|
||||
end
|
||||
end
|
||||
if mov>=das and P.gameEnv.shakeFX and P.cur and P:ifoverlap(P.cur.bk,P.curX-1,P.curY)then
|
||||
P.fieldOff.vx=-P.gameEnv.shakeFX*.5
|
||||
if mov>=das and ENV.shakeFX and P.cur and P:ifoverlap(P.cur.bk,P.curX-1,P.curY)then
|
||||
P.fieldOff.vx=-ENV.shakeFX*.5
|
||||
end
|
||||
else
|
||||
P.movDir=0
|
||||
@@ -222,18 +224,18 @@ local function update_alive(P,dt)
|
||||
|
||||
--Drop pressed
|
||||
if P.keyPressing[7]and not P.keyPressing[9]then
|
||||
local d=P.downing-P.gameEnv.sddas
|
||||
local d=P.downing-ENV.sddas
|
||||
P.downing=P.downing+1
|
||||
if d>1 then
|
||||
if P.gameEnv.sdarr>0 then
|
||||
if d%P.gameEnv.sdarr==0 then
|
||||
if ENV.sdarr>0 then
|
||||
if d%ENV.sdarr==0 then
|
||||
P:act_down1()
|
||||
end
|
||||
else
|
||||
P:act_insDown()
|
||||
end
|
||||
if P.gameEnv.shakeFX then
|
||||
P.fieldOff.vy=P.gameEnv.shakeFX*.3
|
||||
if ENV.shakeFX then
|
||||
P.fieldOff.vy=ENV.shakeFX*.3
|
||||
end
|
||||
end
|
||||
else
|
||||
@@ -247,7 +249,7 @@ local function update_alive(P,dt)
|
||||
goto stop
|
||||
else
|
||||
local L=#P.clearingRow
|
||||
if P.sound and P.gameEnv.fall>0 and #P.field+L>P.clearingRow[L]then SFX.play("fall")end
|
||||
if P.sound and ENV.fall>0 and #P.field+L>P.clearingRow[L]then SFX.play("fall")end
|
||||
P.clearingRow={}
|
||||
end
|
||||
end
|
||||
@@ -262,7 +264,7 @@ local function update_alive(P,dt)
|
||||
|
||||
--Natural block falling
|
||||
if P.cur then
|
||||
if P.curY>P.imgY then
|
||||
if P.curY>P.ghoY then
|
||||
local D=P.dropDelay
|
||||
if D>1 then
|
||||
P.dropDelay=D-1
|
||||
@@ -270,14 +272,13 @@ local function update_alive(P,dt)
|
||||
end
|
||||
|
||||
if D==1 then
|
||||
if P.gameEnv.moveFX and P.gameEnv.block then
|
||||
if ENV.moveFX and ENV.block then
|
||||
P:createMoveFX("down")
|
||||
end
|
||||
P.curY=P.curY-1
|
||||
else
|
||||
D=1/D--Fall dist
|
||||
if D>P.curY-P.imgY then D=P.curY-P.imgY end
|
||||
if P.gameEnv.moveFX and P.gameEnv.block then
|
||||
D=max(1/D,P.curY-P.ghoY)--Fall dist, max to dist between cur/gho
|
||||
if ENV.moveFX and ENV.block then
|
||||
for _=1,D do
|
||||
P:createMoveFX("down")
|
||||
P.curY=P.curY-1
|
||||
@@ -286,14 +287,14 @@ local function update_alive(P,dt)
|
||||
P.curY=P.curY-D
|
||||
end
|
||||
end
|
||||
P:freshBlock(true,true)
|
||||
P:freshBlock("fresh")
|
||||
P.spinLast=false
|
||||
|
||||
if P.imgY~=P.curY then
|
||||
P.dropDelay=P.gameEnv.drop
|
||||
if P.ghoY~=P.curY then
|
||||
P.dropDelay=ENV.drop
|
||||
elseif P.AI_mode=="CC"then
|
||||
CC.updateField(P)
|
||||
if not P.AIdata._20G and P.gameEnv.drop<P.AI_delay0*.5 then
|
||||
if not P.AIdata._20G and ENV.drop<P.AI_delay0*.5 then
|
||||
CC.switch20G(P)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user