重构背景系统(每个背景使用独立文件),全局变量名整理
This commit is contained in:
@@ -1,512 +1,11 @@
|
||||
local gc=love.graphics
|
||||
local int,ceil,rnd=math.floor,math.ceil,math.random
|
||||
local max,min,sin=math.max,math.min,math.sin
|
||||
local ins,rem=table.insert,table.remove
|
||||
|
||||
local function NULL(...)end
|
||||
local SCR=SCR
|
||||
local BGvars={_G=_G,SHADER=SHADER}
|
||||
local BG
|
||||
local back={}
|
||||
back.none={
|
||||
draw=function()
|
||||
gc.clear(.15,.15,.15)
|
||||
end,
|
||||
}
|
||||
back.grey={
|
||||
draw=function()
|
||||
gc.clear(.3,.3,.3)
|
||||
end,
|
||||
}
|
||||
back.glow={
|
||||
init=function()
|
||||
t=rnd()*2600
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
end,
|
||||
draw=function()
|
||||
local t=(sin(t*.5)+sin(t*.7)+sin(t*.9+1)+sin(t*1.5)+sin(t*2+10))*.08
|
||||
gc.clear(t,t,t)
|
||||
end,
|
||||
}--Light-dark
|
||||
back.rgb={
|
||||
init=function()
|
||||
t=rnd()*2600
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
end,
|
||||
draw=function()
|
||||
gc.clear(
|
||||
sin(t*1.2)*.15+.2,
|
||||
sin(t*1.5)*.15+.2,
|
||||
sin(t*1.9)*.15+.2
|
||||
)
|
||||
end,
|
||||
}--Changing pure color
|
||||
back.flink={
|
||||
init=function()
|
||||
t=rnd()*2600
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
end,
|
||||
draw=function()
|
||||
local t=.13-t%3%1.9
|
||||
if t<.2 then gc.clear(t,t,t)
|
||||
else gc.clear(0,0,0)
|
||||
end
|
||||
end,
|
||||
}--Flash after random time
|
||||
|
||||
local wingColor={
|
||||
{0., .9, .9,.626},
|
||||
{.3, 1., .3,.626},
|
||||
{.9, .9, 0.,.626},
|
||||
{1., .5, 0.,.626},
|
||||
{1., .3, .3,.626},
|
||||
{.5, 0., 1.,.626},
|
||||
{.3, .3, 1.,.626},
|
||||
{0., .9, .9,.626},
|
||||
}
|
||||
back.wing={
|
||||
init=function()
|
||||
bar=gc.newCanvas(41,1)
|
||||
gc.setCanvas(bar)
|
||||
gc.push("transform")
|
||||
gc.origin()
|
||||
for x=0,20 do
|
||||
gc.setColor(1,1,1,x/11)
|
||||
gc.rectangle("fill",x,0,1,1)
|
||||
gc.rectangle("fill",41-x,0,1,1)
|
||||
end
|
||||
gc.pop()
|
||||
gc.setCanvas()
|
||||
BG.resize()
|
||||
end,
|
||||
resize=function()
|
||||
crystal={}
|
||||
W,H=SCR.w,SCR.h
|
||||
for i=1,16 do
|
||||
crystal[i]={
|
||||
x=i<9 and W*.05*i or W*.05*(28-i),
|
||||
y=H*.1,
|
||||
a=0,
|
||||
va=0,
|
||||
f=i<9 and .012-i*.0005 or .012-(17-i)*.0005
|
||||
}
|
||||
end
|
||||
end,
|
||||
update=function()
|
||||
for i=1,16 do
|
||||
local B=crystal[i]
|
||||
B.a=B.a+B.va
|
||||
B.va=B.va*.986-B.a*B.f
|
||||
end
|
||||
end,
|
||||
draw=function()
|
||||
gc.clear(.06,.06,.06)
|
||||
local sy=H*.8
|
||||
for i=1,8 do
|
||||
gc.setColor(wingColor[i])
|
||||
local B=crystal[i]
|
||||
gc.draw(bar,B.x,B.y,B.a,1,sy,20,0)
|
||||
B=crystal[17-i]
|
||||
gc.draw(bar,B.x,B.y,B.a,1,sy,20,0)
|
||||
end
|
||||
end,
|
||||
event=function(level)
|
||||
for i=1,8 do
|
||||
local B=crystal[i]
|
||||
B.va=B.va+.001*level*(1+rnd())
|
||||
B=crystal[17-i]
|
||||
B.va=B.va-.001*level*(1+rnd())
|
||||
end
|
||||
end,
|
||||
discard=function()
|
||||
bar,crystal=nil
|
||||
end,
|
||||
}--Flandre's wing
|
||||
|
||||
back.fan={
|
||||
init=function()
|
||||
fan=_G.title_fan
|
||||
t=rnd(2600)
|
||||
petal={}
|
||||
BG.resize()
|
||||
end,
|
||||
resize=function()
|
||||
CX,CY=SCR.w/2,SCR.h/2
|
||||
W,H=SCR.w,SCR.h
|
||||
end,
|
||||
update=function()
|
||||
t=t+1
|
||||
if t%10==0 then
|
||||
ins(petal,{
|
||||
x=SCR.w*rnd(),
|
||||
y=0,
|
||||
vy=2+rnd()*2,
|
||||
vx=rnd()*2-.5,
|
||||
rx=4+rnd()*4,
|
||||
ry=4+rnd()*4,
|
||||
})
|
||||
end
|
||||
for i=#petal,1,-1 do
|
||||
local P=petal[i]
|
||||
P.y=P.y+P.vy
|
||||
if P.y>H then
|
||||
rem(petal,i)
|
||||
else
|
||||
P.x=P.x+P.vx
|
||||
P.vx=P.vx+rnd()*.01
|
||||
P.rx=max(min(P.rx+rnd()-.5,10),2)
|
||||
P.ry=max(min(P.ry+rnd()-.5,10),2)
|
||||
end
|
||||
end
|
||||
end,
|
||||
draw=function()
|
||||
gc.push("transform")
|
||||
gc.translate(CX,CY+20*sin(t*.02))
|
||||
gc.scale(SCR.k)
|
||||
gc.clear(.1,.1,.1)
|
||||
gc.setLineWidth(320)
|
||||
gc.setColor(.3,.2,.3)
|
||||
gc.arc("line","open",0,420,500,-.8*3.1416,-.2*3.1416)
|
||||
|
||||
gc.setLineWidth(4)
|
||||
gc.setColor(.7,.5,.65)
|
||||
gc.arc("line","open",0,420,660,-.799*3.1416,-.201*3.1416)
|
||||
gc.arc("line","open",0,420,340,-.808*3.1416,-.192*3.1416)
|
||||
gc.line(-281,224,-530,30.5)
|
||||
gc.line(281,224,530,30.5)
|
||||
|
||||
gc.setLineWidth(6)
|
||||
gc.setColor(.55,.5,.6)
|
||||
local F=fan
|
||||
for i=1,8 do
|
||||
gc.polygon("line",F[i])
|
||||
end
|
||||
|
||||
gc.setLineWidth(2)
|
||||
gc.setColor(.6,.3,.5)
|
||||
gc.origin()
|
||||
for i=1,#petal do
|
||||
local P=petal[i]
|
||||
gc.ellipse("fill",P.x,P.y,P.rx,P.ry)
|
||||
end
|
||||
gc.pop()
|
||||
end,
|
||||
discard=function()
|
||||
petal=nil
|
||||
end,
|
||||
}
|
||||
|
||||
local video--128x96, 10fps, 2192f
|
||||
back.badapple={
|
||||
init=function()
|
||||
if not video then
|
||||
video=_G.love.data.decompress("string","zlib",_G.love.filesystem.read("Zframework/badapple.dat"))
|
||||
end
|
||||
t=0
|
||||
BG.resize()
|
||||
end,
|
||||
resize=function()
|
||||
local W,H=SCR.w,SCR.h
|
||||
if H/W>=96/128 then
|
||||
K=W/128
|
||||
X,Y=0,(H-W*96/128)*.5
|
||||
else
|
||||
K=H/96
|
||||
X,Y=(W-H*128/96)*.5,0
|
||||
end
|
||||
end,
|
||||
update=function()
|
||||
t=t+1
|
||||
if t==13146 then
|
||||
t=0
|
||||
end
|
||||
end,
|
||||
draw=function()
|
||||
gc.clear(.2,.2,.2)
|
||||
gc.push("transform")
|
||||
gc.origin()
|
||||
gc.translate(X,Y)
|
||||
gc.scale(K)
|
||||
gc.setColor(.4,.4,.4)
|
||||
local t=int(t/6)
|
||||
local bAnd,bRshift=_G.bit.band,_G.bit.rshift
|
||||
for i=0,1535 do
|
||||
local B=video:byte(1536*t+i+1)
|
||||
for j=7,0,-1 do
|
||||
local p=8*i+j
|
||||
if bAnd(B,1)==0 then
|
||||
gc.rectangle("fill",p%128,int(p/128),1,1)
|
||||
end
|
||||
B=bRshift(B,1)
|
||||
end
|
||||
end
|
||||
gc.pop()
|
||||
end,
|
||||
discard=function()
|
||||
video=nil
|
||||
end
|
||||
}
|
||||
|
||||
back.welcome={
|
||||
init=function()
|
||||
t=rnd()*2600
|
||||
txt=gc.newText(_G.getFont(80),"Welcome To Techmino")
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
end,
|
||||
draw=function()
|
||||
if -t%13.55<.1 then
|
||||
gc.clear(.2+.1*sin(t),.2+.1*sin(1.26*t),.2+.1*sin(1.626*t))
|
||||
else
|
||||
gc.clear(.1,.1,.1)
|
||||
end
|
||||
gc.push("transform")
|
||||
gc.replaceTransform(_G.xOy)
|
||||
gc.translate(640,360)
|
||||
if -t%18.26<1 then
|
||||
gc.scale(6.26)
|
||||
gc.translate(-t*400%800-400,0)
|
||||
else
|
||||
gc.scale(1.1626,1.26)
|
||||
end
|
||||
if -t%12.6<.1 then
|
||||
gc.translate(60*sin(t*.26),100*sin(t*.626))
|
||||
end
|
||||
if -t%16.26<.1 then
|
||||
gc.rotate(t+5*sin(.26*t)+5*sin(.626*t))
|
||||
end
|
||||
gc.setColor(.2,.3,.5)
|
||||
gc.draw(txt,-883*.5+4*sin(t*.7942),-110*.5+4*sin(t*.7355))
|
||||
gc.setColor(.4,.6,.8)
|
||||
gc.draw(txt,-883*.5+2*sin(t*.77023),-110*.5+2*sin(t*.7026))
|
||||
gc.setColor(.9,.9,.9)
|
||||
gc.draw(txt,-883*.5+3*sin(t*.7283),-110*.5+3*sin(t*.7626))
|
||||
gc.pop()
|
||||
end,
|
||||
}
|
||||
|
||||
back.aura={
|
||||
init=function()
|
||||
t=rnd()*2600
|
||||
BG.resize(SCR.w,SCR.h)
|
||||
end,
|
||||
resize=function(_,h)
|
||||
SHADER.aura:send("w",SCR.W)
|
||||
SHADER.aura:send("h",h*SCR.dpi)
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
end,
|
||||
draw=function()
|
||||
SHADER.aura:send("t",t)
|
||||
gc.setShader(SHADER.aura)
|
||||
gc.rectangle("fill",0,0,SCR.w,SCR.h)
|
||||
gc.setShader()
|
||||
end,
|
||||
}--Cool liquid background
|
||||
back.bg1={
|
||||
init=function()
|
||||
t=rnd()*2600
|
||||
BG.resize()
|
||||
end,
|
||||
resize=function()
|
||||
SHADER.gradient1:send("w",SCR.W)
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
end,
|
||||
draw=function()
|
||||
SHADER.gradient1:send("t",t)
|
||||
gc.setShader(SHADER.gradient1)
|
||||
gc.rectangle("fill",0,0,SCR.w,SCR.h)
|
||||
gc.setShader()
|
||||
end,
|
||||
}--Horizonal red-blue gradient
|
||||
back.bg2={
|
||||
init=function()
|
||||
t=rnd()*2600
|
||||
BG.resize(nil,SCR.h)
|
||||
end,
|
||||
resize=function(_,h)
|
||||
SHADER.gradient2:send("h",h*SCR.dpi)
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
end,
|
||||
draw=function()
|
||||
SHADER.gradient2:send("t",t)
|
||||
gc.setShader(SHADER.gradient2)
|
||||
gc.rectangle("fill",0,0,SCR.w,SCR.h)
|
||||
gc.setShader()
|
||||
end,
|
||||
}--Vertical red-green gradient
|
||||
back.rainbow={
|
||||
init=function()
|
||||
t=rnd()*2600
|
||||
BG.resize(SCR.w,SCR.h)
|
||||
end,
|
||||
resize=function(_,h)
|
||||
SHADER.rgb1:send("w",SCR.W)
|
||||
SHADER.rgb1:send("h",h*SCR.dpi)
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
end,
|
||||
draw=function()
|
||||
SHADER.rgb1:send("t",t)
|
||||
gc.setShader(SHADER.rgb1)
|
||||
gc.rectangle("fill",0,0,SCR.w,SCR.h)
|
||||
gc.setShader()
|
||||
end,
|
||||
}--Colorful RGB
|
||||
back.rainbow2={
|
||||
init=function()
|
||||
t=rnd()*2600
|
||||
BG.resize(SCR.w,SCR.h)
|
||||
end,
|
||||
resize=function(_,h)
|
||||
SHADER.rgb2:send("w",SCR.W)
|
||||
SHADER.rgb2:send("h",h*SCR.dpi)
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
end,
|
||||
draw=function()
|
||||
SHADER.rgb2:send("t",t)
|
||||
gc.setShader(SHADER.rgb2)
|
||||
gc.rectangle("fill",0,0,SCR.w,SCR.h)
|
||||
gc.setShader()
|
||||
end,
|
||||
}--Blue RGB
|
||||
back.lightning={
|
||||
init=function()
|
||||
t=rnd()*2600
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
end,
|
||||
draw=function()
|
||||
local t=2.5-t%20%6%2.5
|
||||
if t<.3 then gc.clear(t,t,t)
|
||||
else gc.clear(0,0,0)
|
||||
end
|
||||
end,
|
||||
}--Lightning
|
||||
|
||||
local blocks=require("parts/mino")
|
||||
back.lightning2={
|
||||
init=function()
|
||||
t=rnd()*2600
|
||||
colorLib=_G.SKIN.libColor
|
||||
colorSet=_G.SETTING.skin
|
||||
blockImg=_G.TEXTURE.miniBlock
|
||||
scs=_G.spinCenters
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
end,
|
||||
draw=function()
|
||||
local R=7-int(t*.5%7)
|
||||
local T=1.2-t%10%3%1.2
|
||||
if T<.3 then gc.clear(T,T,T)
|
||||
else gc.clear(0,0,0)
|
||||
end
|
||||
local _=colorLib[colorSet[R]]
|
||||
gc.setColor(_[1],_[2],_[3],.12)
|
||||
gc.draw(blockImg[R],640,360,t%3.1416*6,400,400,scs[R][0][2]+.5,#blocks[R][0]-scs[R][0][1]-.5)
|
||||
end,
|
||||
}--Fast lightning + spining tetromino
|
||||
|
||||
local matrixT={}for i=1,50 do matrixT[i]={}for j=1,50 do matrixT[i][j]=love.math.noise(i,j)+2 end end
|
||||
back.matrix={
|
||||
init=function()
|
||||
t=rnd()*2600
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
end,
|
||||
draw=function()
|
||||
gc.clear(.15,.15,.15)
|
||||
gc.push("transform")
|
||||
local k=SCR.k
|
||||
gc.scale(k)
|
||||
local Y=ceil(SCR.h/80/k)
|
||||
for x=1,ceil(SCR.w/80/k)do
|
||||
for y=1,Y do
|
||||
gc.setColor(1,1,1,sin(x+matrixT[x][y]*t)*.1+.1)
|
||||
gc.rectangle("fill",80*x,80*y,-80,-80)
|
||||
end
|
||||
end
|
||||
gc.pop()
|
||||
end,
|
||||
}
|
||||
|
||||
back.space={
|
||||
init=function()
|
||||
stars={}
|
||||
W,H=SCR.w+20,SCR.h+20
|
||||
BG.resize(SCR.w,SCR.h)
|
||||
end,
|
||||
resize=function()
|
||||
local S=stars
|
||||
for i=1,1260,5 do
|
||||
local s=rnd(26,40)*.1
|
||||
S[i]=s*SCR.k --Size
|
||||
S[i+1]=rnd(W)-10 --X
|
||||
S[i+2]=rnd(H)-10 --Y
|
||||
S[i+3]=(rnd()-.5)*.01*s --Vx
|
||||
S[i+4]=(rnd()-.5)*.01*s --Vy
|
||||
end
|
||||
end,
|
||||
update=function()
|
||||
local S=stars
|
||||
--Star moving
|
||||
for i=1,1260,5 do
|
||||
S[i+1]=(S[i+1]+S[i+3])%W
|
||||
S[i+2]=(S[i+2]+S[i+4])%H
|
||||
end
|
||||
end,
|
||||
draw=function()
|
||||
gc.clear(.2,.2,.2)
|
||||
if not stars[1]then return end
|
||||
gc.translate(-10,-10)
|
||||
gc.setColor(.8,.8,.8)
|
||||
for i=1,1260,5 do
|
||||
local s=stars
|
||||
local x,y=s[i+1],s[i+2]
|
||||
s=s[i]
|
||||
gc.rectangle("fill",x,y,s,s)
|
||||
end
|
||||
gc.translate(10,10)
|
||||
end,
|
||||
discard=function()
|
||||
stars=nil
|
||||
end,
|
||||
}
|
||||
|
||||
--Make BG vars invisible
|
||||
for _,bg in next,back do
|
||||
if bg.init then setfenv(bg.init, BGvars)else bg.init=NULL end
|
||||
if bg.resize then setfenv(bg.resize, BGvars)else bg.resize=NULL end
|
||||
if bg.update then setfenv(bg.update, BGvars)else bg.update=NULL end
|
||||
if bg.draw then setfenv(bg.draw, BGvars)else bg.draw=NULL end
|
||||
if bg.event then setfenv(bg.event, BGvars)else bg.event=NULL end
|
||||
if bg.discard then setfenv(bg.discard, BGvars)else bg.discard=NULL end
|
||||
end
|
||||
|
||||
BG={
|
||||
cur="none",
|
||||
local BG={
|
||||
list={},
|
||||
cur="",
|
||||
init=NULL,
|
||||
resize=NULL,
|
||||
update=NULL,
|
||||
draw=back.none.draw,
|
||||
draw=NULL,
|
||||
event=NULL,
|
||||
discard=NULL,
|
||||
}
|
||||
@@ -515,22 +14,22 @@ function BG.send(data)
|
||||
BG.event(data)
|
||||
end
|
||||
end
|
||||
function BG.set(bg)
|
||||
if bg==BG.cur or not SETTING.bg then return end
|
||||
function BG.set(background)
|
||||
if background==BG.cur or not SETTING.bg then return end
|
||||
BG.discard()
|
||||
if not back[bg]then
|
||||
LOG.print("No BG called"..bg,"warn")
|
||||
background=BG.list[background]
|
||||
if not background then
|
||||
LOG.print("No BG called"..background,"warn")
|
||||
return
|
||||
end
|
||||
BG.cur=bg
|
||||
bg=back[bg]
|
||||
BG.cur=background
|
||||
|
||||
BG.init= bg.init
|
||||
BG.resize= bg.resize
|
||||
BG.update= bg.update
|
||||
BG.draw= bg.draw
|
||||
BG.event= bg.event
|
||||
BG.discard= bg.discard
|
||||
BG.init= background.init or NULL
|
||||
BG.resize= background.resize or NULL
|
||||
BG.update= background.update or NULL
|
||||
BG.draw= background.draw or NULL
|
||||
BG.event= background.event or NULL
|
||||
BG.discard= background.discard or NULL
|
||||
BG.init()
|
||||
end
|
||||
return BG
|
||||
@@ -55,7 +55,7 @@ function BGM.loadOne(N)
|
||||
BGM.list[N]:setLooping(true)
|
||||
BGM.list[N]:setVolume(0)
|
||||
else
|
||||
LOG.print("No BGM file: "..N,5,color.orange)
|
||||
LOG.print("No BGM file: "..N,5,COLOR.orange)
|
||||
end
|
||||
end
|
||||
function BGM.loadAll()
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local rnd=math.random
|
||||
local sin=math.sin
|
||||
local color={
|
||||
local COLOR={
|
||||
red={1,0,0},
|
||||
green={0,1,0},
|
||||
blue={.2,.2,1},
|
||||
@@ -41,27 +41,27 @@ local color={
|
||||
}
|
||||
local list_norm={"red","green","blue","yellow","magenta","cyan","purple","orange","pink","grass"}
|
||||
local len_list_norm=#list_norm
|
||||
function color.random_norm()
|
||||
return color[list_norm[rnd(len_list_norm)]]
|
||||
function COLOR.random_norm()
|
||||
return COLOR[list_norm[rnd(len_list_norm)]]
|
||||
end
|
||||
|
||||
local list_bright={"lRed","lGreen","lBlue","lYellow","lMagenta","lCyan","lPurple","lOrange"}
|
||||
local len_list_bright=#list_bright
|
||||
function color.random_bright()
|
||||
return color[list_bright[rnd(len_list_bright)]]
|
||||
function COLOR.random_bright()
|
||||
return COLOR[list_bright[rnd(len_list_bright)]]
|
||||
end
|
||||
|
||||
local list_dark={"dRed","dGreen","dBlue","dYellow","dMagenta","dCyan","dPurple","dOrange"}
|
||||
local len_list_dark=#list_dark
|
||||
function color.random_bright()
|
||||
return color[list_dark[rnd(len_list_dark)]]
|
||||
function COLOR.random_bright()
|
||||
return COLOR[list_dark[rnd(len_list_dark)]]
|
||||
end
|
||||
|
||||
function color.rainbow(phase)
|
||||
function COLOR.rainbow(phase)
|
||||
return
|
||||
sin(phase)*.4+.6,
|
||||
sin(phase+2.0944)*.4+.6,
|
||||
sin(phase-2.0944)*.4+.6
|
||||
end
|
||||
|
||||
return color
|
||||
return COLOR
|
||||
@@ -28,7 +28,7 @@ function FILE.saveRecord(N,L)
|
||||
local _,mes=F:write(dumpTable(L))
|
||||
F:flush()F:close()
|
||||
if not _ then
|
||||
LOG.print(text.recSavingError..(mes or"unknown error"),color.red)
|
||||
LOG.print(text.recSavingError..(mes or"unknown error"),COLOR.red)
|
||||
end
|
||||
end
|
||||
function FILE.delRecord(N)
|
||||
@@ -36,7 +36,7 @@ function FILE.delRecord(N)
|
||||
end
|
||||
|
||||
function FILE.exportUnlock()
|
||||
sys.setClipboardText(dumpTable(modeRanks))
|
||||
sys.setClipboardText(dumpTable(RANKS))
|
||||
end
|
||||
function FILE.loadUnlock()
|
||||
local F=files.unlock
|
||||
@@ -47,17 +47,17 @@ function FILE.loadUnlock()
|
||||
F:close()
|
||||
if s then
|
||||
setfenv(s,{})
|
||||
modeRanks=s()
|
||||
RANKS=s()
|
||||
end
|
||||
end
|
||||
end
|
||||
function FILE.saveUnlock()
|
||||
local F=files.unlock
|
||||
F:open("w")
|
||||
local _,mes=F:write(dumpTable(modeRanks))
|
||||
local _,mes=F:write(dumpTable(RANKS))
|
||||
F:flush()F:close()
|
||||
if not _ then
|
||||
LOG.print(text.unlockSavingError..(mes or"unknown error"),color.red)
|
||||
LOG.print(text.unlockSavingError..(mes or"unknown error"),COLOR.red)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -86,7 +86,7 @@ function FILE.saveData()
|
||||
local _,mes=F:write(dumpTable(STAT))
|
||||
F:flush()F:close()
|
||||
if not _ then
|
||||
LOG.print(text.statSavingError..(mes or"unknown error"),color.red)
|
||||
LOG.print(text.statSavingError..(mes or"unknown error"),COLOR.red)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -113,8 +113,8 @@ function FILE.saveSetting()
|
||||
F:open("w")
|
||||
local _,mes=F:write(dumpTable(SETTING))
|
||||
F:flush()F:close()
|
||||
if _ then LOG.print(text.settingSaved,color.green)
|
||||
else LOG.print(text.settingSavingError..(mes or"unknown error"),color.red)
|
||||
if _ then LOG.print(text.settingSaved,COLOR.green)
|
||||
else LOG.print(text.settingSavingError..(mes or"unknown error"),COLOR.red)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -134,8 +134,8 @@ function FILE.saveKeyMap()
|
||||
F:open("w")
|
||||
local _,mes=F:write(dumpTable(keyMap))
|
||||
F:flush()F:close()
|
||||
if _ then LOG.print(text.keyMapSaved,color.green)
|
||||
else LOG.print(text.keyMapSavingError..(mes or"unknown error"),color.red)
|
||||
if _ then LOG.print(text.keyMapSaved,COLOR.green)
|
||||
else LOG.print(text.keyMapSavingError..(mes or"unknown error"),COLOR.red)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -158,8 +158,8 @@ function FILE.saveVK()
|
||||
F:open("w")
|
||||
local _,mes=F:write(dumpTable(VK_org))
|
||||
F:flush()F:close()
|
||||
if _ then LOG.print(text.VKSaved,color.green)
|
||||
else LOG.print(text.VKSavingError..(mes or"unknown error"),color.red)
|
||||
if _ then LOG.print(text.VKSaved,COLOR.green)
|
||||
else LOG.print(text.VKSavingError..(mes or"unknown error"),COLOR.red)
|
||||
end
|
||||
end
|
||||
return FILE
|
||||
@@ -1,21 +1,25 @@
|
||||
color= require("Zframework/color")
|
||||
COLOR= require("Zframework/color")
|
||||
SCN= require("Zframework/scene")
|
||||
LOG= require("Zframework/log")
|
||||
require("Zframework/toolfunc")
|
||||
SHADER= require("Zframework/shader")
|
||||
|
||||
VIB= require("Zframework/vib")
|
||||
SFX= require("Zframework/sfx")
|
||||
sysFX= require("Zframework/sysFX")
|
||||
|
||||
LIGHT= require("Zframework/light")
|
||||
SHADER= require("Zframework/shader")
|
||||
BG= require("Zframework/bg")
|
||||
WIDGET= require("Zframework/widget")
|
||||
TEXT= require("Zframework/text")
|
||||
sysFX= require("Zframework/sysFX")
|
||||
|
||||
IMG= require("Zframework/img")
|
||||
BGM= require("Zframework/bgm")
|
||||
VOC= require("Zframework/voice")
|
||||
|
||||
LANG= require("Zframework/languages")
|
||||
FILE= require("Zframework/file")
|
||||
TEXT= require("Zframework/text")
|
||||
TASK= require("Zframework/task")
|
||||
IMG= require("Zframework/img")
|
||||
WIDGET= require("Zframework/widget")
|
||||
LIGHT= require("Zframework/light")
|
||||
FILE= require("Zframework/file")
|
||||
PROFILE=require("Zframework/profile")
|
||||
|
||||
local ms,kb=love.mouse,love.keyboard
|
||||
@@ -24,6 +28,7 @@ local int,rnd,abs=math.floor,math.random,math.abs
|
||||
local min=math.min
|
||||
local ins,rem=table.insert,table.remove
|
||||
local SCR=SCR
|
||||
local setFont=setFont
|
||||
|
||||
local mx,my,mouseShow=-20,-20,false
|
||||
local touching=nil--First touching ID(userdata)
|
||||
@@ -212,11 +217,11 @@ function love.keypressed(i)
|
||||
elseif i=="f5"then if love._openConsole then love._openConsole()end
|
||||
elseif i=="f6"then if WIDGET.sel then DBP(WIDGET.sel)end
|
||||
elseif i=="f7"then for k,v in next,_G do DBP(k,v)end
|
||||
elseif i=="f8"then devMode=nil LOG.print("DEBUG OFF",color.yellow)
|
||||
elseif i=="f9"then devMode=1 LOG.print("DEBUG 1",color.yellow)
|
||||
elseif i=="f10"then devMode=2 LOG.print("DEBUG 2",color.yellow)
|
||||
elseif i=="f11"then devMode=3 LOG.print("DEBUG 3",color.yellow)
|
||||
elseif i=="f12"then devMode=4 LOG.print("DEBUG 4",color.yellow)
|
||||
elseif i=="f8"then devMode=nil LOG.print("DEBUG OFF",COLOR.yellow)
|
||||
elseif i=="f9"then devMode=1 LOG.print("DEBUG 1",COLOR.yellow)
|
||||
elseif i=="f10"then devMode=2 LOG.print("DEBUG 2",COLOR.yellow)
|
||||
elseif i=="f11"then devMode=3 LOG.print("DEBUG 3",COLOR.yellow)
|
||||
elseif i=="f12"then devMode=4 LOG.print("DEBUG 4",COLOR.yellow)
|
||||
elseif devMode==2 then
|
||||
if WIDGET.sel then
|
||||
local W=WIDGET.sel
|
||||
@@ -250,7 +255,7 @@ function love.keypressed(i)
|
||||
end
|
||||
else
|
||||
devMode=1
|
||||
LOG.print("DEBUG ON",color.yellow)
|
||||
LOG.print("DEBUG ON",COLOR.yellow)
|
||||
end
|
||||
end
|
||||
function love.keyreleased(i)
|
||||
@@ -279,7 +284,7 @@ function love.joystickremoved(JS)
|
||||
for i=1,#joysticks do
|
||||
if joysticks[i]==JS then
|
||||
rem(joysticks,i)
|
||||
LOG.print("Joystick removed",color.yellow)
|
||||
LOG.print("Joystick removed",COLOR.yellow)
|
||||
return
|
||||
end
|
||||
end
|
||||
@@ -360,9 +365,9 @@ function love.focus(f)
|
||||
end
|
||||
end
|
||||
function love.errorhandler(msg)
|
||||
local PUMP,POLL=love.event.pump,love.event.poll
|
||||
love.mouse.setVisible(true)
|
||||
ms.setVisible(true)
|
||||
love.audio.stop()
|
||||
|
||||
local err={"Error:"..msg}
|
||||
local trace=debug.traceback("",2)
|
||||
local c=2
|
||||
@@ -379,9 +384,9 @@ function love.errorhandler(msg)
|
||||
end
|
||||
DBP(table.concat(err,"\n"),1,c-2)
|
||||
gc.reset()
|
||||
local CAP
|
||||
local function _(_)CAP=gc.newImage(_)end
|
||||
gc.captureScreenshot(_)
|
||||
|
||||
local errScrShot
|
||||
gc.captureScreenshot(function (_)errScrShot=gc.newImage(_)end)
|
||||
gc.present()
|
||||
|
||||
SFX.fplay("error",SETTING.voc*.8)
|
||||
@@ -390,8 +395,8 @@ function love.errorhandler(msg)
|
||||
local needDraw=true
|
||||
local count=0
|
||||
return function()
|
||||
PUMP()
|
||||
for E,a,b in POLL()do
|
||||
love.event.pump()
|
||||
for E,a,b in love.event.poll()do
|
||||
if E=="quit"or a=="escape"then
|
||||
destroyPlayers()
|
||||
return 1
|
||||
@@ -422,7 +427,7 @@ function love.errorhandler(msg)
|
||||
gc.setColor(1,1,1)
|
||||
gc.push("transform")
|
||||
gc.replaceTransform(xOy)
|
||||
gc.draw(CAP,100,365,nil,512/CAP:getWidth(),288/CAP:getHeight())
|
||||
gc.draw(errScrShot,100,365,nil,512/errScrShot:getWidth(),288/errScrShot:getHeight())
|
||||
setFont(120)gc.print(":(",100,40)
|
||||
setFont(38)gc.printf(text.errorMsg,100,200,1280-100)
|
||||
setFont(20)
|
||||
@@ -437,14 +442,14 @@ function love.errorhandler(msg)
|
||||
gc.present()
|
||||
needDraw=false
|
||||
end
|
||||
love.timer.sleep(.2)
|
||||
love.timer.sleep(.26)
|
||||
end
|
||||
end
|
||||
local devColor={
|
||||
color.white,
|
||||
color.lMagenta,
|
||||
color.lGreen,
|
||||
color.lBlue,
|
||||
COLOR.white,
|
||||
COLOR.lMagenta,
|
||||
COLOR.lGreen,
|
||||
COLOR.lBlue,
|
||||
}
|
||||
local FPS=love.timer.getFPS
|
||||
love.draw,love.update=nil--remove default draw/update
|
||||
@@ -473,6 +478,7 @@ function love.run()
|
||||
else
|
||||
SCN.init("load")
|
||||
end
|
||||
BG.set("none")
|
||||
|
||||
return function()
|
||||
local _
|
||||
@@ -526,7 +532,7 @@ function love.run()
|
||||
local R=int(r)%7+1
|
||||
_=SKIN.libColor[SETTING.skin[R]]
|
||||
gc.setColor(_[1],_[2],_[3],min(1-abs(1-r%1*2),.3))
|
||||
gc.draw(TEXTURE.miniBlock[R],mx,my,Timer()%3.1416*4,20,20,spinCenters[R][0][2]+.5,#blocks[R][0]-spinCenters[R][0][1]-.5)
|
||||
gc.draw(TEXTURE.miniBlock[R],mx,my,Timer()%3.1416*4,20,20,spinCenters[R][0][2]+.5,#BLOCKS[R][0]-spinCenters[R][0][1]-.5)
|
||||
gc.setColor(1,1,1,.5)gc.circle("fill",mx,my,5)
|
||||
gc.setColor(1,1,1)gc.circle("fill",mx,my,3)
|
||||
end
|
||||
@@ -549,7 +555,7 @@ function love.run()
|
||||
--Draw network working
|
||||
if TASK.netTaskCount>0 then
|
||||
setFont(30)
|
||||
gc.setColor(color.rainbow(Timer()*5))
|
||||
gc.setColor(COLOR.rainbow(Timer()*5))
|
||||
gc.print("E",1250,0,.26+.355*math.sin(Timer()*6.26))
|
||||
end
|
||||
|
||||
@@ -563,7 +569,7 @@ function love.run()
|
||||
if devMode then
|
||||
gc.setColor(devColor[devMode])
|
||||
gc.print("Memory:"..gcinfo(),5,_-40)
|
||||
gc.print("Lines:"..freeRow.getCount(),5,_-60)
|
||||
gc.print("Lines:"..FREEROW.getCount(),5,_-60)
|
||||
gc.print("Cursor:"..int(mx+.5).." "..int(my+.5),5,_-80)
|
||||
gc.print("Voices:"..VOC.getCount(),5,_-100)
|
||||
gc.print("Tasks:"..TASK.getCount(),5,_-120)
|
||||
@@ -590,7 +596,7 @@ function love.run()
|
||||
end
|
||||
if gc.getWidth()~=SCR.w then
|
||||
love.resize(gc.getWidth(),gc.getHeight())
|
||||
LOG.print("Screen Resized",color.yellow)
|
||||
LOG.print("Screen Resized",COLOR.yellow)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -41,23 +41,23 @@ function LOG.print(text,T,C)--text,type/time,color
|
||||
local time
|
||||
local his
|
||||
if T=="warn"then
|
||||
C=C or color.yellow
|
||||
C=C or COLOR.yellow
|
||||
his=true
|
||||
time=180
|
||||
elseif T=="error"then
|
||||
C=C or color.red
|
||||
C=C or COLOR.red
|
||||
his=true
|
||||
time=210
|
||||
elseif T=="message"then
|
||||
C=C or color.sky
|
||||
C=C or COLOR.sky
|
||||
his=true
|
||||
elseif type(T)=="number"then
|
||||
C=C or color.white
|
||||
C=C or COLOR.white
|
||||
time=T
|
||||
elseif type(T)=="table"then
|
||||
C,T=T
|
||||
elseif not C then
|
||||
C=color.white
|
||||
C=COLOR.white
|
||||
end
|
||||
if his then
|
||||
ins(debugMesHistory,SCN.cur..": "..tostring(text))
|
||||
@@ -67,6 +67,6 @@ end
|
||||
function LOG.copy()
|
||||
local str=table.concat(debugMesHistory,"\n")
|
||||
love.system.setClipboardText(str)
|
||||
LOG.print("Log copied",color.blue)
|
||||
LOG.print("Log copied",COLOR.blue)
|
||||
end
|
||||
return LOG
|
||||
@@ -30,7 +30,7 @@ function SFX.loadOne(_)
|
||||
if love.filesystem.getInfo(N)then
|
||||
SFX.list[_]={love.audio.newSource(N,"static")}
|
||||
else
|
||||
LOG.print("No SFX file: "..N,5,color.orange)
|
||||
LOG.print("No SFX file: "..N,5,COLOR.orange)
|
||||
end
|
||||
end
|
||||
function SFX.loadAll()
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
local gc=love.graphics
|
||||
local setColor=gc.setColor
|
||||
local setWidth=gc.setLineWidth
|
||||
local rem=table.remove
|
||||
local setColor,setWidth=gc.setColor,gc.setLineWidth
|
||||
local max,min=math.max,math.min
|
||||
local rem=table.remove
|
||||
|
||||
local fx={}
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ function TASK.update()
|
||||
TASK.netTaskCount=TASK.netTaskCount-1
|
||||
end
|
||||
rem(tasks,i)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function TASK.new(code,data)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local gc=love.graphics
|
||||
local rnd=math.random
|
||||
local rem=table.remove
|
||||
local mStr=mStr
|
||||
local setFont,mStr=setFont,mStr
|
||||
|
||||
local texts={}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ do--LOADLIB
|
||||
if success then
|
||||
return success
|
||||
else
|
||||
LOG.print("Cannot load "..name..": "..message,"warn",color.red)
|
||||
LOG.print("Cannot load "..name..": "..message,"warn",COLOR.red)
|
||||
end
|
||||
elseif SYSTEM=="Android"then
|
||||
local fs=love.filesystem
|
||||
@@ -37,25 +37,25 @@ do--LOADLIB
|
||||
if success then
|
||||
libFunc,message=package.loadlib(table.concat({fs.getSaveDirectory(),libName.Android},"/"),libName.libFunc)
|
||||
if libFunc then
|
||||
LOG.print(name.." lib loaded","warn",color.green)
|
||||
LOG.print(name.." lib loaded","warn",COLOR.green)
|
||||
break
|
||||
else
|
||||
LOG.print("Cannot load "..name..": "..message,"warn",color.red)
|
||||
LOG.print("Cannot load "..name..": "..message,"warn",COLOR.red)
|
||||
end
|
||||
else
|
||||
LOG.print("Write "..name.."-"..platform[i].." to saving failed: "..message,"warn",color.red)
|
||||
LOG.print("Write "..name.."-"..platform[i].." to saving failed: "..message,"warn",COLOR.red)
|
||||
end
|
||||
else
|
||||
LOG.print("Read "..name.."-"..platform[i].." failed","warn",color.red)
|
||||
LOG.print("Read "..name.."-"..platform[i].." failed","warn",COLOR.red)
|
||||
end
|
||||
end
|
||||
if not libFunc then
|
||||
LOG.print("failed to load "..name,"warn",color.red)
|
||||
LOG.print("failed to load "..name,"warn",COLOR.red)
|
||||
return
|
||||
end
|
||||
return libFunc()
|
||||
else
|
||||
LOG.print("No "..name.." for "..SYSTEM,"warn",color.red)
|
||||
LOG.print("No "..name.." for "..SYSTEM,"warn",COLOR.red)
|
||||
return
|
||||
end
|
||||
return true
|
||||
@@ -180,7 +180,7 @@ do--httpRequest
|
||||
TASK.netTaskCount=TASK.netTaskCount+1
|
||||
end or
|
||||
function()
|
||||
LOG.print("[NO NETlib]",5,color.yellow)
|
||||
LOG.print("[NO NETlib]",5,COLOR.yellow)
|
||||
end
|
||||
end
|
||||
do--json
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
local level={0,0,.015,.02,.03,.04,.05,.06,.07,.08}
|
||||
local _=love.system.vibrate
|
||||
local VIB=love.system.vibrate
|
||||
return function(t)
|
||||
local L=SETTING.vib
|
||||
if L>0 then
|
||||
_(level[L+t])
|
||||
VIB(level[L+t])
|
||||
end
|
||||
end
|
||||
@@ -31,7 +31,7 @@ function VOC.loadOne(name)
|
||||
|
||||
if i==1 then
|
||||
if not loadVoiceFile(N,N)then
|
||||
LOG.print("No VOICE file: "..N,5,color.orange)
|
||||
LOG.print("No VOICE file: "..N,5,COLOR.orange)
|
||||
end
|
||||
end
|
||||
if not VOC.list[N][1]then VOC.list[N]=nil end
|
||||
|
||||
@@ -5,10 +5,8 @@ local max,min=math.max,math.min
|
||||
local sub,format=string.sub,string.format
|
||||
local ins=table.insert
|
||||
|
||||
local color=color
|
||||
local setFont=setFont
|
||||
local Timer=love.timer.getTime
|
||||
local mStr=mStr
|
||||
local setFont,mStr=setFont,mStr
|
||||
|
||||
local Empty={}
|
||||
local widgetList={}
|
||||
@@ -42,7 +40,7 @@ function WIDGET.newText(D)--name,x,y[,color][,font=30][,align="M"][,hide]
|
||||
name= D.name,
|
||||
x= D.x,
|
||||
y= D.y,
|
||||
color= D.color and(color[D.color]or D.color)or color.white,
|
||||
color= D.color and(COLOR[D.color]or D.color)or COLOR.white,
|
||||
font= D.font or 30,
|
||||
align= D.align or"M",
|
||||
hide= D.hide,
|
||||
@@ -161,7 +159,7 @@ function WIDGET.newButton(D)--name,x,y,w[,h][,color][,font],code[,hide]
|
||||
D.x+D.w*.35,D.y+D.h*.35,
|
||||
},
|
||||
|
||||
color= D.color and(color[D.color]or D.color)or color.white,
|
||||
color= D.color and(COLOR[D.color]or D.color)or COLOR.white,
|
||||
font= D.font or 30,
|
||||
code= D.code,
|
||||
hide= D.hide,
|
||||
@@ -236,7 +234,7 @@ function WIDGET.newKey(D)--name,x,y,w[,h][,color][,font],code[,hide]
|
||||
D.x+D.w*.35,D.y+D.h*.35,
|
||||
},
|
||||
|
||||
color= D.color and(color[D.color]or D.color)or color.white,
|
||||
color= D.color and(COLOR[D.color]or D.color)or COLOR.white,
|
||||
font= D.font or 30,
|
||||
code= D.code,
|
||||
hide= D.hide,
|
||||
@@ -567,7 +565,7 @@ function WIDGET.newSelector(D)--name,x,y,w[,color],list,disp,code,hide
|
||||
D.x+D.w,D.y,
|
||||
},
|
||||
|
||||
color= D.color and(color[D.color]or D.color)or color.white,
|
||||
color= D.color and(COLOR[D.color]or D.color)or COLOR.white,
|
||||
list= D.list,
|
||||
disp= D.disp,
|
||||
code= D.code,
|
||||
@@ -870,7 +868,6 @@ function WIDGET.keyPressed(key)
|
||||
local dist=(x-WX)*dir
|
||||
if dist>10 then
|
||||
dist=dist+abs(y-WY)*6.26
|
||||
print(W1.name,dist)
|
||||
if dist<minDist then
|
||||
minDist=dist
|
||||
tar=W1
|
||||
|
||||
52
main.lua
52
main.lua
@@ -8,11 +8,15 @@
|
||||
optimization is welcomed if you also love tetromino game
|
||||
]]--
|
||||
|
||||
local fs=love.filesystem
|
||||
|
||||
--?
|
||||
NULL=function()end
|
||||
DBP=print--use this if need debugging print
|
||||
SYSTEM=love.system.getOS()
|
||||
MOBILE=SYSTEM=="Android"or SYSTEM=="iOS"
|
||||
SAVEDIR=fs.getSaveDirectory()
|
||||
|
||||
MARKING=true
|
||||
LOADED=false
|
||||
NOGAME=false
|
||||
@@ -103,10 +107,10 @@ GAME={
|
||||
}--Global game data
|
||||
PLAYERS={alive={}}--Players data
|
||||
CURMODE=nil--Current mode object
|
||||
--blockSkin,blockSkinMini={},{}--Redefined in SKIN.change
|
||||
|
||||
|
||||
--Load modules
|
||||
|
||||
require("Zframework")--Load Zframework
|
||||
|
||||
require("parts/list")
|
||||
@@ -115,30 +119,38 @@ require("parts/gametoolfunc")
|
||||
|
||||
FIELD[1]=newBoard()--Initialize field[1]
|
||||
|
||||
blocks= require("parts/mino")
|
||||
AITemplate= require("parts/AITemplate")
|
||||
freeRow= require("parts/freeRow")
|
||||
BLOCKS= require("parts/mino")
|
||||
AIBUILDER= require("parts/AITemplate")
|
||||
FREEROW= require("parts/freeRow")
|
||||
|
||||
TEXTURE=require("parts/texture")
|
||||
SKIN= require("parts/skin")
|
||||
PLY= require("parts/player")
|
||||
AIfunc= require("parts/ai")
|
||||
Modes= require("parts/modes")
|
||||
AIFUNC= require("parts/ai")
|
||||
MODES= require("parts/modes")
|
||||
TICK= require("parts/tick")
|
||||
|
||||
--Load Scenes files from SOURCE ONLY
|
||||
local fs=love.filesystem
|
||||
local saveDir=fs.getSaveDirectory()
|
||||
--Load Scene files from SOURCE ONLY
|
||||
for _,v in next,fs.getDirectoryItems("parts/scenes")do
|
||||
if fs.getRealDirectory("parts/scenes/"..v)~=saveDir then
|
||||
if fs.getRealDirectory("parts/scenes/"..v)~=SAVEDIR then
|
||||
require("parts/scenes/"..v:sub(1,-5))
|
||||
else
|
||||
LOG.print("Dangerous file : %SAVE%/parts/scenes/"..v)
|
||||
end
|
||||
end
|
||||
|
||||
--Load Background files from SOURCE ONLY
|
||||
for _,v in next,love.filesystem.getDirectoryItems("parts/backgrounds")do
|
||||
if love.filesystem.getRealDirectory("parts/backgrounds/"..v)~=SAVEDIR then
|
||||
local name=v:sub(1,-5)
|
||||
BG.list[name]=require("parts/backgrounds/"..name)
|
||||
else
|
||||
LOG.print("Dangerous file : %SAVE%/parts/backgrounds/"..v)
|
||||
end
|
||||
end
|
||||
|
||||
--Load files & settings
|
||||
modeRanks={sprint_10=0}
|
||||
RANKS={sprint_10=0}
|
||||
|
||||
if fs.getInfo("keymap.dat")then fs.remove("keymap.dat")end
|
||||
if fs.getInfo("setting.dat")then fs.remove("setting.dat")end
|
||||
@@ -170,7 +182,7 @@ if fs.getInfo("tech_ultimate+.dat")then fs.remove("tech_ultimate+.dat")end
|
||||
|
||||
--Update data
|
||||
do
|
||||
local R=modeRanks
|
||||
local R=RANKS
|
||||
R.sprint_10=R.sprint_10 or 0
|
||||
for k,_ in next,R do
|
||||
if type(k)=="number"then
|
||||
@@ -213,13 +225,13 @@ do
|
||||
if S.version~=gameVersion then
|
||||
S.version=gameVersion
|
||||
newVersionLaunch=true
|
||||
for name,rank in next,modeRanks do
|
||||
for name,rank in next,RANKS do
|
||||
if rank and rank>0 then
|
||||
for i=1,#Modes do
|
||||
if Modes[i].name==name and Modes[i].unlock then
|
||||
for _,unlockName in next,Modes[i].unlock do
|
||||
if not modeRanks[unlockName]then
|
||||
modeRanks[unlockName]=0
|
||||
for i=1,#MODES do
|
||||
if MODES[i].name==name and MODES[i].unlock then
|
||||
for _,unlockName in next,MODES[i].unlock do
|
||||
if not RANKS[unlockName]then
|
||||
RANKS[unlockName]=0
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -230,7 +242,7 @@ do
|
||||
FILE.saveSetting()
|
||||
end
|
||||
if MOBILE and not SETTING.fullscreen then
|
||||
LOG.print("如果手机上方状态栏不消失,请到设置界面开启全屏",300,color.yellow)
|
||||
LOG.print("Switch fullscreen on if titleBar don't disappear",300,color.yellow)
|
||||
LOG.print("如果手机上方状态栏不消失,请到设置界面开启全屏",300,COLOR.yellow)
|
||||
LOG.print("Switch fullscreen on if titleBar don't disappear",300,COLOR.yellow)
|
||||
end
|
||||
end
|
||||
@@ -12,7 +12,7 @@ local function score(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.lBlue,
|
||||
color=COLOR.lBlue,
|
||||
env={
|
||||
noTele=true,
|
||||
minarr=1,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
color=color.magenta,
|
||||
color=COLOR.magenta,
|
||||
env={
|
||||
drop=30,lock=60,
|
||||
fall=12,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local min=math.min
|
||||
return{
|
||||
color=color.lYellow,
|
||||
color=COLOR.lYellow,
|
||||
env={
|
||||
drop=5,lock=60,
|
||||
fall=8,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local format=string.format
|
||||
return{
|
||||
color=color.lGrey,
|
||||
color=COLOR.lGrey,
|
||||
env={
|
||||
drop=1e99,lock=1e99,
|
||||
hold=false,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local min=math.min
|
||||
return{
|
||||
color=color.cyan,
|
||||
color=COLOR.cyan,
|
||||
env={
|
||||
drop=30,lock=45,
|
||||
visible="time",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local gc=love.graphics
|
||||
local min=math.min
|
||||
return{
|
||||
color=color.magenta,
|
||||
color=COLOR.magenta,
|
||||
env={
|
||||
drop=15,lock=45,
|
||||
fall=10,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local gc=love.graphics
|
||||
local min=math.min
|
||||
return{
|
||||
color=color.red,
|
||||
color=COLOR.red,
|
||||
env={
|
||||
drop=10,lock=60,
|
||||
fall=5,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local gc=love.graphics
|
||||
local min=math.min
|
||||
return{
|
||||
color=color.green,
|
||||
color=COLOR.green,
|
||||
env={
|
||||
drop=15,lock=45,
|
||||
freshLimit=10,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local gc=love.graphics
|
||||
local min=math.min
|
||||
return{
|
||||
color=color.red,
|
||||
color=COLOR.red,
|
||||
env={
|
||||
drop=30,lock=60,
|
||||
block=false,center=0,ghost=0,
|
||||
|
||||
@@ -2,7 +2,7 @@ local gc=love.graphics
|
||||
local sin,min=math.sin,math.min
|
||||
local Timer=love.timer.getTime
|
||||
return{
|
||||
color=color.red,
|
||||
color=COLOR.red,
|
||||
env={
|
||||
drop=30,lock=60,
|
||||
next=1,
|
||||
@@ -18,7 +18,7 @@ return{
|
||||
load=function()
|
||||
PLY.newPlayer(1,340,15)
|
||||
if SETTING.spawn==0 then
|
||||
LOG.print(text.switchSpawnSFX,color.yellow)
|
||||
LOG.print(text.switchSpawnSFX,COLOR.yellow)
|
||||
end
|
||||
end,
|
||||
mesDisp=function(P)
|
||||
|
||||
@@ -4,8 +4,8 @@ local function check_c4w(P)
|
||||
P:lose()
|
||||
else
|
||||
for _=1,#P.clearedRow do
|
||||
P.field[#P.field+1]=freeRow.get(13)
|
||||
P.visTime[#P.visTime+1]=freeRow.get(20)
|
||||
P.field[#P.field+1]=FREEROW.get(13)
|
||||
P.visTime[#P.visTime+1]=FREEROW.get(20)
|
||||
for i=4,7 do P.field[#P.field][i]=0 end
|
||||
end
|
||||
if P.combo>P.modeData.point then
|
||||
@@ -18,7 +18,7 @@ local function check_c4w(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.red,
|
||||
color=COLOR.red,
|
||||
env={
|
||||
drop=5,lock=30,
|
||||
dropPiece=check_c4w,
|
||||
@@ -31,8 +31,8 @@ return{
|
||||
local P=PLAYERS[1]
|
||||
local F=P.field
|
||||
for i=1,24 do
|
||||
F[i]=freeRow.get(13)
|
||||
P.visTime[i]=freeRow.get(20)
|
||||
F[i]=FREEROW.get(13)
|
||||
P.visTime[i]=FREEROW.get(20)
|
||||
for x=4,7 do F[i][x]=0 end
|
||||
end
|
||||
local r=P:RND(6)
|
||||
|
||||
@@ -2,8 +2,8 @@ local min=math.min
|
||||
local function check_c4w(P)
|
||||
if #P.clearedRow>0 then
|
||||
for _=1,#P.clearedRow do
|
||||
P.field[#P.field+1]=freeRow.get(13)
|
||||
P.visTime[#P.visTime+1]=freeRow.get(20)
|
||||
P.field[#P.field+1]=FREEROW.get(13)
|
||||
P.visTime[#P.visTime+1]=FREEROW.get(20)
|
||||
for i=4,7 do P.field[#P.field][i]=0 end
|
||||
end
|
||||
if P.combo>P.modeData.point then
|
||||
@@ -16,7 +16,7 @@ local function check_c4w(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.green,
|
||||
color=COLOR.green,
|
||||
env={
|
||||
drop=30,lock=60,oncehold=false,
|
||||
dropPiece=check_c4w,
|
||||
@@ -29,8 +29,8 @@ return{
|
||||
local P=PLAYERS[1]
|
||||
local F=P.field
|
||||
for i=1,24 do
|
||||
F[i]=freeRow.get(13)
|
||||
P.visTime[i]=freeRow.get(20)
|
||||
F[i]=FREEROW.get(13)
|
||||
P.visTime[i]=FREEROW.get(20)
|
||||
for x=4,7 do F[i][x]=0 end
|
||||
end
|
||||
local r=P:RND(6)
|
||||
|
||||
@@ -15,7 +15,7 @@ local function check_LVup(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.lBlue,
|
||||
color=COLOR.lBlue,
|
||||
env={
|
||||
noTele=true,
|
||||
das=16,arr=6,sddas=2,sdarr=2,
|
||||
|
||||
@@ -17,8 +17,8 @@ local function setField(P,page)
|
||||
local t=P.showTime*3
|
||||
for y=1,height do
|
||||
local solid=notAir(F[y])
|
||||
P.field[y]=freeRow.get(0,solid)
|
||||
P.visTime[y]=freeRow.get(t)
|
||||
P.field[y]=FREEROW.get(0,solid)
|
||||
P.visTime[y]=FREEROW.get(t)
|
||||
if solid then
|
||||
for x=1,10 do
|
||||
P.field[y][x]=F[y][x]
|
||||
@@ -33,8 +33,8 @@ local function checkClear(P)
|
||||
if FIELD[P.modeData.point+1]then
|
||||
P.waiting=26
|
||||
for _=#P.field,1,-1 do
|
||||
freeRow.discard(P.field[_])
|
||||
freeRow.discard(P.visTime[_])
|
||||
FREEROW.discard(P.field[_])
|
||||
FREEROW.discard(P.visTime[_])
|
||||
P.field[_],P.visTime[_]=nil
|
||||
end
|
||||
setField(P,P.modeData.point+1)
|
||||
@@ -46,7 +46,7 @@ local function checkClear(P)
|
||||
end
|
||||
end
|
||||
return{
|
||||
color=color.white,
|
||||
color=COLOR.white,
|
||||
env={},
|
||||
load=function()
|
||||
for k,v in next,customEnv do
|
||||
@@ -80,9 +80,9 @@ return{
|
||||
if L~=0 then
|
||||
modeEnv.target=nil
|
||||
if L<6 then
|
||||
PLY.newAIPlayer(2,965,360,.5,AITemplate("9S",2*L))
|
||||
PLY.newAIPlayer(2,965,360,.5,AIBUILDER("9S",2*L))
|
||||
else
|
||||
PLY.newAIPlayer(2,965,360,.5,AITemplate("CC",2*L-11,int(L*.5-1.5),modeEnv.hold,4000*L))
|
||||
PLY.newAIPlayer(2,965,360,.5,AIBUILDER("CC",2*L-11,int(L*.5-1.5),modeEnv.hold,4000*L))
|
||||
end
|
||||
end
|
||||
for _,P in next,PLAYERS.alive do
|
||||
|
||||
@@ -18,8 +18,8 @@ local function puzzleCheck(P)
|
||||
if FIELD[P.modeData.point+1]then
|
||||
P.waiting=26
|
||||
for _=#P.field,1,-1 do
|
||||
freeRow.discard(P.field[_])
|
||||
freeRow.discard(P.visTime[_])
|
||||
FREEROW.discard(P.field[_])
|
||||
FREEROW.discard(P.visTime[_])
|
||||
P.field[_],P.visTime[_]=nil
|
||||
end
|
||||
sysFX.newShade(.7,.3,1,.3,P.x+150*P.size,P.y+60*P.size,300*P.size,610*P.size)
|
||||
@@ -32,7 +32,7 @@ local function puzzleCheck(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.white,
|
||||
color=COLOR.white,
|
||||
env={
|
||||
Fkey=function(P)P.modeData.event=1-P.modeData.event end,
|
||||
dropPiece=puzzleCheck,
|
||||
@@ -56,9 +56,9 @@ return{
|
||||
if L~=0 then
|
||||
modeEnv.target=nil
|
||||
if L<6 then
|
||||
PLY.newAIPlayer(2,965,360,.5,AITemplate("9S",2*L))
|
||||
PLY.newAIPlayer(2,965,360,.5,AIBUILDER("9S",2*L))
|
||||
else
|
||||
PLY.newAIPlayer(2,965,360,.5,AITemplate("CC",2*L-11,int(L*.5-1.5),modeEnv.hold,4000*L))
|
||||
PLY.newAIPlayer(2,965,360,.5,AIBUILDER("CC",2*L-11,int(L*.5-1.5),modeEnv.hold,4000*L))
|
||||
end
|
||||
end
|
||||
modeEnv.bg=customEnv.bg
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local int=math.floor
|
||||
return{
|
||||
color=color.red,
|
||||
color=COLOR.red,
|
||||
env={
|
||||
drop=5,lock=60,
|
||||
fall=6,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local int=math.floor
|
||||
return{
|
||||
color=color.green,
|
||||
color=COLOR.green,
|
||||
env={
|
||||
drop=30,lock=60,
|
||||
fall=10,
|
||||
|
||||
@@ -5,7 +5,7 @@ local function check_rise(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.cyan,
|
||||
color=COLOR.cyan,
|
||||
env={
|
||||
pushSpeed=6,
|
||||
dropPiece=check_rise,
|
||||
|
||||
@@ -8,7 +8,7 @@ local function check_rise(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.green,
|
||||
color=COLOR.green,
|
||||
env={
|
||||
pushSpeed=6,
|
||||
dropPiece=check_rise,
|
||||
|
||||
@@ -8,7 +8,7 @@ local function check_rise(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.lBlue,
|
||||
color=COLOR.lBlue,
|
||||
env={
|
||||
pushSpeed=6,
|
||||
dropPiece=check_rise,
|
||||
|
||||
@@ -8,7 +8,7 @@ local function check_rise(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.orange,
|
||||
color=COLOR.orange,
|
||||
env={
|
||||
pushSpeed=6,
|
||||
dropPiece=check_rise,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local max=math.max
|
||||
return{
|
||||
color=color.magenta,
|
||||
color=COLOR.magenta,
|
||||
env={
|
||||
drop=60,lock=120,
|
||||
fall=20,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local max=math.max
|
||||
return{
|
||||
color=color.lYellow,
|
||||
color=COLOR.lYellow,
|
||||
env={
|
||||
drop=10,lock=30,
|
||||
freshLimit=15,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local min=math.min
|
||||
return{
|
||||
color=color.red,
|
||||
color=COLOR.red,
|
||||
env={
|
||||
drop=20,lock=60,
|
||||
sequence=function(P)
|
||||
@@ -8,7 +8,7 @@ return{
|
||||
end,
|
||||
freshMethod=function(P)
|
||||
if not P.next[1] then
|
||||
local height=freeRow.get(0)
|
||||
local height=FREEROW.get(0)
|
||||
local max=#P.field
|
||||
if max>0 then
|
||||
--Get heights
|
||||
@@ -87,7 +87,7 @@ return{
|
||||
end
|
||||
|
||||
::END::
|
||||
freeRow.discard(height)
|
||||
FREEROW.discard(height)
|
||||
P:getNext(res[P:RND(#res)])
|
||||
end
|
||||
end,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local min=math.min
|
||||
return{
|
||||
color=color.green,
|
||||
color=COLOR.green,
|
||||
env={
|
||||
drop=20,lock=60,
|
||||
sequence="bag",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local format=string.format
|
||||
return{
|
||||
color=color.lGrey,
|
||||
color=COLOR.lGrey,
|
||||
env={
|
||||
drop=1e99,lock=1e99,
|
||||
oncehold=false,
|
||||
|
||||
@@ -27,7 +27,7 @@ local function check_rise(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.white,
|
||||
color=COLOR.white,
|
||||
env={
|
||||
drop=1e99,lock=1e99,
|
||||
oncehold=false,
|
||||
|
||||
@@ -17,7 +17,7 @@ local function check(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.magenta,
|
||||
color=COLOR.magenta,
|
||||
env={
|
||||
noTele=true,
|
||||
mindas=7,minarr=1,minsdarr=1,
|
||||
|
||||
@@ -14,7 +14,7 @@ local function check_LVup(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.green,
|
||||
color=COLOR.green,
|
||||
env={
|
||||
noTele=true,
|
||||
wait=8,fall=20,
|
||||
|
||||
@@ -21,7 +21,7 @@ local function check_LVup(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.yellow,
|
||||
color=COLOR.yellow,
|
||||
env={
|
||||
noTele=true,
|
||||
wait=8,fall=20,
|
||||
|
||||
@@ -40,7 +40,7 @@ local function score(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.red,
|
||||
color=COLOR.red,
|
||||
env={
|
||||
noTele=true,
|
||||
das=6,arr=1,
|
||||
|
||||
@@ -42,7 +42,7 @@ local function score(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.red,
|
||||
color=COLOR.red,
|
||||
env={
|
||||
noTele=true,
|
||||
das=9,arr=3,
|
||||
|
||||
@@ -40,7 +40,7 @@ local function score(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.lGrey,
|
||||
color=COLOR.lGrey,
|
||||
env={
|
||||
noTele=true,
|
||||
das=5,arr=1,
|
||||
|
||||
@@ -38,8 +38,8 @@ local function check_LVup(P)
|
||||
P.field[i][P:RND(10)]=0
|
||||
end
|
||||
else
|
||||
P.field[i]=freeRow.get(0)
|
||||
P.visTime[i]=freeRow.get(30)
|
||||
P.field[i]=FREEROW.get(0)
|
||||
P.visTime[i]=FREEROW.get(30)
|
||||
for j=1,10 do
|
||||
if P:RND()>.9 then
|
||||
P.field[i][j]=math.random(16)
|
||||
@@ -132,7 +132,7 @@ local function check_LVup(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.black,
|
||||
color=COLOR.black,
|
||||
env={
|
||||
noTele=true,
|
||||
das=5,arr=1,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
color=color.magenta,
|
||||
color=COLOR.magenta,
|
||||
env={
|
||||
drop=60,lock=120,
|
||||
fall=10,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
color=color.red,
|
||||
color=COLOR.red,
|
||||
env={
|
||||
drop=20,lock=60,
|
||||
fall=20,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
color=color.green,
|
||||
color=COLOR.green,
|
||||
env={
|
||||
oncehold=false,
|
||||
drop=300,lock=1e99,
|
||||
|
||||
@@ -47,7 +47,7 @@ local function newPC(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.red,
|
||||
color=COLOR.red,
|
||||
env={
|
||||
next=4,
|
||||
hold=false,
|
||||
|
||||
@@ -40,7 +40,7 @@ local function newPC(P)
|
||||
end
|
||||
end
|
||||
return{
|
||||
color=color.green,
|
||||
color=COLOR.green,
|
||||
env={
|
||||
next=4,
|
||||
hold=false,
|
||||
|
||||
@@ -11,7 +11,7 @@ local function update_round(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.cyan,
|
||||
color=COLOR.cyan,
|
||||
env={
|
||||
drop=300,lock=300,
|
||||
oncehold=false,
|
||||
@@ -20,7 +20,7 @@ return{
|
||||
},
|
||||
load=function()
|
||||
PLY.newPlayer(1,340,15)
|
||||
PLY.newAIPlayer(2,965,360,.5,AITemplate("CC",10,1,true,10000))
|
||||
PLY.newAIPlayer(2,965,360,.5,AIBUILDER("CC",10,1,true,10000))
|
||||
GAME.garbageSpeed=1e99
|
||||
end,
|
||||
score=function(P)return{P.stat.piece,P.stat.time}end,
|
||||
|
||||
@@ -11,7 +11,7 @@ local function update_round(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.green,
|
||||
color=COLOR.green,
|
||||
env={
|
||||
drop=300,lock=300,
|
||||
oncehold=false,
|
||||
@@ -20,7 +20,7 @@ return{
|
||||
},
|
||||
load=function()
|
||||
PLY.newPlayer(1,340,15)
|
||||
PLY.newAIPlayer(2,965,360,.5,AITemplate("CC",10,1,true,13000))
|
||||
PLY.newAIPlayer(2,965,360,.5,AIBUILDER("CC",10,1,true,13000))
|
||||
GAME.garbageSpeed=1e99
|
||||
end,
|
||||
score=function(P)return{P.stat.piece,P.stat.time}end,
|
||||
|
||||
@@ -11,7 +11,7 @@ local function update_round(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.magenta,
|
||||
color=COLOR.magenta,
|
||||
env={
|
||||
drop=300,lock=300,
|
||||
oncehold=false,
|
||||
@@ -20,7 +20,7 @@ return{
|
||||
},
|
||||
load=function()
|
||||
PLY.newPlayer(1,340,15)
|
||||
PLY.newAIPlayer(2,965,360,.5,AITemplate("CC",10,2,true,16000))
|
||||
PLY.newAIPlayer(2,965,360,.5,AIBUILDER("CC",10,2,true,16000))
|
||||
GAME.garbageSpeed=1e99
|
||||
end,
|
||||
score=function(P)return{P.stat.piece,P.stat.time}end,
|
||||
|
||||
@@ -11,7 +11,7 @@ local function update_round(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.red,
|
||||
color=COLOR.red,
|
||||
env={
|
||||
drop=300,lock=300,
|
||||
oncehold=false,
|
||||
@@ -20,7 +20,7 @@ return{
|
||||
},
|
||||
load=function()
|
||||
PLY.newPlayer(1,340,15)
|
||||
PLY.newAIPlayer(2,965,360,.5,AITemplate("CC",10,3,true,26000))
|
||||
PLY.newAIPlayer(2,965,360,.5,AIBUILDER("CC",10,3,true,26000))
|
||||
GAME.garbageSpeed=1e99
|
||||
end,
|
||||
score=function(P)return{P.stat.piece,P.stat.time}end,
|
||||
|
||||
@@ -11,7 +11,7 @@ local function update_round(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.lYellow,
|
||||
color=COLOR.lYellow,
|
||||
env={
|
||||
drop=300,lock=300,
|
||||
oncehold=false,
|
||||
@@ -20,7 +20,7 @@ return{
|
||||
},
|
||||
load=function()
|
||||
PLY.newPlayer(1,340,15)
|
||||
PLY.newAIPlayer(2,965,360,.5,AITemplate("CC",10,3,true,40000))
|
||||
PLY.newAIPlayer(2,965,360,.5,AIBUILDER("CC",10,3,true,40000))
|
||||
GAME.garbageSpeed=1e99
|
||||
end,
|
||||
score=function(P)return{P.stat.piece,P.stat.time}end,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
color=color.cyan,
|
||||
color=COLOR.cyan,
|
||||
env={
|
||||
life=2,
|
||||
drop=60,lock=60,
|
||||
@@ -9,7 +9,7 @@ return{
|
||||
pauseLimit=true,
|
||||
load=function()
|
||||
PLY.newPlayer(1,340,15)
|
||||
PLY.newAIPlayer(2,965,360,.5,AITemplate("9S",4))
|
||||
PLY.newAIPlayer(2,965,360,.5,AIBUILDER("9S",4))
|
||||
end,
|
||||
score=function(P)return{P.stat.time}end,
|
||||
scoreDisp=function(D)return toTime(D[1])end,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
color=color.green,
|
||||
color=COLOR.green,
|
||||
env={
|
||||
life=2,
|
||||
drop=60,lock=60,
|
||||
@@ -9,7 +9,7 @@ return{
|
||||
pauseLimit=true,
|
||||
load=function()
|
||||
PLY.newPlayer(1,340,15)
|
||||
PLY.newAIPlayer(2,965,360,.5,AITemplate("9S",5))
|
||||
PLY.newAIPlayer(2,965,360,.5,AIBUILDER("9S",5))
|
||||
end,
|
||||
score=function(P)return{P.stat.time}end,
|
||||
scoreDisp=function(D)return toTime(D[1])end,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
color=color.magenta,
|
||||
color=COLOR.magenta,
|
||||
env={
|
||||
life=2,
|
||||
drop=60,lock=60,
|
||||
@@ -9,7 +9,7 @@ return{
|
||||
pauseLimit=true,
|
||||
load=function()
|
||||
PLY.newPlayer(1,340,15)
|
||||
PLY.newAIPlayer(2,965,360,.5,AITemplate("9S",6))
|
||||
PLY.newAIPlayer(2,965,360,.5,AIBUILDER("9S",6))
|
||||
end,
|
||||
score=function(P)return{P.stat.time}end,
|
||||
scoreDisp=function(D)return toTime(D[1])end,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
color=color.red,
|
||||
color=COLOR.red,
|
||||
env={
|
||||
life=2,
|
||||
drop=60,lock=60,
|
||||
@@ -9,7 +9,7 @@ return{
|
||||
pauseLimit=true,
|
||||
load=function()
|
||||
PLY.newPlayer(1,340,15)
|
||||
PLY.newAIPlayer(2,965,360,.5,AITemplate("CC",6,2,true,30000))
|
||||
PLY.newAIPlayer(2,965,360,.5,AIBUILDER("CC",6,2,true,30000))
|
||||
end,
|
||||
score=function(P)return{P.stat.time}end,
|
||||
scoreDisp=function(D)return toTime(D[1])end,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
color=color.lYellow,
|
||||
color=COLOR.lYellow,
|
||||
env={
|
||||
life=2,
|
||||
drop=60,lock=60,
|
||||
@@ -9,7 +9,7 @@ return{
|
||||
pauseLimit=true,
|
||||
load=function()
|
||||
PLY.newPlayer(1,340,15)
|
||||
PLY.newAIPlayer(2,965,360,.5,AITemplate("CC",7,3,true,50000))
|
||||
PLY.newAIPlayer(2,965,360,.5,AIBUILDER("CC",7,3,true,50000))
|
||||
end,
|
||||
score=function(P)return{P.stat.time}end,
|
||||
scoreDisp=function(D)return toTime(D[1])end,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
color=color.green,
|
||||
color=COLOR.green,
|
||||
env={
|
||||
drop=60,lock=180,
|
||||
noTele=true,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
color=color.green,
|
||||
color=COLOR.green,
|
||||
env={
|
||||
drop=60,lock=180,
|
||||
keyCancel={3,4,5},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
color=color.green,
|
||||
color=COLOR.green,
|
||||
env={
|
||||
drop=60,lock=60,
|
||||
next=0,hold=false,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
color=color.green,
|
||||
color=COLOR.green,
|
||||
env={
|
||||
drop=60,lock=60,
|
||||
sequence="bag",bag={8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25},
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
color=color.cyan,
|
||||
color=COLOR.cyan,
|
||||
env={
|
||||
drop=60,lock=60,
|
||||
target=10,dropPiece=PLY.check_lineReach,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
color=color.red,
|
||||
color=COLOR.red,
|
||||
env={
|
||||
drop=60,lock=60,
|
||||
target=100,dropPiece=PLY.check_lineReach,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
color=color.lGrey,
|
||||
color=COLOR.lGrey,
|
||||
env={
|
||||
drop=60,lock=60,
|
||||
target=1000,dropPiece=PLY.check_lineReach,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
color=color.lBlue,
|
||||
color=COLOR.lBlue,
|
||||
env={
|
||||
drop=60,lock=60,
|
||||
target=20,dropPiece=PLY.check_lineReach,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
color=color.green,
|
||||
color=COLOR.green,
|
||||
env={
|
||||
drop=60,lock=60,
|
||||
target=40,dropPiece=PLY.check_lineReach,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
color=color.dRed,
|
||||
color=COLOR.dRed,
|
||||
env={
|
||||
drop=60,lock=60,
|
||||
target=400,dropPiece=PLY.check_lineReach,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local max=math.max
|
||||
return{
|
||||
color=color.cyan,
|
||||
color=COLOR.cyan,
|
||||
env={
|
||||
drop=30,lock=45,
|
||||
freshLimit=10,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local max=math.max
|
||||
return{
|
||||
color=color.magenta,
|
||||
color=COLOR.magenta,
|
||||
env={
|
||||
drop=30,lock=45,
|
||||
freshLimit=10,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local max=math.max
|
||||
return{
|
||||
color=color.red,
|
||||
color=COLOR.red,
|
||||
env={
|
||||
drop=30,lock=45,
|
||||
freshLimit=10,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local max=math.max
|
||||
return{
|
||||
color=color.green,
|
||||
color=COLOR.green,
|
||||
env={
|
||||
drop=30,lock=45,
|
||||
freshLimit=10,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local max=math.max
|
||||
return{
|
||||
color=color.lYellow,
|
||||
color=COLOR.lYellow,
|
||||
env={
|
||||
drop=5,lock=60,
|
||||
fall=10,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local format=string.format
|
||||
local int=math.floor
|
||||
return{
|
||||
color=color.lYellow,
|
||||
color=COLOR.lYellow,
|
||||
env={
|
||||
arr=0,
|
||||
drop=1e99,lock=60,
|
||||
|
||||
@@ -13,7 +13,7 @@ local function tech_check_hard(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.grey,
|
||||
color=COLOR.grey,
|
||||
env={
|
||||
arr=0,
|
||||
drop=1e99,lock=60,
|
||||
|
||||
@@ -9,7 +9,7 @@ local function tech_check_easy(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.magenta,
|
||||
color=COLOR.magenta,
|
||||
env={
|
||||
drop=20,lock=60,
|
||||
freshLimit=15,
|
||||
|
||||
@@ -13,7 +13,7 @@ local function tech_check_hard(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.dMagenta,
|
||||
color=COLOR.dMagenta,
|
||||
env={
|
||||
drop=30,lock=60,
|
||||
freshLimit=15,
|
||||
|
||||
@@ -9,7 +9,7 @@ local function tech_check_easy(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.red,
|
||||
color=COLOR.red,
|
||||
env={
|
||||
drop=0,lock=60,
|
||||
freshLimit=15,
|
||||
|
||||
@@ -13,7 +13,7 @@ local function tech_check_hard(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.dRed,
|
||||
color=COLOR.dRed,
|
||||
env={
|
||||
drop=0,lock=60,
|
||||
freshLimit=15,
|
||||
|
||||
@@ -9,7 +9,7 @@ local function tech_check_easy(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.green,
|
||||
color=COLOR.green,
|
||||
env={
|
||||
oncehold=false,
|
||||
drop=1e99,lock=1e99,
|
||||
|
||||
@@ -13,7 +13,7 @@ local function tech_check_hard(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.dGreen,
|
||||
color=COLOR.dGreen,
|
||||
env={
|
||||
oncehold=false,
|
||||
drop=1e99,lock=1e99,
|
||||
|
||||
@@ -16,7 +16,7 @@ local function selectTarget(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.cyan,
|
||||
color=COLOR.cyan,
|
||||
env={
|
||||
drop=60,lock=60,
|
||||
fall=20,
|
||||
@@ -41,17 +41,17 @@ return{
|
||||
local n=2
|
||||
for i=1,4 do for j=1,6 do
|
||||
if L[n]then
|
||||
PLY.newAIPlayer(n,78*i-54,115*j-98,.09,AITemplate("9S",rnd(4,6)))
|
||||
PLY.newAIPlayer(n,78*i-54,115*j-98,.09,AIBUILDER("9S",rnd(4,6)))
|
||||
else
|
||||
PLY.newAIPlayer(n,78*i-54,115*j-98,.09,AITemplate("CC",rnd(2,4),2,true,20000))
|
||||
PLY.newAIPlayer(n,78*i-54,115*j-98,.09,AIBUILDER("CC",rnd(2,4),2,true,20000))
|
||||
end
|
||||
n=n+1
|
||||
end end
|
||||
for i=9,12 do for j=1,6 do
|
||||
if L[n]then
|
||||
PLY.newAIPlayer(n,78*i+267,115*j-98,.09,AITemplate("9S",rnd(4,5)))
|
||||
PLY.newAIPlayer(n,78*i+267,115*j-98,.09,AIBUILDER("9S",rnd(4,5)))
|
||||
else
|
||||
PLY.newAIPlayer(n,78*i+267,115*j-98,.09,AITemplate("CC",rnd(3,5),2,true,20000))
|
||||
PLY.newAIPlayer(n,78*i+267,115*j-98,.09,AIBUILDER("CC",rnd(3,5),2,true,20000))
|
||||
end
|
||||
n=n+1
|
||||
end end
|
||||
|
||||
@@ -16,7 +16,7 @@ local function selectTarget(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.magenta,
|
||||
color=COLOR.magenta,
|
||||
env={
|
||||
drop=60,lock=60,
|
||||
fall=20,
|
||||
@@ -41,17 +41,17 @@ return{
|
||||
local n=2
|
||||
for i=1,4 do for j=1,6 do
|
||||
if L[n]then
|
||||
PLY.newAIPlayer(n,78*i-54,115*j-98,.09,AITemplate("9S",rnd(4,8)))
|
||||
PLY.newAIPlayer(n,78*i-54,115*j-98,.09,AIBUILDER("9S",rnd(4,8)))
|
||||
else
|
||||
PLY.newAIPlayer(n,78*i-54,115*j-98,.09,AITemplate("CC",rnd(3,6),3,true,30000))
|
||||
PLY.newAIPlayer(n,78*i-54,115*j-98,.09,AIBUILDER("CC",rnd(3,6),3,true,30000))
|
||||
end
|
||||
n=n+1
|
||||
end end
|
||||
for i=9,12 do for j=1,6 do
|
||||
if L[n]then
|
||||
PLY.newAIPlayer(n,78*i+267,115*j-98,.09,AITemplate("9S",rnd(4,7)))
|
||||
PLY.newAIPlayer(n,78*i+267,115*j-98,.09,AIBUILDER("9S",rnd(4,7)))
|
||||
else
|
||||
PLY.newAIPlayer(n,78*i+267,115*j-98,.09,AITemplate("CC",rnd(4,6),3,true,30000))
|
||||
PLY.newAIPlayer(n,78*i+267,115*j-98,.09,AIBUILDER("CC",rnd(4,6),3,true,30000))
|
||||
end
|
||||
n=n+1
|
||||
end end
|
||||
|
||||
@@ -16,7 +16,7 @@ local function selectTarget(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.lYellow,
|
||||
color=COLOR.lYellow,
|
||||
env={
|
||||
drop=15,lock=60,
|
||||
fall=20,
|
||||
@@ -41,17 +41,17 @@ return{
|
||||
local n=2
|
||||
for i=1,4 do for j=1,6 do
|
||||
if L[n]then
|
||||
PLY.newAIPlayer(n,78*i-54,115*j-98,.09,AITemplate("9S",rnd(8,10)))
|
||||
PLY.newAIPlayer(n,78*i-54,115*j-98,.09,AIBUILDER("9S",rnd(8,10)))
|
||||
else
|
||||
PLY.newAIPlayer(n,78*i-54,115*j-98,.09,AITemplate("CC",rnd(4,7),3,true,40000))
|
||||
PLY.newAIPlayer(n,78*i-54,115*j-98,.09,AIBUILDER("CC",rnd(4,7),3,true,40000))
|
||||
end
|
||||
n=n+1
|
||||
end end
|
||||
for i=9,12 do for j=1,6 do
|
||||
if L[n]then
|
||||
PLY.newAIPlayer(n,78*i+267,115*j-98,.09,AITemplate("9S",rnd(8,9)))
|
||||
PLY.newAIPlayer(n,78*i+267,115*j-98,.09,AIBUILDER("9S",rnd(8,9)))
|
||||
else
|
||||
PLY.newAIPlayer(n,78*i+267,115*j-98,.09,AITemplate("CC",rnd(5,8),3,true,40000))
|
||||
PLY.newAIPlayer(n,78*i+267,115*j-98,.09,AIBUILDER("CC",rnd(5,8),3,true,40000))
|
||||
end
|
||||
n=n+1
|
||||
end end
|
||||
|
||||
@@ -16,7 +16,7 @@ local function selectTarget(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.cyan,
|
||||
color=COLOR.cyan,
|
||||
env={
|
||||
drop=60,lock=60,
|
||||
fall=20,
|
||||
@@ -41,17 +41,17 @@ return{
|
||||
local n=2
|
||||
for i=1,7 do for j=1,7 do
|
||||
if L[n]then
|
||||
PLY.newAIPlayer(n,46*i-36,97*j-72,.068,AITemplate("9S",rnd(4,6)))
|
||||
PLY.newAIPlayer(n,46*i-36,97*j-72,.068,AIBUILDER("9S",rnd(4,6)))
|
||||
else
|
||||
PLY.newAIPlayer(n,46*i-36,97*j-72,.068,AITemplate("CC",rnd(2,4),2,true,20000))
|
||||
PLY.newAIPlayer(n,46*i-36,97*j-72,.068,AIBUILDER("CC",rnd(2,4),2,true,20000))
|
||||
end
|
||||
n=n+1
|
||||
end end
|
||||
for i=15,21 do for j=1,7 do
|
||||
if L[n]then
|
||||
PLY.newAIPlayer(n,46*i+264,97*j-72,.068,AITemplate("9S",rnd(4,5)))
|
||||
PLY.newAIPlayer(n,46*i+264,97*j-72,.068,AIBUILDER("9S",rnd(4,5)))
|
||||
else
|
||||
PLY.newAIPlayer(n,46*i+264,97*j-72,.068,AITemplate("CC",rnd(3,5),2,true,20000))
|
||||
PLY.newAIPlayer(n,46*i+264,97*j-72,.068,AIBUILDER("CC",rnd(3,5),2,true,20000))
|
||||
end
|
||||
n=n+1
|
||||
end end
|
||||
|
||||
@@ -16,7 +16,7 @@ local function selectTarget(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.magenta,
|
||||
color=COLOR.magenta,
|
||||
env={
|
||||
drop=60,lock=60,
|
||||
fall=20,
|
||||
@@ -41,17 +41,17 @@ return{
|
||||
local n=2
|
||||
for i=1,7 do for j=1,7 do
|
||||
if L[n]then
|
||||
PLY.newAIPlayer(n,46*i-36,97*j-72,.068,AITemplate("9S",rnd(4,8)))
|
||||
PLY.newAIPlayer(n,46*i-36,97*j-72,.068,AIBUILDER("9S",rnd(4,8)))
|
||||
else
|
||||
PLY.newAIPlayer(n,46*i-36,97*j-72,.068,AITemplate("CC",rnd(3,6),3,true,30000))
|
||||
PLY.newAIPlayer(n,46*i-36,97*j-72,.068,AIBUILDER("CC",rnd(3,6),3,true,30000))
|
||||
end
|
||||
n=n+1
|
||||
end end
|
||||
for i=15,21 do for j=1,7 do
|
||||
if L[n]then
|
||||
PLY.newAIPlayer(n,46*i+264,97*j-72,.068,AITemplate("9S",rnd(4,7)))
|
||||
PLY.newAIPlayer(n,46*i+264,97*j-72,.068,AIBUILDER("9S",rnd(4,7)))
|
||||
else
|
||||
PLY.newAIPlayer(n,46*i+264,97*j-72,.068,AITemplate("CC",rnd(4,6),3,true,30000))
|
||||
PLY.newAIPlayer(n,46*i+264,97*j-72,.068,AIBUILDER("CC",rnd(4,6),3,true,30000))
|
||||
end
|
||||
n=n+1
|
||||
end end
|
||||
|
||||
@@ -16,7 +16,7 @@ local function selectTarget(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.lYellow,
|
||||
color=COLOR.lYellow,
|
||||
env={
|
||||
drop=15,lock=60,
|
||||
fall=20,
|
||||
@@ -41,17 +41,17 @@ return{
|
||||
local n=2
|
||||
for i=1,7 do for j=1,7 do
|
||||
if L[n]then
|
||||
PLY.newAIPlayer(n,46*i-36,97*j-72,.068,AITemplate("9S",rnd(8,10)))
|
||||
PLY.newAIPlayer(n,46*i-36,97*j-72,.068,AIBUILDER("9S",rnd(8,10)))
|
||||
else
|
||||
PLY.newAIPlayer(n,46*i-36,97*j-72,.068,AITemplate("CC",rnd(4,7),3,true,40000))
|
||||
PLY.newAIPlayer(n,46*i-36,97*j-72,.068,AIBUILDER("CC",rnd(4,7),3,true,40000))
|
||||
end
|
||||
n=n+1
|
||||
end end
|
||||
for i=15,21 do for j=1,7 do
|
||||
if L[n]then
|
||||
PLY.newAIPlayer(n,46*i+264,97*j-72,.068,AITemplate("9S",rnd(8,9)))
|
||||
PLY.newAIPlayer(n,46*i+264,97*j-72,.068,AIBUILDER("9S",rnd(8,9)))
|
||||
else
|
||||
PLY.newAIPlayer(n,46*i+264,97*j-72,.068,AITemplate("CC",rnd(5,8),3,true,40000))
|
||||
PLY.newAIPlayer(n,46*i+264,97*j-72,.068,AIBUILDER("CC",rnd(5,8),3,true,40000))
|
||||
end
|
||||
n=n+1
|
||||
end end
|
||||
|
||||
@@ -10,7 +10,7 @@ local function check_tsd(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.green,
|
||||
color=COLOR.green,
|
||||
env={
|
||||
drop=1e99,lock=1e99,
|
||||
oncehold=false,
|
||||
|
||||
@@ -10,7 +10,7 @@ local function check_tsd(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.magenta,
|
||||
color=COLOR.magenta,
|
||||
env={
|
||||
drop=60,lock=60,
|
||||
freshLimit=15,
|
||||
|
||||
@@ -10,7 +10,7 @@ local function check_tsd(P)
|
||||
end
|
||||
|
||||
return{
|
||||
color=color.lYellow,
|
||||
color=COLOR.lYellow,
|
||||
env={
|
||||
drop=60,lock=60,
|
||||
freshLimit=15,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local gc=love.graphics
|
||||
local warnTime={60,90,105,115,116,117,118,119,120}
|
||||
return{
|
||||
color=color.lGrey,
|
||||
color=COLOR.lGrey,
|
||||
env={
|
||||
noTele=true,
|
||||
minarr=1,minsdarr=1,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
return{
|
||||
color=color.lGrey,
|
||||
color=COLOR.lGrey,
|
||||
env={
|
||||
drop=120,lock=120,
|
||||
oncehold=false,
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
local AISpeed={60,50,40,30,20,14,10,6,4,3}
|
||||
local AISpeed={60,50,40,30,20,14,10,6,4,3}
|
||||
return function(type,speedLV,next,hold,node)
|
||||
if type=="CC"then
|
||||
return{
|
||||
|
||||
@@ -113,8 +113,8 @@ local function ifoverlapAI(f,bk,x,y)
|
||||
if f[y+i-1]and bk[i][j]and f[y+i-1][x+j-1]>0 then return true end
|
||||
end end
|
||||
end
|
||||
local discardRow=freeRow.discard
|
||||
local getRow=freeRow.get
|
||||
local discardRow=FREEROW.discard
|
||||
local getRow=FREEROW.get
|
||||
local function resetField(f0,f,start)
|
||||
for _=#f,start,-1 do
|
||||
discardRow(f[_])
|
||||
@@ -215,7 +215,7 @@ return{
|
||||
if not bn then goto CTN end
|
||||
|
||||
for dir=0,dirCount[bn]do--Each dir
|
||||
local cb=blocks[bn][dir]
|
||||
local cb=BLOCKS[bn][dir]
|
||||
for cx=1,11-#cb[1]do--Each pos
|
||||
local cy=#Tfield+1
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user