diff --git a/Zframework/bg.lua b/Zframework/bg.lua index 92c60e12..7be83a81 100644 --- a/Zframework/bg.lua +++ b/Zframework/bg.lua @@ -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() diff --git a/Zframework/bgm.lua b/Zframework/bgm.lua index 3651b2e8..1e07bea2 100644 --- a/Zframework/bgm.lua +++ b/Zframework/bgm.lua @@ -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 diff --git a/Zframework/file.lua b/Zframework/file.lua index d3e0097e..484eadbc 100644 --- a/Zframework/file.lua +++ b/Zframework/file.lua @@ -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) diff --git a/Zframework/init.lua b/Zframework/init.lua index 70db546b..60ec2089 100644 --- a/Zframework/init.lua +++ b/Zframework/init.lua @@ -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 diff --git a/Zframework/log.lua b/Zframework/log.lua index 9ed36fe0..bfd8e156 100644 --- a/Zframework/log.lua +++ b/Zframework/log.lua @@ -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] diff --git a/Zframework/scene.lua b/Zframework/scene.lua index 14ffd929..92442eeb 100644 --- a/Zframework/scene.lua +++ b/Zframework/scene.lua @@ -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 diff --git a/Zframework/sfx.lua b/Zframework/sfx.lua index 78691804..90d64a44 100644 --- a/Zframework/sfx.lua +++ b/Zframework/sfx.lua @@ -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) diff --git a/Zframework/sysFX.lua b/Zframework/sysFX.lua index 8a92d724..96ff7f4b 100644 --- a/Zframework/sysFX.lua +++ b/Zframework/sysFX.lua @@ -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 diff --git a/Zframework/toolfunc.lua b/Zframework/toolfunc.lua index 7e28df81..da2774d0 100644 --- a/Zframework/toolfunc.lua +++ b/Zframework/toolfunc.lua @@ -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 diff --git a/Zframework/vib.lua b/Zframework/vib.lua index 7e49cc1d..68142e01 100644 --- a/Zframework/vib.lua +++ b/Zframework/vib.lua @@ -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 diff --git a/Zframework/voice.lua b/Zframework/voice.lua index d80d54bd..1fafac1f 100644 --- a/Zframework/voice.lua +++ b/Zframework/voice.lua @@ -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 diff --git a/Zframework/widget.lua b/Zframework/widget.lua index f3be7b0a..7604636c 100644 --- a/Zframework/widget.lua +++ b/Zframework/widget.lua @@ -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 diff --git a/Zframework/widgetList.lua b/Zframework/widgetList.lua index 97c0ef52..8fde438f 100644 --- a/Zframework/widgetList.lua +++ b/Zframework/widgetList.lua @@ -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, diff --git a/main.lua b/main.lua index 60844da5..42302237 100644 --- a/main.lua +++ b/main.lua @@ -11,6 +11,7 @@ --? function NULL()end DBP=print--use this if need debugging print +SYSTEM=love.system.getOS() MARKING=true LOADED=false NOGAME=false @@ -21,8 +22,7 @@ math.randomseed(os.time()*626) love.keyboard.setKeyRepeat(true) love.mouse.setVisible(false) -system=love.system.getOS() -scr={ +SCR={ 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 @@ -72,11 +72,11 @@ customEnv={ bg="none", bgm="race" } -preField={h=20}for i=1,20 do preField[i]={0,0,0,0,0,0,0,0,0,0}end--Field for custom game -preBag={}--Sequence for custom game -preMission={}--Clearing target for custom game +FIELD={h=20}for i=1,20 do FIELD[i]={0,0,0,0,0,0,0,0,0,0}end--Field for custom game +BAG={}--Sequence for custom game +MISSION={}--Clearing mission for custom game -game={ +GAME={ frame=0, --Frame count result=false, --Game result (string) pauseTime=0, --Time paused @@ -97,13 +97,13 @@ game={ mostDangerous=nil, --Most dangerous player secDangerous=nil, --Second dangerous player }--Global game data -players={alive={}}--Players data -curMode=nil--Current mode object +PLAYERS={alive={}}--Players data +CURMODE=nil--Current mode object --blockSkin,blockSkinMini={},{}--Redefined in SKIN.change -require("Zframework")--Load Zframework --Load modules +require("Zframework")--Load Zframework blocks= require("parts/mino") AITemplate= require("parts/AITemplate") freeRow= require("parts/freeRow") @@ -132,18 +132,18 @@ if fs.getInfo("settings.dat")then FILE.loadSetting() else -- firstRun=true - if system=="Android"or system=="iOS" then - setting.VKSwitch=true - setting.swap=false - setting.vib=2 - setting.powerInfo=true - setting.fullscreen=true + if SYSTEM=="Android"or SYSTEM=="iOS" then + SETTING.VKSwitch=true + SETTING.swap=false + SETTING.vib=2 + SETTING.powerInfo=true + SETTING.fullscreen=true love.window.setFullscreen(true) 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 SETTING.fullscreen then love.window.setFullscreen(true)end if fs.getInfo("unlock.dat")then FILE.loadUnlock()end if fs.getInfo("data.dat")then FILE.loadData()end @@ -172,12 +172,12 @@ do R.tech_finesse2=R["tech_finesse+"] R["tech_normal+"],R["tech_hard+"],R["tech_lunatic+"],R["tech_finesse+"]=nil end - if not text.modes[stat.lastPlay]then - stat.lastPlay="sprint_10" + if not text.modes[STAT.lastPlay]then + STAT.lastPlay="sprint_10" end --Check setting file - local S=setting + local S=SETTING if type(S.block)~="boolean"or type(S.spawn)~="number"or @@ -191,7 +191,7 @@ do end --Update data file - S=stat + S=STAT if not S.spin[1][6]then for i=1,25 do S.spin[i][6]=0 @@ -210,7 +210,7 @@ do FILE.saveData() FILE.saveSetting() end - if system=="Android"and not setting.fullscreen then + if SYSTEM=="Android"and not SETTING.fullscreen then LOG.print("如果手机上方状态栏不消失,请到设置界面开启全屏",300,color.yellow) LOG.print("Switch fullscreen on if titleBar don't disappear",300,color.yellow) end diff --git a/modes/GM.lua b/modes/GM.lua index d1458dbd..f17d5556 100644 --- a/modes/GM.lua +++ b/modes/GM.lua @@ -36,7 +36,7 @@ return{ slowMark=true, load=function() PLY.newPlayer(1,340,15) - players[1].modeData.event="M7" + PLAYERS[1].modeData.event="M7" end, mesDisp=function(P) mText(drawableText.line,69,370) diff --git a/modes/blind_wtf.lua b/modes/blind_wtf.lua index 7a618d5b..5985f061 100644 --- a/modes/blind_wtf.lua +++ b/modes/blind_wtf.lua @@ -17,17 +17,17 @@ return{ pauseLimit=true, load=function() PLY.newPlayer(1,340,15) - if setting.spawn==0 then + if SETTING.spawn==0 then LOG.print(text.switchSpawnSFX,color.yellow) end end, mesDisp=function(P) - if not game.result then - if game.replaying then + if not GAME.result then + if GAME.replaying then gc.setColor(.3,.3,.3,.7) gc.push("transform") gc.origin() - gc.rectangle("fill",0,0,scr.w,scr.h) + gc.rectangle("fill",0,0,SCR.w,SCR.h) gc.pop() else gc.clear(.26,.26,.26) diff --git a/modes/c4wtrain_lunatic.lua b/modes/c4wtrain_lunatic.lua index 83ad2417..7be567ab 100644 --- a/modes/c4wtrain_lunatic.lua +++ b/modes/c4wtrain_lunatic.lua @@ -28,7 +28,7 @@ return{ pauseLimit=true, load=function() PLY.newPlayer(1,340,15) - local P=players[1] + local P=PLAYERS[1] local F=P.field for i=1,24 do F[i]=freeRow.get(13) diff --git a/modes/c4wtrain_normal.lua b/modes/c4wtrain_normal.lua index 62db20ce..a7c5a87a 100644 --- a/modes/c4wtrain_normal.lua +++ b/modes/c4wtrain_normal.lua @@ -26,7 +26,7 @@ return{ pauseLimit=true, load=function() PLY.newPlayer(1,340,15) - local P=players[1] + local P=PLAYERS[1] local F=P.field for i=1,24 do F[i]=freeRow.get(13) diff --git a/modes/custom_clear.lua b/modes/custom_clear.lua index b3ea5439..7719d7c4 100644 --- a/modes/custom_clear.lua +++ b/modes/custom_clear.lua @@ -9,13 +9,13 @@ return{ for k,v in next,customEnv do modeEnv[k]=v end - if preBag[1]then - modeEnv.bag=preBag + if BAG[1]then + modeEnv.bag=BAG else modeEnv.bag=nil end - if preMission[1]then - modeEnv.mission=preMission + if MISSION[1]then + modeEnv.mission=MISSION else modeEnv.mission=nil end @@ -29,24 +29,24 @@ return{ PLY.newAIPlayer(2,965,360,.5,AITemplate("CC",2*L-11,int(L*.5-1.5),modeEnv.hold,4000*L)) end end - preField.h=20 + FIELD.h=20 repeat for i=1,10 do - if preField[preField.h][i]>0 then + if FIELD[FIELD.h][i]>0 then goto L end end - preField.h=preField.h-1 - until preField.h==0 + FIELD.h=FIELD.h-1 + until FIELD.h==0 ::L:: - for _,P in next,players.alive do + for _,P in next,PLAYERS.alive do local t=P.showTime*3 - for y=1,preField.h do + for y=1,FIELD.h do P.field[y]=freeRow.get(0) P.visTime[y]=freeRow.get(t) - for x=1,10 do P.field[y][x]=preField[y][x]end + for x=1,10 do P.field[y][x]=FIELD[y][x]end end - P.garbageBeneath=preField.h + P.garbageBeneath=FIELD.h end modeEnv.bg=customEnv.bg modeEnv.bgm=customEnv.bgm diff --git a/modes/custom_puzzle.lua b/modes/custom_puzzle.lua index 775a2788..7365bcce 100644 --- a/modes/custom_puzzle.lua +++ b/modes/custom_puzzle.lua @@ -4,7 +4,7 @@ local function puzzleCheck(P) for y=1,20 do local L=P.field[y] for x=1,10 do - local a,b=preField[y][x],L and L[x]or 0 + local a,b=FIELD[y][x],L and L[x]or 0 if a~=0 then if a==-1 then if b>0 then return end elseif a<12 then if a~=b then return end @@ -27,13 +27,13 @@ return{ for k,v in next,customEnv do modeEnv[k]=v end - if preBag[1]then - modeEnv.bag=preBag + if BAG[1]then + modeEnv.bag=BAG else modeEnv.bag=nil end - if preMission[1]then - modeEnv.mission=preMission + if MISSION[1]then + modeEnv.mission=MISSION else modeEnv.mission=nil end @@ -47,15 +47,15 @@ return{ PLY.newAIPlayer(2,965,360,.5,AITemplate("CC",2*L-11,int(L*.5-1.5),modeEnv.hold,4000*L)) end end - preField.h=20 + FIELD.h=20 repeat for i=1,10 do - if preField[preField.h][i]~=0 then + if FIELD[FIELD.h][i]~=0 then goto L end end - preField.h=preField.h-1 - until preField.h==0 + FIELD.h=FIELD.h-1 + until FIELD.h==0 ::L:: modeEnv.bg=customEnv.bg modeEnv.bgm=customEnv.bgm @@ -67,8 +67,8 @@ return{ mText(drawableText.line,69,360) if P.modeData.event==0 then local m=puzzleMark - for y=1,preField.h do for x=1,10 do - local T=preField[y][x] + for y=1,FIELD.h do for x=1,10 do + local T=FIELD[y][x] if T~=0 then gc.draw(m[T],150+30*x-30+dx,70+600-30*y+dy) end diff --git a/modes/dig_10.lua b/modes/dig_10.lua index 15275a22..1ae268d8 100644 --- a/modes/dig_10.lua +++ b/modes/dig_10.lua @@ -13,7 +13,7 @@ return{ }, load=function() PLY.newPlayer(1,340,15) - local P=players[1] + local P=PLAYERS[1] for _=1,10 do P:garbageRise(13,1,P:RND(10)) end diff --git a/modes/dig_100.lua b/modes/dig_100.lua index 550c0948..f752f964 100644 --- a/modes/dig_100.lua +++ b/modes/dig_100.lua @@ -16,7 +16,7 @@ return{ }, load=function() PLY.newPlayer(1,340,15) - local P=players[1] + local P=PLAYERS[1] for _=1,10 do P:garbageRise(13,1,P:RND(10)) end diff --git a/modes/dig_40.lua b/modes/dig_40.lua index e42bbe01..a1661900 100644 --- a/modes/dig_40.lua +++ b/modes/dig_40.lua @@ -16,7 +16,7 @@ return{ }, load=function() PLY.newPlayer(1,340,15) - local P=players[1] + local P=PLAYERS[1] for _=1,10 do P:garbageRise(13,1,P:RND(10)) end diff --git a/modes/dig_400.lua b/modes/dig_400.lua index c0b73d24..36627dba 100644 --- a/modes/dig_400.lua +++ b/modes/dig_400.lua @@ -16,7 +16,7 @@ return{ }, load=function() PLY.newPlayer(1,340,15) - local P=players[1] + local P=PLAYERS[1] for _=1,10 do P:garbageRise(13,1,P:RND(10)) end diff --git a/modes/infinite_dig.lua b/modes/infinite_dig.lua index 384ecd35..52de300d 100644 --- a/modes/infinite_dig.lua +++ b/modes/infinite_dig.lua @@ -37,7 +37,7 @@ return{ }, load=function() PLY.newPlayer(1,340,15) - local P=players[1] + local P=PLAYERS[1] for _=1,8 do P:garbageRise(13,1,P:RND(10)) end diff --git a/modes/pctrain_lunatic.lua b/modes/pctrain_lunatic.lua index 692c397f..d4543744 100644 --- a/modes/pctrain_lunatic.lua +++ b/modes/pctrain_lunatic.lua @@ -63,7 +63,7 @@ return{ pauseLimit=true, load=function() PLY.newPlayer(1,340,15) - newPC(players[1]) + newPC(PLAYERS[1]) end, mesDisp=function(P) setFont(75) diff --git a/modes/pctrain_normal.lua b/modes/pctrain_normal.lua index 8aed57c5..a358f55f 100644 --- a/modes/pctrain_normal.lua +++ b/modes/pctrain_normal.lua @@ -54,7 +54,7 @@ return{ pauseLimit=true, load=function() PLY.newPlayer(1,340,15) - newPC(players[1]) + newPC(PLAYERS[1]) end, mesDisp=function(P) setFont(75) diff --git a/modes/round_1.lua b/modes/round_1.lua index 01028fe4..bc85a69d 100644 --- a/modes/round_1.lua +++ b/modes/round_1.lua @@ -1,12 +1,12 @@ local function update_round(P) - if #players.alive>1 then + if #PLAYERS.alive>1 then P.control=false local ID=P.id repeat ID=ID+1 - if not players[ID]then ID=1 end - until players[ID].alive or ID==P.id - players[ID].control=true + if not PLAYERS[ID]then ID=1 end + until PLAYERS[ID].alive or ID==P.id + PLAYERS[ID].control=true end end @@ -21,7 +21,7 @@ return{ load=function() PLY.newPlayer(1,340,15) PLY.newAIPlayer(2,965,360,.5,AITemplate("CC",10,1,true,10000)) - game.garbageSpeed=1e99 + GAME.garbageSpeed=1e99 end, score=function(P)return{P.stat.piece,P.stat.time}end, scoreDisp=function(D)return D[1].." Pieces "..toTime(D[2])end, diff --git a/modes/round_2.lua b/modes/round_2.lua index dc0d0e84..3f071e66 100644 --- a/modes/round_2.lua +++ b/modes/round_2.lua @@ -1,12 +1,12 @@ local function update_round(P) - if #players.alive>1 then + if #PLAYERS.alive>1 then P.control=false local ID=P.id repeat ID=ID+1 - if not players[ID]then ID=1 end - until players[ID].alive or ID==P.id - players[ID].control=true + if not PLAYERS[ID]then ID=1 end + until PLAYERS[ID].alive or ID==P.id + PLAYERS[ID].control=true end end @@ -21,7 +21,7 @@ return{ load=function() PLY.newPlayer(1,340,15) PLY.newAIPlayer(2,965,360,.5,AITemplate("CC",10,1,true,13000)) - game.garbageSpeed=1e99 + GAME.garbageSpeed=1e99 end, score=function(P)return{P.stat.piece,P.stat.time}end, scoreDisp=function(D)return D[1].." Pieces "..toTime(D[2])end, diff --git a/modes/round_3.lua b/modes/round_3.lua index 2edce57d..6a60842a 100644 --- a/modes/round_3.lua +++ b/modes/round_3.lua @@ -1,12 +1,12 @@ local function update_round(P) - if #players.alive>1 then + if #PLAYERS.alive>1 then P.control=false local ID=P.id repeat ID=ID+1 - if not players[ID]then ID=1 end - until players[ID].alive or ID==P.id - players[ID].control=true + if not PLAYERS[ID]then ID=1 end + until PLAYERS[ID].alive or ID==P.id + PLAYERS[ID].control=true end end @@ -21,7 +21,7 @@ return{ load=function() PLY.newPlayer(1,340,15) PLY.newAIPlayer(2,965,360,.5,AITemplate("CC",10,2,true,16000)) - game.garbageSpeed=1e99 + GAME.garbageSpeed=1e99 end, score=function(P)return{P.stat.piece,P.stat.time}end, scoreDisp=function(D)return D[1].." Pieces "..toTime(D[2])end, diff --git a/modes/round_4.lua b/modes/round_4.lua index 2365a903..4bbc3094 100644 --- a/modes/round_4.lua +++ b/modes/round_4.lua @@ -1,12 +1,12 @@ local function update_round(P) - if #players.alive>1 then + if #PLAYERS.alive>1 then P.control=false local ID=P.id repeat ID=ID+1 - if not players[ID]then ID=1 end - until players[ID].alive or ID==P.id - players[ID].control=true + if not PLAYERS[ID]then ID=1 end + until PLAYERS[ID].alive or ID==P.id + PLAYERS[ID].control=true end end @@ -21,7 +21,7 @@ return{ load=function() PLY.newPlayer(1,340,15) PLY.newAIPlayer(2,965,360,.5,AITemplate("CC",10,3,true,26000)) - game.garbageSpeed=1e99 + GAME.garbageSpeed=1e99 end, score=function(P)return{P.stat.piece,P.stat.time}end, scoreDisp=function(D)return D[1].." Pieces "..toTime(D[2])end, diff --git a/modes/round_5.lua b/modes/round_5.lua index e7595895..efd80962 100644 --- a/modes/round_5.lua +++ b/modes/round_5.lua @@ -1,12 +1,12 @@ local function update_round(P) - if #players.alive>1 then + if #PLAYERS.alive>1 then P.control=false local ID=P.id repeat ID=ID+1 - if not players[ID]then ID=1 end - until players[ID].alive or ID==P.id - players[ID].control=true + if not PLAYERS[ID]then ID=1 end + until PLAYERS[ID].alive or ID==P.id + PLAYERS[ID].control=true end end @@ -21,7 +21,7 @@ return{ load=function() PLY.newPlayer(1,340,15) PLY.newAIPlayer(2,965,360,.5,AITemplate("CC",10,3,true,40000)) - game.garbageSpeed=1e99 + GAME.garbageSpeed=1e99 end, score=function(P)return{P.stat.piece,P.stat.time}end, scoreDisp=function(D)return D[1].." Pieces "..toTime(D[2])end, diff --git a/modes/techmino49_easy.lua b/modes/techmino49_easy.lua index 5c126215..3e327914 100644 --- a/modes/techmino49_easy.lua +++ b/modes/techmino49_easy.lua @@ -2,7 +2,7 @@ local gc=love.graphics local int,rnd=math.floor,math.random local powerUp={[0]="000%UP","025%UP","050%UP","075%UP","100%UP",} local function selectTarget(P) - if setting.swap then + if SETTING.swap then for i=1,#P.keyPressing do if P.keyPressing[i]then P.keyPressing[i]=false @@ -58,7 +58,7 @@ return{ end, mesDisp=function(P) setFont(35) - mStr(#players.alive.."/49",69,245) + mStr(#PLAYERS.alive.."/49",69,245) mStr(P.modeData.point,80,285) gc.draw(drawableText.ko,23,295) setFont(20) diff --git a/modes/techmino49_hard.lua b/modes/techmino49_hard.lua index 4069dab0..db70c343 100644 --- a/modes/techmino49_hard.lua +++ b/modes/techmino49_hard.lua @@ -2,7 +2,7 @@ local gc=love.graphics local int,rnd=math.floor,math.random local powerUp={[0]="000%UP","025%UP","050%UP","075%UP","100%UP",} local function selectTarget(P) - if setting.swap then + if SETTING.swap then for i=1,#P.keyPressing do if P.keyPressing[i]then P.keyPressing[i]=false @@ -58,7 +58,7 @@ return{ end, mesDisp=function(P) setFont(35) - mStr(#players.alive.."/49",69,245) + mStr(#PLAYERS.alive.."/49",69,245) mStr(P.modeData.point,80,285) gc.draw(drawableText.ko,23,295) setFont(20) diff --git a/modes/techmino49_ultimate.lua b/modes/techmino49_ultimate.lua index 69f64197..6ade5e5b 100644 --- a/modes/techmino49_ultimate.lua +++ b/modes/techmino49_ultimate.lua @@ -2,7 +2,7 @@ local gc=love.graphics local int,rnd=math.floor,math.random local powerUp={[0]="000%UP","025%UP","050%UP","075%UP","100%UP",} local function selectTarget(P) - if setting.swap then + if SETTING.swap then for i=1,#P.keyPressing do if P.keyPressing[i]then P.keyPressing[i]=false @@ -58,7 +58,7 @@ return{ end, mesDisp=function(P) setFont(35) - mStr(#players.alive.."/49",69,245) + mStr(#PLAYERS.alive.."/49",69,245) mStr(P.modeData.point,80,285) gc.draw(drawableText.ko,23,295) setFont(20) diff --git a/modes/techmino99_easy.lua b/modes/techmino99_easy.lua index 475bc22a..d9254268 100644 --- a/modes/techmino99_easy.lua +++ b/modes/techmino99_easy.lua @@ -2,7 +2,7 @@ local gc=love.graphics local int,rnd=math.floor,math.random local powerUp={[0]="000%UP","025%UP","050%UP","075%UP","100%UP",} local function selectTarget(P) - if setting.swap then + if SETTING.swap then for i=1,#P.keyPressing do if P.keyPressing[i]then P.keyPressing[i]=false @@ -58,7 +58,7 @@ return{ end, mesDisp=function(P) setFont(35) - mStr(#players.alive.."/99",69,245) + mStr(#PLAYERS.alive.."/99",69,245) mStr(P.modeData.point,80,285) gc.draw(drawableText.ko,23,295) setFont(20) diff --git a/modes/techmino99_hard.lua b/modes/techmino99_hard.lua index 4286273d..2e282f94 100644 --- a/modes/techmino99_hard.lua +++ b/modes/techmino99_hard.lua @@ -2,7 +2,7 @@ local gc=love.graphics local int,rnd=math.floor,math.random local powerUp={[0]="000%UP","025%UP","050%UP","075%UP","100%UP",} local function selectTarget(P) - if setting.swap then + if SETTING.swap then for i=1,#P.keyPressing do if P.keyPressing[i]then P.keyPressing[i]=false @@ -58,7 +58,7 @@ return{ end, mesDisp=function(P) setFont(35) - mStr(#players.alive.."/99",69,245) + mStr(#PLAYERS.alive.."/99",69,245) mStr(P.modeData.point,80,285) gc.draw(drawableText.ko,23,295) setFont(20) diff --git a/modes/techmino99_ultimate.lua b/modes/techmino99_ultimate.lua index ff689ca1..bdbe0d34 100644 --- a/modes/techmino99_ultimate.lua +++ b/modes/techmino99_ultimate.lua @@ -2,7 +2,7 @@ local gc=love.graphics local int,rnd=math.floor,math.random local powerUp={[0]="000%UP","025%UP","050%UP","075%UP","100%UP",} local function selectTarget(P) - if setting.swap then + if SETTING.swap then for i=1,#P.keyPressing do if P.keyPressing[i]then P.keyPressing[i]=false @@ -58,7 +58,7 @@ return{ end, mesDisp=function(P) setFont(35) - mStr(#players.alive.."/99",69,245) + mStr(#PLAYERS.alive.."/99",69,245) mStr(P.modeData.point,80,285) gc.draw(drawableText.ko,23,295) setFont(20) diff --git a/parts/default_data.lua b/parts/default_data.lua index 39abbf0d..413243c4 100644 --- a/parts/default_data.lua +++ b/parts/default_data.lua @@ -1,4 +1,4 @@ -setting={ +SETTING={ --Game das=10,arr=2, sddas=0,sdarr=2, @@ -57,10 +57,10 @@ setting={ VKAlpha=.3, } for i=1,25 do - setting.face[i]=0 + SETTING.face[i]=0 end -stat={ +STAT={ version=gameVersion, run=0,game=0,time=0, key=0,rotate=0,hold=0, @@ -73,8 +73,8 @@ stat={ lastPlay="sprint_10",--Last played mode ID } for i=1,25 do - stat.clear[i]={0,0,0,0,0} - stat.spin[i]={0,0,0,0,0,0} + STAT.clear[i]={0,0,0,0,0} + STAT.spin[i]={0,0,0,0,0,0} end keyMap={ diff --git a/parts/gametoolfunc.lua b/parts/gametoolfunc.lua index 902058ff..d6ab4d6f 100644 --- a/parts/gametoolfunc.lua +++ b/parts/gametoolfunc.lua @@ -17,17 +17,17 @@ local default_setting={ local function copyGameSetting() local S={face={}} for _,v in next,default_setting do - S[v]=setting[v] + S[v]=SETTING[v] end for i=1,25 do - S.face[i]=setting.face[i] + S.face[i]=SETTING.face[i] end return S end function destroyPlayers() - for i=#players,1,-1 do - local P=players[i] + for i=#PLAYERS,1,-1 do + local P=PLAYERS[i] if P.canvas then P.canvas:release()end while P.field[1]do freeRow.discard(rem(P.field)) @@ -39,10 +39,10 @@ function destroyPlayers() CC.destroy(P.AI_bot) P.AI_mode=nil end - players[i]=nil + PLAYERS[i]=nil end - for i=#players.alive,1,-1 do - players.alive[i]=nil + for i=#PLAYERS.alive,1,-1 do + PLAYERS.alive[i]=nil end collectgarbage() end @@ -89,13 +89,13 @@ end Example: "abcdefg" is [SZJLTOI], "a^aDb)" is [Z*63,Z*37,S*10] ]] function copySequence() - local preBag=preBag + local BAG=BAG local str="" local count=1 - for i=1,#preBag+1 do - if preBag[i+1]~=preBag[i]or count==64 then - str=str..char(96+preBag[i]) + for i=1,#BAG+1 do + if BAG[i+1]~=BAG[i]or count==64 then + str=str..char(96+BAG[i]) if count>1 then str=str..char(32+count) count=1 @@ -136,7 +136,7 @@ function pasteSequence(str) ins(bag,reg) end - preBag=bag + BAG=bag sceneTemp.cur=#bag return true end @@ -147,7 +147,7 @@ function copyBoard() for y=20,1,-1 do for x=1,10 do - if preField[y][x]~=0 then + if FIELD[y][x]~=0 then H=y goto topFound end @@ -158,7 +158,7 @@ function copyBoard() --Encode field for y=1,H do local S="" - local L=preField[y] + local L=FIELD[y] for x=1,10 do S=S..char(L[x]+1) end @@ -193,7 +193,7 @@ function pasteBoard(str) if __>17 then return end--Illegal blockid _=int(_/32)--Mode id - preField[fY][fX]=__ + FIELD[fY][fX]=__ if fX<10 then fX=fX+1 else @@ -206,7 +206,7 @@ function pasteBoard(str) for y=fY,20 do for x=1,10 do - preField[y][x]=0 + FIELD[y][x]=0 end end @@ -231,13 +231,13 @@ end ]] function copyMission() local _ - local preMission=preMission + local MISSION=MISSION local str="" local count=1 - for i=1,#preMission+1 do - if preMission[i+1]~=preMission[i]or count==13 then - _=33+preMission[i] + for i=1,#MISSION+1 do + if MISSION[i+1]~=MISSION[i]or count==13 then + _=33+MISSION[i] str=str..char(_) if count>1 then str=str..char(113+count) @@ -282,7 +282,7 @@ function pasteMission(str) ins(mission,reg) end - preMission=mission + MISSION=mission sceneTemp.cur=#mission return true end @@ -302,84 +302,84 @@ function mergeStat(stat,delta) end function randomTarget(P)--Return a random opponent for P - if #players.alive>1 then + if #PLAYERS.alive>1 then local R repeat - R=players.alive[rnd(#players.alive)] + R=PLAYERS.alive[rnd(#PLAYERS.alive)] until R~=P return R end end function freshMostDangerous() - game.mostDangerous,game.secDangerous=nil + GAME.mostDangerous,GAME.secDangerous=nil local m,m2=0,0 - for i=1,#players.alive do - local h=#players.alive[i].field + for i=1,#PLAYERS.alive do + local h=#PLAYERS.alive[i].field if h>=m then - game.mostDangerous,game.secDangerous=players.alive[i],game.mostDangerous + GAME.mostDangerous,GAME.secDangerous=PLAYERS.alive[i],GAME.mostDangerous m,m2=h,m elseif h>=m2 then - game.secDangerous=players.alive[i] + GAME.secDangerous=PLAYERS.alive[i] m2=h end end - for i=1,#players.alive do - if players.alive[i].atkMode==3 then - players.alive[i]:freshTarget() + for i=1,#PLAYERS.alive do + if PLAYERS.alive[i].atkMode==3 then + PLAYERS.alive[i]:freshTarget() end end end function freshMostBadge() - game.mostBadge,game.secBadge=nil + GAME.mostBadge,GAME.secBadge=nil local m,m2=0,0 - for i=1,#players.alive do - local P=players.alive[i] + for i=1,#PLAYERS.alive do + local P=PLAYERS.alive[i] local b=P.badge if b>=m then - game.mostBadge,game.secBadge=P,game.mostBadge + GAME.mostBadge,GAME.secBadge=P,GAME.mostBadge m,m2=b,m elseif b>=m2 then - game.secBadge=P + GAME.secBadge=P m2=b end end - for i=1,#players.alive do - if players.alive[i].atkMode==4 then - players.alive[i]:freshTarget() + for i=1,#PLAYERS.alive do + if PLAYERS.alive[i].atkMode==4 then + PLAYERS.alive[i]:freshTarget() end end end function royaleLevelup() - game.stage=game.stage+1 + GAME.stage=GAME.stage+1 local spd - TEXT.show(text.royale_remain(#players.alive),640,200,40,"beat",.3) - if game.stage==2 then + TEXT.show(text.royale_remain(#PLAYERS.alive),640,200,40,"beat",.3) + if GAME.stage==2 then spd=30 - elseif game.stage==3 then + elseif GAME.stage==3 then spd=15 - game.garbageSpeed=.6 - if players[1].alive then BGM.play("cruelty")end - elseif game.stage==4 then + GAME.garbageSpeed=.6 + if PLAYERS[1].alive then BGM.play("cruelty")end + elseif GAME.stage==4 then spd=10 - local _=players.alive + local _=PLAYERS.alive for i=1,#_ do _[i].gameEnv.pushSpeed=3 end - elseif game.stage==5 then + elseif GAME.stage==5 then spd=5 - game.garbageSpeed=1 - elseif game.stage==6 then + GAME.garbageSpeed=1 + elseif GAME.stage==6 then spd=3 - if players[1].alive then BGM.play("final")end + if PLAYERS[1].alive then BGM.play("final")end end - for i=1,#players.alive do - players.alive[i].gameEnv.drop=spd + for i=1,#PLAYERS.alive do + PLAYERS.alive[i].gameEnv.drop=spd end - if curMode.lv==3 then - for i=1,#players.alive do - local P=players.alive[i] + if CURMODE.lv==3 then + for i=1,#PLAYERS.alive do + local P=PLAYERS.alive[i] P.gameEnv.drop=int(P.gameEnv.drop*.3) if P.gameEnv.drop==0 then P.curY=P.imgY @@ -393,15 +393,15 @@ end function pauseGame() if not SCN.swapping then restartCount=0--Avoid strange darkness - if not game.result then - game.pauseCount=game.pauseCount+1 + if not GAME.result then + GAME.pauseCount=GAME.pauseCount+1 end - if not game.replaying then - for i=1,#players do - local l=players[i].keyPressing + if not GAME.replaying then + for i=1,#PLAYERS do + local l=PLAYERS[i].keyPressing for j=1,#l do if l[j]then - players[i]:releaseKey(j) + PLAYERS[i]:releaseKey(j) end end end @@ -413,9 +413,8 @@ function resumeGame() SCN.swapTo("play","none") end function loadGame(M,ifQuickPlay) - stat.lastPlay=M - curMode=Modes[M] - local lang=setting.lang + STAT.lastPlay=M + CURMODE=Modes[M] drawableText.modeName:set(text.modes[M][1]) drawableText.levelName:set(text.modes[M][2]) needResetGameData=true @@ -423,31 +422,31 @@ function loadGame(M,ifQuickPlay) SFX.play("enter") end function resetGameData() - if players[1]and not game.replaying then - mergeStat(stat,players[1].stat) + if PLAYERS[1]and not GAME.replaying then + mergeStat(STAT,PLAYERS[1].stat) end - game.frame=150-setting.reTime*15 - game.result=false - game.pauseTime=0 - game.pauseCount=0 - game.garbageSpeed=1 - game.warnLVL0=0 - game.warnLVL=0 - game.recording=true - game.replaying=false - game.setting=copyGameSetting() - game.rec={} + GAME.frame=150-SETTING.reTime*15 + GAME.result=false + GAME.pauseTime=0 + GAME.pauseCount=0 + GAME.garbageSpeed=1 + GAME.warnLVL0=0 + GAME.warnLVL=0 + GAME.recording=true + GAME.replaying=false + GAME.setting=copyGameSetting() + GAME.rec={} math.randomseed(tm.getTime()) - game.seed=rnd(261046101471026) + GAME.seed=rnd(261046101471026) destroyPlayers() - modeEnv=curMode.env + modeEnv=CURMODE.env restoreVirtualKey() - curMode.load() + CURMODE.load() if modeEnv.task then - for i=1,#players do - players[i]:newTask(modeEnv.task) + for i=1,#PLAYERS do + PLAYERS[i]:newTask(modeEnv.task) end end BG.set(modeEnv.bg) @@ -455,55 +454,55 @@ function resetGameData() TEXT.clear() if modeEnv.royaleMode then - for i=1,#players do - players[i]:changeAtk(randomTarget(players[i])) + for i=1,#PLAYERS do + PLAYERS[i]:changeAtk(randomTarget(PLAYERS[i])) end - game.stage=nil - game.mostBadge=nil - game.secBadge=nil - game.mostDangerous=nil - game.secDangerous=nil - game.stage=1 - game.garbageSpeed=.3 + GAME.stage=nil + GAME.mostBadge=nil + GAME.secBadge=nil + GAME.mostDangerous=nil + GAME.secDangerous=nil + GAME.stage=1 + GAME.garbageSpeed=.3 end - stat.game=stat.game+1 - freeRow.reset(30*#players) + STAT.game=STAT.game+1 + freeRow.reset(30*#PLAYERS) SFX.play("ready") collectgarbage() end function resetPartGameData(replaying) TASK.removeTask_code(TICK.autoPause) - if players[1]and not game.replaying then - mergeStat(stat,players[1].stat) + if PLAYERS[1]and not GAME.replaying then + mergeStat(STAT,PLAYERS[1].stat) end - game.result=false - game.garbageSpeed=1 - game.warnLVL0=0 - game.warnLVL=0 + GAME.result=false + GAME.garbageSpeed=1 + GAME.warnLVL0=0 + GAME.warnLVL=0 if replaying then - game.frame=0 - game.recording=false - game.replaying=1 + GAME.frame=0 + GAME.recording=false + GAME.replaying=1 else - game.frame=150-setting.reTime*15 - game.pauseTime=0 - game.pauseCount=0 - game.recording=true - game.replaying=false - game.setting=copyGameSetting() - game.rec={} + GAME.frame=150-SETTING.reTime*15 + GAME.pauseTime=0 + GAME.pauseCount=0 + GAME.recording=true + GAME.replaying=false + GAME.setting=copyGameSetting() + GAME.rec={} math.randomseed(tm.getTime()) - game.seed=rnd(1046101471,2662622626) + GAME.seed=rnd(1046101471,2662622626) end destroyPlayers() - modeEnv=curMode.env + modeEnv=CURMODE.env restoreVirtualKey() - curMode.load() + CURMODE.load() if modeEnv.task then - for i=1,#players do - players[i]:newTask(modeEnv.task) + for i=1,#PLAYERS do + PLAYERS[i]:newTask(modeEnv.task) end end BG.set(modeEnv.bg) @@ -511,23 +510,23 @@ function resetPartGameData(replaying) TEXT.clear() if modeEnv.royaleMode then - for i=1,#players do - players[i]:changeAtk(randomTarget(players[i])) + for i=1,#PLAYERS do + PLAYERS[i]:changeAtk(randomTarget(PLAYERS[i])) end - game.stage=nil - game.mostBadge=nil - game.secBadge=nil - game.mostDangerous=nil - game.secDangerous=nil - game.stage=1 - game.garbageSpeed=.3 + GAME.stage=nil + GAME.mostBadge=nil + GAME.secBadge=nil + GAME.mostDangerous=nil + GAME.secDangerous=nil + GAME.stage=1 + GAME.garbageSpeed=.3 end collectgarbage() end function gameStart() SFX.play("start") - for P=1,#players do - P=players[P] + for P=1,#PLAYERS do + P=PLAYERS[P] P.control=true P.timing=true P:popNext() diff --git a/parts/getTip.lua b/parts/getTip.lua index f9984300..66f2505a 100644 --- a/parts/getTip.lua +++ b/parts/getTip.lua @@ -1,5 +1,5 @@ local L -if setting.lang==1 or setting.lang==2 then +if SETTING.lang==1 or SETTING.lang==2 then L={ '注意到"旋转"到底对方块做了些什么吗?', "(RUR'U')R'FR2U'R'U'(RUR'F')", @@ -159,7 +159,7 @@ if setting.lang==1 or setting.lang==2 then "ZS JL T O I", -- "Z酱 可爱!", } -elseif setting.lang==3 then +elseif SETTING.lang==3 then L={ 'Free block game with Battle Royale mode!', 'Have you noticed what "rotating" does do to the block?', @@ -228,14 +228,14 @@ elseif setting.lang==3 then "You can set orientation for each block", "ZS JL T O I", } -elseif setting.lang==4 then +elseif SETTING.lang==4 then L={'!','@','#','$','%','^','&','*','(',')','-','=','_','+','[',']','{','}','\\','|',';',':','\'','"',',','<','.','>','/','?'} local s="" for i=1,math.random(16,26)do s=s..L[math.random(#L)] end return s -elseif setting.lang==5 then +elseif SETTING.lang==5 then local R=math.random() if R<.05 then local time={ @@ -268,14 +268,14 @@ elseif setting.lang==5 then elseif R<.1 then local int=math.floor L={ - "平均"..int(stat.row/stat.time*60).."LPM,那可真强呢", - "平均"..int(stat.atk/stat.time*60).."APM,好厉害哦", - "平均"..(int(stat.atk/stat.row*10)*.1).."效,你看这数据能看么", - "平均"..(int(stat.atk/stat.row*10)*.1).."效,我就不说你多菜了", - "才玩了"..stat.game.."把,跟几十万局的没法比", - "才玩了"..stat.game.."把,玩了不下几万局的人可不在少数", - "才玩了"..int(stat.time/3600).."小时,人家总时长是你不知道多少倍", - "才玩了"..int(stat.time/3600).."小时,别人总时长跟你都不在一个数量级", + "平均"..int(STAT.row/STAT.time*60).."LPM,那可真强呢", + "平均"..int(STAT.atk/STAT.time*60).."APM,好厉害哦", + "平均"..(int(STAT.atk/STAT.row*10)*.1).."效,你看这数据能看么", + "平均"..(int(STAT.atk/STAT.row*10)*.1).."效,我就不说你多菜了", + "才玩了"..STAT.game.."把,跟几十万局的没法比", + "才玩了"..STAT.game.."把,玩了不下几万局的人可不在少数", + "才玩了"..int(STAT.time/3600).."小时,人家总时长是你不知道多少倍", + "才玩了"..int(STAT.time/3600).."小时,别人总时长跟你都不在一个数量级", } else L={ diff --git a/parts/player.lua b/parts/player.lua index d312dd1d..bc42fad7 100644 --- a/parts/player.lua +++ b/parts/player.lua @@ -5,7 +5,7 @@ local int,ceil,rnd=math.floor,math.ceil,math.random local max,min,abs,sin,cos,log=math.max,math.min,math.abs,math.sin,math.cos,math.log local ins,rem=table.insert,table.remove local format=string.format -local scr=scr +local SCR=SCR local setFont=setFont ---------------------------------------------------- @@ -74,7 +74,7 @@ local function updateLine(P,dt)--Attacks, line pushing, cam moving A.time=A.time+1 if not A.sent then if A.countdown>0 then - A.countdown=max(A.countdown-game.garbageSpeed,0) + A.countdown=max(A.countdown-GAME.garbageSpeed,0) end else if A.time>20 then @@ -167,7 +167,7 @@ end local function Pupdate_alive(P,dt) if P.timing then P.stat.time=P.stat.time+dt end if P.keyRec then--Update speeds - local _=game.frame + local _=GAME.frame local v=0 for i=2,10 do v=v+i*(i-1)*7.2/(_-P.keyTime[i]+1)end @@ -428,7 +428,7 @@ end local function drawField(P) local V,F=P.visTime,P.field local start=int((P.fieldBeneath+P.fieldUp)/30+1) - local rep=game.replaying + local rep=GAME.replaying if P.falling==-1 then--Blocks only for j=start,min(start+21,#F)do for i=1,10 do @@ -608,7 +608,7 @@ local Pdraw_norm do --In-field things gc.push("transform") gc.translate(0,600+FBN+FUP) - gc.setScissor(scr.x+(P.absFieldX+P.fieldOff.x)*scr.k,scr.y+(P.absFieldY+P.fieldOff.y)*scr.k,300*P.size*scr.k,610*P.size*scr.k) + gc.setScissor(SCR.x+(P.absFieldX+P.fieldOff.x)*SCR.k,SCR.y+(P.absFieldY+P.fieldOff.y)*SCR.k,300*P.size*SCR.k,610*P.size*SCR.k) --Draw dangerous area gc.setColor(1,0,0,.3) @@ -848,8 +848,8 @@ local Pdraw_norm do --Other messages gc.setColor(1,1,1) - if curMode.mesDisp then - curMode.mesDisp(P) + if CURMODE.mesDisp then + CURMODE.mesDisp(P) end --Missions @@ -882,8 +882,8 @@ local Pdraw_norm do --Draw starting counter gc.setColor(1,1,1) - if game.frame<180 then - local count=179-game.frame + if GAME.frame<180 then + local count=179-GAME.frame gc.push("transform") gc.translate(305,290) setFont(95) @@ -1092,7 +1092,7 @@ local function pressKey(P,i) P.act[i](P) if P.control then if P.keyRec then - ins(P.keyTime,1,game.frame) + ins(P.keyTime,1,GAME.frame) P.keyTime[11]=nil end end @@ -1104,15 +1104,15 @@ local function releaseKey(P,i) end local function pressKey_Rec(P,i) if P.keyAvailable[i]then - if game.recording then - ins(game.rec,game.frame+1) - ins(game.rec,i) + if GAME.recording then + ins(GAME.rec,GAME.frame+1) + ins(GAME.rec,i) end P.keyPressing[i]=true P.act[i](P) if P.control then if P.keyRec then - ins(P.keyTime,1,game.frame) + ins(P.keyTime,1,GAME.frame) P.keyTime[11]=nil end end @@ -1120,9 +1120,9 @@ local function pressKey_Rec(P,i) end end local function releaseKey_Rec(P,i) - if game.recording then - ins(game.rec,game.frame+1) - ins(game.rec,-i) + if GAME.recording then + ins(GAME.rec,GAME.frame+1) + ins(GAME.rec,-i) end P.keyPressing[i]=false end @@ -1135,11 +1135,11 @@ local function loadGameEnv(P)--Load gameEnv if modeEnv[k]~=nil then v=modeEnv[k] --Mode setting -- DBP("mode-"..k..":"..tostring(v)) - elseif game.setting[k]~=nil then - v=game.setting[k] --Game setting + elseif GAME.setting[k]~=nil then + v=GAME.setting[k] --Game setting -- DBP("game-"..k..":"..tostring(v)) - elseif setting[k]~=nil then - v=setting[k] --Global setting + elseif SETTING[k]~=nil then + v=SETTING[k] --Global setting -- DBP("global-"..k..":"..tostring(v)) -- else -- DBP("default-"..k..":"..tostring(v)) @@ -1189,7 +1189,7 @@ local function applyGameEnv(P)--Finish gameEnv processing ENV.das=max(ENV.das,ENV.mindas) ENV.arr=max(ENV.arr,ENV.minarr) ENV.sdarr=max(ENV.sdarr,ENV.minsdarr) - ENV.next=min(ENV.next,setting.maxNext) + ENV.next=min(ENV.next,SETTING.maxNext) if ENV.sequence~="bag"and ENV.sequence~="loop"then ENV.bagLine=false @@ -1355,12 +1355,12 @@ local function loadAI(P,AIdata)--Load AI params end local function newEmptyPlayer(id,x,y,size) local P={id=id} - players[id]=P - players.alive[id]=P + PLAYERS[id]=P + PLAYERS.alive[id]=P --Inherit functions of player class for k,v in next,player do P[k]=v end - if P.id==1 and game.recording then + if P.id==1 and GAME.recording then P.pressKey=pressKey_Rec P.releaseKey=releaseKey_Rec else @@ -1387,7 +1387,7 @@ local function newEmptyPlayer(id,x,y,size) P.draw=Pdraw_norm P.bonus={}--Text objects end - P.randGen=mt.newRandomGenerator(game.seed) + P.randGen=mt.newRandomGenerator(GAME.seed) P.small=false P.alive=true @@ -1581,7 +1581,7 @@ function player.createBeam(P,R,send,time,target,color,clear,combo) radius=radius*.4 a=.35 end - sysFX.newAttack(x1,y1,x2,y2,radius*(setting.atkFX+3)*.12,corner,type==1 and"fill"or"line",r,g,b,a*(setting.atkFX+5)*.1) + sysFX.newAttack(x1,y1,x2,y2,radius*(SETTING.atkFX+3)*.12,corner,type==1 and"fill"or"line",r,g,b,a*(SETTING.atkFX+5)*.1) end function player.newTask(P,code,data) local L=P.tasks @@ -1621,7 +1621,7 @@ function player.ckfull(P,i) return true end function player.attack(P,R,send,time,...) - if setting.atkFX>0 then + if SETTING.atkFX>0 then P:createBeam(R,send,time,...) end R.lastRecv=P @@ -1730,9 +1730,9 @@ function player.freshTarget(P) P:changeAtk(randomTarget(P)) end elseif P.atkMode==2 then - P:changeAtk(P~=game.mostBadge and game.mostBadge or game.secBadge or randomTarget(P)) + P:changeAtk(P~=GAME.mostBadge and GAME.mostBadge or GAME.secBadge or randomTarget(P)) elseif P.atkMode==3 then - P:changeAtk(P~=game.mostDangerous and game.mostDangerous or game.secDangerous or randomTarget(P)) + P:changeAtk(P~=GAME.mostDangerous and GAME.mostDangerous or GAME.secDangerous or randomTarget(P)) elseif P.atkMode==4 then for i=1,#P.atker do if not P.atker[i].alive then @@ -1754,7 +1754,7 @@ function player.changeAtkMode(P,m) end end function player.changeAtk(P,R) - -- if not P.human then R=players[1]end--1vALL mode? + -- if not P.human then R=PLAYERS[1]end--1vALL mode? if P.atking then local K=P.atking.atker for i=1,#K do @@ -1905,7 +1905,7 @@ function player.resetBlock(P) --Spawn SFX if P.sound and id<8 then - SFX.fplay(spawnSFX_name[id],setting.spawn) + SFX.fplay(spawnSFX_name[id],SETTING.spawn) end end @@ -2133,7 +2133,7 @@ do--player.drop(P)--Place piece function player.drop(P) local _ local CHN=VOC.getFreeChannel() - P.dropTime[11]=ins(P.dropTime,1,game.frame)--Update speed dial + P.dropTime[11]=ins(P.dropTime,1,GAME.frame)--Update speed dial local ENV=P.gameEnv local STAT=P.stat P.waiting=ENV.wait @@ -2491,7 +2491,7 @@ do--player.drop(P)--Place piece P:freshTarget() T=P.atking end - elseif #players.alive>1 then + elseif #PLAYERS.alive>1 then T=randomTarget(P) end if T then @@ -2622,12 +2622,12 @@ end ---------------------------------------------------- local function gameOver()--Save record - if game.replaying then return end + if GAME.replaying then return end FILE.saveData() - local M=curMode + local M=CURMODE local R=M.getRank if R then - local P=players[1] + local P=PLAYERS[1] R=R(P)--New rank if R then local r=modeRanks[M.name]--Old rank @@ -2700,14 +2700,14 @@ function player.win(P,result) P:changeAtk() end if P.human then - game.result=result or"win" + GAME.result=result or"win" SFX.play("win") VOC.play("win") if modeEnv.royaleMode then BGM.play("8-bit happiness") end end - if curMode.id=="custom_puzzle"then + if CURMODE.id=="custom_puzzle"then P:showTextF(text.win,0,0,90,"beat",.4) else P:showTextF(text.win,0,0,90,"beat",.5,.2) @@ -2761,16 +2761,16 @@ function player.lose(P) return end P:die() - for i=1,#players.alive do - if players.alive[i]==P then - rem(players.alive,i) + for i=1,#PLAYERS.alive do + if PLAYERS.alive[i]==P then + rem(PLAYERS.alive,i) break end end P.result="K.O." if modeEnv.royaleMode then P:changeAtk() - P.modeData.event=#players.alive+1 + P.modeData.event=#PLAYERS.alive+1 P.strength=0 if P.lastRecv then local A,i=P,0 @@ -2799,7 +2799,7 @@ function player.lose(P) freshMostBadge() freshMostDangerous() - if #players.alive==royaleData.stage[game.stage]then + if #PLAYERS.alive==royaleData.stage[GAME.stage]then royaleLevelup() end P:showTextF(P.modeData.event,0,120,60,"appear",.26,.9) @@ -2807,7 +2807,7 @@ function player.lose(P) P.gameEnv.keepVisible=P.gameEnv.visible~="show" P:showTextF(text.gameover,0,0,60,"appear",.26,.9) if P.human then - game.result="gameover" + GAME.result="gameover" SFX.play("fail") VOC.play("lose") if modeEnv.royaleMode then @@ -2818,7 +2818,7 @@ function player.lose(P) end end gameOver() - P:newTask(#players>1 and TICK.lose or TICK.finish) + P:newTask(#PLAYERS>1 and TICK.lose or TICK.finish) TASK.new(TICK.autoPause,{0}) if MARKING then P:showTextF(text.marking,0,-226,25,"appear",.4,.0626) @@ -2826,8 +2826,8 @@ function player.lose(P) else P:newTask(TICK.lose) end - if #players.alive==1 then - players.alive[1]:win() + if #PLAYERS.alive==1 then + PLAYERS.alive[1]:win() end end @@ -2971,7 +2971,7 @@ function player.act.func(P) P.gameEnv.Fkey(P) end function player.act.restart(P) - if game.frame<240 or game.result then + if GAME.frame<240 or GAME.result then resetPartGameData() else LOG.print(text.holdR,20,color.orange) @@ -3119,17 +3119,17 @@ function PLY.newDemoPlayer(id,x,y,size) das=10,arr=2,sddas=2,sdarr=2, swap=true, - ghost=setting.ghost, - center=setting.center, - smooth=setting.smooth, - grid=setting.grid, - text=setting.text, - score=setting.score, - lockFX=setting.lockFX, - dropFX=setting.dropFX, - moveFX=setting.moveFX, - clearFX=setting.clearFX, - shakeFX=setting.shakeFX, + ghost=SETTING.ghost, + center=SETTING.center, + smooth=SETTING.smooth, + grid=SETTING.grid, + text=SETTING.text, + score=SETTING.score, + lockFX=SETTING.lockFX, + dropFX=SETTING.dropFX, + moveFX=SETTING.moveFX, + clearFX=SETTING.clearFX, + shakeFX=SETTING.shakeFX, drop=1e99,lock=1e99, wait=10,fall=20, @@ -3140,7 +3140,7 @@ function PLY.newDemoPlayer(id,x,y,size) sequence="bag", bag={1,2,3,4,5,6,7}, face={0,0,0,0,0,0,0}, - skin=setting.skin, + skin=SETTING.skin, mission=false, life=1e99, diff --git a/parts/scenes.lua b/parts/scenes.lua index 127cc783..acc22387 100644 --- a/parts/scenes.lua +++ b/parts/scenes.lua @@ -12,7 +12,7 @@ local format=string.format local ins,rem=table.insert,table.remove local find,sub,char,byte=string.find,string.sub,string.char,string.byte -local scr=scr +local SCR=SCR local floatWheel=0 local function wheelScroll(y) @@ -227,7 +227,7 @@ do--load elseif S.phase==7 then --------------------------Loading other little things here SKIN.load() - stat.run=stat.run+1 + STAT.run=STAT.run+1 LOADED=true -------------------------- SFX.play("welcome_sfx") @@ -389,13 +389,13 @@ do--main modeEnv={} --Create demo player destroyPlayers() - game.frame=0 + GAME.frame=0 PLY.newDemoPlayer(1,900,35,1.1) end function Tmr.main(dt) - game.frame=game.frame+1 - players[1]:update(dt) + GAME.frame=GAME.frame+1 + PLAYERS[1]:update(dt) end function Pnt.main() @@ -403,12 +403,12 @@ do--main gc.draw(IMG.title_color,60,30,nil,1.3) setFont(30) gc.print(gameVersion,70,125) - gc.print(system,610,100) - local L=text.modes[stat.lastPlay] + gc.print(SYSTEM,610,100) + local L=text.modes[STAT.lastPlay] setFont(25) gc.print(L[1],700,470) gc.print(L[2],700,500) - players[1]:draw() + PLAYERS[1]:draw() end end do--mode @@ -708,7 +708,7 @@ do--mode gc.pop() if sel then local M=Modes[sel] - local lang=setting.lang + local lang=SETTING.lang gc.setColor(.7,.7,.7,.5) gc.rectangle("fill",920,0,360,720)--Info board gc.setColor(M.color) @@ -765,10 +765,10 @@ do--customGame if customEnv.opponent>5 and customEnv.sequence=="fixed"then LOG.print(text.ai_fixed,"warn") return - elseif customEnv.opponent>0 and #preBag>0 then + elseif customEnv.opponent>0 and #BAG>0 then LOG.print(text.ai_prebag,"warn") return - elseif customEnv.opponent>0 and #preMission>0 then + elseif customEnv.opponent>0 and #MISSION>0 then LOG.print(text.ai_mission,"warn") return end @@ -785,9 +785,9 @@ do--customGame SCN.go("custom_advance","swipeD") elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then local str="Techmino Quest:"..copyQuestArgs().."!" - if #preBag>0 then str=str..copySequence()end + if #BAG>0 then str=str..copySequence()end str=str.."!"..copyBoard().."!" - if #preMission>0 then str=str..copyMission()end + if #MISSION>0 then str=str..copyMission()end sys.setClipboardText(str.."!") LOG.print(text.copySuccess,color.green) elseif key=="v"and kb.isDown("lctrl","rctrl")or key=="cV"then @@ -828,7 +828,7 @@ do--customGame end end - local preField=preField + local FIELD=FIELD function Pnt.customGame() --Field gc.push("transform") @@ -839,7 +839,7 @@ do--customGame gc.rectangle("line",-2,-2,304,604) local cross=puzzleMark[-1] for y=1,20 do for x=1,10 do - local B=preField[y][x] + local B=FIELD[y][x] if B>0 then gc.draw(blockSkin[B],30*x-30,600-30*y) elseif B==-1 then @@ -852,17 +852,17 @@ do--customGame setFont(30) gc.printf(customEnv.sequence,330,550,240,"right") setFont(40) - if #preBag>0 then + if #BAG>0 then gc.setColor(1,1,int(Timer()*6.26)%2) gc.print("#",330,545) - gc.print(#preBag,360,545) + gc.print(#BAG,360,545) end --Sequence - if #preMission>0 then + if #MISSION>0 then gc.setColor(1,customEnv.missionKill and 0 or 1,int(Timer()*6.26)%2) gc.print("#",610,545) - gc.print(#preMission,640,545) + gc.print(#MISSION,640,545) end end end @@ -873,7 +873,7 @@ do--custom_advance end do--custom_sequence function sceneInit.custom_sequence() - sceneTemp={cur=#preBag,sure=0} + sceneTemp={cur=#BAG,sure=0} end local minoKey={ @@ -888,48 +888,48 @@ do--custom_sequence } function keyDown.custom_sequence(key) local S=sceneTemp - local preBag=preBag + local BAG=BAG if key=="left"then local p=S.cur if p==0 then - S.cur=#preBag + S.cur=#BAG else repeat p=p-1 - until preBag[p]~=preBag[S.cur] + until BAG[p]~=BAG[S.cur] S.cur=p end elseif key=="right"then local p=S.cur - if p==#preBag then + if p==#BAG then S.cur=0 else repeat p=p+1 - until preBag[p+1]~=preBag[S.cur+1] + until BAG[p+1]~=BAG[S.cur+1] S.cur=p end elseif key=="ten"then for i=1,10 do local p=S.cur - if p==#preBag then break end + if p==#BAG then break end repeat p=p+1 - until preBag[p+1]~=preBag[S.cur+1] + until BAG[p+1]~=BAG[S.cur+1] S.cur=p end elseif key=="backspace"then if S.cur>0 then - rem(preBag,S.cur) + rem(BAG,S.cur) S.cur=S.cur-1 - if S.cur>0 and preBag[S.cur]==preBag[S.cur+1]then + if S.cur>0 and BAG[S.cur]==BAG[S.cur+1]then keyDown.custom_mission("right") end end elseif key=="delete"then if S.sure>20 then - for i=1,#preBag do - rem(preBag) + for i=1,#BAG do + rem(BAG) end S.cur=0 S.sure=0 @@ -938,7 +938,7 @@ do--custom_sequence S.sure=50 end elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then - if #preBag>0 then + if #BAG>0 then sys.setClipboardText("Techmino SEQ:"..copySequence()) LOG.print(text.copySuccess,color.green) end @@ -955,13 +955,13 @@ do--custom_sequence SCN.back() elseif type(key)=="number"then S.cur=S.cur+1 - ins(preBag,S.cur,key) + ins(BAG,S.cur,key) elseif #key==1 then key=(kb.isDown("lshift","lalt","rshift","ralt")and minoKey2 or minoKey)[key] if key then local p=S.cur+1 - while preBag[p]==key do p=p+1 end - ins(preBag,p,key) + while BAG[p]==key do p=p+1 end + ins(BAG,p,key) S.cur=p end end @@ -982,8 +982,8 @@ do--custom_sequence --Draw sequence local miniBlock=TEXTURE.miniBlock local libColor=SKIN.libColor - local set=setting.skin - local L=preBag + local set=SETTING.skin + local L=BAG local x,y=120,136--Next block pos local cx,cy=120,136--Cursor-center pos local i,j=1,#L @@ -1051,7 +1051,7 @@ do--custom_field a=12,s=13,d=14,f=15,g=16,h=17, z=0,x=-1, } - local preField=preField + local FIELD=FIELD function mouseDown.custom_field(x,y,k) mouseMove.custom_field(x,y) end @@ -1061,7 +1061,7 @@ do--custom_field if sy<1 or sy>20 then sy=nil end sceneTemp.x,sceneTemp.y=sx,sy if sx and sy and ms.isDown(1,2,3)then - preField[sy][sx]=ms.isDown(1)and sceneTemp.pen or ms.isDown(2)and -1 or 0 + FIELD[sy][sx]=ms.isDown(1)and sceneTemp.pen or ms.isDown(2)and -1 or 0 end end function wheelMoved.custom_field(x,y) @@ -1084,7 +1084,7 @@ do--custom_field if sy<1 or sy>20 then sy=nil end sceneTemp.x,sceneTemp.y=sx,sy if sx and sy then - preField[sy][sx]=sceneTemp.pen + FIELD[sy][sx]=sceneTemp.pen end end function keyDown.custom_field(key) @@ -1098,11 +1098,11 @@ do--custom_field elseif key=="right"and sx<10 then sx=sx+1 end if kb.isDown("space")then - preField[sy][sx]=pen + FIELD[sy][sx]=pen end elseif key=="delete"then if sceneTemp.sure>20 then - for y=1,20 do for x=1,10 do preField[y][x]=0 end end + for y=1,20 do for x=1,10 do FIELD[y][x]=0 end end sceneTemp.sure=0 SFX.play("finesseError",.7) else @@ -1110,16 +1110,16 @@ do--custom_field end elseif key=="space"then if sx and sy then - preField[sy][sx]=pen + FIELD[sy][sx]=pen end elseif key=="escape"then SCN.back() elseif key=="k"then - ins(preField,1,{14,14,14,14,14,14,14,14,14,14}) - preField[21]=nil + ins(FIELD,1,{14,14,14,14,14,14,14,14,14,14}) + FIELD[21]=nil SFX.play("blip") elseif key=="l"then - local F=preField + local F=FIELD for i=20,1,-1 do for j=1,10 do if F[i][j]<=0 then goto L end @@ -1174,7 +1174,7 @@ do--custom_field gc.setLineWidth(2) local cross=puzzleMark[-1] for y=1,20 do for x=1,10 do - local B=preField[y][x] + local B=FIELD[y][x] if B>0 then gc.draw(blockSkin[B],30*x-30,600-30*y) elseif B==-1 and not S.demo then @@ -1210,7 +1210,7 @@ do--custom_field setFont(40) local _ for i=1,7 do - _=setting.skin[i] + _=SETTING.skin[i] gc.setColor(SKIN.libColor[_]) mStr(text.block[i],500+65*_,115) end @@ -1220,7 +1220,7 @@ do--custom_mission function sceneInit.custom_mission() sceneTemp={ input="", - cur=#preMission, + cur=#MISSION, sure=0, } end @@ -1229,48 +1229,48 @@ do--custom_mission local legalInput={Z=true,S=true,J=true,L=true,T=true,O=true,I=true,A=true,_=true,P=true} function keyDown.custom_mission(key) local S=sceneTemp - local preMission=preMission + local MISSION=MISSION if key=="left"then local p=S.cur if p==0 then - S.cur=#preMission + S.cur=#MISSION else repeat p=p-1 - until preMission[p]~=preMission[S.cur] + until MISSION[p]~=MISSION[S.cur] S.cur=p end elseif key=="right"then local p=S.cur - if p==#preMission then + if p==#MISSION then S.cur=0 else repeat p=p+1 - until preMission[p+1]~=preMission[S.cur+1] + until MISSION[p+1]~=MISSION[S.cur+1] S.cur=p end elseif key=="ten"then for i=1,10 do local p=S.cur - if p==#preMission then break end + if p==#MISSION then break end repeat p=p+1 - until preMission[p+1]~=preMission[S.cur+1] + until MISSION[p+1]~=MISSION[S.cur+1] S.cur=p end elseif key=="backspace"then if S.cur>0 then - rem(preMission,S.cur) + rem(MISSION,S.cur) S.cur=S.cur-1 - if S.cur>0 and preMission[S.cur]==preMission[S.cur+1]then + if S.cur>0 and MISSION[S.cur]==MISSION[S.cur+1]then keyDown.custom_mission("right") end end elseif key=="delete"then if S.sure>20 then - for i=1,#preMission do - rem(preMission) + for i=1,#MISSION do + rem(MISSION) end S.cur=0 S.sure=0 @@ -1279,7 +1279,7 @@ do--custom_mission S.sure=50 end elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then - if #preMission>0 then + if #MISSION>0 then sys.setClipboardText("Techmino Target:"..copyMission()) LOG.print(text.copySuccess,color.green) end @@ -1296,8 +1296,8 @@ do--custom_mission SCN.back() elseif type(key)=="number"then local p=S.cur+1 - while preMission[p]==key do p=p+1 end - ins(preMission,p,key) + while MISSION[p]==key do p=p+1 end + ins(MISSION,p,key) S.cur=p else if key=="space"then @@ -1310,7 +1310,7 @@ do--custom_mission input=input..key if missionEnum[input]then S.cur=S.cur+1 - ins(preMission,S.cur,missionEnum[input]) + ins(MISSION,S.cur,missionEnum[input]) input="" elseif #input>1 or not legalInput[input]then input="" @@ -1338,8 +1338,8 @@ do--custom_mission --Draw targets local libColor=SKIN.libColor - local set=setting.skin - local L=preMission + local set=SETTING.skin + local L=MISSION local x,y=100,136--Next block pos local cx,cy=100,136--Cursor-center pos local i,j=1,#L @@ -1422,19 +1422,19 @@ do--play end function touchDown.play(id,x,y) - if not setting.VKSwitch or game.replaying then return end + if not SETTING.VKSwitch or GAME.replaying then return end local t=onVirtualkey(x,y) if t then - players[1]:pressKey(t) - if setting.VKSFX>0 then - SFX.play("virtualKey",setting.VKSFX) + PLAYERS[1]:pressKey(t) + if SETTING.VKSFX>0 then + SFX.play("virtualKey",SETTING.VKSFX) end VK[t].isDown=true VK[t].pressTime=10 - if setting.VKTrack then + if SETTING.VKTrack then local B=VK[t] - if setting.VKDodge then--Button collision (not accurate) + if SETTING.VKDodge then--Button collision (not accurate) for i=1,#VK do local b=VK[i] local d=B.r+b.r-((B.x-b.x)^2+(B.y-b.y)^2)^.5--Hit depth(Neg means distance) @@ -1445,25 +1445,25 @@ do--play end end local O=VK_org[t] - local _FW,_CW=setting.VKTchW*.1,1-setting.VKCurW*.1 + local _FW,_CW=SETTING.VKTchW*.1,1-SETTING.VKCurW*.1 local _OW=1-_FW-_CW --Auto follow: finger, current, origin (weight from setting) B.x,B.y=x*_FW+B.x*_CW+O.x*_OW,y*_FW+B.y*_CW+O.y*_OW end - VIB(setting.VKVIB) + VIB(SETTING.VKVIB) end end function touchUp.play(id,x,y) - if not setting.VKSwitch or game.replaying then return end + if not SETTING.VKSwitch or GAME.replaying then return end local t=onVirtualkey(x,y) if t then - players[1]:releaseKey(t) + PLAYERS[1]:releaseKey(t) end end function touchMove.play(id,x,y,dx,dy) - if not setting.VKSwitch or game.replaying then return end + if not SETTING.VKSwitch or GAME.replaying then return end local l=tc.getTouches() for n=1,#VK do @@ -1474,17 +1474,17 @@ do--play goto next end end - players[1]:releaseKey(n) + PLAYERS[1]:releaseKey(n) ::next:: end end function keyDown.play(key) - if game.replaying then return end + if GAME.replaying then return end local m=keyMap for k=1,20 do if key==m[1][k]or key==m[2][k]then - players[1]:pressKey(k) + PLAYERS[1]:pressKey(k) VK[k].isDown=true VK[k].pressTime=10 return @@ -1494,23 +1494,23 @@ do--play if key=="escape"then pauseGame()end end function keyUp.play(key) - if game.replaying then return end + if GAME.replaying then return end local m=keyMap for k=1,20 do if key==m[1][k]or key==m[2][k]then - players[1]:releaseKey(k) + PLAYERS[1]:releaseKey(k) VK[k].isDown=false return end end end function gamepadDown.play(key) - if game.replaying then return end + if GAME.replaying then return end local m=keyMap for k=1,20 do if key==m[3][k]or key==m[4][k]then - players[1]:pressKey(k) + PLAYERS[1]:pressKey(k) VK[k].isDown=true VK[k].pressTime=10 return @@ -1520,12 +1520,12 @@ do--play if key=="back"then pauseGame()end end function gamepadUp.play(key) - if game.replaying then return end + if GAME.replaying then return end local m=keyMap for k=1,20 do if key==m[3][k]or key==m[4][k]then - players[1]:releaseKey(k) + PLAYERS[1]:releaseKey(k) VK[k].isDown=false return end @@ -1534,13 +1534,13 @@ do--play function Tmr.play(dt) local _ - local P1=players[1] - local game=game - game.frame=game.frame+1 - stat.time=stat.time+dt + local P1=PLAYERS[1] + local GAME=GAME + GAME.frame=GAME.frame+1 + STAT.time=STAT.time+dt --Update virtualkey animation - if setting.VKSwitch then + if SETTING.VKSwitch then for i=1,#VK do _=VK[i] if _.pressTime>0 then @@ -1550,10 +1550,10 @@ do--play end --Replay - if game.replaying then - _=game.replaying - local L=game.rec - while game.frame==L[_]do + if GAME.replaying then + _=GAME.replaying + local L=GAME.rec + while GAME.frame==L[_]do local k=L[_+1] if k>0 then P1:pressKey(k) @@ -1565,18 +1565,18 @@ do--play end _=_+2 end - game.replaying=_ + GAME.replaying=_ end --Counting,include pre-das,directy RETURN,or restart counting - if game.frame<180 then - if game.frame==179 then + if GAME.frame<180 then + if GAME.frame==179 then gameStart() - elseif game.frame==60 or game.frame==120 then + elseif GAME.frame==60 or GAME.frame==120 then SFX.play("ready") end - for p=1,#players do - local P=players[p] + for p=1,#PLAYERS do + local P=PLAYERS[p] if P.movDir~=0 then if P.moving0 then _=max(_-.026,0) end - game.warnLVL=_ - elseif game.warnLVL>0 then - game.warnLVL=max(game.warnLVL-.026,0) + GAME.warnLVL=_ + elseif GAME.warnLVL>0 then + GAME.warnLVL=max(GAME.warnLVL-.026,0) end end @@ -1646,9 +1646,9 @@ do--play gc.circle("line",x,y,30*(1+a),6) end local function drawVirtualkey() - local a=setting.VKAlpha + local a=SETTING.VKAlpha local _ - if setting.VKIcon then + if SETTING.VKIcon then local icons=TEXTURE.VKIcon for i=1,#VK do if VK[i].ava then @@ -1689,15 +1689,15 @@ do--play gc.setColor(1,1,1,.2+.1*(sin(3*t)+sin(2.6*t))) mStr(text.marking,190,60+26*sin(t)) end - for p=1,#players do - players[p]:draw() + for p=1,#PLAYERS do + PLAYERS[p]:draw() end gc.setColor(1,1,1) - if setting.VKSwitch then drawVirtualkey()end + if SETTING.VKSwitch then drawVirtualkey()end if modeEnv.royaleMode then - local P=players[1] + local P=PLAYERS[1] gc.setLineWidth(5) gc.setColor(.8,1,0,.2) for i=1,#P.atker do @@ -1720,7 +1720,7 @@ do--play gc.draw(drawableText.levelName,511+drawableText.modeName:getWidth(),10) --Replaying - if game.replaying then + if GAME.replaying then gc.setColor(1,1,Timer()%1>.5 and 1 or 0) mText(drawableText.replaying,410,17) end @@ -1728,16 +1728,16 @@ do--play --Warning gc.push("transform") gc.origin() - if game.warnLVL>0 then + if GAME.warnLVL>0 then gc.setColor(0,0,0,0) - SHADER.warning:send("level",game.warnLVL) + SHADER.warning:send("level",GAME.warnLVL) gc.setShader(SHADER.warning) - gc.rectangle("fill",0,0,scr.w,scr.h) + gc.rectangle("fill",0,0,SCR.w,SCR.h) gc.setShader() end if restartCount>0 then gc.setColor(0,0,0,restartCount*.05) - gc.rectangle("fill",0,0,scr.w,scr.h) + gc.rectangle("fill",0,0,SCR.w,SCR.h) end gc.pop() end @@ -1761,7 +1761,7 @@ do--pause then TEXT.show(text.needRestart,640,440,50,"fly",.6) end - local P=players[1] + local P=PLAYERS[1] local S=P.stat sceneTemp={ timer=org=="play"and 0 or 50, @@ -1848,8 +1848,8 @@ do--pause end function sceneBack.pause() love.keyboard.setKeyRepeat(true) - if not game.replaying then - mergeStat(stat,players[1].stat) + if not GAME.replaying then + mergeStat(STAT,PLAYERS[1].stat) end FILE.saveData() end @@ -1864,15 +1864,15 @@ do--pause elseif key=="r"then resetGameData() SCN.swapTo("play","none") - elseif key=="p"and(game.result or game.replaying)and #players==1 then + elseif key=="p"and(GAME.result or GAME.replaying)and #PLAYERS==1 then resetPartGameData(true) SCN.swapTo("play","none") end end function Tmr.pause(dt) - if not game.result then - game.pauseTime=game.pauseTime+dt + if not GAME.result then + GAME.pauseTime=GAME.pauseTime+dt end if sceneTemp.timer<50 then sceneTemp.timer=sceneTemp.timer+1 @@ -1886,22 +1886,22 @@ do--pause function Pnt.pause() local S=sceneTemp local T=S.timer*.02 - if T<1 or game.result then Pnt.play()end + if T<1 or GAME.result then Pnt.play()end --Dark BG local _=T - if game.result then _=_*.7 end + if GAME.result then _=_*.7 end gc.setColor(.15,.15,.15,_) gc.push("transform") gc.origin() - gc.rectangle("fill",0,0,scr.w,scr.h) + gc.rectangle("fill",0,0,SCR.w,SCR.h) gc.pop() --Pause Info setFont(25) - if game.pauseCount>0 then + if GAME.pauseCount>0 then gc.setColor(1,.4,.4,T) - gc.print(text.pauseCount..":["..game.pauseCount.."] "..format("%.2f",game.pauseTime).."s",70,100) + gc.print(text.pauseCount..":["..GAME.pauseCount.."] "..format("%.2f",GAME.pauseTime).."s",70,100) end gc.setColor(1,1,1,T) @@ -1913,10 +1913,10 @@ do--pause --Result Text setFont(35) - mText(game.result and drawableText[game.result]or drawableText.pause,640,50-10*(5-sceneTemp.timer*.1)^1.5) + mText(GAME.result and drawableText[GAME.result]or drawableText.pause,640,50-10*(5-sceneTemp.timer*.1)^1.5) --Infos - if game.frame>180 then + if GAME.frame>180 then _=S.list setFont(26) for i=1,10 do @@ -1938,7 +1938,7 @@ do--pause end --Radar Chart - if T>.5 and game.frame>180 then + if T>.5 and GAME.frame>180 then T=T*2-1 gc.setLineWidth(2) gc.push("transform") @@ -2057,8 +2057,8 @@ end do--setting_control function sceneInit.setting_control() sceneTemp={ - das=setting.das, - arr=setting.arr, + das=SETTING.das, + arr=SETTING.arr, pos=0, dir=1, wait=30, @@ -2081,8 +2081,8 @@ do--setting_control if T.das==0 then if T.arr==0 then T.pos=T.pos+7*T.dir - T.das=setting.das+1 - T.arr=setting.arr + T.das=SETTING.das+1 + T.arr=SETTING.arr T.dir=-T.dir T.wait=26 else @@ -2093,15 +2093,15 @@ do--setting_control T.arr=T.arr-1 if T.arr==0 then T.pos=T.pos+T.dir - T.arr=setting.arr + T.arr=SETTING.arr elseif T.arr==-1 then T.pos=T.dir>0 and 8 or 0 - T.arr=setting.arr + T.arr=SETTING.arr end if T.pos%8==0 then T.dir=-T.dir T.wait=26 - T.das=setting.das + T.das=SETTING.das end end end @@ -2121,7 +2121,7 @@ do--setting_control gc.line(950,530,950,630) --Testing O mino - _=blockSkin[setting.skin[6]] + _=blockSkin[SETTING.skin[6]] local x=550+40*sceneTemp.pos gc.draw(_,x,540,nil,40/30) gc.draw(_,x,580,nil,40/30) @@ -2261,13 +2261,13 @@ do--setting_skin function Pnt.setting_skin() gc.setColor(1,1,1) for N=1,7 do - local face=setting.face[N] + local face=SETTING.face[N] local B=blocks[N][face] local x,y=-55+140*N-scs[N][face][2]*30,355+scs[N][face][1]*30 local col=#B[1] for i=1,#B do for j=1,col do if B[i][j]then - gc.draw(blockSkin[setting.skin[N]],x+30*j,y-30*i) + gc.draw(blockSkin[SETTING.skin[N]],x+30*j,y-30*i) end end end gc.circle("fill",-10+140*N,340,sin(Timer()*10)+5) @@ -2341,15 +2341,15 @@ do--setting_touch end local function VirtualkeyPreview() - if setting.VKSwitch then + if SETTING.VKSwitch then for i=1,#VK_org do local B=VK_org[i] if B.ava then local c=sceneTemp.sel==i and .6 or 1 - gc.setColor(c,1,c,setting.VKAlpha) + gc.setColor(c,1,c,SETTING.VKAlpha) gc.setLineWidth(B.r*.07) gc.circle("line",B.x,B.y,B.r,10) - if setting.VKIcon then gc.draw(TEXTURE.VKIcon[i],B.x,B.y,nil,B.r*.025,nil,18,18)end + if SETTING.VKIcon then gc.draw(TEXTURE.VKIcon[i],B.x,B.y,nil,B.r*.025,nil,18,18)end end end end @@ -2375,9 +2375,9 @@ end do--setting_trackSetting function Pnt.setting_trackSetting() gc.setColor(1,1,1) - mText(drawableText.VKTchW,140+50*setting.VKTchW,260) - mText(drawableText.VKOrgW,140+50*setting.VKTchW+50*setting.VKCurW,320) - mText(drawableText.VKCurW,640+50*setting.VKCurW,380) + mText(drawableText.VKTchW,140+50*SETTING.VKTchW,260) + mText(drawableText.VKOrgW,140+50*SETTING.VKTchW+50*SETTING.VKCurW,320) + mText(drawableText.VKCurW,640+50*SETTING.VKCurW,380) end end do--setting_touchSwitch @@ -2421,7 +2421,7 @@ do--music end elseif key=="return"or key=="space"then if BGM.nowPlay~=BGM.list[S]then - if setting.bgm>0 then + if SETTING.bgm>0 then SFX.play("click") BGM.play(BGM.list[S]) end @@ -2488,7 +2488,7 @@ do--help end do--dict function sceneInit.dict() - local location=(setting.lang==3 or setting.lang==4)and"en"or"zh" + local location=(SETTING.lang==3 or SETTING.lang==4)and"en"or"zh" sceneTemp={ dict=require("document/dict_"..location), @@ -2689,7 +2689,7 @@ do--staff end do--stat function sceneInit.stat() - local S=stat + local S=STAT local X1,X2,Y1,Y2={0,0,0,0},{0,0,0,0},{},{} for i=1,7 do local S,C=S.spin[i],S.clear[i] @@ -2728,7 +2728,7 @@ do--stat function Pnt.stat() local chart=sceneTemp.chart setFont(24) - local _,__=SKIN.libColor,setting.skin + local _,__=SKIN.libColor,SETTING.skin local A,B=chart.A1,chart.A2 for x=1,7 do gc.setColor(_[__[x]]) diff --git a/parts/skin.lua b/parts/skin.lua index 85be4745..d932c211 100644 --- a/parts/skin.lua +++ b/parts/skin.lua @@ -82,7 +82,7 @@ function SKIN.load() end I:release() end - SKIN.change(setting.skinSet) + SKIN.change(SETTING.skinSet) puzzleMark={} gc.setLineWidth(3) for i=1,11 do @@ -110,29 +110,29 @@ function SKIN.load() end local L=#list function SKIN.prevSet()--Prev skin_set - local _=(setting.skinSet-2)%L+1 - setting.skinSet=_ + local _=(SETTING.skinSet-2)%L+1 + SETTING.skinSet=_ SKIN.change(_) _=list[_] TEXT.show(_,1100,100,int(300/#_)+5,"fly") end function SKIN.nextSet()--Next skin_set - local _=setting.skinSet%L+1 - setting.skinSet=_ + local _=SETTING.skinSet%L+1 + SETTING.skinSet=_ SKIN.change(_) _=list[_] TEXT.show(_,1100,100,int(300/#_)+5,"fly") end function SKIN.prev(i)--Prev skin for [i] - local _=setting.skin + local _=SETTING.skin _[i]=(_[i]-2)%11+1 end function SKIN.next(i)--Next skin for [i] - local _=setting.skin + local _=SETTING.skin _[i]=_[i]%11+1 end function SKIN.rotate(i)--Change direction of [i] - setting.face[i]=(setting.face[i]+1)%4 + SETTING.face[i]=(SETTING.face[i]+1)%4 SFX.play("rotate") end function SKIN.change(i)--Change to skin_set[i] diff --git a/parts/tick.lua b/parts/tick.lua index 2fac8408..8be3b4ae 100644 --- a/parts/tick.lua +++ b/parts/tick.lua @@ -34,7 +34,7 @@ function Tick.lose(P) return true end end - if not modeEnv.royaleMode and #players>1 then + if not modeEnv.royaleMode and #PLAYERS>1 then P.y=P.y+P.endCounter*.26 P.absFieldY=P.absFieldY+P.endCounter*.26 end