整理代码
This commit is contained in:
@@ -54,7 +54,6 @@ return{
|
|||||||
mStr(P.stat.row,69,225)
|
mStr(P.stat.row,69,225)
|
||||||
mText(drawableText.line,69,290)
|
mText(drawableText.line,69,290)
|
||||||
gc.push("transform")
|
gc.push("transform")
|
||||||
PLY.draw.applyFieldxOy(P)
|
|
||||||
PLY.draw.applyFieldOffset(P)
|
PLY.draw.applyFieldOffset(P)
|
||||||
if P.modeData.showMark==0 then
|
if P.modeData.showMark==0 then
|
||||||
local mark=TEXTURE.puzzleMark
|
local mark=TEXTURE.puzzleMark
|
||||||
@@ -62,7 +61,7 @@ return{
|
|||||||
for y=1,20 do for x=1,10 do
|
for y=1,20 do for x=1,10 do
|
||||||
local T=F[y][x]
|
local T=F[y][x]
|
||||||
if T~=0 then
|
if T~=0 then
|
||||||
gc.draw(mark[T],150+30*x-30,600-30*y)
|
gc.draw(mark[T],30*x-30,600-30*y)
|
||||||
end
|
end
|
||||||
end end
|
end end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -520,10 +520,8 @@ function draw.drawNext_hidden(P)
|
|||||||
gc_pop()
|
gc_pop()
|
||||||
end
|
end
|
||||||
|
|
||||||
function draw.applyFieldxOy()
|
function draw.applyFieldOffset(P,notNorm)
|
||||||
gc_translate(150,0)
|
if not notNorm then gc_translate(150,0)end
|
||||||
end
|
|
||||||
function draw.applyFieldOffset(P)
|
|
||||||
local O=P.fieldOff
|
local O=P.fieldOff
|
||||||
gc_translate(O.x,O.y)
|
gc_translate(O.x,O.y)
|
||||||
gc_translate(150,300)
|
gc_translate(150,300)
|
||||||
@@ -535,7 +533,6 @@ function draw.drawTargetLine(P,r)
|
|||||||
gc_setLineWidth(4)
|
gc_setLineWidth(4)
|
||||||
gc_setColor(1,r>10 and 0 or rnd(),.5)
|
gc_setColor(1,r>10 and 0 or rnd(),.5)
|
||||||
gc_push("transform")
|
gc_push("transform")
|
||||||
draw.applyFieldxOy(P)
|
|
||||||
draw.applyFieldOffset(P)
|
draw.applyFieldOffset(P)
|
||||||
gc_line(0,600-30*r,300,600-30*r)
|
gc_line(0,600-30*r,300,600-30*r)
|
||||||
gc_pop()
|
gc_pop()
|
||||||
@@ -551,119 +548,113 @@ function draw.norm(P)
|
|||||||
|
|
||||||
--Field-related things
|
--Field-related things
|
||||||
gc_push("transform")
|
gc_push("transform")
|
||||||
draw.applyFieldxOy(P)
|
draw.applyFieldOffset(P)
|
||||||
|
|
||||||
--Things shake with field
|
--Fill field
|
||||||
|
gc_setColor(0,0,0,.6)
|
||||||
|
gc_rectangle("fill",0,-10,300,610)
|
||||||
|
|
||||||
|
--Stenciled in-field things
|
||||||
|
gc_stencil(stencilBoard,"replace",1)
|
||||||
|
gc_setStencilTest("equal",1)
|
||||||
gc_push("transform")
|
gc_push("transform")
|
||||||
draw.applyFieldOffset(P)
|
boardTransform(ENV.flipBoard)
|
||||||
|
|
||||||
--Fill field
|
--Draw grid
|
||||||
gc_setColor(0,0,0,.6)
|
if ENV.grid then drawGrid(P)end
|
||||||
gc_rectangle("fill",0,-10,300,610)
|
|
||||||
|
|
||||||
--Stenciled in-field things
|
--Move camera
|
||||||
gc_stencil(stencilBoard,"replace",1)
|
gc_translate(0,600+FBN+FUP)
|
||||||
gc_setStencilTest("equal",1)
|
|
||||||
gc_push("transform")
|
|
||||||
boardTransform(ENV.flipBoard)
|
|
||||||
|
|
||||||
--Draw grid
|
local fieldTop=-ENV.fieldH*30
|
||||||
if ENV.grid then drawGrid(P)end
|
--Draw dangerous area
|
||||||
|
gc_setColor(1,0,0,.3)
|
||||||
|
gc_rectangle("fill",0,fieldTop,300,-FUP-FBN-fieldTop-620)
|
||||||
|
|
||||||
--Move camera
|
--Draw field
|
||||||
gc_translate(0,600+FBN+FUP)
|
drawField(P)
|
||||||
|
|
||||||
local fieldTop=-ENV.fieldH*30
|
--Draw spawn line
|
||||||
--Draw dangerous area
|
gc_setColor(1,sin(t)*.4+.5,0,.5)
|
||||||
gc_setColor(1,0,0,.3)
|
gc_setLineWidth(4)
|
||||||
gc_rectangle("fill",0,fieldTop,300,-FUP-FBN-fieldTop-620)
|
gc_line(0,fieldTop-FBN,300,fieldTop-FBN)
|
||||||
|
|
||||||
--Draw field
|
--Draw FXs
|
||||||
drawField(P)
|
drawFXs(P)
|
||||||
|
|
||||||
--Draw spawn line
|
--Draw current block
|
||||||
gc_setColor(1,sin(t)*.4+.5,0,.5)
|
if P.cur and P.waiting==-1 then
|
||||||
gc_setLineWidth(4)
|
local curColor=P.cur.color
|
||||||
gc_line(0,fieldTop-FBN,300,fieldTop-FBN)
|
|
||||||
|
|
||||||
--Draw FXs
|
local trans=P.lockDelay/ENV.lock
|
||||||
drawFXs(P)
|
local centerX=30*(P.curX+P.cur.sc[2])-15
|
||||||
|
|
||||||
--Draw current block
|
--Draw ghost & rotation center
|
||||||
if P.cur and P.waiting==-1 then
|
if ENV.ghost then drawGhost(P,curColor)end
|
||||||
local curColor=P.cur.color
|
if ENV.center and ENV.ghost then
|
||||||
|
gc_setColor(1,1,1,trans*ENV.center)
|
||||||
|
gc_draw(IMG.spinCenter,centerX,-30*(P.ghoY+P.cur.sc[1])+15,nil,nil,nil,4,4)
|
||||||
|
end
|
||||||
|
|
||||||
local trans=P.lockDelay/ENV.lock
|
local dy=ENV.smooth and P.ghoY~=P.curY and(P.dropDelay/ENV.drop-1)*30 or 0
|
||||||
local centerX=30*(P.curX+P.cur.sc[2])-15
|
gc_translate(0,-dy)
|
||||||
|
--Draw block & rotation center
|
||||||
--Draw ghost & rotation center
|
if ENV.block then
|
||||||
if ENV.ghost then drawGhost(P,curColor)end
|
drawBlockOutline(P,SKIN.curText[curColor],trans)
|
||||||
if ENV.center and ENV.ghost then
|
drawBlock(P,curColor)
|
||||||
gc_setColor(1,1,1,trans*ENV.center)
|
if ENV.center then
|
||||||
gc_draw(IMG.spinCenter,centerX,-30*(P.ghoY+P.cur.sc[1])+15,nil,nil,nil,4,4)
|
gc_setColor(1,1,1,ENV.center)
|
||||||
end
|
gc_draw(IMG.spinCenter,centerX,-30*(P.curY+P.cur.sc[1])+15,nil,nil,nil,4,4)
|
||||||
|
|
||||||
local dy=ENV.smooth and P.ghoY~=P.curY and(P.dropDelay/ENV.drop-1)*30 or 0
|
|
||||||
gc_translate(0,-dy)
|
|
||||||
--Draw block & rotation center
|
|
||||||
if ENV.block then
|
|
||||||
drawBlockOutline(P,SKIN.curText[curColor],trans)
|
|
||||||
drawBlock(P,curColor)
|
|
||||||
if ENV.center then
|
|
||||||
gc_setColor(1,1,1,ENV.center)
|
|
||||||
gc_draw(IMG.spinCenter,centerX,-30*(P.curY+P.cur.sc[1])+15,nil,nil,nil,4,4)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
gc_translate(0,dy)
|
|
||||||
end
|
|
||||||
|
|
||||||
--Draw next preview
|
|
||||||
if ENV.nextPos and P.nextQueue[1]then
|
|
||||||
drawNextPreview(P,P.nextQueue[1])
|
|
||||||
end
|
|
||||||
|
|
||||||
--Draw AI's drop destination
|
|
||||||
if P.AI_dest then
|
|
||||||
local texture=TEXTURE.puzzleMark[21]
|
|
||||||
local L=P.AI_dest
|
|
||||||
for i=1,#L,2 do
|
|
||||||
gc_draw(texture,30*L[i],-30*L[i+1]-30)
|
|
||||||
end
|
end
|
||||||
end
|
gc_translate(0,dy)
|
||||||
gc_pop()
|
|
||||||
gc_setStencilTest()
|
|
||||||
|
|
||||||
drawBoarders(P)
|
|
||||||
drawBuffer(P)
|
|
||||||
drawB2Bbar(P)
|
|
||||||
drawHold(P)
|
|
||||||
P:drawNext()
|
|
||||||
|
|
||||||
--Draw target selecting pad
|
|
||||||
if GAME.modeEnv.royaleMode then
|
|
||||||
if P.atkMode then
|
|
||||||
gc_setColor(1,.8,0,P.swappingAtkMode*.02)
|
|
||||||
gc_rectangle("fill",RCPB[2*P.atkMode-1],RCPB[2*P.atkMode],90,35,8,4)
|
|
||||||
end
|
|
||||||
gc_setColor(1,1,1,P.swappingAtkMode*.025)
|
|
||||||
setFont(35)
|
|
||||||
for i=1,4 do
|
|
||||||
gc_rectangle("line",RCPB[2*i-1],RCPB[2*i],90,35,8,4)
|
|
||||||
gc_printf(text.atkModeName[i],RCPB[2*i-1]-4,RCPB[2*i]+4,200,"center",nil,.5)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if ENV.hideBoard then
|
|
||||||
gc_stencil(hideBoardStencil[ENV.hideBoard],"replace",1)
|
--Draw next preview
|
||||||
gc_setStencilTest("equal",1)
|
if ENV.nextPos and P.nextQueue[1]then
|
||||||
gc_setLineWidth(20)
|
drawNextPreview(P,P.nextQueue[1])
|
||||||
for i=0,24 do
|
end
|
||||||
gc_setColor(COLOR.rainbow_grey(t*.626+i*.1))
|
|
||||||
gc_line(20*i-190,-2,20*i+10,602)
|
--Draw AI's drop destination
|
||||||
|
if P.AI_dest then
|
||||||
|
local texture=TEXTURE.puzzleMark[21]
|
||||||
|
local L=P.AI_dest
|
||||||
|
for i=1,#L,2 do
|
||||||
|
gc_draw(texture,30*L[i],-30*L[i+1]-30)
|
||||||
end
|
end
|
||||||
gc_setStencilTest()
|
|
||||||
end
|
end
|
||||||
gc_pop()
|
gc_pop()
|
||||||
|
gc_setStencilTest()
|
||||||
|
|
||||||
|
drawBoarders(P)
|
||||||
|
drawBuffer(P)
|
||||||
|
drawB2Bbar(P)
|
||||||
|
drawHold(P)
|
||||||
|
P:drawNext()
|
||||||
|
|
||||||
|
--Draw target selecting pad
|
||||||
|
if GAME.modeEnv.royaleMode then
|
||||||
|
if P.atkMode then
|
||||||
|
gc_setColor(1,.8,0,P.swappingAtkMode*.02)
|
||||||
|
gc_rectangle("fill",RCPB[2*P.atkMode-1],RCPB[2*P.atkMode],90,35,8,4)
|
||||||
|
end
|
||||||
|
gc_setColor(1,1,1,P.swappingAtkMode*.025)
|
||||||
|
setFont(35)
|
||||||
|
for i=1,4 do
|
||||||
|
gc_rectangle("line",RCPB[2*i-1],RCPB[2*i],90,35,8,4)
|
||||||
|
gc_printf(text.atkModeName[i],RCPB[2*i-1]-4,RCPB[2*i]+4,200,"center",nil,.5)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if ENV.hideBoard then
|
||||||
|
gc_stencil(hideBoardStencil[ENV.hideBoard],"replace",1)
|
||||||
|
gc_setStencilTest("equal",1)
|
||||||
|
gc_setLineWidth(20)
|
||||||
|
for i=0,24 do
|
||||||
|
gc_setColor(COLOR.rainbow_grey(t*.626+i*.1))
|
||||||
|
gc_line(20*i-190,-2,20*i+10,602)
|
||||||
|
end
|
||||||
|
gc_setStencilTest()
|
||||||
|
end
|
||||||
--Bonus texts
|
--Bonus texts
|
||||||
TEXT.draw(P.bonus)
|
TEXT.draw(P.bonus)
|
||||||
|
|
||||||
@@ -711,114 +702,109 @@ function draw.norm_remote(P)
|
|||||||
|
|
||||||
--Field-related things
|
--Field-related things
|
||||||
gc_push("transform")
|
gc_push("transform")
|
||||||
draw.applyFieldxOy(P)
|
draw.applyFieldOffset(P)
|
||||||
|
|
||||||
--Draw username
|
--Draw username
|
||||||
setFont(30)
|
setFont(30)
|
||||||
gc_setColor(1,1,1)
|
gc_setColor(1,1,1)
|
||||||
mStr(P.userName,150,-60)
|
mStr(P.userName,150,-60)
|
||||||
|
|
||||||
--Things shake with field
|
--Fill field
|
||||||
|
gc_setColor(0,0,0,.6)
|
||||||
|
gc_rectangle("fill",0,-10,300,610)
|
||||||
|
|
||||||
|
--Stenciled in-field things
|
||||||
|
gc_stencil(stencilBoard,"replace",1)
|
||||||
|
gc_setStencilTest("equal",1)
|
||||||
gc_push("transform")
|
gc_push("transform")
|
||||||
draw.applyFieldOffset(P)
|
boardTransform(ENV.flipBoard)
|
||||||
|
|
||||||
--Fill field
|
--Draw grid
|
||||||
gc_setColor(0,0,0,.6)
|
if ENV.grid then drawGrid(P)end
|
||||||
gc_rectangle("fill",0,-10,300,610)
|
|
||||||
|
|
||||||
--Stenciled in-field things
|
--Move camera
|
||||||
gc_stencil(stencilBoard,"replace",1)
|
gc_translate(0,600+FBN+FUP)
|
||||||
gc_setStencilTest("equal",1)
|
|
||||||
gc_push("transform")
|
|
||||||
boardTransform(ENV.flipBoard)
|
|
||||||
|
|
||||||
--Draw grid
|
local fieldTop=-ENV.fieldH*30
|
||||||
if ENV.grid then drawGrid(P)end
|
--Draw dangerous area
|
||||||
|
gc_setColor(1,0,0,.3)
|
||||||
|
gc_rectangle("fill",0,fieldTop,300,-FUP-FBN-fieldTop-620)
|
||||||
|
|
||||||
--Move camera
|
--Draw field
|
||||||
gc_translate(0,600+FBN+FUP)
|
drawField(P)
|
||||||
|
|
||||||
local fieldTop=-ENV.fieldH*30
|
--Draw spawn line
|
||||||
--Draw dangerous area
|
gc_setColor(1,sin(t)*.4+.5,0,.5)
|
||||||
gc_setColor(1,0,0,.3)
|
gc_setLineWidth(4)
|
||||||
gc_rectangle("fill",0,fieldTop,300,-FUP-FBN-fieldTop-620)
|
gc_line(0,fieldTop-FBN,300,fieldTop-FBN)
|
||||||
|
|
||||||
--Draw field
|
--Draw FXs
|
||||||
drawField(P)
|
drawFXs(P)
|
||||||
|
|
||||||
--Draw spawn line
|
--Draw current block
|
||||||
gc_setColor(1,sin(t)*.4+.5,0,.5)
|
if P.cur and P.waiting==-1 then
|
||||||
gc_setLineWidth(4)
|
local curColor=P.cur.color
|
||||||
gc_line(0,fieldTop-FBN,300,fieldTop-FBN)
|
|
||||||
|
|
||||||
--Draw FXs
|
local trans=P.lockDelay/ENV.lock
|
||||||
drawFXs(P)
|
local centerX=30*(P.curX+P.cur.sc[2])-15
|
||||||
|
|
||||||
--Draw current block
|
--Draw ghost & rotation center
|
||||||
if P.cur and P.waiting==-1 then
|
if ENV.ghost then drawGhost(P,curColor)end
|
||||||
local curColor=P.cur.color
|
if ENV.center and ENV.ghost then
|
||||||
|
gc_setColor(1,1,1,trans*ENV.center)
|
||||||
|
gc_draw(IMG.spinCenter,centerX,-30*(P.ghoY+P.cur.sc[1])+15,nil,nil,nil,4,4)
|
||||||
|
end
|
||||||
|
|
||||||
local trans=P.lockDelay/ENV.lock
|
local dy=ENV.smooth and P.ghoY~=P.curY and(P.dropDelay/ENV.drop-1)*30 or 0
|
||||||
local centerX=30*(P.curX+P.cur.sc[2])-15
|
gc_translate(0,-dy)
|
||||||
|
--Draw block & rotation center
|
||||||
--Draw ghost & rotation center
|
if ENV.block then
|
||||||
if ENV.ghost then drawGhost(P,curColor)end
|
drawBlockOutline(P,SKIN.curText[curColor],trans)
|
||||||
if ENV.center and ENV.ghost then
|
drawBlock(P,curColor)
|
||||||
gc_setColor(1,1,1,trans*ENV.center)
|
if ENV.center then
|
||||||
gc_draw(IMG.spinCenter,centerX,-30*(P.ghoY+P.cur.sc[1])+15,nil,nil,nil,4,4)
|
gc_setColor(1,1,1,ENV.center)
|
||||||
end
|
gc_draw(IMG.spinCenter,centerX,-30*(P.curY+P.cur.sc[1])+15,nil,nil,nil,4,4)
|
||||||
|
|
||||||
local dy=ENV.smooth and P.ghoY~=P.curY and(P.dropDelay/ENV.drop-1)*30 or 0
|
|
||||||
gc_translate(0,-dy)
|
|
||||||
--Draw block & rotation center
|
|
||||||
if ENV.block then
|
|
||||||
drawBlockOutline(P,SKIN.curText[curColor],trans)
|
|
||||||
drawBlock(P,curColor)
|
|
||||||
if ENV.center then
|
|
||||||
gc_setColor(1,1,1,ENV.center)
|
|
||||||
gc_draw(IMG.spinCenter,centerX,-30*(P.curY+P.cur.sc[1])+15,nil,nil,nil,4,4)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
gc_translate(0,dy)
|
end
|
||||||
end
|
gc_translate(0,dy)
|
||||||
|
|
||||||
--Draw next preview
|
|
||||||
if ENV.nextPos and P.nextQueue[1]then
|
|
||||||
drawNextPreview(P,P.nextQueue[1])
|
|
||||||
end
|
|
||||||
gc_pop()
|
|
||||||
gc_setStencilTest()
|
|
||||||
|
|
||||||
drawBoarders(P)
|
|
||||||
drawBuffer(P)
|
|
||||||
drawB2Bbar(P)
|
|
||||||
drawHold(P)
|
|
||||||
P:drawNext()
|
|
||||||
|
|
||||||
--Draw target selecting pad
|
|
||||||
if GAME.modeEnv.royaleMode then
|
|
||||||
if P.atkMode then
|
|
||||||
gc_setColor(1,.8,0,P.swappingAtkMode*.02)
|
|
||||||
gc_rectangle("fill",RCPB[2*P.atkMode-1],RCPB[2*P.atkMode],90,35,8,4)
|
|
||||||
end
|
|
||||||
gc_setColor(1,1,1,P.swappingAtkMode*.025)
|
|
||||||
setFont(35)
|
|
||||||
for i=1,4 do
|
|
||||||
gc_rectangle("line",RCPB[2*i-1],RCPB[2*i],90,35,8,4)
|
|
||||||
gc_printf(text.atkModeName[i],RCPB[2*i-1]-4,RCPB[2*i]+4,200,"center",nil,.5)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
if ENV.hideBoard then
|
|
||||||
gc_stencil(hideBoardStencil[ENV.hideBoard],"replace",1)
|
--Draw next preview
|
||||||
gc_setStencilTest("equal",1)
|
if ENV.nextPos and P.nextQueue[1]then
|
||||||
gc_setLineWidth(20)
|
drawNextPreview(P,P.nextQueue[1])
|
||||||
for i=0,24 do
|
|
||||||
gc_setColor(COLOR.rainbow_grey(t*.626+i*.1))
|
|
||||||
gc_line(20*i-190,-2,20*i+10,602)
|
|
||||||
end
|
|
||||||
gc_setStencilTest()
|
|
||||||
end
|
end
|
||||||
gc_pop()
|
gc_pop()
|
||||||
|
gc_setStencilTest()
|
||||||
|
|
||||||
|
drawBoarders(P)
|
||||||
|
drawBuffer(P)
|
||||||
|
drawB2Bbar(P)
|
||||||
|
drawHold(P)
|
||||||
|
P:drawNext()
|
||||||
|
|
||||||
|
--Draw target selecting pad
|
||||||
|
if GAME.modeEnv.royaleMode then
|
||||||
|
if P.atkMode then
|
||||||
|
gc_setColor(1,.8,0,P.swappingAtkMode*.02)
|
||||||
|
gc_rectangle("fill",RCPB[2*P.atkMode-1],RCPB[2*P.atkMode],90,35,8,4)
|
||||||
|
end
|
||||||
|
gc_setColor(1,1,1,P.swappingAtkMode*.025)
|
||||||
|
setFont(35)
|
||||||
|
for i=1,4 do
|
||||||
|
gc_rectangle("line",RCPB[2*i-1],RCPB[2*i],90,35,8,4)
|
||||||
|
gc_printf(text.atkModeName[i],RCPB[2*i-1]-4,RCPB[2*i]+4,200,"center",nil,.5)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if ENV.hideBoard then
|
||||||
|
gc_stencil(hideBoardStencil[ENV.hideBoard],"replace",1)
|
||||||
|
gc_setStencilTest("equal",1)
|
||||||
|
gc_setLineWidth(20)
|
||||||
|
for i=0,24 do
|
||||||
|
gc_setColor(COLOR.rainbow_grey(t*.626+i*.1))
|
||||||
|
gc_line(20*i-190,-2,20*i+10,602)
|
||||||
|
end
|
||||||
|
gc_setStencilTest()
|
||||||
|
end
|
||||||
|
|
||||||
--Bonus texts
|
--Bonus texts
|
||||||
TEXT.draw(P.bonus)
|
TEXT.draw(P.bonus)
|
||||||
@@ -913,7 +899,7 @@ function draw.demo(P)
|
|||||||
gc_translate(P.x,P.y)
|
gc_translate(P.x,P.y)
|
||||||
gc_scale(P.size)
|
gc_scale(P.size)
|
||||||
gc_push("transform")
|
gc_push("transform")
|
||||||
draw.applyFieldOffset(P)
|
draw.applyFieldOffset(P,true)
|
||||||
|
|
||||||
--Frame
|
--Frame
|
||||||
gc_setColor(0,0,0,.6)
|
gc_setColor(0,0,0,.6)
|
||||||
|
|||||||
Reference in New Issue
Block a user