整理代码,goto标签名字统一格式方便理解
This commit is contained in:
@@ -146,11 +146,11 @@ local function getScore(field,cb,cy)
|
|||||||
|
|
||||||
for i=cy+#cb-1,cy,-1 do
|
for i=cy+#cb-1,cy,-1 do
|
||||||
for j=1,10 do
|
for j=1,10 do
|
||||||
if field[i][j]==0 then goto continue end
|
if field[i][j]==0 then goto CONTINUE_notFull end
|
||||||
end
|
end
|
||||||
discardRow(rem(field,i))
|
discardRow(rem(field,i))
|
||||||
clear=clear+1
|
clear=clear+1
|
||||||
::continue::
|
::CONTINUE_notFull::
|
||||||
end
|
end
|
||||||
if #field==0 then return 1e99 end--PC
|
if #field==0 then return 1e99 end--PC
|
||||||
for x=1,10 do
|
for x=1,10 do
|
||||||
|
|||||||
@@ -100,11 +100,11 @@ function copyBoard(page)--Copy the [page] board
|
|||||||
for x=1,10 do
|
for x=1,10 do
|
||||||
if F[y][x]~=0 then
|
if F[y][x]~=0 then
|
||||||
H=y
|
H=y
|
||||||
goto topFound
|
goto BREAK_topFound
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
::topFound::
|
::BREAK_topFound::
|
||||||
|
|
||||||
--Encode field
|
--Encode field
|
||||||
for y=1,H do
|
for y=1,H do
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ function Player.createLockFX(P)
|
|||||||
local y=P.curY+i-1
|
local y=P.curY+i-1
|
||||||
local L=P.clearedRow
|
local L=P.clearedRow
|
||||||
for j=1,#L do
|
for j=1,#L do
|
||||||
if L[j]==y then goto continue end
|
if L[j]==y then goto CONTINUE_skip end
|
||||||
end
|
end
|
||||||
y=-30*y
|
y=-30*y
|
||||||
for j=1,#CB[1]do
|
for j=1,#CB[1]do
|
||||||
@@ -36,7 +36,7 @@ function Player.createLockFX(P)
|
|||||||
ins(P.lockFX,{30*(P.curX+j-2),y,0,t})
|
ins(P.lockFX,{30*(P.curX+j-2),y,0,t})
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
::continue::
|
::CONTINUE_skip::
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function Player.createDropFX(P,x,y,w,h)
|
function Player.createDropFX(P,x,y,w,h)
|
||||||
@@ -513,11 +513,11 @@ function Player.lock(P)
|
|||||||
for k=1,#dest,2 do
|
for k=1,#dest,2 do
|
||||||
if x==dest[k]+1 and y==dest[k+1]+1 then
|
if x==dest[k]+1 and y==dest[k+1]+1 then
|
||||||
rem(dest,k)rem(dest,k)
|
rem(dest,k)rem(dest,k)
|
||||||
goto success
|
goto BREAK_success
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
dest=nil
|
dest=nil
|
||||||
::success::
|
::BREAK_success::
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -660,8 +660,8 @@ function Player.hold(P,ifpre)
|
|||||||
SFX.play("finesseError")
|
SFX.play("finesseError")
|
||||||
do return end
|
do return end
|
||||||
--<for-end>
|
--<for-end>
|
||||||
|
|
||||||
::BREAK_success::
|
::BREAK_success::
|
||||||
|
|
||||||
P.spinLast=false
|
P.spinLast=false
|
||||||
P.spinSeq=0
|
P.spinSeq=0
|
||||||
local hb=P:getBlock(C.id)
|
local hb=P:getBlock(C.id)
|
||||||
@@ -998,13 +998,13 @@ do--Player.drop(P)--Place piece
|
|||||||
--Row filled
|
--Row filled
|
||||||
for x=1,10 do
|
for x=1,10 do
|
||||||
if P.field[h][x]<=0 then
|
if P.field[h][x]<=0 then
|
||||||
goto notFull
|
goto CONTINUE_notFull
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
cc=cc+1
|
cc=cc+1
|
||||||
P.clearingRow[cc]=h-cc+1
|
P.clearingRow[cc]=h-cc+1
|
||||||
P.clearedRow[cc]=h
|
P.clearedRow[cc]=h
|
||||||
::notFull::
|
::CONTINUE_notFull::
|
||||||
end
|
end
|
||||||
|
|
||||||
--Create clearing FX
|
--Create clearing FX
|
||||||
@@ -1062,11 +1062,11 @@ do--Player.drop(P)--Place piece
|
|||||||
for testY=CY+y,#P.field do
|
for testY=CY+y,#P.field do
|
||||||
if P:solid(testX,testY)then
|
if P:solid(testX,testY)then
|
||||||
finesse=true
|
finesse=true
|
||||||
goto BERAK
|
goto BERAK_roofFound
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
::BERAK::
|
::BERAK_roofFound::
|
||||||
end
|
end
|
||||||
|
|
||||||
--Remove rows need to be cleared
|
--Remove rows need to be cleared
|
||||||
|
|||||||
@@ -40,11 +40,11 @@ local function checkBoard(b,p)
|
|||||||
for i=1,8 do
|
for i=1,8 do
|
||||||
for j=1,3 do
|
for j=1,3 do
|
||||||
if b[lines[i][j]]~=p then
|
if b[lines[i][j]]~=p then
|
||||||
goto nextLine
|
goto CONTINUE_testNextLine
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
do return true end
|
do return true end
|
||||||
::nextLine::
|
::CONTINUE_testNextLine::
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local function full(L)
|
local function full(L)
|
||||||
|
|||||||
@@ -71,21 +71,21 @@ function scene.keyDown(key)
|
|||||||
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
|
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
|
||||||
local str=sys.getClipboardText()
|
local str=sys.getClipboardText()
|
||||||
local args=SPLITSTR(str:sub((str:find(":")or 0)+1),"!")
|
local args=SPLITSTR(str:sub((str:find(":")or 0)+1),"!")
|
||||||
if #args<4 then goto fail end
|
if #args<4 then goto THROW_fail end
|
||||||
if not(
|
if not(
|
||||||
pasteQuestArgs(args[1])and
|
pasteQuestArgs(args[1])and
|
||||||
pasteSequence(args[2])and
|
pasteSequence(args[2])and
|
||||||
pasteMission(args[3])
|
pasteMission(args[3])
|
||||||
)then goto fail end
|
)then goto THROW_fail end
|
||||||
repeat table.remove(FIELD)until #FIELD==0
|
repeat table.remove(FIELD)until #FIELD==0
|
||||||
FIELD[1]=newBoard()
|
FIELD[1]=newBoard()
|
||||||
for i=4,#args do
|
for i=4,#args do
|
||||||
if not pasteBoard(args[i],i-3)and i<#args then goto fail end
|
if not pasteBoard(args[i],i-3)and i<#args then goto THROW_fail end
|
||||||
end
|
end
|
||||||
freshMiniFieldVisible()
|
freshMiniFieldVisible()
|
||||||
LOG.print(text.importSuccess,COLOR.green)
|
LOG.print(text.importSuccess,COLOR.green)
|
||||||
do return end
|
do return end
|
||||||
::fail::LOG.print(text.dataCorrupted,COLOR.red)
|
::THROW_fail::LOG.print(text.dataCorrupted,COLOR.red)
|
||||||
elseif key=="escape"then
|
elseif key=="escape"then
|
||||||
SCN.back()
|
SCN.back()
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -211,12 +211,12 @@ function scene.keyDown(key)
|
|||||||
local F=FIELD[page]
|
local F=FIELD[page]
|
||||||
for i=20,1,-1 do
|
for i=20,1,-1 do
|
||||||
for j=1,10 do
|
for j=1,10 do
|
||||||
if F[i][j]<=0 then goto nextLine end
|
if F[i][j]<=0 then goto CONTINUE_notFull end
|
||||||
end
|
end
|
||||||
SYSFX.newShade(3,200,660-30*i,300,30)
|
SYSFX.newShade(3,200,660-30*i,300,30)
|
||||||
SYSFX.newRectRipple(3,200,660-30*i,300,30)
|
SYSFX.newRectRipple(3,200,660-30*i,300,30)
|
||||||
rem(F,i)
|
rem(F,i)
|
||||||
::nextLine::
|
::CONTINUE_notFull::
|
||||||
end
|
end
|
||||||
if #F~=20 then
|
if #F~=20 then
|
||||||
repeat
|
repeat
|
||||||
|
|||||||
@@ -80,12 +80,12 @@ function scene.touchMove()
|
|||||||
if B.ava then
|
if B.ava then
|
||||||
for i=1,#L,2 do
|
for i=1,#L,2 do
|
||||||
if(L[i]-B.x)^2+(L[i+1]-B.y)^2<=B.r^2 then
|
if(L[i]-B.x)^2+(L[i+1]-B.y)^2<=B.r^2 then
|
||||||
goto continue
|
goto CONTINUE_nextKey
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
PLAYERS[1]:releaseKey(n)
|
PLAYERS[1]:releaseKey(n)
|
||||||
end
|
end
|
||||||
::continue::
|
::CONTINUE_nextKey::
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key)
|
||||||
|
|||||||
@@ -61,12 +61,12 @@ function scene.touchMove()
|
|||||||
if B.ava then
|
if B.ava then
|
||||||
for i=1,#L,2 do
|
for i=1,#L,2 do
|
||||||
if(L[i]-B.x)^2+(L[i+1]-B.y)^2<=B.r^2 then
|
if(L[i]-B.x)^2+(L[i+1]-B.y)^2<=B.r^2 then
|
||||||
goto continue
|
goto CONTINUE_nextKey
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
PLAYERS[1]:releaseKey(n)
|
PLAYERS[1]:releaseKey(n)
|
||||||
end
|
end
|
||||||
::continue::
|
::CONTINUE_nextKey::
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
function scene.keyDown(key)
|
function scene.keyDown(key)
|
||||||
|
|||||||
Reference in New Issue
Block a user