略微优化性能

This commit is contained in:
MrZ626
2021-05-05 11:12:43 +08:00
parent 1d36d50fca
commit 9af190529c
2 changed files with 12 additions and 9 deletions

View File

@@ -3,7 +3,11 @@ local int,abs,rnd=math.floor,math.abs,math.random
local rem=table.remove local rem=table.remove
local assert,resume,status=assert,coroutine.resume,coroutine.status 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 local bf=P.atkBuffer
for i=#bf,1,-1 do for i=#bf,1,-1 do
local A=bf[i] local A=bf[i]
@@ -280,7 +284,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 THROW_stop goto 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
@@ -289,11 +293,11 @@ function update.alive(P,dt)
end end
--Try spawn new block --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 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 P:popNext()end
goto THROW_stop goto stop
end end
--Natural block falling --Natural block falling
@@ -302,7 +306,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 THROW_stop goto stop
end end
if D==1 then if D==1 then
@@ -335,14 +339,14 @@ 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 THROW_stop end if P.lockDelay>=0 then goto 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
::THROW_stop:: ::stop::
--B2B bar animation --B2B bar animation
if P.b2b1==P.b2b then if P.b2b1==P.b2b then

View File

@@ -21,8 +21,7 @@ local scene={}
function scene.sceneInit(org) function scene.sceneInit(org)
BG.set() BG.set()
destroyPlayers() destroyPlayers()
local cam=mapCam mapCam.zoomK=org=="main"and 5 or 1
cam.zoomK=org=="main"and 5 or 1
end end
local function getK() local function getK()