diff --git a/Zframework/bg.lua b/Zframework/bg.lua index 7be83a81..8cc7ff29 100644 --- a/Zframework/bg.lua +++ b/Zframework/bg.lua @@ -1,12 +1,12 @@ local gc=love.graphics -local int,ceil,rnd,abs=math.floor,math.ceil,math.random,math.abs -local max,min,sin,cos=math.max,math.min,math.sin,math.cos +local int,ceil,rnd=math.floor,math.ceil,math.random +local max,min,sin=math.max,math.min,math.sin local ins,rem=table.insert,table.remove -local BG +local function NULL(...)end local SCR=SCR local BGvars={_G=_G,SHADER=SHADER} - +local BG local back={} back.none={ draw=function() @@ -208,7 +208,7 @@ back.aura={ t=rnd()*3600 BG.resize(SCR.w,SCR.h) end, - resize=function(w,h) + resize=function(_,h) SHADER.aura:send("w",SCR.W) SHADER.aura:send("h",h*SCR.dpi) end, @@ -225,9 +225,9 @@ back.aura={ back.bg1={ init=function() t=0 - BG.resize(SCR.w) + BG.resize() end, - resize=function(w) + resize=function() SHADER.gradient1:send("w",SCR.W) end, update=function(dt) @@ -245,7 +245,7 @@ back.bg2={ t=0 BG.resize(nil,SCR.h) end, - resize=function(w,h) + resize=function(_,h) SHADER.gradient2:send("h",h*SCR.dpi) end, update=function(dt) @@ -263,7 +263,7 @@ back.rainbow={ t=0 BG.resize(SCR.w,SCR.h) end, - resize=function(w,h) + resize=function(_,h) SHADER.rgb1:send("w",SCR.W) SHADER.rgb1:send("h",h*SCR.dpi) end, @@ -282,7 +282,7 @@ back.rainbow2={ t=0 BG.resize(SCR.w,SCR.h) end, - resize=function(w,h) + resize=function(_,h) SHADER.rgb2:send("w",SCR.W) SHADER.rgb2:send("h",h*SCR.dpi) end, @@ -365,7 +365,7 @@ back.space={ W,H=SCR.w+20,SCR.h+20 BG.resize(SCR.w,SCR.h) end, - resize=function(w,h) + resize=function() local S=stars for i=1,1260,5 do local s=rnd(26,40)*.1 @@ -376,7 +376,7 @@ back.space={ S[i+4]=(rnd()-.5)*.01*s --Vy end end, - update=function(dt) + update=function() local S=stars --Star moving for i=1,1260,5 do @@ -404,31 +404,31 @@ back.space={ --Make BG vars invisible for _,bg in next,back do - if not bg.init then bg.init= NULL end setfenv(bg.init ,BGvars) - if not bg.resize then bg.resize= NULL end setfenv(bg.resize ,BGvars) - if not bg.update then bg.update= NULL end setfenv(bg.update ,BGvars) - if not bg.draw then bg.draw= NULL end setfenv(bg.draw ,BGvars) - if not bg.event then bg.event= NULL end setfenv(bg.event ,BGvars) - if not bg.discard then bg.discard=NULL end setfenv(bg.discard ,BGvars) + if bg.init then setfenv(bg.init ,BGvars)end + if bg.resize then setfenv(bg.resize ,BGvars)end + if bg.update then setfenv(bg.update ,BGvars)end + if bg.draw then setfenv(bg.draw ,BGvars)end + if bg.event then setfenv(bg.event ,BGvars)end + if bg.discard then setfenv(bg.discard ,BGvars)end end BG={ cur="none", + init=NULL, resize=NULL, update=NULL, draw=back.none.draw, + event=NULL, + discard=NULL, } function BG.send(data) if BG.event then BG.event(data) end end -function BG.set(bg,data) +function BG.set(bg) if bg==BG.cur or not SETTING.bg then return end - if BG.discard then - BG.discard() - collectgarbage() - end + BG.discard() if not back[bg]then LOG.print("No BG called"..bg,"warn") return diff --git a/Zframework/bgm.lua b/Zframework/bgm.lua index 1e07bea2..e644b4da 100644 --- a/Zframework/bgm.lua +++ b/Zframework/bgm.lua @@ -1,5 +1,4 @@ local min=math.min -local rem=table.remove local function fadeOut(id) local src=BGM.list[id] diff --git a/Zframework/file.lua b/Zframework/file.lua index 484eadbc..8bcd44b4 100644 --- a/Zframework/file.lua +++ b/Zframework/file.lua @@ -1,6 +1,4 @@ local fs=love.filesystem -local int=math.floor -local toN,toS=tonumber,tostring local files={ data= fs.newFile("data.dat"), diff --git a/Zframework/img.lua b/Zframework/img.lua index a8f5fc41..336ef8fa 100644 --- a/Zframework/img.lua +++ b/Zframework/img.lua @@ -23,7 +23,7 @@ local IMG={ } local list={} local count=0 -for k,v in next,IMG do +for k,_ in next,IMG do count=count+1 list[count]=k end diff --git a/Zframework/init.lua b/Zframework/init.lua index 60ec2089..3ad40a70 100644 --- a/Zframework/init.lua +++ b/Zframework/init.lua @@ -21,7 +21,7 @@ LIGHT= require("Zframework/light") local ms=love.mouse local gc=love.graphics local int,rnd,abs=math.floor,math.random,math.abs -local max,min=math.max,math.min +local min=math.min local ins,rem=table.insert,table.remove local SCR=SCR @@ -85,7 +85,7 @@ local keyDown,keyUp=keyDown,keyUp local gamepadDown,gamepadUp=gamepadDown,gamepadUp ------------------------------------------------------------- local lastX,lastY=0,0--Last clickDown pos -function love.mousepressed(x,y,k,touch,num) +function love.mousepressed(x,y,k,touch) if touch then return end mouseShow=true mx,my=xOy:inverseTransformPoint(x,y) @@ -112,12 +112,12 @@ function love.mousemoved(x,y,dx,dy,t) mouseMove[SCN.cur](mx,my,dx,dy) end if ms.isDown(1) then - WIDGET.drag(mx,my,dx,dy) + WIDGET.drag(mx,my) else WIDGET.moveCursor(mx,my) end end -function love.mousereleased(x,y,k,touch,num) +function love.mousereleased(x,y,k,touch) if touch or SCN.swapping then return end mx,my=xOy:inverseTransformPoint(x,y) WIDGET.release(mx,my) @@ -155,7 +155,7 @@ function love.touchmoved(id,x,y,dx,dy) end if WIDGET.sel then if touching then - WIDGET.drag(x,y,dx,dy) + WIDGET.drag(x,y) end else WIDGET.moveCursor(x,y) @@ -281,7 +281,7 @@ local keyMirror={ start="return", back="escape", } -function love.gamepadpressed(joystick,i) +function love.gamepadpressed(_,i) mouseShow=false if SCN.swapping then return end if gamepadDown[SCN.cur]then gamepadDown[SCN.cur](i) @@ -290,7 +290,7 @@ function love.gamepadpressed(joystick,i) else WIDGET.gamepadPressed(i) end end -function love.gamepadreleased(joystick,i) +function love.gamepadreleased(_,i) if SCN.swapping then return end if gamepadUp[SCN.cur]then gamepadUp[SCN.cur](i) end @@ -336,7 +336,7 @@ function love.resize(w,h) SCR.x,SCR.y=(w-h*16/9)*.5,0 end xOy=xOy:setTransformation(w*.5,h*.5,nil,SCR.k,nil,640,360) - BG.resize(w,h) + if BG.resize then BG.resize(w,h)end SHADER.warning:send("w",w*SCR.dpi) SHADER.warning:send("h",h*SCR.dpi) @@ -366,7 +366,7 @@ function love.errorhandler(msg) c=3 end end - print(table.concat(err,"\n"),1,c-2) + DBP(table.concat(err,"\n"),1,c-2) gc.reset() local CAP local function _(_)CAP=gc.newImage(_)end @@ -380,7 +380,7 @@ function love.errorhandler(msg) local count=0 return function() PUMP() - for E,a,b,c,d,e in POLL()do + for E,a,b in POLL()do if E=="quit"or a=="escape"then destroyPlayers() return 1 @@ -445,7 +445,6 @@ function love.run() local mini=love.window.isMinimized local PUMP,POLL=love.event.pump,love.event.poll - local waitTime=1/60 local frameTimeList={} local lastFrame=Timer() diff --git a/Zframework/languages.lua b/Zframework/languages.lua index 59cb953e..c0256117 100644 --- a/Zframework/languages.lua +++ b/Zframework/languages.lua @@ -2996,7 +2996,6 @@ end local langMeta={__index=langList[1]} for i=2,#langList do setmetatable(langList[i],langMeta)end -local gc=love.graphics local LANG={} local drawableTextLoad={ "anykey", @@ -3013,7 +3012,7 @@ end function LANG.set(l) text=langList[l] for S,L in next,Widgets do - for N,W in next,L do + for _,W in next,L do W.text=text.WidgetText[S][W.name] end end diff --git a/Zframework/light.lua b/Zframework/light.lua index 8cf8a92b..f684a03a 100644 --- a/Zframework/light.lua +++ b/Zframework/light.lua @@ -62,7 +62,7 @@ function LIGHT.draw() Lights[i]:draw() end end -function LIGHT.clear(L) +function LIGHT.clear() for i=#Lights,1,-1 do Lights[i]:destroy() Lights[i]=nil diff --git a/Zframework/toolfunc.lua b/Zframework/toolfunc.lua index da2774d0..fd04a55a 100644 --- a/Zframework/toolfunc.lua +++ b/Zframework/toolfunc.lua @@ -179,7 +179,7 @@ do--httpRequest end end else - function httpRequest(tick,url,method) + function httpRequest(...) LOG.print("[NO NETlib]",5,color.yellow) end end @@ -235,7 +235,7 @@ do--json return "\\" .. (escape_char_map[c] or string.format("u%04x", c:byte())) end - local function encode_nil(val) return "null" end + local function encode_nil() return "null" end local function encode_table(val, stack) local res = {} @@ -257,7 +257,7 @@ do--json end if n ~= #val then error("invalid table: sparse array") end -- Encode - for i, v in ipairs(val) do table.insert(res, encode(v, stack)) end + for _, v in ipairs(val) do table.insert(res, encode(v, stack)) end stack[val] = nil return "[" .. table.concat(res, ",") .. "]" diff --git a/Zframework/widget.lua b/Zframework/widget.lua index 40c81cb0..8f3ca28a 100644 --- a/Zframework/widget.lua +++ b/Zframework/widget.lua @@ -102,7 +102,6 @@ function button:FX() self.y-ATV, self.w+2*ATV, self.h+2*ATV - ,5 ) end function button:update() @@ -329,7 +328,6 @@ local slider={ pos=0,--Position shown } local sliderShowFunc={ - none=NULL, int=function(S) return S.disp() end, @@ -733,7 +731,7 @@ function WIDGET.press(x,y) end if W.hide and W.hide()then WIDGET.sel=nil end end -function WIDGET.drag(x,y,dx,dy) +function WIDGET.drag(x,y) local W=WIDGET.sel if not W then return end if W.type=="slider"then @@ -851,7 +849,7 @@ function WIDGET.keyPressed(key) end end else - for k,v in next,WIDGET.active do + for _,v in next,WIDGET.active do if v.isAbove then WIDGET.sel=v break diff --git a/Zframework/widgetList.lua b/Zframework/widgetList.lua index 9bd105cd..6f306089 100644 --- a/Zframework/widgetList.lua +++ b/Zframework/widgetList.lua @@ -1,5 +1,4 @@ local rnd=math.random -local ins,rem=table.insert,table.remove local mobileHide=(SYSTEM=="Android"or SYSTEM=="iOS")and function()return true end local function BACK()SCN.back()end local virtualkeySet={ @@ -102,7 +101,6 @@ 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 local function STPeq(k,v) return function() return sceneTemp[k]==v end end -local function STPsto(k) return function(i) sceneTemp[k]=i end end local function prevSkin(n) return function() SKIN.prev(n) end end local function nextSkin(n) return function() SKIN.next(n) end end @@ -644,20 +642,20 @@ local Widgets={ }, dict={ newText({name="title", x=20,y=5,font=70,align="L"}), - newKey({name="link", x=1140,y=650,w=200,h=80, font=35,code=pressKey("link"),hide=function()return not sceneTemp.url end}), - newButton({name="back", x=1165,y=60,w=170,h=80, font=40,code=BACK}), + newKey({name="link", x=1140,y=650,w=200,h=80,font=35,code=pressKey("link"),hide=function()return not sceneTemp.url end}), + newButton({name="back", x=1165,y=60,w=170,h=80,font=40,code=BACK}), }, staff={ - newButton({name="back", x=1140, y=640,w=170,h=80, font=40,code=BACK}), + newButton({name="back", x=1140, y=640,w=170,h=80,font=40,code=BACK}), }, history={ - newKey({name="prev", x=1155, y=170,w=180, font=65,code=pressKey("up"),hide=STPeq("pos",1)}), - newKey({name="next", x=1155, y=400,w=180, font=65,code=pressKey("down"),hide=function()return sceneTemp.pos==#sceneTemp.text end}), - newButton({name="back", x=1140, y=640,w=170,h=80, font=40,code=BACK}), + newKey({name="prev", x=1155, y=170,w=180,font=65,code=pressKey("up"),hide=STPeq("pos",1)}), + newKey({name="next", x=1155, y=400,w=180,font=65,code=pressKey("down"),hide=function()return sceneTemp.pos==#sceneTemp.text end}), + newButton({name="back", x=1140, y=640,w=170,h=80,font=40,code=BACK}), }, stat={ - newButton({name="path", x=980, y=620,w=250,h=80, font=25,code=function()love.system.openURL(love.filesystem.getSaveDirectory())end,hide=mobileHide}), - newButton({name="back", x=640, y=620,w=200,h=80, font=35,code=BACK}), + newButton({name="path", x=980, y=620,w=250,h=80,font=25,code=function()love.system.openURL(love.filesystem.getSaveDirectory())end,hide=mobileHide}), + newButton({name="back", x=640, y=620,w=200,h=80,font=35,code=BACK}), }, login={ newText({name="title", x=80,y=50,font=70,align="L"}), @@ -676,20 +674,20 @@ local Widgets={ }, p15={ newButton({name="reset", x=160,y=100,w=180,h=100,color="lGreen", font=40,code=pressKey("space")}), - newSlider({name="color", x=110,y=250,w=170,unit=4,show=false, font=30,disp=STPval("color"), code=function(v)if sceneTemp.state~=1 then sceneTemp.color=v end end,hide=STPeq("state",1)}), - newSwitch({name="blind", x=240,y=330,w=60, font=40,disp=STPval("blind"), code=pressKey("w"), hide=STPeq("state",1)}), - newSwitch({name="slide", x=240,y=420,w=60, font=40,disp=STPval("slide"), code=pressKey("e"), hide=STPeq("state",1)}), - newSwitch({name="pathVis", x=240,y=510,w=60, font=40,disp=STPval("pathVis"), code=pressKey("r"), hide=function()return sceneTemp.state==1 or not sceneTemp.slide end}), - newSwitch({name="revKB", x=240,y=600,w=60, font=40,disp=STPval("revKB"), code=pressKey("t"), hide=STPeq("state",1)}), - newButton({name="back", x=1140,y=640,w=170,h=80, font=40,code=BACK}), + newSlider({name="color", x=110,y=250,w=170,unit=4,show=false,font=30,disp=STPval("color"), code=function(v)if sceneTemp.state~=1 then sceneTemp.color=v end end,hide=STPeq("state",1)}), + newSwitch({name="blind", x=240,y=330,w=60, font=40,disp=STPval("blind"), code=pressKey("w"), hide=STPeq("state",1)}), + newSwitch({name="slide", x=240,y=420,w=60, font=40,disp=STPval("slide"), code=pressKey("e"), hide=STPeq("state",1)}), + newSwitch({name="pathVis", x=240,y=510,w=60, font=40,disp=STPval("pathVis"), code=pressKey("r"), hide=function()return sceneTemp.state==1 or not sceneTemp.slide end}), + newSwitch({name="revKB", x=240,y=600,w=60, font=40,disp=STPval("revKB"), code=pressKey("t"), hide=STPeq("state",1)}), + newButton({name="back", x=1140,y=640,w=170,h=80, font=40,code=BACK}), }, schulte_G={ - newButton({name="reset", x=160,y=100,w=180,h=100,color="lGreen", font=40,code=pressKey("space"),hide=function()return sceneTemp.state==0 end}), - newSlider({name="rank", x=130,y=250,w=150,unit=3,show=false, font=40,disp=function()return sceneTemp.rank-3 end, code=function(v)sceneTemp.rank=v+3 end,hide=function()return sceneTemp.state>0 end}), - newSwitch({name="blind", x=240,y=330,w=60, font=40,disp=STPval("blind"), code=pressKey("q"),hide=STPeq("state",1)}), - newSwitch({name="disappear",x=240,y=420,w=60, font=40,disp=STPval("disappear"), code=pressKey("w"),hide=STPeq("state",1)}), - newSwitch({name="tapFX", x=240,y=510,w=60, font=40,disp=STPval("tapFX"), code=pressKey("e"),hide=STPeq("state",1)}), - newButton({name="back", x=1140,y=640,w=170,h=80, font=40,code=BACK}), + newButton({name="reset", x=160,y=100,w=180,h=100,color="lGreen",font=40,code=pressKey("space"),hide=function()return sceneTemp.state==0 end}), + newSlider({name="rank", x=130,y=250,w=150,unit=3,show=false,font=40,disp=function()return sceneTemp.rank-3 end,code=function(v)sceneTemp.rank=v+3 end,hide=function()return sceneTemp.state>0 end}), + newSwitch({name="blind", x=240,y=330,w=60, font=40,disp=STPval("blind"), code=pressKey("q"),hide=STPeq("state",1)}), + newSwitch({name="disappear",x=240,y=420,w=60, font=40,disp=STPval("disappear"),code=pressKey("w"),hide=STPeq("state",1)}), + newSwitch({name="tapFX", x=240,y=510,w=60, font=40,disp=STPval("tapFX"), code=pressKey("e"),hide=STPeq("state",1)}), + newButton({name="back", x=1140,y=640,w=170,h=80, font=40,code=BACK}), }, pong={ newKey({name="reset", x=640,y=45,w=150,h=50, font=35,code=pressKey("r")}), diff --git a/main.lua b/main.lua index 42302237..08b96ff9 100644 --- a/main.lua +++ b/main.lua @@ -9,7 +9,7 @@ ]]-- --? -function NULL()end +NULL=function()end DBP=print--use this if need debugging print SYSTEM=love.system.getOS() MARKING=true @@ -157,7 +157,7 @@ if fs.getInfo("tech_ultimate+.dat")then fs.remove("tech_ultimate+.dat")end do local R=modeRanks R.sprint_10=R.sprint_10 or 0 - for k,v in next,R do + for k,_ in next,R do if type(k)=="number"then R[k]=nil end diff --git a/modes/GM.lua b/modes/GM.lua index f17d5556..961b5a11 100644 --- a/modes/GM.lua +++ b/modes/GM.lua @@ -1,7 +1,6 @@ -local int,max,min=math.floor,math.max,math.min +local int,min=math.floor,math.min local sectionName={"M7","M8","M9","M","MK","MV","MO","MM","GM"} local function score(P) - local F=false --If Less then MM if P.modeData.point<70 then local R=#P.clearedRow diff --git a/modes/attacker_hard.lua b/modes/attacker_hard.lua index 0c285490..daf59e22 100644 --- a/modes/attacker_hard.lua +++ b/modes/attacker_hard.lua @@ -1,4 +1,3 @@ -local int=math.floor return{ color=color.magenta, env={ diff --git a/modes/attacker_ultimate.lua b/modes/attacker_ultimate.lua index c72fa940..dfbc3e53 100644 --- a/modes/attacker_ultimate.lua +++ b/modes/attacker_ultimate.lua @@ -1,4 +1,4 @@ -local int,min=math.floor,math.min +local min=math.min return{ color=color.lYellow, env={ diff --git a/modes/bigbang.lua b/modes/bigbang.lua index 14ff286f..a8c83c05 100644 --- a/modes/bigbang.lua +++ b/modes/bigbang.lua @@ -1,11 +1,4 @@ local format=string.format -local function getField() - local F={} - return F -end -local function newField(P) - -end return{ color=color.lGrey, env={ diff --git a/modes/c4wtrain_lunatic.lua b/modes/c4wtrain_lunatic.lua index 7be567ab..6ca6f687 100644 --- a/modes/c4wtrain_lunatic.lua +++ b/modes/c4wtrain_lunatic.lua @@ -3,7 +3,7 @@ local function check_c4w(P) if #P.clearedRow==0 then P:lose() else - for i=1,#P.clearedRow do + for _=1,#P.clearedRow do P.field[#P.field+1]=freeRow.get(13) P.visTime[#P.visTime+1]=freeRow.get(20) for i=4,7 do P.field[#P.field][i]=0 end diff --git a/modes/c4wtrain_normal.lua b/modes/c4wtrain_normal.lua index a7c5a87a..a673fbde 100644 --- a/modes/c4wtrain_normal.lua +++ b/modes/c4wtrain_normal.lua @@ -1,7 +1,7 @@ local min=math.min local function check_c4w(P) if #P.clearedRow>0 then - for i=1,#P.clearedRow do + for _=1,#P.clearedRow do P.field[#P.field+1]=freeRow.get(13) P.visTime[#P.visTime+1]=freeRow.get(20) for i=4,7 do P.field[#P.field][i]=0 end diff --git a/modes/custom_clear.lua b/modes/custom_clear.lua index 7719d7c4..4d3f76ee 100644 --- a/modes/custom_clear.lua +++ b/modes/custom_clear.lua @@ -1,4 +1,3 @@ -local gc=love.graphics local int=math.floor return{ color=color.white, diff --git a/modes/dig_100.lua b/modes/dig_100.lua index f752f964..7cf719f0 100644 --- a/modes/dig_100.lua +++ b/modes/dig_100.lua @@ -1,5 +1,5 @@ local function check_rise(P) - for i=1,math.min(8,100-P.stat.dig)-P.garbageBeneath do + for _=1,math.min(8,100-P.stat.dig)-P.garbageBeneath do P:garbageRise(13,1,P:RND(10)) end if P.stat.dig==100 then diff --git a/modes/dig_40.lua b/modes/dig_40.lua index a1661900..f2d8ff21 100644 --- a/modes/dig_40.lua +++ b/modes/dig_40.lua @@ -1,5 +1,5 @@ local function check_rise(P) - for i=1,math.min(8,40-P.stat.dig)-P.garbageBeneath do + for _=1,math.min(8,40-P.stat.dig)-P.garbageBeneath do P:garbageRise(13,1,P:RND(10)) end if P.stat.dig==40 then diff --git a/modes/dig_400.lua b/modes/dig_400.lua index 36627dba..a9271cd7 100644 --- a/modes/dig_400.lua +++ b/modes/dig_400.lua @@ -1,5 +1,5 @@ local function check_rise(P) - for i=1,math.min(8,400-P.stat.dig)-P.garbageBeneath do + for _=1,math.min(8,400-P.stat.dig)-P.garbageBeneath do P:garbageRise(13,1,P:RND(10)) end if P.stat.dig==400 then diff --git a/modes/drought_lunatic.lua b/modes/drought_lunatic.lua index c188616b..de31fe99 100644 --- a/modes/drought_lunatic.lua +++ b/modes/drought_lunatic.lua @@ -1,10 +1,10 @@ -local min,rem=math.min,table.remove +local min=math.min return{ color=color.red, env={ drop=20,lock=60, sequence=function(P) - for i=1,3 do P:getNext(7)end + for _=1,3 do P:getNext(7)end end, freshMethod=function(P) if not P.next[1] then @@ -34,7 +34,7 @@ return{ end if d<40 or P.stat.row>2*42 then A=#res+1 - for i=1,4 do + for _=1,4 do res[A]=1 res[A+1]=2 res[A+2]=6 diff --git a/modes/infinite_dig.lua b/modes/infinite_dig.lua index 52de300d..03e61832 100644 --- a/modes/infinite_dig.lua +++ b/modes/infinite_dig.lua @@ -9,7 +9,7 @@ local function check_rise(P) P:showTextF(text.great,0,-120,80,"fly",.8) end end - for i=1,8-L do + for _=1,8-L do P:garbageRise(13,1,P:RND(10)) end else @@ -17,7 +17,7 @@ local function check_rise(P) P:showTextF(text.awesome,0,-120,80,"beat",.6) SFX.play("clear") BG.send(26) - for i=1,8 do + for _=1,8 do P:garbageRise(13,1,P:RND(10)) end else diff --git a/modes/pcchallenge_hard.lua b/modes/pcchallenge_hard.lua index 0fbfa9f0..6c795e9d 100644 --- a/modes/pcchallenge_hard.lua +++ b/modes/pcchallenge_hard.lua @@ -1,4 +1,3 @@ -local gc=love.graphics return{ color=color.magenta, env={ diff --git a/modes/pcchallenge_lunatic.lua b/modes/pcchallenge_lunatic.lua index 45521c87..a5034a1d 100644 --- a/modes/pcchallenge_lunatic.lua +++ b/modes/pcchallenge_lunatic.lua @@ -1,4 +1,3 @@ -local gc=love.graphics return{ color=color.red, env={ diff --git a/modes/pcchallenge_normal.lua b/modes/pcchallenge_normal.lua index b1c6ac8e..305731c0 100644 --- a/modes/pcchallenge_normal.lua +++ b/modes/pcchallenge_normal.lua @@ -1,4 +1,3 @@ -local gc=love.graphics return{ color=color.green, env={ diff --git a/modes/pctrain_lunatic.lua b/modes/pctrain_lunatic.lua index d4543744..11c5d3a6 100644 --- a/modes/pctrain_lunatic.lua +++ b/modes/pctrain_lunatic.lua @@ -1,5 +1,4 @@ local int=math.floor -local ins=table.insert local pc_drop={50,45,40,35,30,26,22,18,15,12} local pc_lock={55,50,45,40,36,32,30} local pc_fall={18,16,14,12,10,9,8,7,6} diff --git a/modes/techmino49_easy.lua b/modes/techmino49_easy.lua index 3e327914..44c7fc52 100644 --- a/modes/techmino49_easy.lua +++ b/modes/techmino49_easy.lua @@ -1,5 +1,5 @@ local gc=love.graphics -local int,rnd=math.floor,math.random +local rnd=math.random local powerUp={[0]="000%UP","025%UP","050%UP","075%UP","100%UP",} local function selectTarget(P) if SETTING.swap then diff --git a/modes/techmino49_hard.lua b/modes/techmino49_hard.lua index db70c343..14520e5b 100644 --- a/modes/techmino49_hard.lua +++ b/modes/techmino49_hard.lua @@ -1,5 +1,5 @@ local gc=love.graphics -local int,rnd=math.floor,math.random +local rnd=math.random local powerUp={[0]="000%UP","025%UP","050%UP","075%UP","100%UP",} local function selectTarget(P) if SETTING.swap then diff --git a/modes/techmino49_ultimate.lua b/modes/techmino49_ultimate.lua index 6ade5e5b..b790bac2 100644 --- a/modes/techmino49_ultimate.lua +++ b/modes/techmino49_ultimate.lua @@ -1,5 +1,5 @@ local gc=love.graphics -local int,rnd=math.floor,math.random +local rnd=math.random local powerUp={[0]="000%UP","025%UP","050%UP","075%UP","100%UP",} local function selectTarget(P) if SETTING.swap then diff --git a/modes/techmino99_easy.lua b/modes/techmino99_easy.lua index d9254268..f7ababaf 100644 --- a/modes/techmino99_easy.lua +++ b/modes/techmino99_easy.lua @@ -1,5 +1,5 @@ local gc=love.graphics -local int,rnd=math.floor,math.random +local rnd=math.random local powerUp={[0]="000%UP","025%UP","050%UP","075%UP","100%UP",} local function selectTarget(P) if SETTING.swap then diff --git a/modes/techmino99_hard.lua b/modes/techmino99_hard.lua index 2e282f94..90efbd5f 100644 --- a/modes/techmino99_hard.lua +++ b/modes/techmino99_hard.lua @@ -1,5 +1,5 @@ local gc=love.graphics -local int,rnd=math.floor,math.random +local rnd=math.random local powerUp={[0]="000%UP","025%UP","050%UP","075%UP","100%UP",} local function selectTarget(P) if SETTING.swap then diff --git a/modes/techmino99_ultimate.lua b/modes/techmino99_ultimate.lua index bdbe0d34..d62d8c7d 100644 --- a/modes/techmino99_ultimate.lua +++ b/modes/techmino99_ultimate.lua @@ -1,5 +1,5 @@ local gc=love.graphics -local int,rnd=math.floor,math.random +local rnd=math.random local powerUp={[0]="000%UP","025%UP","050%UP","075%UP","100%UP",} local function selectTarget(P) if SETTING.swap then diff --git a/parts/ai.lua b/parts/ai.lua index fba2f87b..aaebf958 100644 --- a/parts/ai.lua +++ b/parts/ai.lua @@ -87,15 +87,6 @@ if CC then end -------------------------------------------------9 Stack setup local dirCount={1,1,3,3,3,0,1} -local spinOffset={ - {[0]=0,1,0,0},--Z - {[0]=0,1,0,0},--L - {[0]=0,1,0,0},--J - {[0]=0,1,0,0},--T - {[0]=0,1,0,0},--S - {[0]=0,0,0,0},--O - {[0]=0,2,0,1},--I -} local FCL={ [1]={ {{11},{11,2},{1},{},{2},{2,2},{12,1},{12}}, @@ -281,7 +272,7 @@ return{ return 1 end, }, - ["CC"]={ + ["CC"]=CC and{ [0]=NULL, function(P)--Start thinking if not pcall(CC.think,P.AI_bot)then diff --git a/parts/gametoolfunc.lua b/parts/gametoolfunc.lua index d6ab4d6f..37978457 100644 --- a/parts/gametoolfunc.lua +++ b/parts/gametoolfunc.lua @@ -1,8 +1,7 @@ -local tm,gc=love.timer,love.graphics -local kb,data=love.keyboard,love.data -local int,abs,rnd=math.floor,math.abs,math.random -local max,min=math.max,math.min -local sub,find=string.sub,string.find +local tm=love.timer +local data=love.data +local int,rnd=math.floor,math.random +local sub=string.sub local char,byte=string.char,string.byte local ins,rem=table.insert,table.remove @@ -108,24 +107,24 @@ function copySequence() return str end function pasteSequence(str) - local _ + local b local bag={} local reg for i=1,#str do - _=byte(str,i) + b=byte(str,i) if not reg then - if _>=97 and _<=125 then - reg=_-96 + if b>=97 and b<=125 then + reg=b-96 else return end else - if _>=97 and _<=125 then + if b>=97 and b<=125 then ins(bag,reg) - reg=_-96 - elseif _>=34 and _<=96 then - for i=1,_-32 do + reg=b-96 + elseif b>=34 and b<=96 then + for _=1,b-32 do ins(bag,reg) end reg=nil @@ -251,27 +250,27 @@ function copyMission() return str end function pasteMission(str) - local _ + local b local mission={} local reg for i=1,#str do - _=byte(str,i) + b=byte(str,i) if not reg then - if _>=34 and _<=114 then - reg=_-33 + if b>=34 and b<=114 then + reg=b-33 else return end else - if _>=34 and _<=114 then + if b>=34 and b<=114 then if missionEnum[reg]then ins(mission,reg) - reg=_-33 + reg=b-33 else return end - elseif _>=115 and _<=126 then - for i=1,_-113 do + elseif b>=115 and b<=126 then + for _=1,b-113 do ins(mission,reg) end reg=nil diff --git a/parts/getTip.lua b/parts/getTip.lua index 66f2505a..70b797ee 100644 --- a/parts/getTip.lua +++ b/parts/getTip.lua @@ -231,7 +231,7 @@ elseif SETTING.lang==3 then elseif SETTING.lang==4 then L={'!','@','#','$','%','^','&','*','(',')','-','=','_','+','[',']','{','}','\\','|',';',':','\'','"',',','<','.','>','/','?'} local s="" - for i=1,math.random(16,26)do + for _=1,math.random(16,26)do s=s..L[math.random(#L)] end return s diff --git a/parts/kickList.lua b/parts/kickList.lua index a0b44495..059b0204 100644 --- a/parts/kickList.lua +++ b/parts/kickList.lua @@ -26,7 +26,7 @@ local function flipList(O)--Use this to copy a symmetry list end return L end -local function reflect(a,b) +local function reflect(a) local b={} b[03]=flipList(a[01]) b[01]=flipList(a[03]) diff --git a/parts/player.lua b/parts/player.lua index bc42fad7..327235cd 100644 --- a/parts/player.lua +++ b/parts/player.lua @@ -2,7 +2,7 @@ local gc=love.graphics local mt=love.math local Timer=love.timer.getTime 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 max,min,abs,sin=math.max,math.min,math.abs,math.sin local ins,rem=table.insert,table.remove local format=string.format local SCR=SCR @@ -67,7 +67,7 @@ local PLY={}--Lib ---------------------------------------------------- ---------------------------------------------------- -local function updateLine(P,dt)--Attacks, line pushing, cam moving +local function updateLine(P)--Attacks, line pushing, cam moving local bf=P.atkBuffer for i=#bf,1,-1 do local A=bf[i] @@ -96,7 +96,7 @@ local function updateLine(P,dt)--Attacks, line pushing, cam moving y=30*max(min(#P.field-19.5-P.fieldBeneath/30,P.imgY-17),0) end if f~=y then - P.fieldUp=f>y and max(f*.95+y*.05-2,y)or ceil(f*.97+y*.03+1,y) + P.fieldUp=f>y and max(f*.95+y*.05-2,y)or min(f*.97+y*.03+1,y) end end end @@ -329,7 +329,7 @@ local function Pupdate_alive(P,dt) D=1/D--Fall dist if D>P.curY-P.imgY then D=P.curY-P.imgY end if P.gameEnv.moveFX and P.gameEnv.block then - for i=1,D do + for _=1,D do P:createMoveFX("down") P.curY=P.curY-1 end @@ -368,7 +368,7 @@ local function Pupdate_alive(P,dt) if P.finesseComboTime>0 then P.finesseComboTime=P.finesseComboTime-1 end - updateLine(P,dt) + updateLine(P) updateFXs(P,dt) updateTasks(P) end @@ -396,7 +396,7 @@ local function Pupdate_dead(P,dt) if P.finesseComboTime>0 then P.finesseComboTime=P.finesseComboTime-1 end - updateLine(P,dt) + updateLine(P) updateFXs(P,dt) updateTasks(P) end @@ -722,10 +722,10 @@ local Pdraw_norm do if P.lockDelay>=0 then gc.rectangle("fill",0,602,300*P.lockDelay/ENV.lock,6)--Lock delay indicator end - _=3 - for i=1,min(ENV.freshLimit-P.freshTime,15)do - gc.rectangle("fill",_,615,14,5) - _=_+20 + local x=3 + for _=1,min(ENV.freshLimit-P.freshTime,15)do + gc.rectangle("fill",x,615,14,5) + x=x+20 end --Draw Hold @@ -1129,7 +1129,6 @@ end local function loadGameEnv(P)--Load gameEnv P.gameEnv={}--Current game setting environment local ENV=P.gameEnv - local E --Load game settings for k,v in next,gameEnv0 do if modeEnv[k]~=nil then @@ -1567,7 +1566,7 @@ function player.createBeam(P,R,send,time,target,color,clear,combo) end else if combo>3 then - radius=min(15+combo,30) + radius=min(15+combo,30)+time*.1 corner=3 else radius=30 @@ -1577,7 +1576,7 @@ function player.createBeam(P,R,send,time,target,color,clear,combo) g=1-g*.3 b=1-b*.3 end - if modeEnv.royaleMode and not(P.human or R.human)then + if modeEnv.royaleMode and not P.human and not R.human then radius=radius*.4 a=.35 end @@ -2198,7 +2197,7 @@ do--player.drop(P)--Place piece else _=#P.lockFX if _>0 then - for i=1,_ do + for _=1,_ do rem(P.lockFX) end end @@ -2223,7 +2222,7 @@ do--player.drop(P)--Place piece finesse=true elseif CY<=18 then local y0=CY - local x,c=CX,P.c + local c=P.c local B=CB.bk for x=1,c do local y @@ -2970,7 +2969,7 @@ end function player.act.func(P) P.gameEnv.Fkey(P) end -function player.act.restart(P) +function player.act.restart() if GAME.frame<240 or GAME.result then resetPartGameData() else @@ -3170,7 +3169,7 @@ function PLY.newDemoPlayer(id,x,y,size) P:popNext() end -function PLY.newRemotePlayer(id,x,y,size,actions) +function PLY.newRemotePlayer(id,x,y,size) local P=newEmptyPlayer(id,x,y,size) P.human=false diff --git a/parts/scenes.lua b/parts/scenes.lua index c8f47e3d..87efa7d2 100644 --- a/parts/scenes.lua +++ b/parts/scenes.lua @@ -5,12 +5,12 @@ local Timer=love.timer.getTime local setFont=setFont local mStr=mStr -local int,ceil,abs=math.floor,math.ceil,math.abs +local int,abs=math.floor,math.abs local max,min,sin,cos=math.max,math.min,math.sin,math.cos local log,rnd=math.log,math.random 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 find,sub,byte=string.find,string.sub,string.byte local SCR=SCR @@ -187,7 +187,7 @@ do--load SCN.back() end end - function touchDown.load(id,x,y) + function touchDown.load() if #tc.getTouches()==2 then sceneTemp.skip=true end @@ -285,7 +285,7 @@ do--intro end end - function mouseDown.intro(x,y,k) + function mouseDown.intro(_,_,k) if k==2 then VOC.play("bye") SCN.back() @@ -312,7 +312,7 @@ do--intro end end end - function touchDown.intro(id,x,y) + function touchDown.intro() mouseDown.intro() end function keyDown.intro(key) @@ -457,7 +457,7 @@ do--mode end end end - function wheelMoved.mode(x,y) + function wheelMoved.mode(_,y) local cam=mapCam local t=cam.k local k=t+y*.1 @@ -475,7 +475,7 @@ do--mode cam.k=k cam.keyCtrl=false end - function mouseMove.mode(x,y,dx,dy) + function mouseMove.mode(_,_,dx,dy) if ms.isDown(1)then mapCam.x,mapCam.y=mapCam.x-dx,mapCam.y-dy end @@ -504,10 +504,10 @@ do--mode end cam.keyCtrl=false end - function touchDown.mode(id,x,y) + function touchDown.mode() touchDist=nil end - function touchMove.mode(id,x,y,dx,dy) + function touchMove.mode(_,x,y,dx,dy) local L=tc.getTouches() if not L[2]then mapCam.x,mapCam.y=mapCam.x-dx,mapCam.y-dy @@ -544,7 +544,7 @@ do--mode end end - function Tmr.mode(dt) + function Tmr.mode() local cam=mapCam local x,y,k=cam.x,cam.y,cam.k local F @@ -708,7 +708,6 @@ do--mode gc.pop() if sel then local M=Modes[sel] - local lang=SETTING.lang gc.setColor(.7,.7,.7,.5) gc.rectangle("fill",920,0,360,720)--Info board gc.setColor(M.color) @@ -910,7 +909,7 @@ do--custom_sequence S.cur=p end elseif key=="ten"then - for i=1,10 do + for _=1,10 do local p=S.cur if p==#BAG then break end repeat @@ -928,7 +927,7 @@ do--custom_sequence end elseif key=="delete"then if S.sure>20 then - for i=1,#BAG do + for _=1,#BAG do rem(BAG) end S.cur=0 @@ -1052,10 +1051,10 @@ do--custom_field z=0,x=-1, } local FIELD=FIELD - function mouseDown.custom_field(x,y,k) + function mouseDown.custom_field(x,y) mouseMove.custom_field(x,y) end - function mouseMove.custom_field(x,y,dx,dy) + function mouseMove.custom_field(x,y) local sx,sy=int((x-200)/30)+1,20-int((y-60)/30) if sx<1 or sx>10 then sx=nil end if sy<1 or sy>20 then sy=nil end @@ -1064,7 +1063,7 @@ do--custom_field 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) + function wheelMoved.custom_field(_,y) local pen=sceneTemp.pen if y<0 then pen=pen+1 @@ -1075,10 +1074,10 @@ do--custom_field end sceneTemp.pen=pen end - function touchDown.custom_field(id,x,y) + function touchDown.custom_field(_,x,y) mouseMove.custom_field(x,y) end - function touchMove.custom_field(id,x,y,dx,dy) + function touchMove.custom_field(_,x,y) local sx,sy=int((x-200)/30)+1,20-int((y-60)/30) if sx<1 or sx>10 then sx=nil end if sy<1 or sy>20 then sy=nil end @@ -1251,7 +1250,7 @@ do--custom_mission S.cur=p end elseif key=="ten"then - for i=1,10 do + for _=1,10 do local p=S.cur if p==#MISSION then break end repeat @@ -1269,7 +1268,7 @@ do--custom_mission end elseif key=="delete"then if S.sure>20 then - for i=1,#MISSION do + for _=1,#MISSION do rem(MISSION) end S.cur=0 @@ -1421,7 +1420,7 @@ do--play BG.set(modeEnv.bg) end - function touchDown.play(id,x,y) + function touchDown.play(_,x,y) if not SETTING.VKSwitch or GAME.replaying then return end local t=onVirtualkey(x,y) @@ -1454,7 +1453,7 @@ do--play VIB(SETTING.VKVIB) end end - function touchUp.play(id,x,y) + function touchUp.play(_,x,y) if not SETTING.VKSwitch or GAME.replaying then return end local t=onVirtualkey(x,y) @@ -1462,7 +1461,7 @@ do--play PLAYERS[1]:releaseKey(t) end end - function touchMove.play(id,x,y,dx,dy) + function touchMove.play() if not SETTING.VKSwitch or GAME.replaying then return end local l=tc.getTouches() @@ -2017,7 +2016,7 @@ do--setting_sound FILE.saveSetting() end - function mouseDown.setting_sound(x,y,k) + function mouseDown.setting_sound(x,y) local S=sceneTemp if x>780 and x<980 and y>470 and S.jump==0 then S.jump=10 @@ -2028,7 +2027,7 @@ do--setting_sound end end end - function touchDown.setting_sound(id,x,y) + function touchDown.setting_sound(_,x,y) mouseDown.setting_sound(x,y) end @@ -2310,30 +2309,30 @@ do--setting_touch if k==2 then SCN.back()end sceneTemp.sel=onVK_org(x,y)or sceneTemp.sel end - function mouseMove.setting_touch(x,y,dx,dy) + function mouseMove.setting_touch(_,_,dx,dy) if sceneTemp.sel and ms.isDown(1)and not WIDGET.sel then local B=VK_org[sceneTemp.sel] B.x,B.y=B.x+dx,B.y+dy end end - function mouseUp.setting_touch(x,y,k) + function mouseUp.setting_touch() if sceneTemp.sel then local B=VK_org[sceneTemp.sel] local k=snapLevelValue[sceneTemp.snap] B.x,B.y=int(B.x/k+.5)*k,int(B.y/k+.5)*k end end - function touchDown.setting_touch(id,x,y) + function touchDown.setting_touch(_,x,y) sceneTemp.sel=onVK_org(x,y)or sceneTemp.sel end - function touchUp.setting_touch(id,x,y) + function touchUp.setting_touch() if sceneTemp.sel then local B=VK_org[sceneTemp.sel] local k=snapLevelValue[sceneTemp.snap] B.x,B.y=int(B.x/k+.5)*k,int(B.y/k+.5)*k end end - function touchMove.setting_touch(id,x,y,dx,dy) + function touchMove.setting_touch(_,_,_,dx,dy) if sceneTemp.sel and not WIDGET.sel then local B=VK_org[sceneTemp.sel] B.x,B.y=B.x+dx,B.y+dy @@ -2404,7 +2403,7 @@ do--music end end - function wheelMoved.music(x,y) + function wheelMoved.music(_,y) wheelScroll(y) end function keyDown.music(key) @@ -2508,7 +2507,7 @@ do--dict local function clearResult() local S=sceneTemp local result=S.result - for i=1,#result do rem(result)end + for _=1,#result do rem(result)end S.select,S.scroll,S.lastSearch=1,0 end local function search() @@ -2768,16 +2767,8 @@ do--stat end end do--login - function Pnt.login() - local S=sceneTemp - - end end do--account - function Pnt.account() - local S=sceneTemp - - end end do--minigame function sceneInit.minigame() @@ -2951,7 +2942,7 @@ do--p15 SCN.back() end end - function mouseDown.p15(x,y,k) + function mouseDown.p15(x,y) tapBoard(x,y) end function mouseMove.p15(x,y) @@ -2959,10 +2950,10 @@ do--p15 tapBoard(x,y) end end - function touchDown.p15(id,x,y) + function touchDown.p15(_,x,y) tapBoard(x,y) end - function touchMove.p15(id,x,y,dx,dy) + function touchMove.p15(_,x,y) if sceneTemp.slide then tapBoard(x,y) end @@ -3157,10 +3148,10 @@ do--schulte_G end end - function mouseDown.schulte_G(x,y,k) + function mouseDown.schulte_G(x,y) tapBoard(x,y) end - function touchDown.schulte_G(id,x,y) + function touchDown.schulte_G(_,x,y) tapBoard(x,y) end function keyDown.schulte_G(key) @@ -3312,7 +3303,7 @@ do--pong start() end end - function touchMove.pong(id,x,y,dx,dy) + function touchMove.pong(_,x,y) sceneTemp[x<640 and"p1"or"p2"].y0=y end function mouseMove.pong(x,y) @@ -3438,7 +3429,7 @@ do--history end end - function wheelMoved.history(x,y) + function wheelMoved.history(_,y) wheelScroll(y) end function keyDown.history(key) diff --git a/parts/texture.lua b/parts/texture.lua index 12546787..09422ef3 100644 --- a/parts/texture.lua +++ b/parts/texture.lua @@ -5,7 +5,6 @@ local function C(x,y) gc.setCanvas(_) return _ end -local c local TEXTURE={} gc.setDefaultFilter("nearest","nearest")