整理代码,修复消行延迟和出块延迟在极小时的错误行为

This commit is contained in:
MrZ626
2021-11-25 02:42:25 +08:00
parent dd3df9981b
commit 3d26db7a01
2 changed files with 20 additions and 8 deletions

View File

@@ -782,7 +782,7 @@ function draw.norm(P,repMode)
_drawFXs(P)
--Draw current block
if P.cur and P.waiting==0 then
if P.cur then
local C=P.cur
local curColor=C.color
@@ -981,7 +981,6 @@ function draw.small(P)
end
function draw.demo(P)
local ENV=P.gameEnv
local curColor=P.cur.color
--Camera
gc_push('transform')
@@ -997,7 +996,8 @@ function draw.demo(P)
gc_translate(0,600)
_drawField(P)
_drawFXs(P)
if P.cur and P.waiting==0 then
if P.cur then
local curColor=P.cur.color
if ENV.ghost then
drawGhost[ENV.ghostType](P.cur.bk,P.curX,P.ghoY,ENV.ghost,P.skinLib,curColor)
end

View File

@@ -489,7 +489,9 @@ local playerActions={
if self.keyAvailable[keyID]and self.alive then
if self.waiting>self.gameEnv.hurry then
self.waiting=self.gameEnv.hurry
if self.waiting==0 then self:popNext()end
if self.waiting==0 and self.falling==0 then
self:popNext()
end
end
self.keyPressing[keyID]=true
playerActions[keyID](self)
@@ -1322,7 +1324,7 @@ function Player:hold_swap(ifpre)
self.stat.hold=self.stat.hold+1
end
function Player:hold(ifpre)
if self.holdTime>0 and(ifpre or self.waiting==0)then
if self.holdTime>0 and(ifpre or self.falling==0 and self.waiting==0)then
if self.gameEnv.holdMode=='hold'then
self:hold_norm(ifpre)
elseif self.gameEnv.holdMode=='swap'then
@@ -2019,7 +2021,12 @@ do
self:_triggerEvent('hook_drop')
end
if self.waiting==0 then self:popNext()end
--Remove controling block
self.cur=nil
if self.waiting==0 and self.falling==0 then
self:popNext()
end
end
function Player:clearFilledLines(start,height)
@@ -2419,8 +2426,11 @@ local function update_alive(P)
P.downing=0
end
local stopAtFalling
--Falling animation
if P.falling>0 then
stopAtFalling=true
P:_updateFalling(P.falling-1)
if P.falling>0 then
goto THROW_stop
@@ -2430,8 +2440,10 @@ local function update_alive(P)
--Update block state
if P.control then
--Try spawn new block
if P.waiting>0 then
P.waiting=P.waiting-1
if not P.cur then
if not stopAtFalling and P.waiting>0 then
P.waiting=P.waiting-1
end
if P.waiting<=0 then
P:popNext()
end