重构背景系统(每个背景使用独立文件),全局变量名整理

This commit is contained in:
MrZ626
2020-11-04 00:08:50 +08:00
parent c688fef3f6
commit a485a71dfc
149 changed files with 1087 additions and 1046 deletions

View File

@@ -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{

View File

@@ -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

View File

@@ -0,0 +1,24 @@
--Cool liquid background
local gc=love.graphics
local rnd=math.random
local back={}
local t
function back.init()
t=rnd()*2600
BG.resize(SCR.w,SCR.h)
end
function back.resize(_,h)
SHADER.aura:send("w",SCR.W)
SHADER.aura:send("h",h*SCR.dpi)
end
function back.update(dt)
t=t+dt
end
function back.draw()
SHADER.aura:send("t",t)
gc.setShader(SHADER.aura)
gc.rectangle("fill",0,0,SCR.w,SCR.h)
gc.setShader()
end
return back

View File

@@ -0,0 +1,56 @@
--Bad Apple!! (128x96, 10fps, 2192f)
local gc=love.graphics
local int=math.floor
local back={}
local bAnd,bRshift=bit.band,bit.rshift
local t
local video
local X,Y,K
function back.init()
if not video then
video=love.data.decompress("string","zlib",love.filesystem.read("Zframework/badapple.dat"))
end
t=0
BG.resize()
end
function back.resize()
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
function back.update()
t=t+1
if t==13146 then
t=0
end
end
function back.draw()
gc.clear(.2,.2,.2)
gc.push("transform")
gc.origin()
gc.translate(X,Y)
gc.scale(K)
gc.setColor(.4,.4,.4)
local t1=1536*int(t/6)+1
for i=0,1535 do
local B=video:byte(t1+i)
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
function back.discard()
video=nil
end
return back

23
parts/backgrounds/bg1.lua Normal file
View File

@@ -0,0 +1,23 @@
--Horizonal red-blue gradient
local gc=love.graphics
local rnd=math.random
local back={}
local t
function back.init()
t=rnd()*2600
BG.resize()
end
function back.resize()
SHADER.gradient1:send("w",SCR.W)
end
function back.update(dt)
t=t+dt
end
function back.draw()
SHADER.gradient1:send("t",t)
gc.setShader(SHADER.gradient1)
gc.rectangle("fill",0,0,SCR.w,SCR.h)
gc.setShader()
end
return back

23
parts/backgrounds/bg2.lua Normal file
View File

@@ -0,0 +1,23 @@
--Vertical red-green gradient
local gc=love.graphics
local rnd=math.random
local back={}
local t
function back.init()
t=rnd()*2600
BG.resize(nil,SCR.h)
end
function back.resize(_,h)
SHADER.gradient2:send("h",h*SCR.dpi)
end
function back.update(dt)
t=t+dt
end
function back.draw()
SHADER.gradient2:send("t",t)
gc.setShader(SHADER.gradient2)
gc.rectangle("fill",0,0,SCR.w,SCR.h)
gc.setShader()
end
return back

75
parts/backgrounds/fan.lua Normal file
View File

@@ -0,0 +1,75 @@
--UUZ's fan
local gc=love.graphics
local rnd=math.random
local max,min,sin=math.max,math.min,math.sin
local ins,rem=table.insert,table.remove
local back={}
local t
local fan,petal
function back.init()
t=rnd(2600)
fan=title_fan
petal={}
BG.resize()
end
function back.update()
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>SCR.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
function back.draw()
gc.push("transform")
gc.translate(SCR.w/2,SCR.h/2+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)
for i=1,8 do
gc.polygon("line",fan[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
function back.discard()
petal=nil
end
return back

View File

@@ -0,0 +1,19 @@
--Flash after random time
local gc=love.graphics
local rnd=math.random
local back={}
local t
function back.init()
t=rnd()*2600
end
function back.update(dt)
t=t+dt
end
function back.draw()
local t1=.13-t%3%1.9
if t1<.2 then gc.clear(t1,t1,t1)
else gc.clear(0,0,0)
end
end
return back

View File

@@ -0,0 +1,17 @@
--Light-dark
local gc=love.graphics
local rnd,sin=math.random,math.sin
local back={}
local t
function back.init()
t=rnd()*2600
end
function back.update(dt)
t=t+dt
end
function back.draw()
local t1=(sin(t*.5)+sin(t*.7)+sin(t*.9+1)+sin(t*1.5)+sin(t*2+10))*.08
gc.clear(t1,t1,t1)
end
return back

View File

@@ -0,0 +1,6 @@
local gc=love.graphics
local back={}
function back.draw()
gc.clear(.3,.3,.3)
end
return back

View File

@@ -0,0 +1,19 @@
--Lightning
local gc=love.graphics
local rnd=math.random
local back={}
local t
function back.init()
t=rnd()*2600
end
function back.update(dt)
t=t+dt
end
function back.draw()
local t1=2.5-t%20%6%2.5
if t1<.3 then gc.clear(t1,t1,t1)
else gc.clear(0,0,0)
end
end
return back

View File

@@ -0,0 +1,27 @@
--Fast lightning + spining tetromino
local gc=love.graphics
local int,rnd=math.floor,math.random
local back={}
local t
local colorLib
local blocks=BLOCKS
local scs=spinCenters
function back.init()
colorLib=SKIN.libColor
t=rnd()*2600
end
function back.update(dt)
t=t+dt
end
function back.draw()
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[SETTING.skin[R]]
gc.setColor(_[1],_[2],_[3],.12)
gc.draw(TEXTURE.miniBlock[R],640,360,t%3.1416*6,400,400,scs[R][0][2]+.5,#blocks[R][0]-scs[R][0][1]-.5)
end
return back

View File

@@ -0,0 +1,29 @@
--Black-White grid
local gc=love.graphics
local rnd,sin=math.random,math.sin
local ceil=math.ceil
local back={}
local t
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
function back.init()
t=rnd()*2600
end
function back.update(dt)
t=t+dt
end
function back.draw()
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
return back

View File

@@ -0,0 +1,6 @@
local gc=love.graphics
local back={}
function back.draw()
gc.clear(.15,.15,.15)
end
return back

View File

@@ -0,0 +1,24 @@
--Colorful RGB
local gc=love.graphics
local rnd=math.random
local back={}
local t
function back.init()
t=rnd()*2600
BG.resize(SCR.w,SCR.h)
end
function back.resize(_,h)
SHADER.rgb1:send("w",SCR.W)
SHADER.rgb1:send("h",h*SCR.dpi)
end
function back.update(dt)
t=t+dt
end
function back.draw()
SHADER.rgb1:send("t",t)
gc.setShader(SHADER.rgb1)
gc.rectangle("fill",0,0,SCR.w,SCR.h)
gc.setShader()
end
return back

View File

@@ -0,0 +1,24 @@
--Blue RGB
local gc=love.graphics
local rnd=math.random
local back={}
local t
function back.init()
t=rnd()*2600
BG.resize(SCR.w,SCR.h)
end
function back.resize(_,h)
SHADER.rgb2:send("w",SCR.W)
SHADER.rgb2:send("h",h*SCR.dpi)
end
function back.update(dt)
t=t+dt
end
function back.draw()
SHADER.rgb2:send("t",t)
gc.setShader(SHADER.rgb2)
gc.rectangle("fill",0,0,SCR.w,SCR.h)
gc.setShader()
end
return back

20
parts/backgrounds/rgb.lua Normal file
View File

@@ -0,0 +1,20 @@
--Changing pure color
local gc=love.graphics
local rnd,sin=math.random,math.sin
local back={}
local t
function back.init()
t=rnd()*2600
end
function back.update(dt)
t=t+dt
end
function back.draw()
gc.clear(
sin(t*1.2)*.15+.2,
sin(t*1.5)*.15+.2,
sin(t*1.9)*.15+.2
)
end
return back

View File

@@ -0,0 +1,48 @@
--Space with stars
local gc=love.graphics
local rnd=math.random
local back={}
local stars
local W,H
function back.init()
stars={}
W,H=SCR.w+20,SCR.h+20
BG.resize(SCR.w,SCR.h)
end
function back.resize()
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
function back.update()
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
function back.draw()
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
function back.discard()
stars=nil
end
return back

View File

@@ -0,0 +1,39 @@
--Welcome to Techmino
local gc=love.graphics
local rnd,sin=math.random,math.sin
local back={}
local t
local txt
function back.init()
t=rnd()*2600
txt=gc.newText(getFont(80),"Welcome To Techmino")
end
function back.update(dt)
t=t+dt
end
function back.draw()
if -t%13.55<.1283 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(xOy)
gc.translate(640,360)
gc.scale(1.1626,1.26)
if -t%6.26<.1355 then
gc.translate(60*sin(t*.26),100*sin(t*.626))
end
if -t%12.6<.1626 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
return back

View File

@@ -0,0 +1,73 @@
--Flandre's wing
local gc=love.graphics
local rnd=math.random
local back={}
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},
}
local bar,crystal
local W,H
function back.init()
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
function back.resize()
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
function back.update()
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
function back.draw()
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
function back.event(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
function back.discard()
bar,crystal=nil
end
return back

View File

@@ -1,7 +1,7 @@
local freeRow={}
local FREEROW={}
local L={}--Storage
local _=0--Length
function freeRow.reset(num)
function FREEROW.reset(num)
if num<_ then
for i=_,num+1,-1 do
L[i]=nil
@@ -13,7 +13,7 @@ function freeRow.reset(num)
end
_=num
end
function freeRow.get(val,type)--type: nil=norm, true=garbage
function FREEROW.get(val,type)--type: nil=norm, true=garbage
if _==0 then
for i=1,10 do
L[i]={0,0,0,0,0,0,0,0,0,0}
@@ -27,11 +27,11 @@ function freeRow.get(val,type)--type: nil=norm, true=garbage
_=_-1
return t
end
function freeRow.discard(t)
function FREEROW.discard(t)
_=_+1
L[_]=t
end
function freeRow.getCount()
function FREEROW.getCount()
return _
end
return freeRow
return FREEROW

View File

@@ -29,8 +29,8 @@ function destroyPlayers()
local P=PLAYERS[i]
if P.canvas then P.canvas:release()end
while P.field[1]do
freeRow.discard(rem(P.field))
freeRow.discard(rem(P.visTime))
FREEROW.discard(rem(P.field))
FREEROW.discard(rem(P.visTime))
end
if P.AI_mode=="CC"then
CC.free(P.bot_opt)
@@ -63,11 +63,11 @@ end
function copyQuestArgs()
local ENV=customEnv
local str=""
str=str..(ENV.hold and"H"or"Z")
str=str..(ENV.ospin and"O"or"Z")
str=str..(ENV.missionKill and"M"or"Z")
str=str..ENV.sequence
local str=""..
(ENV.hold and"H"or"Z")..
(ENV.ospin and"O"or"Z")..
(ENV.missionKill and"M"or"Z")..
ENV.sequence
return str
end
function pasteQuestArgs(str)
@@ -84,7 +84,7 @@ end
--[[
Count: 34~96
Block: 97~125
Encode: [A] or [AB] sequence, A = block ID, B = repeat times, no B means do not repeat.
Encode: A[B] sequence, A = block ID, B = repeat times, no B means do not repeat.
Example: "abcdefg" is [SZJLTOI], "a^aDb)" is [Z*63,Z*37,S*10]
]]
function copySequence()
@@ -424,7 +424,7 @@ function resumeGame()
end
function loadGame(M,ifQuickPlay)
STAT.lastPlay=M
CURMODE=Modes[M]
CURMODE=MODES[M]
drawableText.modeName:set(text.modes[M][1])
drawableText.levelName:set(text.modes[M][2])
needResetGameData=true
@@ -477,7 +477,7 @@ function resetGameData()
GAME.garbageSpeed=.3
end
STAT.game=STAT.game+1
freeRow.reset(30*#PLAYERS)
FREEROW.reset(30*#PLAYERS)
SFX.play("ready")
collectgarbage()
end

View File

@@ -130,7 +130,7 @@ do
local L=OspinList[i]
if D==L[1]then
local id,dir=L[2],L[3]
local bk=blocks[id][dir]
local bk=BLOCKS[id][dir]
x,y=P.curX+L[4],P.curY+L[5]
if not P:ifoverlap(bk,x,y)and(L[6]>0 or P:ifoverlap(bk,x-1,y)and P:ifoverlap(bk,x+1,y))and(L[6]==2 or P:ifoverlap(bk,x,y-1))and P:ifoverlap(bk,x,y+1)then
local C=P.cur

View File

@@ -179,12 +179,12 @@ for k,v in next,missionEnum do _[v]=k end
for k,v in next,_ do missionEnum[k]=v end
rankColor={
color.dRed, --D
color.dOrange, --C
color.lYellow, --B
color.lBlue, --A
color.lCyan, --S
color.lGreen, --Special
COLOR.dRed, --D
COLOR.dOrange, --C
COLOR.lYellow, --B
COLOR.lBlue, --A
COLOR.lCyan, --S
COLOR.lGreen, --Special
}
local function T(s,t)return love.graphics.newText(getFont(s),t)end

View File

@@ -190,7 +190,7 @@ local function Pupdate_alive(P,dt)
local C=P.AI_keys
P.AI_delay=P.AI_delay-1
if not C[1]then
P.AI_stage=AIfunc[P.AI_mode][P.AI_stage](P,C)
P.AI_stage=AIFUNC[P.AI_mode][P.AI_stage](P,C)
elseif P.AI_delay<=0 then
P:pressKey(C[1])P:releaseKey(C[1])
if P.AI_mode~="CC"or C[1]>3 then
@@ -403,13 +403,13 @@ end
--------------------------<Paint>--------------------------
local frameColor={
[0]=color.white,
color.lGreen,
color.lBlue,
color.lPurple,
color.lOrange,
[0]=COLOR.white,
COLOR.lGreen,
COLOR.lBlue,
COLOR.lPurple,
COLOR.lOrange,
}
--local function drawCell(y,x,id)gc.draw(blockSkin[id],30*x-30,-30*y)end
--local function drawCell(y,x,id)gc.draw(SKIN.curText[id],30*x-30,-30*y)end
local function drawGrid(P)
local FBN,FUP=P.fieldBeneath,P.fieldUp
gc.setLineWidth(1)
@@ -426,13 +426,14 @@ local function drawField(P)
local V,F=P.visTime,P.field
local start=int((P.fieldBeneath+P.fieldUp)/30+1)
local rep=GAME.replaying
local texture=SKIN.curText
if P.falling==-1 then--Blocks only
for j=start,min(start+21,#F)do
for i=1,10 do
if F[j][i]>0 then
if V[j][i]>0 then
gc.setColor(1,1,1,min(V[j][i]*.05,1))
gc.draw(blockSkin[F[j][i]],30*i-30,-30*j)-- drawCell(j,i,F[j][i])
gc.draw(texture[F[j][i]],30*i-30,-30*j)-- drawCell(j,i,F[j][i])
elseif rep then
gc.setColor(1,1,1,.3+.08*sin(.5*(j-i)+Timer()*4))
gc.rectangle("fill",30*i-30,-30*j,30,30)
@@ -457,7 +458,7 @@ local function drawField(P)
if F[j][i]>0 then
if V[j][i]>0 then
gc.setColor(1,1,1,min(V[j][i]*.05,1))
gc.draw(blockSkin[F[j][i]],30*i-30,-30*j)-- drawCell(j,i,F[j][i])
gc.draw(texture[F[j][i]],30*i-30,-30*j)-- drawCell(j,i,F[j][i])
elseif rep then
gc.setColor(1,1,1,.2)
gc.rectangle("fill",30*i-30,-30*j,30,30)
@@ -490,10 +491,11 @@ local function drawFXs(P)
end
--MoveFX
local texture=SKIN.curText
for i=1,#P.moveFX do
local S=P.moveFX[i]
gc.setColor(1,1,1,.6-S[4]*.6)
gc.draw(blockSkin[S[1]],30*S[2]-30,-30*S[3])-- drawCell(S[3],S[2],S[1])
gc.draw(texture[S[1]],30*S[2]-30,-30*S[3])-- drawCell(S[3],S[2],S[1])
end
--ClearFX
@@ -508,31 +510,34 @@ local function drawFXs(P)
end
local function drawGhost(P,clr)
gc.setColor(1,1,1,P.gameEnv.ghost)
local texture=SKIN.curText
for i=1,P.r do for j=1,P.c do
if P.cur.bk[i][j]then
gc.draw(blockSkin[clr],30*(j+P.curX-1)-30,-30*(i+P.imgY-1))-- drawCell(i+P.imgY-1,j+P.curX-1,clr)
gc.draw(texture[clr],30*(j+P.curX-1)-30,-30*(i+P.imgY-1))-- drawCell(i+P.imgY-1,j+P.curX-1,clr)
end
end end
end
local function drawBlockOutline(P,clr,trans)
local function drawBlockOutline(P,texture,trans)
SHADER.alpha:send("a",trans)
gc.setShader(SHADER.alpha)
local _=blockSkin[clr]
for i=1,P.r do for j=1,P.c do
if P.cur.bk[i][j]then
local x=30*(j+P.curX)-60-3
local y=30-30*(i+P.curY)-3
gc.draw(_,x,y)gc.draw(_,x+6,y+6)
gc.draw(_,x+6,y)gc.draw(_,x,y+6)
gc.draw(texture,x,y)
gc.draw(texture,x+6,y+6)
gc.draw(texture,x+6,y)
gc.draw(texture,x,y+6)
end
end end
gc.setShader()
end
local function drawBlock(P,clr)
gc.setColor(1,1,1)
local texture=SKIN.curText
for i=1,P.r do for j=1,P.c do
if P.cur.bk[i][j]then
gc.draw(blockSkin[clr],30*(j+P.curX-1)-30,-30*(i+P.curY-1))-- drawCell(i+P.curY-1,j+P.curX-1,clr)
gc.draw(texture[clr],30*(j+P.curX-1)-30,-30*(i+P.curY-1))-- drawCell(i+P.curY-1,j+P.curX-1,clr)
end
end end
end
@@ -548,20 +553,21 @@ local function drawNextPreview(P,B)
end
local function drawHold(P,clr)
local B=P.hd.bk
local texture=SKIN.curText
for i=1,#B do for j=1,#B[1]do
if B[i][j]then
gc.draw(blockSkin[clr],30*(j+2.06-#B[1]*.5)-30,-30*(i+1.36-#B*.5))-- drawCell(i+1.36-#B*.5,j+2.06-#B[1]*.5,clr)
gc.draw(texture[clr],30*(j+2.06-#B[1]*.5)-30,-30*(i+1.36-#B*.5))-- drawCell(i+1.36-#B*.5,j+2.06-#B[1]*.5,clr)
end
end end
end
local Pdraw_norm do
local attackColor={
{color.dGrey,color.white},
{color.grey,color.white},
{color.lPurple,color.white},
{color.lRed,color.white},
{color.dGreen,color.cyan},
{COLOR.dGrey,COLOR.white},
{COLOR.grey,COLOR.white},
{COLOR.lPurple,COLOR.white},
{COLOR.lRed,COLOR.white},
{COLOR.dGreen,COLOR.cyan},
}
local RCPB={10,33,200,33,105,5,105,60}
local function drawDial(x,y,speed)
@@ -634,7 +640,7 @@ local Pdraw_norm do
--Draw block
if ENV.block then
drawBlockOutline(P,curColor,trans)
drawBlockOutline(P,SKIN.curText[curColor],trans)
drawBlock(P,curColor)
end
@@ -702,7 +708,7 @@ local Pdraw_norm do
local a,b=P.b2b,P.b2b1 if a>b then a,b=b,a end
gc.setColor(.8,1,.2)
gc.rectangle("fill",-14,599,11,-b*.5)
gc.setColor(P.b2b<40 and color.white or P.b2b<=1e3 and color.lRed or color.lBlue)
gc.setColor(P.b2b<40 and COLOR.white or P.b2b<=1e3 and COLOR.lRed or COLOR.lBlue)
gc.rectangle("fill",-14,599,11,-a*.5)
gc.setColor(1,1,1)
if Timer()%.5<.3 then
@@ -743,11 +749,12 @@ local Pdraw_norm do
gc.setColor(1,1,1)gc.rectangle("line",316,36,124,N)
mText(drawableText.next,378,-15)
N=1
local texture=SKIN.curText
while N<=ENV.next and P.next[N]do
local bk,clr=P.next[N].bk,P.next[N].color
for i=1,#bk do for j=1,#bk[1] do
if bk[i][j]then
gc.draw(blockSkin[clr],30*(j+12.6-#bk[1]*.5)-30,-30*(i-2.4*N-#bk*.5))-- drawCell(i-2.4*N-#bk*.5,j+12.6-#bk[1]*.5,clr)
gc.draw(texture[clr],30*(j+12.6-#bk[1]*.5)-30,-30*(i-2.4*N-#bk*.5))-- drawCell(i-2.4*N-#bk*.5,j+12.6-#bk[1]*.5,clr)
end
end end
N=N+1
@@ -798,8 +805,8 @@ local Pdraw_norm do
gc.print(P.score1,18,579)
gc.print(format("%.2f",P.stat.time),18,609)
gc.setColor(color.lYellow)gc.print(P.score1,20,580)
gc.setColor(color.sky)gc.print(format("%.2f",P.stat.time),20,610)
gc.setColor(COLOR.lYellow)gc.print(P.score1,20,580)
gc.setColor(COLOR.sky)gc.print(format("%.2f",P.stat.time),20,610)
--FinesseCombo
if P.finesseCombo>2 then
@@ -902,9 +909,10 @@ local function Pdraw_small(P)
--Field
local F=P.field
local texture=SKIN.curTextMini
for j=1,#F do
for i=1,10 do if F[j][i]>0 then
gc.draw(blockSkinMini[F[j][i]],6*i-6,120-6*j)
gc.draw(texture[F[j][i]],6*i-6,120-6*j)
end end
end
@@ -968,7 +976,7 @@ local function Pdraw_demo(P)
if P.cur and P.waiting==-1 then
if ENV.ghost then drawGhost(P,curColor)end
if ENV.block then
drawBlockOutline(P,curColor,P.lockDelay/ENV.lock)
drawBlockOutline(P,SKIN.curText[curColor],P.lockDelay/ENV.lock)
drawBlock(P,curColor)
end
end
@@ -1264,8 +1272,6 @@ local prepareSequence do
if P.seqData[1]then
P:getNext(rem(P.seqData))
else
print(P.cur)
print(P.hd)
if not(P.cur or P.hd)then P:lose(true)end
return
end
@@ -1624,8 +1630,8 @@ function player.garbageRise(P,color,amount,pos)
local _
local t=P.showTime*2
for _=1,amount do
ins(P.field,1,freeRow.get(color,true))
ins(P.visTime,1,freeRow.get(t))
ins(P.field,1,FREEROW.get(color,true))
ins(P.visTime,1,FREEROW.get(t))
P.field[1][pos]=0
end
P.fieldBeneath=P.fieldBeneath+amount*30
@@ -1654,7 +1660,7 @@ function player.pushLine(P,L,mir)
local l=#L
local S=P.gameEnv.skin
for i=1,l do
local r=freeRow.get(0)
local r=FREEROW.get(0)
if not mir then
for j=1,10 do
r[j]=S[L[i][j]]or 0
@@ -1665,7 +1671,7 @@ function player.pushLine(P,L,mir)
end
end
ins(P.field,1,r)
ins(P.visTime,1,freeRow.get(20))
ins(P.visTime,1,FREEROW.get(20))
end
P.fieldBeneath=P.fieldBeneath+30*l
P.curY=P.curY+l
@@ -1791,7 +1797,7 @@ function player.lock(P)
local has_dest=dest~=nil
for i=1,P.r do
local y=P.curY+i-1
if not P.field[y]then P.field[y],P.visTime[y]=freeRow.get(0),freeRow.get(0)end
if not P.field[y]then P.field[y],P.visTime[y]=FREEROW.get(0),FREEROW.get(0)end
for j=1,P.c do
if P.cur.bk[i][j]then
P.field[y][P.curX+j-1]=P.cur.color
@@ -1867,7 +1873,7 @@ function player.spin(P,d,ifpre)
local iki=P.RS[P.cur.id]
if type(iki)=="table"then
local idir=(P.dir+d)%4
local icb=blocks[P.cur.id][idir]
local icb=BLOCKS[P.cur.id][idir]
local isc=scs[P.cur.id][idir]
local ir,ic=#icb,#icb[1]
local ix,iy=P.curX+P.sc[2]-isc[2],P.curY+P.sc[1]-isc[1]
@@ -1932,7 +1938,7 @@ function player.hold(P,ifpre)
if H then
local hid=P.hd.id
P.hd.bk=blocks[hid][P.gameEnv.face[hid]]
P.hd.bk=BLOCKS[hid][P.gameEnv.face[hid]]
end
if not C then
C=rem(P.next,1)
@@ -1968,7 +1974,7 @@ end
function player.getNext(P,n)
local E=P.gameEnv
ins(P.next,{bk=blocks[n][E.face[n]],id=n,color=E.bone and 17 or E.skin[n],name=n})
ins(P.next,{bk=BLOCKS[n][E.face[n]],id=n,color=E.bone and 17 or E.skin[n],name=n})
end
function player.popNext(P)--Pop next queue to hand
P.holded=false
@@ -2232,8 +2238,8 @@ do--player.drop(P)--Place piece
P.garbageBeneath=P.garbageBeneath-1
gbcc=gbcc+1
end
freeRow.discard(rem(P.field,_))
freeRow.discard(rem(P.visTime,_))
FREEROW.discard(rem(P.field,_))
FREEROW.discard(rem(P.visTime,_))
end
end
@@ -2603,10 +2609,10 @@ local function gameOver()--Save record
local P=PLAYERS[1]
R=R(P)--New rank
if R then
local r=modeRanks[M.name]--Old rank
local r=RANKS[M.name]--Old rank
local needSave
if R>r then
modeRanks[M.name]=R
RANKS[M.name]=R
needSave=true
end
if R>0 then
@@ -2614,9 +2620,9 @@ local function gameOver()--Save record
if M.unlock then
for i=1,#M.unlock do
local m=M.unlock[i]
local n=Modes[m].name
if not modeRanks[n]then
modeRanks[n]=Modes[m].score and 0 or 6
local n=MODES[m].name
if not RANKS[n]then
RANKS[n]=MODES[m].score and 0 or 6
needSave=true
end
end
@@ -2698,8 +2704,8 @@ function player.lose(P,force)
if P.life>0 and not force then
P.waiting=62
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
@@ -2948,7 +2954,7 @@ function player.act.restart()
if GAME.frame<240 or GAME.result then
resetPartGameData()
else
LOG.print(text.holdR,20,color.orange)
LOG.print(text.holdR,20,COLOR.orange)
end
end
function player.act.insLeft(P,auto)

View File

@@ -1,8 +1,6 @@
local gc=love.graphics
local kb=love.keyboard
local setFont=setFont
local find,sub,byte=string.find,string.sub,string.byte
function sceneInit.calculator()
@@ -87,9 +85,9 @@ function keyDown.calculator(k)
SFX.play("clear")
elseif v==72943816 then
S.pass=true
for name,M in next,Modes do
if not modeRanks[name]then
modeRanks[name]=M.score and 0 or 6
for name,M in next,MODES do
if not RANKS[name]then
RANKS[name]=M.score and 0 or 6
end
end
FILE.saveUnlock()

View File

@@ -2,7 +2,6 @@ local gc,sys=love.graphics,love.system
local kb=love.keyboard
local Timer=love.timer.getTime
local setFont=setFont
local int=math.floor
local find,sub=string.find,string.sub
@@ -43,7 +42,7 @@ function keyDown.customGame(key)
str=str.."!"..copyBoard().."!"
if #MISSION>0 then str=str..copyMission()end
sys.setClipboardText(str.."!")
LOG.print(text.copySuccess,color.green)
LOG.print(text.copySuccess,COLOR.green)
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
local str=sys.getClipboardText()
local p1,p2,p3,p4,p5--ptr*
@@ -71,10 +70,10 @@ function keyDown.customGame(key)
break
end
end
LOG.print(text.pasteSuccess,color.green)
LOG.print(text.pasteSuccess,COLOR.green)
return
end
LOG.print(text.dataCorrupted,color.red)
LOG.print(text.dataCorrupted,COLOR.red)
elseif key=="escape"then
SCN.back()
else
@@ -92,10 +91,11 @@ function Pnt.customGame()
gc.rectangle("line",-2,-2,304,604)
local F=FIELD[1]
local cross=puzzleMark[-1]
local texture=SKIN.curText
for y=1,20 do for x=1,10 do
local B=F[y][x]
if B>0 then
gc.draw(blockSkin[B],30*x-30,600-30*y)
gc.draw(texture[B],30*x-30,600-30*y)
elseif B==-1 then
gc.draw(cross,30*x-30,600-30*y)
end

View File

@@ -1,9 +1,6 @@
local gc,sys=love.graphics,love.system
local ms,kb=love.mouse,love.keyboard
local setFont=setFont
local mStr=mStr
local max,min,int=math.max,math.min,math.floor
local ins,rem=table.insert,table.remove
local sub=string.sub
@@ -118,15 +115,15 @@ function keyDown.custom_field(key)
end
elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then
sys.setClipboardText("Techmino Field:"..copyBoard(S.page))
LOG.print(text.copySuccess,color.green)
LOG.print(text.copySuccess,COLOR.green)
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
local str=sys.getClipboardText()
local p=string.find(str,":")--ptr*
if p then str=sub(str,p+1)end
if pasteBoard(str,S.page)then
LOG.print(text.pasteSuccess,color.green)
LOG.print(text.pasteSuccess,COLOR.green)
else
LOG.print(text.dataCorrupted,color.red)
LOG.print(text.dataCorrupted,COLOR.red)
end
elseif key=="tab"or key=="sTab"then
if key=="sTab"or kb.isDown("lshift","rshift")then
@@ -177,10 +174,11 @@ function Pnt.custom_field()
gc.setLineWidth(2)
local cross=puzzleMark[-1]
local F=FIELD[S.page]
local texture=SKIN.curText
for y=1,20 do for x=1,10 do
local B=F[y][x]
if B>0 then
gc.draw(blockSkin[B],30*x-30,600-30*y)
gc.draw(texture[B],30*x-30,600-30*y)
elseif B==-1 and not S.demo then
gc.draw(cross,30*x-30,600-30*y)
end
@@ -237,23 +235,23 @@ WIDGET.init("custom_field",{
WIDGET.newText({name="title", x=1020,y=5,font=70,align="R"}),
WIDGET.newText({name="subTitle", x=1030,y=50,font=35,align="L",color="grey"}),
WIDGET.newButton({name="b1", x=580, y=130,w=75,color={color.rainbow( 1.471)},code=setPen(1)}),--B1
WIDGET.newButton({name="b2", x=660, y=130,w=75,color={color.rainbow( 1.078)},code=setPen(2)}),--B2
WIDGET.newButton({name="b3", x=740, y=130,w=75,color={color.rainbow( 0.685)},code=setPen(3)}),--B3
WIDGET.newButton({name="b4", x=820, y=130,w=75,color={color.rainbow( 0.293)},code=setPen(4)}),--B4
WIDGET.newButton({name="b5", x=900, y=130,w=75,color={color.rainbow(-0.100)},code=setPen(5)}),--B5
WIDGET.newButton({name="b6", x=980, y=130,w=75,color={color.rainbow(-0.493)},code=setPen(6)}),--B6
WIDGET.newButton({name="b7", x=1060, y=130,w=75,color={color.rainbow(-0.885)},code=setPen(7)}),--B7
WIDGET.newButton({name="b8", x=1140, y=130,w=75,color={color.rainbow(-1.278)},code=setPen(8)}),--B8
WIDGET.newButton({name="b1", x=580, y=130,w=75,color={COLOR.rainbow( 1.471)},code=setPen(1)}),--B1
WIDGET.newButton({name="b2", x=660, y=130,w=75,color={COLOR.rainbow( 1.078)},code=setPen(2)}),--B2
WIDGET.newButton({name="b3", x=740, y=130,w=75,color={COLOR.rainbow( 0.685)},code=setPen(3)}),--B3
WIDGET.newButton({name="b4", x=820, y=130,w=75,color={COLOR.rainbow( 0.293)},code=setPen(4)}),--B4
WIDGET.newButton({name="b5", x=900, y=130,w=75,color={COLOR.rainbow(-0.100)},code=setPen(5)}),--B5
WIDGET.newButton({name="b6", x=980, y=130,w=75,color={COLOR.rainbow(-0.493)},code=setPen(6)}),--B6
WIDGET.newButton({name="b7", x=1060, y=130,w=75,color={COLOR.rainbow(-0.885)},code=setPen(7)}),--B7
WIDGET.newButton({name="b8", x=1140, y=130,w=75,color={COLOR.rainbow(-1.278)},code=setPen(8)}),--B8
WIDGET.newButton({name="b9", x=580, y=210,w=75,color={color.rainbow(-1.671)},code=setPen(9)}),--B9
WIDGET.newButton({name="b10", x=660, y=210,w=75,color={color.rainbow(-2.063)},code=setPen(10)}),--B10
WIDGET.newButton({name="b11", x=740, y=210,w=75,color={color.rainbow(-2.456)},code=setPen(11)}),--B11
WIDGET.newButton({name="b12", x=820, y=210,w=75,color={color.rainbow(-2.849)},code=setPen(12)}),--B12
WIDGET.newButton({name="b13", x=900, y=210,w=75,color={color.rainbow(-3.242)},code=setPen(13)}),--B13
WIDGET.newButton({name="b14", x=980, y=210,w=75,color={color.rainbow(-3.634)},code=setPen(14)}),--B14
WIDGET.newButton({name="b15", x=1060, y=210,w=75,color={color.rainbow(-4.027)},code=setPen(15)}),--B15
WIDGET.newButton({name="b16", x=1140, y=210,w=75,color={color.rainbow(-4.412)},code=setPen(16)}),--B16
WIDGET.newButton({name="b9", x=580, y=210,w=75,color={COLOR.rainbow(-1.671)},code=setPen(9)}),--B9
WIDGET.newButton({name="b10", x=660, y=210,w=75,color={COLOR.rainbow(-2.063)},code=setPen(10)}),--B10
WIDGET.newButton({name="b11", x=740, y=210,w=75,color={COLOR.rainbow(-2.456)},code=setPen(11)}),--B11
WIDGET.newButton({name="b12", x=820, y=210,w=75,color={COLOR.rainbow(-2.849)},code=setPen(12)}),--B12
WIDGET.newButton({name="b13", x=900, y=210,w=75,color={COLOR.rainbow(-3.242)},code=setPen(13)}),--B13
WIDGET.newButton({name="b14", x=980, y=210,w=75,color={COLOR.rainbow(-3.634)},code=setPen(14)}),--B14
WIDGET.newButton({name="b15", x=1060, y=210,w=75,color={COLOR.rainbow(-4.027)},code=setPen(15)}),--B15
WIDGET.newButton({name="b16", x=1140, y=210,w=75,color={COLOR.rainbow(-4.412)},code=setPen(16)}),--B16
WIDGET.newButton({name="b17", x=580, y=290,w=75,color="dGrey", code=setPen(17)}),--BONE
WIDGET.newButton({name="b18", x=660, y=290,w=75,color="black", code=setPen(18)}),--HIDE

View File

@@ -2,7 +2,6 @@ local gc,sys=love.graphics,love.system
local kb=love.keyboard
local Timer=love.timer.getTime
local setFont=setFont
local int,sin=math.floor,math.sin
local ins,rem=table.insert,table.remove
local sub=string.sub
@@ -73,16 +72,16 @@ function keyDown.custom_mission(key)
elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then
if #MISSION>0 then
sys.setClipboardText("Techmino Target:"..copyMission())
LOG.print(text.copySuccess,color.green)
LOG.print(text.copySuccess,COLOR.green)
end
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
local str=sys.getClipboardText()
local p=string.find(str,":")--ptr*
if p then str=sub(str,p+1)end
if pasteMission(str)then
LOG.print(text.pasteSuccess,color.green)
LOG.print(text.pasteSuccess,COLOR.green)
else
LOG.print(text.dataCorrupted,color.red)
LOG.print(text.dataCorrupted,COLOR.red)
end
elseif key=="escape"then
SCN.back()
@@ -161,9 +160,9 @@ function Pnt.custom_mission()
if N>0 then
gc.setColor(libColor[set[N]])
elseif L[i]>4 then
gc.setColor(color.rainbow(i+Timer()*6.26))
gc.setColor(COLOR.rainbow(i+Timer()*6.26))
else
gc.setColor(color.grey)
gc.setColor(COLOR.grey)
end
gc.print(missionEnum[L[i]],x,y-25)
x=x+56

View File

@@ -2,8 +2,6 @@ local gc,sys=love.graphics,love.system
local kb=love.keyboard
local Timer=love.timer.getTime
local setFont=setFont
local sin=math.sin
local ins,rem=table.insert,table.remove
local sub=string.sub
@@ -76,16 +74,16 @@ function keyDown.custom_sequence(key)
elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then
if #BAG>0 then
sys.setClipboardText("Techmino SEQ:"..copySequence())
LOG.print(text.copySuccess,color.green)
LOG.print(text.copySuccess,COLOR.green)
end
elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then
local str=sys.getClipboardText()
local p=string.find(str,":")--ptr*
if p then str=sub(str,p+1)end
if pasteSequence(str)then
LOG.print(text.pasteSuccess,color.green)
LOG.print(text.pasteSuccess,COLOR.green)
else
LOG.print(text.dataCorrupted,color.red)
LOG.print(text.dataCorrupted,COLOR.red)
end
elseif key=="escape"then
SCN.back()

View File

@@ -1,7 +1,6 @@
local gc=love.graphics
local Timer=love.timer.getTime
local setFont=setFont
local int,abs=math.floor,math.abs
local min,sin=math.min,math.sin
local ins,rem=table.insert,table.remove
@@ -115,12 +114,12 @@ function Tmr.dict(dt)
end
local typeColor={
help=color.lGrey,
other=color.lOrange,
game=color.lCyan,
term=color.lRed,
english=color.green,
name=color.lPurple,
help=COLOR.lGrey,
other=COLOR.lOrange,
game=COLOR.lCyan,
term=COLOR.lRed,
english=COLOR.green,
name=COLOR.lPurple,
}
function Pnt.dict()
local S=sceneTemp
@@ -171,7 +170,7 @@ function Pnt.dict()
local r=Timer()*2
local R=int(r)%7+1
gc.setColor(1,1,1,1-abs(r%1*2-1))
gc.draw(TEXTURE.miniBlock[R],785,140,Timer()*10%6.2832,15,15,spinCenters[R][0][2]+.5,#blocks[R][0]-spinCenters[R][0][1]-.5)
gc.draw(TEXTURE.miniBlock[R],785,140,Timer()*10%6.2832,15,15,spinCenters[R][0][2]+.5,#BLOCKS[R][0]-spinCenters[R][0][1]-.5)
end
end

View File

@@ -1,8 +1,6 @@
local gc=love.graphics
local Timer=love.timer.getTime
local setFont=setFont
local mStr=mStr
local sin=math.sin
function sceneInit.help()

View File

@@ -1,5 +1,4 @@
local gc=love.graphics
local setFont=setFont
local max,min=math.max,math.min
local floatWheel=0

View File

@@ -23,11 +23,11 @@ function mouseDown.intro(_,_,k)
VOC.play("bye")
SCN.back()
elseif NOGAME=="delSetting"then
LOG.print("检测到过老版本非法设置数据,设置已经全部重置,请重启游戏完成",600,color.yellow)
LOG.print("Old version detected, setting file deleted, please restart the game",600,color.yellow)
LOG.print("检测到过老版本非法设置数据,设置已经全部重置,请重启游戏完成",600,COLOR.yellow)
LOG.print("Old version detected, setting file deleted, please restart the game",600,COLOR.yellow)
elseif NOGAME=="delCC"then
LOG.print("请关闭游戏,然后删除存档文件夹内的 CCloader.dll(21KB) !",600,color.yellow)
LOG.print("Please quit the game, then delete CCloader.dll(21KB) in saving folder!",600,color.yellow)
LOG.print("请关闭游戏,然后删除存档文件夹内的 CCloader.dll(21KB) !",600,COLOR.yellow)
LOG.print("Please quit the game, then delete CCloader.dll(21KB) in saving folder!",600,COLOR.yellow)
TASK.new(function(S)
S[1]=S[1]-1
if S[1]==0 then
@@ -39,7 +39,7 @@ function mouseDown.intro(_,_,k)
if newVersionLaunch then
SCN.push("main","fade")
SCN.swapTo("history","fade")
LOG.print(text.newVersion,"warn",color.lBlue)
LOG.print(text.newVersion,"warn",COLOR.lBlue)
else
SCN.go("main")
end

View File

@@ -2,7 +2,6 @@ local gc=love.graphics
local tc=love.touch
local Timer=love.timer.getTime
local setFont=setFont
local max,min,sin=math.max,math.min,math.sin
function sceneInit.load()
@@ -18,7 +17,7 @@ function sceneInit.load()
IMG.getCount(),
17,--Fontsize 20~100
SKIN.getCount(),
#Modes,
#MODES,
1,
1,
},
@@ -65,19 +64,19 @@ function Tmr.load()
elseif S.phase==6 then
SKIN.loadOne(S.cur)
elseif S.phase==7 then
local m=Modes[S.cur]--Mode template
local m=MODES[S.cur]--Mode template
local M=require("modes/"..m.name)--Mode file
Modes[m.name],Modes[S.cur]=M
MODES[m.name],MODES[S.cur]=M
for k,v in next,m do
M[k]=v
end
M.records=FILE.loadRecord(m.name)or M.score and{}
if M.score then
if modeRanks[M.name]==6 then
modeRanks[M.name]=0
if RANKS[M.name]==6 then
RANKS[M.name]=0
end
else
modeRanks[M.name]=6
RANKS[M.name]=6
end
-- M.icon=gc.newImage("image/modeIcon/"..m.icon..".png")
-- M.icon=gc.newImage("image/modeIcon/custom.png")
@@ -153,15 +152,15 @@ function Pnt.load()
gc.rectangle("fill",0,0,440,260)
local T=Timer()
gc.setColor(color.dCyan)
gc.setColor(COLOR.dCyan)
mDraw(S.text,220,Y*.2-1204)
mDraw(S.text,220,-Y*.2+1476)
gc.setColor(color.cyan)
gc.setColor(COLOR.cyan)
mDraw(S.text,220+4*sin(T*10),136+4*sin(T*6))
mDraw(S.text,220+4*sin(T*12),136+4*sin(T*8))
gc.setColor(color.dCyan)
gc.setColor(COLOR.dCyan)
mDraw(S.text,219,137)
mDraw(S.text,219,135)
mDraw(S.text,221,137)
@@ -177,7 +176,7 @@ function Pnt.load()
setFont(50)
for i=1,27 do
if i<26 then
local r,g,b=color.rainbow(i+3.5)
local r,g,b=COLOR.rainbow(i+3.5)
gc.setColor(r*.26,g*.26,b*.26)
gc.rectangle("fill",-220,Y-260*i-80,440,260)
gc.setColor(r*1.6,g*1.6,b*1.6)

View File

@@ -1,5 +1,4 @@
local gc=love.graphics
local setFont=setFont
function sceneInit.main()
sceneTemp={
@@ -37,7 +36,7 @@ end
WIDGET.init("main",{
WIDGET.newButton({name="play", x=150,y=220,w=200,h=140,color="lRed", font=55,code=WIDGET.lnk.goScene("mode")}),
WIDGET.newButton({name="setting", x=370,y=220,w=200,h=140,color="sky", font=45,code=WIDGET.lnk.goScene("setting_game")}),
WIDGET.newButton({name="custom", x=590,y=220,w=200,h=140,color="lPurple",font=45,code=WIDGET.lnk.goScene("customGame"),hide=function()return not modeRanks.marathon_normal end}),
WIDGET.newButton({name="custom", x=590,y=220,w=200,h=140,color="lPurple",font=45,code=WIDGET.lnk.goScene("customGame"),hide=function()return not RANKS.marathon_normal end}),
WIDGET.newButton({name="help", x=150,y=380,w=200,h=140,color="lYellow",font=50,code=WIDGET.lnk.goScene("help")}),
WIDGET.newButton({name="stat", x=370,y=380,w=200,h=140,color="lGreen", font=40,code=WIDGET.lnk.goScene("stat")}),
WIDGET.newButton({name="qplay", x=590,y=380,w=200,h=140,color="white", font=45,code=function()SCN.push()loadGame(STAT.lastPlay,true)end}),

View File

@@ -2,9 +2,6 @@ local gc=love.graphics
local ms,kb,tc=love.mouse,love.keyboard,love.touch
local Timer=love.timer.getTime
local setFont=setFont
local mStr=mStr
local int,abs=math.floor,math.abs
local sin=math.sin
@@ -30,7 +27,7 @@ function sceneInit.mode(org)
local cam=mapCam
cam.zoomK=org=="main"and 5 or 1
if cam.sel then
local M=Modes[cam.sel]
local M=MODES[cam.sel]
cam.x,cam.y=M.x*cam.k+180,M.y*cam.k
cam.x1,cam.y1=cam.x,cam.y
end
@@ -40,8 +37,8 @@ local function onMode(x,y)
local cam=mapCam
x=(cam.x1-640+x)/cam.k1
y=(cam.y1-360+y)/cam.k1
for name,M in next,Modes do
if modeRanks[name]then
for name,M in next,MODES do
if RANKS[name]then
local s=M.size
if M.shape==1 then
if x>M.x-s and x<M.x+s and y>M.y-s and y<M.y+s then return name end
@@ -85,7 +82,7 @@ function mouseClick.mode(x,y)
if _~=SEL then
if SEL then
cam.moving=true
_=Modes[SEL]
_=MODES[SEL]
cam.x=_.x*cam.k+180
cam.y=_.y*cam.k
cam.sel=SEL
@@ -165,8 +162,8 @@ function Tmr.mode()
cam.keyCtrl=true
end
local x1,y1=(cam.x1-180)/cam.k1,cam.y1/cam.k1
for name,M in next,Modes do
if modeRanks[name]then
for name,M in next,MODES do
if RANKS[name]then
local SEL
local s=M.size
if M.shape==1 then
@@ -200,7 +197,7 @@ function Tmr.mode()
cam.zoomMethod=_=="play"and 1 or _=="mode"and 2
if cam.zoomMethod==1 then
if cam.sel then
local M=Modes[cam.sel]
local M=MODES[cam.sel]
cam.x=cam.x*.8+M.x*cam.k*.2
cam.y=cam.y*.8+M.y*cam.k*.2
end
@@ -221,23 +218,23 @@ function Pnt.mode()
gc.scale(cam.zoomK)
gc.translate(-cam.x1,-cam.y1)
gc.scale(cam.k1)
local R=modeRanks
local R=RANKS
local sel=cam.sel
--Draw lines connecting modes
gc.setLineWidth(8)
gc.setColor(1,1,1,.2)
for name,M in next,Modes do
for name,M in next,MODES do
if R[name]and M.unlock then
for _=1,#M.unlock do
local m=Modes[M.unlock[_]]
local m=MODES[M.unlock[_]]
gc.line(M.x,M.y,m.x,m.y)
end
end
end
setFont(60)
for name,M in next,Modes do
for name,M in next,MODES do
if R[name]then
local S=M.size
local d=((M.x-(cam.x1+(sel and -180 or 0))/cam.k1)^2+(M.y-cam.y1/cam.k1)^2)^.55
@@ -295,7 +292,7 @@ function Pnt.mode()
end
gc.pop()
if sel then
local M=Modes[sel]
local M=MODES[sel]
gc.setColor(.7,.7,.7,.5)
gc.rectangle("fill",920,0,360,720)--Info board
gc.setColor(M.color)

View File

@@ -1,8 +1,6 @@
local gc=love.graphics
local Timer=love.timer.getTime
local setFont=setFont
local sin=math.sin
local floatWheel=0

View File

@@ -1,7 +1,6 @@
local gc=love.graphics
local Timer=love.timer.getTime
local setFont=setFont
local mStr=mStr
local int=math.floor
@@ -114,16 +113,16 @@ local function tapBoard(x,y,key)
if checkBoard(b)then
S.state=2
S.time=Timer()-S.startTime
if S.time<1 then LOG.print("不是人",color.lBlue)
elseif S.time<2 then LOG.print("还是人",color.lBlue)
elseif S.time<3 then LOG.print("神仙",color.lBlue)
elseif S.time<5 then LOG.print("太强了",color.lBlue)
elseif S.time<7.5 then LOG.print("很强",color.lBlue)
elseif S.time<10 then LOG.print("可以的",color.lBlue)
elseif S.time<20 then LOG.print("马上入门了",color.lBlue)
elseif S.time<30 then LOG.print("入门不远了",color.lBlue)
elseif S.time<60 then LOG.print("多加练习",color.lBlue)
else LOG.print("第一次玩?加油",color.lBlue)
if S.time<1 then LOG.print("不是人",COLOR.lBlue)
elseif S.time<2 then LOG.print("还是人",COLOR.lBlue)
elseif S.time<3 then LOG.print("神仙",COLOR.lBlue)
elseif S.time<5 then LOG.print("太强了",COLOR.lBlue)
elseif S.time<7.5 then LOG.print("很强",COLOR.lBlue)
elseif S.time<10 then LOG.print("可以的",COLOR.lBlue)
elseif S.time<20 then LOG.print("马上入门了",COLOR.lBlue)
elseif S.time<30 then LOG.print("入门不远了",COLOR.lBlue)
elseif S.time<60 then LOG.print("多加练习",COLOR.lBlue)
else LOG.print("第一次玩?加油",COLOR.lBlue)
end
SFX.play("win")
end
@@ -200,66 +199,66 @@ end
local frontColor={
[0]={
color.lRed,color.lRed,color.lRed,color.lRed,
color.lGreen,color.lBlue,color.lBlue,color.lBlue,
color.lGreen,color.lYellow,color.lPurple,color.lPurple,
color.lGreen,color.lYellow,color.lPurple,color.lPurple,
COLOR.lRed,COLOR.lRed,COLOR.lRed,COLOR.lRed,
COLOR.lGreen,COLOR.lBlue,COLOR.lBlue,COLOR.lBlue,
COLOR.lGreen,COLOR.lYellow,COLOR.lPurple,COLOR.lPurple,
COLOR.lGreen,COLOR.lYellow,COLOR.lPurple,COLOR.lPurple,
},--Colored(rank)
{
color.lRed,color.lRed,color.lRed,color.lRed,
color.lOrange,color.lYellow,color.lYellow,color.lYellow,
color.lOrange,color.lGreen,color.lBlue,color.lBlue,
color.lOrange,color.lGreen,color.lBlue,color.lBlue,
COLOR.lRed,COLOR.lRed,COLOR.lRed,COLOR.lRed,
COLOR.lOrange,COLOR.lYellow,COLOR.lYellow,COLOR.lYellow,
COLOR.lOrange,COLOR.lGreen,COLOR.lBlue,COLOR.lBlue,
COLOR.lOrange,COLOR.lGreen,COLOR.lBlue,COLOR.lBlue,
},--Rainbow(rank)
{
color.lRed,color.lRed,color.lRed,color.lRed,
color.lBlue,color.lBlue,color.lBlue,color.lBlue,
color.lGreen,color.lYellow,color.lPurple,color.lPurple,
color.lGreen,color.lYellow,color.lPurple,color.lPurple,
COLOR.lRed,COLOR.lRed,COLOR.lRed,COLOR.lRed,
COLOR.lBlue,COLOR.lBlue,COLOR.lBlue,COLOR.lBlue,
COLOR.lGreen,COLOR.lYellow,COLOR.lPurple,COLOR.lPurple,
COLOR.lGreen,COLOR.lYellow,COLOR.lPurple,COLOR.lPurple,
},--Colored(row)
{
color.white,color.white,color.white,color.white,
color.white,color.white,color.white,color.white,
color.white,color.white,color.white,color.white,
color.white,color.white,color.white,color.white,
COLOR.white,COLOR.white,COLOR.white,COLOR.white,
COLOR.white,COLOR.white,COLOR.white,COLOR.white,
COLOR.white,COLOR.white,COLOR.white,COLOR.white,
COLOR.white,COLOR.white,COLOR.white,COLOR.white,
},--Grey
{
color.white,color.white,color.white,color.white,
color.white,color.white,color.white,color.white,
color.white,color.white,color.white,color.white,
color.white,color.white,color.white,color.white,
COLOR.white,COLOR.white,COLOR.white,COLOR.white,
COLOR.white,COLOR.white,COLOR.white,COLOR.white,
COLOR.white,COLOR.white,COLOR.white,COLOR.white,
COLOR.white,COLOR.white,COLOR.white,COLOR.white,
},--Black
}
local backColor={
[0]={
color.dRed,color.dRed,color.dRed,color.dRed,
color.dGreen,color.dBlue,color.dBlue,color.dBlue,
color.dGreen,color.dYellow,color.dPurple,color.dPurple,
color.dGreen,color.dYellow,color.dPurple,color.dPurple,
COLOR.dRed,COLOR.dRed,COLOR.dRed,COLOR.dRed,
COLOR.dGreen,COLOR.dBlue,COLOR.dBlue,COLOR.dBlue,
COLOR.dGreen,COLOR.dYellow,COLOR.dPurple,COLOR.dPurple,
COLOR.dGreen,COLOR.dYellow,COLOR.dPurple,COLOR.dPurple,
},--Colored(rank)
{
color.dRed,color.dRed,color.dRed,color.dRed,
color.dOrange,color.dYellow,color.dYellow,color.dYellow,
color.dOrange,color.dGreen,color.dBlue,color.dBlue,
color.dOrange,color.dGreen,color.dBlue,color.dBlue,
COLOR.dRed,COLOR.dRed,COLOR.dRed,COLOR.dRed,
COLOR.dOrange,COLOR.dYellow,COLOR.dYellow,COLOR.dYellow,
COLOR.dOrange,COLOR.dGreen,COLOR.dBlue,COLOR.dBlue,
COLOR.dOrange,COLOR.dGreen,COLOR.dBlue,COLOR.dBlue,
},--Rainbow(rank)
{
color.dRed,color.dRed,color.dRed,color.dRed,
color.dBlue,color.dBlue,color.dBlue,color.dBlue,
color.dGreen,color.dYellow,color.dPurple,color.dPurple,
color.dGreen,color.dYellow,color.dPurple,color.dPurple,
COLOR.dRed,COLOR.dRed,COLOR.dRed,COLOR.dRed,
COLOR.dBlue,COLOR.dBlue,COLOR.dBlue,COLOR.dBlue,
COLOR.dGreen,COLOR.dYellow,COLOR.dPurple,COLOR.dPurple,
COLOR.dGreen,COLOR.dYellow,COLOR.dPurple,COLOR.dPurple,
},--Colored(row)
{
color.dGrey,color.dGrey,color.dGrey,color.dGrey,
color.dGrey,color.dGrey,color.dGrey,color.dGrey,
color.dGrey,color.dGrey,color.dGrey,color.dGrey,
color.dGrey,color.dGrey,color.dGrey,color.dGrey,
COLOR.dGrey,COLOR.dGrey,COLOR.dGrey,COLOR.dGrey,
COLOR.dGrey,COLOR.dGrey,COLOR.dGrey,COLOR.dGrey,
COLOR.dGrey,COLOR.dGrey,COLOR.dGrey,COLOR.dGrey,
COLOR.dGrey,COLOR.dGrey,COLOR.dGrey,COLOR.dGrey,
},--Grey
{
color.black,color.black,color.black,color.black,
color.black,color.black,color.black,color.black,
color.black,color.black,color.black,color.black,
color.black,color.black,color.black,color.black,
COLOR.black,COLOR.black,COLOR.black,COLOR.black,
COLOR.black,COLOR.black,COLOR.black,COLOR.black,
COLOR.black,COLOR.black,COLOR.black,COLOR.black,
COLOR.black,COLOR.black,COLOR.black,COLOR.black,
},--Black
}
function Pnt.p15()

View File

@@ -4,21 +4,20 @@ local Timer=love.timer.getTime
local setFont=setFont
local mStr=mStr
local sin=math.sin
local log=math.log
local sin,log=math.sin,math.log
local format=string.format
local SCR=SCR
local fnsRankColor={
Z=color.lYellow,
S=color.lGrey,
A=color.sky,
B=color.lGreen,
C=color.magenta,
D=color.dGreen,
E=color.red,
F=color.dRed,
Z=COLOR.lYellow,
S=COLOR.lGrey,
A=COLOR.sky,
B=COLOR.lGreen,
C=COLOR.magenta,
D=COLOR.dGreen,
E=COLOR.red,
F=COLOR.dRed,
}
function sceneInit.pause(org)
if
@@ -106,10 +105,10 @@ function sceneInit.pause(org)
S.fnsRankColor=fnsRankColor[S.rank]
if acc==1 then
S.trophy=text.finesse_ap
S.trophyColor=color.yellow
S.trophyColor=COLOR.yellow
elseif P.stat.maxFinesseCombo==P.stat.piece then
S.trophy=text.finesse_fc
S.trophyColor=color.lCyan
S.trophyColor=COLOR.lCyan
end
end
end

View File

@@ -2,9 +2,6 @@ local gc=love.graphics
local tc=love.touch
local Timer=love.timer.getTime
local setFont=setFont
local mStr=mStr
local max,sin=math.max,math.sin
local log=math.log

View File

@@ -1,9 +1,6 @@
local gc=love.graphics
local kb=love.keyboard
local setFont=setFont
local mStr=mStr
local abs=math.abs
local max,min=math.max,math.min
local rnd=math.random

View File

@@ -66,13 +66,13 @@ function Pnt.setting_control()
gc.line(550,530,550,630)
gc.line(950,530,950,630)
--Testing O mino
_=blockSkin[SETTING.skin[6]]
--O mino animation
local O=SKIN.curText[SETTING.skin[6]]
local x=550+40*sceneTemp.pos
gc.draw(_,x,540,nil,40/30)
gc.draw(_,x,580,nil,40/30)
gc.draw(_,x+40,540,nil,40/30)
gc.draw(_,x+40,580,nil,40/30)
gc.draw(O,x,540,nil,40/30)
gc.draw(O,x,580,nil,40/30)
gc.draw(O,x+40,540,nil,40/30)
gc.draw(O,x+40,580,nil,40/30)
end
local function sliderShow(S)

View File

@@ -12,7 +12,7 @@ end
function Pnt.setting_game()
gc.setColor(1,1,1)
gc.draw(blockSkin[int(Timer()*2)%16+1],590,540,Timer()%6.28319,2,nil,15,15)
gc.draw(SKIN.curText[int(Timer()*2)%16+1],590,540,Timer()%6.28319,2,nil,15,15)
end
WIDGET.init("setting_game",{

View File

@@ -1,7 +1,6 @@
local gc=love.graphics
local Timer=love.timer.getTime
local setFont=setFont
local mStr=mStr
local int,sin=math.floor,math.sin

View File

@@ -4,21 +4,22 @@ local sin=math.sin
function Pnt.setting_skin()
gc.setColor(1,1,1)
local texture=SKIN.curText
for N=1,7 do
local face=SETTING.face[N]
local B=blocks[N][face]
local B=BLOCKS[N][face]
local x,y=-55+140*N-spinCenters[N][face][2]*30,355+spinCenters[N][face][1]*30
local col=#B[1]
for i=1,#B do for j=1,col do
if B[i][j]then
gc.draw(blockSkin[SETTING.skin[N]],x+30*j,y-30*i)
gc.draw(texture[SETTING.skin[N]],x+30*j,y-30*i)
end
end end
gc.circle("fill",-10+140*N,340,sin(Timer()*10)+5)
end
gc.draw(blockSkin[17],930,610,nil,2)
gc.draw(texture[17],930,610,nil,2)
for i=1,5 do
gc.draw(blockSkin[19+i],570+60*i,610,nil,2)
gc.draw(texture[19+i],570+60*i,610,nil,2)
end
end

View File

@@ -1,9 +1,6 @@
local gc=love.graphics
local kb,tc=love.keyboard,love.touch
local setFont=setFont
local mStr=mStr
function sceneInit.staff()
sceneTemp={
time=0,

View File

@@ -1,7 +1,6 @@
local gc=love.graphics
local Timer=love.timer.getTime
local setFont=setFont
local mStr=mStr
local abs,int,sin=math.abs,math.floor,math.sin
@@ -89,8 +88,8 @@ function Pnt.stat()
local r=Timer()*2
local R=int(r)%7+1
gc.setColor(1,1,1,1-abs(r%1*2-1))
gc.draw(TEXTURE.miniBlock[R],650,50,Timer()*10%6.2832,15,15,spinCenters[R][0][2]+.5,#blocks[R][0]-spinCenters[R][0][1]-.5)
gc.draw(TEXTURE.miniBlock[R],650,300,0,15,15,spinCenters[R][0][2]+.5,#blocks[R][0]-spinCenters[R][0][1]-.5)
gc.draw(TEXTURE.miniBlock[R],650,50,Timer()*10%6.2832,15,15,spinCenters[R][0][2]+.5,#BLOCKS[R][0]-spinCenters[R][0][1]-.5)
gc.draw(TEXTURE.miniBlock[R],650,300,0,15,15,spinCenters[R][0][2]+.5,#BLOCKS[R][0]-spinCenters[R][0][1]-.5)
end
WIDGET.init("stat",{

View File

@@ -33,30 +33,30 @@ local SKIN={}
SKIN.lib={}
SKIN.libMini={}
SKIN.libColor={
{color.rainbow( 1.471)},
{color.rainbow( 1.078)},
{color.rainbow( 0.685)},
{color.rainbow( 0.293)},
{color.rainbow(-0.100)},
{color.rainbow(-0.493)},
{color.rainbow(-0.885)},
{color.rainbow(-1.278)},
{color.rainbow(-1.671)},
{color.rainbow(-2.063)},
{color.rainbow(-2.456)},
{color.rainbow(-2.849)},
{color.rainbow(-3.242)},
{color.rainbow(-3.634)},
{color.rainbow(-4.027)},
{color.rainbow(-4.412)},
color.dGrey,
color.black,
color.lYellow,
color.grey,
color.lGrey,
color.dPurple,
color.dRed,
color.dGreen,
{COLOR.rainbow( 1.471)},
{COLOR.rainbow( 1.078)},
{COLOR.rainbow( 0.685)},
{COLOR.rainbow( 0.293)},
{COLOR.rainbow(-0.100)},
{COLOR.rainbow(-0.493)},
{COLOR.rainbow(-0.885)},
{COLOR.rainbow(-1.278)},
{COLOR.rainbow(-1.671)},
{COLOR.rainbow(-2.063)},
{COLOR.rainbow(-2.456)},
{COLOR.rainbow(-2.849)},
{COLOR.rainbow(-3.242)},
{COLOR.rainbow(-3.634)},
{COLOR.rainbow(-4.027)},
{COLOR.rainbow(-4.412)},
COLOR.dGrey,
COLOR.black,
COLOR.lYellow,
COLOR.grey,
COLOR.lGrey,
COLOR.dPurple,
COLOR.dRed,
COLOR.dGreen,
}
function SKIN.getCount()
return count
@@ -120,7 +120,7 @@ function SKIN.rotate(i)--Change direction of [i]
SFX.play("rotate")
end
function SKIN.change(i)--Change to skin_set[i]
blockSkin=SKIN.lib[i]
blockSkinMini=SKIN.libMini[i]
SKIN.curText=SKIN.lib[i]
SKIN.curTextMini=SKIN.libMini[i]
end
return SKIN

View File

@@ -18,7 +18,7 @@ end
TEXTURE.miniBlock={}
for i=1,25 do
local b=blocks[i][0]
local b=BLOCKS[i][0]
TEXTURE.miniBlock[i]=C(#b[1],#b)
for y=1,#b do for x=1,#b[1]do
if b[y][x]then

View File

@@ -27,8 +27,8 @@ function Tick.lose(P)
end
if P.endCounter==120 then
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
return true
@@ -80,9 +80,9 @@ function Tick.httpREQ_launch(data)
if res.code==200 then
err,res=json.decode(res.body)
if res then
LOG.print(res.notice,360,color.sky)
LOG.print(res.notice,360,COLOR.sky)
if gameVersion==res.version then
LOG.print(text.versionIsNew,360,color.sky)
LOG.print(text.versionIsNew,360,COLOR.sky)
else
LOG.print(string.gsub(text.versionIsOld,"$1",res.version),"warn")
end