整理代码
This commit is contained in:
@@ -34,7 +34,7 @@ function BG.setDefault(bg)
|
|||||||
end
|
end
|
||||||
function BG.set(background)
|
function BG.set(background)
|
||||||
if not background then background=BG.default end
|
if not background then background=BG.default end
|
||||||
if not BGs[background]then LOG.print("No BGM file: "..background,10,COLOR.orange)end
|
if not BGs[background]then LOG.print("No BG file: "..background,10,COLOR.orange)end
|
||||||
if background==BG.cur or not SETTING.bg then return end
|
if background==BG.cur or not SETTING.bg then return end
|
||||||
BG.discard()
|
BG.discard()
|
||||||
BG.cur=background
|
BG.cur=background
|
||||||
|
|||||||
1
main.lua
1
main.lua
@@ -14,6 +14,7 @@ local fs=love.filesystem
|
|||||||
NONE={}function NULL()end
|
NONE={}function NULL()end
|
||||||
DBP=print--Use this in permanent code
|
DBP=print--Use this in permanent code
|
||||||
TIME=love.timer.getTime
|
TIME=love.timer.getTime
|
||||||
|
YIELD=coroutine.yield
|
||||||
SYSTEM=love.system.getOS()
|
SYSTEM=love.system.getOS()
|
||||||
MOBILE=SYSTEM=="Android"or SYSTEM=="iOS"
|
MOBILE=SYSTEM=="Android"or SYSTEM=="iOS"
|
||||||
SAVEDIR=fs.getSaveDirectory()
|
SAVEDIR=fs.getSaveDirectory()
|
||||||
|
|||||||
@@ -681,7 +681,7 @@ do--function resetGameData(args)
|
|||||||
local function tick_showMods()
|
local function tick_showMods()
|
||||||
local time=0
|
local time=0
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
time=time+1
|
time=time+1
|
||||||
if time%20==0 then
|
if time%20==0 then
|
||||||
local M=GAME.mod[time/20]
|
local M=GAME.mod[time/20]
|
||||||
@@ -1220,7 +1220,7 @@ do
|
|||||||
|
|
||||||
function TICK_WS_app()
|
function TICK_WS_app()
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
local status=WS.status("app")
|
local status=WS.status("app")
|
||||||
if status=="running"then
|
if status=="running"then
|
||||||
local message,op=WS.read("app")
|
local message,op=WS.read("app")
|
||||||
@@ -1243,7 +1243,7 @@ do
|
|||||||
end
|
end
|
||||||
function TICK_WS_chat()
|
function TICK_WS_chat()
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
local status=WS.status("chat")
|
local status=WS.status("chat")
|
||||||
if status=="running"then
|
if status=="running"then
|
||||||
local message,op=WS.read("chat")
|
local message,op=WS.read("chat")
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ return{
|
|||||||
dropPiece=score,
|
dropPiece=score,
|
||||||
task=function(P)
|
task=function(P)
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
if P.stat.time>=53.5 then
|
if P.stat.time>=53.5 then
|
||||||
P.modeData.point=min(P.modeData.point+16,80)
|
P.modeData.point=min(P.modeData.point+16,80)
|
||||||
P.modeData.event=sectionName[int(P.modeData.point*.1)+1]
|
P.modeData.event=sectionName[int(P.modeData.point*.1)+1]
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ return{
|
|||||||
pushSpeed=2,
|
pushSpeed=2,
|
||||||
task=function(P)
|
task=function(P)
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
if P.control and SCN.cur=="play"and P.atkBuffer.sum==0 then
|
if P.control and SCN.cur=="play"and P.atkBuffer.sum==0 then
|
||||||
local p=#P.atkBuffer+1
|
local p=#P.atkBuffer+1
|
||||||
local B,D=P.atkBuffer,P.modeData
|
local B,D=P.atkBuffer,P.modeData
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ return{
|
|||||||
freshLimit=15,
|
freshLimit=15,
|
||||||
task=function(P)
|
task=function(P)
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
if P.control and SCN.cur=="play"and P.atkBuffer.sum<4 then
|
if P.control and SCN.cur=="play"and P.atkBuffer.sum<4 then
|
||||||
local p=#P.atkBuffer+1
|
local p=#P.atkBuffer+1
|
||||||
local B,D=P.atkBuffer,P.modeData
|
local B,D=P.atkBuffer,P.modeData
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ return{
|
|||||||
pushSpeed=2,
|
pushSpeed=2,
|
||||||
task=function(P)
|
task=function(P)
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
if P.control and SCN.cur=="play"then
|
if P.control and SCN.cur=="play"then
|
||||||
local D=P.modeData
|
local D=P.modeData
|
||||||
D.counter=D.counter+1
|
D.counter=D.counter+1
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ return{
|
|||||||
pushSpeed=1,
|
pushSpeed=1,
|
||||||
task=function(P)
|
task=function(P)
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
if P.control and SCN.cur=="play"then
|
if P.control and SCN.cur=="play"then
|
||||||
local D=P.modeData
|
local D=P.modeData
|
||||||
D.counter=D.counter+1
|
D.counter=D.counter+1
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ return{
|
|||||||
freshLimit=15,
|
freshLimit=15,
|
||||||
task=function(P)
|
task=function(P)
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
if P.control and SCN.cur=="play"then
|
if P.control and SCN.cur=="play"then
|
||||||
local D=P.modeData
|
local D=P.modeData
|
||||||
D.counter=D.counter+1
|
D.counter=D.counter+1
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ return{
|
|||||||
freshLimit=15,
|
freshLimit=15,
|
||||||
task=function(P)
|
task=function(P)
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
if P.control and SCN.cur=="play"then
|
if P.control and SCN.cur=="play"then
|
||||||
local D=P.modeData
|
local D=P.modeData
|
||||||
D.counter=D.counter+1
|
D.counter=D.counter+1
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ local PClist=require"parts/modes/PClist"
|
|||||||
local function task_PC(P)
|
local function task_PC(P)
|
||||||
local D=P.modeData
|
local D=P.modeData
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
D.counter=D.counter+1
|
D.counter=D.counter+1
|
||||||
if D.counter==26 then
|
if D.counter==26 then
|
||||||
local base=PCbase[D.type]
|
local base=PCbase[D.type]
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ local function task_PC(P)
|
|||||||
local base=PCbase[D.type]
|
local base=PCbase[D.type]
|
||||||
P:pushLineList(base[P:RND(#base)],D.symmetry)
|
P:pushLineList(base[P:RND(#base)],D.symmetry)
|
||||||
end
|
end
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
local function check(P)
|
local function check(P)
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ return{
|
|||||||
P.modeData.beatFrame=90
|
P.modeData.beatFrame=90
|
||||||
P.modeData.counter=90
|
P.modeData.counter=90
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
P.modeData.counter=P.modeData.counter-1
|
P.modeData.counter=P.modeData.counter-1
|
||||||
if P.modeData.counter==0 then
|
if P.modeData.counter==0 then
|
||||||
P.modeData.counter=P.modeData.beatFrame
|
P.modeData.counter=P.modeData.beatFrame
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ return{
|
|||||||
P.modeData.beatFrame=60
|
P.modeData.beatFrame=60
|
||||||
P.modeData.counter=60
|
P.modeData.counter=60
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
P.modeData.counter=P.modeData.counter-1
|
P.modeData.counter=P.modeData.counter-1
|
||||||
if P.modeData.counter==0 then
|
if P.modeData.counter==0 then
|
||||||
P.modeData.counter=P.modeData.beatFrame
|
P.modeData.counter=P.modeData.beatFrame
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ return{
|
|||||||
P.modeData.beatFrame=30
|
P.modeData.beatFrame=30
|
||||||
P.modeData.counter=30
|
P.modeData.counter=30
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
P.modeData.counter=P.modeData.counter-1
|
P.modeData.counter=P.modeData.counter-1
|
||||||
if P.modeData.counter==0 then
|
if P.modeData.counter==0 then
|
||||||
P.modeData.counter=P.modeData.beatFrame
|
P.modeData.counter=P.modeData.beatFrame
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ return{
|
|||||||
freshLimit=10,
|
freshLimit=10,
|
||||||
task=function(P)
|
task=function(P)
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
if P.control and SCN.cur=="play"then
|
if P.control and SCN.cur=="play"then
|
||||||
P.modeData.counter=P.modeData.counter+1
|
P.modeData.counter=P.modeData.counter+1
|
||||||
if P.modeData.counter>=math.max(60,150-2*P.modeData.event)and P.atkBuffer.sum<4 then
|
if P.modeData.counter>=math.max(60,150-2*P.modeData.event)and P.atkBuffer.sum<4 then
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ return{
|
|||||||
freshLimit=10,
|
freshLimit=10,
|
||||||
task=function(P)
|
task=function(P)
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
if P.control and SCN.cur=="play"then
|
if P.control and SCN.cur=="play"then
|
||||||
P.modeData.counter=P.modeData.counter+1
|
P.modeData.counter=P.modeData.counter+1
|
||||||
local B=P.atkBuffer
|
local B=P.atkBuffer
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ return{
|
|||||||
freshLimit=10,
|
freshLimit=10,
|
||||||
task=function(P)
|
task=function(P)
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
if P.control and SCN.cur=="play"then
|
if P.control and SCN.cur=="play"then
|
||||||
P.modeData.counter=P.modeData.counter+1
|
P.modeData.counter=P.modeData.counter+1
|
||||||
if P.modeData.counter>=math.max(60,150-P.modeData.event)and P.atkBuffer.sum<20 then
|
if P.modeData.counter>=math.max(60,150-P.modeData.event)and P.atkBuffer.sum<20 then
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ return{
|
|||||||
freshLimit=10,
|
freshLimit=10,
|
||||||
task=function(P)
|
task=function(P)
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
if P.control and SCN.cur=="play"then
|
if P.control and SCN.cur=="play"then
|
||||||
P.modeData.counter=P.modeData.counter+1
|
P.modeData.counter=P.modeData.counter+1
|
||||||
if P.modeData.counter>=math.max(90,180-2*P.modeData.event)and P.atkBuffer.sum<8 then
|
if P.modeData.counter>=math.max(90,180-2*P.modeData.event)and P.atkBuffer.sum<8 then
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ return{
|
|||||||
pushSpeed=2,
|
pushSpeed=2,
|
||||||
task=function(P)
|
task=function(P)
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
if P.control and SCN.cur=="play"then
|
if P.control and SCN.cur=="play"then
|
||||||
P.modeData.counter=P.modeData.counter+1
|
P.modeData.counter=P.modeData.counter+1
|
||||||
if P.modeData.counter>=math.max(300,600-10*P.modeData.event)and P.atkBuffer.sum<20 then
|
if P.modeData.counter>=math.max(300,600-10*P.modeData.event)and P.atkBuffer.sum<20 then
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ return{
|
|||||||
fall=20,
|
fall=20,
|
||||||
task=function(P)
|
task=function(P)
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
local _=P.modeData.counter+1
|
local _=P.modeData.counter+1
|
||||||
if P.stat.time>=warnTime[_]then
|
if P.stat.time>=warnTime[_]then
|
||||||
if _<9 then
|
if _<9 then
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ local Player={}--Player class
|
|||||||
local int,ceil,rnd=math.floor,math.ceil,math.random
|
local int,ceil,rnd=math.floor,math.ceil,math.random
|
||||||
local max,min,modf=math.max,math.min,math.modf
|
local max,min,modf=math.max,math.min,math.modf
|
||||||
local ins,rem=table.insert,table.remove
|
local ins,rem=table.insert,table.remove
|
||||||
local ct=coroutine
|
local YIELD=YIELD
|
||||||
|
|
||||||
local kickList=require"parts/kickList"
|
local kickList=require"parts/kickList"
|
||||||
|
|
||||||
@@ -121,9 +121,9 @@ function Player.RND(P,a,b)
|
|||||||
return R:random(a,b)
|
return R:random(a,b)
|
||||||
end
|
end
|
||||||
function Player.newTask(P,code,...)
|
function Player.newTask(P,code,...)
|
||||||
local thread=ct.create(code)
|
local thread=coroutine.create(code)
|
||||||
ct.resume(thread,P,...)
|
coroutine.resume(thread,P,...)
|
||||||
if ct.status(thread)~="dead"then
|
if coroutine.status(thread)~="dead"then
|
||||||
P.tasks[#P.tasks+1]={
|
P.tasks[#P.tasks+1]={
|
||||||
thread=thread,
|
thread=thread,
|
||||||
code=code,
|
code=code,
|
||||||
@@ -147,7 +147,7 @@ end
|
|||||||
local function task_movePosition(P,x,y,size)
|
local function task_movePosition(P,x,y,size)
|
||||||
local x1,y1,size1=P.x,P.y,P.size
|
local x1,y1,size1=P.x,P.y,P.size
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
if (x1-x)^2+(y1-y)^2<1 then
|
if (x1-x)^2+(y1-y)^2<1 then
|
||||||
P:setPosition(x,y,size)
|
P:setPosition(x,y,size)
|
||||||
return true
|
return true
|
||||||
@@ -1469,7 +1469,7 @@ end
|
|||||||
--------------------------<Ticks>--------------------------
|
--------------------------<Ticks>--------------------------
|
||||||
local function tick_throwBadge(ifAI,sender,time)
|
local function tick_throwBadge(ifAI,sender,time)
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
time=time-1
|
time=time-1
|
||||||
if time%4==0 then
|
if time%4==0 then
|
||||||
local S,R=sender,sender.lastRecv
|
local S,R=sender,sender.lastRecv
|
||||||
@@ -1497,7 +1497,7 @@ local function tick_throwBadge(ifAI,sender,time)
|
|||||||
end
|
end
|
||||||
local function tick_finish(P)
|
local function tick_finish(P)
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
P.endCounter=P.endCounter+1
|
P.endCounter=P.endCounter+1
|
||||||
if P.endCounter<40 then
|
if P.endCounter<40 then
|
||||||
--Make field visible
|
--Make field visible
|
||||||
@@ -1511,7 +1511,7 @@ local function tick_finish(P)
|
|||||||
end
|
end
|
||||||
local function tick_lose(P)
|
local function tick_lose(P)
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
P.endCounter=P.endCounter+1
|
P.endCounter=P.endCounter+1
|
||||||
if P.endCounter<40 then
|
if P.endCounter<40 then
|
||||||
--Make field visible
|
--Make field visible
|
||||||
@@ -1544,7 +1544,7 @@ end
|
|||||||
function tick_autoPause()
|
function tick_autoPause()
|
||||||
local time=0
|
local time=0
|
||||||
while true do
|
while true do
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
time=time+1
|
time=time+1
|
||||||
if SCN.cur~="play"or GAME.frame<180 then
|
if SCN.cur~="play"or GAME.frame<180 then
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -14,37 +14,37 @@ local skip
|
|||||||
local loadingThread=coroutine.create(function()
|
local loadingThread=coroutine.create(function()
|
||||||
for _=1,VOC.getCount()do
|
for _=1,VOC.getCount()do
|
||||||
VOC.loadOne()
|
VOC.loadOne()
|
||||||
if _%3==0 then coroutine.yield()end
|
if _%3==0 then YIELD()end
|
||||||
end
|
end
|
||||||
|
|
||||||
progress=1
|
progress=1
|
||||||
for i=1,BGM.getCount()do
|
for i=1,BGM.getCount()do
|
||||||
BGM.loadOne()
|
BGM.loadOne()
|
||||||
if i%2==0 then coroutine.yield()end
|
if i%2==0 then YIELD()end
|
||||||
end
|
end
|
||||||
|
|
||||||
progress=2
|
progress=2
|
||||||
for i=1,SFX.getCount()do
|
for i=1,SFX.getCount()do
|
||||||
SFX.loadOne()
|
SFX.loadOne()
|
||||||
if i%2==0 then coroutine.yield()end
|
if i%2==0 then YIELD()end
|
||||||
end
|
end
|
||||||
|
|
||||||
progress=3
|
progress=3
|
||||||
for i=1,IMG.getCount()do
|
for i=1,IMG.getCount()do
|
||||||
IMG.loadOne()
|
IMG.loadOne()
|
||||||
if i%2==0 then coroutine.yield()end
|
if i%2==0 then YIELD()end
|
||||||
end
|
end
|
||||||
|
|
||||||
progress=4
|
progress=4
|
||||||
for i=1,SKIN.getCount()do
|
for i=1,SKIN.getCount()do
|
||||||
SKIN.loadOne()
|
SKIN.loadOne()
|
||||||
if i%2==0 then coroutine.yield()end
|
if i%2==0 then YIELD()end
|
||||||
end
|
end
|
||||||
|
|
||||||
progress=5
|
progress=5
|
||||||
for i=1,17 do
|
for i=1,17 do
|
||||||
getFont(15+5*i)
|
getFont(15+5*i)
|
||||||
if i%3==0 then coroutine.yield()end
|
if i%3==0 then YIELD()end
|
||||||
end
|
end
|
||||||
|
|
||||||
progress=6
|
progress=6
|
||||||
@@ -58,7 +58,7 @@ local loadingThread=coroutine.create(function()
|
|||||||
M.records=FILE.load("record/"..m.name..".rec")or M.score and{}
|
M.records=FILE.load("record/"..m.name..".rec")or M.score and{}
|
||||||
-- M.icon=gc.newImage("media/image/modeIcon/"..m.icon..".png")
|
-- M.icon=gc.newImage("media/image/modeIcon/"..m.icon..".png")
|
||||||
-- M.icon=gc.newImage("media/image/modeIcon/custom.png")
|
-- M.icon=gc.newImage("media/image/modeIcon/custom.png")
|
||||||
if i%5==0 then coroutine.yield()end
|
if i%5==0 then YIELD()end
|
||||||
end
|
end
|
||||||
|
|
||||||
progress=7
|
progress=7
|
||||||
@@ -118,7 +118,7 @@ local loadingThread=coroutine.create(function()
|
|||||||
VOC.play("welcome_voc")
|
VOC.play("welcome_voc")
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ local heartBeatTimer
|
|||||||
local escapeTimer=0
|
local escapeTimer=0
|
||||||
|
|
||||||
local function _init()
|
local function _init()
|
||||||
coroutine.yield()
|
YIELD()
|
||||||
WIDGET.sel=WIDGET.active.input
|
WIDGET.sel=WIDGET.active.input
|
||||||
end
|
end
|
||||||
local function sendMessage()
|
local function sendMessage()
|
||||||
|
|||||||
Reference in New Issue
Block a user