Compare commits
211 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5604ba5416 | ||
|
|
32b0383689 | ||
|
|
9b33f56456 | ||
|
|
5341a0fc3b | ||
|
|
649a1b3032 | ||
|
|
73e1dabe14 | ||
|
|
0372fc18ee | ||
|
|
fbfe585766 | ||
|
|
f0727c3361 | ||
|
|
c4d787cb27 | ||
|
|
7bed61f210 | ||
|
|
af3bc9427d | ||
|
|
447c0cdf8d | ||
|
|
3ae9dfa323 | ||
|
|
03ae6c987e | ||
|
|
ca21591a4b | ||
|
|
c201579f5d | ||
|
|
833343cf56 | ||
|
|
d93eea4e56 | ||
|
|
f7c2d5f9e7 | ||
|
|
dcc887583f | ||
|
|
d2e6631b46 | ||
|
|
ef1ebd509d | ||
|
|
3a90089405 | ||
|
|
bcacee9d6e | ||
|
|
ebd2cce1db | ||
|
|
f72a287ab5 | ||
|
|
e61f7c33e3 | ||
|
|
b018e7b12b | ||
|
|
0faadc979e | ||
|
|
ebe3424b01 | ||
|
|
f05dc45c03 | ||
|
|
51ca17735d | ||
|
|
be1794049b | ||
|
|
b23f005348 | ||
|
|
2a5242aa6e | ||
|
|
f5d4866996 | ||
|
|
27d8aac39e | ||
|
|
ba4d3b09ff | ||
|
|
d52e69ac9d | ||
|
|
b6a4412c7b | ||
|
|
af59709b4c | ||
|
|
8a754431cf | ||
|
|
0b2abf71ea | ||
|
|
98629be450 | ||
|
|
6f49341ba5 | ||
|
|
7bdc20f15c | ||
|
|
a83bc31258 | ||
|
|
9d893f51c2 | ||
|
|
deca116e13 | ||
|
|
391b2a95d3 | ||
|
|
37d7dd5fe0 | ||
|
|
325c544e17 | ||
|
|
c88dd155dc | ||
|
|
d7b57a77c6 | ||
|
|
a0fb59973c | ||
|
|
1bb8df5db5 | ||
|
|
ac701c4759 | ||
|
|
cd3eab103c | ||
|
|
6e0ecc584a | ||
|
|
f54154195d | ||
|
|
79e6477338 | ||
|
|
e8d9cb74ad | ||
|
|
7364a6c89c | ||
|
|
28bc5e72e7 | ||
|
|
30f4f7ba57 | ||
|
|
f02c0b7d8b | ||
|
|
d342a1d55c | ||
|
|
27b3e37e16 | ||
|
|
6331647a10 | ||
|
|
42430e2dc7 | ||
|
|
c80ecfe0cb | ||
|
|
e096fb8e85 | ||
|
|
584b3c1fc2 | ||
|
|
8a2e6216d7 | ||
|
|
8ffff57b72 | ||
|
|
3bc5608476 | ||
|
|
c63618a44c | ||
|
|
c33c2ab1ca | ||
|
|
086697dd2e | ||
|
|
3b68f1571e | ||
|
|
a75f19f924 | ||
|
|
f1a5daf840 | ||
|
|
ca8dde28bf | ||
|
|
2c247a599d | ||
|
|
41a9f6f16d | ||
|
|
2381dca463 | ||
|
|
f17724c7ef | ||
|
|
9c14005cde | ||
|
|
25aa0d4770 | ||
|
|
5439f30f64 | ||
|
|
654a5b9dfe | ||
|
|
b6b87f5480 | ||
|
|
57f6249711 | ||
|
|
5a8bb432fe | ||
|
|
89bde6e6a1 | ||
|
|
521dea8c0e | ||
|
|
eefd6af5a4 | ||
|
|
e6cdb8dbb1 | ||
|
|
114c348039 | ||
|
|
ba7168edd4 | ||
|
|
9e6e170e49 | ||
|
|
1eba821522 | ||
|
|
e0c639e145 | ||
|
|
bbc9dcb9e3 | ||
|
|
e83159102f | ||
|
|
6a2ac1e669 | ||
|
|
ac76984052 | ||
|
|
373fc31408 | ||
|
|
9fbb248929 | ||
|
|
73ec8a51c2 | ||
|
|
a2e3301dfd | ||
|
|
b924656abd | ||
|
|
8f2b62ccc0 | ||
|
|
9265101025 | ||
|
|
1d2a4437e3 | ||
|
|
3116fff552 | ||
|
|
8cc53bfb46 | ||
|
|
44b151c617 | ||
|
|
914a962a94 | ||
|
|
7649d23ac4 | ||
|
|
467c8f44d6 | ||
|
|
b33cf65593 | ||
|
|
3b717d4705 | ||
|
|
fb5ea1643a | ||
|
|
fb895f8bd4 | ||
|
|
976814e039 | ||
|
|
2783a7978f | ||
|
|
4c0c777874 | ||
|
|
0e9730d923 | ||
|
|
c3d9531f98 | ||
|
|
92f6826a6c | ||
|
|
7c52eef041 | ||
|
|
73ccc1d7ed | ||
|
|
d023455f73 | ||
|
|
e72cd1751a | ||
|
|
9d2a46ab87 | ||
|
|
f8c45302f9 | ||
|
|
e78dc5d333 | ||
|
|
538c3b90ea | ||
|
|
17f0cb2369 | ||
|
|
340b2ed8f4 | ||
|
|
314e1de5f0 | ||
|
|
8544279cb6 | ||
|
|
95bee07317 | ||
|
|
046d173090 | ||
|
|
c38ef7c487 | ||
|
|
59fbb8106c | ||
|
|
8a34146028 | ||
|
|
c38fd92029 | ||
|
|
7e9f56a770 | ||
|
|
3876169ce3 | ||
|
|
c91a79488d | ||
|
|
aa0f2ccdc6 | ||
|
|
8a9ae47d41 | ||
|
|
9442da2b44 | ||
|
|
0456bf515e | ||
|
|
7bfd362567 | ||
|
|
25b8098c02 | ||
|
|
f216e2d6e5 | ||
|
|
1c31015fa8 | ||
|
|
55fc778d38 | ||
|
|
090ca861b9 | ||
|
|
f275cc404b | ||
|
|
22dcf9d84d | ||
|
|
d167fecf07 | ||
|
|
c000f5a3a1 | ||
|
|
50193ab149 | ||
|
|
402636f70c | ||
|
|
340f636ea7 | ||
|
|
3b8a952c84 | ||
|
|
4a84466ffe | ||
|
|
feafb79529 | ||
|
|
721fe74eec | ||
|
|
85c8239116 | ||
|
|
6bd0843dd5 | ||
|
|
8291184ae6 | ||
|
|
564dd1b20d | ||
|
|
c6b41c5913 | ||
|
|
8ea1b03ab2 | ||
|
|
e3f2a9c803 | ||
|
|
ccf47c3c2f | ||
|
|
24a47f1e1e | ||
|
|
6a86c2d984 | ||
|
|
909c265e51 | ||
|
|
d70e915557 | ||
|
|
a1f4b703e6 | ||
|
|
538960ac04 | ||
|
|
a43a34fe10 | ||
|
|
db3c87f852 | ||
|
|
7cd5d19f31 | ||
|
|
246def7525 | ||
|
|
dda0f04b8d | ||
|
|
1f45b420cc | ||
|
|
2e6c4c3266 | ||
|
|
890ef6c87b | ||
|
|
025ef02e71 | ||
|
|
b1c15750b4 | ||
|
|
f1f2eb583f | ||
|
|
ba486b5de7 | ||
|
|
c96b1f6106 | ||
|
|
b5af572d93 | ||
|
|
fe632b71d6 | ||
|
|
234ee0c4d1 | ||
|
|
1fb50e3f4e | ||
|
|
f478184342 | ||
|
|
c29a1e4c0d | ||
|
|
aed9fb8a24 | ||
|
|
f9bdd8433a | ||
|
|
0b8de7f94a | ||
|
|
e995d93bb2 |
@@ -1,55 +1,42 @@
|
||||
local min=math.min
|
||||
|
||||
local function fadeOut(id)
|
||||
local src=BGM.list[id]
|
||||
local v=src:getVolume()-.025*SETTING.bgm
|
||||
src:setVolume(v>0 and v or 0)
|
||||
if v<=0 then
|
||||
src:stop()
|
||||
return true
|
||||
local function fadeOut(src)
|
||||
while true do
|
||||
coroutine.yield()
|
||||
local v=src:getVolume()-.025*SETTING.bgm
|
||||
src:setVolume(v>0 and v or 0)
|
||||
if v<=0 then
|
||||
src:stop()
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
local function fadeIn(id)
|
||||
local src=BGM.list[id]
|
||||
local v=SETTING.bgm
|
||||
v=min(v,src:getVolume()+.025*v)
|
||||
src:setVolume(v)
|
||||
if v>=SETTING.bgm then return true end
|
||||
local function fadeIn(src)
|
||||
while true do
|
||||
coroutine.yield()
|
||||
local v=SETTING.bgm
|
||||
v=min(v,src:getVolume()+.025*v)
|
||||
src:setVolume(v)
|
||||
if v>=SETTING.bgm then
|
||||
return true
|
||||
end
|
||||
end
|
||||
end
|
||||
local function removeCurFadeOut(task,code,src)
|
||||
return task.code==code and task.args[1]==src
|
||||
end
|
||||
|
||||
local BGM={
|
||||
--nowPlay=[str:playing ID]
|
||||
--suspend=[str:pausing ID]
|
||||
--playing=[src:playing SRC]
|
||||
}
|
||||
BGM.list={
|
||||
"blank",--menu
|
||||
"race",--sprint, solo
|
||||
"infinite",--infinite norm/dig, ultra, zen, tech-finesse
|
||||
"push",--marathon, round, tsd, blind-5/6
|
||||
"way",--dig sprint
|
||||
"reason",--drought, blind-1/2/3/4
|
||||
|
||||
"secret8th",--master-1, survivor-2
|
||||
"secret7th",--master-2, survivor-3
|
||||
"waterfall",--sprint Penta/MPH
|
||||
"newera",--bigbang, survivor-1, tech-normal
|
||||
"oxygen",--c4w/pc train
|
||||
"truth",--pc challenge
|
||||
|
||||
"distortion",--master-3
|
||||
"far",--GM
|
||||
"shining terminal",--attacker
|
||||
"storm",--defender, survivor-4/5
|
||||
"down",--dig, tech-hard/lunatic
|
||||
|
||||
"rockblock",--classic, 49/99
|
||||
"cruelty","final","8-bit happiness","end","how feeling",--49/99
|
||||
}
|
||||
BGM.len=#BGM.list
|
||||
function BGM.set(L)
|
||||
BGM.list=L
|
||||
BGM.len=#L
|
||||
end
|
||||
function BGM.loadOne(N)
|
||||
N=BGM.list[N]
|
||||
local file="/BGM/"..N..".ogg"
|
||||
local file="media/BGM/"..N..".ogg"
|
||||
if love.filesystem.getInfo(file)then
|
||||
BGM.list[N]=love.audio.newSource(file,"stream")
|
||||
BGM.list[N]:setLooping(true)
|
||||
@@ -65,19 +52,17 @@ function BGM.loadAll()
|
||||
end
|
||||
function BGM.play(s)
|
||||
if SETTING.bgm==0 then
|
||||
BGM.nowPlay=s
|
||||
BGM.playing=BGM.list[s]
|
||||
BGM.suspend,BGM.nowPlay=s
|
||||
return
|
||||
elseif not(s and 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)
|
||||
if s and BGM.list[s]and BGM.nowPlay~=s then
|
||||
if BGM.nowPlay then TASK.new(fadeOut,BGM.playing)end
|
||||
TASK.removeTask_iterate(removeCurFadeOut,fadeOut,BGM.list[s])
|
||||
TASK.removeTask_code(fadeIn)
|
||||
|
||||
BGM.nowPlay,BGM.suspend=s
|
||||
TASK.new(fadeIn,s)
|
||||
TASK.new(fadeIn,BGM.list[s])
|
||||
BGM.nowPlay=s
|
||||
BGM.playing=BGM.list[s]
|
||||
BGM.playing:play()
|
||||
end
|
||||
@@ -87,23 +72,15 @@ function BGM.freshVolume()
|
||||
local v=SETTING.bgm
|
||||
if v>0 then
|
||||
BGM.playing:setVolume(v)
|
||||
if BGM.suspend then
|
||||
BGM.playing:play()
|
||||
BGM.nowPlay,BGM.suspend=BGM.suspend
|
||||
end
|
||||
else
|
||||
if BGM.nowPlay then
|
||||
BGM.playing:pause()
|
||||
BGM.suspend,BGM.nowPlay=BGM.nowPlay
|
||||
end
|
||||
BGM.playing:play()
|
||||
elseif BGM.nowPlay then
|
||||
BGM.playing:pause()
|
||||
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
|
||||
TASK.removeTask_code(fadeIn)
|
||||
if BGM.nowPlay then TASK.new(fadeOut,BGM.playing)end
|
||||
BGM.nowPlay,BGM.playing=nil
|
||||
end
|
||||
return BGM
|
||||
@@ -1,153 +1,58 @@
|
||||
local fs=love.filesystem
|
||||
|
||||
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")
|
||||
function FILE.load(name)
|
||||
name=name..".dat"
|
||||
local F=fs.newFile(name)
|
||||
if F:open("r")then
|
||||
local s=loadstring(F:read())
|
||||
local s=F:read()
|
||||
F:close()
|
||||
if s then
|
||||
setfenv(s,{})
|
||||
return s()
|
||||
if s:sub(1,6)=="return"then
|
||||
s=loadstring(s)
|
||||
if s then
|
||||
setfenv(s,{})
|
||||
return s()
|
||||
else
|
||||
LOG.print(name.." "..text.loadError,COLOR.red)
|
||||
return{}
|
||||
end
|
||||
else
|
||||
return{}
|
||||
local res=json.decode(s)
|
||||
if res then
|
||||
return res
|
||||
else
|
||||
LOG.print(name.." "..text.loadError,COLOR.red)
|
||||
return{}
|
||||
end
|
||||
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
|
||||
LOG.print(text.recSavingError..(mes or"unknown error"),COLOR.red)
|
||||
function FILE.save(data,name,mode)
|
||||
if not mode then mode=""end
|
||||
name=name..".dat"
|
||||
if mode:find("l")then
|
||||
data=dumpTable(data)
|
||||
if not data then
|
||||
LOG.print(name.." "..text.saveError.."dump error","error")
|
||||
return
|
||||
end
|
||||
else
|
||||
data=json.encode(data)
|
||||
if not data then
|
||||
LOG.print(name.." "..text.saveError.."json error","error")
|
||||
return
|
||||
end
|
||||
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,{})
|
||||
RANKS=s()
|
||||
end
|
||||
end
|
||||
end
|
||||
function FILE.saveUnlock()
|
||||
local F=files.unlock
|
||||
local F=fs.newFile(name)
|
||||
F:open("w")
|
||||
local _,mes=F:write(dumpTable(RANKS))
|
||||
local success,mes=F:write(data)
|
||||
F:flush()F:close()
|
||||
if not _ then
|
||||
LOG.print(text.unlockSavingError..(mes or"unknown error"),COLOR.red)
|
||||
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",",").."}"
|
||||
if success then
|
||||
if mode:find("q")then
|
||||
LOG.print(text.saveDone,COLOR.green)
|
||||
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
|
||||
LOG.print(text.statSavingError..(mes or"unknown error"),COLOR.red)
|
||||
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 LOG.print(text.settingSaved,COLOR.green)
|
||||
else LOG.print(text.settingSavingError..(mes or"unknown error"),COLOR.red)
|
||||
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 LOG.print(text.keyMapSaved,COLOR.green)
|
||||
else LOG.print(text.keyMapSavingError..(mes or"unknown error"),COLOR.red)
|
||||
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 LOG.print(text.VKSaved,COLOR.green)
|
||||
else LOG.print(text.VKSavingError..(mes or"unknown error"),COLOR.red)
|
||||
else
|
||||
LOG.print(text.saveError..(mes or"unknown error"),"error")
|
||||
end
|
||||
end
|
||||
return FILE
|
||||
@@ -32,7 +32,7 @@ function IMG.getCount()
|
||||
end
|
||||
function IMG.loadOne(_)
|
||||
local N=list[_]
|
||||
IMG[N]=love.graphics.newImage("/image/"..IMG[N])
|
||||
IMG[N]=love.graphics.newImage("media/image/"..IMG[N])
|
||||
end
|
||||
function IMG.loadAll()
|
||||
for i=1,count do
|
||||
@@ -1,26 +1,26 @@
|
||||
COLOR= require("Zframework/color")
|
||||
SCN= require("Zframework/scene")
|
||||
LOG= require("Zframework/log")
|
||||
require("Zframework/toolfunc")
|
||||
SCR= require"Zframework/screen"
|
||||
COLOR= require"Zframework/color"
|
||||
SCN= require"Zframework/scene"
|
||||
LOG= require"Zframework/log"
|
||||
require"Zframework/toolfunc"
|
||||
|
||||
VIB= require("Zframework/vib")
|
||||
SFX= require("Zframework/sfx")
|
||||
VIB= require"Zframework/vibrate"
|
||||
SFX= require"Zframework/sfx"
|
||||
|
||||
LIGHT= require("Zframework/light")
|
||||
SHADER= require("Zframework/shader")
|
||||
BG= require("Zframework/bg")
|
||||
WIDGET= require("Zframework/widget")
|
||||
TEXT= require("Zframework/text")
|
||||
sysFX= require("Zframework/sysFX")
|
||||
LIGHT= require"Zframework/light"
|
||||
BG= require"Zframework/background"
|
||||
WIDGET= require"Zframework/widget"
|
||||
TEXT= require"Zframework/text"
|
||||
SYSFX= require"Zframework/sysFX"
|
||||
|
||||
IMG= require("Zframework/img")
|
||||
BGM= require("Zframework/bgm")
|
||||
VOC= require("Zframework/voice")
|
||||
IMG= require"Zframework/image"
|
||||
BGM= require"Zframework/bgm"
|
||||
VOC= require"Zframework/voice"
|
||||
|
||||
LANG= require("Zframework/languages")
|
||||
TASK= require("Zframework/task")
|
||||
FILE= require("Zframework/file")
|
||||
PROFILE=require("Zframework/profile")
|
||||
LANG= require"Zframework/languages"
|
||||
TASK= require"Zframework/task"
|
||||
FILE= require"Zframework/file"
|
||||
PROFILE=require"Zframework/profile"
|
||||
|
||||
local ms,kb=love.mouse,love.keyboard
|
||||
local gc=love.graphics
|
||||
@@ -58,14 +58,14 @@ local function updatePowerInfo()
|
||||
end
|
||||
gc.rectangle("fill",76,6,pow*.22,14)
|
||||
if pow<100 then
|
||||
setFont(14)
|
||||
setFont(15)
|
||||
gc.setColor(0,0,0)
|
||||
gc.print(pow,77,2)
|
||||
gc.print(pow,77,4)
|
||||
gc.print(pow,79,2)
|
||||
gc.print(pow,79,4)
|
||||
gc.print(pow,77,1)
|
||||
gc.print(pow,77,3)
|
||||
gc.print(pow,79,1)
|
||||
gc.print(pow,79,3)
|
||||
gc.setColor(1,1,1)
|
||||
gc.print(pow,78,3)
|
||||
gc.print(pow,78,2)
|
||||
end
|
||||
end
|
||||
gc.draw(IMG.batteryImage,73,3)
|
||||
@@ -75,37 +75,27 @@ local function updatePowerInfo()
|
||||
gc.pop()gc.setCanvas()
|
||||
end
|
||||
-------------------------------------------------------------
|
||||
Tmr,Pnt={},{}
|
||||
mouseClick,touchClick={},{}
|
||||
mouseDown,mouseMove,mouseUp,wheelMoved={},{},{},{}
|
||||
touchDown,touchUp,touchMove={},{},{}
|
||||
keyDown,keyUp={},{}
|
||||
gamepadDown,gamepadUp={},{}
|
||||
|
||||
local Tmr,Pnt=Tmr,Pnt
|
||||
local mouseClick,touchClick=mouseClick,touchClick
|
||||
local mouseDown,mouseMove,mouseUp,wheelMoved=mouseDown,mouseMove,mouseUp,wheelMoved
|
||||
local touchDown,touchUp,touchMove=touchDown,touchUp,touchMove
|
||||
local keyDown,keyUp=keyDown,keyUp
|
||||
local gamepadDown,gamepadUp=gamepadDown,gamepadUp
|
||||
-------------------------------------------------------------
|
||||
local lastX,lastY=0,0--Last clickDown pos
|
||||
function love.mousepressed(x,y,k,touch)
|
||||
if touch then return end
|
||||
mouseShow=true
|
||||
mx,my=xOy:inverseTransformPoint(x,y)
|
||||
if devMode==1 then DBP(mx,my)end
|
||||
if SCN.swapping then return end
|
||||
if mouseDown[SCN.cur]then
|
||||
mouseDown[SCN.cur](mx,my,k)
|
||||
elseif k==2 then
|
||||
SCN.back()
|
||||
if devMode==1 then
|
||||
local dx,dy=mx-lastX,my-lastY
|
||||
DBP(("(%d,%d), D=(%d,%d)~~(%d,%d)(%d,%d)"):format(mx,my,dx,dy,int(mx/10)*10,int(my/10)*10,int(dx/10)*10,int(dy/10)*10))
|
||||
end
|
||||
if k==1 then
|
||||
WIDGET.press(mx,my)
|
||||
if not SCN.swapping then
|
||||
if SCN.mouseDown then
|
||||
SCN.mouseDown(mx,my,k)
|
||||
elseif k==2 then
|
||||
SCN.back()
|
||||
end
|
||||
if k==1 then
|
||||
WIDGET.press(mx,my)
|
||||
end
|
||||
lastX,lastY=mx,my
|
||||
SYSFX.newRipple(3,mx,my,30)
|
||||
end
|
||||
lastX,lastY=mx,my
|
||||
sysFX.newRipple(.3,mx,my,30)
|
||||
end
|
||||
function love.mousemoved(x,y,dx,dy,t)
|
||||
if t then return end
|
||||
@@ -113,9 +103,7 @@ function love.mousemoved(x,y,dx,dy,t)
|
||||
mx,my=xOy:inverseTransformPoint(x,y)
|
||||
if SCN.swapping then return end
|
||||
dx,dy=dx/SCR.k,dy/SCR.k
|
||||
if mouseMove[SCN.cur]then
|
||||
mouseMove[SCN.cur](mx,my,dx,dy)
|
||||
end
|
||||
if SCN.mouseMove then SCN.mouseMove(mx,my,dx,dy)end
|
||||
if ms.isDown(1) then
|
||||
WIDGET.drag(mx,my)
|
||||
else
|
||||
@@ -127,16 +115,12 @@ function love.mousereleased(x,y,k,touch)
|
||||
mx,my=xOy:inverseTransformPoint(x,y)
|
||||
WIDGET.release(mx,my)
|
||||
WIDGET.moveCursor(mx,my)
|
||||
if mouseUp[SCN.cur]then
|
||||
mouseUp[SCN.cur](mx,my,k)
|
||||
end
|
||||
if lastX and(mx-lastX)^2+(my-lastY)^2<26 and mouseClick[SCN.cur]then
|
||||
mouseClick[SCN.cur](mx,my,k)
|
||||
end
|
||||
if SCN.mouseUp then SCN.mouseUp(mx,my,k)end
|
||||
if lastX and SCN.mouseClick and(mx-lastX)^2+(my-lastY)^2<26 then SCN.mouseClick(mx,my,k)end
|
||||
end
|
||||
function love.wheelmoved(x,y)
|
||||
if SCN.swapping then return end
|
||||
if wheelMoved[SCN.cur]then wheelMoved[SCN.cur](x,y)end
|
||||
if SCN.wheelMoved then SCN.wheelMoved(x,y)end
|
||||
end
|
||||
|
||||
function love.touchpressed(id,x,y)
|
||||
@@ -148,17 +132,13 @@ function love.touchpressed(id,x,y)
|
||||
end
|
||||
x,y=xOy:inverseTransformPoint(x,y)
|
||||
lastX,lastY=x,y
|
||||
if touchDown[SCN.cur]then
|
||||
touchDown[SCN.cur](id,x,y)
|
||||
end
|
||||
if SCN.touchDown then SCN.touchDown(id,x,y)end
|
||||
if kb.hasTextInput()then kb.setTextInput(false)end
|
||||
end
|
||||
function love.touchmoved(id,x,y,dx,dy)
|
||||
if SCN.swapping then return end
|
||||
x,y=xOy:inverseTransformPoint(x,y)
|
||||
if touchMove[SCN.cur]then
|
||||
touchMove[SCN.cur](id,x,y,dx/SCR.k,dy/SCR.k)
|
||||
end
|
||||
if SCN.touchMove then SCN.touchMove(id,x,y,dx/SCR.k,dy/SCR.k)end
|
||||
if WIDGET.sel then
|
||||
if touching then
|
||||
WIDGET.drag(x,y)
|
||||
@@ -181,22 +161,17 @@ function love.touchreleased(id,x,y)
|
||||
WIDGET.sel=nil
|
||||
end
|
||||
end
|
||||
if touchUp[SCN.cur]then
|
||||
touchUp[SCN.cur](id,x,y)
|
||||
end
|
||||
if SCN.touchUp then SCN.touchUp(id,x,y)end
|
||||
if(x-lastX)^2+(y-lastY)^2<26 then
|
||||
if touchClick[SCN.cur]then
|
||||
touchClick[SCN.cur](x,y)
|
||||
end
|
||||
sysFX.newRipple(.3,x,y,30)
|
||||
if SCN.touchClick then SCN.touchClick(x,y)end
|
||||
SYSFX.newRipple(3,x,y,30)
|
||||
end
|
||||
end
|
||||
|
||||
function love.keypressed(i)
|
||||
mouseShow=false
|
||||
if devMode then
|
||||
if i=="f1"then
|
||||
PROFILE.switch()
|
||||
if i=="f1"then PROFILE.switch()
|
||||
elseif i=="f2"then
|
||||
LOG.print("System:"..SYSTEM.."["..jit.arch.."]")
|
||||
LOG.print("luaVer:".._VERSION)
|
||||
@@ -249,7 +224,7 @@ function love.keypressed(i)
|
||||
if i~="f8"then
|
||||
if SCN.swapping then return end
|
||||
|
||||
if keyDown[SCN.cur]then keyDown[SCN.cur](i)
|
||||
if SCN.keyDown then SCN.keyDown(i)
|
||||
elseif i=="escape"then SCN.back()
|
||||
else WIDGET.keyPressed(i)
|
||||
end
|
||||
@@ -260,7 +235,7 @@ function love.keypressed(i)
|
||||
end
|
||||
function love.keyreleased(i)
|
||||
if SCN.swapping then return end
|
||||
if keyUp[SCN.cur]then keyUp[SCN.cur](i)end
|
||||
if SCN.keyUp then SCN.keyUp(i)end
|
||||
end
|
||||
function love.textedited(text)
|
||||
EDITING=text
|
||||
@@ -300,30 +275,29 @@ local keyMirror={
|
||||
function love.gamepadpressed(_,i)
|
||||
mouseShow=false
|
||||
if SCN.swapping then return end
|
||||
if gamepadDown[SCN.cur]then gamepadDown[SCN.cur](i)
|
||||
elseif keyDown[SCN.cur]then keyDown[SCN.cur](keyMirror[i]or i)
|
||||
if SCN.gamepadDown then SCN.gamepadDown(i)
|
||||
elseif SCN.keyDown then SCN.keyDown(keyMirror[i]or i)
|
||||
elseif i=="back"then SCN.back()
|
||||
else WIDGET.gamepadPressed(i)
|
||||
else WIDGET.gamepadPressed(keyMirror[i]or i)
|
||||
end
|
||||
end
|
||||
function love.gamepadreleased(_,i)
|
||||
if SCN.swapping then return end
|
||||
if gamepadUp[SCN.cur]then gamepadUp[SCN.cur](i)
|
||||
end
|
||||
if SCN.gamepadUp then SCN.gamepadUp(i)end
|
||||
end
|
||||
--[[
|
||||
function love.joystickpressed(JS,k)
|
||||
mouseShow=false
|
||||
if SCN.swapping then return end
|
||||
if gamepadDown[SCN.cur]then gamepadDown[SCN.cur](i)
|
||||
elseif keyDown[SCN.cur]then keyDown[SCN.cur](keyMirror[i]or i)
|
||||
if SCN.gamepadDown then SCN.gamepadDown(i)
|
||||
elseif SCN.keyDown then SCN.keyDown(keyMirror[i]or i)
|
||||
elseif i=="back"then SCN.back()
|
||||
else WIDGET.gamepadPressed(i)
|
||||
end
|
||||
end
|
||||
function love.joystickreleased(JS,k)
|
||||
if SCN.swapping then return end
|
||||
if gamepadUp[SCN.cur]then gamepadUp[SCN.cur](i)
|
||||
if SCN.gamepadUp then SCN.gamepadUp(i)
|
||||
end
|
||||
end
|
||||
function love.joystickaxis(JS,axis,val)
|
||||
@@ -386,7 +360,7 @@ function love.errorhandler(msg)
|
||||
gc.reset()
|
||||
|
||||
local errScrShot
|
||||
gc.captureScreenshot(function (_)errScrShot=gc.newImage(_)end)
|
||||
gc.captureScreenshot(function(_)errScrShot=gc.newImage(_)end)
|
||||
gc.present()
|
||||
|
||||
SFX.fplay("error",SETTING.voc*.8)
|
||||
@@ -431,7 +405,7 @@ function love.errorhandler(msg)
|
||||
setFont(100)gc.print(":(",100,40,0,1.2)
|
||||
setFont(40)gc.printf(text.errorMsg,100,200,SCR.w0-100)
|
||||
setFont(20)
|
||||
gc.print(SYSTEM.."-"..VERSION,100,660)
|
||||
gc.print(SYSTEM.."-"..VERSION_NAME,100,660)
|
||||
gc.print("scene:"..SCN.cur,400,660)
|
||||
gc.printf(err[1],626,360,1260-626)
|
||||
gc.print("TRACEBACK",626,426)
|
||||
@@ -454,21 +428,21 @@ local devColor={
|
||||
local FPS=love.timer.getFPS
|
||||
love.draw,love.update=nil--remove default draw/update
|
||||
function love.run()
|
||||
local SCN=SCN
|
||||
local SETTING=SETTING
|
||||
|
||||
local Timer=love.timer.getTime
|
||||
local STEP,WAIT=love.timer.step,love.timer.sleep
|
||||
local MINI=love.window.isMinimized
|
||||
local PUMP,POLL=love.event.pump,love.event.poll
|
||||
local DISCARD=gc.discard
|
||||
local PRESENT=gc.present
|
||||
|
||||
local T=love.timer
|
||||
local Timer=T.getTime
|
||||
local STEP,GETDelta,WAIT=T.step,T.getDelta,T.sleep
|
||||
local mini=love.window.isMinimized
|
||||
local PUMP,POLL=love.event.pump,love.event.poll
|
||||
|
||||
local frameTimeList={}
|
||||
|
||||
local lastFrame=Timer()
|
||||
local lastFreshPow=lastFrame
|
||||
local FCT=0--Framedraw counter
|
||||
local FCT=0--Framedraw counter, from 0~99
|
||||
|
||||
love.resize(gc.getWidth(),gc.getHeight())
|
||||
|
||||
@@ -482,7 +456,9 @@ function love.run()
|
||||
return function()
|
||||
local _
|
||||
|
||||
lastFrame=Timer()
|
||||
local T=Timer()
|
||||
local dt=T-lastFrame
|
||||
lastFrame=T
|
||||
|
||||
--EVENT
|
||||
PUMP()
|
||||
@@ -497,45 +473,45 @@ function love.run()
|
||||
|
||||
--UPDATE
|
||||
STEP()
|
||||
local dt=GETDelta()
|
||||
TASK.update()
|
||||
VOC.update()
|
||||
BG.update(dt)
|
||||
sysFX.update(dt)
|
||||
SYSFX.update(dt)
|
||||
TEXT.update()
|
||||
_=Tmr[SCN.cur]if _ then _(dt)end--Scene Updater
|
||||
if SCN.update then SCN.update(dt)end--Scene Updater
|
||||
if SCN.swapping then SCN.swapUpdate()end--Scene swapping animation
|
||||
WIDGET.update()--Widgets animation
|
||||
LOG.update()
|
||||
|
||||
--DRAW
|
||||
if not mini()then
|
||||
if not MINI()then
|
||||
FCT=FCT+SETTING.frameMul
|
||||
if FCT>=100 then
|
||||
FCT=FCT-100
|
||||
DISCARD()--SPEED UPUPUP!
|
||||
|
||||
--Draw background
|
||||
BG.draw()
|
||||
|
||||
gc.push("transform")
|
||||
gc.replaceTransform(xOy)
|
||||
|
||||
--Draw scene contents
|
||||
if Pnt[SCN.cur]then Pnt[SCN.cur]()end
|
||||
if SCN.draw then SCN.draw()end
|
||||
|
||||
--Draw widgets
|
||||
WIDGET.draw()
|
||||
|
||||
--Draw cursor
|
||||
if mouseShow then
|
||||
local r=Timer()*.5
|
||||
local r=T*.5
|
||||
local R=int(r)%7+1
|
||||
_=SKIN.libColor[SETTING.skin[R]]
|
||||
gc.setColor(_[1],_[2],_[3],min(1-abs(1-r%1*2),.3))
|
||||
gc.draw(TEXTURE.miniBlock[R],mx,my,Timer()%3.1416*4,20,20,spinCenters[R][0][2]+.5,#BLOCKS[R][0]-spinCenters[R][0][1]-.5)
|
||||
gc.draw(TEXTURE.miniBlock[R],mx,my,T%3.1416*4,20,20,spinCenters[R][0][2]+.5,#BLOCKS[R][0]-spinCenters[R][0][1]-.5)
|
||||
gc.setColor(1,1,1,.5)gc.circle("fill",mx,my,5)
|
||||
gc.setColor(1,1,1)gc.circle("fill",mx,my,3)
|
||||
end
|
||||
sysFX.draw()
|
||||
SYSFX.draw()
|
||||
TEXT.draw()
|
||||
gc.pop()
|
||||
|
||||
@@ -554,8 +530,8 @@ function love.run()
|
||||
--Draw network working
|
||||
if TASK.netTaskCount>0 then
|
||||
setFont(30)
|
||||
gc.setColor(COLOR.rainbow(Timer()*5))
|
||||
gc.print("E",1250,0,.26+.355*math.sin(Timer()*6.26))
|
||||
gc.setColor(COLOR.rainbow(T*5))
|
||||
gc.print("E",1250,0,.26+.355*math.sin(T*6.26))
|
||||
end
|
||||
|
||||
--Draw FPS
|
||||
@@ -584,6 +560,7 @@ function love.run()
|
||||
LOG.draw()
|
||||
|
||||
PRESENT()
|
||||
DISCARD()--SPEED UPUPUP!
|
||||
end
|
||||
end
|
||||
|
||||
@@ -595,7 +572,6 @@ function love.run()
|
||||
end
|
||||
if gc.getWidth()~=SCR.w then
|
||||
love.resize(gc.getWidth(),gc.getHeight())
|
||||
LOG.print("Screen Resized",COLOR.yellow)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
local langList={
|
||||
require("LANG/lang_zh"),
|
||||
require("LANG/lang_zh2"),
|
||||
require("LANG/lang_en"),
|
||||
require("LANG/lang_fr"),
|
||||
require("LANG/lang_sp"),
|
||||
require("LANG/lang_symbol"),
|
||||
require("LANG/lang_yygq"),
|
||||
require"parts/language/lang_zh",
|
||||
require"parts/language/lang_zh2",
|
||||
require"parts/language/lang_en",
|
||||
require"parts/language/lang_fr",
|
||||
require"parts/language/lang_sp",
|
||||
require"parts/language/lang_symbol",
|
||||
require"parts/language/lang_yygq",
|
||||
--Add new language file to LANG folder. Attention, new language won't show in-game when you add language
|
||||
}
|
||||
local publicText={
|
||||
@@ -40,6 +40,12 @@ local publicWidgetText={
|
||||
symbol="?????",
|
||||
yygq="就这?",
|
||||
},
|
||||
custom_field={
|
||||
b0="",b1="",b2="",b3="",b4="",b5="",b6="",b7="",
|
||||
b8="",b9="",b10="",b11="",b12="",b13="",b14="",b15="",b16="",
|
||||
b17="[ ]",b18="N",b19="B",b20="_",b21="_",b22="_",b23="_",b24="_",
|
||||
},
|
||||
mg_cubefield={},
|
||||
}
|
||||
local function langFallback(T0,T)
|
||||
for k,v in next,T0 do
|
||||
|
||||
@@ -1,89 +0,0 @@
|
||||
--LIGHT MODULE(Optimized by MrZ,Original on github/love2d community/simple-love-lights)
|
||||
--Heavily based on mattdesl's libGDX implementation:
|
||||
--https://github.com/mattdesl/lwjgl-basics/wiki/2D-Pixel-Perfect-Shadows
|
||||
local gc=love.graphics
|
||||
local C=gc.clear
|
||||
local shadowMapShader=gc.newShader("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
|
||||
local function setPow(L,pow)
|
||||
L.size=pow
|
||||
end
|
||||
local function destroy(L)
|
||||
L.blackCanvas:release()
|
||||
L.shadowCanvas:release()
|
||||
L.renderCanvas:release()
|
||||
end
|
||||
local function draw(L)
|
||||
--Initialization
|
||||
local r,g,b,a=love.graphics.getColor()
|
||||
gc.setCanvas(L.blackCanvas)C()
|
||||
gc.setCanvas(L.shadowCanvas)C()
|
||||
gc.setCanvas(L.renderCanvas)C()
|
||||
lightRenderShader:send("xresolution",L.size)
|
||||
shadowMapShader:send("yresolution",L.size)
|
||||
|
||||
--Get up-left of light
|
||||
local X=L.x-L.size*.5
|
||||
local Y=L.y-L.size*.5
|
||||
|
||||
--Render solid
|
||||
gc.translate(-X,-Y)
|
||||
L.blackCanvas:renderTo(L.blackFn)
|
||||
gc.translate(X,Y)
|
||||
|
||||
--Render shade canvas by solid
|
||||
gc.setShader(shadowMapShader)
|
||||
gc.setCanvas(L.shadowCanvas)
|
||||
gc.draw(L.blackCanvas)
|
||||
|
||||
--Render light canvas by shade
|
||||
gc.setShader(lightRenderShader)
|
||||
gc.setCanvas(L.renderCanvas)
|
||||
gc.draw(L.shadowCanvas,0,0,0,1,L.size)
|
||||
|
||||
--Ready to final render
|
||||
gc.setShader()gc.setCanvas()gc.setBlendMode("add")
|
||||
|
||||
--Render to screes
|
||||
gc.setColor(r,g,b,a)
|
||||
gc.draw(L.renderCanvas,X,Y+L.size,0,1,-1)
|
||||
|
||||
--Reset
|
||||
gc.setBlendMode("alpha")
|
||||
end
|
||||
|
||||
local LIGHT={}
|
||||
function LIGHT.draw()
|
||||
for i=1,#Lights do
|
||||
Lights[i]:draw()
|
||||
end
|
||||
end
|
||||
function LIGHT.clear()
|
||||
for i=#Lights,1,-1 do
|
||||
Lights[i]:destroy()
|
||||
Lights[i]=nil
|
||||
end
|
||||
end
|
||||
function LIGHT.add(x,y,R,F)
|
||||
local id=#Lights+1
|
||||
Lights[id]={
|
||||
--Methods
|
||||
id=id,
|
||||
x=x,y=y,size=R,
|
||||
blackCanvas=gc.newCanvas(R,R),--Solid canvas
|
||||
shadowCanvas=gc.newCanvas(R,1),--1D vis-depth canvas
|
||||
renderCanvas=gc.newCanvas(R,R),--Light canvas
|
||||
blackFn=F,--Solid draw funcion
|
||||
|
||||
|
||||
move=move,
|
||||
setPow=setPow,
|
||||
draw=draw,
|
||||
destroy=destroy,
|
||||
}
|
||||
end
|
||||
return LIGHT
|
||||
89
Zframework/light/init.lua
Normal file
89
Zframework/light/init.lua
Normal file
@@ -0,0 +1,89 @@
|
||||
--LIGHT MODULE (Optimized by MrZ, Original on github/love2d community/simple-love-lights)
|
||||
--Heavily based on mattdesl's libGDX implementation:
|
||||
--https://github.com/mattdesl/lwjgl-basics/wiki/2D-Pixel-Perfect-Shadows
|
||||
local gc=love.graphics
|
||||
local clear,translate=gc.clear,gc.translate
|
||||
local setCanvas,setShader=gc.setCanvas,gc.setShader
|
||||
local render=gc.draw
|
||||
|
||||
local shadowMapShader=gc.newShader("Zframework/light/shadowMap.glsl")--Shader for caculating the 1D shadow map.
|
||||
local lightRenderShader=gc.newShader("Zframework/light/lightRender.glsl")--Shader for rendering blurred lights and shadows.
|
||||
local Lights={}--Lightsource objects
|
||||
local function move(L,x,y)
|
||||
L.x,L.y=x,y
|
||||
end
|
||||
local function setPow(L,pow)
|
||||
L.size=pow
|
||||
end
|
||||
local function destroy(L)
|
||||
L.blackCanvas:release()
|
||||
L.shadowCanvas:release()
|
||||
L.renderCanvas:release()
|
||||
end
|
||||
local function draw(L)
|
||||
--Initialization
|
||||
local r,g,b,a=gc.getColor()
|
||||
setCanvas(L.blackCanvas)clear()
|
||||
setCanvas(L.shadowCanvas)clear()
|
||||
setCanvas(L.renderCanvas)clear()
|
||||
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
|
||||
translate(-X,-Y)
|
||||
L.blackCanvas:renderTo(L.blackFn)
|
||||
translate(X,Y)
|
||||
|
||||
--Render shade canvas by solid
|
||||
setShader(shadowMapShader)
|
||||
setCanvas(L.shadowCanvas)
|
||||
render(L.blackCanvas)
|
||||
|
||||
--Render light canvas by shade
|
||||
setShader(lightRenderShader)
|
||||
setCanvas(L.renderCanvas)
|
||||
render(L.shadowCanvas,0,0,0,1,L.size)
|
||||
|
||||
--Ready to final render
|
||||
setShader()setCanvas()gc.setBlendMode("add")
|
||||
|
||||
--Render to screes
|
||||
gc.setColor(r,g,b,a)
|
||||
render(L.renderCanvas,X,Y+L.size,0,1,-1)
|
||||
|
||||
--Reset
|
||||
gc.setBlendMode("alpha")
|
||||
end
|
||||
|
||||
local LIGHT={}
|
||||
function LIGHT.draw()
|
||||
for i=1,#Lights do
|
||||
draw(Lights[i])
|
||||
end
|
||||
end
|
||||
function LIGHT.clear()
|
||||
for i=#Lights,1,-1 do
|
||||
Lights[i]:destroy()
|
||||
Lights[i]=nil
|
||||
end
|
||||
end
|
||||
function LIGHT.add(x,y,radius,solidFunc)
|
||||
local id=#Lights+1
|
||||
Lights[id]={
|
||||
id=id,
|
||||
x=x,y=y,size=radius,
|
||||
blackCanvas=gc.newCanvas(radius,radius),--Solid canvas
|
||||
shadowCanvas=gc.newCanvas(radius,1),--1D vis-depth canvas
|
||||
renderCanvas=gc.newCanvas(radius,radius),--Light canvas
|
||||
blackFn=solidFunc,--Solid draw funcion
|
||||
|
||||
move=move,
|
||||
setPow=setPow,
|
||||
destroy=destroy,
|
||||
}
|
||||
end
|
||||
return LIGHT
|
||||
@@ -1,29 +1,29 @@
|
||||
#define PI 3.14159
|
||||
extern float xresolution;
|
||||
//sample from 1D vis-depth map
|
||||
// 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
|
||||
// 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
|
||||
// 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)
|
||||
// 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(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
|
||||
// Multiply the distance to get a soft fading
|
||||
return vec4(vec3(1.),sum*smoothstep(1.,0.,r));
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
#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.
|
||||
// Iterate through the occluder map's y-axis.
|
||||
for(float y=0.;y<yresolution;y++){
|
||||
//cartesian to polar
|
||||
// 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;
|
||||
@@ -12,10 +12,9 @@ vec4 effect(vec4 color,Image texture,vec2 texture_coords,vec2 screen_coords){
|
||||
//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
|
||||
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
|
||||
return vec4(1.);// Return max distance 1
|
||||
}
|
||||
@@ -4,7 +4,7 @@ local ins,rem=table.insert,table.remove
|
||||
|
||||
local debugMesList={}
|
||||
local debugMesHistory={
|
||||
"Version: "..VERSION,
|
||||
"Version: "..VERSION_NAME,
|
||||
os.date("Launched at %Y/%m/%d %H:%M"),
|
||||
}
|
||||
local LOG={}
|
||||
|
||||
@@ -15,21 +15,17 @@ local _ncalls = {}
|
||||
-- list of internal profiler functions
|
||||
local _internal = {}
|
||||
|
||||
local getInfo=debug.getinfo
|
||||
local getInfo = debug.getinfo
|
||||
function profile.hooker(event, line, info)
|
||||
info = info or getInfo(2, 'fnS')
|
||||
local f = info.func
|
||||
-- ignore the profiler itself
|
||||
if _internal[f] or info.what ~= "Lua" then
|
||||
return
|
||||
end
|
||||
if _internal[f] or info.what ~= "Lua" then return end
|
||||
-- get the function name if available
|
||||
if info.name then
|
||||
_labeled[f] = info.name
|
||||
end
|
||||
if info.name then _labeled[f] = info.name end
|
||||
-- find the line definition
|
||||
if not _defined[f] then
|
||||
_defined[f] = info.short_src..":"..info.linedefined
|
||||
_defined[f] = info.short_src .. ":" .. info.linedefined
|
||||
_ncalls[f] = 0
|
||||
_telapsed[f] = 0
|
||||
end
|
||||
@@ -49,13 +45,6 @@ function profile.hooker(event, line, info)
|
||||
end
|
||||
end
|
||||
|
||||
--- Sets a clock function to be used by the profiler.
|
||||
-- @param f Clock function that returns a number
|
||||
function profile.setclock(f)
|
||||
assert(type(f) == "function", "clock must be a function")
|
||||
clock = f
|
||||
end
|
||||
|
||||
--- Starts collecting data.
|
||||
function profile.start()
|
||||
if rawget(_G, 'jit') then
|
||||
@@ -68,15 +57,15 @@ end
|
||||
--- Stops collecting data.
|
||||
function profile.stop()
|
||||
debug.sethook()
|
||||
for f in next,_tcalled do
|
||||
for f in next, _tcalled do
|
||||
local dt = clock() - _tcalled[f]
|
||||
_telapsed[f] = _telapsed[f] + dt
|
||||
_tcalled[f] = nil
|
||||
end
|
||||
-- merge closures
|
||||
local lookup = {}
|
||||
for f, d in next,_defined do
|
||||
local id = (_labeled[f] or '?')..d
|
||||
for f, d in next, _defined do
|
||||
local id = (_labeled[f] or '?') .. d
|
||||
local f2 = lookup[id]
|
||||
if f2 then
|
||||
_ncalls[f2] = _ncalls[f2] + (_ncalls[f] or 0)
|
||||
@@ -92,31 +81,22 @@ end
|
||||
|
||||
--- Resets all collected data.
|
||||
function profile.reset()
|
||||
for f in next,_ncalls do
|
||||
_ncalls[f] = 0
|
||||
end
|
||||
for f in next,_telapsed do
|
||||
_telapsed[f] = 0
|
||||
end
|
||||
for f in next,_tcalled do
|
||||
_tcalled[f] = nil
|
||||
end
|
||||
for f in next, _ncalls do _ncalls[f] = 0 end
|
||||
for f in next, _telapsed do _telapsed[f] = 0 end
|
||||
for f in next, _tcalled do _tcalled[f] = nil end
|
||||
collectgarbage('collect')
|
||||
end
|
||||
|
||||
function profile.comp(a, b)
|
||||
local dt = _telapsed[b] - _telapsed[a]
|
||||
if dt == 0 then
|
||||
return _ncalls[b] < _ncalls[a]
|
||||
end
|
||||
return dt < 0
|
||||
return dt == 0 and _ncalls[b] < _ncalls[a] or dt < 0
|
||||
end
|
||||
|
||||
--- Iterates all functions that have been called since the profile was started.
|
||||
-- @param n Number of results (optional)
|
||||
function profile.query(limit)
|
||||
local t = {}
|
||||
for f, n in next,_ncalls do
|
||||
for f, n in next, _ncalls do
|
||||
if n > 0 then
|
||||
t[#t + 1] = f
|
||||
end
|
||||
@@ -132,12 +112,12 @@ function profile.query(limit)
|
||||
if _tcalled[f] then
|
||||
dt = clock() - _tcalled[f]
|
||||
end
|
||||
t[i] = { i, _labeled[f] or '?', _ncalls[f], _telapsed[f] + dt, _defined[f] }
|
||||
t[i] = {i, _labeled[f] or '?', _ncalls[f], _telapsed[f] + dt, _defined[f]}
|
||||
end
|
||||
return t
|
||||
end
|
||||
|
||||
local cols = { 3, 29, 11, 24, 32 }
|
||||
local cols = {3, 29, 11, 24, 32}
|
||||
function profile.report(n)
|
||||
local out = {}
|
||||
local report = profile.query(n)
|
||||
@@ -148,7 +128,7 @@ function profile.report(n)
|
||||
s = tostring(s)
|
||||
local l1 = s:len()
|
||||
if l1 < l2 then
|
||||
s = s..(' '):rep(l2-l1)
|
||||
s = s .. (' '):rep(l2 - l1)
|
||||
elseif l1 > l2 then
|
||||
s = s:sub(l1 - l2 + 1, l1)
|
||||
end
|
||||
@@ -159,14 +139,14 @@ function profile.report(n)
|
||||
|
||||
local row = " +-----+-------------------------------+-------------+--------------------------+----------------------------------+ \n"
|
||||
local col = " | # | Function | Calls | Time | Code | \n"
|
||||
local sz = row..col..row
|
||||
local sz = row .. col .. row
|
||||
if #out > 0 then
|
||||
sz = sz..' | '..table.concat(out, ' | \n | ')..' | \n'
|
||||
sz = sz .. ' | ' .. table.concat(out, ' | \n | ') .. ' | \n'
|
||||
end
|
||||
return '\n'..sz..row
|
||||
return '\n' .. sz .. row
|
||||
end
|
||||
|
||||
local switch=false
|
||||
local switch = false
|
||||
function profile.switch()
|
||||
if switch then
|
||||
profile.stop()
|
||||
@@ -177,14 +157,12 @@ function profile.switch()
|
||||
PROFILE.start()
|
||||
LOG.print("profile start!")
|
||||
end
|
||||
switch=not switch
|
||||
switch = not switch
|
||||
end
|
||||
|
||||
-- store all internal profiler functions
|
||||
for _, v in next,profile do
|
||||
if type(v) == "function" then
|
||||
_internal[v] = true
|
||||
end
|
||||
for _, v in next, profile do
|
||||
if type(v) == "function" then _internal[v] = true end
|
||||
end
|
||||
|
||||
return profile
|
||||
return profile
|
||||
|
||||
@@ -2,12 +2,10 @@ local gc=love.graphics
|
||||
local abs=math.abs
|
||||
local SCR=SCR
|
||||
|
||||
sceneInit,sceneBack={},{}
|
||||
local sceneInit,sceneBack=sceneInit,sceneBack
|
||||
sceneInit.quit=love.event.quit
|
||||
local scenes={}
|
||||
|
||||
local SCN={
|
||||
cur="load",--Current scene
|
||||
cur="NULL",--Current scene name
|
||||
swapping=false,--If Swapping
|
||||
stat={
|
||||
tar=nil, --Swapping target
|
||||
@@ -16,9 +14,33 @@ local SCN={
|
||||
time=nil, --Full swap time
|
||||
draw=nil, --Swap draw func
|
||||
},
|
||||
seq={"quit","slowFade"},--Back sequence
|
||||
stack={"quit","slowFade"},--Scene stack
|
||||
|
||||
scenes=scenes,
|
||||
|
||||
--Events
|
||||
update=nil,
|
||||
draw=nil,
|
||||
mouseClick=nil,
|
||||
touchClick=nil,
|
||||
mouseDown=nil,
|
||||
mouseMove=nil,
|
||||
mouseUp=nil,
|
||||
wheelMoved=nil,
|
||||
touchDown=nil,
|
||||
touchUp=nil,
|
||||
touchMove=nil,
|
||||
keyDown=nil,
|
||||
keyUp=nil,
|
||||
gamepadDown=nil,
|
||||
gamepadUp=nil,
|
||||
socketRead=nil,
|
||||
}--Scene datas, returned
|
||||
|
||||
function SCN.add(name,scene)
|
||||
scenes[name]=scene
|
||||
end
|
||||
|
||||
function SCN.swapUpdate()
|
||||
local S=SCN.stat
|
||||
S.time=S.time-1
|
||||
@@ -32,19 +54,39 @@ function SCN.swapUpdate()
|
||||
end
|
||||
end
|
||||
function SCN.init(s,org)
|
||||
if sceneInit[s]then sceneInit[s](org)end
|
||||
local S=scenes[s]
|
||||
SCN.cur=s
|
||||
|
||||
SCN.sceneInit=S.sceneInit
|
||||
SCN.sceneBack=S.sceneBack
|
||||
SCN.update=S.update
|
||||
SCN.draw=S.draw
|
||||
SCN.mouseClick=S.mouseClick
|
||||
SCN.touchClick=S.touchClick
|
||||
SCN.mouseDown=S.mouseDown
|
||||
SCN.mouseMove=S.mouseMove
|
||||
SCN.mouseUp=S.mouseUp
|
||||
SCN.wheelMoved=S.wheelMoved
|
||||
SCN.touchDown=S.touchDown
|
||||
SCN.touchUp=S.touchUp
|
||||
SCN.touchMove=S.touchMove
|
||||
SCN.keyDown=S.keyDown
|
||||
SCN.keyUp=S.keyUp
|
||||
SCN.gamepadDown=S.gamepadDown
|
||||
SCN.gamepadUp=S.gamepadUp
|
||||
SCN.socketRead=S.socketRead
|
||||
if S.sceneInit then S.sceneInit(org)end
|
||||
WIDGET.set(s)
|
||||
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"
|
||||
local m=#SCN.stack
|
||||
SCN.stack[m+1]=tar or SCN.cur
|
||||
SCN.stack[m+2]=style or"fade"
|
||||
end
|
||||
end
|
||||
function SCN.pop()
|
||||
local _=SCN.seq
|
||||
local _=SCN.stack
|
||||
_[#_],_[#_-1]=nil
|
||||
end
|
||||
|
||||
@@ -86,27 +128,35 @@ local swap={
|
||||
end},
|
||||
}--Scene swapping animations
|
||||
function SCN.swapTo(tar,style)--Parallel scene swapping, cannot back
|
||||
local S=SCN.stat
|
||||
if not SCN.swapping and tar~=SCN.cur then
|
||||
if not style then style="fade"end
|
||||
SCN.swapping=true
|
||||
S.tar,S.style=tar,style
|
||||
S.time,S.mid,S.draw=unpack(swap[style])
|
||||
if scenes[tar]then
|
||||
local S=SCN.stat
|
||||
if not SCN.swapping and tar~=SCN.cur then
|
||||
if not style then style="fade"end
|
||||
SCN.swapping=true
|
||||
S.tar,S.style=tar,style
|
||||
S.time,S.mid,S.draw=unpack(swap[style])
|
||||
end
|
||||
else
|
||||
LOG.print("No Scene: "..tar,"warn")
|
||||
end
|
||||
end
|
||||
function SCN.go(tar,style)--Normal scene swapping, can back
|
||||
SCN.push()
|
||||
SCN.swapTo(tar,style)
|
||||
if scenes[tar]then
|
||||
SCN.push()
|
||||
SCN.swapTo(tar,style)
|
||||
else
|
||||
LOG.print("No Scene: "..tar,"warn")
|
||||
end
|
||||
end
|
||||
function SCN.back()
|
||||
--Leave scene
|
||||
if sceneBack[SCN.cur] then sceneBack[SCN.cur]()end
|
||||
if SCN.sceneBack then SCN.sceneBack()end
|
||||
|
||||
--Poll&Back to previous Scene
|
||||
local m=#SCN.seq
|
||||
local m=#SCN.stack
|
||||
if m>0 then
|
||||
SCN.swapTo(SCN.seq[m-1],SCN.seq[m])
|
||||
SCN.seq[m],SCN.seq[m-1]=nil
|
||||
SCN.swapTo(SCN.stack[m-1],SCN.stack[m])
|
||||
SCN.stack[m],SCN.stack[m-1]=nil
|
||||
end
|
||||
end
|
||||
return SCN
|
||||
14
Zframework/screen.lua
Normal file
14
Zframework/screen.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
local SCR={
|
||||
w0=1280,h0=720,--Default Screen Size
|
||||
x=0,y=0,--Up-left Coord on screen
|
||||
w=0,h=0,--Fullscreen w/h in gc
|
||||
W=0,H=0,--Fullscreen w/h in shader
|
||||
rad=0,--Radius
|
||||
k=1,--Scale size
|
||||
dpi=1,--DPI from gc.getDPIScale()
|
||||
xOy=love.math.newTransform(),--Screen transformation object
|
||||
}
|
||||
function SCR.setSize(w,h)
|
||||
SCR.w0,SCR.h0=w,h
|
||||
end
|
||||
return SCR
|
||||
@@ -1,32 +1,13 @@
|
||||
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.set(L)
|
||||
SFX.list=L
|
||||
SFX.len=#L
|
||||
end
|
||||
function SFX.loadOne(_)
|
||||
_,SFX.list[_]=SFX.list[_]
|
||||
local N="/SFX/".._..".ogg"
|
||||
local N="media/SFX/".._..".ogg"
|
||||
if love.filesystem.getInfo(N)then
|
||||
SFX.list[_]={love.audio.newSource(N,"static")}
|
||||
else
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
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
|
||||
}
|
||||
@@ -1,5 +0,0 @@
|
||||
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;
|
||||
}
|
||||
@@ -1,10 +1,16 @@
|
||||
local gc=love.graphics
|
||||
local setColor,setWidth=gc.setColor,gc.setLineWidth
|
||||
local max,min=math.max,math.min
|
||||
local rnd=math.random
|
||||
local rem=table.remove
|
||||
|
||||
local fx={}
|
||||
|
||||
local function normUpdate(S,dt)
|
||||
S.t=S.t+dt*S.rate
|
||||
return S.t>1
|
||||
end
|
||||
|
||||
local FXupdate={}
|
||||
function FXupdate.badge(S,dt)
|
||||
S.t=S.t+dt
|
||||
@@ -19,22 +25,22 @@ function FXupdate.badge(S,dt)
|
||||
end
|
||||
return S.t>=1
|
||||
end
|
||||
function FXupdate.attack(S,dt)
|
||||
FXupdate.attack=normUpdate
|
||||
FXupdate.ripple=normUpdate
|
||||
FXupdate.rectRipple=normUpdate
|
||||
FXupdate.shade=normUpdate
|
||||
function FXupdate.cell(S,dt)
|
||||
if S.vx then
|
||||
S.x=S.x+S.vx*S.rate
|
||||
S.y=S.y+S.vy*S.rate
|
||||
if S.ax then
|
||||
S.vx=S.vx+S.ax*S.rate
|
||||
S.vy=S.vy+S.ay*S.rate
|
||||
end
|
||||
end
|
||||
S.t=S.t+dt*S.rate
|
||||
return S.t>1
|
||||
end
|
||||
function FXupdate.ripple(S,dt)
|
||||
S.t=S.t+dt*S.rate
|
||||
return S.t>=1
|
||||
end
|
||||
function FXupdate.rectRipple(S,dt)
|
||||
S.t=S.t+dt*S.rate
|
||||
return S.t>=1
|
||||
end
|
||||
function FXupdate.shade(S,dt)
|
||||
S.t=S.t+dt*S.rate
|
||||
return S.t>=1
|
||||
end
|
||||
|
||||
local FXdraw={}
|
||||
function FXdraw.badge(S)
|
||||
@@ -78,22 +84,26 @@ function FXdraw.shade(S)
|
||||
setColor(S.r,S.g,S.b,1-S.t)
|
||||
gc.rectangle("fill",S.x,S.y,S.w,S.h,2)
|
||||
end
|
||||
function FXdraw.cell(S)
|
||||
setColor(1,1,1,1-S.t)
|
||||
gc.draw(S.image,S.x,S.y,nil,S.size,nil,S.cx,S.cy)
|
||||
end
|
||||
|
||||
local sysFX={}
|
||||
function sysFX.update(dt)
|
||||
local SYSFX={}
|
||||
function SYSFX.update(dt)
|
||||
for i=#fx,1,-1 do
|
||||
if fx[i]:update(dt) then
|
||||
rem(fx,i)
|
||||
end
|
||||
end
|
||||
end
|
||||
function sysFX.draw()
|
||||
function SYSFX.draw()
|
||||
for i=1,#fx do
|
||||
fx[i]:draw()
|
||||
end
|
||||
end
|
||||
|
||||
function sysFX.newBadge(x1,y1,x2,y2)
|
||||
function SYSFX.newBadge(x1,y1,x2,y2)
|
||||
fx[#fx+1]={
|
||||
update=FXupdate.badge,
|
||||
draw=FXdraw.badge,
|
||||
@@ -103,7 +113,7 @@ function sysFX.newBadge(x1,y1,x2,y2)
|
||||
x2=x2,y2=y2,
|
||||
}
|
||||
end
|
||||
function sysFX.newAttack(rate,x1,y1,x2,y2,wid,r,g,b,a)
|
||||
function SYSFX.newAttack(rate,x1,y1,x2,y2,wid,r,g,b,a)
|
||||
fx[#fx+1]={
|
||||
update=FXupdate.attack,
|
||||
draw=FXdraw.attack,
|
||||
@@ -115,32 +125,45 @@ function sysFX.newAttack(rate,x1,y1,x2,y2,wid,r,g,b,a)
|
||||
r=r,g=g,b=b,a=a,
|
||||
}
|
||||
end
|
||||
function sysFX.newRipple(duration,x,y,r)
|
||||
function SYSFX.newRipple(rate,x,y,r)
|
||||
fx[#fx+1]={
|
||||
update=FXupdate.ripple,
|
||||
draw=FXdraw.ripple,
|
||||
t=0,
|
||||
rate=1/duration,
|
||||
rate=rate,
|
||||
x=x,y=y,r=r,
|
||||
}
|
||||
end
|
||||
function sysFX.newRectRipple(duration,x,y,w,h)
|
||||
function SYSFX.newRectRipple(rate,x,y,w,h)
|
||||
fx[#fx+1]={
|
||||
update=FXupdate.rectRipple,
|
||||
draw=FXdraw.rectRipple,
|
||||
t=0,
|
||||
rate=1/duration,
|
||||
rate=rate,
|
||||
x=x,y=y,w=w,h=h,
|
||||
}
|
||||
end
|
||||
function sysFX.newShade(duration,r,g,b,x,y,w,h)
|
||||
function SYSFX.newShade(rate,r,g,b,x,y,w,h)
|
||||
fx[#fx+1]={
|
||||
update=FXupdate.shade,
|
||||
draw=FXdraw.shade,
|
||||
t=0,
|
||||
rate=1/duration,
|
||||
rate=rate,
|
||||
r=r,g=g,b=b,
|
||||
x=x,y=y,w=w,h=h,
|
||||
}
|
||||
end
|
||||
return sysFX
|
||||
function SYSFX.newCell(rate,image,size,x,y,vx,vy,ax,ay)
|
||||
fx[#fx+1]={
|
||||
update=FXupdate.cell,
|
||||
draw=FXdraw.cell,
|
||||
t=0,
|
||||
rate=rate*(.9+rnd()*.2),
|
||||
image=image,size=size,
|
||||
cx=image:getWidth()*.5,cy=image:getHeight()*.5,
|
||||
x=x,y=y,
|
||||
vx=vx,vy=vy,
|
||||
ax=ax,ay=ay,
|
||||
}
|
||||
end
|
||||
return SYSFX
|
||||
@@ -1,4 +1,6 @@
|
||||
local rem=table.remove
|
||||
local ct=coroutine
|
||||
local assert=assert
|
||||
local tasks={}
|
||||
|
||||
local TASK={
|
||||
@@ -10,37 +12,54 @@ end
|
||||
function TASK.update()
|
||||
for i=#tasks,1,-1 do
|
||||
local T=tasks[i]
|
||||
if T.code(T.data)then
|
||||
if T.data.net then
|
||||
assert(ct.resume(T.thread))
|
||||
if ct.status(T.thread)=="dead"then
|
||||
if T.net then
|
||||
TASK.netTaskCount=TASK.netTaskCount-1
|
||||
end
|
||||
rem(tasks,i)
|
||||
end
|
||||
end
|
||||
end
|
||||
function TASK.new(code,data)
|
||||
tasks[#tasks+1]={
|
||||
code=code,
|
||||
data=data,
|
||||
}
|
||||
function TASK.new(code,...)
|
||||
local thread=ct.create(code)
|
||||
if ...~=nil then ct.resume(thread,...)end
|
||||
if ct.status(thread)~="dead"then
|
||||
tasks[#tasks+1]={
|
||||
thread=thread,
|
||||
code=code,
|
||||
args={...},
|
||||
}
|
||||
end
|
||||
end
|
||||
function TASK.changeCode(c1,c2)
|
||||
for i=#tasks,1,-1 do
|
||||
if tasks[i].code==c1 then
|
||||
tasks[i].code=c2
|
||||
end
|
||||
function TASK.newNet(code,...)
|
||||
local thread=ct.create(code)
|
||||
if ...~=nil then ct.resume(thread,...)end
|
||||
if ct.status(thread)~="dead"then
|
||||
tasks[#tasks+1]={
|
||||
thread=thread,
|
||||
code=code,
|
||||
args={...},
|
||||
net=true,
|
||||
}
|
||||
end
|
||||
end
|
||||
function TASK.removeTask_code(code)
|
||||
for i=#tasks,1,-1 do
|
||||
if tasks[i].code==code then
|
||||
if tasks[i].net then
|
||||
TASK.netTaskCount=TASK.netTaskCount-1
|
||||
end
|
||||
rem(tasks,i)
|
||||
end
|
||||
end
|
||||
end
|
||||
function TASK.removeTask_data(data)
|
||||
function TASK.removeTask_iterate(func,...)
|
||||
for i=#tasks,1,-1 do
|
||||
if tasks[i].data==data then
|
||||
if func(tasks[i],...)then
|
||||
if tasks[i].net then
|
||||
TASK.netTaskCount=TASK.netTaskCount-1
|
||||
end
|
||||
rem(tasks,i)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -131,6 +131,9 @@ do--dumpTable
|
||||
else
|
||||
s="return{\n"
|
||||
t=1
|
||||
if type(L)~="table"then
|
||||
return
|
||||
end
|
||||
end
|
||||
local count=1
|
||||
for k,v in next,L do
|
||||
@@ -163,27 +166,6 @@ do--dumpTable
|
||||
return s..tabs[t-1].."}"
|
||||
end
|
||||
end
|
||||
do--httpRequest
|
||||
client=LOADLIB("NETlib")
|
||||
httpRequest=
|
||||
client and function(tick,api,method,header,body)
|
||||
local task,err=client.httpraw{
|
||||
url="http://47.103.200.40/"..api,
|
||||
method=method or"GET",
|
||||
header=header,
|
||||
body=body,
|
||||
}
|
||||
if task then
|
||||
TASK.new(tick,{task=task,time=0,net=true})
|
||||
else
|
||||
LOG.print("NETlib error: "..err,"warn")
|
||||
end
|
||||
TASK.netTaskCount=TASK.netTaskCount+1
|
||||
end or
|
||||
function()
|
||||
LOG.print("[NO NETlib]",5,COLOR.yellow)
|
||||
end
|
||||
end
|
||||
do--json
|
||||
--
|
||||
-- json.lua
|
||||
@@ -302,7 +284,13 @@ do--json
|
||||
end
|
||||
|
||||
function json.encode(val)
|
||||
return pcall(encode,val)
|
||||
local a,b=pcall(encode,val)
|
||||
if a then
|
||||
return b
|
||||
else
|
||||
LOG.print(text.jsonError..": "..(b or"uknErr"),"warn")
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -529,37 +517,102 @@ do--json
|
||||
return res
|
||||
end
|
||||
function json.decode(str)
|
||||
return pcall(decode,str)
|
||||
local a,b=pcall(decode,str)
|
||||
if a then
|
||||
return b
|
||||
else
|
||||
LOG.print(text.jsonError..": "..(b or"uknErr"),"warn")
|
||||
return
|
||||
end
|
||||
end
|
||||
end
|
||||
do--urlencode
|
||||
local rshift=bit.rshift
|
||||
local b16={[0]="0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"}
|
||||
urlencode={}
|
||||
function urlencode.encode(T)
|
||||
local out={}
|
||||
for k,v in next,T do
|
||||
local k1=""
|
||||
for i=1,#k do
|
||||
if k:sub(i,i):match("[a-zA-Z0-9]")then
|
||||
k1=k1..k:sub(i,i)
|
||||
else
|
||||
local b=k:byte(i)
|
||||
k1=k1.."%"..b16[rshift(b,4)]..b16[b%16]
|
||||
end
|
||||
function urlEncode(str)
|
||||
local out=""
|
||||
for i=1,#str do
|
||||
if str:sub(i,i):match("[a-zA-Z0-9]")then
|
||||
out=out..str:sub(i,i)
|
||||
else
|
||||
local b=str:byte(i)
|
||||
out=out.."%"..b16[rshift(b,4)]..b16[b%16]
|
||||
end
|
||||
local v1=""
|
||||
for i=1,#v do
|
||||
if v:sub(i,i):match("[a-zA-Z0-9]")then
|
||||
v1=v1..v:sub(i,i)
|
||||
else
|
||||
local b=v:byte(i)
|
||||
v1=v1.."%"..b16[rshift(b,4)]..b16[b%16]
|
||||
end
|
||||
end
|
||||
ins(out,k1.."="..v1)
|
||||
end
|
||||
return table.concat(out,"&")
|
||||
return out
|
||||
end
|
||||
end
|
||||
do--httpRequest & wsConnect
|
||||
client=LOADLIB("NETlib")
|
||||
if client then
|
||||
function httpRequest(tick,path,method,header,body)
|
||||
local task,err=client.httpraw{
|
||||
url="http://krakens.tpddns.cn:10026"..path,
|
||||
method=method or"GET",
|
||||
header=header,
|
||||
body=body,
|
||||
}
|
||||
if task then
|
||||
TASK.newNet(tick,task)
|
||||
else
|
||||
LOG.print("NETlib error: "..err,"warn")
|
||||
end
|
||||
TASK.netTaskCount=TASK.netTaskCount+1
|
||||
end
|
||||
|
||||
function wsConnect(tick,path,header)
|
||||
local task,err=client.wsraw{
|
||||
url="ws://krakens.tpddns.cn:10026"..path,
|
||||
origin="krakens.tpddns.cn",
|
||||
header=header,
|
||||
}
|
||||
if task then
|
||||
TASK.newNet(tick,task)
|
||||
else
|
||||
LOG.print("NETlib error: "..err,"warn")
|
||||
end
|
||||
TASK.netTaskCount=TASK.netTaskCount+1
|
||||
end
|
||||
|
||||
function wsWrite(data)
|
||||
if WSCONN then
|
||||
local writeErr=client.write(WSCONN,data)
|
||||
if writeErr then
|
||||
LOG.print(writeErr,"error")
|
||||
return
|
||||
end
|
||||
return true
|
||||
else
|
||||
LOG.print(text.wsNoConn,"warn")
|
||||
end
|
||||
end
|
||||
else
|
||||
local function noNetLib()
|
||||
LOG.print("[NO NETlib]",5,COLOR.yellow)
|
||||
end
|
||||
httpRequest=noNetLib
|
||||
wsConnect=noNetLib
|
||||
wsWrite=noNetLib
|
||||
end
|
||||
end
|
||||
do--wheelScroll
|
||||
local floatWheel=0
|
||||
function wheelScroll(y)
|
||||
if y>0 then
|
||||
if floatWheel<0 then floatWheel=0 end
|
||||
floatWheel=floatWheel+y^1.2
|
||||
elseif y<0 then
|
||||
if floatWheel>0 then floatWheel=0 end
|
||||
floatWheel=floatWheel-(-y)^1.2
|
||||
end
|
||||
while floatWheel>=1 do
|
||||
love.keypressed("up")
|
||||
floatWheel=floatWheel-1
|
||||
end
|
||||
while floatWheel<=-1 do
|
||||
love.keypressed("down")
|
||||
floatWheel=floatWheel+1
|
||||
end
|
||||
end
|
||||
end
|
||||
function copyList(org)
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
local level={0,0,.015,.02,.03,.04,.05,.06,.07,.08}
|
||||
local VIB=love.system.vibrate
|
||||
return function(t)
|
||||
local L=SETTING.vib
|
||||
if L>0 then
|
||||
VIB(level[L+t])
|
||||
end
|
||||
end
|
||||
8
Zframework/vibrate.lua
Normal file
8
Zframework/vibrate.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
local level={0,0,.01,.015,.02,.03,.04,.05,.06,.07}
|
||||
local vib=love.system.vibrate
|
||||
return function(t)
|
||||
local L=SETTING.vib
|
||||
if L>0 then
|
||||
vib(level[L+t])
|
||||
end
|
||||
end
|
||||
@@ -3,25 +3,21 @@ local rem=table.remove
|
||||
local voiceQueue={free=0}
|
||||
local bank={}--{vocName1={SRC1s},vocName2={SRC2s},...}
|
||||
local VOC={}
|
||||
VOC.name={
|
||||
"zspin","sspin","lspin","jspin","tspin","ospin","ispin",
|
||||
"single","double","triple","techrash",
|
||||
"mini","b2b","b3b",
|
||||
"perfect_clear","half_clear",
|
||||
"win","lose","bye",
|
||||
"test","happy","doubt","sad","egg",
|
||||
"welcome_voc",
|
||||
}
|
||||
VOC.list={}
|
||||
|
||||
local function loadVoiceFile(N,vocName)
|
||||
local fileName="VOICE/"..SETTING.cv.."/"..vocName..".ogg"
|
||||
local fileName="media/VOICE/"..SETTING.cv.."/"..vocName..".ogg"
|
||||
if love.filesystem.getInfo(fileName)then
|
||||
bank[vocName]={love.audio.newSource(fileName,"static")}
|
||||
table.insert(VOC.list[N],vocName)
|
||||
return true
|
||||
end
|
||||
end
|
||||
function VOC.set(L)
|
||||
VOC.name=L
|
||||
VOC.len=#L
|
||||
end
|
||||
|
||||
function VOC.loadOne(name)
|
||||
local N=VOC.name[name]
|
||||
VOC.list[N]={}
|
||||
|
||||
@@ -8,7 +8,6 @@ local ins=table.insert
|
||||
local Timer=love.timer.getTime
|
||||
local setFont,mStr=setFont,mStr
|
||||
|
||||
local Empty={}
|
||||
local widgetList={}
|
||||
local WIDGET={}
|
||||
local widgetMetatable={
|
||||
@@ -19,6 +18,7 @@ local widgetMetatable={
|
||||
|
||||
local text={
|
||||
type="text",
|
||||
alpha=0,
|
||||
}
|
||||
function text:reset()
|
||||
if type(self.text)=="string"then
|
||||
@@ -29,14 +29,26 @@ function text:reset()
|
||||
self.font=self.font-10
|
||||
end
|
||||
end
|
||||
function text:update()
|
||||
if self.hideCon and self.hideCon()then
|
||||
if self.alpha>0 then
|
||||
self.alpha=self.alpha-.125
|
||||
end
|
||||
elseif self.alpha<1 then
|
||||
self.alpha=self.alpha+.125
|
||||
end
|
||||
end
|
||||
function text:draw()
|
||||
gc.setColor(self.color)
|
||||
if self.align=="M"then
|
||||
gc.draw(self.text,self.x-self.text:getWidth()*.5,self.y)
|
||||
elseif self.align=="L"then
|
||||
gc.draw(self.text,self.x,self.y)
|
||||
elseif self.align=="R"then
|
||||
gc.draw(self.text,self.x-self.text:getWidth(),self.y)
|
||||
if self.alpha>0 then
|
||||
local c=self.color
|
||||
gc.setColor(c[1],c[2],c[3],self.alpha)
|
||||
if self.align=="M"then
|
||||
gc.draw(self.text,self.x-self.text:getWidth()*.5,self.y)
|
||||
elseif self.align=="L"then
|
||||
gc.draw(self.text,self.x,self.y)
|
||||
elseif self.align=="R"then
|
||||
gc.draw(self.text,self.x-self.text:getWidth(),self.y)
|
||||
end
|
||||
end
|
||||
end
|
||||
function WIDGET.newText(D)--name,x,y[,color][,font=30][,align="M"][,hide]
|
||||
@@ -47,9 +59,10 @@ function WIDGET.newText(D)--name,x,y[,color][,font=30][,align="M"][,hide]
|
||||
color= D.color and(COLOR[D.color]or D.color)or COLOR.white,
|
||||
font= D.font or 30,
|
||||
align= D.align or"M",
|
||||
hide= D.hide,
|
||||
hideCon=D.hide,
|
||||
}
|
||||
for k,v in next,text do _[k]=v end
|
||||
if not _.hideCon then _.alpha=1 end
|
||||
setmetatable(_,widgetMetatable)
|
||||
return _
|
||||
end
|
||||
@@ -102,8 +115,8 @@ function button:getCenter()
|
||||
end
|
||||
function button:FX()
|
||||
local ATV=self.ATV
|
||||
sysFX.newRectRipple(
|
||||
.16,
|
||||
SYSFX.newRectRipple(
|
||||
6,
|
||||
self.x-ATV,
|
||||
self.y-ATV,
|
||||
self.w+2*ATV,
|
||||
@@ -140,11 +153,19 @@ function button:draw()
|
||||
gc.printf(t,x+2,y0+2,w,"center")
|
||||
gc.setColor(r*.5,g*.5,b*.5)
|
||||
gc.printf(t,x,y0,w,"center")
|
||||
else
|
||||
self.text=self.name or"NONAME"
|
||||
self.color=COLOR.dPurple
|
||||
end
|
||||
end
|
||||
function button:getInfo()
|
||||
return 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
|
||||
function button:press()
|
||||
self.code()
|
||||
self:FX()
|
||||
SFX.play("button")
|
||||
end
|
||||
function WIDGET.newButton(D)--name,x,y,w[,h][,color][,font],code[,hide]
|
||||
if not D.h then D.h=D.w end
|
||||
local _={
|
||||
@@ -220,6 +241,9 @@ end
|
||||
function key:getInfo()
|
||||
return 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
|
||||
function key:press()
|
||||
self.code()
|
||||
end
|
||||
function WIDGET.newKey(D)--name,x,y,w[,h][,color][,font],code[,hide]
|
||||
if not D.h then D.h=D.w end
|
||||
local _={
|
||||
@@ -304,6 +328,10 @@ end
|
||||
function switch:getInfo()
|
||||
return format("x=%d,y=%d,font=%d",self.x,self.y,self.font)
|
||||
end
|
||||
function switch:press()
|
||||
self.code()
|
||||
SFX.play("move")
|
||||
end
|
||||
function WIDGET.newSwitch(D)--name,x,y[,font][,disp],code,hide
|
||||
local _={
|
||||
name= D.name,
|
||||
@@ -423,6 +451,37 @@ end
|
||||
function slider:getInfo()
|
||||
return format("x=%d,y=%d,w=%d",self.x,self.y,self.w)
|
||||
end
|
||||
function slider:drag(x)
|
||||
if not x then return end
|
||||
x=x-self.x
|
||||
local p=self.disp()
|
||||
local P=x<0 and 0 or x>self.w and self.unit or x/self.w*self.unit
|
||||
if not self.smooth then
|
||||
P=int(P+.5)
|
||||
end
|
||||
if p~=P then
|
||||
self.code(P)
|
||||
end
|
||||
if self.change and Timer()-self.lastTime>.18 then
|
||||
self.lastTime=Timer()
|
||||
self.change()
|
||||
end
|
||||
end
|
||||
function slider:release(x)
|
||||
self.lastTime=0
|
||||
self:drag(x)
|
||||
end
|
||||
function slider:arrowKey(isLeft)
|
||||
local p=self.disp()
|
||||
local u=(self.smooth and .01 or 1)
|
||||
local P=isLeft and max(p-u,0)or min(p+u,self.unit)
|
||||
if p==P or not P then return end
|
||||
self.code(P)
|
||||
if self.change and Timer()-self.lastTime>.18 then
|
||||
self.lastTime=Timer()
|
||||
self.change()
|
||||
end
|
||||
end
|
||||
function WIDGET.newSlider(D)--name,x,y,w[,unit][,smooth][,font][,change],disp,code,hide
|
||||
local _={
|
||||
name= D.name,
|
||||
@@ -542,7 +601,7 @@ function selector:draw()
|
||||
end
|
||||
|
||||
--Text
|
||||
setFont(28)
|
||||
setFont(30)
|
||||
t=self.text
|
||||
if t then
|
||||
gc.setColor(r,g,b)
|
||||
@@ -554,6 +613,43 @@ end
|
||||
function selector:getInfo()
|
||||
return format("x=%d,y=%d,w=%d",self.x+self.w*.5,self.y+30,self.w)
|
||||
end
|
||||
function selector:press(x)
|
||||
if x then
|
||||
local s=self.select
|
||||
if x<self.x+self.w*.5 then
|
||||
if s>1 then
|
||||
s=s-1
|
||||
SYSFX.newShade(3,1,1,1,self.x,self.y,self.w*.5,60)
|
||||
end
|
||||
else
|
||||
if s<#self.list then
|
||||
s=s+1
|
||||
SYSFX.newShade(3,1,1,1,self.x+self.w*.5,self.y,self.w*.5,60)
|
||||
end
|
||||
end
|
||||
if self.select~=s then
|
||||
self.code(self.list[s])
|
||||
self.select=s
|
||||
self.selText=self.list[s]
|
||||
SFX.play("prerotate")
|
||||
end
|
||||
end
|
||||
end
|
||||
function selector:arrowKey(isLeft)
|
||||
local s=self.select
|
||||
if isLeft and s==1 or not isLeft and s==#self.list then return end
|
||||
if isLeft then
|
||||
s=s-1
|
||||
SYSFX.newShade(3,1,1,1,self.x,self.y,self.w*.5,60)
|
||||
else
|
||||
s=s+1
|
||||
SYSFX.newShade(3,1,1,1,self.x+self.w*.5,self.y,self.w*.5,60)
|
||||
end
|
||||
self.code(self.list[s])
|
||||
self.select=s
|
||||
self.selText=self.list[s]
|
||||
SFX.play("prerotate")
|
||||
end
|
||||
function WIDGET.newSelector(D)--name,x,y,w[,color],list,disp,code,hide
|
||||
local _={
|
||||
name= D.name,
|
||||
@@ -633,7 +729,7 @@ function textBox:draw()
|
||||
gc.print("*",x-5+self.font*.5*i,y+h*.5-self.font*.7)
|
||||
end
|
||||
else
|
||||
gc.print(self.value,x+10,y+h*.5-self.font*.7)
|
||||
gc.printf(self.value,x+10,y,self.w,"left")
|
||||
setFont(self.font-10)
|
||||
if WIDGET.sel==self then
|
||||
gc.print(EDITING,x+10,y+12-self.font*1.4)
|
||||
@@ -643,6 +739,28 @@ end
|
||||
function textBox:getInfo()
|
||||
return format("x=%d,y=%d,w=%d,h=%d",self.x+self.w*.5,self.y+self.h*.5,self.w,self.h)
|
||||
end
|
||||
function textBox:press()
|
||||
if MOBILE then
|
||||
local _,y1=SCR.xOy:transformPoint(0,self.y+self.h)
|
||||
kb.setTextInput(true,0,y1,1,1)
|
||||
end
|
||||
end
|
||||
function textBox:keypress(k)
|
||||
local t=self.value
|
||||
if #t>0 and EDITING==""then
|
||||
if k=="backspace"then
|
||||
while t:byte(#t)>=128 and t:byte(#t)<192 do
|
||||
t=sub(t,1,-2)
|
||||
end
|
||||
t=sub(t,1,-2)
|
||||
SFX.play("lock")
|
||||
elseif k=="delete"then
|
||||
t=""
|
||||
SFX.play("hold")
|
||||
end
|
||||
self.value=t
|
||||
end
|
||||
end
|
||||
function WIDGET.newTextBox(D)--name,x,y,w[,h][,font][,secret][,regex],hide
|
||||
local _={
|
||||
name= D.name,
|
||||
@@ -658,7 +776,7 @@ function WIDGET.newTextBox(D)--name,x,y,w[,h][,font][,secret][,regex],hide
|
||||
D.x+D.w*.8,D.y,
|
||||
},
|
||||
|
||||
font= int(D.h/7-1)*5,
|
||||
font= D.font or int(D.h/7-1)*5,
|
||||
secret= D.secret,
|
||||
regex= D.regex,
|
||||
hide= D.hide,
|
||||
@@ -698,24 +816,24 @@ local indexMeta={
|
||||
end
|
||||
end
|
||||
}
|
||||
function WIDGET.init(scene,list)
|
||||
function WIDGET.init(sceneName,list)
|
||||
local L={}
|
||||
for i=1,#list do
|
||||
ins(L,list[i])
|
||||
end
|
||||
setmetatable(L,indexMeta)
|
||||
widgetList[scene]=L
|
||||
widgetList[sceneName]=L
|
||||
end
|
||||
function WIDGET.set(scene)
|
||||
function WIDGET.set(sceneName)
|
||||
local list=widgetList[sceneName]
|
||||
kb.setTextInput(false)
|
||||
WIDGET.sel=nil
|
||||
scene=widgetList[scene]
|
||||
WIDGET.active=scene or Empty
|
||||
WIDGET.active=list or NONE
|
||||
|
||||
--Reset all widgets
|
||||
if scene then
|
||||
for i=1,#scene do
|
||||
scene[i]:reset()
|
||||
if list then
|
||||
for i=1,#list do
|
||||
list[i]:reset()
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -741,43 +859,10 @@ 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")
|
||||
elseif W.type=="key"then
|
||||
W.code()
|
||||
elseif W.type=="switch"then
|
||||
W.code()
|
||||
SFX.play("move")
|
||||
if W.type=="button"or W.type=="key"or W.type=="switch"or W.type=="selector"or W.type=="textBox"then
|
||||
W:press(x,y)
|
||||
elseif W.type=="slider"then
|
||||
WIDGET.drag(x,y)
|
||||
elseif W.type=="selector"then
|
||||
if x then
|
||||
local s=W.select
|
||||
if x<W.x+W.w*.5 then
|
||||
if s>1 then
|
||||
s=s-1
|
||||
sysFX.newShade(.3,1,1,1,W.x,W.y,W.w*.5,60)
|
||||
end
|
||||
else
|
||||
if s<#W.list then
|
||||
s=s+1
|
||||
sysFX.newShade(.3,1,1,1,W.x+W.w*.5,W.y,W.w*.5,60)
|
||||
end
|
||||
end
|
||||
if W.select~=s then
|
||||
W.code(W.list[s])
|
||||
W.select=s
|
||||
W.selText=W.list[s]
|
||||
SFX.play("prerotate")
|
||||
end
|
||||
end
|
||||
elseif W.type=="textBox"then
|
||||
if MOBILE then
|
||||
local _,y1=SCR.xOy:transformPoint(0,W.y+W.h)
|
||||
kb.setTextInput(true,0,y1,1,1)
|
||||
end
|
||||
end
|
||||
if W.hide and W.hide()then WIDGET.sel=nil end
|
||||
end
|
||||
@@ -785,20 +870,7 @@ function WIDGET.drag(x,y)
|
||||
local W=WIDGET.sel
|
||||
if not W then return end
|
||||
if W.type=="slider"then
|
||||
if not x then return end
|
||||
x=x-W.x
|
||||
local p=W.disp()
|
||||
local P=x<0 and 0 or x>W.w and W.unit or x/W.w*W.unit
|
||||
if not W.smooth then
|
||||
P=int(P+.5)
|
||||
end
|
||||
if p~=P then
|
||||
W.code(P)
|
||||
end
|
||||
if W.change and Timer()-W.lastTime>.18 then
|
||||
W.lastTime=Timer()
|
||||
W.change()
|
||||
end
|
||||
W:drag(x,y)
|
||||
elseif not W:isAbove(x,y)then
|
||||
WIDGET.sel=nil
|
||||
end
|
||||
@@ -807,44 +879,19 @@ function WIDGET.release(x,y)
|
||||
local W=WIDGET.sel
|
||||
if not W then return end
|
||||
if W.type=="slider"then
|
||||
W.lastTime=0
|
||||
WIDGET.drag(x,y)
|
||||
W:release(x,y)
|
||||
end
|
||||
end
|
||||
function WIDGET.keyPressed(key)
|
||||
if key=="space"or key=="return"then
|
||||
function WIDGET.keyPressed(k)
|
||||
if k=="space"or k=="return"then
|
||||
WIDGET.press()
|
||||
elseif kb.isDown("lshift","lalt","lctrl")and(key=="left"or key=="right")then
|
||||
elseif kb.isDown("lshift","lalt","lctrl")and(k=="left"or k=="right")then
|
||||
--When hold [↑], control slider with left/right
|
||||
local W=WIDGET.sel
|
||||
if not W then return end
|
||||
local isLeft=key=="left"
|
||||
if W.type=="slider"then
|
||||
local p=W.disp()
|
||||
local u=(W.smooth and .01 or 1)
|
||||
local P=isLeft and max(p-u,0)or min(p+u,W.unit)
|
||||
if p==P or not P then return end
|
||||
W.code(P)
|
||||
if W.change and Timer()-W.lastTime>.18 then
|
||||
W.lastTime=Timer()
|
||||
W.change()
|
||||
end
|
||||
elseif W.type=="selector"then
|
||||
local s=W.select
|
||||
if isLeft and s==1 or not isLeft and s==#W.list then return end
|
||||
if isLeft then
|
||||
s=s-1
|
||||
sysFX.newShade(.3,1,1,1,W.x,W.y,W.w*.5,60)
|
||||
else
|
||||
s=s+1
|
||||
sysFX.newShade(.3,1,1,1,W.x+W.w*.5,W.y,W.w*.5,60)
|
||||
end
|
||||
W.code(W.list[s])
|
||||
W.select=s
|
||||
W.selText=W.list[s]
|
||||
SFX.play("prerotate")
|
||||
if W and W.type=="slider"or W.type=="selector"then
|
||||
W:arrowKey(k=="left")
|
||||
end
|
||||
elseif key=="up"or key=="down"or key=="left"or key=="right"then
|
||||
elseif k=="up"or k=="down"or k=="left"or k=="right"then
|
||||
if not WIDGET.sel then
|
||||
for _,v in next,WIDGET.active do
|
||||
if v.isAbove then
|
||||
@@ -857,10 +904,10 @@ function WIDGET.keyPressed(key)
|
||||
local W=WIDGET.sel
|
||||
if not W.getCenter then return end
|
||||
local WX,WY=W:getCenter()
|
||||
local dir=(key=="right"or key=="down")and 1 or -1
|
||||
local dir=(k=="right"or k=="down")and 1 or -1
|
||||
local tar
|
||||
local minDist=1e99
|
||||
local swap_xy=key=="up"or key=="down"
|
||||
local swap_xy=k=="up"or k=="down"
|
||||
if swap_xy then WX,WY=WY,WX end -- note that we do not swap them back later
|
||||
for _,W1 in ipairs(WIDGET.active)do
|
||||
if W~=W1 and W1.resCtr then
|
||||
@@ -882,20 +929,11 @@ function WIDGET.keyPressed(key)
|
||||
if tar then
|
||||
WIDGET.sel=tar
|
||||
end
|
||||
elseif WIDGET.sel and WIDGET.sel.type=="textBox"then
|
||||
local t=WIDGET.sel.value
|
||||
if #t==0 then return end
|
||||
if key=="backspace"then
|
||||
while t:byte(#t)>=128 and t:byte(#t)<192 do
|
||||
t=sub(t,1,-2)
|
||||
end
|
||||
t=sub(t,1,-2)
|
||||
SFX.play("lock")
|
||||
elseif key=="delete"then
|
||||
t=""
|
||||
SFX.play("hold")
|
||||
else
|
||||
local W=WIDGET.sel
|
||||
if W and W.type=="textBox"then
|
||||
W:keypress(k)
|
||||
end
|
||||
WIDGET.sel.value=t
|
||||
end
|
||||
end
|
||||
local keyMirror={
|
||||
|
||||
12
conf.lua
12
conf.lua
@@ -1,4 +1,5 @@
|
||||
VERSION="Alpha V0.12.1"
|
||||
VERSION_CODE=1204
|
||||
VERSION_NAME="Alpha V0.12.4"
|
||||
love.setDeprecationOutput(false)
|
||||
function love.conf(t)
|
||||
t.identity="Techmino"--Saving folder
|
||||
@@ -6,11 +7,14 @@ function love.conf(t)
|
||||
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
|
||||
if t.audio then
|
||||
t.audio.mic=false
|
||||
t.audio.mixwithsystem=true
|
||||
end
|
||||
|
||||
local W=t.window
|
||||
W.title="Techmino "..VERSION
|
||||
W.icon="/image/icon.png"
|
||||
W.title="Techmino "..VERSION_NAME
|
||||
W.icon="media/image/icon.png"
|
||||
W.width,W.height=1280,720
|
||||
W.minwidth,W.minheight=640,360
|
||||
W.borderless=false
|
||||
|
||||
144
document/mode.txt
Normal file
144
document/mode.txt
Normal file
@@ -0,0 +1,144 @@
|
||||
一个正确的模式文件应是一个合法lua程序,其必须立刻返回一个table,里面的内容包括:
|
||||
color:模式的颜色,用于点击地图图标后显示的提示文本
|
||||
env:
|
||||
必选
|
||||
模式环境变量,决定了关卡的各项属性
|
||||
table值:
|
||||
drop:下落延迟(帧,支持自然数和2的整数次幂)
|
||||
lock:锁定延迟(帧)
|
||||
wait:出块延迟(帧)
|
||||
fall:下落延迟(帧)
|
||||
bone:是否开启骨块模式
|
||||
nextCount:显示next个数
|
||||
nextStartPos:next从第几个开始显示
|
||||
holdCount:hold个数,
|
||||
infHold:是否能无限hold
|
||||
ospin=是否能O-spin
|
||||
RS:旋转系统名
|
||||
|
||||
das:DAS
|
||||
arr:ARR
|
||||
sddas:软降DAS
|
||||
sdarr:软降ARR
|
||||
mindas:允许的最小DAS
|
||||
minarr:允许的最小ARR
|
||||
minsdarr:允许的最小软降ARR
|
||||
ihs:提前Hold
|
||||
irs:提前旋转
|
||||
ims:提前移动
|
||||
maxNext:最大next数
|
||||
|
||||
skin:方块颜色,包含25个整数(1~16)的table
|
||||
face:方块朝向,包含25个整数(0~3)的table
|
||||
|
||||
block:是否显示方块
|
||||
ghost:影子透明度(0~1)
|
||||
center:旋转中心透明度(0~1)
|
||||
smooth:是否平滑下落
|
||||
grid:是否显示网格
|
||||
bagLine:是否显示包分界线
|
||||
lockFX:特效等级(0,5)
|
||||
dropFX:特效等级(0,5)
|
||||
moveFX:特效等级(0,5)
|
||||
clearFX:特效等级(0,5)
|
||||
splashFX:特效等级(0,5)
|
||||
shakeFX:特效等级(0,5)
|
||||
atkFX:特效等级(0,5)
|
||||
|
||||
text:是否显示消行文本
|
||||
score:是否显示落块分数
|
||||
warn:是否开启死亡预警
|
||||
highCam:是否开启超屏视野
|
||||
nextPos:是否开启生成预览
|
||||
|
||||
sequence:序列模式,可以使用默认的几个函数用字符串表示,也可以自己写
|
||||
freshMethod=放一块后对next序列的刷新函数,不使用默认sequence的话就要自己写
|
||||
bag:一包的方块(本质是基准序列,不一定是包)
|
||||
mission:包含任务的table,说明暂时略
|
||||
|
||||
life:生命数,
|
||||
pushSpeed:上涨速度
|
||||
noTele:是否禁止10个高级按键,
|
||||
visible:方块可见性,填写固定的几个字符串
|
||||
freshLimit:锁延刷新次数限制
|
||||
easyFresh:是否使用简单锁延刷新规则
|
||||
|
||||
Fkey:按下功能键后执行的函数
|
||||
keyCancel:包含禁止使用的按键的id们的table
|
||||
fineKill:是否开启非极简即死
|
||||
b2bKill:是否开启断b2b即死
|
||||
missionKill:是否开启强制任务
|
||||
target:目标行数,如果dropPiece使用了默认的几个通用通关函数或者自己有一个目标数字就要写
|
||||
dropPiece:放一块后要执行的函数,输入玩家对象
|
||||
|
||||
bg:背景,只能填写默认背景的名字
|
||||
bgm:背景音乐,只能填写默认音乐库的音乐名
|
||||
noMod:是否禁用玩家开启mod
|
||||
load:
|
||||
必选
|
||||
模式初始化函数,一般创建一个玩家即可
|
||||
无输入和输出
|
||||
mesDisp:
|
||||
必选
|
||||
模式显示信息,是一个绘图函数,坐标系原点是玩家对象最左上角
|
||||
输入玩家对象
|
||||
无输出
|
||||
|
||||
score:
|
||||
可选(不填就没有分数保存和计算)
|
||||
一局打完后要存储的数据
|
||||
输入玩家对象
|
||||
输出游戏结束瞬间返回一个包含直接决定该模式成绩的数据table(会被强制加上date标签)
|
||||
|
||||
scoreDisp:
|
||||
可选(当模式不出现在地图上的时候)
|
||||
是把score()存起来的table转换为字符串显示出来的函数
|
||||
输入一个成绩table
|
||||
输出一个字符串
|
||||
|
||||
comp:
|
||||
可选(当没有score函数的时候)
|
||||
是成绩table之间对比并排序的规则
|
||||
输入两个成绩table
|
||||
输出[第一个是不是排在第二个前面]的布尔值(可以类比"小于"运算)
|
||||
|
||||
getRank:
|
||||
可选,模式评级函数
|
||||
是用于评价玩家表现的函数
|
||||
输入玩家对象
|
||||
返回0~5,0表示除了记录到排行榜外什么都不做;1/2/3/4/5表示D/C/B/A/S级,能解锁连接的模式,还会让模式图标在地图上显示不同的颜色
|
||||
|
||||
以下是40行的模式文件内容:
|
||||
//sprint_40.lua
|
||||
return{--返回一个table,你也可以在之前定义一些常量或者函数什么的
|
||||
color=COLOR.green,--颜色
|
||||
env={--模式环境变量
|
||||
drop=60,lock=60,
|
||||
target=40,dropPiece=PLY.check_lineReach,
|
||||
bg="bg2",bgm="race",
|
||||
},
|
||||
load=function()--生成玩家
|
||||
PLY.newPlayer(1,340,15)
|
||||
end,
|
||||
mesDisp=function(P)--40行模式需要显示的信息
|
||||
setFont(55)
|
||||
local r=40-P.stat.row
|
||||
if r<0 then r=0 end
|
||||
mStr(r,69,335)--把计算出来的剩余行数r显示出来
|
||||
PLY.draw.drawTargetLine(P,r)--使用自带的境界高度线绘制函数
|
||||
end,
|
||||
score=function(P)return{P.stat.frame/60,P.stat.piece}end,--游戏结束时需要保存的本局关键信息
|
||||
scoreDisp=function(D)return toTime(D[1]).." "..D[2].." Pieces"end,--把score返回的数据显示出来的方法
|
||||
comp=function(a,b)return a[1]<b[1]or a[1]==b[1]and a[2]<b[2]end,--按照时间排序,时间一样就看块数
|
||||
getRank=function(P)--计算评级
|
||||
if P.stat.row<40 then return end--你总得打完40行对吧,否则直接return空掉,成绩都不记录
|
||||
local T=P.stat.frame/60
|
||||
return
|
||||
T<=26 and 5 or--时间小于等于26秒,S级要求,至于为什么是26秒不解释
|
||||
T<=32.6 and 4 or--A级要求
|
||||
T<=52.6 and 3 or--B级要求
|
||||
T<=92.9 and 2 or--C级要求
|
||||
T<=183 and 1 or--D级要求,是解锁别的模式的最低标准
|
||||
0--打完了40行那成绩就给你记一下
|
||||
end,
|
||||
}
|
||||
246
main.lua
246
main.lua
@@ -12,127 +12,113 @@ local fs=love.filesystem
|
||||
|
||||
--?
|
||||
NONE={}function NULL()end
|
||||
DBP=print--use this if need debugging print
|
||||
DBP=print--Use this in permanent code
|
||||
SYSTEM=love.system.getOS()
|
||||
MOBILE=SYSTEM=="Android"or SYSTEM=="iOS"
|
||||
SAVEDIR=fs.getSaveDirectory()
|
||||
|
||||
--Global Vars & Settings
|
||||
MARKING=true
|
||||
LOADED=false
|
||||
NOGAME=false
|
||||
LOGIN=false
|
||||
EDITING=""
|
||||
WSCONN=nil
|
||||
|
||||
--Global Setting & Vars
|
||||
math.randomseed(os.time()*626)
|
||||
love.keyboard.setKeyRepeat(true)
|
||||
love.keyboard.setTextInput(false)
|
||||
love.mouse.setVisible(false)
|
||||
|
||||
SCR={
|
||||
w0=1280,h0=720,--Default Screen Size
|
||||
x=0,y=0,--Up-left Coord on screen
|
||||
w=0,h=0,--Fullscreen w/h in gc
|
||||
W=0,H=0,--Fullscreen w/h in shader
|
||||
rad=0,--Radius
|
||||
k=1,--Scale size
|
||||
dpi=1,--DPI from gc.getDPIScale()
|
||||
xOy=love.math.newTransform(),--Screen transformation object
|
||||
}
|
||||
|
||||
CUSTOMENV={
|
||||
--Basic
|
||||
drop=60,
|
||||
lock=60,
|
||||
wait=0,
|
||||
fall=0,
|
||||
|
||||
next=6,
|
||||
hold=true,
|
||||
oncehold=true,
|
||||
|
||||
--Visual
|
||||
block=true,
|
||||
ghost=.3,
|
||||
center=1,
|
||||
bagLine=false,
|
||||
highCam=false,
|
||||
nextPos=false,
|
||||
bone=false,
|
||||
|
||||
--Rule
|
||||
mindas=0,
|
||||
minarr=0,
|
||||
minsdarr=0,
|
||||
sequence="bag",
|
||||
ospin=false,
|
||||
noTele=false,
|
||||
fineKill=false,
|
||||
missionKill=false,
|
||||
easyFresh=true,
|
||||
visible="show",
|
||||
target=1e99,
|
||||
freshLimit=1e99,
|
||||
opponent=0,
|
||||
life=0,
|
||||
pushSpeed=3,
|
||||
|
||||
--Else
|
||||
bg="none",
|
||||
bgm="race"
|
||||
}
|
||||
FIELD={}--Field(s) for custom game
|
||||
BAG={}--Sequence for custom game
|
||||
MISSION={}--Clearing mission for custom game
|
||||
|
||||
GAME={
|
||||
frame=0, --Frame count
|
||||
result=false, --Game result (string)
|
||||
pauseTime=0, --Time paused
|
||||
pauseCount=0, --Pausing count
|
||||
garbageSpeed=1, --Garbage timing speed
|
||||
warnLVL0=0, --Warning level
|
||||
warnLVL=0, --Warning level (show)
|
||||
recording=false, --If recording
|
||||
replaying=false, --If replaying
|
||||
seed=math.random(2e6),--Game seed
|
||||
setting={}, --Game settings
|
||||
rec={}, --Recording list, key,time,key,time...
|
||||
rank=nil, --Rank reached
|
||||
|
||||
prevBG=nil, --Previous background, for restore BG when quit setting page
|
||||
|
||||
--Data for royale mode
|
||||
stage=nil, --Game stage
|
||||
mostBadge=nil, --Most badge owner
|
||||
secBadge=nil, --Second badge owner
|
||||
mostDangerous=nil, --Most dangerous player
|
||||
secDangerous=nil, --Second dangerous player
|
||||
}--Global game data
|
||||
PLAYERS={alive={}}--Players data
|
||||
CURMODE=nil--Current mode object
|
||||
RANKS={sprint_10=0}
|
||||
|
||||
|
||||
--Load modules
|
||||
require("Zframework")
|
||||
require"Zframework"
|
||||
|
||||
require("parts/list")
|
||||
require("parts/default_data")
|
||||
require("parts/gametoolfunc")
|
||||
require"parts/list"
|
||||
require"parts/globalTables"
|
||||
require"parts/gametoolfunc"
|
||||
|
||||
SCR.setSize(1280,720)--Initialize Screen size
|
||||
FIELD[1]=newBoard()--Initialize field[1]
|
||||
|
||||
BLOCKS= require("parts/mino")
|
||||
AIBUILDER= require("parts/AITemplate")
|
||||
FREEROW= require("parts/freeRow")
|
||||
BLOCKS= require"parts/mino"
|
||||
AIBUILDER= require"parts/AITemplate"
|
||||
FREEROW= require"parts/freeRow"
|
||||
|
||||
TEXTURE=require("parts/texture")
|
||||
SKIN= require("parts/skin")
|
||||
PLY= require("parts/player")
|
||||
AIFUNC= require("parts/ai")
|
||||
MODES= require("parts/modes")
|
||||
TICK= require("parts/tick")
|
||||
TEXTURE=require"parts/texture"
|
||||
SKIN= require"parts/skin"
|
||||
PLY= require"parts/player"
|
||||
AIFUNC= require"parts/ai"
|
||||
MODES= require"parts/modes"
|
||||
TICK= require"parts/tick"
|
||||
|
||||
--Initialize sound libs
|
||||
SFX.set{
|
||||
--Stereo sfxs(cannot set position)
|
||||
"welcome_sfx",
|
||||
"click","enter",
|
||||
"finesseError","finesseError_long",
|
||||
|
||||
--Mono sfxs
|
||||
"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",
|
||||
}
|
||||
BGM.set{
|
||||
"blank",--menu
|
||||
"race",--sprint, solo
|
||||
"infinite",--infinite norm/dig, ultra, zen, tech-finesse
|
||||
"push",--marathon, round, tsd, blind-5/6
|
||||
"way",--dig sprint
|
||||
"reason",--drought, blind-1/2/3/4
|
||||
|
||||
"secret8th",--master-1, survivor-2
|
||||
"secret7th",--master-2, survivor-3
|
||||
"waterfall",--sprint Penta/MPH
|
||||
"new era",--bigbang, survivor-1, tech-normal
|
||||
"oxygen",--c4w/pc train
|
||||
"truth",--pc challenge
|
||||
"sugar fairy",--classic2
|
||||
|
||||
"distortion",--master-3
|
||||
"far",--GM
|
||||
"shining terminal",--attacker
|
||||
"storm",--defender, survivor-4/5
|
||||
"down",--dig, tech-hard/lunatic
|
||||
|
||||
"rockblock",--classic, 49/99
|
||||
"cruelty","final","8-bit happiness","end","how feeling",--49/99
|
||||
}
|
||||
VOC.set{
|
||||
"zspin","sspin","lspin","jspin","tspin","ospin","ispin",
|
||||
"single","double","triple","techrash",
|
||||
"mini","b2b","b3b",
|
||||
"perfect_clear","half_clear",
|
||||
"win","lose","bye",
|
||||
"test","happy","doubt","sad","egg",
|
||||
"welcome_voc",
|
||||
}
|
||||
|
||||
--Load shader files from SOURCE ONLY
|
||||
SHADER={}
|
||||
for _,v in next,love.filesystem.getDirectoryItems("parts/shaders")do
|
||||
if love.filesystem.getRealDirectory("parts/shaders/"..v)~=SAVEDIR then
|
||||
local name=v:sub(1,-6)
|
||||
SHADER[name]=love.graphics.newShader("parts/shaders/"..name..".glsl")
|
||||
else
|
||||
LOG.print("Dangerous file : %SAVE%/parts/shaders/"..v)
|
||||
end
|
||||
end
|
||||
|
||||
--Load background files from SOURCE ONLY
|
||||
for _,v in next,love.filesystem.getDirectoryItems("parts/backgrounds")do
|
||||
@@ -147,15 +133,18 @@ end
|
||||
--Load scene files from SOURCE ONLY
|
||||
for _,v in next,fs.getDirectoryItems("parts/scenes")do
|
||||
if fs.getRealDirectory("parts/scenes/"..v)~=SAVEDIR then
|
||||
require("parts/scenes/"..v:sub(1,-5))
|
||||
local sceneName=v:sub(1,-5)
|
||||
local scene=require("parts/scenes/"..sceneName)
|
||||
SCN.add(sceneName,scene)
|
||||
if scene.widgetList then WIDGET.init(sceneName,scene.widgetList)end
|
||||
else
|
||||
LOG.print("Dangerous file : %SAVE%/parts/scenes/"..v)
|
||||
end
|
||||
end
|
||||
|
||||
--Load files & settings
|
||||
--Load files
|
||||
if fs.getInfo("settings.dat")then
|
||||
FILE.loadSetting()
|
||||
addToTable(FILE.load("settings"),SETTING)
|
||||
else
|
||||
if MOBILE then
|
||||
SETTING.VKSwitch=true
|
||||
@@ -167,13 +156,14 @@ else
|
||||
love.resize(love.graphics.getWidth(),love.graphics.getHeight())
|
||||
end
|
||||
end
|
||||
LANG.set(SETTING.lang)
|
||||
if SETTING.fullscreen then love.window.setFullscreen(true)end
|
||||
LANG.set(SETTING.lang)
|
||||
|
||||
if fs.getInfo("unlock.dat")then FILE.loadUnlock()end
|
||||
if fs.getInfo("data.dat")then FILE.loadData()end
|
||||
if fs.getInfo("key.dat")then FILE.loadKeyMap()end
|
||||
if fs.getInfo("virtualkey.dat")then FILE.loadVK()end
|
||||
if fs.getInfo("unlock.dat")then RANKS=FILE.load("unlock")end
|
||||
if fs.getInfo("data.dat")then STAT=FILE.load("data")end
|
||||
if fs.getInfo("key.dat")then keyMap=FILE.load("key")end
|
||||
if fs.getInfo("virtualkey.dat")then VK_org=FILE.load("virtualkey")end
|
||||
if fs.getInfo("account.dat")then ACCOUNT=FILE.load("account")end
|
||||
|
||||
if fs.getInfo("tech_ultimate.dat")then fs.remove("tech_ultimate.dat")end
|
||||
if fs.getInfo("tech_ultimate+.dat")then fs.remove("tech_ultimate+.dat")end
|
||||
@@ -203,28 +193,32 @@ do
|
||||
S.bgm>1 or S.sfx>1 or S.voc>1 or
|
||||
S.stereo>1 or S.VKSFX>1 or S.VKAlpha>1
|
||||
then
|
||||
NOGAME="delSetting"
|
||||
NOGAME=true
|
||||
fs.remove("settings.dat")
|
||||
end
|
||||
|
||||
if fs.getInfo("cold_clear.dll")then
|
||||
NOGAME=true
|
||||
fs.remove("cold_clear.dll")
|
||||
fs.remove("CCloader.dll")
|
||||
end
|
||||
|
||||
--Update data file
|
||||
S=STAT
|
||||
freshDate()
|
||||
if S.extraRate then
|
||||
S.finesseRate=5*(S.piece-S.extraRate)
|
||||
end
|
||||
if S.version~=VERSION then
|
||||
S.version=VERSION
|
||||
newVersionLaunch=true
|
||||
|
||||
local function delRecord(n)
|
||||
if R[n]then
|
||||
R[n]=0
|
||||
fs.remove(n..".dat")
|
||||
end
|
||||
if S.version~=VERSION_CODE then
|
||||
if(tonumber(S.version)or 0)<1204 then
|
||||
STAT.frame=math.floor(STAT.time*60)
|
||||
STAT.lastPlay="sprint_10"
|
||||
RANKS.sprintFix=nil
|
||||
RANKS.sprintLock=nil
|
||||
fs.remove("sprintFix.dat")
|
||||
fs.remove("sprintLock.dat")
|
||||
end
|
||||
delRecord("solo_1")delRecord("solo_2")delRecord("solo_3")delRecord("solo_4")delRecord("solo_5")
|
||||
delRecord("dig_10")delRecord("dig_40")delRecord("dig_100")delRecord("dig_400")
|
||||
delRecord("classic_fast")
|
||||
newVersionLaunch=true
|
||||
|
||||
--Try unlock modes which should be unlocked
|
||||
for name,rank in next,RANKS do
|
||||
@@ -240,11 +234,9 @@ do
|
||||
end
|
||||
end
|
||||
end
|
||||
FILE.saveUnlock()
|
||||
FILE.saveData()
|
||||
end
|
||||
if MOBILE and not SETTING.fullscreen then
|
||||
LOG.print("如果手机上方状态栏不消失,请到设置界面开启全屏",300,COLOR.yellow)
|
||||
LOG.print("Switch fullscreen on if titleBar don't disappear",300,COLOR.yellow)
|
||||
|
||||
S.version=VERSION_CODE
|
||||
FILE.save(RANKS,"unlock","q")
|
||||
FILE.save(STAT,"data")
|
||||
end
|
||||
end
|
||||
BIN
media/BGM/sugar fairy.ogg
Normal file
BIN
media/BGM/sugar fairy.ogg
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user