整理代码
This commit is contained in:
@@ -430,7 +430,7 @@ function royaleLevelup()
|
|||||||
local P=PLAYERS.alive[i]
|
local P=PLAYERS.alive[i]
|
||||||
P.gameEnv.drop=int(P.gameEnv.drop*.3)
|
P.gameEnv.drop=int(P.gameEnv.drop*.3)
|
||||||
if P.gameEnv.drop==0 then
|
if P.gameEnv.drop==0 then
|
||||||
P.curY=P.imgY
|
P.curY=P.ghoY
|
||||||
P:set20G(true)
|
P:set20G(true)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -122,11 +122,11 @@ do
|
|||||||
if P.type=="human"then SFX.fieldPlay("rotate",nil,P)end
|
if P.type=="human"then SFX.fieldPlay("rotate",nil,P)end
|
||||||
if not P.gameEnv.ospin then return end
|
if not P.gameEnv.ospin then return end
|
||||||
local x,y=P.curX,P.curY
|
local x,y=P.curX,P.curY
|
||||||
if y==P.imgY and((P:solid(x-1,y)or P:solid(x-1,y+1)))and(P:solid(x+2,y)or P:solid(x+2,y+1))then
|
if y==P.ghoY and((P:solid(x-1,y)or P:solid(x-1,y+1)))and(P:solid(x+2,y)or P:solid(x+2,y+1))then
|
||||||
local D=P.spinSeq%100*10+d
|
local D=P.spinSeq%100*10+d
|
||||||
P.spinSeq=D
|
P.spinSeq=D
|
||||||
if D<100 then
|
if D<100 then
|
||||||
P:freshBlock(true,true)
|
P:freshBlock("fresh")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
for i=1,#OspinList do
|
for i=1,#OspinList do
|
||||||
@@ -144,7 +144,7 @@ do
|
|||||||
P.dir,P.sc=dir,spinCenters[id][dir]
|
P.dir,P.sc=dir,spinCenters[id][dir]
|
||||||
P.spinLast=2
|
P.spinLast=2
|
||||||
P.stat.rotate=P.stat.rotate+1
|
P.stat.rotate=P.stat.rotate+1
|
||||||
P:freshBlock(false,true)
|
P:freshBlock("move")
|
||||||
P.spinSeq=0
|
P.spinSeq=0
|
||||||
SFX.fieldPlay("rotatekick",nil,P)
|
SFX.fieldPlay("rotatekick",nil,P)
|
||||||
return
|
return
|
||||||
@@ -153,7 +153,7 @@ do
|
|||||||
end
|
end
|
||||||
else
|
else
|
||||||
P.spinSeq=0
|
P.spinSeq=0
|
||||||
P:freshBlock(true,true)
|
P:freshBlock("fresh")
|
||||||
end
|
end
|
||||||
end,--O
|
end,--O
|
||||||
{
|
{
|
||||||
@@ -271,12 +271,12 @@ do
|
|||||||
if not P:ifoverlap(P.cur.bk,x,y)then
|
if not P:ifoverlap(P.cur.bk,x,y)then
|
||||||
P.curX,P.curY=x,y
|
P.curX,P.curY=x,y
|
||||||
P.spinLast=1
|
P.spinLast=1
|
||||||
P:freshBlock(false,true)
|
P:freshBlock("move")
|
||||||
P.stat.rotate=P.stat.rotate+1
|
P.stat.rotate=P.stat.rotate+1
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
P:freshBlock(true,true)
|
P:freshBlock("fresh")
|
||||||
end,--X
|
end,--X
|
||||||
{
|
{
|
||||||
[01]={{-1, 0},{-1, 1},{ 0,-3},{-1, 1},{-1, 2},{ 0, 1}},
|
[01]={{-1, 0},{-1, 1},{ 0,-3},{-1, 1},{-1, 2},{ 0, 1}},
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ local function drawGhost(P,clr)
|
|||||||
local texture=SKIN.curText
|
local texture=SKIN.curText
|
||||||
for i=1,P.r do for j=1,P.c do
|
for i=1,P.r do for j=1,P.c do
|
||||||
if P.cur.bk[i][j]then
|
if P.cur.bk[i][j]then
|
||||||
Draw(texture[clr],30*(j+P.curX-1)-30,-30*(i+P.imgY-1))-- drawCell(i+P.imgY-1,j+P.curX-1,clr)
|
Draw(texture[clr],30*(j+P.curX-1)-30,-30*(i+P.ghoY-1))-- drawCell(i+P.ghoY-1,j+P.curX-1,clr)
|
||||||
end
|
end
|
||||||
end end
|
end end
|
||||||
end
|
end
|
||||||
@@ -371,7 +371,7 @@ function draw.norm(P)
|
|||||||
--Draw ghost
|
--Draw ghost
|
||||||
if ENV.ghost then drawGhost(P,curColor)end
|
if ENV.ghost then drawGhost(P,curColor)end
|
||||||
|
|
||||||
local dy=ENV.smooth and P.imgY~=P.curY and(P.dropDelay/ENV.drop-1)*30 or 0
|
local dy=ENV.smooth and P.ghoY~=P.curY and(P.dropDelay/ENV.drop-1)*30 or 0
|
||||||
gc.translate(0,-dy)
|
gc.translate(0,-dy)
|
||||||
local trans=P.lockDelay/ENV.lock
|
local trans=P.lockDelay/ENV.lock
|
||||||
|
|
||||||
@@ -390,7 +390,7 @@ function draw.norm(P)
|
|||||||
gc.translate(0,dy)
|
gc.translate(0,dy)
|
||||||
if ENV.center and ENV.ghost then
|
if ENV.center and ENV.ghost then
|
||||||
gc_setColor(1,1,1,trans*ENV.center)
|
gc_setColor(1,1,1,trans*ENV.center)
|
||||||
gc.draw(IMG.spinCenter,x,-30*(P.imgY+P.sc[1])+15,nil,nil,nil,4,4)
|
gc.draw(IMG.spinCenter,x,-30*(P.ghoY+P.sc[1])+15,nil,nil,nil,4,4)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -504,7 +504,7 @@ function draw.norm(P)
|
|||||||
--Display Ys
|
--Display Ys
|
||||||
-- gc.setLineWidth(6)
|
-- gc.setLineWidth(6)
|
||||||
-- if P.curY then gc_setColor(1,.4,0,.42)gc.line(0,611-P.curY*30,300,611-P.curY*30)end
|
-- if P.curY then gc_setColor(1,.4,0,.42)gc.line(0,611-P.curY*30,300,611-P.curY*30)end
|
||||||
-- if P.imgY then gc_setColor(0,1,.4,.42)gc.line(0,615-P.imgY*30,300,615-P.imgY*30)end
|
-- if P.ghoY then gc_setColor(0,1,.4,.42)gc.line(0,615-P.ghoY*30,300,615-P.ghoY*30)end
|
||||||
-- if P.minY then gc_setColor(0,.4,1,.42)gc.line(0,619-P.minY*30,300,619-P.minY*30)end
|
-- if P.minY then gc_setColor(0,.4,1,.42)gc.line(0,619-P.minY*30,300,619-P.minY*30)end
|
||||||
-- gc_setColor(0,.4,1,.42)gc.line(0,600-P.garbageBeneath*30,300,600-P.garbageBeneath*30)
|
-- gc_setColor(0,.4,1,.42)gc.line(0,600-P.garbageBeneath*30,300,600-P.garbageBeneath*30)
|
||||||
gc.pop()
|
gc.pop()
|
||||||
@@ -688,7 +688,7 @@ function draw.demo(P)
|
|||||||
if P.cur and P.waiting==-1 then
|
if P.cur and P.waiting==-1 then
|
||||||
if ENV.ghost then drawGhost(P,curColor)end
|
if ENV.ghost then drawGhost(P,curColor)end
|
||||||
if ENV.block then
|
if ENV.block then
|
||||||
local dy=ENV.smooth and P.imgY~=P.curY and(P.dropDelay/ENV.drop-1)*30 or 0
|
local dy=ENV.smooth and P.ghoY~=P.curY and(P.dropDelay/ENV.drop-1)*30 or 0
|
||||||
gc.translate(0,-dy)
|
gc.translate(0,-dy)
|
||||||
drawBlockOutline(P,SKIN.curText[curColor],P.lockDelay/ENV.lock)
|
drawBlockOutline(P,SKIN.curText[curColor],P.lockDelay/ENV.lock)
|
||||||
drawBlock(P,curColor)
|
drawBlock(P,curColor)
|
||||||
|
|||||||
@@ -137,7 +137,7 @@ local function newEmptyPlayer(id,mini)
|
|||||||
--P.cur={bk=matrix[2], id=shapeID, color=colorID, name=nameID}
|
--P.cur={bk=matrix[2], id=shapeID, color=colorID, name=nameID}
|
||||||
--P.sc,P.dir={0,0},0--SpinCenterCoord, direction
|
--P.sc,P.dir={0,0},0--SpinCenterCoord, direction
|
||||||
--P.r,P.c=0,0--row, col
|
--P.r,P.c=0,0--row, col
|
||||||
-- P.curX,P.curY,P.imgY,P.minY=0,0,0,0--x,y,ghostY
|
-- P.curX,P.curY,P.ghoY,P.minY=0,0,0,0--x,y,ghostY
|
||||||
P.holdQueue={}
|
P.holdQueue={}
|
||||||
P.holdTime=0
|
P.holdTime=0
|
||||||
P.nextQueue={}
|
P.nextQueue={}
|
||||||
|
|||||||
@@ -262,13 +262,13 @@ function Player.garbageRise(P,color,amount,pos)--Release n-lines garbage to fiel
|
|||||||
P.fieldBeneath=P.fieldBeneath+amount*30
|
P.fieldBeneath=P.fieldBeneath+amount*30
|
||||||
if P.cur then
|
if P.cur then
|
||||||
P.curY=P.curY+amount
|
P.curY=P.curY+amount
|
||||||
P.imgY=P.imgY+amount
|
P.ghoY=P.ghoY+amount
|
||||||
end
|
end
|
||||||
P.garbageBeneath=P.garbageBeneath+amount
|
P.garbageBeneath=P.garbageBeneath+amount
|
||||||
for i=1,#P.clearingRow do
|
for i=1,#P.clearingRow do
|
||||||
P.clearingRow[i]=P.clearingRow[i]+amount
|
P.clearingRow[i]=P.clearingRow[i]+amount
|
||||||
end
|
end
|
||||||
P:freshBlock(false,false)
|
P:freshBlock("push")
|
||||||
for i=1,#P.lockFX do
|
for i=1,#P.lockFX do
|
||||||
_=P.lockFX[i]
|
_=P.lockFX[i]
|
||||||
_[2]=_[2]-30*amount--Shift 30px per line cleared
|
_[2]=_[2]-30*amount--Shift 30px per line cleared
|
||||||
@@ -300,8 +300,8 @@ function Player.pushLineList(P,L,mir)--Push some lines to field
|
|||||||
end
|
end
|
||||||
P.fieldBeneath=P.fieldBeneath+30*l
|
P.fieldBeneath=P.fieldBeneath+30*l
|
||||||
P.curY=P.curY+l
|
P.curY=P.curY+l
|
||||||
P.imgY=P.imgY+l
|
P.ghoY=P.ghoY+l
|
||||||
P:freshBlock(false,false)
|
P:freshBlock("push")
|
||||||
end
|
end
|
||||||
function Player.pushNextList(P,L,mir)--Push some nexts to nextQueue
|
function Player.pushNextList(P,L,mir)--Push some nexts to nextQueue
|
||||||
for i=1,#L do
|
for i=1,#L do
|
||||||
@@ -403,62 +403,65 @@ function Player.changeAtk(P,R)
|
|||||||
P.atking=nil
|
P.atking=nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function Player.freshBlock(P,keepGhost,control,system)
|
function Player.freshBlock(P,mode)--string mode: push/move/fresh/newBlock
|
||||||
local ENV=P.gameEnv
|
local ENV=P.gameEnv
|
||||||
if not keepGhost and P.cur then
|
|
||||||
P.imgY=min(#P.field+1,P.curY)
|
--Fresh ghost
|
||||||
|
if(mode=="push"or mode=="move"or mode=="newBlock")and P.cur then
|
||||||
|
P.ghoY=min(#P.field+1,P.curY)
|
||||||
if P._20G or P.keyPressing[7]and ENV.sdarr==0 then
|
if P._20G or P.keyPressing[7]and ENV.sdarr==0 then
|
||||||
local _=P.imgY
|
local _=P.ghoY
|
||||||
|
|
||||||
--Move ghost to bottom
|
--Move ghost to bottom
|
||||||
while not P:ifoverlap(P.cur.bk,P.curX,P.imgY-1)do
|
while not P:ifoverlap(P.cur.bk,P.curX,P.ghoY-1)do
|
||||||
P.imgY=P.imgY-1
|
P.ghoY=P.ghoY-1
|
||||||
end
|
end
|
||||||
|
|
||||||
--Cancel spinLast
|
--Cancel spinLast
|
||||||
if _~=P.imgY then
|
if _~=P.ghoY then
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
end
|
end
|
||||||
|
|
||||||
--Create FX if dropped
|
--Create FX if dropped
|
||||||
if P.curY>P.imgY then
|
if P.curY>P.ghoY then
|
||||||
if ENV.dropFX and ENV.block and P.curY-P.imgY-P.r>-1 then
|
if ENV.dropFX and ENV.block and P.curY-P.ghoY-P.r>-1 then
|
||||||
P:createDropFX(P.curX,P.curY-1,P.c,P.curY-P.imgY-P.r+1)
|
P:createDropFX(P.curX,P.curY-1,P.c,P.curY-P.ghoY-P.r+1)
|
||||||
end
|
end
|
||||||
if ENV.shakeFX then
|
if ENV.shakeFX then
|
||||||
P.fieldOff.vy=ENV.shakeFX*.5
|
P.fieldOff.vy=ENV.shakeFX*.5
|
||||||
end
|
end
|
||||||
P.curY=P.imgY
|
P.curY=P.ghoY
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
while not P:ifoverlap(P.cur.bk,P.curX,P.imgY-1)do
|
while not P:ifoverlap(P.cur.bk,P.curX,P.ghoY-1)do
|
||||||
P.imgY=P.imgY-1
|
P.ghoY=P.ghoY-1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
if control then
|
--Fresh delays
|
||||||
|
if mode=="move"or mode=="fresh"or mode=="newBlock"then
|
||||||
|
local d0,l0=ENV.drop,ENV.lock
|
||||||
if ENV.easyFresh then
|
if ENV.easyFresh then
|
||||||
local d0=ENV.lock
|
if P.lockDelay<l0 and P.freshTime>0 then
|
||||||
if P.lockDelay<d0 and P.freshTime>0 then
|
if mode~="newBlock"then
|
||||||
if not system then
|
|
||||||
P.freshTime=P.freshTime-1
|
P.freshTime=P.freshTime-1
|
||||||
end
|
end
|
||||||
P.lockDelay=d0
|
P.lockDelay=l0
|
||||||
P.dropDelay=ENV.drop
|
P.dropDelay=d0
|
||||||
end
|
end
|
||||||
if P.curY<P.minY then
|
if P.curY<P.minY then
|
||||||
P.minY=P.curY
|
P.minY=P.curY
|
||||||
P.dropDelay=ENV.drop
|
P.dropDelay=d0
|
||||||
P.lockDelay=ENV.lock
|
P.lockDelay=l0
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if P.curY<P.minY then
|
if P.curY<P.minY then
|
||||||
P.minY=P.curY
|
P.minY=P.curY
|
||||||
if P.lockDelay<ENV.lock and P.freshTime>0 then
|
if P.lockDelay<l0 and P.freshTime>0 then
|
||||||
P.freshTime=P.freshTime-1
|
P.freshTime=P.freshTime-1
|
||||||
P.dropDelay=ENV.drop
|
P.dropDelay=d0
|
||||||
P.lockDelay=ENV.lock
|
P.lockDelay=l0
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -557,7 +560,7 @@ function Player.spin(P,d,ifpre)
|
|||||||
iki=iki[P.dir*10+idir]
|
iki=iki[P.dir*10+idir]
|
||||||
if not iki then
|
if not iki then
|
||||||
if P.gameEnv.easyFresh then
|
if P.gameEnv.easyFresh then
|
||||||
P:freshBlock(false,true)
|
P:freshBlock("move")
|
||||||
end
|
end
|
||||||
SFX.fieldPlay(ifpre and"prerotate"or"rotate",nil,P)
|
SFX.fieldPlay(ifpre and"prerotate"or"rotate",nil,P)
|
||||||
return
|
return
|
||||||
@@ -574,7 +577,7 @@ function Player.spin(P,d,ifpre)
|
|||||||
P.r,P.c=ir,ic
|
P.r,P.c=ir,ic
|
||||||
P.spinLast=test==2 and 0 or 1
|
P.spinLast=test==2 and 0 or 1
|
||||||
if not ifpre then
|
if not ifpre then
|
||||||
P:freshBlock(false,true)
|
P:freshBlock("move")
|
||||||
end
|
end
|
||||||
if iki[test][2]>0 and not P.gameEnv.easyFresh then
|
if iki[test][2]>0 and not P.gameEnv.easyFresh then
|
||||||
P.freshTime=P.freshTime-1
|
P.freshTime=P.freshTime-1
|
||||||
@@ -621,7 +624,7 @@ function Player.hold(P,ifpre)
|
|||||||
P.cur=rem(P.holdQueue,1)
|
P.cur=rem(P.holdQueue,1)
|
||||||
|
|
||||||
P:resetBlock()
|
P:resetBlock()
|
||||||
P:freshBlock(false,true)
|
P:freshBlock("move")
|
||||||
P.dropDelay=P.gameEnv.drop
|
P.dropDelay=P.gameEnv.drop
|
||||||
P.lockDelay=P.gameEnv.lock
|
P.lockDelay=P.gameEnv.lock
|
||||||
if P:ifoverlap(P.cur.bk,P.curX,P.curY)then
|
if P:ifoverlap(P.cur.bk,P.curX,P.curY)then
|
||||||
@@ -692,7 +695,7 @@ function Player.popNext(P,ifhold)--Pop nextQueue to hand
|
|||||||
P:lock()
|
P:lock()
|
||||||
P:lose()
|
P:lose()
|
||||||
end
|
end
|
||||||
P:freshBlock(false,true,true)
|
P:freshBlock("newBlock")
|
||||||
end
|
end
|
||||||
|
|
||||||
--IHdS
|
--IHdS
|
||||||
@@ -1728,8 +1731,8 @@ function Player.act_moveLeft(P,auto)
|
|||||||
P:createMoveFX("left")
|
P:createMoveFX("left")
|
||||||
end
|
end
|
||||||
P.curX=P.curX-1
|
P.curX=P.curX-1
|
||||||
P:freshBlock(false,true)
|
P:freshBlock("move")
|
||||||
if P.sound and P.curY==P.imgY then SFX.play("move")end
|
if P.sound and P.curY==P.ghoY then SFX.play("move")end
|
||||||
if not auto then P.moving=0 end
|
if not auto then P.moving=0 end
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
else
|
else
|
||||||
@@ -1755,8 +1758,8 @@ function Player.act_moveRight(P,auto)
|
|||||||
P:createMoveFX("right")
|
P:createMoveFX("right")
|
||||||
end
|
end
|
||||||
P.curX=P.curX+1
|
P.curX=P.curX+1
|
||||||
P:freshBlock(false,true)
|
P:freshBlock("move")
|
||||||
if P.sound and P.curY==P.imgY then SFX.play("move")end
|
if P.sound and P.curY==P.ghoY then SFX.play("move")end
|
||||||
if not auto then P.moving=0 end
|
if not auto then P.moving=0 end
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
else
|
else
|
||||||
@@ -1794,11 +1797,11 @@ function Player.act_hardDrop(P)
|
|||||||
end
|
end
|
||||||
P.keyPressing[6]=false
|
P.keyPressing[6]=false
|
||||||
elseif P.control and P.waiting==-1 and P.cur then
|
elseif P.control and P.waiting==-1 and P.cur then
|
||||||
if P.curY>P.imgY then
|
if P.curY>P.ghoY then
|
||||||
if P.gameEnv.dropFX and P.gameEnv.block and P.curY-P.imgY-P.r>-1 then
|
if P.gameEnv.dropFX and P.gameEnv.block and P.curY-P.ghoY-P.r>-1 then
|
||||||
P:createDropFX(P.curX,P.curY-1,P.c,P.curY-P.imgY-P.r+1)
|
P:createDropFX(P.curX,P.curY-1,P.c,P.curY-P.ghoY-P.r+1)
|
||||||
end
|
end
|
||||||
P.curY=P.imgY
|
P.curY=P.ghoY
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
if P.gameEnv.shakeFX then
|
if P.gameEnv.shakeFX then
|
||||||
P.fieldOff.vy=P.gameEnv.shakeFX*.6
|
P.fieldOff.vy=P.gameEnv.shakeFX*.6
|
||||||
@@ -1821,9 +1824,9 @@ function Player.act_softDrop(P)
|
|||||||
else
|
else
|
||||||
P.downing=1
|
P.downing=1
|
||||||
if P.control and P.waiting==-1 and P.cur then
|
if P.control and P.waiting==-1 and P.cur then
|
||||||
if P.curY>P.imgY then
|
if P.curY>P.ghoY then
|
||||||
P.curY=P.curY-1
|
P.curY=P.curY-1
|
||||||
P:freshBlock(true,true)
|
P:freshBlock("fresh")
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -1855,7 +1858,7 @@ function Player.act_insLeft(P,auto)
|
|||||||
P:createMoveFX("left")
|
P:createMoveFX("left")
|
||||||
end
|
end
|
||||||
P.curX=P.curX-1
|
P.curX=P.curX-1
|
||||||
P:freshBlock(false,true)
|
P:freshBlock("move")
|
||||||
end
|
end
|
||||||
if P.curX~=x0 then
|
if P.curX~=x0 then
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
@@ -1877,7 +1880,7 @@ function Player.act_insRight(P,auto)
|
|||||||
P:createMoveFX("right")
|
P:createMoveFX("right")
|
||||||
end
|
end
|
||||||
P.curX=P.curX+1
|
P.curX=P.curX+1
|
||||||
P:freshBlock(false,true)
|
P:freshBlock("move")
|
||||||
end
|
end
|
||||||
if P.curX~=x0 then
|
if P.curX~=x0 then
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
@@ -1892,48 +1895,48 @@ function Player.act_insRight(P,auto)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
function Player.act_insDown(P)
|
function Player.act_insDown(P)
|
||||||
if P.cur and P.curY>P.imgY then
|
if P.cur and P.curY>P.ghoY then
|
||||||
if P.gameEnv.dropFX and P.gameEnv.block and P.curY-P.imgY-P.r>-1 then
|
if P.gameEnv.dropFX and P.gameEnv.block and P.curY-P.ghoY-P.r>-1 then
|
||||||
P:createDropFX(P.curX,P.curY-1,P.c,P.curY-P.imgY-P.r+1)
|
P:createDropFX(P.curX,P.curY-1,P.c,P.curY-P.ghoY-P.r+1)
|
||||||
end
|
end
|
||||||
if P.gameEnv.shakeFX then
|
if P.gameEnv.shakeFX then
|
||||||
P.fieldOff.vy=P.gameEnv.shakeFX*.5
|
P.fieldOff.vy=P.gameEnv.shakeFX*.5
|
||||||
end
|
end
|
||||||
P.curY=P.imgY
|
P.curY=P.ghoY
|
||||||
P.lockDelay=P.gameEnv.lock
|
P.lockDelay=P.gameEnv.lock
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
P:freshBlock(true,true)
|
P:freshBlock("fresh")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function Player.act_down1(P)
|
function Player.act_down1(P)
|
||||||
if P.cur and P.curY>P.imgY then
|
if P.cur and P.curY>P.ghoY then
|
||||||
if P.gameEnv.moveFX and P.gameEnv.block then
|
if P.gameEnv.moveFX and P.gameEnv.block then
|
||||||
P:createMoveFX("down")
|
P:createMoveFX("down")
|
||||||
end
|
end
|
||||||
P.curY=P.curY-1
|
P.curY=P.curY-1
|
||||||
P:freshBlock(true,true)
|
P:freshBlock("fresh")
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function Player.act_down4(P)
|
function Player.act_down4(P)
|
||||||
if P.cur and P.curY>P.imgY then
|
if P.cur and P.curY>P.ghoY then
|
||||||
local y=max(P.curY-4,P.imgY)
|
local y=max(P.curY-4,P.ghoY)
|
||||||
if P.gameEnv.dropFX and P.gameEnv.block and P.curY-y-P.r>-1 then
|
if P.gameEnv.dropFX and P.gameEnv.block and P.curY-y-P.r>-1 then
|
||||||
P:createDropFX(P.curX,P.curY-1,P.c,P.curY-y-P.r+1)
|
P:createDropFX(P.curX,P.curY-1,P.c,P.curY-y-P.r+1)
|
||||||
end
|
end
|
||||||
P.curY=y
|
P.curY=y
|
||||||
P:freshBlock(true,true)
|
P:freshBlock("fresh")
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function Player.act_down10(P)
|
function Player.act_down10(P)
|
||||||
if P.cur and P.curY>P.imgY then
|
if P.cur and P.curY>P.ghoY then
|
||||||
local y=max(P.curY-10,P.imgY)
|
local y=max(P.curY-10,P.ghoY)
|
||||||
if P.gameEnv.dropFX and P.gameEnv.block and P.curY-y-P.r>-1 then
|
if P.gameEnv.dropFX and P.gameEnv.block and P.curY-y-P.r>-1 then
|
||||||
P:createDropFX(P.curX,P.curY-1,P.c,P.curY-y-P.r+1)
|
P:createDropFX(P.curX,P.curY-1,P.c,P.curY-y-P.r+1)
|
||||||
end
|
end
|
||||||
P.curY=y
|
P.curY=y
|
||||||
P:freshBlock(true,true)
|
P:freshBlock("fresh")
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
local int,max,min,abs=math.floor,math.max,math.min,math.abs
|
local int,max,min,abs=math.floor,math.max,math.min,math.abs
|
||||||
local rem=table.remove
|
local rem=table.remove
|
||||||
local ct=coroutine
|
local resume=coroutine.resume
|
||||||
|
local status=coroutine.status
|
||||||
local assert=assert
|
local assert=assert
|
||||||
|
|
||||||
local function updateLine(P)--Attacks, line pushing, cam moving
|
local function updateLine(P)--Attacks, line pushing, cam moving
|
||||||
@@ -29,7 +30,7 @@ local function updateLine(P)--Attacks, line pushing, cam moving
|
|||||||
if not P.alive then
|
if not P.alive then
|
||||||
y=0
|
y=0
|
||||||
else
|
else
|
||||||
y=30*max(min(#P.field-19.5-P.fieldBeneath/30,P.imgY-17),0)
|
y=30*max(min(#P.field-19.5-P.fieldBeneath/30,P.ghoY-17),0)
|
||||||
end
|
end
|
||||||
if f~=y then
|
if f~=y then
|
||||||
P.fieldUp=f>y and max(f*.95+y*.05-2,y)or min(f*.97+y*.03+1,y)
|
P.fieldUp=f>y and max(f*.95+y*.05-2,y)or min(f*.97+y*.03+1,y)
|
||||||
@@ -98,14 +99,15 @@ local function updateTasks(P)
|
|||||||
local L=P.tasks
|
local L=P.tasks
|
||||||
for i=#L,1,-1 do
|
for i=#L,1,-1 do
|
||||||
local tr=L[i].thread
|
local tr=L[i].thread
|
||||||
assert(ct.resume(tr))
|
assert(resume(tr))
|
||||||
if ct.status(tr)=="dead"then
|
if status(tr)=="dead"then
|
||||||
rem(L,i)
|
rem(L,i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local function update_alive(P,dt)
|
local function update_alive(P,dt)
|
||||||
|
local ENV=P.gameEnv
|
||||||
if P.timing then
|
if P.timing then
|
||||||
local S=P.stat
|
local S=P.stat
|
||||||
S.time=S.time+dt
|
S.time=S.time+dt
|
||||||
@@ -160,7 +162,7 @@ local function update_alive(P,dt)
|
|||||||
|
|
||||||
--Moving pressed
|
--Moving pressed
|
||||||
if P.movDir~=0 then
|
if P.movDir~=0 then
|
||||||
local das,arr=P.gameEnv.das,P.gameEnv.arr
|
local das,arr=ENV.das,ENV.arr
|
||||||
local mov=P.moving
|
local mov=P.moving
|
||||||
if P.waiting==-1 then
|
if P.waiting==-1 then
|
||||||
if P.movDir==1 then
|
if P.movDir==1 then
|
||||||
@@ -182,8 +184,8 @@ local function update_alive(P,dt)
|
|||||||
mov=mov+1
|
mov=mov+1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if mov>=das and P.gameEnv.shakeFX and P.cur and P:ifoverlap(P.cur.bk,P.curX+1,P.curY)then
|
if mov>=das and ENV.shakeFX and P.cur and P:ifoverlap(P.cur.bk,P.curX+1,P.curY)then
|
||||||
P.fieldOff.vx=P.gameEnv.shakeFX*.5
|
P.fieldOff.vx=ENV.shakeFX*.5
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
P.movDir=0
|
P.movDir=0
|
||||||
@@ -207,8 +209,8 @@ local function update_alive(P,dt)
|
|||||||
mov=mov+1
|
mov=mov+1
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if mov>=das and P.gameEnv.shakeFX and P.cur and P:ifoverlap(P.cur.bk,P.curX-1,P.curY)then
|
if mov>=das and ENV.shakeFX and P.cur and P:ifoverlap(P.cur.bk,P.curX-1,P.curY)then
|
||||||
P.fieldOff.vx=-P.gameEnv.shakeFX*.5
|
P.fieldOff.vx=-ENV.shakeFX*.5
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
P.movDir=0
|
P.movDir=0
|
||||||
@@ -222,18 +224,18 @@ local function update_alive(P,dt)
|
|||||||
|
|
||||||
--Drop pressed
|
--Drop pressed
|
||||||
if P.keyPressing[7]and not P.keyPressing[9]then
|
if P.keyPressing[7]and not P.keyPressing[9]then
|
||||||
local d=P.downing-P.gameEnv.sddas
|
local d=P.downing-ENV.sddas
|
||||||
P.downing=P.downing+1
|
P.downing=P.downing+1
|
||||||
if d>1 then
|
if d>1 then
|
||||||
if P.gameEnv.sdarr>0 then
|
if ENV.sdarr>0 then
|
||||||
if d%P.gameEnv.sdarr==0 then
|
if d%ENV.sdarr==0 then
|
||||||
P:act_down1()
|
P:act_down1()
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
P:act_insDown()
|
P:act_insDown()
|
||||||
end
|
end
|
||||||
if P.gameEnv.shakeFX then
|
if ENV.shakeFX then
|
||||||
P.fieldOff.vy=P.gameEnv.shakeFX*.3
|
P.fieldOff.vy=ENV.shakeFX*.3
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
@@ -247,7 +249,7 @@ local function update_alive(P,dt)
|
|||||||
goto stop
|
goto stop
|
||||||
else
|
else
|
||||||
local L=#P.clearingRow
|
local L=#P.clearingRow
|
||||||
if P.sound and P.gameEnv.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
|
||||||
P.clearingRow={}
|
P.clearingRow={}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -262,7 +264,7 @@ local function update_alive(P,dt)
|
|||||||
|
|
||||||
--Natural block falling
|
--Natural block falling
|
||||||
if P.cur then
|
if P.cur then
|
||||||
if P.curY>P.imgY then
|
if P.curY>P.ghoY then
|
||||||
local D=P.dropDelay
|
local D=P.dropDelay
|
||||||
if D>1 then
|
if D>1 then
|
||||||
P.dropDelay=D-1
|
P.dropDelay=D-1
|
||||||
@@ -270,14 +272,13 @@ local function update_alive(P,dt)
|
|||||||
end
|
end
|
||||||
|
|
||||||
if D==1 then
|
if D==1 then
|
||||||
if P.gameEnv.moveFX and P.gameEnv.block then
|
if ENV.moveFX and ENV.block then
|
||||||
P:createMoveFX("down")
|
P:createMoveFX("down")
|
||||||
end
|
end
|
||||||
P.curY=P.curY-1
|
P.curY=P.curY-1
|
||||||
else
|
else
|
||||||
D=1/D--Fall dist
|
D=max(1/D,P.curY-P.ghoY)--Fall dist, max to dist between cur/gho
|
||||||
if D>P.curY-P.imgY then D=P.curY-P.imgY end
|
if ENV.moveFX and ENV.block then
|
||||||
if P.gameEnv.moveFX and P.gameEnv.block then
|
|
||||||
for _=1,D do
|
for _=1,D do
|
||||||
P:createMoveFX("down")
|
P:createMoveFX("down")
|
||||||
P.curY=P.curY-1
|
P.curY=P.curY-1
|
||||||
@@ -286,14 +287,14 @@ local function update_alive(P,dt)
|
|||||||
P.curY=P.curY-D
|
P.curY=P.curY-D
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
P:freshBlock(true,true)
|
P:freshBlock("fresh")
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
|
|
||||||
if P.imgY~=P.curY then
|
if P.ghoY~=P.curY then
|
||||||
P.dropDelay=P.gameEnv.drop
|
P.dropDelay=ENV.drop
|
||||||
elseif P.AI_mode=="CC"then
|
elseif P.AI_mode=="CC"then
|
||||||
CC.updateField(P)
|
CC.updateField(P)
|
||||||
if not P.AIdata._20G and P.gameEnv.drop<P.AI_delay0*.5 then
|
if not P.AIdata._20G and ENV.drop<P.AI_delay0*.5 then
|
||||||
CC.switch20G(P)
|
CC.switch20G(P)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user