[change file directory]
This commit is contained in:
303
parts/bg.lua
303
parts/bg.lua
@@ -1,303 +0,0 @@
|
||||
local gc=love.graphics
|
||||
local int,ceil,rnd,abs=math.floor,math.ceil,math.random,math.abs
|
||||
local max,min,sin,cos=math.max,math.min,math.sin,math.cos
|
||||
|
||||
local BG
|
||||
local scr=scr
|
||||
local BGvars={_G=_G,SHADER=SHADER}
|
||||
|
||||
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=0
|
||||
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=0
|
||||
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.strap={
|
||||
init=function()
|
||||
t=0
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
end,
|
||||
draw=function()
|
||||
SHADER.strap:send("t",t*.626)
|
||||
gc.setColor(.4,.626,.626)
|
||||
gc.setShader(SHADER.strap)
|
||||
gc.rectangle("fill",0,0,scr.w,scr.h)
|
||||
gc.setShader()
|
||||
end,
|
||||
}--Horizonal ranbow
|
||||
back.flink={
|
||||
init=function()
|
||||
t=0
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
end,
|
||||
draw=function()
|
||||
local t=.13-t%3%1.7
|
||||
if t<.2 then gc.clear(t,t,t)
|
||||
else gc.clear(0,0,0)
|
||||
end
|
||||
end,
|
||||
}--flash after random time
|
||||
back.aura={
|
||||
init=function()
|
||||
t=rnd()*3600
|
||||
BG.resize(scr.w,scr.h)
|
||||
end,
|
||||
resize=function(w,h)
|
||||
SHADER.aura:send("w",w*scr.dpi)
|
||||
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.game1={
|
||||
init=function()
|
||||
t=0
|
||||
BG.resize(scr.w,scr.h)
|
||||
end,
|
||||
resize=function(w,h)
|
||||
SHADER.rainbow:send("w",w*scr.dpi)
|
||||
SHADER.rainbow:send("h",h*scr.dpi)
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
end,
|
||||
draw=function()
|
||||
SHADER.rainbow:send("t",t)
|
||||
gc.setColor(.6,.6,.6)
|
||||
gc.setShader(SHADER.rainbow)
|
||||
gc.rectangle("fill",0,0,scr.w,scr.h)
|
||||
gc.setShader()
|
||||
end,
|
||||
}--Rolling rainbow
|
||||
back.game2={
|
||||
init=function()
|
||||
t=0
|
||||
BG.resize(scr.w,scr.h)
|
||||
end,
|
||||
resize=function(w,h)
|
||||
SHADER.rainbow:send("w",w*scr.dpi)
|
||||
SHADER.rainbow:send("h",h*scr.dpi)
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
end,
|
||||
draw=function()
|
||||
SHADER.rainbow:send("t",t)
|
||||
gc.setColor(.7,.4,.4)
|
||||
gc.setShader(SHADER.rainbow)
|
||||
gc.rectangle("fill",0,0,scr.w,scr.h)
|
||||
gc.setShader()
|
||||
end,
|
||||
}--Red rolling rainbow
|
||||
back.game3={
|
||||
init=function()
|
||||
t=0
|
||||
BG.resize(scr.w,scr.h)
|
||||
end,
|
||||
resize=function(w,h)
|
||||
SHADER.rainbow:send("w",w*scr.dpi)
|
||||
SHADER.rainbow:send("h",h*scr.dpi)
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
end,
|
||||
draw=function()
|
||||
SHADER.rainbow:send("t",t)
|
||||
gc.setColor(.5,.5,.8)
|
||||
gc.setShader(SHADER.rainbow)
|
||||
gc.rectangle("fill",0,0,scr.w,scr.h)
|
||||
gc.setShader()
|
||||
end,
|
||||
}--Blue rolling rainbow
|
||||
back.game4={
|
||||
init=function()
|
||||
t=0
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
end,
|
||||
draw=function()
|
||||
SHADER.strap:send("t",t*1.26)
|
||||
gc.setColor(.5,.626,.74)
|
||||
gc.setShader(SHADER.strap)
|
||||
gc.rectangle("fill",0,0,scr.w,scr.h)
|
||||
gc.setShader()
|
||||
end,
|
||||
}--Blue strap
|
||||
back.game5={
|
||||
init=function()
|
||||
t=0
|
||||
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")
|
||||
local scs=require("parts/spinCenters")
|
||||
back.game6={
|
||||
init=function()
|
||||
t=0
|
||||
colorLib=_G.SKIN.libColor
|
||||
colorSet=_G.setting.skin
|
||||
miniBlock=_G.miniBlock
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
end,
|
||||
draw=function()
|
||||
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 R=7-int(t*.5)%7
|
||||
local _=colorLib[colorSet[R]]
|
||||
gc.setColor(_[1],_[2],_[3],.1)
|
||||
gc.draw(miniBlock[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()*3600
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
end,
|
||||
draw=function()
|
||||
gc.scale(scr.k)
|
||||
gc.clear(.15,.15,.15)
|
||||
local Y=ceil(scr.h*scr.dpi/80)
|
||||
for x=1,ceil(scr.w*scr.dpi/80)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.scale(1/scr.k)
|
||||
end,
|
||||
}
|
||||
|
||||
back.space={
|
||||
init=function()
|
||||
stars={}
|
||||
W,H=scr.w+20,scr.h+20
|
||||
BG.resize(scr.w,scr.h)
|
||||
end,
|
||||
resize=function(w,h)
|
||||
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--800 var
|
||||
end,
|
||||
update=function(dt)
|
||||
local S=stars
|
||||
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--star moving
|
||||
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={}
|
||||
end,
|
||||
}
|
||||
|
||||
for _,bg in next,back do
|
||||
if not bg.init then bg.init= NULL end setfenv(bg.init ,BGvars)
|
||||
if not bg.resize then bg.resize= NULL end setfenv(bg.resize ,BGvars)
|
||||
if not bg.update then bg.update= NULL end setfenv(bg.update ,BGvars)
|
||||
if not bg.discard then bg.discard=NULL end setfenv(bg.discard ,BGvars)
|
||||
if not bg.draw then bg.draw= NULL end setfenv(bg.draw ,BGvars)
|
||||
end--make BG vars invisible
|
||||
|
||||
BG={
|
||||
cur="none",
|
||||
resize=NULL,
|
||||
update=NULL,
|
||||
draw=back.none.draw,
|
||||
}
|
||||
function BG.set(bg)
|
||||
if bg==BG.cur or not setting.bg then return end
|
||||
if BG.discard then
|
||||
BG.discard()
|
||||
collectgarbage()
|
||||
end
|
||||
BG.cur=bg
|
||||
bg=back[bg]
|
||||
|
||||
BG.init=bg.init or NULL
|
||||
BG.resize=bg.resize or NULL
|
||||
BG.update=bg.update or NULL
|
||||
BG.discard=bg.discard or NULL
|
||||
BG.draw=bg.draw or NULL
|
||||
BG.init()
|
||||
end
|
||||
return BG
|
||||
@@ -1,89 +0,0 @@
|
||||
local min=math.min
|
||||
local rem=table.remove
|
||||
|
||||
local function fadeOut(_,id)
|
||||
local src=BGM.list[id]
|
||||
local v=src:getVolume()-.025*setting.bgm*.1
|
||||
src:setVolume(v>0 and v or 0)
|
||||
if v<=0 then
|
||||
src:stop()
|
||||
return true
|
||||
end
|
||||
end
|
||||
local function fadeIn(_,id)
|
||||
local src=BGM.list[id]
|
||||
local v=min(src:getVolume()+.025*setting.bgm*.1,setting.bgm*.1)
|
||||
src:setVolume(v)
|
||||
if v>=setting.bgm*.1 then return true end
|
||||
end
|
||||
|
||||
local BGM={
|
||||
--nowPlay=[str:playing ID]
|
||||
--suspend=[str:pausing ID]
|
||||
--playing=[src:playing SRC]
|
||||
}
|
||||
BGM.list={
|
||||
"blank","way","race","newera","push","reason","infinite",
|
||||
"secret7th","secret8th",
|
||||
"shining terminal","oxygen","distortion","far",
|
||||
"rockblock","cruelty","final","8-bit happiness","end",
|
||||
"hay what kind of feeling",
|
||||
}
|
||||
BGM.len=#BGM.list
|
||||
function BGM.loadOne(N)
|
||||
N=BGM.list[N]
|
||||
local file="/BGM/"..N..".ogg"
|
||||
if love.filesystem.getInfo(file)then
|
||||
BGM.list[N]=love.audio.newSource(file,"stream")
|
||||
BGM.list[N]:setLooping(true)
|
||||
BGM.list[N]:setVolume(0)
|
||||
end
|
||||
end
|
||||
function BGM.loadAll()
|
||||
for i=1,#BGM.list do
|
||||
BGM.loadOne(i)
|
||||
end
|
||||
end
|
||||
function BGM.play(s)
|
||||
if setting.bgm==0 then
|
||||
BGM.playing=BGM.list[s]
|
||||
BGM.suspend,BGM.nowPlay=s
|
||||
return
|
||||
elseif not s or not BGM.list[s]then
|
||||
return
|
||||
end
|
||||
if BGM.nowPlay~=s then
|
||||
if BGM.nowPlay then TASK.new(fadeOut,nil,BGM.nowPlay)end
|
||||
TASK.changeCode(fadeIn,fadeOut)
|
||||
TASK.removeTask_data(s)
|
||||
|
||||
BGM.nowPlay,BGM.suspend=s
|
||||
TASK.new(fadeIn,nil,s)
|
||||
BGM.playing=BGM.list[s]
|
||||
BGM.playing:play()
|
||||
end
|
||||
end
|
||||
function BGM.freshVolume()
|
||||
if BGM.playing then
|
||||
local v=setting.bgm*.1
|
||||
if v>0 then
|
||||
BGM.playing:setVolume(v)
|
||||
if BGM.suspend then
|
||||
BGM.playing:play()
|
||||
BGM.nowPlay,BGM.suspend=BGM.suspend
|
||||
end
|
||||
else
|
||||
BGM.playing:setVolume(0)
|
||||
BGM.playing:pause()
|
||||
BGM.suspend,BGM.nowPlay=BGM.nowPlay
|
||||
end
|
||||
end
|
||||
end
|
||||
function BGM.stop()
|
||||
if BGM.nowPlay then
|
||||
TASK.new(fadeOut,nil,BGM.nowPlay)
|
||||
end
|
||||
TASK.changeCode(fadeIn,fadeOut)
|
||||
BGM.playing,BGM.nowPlay=nil
|
||||
end
|
||||
return BGM
|
||||
219
parts/file.lua
219
parts/file.lua
@@ -1,219 +0,0 @@
|
||||
local fs=love.filesystem
|
||||
local int,max,min=math.floor,math.max,math.min
|
||||
local sub,find=string.sub,string.find
|
||||
local toN,toS=tonumber,tostring
|
||||
local concat=table.concat
|
||||
|
||||
local function splitS(s,sep)
|
||||
local t,n={},1
|
||||
repeat
|
||||
local p=find(s,sep)or #s+1
|
||||
t[n]=sub(s,1,p-1)
|
||||
n=n+1
|
||||
s=sub(s,p+#sep)
|
||||
until #s==0
|
||||
return t
|
||||
end
|
||||
local tabs={
|
||||
[0]="",
|
||||
"\t",
|
||||
"\t\t",
|
||||
"\t\t\t",
|
||||
"\t\t\t\t",
|
||||
"\t\t\t\t\t",
|
||||
}
|
||||
local function dumpTable(L,t)
|
||||
local s
|
||||
if t then
|
||||
s="{\n"
|
||||
else
|
||||
s="return{\n"
|
||||
t=1
|
||||
end
|
||||
local count=1
|
||||
for k,v in next,L do
|
||||
local T=type(k)
|
||||
if T=="number"then
|
||||
if k==count then
|
||||
k="";count=count+1
|
||||
else
|
||||
k="["..k.."]="
|
||||
end
|
||||
elseif T=="string"then k=k.."="
|
||||
elseif T=="boolean"then k="["..k.."]="
|
||||
else assert(false,"Error key type!")
|
||||
end
|
||||
T=type(v)
|
||||
if T=="number"then v=tostring(v)
|
||||
elseif T=="string"then v="\""..v.."\""
|
||||
elseif T=="table"then v=dumpTable(v,t+1)
|
||||
elseif T=="boolean"then v=tostring(v)
|
||||
else assert(false,"Error data type!")
|
||||
end
|
||||
s=s..tabs[t]..k..v..",\n"
|
||||
end
|
||||
return s..tabs[t-1].."}"
|
||||
end
|
||||
local function addToTable(G,base)--refresh default base with G-values
|
||||
for k,v in next,G do
|
||||
if type(v)==type(base[k])then
|
||||
if type(v)=="table"then
|
||||
addToTable(v,base[k])
|
||||
else
|
||||
base[k]=v
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
local files={
|
||||
data= fs.newFile("data.dat"),
|
||||
setting=fs.newFile("settings.dat"),
|
||||
VK= fs.newFile("virtualkey.dat"),
|
||||
keyMap= fs.newFile("key.dat"),
|
||||
unlock= fs.newFile("unlock.dat"),
|
||||
}
|
||||
|
||||
local File={}
|
||||
function File.loadRecord(N)
|
||||
local F=fs.newFile(N..".dat")
|
||||
if F:open("r")then
|
||||
local s=loadstring(F:read())
|
||||
F:close()
|
||||
if s then
|
||||
setfenv(s,{})
|
||||
return s()
|
||||
else
|
||||
return{}
|
||||
end
|
||||
end
|
||||
end
|
||||
function File.saveRecord(N,L)
|
||||
local F=fs.newFile(N..".dat")
|
||||
F:open("w")
|
||||
local _,mes=F:write(dumpTable(L))
|
||||
F:flush()F:close()
|
||||
if not _ then
|
||||
TEXT.show(text.recSavingError..(mes or"unknown error"),1140,650,20,"sudden",.5)
|
||||
end
|
||||
end
|
||||
function File.delRecord(N)
|
||||
fs.remove(N..".dat")
|
||||
end
|
||||
|
||||
function File.loadUnlock()
|
||||
local F=files.unlock
|
||||
if F:open("r")then
|
||||
local s=F:read()
|
||||
if s:sub(1,6)~="return"then s="return{"..s.."}"end
|
||||
s=loadstring(s)
|
||||
F:close()
|
||||
if s then
|
||||
setfenv(s,{})
|
||||
modeRanks=s()
|
||||
end
|
||||
end
|
||||
end
|
||||
function File.saveUnlock()
|
||||
local F=files.unlock
|
||||
F:open("w")
|
||||
local _,mes=F:write(dumpTable(modeRanks))
|
||||
F:flush()F:close()
|
||||
if not _ then
|
||||
TEXT.show(text.unlockSavingError..(mes or"unknown error"),1140,650,20,"sudden",.5)
|
||||
end
|
||||
end
|
||||
|
||||
function File.loadData()
|
||||
local F=files.data
|
||||
if F:open("r")then
|
||||
local s=F:read()
|
||||
if s:sub(1,6)~="return"then
|
||||
s="return{"..s:gsub("\n",",").."}"
|
||||
end
|
||||
s=loadstring(s)
|
||||
F:close()
|
||||
if s then
|
||||
setfenv(s,{})
|
||||
local S=s()
|
||||
addToTable(S,stat)
|
||||
end
|
||||
end
|
||||
end
|
||||
function File.saveData()
|
||||
local F=files.data
|
||||
F:open("w")
|
||||
local _,mes=F:write(dumpTable(stat))
|
||||
F:flush()F:close()
|
||||
if not _ then
|
||||
TEXT.show(text.statSavingError..(mes or"unknown error"),1140,650,20,"sudden",.5)
|
||||
end
|
||||
end
|
||||
|
||||
function File.loadSetting()
|
||||
local F=files.setting
|
||||
if F:open("r")then
|
||||
local s=F:read()
|
||||
if s:sub(1,6)~="return"then
|
||||
s="return{"..s:gsub("\n",",").."}"
|
||||
end
|
||||
s=loadstring(s)
|
||||
F:close()
|
||||
if s then
|
||||
setfenv(s,{})
|
||||
addToTable(s(),setting)
|
||||
end
|
||||
end
|
||||
end
|
||||
function File.saveSetting()
|
||||
local F=files.setting
|
||||
F:open("w")
|
||||
local _,mes=F:write(dumpTable(setting))
|
||||
F:flush()F:close()
|
||||
if _ then TEXT.show(text.settingSaved,1140,650,40,"sudden",.5)
|
||||
else TEXT.show(text.settingSavingError..(mes or"unknown error"),1140,650,20,"sudden",.5)
|
||||
end
|
||||
end
|
||||
|
||||
function File.loadKeyMap()
|
||||
local F=files.keyMap
|
||||
if F:open("r")then
|
||||
local s=loadstring(F:read())
|
||||
F:close()
|
||||
if s then
|
||||
setfenv(s,{})
|
||||
addToTable(s(),keyMap)
|
||||
end
|
||||
end
|
||||
end
|
||||
function File.saveKeyMap()
|
||||
local F=files.keyMap
|
||||
F:open("w")
|
||||
local _,mes=F:write(dumpTable(keyMap))
|
||||
F:flush()F:close()
|
||||
if _ then TEXT.show(text.keyMapSaved,1140,650,26,"sudden",.5)
|
||||
else TEXT.show(text.keyMapSavingError..(mes or"unknown error"),1140,650,20,"sudden",.5)
|
||||
end
|
||||
end
|
||||
|
||||
function File.loadVK()
|
||||
local F=files.VK
|
||||
if F:open("r")then
|
||||
local s=loadstring(F:read())
|
||||
F:close()
|
||||
if s then
|
||||
setfenv(s,{})
|
||||
addToTable(s(),VK_org)
|
||||
end
|
||||
end
|
||||
end
|
||||
function File.saveVK()
|
||||
local F=files.VK
|
||||
F:open("w")
|
||||
local _,mes=F:write(dumpTable(VK_org))
|
||||
F:flush()F:close()
|
||||
if _ then TEXT.show(text.VKSaved,1140,650,26,"sudden",.5)
|
||||
else TEXT.show(text.VKSavingError..(mes or"unknown error"),1140,650,20,"sudden",.5)
|
||||
end
|
||||
end
|
||||
return File
|
||||
@@ -1,40 +0,0 @@
|
||||
local IMG={
|
||||
batteryImage="/mess/power.png",
|
||||
titleImage="mess/title.png",
|
||||
coloredTitleImage="mess/title_colored.png",
|
||||
dialCircle="mess/dialCircle.png",
|
||||
dialNeedle="mess/dialNeedle.png",
|
||||
badgeIcon="mess/badge.png",
|
||||
spinCenter="mess/spinCenter.png",
|
||||
ctrlSpeedLimit="mess/ctrlSpeedLimit.png",
|
||||
speedLimit="mess/speedLimit.png",
|
||||
pay1="mess/pay1.png",
|
||||
pay2="mess/pay2.png",
|
||||
|
||||
miyaCH="miya/ch.png",
|
||||
miyaF1="miya/f1.png",
|
||||
miyaF2="miya/f2.png",
|
||||
miyaF3="miya/f3.png",
|
||||
miyaF4="miya/f4.png",
|
||||
|
||||
electric="mess/electric.png",
|
||||
}
|
||||
local list={}
|
||||
local count=0
|
||||
for k,v in next,IMG do
|
||||
count=count+1
|
||||
list[count]=k
|
||||
end
|
||||
function IMG.getCount()
|
||||
return count
|
||||
end
|
||||
function IMG.loadOne(_)
|
||||
local N=list[_]
|
||||
IMG[N]=love.graphics.newImage("/image/"..IMG[N])
|
||||
end
|
||||
function IMG.loadAll()
|
||||
for i=1,count do
|
||||
IMG.loadOne(i)
|
||||
end
|
||||
end
|
||||
return IMG
|
||||
1762
parts/languages.lua
1762
parts/languages.lua
File diff suppressed because it is too large
Load Diff
@@ -1,89 +0,0 @@
|
||||
--LIGHT MODULE(Optimized by MrZ,Original on github/love2d community/simple-love-lights)
|
||||
--Heavily based on mattdesl's libGDX implementation:
|
||||
--https://github.com/mattdesl/lwjgl-basics/wiki/2D-Pixel-Perfect-Shadows
|
||||
local gc=love.graphics
|
||||
local C=gc.clear
|
||||
local shadowMapShader=gc.newShader("shader/shadowMap.glsl")--Shader for caculating the 1D shadow map.
|
||||
local lightRenderShader=gc.newShader("shader/lightRender.glsl")--Shader for rendering blurred lights and shadows.
|
||||
local Lights={}--Lightsource objects
|
||||
local function move(L,x,y)
|
||||
L.x,L.y=x,y
|
||||
end
|
||||
local function setPow(L,pow)
|
||||
L.size=pow
|
||||
end
|
||||
local function destroy(L)
|
||||
L.blackCanvas:release()
|
||||
L.shadowCanvas:release()
|
||||
L.renderCanvas:release()
|
||||
end
|
||||
local function draw(L)
|
||||
--Initialization
|
||||
local r,g,b,a=love.graphics.getColor()
|
||||
gc.setCanvas(L.blackCanvas)C()
|
||||
gc.setCanvas(L.shadowCanvas)C()
|
||||
gc.setCanvas(L.renderCanvas)C()
|
||||
lightRenderShader:send("xresolution",L.size);
|
||||
shadowMapShader:send("yresolution",L.size);
|
||||
|
||||
--get up-left of light
|
||||
local X=L.x-L.size*.5
|
||||
local Y=L.y-L.size*.5
|
||||
|
||||
--Render solid
|
||||
gc.translate(-X,-Y)
|
||||
L.blackCanvas:renderTo(L.blackFn)
|
||||
gc.translate(X,Y)
|
||||
|
||||
--Render shade canvas by solid
|
||||
gc.setShader(shadowMapShader)
|
||||
gc.setCanvas(L.shadowCanvas)
|
||||
gc.draw(L.blackCanvas)
|
||||
|
||||
--Render light canvas by shade
|
||||
gc.setShader(lightRenderShader)
|
||||
gc.setCanvas(L.renderCanvas)
|
||||
gc.draw(L.shadowCanvas,0,0,0,1,L.size)
|
||||
|
||||
--Ready to final render
|
||||
gc.setShader()gc.setCanvas()gc.setBlendMode("add")
|
||||
|
||||
--Render to screes
|
||||
gc.setColor(r,g,b,a)
|
||||
gc.draw(L.renderCanvas,X,Y+L.size,0,1,-1)
|
||||
|
||||
--Reset
|
||||
gc.setBlendMode("alpha")
|
||||
end
|
||||
|
||||
local LIGHT={}
|
||||
function LIGHT.draw()
|
||||
for i=1,#Lights do
|
||||
Lights[i]:draw()
|
||||
end
|
||||
end
|
||||
function LIGHT.clear(L)
|
||||
for i=#Lights,1,-1 do
|
||||
Lights[i]:destroy()
|
||||
Lights[i]=nil
|
||||
end
|
||||
end
|
||||
function LIGHT.add(x,y,R,F)
|
||||
local id=#Lights+1
|
||||
Lights[id]={
|
||||
--Methods
|
||||
id=id,
|
||||
x=x,y=y,size=R,
|
||||
blackCanvas=gc.newCanvas(R,R),--solid canvas
|
||||
shadowCanvas=gc.newCanvas(R,1),--1D vis-depth canvas
|
||||
renderCanvas=gc.newCanvas(R,R),--light canvas
|
||||
blackFn=F,--solid draw funcion
|
||||
|
||||
|
||||
move=move,
|
||||
setPow=setPow,
|
||||
draw=draw,
|
||||
destroy=destroy,
|
||||
}
|
||||
end
|
||||
return LIGHT
|
||||
2554
parts/player.lua
Normal file
2554
parts/player.lua
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,71 +0,0 @@
|
||||
local rem=table.remove
|
||||
|
||||
local SFX={}
|
||||
SFX.list={
|
||||
"welcome_sfx",
|
||||
"click","enter",
|
||||
"finesseError","finesseError_long",
|
||||
--Stereo sfxs(cannot set position)
|
||||
|
||||
"virtualKey",
|
||||
"button","swipe",
|
||||
"ready","start","win","fail","collect",
|
||||
"move","rotate","rotatekick","hold",
|
||||
"prerotate","prehold",
|
||||
"lock","drop","fall",
|
||||
"reach",
|
||||
"ren_1","ren_2","ren_3","ren_4","ren_5","ren_6","ren_7","ren_8","ren_9","ren_10","ren_11","ren_mega",
|
||||
"clear_1","clear_2","clear_3","clear_4",
|
||||
"spin_0","spin_1","spin_2","spin_3",
|
||||
"emit","blip_1","blip_2",
|
||||
"clear",
|
||||
|
||||
"error",
|
||||
--Mono sfxs
|
||||
}
|
||||
function SFX.loadOne(_)
|
||||
_,SFX.list[_]=SFX.list[_]
|
||||
SFX.list[_]={love.audio.newSource("/SFX/".._..".ogg","static")}
|
||||
end
|
||||
function SFX.loadAll()
|
||||
for i=1,#SFX.list do
|
||||
SFX.loadOne(i)
|
||||
end
|
||||
end
|
||||
function SFX.fieldPlay(s,v,P)
|
||||
SFX.play(s,v,(P.curX+P.sc[2]-6.5)*.15)
|
||||
end
|
||||
function SFX.play(s,v,pos)
|
||||
if setting.sfx==0 then return end
|
||||
local S=SFX.list[s]--source list
|
||||
local n=1
|
||||
while S[n]:isPlaying()do
|
||||
n=n+1
|
||||
if not S[n]then
|
||||
S[n]=S[1]:clone()
|
||||
S[n]:seek(0)
|
||||
break
|
||||
end
|
||||
end
|
||||
S=S[n]--AU_SRC
|
||||
if S:getChannelCount()==1 then
|
||||
if pos then
|
||||
pos=pos*setting.stereo*.1
|
||||
S:setPosition(pos,1-pos^2,0)
|
||||
else
|
||||
S:setPosition(0,0,0)
|
||||
end
|
||||
end
|
||||
S:setVolume((v or 1)*setting.sfx*.1)
|
||||
S:play()
|
||||
end
|
||||
function SFX.reset()
|
||||
for _,L in next,sfx do
|
||||
for i=#v,2,-1 do
|
||||
if not L[i]:isPlaying()then
|
||||
rem(L,i)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return SFX
|
||||
@@ -1,12 +0,0 @@
|
||||
local function N(file)
|
||||
return love.graphics.newShader("shader/"..file..".glsl")
|
||||
end
|
||||
return{
|
||||
-- glow=gc.newShader("shader/glow.cs"),
|
||||
alpha=N("alpha"),
|
||||
warning=N("warning"),
|
||||
|
||||
rainbow=N("rainbow"),
|
||||
strap=N("strap"),
|
||||
aura=N("aura"),
|
||||
}
|
||||
@@ -1,42 +0,0 @@
|
||||
local gc=love.graphics
|
||||
local setColor=gc.setColor
|
||||
local setWidth=gc.setLineWidth
|
||||
local rect=gc.rectangle
|
||||
|
||||
local fx={}
|
||||
|
||||
local FXdraw={}
|
||||
function FXdraw.ripple(S)
|
||||
setWidth(6)
|
||||
setColor(1,1,1,1-S.t)
|
||||
local r=(10*S.t)^1.2
|
||||
rect("line",S[1]-r,S[2]-r,S[3]+2*r,S[4]+2*r)
|
||||
end
|
||||
function FXdraw.shade(S)
|
||||
setColor(S[1],S[2],S[3],1-S.t)
|
||||
rect("fill",S[4],S[5],S[6],S[7],2)
|
||||
end
|
||||
|
||||
local sysFX={}
|
||||
function sysFX.update(dt)
|
||||
for i=#fx,1,-1 do
|
||||
local S=fx[i]
|
||||
S.t=S.t+dt*S.rate
|
||||
if S.t>=1 then
|
||||
for i=i,#fx do
|
||||
fx[i]=fx[i+1]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function sysFX.draw()
|
||||
for i=1,#fx do
|
||||
fx[i]:draw()
|
||||
end
|
||||
end
|
||||
--0=ripple,x,y,w,h
|
||||
--1=shade,r,g,b,x,y,w,h
|
||||
function sysFX.new(type,duration,...)
|
||||
fx[#fx+1]={draw=FXdraw[type],t=0,rate=1/duration,...}
|
||||
end
|
||||
return sysFX
|
||||
@@ -1,68 +0,0 @@
|
||||
local rem=table.remove
|
||||
|
||||
local tasks={}
|
||||
|
||||
local TASK={}
|
||||
function TASK.getCount()
|
||||
return #tasks
|
||||
end
|
||||
function TASK.update()
|
||||
for i=#tasks,1,-1 do
|
||||
local T=tasks[i]
|
||||
if T.code(T.P,T.data)then
|
||||
for i=i,#tasks do
|
||||
tasks[i]=tasks[i+1]
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function TASK.new(code,P,data)
|
||||
tasks[#tasks+1]={
|
||||
code=code,
|
||||
P=P,
|
||||
data=data,
|
||||
}
|
||||
end
|
||||
function TASK.changeCode(c1,c2)
|
||||
for i=#tasks,1,-1 do
|
||||
if tasks[i].code==c1 then
|
||||
tasks[i].code=c2
|
||||
end
|
||||
end
|
||||
end
|
||||
function TASK.removeTask_code(code)
|
||||
for i=#tasks,1,-1 do
|
||||
if tasks[i].code==code then
|
||||
rem(tasks,i)
|
||||
end
|
||||
end
|
||||
end
|
||||
function TASK.removeTask_data(data)
|
||||
for i=#tasks,1,-1 do
|
||||
if tasks[i].data==data then
|
||||
rem(tasks,i)
|
||||
end
|
||||
end
|
||||
end
|
||||
function TASK.clear(opt)
|
||||
if opt=="all"then
|
||||
local i=#tasks
|
||||
while i>0 do
|
||||
tasks[i]=nil
|
||||
i=i-1
|
||||
end
|
||||
elseif opt=="play"then
|
||||
for i=#tasks,1,-1 do
|
||||
if tasks[i].P then
|
||||
rem(tasks,i)
|
||||
end
|
||||
end
|
||||
else--Player table
|
||||
for i=#tasks,1,-1 do
|
||||
if tasks[i].P==opt then
|
||||
rem(tasks,i)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return TASK
|
||||
126
parts/text.lua
126
parts/text.lua
@@ -1,126 +0,0 @@
|
||||
local gc=love.graphics
|
||||
local rnd=math.random
|
||||
local mStr=mStr
|
||||
local rem=table.remove
|
||||
|
||||
local texts={}
|
||||
|
||||
local textFX={}
|
||||
function textFX.appear(t)
|
||||
mStr(t.text,t.x,t.y-t.font*.7)
|
||||
end
|
||||
function textFX.sudden(t)
|
||||
gc.setColor(1,1,1,1-t.c)
|
||||
mStr(t.text,t.x,t.y-t.font*.7)
|
||||
end
|
||||
function textFX.fly(t)
|
||||
mStr(t.text,t.x+(t.c-.5)^3*300,t.y-t.font*.7)
|
||||
end
|
||||
function textFX.stretch(t)
|
||||
gc.push("transform")
|
||||
gc.translate(t.x,t.y)
|
||||
if t.c<.3 then gc.scale((.3-t.c)*1.6+1,1)end
|
||||
mStr(t.text,0,-t.font*.7)
|
||||
gc.pop()
|
||||
end
|
||||
function textFX.drive(t)
|
||||
gc.push("transform")
|
||||
gc.translate(t.x,t.y)
|
||||
if t.c<.3 then gc.shear((.3-t.c)*2,0)end
|
||||
mStr(t.text,0,-t.font*.7)
|
||||
gc.pop()
|
||||
end
|
||||
function textFX.spin(t)
|
||||
gc.push("transform")
|
||||
gc.translate(t.x,t.y)
|
||||
if t.c<.3 then
|
||||
gc.rotate((.3-t.c)^2*4)
|
||||
elseif t.c>.8 then
|
||||
gc.rotate((t.c-.8)^2*-4)
|
||||
end
|
||||
mStr(t.text,0,-t.font*.7)
|
||||
gc.pop()
|
||||
end
|
||||
function textFX.flicker(t)
|
||||
local _,_,_,T=gc.getColor()
|
||||
gc.setColor(1,1,1,T*(rnd()+.5))
|
||||
mStr(t.text,t.x,t.y-t.font*.7)
|
||||
end
|
||||
function textFX.zoomout(t)
|
||||
gc.push("transform")
|
||||
local k=t.c^.5*.1+1
|
||||
gc.translate(t.x,t.y)
|
||||
gc.scale(k,k)
|
||||
mStr(t.text,0,-t.font*.7)
|
||||
gc.pop()
|
||||
end
|
||||
function textFX.beat(t)
|
||||
gc.push("transform")
|
||||
gc.translate(t.x,t.y)
|
||||
if t.c<.3 then
|
||||
local k=1.3-t.c^2/.3
|
||||
gc.scale(k,k)
|
||||
end
|
||||
mStr(t.text,0,-t.font*.7)
|
||||
gc.pop()
|
||||
end
|
||||
function textFX.mark(t)
|
||||
local _,_,_,T=gc.getColor()
|
||||
gc.setColor(1,1,1,T*.08)
|
||||
mStr(t.text,t.x,t.y-t.font*.7)
|
||||
end
|
||||
|
||||
local TEXT={}
|
||||
function TEXT.clear()
|
||||
texts={}
|
||||
end
|
||||
function TEXT.getText(text,x,y,font,style,spd,stop)
|
||||
return{
|
||||
c=0,
|
||||
text=text,
|
||||
x=x or 0,
|
||||
y=y or 0,
|
||||
font=font or 40,
|
||||
spd=(spd or 1)/60,
|
||||
stop=stop,
|
||||
draw=textFX[style]or assert(false,"unavailable type:"..style),
|
||||
}
|
||||
end--another version of TEXT()
|
||||
function TEXT.show(text,x,y,font,style,spd,stop)
|
||||
texts[#texts+1]={
|
||||
c=0, --timer
|
||||
text=text, --string
|
||||
x=x or 0, --x
|
||||
y=y or 0, --y
|
||||
font=font or 40, --font
|
||||
spd=(spd or 1)/60, --timing speed(1=last 1 sec)
|
||||
stop=stop, --stop time(sustained text)
|
||||
draw=textFX[style]or assert(false,"unavailable type:"..style), --draw method
|
||||
}
|
||||
end
|
||||
function TEXT.update(list)
|
||||
if not list then list=texts end
|
||||
for i=#list,1,-1 do
|
||||
local t=list[i]
|
||||
t.c=t.c+t.spd
|
||||
if t.stop then
|
||||
if t.c>t.stop then
|
||||
t.c=t.stop
|
||||
end
|
||||
end
|
||||
if t.c>1 then
|
||||
rem(list,i)
|
||||
end
|
||||
end
|
||||
end
|
||||
function TEXT.draw(list)
|
||||
if not list then list=texts end
|
||||
for i=1,#list do
|
||||
local t=list[i]
|
||||
local p=t.c
|
||||
gc.setColor(1,1,1,p<.2 and p*5 or p<.8 and 1 or 5-p*5)
|
||||
setFont(t.font)
|
||||
t:draw()
|
||||
end
|
||||
end
|
||||
return TEXT
|
||||
84
parts/texture.lua
Normal file
84
parts/texture.lua
Normal file
@@ -0,0 +1,84 @@
|
||||
local gc=love.graphics
|
||||
local N=gc.newImage
|
||||
local int=math.floor
|
||||
local function T(s,t)return gc.newText(setFont(s),t)end
|
||||
local function C(x,y)
|
||||
local _=gc.newCanvas(x,y)
|
||||
gc.setCanvas(_)
|
||||
return _
|
||||
end
|
||||
local c
|
||||
|
||||
gc.setDefaultFilter("nearest","nearest")
|
||||
gc.setColor(1,1,1)
|
||||
local VKI=N("/image/virtualkey.png")
|
||||
VKIcon={}
|
||||
for i=1,20 do
|
||||
VKIcon[i]=C(36,36)
|
||||
gc.draw(VKI,(i-1)%5*-36,int((i-1)*.2)*-36)
|
||||
end
|
||||
|
||||
miniBlock={}
|
||||
for i=1,7 do
|
||||
local b=blocks[i][0]
|
||||
miniBlock[i]=C(#b[1],#b)
|
||||
for y=1,#b do for x=1,#b[1]do
|
||||
if b[y][x]then
|
||||
gc.rectangle("fill",x-1,#b-y,1,1)
|
||||
end
|
||||
end end
|
||||
end
|
||||
|
||||
mapCross=C(40,40)
|
||||
gc.setColor(1,1,1)
|
||||
gc.setLineWidth(4)
|
||||
gc.line(0,20,40,20)
|
||||
gc.line(20,0,20,40)
|
||||
|
||||
gc.setDefaultFilter("linear","linear")
|
||||
|
||||
drawableText={
|
||||
question=T(100,"?"),
|
||||
bpm=T(15,"BPM"),kpm=T(15,"KPM"),
|
||||
speedLV=T(20,"speed level"),
|
||||
atk=T(20,"Attack"),
|
||||
eff=T(20,"Efficiency"),
|
||||
tsd=T(35,"TSD"),
|
||||
line=T(25,"Lines"),
|
||||
techrash=T(25,"Techrash"),
|
||||
grade=T(25,"Grade"),
|
||||
wave=T(30,"Wave"),
|
||||
rpm=T(35,"RPM"),
|
||||
nextWave=T(30,"Next"),
|
||||
combo=T(20,"Combo"),
|
||||
mxcmb=T(20,"Max Combo"),
|
||||
pc=T(20,"Perfect Clear"),
|
||||
ko=T(25,"KO"),
|
||||
D=T(100,"D"),
|
||||
C=T(100,"C"),
|
||||
B=T(100,"B"),
|
||||
A=T(100,"A"),
|
||||
S=T(100,"S"),
|
||||
|
||||
|
||||
modeName=T(30),levelName=T(30),
|
||||
|
||||
|
||||
anykey=T(40),
|
||||
next=T(40),hold=T(40),
|
||||
win=T(120),finish=T(120),
|
||||
lose=T(120),pause=T(120),
|
||||
|
||||
custom=T(80),
|
||||
setting_game=T(80),setting_video=T(80),setting_sound=T(80),
|
||||
setting_control=T(70),setting_skin=T(70),
|
||||
preview=T(40),
|
||||
keyboard=T(25),joystick=T(25),
|
||||
ctrlSetHelp=T(30),
|
||||
musicRoom=T(80),
|
||||
nowPlaying=T(50),
|
||||
VKTchW=T(30),VKOrgW=T(30),VKCurW=T(30),
|
||||
noScore=T(45),
|
||||
highScore=T(30),
|
||||
}
|
||||
gc.setCanvas()
|
||||
741
parts/updateLog.lua
Normal file
741
parts/updateLog.lua
Normal file
@@ -0,0 +1,741 @@
|
||||
local S=[=[
|
||||
"Patron"(time ordered,may not accurate):
|
||||
[rmb100+]:
|
||||
那没事了(T6300)
|
||||
加油啊,钉钉动了的大哥哥(T3228)
|
||||
弥佑瑶
|
||||
Alan
|
||||
幽灵3383
|
||||
靏鸖龘龘
|
||||
込余
|
||||
[rmb10+]:
|
||||
八零哥 蕴空之灵 gggf127 dtg
|
||||
ThTsOd Fireboos 金巧 10元
|
||||
立斐 Deep_Sea 时雪 yyangdid
|
||||
sfqr 心痕 Sasoric 夏小亚
|
||||
仁参 乐↗乐↘ 喜欢c4w的ztcjoin 面包
|
||||
蠢熏 潘一栗 Lied 星街书婉
|
||||
祝西 829 e m*12 我永远爱白银诺艾尔(鹏
|
||||
PCX kagura77 呆喂 GlowingEmbers
|
||||
轩辕辚 HimuroAki TCV100 tech有养成系统了@7065
|
||||
HAGE KANOBU 闪电和拐棍 葡萄味的曼妥思 世界沃德
|
||||
蓝绿 天生的魔法师 saki 琳雨空
|
||||
|
||||
Thanks!!!
|
||||
|
||||
Future outlook:
|
||||
New mode:
|
||||
PUYO
|
||||
game tutorial
|
||||
finesse tutorial
|
||||
game Abbr. test
|
||||
backfire
|
||||
finesse exam(3next, 1pt/mino, drop to score)
|
||||
round-based dig
|
||||
bigbang
|
||||
rhythm
|
||||
combo
|
||||
square
|
||||
field shifting(left/right)
|
||||
task survival
|
||||
dig practice
|
||||
dig zen
|
||||
sprint_symmetry
|
||||
hidden: sound only
|
||||
reverb (often repeat a piece many times)
|
||||
KPP-locked
|
||||
parkour
|
||||
Other:
|
||||
mod system with:
|
||||
block hidden
|
||||
field hidden
|
||||
up-hidden
|
||||
low-hidden
|
||||
next hidden
|
||||
field flip(LR/UD)
|
||||
no fail(∞ lives)
|
||||
mini games:
|
||||
15 puzzle
|
||||
mine sweeper
|
||||
2048
|
||||
tank battle
|
||||
time-based-rank for master advanced mode(1:58/2:28/3:03/300P/100P)
|
||||
简易防沉迷系统
|
||||
full-key control
|
||||
dragging control
|
||||
"next" SFX
|
||||
new layout of player (rectangle so stupid)
|
||||
better drop FX
|
||||
60+ fps supporting
|
||||
in-game document
|
||||
lang setting page
|
||||
game recording
|
||||
new widgets (joystick etc.)
|
||||
custom sequence(TTT!)
|
||||
splashing block
|
||||
cool backgrounds
|
||||
more graphic FXs & 3D features & animations
|
||||
Encrypt source code (compile to byte code)
|
||||
network game
|
||||
new AI: task-Z
|
||||
|
||||
0.8.25: Custom Sequence Update
|
||||
new:
|
||||
--TODO: custom sequence
|
||||
changed:
|
||||
little easier to get S in PC challenge (easy mode)
|
||||
easier to get S in infinite mode
|
||||
code:
|
||||
file sorted
|
||||
fixed:
|
||||
hard move won't deactive "spin"
|
||||
do not clear dead enemies' field
|
||||
show ghost's center when ghost is off
|
||||
|
||||
0.8.24: Bug Fixed
|
||||
new:
|
||||
ready to refuse auto-formating stats. if update from versions too old
|
||||
changed:
|
||||
little changing of pentomino wallkick list
|
||||
fixed:
|
||||
incorrect color of P/Q
|
||||
rank of petomino may be [custom]
|
||||
|
||||
0.8.23: Details Update
|
||||
new:
|
||||
new hidden BGM: Hay what kind of feeling
|
||||
now can reset all data (hidden)
|
||||
changed:
|
||||
add a stat "offset", used to avoid strange radar chart in Attack Mode, show in total stat page only
|
||||
6 more X-spin-wallkick added
|
||||
fixed:
|
||||
speed dial do not moving
|
||||
do not show 20+ combo
|
||||
|
||||
0.8.22: Shader Update
|
||||
new:
|
||||
new background: aura (using shader)
|
||||
new BGM: Far
|
||||
X-spin added
|
||||
visual effects for when the player is in danger
|
||||
staff page added
|
||||
changed:
|
||||
remake several backgrounds with shader, instead of image
|
||||
kick-list of pentomino optimized
|
||||
all backgounds fix screen correctly (maybe)
|
||||
won't show "open saving folder" button on mobile devices
|
||||
wallkick of J/L-180° spin changed
|
||||
reset all settings
|
||||
code:
|
||||
player generator optimized by FinnTenzor
|
||||
player system moduled
|
||||
fixed:
|
||||
rotating x do not fresh lock delay
|
||||
error after reset skin/dir. in pentomino mode
|
||||
some times error when any AI exists (wrong kickList code)
|
||||
|
||||
0.8.21: Bug Fixed
|
||||
changed:
|
||||
shape of speed dial changed
|
||||
range of FX values changed
|
||||
shape of speed dial changed
|
||||
fixed:
|
||||
error in modes with ai (rotate O in its rotation system, cause some strange error)
|
||||
|
||||
0.8.19/20: Fantastic Global Update II
|
||||
new:
|
||||
new clearing FX
|
||||
pentomino with new rotation system (testing)
|
||||
new PC training mode with over 1000 quiz
|
||||
new English translation by @MattMayuga#8789
|
||||
new language: ???
|
||||
language-setting page
|
||||
[C B A S SS]→[D C B A S]
|
||||
powerinfo switch
|
||||
changed:
|
||||
resume/quit key changed on pause page (quit with Q, resume with esc)
|
||||
warning when back to pause page from setting page
|
||||
some FX based on real time
|
||||
tiny change (almost nothing) changed for powerInfo
|
||||
page turing of in-game update log changed
|
||||
readable update log of 0.8+ ver
|
||||
some new "tips"
|
||||
add ENG ver. document(not in game)
|
||||
code:
|
||||
swap id of J/L
|
||||
wall-kick list easier to read
|
||||
no utf8 char in code/comments
|
||||
less global variables
|
||||
light module optimized (but not used)
|
||||
code optimized
|
||||
fixed:
|
||||
impossible to get SS in attacker mode
|
||||
|
||||
0.8.18: Details Update II
|
||||
new:
|
||||
adjustable virtualkey SFX & VIB
|
||||
changed:
|
||||
add discord link in ENG mode
|
||||
change par time/piece of sprint/battle/round mode
|
||||
info on pause page more clearly
|
||||
faster spaceBG rendering
|
||||
updateLog editted
|
||||
code:
|
||||
delete all removable "goto"s!
|
||||
callback system moduled, main.lua easy to read
|
||||
|
||||
0.8.17: Details Update
|
||||
new:
|
||||
bag seperating line switch
|
||||
better radar chart & statistics on pause page
|
||||
new generator method for drought mode, more difficult to finish
|
||||
virtualkey pressing SFX
|
||||
changed:
|
||||
combo counter changed
|
||||
rule of infinite dig changed
|
||||
no drop/lock FX in two hardest hidden modes, make them harder
|
||||
TSD-easy will auto finish when reach 20TSDs
|
||||
solo/round AI setting changed
|
||||
show text when entering debug mode
|
||||
SFX when enter recording mode
|
||||
remove full speed loading
|
||||
code:
|
||||
launching sound divided to SFX&VOC two parts
|
||||
delete many "goto"s
|
||||
vocal system moduled
|
||||
language system moduled, easier to add new languages
|
||||
fixed:
|
||||
forgot to load language
|
||||
error animation in control setting
|
||||
error when paste map containing darkgreen block
|
||||
moving block when changing target in t49/t99
|
||||
font error in patron list
|
||||
do not reset pause count when restart
|
||||
|
||||
0.8.16: Fantastic Global Update
|
||||
new:
|
||||
new statistic page with:
|
||||
Radar chart which shows some important info. of player's performance
|
||||
count each clear/spin for each piece(old data will be splited averagely)
|
||||
linux version!
|
||||
welcome vocal by MrZ
|
||||
rank label on mode icon(C→B→A→S→SS)
|
||||
new J/L-spin: R→2/L→2(0,-1)
|
||||
new O-spin-J/L method!
|
||||
new tele-ospin method!
|
||||
support out frame of skins with transparent pixels
|
||||
DAS system remade, no bugs any more!(probably)
|
||||
Initial hold/rotate/move switch!
|
||||
display ms in control setting
|
||||
super secret option
|
||||
changed:
|
||||
cannot initial hold in a row any more
|
||||
new randomizer for drought2
|
||||
half-clear judging method changed
|
||||
new background system(well, it doesn't look much different but space BG)
|
||||
now can loading at full speed with Dblclick/space/enter
|
||||
add alipay paycode to help page
|
||||
better sequence randomizer
|
||||
code:
|
||||
first shader applied for white frame of falling block
|
||||
many many module packed, easy to manage
|
||||
bgm module changed, probably no bug
|
||||
4 devMode now
|
||||
fixed:
|
||||
error when set to max 0 next
|
||||
AI sequence initializing error when face setting changed
|
||||
DAS error
|
||||
|
||||
0.8.15: Bug Fixed
|
||||
new:
|
||||
can switch line-clear text now
|
||||
new attack way "Clear"(half-clear)
|
||||
give every update a name!
|
||||
changed:
|
||||
animation time of lock effect little changed
|
||||
bone block of ball-skin changed
|
||||
AI change target more slowly
|
||||
Author.dignity-=1
|
||||
fixed:
|
||||
180° I spin kicklist error
|
||||
AI will kill itself when spawn dir. of mino changed
|
||||
error when reach 400 in 20G(Lunatic)
|
||||
error block color in modes with starting field
|
||||
|
||||
0.8.14: Cool FX
|
||||
new:
|
||||
click/tap/any-key to skip loading animation
|
||||
lock animation
|
||||
changed:
|
||||
display scene info when error
|
||||
code:
|
||||
many optimization
|
||||
fixed:
|
||||
error when attack
|
||||
error garbage line color
|
||||
error in finesse checking
|
||||
some times error when touch screen
|
||||
touch/press release with no press, then error
|
||||
|
||||
0.8.13: O-spin Update++
|
||||
new:
|
||||
a independent page to set DAS/ARR, with an animation for preview
|
||||
changed:
|
||||
new virtualkey animation
|
||||
freer drawing mode(Incompatible with old ver.)
|
||||
combo&b3b attack changed
|
||||
score of spins little changed
|
||||
fixed:
|
||||
wrong behavior in pause scene
|
||||
ospin error in 0.8.12
|
||||
memory leakage in t49/t99
|
||||
unnatural behavior of widgets
|
||||
|
||||
0.8.12: Bountful Update
|
||||
new:
|
||||
layout setting: skin system with customizable block color/direction
|
||||
more information when pause
|
||||
block has more color(7→11)
|
||||
skin: smooth(MrZ), contrast(MrZ), steel(kulumi), ball(shaw)
|
||||
changed:
|
||||
BGM secret7's Inst. changed
|
||||
more stable space background
|
||||
stat format changed when pause/stat menu
|
||||
opaque background in pause when playing, transparent after game
|
||||
canceled invalid game
|
||||
easier to unlock custom mode
|
||||
some text changed
|
||||
code:
|
||||
better line-clear process
|
||||
merge event.lua to player.lua
|
||||
new skin image format
|
||||
same format for all file
|
||||
better virtualkey-scanning opportunity, bit faster when many AI
|
||||
some player-method name changed
|
||||
fixed:
|
||||
an error of pause button
|
||||
score may be float number
|
||||
many syntax errors of texts
|
||||
crash when paste illegal data to drawing mode
|
||||
stage reset problem in t49/t99
|
||||
wrong info in tech-L/U/U+ mode
|
||||
|
||||
0.8.11: Total Update
|
||||
changed:
|
||||
better rule of checking invalid game
|
||||
can setting when pause
|
||||
opaque background when pause
|
||||
code:
|
||||
many code optimized(moduled)
|
||||
fixed:
|
||||
receive attack when paused in survivor mode
|
||||
error when pasteboard has block_13
|
||||
must hold R to restart when finished the game
|
||||
sth about screen size
|
||||
some O-spin error
|
||||
error line counting when pc(full b2b)
|
||||
|
||||
0.8.10: Cool Update
|
||||
new:
|
||||
new BGM:Distortion(master-final)
|
||||
all background darker
|
||||
cooler error page
|
||||
fixed:
|
||||
error when finish master/ultra mode
|
||||
shakeFX no effect when below 3
|
||||
|
||||
0.8.9: System Detail Update
|
||||
new:
|
||||
invalid game when pause too much
|
||||
quick play re-added
|
||||
new BGM: Oxygen(c4w&pc training)
|
||||
changed:
|
||||
space background little changed
|
||||
|
||||
0.8.8+: Bug-Fix Update
|
||||
fixed many fatal bugs
|
||||
|
||||
0.8.8: Space BG Update
|
||||
new:
|
||||
background now is cool space with "planets" and "stars", instead of boring falling tetrominos
|
||||
no black side in any screen size
|
||||
adjustable waiting time before start
|
||||
ajustable maxnext count
|
||||
marked the modes with limited das/arr
|
||||
new error page and a new voice
|
||||
add many fatal bugs
|
||||
changed:
|
||||
simple records with date
|
||||
tiny change in rotate system(JL pistol-spin)
|
||||
better board copy/paste
|
||||
an unlock-all easter egg
|
||||
fixed:
|
||||
press invisible func key
|
||||
some mode error
|
||||
|
||||
0.8.7: Game Detail Update
|
||||
new:
|
||||
support 2^n G falling speed
|
||||
changed:
|
||||
better user experience in mode selecting
|
||||
speed of marathon mode changed
|
||||
code:
|
||||
shorter clipboard string(when air above)
|
||||
attack system/score system little changed
|
||||
fixed:
|
||||
wrong behaviour of rank system
|
||||
error when enter some mode(again!)
|
||||
|
||||
0.8.6: System Detail Update
|
||||
new:
|
||||
can adjust gamepad keysetting
|
||||
add SFX when enter game
|
||||
changed:
|
||||
map GUI little adjusted
|
||||
event system little changed(no control when scene swapping)
|
||||
fixed:
|
||||
wrong behaviour of rank system
|
||||
error when enter some mode
|
||||
|
||||
0.8.5-: Exploration Update
|
||||
new:
|
||||
mode map!Brandly new GUI for mode selecting
|
||||
mode unlock system, not that scary for noob
|
||||
every mode has rank calculating method(may some mistakes/inappropriate number)
|
||||
save 10 best recoreds for each mode
|
||||
can save/share custom map now
|
||||
"new mode": Big Bang
|
||||
changed:
|
||||
button appearance changed
|
||||
better widget performence
|
||||
remove Qplay
|
||||
fixed:
|
||||
many bugs
|
||||
|
||||
0.8.4: Miya Update II
|
||||
changed:
|
||||
vocal more natural(important, may cause new bug)
|
||||
a bit better performence on mobile devices
|
||||
fixed:
|
||||
some fatal bugs
|
||||
|
||||
0.8.3: Miya Update
|
||||
new:
|
||||
new widget appearence
|
||||
cuter miya
|
||||
|
||||
0.8.2: Graphics Update
|
||||
new:
|
||||
miya figure added
|
||||
new widget appearence
|
||||
changed:
|
||||
GUI adjusted
|
||||
fixed:
|
||||
some bugs
|
||||
|
||||
0.8.1: Power Info Update
|
||||
changed:
|
||||
more FX level
|
||||
better battery info displaying
|
||||
3 next in GMroll
|
||||
fixed:
|
||||
some bugs
|
||||
|
||||
0.8.0: Small Update
|
||||
new:
|
||||
better update log from now on(2020.5.2)
|
||||
changed:
|
||||
more details
|
||||
code:
|
||||
remade text system
|
||||
fixed:
|
||||
some bugs
|
||||
|
||||
0.7.35: Bug Fixed
|
||||
yeah, only bug fixed
|
||||
|
||||
0.7.34: Voice Update+
|
||||
replace most voice
|
||||
shaking FX more natural
|
||||
|
||||
0.7.33+: Bot Update
|
||||
MORE POWERFUL 9-stack AI
|
||||
add stereo-setting slider
|
||||
code optimized
|
||||
bug fixed
|
||||
|
||||
0.7.32: Virtualkey Update+
|
||||
Blind-GM now show section directly
|
||||
easier&more standard classic mode
|
||||
can switch Virtualkey's auto dodging
|
||||
in-game setting
|
||||
code optimized
|
||||
bug fixed
|
||||
|
||||
0.7.31: Stereo Update
|
||||
stereo system
|
||||
fixed a problem in finesse calculating
|
||||
|
||||
0.7.30: Virtualkey Update
|
||||
auto-tracking virtual key, adjustable parameters!
|
||||
can switch on/off virtuakeys
|
||||
add 7 more key
|
||||
better finesse rate calculating
|
||||
block generating position on Y-axis changed
|
||||
new icon for android
|
||||
can use preset in custom mode with keyboard
|
||||
adjusted GUI
|
||||
many bug fixed
|
||||
|
||||
0.7.28: Finesse Update
|
||||
add fineese check(almost useful)
|
||||
code optimized
|
||||
|
||||
0.7.27: O-spin Update+
|
||||
super O transform system
|
||||
optimized system(no used)
|
||||
bug fixed
|
||||
|
||||
0.7.26: Bug Fixed
|
||||
new skin
|
||||
import light lib
|
||||
many bug fixed
|
||||
|
||||
0.7.25: Demo Update
|
||||
demo play at main menu
|
||||
ALMOST reconstructed WHOLE PLAYER SYSTEM, NEED TEST
|
||||
many bug fixed
|
||||
|
||||
0.7.23/24: Feast of Hearing
|
||||
all bgm remade
|
||||
more settings with brand new GUI!
|
||||
new mode: Master-Final
|
||||
new modes: attacker & defender(not survivor!)
|
||||
add restart button when pause
|
||||
Code Clear added, face it bravely!(Windows only)
|
||||
change falling animation
|
||||
new GUI details
|
||||
louder sound
|
||||
code optimized
|
||||
many bugs fixed
|
||||
|
||||
0.7.22: Graphics Update
|
||||
scoring system
|
||||
smooth dropping
|
||||
can change FX level
|
||||
new attaking FX
|
||||
new bone skin
|
||||
battery info/time display
|
||||
in-game update log(this page)
|
||||
fast game
|
||||
much many more better GUI details
|
||||
add EXTRA level of survivor mode
|
||||
adjust difficulty of Tech mode
|
||||
compressed setting/data
|
||||
support 10% step alpha of virtual key
|
||||
many code optimized&bugs fixed
|
||||
|
||||
0.7.21: Title Update
|
||||
new title image
|
||||
more GUI details
|
||||
many bugs fixed
|
||||
|
||||
0.7.20: Music Room Update
|
||||
add music room
|
||||
change block/space apperance in draw mode
|
||||
field shake animation
|
||||
default sets of custom options
|
||||
can set BG/BGM in custom mode
|
||||
bug fixed
|
||||
|
||||
0.7.19: Voice Update
|
||||
voice system added(voice by Miya)
|
||||
support macOS!
|
||||
new mode: C4W training
|
||||
rendering of royale mode optimized again
|
||||
add "free cell" in draw mode
|
||||
add 2 new block skins
|
||||
new difficulty in infinite mode
|
||||
new background/sound effect in master mode
|
||||
bug fixed
|
||||
|
||||
0.7.18: Skin Update
|
||||
3 new block skins!(one skin origional by Miya(nya~))
|
||||
better restarting(to prevent mistakenly touching)
|
||||
switch display of puzzle mode
|
||||
adjust UI
|
||||
code optimized
|
||||
default custom options changed to as infinite mode
|
||||
|
||||
0.7.17: Pause Update
|
||||
display game stats when pause
|
||||
more options in statistics
|
||||
better pausing
|
||||
adjust difficulty of Tech mode
|
||||
adjust difficulty of PC training mode
|
||||
adjust vibrate level for mobile devices
|
||||
little optimized
|
||||
bugs fixed
|
||||
|
||||
0.7.16: Game Detail Update
|
||||
change rules of custom puzzle mode
|
||||
change rules of TSD mode
|
||||
better pausing
|
||||
speed optimized
|
||||
adjust difficulty of dig mode
|
||||
bugs fixed
|
||||
|
||||
0.7.15: Puzzle Update
|
||||
can make puzzle by drawing mode
|
||||
can pause game with animation
|
||||
change icon of "Functional key"
|
||||
speed optimized
|
||||
bugs fixed
|
||||
|
||||
0.7.14: Creativity Update
|
||||
drawing mode in custom game
|
||||
adjustable virtual keys with mouse
|
||||
speed optimized
|
||||
rotate also create shade
|
||||
|
||||
0.7.13+: Small Update
|
||||
change difficulty of survivor mode
|
||||
little game rule change
|
||||
bugs fixed(AI control error)
|
||||
|
||||
0.7.13:
|
||||
new:
|
||||
Chinese game name: 方块研究所
|
||||
SUPER COOL instant moving effect
|
||||
new b2b bar style & animation
|
||||
new transition animation
|
||||
changed:
|
||||
change difficulty of master mode
|
||||
adjust delay algorithm(probably cause controlfeel changing, please reset your DAS setting)
|
||||
code reconstructed
|
||||
debug key change to F8
|
||||
fixed:
|
||||
error when seq=his
|
||||
error game area size of custom opponent
|
||||
|
||||
0.7.12: Total Update
|
||||
AI learned to switch attack mode
|
||||
seperate master mode from marathon mode
|
||||
master mode more interesting
|
||||
countdown line in sprint mode
|
||||
smooth BGM swapping
|
||||
new garbage buffer
|
||||
new harddrop&lock SFX feel
|
||||
a bit change of rotate system
|
||||
grid switch
|
||||
swap target by combo key/press
|
||||
some Chinese translaton editted
|
||||
[reconstruct event system]
|
||||
|
||||
0.7.11: Total Update
|
||||
some Chinese translaton editted
|
||||
add bone block in 2 hardest marathon(new block-fresh system)
|
||||
play sound when get badges in royale mode
|
||||
change b2b indicator display method
|
||||
more difficulty of blind mode
|
||||
colorful garbage lines
|
||||
clearer attacking pointer
|
||||
fix 6 next in classic mode
|
||||
add QR code in help page
|
||||
change some detials
|
||||
|
||||
0.7.10: Small Update
|
||||
full Chinese translation
|
||||
add Classic mode
|
||||
change O spin's behaviour
|
||||
bugs fixed
|
||||
|
||||
0.7.9: O-spin Update
|
||||
O spin is a lie
|
||||
better attacking pointer
|
||||
language system
|
||||
change rotate system
|
||||
change BGM&BG set
|
||||
code optimized
|
||||
bugs fixed
|
||||
|
||||
0.7.8: Performance Update
|
||||
GPU usage decreased much more than before
|
||||
add virtual key animation
|
||||
display player's rank after death in royale mode
|
||||
fix sequence error of PC training mode
|
||||
adjust difficulty of suvivor mode
|
||||
code optimized
|
||||
bugs fixed
|
||||
|
||||
0.7.7: Mode Update
|
||||
add dig mode
|
||||
add survivor mode
|
||||
combine some modes
|
||||
change some GUI
|
||||
more SFXs
|
||||
bugs fixed
|
||||
|
||||
0.7.6: Mode Update
|
||||
new font
|
||||
add DIFFICULTY selection
|
||||
virtual keys give visual feedback(PC/phone)
|
||||
add vibration
|
||||
add default set of visual keys
|
||||
add tech mode
|
||||
add drought mode
|
||||
better GUI&change speed&BGM in royale mode
|
||||
more FXs in royale mode
|
||||
fix all attacking bug of royale mode
|
||||
change sequence of TSD-only mode to bag7
|
||||
|
||||
0.7.5: Total Update
|
||||
reduce difficuly of PC training mode, and add more patterns
|
||||
reduce difficuly of death mode
|
||||
add PC challenge mode
|
||||
swapping attack mode for royale mode(AI always use 'Random')
|
||||
royale mode use less GPU
|
||||
new GUI of royale mode
|
||||
add intro scene
|
||||
soft scene swapping
|
||||
adjust other details
|
||||
change game icon
|
||||
adjust GUI of royale mode
|
||||
change sequence of TSD-only mode
|
||||
royale mode use LESS GPU
|
||||
|
||||
0.7.4: Bug Update
|
||||
add a lot of bugs
|
||||
|
||||
0.7.3: Game Detail Update
|
||||
add infinite target in custom
|
||||
fix TSD-only mode result+1 when finishing with a wrong clear
|
||||
change sequence generator of TSD-only mode
|
||||
GUI position editted
|
||||
Fix Screen flow
|
||||
smarter AI
|
||||
|
||||
0.7.2: Mode Update
|
||||
add PC training mode
|
||||
add TSD-only mode
|
||||
remove non-sense s/z spin double
|
||||
GUI position editted
|
||||
grid BG changed
|
||||
smarter AI
|
||||
]=]
|
||||
|
||||
local find,sub=string.find,string.sub
|
||||
local L,c={},0--list, \n counter,
|
||||
local p,p1=1,0--cut start/end pos
|
||||
local EOF=#S
|
||||
|
||||
while true do
|
||||
p1=find(S,"\n",p1+1)
|
||||
c=c+1
|
||||
if c==23 or p1==EOF then
|
||||
L[#L+1]=sub(S,p,p1-1)
|
||||
if p1==EOF then return L end
|
||||
p=p1+1
|
||||
c=0
|
||||
end
|
||||
end
|
||||
@@ -1,8 +0,0 @@
|
||||
local level={0,0,.015,.02,.03,.04,.05,.06,.07,.08}
|
||||
local _=love.system.vibrate
|
||||
return function(t)
|
||||
local L=setting.vib
|
||||
if L>0 then
|
||||
_(level[L+t])
|
||||
end
|
||||
end
|
||||
134
parts/voice.lua
134
parts/voice.lua
@@ -1,134 +0,0 @@
|
||||
local rnd=math.random
|
||||
local rem=table.remove
|
||||
local voiceQueue={free=0}
|
||||
local bank={}--{{SRC1s},{SRC2s},...}
|
||||
local VOC={}
|
||||
VOC.name={
|
||||
"zspin","sspin","lspin","jspin","tspin","ospin","ispin",
|
||||
"single","double","triple","techrash",
|
||||
"mini","b2b","b3b","pc",
|
||||
"win","lose",
|
||||
"bye",
|
||||
"nya",
|
||||
"happy",
|
||||
"doubt",
|
||||
"sad",
|
||||
"egg",
|
||||
"welcome"
|
||||
}
|
||||
VOC.list={
|
||||
zspin={"zspin_1","zspin_2","zspin_3"},
|
||||
sspin={"sspin_1","sspin_2","sspin_3","sspin_4","sspin_5","sspin_6"},
|
||||
lspin={"lspin_1","lspin_2"},
|
||||
jspin={"jspin_1","jspin_2","jspin_3","jspin_4"},
|
||||
tspin={"tspin_1","tspin_2","tspin_3","tspin_4","tspin_5","tspin_6"},
|
||||
ospin={"ospin_1","ospin_2","ospin_3"},
|
||||
ispin={"ispin_1","ispin_2","ispin_3"},
|
||||
|
||||
single={"single_1","single_2","single_3","single_4","single_5","single_6","single_7"},
|
||||
double={"double_1","double_2","double_3","double_4","double_5"},
|
||||
triple={"triple_1","triple_2","triple_3","triple_4","triple_5","triple_6","triple_7"},
|
||||
techrash={"techrash_1","techrash_2","techrash_3","techrash_4"},
|
||||
|
||||
mini={"mini_1","mini_2","mini_3"},
|
||||
b2b={"b2b_1","b2b_2","b2b_3"},
|
||||
b3b={"b3b_1","b3b_2"},
|
||||
pc={"clear_1","clear_2"},
|
||||
win={"win_1","win_2","win_3","win_4","win_5","win_6","win_6","win_7"},
|
||||
lose={"lose_1","lose_2","lose_3"},
|
||||
bye={"bye_1","bye_2"},
|
||||
nya={"nya_1","nya_2","nya_3","nya_4"},
|
||||
happy={"nya_happy_1","nya_happy_2","nya_happy_3","nya_happy_4"},
|
||||
doubt={"nya_doubt_1","nya_doubt_2"},
|
||||
sad={"nya_sad_1"},
|
||||
egg={"egg_1","egg_2"},
|
||||
welcome={"welcome_voc"},
|
||||
}
|
||||
|
||||
local function getVoice(str)
|
||||
local L=bank[str]
|
||||
local n=1
|
||||
while L[n]:isPlaying()do
|
||||
n=n+1
|
||||
if not L[n]then
|
||||
L[n]=L[1]:clone()
|
||||
L[n]:seek(0)
|
||||
break
|
||||
end
|
||||
end
|
||||
return L[n]
|
||||
--load voice with string
|
||||
end
|
||||
function VOC.loadOne(_)
|
||||
local N=VOC.name[_]
|
||||
for i=1,#VOC.list[N]do
|
||||
local V=VOC.list[N][i]
|
||||
bank[V]={love.audio.newSource("VOICE/"..V..".ogg","static")}
|
||||
end
|
||||
end
|
||||
function VOC.loadAll()
|
||||
for i=1,#VOC.list do
|
||||
VOC.loadOne(i)
|
||||
end
|
||||
end
|
||||
function VOC.getFreeChannel()
|
||||
local i=#voiceQueue
|
||||
for i=1,i do
|
||||
if #voiceQueue[i]==0 then return i end
|
||||
end
|
||||
voiceQueue[i+1]={s=0}
|
||||
return i+1
|
||||
end
|
||||
function VOC.getCount()
|
||||
return #voiceQueue
|
||||
end
|
||||
function VOC.update()
|
||||
for i=#voiceQueue,1,-1 do
|
||||
local Q=voiceQueue[i]
|
||||
if Q.s==0 then--Free channel, auto delete when >3
|
||||
if i>3 then
|
||||
rem(voiceQueue,i)
|
||||
end
|
||||
elseif Q.s==1 then--Waiting load source
|
||||
Q[1]=getVoice(Q[1])
|
||||
Q[1]:setVolume(setting.voc*.1)
|
||||
Q[1]:play()
|
||||
Q.s=Q[2]and 2 or 4
|
||||
elseif Q.s==2 then--playing 1,ready 2
|
||||
if Q[1]:getDuration()-Q[1]:tell()<.08 then
|
||||
Q[2]=getVoice(Q[2])
|
||||
Q[2]:setVolume(setting.voc*.1)
|
||||
Q[2]:play()
|
||||
Q.s=3
|
||||
end
|
||||
elseif Q.s==3 then--playing 12 same time
|
||||
if not Q[1]:isPlaying()then
|
||||
for i=1,#Q do
|
||||
Q[i]=Q[i+1]
|
||||
end
|
||||
Q.s=Q[2]and 2 or 4
|
||||
end
|
||||
elseif Q.s==4 then--playing last
|
||||
if not Q[1].isPlaying(Q[1])then
|
||||
Q[1]=nil
|
||||
Q.s=0
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function VOC.play(s,chn)
|
||||
if setting.voc>0 then
|
||||
if chn then
|
||||
local L=voiceQueue[chn]
|
||||
local _=VOC.list[s]
|
||||
if not _ then print("no VOC called:"..s)return end
|
||||
L[#L+1]=_[rnd(#_)]
|
||||
L.s=1
|
||||
--add to queue[chn]
|
||||
else
|
||||
voiceQueue[VOC.getFreeChannel()]={s=1,VOC.list[s][rnd(#VOC.list[s])]}
|
||||
--create new channel & play
|
||||
end
|
||||
end
|
||||
end
|
||||
return VOC
|
||||
309
parts/widget.lua
309
parts/widget.lua
@@ -1,309 +0,0 @@
|
||||
local gc=love.graphics
|
||||
local kb=love.keyboard
|
||||
local int=math.floor
|
||||
local format=string.format
|
||||
local next=next
|
||||
local EMPTY={}
|
||||
|
||||
local button={
|
||||
type="button",
|
||||
ATV=0,--activating time(0~8)
|
||||
}
|
||||
function button:reset()
|
||||
self.ATV=0
|
||||
end
|
||||
function button:isAbove(x,y)
|
||||
return x>self.x-self.ATV and x<self.x+self.w+2*self.ATV and y>self.y-self.ATV and y<self.y+self.h+2*self.ATV
|
||||
end
|
||||
function button:FX()
|
||||
sysFX.new("ripple",.16,self.x-self.ATV,self.y-self.ATV,self.w+2*self.ATV,self.h+2*self.ATV)
|
||||
end
|
||||
function button:update()
|
||||
if WIDGET.sel==self then
|
||||
if self.ATV<8 then self.ATV=self.ATV+1 end
|
||||
else
|
||||
if self.ATV>0 then self.ATV=self.ATV-1 end
|
||||
end
|
||||
end
|
||||
function button:draw()
|
||||
local x,y,w,h=self.x,self.y,self.w,self.h
|
||||
local r,g,b=unpack(self.color)
|
||||
gc.setColor(.2+r*.8,.2+g*.8,.2+b*.8,.7)
|
||||
gc.rectangle("fill",x-self.ATV,y-self.ATV,w+2*self.ATV,h+2*self.ATV)
|
||||
if self.ATV>0 then
|
||||
gc.setLineWidth(4)
|
||||
gc.setColor(1,1,1,self.ATV*.125)
|
||||
gc.rectangle("line",x-self.ATV+2,y-self.ATV+2,w+2*self.ATV-4,h+2*self.ATV-4)
|
||||
end
|
||||
local t=self.text
|
||||
if t then
|
||||
if type(t)=="function"then t=t()end
|
||||
setFont(self.font)
|
||||
local y0=y+h*.5-self.font*.7
|
||||
gc.setColor(1,1,1,.3)
|
||||
gc.printf(t,x-2,y0-2,w,"center")
|
||||
gc.printf(t,x-2,y0+2,w,"center")
|
||||
gc.printf(t,x+2,y0-2,w,"center")
|
||||
gc.printf(t,x+2,y0+2,w,"center")
|
||||
gc.setColor(r*.5,g*.5,b*.5)
|
||||
gc.printf(t,x,y0,w,"center")
|
||||
end
|
||||
end
|
||||
function button:getInfo()
|
||||
print(format("x=%d,y=%d,w=%d,h=%d,font=%d",self.x+self.w*.5,self.y+self.h*.5,self.w,self.h,self.font))
|
||||
end
|
||||
|
||||
local switch={
|
||||
type="switch",
|
||||
ATV=0,--activating time(0~8)
|
||||
CHK=0,--check alpha(0~6)
|
||||
}
|
||||
function switch:reset()
|
||||
self.ATV=0
|
||||
self.CHK=0
|
||||
end
|
||||
function switch:isAbove(x,y)
|
||||
return x>self.x and x<self.x+50 and y>self.y-25 and y<self.y+25
|
||||
end
|
||||
function switch:update()
|
||||
local _=self.ATV
|
||||
if WIDGET.sel==self then if _<8 then self.ATV=_+1 end
|
||||
else if _>0 then self.ATV=_-1 end
|
||||
end
|
||||
_=self.CHK
|
||||
if self:disp()then if _<6 then self.CHK=_+1 end
|
||||
else if _>0 then self.CHK=_-1 end
|
||||
end
|
||||
end
|
||||
function switch:draw()
|
||||
local x,y=self.x,self.y-25
|
||||
if self.ATV>0 then
|
||||
gc.setColor(1,1,1,self.ATV*.08)
|
||||
gc.rectangle("fill",x,y,50,50)
|
||||
end
|
||||
if self.CHK>0 then
|
||||
gc.setColor(.9,1,.9,self.CHK/6)
|
||||
gc.setLineWidth(6)
|
||||
gc.line(x+5,y+25,x+18,y+38,x+45,y+11)
|
||||
end
|
||||
--checked
|
||||
gc.setLineWidth(4)
|
||||
gc.setColor(1,1,1,.6+self.ATV*.05)
|
||||
gc.rectangle("line",x,y,50,50)
|
||||
--frame
|
||||
local t=self.text
|
||||
if t then
|
||||
gc.setColor(1,1,1)
|
||||
setFont(self.font)
|
||||
gc.printf(t,x-412,y+20-self.font*.7,400,"right")
|
||||
end
|
||||
end
|
||||
function switch:getInfo()
|
||||
print(format("x=%d,y=%d,font=%d",self.x,self.y,self.font))
|
||||
end
|
||||
|
||||
local slider={
|
||||
type="slider",
|
||||
ATV=0,--activating time(0~8)
|
||||
pos=0,--position shown
|
||||
}
|
||||
function slider:reset()
|
||||
self.ATV=0
|
||||
self.pos=0
|
||||
end
|
||||
function slider:isAbove(x,y)
|
||||
return x>self.x-10 and x<self.x+self.w+10 and y>self.y-20 and y<self.y+20
|
||||
end
|
||||
function slider:update()
|
||||
if WIDGET.sel==self then
|
||||
if self.ATV<6 then self.ATV=self.ATV+1 end
|
||||
else
|
||||
if self.ATV>0 then self.ATV=self.ATV-1 end
|
||||
end
|
||||
if not(self.hide and self.hide())then
|
||||
self.pos=self.pos*.7+self.disp()*.3
|
||||
end
|
||||
end
|
||||
function slider:draw()
|
||||
local x,y=self.x,self.y
|
||||
gc.setColor(1,1,1,.5+self.ATV*.06)
|
||||
gc.setLineWidth(2)
|
||||
local x1,x2=x,x+self.w
|
||||
for p=0,self.unit do
|
||||
local x=x1+(x2-x1)*p/self.unit
|
||||
gc.line(x,y+7,x,y-7)
|
||||
end
|
||||
--units
|
||||
gc.setLineWidth(4)
|
||||
gc.line(x1,y,x2,y)
|
||||
--axis
|
||||
local t=self.text
|
||||
if t then
|
||||
gc.setColor(1,1,1)
|
||||
setFont(self.font)
|
||||
gc.printf(t,x-312,y-self.font*.7,300,"right")
|
||||
end
|
||||
--text
|
||||
local x,y,w,h=x1+(x2-x1)*self.pos/self.unit-10-self.ATV*.5,y-16-self.ATV,20+self.ATV,32+2*self.ATV
|
||||
gc.setColor(.8,.8,.8)
|
||||
gc.rectangle("fill",x,y,w,h)
|
||||
if self.ATV>0 then
|
||||
gc.setLineWidth(2)
|
||||
gc.setColor(1,1,1,self.ATV*.16)
|
||||
gc.rectangle("line",x+1,y+1,w-2,h-2)
|
||||
end
|
||||
--block
|
||||
end
|
||||
function slider:getInfo()
|
||||
print(format("x=%d,y=%d,w=%d",self.x,self.y,self.w))
|
||||
end
|
||||
|
||||
local WIDGET={}
|
||||
WIDGET.active=EMPTY--table, contains all active widgets
|
||||
WIDGET.sel=nil--selected widget
|
||||
function WIDGET.set(L)
|
||||
WIDGET.sel=nil
|
||||
WIDGET.active=L or EMPTY
|
||||
if L then
|
||||
for _,W in next,L do
|
||||
W:reset()
|
||||
end--Reset all widgets
|
||||
end
|
||||
end
|
||||
|
||||
WIDGET.new={}
|
||||
function WIDGET.new.button(x,y,w,h,color,font,code,hide,N)
|
||||
local _={
|
||||
x=x-w*.5,y=y-h*.5,
|
||||
w=w,h=h,
|
||||
color=color,
|
||||
font=font,
|
||||
code=code,
|
||||
hide=hide,
|
||||
next=N,
|
||||
}for k,v in next,button do _[k]=v end return _
|
||||
end
|
||||
function WIDGET.new.switch(x,y,font,disp,code,hide,N)
|
||||
local _={
|
||||
x=x,y=y,font=font,
|
||||
disp=disp,
|
||||
code=code,
|
||||
hide=hide,
|
||||
next=N,
|
||||
}for k,v in next,switch do _[k]=v end return _
|
||||
end
|
||||
function WIDGET.new.slider(x,y,w,unit,font,change,disp,code,hide,N)
|
||||
local _={
|
||||
x=x,y=y,
|
||||
w=w,unit=unit,
|
||||
font=font,
|
||||
change=change,
|
||||
disp=disp,
|
||||
code=code,
|
||||
hide=hide,
|
||||
next=N,
|
||||
}for k,v in next,slider do _[k]=v end return _
|
||||
end
|
||||
|
||||
function WIDGET.moveCursor(x,y)
|
||||
WIDGET.sel=nil
|
||||
for _,W in next,WIDGET.active do
|
||||
if not(W.hide and W.hide())and W:isAbove(x,y)then
|
||||
WIDGET.sel=W
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
function WIDGET.press(x,y)
|
||||
local W=WIDGET.sel
|
||||
if not W then return end
|
||||
if W.type=="button"then
|
||||
W.code()
|
||||
W:FX()
|
||||
SFX.play("button")
|
||||
VOC.play("nya")
|
||||
elseif W.type=="switch"then
|
||||
W.code()
|
||||
SFX.play("move",.6)
|
||||
elseif W.type=="slider"then
|
||||
if not x then return end
|
||||
local p,P=W.disp(),x<W.x and 0 or x>W.x+W.w and W.unit or int((x-W.x)*W.unit/W.w+.5)
|
||||
if p==P then return end
|
||||
W.code(P)
|
||||
if W.change then W.change()end
|
||||
end
|
||||
if W.hide and W.hide()then WIDGET.sel=nil end
|
||||
end
|
||||
function WIDGET.drag(x,y,dx,dy)
|
||||
local W=WIDGET.sel
|
||||
if not W then return end
|
||||
if W.type=="slider"then
|
||||
local p,P=W.disp(),x<W.x and 0 or x>W.x+W.w and W.unit or int((x-W.x)*W.unit/W.w+.5)
|
||||
if p==P then return end
|
||||
W.code(P)
|
||||
if W.change then W.change()end
|
||||
elseif not W:isAbove(x,y)then
|
||||
WIDGET.sel=nil
|
||||
end
|
||||
end
|
||||
function WIDGET.keyPressed(i)
|
||||
if i=="tab"then
|
||||
if WIDGET.sel then
|
||||
WIDGET.sel=kb.isDown("lshift")and WIDGET.sel.prev or WIDGET.sel.next or WIDGET.sel
|
||||
else
|
||||
WIDGET.sel=select(2,next(WIDGET.active))
|
||||
end
|
||||
elseif i=="space"or i=="return"then
|
||||
if WIDGET.sel then
|
||||
WIDGET.press(WIDGET.sel)
|
||||
end
|
||||
elseif i=="left"or i=="right"then
|
||||
local W=WIDGET.sel
|
||||
if W then
|
||||
if W.type=="slider"then
|
||||
local p=W.disp()
|
||||
local P=i=="left"and(p>0 and p-1)or p<W.unit and p+1
|
||||
if p==P or not P then return end
|
||||
W.code(P)
|
||||
if W.change then W.change()end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
function WIDGET.gamepadPressed(i)
|
||||
if i=="dpup"or i=="dpdown"then
|
||||
if WIDGET.sel then
|
||||
WIDGET.sel=i=="dpup"and WIDGET.sel.prev or WIDGET.sel.next or WIDGET.sel
|
||||
else
|
||||
WIDGET.sel=select(2,next(WIDGET.active))
|
||||
end
|
||||
elseif i=="start"then
|
||||
if WIDGET.sel then
|
||||
WIDGET.press(WIDGET.sel)
|
||||
end
|
||||
elseif i=="dpleft"or i=="dpright"then
|
||||
if WIDGET.sel then
|
||||
local W=WIDGET.sel
|
||||
if W.type=="slider"then
|
||||
local p=W.disp()
|
||||
local P=i=="left"and(p>0 and p-1)or p<W.unit and p+1
|
||||
if p==P or not P then return end
|
||||
W.code(P)
|
||||
if W.change then W.change()end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function WIDGET.update()
|
||||
for _,W in next,WIDGET.active do W:update()end
|
||||
end
|
||||
function WIDGET.draw()
|
||||
for _,W in next,WIDGET.active do
|
||||
if not(W.hide and W.hide())then
|
||||
W:draw()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return WIDGET
|
||||
Reference in New Issue
Block a user