Compare commits

...

46 Commits

Author SHA1 Message Date
MrZ_26
3bef016019 0.9.3:性能优化,细节修改 2020-07-27 00:14:57 +08:00
MrZ_26
4bff742b98 0.9.2:全局更新 2020-07-23 22:16:02 +08:00
MrZ_26
b97319afe0 0.9.2:方向键选择控件 2020-07-23 15:12:17 +08:00
MrZ_26
bb2c732529 0.9.2:调试界面,新背景,布局微调 2020-07-23 00:42:47 +08:00
MrZ_26
ae650bd1ff 0.9.2:调试界面,新背景,布局微调 2020-07-21 00:16:15 +08:00
MrZ_26
ee99943ed9 0.9.1:next音效 2020-07-20 00:06:31 +08:00
MrZ_26
60cbc83313 新tips,修复手机旋屏bug,各种调平,统计数据简化 2020-07-19 21:33:03 +08:00
MrZ_26
74bc1a2544 bug修复,水印修改,20G上级调平 2020-07-18 01:05:10 +08:00
MrZ_26
7b35d69be1 允许用键盘编辑序列 2020-07-17 17:37:48 +08:00
MrZ_26
f29fc7081a 0.9.0:自定义序列 2020-07-17 02:08:26 +08:00
MrZ_26
882b841d3f 界面美化/死亡动画/自定义序列编辑器 2020-07-15 23:22:44 +08:00
MrZ_26
3d22f5d8ca 强化水印&系统优化 2020-07-09 19:39:06 +08:00
MrZ_26
a3302ab2bc Zframework finished 2020-07-08 20:26:28 +08:00
MrZ_26
cdd5194108 [change file directory] 2020-07-05 14:56:58 +08:00
MrZ_26
40de030cae [Z-framework stand alone ready] 2020-07-05 14:46:02 +08:00
MrZ_26
e1d92a166b 0.8.24: Bug Fixed 2020-06-14 15:21:20 +08:00
MrZ_26
99b55b72e0 0.8.23: Details Update 2020-06-07 01:06:31 +08:00
MrZ_26
08883b952f 0.8.22:Shader Update 2020-05-28 15:16:38 +08:00
MrZ_26
76fab86692 player generator优化 2020-05-23 00:09:53 +08:00
MrZ_26
725eb4e26f 0.8.22pre1 2020-05-23 00:05:04 +08:00
MrZ_26
486a64cca3 0.8.21: Bug Fixed 2020-05-23 00:04:21 +08:00
FinnTenzor
8e5f6f8b7c 在不影响newXXXPlayer逻辑的情况下调整函数体 为RemotePlayer预留位置 2020-05-21 17:09:39 +08:00
Finn
c0149d5830 Merge pull request #1 from MrZ626/master
0.8.19/20: Fantastic Global Update II
2020-05-21 16:32:44 +08:00
MrZ_26
28d5136e95 0.8.19/20: Fantastic Global Update II 2020-05-21 01:12:17 +08:00
MrZ_26
2768fa748b 0.8.18:Details Update II 2020-05-01 02:33:36 +08:00
MrZ_26
00026bc46b 0.8.17:Details Update 2020-04-30 01:23:11 +08:00
MrZ_26
7d63386410 0.8.16Fantastic Global Update 2020-04-30 01:23:11 +08:00
MrZ_26
e88553bc00 0.8.15Bug Fixed 2020-04-30 01:23:11 +08:00
MrZ_26
4652be7067 0.8.14 2020-04-30 01:23:11 +08:00
MrZ_26
ed0f8031d0 0.8.13 2020-04-30 01:23:11 +08:00
MrZ_26
15df07ae3f 0.8.12 2020-04-30 01:22:06 +08:00
MrZ_26
57857ceb67 0.8.11 2020-02-22 00:47:35 +08:00
MrZ_26
527352ce15 0.8.10 2020-02-20 00:44:51 +08:00
MrZ_26
b8f57f5a1c 0.8.9 2020-02-19 17:41:23 +08:00
MrZ_26
d02048f0dc 0.8.8 2020-02-18 23:05:10 +08:00
MrZ_26
4da080c6f5 0.8.7 2020-02-14 19:26:57 +08:00
MrZ_26
5f62127f28 0.8.6 2020-02-14 00:22:15 +08:00
MrZ_26
f6835c2118 0.8.5- 2020-02-12 23:49:24 +08:00
MrZ_26
3155bc48ef 0.8.4α 2020-02-04 20:33:46 +08:00
MrZ_26
c1b334963b 0.8.3α 2020-02-04 19:41:15 +08:00
MrZ_26
0dbdc9fe42 0.8.2+α 2020-02-04 19:40:51 +08:00
MrZ_26
324435d51a 0.8.2α 2020-02-04 19:40:34 +08:00
MrZ_26
1c384ca51a 0.8.2α 2020-02-04 19:40:21 +08:00
MrZ_26
e196790e2c 0.8.1α 2020-02-04 19:38:58 +08:00
MrZ_26
659a50300d 0.8.0α 2020-02-04 19:38:48 +08:00
MrZ_26
918d17ad9a 0.7.35α 2020-02-04 19:38:28 +08:00
216 changed files with 16291 additions and 9075 deletions

BIN
BGM/distortion.ogg Normal file

Binary file not shown.

BIN
BGM/far.ogg Normal file

Binary file not shown.

BIN
BGM/how feeling.ogg Normal file

Binary file not shown.

BIN
BGM/oxygen.ogg Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
SFX/click.ogg Normal file

Binary file not shown.

BIN
SFX/enter.ogg Normal file

Binary file not shown.

Binary file not shown.

BIN
SFX/finesseError.ogg Normal file

Binary file not shown.

BIN
SFX/spawn_1.ogg Normal file

Binary file not shown.

BIN
SFX/spawn_2.ogg Normal file

Binary file not shown.

BIN
SFX/spawn_3.ogg Normal file

Binary file not shown.

BIN
SFX/spawn_4.ogg Normal file

Binary file not shown.

BIN
SFX/spawn_5.ogg Normal file

Binary file not shown.

BIN
SFX/spawn_6.ogg Normal file

Binary file not shown.

BIN
SFX/spawn_7.ogg Normal file

Binary file not shown.

BIN
SFX/virtualKey.ogg Normal file

Binary file not shown.

Binary file not shown.

BIN
SFX/welcome_sfx.ogg Normal file

Binary file not shown.

Binary file not shown.

BIN
VOICE/egg_1.ogg Normal file

Binary file not shown.

BIN
VOICE/egg_2.ogg Normal file

Binary file not shown.

Binary file not shown.

BIN
VOICE/nya_happy_4.ogg Normal file

Binary file not shown.

BIN
VOICE/nya_sad_1.ogg Normal file

Binary file not shown.

Binary file not shown.

BIN
VOICE/welcome_voc.ogg Normal file

Binary file not shown.

287
Zframework/bg.lua Normal file
View File

@@ -0,0 +1,287 @@
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.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)
end,
resize=function(w)
SHADER.gradient1:send("w",w*scr.dpi)
end,
update=function(dt)
t=t+dt
end,
draw=function()
SHADER.gradient1:send("t",t)
gc.setShader(SHADER.gradient1)
gc.rectangle("fill",0,0,scr.w,scr.h)
gc.setShader()
end,
}--Horizonal red-blue gradient
back.game2={
init=function()
t=0
BG.resize(nil,scr.h)
end,
resize=function(w,h)
SHADER.gradient2:send("h",h*scr.dpi)
end,
update=function(dt)
t=t+dt
end,
draw=function()
SHADER.gradient2:send("t",t)
gc.setShader(SHADER.gradient2)
gc.rectangle("fill",0,0,scr.w,scr.h)
gc.setShader()
end,
}--Vertical red-green gradient
back.game3={
init=function()
t=0
BG.resize(scr.w,scr.h)
end,
resize=function(w,h)
SHADER.rgb1:send("w",w*scr.dpi)
SHADER.rgb1:send("h",h*scr.dpi)
end,
update=function(dt)
t=t+dt
end,
draw=function()
SHADER.rgb1:send("t",t)
gc.setShader(SHADER.rgb1)
gc.rectangle("fill",0,0,scr.w,scr.h)
gc.setShader()
end,
}--Colorful RGB
back.game4={
init=function()
t=0
BG.resize(scr.w,scr.h)
end,
resize=function(w,h)
SHADER.rgb2:send("w",w*scr.dpi)
SHADER.rgb2:send("h",h*scr.dpi)
end,
update=function(dt)
t=t+dt
end,
draw=function()
SHADER.rgb2:send("t",t)
gc.setShader(SHADER.rgb2)
gc.rectangle("fill",0,0,scr.w,scr.h)
gc.setShader()
end,
}--Blue RGB
back.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
blockImg=_G.TEXTURE.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(blockImg[R],640,360,t%3.1416*6,400,400,scs[R][0][2]-.5,#blocks[R][0]-scs[R][0][1]+.5)
end,
}--Fast lightning + spining tetromino
local matrixT={}for i=1,50 do matrixT[i]={}for j=1,50 do matrixT[i][j]=love.math.noise(i,j)+2 end end
back.matrix={
init=function()
t=rnd()*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,data)
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

89
Zframework/bgm.lua Normal file
View File

@@ -0,0 +1,89 @@
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",
"how 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,BGM.nowPlay)end
TASK.changeCode(fadeIn,fadeOut)
TASK.removeTask_data(s)
BGM.nowPlay,BGM.suspend=s
TASK.new(fadeIn,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,BGM.nowPlay)
end
TASK.changeCode(fadeIn,fadeOut)
BGM.playing,BGM.nowPlay=nil
end
return BGM

39
Zframework/color.lua Normal file
View File

@@ -0,0 +1,39 @@
local color={
red={1,0,0},
green={0,1,0},
blue={.2,.2,1},
yellow={1,1,0},
magenta={1,0,1},
cyan={0,1,1},
grey={.6,.6,.6},
lRed={1,.5,.5},
lGreen={.5,1,.5},
lBlue={.6,.6,1},
lCyan={.5,1,1},
lMagenta={1,.5,1},
lYellow={1,1,.5},
lPurple={.8,.4,1},
lOrange={1,.7,.3},
lGrey={.8,.8,.8},
dRed={.6,0,0},
dGreen={0,.6,0},
dBlue={0,0,.6},
dCyan={0,.6,.6},
dMagenta={.6,0,.6},
dYellow={.6,.6,0},
dPurple={.3,0,.6},
dOrange={.6,.4,0},
dGrey={.3,.3,.3},
black={0,0,0},
orange={1,.6,0},
pink={1,0,.6},
grass={.6,1,0},
water={0,1,.6},
bronze={.7,.4,0},
white={1,1,1},
purple={.5,0,1},
}
return color

224
Zframework/file.lua Normal file
View File

@@ -0,0 +1,224 @@
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
if find(k,"[^0-9a-zA-Z_]")then
k="[\""..k.."\"]="
else
k=k.."="
end
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

41
Zframework/img.lua Normal file
View File

