diff --git a/parts/player/draw.lua b/parts/player/draw.lua index bdfeed51..1ab99e1c 100644 --- a/parts/player/draw.lua +++ b/parts/player/draw.lua @@ -569,8 +569,10 @@ local function _drawNext(P,repMode) end if ENV.bagLine then gc_setColor(.8,.8,.8,.8) - for i=-P.pieceCount%ENV.bagLine,N-1,ENV.bagLine do-- i=phase - gc_rectangle('fill',1,72*i+3,98,2) + for i=1,ENV.nextCount+1 do + if queue[i] and queue[i].bagLine>0 then + gc_rectangle('fill',1,72*(i-1)+3,98,2) + end end end gc_translate(-488,-20) diff --git a/parts/player/init.lua b/parts/player/init.lua index 150b122f..6fe9bad2 100644 --- a/parts/player/init.lua +++ b/parts/player/init.lua @@ -331,8 +331,6 @@ local function _applyGameEnv(P)-- Finish gameEnv processing ENV.arr=max(ENV.arr,ENV.minarr) ENV.sdarr=max(ENV.sdarr,ENV.minsdarr) - ENV.bagLine=ENV.bagLine and (ENV.sequence=='bag' or ENV.sequence=='loop') and #ENV.seqData - if ENV.nextCount==0 then ENV.nextPos=false end @@ -340,6 +338,7 @@ local function _applyGameEnv(P)-- Finish gameEnv processing local seqGen=coroutine.create(getSeqGen(ENV.sequence)) local seqCalled=false local initSZOcount=0 + local bagLineCounter=0 function P:newNext() local status,piece if seqCalled then @@ -348,7 +347,9 @@ local function _applyGameEnv(P)-- Finish gameEnv processing status,piece=coroutine.resume(seqGen,P.seqRND,P.gameEnv.seqData) seqCalled=true end - if status and piece then + if not status then + assert(piece=='cannot resume dead coroutine') + elseif piece then if ENV.noInitSZO and initSZOcount<5 then initSZOcount=initSZOcount+1 if piece==1 or piece==2 or piece==6 then @@ -357,9 +358,13 @@ local function _applyGameEnv(P)-- Finish gameEnv processing initSZOcount=5 end end - P:getNext(piece) - elseif not status then - assert(piece=='cannot resume dead coroutine') + P:getNext(piece,bagLineCounter) + bagLineCounter=0 + else + if ENV.bagLine then + bagLineCounter=bagLineCounter+1 + end + P:newNext() end end for _=1,ENV.trueNextCount do diff --git a/parts/player/player.lua b/parts/player/player.lua index 3cb12e5d..00531106 100644 --- a/parts/player/player.lua +++ b/parts/player/player.lua @@ -1415,7 +1415,7 @@ function Player:hold(ifpre,force) end end -function Player:getBlock(id,name,color)-- Get a block object +function Player:getBlock(id,name,color,bagLineCounter)-- Get a block object local ENV=self.gameEnv local dir=ENV.face[id] return { @@ -1425,10 +1425,11 @@ function Player:getBlock(id,name,color)-- Get a block object RS=self.RS, name=name or id, color=ENV.bone and 17 or color or ENV.skin[id], + bagLine=bagLineCounter, } end -function Player:getNext(id)-- Push a block to nextQueue - ins(self.nextQueue,self:getBlock(id)) +function Player:getNext(id,bagLineCounter)-- Push a block to nextQueue + ins(self.nextQueue,self:getBlock(id,nil,nil,bagLineCounter)) if self.bot then self.bot:pushNewNext(id) end diff --git a/parts/player/seqGenerators.lua b/parts/player/seqGenerators.lua index 0f116be0..0e62a391 100644 --- a/parts/player/seqGenerators.lua +++ b/parts/player/seqGenerators.lua @@ -8,6 +8,7 @@ local seqGenerators={ local bag={} while true do if #bag==0 then + yield(nil) for i=1,len do bag[i]=seq0[len-i+1] end @@ -35,11 +36,13 @@ local seqGenerators={ end end -- Finish + yield(nil) for i=1,len do yield(bag[i]) end end bag={} while true do if #bag==0 then + yield(nil) for i=1,len do bag[i]=seq0[len-i+1] end @@ -189,6 +192,7 @@ local seqGenerators={ local bufferSeq,bag={},{} while true do if #bag==0 then + yield(nil) for i=1,#seq0 do bufferSeq[i]=seq0[i] end repeat local r=rem(bufferSeq,rndGen:random(#bag)) @@ -210,6 +214,7 @@ local seqGenerators={ local bag={} while true do if #bag==0 then + yield(nil) for i=1,len do bag[i]=seq0[len-i+1] end @@ -235,6 +240,7 @@ local seqGenerators={ local unknown={} local extra=-1 local function init() + yield(nil) for i=1,len do unknown[i]=1 end