整理代码,修复birs报错

This commit is contained in:
MrZ626
2021-08-26 17:13:01 +08:00
parent f6826432d0
commit a64edc70ed
2 changed files with 18 additions and 18 deletions

View File

@@ -303,7 +303,7 @@ local function _drawBlock(CB,curX,curY,texture)
end end
local function _drawNextPreview(B,fieldH,fieldBeneath) local function _drawNextPreview(B,fieldH,fieldBeneath)
gc_setColor(1,1,1,.8) gc_setColor(1,1,1,.8)
local y=int(fieldH+1-modf(B.rs.centerPos[B.id][B.dir][1]))+ceil(fieldBeneath/30) local y=int(fieldH+1-modf(B.RS.centerPos[B.id][B.dir][1]))+ceil(fieldBeneath/30)
B=B.bk B=B.bk
local x=int(6-#B[1]*.5) local x=int(6-#B[1]*.5)
local cross=TEXTURE.puzzleMark[-1] local cross=TEXTURE.puzzleMark[-1]
@@ -764,16 +764,16 @@ function draw.norm(P,repMode)
local curColor=C.color local curColor=C.color
local trans=P.lockDelay/ENV.lock local trans=P.lockDelay/ENV.lock
local centerPos=C.rs.centerPos[C.id][C.dir] local centerPos=C.RS.centerPos[C.id][C.dir]
local centerX=30*(P.curX+centerPos[2])-20 local centerX=30*(P.curX+centerPos[2])-20
--Draw ghost & rotation center --Draw ghost & rotation center
local centerDisp=ENV.center and C.rs.centerDisp[C.id] local centerDisp=ENV.center and C.RS.centerDisp[C.id]
if ENV.ghost then if ENV.ghost then
drawGhost[ENV.ghostType](P.cur.bk,P.curX,P.ghoY,ENV.ghost,P.skinLib,curColor) drawGhost[ENV.ghostType](P.cur.bk,P.curX,P.ghoY,ENV.ghost,P.skinLib,curColor)
if centerDisp then if centerDisp then
gc_setColor(1,1,1,ENV.center) gc_setColor(1,1,1,ENV.center)
gc_draw(C.rs.centerTex,centerX,-30*(P.ghoY+centerPos[1])+10) gc_draw(C.RS.centerTex,centerX,-30*(P.ghoY+centerPos[1])+10)
end end
elseif repMode then elseif repMode then
drawGhost.grayCell(P.cur.bk,P.curX,P.ghoY,.15,nil,nil) drawGhost.grayCell(P.cur.bk,P.curX,P.ghoY,.15,nil,nil)
@@ -787,7 +787,7 @@ function draw.norm(P,repMode)
_drawBlock(P.cur.bk,P.curX,P.curY,P.skinLib[curColor]) _drawBlock(P.cur.bk,P.curX,P.curY,P.skinLib[curColor])
if centerDisp then if centerDisp then
gc_setColor(1,1,1,ENV.center) gc_setColor(1,1,1,ENV.center)
gc_draw(C.rs.centerTex,centerX,-30*(P.curY+centerPos[1])+10) gc_draw(C.RS.centerTex,centerX,-30*(P.curY+centerPos[1])+10)
end end
elseif repMode then elseif repMode then
_drawBlockShade(P.cur.bk,P.curX,P.curY,trans*.3) _drawBlockShade(P.cur.bk,P.curX,P.curY,trans*.3)

View File

@@ -162,7 +162,7 @@ function Player:createBeam(R,send)
x1,y1=self.centerX,self.centerY x1,y1=self.centerX,self.centerY
else else
local C=self.cur local C=self.cur
local sc=C.rs.centerPos[C.id][C.dir] local sc=C.RS.centerPos[C.id][C.dir]
x1=self.x+(30*(self.curX+sc[2])-30+15+150)*self.size x1=self.x+(30*(self.curX+sc[2])-30+15+150)*self.size
y1=self.y+(600-30*(self.curY+sc[1])+15+self.fieldUp+self.fieldBeneath)*self.size y1=self.y+(600-30*(self.curY+sc[1])+15+self.fieldUp+self.fieldBeneath)*self.size
end end
@@ -285,9 +285,9 @@ function Player:setRS(RSname)
self.RS=rs self.RS=rs
--Reset all player's blocks' RSs --Reset all player's blocks' RSs
for i=1,#self.nextQueue do self.nextQueue[i].rs=rs end for i=1,#self.nextQueue do self.nextQueue[i].RS=rs end
for i=1,#self.holdQueue do self.holdQueue[i].rs=rs end for i=1,#self.holdQueue do self.holdQueue[i].RS=rs end
if self.cur then self.cur.rs=rs end if self.cur then self.cur.RS=rs end
end end
function Player:getHolePos()--Get a good garbage-line hole position function Player:getHolePos()--Get a good garbage-line hole position
@@ -380,11 +380,11 @@ end
function Player:getCenterX() function Player:getCenterX()
local C=self.cur local C=self.cur
return self.curX+C.rs.centerPos[C.id][C.dir][2]-5.5 return self.curX+C.RS.centerPos[C.id][C.dir][2]-5.5
end end
function Player:getCenterY() function Player:getCenterY()
local C=self.cur local C=self.cur
return self.curY-C.rs.centerPos[C.id][C.dir][1] return self.curY-C.RS.centerPos[C.id][C.dir][1]
end end
function Player:solid(x,y) function Player:solid(x,y)
if x<1 or x>10 or y<1 then return true end if x<1 or x>10 or y<1 then return true end
@@ -547,7 +547,7 @@ function Player:freshBlock(mode)--string mode: push/move/fresh/newBlock
if mode=='move'or mode=='newBlock'or mode=='fresh'then if mode=='move'or mode=='newBlock'or mode=='fresh'then
local d0,l0=ENV.drop,ENV.lock local d0,l0=ENV.drop,ENV.lock
local C=self.cur local C=self.cur
local sc=C.rs.centerPos[C.id][C.dir] local sc=C.RS.centerPos[C.id][C.dir]
if ENV.easyFresh then if ENV.easyFresh then
if self.lockDelay<l0 and self.freshTime>0 then if self.lockDelay<l0 and self.freshTime>0 then
if mode~='newBlock'then if mode~='newBlock'then
@@ -664,7 +664,7 @@ end
local spawnSFX_name={}for i=1,7 do spawnSFX_name[i]='spawn_'..i end local spawnSFX_name={}for i=1,7 do spawnSFX_name[i]='spawn_'..i end
function Player:resetBlock()--Reset Block's position and execute I*S function Player:resetBlock()--Reset Block's position and execute I*S
local C=self.cur local C=self.cur
local sc=C.rs.centerPos[C.id][C.dir] local sc=C.RS.centerPos[C.id][C.dir]
self.curX=int(6-#C.bk[1]*.5) self.curX=int(6-#C.bk[1]*.5)
local y=int(self.gameEnv.fieldH+1-modf(sc[1]))+ceil(self.fieldBeneath/30) local y=int(self.gameEnv.fieldH+1-modf(sc[1]))+ceil(self.fieldBeneath/30)
@@ -709,8 +709,8 @@ end
function Player:spin(d,ifpre) function Player:spin(d,ifpre)
local C=self.cur local C=self.cur
local sc=C.rs.centerPos[C.id][C.dir] local sc=C.RS.centerPos[C.id][C.dir]
local kickData=C.rs.kickTable[C.id] local kickData=C.RS.kickTable[C.id]
if type(kickData)=='table'then if type(kickData)=='table'then
local idir=(C.dir+d)%4 local idir=(C.dir+d)%4
kickData=kickData[C.dir*10+idir] kickData=kickData[C.dir*10+idir]
@@ -720,7 +720,7 @@ function Player:spin(d,ifpre)
return return
end end
local icb=BLOCKS[C.id][idir] local icb=BLOCKS[C.id][idir]
local isc=C.rs.centerPos[C.id][idir] local isc=C.RS.centerPos[C.id][idir]
local baseX,baseY=self.curX+sc[2]-isc[2],self.curY+sc[1]-isc[1] local baseX,baseY=self.curX+sc[2]-isc[2],self.curY+sc[1]-isc[1]
for test=1,#kickData do for test=1,#kickData do
local ix,iy=baseX+kickData[test][1],baseY+kickData[test][2] local ix,iy=baseX+kickData[test][1],baseY+kickData[test][2]
@@ -866,7 +866,7 @@ function Player:getBlock(id,name,color)--Get a block object
id=id, id=id,
dir=dir, dir=dir,
bk=BLOCKS[id][dir], bk=BLOCKS[id][dir],
rs=self.RS, RS=self.RS,
name=name or id, name=name or id,
color=ENV.bone and 17 or color or ENV.skin[id], color=ENV.bone and 17 or color or ENV.skin[id],
} }
@@ -1076,7 +1076,7 @@ do--Player.drop(self)--Place piece
local finish local finish
local cmb=self.combo local cmb=self.combo
local C,CB,CX,CY=self.cur,self.cur.bk,self.curX,self.curY local C,CB,CX,CY=self.cur,self.cur.bk,self.curX,self.curY
local sc=C.rs.centerPos[C.id][C.dir] local sc=C.RS.centerPos[C.id][C.dir]
local clear--If clear with no line fall local clear--If clear with no line fall
local cc,gbcc=0,0--Row/garbage-row cleared,full-part local cc,gbcc=0,0--Row/garbage-row cleared,full-part
local atk,exblock=0,0--Attack & extra defense local atk,exblock=0,0--Attack & extra defense