整理代码

This commit is contained in:
MrZ626
2021-06-03 10:52:51 +08:00
parent 77b6e14e7f
commit 69b47c66b4

View File

@@ -114,7 +114,7 @@ local function update_misc(P,dt)
O.va=O.va*.8-abs(O.a)^1.4*(O.a>0 and .08 or -.08) O.va=O.va*.8-abs(O.a)^1.4*(O.a>0 and .08 or -.08)
O.a=O.a+O.va O.a=O.a+O.va
-- if abs(O.a)<.3 then O.a,O.va=0,0 end if abs(O.a)<.0006 then O.a,O.va=0,0 end
end end
--Update texts --Update texts
@@ -303,7 +303,7 @@ function update.alive(P,dt)
if P.falling>=0 then if P.falling>=0 then
P.falling=P.falling-1 P.falling=P.falling-1
if P.falling>=0 then if P.falling>=0 then
goto stop goto THROW_stop
else else
local L=#P.clearingRow local L=#P.clearingRow
if P.sound and ENV.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
@@ -311,12 +311,15 @@ function update.alive(P,dt)
end end
end end
--Update block state
if P.control then
--Try spawn new block --Try spawn new block
if not P.control then goto stop end
if P.waiting>=0 then if P.waiting>=0 then
P.waiting=P.waiting-1 P.waiting=P.waiting-1
if P.waiting<0 then P:popNext()end if P.waiting<0 then
goto stop P:popNext()
end
goto THROW_stop
end end
--Natural block falling --Natural block falling
@@ -325,7 +328,7 @@ function update.alive(P,dt)
local D=P.dropDelay local D=P.dropDelay
if D>1 then if D>1 then
P.dropDelay=D-1 P.dropDelay=D-1
goto stop goto THROW_stop
end end
if D==1 then if D==1 then
@@ -334,8 +337,7 @@ function update.alive(P,dt)
end end
P.curY=P.curY-1 P.curY=P.curY-1
else else
D=1/D--Fall dist D=min(1/D,P.curY-P.ghoY)--1/D=Drop dist, lowest to ghost
if D>P.curY-P.ghoY then D=P.curY-P.ghoY end
if ENV.moveFX and ENV.block then if ENV.moveFX and ENV.block then
for _=1,D do for _=1,D do
P:createMoveFX('down') P:createMoveFX('down')
@@ -358,14 +360,17 @@ function update.alive(P,dt)
end end
else else
P.lockDelay=P.lockDelay-1 P.lockDelay=P.lockDelay-1
if P.lockDelay>=0 then goto stop end if P.lockDelay>=0 then
goto THROW_stop
end
P:drop() P:drop()
if P.AI_mode=='CC'and P.AI_bot then if P.AI_mode=='CC'and P.AI_bot then
CC.updateField(P) CC.updateField(P)
end end
end end
end end
::stop:: end
::THROW_stop::
--B2B bar animation --B2B bar animation
if P.b2b1==P.b2b then if P.b2b1==P.b2b then