整理代码

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.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
--Update texts
@@ -303,7 +303,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
@@ -311,12 +311,15 @@ function update.alive(P,dt)
end
end
--Update block state
if P.control then
--Try spawn new block
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 stop
if P.waiting<0 then
P:popNext()
end
goto THROW_stop
end
--Natural block falling
@@ -325,7 +328,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
@@ -334,8 +337,7 @@ function update.alive(P,dt)
end
P.curY=P.curY-1
else
D=1/D--Fall dist
if D>P.curY-P.ghoY then D=P.curY-P.ghoY end
D=min(1/D,P.curY-P.ghoY)--1/D=Drop dist, lowest to ghost
if ENV.moveFX and ENV.block then
for _=1,D do
P:createMoveFX('down')
@@ -358,14 +360,17 @@ 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::
end
::THROW_stop::
--B2B bar animation
if P.b2b1==P.b2b then