@@ -0,0 +1,41 @@
local IMG={
batteryImage="/mess/power.png",
title="mess/title.png",
title_color="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",
hbm="mess/hbm.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

1133
Zframework/init.lua Normal file

File diff suppressed because it is too large Load Diff

1866
Zframework/languages.lua Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -3,11 +3,9 @@
--https://github.com/mattdesl/lwjgl-basics/wiki/2D-Pixel-Perfect-Shadows
local gc=love.graphics
local C=gc.clear
local shadowMapShader=gc.newShader("shadowMapShader.cs")--Shader for caculating the 1D shadow map.
local lightRenderShader=gc.newShader("lightRenderShader.cs")--Shader for rendering blurred lights and shadows.
Lights={}--Lightsource objects
local Lights=Lights
--Private--
local shadowMapShader=gc.newShader("Zframework/shader/shadowMap.glsl")--Shader for caculating the 1D shadow map.
local lightRenderShader=gc.newShader("Zframework/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
@@ -20,61 +18,72 @@ local function destroy(L)
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
--Public--
function drawLight()
local LIGHT={}
function LIGHT.draw()
for i=1,#Lights do
Lights[i]:draw()
end
end
function clearLight(L)
for i=1,#Lights do
function LIGHT.clear(L)
for i=#Lights,1,-1 do
Lights[i]:destroy()
Lights[i]=nil
end
end
function addLight(x,y,R,F)
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),--遮挡物画布
shadowCanvas=gc.newCanvas(R,1),--1D视深画布
renderCanvas=gc.newCanvas(R,R),--灯光画布
blackFn=F,--遮挡物绘图函数
--方法
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
end
return LIGHT

848
Zframework/paint.lua Normal file
View File

@@ -0,0 +1,848 @@
local gc=love.graphics
local setFont=setFont
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 format=string.format
local Timer=love.timer.getTime
local mStr=mStr
local scr=scr
local scs=require("parts/spinCenters")
local modeRankColor={
color.bronze, --Rank1
color.lGrey, --Rank2
color.lYellow, --Rank3
color.lPurple, --Rank4
color.lCyan, --Rank5
color.lGreen, --Special
}
local rankString={
"D","C","B","A","S",
}
local miniTitle_rect={
{2,0,5,1},{4,1,1,6},
{9,0,4,1},{9,3,4,1},{9,6,4,1},{8,0,1,7},
{15,0,3,1},{15,6,3,1},{14,0,1,7},
{19,0,1,7},{23,0,1,7},{20,3,3,1},
{0,8,1,6},{6,8,1,6},{1,9,1,1},{2,10,1,1},{3,11,1,1},{4,10,1,1},{5,9,1,1},
{8,8,5,1},{8,13,5,1},{10,9,1,4},
{14,8,1,6},{19,8,1,6},{15,9,1,1},{16,10,1,1},{17,11,1,1},{18,12,1,1},
{21,8,5,1},{21,13,5,1},{21,9,1,4},{25,9,1,4},
}
FX_attack={}--Attack beam
FX_badge={}--Badge thrown
local function drawAtkPointer(x,y)
local t=sin(Timer()*20)
gc.setColor(.2,.7+t*.2,1,.6+t*.4)
gc.circle("fill",x,y,25,6)
local a=Timer()*3%1*.8
gc.setColor(0,.6,1,.8-a)
gc.circle("line",x,y,30*(1+a),6)
end
local function VirtualkeyPreview()
if setting.VKSwitch then
for i=1,#VK_org do
local B=VK_org[i]
if B.ava then
local c=sceneTemp.sel==i and .6 or 1
gc.setColor(c,1,c,setting.VKAlpha*.1)
gc.setLineWidth(B.r*.07)
gc.circle("line",B.x,B.y,B.r,10)
if setting.VKIcon then gc.draw(TEXTURE.VKIcon[i],B.x,B.y,nil,B.r*.025,nil,18,18)end
end
end
end
end
local function drawVirtualkey()
local V=virtualkey
local a=setting.VKAlpha*.1
local _
if setting.VKIcon then
local icons=TEXTURE.VKIcon
for i=1,#V do
if V[i].ava then
local B=V[i]
gc.setColor(1,1,1,a)
gc.setLineWidth(B.r*.07)
gc.circle("line",B.x,B.y,B.r,10)--Button outline
_=V[i].pressTime
gc.draw(icons[i],B.x,B.y,nil,B.r*.026+_*.08,nil,18,18)--icon
if _>0 then
gc.setColor(1,1,1,a*_*.08)
gc.circle("fill",B.x,B.y,B.r*.94,10)--Glow
gc.circle("line",B.x,B.y,B.r*(1.4-_*.04),10)--Ripple
end
end
end
else
for i=1,#V do
if V[i].ava then
local B=V[i]
gc.setColor(1,1,1,a)
gc.setLineWidth(B.r*.07)
gc.circle("line",B.x,B.y,B.r,10)
_=V[i].pressTime
if _>0 then
gc.setColor(1,1,1,a*_*.08)
gc.circle("fill",B.x,B.y,B.r*.94,10)
gc.circle("line",B.x,B.y,B.r*(1.4-_*.04),10)
end
end
end
end
end
local Pnt={}
function Pnt.load()
local S=sceneTemp
gc.setLineWidth(4)
gc.setColor(1,1,1,.5)
gc.rectangle("fill",300,330,S.cur/S.tar*680,60,5)
gc.setColor(1,1,1)
gc.rectangle("line",300,330,680,60,5)
setFont(35)
gc.print(text.load[S.phase],340,335)
if S.phase~=0 then
gc.printf(S.cur.."/"..S.tar,795,335,150,"right")
end
setFont(25)
mStr(S.tip,640,400)
end
local titleTransform={
function(t)
gc.translate(0,max(50-t,0)^2/25)
end,
function(t)
gc.translate(0,-max(50-t,0)^2/25)
end,
function(t,i)
local d=max(50-t,0)
gc.translate(sin(Timer()*3+626*i)*d,cos(Timer()*3+626*i)*d)
end,
function(t,i)
local d=max(50-t,0)
gc.translate(sin(Timer()*3+626*i)*d,-cos(Timer()*3+626*i)*d)
end,
function(t)
gc.setColor(1,1,1,min(t*.02,1)+rnd()*.2)
end,
}
function Pnt.intro()
local s=sceneTemp
local t=s.t1
local T=(t+110)%300
if T<30 then
gc.setLineWidth(4+(30-T)^1.626/62)
else
gc.setLineWidth(4)
end
local L=title
gc.push("transform")
gc.translate(126,226)
for i=1,8 do
local T=t-i*15
if T>0 then
gc.push("transform")
gc.setColor(1,1,1,min(T*.025,1))
titleTransform[s.r[i]](T,i)
local dt=(t+62-5*i)%300
if dt<20 then
gc.translate(0,abs(10-dt)-10)
end
gc.polygon("line",L[i])
gc.pop()
end
end
gc.pop()
t=s.t2
if t>=80 then
gc.setColor(1,1,1,.6+sin((t-80)*.0626)*.3)
mText(drawableText.anykey,640,615+sin(Timer()*3)*5)
end
end
function Pnt.main()
gc.setColor(1,1,1)
gc.draw(IMG.title_color,60,30,nil,1.3)
setFont(30)
gc.print(gameVersion,70,125)
gc.print(system,610,100)
local L=text.modes[stat.lastPlay]
setFont(25)
gc.print(L[1],700,470)
gc.print(L[2],700,500)
players[1]:draw()
end
function Pnt.mode()
local _
local cam=mapCam
gc.push("transform")
gc.translate(640,360)
gc.scale(cam.zoomK)
gc.translate(-cam.x1,-cam.y1)
gc.scale(cam.k1)
local R=modeRanks
local sel=cam.sel
setFont(30)
gc.setLineWidth(8)
gc.setColor(1,1,1,.2)
for name,M in next,Modes do
if R[name]then
for _=1,#M.unlock do
local m=Modes[M.unlock[_]]
gc.line(M.x,M.y,m.x,m.y)
end
end
end--lines connecting modes
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
if d<500 then S=S*(1.25-d*0.0005) end
local c=modeRankColor[R[M.name]]
if c then
gc.setColor(c)
else
c=.5+sin(Timer()*6.26)*.2
S=S*(.9+c*.4)
gc.setColor(c,c,c)
end
if M.shape==1 then--Rectangle
gc.rectangle("fill",M.x-S,M.y-S,2*S,2*S)
if sel==name then
gc.setColor(1,1,1)
gc.setLineWidth(10)
gc.rectangle("line",M.x-S+5,M.y-S+5,2*S-10,2*S-10)
end
elseif M.shape==2 then--diamond
gc.circle("fill",M.x,M.y,S+5,4)
if sel==name then
gc.setColor(1,1,1)
gc.setLineWidth(10)
gc.circle("line",M.x,M.y,S+5,4)
end
elseif M.shape==3 then--Octagon
gc.circle("fill",M.x,M.y,S,8)
if sel==name then
gc.setColor(1,1,1)
gc.setLineWidth(10)
gc.circle("line",M.x,M.y,S,8)
end
end
name=drawableText[rankString[R[M.name]]]
if name then
gc.setColor(0,0,0,.26)
mDraw(name,M.x,M.y)
end
--[[
if M.icon then
local i=M.icon
local l=i:getWidth()*.5
local k=S/l*.8
gc.setColor(0,0,0,2)
gc.draw(i,M.x-1,M.y-1,nil,k,nil,l,l)
gc.draw(i,M.x-1,M.y+1,nil,k,nil,l,l)
gc.draw(i,M.x+1,M.y-1,nil,k,nil,l,l)
gc.draw(i,M.x+1,M.y+1,nil,k,nil,l,l)
gc.setColor(1,1,1)
gc.draw(i,M.x,M.y,nil,k,nil,l,l)
end
]]
end
end
gc.pop()
if sel then
local M=Modes[sel]
local lang=setting.lang
gc.setColor(.7,.7,.7,.5)
gc.rectangle("fill",920,0,360,720)--Info board
gc.setColor(M.color)
setFont(40)mStr(text.modes[sel][1],1100,5)
setFont(30)mStr(text.modes[sel][2],1100,50)
gc.setColor(1,1,1)
setFont(28)gc.printf(text.modes[sel][3],920,110,360,"center")
if M.slowMark then
gc.draw(IMG.ctrlSpeedLimit,1230,50,nil,.4)
end
if M.score then
mText(drawableText.highScore,1100,240)
gc.setColor(.4,.4,.4,.8)
gc.rectangle("fill",940,290,320,280)--Highscore board
local L=M.records
gc.setColor(1,1,1)
if L[1]then
for i=1,#L do
local t=M.scoreDisp(L[i])
local s=#t
local dy
if s<15 then dy=0
elseif s<25 then dy=2
else dy=4
end
setFont(int(26-s*.4))
gc.print(t,955,275+dy+25*i)
setFont(10)
_=L[i].date
if _ then gc.print(_,1155,284+25*i)end
end
else
mText(drawableText.noScore,1100,370)
end
end
end
if cam.keyCtrl then
gc.setColor(1,1,1)
gc.draw(TEXTURE.mapCross,460-20,360-20)
end
end
function Pnt.music()
gc.setColor(1,1,1,.3+sin(Timer()*5)*.2)
gc.rectangle("fill",45,98+30*sceneTemp,250,30)
gc.setColor(.7,.7,.7)
gc.draw(drawableText.musicRoom,20,20)
gc.setColor(1,1,1)
gc.draw(drawableText.musicRoom,22,23)
gc.draw(drawableText.nowPlaying,490,390)
setFont(30)
for i=1,BGM.len do
gc.print(BGM.list[i],50,90+30*i)
end
gc.draw(IMG.title,640,310,nil,1.5,nil,206,35)
if BGM.nowPlay then
setFont(45)
gc.setColor(sin(Timer()*.5)*.2+.8,sin(Timer()*.7)*.2+.8,sin(Timer())*.2+.8)
mStr(BGM.nowPlay,630,460)
local t=-Timer()%2.3/2
if t<1 then
gc.setColor(1,1,1,t)
gc.draw(IMG.title_color,640,310,nil,1.5+.1-.1*t,1.5+.3-.3*t,206,35)
end
end
end
function Pnt.custom()
gc.setColor(1,1,1,.3+sin(Timer()*8)*.2)
gc.rectangle("fill",100,115+40*sceneTemp,570,40)
gc.setColor(.7,.7,.7)gc.draw(drawableText.custom,360,20)
gc.setColor(1,1,1)gc.draw(drawableText.custom,362,23)
setFont(35)
for i=1,#customID do
local k=customID[i]
local y=110+40*i
gc.printf(text.customOption[k],100,y,320,"right")
if text.customVal[k]then
gc.print(text.customVal[k][customSel[i]],440,y)
else
gc.print(customRange[k][customSel[i]],440,y)
end
end
end
function Pnt.sequence()
local s=sceneTemp
gc.setColor(.7,.7,.7)gc.draw(drawableText.sequence,120,-15)
gc.setColor(1,1,1)gc.draw(drawableText.sequence,122,-12)
gc.setLineWidth(4)
gc.rectangle("line",100,100,1080,260)
setFont(30)
local bag=preBag
local len=#bag
setFont(40)
gc.print(len,120,300)
local L=TEXTURE.miniBlock
local x,y=120,126
local cx,cy=120,126
for i=1,len do
local B=L[bag[i]]
gc.draw(B,x,y,nil,15,15,0,B:getHeight()*.5)
x=x+B:getWidth()*15+10
if x>1126 then
x,y=120,y+50
end
if i==s.cur then
cx,cy=x,y
end
end
gc.setColor(.5,1,.5,.6+.4*sin(Timer()*6.26))
gc.line(cx-5,cy-20,cx-5,cy+20)
--Confirm reset
if s.sure>0 then
gc.setColor(1,1,1,s.sure*.02)
gc.draw(drawableText.question,1035,570)
end
end
function Pnt.draw()
local sx,sy=sceneTemp.x,sceneTemp.y
gc.translate(200,60)
gc.setColor(1,1,1,.2)
gc.setLineWidth(1)
for x=1,9 do gc.line(30*x,0,30*x,600)end
for y=0,19 do gc.line(0,30*y,300,30*y)end
gc.setColor(1,1,1)
gc.setLineWidth(3)
gc.rectangle("line",-2,-2,304,604)
gc.setLineWidth(2)
local cross=puzzleMark[-1]
for y=1,20 do for x=1,10 do
local B=preField[y][x]
if B>0 then
gc.draw(blockSkin[B],30*x-30,600-30*y)
elseif B==-1 and not sceneTemp.demo then
gc.draw(cross,30*x-30,600-30*y)
end
end end
if sx and sy then
gc.setLineWidth(2)
gc.rectangle("line",30*sx-30,600-30*sy,30,30)
end
gc.translate(-200,-60)
--Pen
local pen=sceneTemp.pen
if pen>0 then
gc.setLineWidth(13)
gc.setColor(SKIN.libColor[pen])
gc.rectangle("line",565,460,70,70)
elseif pen==-1 then
gc.setLineWidth(5)
gc.setColor(.9,.9,.9)
gc.line(575,470,625,520)
gc.line(575,520,625,470)
end
--Confirm reset
if sceneTemp.sure>0 then
gc.setColor(1,1,1,sceneTemp.sure*.02)
gc.draw(drawableText.question,1040,430)
end
--Block name
setFont(40)
local _
for i=1,7 do
_=setting.skin[i]
gc.setColor(SKIN.libColor[_])
mStr(text.block[i],500+65*_,65)
end
end
function Pnt.play()
if marking then
setFont(26)
local t=Timer()
gc.setColor(1,1,1,.2+.1*(sin(3*t)+sin(2.6*t)))
mStr(text.marking,190,60+26*sin(t))
end
for p=1,#players do
players[p]:draw()
end
gc.setLineWidth(5)
for i=1,#FX_attack do
local A=FX_attack[i]
gc.push("transform")
local a=(A.t<10 and A.t*.05 or A.t>50 and 6-A.t*.1 or 1)*A.a
gc.setColor(A.r,A.g,A.b,a*.5)
gc.circle("line",0,0,A.rad,A.corner)
local L=A.drag
local len=#L
for i=1,len,2 do
gc.setColor(A.r,A.g,A.b,.4*a*i/len)
gc.translate(L[i],L[i+1])
gc.rotate(A.t*.1)
gc.circle("fill",0,0,A.rad,A.corner)
gc.rotate(-A.t*.1)
gc.translate(-L[i],-L[i+1])
end
gc.setColor(A.r,A.g,A.b,a)
gc.translate(A.x,A.y)
gc.rotate(A.t*.1)
gc.circle("fill",0,0,A.rad,A.corner)
gc.pop()
end--FX animation
gc.setColor(1,1,1)
if setting.VKSwitch then drawVirtualkey()end
if modeEnv.royaleMode then
for i=1,#FX_badge do
local b=FX_badge[i]
gc.setColor(1,1,1,b.t<10 and b.t*.1 or b.t<50 and 1 or(60-b.t)*.1)
if b.t<10 then
gc.draw(IMG.badgeIcon,b[1]-14,b[2]-14)
elseif b.t<50 then
local t=((b.t-10)*.025)t=(3-2*t)*t*t
gc.draw(IMG.badgeIcon,b[1]*(1-t)+b[3]*t-14,b[2]*(1-t)+b[4]*t-14)
else
gc.draw(IMG.badgeIcon,b[3]-14,b[4]-14)
end
end
local P=players[1]
gc.setLineWidth(5)
gc.setColor(.8,1,0,.2)
for i=1,#P.atker do
local p=P.atker[i]
gc.line(p.centerX,p.centerY,P.x+300*P.size,P.y+670*P.size)
end
if P.atkMode~=4 then
if P.atking then drawAtkPointer(P.atking.centerX,P.atking.centerY)end
else
for i=1,#P.atker do
local p=P.atker[i]
drawAtkPointer(p.centerX,p.centerY)
end
end
end
--Mode info
gc.setColor(1,1,1,.8)
gc.draw(drawableText.modeName,485,10)
gc.draw(drawableText.levelName,511+drawableText.modeName:getWidth(),10)
--Danger
gc.push("transform")
gc.origin()
if restartCount>0 then
gc.setColor(0,0,0,restartCount*.05)
gc.rectangle("fill",0,0,scr.w*scr.dpi,scr.h*scr.dpi)
end
if game.warnLVL>0 then
gc.setColor(0,0,0,0)
SHADER.warning:send("level",game.warnLVL)
gc.setShader(SHADER.warning)
gc.rectangle("fill",0,0,scr.w,scr.h)
gc.setShader()
end
gc.pop()
end
local hexList={1,0,.5,1.732*.5,-.5,1.732*.5}for i=1,6 do hexList[i]=hexList[i]*150 end
local textPos={90,131,-90,131,-200,-25,-90,-181,90,-181,200,-25}
local dataPos={90,143,-90,143,-200,-13,-90,-169,90,-169,200,-13}
function Pnt.pause()
local S=sceneTemp
local T=S.timer*.02
if T<1 or game.result then Pnt.play()end
--Dark BG
local _=T
if game.result then _=_*.7 end
gc.setColor(.15,.15,.15,_)
gc.push("transform")
gc.origin()
gc.rectangle("fill",0,0,scr.w*scr.dpi,scr.h*scr.dpi)
gc.pop()
--Pause Info
setFont(25)
if game.pauseCount>0 then
gc.setColor(1,.4,.4,T)
gc.print(text.pauseCount..":["..game.pauseCount.."] "..format("%.2f",game.pauseTime).."s",70,100)
end
gc.setColor(1,1,1,T)
--Mode Info
_=drawableText.modeName
gc.draw(_,40,180)
gc.draw(drawableText.levelName,60+_:getWidth(),180)
--Result Text
setFont(35)
mText(game.result and drawableText[game.result]or drawableText.pause,640,50-10*(5-sceneTemp.timer*.1)^1.5)
--Infos
if game.frame>180 then
_=S.list
setFont(26)
for i=1,10 do
gc.print(text.pauseStat[i],40,210+40*i)
gc.printf(_[i],195,210+40*i,300,"right")
end
end
--Radar Chart
if T>.5 and game.frame>180 then
T=T*2-1
gc.setLineWidth(2)
gc.push("transform")
gc.translate(1026,400)
--Polygon
gc.push("transform")
gc.scale((3-2*T)*T)
gc.setColor(1,1,1,T*(.5+.3*sin(Timer()*6.26)))gc.polygon("line",S.standard)
_=S.color
gc.setColor(_[1],_[2],_[3],T*.626)
_=S.val
for i=1,9,2 do
gc.polygon("fill",0,0,_[i],_[i+1],_[i+2],_[i+3])
end
gc.polygon("fill",0,0,_[11],_[12],_[1],_[2])
gc.setColor(1,1,1,T)gc.polygon("line",S.val)
gc.pop()
--Axes
gc.setColor(1,1,1,T)
for i=1,3 do
local x,y=hexList[2*i-1],hexList[2*i]
gc.line(-x,-y,x,y)
end
--Texts
local C
_=Timer()%6.2832
if _>3.1416 then
gc.setColor(1,1,1,-T*sin(_))
setFont(35)
C,_=text.radar,textPos
else
gc.setColor(1,1,1,T*sin(_))
setFont(18)
C,_=S.radar,dataPos
end
for i=1,6 do
mStr(C[i],_[2*i-1],_[2*i])
end
gc.pop()
end
end
function Pnt.setting_game()
gc.setColor(1,1,1)
mText(drawableText.setting_game,640,15)
gc.draw(blockSkin[int(Timer()*2)%11+1],720,540,Timer()%6.28319,2,nil,15,15)
end
function Pnt.setting_video()
gc.setColor(1,1,1)
mText(drawableText.setting_video,640,15)
end
function Pnt.setting_sound()
gc.setColor(1,1,1,.8)
mText(drawableText.setting_sound,640,15)
local t=Timer()
local _=sceneTemp.jump
local x,y=800,340+10*sin(t*.5)+(_-10)*_*.3
gc.translate(x,y)
gc.draw(IMG.miyaCH,0,0)
gc.setColor(1,1,1,.7)
gc.draw(IMG.miyaF1,4,47+4*sin(t*.9))
gc.draw(IMG.miyaF2,42,107+5*sin(t))
gc.draw(IMG.miyaF3,93,126+3*sin(t*.7))
gc.draw(IMG.miyaF4,129,98+3*sin(t*.7))
gc.translate(-x,-y)
end
local function timeConv(t)
return t.."F "..int(t*16.67).."ms"
end
function Pnt.setting_control()
--Testing grid line
gc.setLineWidth(4)
gc.setColor(1,1,1,.4)
gc.line(550,540,950,540)
gc.line(550,580,950,580)
gc.line(550,620,950,620)
for x=590,910,40 do
gc.line(x,530,x,630)
end
gc.setColor(1,1,1)
gc.line(550,530,550,630)
gc.line(950,530,950,630)
--Texts
gc.draw(drawableText.setting_control,80,50)
setFont(50)
gc.printf(text.preview,320,540,200,"right")
--Floating number
setFont(30)
local _=setting
mStr(timeConv(_.das),226+35*_.das,145)
mStr(timeConv(_.arr),226+35*_.arr,235)
mStr(timeConv(_.sddas),226+35*_.sddas,325)
mStr(timeConv(_.sdarr),226+35*_.sdarr,415)
--Testing O mino
_=blockSkin[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)
end
function Pnt.setting_key()
local s=sceneTemp
local a=.3+sin(Timer()*15)*.1
if s.kS then gc.setColor(1,.3,.3,a)else gc.setColor(1,.7,.7,a)end
gc.rectangle("fill",
s.kb<11 and 240 or 840,
45*s.kb+20-450*int(s.kb/11),
200,45
)
if s.jS then gc.setColor(.3,.3,.1,a)else gc.setColor(.7,.7,1,a)end
gc.rectangle("fill",
s.js<11 and 440 or 1040,
45*s.js+20-450*int(s.js/11),
200,45
)
--Selection rect
gc.setColor(1,.3,.3)
mText(drawableText.keyboard,340,30)
mText(drawableText.keyboard,940,30)
gc.setColor(.3,.3,1)
mText(drawableText.joystick,540,30)
mText(drawableText.joystick,1140,30)
gc.setColor(1,1,1)
setFont(26)
local b1,b2=keyMap[s.board],keyMap[s.board+2]
for N=1,20 do
if N<11 then
gc.printf(text.acts[N],47,45*N+22,180,"right")
mStr(b1[N],340,45*N+22)
mStr(b2[N],540,45*N+22)
else
gc.printf(text.acts[N],647,45*N-428,180,"right")
mStr(b1[N],940,45*N-428)
mStr(b2[N],1040,45*N-428)
end
end
gc.setLineWidth(2)
for x=40,1240,200 do
gc.line(x,65,x,515)
end
for y=65,515,45 do
gc.line(40,y,1240,y)
end
setFont(35)
gc.print(text.page..s.board,280,590)
gc.draw(drawableText.ctrlSetHelp,50,650)
end
function Pnt.setting_skin()
gc.setColor(1,1,1)
for N=1,7 do
local face=setting.face[N]
local B=blocks[N][face]
local x,y=-25+140*N-scs[N][face][2]*30,325+scs[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)
end
end end
gc.circle("fill",-10+140*N,340,sin(Timer()*10)+5)
end
for i=1,6 do
gc.draw(blockSkin[11+i],570+60*i,610,nil,2)
end
gc.draw(drawableText.setting_skin,80,50)
end
function Pnt.setting_touch()
gc.setColor(1,1,1)
gc.setLineWidth(7)gc.rectangle("line",340,15,600,690)
gc.setLineWidth(3)gc.rectangle("line",490,85,300,600)
VirtualkeyPreview()
local d=snapLevelValue[sceneTemp.snap]
if d>=10 then
gc.setLineWidth(3)
gc.setColor(1,1,1,sin(Timer()*4)*.1+.1)
for i=1,1280/d-1 do
gc.line(d*i,0,d*i,720)
end
for i=1,720/d-1 do
gc.line(0,d*i,1280,d*i)
end
end
end
function Pnt.setting_trackSetting()
gc.setColor(1,1,1)
mText(drawableText.VKTchW,140+50*setting.VKTchW,260)
mText(drawableText.VKOrgW,140+50*setting.VKTchW+50*setting.VKCurW,320)
mText(drawableText.VKCurW,640+50*setting.VKCurW,380)
end
function Pnt.help()
setFont(20)
gc.setColor(1,1,1)
for i=1,#text.help do
gc.printf(text.help[i],150,35*i+40,1000,"center")
end
setFont(19)
gc.print(text.used,30,330)
gc.draw(IMG.title,280,610,.1,1+.05*sin(Timer()*2.6),nil,206,35)
gc.setLineWidth(3)
gc.rectangle("line",18,18,263,263)
gc.rectangle("line",1012,18,250,250)
gc.draw(IMG.pay1,20,20)
gc.draw(IMG.pay2,1014,20)
setFont(20)
mStr(text.group,640,490)
gc.setColor(1,1,1,sin(Timer()*20)*.3+.6)
setFont(30)
mStr(text.support,150+sin(Timer()*4)*20,283)
mStr(text.support,1138-sin(Timer()*4)*20,270)
end
function Pnt.staff()
local L=text.staff
local t=sceneTemp.time
setFont(40)
for i=1,#L do
mStr(L[i],640,800+80*i-t*40)
end
mDraw(IMG.title_color,640,800-t*40,nil,2)
mDraw(IMG.title_color,640,2160-t*40,nil,2)
end
function Pnt.stat()
local chart=sceneTemp.chart
setFont(24)
local _,__=SKIN.libColor,setting.skin
local A,B=chart.A1,chart.A2
for x=1,7 do
gc.setColor(_[__[x]])
mStr(text.block[x],80*x,40)
mStr(text.block[x],80*x,280)
for y=1,4 do
mStr(A[x][y],80*x,40+40*y)
mStr(B[x][y],80*x,280+40*y)
end
mStr(chart.Y1[x],80*x,240)
mStr(chart.Y2[x],80*x,480)
end
gc.setColor(1,1,1)
A,B=chart.X1,chart.X2
mStr(text.stat.spin,650,45)
mStr(text.stat.clear,650,285)
for y=1,4 do
mStr(A[y],650,40+40*y)
mStr(B[y],650,280+40*y)
end
setFont(22)
for i=1,11 do
gc.print(sceneTemp.item[i],740,40*i+10)
end
gc.setLineWidth(4)
for x=1,8 do
x=80*x-40
gc.line(x,80,x,240)
gc.line(x,320,x,480)
end
for y=2,6 do
gc.line(40,40*y,600,40*y)
gc.line(40,240+40*y,600,240+40*y)
end
gc.draw(IMG.title,260,615,.2+.04*sin(Timer()*3),nil,nil,206,35)
end
function Pnt.history()
gc.setColor(.2,.2,.2,.7)
gc.rectangle("fill",30,45,1000,632)
gc.setColor(1,1,1)
gc.setLineWidth(4)
gc.rectangle("line",30,45,1000,632)
setFont(20)
local _=sceneTemp
gc.print(_[1][_[2]],40,50)
end
return Pnt

373
Zframework/scene.lua Normal file
View File

@@ -0,0 +1,373 @@
local gc=love.graphics
local int,max,log=math.floor,math.max,math.log
local rnd,sin,cos=math.random,math.sin,math.cos
local format=string.format
local scr=scr
local SCN={
cur="load",--Current scene
swapping=false,--ifSwapping
swap={
tar=nil, --Swapping target
style=nil, --Swapping style
mid=nil, --Loading point
time=nil, --Full swap time
draw=nil, --Swap draw func
},
seq={"quit","slowFade"},--Back sequence
}--scene datas,returned
local sceneInit={}
sceneInit.quit=love.event.quit
function sceneInit.load()
sceneTemp={
phase=1,--Loading stage
cur=1,--Counter
tar=#VOC.name,--Loading bar lenth(current)
tip=require("parts/getTip"),
list={
#VOC.name,
#BGM.list,
#SFX.list,
IMG.getCount(),
#Modes,
1,
},
skip=false,--If skipped
}
end
function sceneInit.intro()
BG.set("space")
sceneTemp={
t1=0,--Timer 1
t2=0,--Timer 2
r={},--Random animation type
}
for i=1,8 do
sceneTemp.r[i]=rnd(5)
end
BGM.play("blank")
end
function sceneInit.main()
BG.set("space")
BGM.play("blank")
destroyPlayers()
modeEnv={}
if not players[1]then
PLY.newDemoPlayer(1,900,35,1.1)
end--Create demo player
end
function sceneInit.music()
if BGM.nowPlay then
for i=1,BGM.len do
if BGM.list[i]==BGM.nowPlay then
sceneTemp=i--Music selected
return
end
end
else
sceneTemp=1
end
end
function sceneInit.mode(org)
BG.set("space")
BGM.play("blank")
destroyPlayers()
local cam=mapCam
cam.zoomK=org=="main"and 5 or 1
if cam.sel then
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
end
function sceneInit.custom()
sceneTemp=1--Option selected
destroyPlayers()
BG.set(customRange.bg[customSel[12]])
BGM.play(customRange.bgm[customSel[13]])
end
function sceneInit.sequence()
sceneTemp={cur=#preBag,sure=0}
end
function sceneInit.draw()
BG.set("space")
sceneTemp={
sure=0,
pen=1,
x=1,y=1,
demo=false,
}
end
function sceneInit.play()
love.keyboard.setKeyRepeat(false)
restartCount=0
if needResetGameData then
resetGameData()
needResetGameData=nil
end
BG.set(modeEnv.bg)
end
function sceneInit.pause(org)
if
org=="setting_game"or
org=="setting_video"or
org=="setting_sound"
then
TEXT.show(text.needRestart,640,440,50,"fly",.6)
end
local S=players[1].stat
sceneTemp={
timer=org=="play"and 0 or 50,
list={
toTime(S.time),
S.key.."/"..S.rotate.."/"..S.hold,
format("%d %.2fPPS",S.piece,S.piece/S.time),
format("%d(%d) %.2fLPM",S.row,S.dig,S.row/S.time*60),
format("%d(%d) %.2fAPM",S.atk,S.digatk,S.atk/S.time*60),
format("%d(%d-%d)",S.pend,S.recv,S.recv-S.pend),
format("%d/%d/%d/%d",S.clears[1],S.clears[2],S.clears[3],S.clears[4]),
format("(%d)/%d/%d/%d",S.spins[1],S.spins[2],S.spins[3],S.spins[4]),
format("%d/%d;%d/%d",S.b2b,S.b3b,S.pc,S.hpc),
format("%d[%.2f%%]",S.extraPiece,100*max(1-S.extraRate/S.piece,0)),
},
--from right-down, 60 degree each
radar={
(S.off+S.dig)/S.time*60,--DefPM
(S.off)/S.time*60, --OffPM
S.atk/S.time*60, --AtkPM
S.send/S.time*60, --SendPM
S.piece/S.time*24, --LinePM
S.dig/S.time*60, --DigPM
},
val={1/80,1/40,1/60,1/60,1/100,1/40},
timing=org=="play",
}
local _=sceneTemp
local A,B=_.radar,_.val
--Normalize Values
for i=1,6 do
B[i]=B[i]*A[i]if B[i]>1.26 then B[i]=1.26+log(B[i]-.26,10)end
end
for i=1,6 do
A[i]=format("%.2f",A[i])..text.radarData[i]
end
local f=1
for i=1,6 do
if B[i]>.5 then f=2 end
if B[i]>1 then f=3 break end
end
if f==1 then _.color,f={.4,.9,.5},1.25 --Vegetable
elseif f==2 then _.color,f={.4,.7,.9},1 --Normal
elseif f==3 then _.color,f={1,.3,.3},.626 --Diao
end
A={
120*.5*f, 120*3^.5*.5*f,
120*-.5*f, 120*3^.5*.5*f,
120*-1*f, 120*0*f,
120*-.5*f, 120*-3^.5*.5*f,
120*.5*f, 120*-3^.5*.5*f,
120*1*f, 120*0*f,
}
_.scale=f
_.standard=A
for i=6,1,-1 do
B[2*i-1],B[2*i]=B[i]*A[2*i-1],B[i]*A[2*i]
end
_.val=B
end
function sceneInit.setting_game()
BG.set("space")
end
function sceneInit.setting_video()
BG.set("space")
end
function sceneInit.setting_sound()
sceneTemp={last=0,jump=0}--last sound time,animation count(10 to 0)
BG.set("space")
end
function sceneInit.setting_control()
sceneTemp={
das=setting.das,
arr=setting.arr,
pos=0,
dir=1,
wait=30,
}
BG.set("game1")
end
function sceneInit.setting_key()
sceneTemp={
board=1,
kb=1,js=1,
kS=false,jS=false,
}
end
function sceneInit.setting_touch()
BG.set("game3")
sceneTemp={
default=1,
snap=1,
sel=nil,
}
end
function sceneInit.setting_touchSwitch()
BG.set("matrix")
end
function sceneInit.help()
BG.set("space")
end
function sceneInit.staff()
sceneTemp={
pw=0,
time=0,
v=1,
}
BG.set("space")
end
function sceneInit.stat()
local S=stat
local X1,X2,Y1,Y2={0,0,0,0},{0,0,0,0},{},{}
for i=1,7 do
local S,C=S.spin[i],S.clear[i]
Y1[i]=S[1]+S[2]+S[3]+S[4]
Y2[i]=C[1]+C[2]+C[3]+C[4]
for j=1,4 do
X1[j]=X1[j]+S[j]
X2[j]=X2[j]+C[j]
end
end
sceneTemp={
chart={
A1=S.spin,A2=S.clear,
X1=X1,X2=X2,
Y1=Y1,Y2=Y2,
},
item={
S.run,
S.game,
toTime(S.time),
S.key.." "..S.rotate.." "..S.hold,
S.piece.." "..S.row.." "..int(S.atk),
S.recv.." "..S.off.." "..S.pend,
S.dig.." "..int(S.digatk),
format("%.2f %.2f",S.atk/S.row,S.digatk/S.dig),
format("%d/%.3f%%",S.extraPiece,100*max(1-S.extraRate/S.piece,0)),
S.b2b.." "..S.b3b,
S.pc.." "..S.hpc,
},
}
for i=1,11 do
sceneTemp.item[i]=text.stat[i].."\t"..sceneTemp.item[i]
end
end
function sceneInit.history()
BG.set("game1")
sceneTemp={require("parts/updateLog"),1}--scroll pos
end
function sceneInit.debug()
sceneTemp={
ct=0,
}
end
function sceneInit.quit()
if rnd()>.000626 then
love.timer.sleep(.3)
love.event.quit()
else
error("So lucky! 0.0626 precent to get this!!! You can quit the game now.")
end
end
local swap={
none={1,0,NULL},
flash={8,1,function()gc.clear(1,1,1)end},
fade={30,15,function(t)
local t=t>15 and 2-t/15 or t/15
gc.setColor(0,0,0,t)
gc.rectangle("fill",0,0,scr.w*scr.dpi,scr.h*scr.dpi)
end},
fade_togame={120,20,function(t)
local t=t>20 and (120-t)/100 or t/20
gc.setColor(0,0,0,t)
gc.rectangle("fill",0,0,scr.w*scr.dpi,scr.h*scr.dpi)
end},
slowFade={180,90,function(t)
local t=t>90 and 2-t/90 or t/90
gc.setColor(0,0,0,t)
gc.rectangle("fill",0,0,scr.w*scr.dpi,scr.h*scr.dpi)
end},
}--Scene swapping animations
local backFunc={
load=love.event.quit,
pause=function()
love.keyboard.setKeyRepeat(true)
mergeStat(stat,players[1].stat)
TASK.clear("play")
end,
setting_game= function()FILE.saveSetting()end,
setting_video= function()FILE.saveSetting()end,
setting_sound= function()FILE.saveSetting()end,
setting_touch= function()FILE.saveVK()end,
setting_key= function()FILE.saveKeyMap()end,
setting_lang= function()FILE.saveSetting()end,
}
function SCN.swapUpdate()
local S=SCN.swap
S.time=S.time-1
if S.time==S.mid then
SCN.init(S.tar,SCN.cur)
SCN.cur=S.tar
WIDGET.set(Widgets[S.tar])
collectgarbage()
--Scene swapped this moment
end
if S.time==0 then
SCN.swapping=false
end
end
function SCN.init(s,org)
if sceneInit[s]then sceneInit[s](org)end
end
function SCN.push(tar,style)
if not SCN.swapping then
local m=#SCN.seq
SCN.seq[m+1]=tar or SCN.cur
SCN.seq[m+2]=style or"fade"
end
end
function SCN.pop()
local _=SCN.seq
_[#_-1]=nil
end
function SCN.swapTo(tar,style)
local S=SCN.swap
if not SCN.swapping and tar~=SCN.cur then
SCN.swapping=true
if not style then style="fade"end
S.tar=tar
S.style=style
local swap=swap[style]
S.time=swap[1]
S.mid=swap[2]
S.draw=swap[3]
end
end
function SCN.goto(tar,style)
SCN.push()SCN.swapTo(tar,style)
end
function SCN.back()
if backFunc[SCN.cur] then backFunc[SCN.cur]()end
--func when scene end
local m=#SCN.seq
if m>0 then
SCN.swapTo(SCN.seq[m-1],SCN.seq[m])
SCN.seq[m],SCN.seq[m-1]=nil
--Poll&Back to preScene
end
end
return SCN

77
Zframework/sfx.lua Normal file
View File

@@ -0,0 +1,77 @@
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",
"spawn_1","spawn_2","spawn_3","spawn_4","spawn_5","spawn_6","spawn_7",
"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,vol,pos,force)
if setting.sfx==0 and not force then return end
local S=SFX.list[s]--source list
if not S then return end
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
if not force then
S:setVolume((vol or 1)*setting.sfx*.1)
else
S:setVolume(vol*.1)
end
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

14
Zframework/shader.lua Normal file
View File

@@ -0,0 +1,14 @@
local function N(file)
return love.graphics.newShader("Zframework/shader/"..file..".glsl")
end
return{
-- glow=gc.newShader("Zframework/shader/glow.cs"),
alpha=N("alpha"),
warning=N("warning"),
aura=N("aura"),
gradient1=N("grad1"),--Horizonal red-blue gradient
gradient2=N("grad2"),--Vertical red-green gradient
rgb1=N("rgb1"),--colorful RGB
rgb2=N("rgb2"),--blue RGB
}

View File

@@ -0,0 +1,4 @@
extern float a;
vec4 effect(vec4 color,Image text,vec2 pos,vec2 scr_pos){
return vec4(1.,1.,1.,sign(Texel(text,pos).a)*a);
}

View File

@@ -0,0 +1,42 @@
#define PI 3.1415926535897932384626
extern float w,h;
extern float t;
vec4 effect(vec4 color,Image text,vec2 pos,vec2 scr_pos){
float x=scr_pos.x/w;
float y=scr_pos.y/h;
float dx,dy;
vec3 V=vec3(0.);
dx=0.5+cos(t*3.*0.26)*0.4-x;
dy=0.5-sin(t*3.*0.62)*0.4-y;
dx=sqrt(dx*dx+dy*dy);
V.r=V.r+smoothstep(1.26,0.,dx);
dx=(0.5+cos(t*3.*0.32)*0.4)-x;
dy=(0.5-sin(t*3.*0.80)*0.4)-y;
dx=sqrt(dx*dx+dy*dy);
V.g=V.g+smoothstep(1.26,0.,dx);
dx=(0.5-cos(t*3.*0.49)*0.4)-x;
dy=(0.5+sin(t*3.*0.18)*0.4)-y;
dx=sqrt(dx*dx+dy*dy);
V.b=V.b+smoothstep(1.26,0.,dx);
dx=(0.5+cos(t*0.53)*0.4)-x;
dy=(0.5-sin(t*0.46)*0.4)-y;
dx=sqrt(dx*dx+dy*dy);
V.rg+=vec2(smoothstep(0.626,0.,dx));
dx=(0.5+cos(t*0.98)*0.4)-x;
dy=(0.5+sin(t*0.57)*0.4)-y;
dx=sqrt(dx*dx+dy*dy);
V.rb+=vec2(smoothstep(0.626,0.,dx));
dx=(0.5-cos(t*0.86)*0.4)-x;
dy=(0.5-sin(t*0.32)*0.4)-y;
dx=sqrt(dx*dx+dy*dy);
V.gb+=vec2(smoothstep(0.626,0.,dx));
dx=1.626*max(max(V.r,V.g),V.b);
return vec4(V/dx,1.);
}

View File

@@ -0,0 +1,5 @@
extern float X,Y,W,H;
vec4 effect(vec4 C,Image Tx,vec2 pos,vec2 scr_pos){
C[3]=min((scr_pos.x-X)/W*0.3+(scr_pos.y-Y)/H*0.1,0.3)+0.5;
return C;
}

View File

@@ -0,0 +1,10 @@
extern float t,w;
vec4 effect(vec4 color,Image text,vec2 pos,vec2 scr_pos){
float x=scr_pos.x/w;
return vec4(
.8-x*.6,
.3+.2*sin(t),
.15+x*.7,
1.
);
}

View File

@@ -0,0 +1,10 @@
extern float t,h;
vec4 effect(vec4 color,Image text,vec2 pos,vec2 scr_pos){
float y=scr_pos.y/h;
return vec4(
.8-y*.6,
.2+y*.4,
.3+.1*sin(t),
1.
);
}

View File

@@ -0,0 +1,29 @@
#define PI 3.14159
extern float xresolution;
//sample from 1D vis-depth map
float samp(vec2 coord,float r,Image u_texture){
return step(r,Texel(u_texture,coord).r);
}
vec4 effect(vec4 color,Image texture,vec2 texture_coords,vec2 screen_coords){
//cartesian to polar, y of 1D sample is always 0
vec2 norm=texture_coords.st*2.-1.;
vec2 tc=vec2((atan(norm.y,norm.x)+PI)/(2.*PI),0.);
float r=length(norm);
//enlarge blur parameter by distance, light scattering simulation
float blur=(1./xresolution)*smoothstep(0.3,1.,r);
//Simple Gaussian blur
float sum=//brightness(0~1)
samp(vec2(tc.x-3.*blur,tc.y),r,texture)*0.1
+samp(vec2(tc.x-2.*blur,tc.y),r,texture)*0.13
+samp(vec2(tc.x-1.*blur,tc.y),r,texture)*0.17
+samp(tc,r,texture)*0.2//The center tex coord,which gives us hard shadows.
+samp(vec2(tc.x+1.*blur,tc.y),r,texture)*0.17
+samp(vec2(tc.x+2.*blur,tc.y),r,texture)*0.13
+samp(vec2(tc.x+3.*blur,tc.y),r,texture)*0.1;
//Multiply the distance to get a soft fading
return vec4(vec3(1.),sum*smoothstep(1.,0.,r));
}

View File

@@ -0,0 +1,11 @@
extern float t,w,h;
vec4 effect(vec4 color,Image text,vec2 pos,vec2 scr_pos){
float x=scr_pos.x/w;
float y=scr_pos.y/h;
return vec4(
.8-y*.7+.2*sin(t/6.26),
.2+y*.5+.15*sin(t/4.),
.2+x*.6-.1*sin(t/2.83),
1.
);
}

View File

@@ -0,0 +1,11 @@
extern float t,w,h;
vec4 effect(vec4 color,Image text,vec2 pos,vec2 scr_pos){
float x=scr_pos.x/w;
float y=scr_pos.y/h;
return vec4(
.4-y*.3-.1*sin(t/6.26),
.2+.1*sin(t),
abs(.7-x*1.2+y*.5*sin(t/16.)),
1.
);
}

View File

@@ -0,0 +1,21 @@
#define PI 3.14
extern float yresolution;
vec4 effect(vec4 color,Image texture,vec2 texture_coords,vec2 screen_coords){
//Iterate through the occluder map's y-axis.
for(float y=0.;y<yresolution;y++){
//cartesian to polar
// y/yresolution=distance to light source(0~1)
vec2 norm=vec2(texture_coords.s,y/yresolution)*2.-1.;
float theta=PI*1.5+norm.x*PI;
float r=(1.+norm.y)*0.5;
//sample from solid
if(
Texel(texture,(
vec2(-r*sin(theta),-r*cos(theta))*0.5+0.5//coord of solid sampling
))
.a>0.1
)return vec4(vec3(y/yresolution),1.);//collision check, alpha>0.1 means transparent
}
return vec4(1.,1.,1.,1.);//return max distance 1
}

View File

@@ -0,0 +1,8 @@
extern float w,h;
extern float level;
vec4 effect(vec4 color,Image text,vec2 pos,vec2 scr_pos){
float dx=abs(scr_pos.x/w-0.5);
float dy=abs(scr_pos.y/h-0.5);
float a=(max(dx,dy)*2.-.626)*level;
return vec4(1.,0.,0.,a);
}

42
Zframework/sysFX.lua Normal file
View File

@@ -0,0 +1,42 @@
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

58
Zframework/task.lua Normal file
View File

@@ -0,0 +1,58 @@
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.data)then
rem(tasks,i)
end
end
end
function TASK.new(code,data)
tasks[#tasks+1]={
code=code,
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
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
Zframework/text.lua Normal file
View File

@@ -0,0 +1,126 @@
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

308
Zframework/timer.lua Normal file
View File

@@ -0,0 +1,308 @@
local gc=love.graphics
local kb=love.keyboard
local Timer=love.timer.getTime
local int,abs,rnd,max,min,sin,ln=math.floor,math.abs,math.random,math.max,math.min,math.sin,math.log
local ins,rem=table.insert,table.remove
local Tmr={}
function Tmr.load()
local t=Timer()
local S=sceneTemp
repeat
if S.phase==1 then
VOC.loadOne(S.cur)
elseif S.phase==2 then
BGM.loadOne(S.cur)
elseif S.phase==3 then
SFX.loadOne(S.cur)
elseif S.phase==4 then
IMG.loadOne(S.cur)
elseif S.phase==5 then
local m=Modes[S.cur]--mode template
local M=require("modes/"..m.name)--mode file
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{}
-- M.icon=gc.newImage("image/modeIcon/"..m.icon..".png")
-- M.icon=gc.newImage("image/modeIcon/custom.png")
elseif S.phase==6 then
--------------------------Loading other little things here
SKIN.load()
stat.run=stat.run+1
--------------------------
SFX.play("welcome_sfx")
VOC.play("welcome")
else
S.cur=S.cur+1
S.tar=S.cur
if S.cur>62.6 then
SCN.swapTo("intro","none")
end
return
end
S.cur=S.cur+1
if S.cur>S.tar then
S.phase=S.phase+1
S.cur=1
S.tar=S.list[S.phase]
if not S.tar then
S.phase=0
S.tar=1
end
end
until not S.skip and Timer()-t>.01
end
function Tmr.intro()
local s=sceneTemp
s.t1=s.t1+1
s.t2=s.t2+1
end
function Tmr.main(dt)
players[1]:update(dt)
end
function Tmr.mode(dt)
local cam=mapCam
local x,y,k=cam.x,cam.y,cam.k
local F
if not SCN.swapping then
if kb.isDown("up", "w")then y=y-10*k;F=true end
if kb.isDown("down","s")then y=y+10*k;F=true end
if kb.isDown("left","a")then x=x-10*k;F=true end
if kb.isDown("right","d")then x=x+10*k;F=true end
local js1=joysticks[1]
if js1 then
local k=js1:getAxis(1)
if k~="c"then
if k=="u"or k=="ul"or k=="ur"then y=y-10*k;F=true end
if k=="d"or k=="dl"or k=="dl"then y=y+10*k;F=true end
if k=="l"or k=="ul"or k=="dl"then x=x-10*k;F=true end
if k=="r"or k=="ur"or k=="dr"then x=x+10*k;F=true end
end
end
end
if F or cam.keyCtrl and(x-cam.x1)^2+(y-cam.y1)^2>2.6 then
if F then
cam.keyCtrl=true
end
local x,y=(cam.x1-180)/cam.k1,cam.y1/cam.k1
for name,M in next,Modes do
if modeRanks[name]then
local SEL
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 SEL=name end
elseif M.shape==2 then
if abs(x-M.x)+abs(y-M.y)<s then SEL=name end
elseif M.shape==3 then
if(x-M.x)^2+(y-M.y)^2<s^2 then SEL=name end
end
if SEL and cam.sel~=SEL then
cam.sel=SEL
SFX.play("click")
end
end
end
end
if x>1850*k then x=1850*k
elseif x<-1000*k then x=-1000*k
end
if y>500*k then y=500*k
elseif y<-1900*k then y=-1900*k
end
cam.x,cam.y=x,y
--keyboard controlling
cam.x1=cam.x1*.85+x*.15
cam.y1=cam.y1*.85+y*.15
cam.k1=cam.k1*.85+k*.15
local _=SCN.swap.tar
cam.zoomMethod=_=="play"and 1 or _=="mode"and 2
if cam.zoomMethod==1 then
if cam.sel then
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
_=cam.zoomK
if _<.8 then _=_*1.05 end
if _<1.1 then _=_*1.05 end
cam.zoomK=_*1.05
elseif cam.zoomMethod==2 then
cam.zoomK=cam.zoomK^.9
end
end
function Tmr.sequence()
if sceneTemp.sure>0 then sceneTemp.sure=sceneTemp.sure-1 end
end
function Tmr.draw()
if sceneTemp.sure>0 then sceneTemp.sure=sceneTemp.sure-1 end
end
function Tmr.play(dt)
game.frame=game.frame+1
stat.time=stat.time+dt
local P1=players[1]
for i=#FX_attack,1,-1 do
local b=FX_attack[i]
b.t=b.t+1
if b.t>50 then
b.rad=b.rad*1.05+.1
b.x,b.y=b.x2,b.y2
elseif b.t>10 then
local t=((b.t-10)*.025)t=(3-2*t)*t*t
b.x,b.y=b.x1*(1-t)+b.x2*t,b.y1*(1-t)+b.y2*t
end
if b.t<60 then
local L=FX_attack[i].drag
if #L==4*setting.atkFX then
rem(L,1)rem(L,1)
end
ins(L,b.x)ins(L,b.y)
else
for i=i,#FX_attack do
FX_attack[i]=FX_attack[i+1]
end
end
end
for i=#FX_badge,1,-1 do
local b=FX_badge[i]
b.t=b.t+1
if b.t==60 then
rem(FX_badge,i)
end
end
local _
for i=1,#virtualkey do
_=virtualkey[i]
if _.pressTime>0 then
_.pressTime=_.pressTime-1
end
end
if game.frame<180 then
if game.frame==179 then
gameStart()
elseif game.frame==60 or game.frame==120 then
SFX.play("ready")
end
for p=1,#players do
local P=players[p]
if P.movDir~=0 then
if P.moving<P.gameEnv.das then
P.moving=P.moving+1
end
else
P.moving=0
end
end
if restartCount>0 then restartCount=restartCount-1 end
return
elseif P1.keyPressing[10]then
restartCount=restartCount+1
if restartCount>20 then
TASK.clear("play")
mergeStat(stat,P1.stat)
resetGameData()
return
end
elseif restartCount>0 then
restartCount=restartCount>2 and restartCount-2 or 0
end--Counting,include pre-das,directy RETURN,or restart counting
for p=1,#players do
local P=players[p]
P:update(dt)
end
if game.frame%120==0 then
if modeEnv.royaleMode then freshMostDangerous()end
end
if P1.alive then
if game.frame%26==0 and setting.warn then
local F=P1.field
local M=#F
local height=0--max height of row 4~7
for x=4,7 do
for y=M,1,-1 do
if F[y][x]>0 then
if y>height then
height=y
end
break
end
end
end
game.warnLVL0=ln(height-15+P1.atkBuffer.sum*.8)
end
local M=game.warnLVL
if M<game.warnLVL0 then
M=M*.95+game.warnLVL0*.05
elseif M>0 then
M=max(M-.026,0)
end
game.warnLVL=M
elseif game.warnLVL>0 then
game.warnLVL=max(game.warnLVL-.026,0)
end
end
function Tmr.pause(dt)
if not game.result then
game.pauseTime=game.pauseTime+dt
end
if sceneTemp.timer<50 then
sceneTemp.timer=sceneTemp.timer+1
end
end
function Tmr.setting_sound()
local t=sceneTemp.jump
if t>0 then
sceneTemp.jump=t-1
end
end
function Tmr.setting_control()
local T=sceneTemp
if T.wait>0 then
T.wait=T.wait-1
if T.wait==0 then
T.pos=T.pos+T.dir
else
return
end
end
if T.das>0 then
T.das=T.das-1
if T.das==0 then
T.pos=T.pos+T.dir
end
else
T.arr=T.arr-1
if T.arr==0 then
T.pos=T.pos+T.dir
T.arr=setting.arr
elseif T.arr==-1 then
T.pos=T.dir>0 and 8 or 0
T.arr=setting.arr
end
if T.pos%8==0 then
T.dir=-T.dir
T.wait=26
T.das=setting.das
end
end
end
function Tmr.staff(dt)
local S=sceneTemp
if kb.isDown("space","return")and S.v<6.26 then
S.v=S.v+.26
elseif S.v>1 then
S.v=S.v-.26
end
S.time=S.time+S.v*dt
if S.time>45 then
S.time=45
elseif S.time<-10 then
S.time=-10
end
end
return Tmr

42
Zframework/toolfunc.lua Normal file
View File

@@ -0,0 +1,42 @@
local gc=love.graphics
local int=math.floor
local format=string.format
local fontData=love.filesystem.newFile("font.ttf")
local newFont=gc.setNewFont
local setNewFont=gc.setFont
local fontCache,currentFontSize={}
function setFont(s)
local f=fontCache[s]
if s~=currentFontSize then
if f then
setNewFont(f)
else
f=newFont(fontData,s)
fontCache[s]=f
setNewFont(f)
end
currentFontSize=s
end
return f
end
function toTime(s)
if s<60 then
return format("%.3fs",s)
elseif s<3600 then
return format("%d:%.2f",int(s/60),s%60)
else
local h=int(s/3600)
return format("%d:%d:%.2f",h,int(s/60%60),s%60)
end
end
function mStr(s,x,y)
gc.printf(s,x-450,y,900,"center")
end
function mText(s,x,y)
gc.draw(s,x-s:getWidth()*.5,y)
end
function mDraw(s,x,y,a,k)
gc.draw(s,x,y,a,k,nil,s:getWidth()*.5,s:getHeight()*.5)
end

8
Zframework/vib.lua Normal file
View File

@@ -0,0 +1,8 @@
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
Zframework/voice.lua Normal file
View File

@@ -0,0 +1,134 @@
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

443
Zframework/widget.lua Normal file
View File

@@ -0,0 +1,443 @@
local gc=love.graphics
local kb=love.keyboard
local int,abs=math.floor,math.abs
local format=string.format
local color=color
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:getCenter()
return self.x+self.w*.5,self.y+self.h*.5
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:getCenter()
return self.x,self.y
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
--Checked
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
--Frame
gc.setLineWidth(4)
gc.setColor(1,1,1,.6+self.ATV*.05)
gc.rectangle("line",x,y,50,50)
--Text
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:getCenter()
return self.x+self.w*(self.pos/self.unit),self.y
end
function slider:update()
local _=self.ATV
if WIDGET.sel==self then
if _<6 then self.ATV=_+1 end
else
if _>0 then 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
--Units
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
--Axis
gc.setLineWidth(4)
gc.line(x1,y,x2,y)
--Text
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
--Block
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
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.newText(D)
local _={
name= D.name,
x= D.x,
y= D.y,
align= D.align,
color= color[D.color]or D.color,
font= D.font,
hide= D.hide,
}for k,v in next,button do _[k]=v end return _
end
function WIDGET.newImage(D)
local _={
name= D.name,
x= D.x-w*.5,
y= D.y-h*.5,
w= D.w,
h= D.h,
color= color[D.color]or D.color,
font= D.font,
code= D.code,
hide= D.hide,
}for k,v in next,button do _[k]=v end return _
end
function WIDGET.newButton(D)
local _={
name= D.name,
x= D.x-D.w*.5,
y= D.y-D.h*.5,
w= D.w,
h= D.h,
resCtr={
D.x,D.y,
D.x-D.w*.35,D.y-D.h*.35,
D.x-D.w*.35,D.y+D.h*.35,
D.x+D.w*.35,D.y-D.h*.35,
D.x+D.w*.35,D.y+D.h*.35,
},
color= color[D.color]or D.color,
font= D.font,
code= D.code,
hide= D.hide,
}for k,v in next,button do _[k]=v end return _
end
function WIDGET.newSwitch(D)
local _={
name= D.name,
x= D.x,
y= D.y,
cx= D.x+25,
cy= D.y,
resCtr={
D.x+25,D.y,
},
font= D.font,
disp= D.disp,
code= D.code,
hide= D.hide,
}for k,v in next,switch do _[k]=v end return _
end
function WIDGET.newSlider(D)
local _={
name= D.name,
x= D.x,
y= D.y,
w= D.w,
cx= D.x+D.w*.5,
cy= D.y,
resCtr={
D.x,D.y,
D.x+D.w*.25,D.y,
D.x+D.w*.5,D.y,
D.x+D.w*.75,D.y,
D.x+D.w,D.y,
},
unit= D.unit,
font= D.font,
change= D.change,
disp= D.disp,
code= D.code,
hide= D.hide,
}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=="space"or i=="return"then
if WIDGET.sel then
WIDGET.press()
end
elseif kb.isDown("lshift","lalt","lctrl")then
--when hold [↑], control slider with left/right
if 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
elseif i=="up"or i=="down"or i=="left"or i=="right"then
if WIDGET.sel then
local W=WIDGET.sel
local WX,WY=W:getCenter()
local dir=(i=="right"or i=="down")and 1 or -1
local tar
local minDist=1e99
if i=="left"or i=="right"then
for i=1,#WIDGET.active do
local W1=WIDGET.active[i]
if W~=W1 then
local L=W1.resCtr
for j=1,#L,2 do
local x,y=L[j],L[j+1]
local dist=(x-WX)*dir
if dist>10 then
dist=dist+abs(y-WY)*6.26
if dist<minDist then
minDist=dist
tar=W1
end
end
end
end
end
else
for i=1,#WIDGET.active do
local W1=WIDGET.active[i]
if W~=W1 then
local L=W1.resCtr
for j=1,#L,2 do
local x,y=L[j],L[j+1]
local dist=(y-WY)*dir
if dist>10 then
dist=dist+abs(x-WX)*6.26
if dist<minDist then
minDist=dist
tar=W1
end
end
end
end
end
end
if tar then
WIDGET.sel=tar
end
else
WIDGET.sel=WIDGET.active[1]
end
end
end
local keyMirror={
dpup="up",
dpdown="down",
dpleft="left",
dpright="right",
start="return",
back="escape",
}
function WIDGET.gamepadPressed(i)
if i=="start"then
if WIDGET.sel then
WIDGET.press()
end
elseif i=="a"or i=="b"then
local W=WIDGET.sel
if W then
if W.type=="button"then
WIDGET.press()
elseif 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
elseif i=="dpup"or i=="dpdown"or i=="dpleft"or i=="dpright"then
WIDGET.keyPressed(keyMirror[i])
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

513
Zframework/widgetList.lua Normal file
View File

@@ -0,0 +1,513 @@
local ins,rem=table.insert,table.remove
local mobileHide=(system=="Android"or system=="iOS")and function()return true end
local function BACK()SCN.back()end
local virtualkeySet={
{
{1, 80, 720-200, 80},--moveLeft
{2, 320, 720-200, 80},--moveRight
{3, 1280-80, 720-200, 80},--rotRight
{4, 1280-200, 720-80, 80},--rotLeft
{5, 1280-200, 720-320, 80},--rot180
{6, 200, 720-320, 80},--hardDrop
{7, 200, 720-80, 80},--softDrop
{8, 1280-320, 720-200, 80},--hold
{9, 1280-80, 280, 80},--func
{10,80, 280, 80},--restart
},--Farter's set,thanks
{
{1, 1280-320, 720-200, 80},--moveLeft
{2, 1280-80, 720-200, 80},--moveRight
{3, 200, 720-80, 80},--rotRight
{4, 80, 720-200, 80},--rotLeft
{5, 200, 720-320, 80},--rot180
{6, 1280-200, 720-320, 80},--hardDrop
{7, 1280-200, 720-80, 80},--softDrop
{8, 320, 720-200, 80},--hold
{9, 80, 280, 80},--func
{10,1280-80, 280, 80},--restart
},--Mirrored farter's set,sknaht
{
{1, 80, 720-80, 80},--moveLeft
{2, 240, 720-80, 80},--moveRight
{3, 1280-240, 720-80, 80},--rotRight
{4, 1280-400, 720-80, 80},--rotLeft
{5, 1280-240, 720-240, 80},--rot180
{6, 1280-80, 720-80, 80},--hardDrop
{7, 1280-80, 720-240, 80},--softDrop
{8, 1280-80, 720-400, 80},--hold
{9, 80, 360, 80},--func
{10,80, 80, 80},--restart
},--Author's set,not recommend
{
{1, 1280-400, 720-80, 80},--moveLeft
{2, 1280-80, 720-80, 80},--moveRight
{3, 240, 720-80, 80},--rotRight
{4, 80, 720-80, 80},--rotLeft
{5, 240, 720-240, 80},--rot180
{6, 1280-240, 720-240, 80},--hardDrop
{7, 1280-240, 720-80, 80},--softDrop
{8, 1280-80, 720-240, 80},--hold
{9, 80, 720-240, 80},--func
{10,80, 320, 80},--restart
},--Keyboard set
{
{10,70, 50,30},--restart
{9, 130, 50,30},--func
{4, 190, 50,30},--rotLeft
{3, 250, 50,30},--rotRight
{5, 310, 50,30},--rot180
{1, 370, 50,30},--moveLeft
{2, 430, 50,30},--moveRight
{8, 490, 50,30},--hold
{7, 550, 50,30},--softDrop1
{6, 610, 50,30},--hardDrop
{11,670, 50,30},--insLeft
{12,730, 50,30},--insRight
{13,790, 50,30},--insDown
{14,850, 50,30},--down1
{15,910, 50,30},--down4
{16,970, 50,30},--down10
{17,1030, 50,30},--dropLeft
{18,1090, 50,30},--dropRight
{19,1150, 50,30},--addLeft
{20,1210, 50,30},--addRight
},--PC key feedback(top&in a row)
}
--Lambda Funcs for widgets,delete at file end
local function SETval(k) return function()return setting[k] end end
local function SETsto(k) return function(i)setting[k]=i end end
local function SETrev(k) return function()setting[k]=not setting[k] end end
local function pressKey(k) return function()love.keypressed(k) end end
local function setPen(i) return function()sceneTemp.pen=i end end
local function prevSkin(n) return function()SKIN.prev(n) end end
local function nextSkin(n) return function()SKIN.next(n) end end
local function nextDir(n) return function()SKIN.rotate(n) end end
local function VKAdisp(n) return function()return VK_org[n].ava end end
local function VKAcode(n) return function()VK_org[n].ava=not VK_org[n].ava end end
local function setLang(n) return function()LANG.set(n)setting.lang=n end end
--newXXX
newText=WIDGET.newText
newImage=WIDGET.newImage
newButton=WIDGET.newButton
newSwitch=WIDGET.newSwitch
newSlider=WIDGET.newSlider
--All widgets
local Widgets={
load={},intro={},quit={},
main={
newButton({name="play", x=150,y=280,w=200,h=160,color="lRed", font=55,code=function()SCN.goto("mode")end}),
newButton({name="setting", x=370,y=280,w=200,h=160,color="lBlue", font=45,code=function()SCN.goto("setting_game")end}),
newButton({name="music", x=590,y=280,w=200,h=160,color="lPurple",font=32,code=function()SCN.goto("music")end}),
newButton({name="help", x=150,y=460,w=200,h=160,color="lYellow",font=50,code=function()SCN.goto("help")end}),
newButton({name="stat", x=370,y=460,w=200,h=160,color="lCyan", font=43,code=function()SCN.goto("stat")end}),
newButton({name="qplay", x=590,y=460,w=200,h=160,color="lOrange",font=43,code=function()SCN.push()loadGame(stat.lastPlay)end}),
newButton({name="lang", x=150,y=610,w=160,h=100,color="lGreen", font=45,code=function()SCN.goto("setting_lang")end}),
newButton({name="quit", x=590,y=610,w=160,h=100,color="lGrey", font=45,code=function()VOC.play("bye")SCN.swapTo("quit","slowFade")end}),
},
mode={
newButton({name="setting",x=1100,y=540,w=240,h=90,color="lGreen", font=40,code=function()
SCN.goto("custom")
end,
hide=function()
return mapCam.sel~="custom_clear" and mapCam.sel~="custom_puzzle"
end}),
newButton({name="start", x=1040,y=655,w=180,h=80,color="lGrey", font=40,code=pressKey("return"),hide=function()return not mapCam.sel end}),
newButton({name="back", x=1200,y=655,w=120,h=80,color="white", font=40,code=BACK}),
},
music={
newSlider({name="bgm", x=760, y=80, w=400,unit=10, font=35,change=function()BGM.freshVolume()end,disp=SETval("bgm"),code=SETsto("bgm")}),
newButton({name="up", x=1100, y=200, w=120,h=120, color="white", font=55,code=pressKey("up")}),
newButton({name="play", x=1100, y=340, w=120,h=120, color="white", font=35,code=pressKey("space"),hide=function()return setting.bgm==0 end}),
newButton({name="down", x=1100, y=480, w=120,h=120, color="white", font=55,code=pressKey("down")}),
newButton({name="back", x=640, y=630, w=230,h=90, color="white", font=40,code=BACK}),
},
custom={
newButton({name="up", x=1140, y=100, w=100,h=100, color="white", font=45,code=function()sceneTemp=(sceneTemp-2)%#customID+1 end}),
newButton({name="down", x=1140, y=340, w=100,h=100, color="white", font=45,code=function()sceneTemp=sceneTemp%#customID+1 end}),
newButton({name="left", x=1080, y=220, w=100,h=100, color="white", font=45,code=pressKey("left")}),
newButton({name="right", x=1200, y=220, w=100,h=100, color="white", font=45,code=pressKey("right")}),
newButton({name="set1", x=940, y=320, w=260,h=70, color="lYellow",font=32,code=pressKey("1")}),
newButton({name="set2", x=940, y=400, w=260,h=70, color="lYellow",font=32,code=pressKey("2")}),
newButton({name="set3", x=940, y=480, w=260,h=70, color="lYellow",font=32,code=pressKey("3")}),
newButton({name="set4", x=940, y=560, w=260,h=70, color="lYellow",font=32,code=pressKey("4")}),
newButton({name="set5", x=940, y=640, w=260,h=70, color="lYellow",font=32,code=pressKey("5")}),
newButton({name="seq", x=665, y=415, w=200,h=40, color="lGreen", font=30,code=pressKey("q")}),
newButton({name="draw", x=150, y=80, w=220,h=80, color="white", font=35,code=pressKey("e")}),
newButton({name="back", x=1200, y=640, w=120,h=120, color="white", font=35,code=BACK}),
},
sequence={
newButton({name="Z", x=150, y=440, w=90,h=90, color="white", font=50,code=pressKey(1)}),
newButton({name="S", x=250, y=440, w=90,h=90, color="white", font=50,code=pressKey(2)}),
newButton({name="J", x=350, y=440, w=90,h=90, color="white", font=50,code=pressKey(3)}),
newButton({name="L", x=450, y=440, w=90,h=90, color="white", font=50,code=pressKey(4)}),
newButton({name="T", x=550, y=440, w=90,h=90, color="white", font=50,code=pressKey(5)}),
newButton({name="O", x=650, y=440, w=90,h=90, color="white", font=50,code=pressKey(6)}),
newButton({name="I", x=750, y=440, w=90,h=90, color="white", font=50,code=pressKey(7)}),
newButton({name="Z5", x=150, y=540, w=90,h=90, color="dGrey",font=50,code=pressKey(8)}),
newButton({name="S5", x=250, y=540, w=90,h=90, color="dGrey",font=50,code=pressKey(9)}),
newButton({name="P", x=350, y=540, w=90,h=90, color="dGrey",font=50,code=pressKey(10)}),
newButton({name="Q", x=450, y=540, w=90,h=90, color="dGrey",font=50,code=pressKey(11)}),
newButton({name="F", x=550, y=540, w=90,h=90, color="dGrey",font=50,code=pressKey(12)}),
newButton({name="E", x=650, y=540, w=90,h=90, color="dGrey",font=50,code=pressKey(13)}),
newButton({name="T5", x=750, y=540, w=90,h=90, color="dGrey",font=50,code=pressKey(14)}),
newButton({name="U", x=850, y=540, w=90,h=90, color="dGrey",font=50,code=pressKey(15)}),
newButton({name="V", x=950, y=540, w=90,h=90, color="dGrey",font=50,code=pressKey(16)}),
newButton({name="W", x=150, y=640, w=90,h=90, color="dGrey",font=50,code=pressKey(17)}),
newButton({name="X", x=250, y=640, w=90,h=90, color="dGrey",font=50,code=pressKey(18)}),
newButton({name="J5", x=350, y=640, w=90,h=90, color="dGrey",font=50,code=pressKey(19)}),
newButton({name="L5", x=450, y=640, w=90,h=90, color="dGrey",font=50,code=pressKey(20)}),
newButton({name="R", x=550, y=640, w=90,h=90, color="dGrey",font=50,code=pressKey(21)}),
newButton({name="Y", x=650, y=640, w=90,h=90, color="dGrey",font=50,code=pressKey(22)}),
newButton({name="N", x=750, y=640, w=90,h=90, color="dGrey",font=50,code=pressKey(23)}),
newButton({name="H", x=850, y=640, w=90,h=90, color="dGrey",font=50,code=pressKey(24)}),
newButton({name="I5", x=950, y=640, w=90,h=90, color="dGrey",font=50,code=pressKey(25)}),
newButton({name="left", x=850, y=440, w=90,h=90, color="lGreen", font=55,code=pressKey("left")}),
newButton({name="right", x=950, y=440, w=90,h=90, color="lGreen", font=55,code=pressKey("right")}),
newButton({name="backsp", x=1050, y=440, w=90,h=90, color="lRed", font=50,code=pressKey("backspace")}),
newButton({name="reset", x=1050, y=540, w=90,h=90, color="lRed", font=50,code=pressKey("delete")}),
newButton({name="back", x=1200, y=640, w=120,h=120, color="white", font=35,code=BACK}),
},
draw={
newButton({name="b1", x=500+65*1, y=150,w=58,h=58, color="red", font=30,code=setPen(1)}),--B1
newButton({name="b2", x=500+65*2, y=150,w=58,h=58, color="orange", font=30,code=setPen(2)}),--B2
newButton({name="b3", x=500+65*3, y=150,w=58,h=58, color="yellow", font=30,code=setPen(3)}),--B3
newButton({name="b4", x=500+65*4, y=150,w=58,h=58, color="grass", font=30,code=setPen(4)}),--B4
newButton({name="b5", x=500+65*5, y=150,w=58,h=58, color="green", font=30,code=setPen(5)}),--B5
newButton({name="b6", x=500+65*6, y=150,w=58,h=58, color="water", font=30,code=setPen(6)}),--B6
newButton({name="b7", x=500+65*7, y=150,w=58,h=58, color="cyan", font=30,code=setPen(7)}),--B7
newButton({name="b8", x=500+65*8, y=150,w=58,h=58, color="blue", font=30,code=setPen(8)}),--B8
newButton({name="b9", x=500+65*9, y=150,w=58,h=58, color="purple", font=30,code=setPen(9)}),--B9
newButton({name="b10", x=500+65*10,y=150,w=58,h=58, color="magenta",font=30,code=setPen(10)}),--B10
newButton({name="b11", x=500+65*11,y=150,w=58,h=58, color="pink", font=30,code=setPen(11)}),--B11
newButton({name="b12", x=500+65*1, y=230,w=58,h=58, color="dGrey", font=30,code=setPen(12)}),--Bone
newButton({name="b13", x=500+65*2, y=230,w=58,h=58, color="grey", font=30,code=setPen(13)}),--GB1
newButton({name="b14", x=500+65*3, y=230,w=58,h=58, color="lGrey", font=30,code=setPen(14)}),--GB2
newButton({name="b15", x=500+65*4, y=230,w=58,h=58, color="dPurple",font=30,code=setPen(15)}),--GB3
newButton({name="b16", x=500+65*5, y=230,w=58,h=58, color="dRed", font=30,code=setPen(16)}),--GB4
newButton({name="b17", x=500+65*6, y=230,w=58,h=58, color="dGreen", font=30,code=setPen(17)}),--GB5
newButton({name="any", x=600, y=360, w=120,h=120, color="lGrey", font=40,code=setPen(0)}),
newButton({name="space", x=730, y=360, w=120,h=120, color="grey", font=65,code=setPen(-1)}),
newButton({name="clear", x=1200, y=500, w=120,h=120, color="white", font=40,code=pressKey("delete")}),
newSwitch({name="demo", x=755, y=640, font=30,disp=function()return sceneTemp.demo end,code=function()sceneTemp.demo=not sceneTemp.demo end}),
newButton({name="copy", x=920, y=640, w=120,h=120, color="lRed", font=35,code=function()copyBoard()end}),
newButton({name="paste", x=1060, y=640, w=120,h=120, color="lBlue", font=35,code=function()pasteBoard()end}),
newButton({name="custom", x=110, y=80, w=140,h=80, color="white", font=35,code=function()SCN.goto("custom")end}),
newButton({name="back", x=1200, y=640, w=120,h=120, color="white", font=35,code=BACK}),
},
play={
newButton({name="pause", x=1235, y=45, w=80,h=80, color="white", font=25,code=function()pauseGame()end}),
},
pause={
newButton({name="resume", x=640,y=290,w=240,h=100,color="white",font=30,code=function()resumeGame()end}),
newButton({name="restart", x=640,y=445,w=240,h=100,color="white",font=33,
code=function()
TASK.removeTask_code(TICK.autoPause)
mergeStat(stat,players[1].stat)
resetGameData()
SCN.swapTo("play","none")
end}),
newButton({name="setting", x=1120, y=70, w=240,h=90, color="lBlue",font=35,
code=function()
SCN.goto("setting_sound")
end}),
newButton({name="quit", x=640, y=600, w=240,h=100,color="white",font=35,code=BACK}),
},
setting_game={
newButton({name="graphic", x=200, y=80, w=240,h=80, color="lCyan", font=35,code=function()SCN.swapTo("setting_video")end}),
newButton({name="sound", x=1080, y=80, w=240,h=80, color="lCyan", font=35,code=function()SCN.swapTo("setting_sound")end}),
newButton({name="ctrl", x=290, y=220, w=320,h=80, color="lYellow",font=35,code=function()SCN.goto("setting_control")end}),
newButton({name="key", x=640, y=220, w=320,h=80, color="lGreen", font=35,code=function()SCN.goto("setting_key")end}),
newButton({name="touch", x=990, y=220, w=320,h=80, color="lBlue", font=35,code=function()SCN.goto("setting_touch")end}),
newSlider({name="reTime", x=350, y=340, w=300,unit=10, font=30,disp=SETval("reTime"), code=SETsto("reTime")}),
newSlider({name="maxNext", x=350, y=440, w=300,unit=6, font=30,disp=SETval("maxNext"), code=SETsto("maxNext")}),
newSwitch({name="autoPause",x=350, y=540, font=20,disp=SETval("autoPause"),code=SETrev("autoPause")}),
newButton({name="layout", x=590, y=540, w=140,h=70,color="white", font=35,code=function()
SCN.goto("setting_skin")
end}),
newSwitch({name="quickR", x=1050,y=320,font=35, disp=SETval("quickR"), code=SETrev("quickR")}),
newSwitch({name="swap", x=1050,y=400,font=20, disp=SETval("swap"), code=SETrev("swap")}),
newSwitch({name="fine", x=1050,y=480,font=20, disp=SETval("fine"), code=SETrev("fine")}),
newButton({name="back", x=1140,y=650,w=200,h=80,color="white",font=40,code=BACK}),
},
setting_video={
newButton({name="sound", x=200, y=80,w=240,h=80,color="lCyan",font=35,code=function()SCN.swapTo("setting_sound")end}),
newButton({name="game", x=1080, y=80,w=240,h=80,color="lCyan",font=35,code=function()SCN.swapTo("setting_game")end}),
newSwitch({name="ghost", x=250, y=180,font=35, disp=SETval("ghost"), code=SETrev("ghost")}),
newSwitch({name="smooth", x=250, y=260,font=25, disp=SETval("smooth"), code=SETrev("smooth")}),
newSwitch({name="center", x=500, y=180,font=35, disp=SETval("center"), code=SETrev("center")}),
newSwitch({name="grid", x=500, y=260,font=30, disp=SETval("grid"), code=SETrev("grid")}),
newSwitch({name="bagLine", x=730, y=180,font=30, disp=SETval("bagLine"), code=SETrev("bagLine")}),
newSlider({name="lockFX", x=350, y=340,w=373,unit=3, font=32,disp=SETval("lockFX"), code=SETsto("lockFX")}),
newSlider({name="dropFX", x=350, y=400,w=373,unit=5, font=32,disp=SETval("dropFX"), code=SETsto("dropFX")}),
newSlider({name="clearFX", x=350, y=460,w=373,unit=3, font=32,disp=SETval("clearFX"), code=SETsto("clearFX")}),
newSlider({name="shakeFX", x=350, y=520,w=373,unit=5, font=32,disp=SETval("shakeFX"), code=SETsto("shakeFX")}),
newSlider({name="atkFX", x=350, y=580,w=373,unit=5, font=32,disp=SETval("atkFX"), code=SETsto("atkFX")}),
newSlider({name="frame", x=350, y=640,w=373,unit=10,font=30,
disp=function()
return setting.frameMul>35 and setting.frameMul/10 or setting.frameMul/5-4
end,
code=function(i)
setting.frameMul=i<5 and 5*i+20 or 10*i
end}),
newSwitch({name="text", x=1050, y=180, font=35,disp=SETval("text"),code=SETrev("text")}),
newSwitch({name="warn", x=1050, y=260, font=35,disp=SETval("warn"),code=SETrev("warn")}),
newSwitch({name="fullscreen",x=1050,y=340, font=35,disp=SETval("fullscreen"),
code=function()
setting.fullscreen=not setting.fullscreen
love.window.setFullscreen(setting.fullscreen)
love.resize(love.graphics.getWidth(),love.graphics.getHeight())
end}),
newSwitch({name="bg", x=1050, y=420, font=35,disp=SETval("bg"),
code=function()
BG.set("none")
setting.bg=not setting.bg
BG.set("space")
end}),
newSwitch({name="power", x=1050, y=500,font=35,disp=SETval("powerInfo"),
code=function()
setting.powerInfo=not setting.powerInfo
end}),
newButton({name="back", x=1140, y=650,w=200,h=80,color="white",font=40,code=BACK}),
},
setting_sound={
newButton({name="game", x=200, y=80,w=240,h=80,color="lCyan",font=35,code=function()SCN.swapTo("setting_game")end}),
newButton({name="graphic", x=1080, y=80,w=240,h=80,color="lCyan",font=35,code=function()SCN.swapTo("setting_video")end}),
newSlider({name="sfx", x=180, y=200,w=400,unit=10,font=35,change=function()SFX.play("blip_1")end, disp=SETval("sfx"), code=SETsto("sfx")}),
newSlider({name="stereo", x=180, y=500,w=400,unit=10,font=35,change=function()SFX.play("move",1,-1)SFX.play("lock",1,1)end, disp=SETval("stereo"), code=SETsto("stereo"),hide=function()return setting.sfx==0 end}),
newSlider({name="spawn", x=180, y=300,w=400,unit=10,font=30,change=function()SFX.play("spawn_1",setting.spawn,nil,true)end, disp=SETval("spawn"), code=SETsto("spawn")}),
newSlider({name="bgm", x=180, y=400,w=400,unit=10,font=35,change=function()BGM.freshVolume()end, disp=SETval("bgm"), code=SETsto("bgm")}),
newSlider({name="vib", x=750, y=200,w=400,unit=5, font=28,change=function()VIB(2)end, disp=SETval("vib"), code=SETsto("vib")}),
newSlider({name="voc", x=750, y=300,w=400,unit=10,font=32,change=function()VOC.play("nya")end, disp=SETval("voc"), code=SETsto("voc")}),
newButton({name="back", x=1140, y=650,w=200,h=80,color="white",font=40,code=BACK}),
},
setting_control={
newSlider({name="das", x=226, y=200,w=910, unit=26, font=30,disp=SETval("das"), code=SETsto("das")}),
newSlider({name="arr", x=226, y=290,w=525, unit=15, font=30,disp=SETval("arr"), code=SETsto("arr")}),
newSlider({name="sddas", x=226, y=380,w=350, unit=10, font=30,disp=SETval("sddas"), code=SETsto("sddas")}),
newSlider({name="sdarr", x=226, y=470,w=140, unit=4, font=30,disp=SETval("sdarr"), code=SETsto("sdarr")}),
newSwitch({name="ihs", x=1100, y=290,font=30, disp=SETval("ihs"), code=SETrev("ihs")}),
newSwitch({name="irs", x=1100, y=380,font=30, disp=SETval("irs"), code=SETrev("irs")}),
newSwitch({name="ims", x=1100, y=470,font=30, disp=SETval("ims"), code=SETrev("ims")}),
newButton({name="reset", x=160, y=580,w=200,h=100,color="lRed",font=40,
code=function()
local _=setting
_.das,_.arr=10,2
_.sddas,_.sdarr=0,2
_.ihs,_.irs,_.ims=false,false,false
end}),
newButton({name="back", x=1140,y=650,w=200,h=80,color="white",font=40,code=BACK}),
},
setting_key={
newButton({name="back", x=1140,y=650,w=200,h=80,color="white",font=45,code=BACK}),
},
setting_skin={
newButton({name="prev", x=700,y=100,w=140,h=100,color="white",font=50,code=function()SKIN.prevSet()end}),
newButton({name="next", x=860,y=100,w=140,h=100,color="white",font=50,code=function()SKIN.nextSet()end}),
newButton({name="prev1", x=130,y=230,w=90,h=65,color="white",font=30,code=prevSkin(1)}),
newButton({name="prev2", x=270,y=230,w=90,h=65,color="white",font=30,code=prevSkin(2)}),
newButton({name="prev3", x=410,y=230,w=90,h=65,color="white",font=30,code=prevSkin(3)}),
newButton({name="prev4", x=550,y=230,w=90,h=65,color="white",font=30,code=prevSkin(4)}),
newButton({name="prev5", x=690,y=230,w=90,h=65,color="white",font=30,code=prevSkin(5)}),
newButton({name="prev6", x=830,y=230,w=90,h=65,color="white",font=30,code=prevSkin(6)}),
newButton({name="prev7", x=970,y=230,w=90,h=65,color="white",font=30,code=prevSkin(7)}),
newButton({name="next1", x=130,y=450,w=90,h=65,color="white",font=30,code=nextSkin(1)}),
newButton({name="next2", x=270,y=450,w=90,h=65,color="white",font=30,code=nextSkin(2)}),
newButton({name="next3", x=410,y=450,w=90,h=65,color="white",font=30,code=nextSkin(3)}),
newButton({name="next4", x=550,y=450,w=90,h=65,color="white",font=30,code=nextSkin(4)}),
newButton({name="next5", x=690,y=450,w=90,h=65,color="white",font=30,code=nextSkin(5)}),
newButton({name="next6", x=830,y=450,w=90,h=65,color="white",font=30,code=nextSkin(6)}),
newButton({name="next7", x=970,y=450,w=90,h=65,color="white",font=30,code=nextSkin(7)}),
newButton({name="spin1", x=130,y=540,w=90,h=65,color="white",font=30,code=nextDir(1)}),
newButton({name="spin2", x=270,y=540,w=90,h=65,color="white",font=30,code=nextDir(2)}),
newButton({name="spin3", x=410,y=540,w=90,h=65,color="white",font=30,code=nextDir(3)}),
newButton({name="spin4", x=550,y=540,w=90,h=65,color="white",font=30,code=nextDir(4)}),
newButton({name="spin5", x=690,y=540,w=90,h=65,color="white",font=30,code=nextDir(5)}),
--newButton({name="spin6",x=825,y=540,w=90,h=65,color="white",font=30,code=nextDir(6)}),--cannot rotate O
newButton({name="spin7", x=970,y=540,w=90,h=65,color="white",font=30,code=nextDir(7)}),
newButton({name="skinR", x=200,y=640,w=220,h=80,color="lPurple",font=35,
code=function()
setting.skin={1,5,8,2,10,3,7,1,5,5,1,8,2,10,3,7,10,7,8,2,8,2,1,5,3}
SFX.play("rotate")
end}),
newButton({name="faceR", x=480,y=640,w=220,h=80,color="lRed",font=35,
code=function()
for i=1,25 do
setting.face[i]=0
end
SFX.play("hold")
end}),
newButton({name="back", x=1140,y=650,w=200,h=80,color="white",font=40,code=BACK}),
},
setting_touch={
newButton({name="default", x=520,y=80,w=170,h=80,color="white",font=35,
code=function()
local D=virtualkeySet[sceneTemp.default]
for i=1,#VK_org do
VK_org[i].ava=false
end
for n=1,#D do
local T=D[n]
if T[1]then
local B=VK_org[n]
B.ava=true
B.x,B.y,B.r=T[2],T[3],T[4]
end
end--Replace keys
sceneTemp.default=sceneTemp.default%5+1
sceneTemp.sel=nil
end}),
newButton({name="snap", x=760,y=80,w=170,h=80,color="white",font=35,
code=function()
sceneTemp.snap=sceneTemp.snap%6+1
end}),
newButton({name="option", x=520,y=180,w=170,h=80,color="white",font=40,
code=function()
SCN.goto("setting_touchSwitch")
end}),
newButton({name="back", x=760,y=180,w=170,h=80,color="white",font=40,code=BACK}),
newSlider({name="size", x=450,y=265,w=460,unit=14,font=40,
disp=function()
return VK_org[sceneTemp.sel].r/10-1
end,
code=function(v)
if sceneTemp.sel then
VK_org[sceneTemp.sel].r=10+v*10
end
end,
hide=function()
return not sceneTemp.sel
end}),
},
setting_touchSwitch={
newSwitch({name="b1", x=280, y=80, font=35,disp=VKAdisp(1),code=VKAcode(1)}),
newSwitch({name="b2", x=280, y=140, font=35,disp=VKAdisp(2),code=VKAcode(2)}),
newSwitch({name="b3", x=280, y=200, font=35,disp=VKAdisp(3),code=VKAcode(3)}),
newSwitch({name="b4", x=280, y=260, font=35,disp=VKAdisp(4),code=VKAcode(4)}),
newSwitch({name="b5", x=280, y=320, font=35,disp=VKAdisp(5),code=VKAcode(5)}),
newSwitch({name="b6", x=280, y=380, font=35,disp=VKAdisp(6),code=VKAcode(6)}),
newSwitch({name="b7", x=280, y=440, font=35,disp=VKAdisp(7),code=VKAcode(7)}),
newSwitch({name="b8", x=280, y=500, font=35,disp=VKAdisp(8),code=VKAcode(8)}),
newSwitch({name="b9", x=280, y=560, font=35,disp=VKAdisp(9),code=VKAcode(9)}),
newSwitch({name="b10", x=280, y=620, font=35,disp=VKAdisp(10),code=VKAcode(10)}),
newSwitch({name="b11", x=620, y=80, font=35,disp=VKAdisp(11),code=VKAcode(11)}),
newSwitch({name="b12", x=620, y=140, font=35,disp=VKAdisp(12),code=VKAcode(12)}),
newSwitch({name="b13", x=620, y=200, font=35,disp=VKAdisp(13),code=VKAcode(13)}),
newSwitch({name="b14", x=620, y=260, font=35,disp=VKAdisp(14),code=VKAcode(14)}),
newSwitch({name="b15", x=620, y=320, font=35,disp=VKAdisp(15),code=VKAcode(15)}),
newSwitch({name="b16", x=620, y=380, font=35,disp=VKAdisp(16),code=VKAcode(16)}),
newSwitch({name="b17", x=620, y=440, font=35,disp=VKAdisp(17),code=VKAcode(17)}),
newSwitch({name="b18", x=620, y=500, font=35,disp=VKAdisp(18),code=VKAcode(18)}),
newSwitch({name="b19", x=620, y=560, font=35,disp=VKAdisp(19),code=VKAcode(19)}),
newSwitch({name="b20", x=620, y=620, font=35,disp=VKAdisp(20),code=VKAcode(20)}),
newButton({name="norm", x=840, y=100, w=240,h=80,color="white",font=35,code=function()for i=1,20 do VK_org[i].ava=i<11 end end}),
newButton({name="pro", x=1120, y=100, w=240,h=80,color="white",font=35,code=function()for i=1,20 do VK_org[i].ava=true end end}),
newSwitch({name="hide", x=1170, y=200, font=40,disp=SETval("VKSwitch"),code=SETrev("VKSwitch")}),
newSwitch({name="track", x=1170, y=300, font=35,disp=SETval("VKTrack"),code=SETrev("VKTrack")}),
newSlider({name="sfx", x=800, y=380, w=180,unit=4,font=40,change=function()SFX.play("virtualKey",setting.VKSFX*.25)end,disp=SETval("VKSFX"),code=SETsto("VKSFX")}),
newSlider({name="vib", x=800, y=460, w=180,unit=2,font=40,change=function()VIB(setting.VKVIB)end,disp=SETval("VKVIB"),code=SETsto("VKVIB")}),
newSwitch({name="icon", x=850, y=300, font=40,disp=SETval("VKIcon"),code=SETrev("VKIcon")}),
newButton({name="tkset", x=1120, y=420, w=240,h=80,color="white",font=32,
code=function()
SCN.goto("setting_trackSetting")
end,
hide=function()
return not setting.VKTrack
end}),
newSlider({name="alpha", x=840, y=540, w=400,unit=10,font=40,disp=SETval("VKAlpha"),code=SETsto("VKAlpha")}),
newButton({name="back", x=1120, y=620, w=200,h=80,color="white",font=45,code=BACK}),
},
setting_trackSetting={
newSwitch({name="VKDodge", x=400, y=200, font=35, disp=SETval("VKDodge"),code=SETrev("VKDodge")}),
newSlider({name="VKTchW", x=140, y=310, w=1000, unit=10,font=35,disp=SETval("VKTchW"),code=function(i)setting.VKTchW=i;setting.VKCurW=math.max(setting.VKCurW,i)end}),
newSlider({name="VKCurW", x=140, y=370, w=1000, unit=10,font=35,disp=SETval("VKCurW"),code=function(i)setting.VKCurW=i;setting.VKTchW=math.min(setting.VKTchW,i)end}),
newButton({name="back", x=1080, y=600, w=240, h=80,color="white",font=45,code=BACK}),
},
setting_lang={
newButton({name="chi", x=160, y=100,w=200,h=120,color="white",font=45,code=setLang(1)}),
newButton({name="chi2", x=380, y=100,w=200,h=120,color="white",font=45,code=setLang(2)}),
newButton({name="eng", x=600, y=100,w=200,h=120,color="white",font=45,code=setLang(3)}),
newButton({name="str", x=820, y=100,w=200,h=120,color="white",font=45,code=setLang(4)}),
newButton({name="back", x=640, y=600,w=200,h=80,color="white",font=40,code=BACK}),
},
help={
newButton({name="staff", x=980, y=500,w=150,h=80,color="white",font=32,code=function()SCN.goto("staff")end}),
newButton({name="his", x=1160, y=500,w=150,h=80,color="white",font=32,code=function()SCN.goto("history")end}),
newButton({name="qq", x=1070, y=600,w=200,h=80,color="white",font=32,code=function()love.system.openURL("tencent://message/?uin=1046101471&Site=&Menu=yes")end,hide=mobileHide}),
newButton({name="back", x=640, y=600,w=200,h=80,color="white",font=40,code=BACK}),
},
staff={
newButton({name="back", x=1160, y=630,w=150,h=80,color="white",font=40,code=BACK}),
},
history={
newButton({name="prev", x=1155, y=170,w=180,h=180,color="white",font=65,code=pressKey("up"),hide=function()return sceneTemp[2]==1 end}),
newButton({name="next", x=1155, y=400,w=180,h=180,color="white",font=65,code=pressKey("down"),hide=function()return sceneTemp[2]==#sceneTemp[1]end}),
newButton({name="back", x=1155, y=600,w=180,h=90,color="white",font=40,code=BACK}),
},
stat={
newButton({name="path", x=980, y=620,w=250,h=80,color="white",font=25,code=function()love.system.openURL(love.filesystem.getSaveDirectory())end,hide=mobileHide}),
newButton({name="back", x=640, y=620,w=200,h=80,color="white",font=40,code=BACK}),
},
debug={
newButton({name="killWTM", x=340, y=200,w=260,h=100,color="white",font=35,
code=function()
marking=nil
TEXT.show("\68\69\86\58\87\97\116\101\114\109\97\114\107\32\82\101\109\111\118\101\100",640,360,60,"stretch",.6)
SFX.play("clear")
end,
hide=function()
return not marking
end}),
newButton({name="unlock", x=640,y=200,w=260,h=100,color="white",font=40,
code=function()
for name,M in next,Modes do
if not modeRanks[name]then
modeRanks[name]=M.score and 0 or 6
end
end
FILE.saveUnlock()
TEXT.show("\68\69\86\58\85\78\76\79\67\75\65\76\76",640,360,60,"stretch",.6)
SFX.play("clear_2")
end}),
newButton({name="reset", x=940,y=200,w=260,h=100,color="white",font=40,
code=function()
sceneTemp.ct=sceneTemp.ct+1
if sceneTemp.ct==1 then
TEXT.show("RESET ALL DATA?",640,360,50,"appear",.5)
elseif sceneTemp.ct==5 then
TEXT.show("SURE?????",640,360,80,"beat",.5)
elseif sceneTemp.ct==10 then
local L=love.filesystem.getDirectoryItems("")
for i=1,#L do
local s=L[i]
if s:sub(-4)==".dat"then
love.filesystem.remove(s)
end
end
SFX.play("clear_4")SFX.play("finesseError_long")
TEXT.clear()
TEXT.show("ALL SAVING FILE DELETED",640,360,60,"stretch",.4)
SCN.back()
end
end}),
newButton({name="back", x=640,y=620,w=200,h=80,color="white",font=40,code=BACK}),
},
}
--Remove temp vars
mobileHide,SETval,SETsto,SETrev=nil
pressKey,setPen,prevSkin,nextSkin=nil
nextDir,VKAdisp,VKAcode,setLang=nil
newText,newImage,newButton,newSwitch,newSlider=nil
return Widgets

165
class.lua
View File

@@ -1,165 +0,0 @@
local gc=love.graphics
local rem=table.remove
local format=string.format
Task={}
function newTask(code,P,data)
Task[#Task+1]={
code=code,
P=P,
data=data,
}
end
function clearTask(opt)
if opt=="all"then
local i=#Task
while i>0 do
Task[i]=nil
i=i-1
end
elseif opt=="play"then
for i=#Task,1,-1 do
if Task[i].P then
rem(Task,i)
end
end
else--Player table
for i=#Task,1,-1 do
if Task[i].P==opt then
rem(Task,i)
end
end
end
end
local button={type="button"}
function newButton(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 button:isAbove(x,y)
return x>self.x and x<self.x+self.w and y>self.y and y<self.y+self.h
end
function button:FX()
sysFX[#sysFX+1]={0,0,10,self.x,self.y,self.w,self.h}
--[0=ripple],timer,duration,x,y,w,h
end
function button:draw()
local C=self.color
gc.setColor(C)
gc.setLineWidth(3)gc.rectangle("line",self.x,self.y,self.w,self.h,4)
gc.setColor(C[1],C[2],C[3],.4)
gc.setLineWidth(5)gc.rectangle("line",self.x,self.y,self.w,self.h,4)
if self==widget_sel then
gc.rectangle("fill",self.x,self.y,self.w,self.h,4)
end--Highlight when Selected
local t=self.text
if t then
if type(t)=="function"then t=t()end
setFont(self.font)
local y0=self.y+self.h*.5-self.font*.7
gc.printf(t,self.x-2,y0-1,self.w,"center")
gc.setColor(C)
gc.printf(t,self.x,y0,self.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"}
function newSwitch(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 switch:isAbove(x,y)
return x>self.x and x<self.x+100 and y>self.y-20 and y<self.y+20
end
function switch:FX()
sysFX[#sysFX+1]=self.disp()and
{1,0,15,1,.4,.4,self.x,self.y-20,50,40,0}--Switched on
or{1,0,15,.4,1,.4,self.x+50,self.y-20,50,40,0}--Switched off
--[1=square fade],timer,duration,r,g,b,x,y,w,h
end
function switch:draw()
local x,y=self.x,self.y-20
if self.disp()then
gc.setColor(.6,1,.6)
gc.rectangle("fill",x+50,y,50,40,3)
--ON
else
gc.setColor(1,.6,.6)
gc.rectangle("fill",x,y,50,40,3)
--OFF
end--switch
gc.setColor(1,1,1,self==widget_sel and 1 or .6)
gc.setLineWidth(3)gc.rectangle("line",x-3,y-3,106,46,5)
--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"}
function newSlider(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 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:FX(pos)
sysFX[#sysFX+1]={1,0,10,1,1,1,self.x+self.w*pos/self.unit-8,self.y-15,17,30}
--[1=square fade],timer,duration,r,g,b,x,y,w,h
end
function slider:draw()
local S=self==widget_sel
gc.setColor(1,1,1,S and 1 or .5)
gc.setLineWidth(2)
local x1,x2=self.x,self.x+self.w
for p=0,self.unit do
local x=x1+(x2-x1)*p/self.unit
gc.line(x,self.y+7,x,self.y-7)
end
--units
gc.setLineWidth(5)
gc.line(x1,self.y,x2,self.y)
--axis
gc.setColor(1,1,1)
gc.rectangle("fill",x1+(x2-x1)*self.disp()/self.unit-8,self.y-15,17,30)
--block
local t=self.text
if t then
gc.setColor(1,1,1)
setFont(self.font)
gc.printf(t,self.x-312,self.y-self.font*.7,300,"right")
end
end
function slider:getInfo()
print(format("x=%d,y=%d,w=%d",self.x,self.y,self.w))
end

View File

@@ -1,41 +1,34 @@
math.randomseed(os.time())
gameVersion="Alpha V0.7.34"
gameVersion="Alpha V0.9.3"
function love.conf(t)
t.identity="Techmino"--Save directory name
t.identity="Techmino"--saving folder
t.version="11.1"
t.console=X
t.gammacorrect=X
t.appendidentity=X--If search files in source before save directory
t.accelerometerjoystick=X--If exposing accelerometer on iOS and Android as a Joystick
t.audio.mixwithsystem=true--Switch on to keep sysBGM
t.gammacorrect=false
t.appendidentity=true--search files in source then in save directory
t.accelerometerjoystick=false--accelerometer=joystick on ios/android
if t.audio then t.audio.mixwithsystem=true end
local W=t.window
if math.random()>.26 then
W.title="Techmino "..gameVersion
else
math.randomseed(tonumber(os.date("%Y%j")))
W.title="Your lucky number today:"..math.random(100,626)
end
W.title="Techmino "..gameVersion
W.icon="/image/icon.png"
W.width,W.height=1280,720
W.minwidth,W.minheight=640,360
W.borderless=X
W.resizable=1
W.borderless=false
W.resizable=true
W.fullscreentype="desktop"--"exclusive"
W.fullscreen=X
W.vsync=0--0→∞fps
W.msaa=X--The number of samples to use with multi-sampled antialiasing (number)
W.depth=X--Bits per sample in the depth buffer
W.stencil=1--The number of bits per sample in the stencil buffer
W.display=1--Monitor ID
W.highdpi=X--Enable high-dpi mode for the window on a Retina display (boolean)
W.fullscreen=false
W.vsync=nil--60FPS
W.msaa=false--num of samples to use with multi-sampled antialiasing
W.depth=0--bits/samp of depth buffer
W.stencil=1--bits/samp of stencil buffer
W.display=1--monitor ID
W.highdpi=true--high-dpi mode for the window on a Retina display
W.x,W.y=nil
local M=t.modules
M.window,M.system,M.event=1,1,1
M.audio,M.sound=1,1
M.math,M.data=1,1
M.timer,M.graphics,M.font,M.image=1,1,1,1
M.mouse,M.touch,M.keyboard,M.joystick=1,1,1,1
M.physics,M.thread,M.video=X
M.window,M.system,M.event=true,true,true
M.audio,M.sound=true,true
M.math,M.data=true,true
M.timer,M.graphics,M.font,M.image=true,true,true,true
M.mouse,M.touch,M.keyboard,M.joystick=true,true,true,true
M.physics,M.thread,M.video=false,false,false
end

File diff suppressed because it is too large Load Diff

View File

@@ -1,88 +0,0 @@
setting={
das=10,arr=2,
sddas=0,sdarr=2,
quickR=true,swap=true,
fine=false,
--game
ghost=true,center=true,
smo=true,grid=false,
dropFX=3,
shakeFX=1,
atkFX=3,
frameMul=100,
--
fullscreen=false,
bg=true,
bgblock=true,
lang=1,
skin=1,
--graphic
sfx=10,bgm=7,
vib=3,voc=0,
stereo=6,
--sound
keyMap={
{"left","right","x","z","c","up","down","space","tab","r"},
{},{},{},{},{},{},{},
--keyboard
{"dpleft","dpright","a","b","y","dpup","dpdown","rightshoulder","x","leftshoulder"},
{},{},{},{},{},{},{},
--joystick
},
VKSwitch=true,
VKTrack=true,--If tracked
VKDodge=false,--If repel
VKTchW=3,--Touch Weight
VKCurW=4,--CurPos Weight
VKIcon=true,
VKAlpha=3,
--control
}
local L=setting.keyMap
for i=1,#L do
for j=1,20 do
if not L[i][j]then
L[i][j]=""
end
end
end
stat={
run=0,game=0,time=0,
extraPiece=0,extraRate=0,
key=0,rotate=0,hold=0,piece=0,row=0,
atk=0,send=0,recv=0,pend=0,
clear_1=0,clear_2=0,clear_3=0,clear_4=0,
spin_0=0,spin_1=0,spin_2=0,spin_3=0,
b2b=0,b3b=0,pc=0,score=0,
}
--Things related to virtualkey
local O,_=true,false
VK_org={--Original set,for restore VK' position
{ava=O,x=80, y=720-200, r=80},--moveLeft
{ava=O,x=320, y=720-200, r=80},--moveRight
{ava=O,x=1280-80, y=720-200, r=80},--rotRight
{ava=O,x=1280-200, y=720-80, r=80},--rotLeft
{ava=O,x=1280-200, y=720-320, r=80},--rotFlip
{ava=O,x=200, y=720-320, r=80},--hardDrop
{ava=O,x=200, y=720-80, r=80},--softDrop
{ava=O,x=1280-320, y=720-200, r=80},--hold
{ava=O,x=1280-80, y=280, r=80},--func
{ava=O,x=80, y=280, r=80},--restart
{ava=_,x=100, y=50, r=80},--insLeft
{ava=_,x=200, y=50, r=80},--insRight
{ava=_,x=300, y=50, r=80},--insDown
{ava=_,x=400, y=50, r=80},--down1
{ava=_,x=500, y=50, r=80},--down4
{ava=_,x=600, y=50, r=80},--down10
{ava=_,x=700, y=50, r=80},--dropLeft
{ava=_,x=800, y=50, r=80},--dropRight
{ava=_,x=900, y=50, r=80},--addToLeft
{ava=_,x=1000, y=50, r=80},--addToRight
}
virtualkey={}
for i=1,#VK_org do
virtualkey[i]={}
end

View File

@@ -1,89 +1,115 @@
(ENG ver. below)
游戏方法:
控制系统提供的一个个方块,每填满场地的一行就会将其消除,根据消除方式会给对手攻击(如果有对手的话)
完成当前游戏模式中的目标或者是活到最后即算胜利.
系统提供的一个个四联骨牌("方块",总共7种),玩家需要控制(左右移动和旋转90,180,270度),每填满场地的一行就会将其消除,根据消除方式会给对手攻击(如果有对手的话)
活到最后或者完成目标即胜利.
旋转系统:
使用Techmino专属旋转系统,细节不赘述
使用Techmino专属旋转系统,细节懒得写(
spin判定:
结合了不可移动判定和三角判定,是否为mini也与这二者有关,细节不赘述
结合了不可移动判定和三角判定,是否为mini也与判定过程数据有关,细节也懒得写(
攻击系统:
消1/2/3/4攻击0/1/2/4
spin1/2/3攻击2/4/6,若mini则减半
b2b:增加1~2(tetris)/1~3(spin)攻击
b3b:满b2b效果+1额外抵挡
PC:其它攻击与6~8(本局内递增)取高+2额外抵挡
连击:0,0,1,1,2,2,3,3,4,4,3……
普通消除:
1/2/3/4攻击0.25/1.25/2.25/4
特殊消除:
spin1/2/3攻击2/4/6,若mini则减半
B2B:加1(techrash/spin1/spin2)或2(spin3)攻击
B3B:在B2B效果之上消四再加1,spin再加0.5*消行数攻击,二者都+1额外抵挡
堆楼连击:0,0,1,1,2,2,2,3,3,3,4,4,3, 之后都是2
挖掘连击:0,0,1,1,2,2,3,3,4,4,4, 之后都是5
特殊消除会增加B2B点数,让之后的特殊消除获得B2B(B3B)增益(详细说明见下文)
半全消("下方有剩余方块"的全消,如果是I消1行则必须不剩余玩家放置的方块):伤害+2,额外抵挡+2
全消:将上述伤害之和开根号,再+6~12(本局内递增)+2额外抵挡(注:本局消行数>4时会将B2B点数拉满)
根据上述规则计算后,向下取整,攻击打出
back to back(B2B)点数说明:
B2B点数的范围在0~1200
在40及以上特殊消除时B2B,在1000以上特殊消除时B3B,1200封顶
消四+100
空spin加20,不超过1000
spin1~3+50/100/180 (mini*.5)
普通消除-250
1000以上空放一块-40(不减到低于1000)
分数系统:
操作越牛逼得分越高嗷(
攻击延迟:
消2/3的攻击生效最快,消四其次,spin攻击生效较慢,高连击生效最慢
b2b或者b3b增加攻击力的同时也会减缓一点生效速度,mini大幅减缓生效速度
B2B或者B3B增加攻击力的同时也会减缓一点生效速度,mini大幅减缓生效速度
抵消逻辑:
发动攻击时,若缓冲条有攻击则先用额外抵挡再用攻击力1:1抵消最先受到的攻击
没有用上的额外抵挡会被丢弃,最后剩下的攻击力会发送给对手
back to back(B2B)点数说明:
B2B点数的范围在0~1200,在点数>=40时进行特殊消除为B2B,>1000时特殊消除为B3B
普通消除-250
spin1/2/3:+50/100/180(mini变为原来40%)
消四:+100
空spin:+20,此法得到的点数不能超过1000
当点数在1000以上时空放一块-40(不减到低于1000)
模式说明:
竞速:
用你最快的速度消除40行(据难度而定)吧!
马拉松:
根据总消行数,速度会逐渐加快,消除两百行吧!(easy和hard就是normal开始和结束的速度,消除200行不加速)
大师:
马拉松进化版,如果觉得马拉松太简单了久玩这个吧,每一个难度都是一层境界,L难度和U难度攒到500点数通关,final难度为上级者专属游戏模式,不建议游玩.
经典:
使用低速控制设置在高速下落时尽可能消除更多的行,没有通关目标.(到90有"彩蛋")
:
闲得无聊,只是想单纯地打打块地时候可以玩此模式,无重力消除200行.
无尽:
无尽模式,边上会显示玩家的消行数和攻击效率,适合科研(术语).
单挑:
和一个电脑玩家单挑,带加号的和最后一个模式是超强机器人(仅限Windows平台),试试你能稳定打败多难的对手吧!
回合制:
玩法同单挑模式,只不过只有当一个人放下一个方块后另一个人才能放下一块.
仅TSD:
这个模式中,玩家必须用TSD(T spin double)的方式消除,否则直接判负,你能连续打出多少个TSD呢?
隐形:
根据不同难度,场地内(甚至当前方块)会隐形,看看你能活多久吧!(GM难度为类似TGM3的GM Roll,用于上级者练习)
挖掘:
每隔一定时间,系统会向场地的低端添加一行垃圾行,间隔会随着波数增加而越来越短,你能顶住几波呢?
生存:
每隔一定时间,系统会向玩家的垃圾缓冲槽中添加垃圾行,释放速度和间隔会随着波数增加而越来越短,玩家可以将其抵消也可以让其释放,尽可能活更久的时间.
防守:
系统会向玩家的垃圾缓冲槽中添加难消除的垃圾行,释放速度和间隔会随着波数增加而越来越短,玩家要尽量抵消他们来让自己存活更久.
进攻:
当玩家的攻击缓冲槽空时,系统会向玩家的垃圾缓冲槽中添加大量的垃圾行(高难度下后期甚至会远超过20),释放速度和间隔都会随着波数增加而越来越短,垃圾上涨速度也会提升.赶紧在其释放之前将攻击抵消到不会一下致命的量!
科研:
玩家只被允许做特殊消除(spin/全消/消四),在带+的难度中不允许消四,U难度下玩家甚至只被允许每一个方块都使用最简操作控制,任何违反规则的行为都会判负.
C4W练习:(或者说是4w练习)
系统直接提供给玩家"留4列"的场地,玩家可以自由练习4w消除,该技巧在某些时候实战很有用.(需要学会spin,否则意义不是很大)
全清训练:
系统会连续给玩家提供"标准开局PC套路"的场地和四个方块(不允许使用hold),玩家需要一直完成PC,否则判负.
全清挑战:
在消除一百行的限制内,你能全清几次?
49人混战:
许多玩家同时进行一局游戏其它的是AI,不是真人).随着玩家数量的减少,方块下落/垃圾生效速度/垃圾升起速度都会增加.淘汰其它玩家后可以获得一个徽章和该玩家持有的徽章,增强自己的攻击力.
玩家可选四个攻击模式:
1.随机:每次攻击后10%随机挑选一个玩家锁定
2.最多徽章:攻击后或者锁定玩家死亡时锁定徽章最多的玩家
3.最高:攻击后或者锁定玩家死亡时锁定场地最高的玩家(每秒刷新)
4.反击:攻击所有锁定自己的玩家AOE,若无则伏击随机玩家
坚持到最后的玩家就是胜利者.
99人混战:
同49人混战,只是增加到了99名玩家,难度系数也有调整,对设备的要求也较高.
干旱:
系统提供的方块序列变得奇怪了!你能消除100行不死吗,或者,多快?
多人:
使用键盘或者多个手柄(也许?)
自定义:
玩家可以自由调整下落速度等等几乎大多数设置(不包括上述各种游戏模式的特殊效果),也可以画一个场地去消除或者是作为提示模板来玩方块拼图.在拼图模式下,按功能键切换是否显示提示模板.其中打"X"的格子不允许有方块,空的格子可以是任何状态,玩家能获得的七种普通方块必须完全符合,垃圾行方块的为止只要有方块就可以,但是不能是空气,玩家拼出自己画的图后就会判定胜利.
混战模式说明:
许多玩家同时进行一局游戏对手都是AI,不是真人).随着玩家数量的减少,方块下落/垃圾生效速度/垃圾升起速度都会增加.淘汰其它玩家后可以获得一个徽章和该玩家持有的徽章,增强自己的攻击力.
玩家可选四个攻击模式:
1.随机:每次攻击后10%随机挑选一个玩家锁定
2.最多徽章:攻击后或者锁定玩家死亡时锁定徽章最多的玩家
3.最高:攻击后或者锁定玩家死亡时锁定场地最高的玩家(每秒刷新)
4.反击:攻击所有锁定自己的玩家攻击AOE,若未被任何人锁定则攻击随机玩家(不锁定)
坚持到最后的玩家就是胜利者.
自定义模式说明:
玩家可以自由调整大多数参数(不包括上述各种游戏模式的特殊效果),也可以画一个场地去消除或者是作为提示模板来进行拼图模式.
在拼图模式下,按功能键切换是否展示提示.其中打"X"的格子不允许有方块,空的格子可以是任何状态,普通的七种彩色方块必须颜色对应,垃圾行方块的为止只要有方块就可以,但是不能是空气,玩家拼出自己画的图后就会判定胜利.
Gameplay:
System will offer a series of tetrominoes ("Pieces". There are 7 types), and the player needs to control [them] (move left and right, rotate 90, 180 or 270 degrees), filling a row on the play field will clear it, attack will be sent depending on the type of the line clear (if there is an opponent)
Survive till the last or complete the level's goal to win.
Rotation system:
Uses Techmino's custom rotation system. Too lazy to write the details
Spin detection:
Combines immobile and 3-corner detection, and whether a spin is mini also depends on the data used for detection. Also too lazy to write the details
Attack system:
Regular line clears:
Single/Double/Triple/Techrash sends 0.25/1.25/2.25/4
Special line clears:
Spin Single/Double/Triple sends 2/4/6, half if Mini
B2B: +1 (Techrash/Spin Single/Spin Double) or +2 (Spin Triple)
B2B2B/B3B: In addition to B2B, +1 if Techrash, +(0.5 * lines cleared) if Spin, and in both cases +1 additional blocking
Wide Combo: 0, 0, 1, 1, 2, 2, 2, 3, 3, 3, 4, 4, 3, then 2 afterwards
Dig Combo: 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 4, then 5 afterwards
Special line clears will increase B2B gauge, making later special line clears have B2B or B2B2B bonus (see below)
Half Perfect Clear (a Perfect Clear "with blocks left below". If it's an I clearing 1 line, then the remaining blocks must not be player-placed): Attack +2, Extra Blocking +2
Perfect Clear: square root all damage above, then +6 to +12 attack (increases within a round) and +2 extra blocking. (note: if lines cleared in this round >4, then B2B gauge will be filled)
After calculating all above, the damage value will be rounded down then sent
Score system:
The more impressive you play, the more score you get
Attack delay:
Attack from Doubles/Triples take effect the faster, then Techrash, Spins send rather slow attack, and high combos will send the slowest
B2B or B2B2B, while they increase lines sent, they also increase the attack delay. Minis will greatly increase delay.
Countering:
When you send attack, if there is garbage in queue, extra blocking will be used first, then attack, countering the earliest attack at a 1:1 ratio.
Unused extra blocking will be discarded, then remaining attack will be sent to your opponent.
Back to Back (B2B) gauge:
The B2B gauge ranges from 0 to 1,200. Special line clears are B2B if the gauge is >=40, B2B2B if >1,000.
A regular line clear -250
Spin Single/Double/Triple +50/100/180 (x40% if Mini)
Techrash +100
Spin without clearing lines +20, but gauge cannot exceed 1,000 with this method
When gauge is above 1,000, a drop without clearing lines -40 (cannot drop below 1,000 with this method)
Battle Royale modes:
Many players play within one game (all opponents are bots, not real players). As players get eliminated, blocks fall faster, and garbage take effect faster, as well as rise faster. KO-ing another player grants you one badge plus all badge that player has, increasing your attack power.
Players can select one of 4 attack modes:
1. Random: Every time you attack, 10% chance to lock onto a random player.
2. Badges: After you attack or when your target dies, lock onto the player with the most badges.
3. KOs: After you attack or when your target dies, lock onto the player with the highest field. (This refreshes every second)
4. Counter: attack all players locking onto yourself. Your attack will be sent to all of them. If you are not targetted, you attack a random player (not locking).
The last survivor wins.
Custom mode:
You can freely adjust most parameters (not including special effects of other game modes), and you can also draw a field to clear or make a template to build.
In build (puzzle) mode, you can toggle template display with Function key. Cells with a X cannot have blocks; empty cells can be in any state; regular colored cells have to be made of the corresponding block; garbage-colored cells can be any block but not air. Once you make the shape, you will win.
附录Appendix:
ZXC's cool O-spin map:XY0BCgAwCAIR7v9vHtUSt8AS0xKqgpnNGyXkrmFNePf6qi3BbQPrHT2Owxe6D66NeKi86dwB

BIN
font.ttf

Binary file not shown.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 140 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

BIN
image/mess/electric.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

BIN
image/mess/hbm.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
image/mess/pay1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

BIN
image/mess/pay2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 60 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 147 B

After

Width:  |  Height:  |  Size: 155 B

BIN
image/mess/speedLimit.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

BIN
image/mess/title_new.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
image/miya/ch.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 74 KiB

BIN
image/miya/f1.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
image/miya/f2.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

BIN
image/miya/f3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
image/miya/f4.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 KiB

BIN
image/skin/WTF.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 91 B

BIN
image/skin/ball(shaw).png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

BIN
image/skin/classic(_).png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.3 KiB

Some files were not shown because too many files have changed in this diff Show More