很多全局变量名改为大写
This commit is contained in:
@@ -4,7 +4,7 @@ local max,min,sin,cos=math.max,math.min,math.sin,math.cos
|
||||
local ins,rem=table.insert,table.remove
|
||||
|
||||
local BG
|
||||
local scr=scr
|
||||
local SCR=SCR
|
||||
local BGvars={_G=_G,SHADER=SHADER}
|
||||
|
||||
local back={}
|
||||
@@ -88,7 +88,7 @@ back.wing={
|
||||
end,
|
||||
resize=function()
|
||||
crystal={}
|
||||
W,H=scr.w,scr.h
|
||||
W,H=SCR.w,SCR.h
|
||||
for i=1,16 do
|
||||
crystal[i]={
|
||||
x=i<9 and W*.05*i or W*.05*(28-i),
|
||||
@@ -138,14 +138,14 @@ back.fan={
|
||||
BG.resize()
|
||||
end,
|
||||
resize=function()
|
||||
CX,CY=scr.w/2,scr.h/2
|
||||
W,H=scr.w,scr.h
|
||||
CX,CY=SCR.w/2,SCR.h/2
|
||||
W,H=SCR.w,SCR.h
|
||||
end,
|
||||
update=function()
|
||||
t=t+1
|
||||
if t%10==0 then
|
||||
ins(petal,{
|
||||
x=scr.w*rnd(),
|
||||
x=SCR.w*rnd(),
|
||||
y=0,
|
||||
vy=2+rnd()*2,
|
||||
vx=rnd()*2-.5,
|
||||
@@ -169,7 +169,7 @@ back.fan={
|
||||
draw=function()
|
||||
gc.push("transform")
|
||||
gc.translate(CX,CY+20*sin(t*.02))
|
||||
gc.scale(scr.k)
|
||||
gc.scale(SCR.k)
|
||||
gc.clear(.1,.1,.1)
|
||||
gc.setLineWidth(320)
|
||||
gc.setColor(.3,.2,.3)
|
||||
@@ -206,11 +206,11 @@ back.fan={
|
||||
back.aura={
|
||||
init=function()
|
||||
t=rnd()*3600
|
||||
BG.resize(scr.w,scr.h)
|
||||
BG.resize(SCR.w,SCR.h)
|
||||
end,
|
||||
resize=function(w,h)
|
||||
SHADER.aura:send("w",scr.W)
|
||||
SHADER.aura:send("h",h*scr.dpi)
|
||||
SHADER.aura:send("w",SCR.W)
|
||||
SHADER.aura:send("h",h*SCR.dpi)
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
@@ -218,17 +218,17 @@ back.aura={
|
||||
draw=function()
|
||||
SHADER.aura:send("t",t)
|
||||
gc.setShader(SHADER.aura)
|
||||
gc.rectangle("fill",0,0,scr.w,scr.h)
|
||||
gc.rectangle("fill",0,0,SCR.w,SCR.h)
|
||||
gc.setShader()
|
||||
end,
|
||||
}--Cool liquid background
|
||||
back.bg1={
|
||||
init=function()
|
||||
t=0
|
||||
BG.resize(scr.w)
|
||||
BG.resize(SCR.w)
|
||||
end,
|
||||
resize=function(w)
|
||||
SHADER.gradient1:send("w",scr.W)
|
||||
SHADER.gradient1:send("w",SCR.W)
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
@@ -236,17 +236,17 @@ back.bg1={
|
||||
draw=function()
|
||||
SHADER.gradient1:send("t",t)
|
||||
gc.setShader(SHADER.gradient1)
|
||||
gc.rectangle("fill",0,0,scr.w,scr.h)
|
||||
gc.rectangle("fill",0,0,SCR.w,SCR.h)
|
||||
gc.setShader()
|
||||
end,
|
||||
}--Horizonal red-blue gradient
|
||||
back.bg2={
|
||||
init=function()
|
||||
t=0
|
||||
BG.resize(nil,scr.h)
|
||||
BG.resize(nil,SCR.h)
|
||||
end,
|
||||
resize=function(w,h)
|
||||
SHADER.gradient2:send("h",h*scr.dpi)
|
||||
SHADER.gradient2:send("h",h*SCR.dpi)
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
@@ -254,18 +254,18 @@ back.bg2={
|
||||
draw=function()
|
||||
SHADER.gradient2:send("t",t)
|
||||
gc.setShader(SHADER.gradient2)
|
||||
gc.rectangle("fill",0,0,scr.w,scr.h)
|
||||
gc.rectangle("fill",0,0,SCR.w,SCR.h)
|
||||
gc.setShader()
|
||||
end,
|
||||
}--Vertical red-green gradient
|
||||
back.rainbow={
|
||||
init=function()
|
||||
t=0
|
||||
BG.resize(scr.w,scr.h)
|
||||
BG.resize(SCR.w,SCR.h)
|
||||
end,
|
||||
resize=function(w,h)
|
||||
SHADER.rgb1:send("w",scr.W)
|
||||
SHADER.rgb1:send("h",h*scr.dpi)
|
||||
SHADER.rgb1:send("w",SCR.W)
|
||||
SHADER.rgb1:send("h",h*SCR.dpi)
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
@@ -273,18 +273,18 @@ back.rainbow={
|
||||
draw=function()
|
||||
SHADER.rgb1:send("t",t)
|
||||
gc.setShader(SHADER.rgb1)
|
||||
gc.rectangle("fill",0,0,scr.w,scr.h)
|
||||
gc.rectangle("fill",0,0,SCR.w,SCR.h)
|
||||
gc.setShader()
|
||||
end,
|
||||
}--Colorful RGB
|
||||
back.rainbow2={
|
||||
init=function()
|
||||
t=0
|
||||
BG.resize(scr.w,scr.h)
|
||||
BG.resize(SCR.w,SCR.h)
|
||||
end,
|
||||
resize=function(w,h)
|
||||
SHADER.rgb2:send("w",scr.W)
|
||||
SHADER.rgb2:send("h",h*scr.dpi)
|
||||
SHADER.rgb2:send("w",SCR.W)
|
||||
SHADER.rgb2:send("h",h*SCR.dpi)
|
||||
end,
|
||||
update=function(dt)
|
||||
t=t+dt
|
||||
@@ -292,7 +292,7 @@ back.rainbow2={
|
||||
draw=function()
|
||||
SHADER.rgb2:send("t",t)
|
||||
gc.setShader(SHADER.rgb2)
|
||||
gc.rectangle("fill",0,0,scr.w,scr.h)
|
||||
gc.rectangle("fill",0,0,SCR.w,SCR.h)
|
||||
gc.setShader()
|
||||
end,
|
||||
}--Blue RGB
|
||||
@@ -317,7 +317,7 @@ back.lightning2={
|
||||
init=function()
|
||||
t=0
|
||||
colorLib=_G.SKIN.libColor
|
||||
colorSet=_G.setting.skin
|
||||
colorSet=_G.SETTING.skin
|
||||
blockImg=_G.TEXTURE.miniBlock
|
||||
end,
|
||||
update=function(dt)
|
||||
@@ -346,10 +346,10 @@ back.matrix={
|
||||
draw=function()
|
||||
gc.clear(.15,.15,.15)
|
||||
gc.push("transform")
|
||||
local k=scr.k
|
||||
local k=SCR.k
|
||||
gc.scale(k)
|
||||
local Y=ceil(scr.h/80/k)
|
||||
for x=1,ceil(scr.w/80/k)do
|
||||
local Y=ceil(SCR.h/80/k)
|
||||
for x=1,ceil(SCR.w/80/k)do
|
||||
for y=1,Y do
|
||||
gc.setColor(1,1,1,sin(x+matrixT[x][y]*t)*.1+.1)
|
||||
gc.rectangle("fill",80*x,80*y,-80,-80)
|
||||
@@ -362,14 +362,14 @@ back.matrix={
|
||||
back.space={
|
||||
init=function()
|
||||
stars={}
|
||||
W,H=scr.w+20,scr.h+20
|
||||
BG.resize(scr.w,scr.h)
|
||||
W,H=SCR.w+20,SCR.h+20
|
||||
BG.resize(SCR.w,SCR.h)
|
||||
end,
|
||||
resize=function(w,h)
|
||||
local S=stars
|
||||
for i=1,1260,5 do
|
||||
local s=rnd(26,40)*.1
|
||||
S[i]=s*scr.k --Size
|
||||
S[i]=s*SCR.k --Size
|
||||
S[i+1]=rnd(W)-10 --X
|
||||
S[i+2]=rnd(H)-10 --Y
|
||||
S[i+3]=(rnd()-.5)*.01*s --Vx
|
||||
@@ -424,7 +424,7 @@ function BG.send(data)
|
||||
end
|
||||
end
|
||||
function BG.set(bg,data)
|
||||
if bg==BG.cur or not setting.bg then return end
|
||||
if bg==BG.cur or not SETTING.bg then return end
|
||||
if BG.discard then
|
||||
BG.discard()
|
||||
collectgarbage()
|
||||
|
||||
@@ -3,7 +3,7 @@ local rem=table.remove
|
||||
|
||||
local function fadeOut(id)
|
||||
local src=BGM.list[id]
|
||||
local v=src:getVolume()-.025*setting.bgm
|
||||
local v=src:getVolume()-.025*SETTING.bgm
|
||||
src:setVolume(v>0 and v or 0)
|
||||
if v<=0 then
|
||||
src:stop()
|
||||
@@ -12,10 +12,10 @@ local function fadeOut(id)
|
||||
end
|
||||
local function fadeIn(id)
|
||||
local src=BGM.list[id]
|
||||
local v=setting.bgm
|
||||
local v=SETTING.bgm
|
||||
v=min(v,src:getVolume()+.025*v)
|
||||
src:setVolume(v)
|
||||
if v>=setting.bgm then return true end
|
||||
if v>=SETTING.bgm then return true end
|
||||
end
|
||||
|
||||
local BGM={
|
||||
@@ -64,7 +64,7 @@ function BGM.loadAll()
|
||||
end
|
||||
end
|
||||
function BGM.play(s)
|
||||
if setting.bgm==0 then
|
||||
if SETTING.bgm==0 then
|
||||
BGM.playing=BGM.list[s]
|
||||
BGM.suspend,BGM.nowPlay=s
|
||||
return
|
||||
@@ -84,7 +84,7 @@ function BGM.play(s)
|
||||
end
|
||||
function BGM.freshVolume()
|
||||
if BGM.playing then
|
||||
local v=setting.bgm
|
||||
local v=SETTING.bgm
|
||||
if v>0 then
|
||||
BGM.playing:setVolume(v)
|
||||
if BGM.suspend then
|
||||
|
||||
@@ -71,14 +71,14 @@ function FILE.loadData()
|
||||
if s then
|
||||
setfenv(s,{})
|
||||
local S=s()
|
||||
addToTable(S,stat)
|
||||
addToTable(S,STAT)
|
||||
end
|
||||
end
|
||||
end
|
||||
function FILE.saveData()
|
||||
local F=files.data
|
||||
F:open("w")
|
||||
local _,mes=F:write(dumpTable(stat))
|
||||
local _,mes=F:write(dumpTable(STAT))
|
||||
F:flush()F:close()
|
||||
if not _ then
|
||||
LOG.print(text.statSavingError..(mes or"unknown error"),color.red)
|
||||
@@ -96,14 +96,14 @@ function FILE.loadSetting()
|
||||
F:close()
|
||||
if s then
|
||||
setfenv(s,{})
|
||||
addToTable(s(),setting)
|
||||
addToTable(s(),SETTING)
|
||||
end
|
||||
end
|
||||
end
|
||||
function FILE.saveSetting()
|
||||
local F=files.setting
|
||||
F:open("w")
|
||||
local _,mes=F:write(dumpTable(setting))
|
||||
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)
|
||||
|
||||
@@ -23,7 +23,7 @@ local gc=love.graphics
|
||||
local int,rnd,abs=math.floor,math.random,math.abs
|
||||
local max,min=math.max,math.min
|
||||
local ins,rem=table.insert,table.remove
|
||||
local scr=scr
|
||||
local SCR=SCR
|
||||
|
||||
local mx,my,mouseShow=-20,-20,false
|
||||
local touching=nil--First touching ID(userdata)
|
||||
@@ -107,7 +107,7 @@ function love.mousemoved(x,y,dx,dy,t)
|
||||
mouseShow=true
|
||||
mx,my=xOy:inverseTransformPoint(x,y)
|
||||
if SCN.swapping then return end
|
||||
dx,dy=dx/scr.k,dy/scr.k
|
||||
dx,dy=dx/SCR.k,dy/SCR.k
|
||||
if mouseMove[SCN.cur]then
|
||||
mouseMove[SCN.cur](mx,my,dx,dy)
|
||||
end
|
||||
@@ -151,7 +151,7 @@ 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)
|
||||
touchMove[SCN.cur](id,x,y,dx/SCR.k,dy/SCR.k)
|
||||
end
|
||||
if WIDGET.sel then
|
||||
if touching then
|
||||
@@ -194,15 +194,15 @@ function love.keypressed(i)
|
||||
love._setGammaCorrect(r)
|
||||
LOG.print("GammaCorrect: "..(r and"on"or"off"),"warn")
|
||||
elseif i=="f2"then
|
||||
LOG.print("System:"..system.."["..jit.arch.."]")
|
||||
LOG.print("System:"..SYSTEM.."["..jit.arch.."]")
|
||||
LOG.print("luaVer:".._VERSION)
|
||||
LOG.print("jitVer:"..jit.version)
|
||||
LOG.print("jitVerNum:"..jit.version_num)
|
||||
elseif i=="f3"then
|
||||
for _=1,8 do
|
||||
local P=players.alive[rnd(#players.alive)]
|
||||
if P~=players[1]then
|
||||
P.lastRecv=players[1]
|
||||
local P=PLAYERS.alive[rnd(#PLAYERS.alive)]
|
||||
if P~=PLAYERS[1]then
|
||||
P.lastRecv=PLAYERS[1]
|
||||
P:lose()
|
||||
end
|
||||
end
|
||||
@@ -323,28 +323,28 @@ function love.lowmemory()
|
||||
collectgarbage()
|
||||
end
|
||||
function love.resize(w,h)
|
||||
scr.w,scr.h,scr.dpi=w,h,gc.getDPIScale()
|
||||
scr.W,scr.H=scr.w*scr.dpi,scr.h*scr.dpi
|
||||
scr.r=h/w
|
||||
scr.rad=(w^2+h^2)^.5
|
||||
SCR.w,SCR.h,SCR.dpi=w,h,gc.getDPIScale()
|
||||
SCR.W,SCR.H=SCR.w*SCR.dpi,SCR.h*SCR.dpi
|
||||
SCR.r=h/w
|
||||
SCR.rad=(w^2+h^2)^.5
|
||||
|
||||
if scr.r>=.5625 then
|
||||
scr.k=w/1280
|
||||
scr.x,scr.y=0,(h-w*9/16)*.5
|
||||
if SCR.r>=.5625 then
|
||||
SCR.k=w/1280
|
||||
SCR.x,SCR.y=0,(h-w*9/16)*.5
|
||||
else
|
||||
scr.k=h/720
|
||||
scr.x,scr.y=(w-h*16/9)*.5,0
|
||||
SCR.k=h/720
|
||||
SCR.x,SCR.y=(w-h*16/9)*.5,0
|
||||
end
|
||||
xOy=xOy:setTransformation(w*.5,h*.5,nil,scr.k,nil,640,360)
|
||||
xOy=xOy:setTransformation(w*.5,h*.5,nil,SCR.k,nil,640,360)
|
||||
BG.resize(w,h)
|
||||
|
||||
SHADER.warning:send("w",w*scr.dpi)
|
||||
SHADER.warning:send("h",h*scr.dpi)
|
||||
SHADER.warning:send("w",w*SCR.dpi)
|
||||
SHADER.warning:send("h",h*SCR.dpi)
|
||||
end
|
||||
function love.focus(f)
|
||||
if f then
|
||||
love.timer.step()
|
||||
elseif SCN.cur=="play"and setting.autoPause then
|
||||
elseif SCN.cur=="play"and SETTING.autoPause then
|
||||
pauseGame()
|
||||
end
|
||||
end
|
||||
@@ -373,7 +373,7 @@ function love.errorhandler(msg)
|
||||
gc.captureScreenshot(_)
|
||||
gc.present()
|
||||
|
||||
SFX.fplay("error",setting.voc*.8)
|
||||
SFX.fplay("error",SETTING.voc*.8)
|
||||
|
||||
local BGcolor=rnd()>.026 and{.3,.5,.9}or{.62,.3,.926}
|
||||
local needDraw=true
|
||||
@@ -415,7 +415,7 @@ function love.errorhandler(msg)
|
||||
setFont(120)gc.print(":(",100,40)
|
||||
setFont(38)gc.printf(text.errorMsg,100,200,1280-100)
|
||||
setFont(20)
|
||||
gc.print(system.."-"..gameVersion,100,660)
|
||||
gc.print(SYSTEM.."-"..gameVersion,100,660)
|
||||
gc.print("scene:"..SCN.cur,400,660)
|
||||
gc.printf(err[1],626,360,1260-626)
|
||||
gc.print("TRACEBACK",626,426)
|
||||
@@ -455,7 +455,7 @@ function love.run()
|
||||
love.resize(gc.getWidth(),gc.getHeight())
|
||||
|
||||
--Scene Launch
|
||||
if setting.appLock then
|
||||
if SETTING.appLock then
|
||||
SCN.init("calculator")
|
||||
else
|
||||
SCN.init("load")
|
||||
@@ -492,7 +492,7 @@ function love.run()
|
||||
|
||||
--DRAW
|
||||
if not mini()then
|
||||
FCT=FCT+setting.frameMul
|
||||
FCT=FCT+SETTING.frameMul
|
||||
if FCT>=100 then
|
||||
FCT=FCT-100
|
||||
gc.discard()--SPEED UPUPUP!
|
||||
@@ -511,7 +511,7 @@ function love.run()
|
||||
if mouseShow then
|
||||
local r=Timer()*.5
|
||||
local R=int(r)%7+1
|
||||
_=SKIN.libColor[setting.skin[R]]
|
||||
_=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,scs[2*R],#blocks[R][0]-scs[2*R-1])
|
||||
gc.setColor(1,1,1,.5)gc.circle("fill",mx,my,5)
|
||||
@@ -523,8 +523,8 @@ function love.run()
|
||||
|
||||
--Draw power info.
|
||||
gc.setColor(1,1,1)
|
||||
if setting.powerInfo then
|
||||
gc.draw(infoCanvas,0,0,0,scr.k)
|
||||
if SETTING.powerInfo then
|
||||
gc.draw(infoCanvas,0,0,0,SCR.k)
|
||||
end
|
||||
|
||||
--Draw scene swapping animation
|
||||
@@ -536,7 +536,7 @@ function love.run()
|
||||
--Draw FPS
|
||||
gc.setColor(1,1,1)
|
||||
setFont(15)
|
||||
_=scr.h-20
|
||||
_=SCR.h-20
|
||||
gc.print(FPS(),5,_)
|
||||
|
||||
--Debug info.
|
||||
@@ -564,11 +564,11 @@ function love.run()
|
||||
|
||||
--Fresh power info.
|
||||
if Timer()-lastFreshPow>2 then
|
||||
if setting.powerInfo and loadingFinished then
|
||||
if SETTING.powerInfo and loadingFinished then
|
||||
updatePowerInfo()
|
||||
lastFreshPow=Timer()
|
||||
end
|
||||
if gc.getWidth()~=scr.w then
|
||||
if gc.getWidth()~=SCR.w then
|
||||
love.resize(gc.getWidth(),gc.getHeight())
|
||||
LOG.print("Screen Resized",color.yellow)
|
||||
end
|
||||
|
||||
@@ -26,7 +26,7 @@ end
|
||||
function LOG.draw()
|
||||
if debugMesList[1]then
|
||||
gc.push("transform")
|
||||
local k=scr.w/1280
|
||||
local k=SCR.w/1280
|
||||
setFont(int(20*k))
|
||||
for i=1,#debugMesList do
|
||||
local M=debugMesList[i]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local gc=love.graphics
|
||||
local abs=math.abs
|
||||
local scr=scr
|
||||
local SCR=SCR
|
||||
|
||||
sceneInit,sceneBack={},{}
|
||||
local sceneInit,sceneBack=sceneInit,sceneBack
|
||||
@@ -54,35 +54,35 @@ local swap={
|
||||
fade={30,15,function(t)
|
||||
local t=t>15 and 2-t/15 or t/15
|
||||
gc.setColor(0,0,0,t)
|
||||
gc.rectangle("fill",0,0,scr.w,scr.h)
|
||||
gc.rectangle("fill",0,0,SCR.w,SCR.h)
|
||||
end},
|
||||
fade_togame={120,20,function(t)
|
||||
local t=t>20 and(120-t)/100 or t/20
|
||||
gc.setColor(0,0,0,t)
|
||||
gc.rectangle("fill",0,0,scr.w,scr.h)
|
||||
gc.rectangle("fill",0,0,SCR.w,SCR.h)
|
||||
end},
|
||||
slowFade={180,90,function(t)
|
||||
local t=t>90 and 2-t/90 or t/90
|
||||
gc.setColor(0,0,0,t)
|
||||
gc.rectangle("fill",0,0,scr.w,scr.h)
|
||||
gc.rectangle("fill",0,0,SCR.w,SCR.h)
|
||||
end},
|
||||
swipeL={30,15,function(t)
|
||||
t=t/30
|
||||
gc.setColor(.1,.1,.1,1-abs(t-.5))
|
||||
t=t*t*(3-2*t)*2-1
|
||||
gc.rectangle("fill",t*scr.w,0,scr.w,scr.h)
|
||||
gc.rectangle("fill",t*SCR.w,0,SCR.w,SCR.h)
|
||||
end},
|
||||
swipeR={30,15,function(t)
|
||||
t=t/30
|
||||
gc.setColor(.1,.1,.1,1-abs(t-.5))
|
||||
t=t*t*(2*t-3)*2+1
|
||||
gc.rectangle("fill",t*scr.w,0,scr.w,scr.h)
|
||||
gc.rectangle("fill",t*SCR.w,0,SCR.w,SCR.h)
|
||||
end},
|
||||
swipeD={30,15,function(t)
|
||||
t=t/30
|
||||
gc.setColor(.1,.1,.1,1-abs(t-.5))
|
||||
t=t*t*(2*t-3)*2+1
|
||||
gc.rectangle("fill",0,t*scr.h,scr.w,scr.h)
|
||||
gc.rectangle("fill",0,t*SCR.h,SCR.w,SCR.h)
|
||||
end},
|
||||
}--Scene swapping animations
|
||||
function SCN.swapTo(tar,style)--Parallel scene swapping, cannot back
|
||||
|
||||
@@ -42,7 +42,7 @@ function SFX.fieldPlay(s,v,P)
|
||||
SFX.play(s,v,(P.curX+P.sc[2]-5.5)*.15)
|
||||
end
|
||||
function SFX.play(s,vol,pos)
|
||||
if setting.sfx==0 then return end
|
||||
if SETTING.sfx==0 then return end
|
||||
local S=SFX.list[s]--Source list
|
||||
if not S then return end
|
||||
local n=1
|
||||
@@ -57,13 +57,13 @@ function SFX.play(s,vol,pos)
|
||||
S=S[n]--AU_SRC
|
||||
if S:getChannelCount()==1 then
|
||||
if pos then
|
||||
pos=pos*setting.stereo
|
||||
pos=pos*SETTING.stereo
|
||||
S:setPosition(pos,1-pos^2,0)
|
||||
else
|
||||
S:setPosition(0,0,0)
|
||||
end
|
||||
end
|
||||
S:setVolume(((vol or 1)*setting.sfx)^1.626)
|
||||
S:setVolume(((vol or 1)*SETTING.sfx)^1.626)
|
||||
S:play()
|
||||
end
|
||||
function SFX.fplay(s,vol,pos)
|
||||
@@ -81,7 +81,7 @@ function SFX.fplay(s,vol,pos)
|
||||
S=S[n]--AU_SRC
|
||||
if S:getChannelCount()==1 then
|
||||
if pos then
|
||||
pos=pos*setting.stereo
|
||||
pos=pos*SETTING.stereo
|
||||
S:setPosition(pos,1-pos^2,0)
|
||||
else
|
||||
S:setPosition(0,0,0)
|
||||
|
||||
@@ -32,7 +32,7 @@ function FXupdate.attack(S,dt)
|
||||
|
||||
ins(L,S.x)ins(L,S.y)
|
||||
end
|
||||
if #L==4+4*setting.atkFX then
|
||||
if #L==4+4*SETTING.atkFX then
|
||||
rem(L,1)rem(L,1)
|
||||
end
|
||||
return S.t>1
|
||||
|
||||
@@ -19,14 +19,14 @@ do--LOADLIB
|
||||
}
|
||||
function LOADLIB(name)
|
||||
local libName=libName[name]
|
||||
if system=="Windows"or system=="Linux"then
|
||||
local success,message=require(libName[system])
|
||||
if SYSTEM=="Windows"or SYSTEM=="Linux"then
|
||||
local success,message=require(libName[SYSTEM])
|
||||
if success then
|
||||
return success
|
||||
else
|
||||
LOG.print("Cannot load "..name..": "..message,"warn",color.red)
|
||||
end
|
||||
elseif system=="Android"then
|
||||
elseif SYSTEM=="Android"then
|
||||
local fs=love.filesystem
|
||||
local platform={"arm64-v8a","armeabi-v7a"}
|
||||
local libFunc
|
||||
@@ -55,7 +55,7 @@ do--LOADLIB
|
||||
end
|
||||
return libFunc()
|
||||
else
|
||||
LOG.print("No "..name.." for "..system,"warn",color.red)
|
||||
LOG.print("No "..name.." for "..SYSTEM,"warn",color.red)
|
||||
return
|
||||
end
|
||||
return true
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local level={0,0,.015,.02,.03,.04,.05,.06,.07,.08}
|
||||
local _=love.system.vibrate
|
||||
return function(t)
|
||||
local L=setting.vib
|
||||
local L=SETTING.vib
|
||||
if L>0 then
|
||||
_(level[L+t])
|
||||
end
|
||||
|
||||
@@ -80,13 +80,13 @@ function VOC.update()
|
||||
end
|
||||
elseif Q.s==1 then--Waiting load source
|
||||
Q[1]=getVoice(Q[1])
|
||||
Q[1]:setVolume(setting.voc)
|
||||
Q[1]:setVolume(SETTING.voc)
|
||||
Q[1]:play()
|
||||
Q.s=Q[2]and 2 or 4
|
||||
elseif Q.s==2 then--Playing 1,ready 2
|
||||
if Q[1]:getDuration()-Q[1]:tell()<.08 then
|
||||
Q[2]=getVoice(Q[2])
|
||||
Q[2]:setVolume(setting.voc)
|
||||
Q[2]:setVolume(SETTING.voc)
|
||||
Q[2]:play()
|
||||
Q.s=3
|
||||
end
|
||||
@@ -106,7 +106,7 @@ function VOC.update()
|
||||
end
|
||||
end
|
||||
function VOC.play(s,chn)
|
||||
if setting.voc>0 then
|
||||
if SETTING.voc>0 then
|
||||
local _=VOC.list[s]
|
||||
if not _ then return end
|
||||
if chn then
|
||||
|
||||
@@ -729,7 +729,7 @@ function WIDGET.press(x,y)
|
||||
end
|
||||
end
|
||||
elseif W.type=="textBox"then
|
||||
if system=="Android"then
|
||||
if SYSTEM=="Android"then
|
||||
local _,y=xOy:transformPoint(0,W.y+W.h)
|
||||
kb.setTextInput(true,0,y,1,1)
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
local rnd=math.random
|
||||
local ins,rem=table.insert,table.remove
|
||||
local mobileHide=(system=="Android"or system=="iOS")and function()return true end
|
||||
local mobileHide=(SYSTEM=="Android"or SYSTEM=="iOS")and function()return true end
|
||||
local function BACK()SCN.back()end
|
||||
local virtualkeySet={
|
||||
{
|
||||
@@ -95,9 +95,9 @@ local function CUSval(k) return function() return customEnv[k] end end
|
||||
local function CUSrev(k) return function() customEnv[k]=not customEnv[k] end end
|
||||
local function CUSsto(k) return function(i) customEnv[k]=i end end
|
||||
|
||||
local function SETval(k) return function() return setting[k] end end
|
||||
local function SETrev(k) return function() setting[k]=not setting[k] end end
|
||||
local function SETsto(k) return function(i) setting[k]=i end end
|
||||
local function SETval(k) return function() return SETTING[k] end end
|
||||
local function SETrev(k) return function() SETTING[k]=not SETTING[k] end end
|
||||
local function SETsto(k) return function(i) SETTING[k]=i end end
|
||||
|
||||
local function STPval(k) return function() return sceneTemp[k] end end
|
||||
local function STPrev(k) return function() sceneTemp[k]=not sceneTemp[k] end end
|
||||
@@ -113,7 +113,7 @@ local function VKAcode(n) return function() VK_org[n].ava=not VK_org[n].ava end
|
||||
|
||||
local function pressKey(k) return function() love.keypressed(k) end end
|
||||
local function setPen(i) return function() sceneTemp.pen=i end end
|
||||
local function setLang(n) return function() LANG.set(n)setting.lang=n end end
|
||||
local function setLang(n) return function() LANG.set(n)SETTING.lang=n end end
|
||||
local function goScene(t,s) return function() SCN.go(t,s) end end
|
||||
local function swapScene(t,s)return function() SCN.swapTo(t,s) end end
|
||||
|
||||
@@ -157,7 +157,7 @@ local Widgets={
|
||||
newButton({name="custom", x=590,y=270,w=200,h=160,color="lOrange",font=45,code=goScene("customGame"),hide=function()return not modeRanks.marathon_normal end}),
|
||||
newButton({name="help", x=150,y=450,w=200,h=160,color="lYellow",font=50,code=goScene("help")}),
|
||||
newButton({name="stat", x=370,y=450,w=200,h=160,color="lCyan", font=40,code=goScene("stat")}),
|
||||
newButton({name="qplay", x=590,y=450,w=200,h=160,color="lGreen", font=45,code=function()SCN.push()loadGame(stat.lastPlay,true)end}),
|
||||
newButton({name="qplay", x=590,y=450,w=200,h=160,color="lGreen", font=45,code=function()SCN.push()loadGame(STAT.lastPlay,true)end}),
|
||||
newButton({name="lang", x=150,y=590,w=200,h=80,color="lGreen", font=45,code=goScene("setting_lang")}),
|
||||
newButton({name="music", x=370,y=590,w=200,h=80,color="lPurple", font=30,code=goScene("music")}),
|
||||
newButton({name="quit", x=590,y=590,w=200,h=80,color="lGrey", font=45,code=function()VOC.play("bye")SCN.swapTo("quit","slowFade")end}),
|
||||
@@ -172,17 +172,17 @@ local Widgets={
|
||||
newText({name="title", x=30, y=30,font=80,align="L"}),
|
||||
newText({name="arrow", x=270, y=360,font=45,align="L"}),
|
||||
newText({name="now", x=700, y=500,font=50,align="R",hide=function()return not BGM.nowPlay end}),
|
||||
newSlider({name="bgm", x=760, y=80,w=400, font=35,disp=SETval("bgm"),code=function(v)setting.bgm=v BGM.freshVolume()end}),
|
||||
newSlider({name="bgm", x=760, y=80,w=400, font=35,disp=SETval("bgm"),code=function(v)SETTING.bgm=v BGM.freshVolume()end}),
|
||||
newButton({name="up", x=200, y=250,w=120, font=55,code=pressKey("up"),hide=function()return sceneTemp==1 end}),
|
||||
newButton({name="play", x=200, y=390,w=120, font=35,code=pressKey("space"),hide=function()return setting.bgm==0 end}),
|
||||
newButton({name="play", x=200, y=390,w=120, font=35,code=pressKey("space"),hide=function()return SETTING.bgm==0 end}),
|
||||
newButton({name="down", x=200, y=530,w=120, font=55,code=pressKey("down"),hide=function()return sceneTemp==BGM.len end}),
|
||||
newButton({name="back", x=1140, y=640,w=170,h=80, font=40,code=BACK}),
|
||||
},
|
||||
customGame={
|
||||
newText({name="title", x=600,y=5,font=80,align="R"}),
|
||||
newText({name="subTitle", x=610,y=50,font=35,align="L",color="grey"}),
|
||||
newText({name="defSeq", x=330,y=550,align="L",color="grey",hide=function()return preBag[1]end}),
|
||||
newText({name="noMsn", x=610,y=550,align="L",color="grey",hide=function()return preMission[1]end}),
|
||||
newText({name="defSeq", x=330,y=550,align="L",color="grey",hide=function()return BAG[1]end}),
|
||||
newText({name="noMsn", x=610,y=550,align="L",color="grey",hide=function()return MISSION[1]end}),
|
||||
|
||||
--Basic
|
||||
newSelector({name="drop", x=170, y=150,w=220,color="orange", list=CUSlist.drop, disp=CUSval("drop"),code=CUSsto("drop")}),
|
||||
@@ -317,7 +317,7 @@ local Widgets={
|
||||
newKey({name="ten", x=1000, y=440, w=90, color="lGreen", font=40,code=pressKey("ten")}),
|
||||
newKey({name="backsp", x=1000, y=540, w=90, color="lYellow",font=50,code=pressKey("backspace")}),
|
||||
newKey({name="reset", x=1000, y=640, w=90, color="lYellow",font=50,code=pressKey("delete")}),
|
||||
newButton({name="copy", x=1140, y=440, w=170,h=80, color="lRed", font=40,code=pressKey("cC"),hide=function()return #preBag==0 end}),
|
||||
newButton({name="copy", x=1140, y=440, w=170,h=80, color="lRed", font=40,code=pressKey("cC"),hide=function()return #BAG==0 end}),
|
||||
newButton({name="paste", x=1140, y=540, w=170,h=80, color="lBlue", font=40,code=pressKey("cV")}),
|
||||
|
||||
newButton({name="back", x=1140, y=640, w=170,h=80, font=40,code=BACK}),
|
||||
@@ -368,7 +368,7 @@ local Widgets={
|
||||
newKey({name="ten", x=1000, y=440, w=90, color="lGreen", font=40,code=pressKey("ten")}),
|
||||
newKey({name="backsp", x=1000, y=540, w=90, color="lYellow",font=50,code=pressKey("backspace")}),
|
||||
newKey({name="reset", x=1000, y=640, w=90, color="lYellow",font=50,code=pressKey("delete")}),
|
||||
newButton({name="copy", x=1140, y=440, w=170,h=80, color="lRed", font=40,code=pressKey("cC"),hide=function()return #preMission==0 end}),
|
||||
newButton({name="copy", x=1140, y=440, w=170,h=80, color="lRed", font=40,code=pressKey("cC"),hide=function()return #MISSION==0 end}),
|
||||
newButton({name="paste", x=1140, y=540, w=170,h=80, color="lBlue", font=40,code=pressKey("cV")}),
|
||||
newSwitch({name="mission", x=1150, y=350, disp=CUSval("missionKill"), code=CUSrev("missionKill")}),
|
||||
|
||||
@@ -379,7 +379,7 @@ local Widgets={
|
||||
},
|
||||
pause={
|
||||
newButton({name="setting", x=1120, y=70, w=240,h=90, color="lBlue", font=35,code=pressKey("s")}),
|
||||
newButton({name="replay", x=640, y=250, w=240,h=100,color="lYellow",font=30,code=pressKey("p"),hide=function()return not(game.result or game.replaying)or #players>1 end}),
|
||||
newButton({name="replay", x=640, y=250, w=240,h=100,color="lYellow",font=30,code=pressKey("p"),hide=function()return not(GAME.result or GAME.replaying)or #PLAYERS>1 end}),
|
||||
newButton({name="resume", x=640, y=367, w=240,h=100,color="lGreen", font=30,code=pressKey("escape")}),
|
||||
newButton({name="restart", x=640, y=483, w=240,h=100,color="lRed", font=35,code=pressKey("r")}),
|
||||
newButton({name="quit", x=640, y=600, w=240,h=100,font=35,code=BACK}),
|
||||
@@ -398,9 +398,9 @@ local Widgets={
|
||||
newButton({name="layout", x=460, y=540, w=140,h=70, font=35,code=goScene("setting_skin")}),
|
||||
newSwitch({name="autoPause",x=1080, y=320, font=20,disp=SETval("autoPause"), code=SETrev("autoPause")}),
|
||||
newSwitch({name="swap", x=1080, y=380, font=20,disp=SETval("swap"), code=SETrev("swap")}),
|
||||
newSwitch({name="fine", x=1080, y=440, font=20,disp=SETval("fine"), code=function()setting.fine=not setting.fine if setting.fine then SFX.play("finesseError",.6) end end}),
|
||||
newSwitch({name="fine", x=1080, y=440, font=20,disp=SETval("fine"), code=function()SETTING.fine=not SETTING.fine if SETTING.fine then SFX.play("finesseError",.6) end end}),
|
||||
newSwitch({name="appLock", x=1080, y=500, font=20,disp=SETval("appLock"), code=SETrev("appLock")}),
|
||||
newButton({name="calc", x=970, y=550, w=150,h=60,color="dGrey", font=25,code=goScene("calculator"),hide=function()return not setting.appLock end}),
|
||||
newButton({name="calc", x=970, y=550, w=150,h=60,color="dGrey", font=25,code=goScene("calculator"),hide=function()return not SETTING.appLock end}),
|
||||
newButton({name="back", x=1140, y=640, w=170,h=80, font=40,code=BACK}),
|
||||
},
|
||||
setting_video={
|
||||
@@ -425,10 +425,10 @@ local Widgets={
|
||||
newSlider({name="atkFX", x=350, y=600,w=373,unit=5, disp=SETval("atkFX"), code=SETsto("atkFX")}),
|
||||
newSlider({name="frame", x=350, y=650,w=373,unit=10,
|
||||
disp=function()
|
||||
return setting.frameMul>35 and setting.frameMul/10 or setting.frameMul/5-4
|
||||
return SETTING.frameMul>35 and SETTING.frameMul/10 or SETTING.frameMul/5-4
|
||||
end,
|
||||
code=function(i)
|
||||
setting.frameMul=i<5 and 5*i+20 or 10*i
|
||||
SETTING.frameMul=i<5 and 5*i+20 or 10*i
|
||||
end}),
|
||||
|
||||
newSwitch({name="text", x=1100, y=180,font=35,disp=SETval("text"),code=SETrev("text")}),
|
||||
@@ -438,19 +438,19 @@ local Widgets={
|
||||
newSwitch({name="nextPos", x=1100, y=420,font=35,disp=SETval("nextPos"),code=SETrev("nextPos")}),
|
||||
newSwitch({name="fullscreen",x=1100,y=480,disp=SETval("fullscreen"),
|
||||
code=function()
|
||||
setting.fullscreen=not setting.fullscreen
|
||||
love.window.setFullscreen(setting.fullscreen)
|
||||
SETTING.fullscreen=not SETTING.fullscreen
|
||||
love.window.setFullscreen(SETTING.fullscreen)
|
||||
love.resize(love.graphics.getWidth(),love.graphics.getHeight())
|
||||
end}),
|
||||
newSwitch({name="bg", x=1100, y=540,font=35,disp=SETval("bg"),
|
||||
code=function()
|
||||
BG.set("none")
|
||||
setting.bg=not setting.bg
|
||||
SETTING.bg=not SETTING.bg
|
||||
BG.set("space")
|
||||
end}),
|
||||
newSwitch({name="power", x=990, y=640,font=35,disp=SETval("powerInfo"),
|
||||
code=function()
|
||||
setting.powerInfo=not setting.powerInfo
|
||||
SETTING.powerInfo=not SETTING.powerInfo
|
||||
end}),
|
||||
newButton({name="back", x=1140, y=640,w=170,h=80, font=40,code=BACK}),
|
||||
},
|
||||
@@ -461,8 +461,8 @@ local Widgets={
|
||||
newButton({name="graphic", x=1080, y=80,w=240,h=80,color="lCyan", font=35,code=swapScene("setting_video","swipeL")}),
|
||||
|
||||
newSlider({name="sfx", x=180, y=200,w=400, font=35,change=function()SFX.play("blip_1")end, disp=SETval("sfx"), code=SETsto("sfx")}),
|
||||
newSlider({name="stereo", x=180, y=500,w=400, font=35,change=function()SFX.play("move",1,-1)SFX.play("lock",1,1)end,disp=SETval("stereo"),code=SETsto("stereo"),hide=function()return setting.sfx==0 end}),
|
||||
newSlider({name="spawn", x=180, y=300,w=400, font=30,change=function()SFX.fplay("spawn_"..rnd(7),setting.spawn)end,disp=SETval("spawn"), code=SETsto("spawn")}),
|
||||
newSlider({name="stereo", x=180, y=500,w=400, font=35,change=function()SFX.play("move",1,-1)SFX.play("lock",1,1)end,disp=SETval("stereo"),code=SETsto("stereo"),hide=function()return SETTING.sfx==0 end}),
|
||||
newSlider({name="spawn", x=180, y=300,w=400, font=30,change=function()SFX.fplay("spawn_"..rnd(7),SETTING.spawn)end,disp=SETval("spawn"), code=SETsto("spawn")}),
|
||||
newSlider({name="bgm", x=180, y=400,w=400, font=35,change=function()BGM.freshVolume()end, disp=SETval("bgm"), code=SETsto("bgm")}),
|
||||
newSlider({name="vib", x=750, y=200,w=400, unit=5, font=25,change=function()VIB(2)end, disp=SETval("vib"), code=SETsto("vib")}),
|
||||
newSlider({name="voc", x=750, y=300,w=400, font=35,change=function()VOC.play("test")end, disp=SETval("voc"), code=SETsto("voc")}),
|
||||
@@ -481,7 +481,7 @@ local Widgets={
|
||||
newSwitch({name="ims", x=1100, y=470, disp=SETval("ims"), code=SETrev("ims")}),
|
||||
newButton({name="reset", x=160, y=580,w=200,h=100,color="lRed",font=40,
|
||||
code=function()
|
||||
local _=setting
|
||||
local _=SETTING
|
||||
_.das,_.arr=10,2
|
||||
_.sddas,_.sdarr=0,2
|
||||
_.ihs,_.irs,_.ims=false,false,false
|
||||
@@ -527,13 +527,13 @@ local Widgets={
|
||||
|
||||
newButton({name="skinR", x=200,y=640,w=220,h=80,color="lPurple",font=35,
|
||||
code=function()
|
||||
setting.skin={1,5,8,2,10,3,7,1,5,5,1,8,2,10,3,7,10,7,8,2,8,2,1,5,3}
|
||||
SETTING.skin={1,5,8,2,10,3,7,1,5,5,1,8,2,10,3,7,10,7,8,2,8,2,1,5,3}
|
||||
SFX.play("rotate")
|
||||
end}),
|
||||
newButton({name="faceR", x=480,y=640,w=220,h=80,color="lRed",font=35,
|
||||
code=function()
|
||||
for i=1,25 do
|
||||
setting.face[i]=0
|
||||
SETTING.face[i]=0
|
||||
end
|
||||
SFX.play("hold")
|
||||
end}),
|
||||
@@ -606,23 +606,23 @@ local Widgets={
|
||||
newButton({name="pro", x=1120, y=100, w=240,h=80, font=35,code=function()for i=1,20 do VK_org[i].ava=true end end}),
|
||||
newSwitch({name="hide", x=1170, y=200, font=40,disp=SETval("VKSwitch"),code=SETrev("VKSwitch")}),
|
||||
newSwitch({name="track", x=1170, y=300, font=35,disp=SETval("VKTrack"),code=SETrev("VKTrack")}),
|
||||
newSlider({name="sfx", x=800, y=380, w=180, font=35,change=function()SFX.play("virtualKey",setting.VKSFX)end,disp=SETval("VKSFX"),code=SETsto("VKSFX")}),
|
||||
newSlider({name="vib", x=800, y=460, w=180,unit=2, font=35,change=function()VIB(setting.VKVIB)end,disp=SETval("VKVIB"),code=SETsto("VKVIB")}),
|
||||
newSlider({name="sfx", x=800, y=380, w=180, font=35,change=function()SFX.play("virtualKey",SETTING.VKSFX)end,disp=SETval("VKSFX"),code=SETsto("VKSFX")}),
|
||||
newSlider({name="vib", x=800, y=460, w=180,unit=2, font=35,change=function()VIB(SETTING.VKVIB)end,disp=SETval("VKVIB"),code=SETsto("VKVIB")}),
|
||||
newSwitch({name="icon", x=850, y=300, font=40,disp=SETval("VKIcon"),code=SETrev("VKIcon")}),
|
||||
newButton({name="tkset", x=1120, y=420, w=240,h=80,
|
||||
code=function()
|
||||
SCN.go("setting_trackSetting")
|
||||
end,
|
||||
hide=function()
|
||||
return not setting.VKTrack
|
||||
return not SETTING.VKTrack
|
||||
end}),
|
||||
newSlider({name="alpha", x=840, y=540, w=400,font=40,disp=SETval("VKAlpha"),code=SETsto("VKAlpha")}),
|
||||
newButton({name="back", x=1140, y=640, w=170,h=80,font=40,code=BACK}),
|
||||
},
|
||||
setting_trackSetting={
|
||||
newSwitch({name="VKDodge", x=400, y=200, font=35, disp=SETval("VKDodge"),code=SETrev("VKDodge")}),
|
||||
newSlider({name="VKTchW", x=140, y=310, w=1000, unit=10,font=35,disp=SETval("VKTchW"),code=function(i)setting.VKTchW=i setting.VKCurW=math.max(setting.VKCurW,i)end}),
|
||||
newSlider({name="VKCurW", x=140, y=370, w=1000, unit=10,font=35,disp=SETval("VKCurW"),code=function(i)setting.VKCurW=i setting.VKTchW=math.min(setting.VKTchW,i)end}),
|
||||
newSlider({name="VKTchW", x=140, y=310, w=1000, unit=10,font=35,disp=SETval("VKTchW"),code=function(i)SETTING.VKTchW=i SETTING.VKCurW=math.max(SETTING.VKCurW,i)end}),
|
||||
newSlider({name="VKCurW", x=140, y=370, w=1000, unit=10,font=35,disp=SETval("VKCurW"),code=function(i)SETTING.VKCurW=i SETTING.VKTchW=math.min(SETTING.VKTchW,i)end}),
|
||||
newButton({name="back", x=1140, y=640, w=170,h=80,font=40,code=BACK}),
|
||||
},
|
||||
setting_lang={
|
||||
@@ -696,12 +696,12 @@ local Widgets={
|
||||
debug={
|
||||
newButton({name="scrInfo", x=300,y=120,w=300,h=100,color="green",code=function()
|
||||
LOG.print("Screen Info:")
|
||||
LOG.print("x y: "..scr.x.." "..scr.y)
|
||||
LOG.print("w h: "..scr.w.." "..scr.h)
|
||||
LOG.print("W H: "..scr.W.." "..scr.H)
|
||||
LOG.print("k: "..math.floor(scr.k*100)*.01)
|
||||
LOG.print("rad: "..math.floor(scr.rad*100)*.01)
|
||||
LOG.print("dpi: "..scr.dpi)
|
||||
LOG.print("x y: "..SCR.x.." "..SCR.y)
|
||||
LOG.print("w h: "..SCR.w.." "..SCR.h)
|
||||
LOG.print("W H: "..SCR.W.." "..SCR.H)
|
||||
LOG.print("k: "..math.floor(SCR.k*100)*.01)
|
||||
LOG.print("rad: "..math.floor(SCR.rad*100)*.01)
|
||||
LOG.print("dpi: "..SCR.dpi)
|
||||
end}),
|
||||
newButton({name="reset", x=640,y=380,w=240,h=100,color="orange", font=40,
|
||||
code=function()sceneTemp.reset=true end,
|
||||
|
||||
Reference in New Issue
Block a user