diff --git a/Zframework/bgm.lua b/Zframework/bgm.lua index e8bddb11..3cf5eb29 100644 --- a/Zframework/bgm.lua +++ b/Zframework/bgm.lua @@ -25,7 +25,7 @@ function BGM.init(list) local count=#simpList function BGM.getCount()return count end - local function load(name) + local function _load(name) if type(Sources[name])=='string'then if love.filesystem.getInfo(Sources[name])then Sources[name]=love.audio.newSource(Sources[name],'stream') @@ -41,8 +41,8 @@ function BGM.init(list) MES.new('warn',"No BGM: "..name,5) end end - function BGM.loadAll()for name in next,Sources do load(name)end end - local function fadeOut(src) + function BGM.loadAll()for name in next,Sources do _load(name)end end + local function task_fadeOut(src) while true do coroutine.yield() local v=src:getVolume()-.025*SETTING.bgm @@ -53,7 +53,7 @@ function BGM.init(list) end end end - local function fadeIn(src) + local function task_fadeIn(src) while true do coroutine.yield() local v=SETTING.bgm @@ -64,12 +64,12 @@ function BGM.init(list) end end end - local function removeCurFadeOut(task,code,src) + local function check_curFadeOut(task,code,src) return task.code==code and task.args[1]==src end function BGM.play(name) if not name then name=BGM.default end - if not load(name)then return end + if not _load(name)then return end if SETTING.bgm==0 then BGM.nowPlay=name BGM.playing=Sources[name] @@ -77,11 +77,11 @@ function BGM.init(list) end if name and Sources[name]then if BGM.nowPlay~=name then - if BGM.nowPlay then TASK.new(fadeOut,BGM.playing)end - TASK.removeTask_iterate(removeCurFadeOut,fadeOut,Sources[name]) - TASK.removeTask_code(fadeIn) + if BGM.nowPlay then TASK.new(task_fadeOut,BGM.playing)end + TASK.removeTask_iterate(check_curFadeOut,task_fadeOut,Sources[name]) + TASK.removeTask_code(task_fadeIn) - TASK.new(fadeIn,Sources[name]) + TASK.new(task_fadeIn,Sources[name]) BGM.nowPlay=name BGM.playing=Sources[name] BGM.playing:play() @@ -101,8 +101,8 @@ function BGM.init(list) end end function BGM.stop() - TASK.removeTask_code(fadeIn) - if BGM.nowPlay then TASK.new(fadeOut,BGM.playing)end + TASK.removeTask_code(task_fadeIn) + if BGM.nowPlay then TASK.new(task_fadeOut,BGM.playing)end BGM.nowPlay,BGM.playing=nil end end diff --git a/Zframework/languages.lua b/Zframework/languages.lua index 95b7ee56..411d3692 100644 --- a/Zframework/languages.lua +++ b/Zframework/languages.lua @@ -1,10 +1,10 @@ local LANG={} function LANG.init(langList,publicText)--Attention, calling this will destory all initializing methods, create a LANG.set()! - local function langFallback(T0,T) + local function _langFallback(T0,T) for k,v in next,T0 do if type(v)=='table'and not v.refuseCopy then--refuseCopy: just copy pointer, not contents if not T[k]then T[k]={}end - if type(T[k])=='table'then langFallback(v,T[k])end + if type(T[k])=='table'then _langFallback(v,T[k])end elseif not T[k]then T[k]=v end @@ -22,7 +22,7 @@ function LANG.init(langList,publicText)--Attention, calling this will destory al --Fallback to other language, default zh if i>1 then - langFallback(langList[L.fallback or 1],L) + _langFallback(langList[L.fallback or 1],L) end --Metatable:__call for table:getTip diff --git a/Zframework/sysFX.lua b/Zframework/sysFX.lua index 7e0616d6..b547ef98 100644 --- a/Zframework/sysFX.lua +++ b/Zframework/sysFX.lua @@ -9,7 +9,7 @@ local ins,rem=table.insert,table.remove local fx={} -local function normUpdate(S,dt) +local function _normUpdate(S,dt) S.t=S.t+dt*S.rate return S.t>1 end @@ -28,11 +28,11 @@ function FXupdate.badge(S,dt) end return S.t>=1 end -FXupdate.attack=normUpdate -FXupdate.tap=normUpdate -FXupdate.ripple=normUpdate -FXupdate.rectRipple=normUpdate -FXupdate.shade=normUpdate +FXupdate.attack=_normUpdate +FXupdate.tap=_normUpdate +FXupdate.ripple=_normUpdate +FXupdate.rectRipple=_normUpdate +FXupdate.shade=_normUpdate function FXupdate.cell(S,dt) if S.vx then S.x=S.x+S.vx*S.rate @@ -45,7 +45,7 @@ function FXupdate.cell(S,dt) S.t=S.t+dt*S.rate return S.t>1 end -FXupdate.line=normUpdate +FXupdate.line=_normUpdate local FXdraw={} function FXdraw.badge(S) diff --git a/Zframework/voice.lua b/Zframework/voice.lua index 0736e8a5..cbcbbf62 100644 --- a/Zframework/voice.lua +++ b/Zframework/voice.lua @@ -15,7 +15,7 @@ function VOC.init(list) local Source={} local count=#list function VOC.getCount()return count end - local function loadVoiceFile(N,vocName) + local function _loadVoiceFile(N,vocName) local fileName='media/VOICE/'..SETTING.cv..'/'..vocName..'.ogg' if love.filesystem.getInfo(fileName)then bank[vocName]={love.audio.newSource(fileName,'stream')} @@ -23,7 +23,7 @@ function VOC.init(list) return true end end - local function getVoice(str) + local function _getVoice(str) local L=bank[str] local n=1 while L[n]:isPlaying()do @@ -42,10 +42,10 @@ function VOC.init(list) Source[list[i]]={} local n=0 - repeat n=n+1 until not loadVoiceFile(list[i],list[i]..'_'..n) + repeat n=n+1 until not _loadVoiceFile(list[i],list[i]..'_'..n) if n==1 then - if not loadVoiceFile(list[i],list[i])then + if not _loadVoiceFile(list[i],list[i])then MES.new('warn',"No VOICE file: "..list[i],.1) end end @@ -87,13 +87,13 @@ function VOC.init(list) rem(voiceQueue,i) end elseif Q.s==1 then--Waiting load source - Q[1]=getVoice(Q[1]) + Q[1]=_getVoice(Q[1]) 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]=_getVoice(Q[2]) Q[2]:setVolume(SETTING.voc) Q[2]:play() Q.s=3 diff --git a/Zframework/widget.lua b/Zframework/widget.lua index 3119c677..aa85c5b0 100644 --- a/Zframework/widget.lua +++ b/Zframework/widget.lua @@ -40,7 +40,7 @@ local largerThen=GC.DO{20,20, } local STW,STH--stencil-wid/hei -local function rectangleStencil() +local function _rectangleStencil() gc.rectangle('fill',1,1,STW-2,STH-2) end @@ -1026,7 +1026,7 @@ function textBox:draw() gc_setStencilTest('equal',1) STW,STH=w,h - gc_stencil(rectangleStencil) + gc_stencil(_rectangleStencil) gc_translate(0,-(scrollPos%lineH)) local pos=int(scrollPos/lineH) for i=pos+1,min(pos+cap+1,#texts)do @@ -1186,7 +1186,7 @@ function listBox:draw() --List gc_setStencilTest('equal',1) STW,STH=w,h - gc_stencil(rectangleStencil) + gc_stencil(_rectangleStencil) local pos=int(scrollPos/lineH) gc_translate(0,-(scrollPos%lineH)) for i=pos+1,min(pos+cap+1,#list)do diff --git a/parts/RSlist.lua b/parts/RSlist.lua index 613194f8..841467d9 100644 --- a/parts/RSlist.lua +++ b/parts/RSlist.lua @@ -45,7 +45,7 @@ local noKickSet,noKickSet_180 do noKickSet={[01]=Zero,[10]=Zero,[03]=Zero,[30]=Zero,[12]=Zero,[21]=Zero,[32]=Zero,[23]=Zero} noKickSet_180={[01]=Zero,[10]=Zero,[03]=Zero,[30]=Zero,[12]=Zero,[21]=Zero,[32]=Zero,[23]=Zero,[02]=Zero,[20]=Zero,[13]=Zero,[31]=Zero} end -local function strToVec(list) +local function _strToVec(list) for i,vecStr in next,list do list[i]={tonumber(vecStr:sub(1,2)),tonumber(vecStr:sub(3,4))} end @@ -53,14 +53,14 @@ local function strToVec(list) end --Use this if the block is centrosymmetry, *PTR!!! -local function centroSymSet(L) +local function _centroSymSet(L) L[23]=L[01]L[32]=L[10] L[21]=L[03]L[12]=L[30] L[20]=L[02]L[31]=L[13] end --Use this to copy a symmetry set -local function flipList(O) +local function _flipList(O) if not O then return end local L={} for i,s in next,O do @@ -69,20 +69,20 @@ local function flipList(O) return L end -local function reflect(a) +local function _reflect(a) return{ - [03]=flipList(a[01]), - [01]=flipList(a[03]), - [30]=flipList(a[10]), - [32]=flipList(a[12]), - [23]=flipList(a[21]), - [21]=flipList(a[23]), - [10]=flipList(a[30]), - [12]=flipList(a[32]), - [02]=flipList(a[02]), - [20]=flipList(a[20]), - [31]=flipList(a[13]), - [13]=flipList(a[31]), + [03]=_flipList(a[01]), + [01]=_flipList(a[03]), + [30]=_flipList(a[10]), + [32]=_flipList(a[12]), + [23]=_flipList(a[21]), + [21]=_flipList(a[23]), + [10]=_flipList(a[30]), + [12]=_flipList(a[32]), + [02]=_flipList(a[02]), + [20]=_flipList(a[20]), + [31]=_flipList(a[13]), + [13]=_flipList(a[31]), } end @@ -422,16 +422,16 @@ do } TRS.centerDisp[6]=false TRS.centerDisp[18]=false - TRS.kickTable[2]= reflect(TRS.kickTable[1])--SZ - TRS.kickTable[4]= reflect(TRS.kickTable[3])--LJ - TRS.kickTable[9]= reflect(TRS.kickTable[8])--S5Z5 - TRS.kickTable[11]=reflect(TRS.kickTable[10])--PQ - TRS.kickTable[13]=reflect(TRS.kickTable[12])--FE - TRS.kickTable[20]=reflect(TRS.kickTable[19])--L5J5 - TRS.kickTable[22]=reflect(TRS.kickTable[21])--RY - TRS.kickTable[24]=reflect(TRS.kickTable[23])--NH - centroSymSet(TRS.kickTable[8])centroSymSet(TRS.kickTable[9])--S5Z5 - centroSymSet(TRS.kickTable[25])centroSymSet(TRS.kickTable[26])--I5I3 + TRS.kickTable[2]= _reflect(TRS.kickTable[1])--SZ + TRS.kickTable[4]= _reflect(TRS.kickTable[3])--LJ + TRS.kickTable[9]= _reflect(TRS.kickTable[8])--S5Z5 + TRS.kickTable[11]=_reflect(TRS.kickTable[10])--PQ + TRS.kickTable[13]=_reflect(TRS.kickTable[12])--FE + TRS.kickTable[20]=_reflect(TRS.kickTable[19])--L5J5 + TRS.kickTable[22]=_reflect(TRS.kickTable[21])--RY + TRS.kickTable[24]=_reflect(TRS.kickTable[23])--NH + _centroSymSet(TRS.kickTable[8])_centroSymSet(TRS.kickTable[9])--S5Z5 + _centroSymSet(TRS.kickTable[25])_centroSymSet(TRS.kickTable[26])--I5I3 end local SRS @@ -574,9 +574,9 @@ end local BiRS do - local R=strToVec{'+0+0','-1+0','-1-1','+0-1','-1+1','+1-1','+1+0','+0+1','+1+1','+0+2','-1+2','+1+2','-2+0','+2+0'} - local L=strToVec{'+0+0','+1+0','+1-1','+0-1','+1+1','-1-1','-1+0','+0+1','-1+1','+0+2','+1+2','-1+2','+2+0','-2+0'} - local F=strToVec{'+0+0','+0-1','+0+1','+0+2'} + local R=_strToVec{'+0+0','-1+0','-1-1','+0-1','-1+1','+1-1','+1+0','+0+1','+1+1','+0+2','-1+2','+1+2','-2+0','+2+0'} + local L=_strToVec{'+0+0','+1+0','+1-1','+0-1','+1+1','-1-1','-1+0','+0+1','-1+1','+0+2','+1+2','-1+2','+2+0','-2+0'} + local F=_strToVec{'+0+0','+0-1','+0+1','+0+2'} local list={ {[02]=L,[20]=R,[13]=R,[31]=L},--Z {[02]=R,[20]=L,[13]=L,[31]=R},--S @@ -756,7 +756,7 @@ end local ASC do local L={'+0+0','+1+0','+0-1','+1-1','+0-2','+1-2','+2+0','+2-1','+2-2','-1+0','-1-1','+0+1','+1+1','+2+1','-1-2','-2+0','+0+2','+1+2','+2+2','-2-1','-2-2'} - local R=flipList(L) + local R=_flipList(L) local F={'+0+0'} local centerPos=TABLE.copy(defaultCenterPos) centerPos[6]={[0]={0,0},{1,0},{1,1},{0,1}} @@ -784,7 +784,7 @@ end local ASC_plus do local L={'+0+0','+1+0','+0-1','+1-1','+0-2','+1-2','+2+0','+2-1','+2-2','-1+0','-1-1','+0+1','+1+1','+2+1','-1-2','-2+0','+0+2','+1+2','+2+2','-2-1','-2-2'} - local R=flipList(L) + local R=_flipList(L) local F={'+0+0','-1+0','+1+0','+0-1','-1-1','+1-1','+0-2','-1-2','+1-2','-2+0','+2+0','-2-1','+2-1','-2+1','+2+1','+0+2','-1+2','+1+2'} local centerPos=TABLE.copy(defaultCenterPos) centerPos[6]={[0]={0,0},{1,0},{1,1},{0,1}} @@ -836,7 +836,7 @@ do [12]=R,[21]=L,[32]=L,[23]=R, [02]=R,[20]=L,[13]=L,[31]=R, } - local S=reflect(Z) + local S=_reflect(Z) C2_sym={ centerTex=GC.DO{10,10, @@ -946,7 +946,7 @@ for _,rs in next,RSlist do if type(set)=='table'then for _,list in next,set do if type(list[1])=='string'then - strToVec(list) + _strToVec(list) end end end diff --git a/parts/bot/bot_9s.lua b/parts/bot/bot_9s.lua index faf553d5..8ae6d1ff 100644 --- a/parts/bot/bot_9s.lua +++ b/parts/bot/bot_9s.lua @@ -37,14 +37,14 @@ local FCL={ }FCL[2],FCL[4],FCL[5]=FCL[1],FCL[3],FCL[3] local LclearScore={[0]=0,-200,-150,-100,200} local HclearScore={[0]=0,100,140,200,500} -local function ifoverlapAI(f,bk,x,y) +local function _ifoverlapAI(f,bk,x,y) for i=1,#bk do for j=1,#bk[1]do if f[y+i-1]and bk[i][j]and f[y+i-1][x+j-1]>0 then return true end end end end local discardRow=FREEROW.discard local getRow=FREEROW.get -local function resetField(f0,f,start) +local function _resetField(f0,f,start) for _=#f,start,-1 do discardRow(f[_]) f[_]=nil @@ -56,7 +56,7 @@ local function resetField(f0,f,start) end end end -local function getScore(field,cb,cy) +local function _getScore(field,cb,cy) local score=0 local highest=0 local height=getRow(0) @@ -151,7 +151,7 @@ function bot_9s.thread(bot) local cy=#Tfield+1 --Move to bottom - while cy>1 and not ifoverlapAI(Tfield,cb,cx,cy-1)do + while cy>1 and not _ifoverlapAI(Tfield,cb,cx,cy-1)do cy=cy-1 end @@ -166,11 +166,11 @@ function bot_9s.thread(bot) end end end - local score=getScore(Tfield,cb,cy) + local score=_getScore(Tfield,cb,cy) if score>best.score then best={bn=bn,x=cx,dir=dir,hold=ifhold==1,score=score} end - resetField(field_org,Tfield,cy) + _resetField(field_org,Tfield,cy) end end end diff --git a/parts/bot/init.lua b/parts/bot/init.lua index d73ccc71..f106c15a 100644 --- a/parts/bot/init.lua +++ b/parts/bot/init.lua @@ -26,12 +26,12 @@ function baseBot.update(bot) end end -local function undefMethod(self,k) +local function _undefMethod(self,k) print("Undefined method: "..k) self[k]=NULL return NULL end -local botMeta={__index=undefMethod} +local botMeta={__index=_undefMethod} local BOT={} diff --git a/parts/data.lua b/parts/data.lua index d7a78b32..4e22ed83 100644 --- a/parts/data.lua +++ b/parts/data.lua @@ -335,7 +335,7 @@ function DATA.pumpRecording(str,L) end do--function DATA.saveReplay() local noRecList={"custom","solo","round","techmino"} - local function getModList() + local function _getModList() local res={} for _,v in next,GAME.mod do if v.sel>0 then @@ -365,7 +365,7 @@ do--function DATA.saveReplay() player=USERS.getUsername(USER.uid), seed=GAME.seed, setting=GAME.setting, - mod=getModList(), + mod=_getModList(), tasUsed=GAME.tasUsed, }.."\n".. DATA.dumpRecording(GAME.rep) diff --git a/parts/gametoolfunc.lua b/parts/gametoolfunc.lua index f0925d67..8451220d 100644 --- a/parts/gametoolfunc.lua +++ b/parts/gametoolfunc.lua @@ -445,7 +445,7 @@ do--function dumpBasicConfig() end end do--function resetGameData(args) - local function tick_showMods() + local function task_showMods() local time=0 while true do YIELD() @@ -473,7 +473,7 @@ do--function resetGameData(args) 'lockFX','dropFX','moveFX','clearFX','splashFX','shakeFX','atkFX', 'text','score','warn','highCam','nextPos', } - local function copyGameSetting() + local function _copyGameSetting() local S={} for _,key in next,gameSetting do if type(SETTING[key])=='table'then @@ -502,7 +502,7 @@ do--function resetGameData(args) GAME.pauseTime=0 GAME.pauseCount=0 GAME.saved=false - GAME.setting=copyGameSetting() + GAME.setting=_copyGameSetting() GAME.tasUsed=false GAME.rep={} GAME.recording=true @@ -554,9 +554,9 @@ do--function resetGameData(args) GAME.stage=1 end FREEROW.reset(30*#PLAYERS) - TASK.removeTask_code(tick_showMods) + TASK.removeTask_code(task_showMods) if GAME.setting.allowMod then - TASK.new(tick_showMods) + TASK.new(task_showMods) end SFX.play('ready') collectgarbage() diff --git a/parts/globalTables.lua b/parts/globalTables.lua index b183a8cd..d5d9b734 100644 --- a/parts/globalTables.lua +++ b/parts/globalTables.lua @@ -1,5 +1,5 @@ --Complex tables -local function disableKey(P,key) +local function _disableKey(P,key) table.insert(P.gameEnv.keyCancel,key) end MODOPT={--Mod options @@ -107,19 +107,19 @@ MODOPT={--Mod options {no=17,id="FX",name="noRotation", key="x",x=320,y=470,color='lH', func=function(P) - disableKey(P,3) - disableKey(P,4) - disableKey(P,5) + _disableKey(P,3) + _disableKey(P,4) + _disableKey(P,5) end, unranked=true, }, {no=18,id="GL",name="noMove", key="c",x=440,y=470,color='lH', func=function(P) - disableKey(P,1)disableKey(P,2) - disableKey(P,11)disableKey(P,12) - disableKey(P,17)disableKey(P,18) - disableKey(P,19)disableKey(P,20) + _disableKey(P,1)_disableKey(P,2) + _disableKey(P,11)_disableKey(P,12) + _disableKey(P,17)_disableKey(P,18) + _disableKey(P,19)_disableKey(P,20) end, unranked=true, }, diff --git a/parts/list.lua b/parts/list.lua index 4581b244..0096910e 100644 --- a/parts/list.lua +++ b/parts/list.lua @@ -220,7 +220,7 @@ do--BLOCKS --Dot {{O}}, --O1 } - local function RotCW(B) + local function _RotCW(B) local N={} local r,c=#B,#B[1]--row,col for x=1,c do @@ -235,7 +235,7 @@ do--BLOCKS local B=BLOCKS[i] BLOCKS[i]={[0]=B} for j=1,3 do - B=RotCW(B) + B=_RotCW(B) BLOCKS[i][j]=B end end diff --git a/parts/netPlayer.lua b/parts/netPlayer.lua index 06c3f264..c42178af 100644 --- a/parts/netPlayer.lua +++ b/parts/netPlayer.lua @@ -82,7 +82,7 @@ local nullIndex={ end } local PLYlist,PLYmap=setmetatable({},nullIndex),setmetatable({},nullIndex) -local function freshPos() +local function _freshPos() table.sort(PLYlist,_placeSort) if #PLYlist<=5 then posList=posLists[1] @@ -99,7 +99,7 @@ end netPLY={ list=PLYlist, map=PLYmap, - freshPos=freshPos, + freshPos=_freshPos, } function netPLY.clear() @@ -122,14 +122,14 @@ function netPLY.add(d) ins(PLYlist,p) PLYmap[p.uid]=p - freshPos() + _freshPos() end function netPLY.remove(sid) for i=1,#PLYlist do if PLYlist[i].sid==sid then PLYmap[PLYlist[i].uid]=nil rem(PLYlist,i) - freshPos() + _freshPos() break end end @@ -205,7 +205,7 @@ function netPLY.update() end local stencilW,stencilH -local function plyStencil() +local function _playerFrameStencil() gc_rectangle('fill',0,0,stencilW,stencilH) end function netPLY.draw() @@ -229,7 +229,7 @@ function netPLY.draw() --Stencil stencilW,stencilH=p.w,p.h gc_setStencilTest('equal',1) - gc_stencil(plyStencil) + gc_stencil(_playerFrameStencil) gc_setColor(1,1,1) --Avatar diff --git a/parts/player/draw.lua b/parts/player/draw.lua index 801e2ccb..12cf869e 100644 --- a/parts/player/draw.lua +++ b/parts/player/draw.lua @@ -60,7 +60,7 @@ local gridLines do end local LDmarks=gc.newSpriteBatch(GC.DO{14,5,{'fRect',0,0,14,5,3}},15,'static') for i=0,14 do LDmarks:add(3+20*i,615)end -local function boardTransform(mode) +local function _boardTransform(mode) if mode then if mode=="U-D"then gc_translate(0,590) @@ -74,8 +74,8 @@ local function boardTransform(mode) end end end -local function stencilBoard()gc_rectangle('fill',0,-10,300,610)end -local function applyField(P) +local function _stencilBoard()gc_rectangle('fill',0,-10,300,610)end +local function _applyField(P) gc_push('transform') --Apply fieldOffset @@ -90,21 +90,21 @@ local function applyField(P) end --Apply stencil - gc_stencil(stencilBoard) + gc_stencil(_stencilBoard) gc_setStencilTest('equal',1) --Move camera gc_push('transform') - boardTransform(P.gameEnv.flipBoard) + _boardTransform(P.gameEnv.flipBoard) gc_translate(0,P.fieldBeneath+P.fieldUp) end -local function cancelField() +local function _cancelField() gc_setStencilTest() gc_pop() gc_pop() end -local function drawRow(texture,h,V,L,showInvis) +local function _drawRow(texture,h,V,L,showInvis) local t=TIME()*4 for i=1,10 do if L[i]>0 then @@ -118,7 +118,7 @@ local function drawRow(texture,h,V,L,showInvis) end end end -local function drawField(P,showInvis) +local function _drawField(P,showInvis) local ENV=P.gameEnv local V,F=P.visTime,P.field local start=int((P.fieldBeneath+P.fieldUp)/30+1) @@ -128,14 +128,14 @@ local function drawField(P,showInvis) gc_setShader(shader_lighter) gc_translate(0,-4) -- - for j=start,min(start+21,#F)do drawRow(texture,j,V[j],F[j])end + for j=start,min(start+21,#F)do _drawRow(texture,j,V[j],F[j])end -- gc_setShader(shader_fieldSatur) gc_translate(0,4) end -- - for j=start,min(start+21,#F)do drawRow(texture,j,V[j],F[j],showInvis)end + for j=start,min(start+21,#F)do _drawRow(texture,j,V[j],F[j],showInvis)end -- else--With falling animation local stepY=ENV.smooth and(P.falling/(ENV.fall+1))^1.6*30 or 30 @@ -151,7 +151,7 @@ local function drawField(P,showInvis) h=h+1 gc_translate(0,-stepY) end - drawRow(texture,j,V[j],F[j]) + _drawRow(texture,j,V[j],F[j]) end -- gc_setShader(shader_fieldSatur) @@ -168,14 +168,14 @@ local function drawField(P,showInvis) gc_setColor(1,1,1,alpha) gc_rectangle('fill',0,30-30*j,300,stepY) end - drawRow(texture,j,V[j],F[j],showInvis) + _drawRow(texture,j,V[j],F[j],showInvis) end -- gc_pop() end gc_setShader() end -local function drawFXs(P) +local function _drawFXs(P) --LockFX for i=1,#P.lockFX do local S=P.lockFX[i] @@ -268,7 +268,7 @@ local drawGhost={ end end end, } -local function drawBlockOutline(CB,curX,curY,texture,trans) +local function _drawBlockOutline(CB,curX,curY,texture,trans) shader_alpha:send('a',trans) gc_setShader(shader_alpha) for i=1,#CB do for j=1,#CB[1]do @@ -283,7 +283,7 @@ local function drawBlockOutline(CB,curX,curY,texture,trans) end end gc_setShader() end -local function drawBlockShade(CB,curX,curY,alpha) +local function _drawBlockShade(CB,curX,curY,alpha) gc_setColor(1,1,1,alpha) for i=1,#CB do for j=1,#CB[1]do if CB[i][j]then @@ -291,7 +291,7 @@ local function drawBlockShade(CB,curX,curY,alpha) end end end end -local function drawBlock(CB,curX,curY,texture) +local function _drawBlock(CB,curX,curY,texture) gc_setColor(1,1,1) gc_setShader(shader_blockSatur) for i=1,#CB do for j=1,#CB[1]do @@ -301,7 +301,7 @@ local function drawBlock(CB,curX,curY,texture) end end gc_setShader() end -local function drawNextPreview(B,fieldH,fieldBeneath) +local function _drawNextPreview(B,fieldH,fieldBeneath) gc_setColor(1,1,1,.8) local y=int(fieldH+1-modf(B.rs.centerPos[B.id][B.dir][1]))+ceil(fieldBeneath/30) B=B.bk @@ -313,7 +313,7 @@ local function drawNextPreview(B,fieldH,fieldBeneath) end end end end -local function drawBuffer(atkBuffer,bufferWarn,atkBufferSum1,atkBufferSum) +local function _drawBuffer(atkBuffer,bufferWarn,atkBufferSum1,atkBufferSum) local h=0 for i=1,#atkBuffer do local A=atkBuffer[i] @@ -368,7 +368,7 @@ local function drawBuffer(atkBuffer,bufferWarn,atkBufferSum1,atkBufferSum) end end end -local function drawB2Bbar(b2b,b2b1) +local function _drawB2Bbar(b2b,b2b1) local a,b=b2b,b2b1 if a>b then a,b=b,a end if b>0 then @@ -382,7 +382,7 @@ local function drawB2Bbar(b2b,b2b1) end end end -local function drawLDI(easyFresh,length,freshTime)--Lock Delay Indicator +local function _drawLDI(easyFresh,length,freshTime)--Lock Delay Indicator if easyFresh then gc_setColor(.97,.97,.97) else @@ -396,7 +396,7 @@ local function drawLDI(easyFresh,length,freshTime)--Lock Delay Indicator gc_draw(LDmarks) end end -local function drawHold(holdQueue,holdCount,holdTime,skinLib) +local function _drawHold(holdQueue,holdCount,holdTime,skinLib) local N=holdCount*72 gc_push('transform') gc_translate(12,20) @@ -425,7 +425,7 @@ local function drawHold(holdQueue,holdCount,holdTime,skinLib) gc_pop() gc_pop() end -local function drawDial(x,y,speed) +local function _drawDial(x,y,speed) gc_setColor(1,1,1,.7) gc_draw(dialFrame,x,y) gc_setColor(1,1,1,.3) @@ -433,7 +433,7 @@ local function drawDial(x,y,speed) gc_setColor(.9,.9,.91) setFont(30)mStr(int(speed),x+40,y+19) end -local function drawFinesseCombo_norm(P) +local function _drawFinesseCombo_norm(P) if P.finesseCombo>2 then local S=P.stat local t=P.finesseComboTime @@ -454,7 +454,7 @@ local function drawFinesseCombo_norm(P) gc_print(str,20,600,nil,1+t*.08,nil,0,30) end end -local function drawFinesseCombo_remote(P) +local function _drawFinesseCombo_remote(P) if P.finesseCombo>2 then local S=P.stat if S.finesseRate==5*S.piece then @@ -467,7 +467,7 @@ local function drawFinesseCombo_remote(P) gc_print(P.finesseCombo.."x",20,570) end end -local function drawLife(life) +local function _drawLife(life) gc_setColor(.97,.97,.97) gc_draw(IMG.lifeIcon,475,595,nil,.8) if life>3 then @@ -478,7 +478,7 @@ local function drawLife(life) if life>2 then gc_draw(IMG.lifeIcon,525,595,nil,.8)end end end -local function drawMission(curMission,L,missionkill) +local function _drawMission(curMission,L,missionkill) --Draw current mission setFont(35) if missionkill then @@ -500,7 +500,7 @@ local function drawMission(curMission,L,missionkill) end end end -local function drawStartCounter(time) +local function _drawStartCounter(time) time=179-time gc_push('transform') gc_translate(300,300) @@ -524,8 +524,8 @@ end local draw={} draw.drawGhost=drawGhost -draw.applyField=applyField -draw.cancelField=cancelField +draw.applyField=_applyField +draw.cancelField=_cancelField function draw.drawNext_norm(P,repMode) local ENV=P.gameEnv local texture=P.skinLib @@ -653,11 +653,11 @@ function draw.drawTargetLine(P,r) if r<=20+(P.fieldBeneath+P.fieldUp+10)/30 and r>0 then gc_setLineWidth(3) gc_setColor(1,r>10 and 0 or .2+.8*rnd(),.5) - applyField(P) + _applyField(P) r=600-30*r if P.falling~=-1 then r=r-#P.clearingRow*(P.gameEnv.smooth and(P.falling/(P.gameEnv.fall+1))^1.6*30 or 30)end gc_line(0,r,300,r) - cancelField() + _cancelField() end end function draw.drawProgress(s1,s2) @@ -699,13 +699,13 @@ function draw.norm(P,repMode) --Draw HUD P:drawNext(repMode) - if P.curMission then drawMission(P.curMission,ENV.mission,ENV.missionKill)end - if ENV.holdCount>0 then drawHold(P.holdQueue,ENV.holdCount,P.holdTime,P.skinLib)end - drawDial(499,505,P.dropSpeed) - if P.life>0 then drawLife(P.life)end + if P.curMission then _drawMission(P.curMission,ENV.mission,ENV.missionKill)end + if ENV.holdCount>0 then _drawHold(P.holdQueue,ENV.holdCount,P.holdTime,P.skinLib)end + _drawDial(499,505,P.dropSpeed) + if P.life>0 then _drawLife(P.life)end --Field-related things - applyField(P) + _applyField(P) --Fill field gc_setColor(0,0,0,.6) gc_rectangle('fill',0,-10-camDY,300,610) @@ -727,7 +727,7 @@ function draw.norm(P,repMode) end --Draw field - drawField(P,repMode) + _drawField(P,repMode) --Draw line number if ENV.fieldH>20 and ENV.lineNum then @@ -756,7 +756,7 @@ function draw.norm(P,repMode) gc_rectangle('fill',0,-ENV.heightLimit*30-FBN-2,300,4) --Draw FXs - drawFXs(P) + _drawFXs(P) --Draw current block if P.cur and P.waiting==-1 then @@ -783,21 +783,21 @@ function draw.norm(P,repMode) gc_translate(0,-dy) --Draw block & rotation center if ENV.block then - drawBlockOutline(P.cur.bk,P.curX,P.curY,P.skinLib[curColor],trans) - drawBlock(P.cur.bk,P.curX,P.curY,P.skinLib[curColor]) + _drawBlockOutline(P.cur.bk,P.curX,P.curY,P.skinLib[curColor],trans) + _drawBlock(P.cur.bk,P.curX,P.curY,P.skinLib[curColor]) if centerDisp then gc_setColor(1,1,1,ENV.center) gc_draw(C.rs.centerTex,centerX,-30*(P.curY+centerPos[1])+10) end elseif repMode then - drawBlockShade(P.cur.bk,P.curX,P.curY,trans*.3) + _drawBlockShade(P.cur.bk,P.curX,P.curY,trans*.3) end gc_translate(0,dy) end --Draw next preview if ENV.nextPos and P.nextQueue[1]then - drawNextPreview(P.nextQueue[1],ENV.fieldH,P.fieldBeneath) + _drawNextPreview(P.nextQueue[1],ENV.fieldH,P.fieldBeneath) end --Draw AI's drop destination @@ -833,9 +833,9 @@ function draw.norm(P,repMode) --Draw Frame and buffers gc_setColor(P.frameColor) gc_draw(playerBoarder,-17,-12) - drawBuffer(P.atkBuffer,ENV.bufferWarn,P.atkBufferSum1,P.atkBufferSum) - drawB2Bbar(P.b2b,P.b2b1) - drawLDI(ENV.easyFresh,P.lockDelay/ENV.lock,P.freshTime) + _drawBuffer(P.atkBuffer,ENV.bufferWarn,P.atkBufferSum1,P.atkBufferSum) + _drawB2Bbar(P.b2b,P.b2b1) + _drawLDI(ENV.easyFresh,P.lockDelay/ENV.lock,P.freshTime) --Draw target selecting pad if GAME.modeEnv.royaleMode then @@ -888,7 +888,7 @@ function draw.norm(P,repMode) gc_print(tm,20,540) --FinesseCombo - ;(P.type=='remote'and drawFinesseCombo_remote or drawFinesseCombo_norm)(P) + ;(P.type=='remote'and _drawFinesseCombo_remote or _drawFinesseCombo_norm)(P) --Mode informations if GAME.curMode.mesDisp then @@ -896,7 +896,7 @@ function draw.norm(P,repMode) GAME.curMode.mesDisp(P,repMode) end - if P.frameRun<180 then drawStartCounter(P.frameRun)end + if P.frameRun<180 then _drawStartCounter(P.frameRun)end gc_pop() end function draw.small(P) @@ -963,21 +963,21 @@ function draw.demo(P) gc_scale(P.size) gc_translate(-150,0) - applyField(P) + _applyField(P) gc_setStencilTest() gc_setColor(0,0,0,.6) gc_rectangle('fill',0,0,300,600,3) gc_push('transform') gc_translate(0,600) - drawField(P) - drawFXs(P) + _drawField(P) + _drawFXs(P) if P.cur and P.waiting==-1 then if ENV.ghost then drawGhost[ENV.ghostType](P.cur.bk,P.curX,P.ghoY,ENV.ghost,P.skinLib,curColor)end if ENV.block then local dy=ENV.smooth and P.ghoY~=P.curY and(P.dropDelay/ENV.drop-1)*30 or 0 gc_translate(0,-dy) - drawBlockOutline(P.cur.bk,P.curX,P.curY,P.skinLib[curColor],P.lockDelay/ENV.lock) - drawBlock(P.cur.bk,P.curX,P.curY,P.skinLib[curColor]) + _drawBlockOutline(P.cur.bk,P.curX,P.curY,P.skinLib[curColor],P.lockDelay/ENV.lock) + _drawBlock(P.cur.bk,P.curX,P.curY,P.skinLib[curColor]) gc_translate(0,dy) end end diff --git a/parts/player/init.lua b/parts/player/init.lua index 9e84e282..5b84d343 100644 --- a/parts/player/init.lua +++ b/parts/player/init.lua @@ -17,7 +17,7 @@ local modeDataMeta do __newindex=function(self,k,v)rawset(self,k,v)end, } end -local function getNewStatTable() +local function _getNewStatTable() local T={ time=0,frame=0,score=0, key=0,rotate=0,hold=0, @@ -37,17 +37,17 @@ local function getNewStatTable() end return T end -local function pressKey(P,keyID) +local function _pressKey(P,keyID) if P.keyAvailable[keyID]and P.alive then P.keyPressing[keyID]=true P.actList[keyID](P) P.stat.key=P.stat.key+1 end end -local function releaseKey(P,keyID) +local function _releaseKey(P,keyID) P.keyPressing[keyID]=false end -local function pressKey_Rec(P,keyID) +local function _pressKey_Rec(P,keyID) if P.keyAvailable[keyID]and P.alive then local L=GAME.rep ins(L,P.frameRun) @@ -57,13 +57,13 @@ local function pressKey_Rec(P,keyID) P.stat.key=P.stat.key+1 end end -local function releaseKey_Rec(P,keyID) +local function _releaseKey_Rec(P,keyID) local L=GAME.rep ins(L,P.frameRun) ins(L,32+keyID) P.keyPressing[keyID]=false end -local function newEmptyPlayer(id,mini) +local function _newEmptyPlayer(id,mini) local P={id=id} PLAYERS[id]=P PLY_ALIVE[id]=P @@ -73,11 +73,11 @@ local function newEmptyPlayer(id,mini) --Set key/timer event if P.id==1 and GAME.recording then - P.pressKey=pressKey_Rec - P.releaseKey=releaseKey_Rec + P.pressKey=_pressKey_Rec + P.releaseKey=_releaseKey_Rec else - P.pressKey=pressKey - P.releaseKey=releaseKey + P.pressKey=_pressKey + P.releaseKey=_releaseKey end P.update=ply_update.alive @@ -112,7 +112,7 @@ local function newEmptyPlayer(id,mini) P.control=false P.timing=false P.result=false--String: 'finish'|'win'|'lose' - P.stat=getNewStatTable() + P.stat=_getNewStatTable() P.modeData=setmetatable({},modeDataMeta)--Data use by mode P.keyPressing={}for i=1,12 do P.keyPressing[i]=false end P.clearingRow,P.clearedRow={},{}--Clearing animation height,cleared row mark @@ -208,7 +208,7 @@ local function newEmptyPlayer(id,mini) } return P end -local function loadGameEnv(P)--Load gameEnv +local function _loadGameEnv(P)--Load gameEnv P.gameEnv={}--Current game setting environment local ENV=P.gameEnv local GAME,SETTING=GAME,SETTING @@ -238,7 +238,7 @@ local function loadGameEnv(P)--Load gameEnv end end end -local function loadRemoteEnv(P,confStr)--Load gameEnv +local function _loadRemoteEnv(P,confStr)--Load gameEnv confStr=JSON.decode(confStr) if not confStr then confStr={} @@ -264,7 +264,7 @@ local function loadRemoteEnv(P,confStr)--Load gameEnv end end end -local function applyGameEnv(P)--Finish gameEnv processing +local function _applyGameEnv(P)--Finish gameEnv processing local ENV=P.gameEnv P._20G=ENV.drop==0 @@ -364,7 +364,7 @@ local DemoEnv={ fine=false, } function PLY.newDemoPlayer(id) - local P=newEmptyPlayer(id) + local P=_newEmptyPlayer(id) P.type='computer' P.sound=true P.demo=true @@ -373,8 +373,8 @@ function PLY.newDemoPlayer(id) P.draw=ply_draw.demo P.control=true GAME.modeEnv=DemoEnv - loadGameEnv(P) - applyGameEnv(P) + _loadGameEnv(P) + _applyGameEnv(P) P:loadAI{ type='CC', next=5, @@ -386,7 +386,7 @@ function PLY.newDemoPlayer(id) P:popNext() end function PLY.newRemotePlayer(id,mini,ply) - local P=newEmptyPlayer(id,mini) + local P=_newEmptyPlayer(id,mini) P.type='remote' P.update=ply_update.remote_alive @@ -400,30 +400,30 @@ function PLY.newRemotePlayer(id,mini,ply) P.username=ply.username P.sid=ply.sid - loadRemoteEnv(P,ply.config) - applyGameEnv(P) + _loadRemoteEnv(P,ply.config) + _applyGameEnv(P) end function PLY.newAIPlayer(id,AIdata,mini) - local P=newEmptyPlayer(id,mini) + local P=_newEmptyPlayer(id,mini) P.type='computer' - loadGameEnv(P) + _loadGameEnv(P) local ENV=P.gameEnv ENV.face={0,0,0,0,0,0,0} ENV.skin={1,7,11,3,14,4,9} - applyGameEnv(P) + _applyGameEnv(P) P:loadAI(AIdata) end function PLY.newPlayer(id,mini) - local P=newEmptyPlayer(id,mini) + local P=_newEmptyPlayer(id,mini) P.type='human' P.sound=true P.uid=USER.uid P.username=USERS.getUsername(USER.uid) - loadGameEnv(P) - applyGameEnv(P) + _loadGameEnv(P) + _applyGameEnv(P) end ---------------------------------------------------- return PLY \ No newline at end of file diff --git a/parts/player/player.lua b/parts/player/player.lua index 0b649ceb..70d796d1 100644 --- a/parts/player/player.lua +++ b/parts/player/player.lua @@ -218,11 +218,11 @@ do--function Player:movePosition(x,y,size) end end end - local function checkPlayer(obj,Ptar) + local function check_player(obj,Ptar) return obj.args[1]==Ptar end function Player:movePosition(x,y,size) - TASK.removeTask_iterate(checkPlayer,self) + TASK.removeTask_iterate(check_player,self) TASK.new(task_movePosition,self,x,y,size or self.size) end end @@ -1539,7 +1539,7 @@ end ---------------------------------------------------- ---------------------------------------------------- -local function tick_throwBadge(ifAI,sender,time) +local function task_throwBadge(ifAI,sender,time) while true do yield() time=time-1 @@ -1567,7 +1567,7 @@ local function tick_throwBadge(ifAI,sender,time) if time<=0 then return end end end -local function tick_finish(self) +local function task_finish(self) while true do yield() self.endCounter=self.endCounter+1 @@ -1581,7 +1581,7 @@ local function tick_finish(self) end end end -local function tick_lose(self) +local function task_lose(self) while true do yield() self.endCounter=self.endCounter+1 @@ -1613,7 +1613,7 @@ local function tick_lose(self) end end end -local function tick_autoPause() +local function task_autoPause() local time=0 while true do yield() @@ -1705,9 +1705,9 @@ function Player:win(result) end if self.type=='human'then gameOver() - TASK.new(tick_autoPause) + TASK.new(task_autoPause) end - self:newTask(tick_finish) + self:newTask(task_finish) end function Player:lose(force) if self.result then return end @@ -1740,7 +1740,7 @@ function Player:lose(force) end self.lastRecv=A if self.id==1 or A.id==1 then - TASK.new(tick_throwBadge,not A.type=='human',self,max(3,self.badge)*4) + TASK.new(task_throwBadge,not A.type=='human',self,max(3,self.badge)*4) end end else @@ -1764,14 +1764,14 @@ function Player:lose(force) BGM.play('end') end gameOver() - self:newTask(#PLAYERS>1 and tick_lose or tick_finish) + self:newTask(#PLAYERS>1 and task_lose or task_finish) if GAME.net and not NET.spectate then NET.signal_die() else - TASK.new(tick_autoPause) + TASK.new(task_autoPause) end else - self:newTask(tick_lose) + self:newTask(task_lose) end if #PLY_ALIVE==1 then PLY_ALIVE[1]:win() diff --git a/parts/player/seqGenerators.lua b/parts/player/seqGenerators.lua index e80713c6..cefdc0aa 100644 --- a/parts/player/seqGenerators.lua +++ b/parts/player/seqGenerators.lua @@ -53,7 +53,7 @@ local seqGenerators={ local poolLen=5*len local droughtTimes=TABLE.new(len,len)--Drought times of seq0 local pool={}for i=1,len do for _=1,5 do ins(pool,i)end end--5 times indexes of seq0 - local function poolPick() + local function _poolPick() local r=rndGen:random(poolLen) local res=pool[r] @@ -87,7 +87,7 @@ local seqGenerators={ --Pick a mino from pool local tryTime=0 ::REPEAT_pickAgain:: - local r=poolPick()--Random mino-index in pool + local r=_poolPick()--Random mino-index in pool for i=1,len do if r==history[i]then tryTime=tryTime+1 diff --git a/parts/player/update.lua b/parts/player/update.lua index 26709795..fbdb34ac 100644 --- a/parts/player/update.lua +++ b/parts/player/update.lua @@ -6,7 +6,7 @@ local assert,resume,status=assert,coroutine.resume,coroutine.status local TEXT,GAME=TEXT,GAME local PLY_ALIVE=PLY_ALIVE -local function update_misc(P,dt) +local function _updateMisc(P,dt) --Finesse combo animation if P.finesseComboTime>0 then P.finesseComboTime=P.finesseComboTime-1 @@ -363,7 +363,7 @@ function update.alive(P,dt) end --Others - update_misc(P,dt) + _updateMisc(P,dt) -- P:setPosition(640-150-(30*(P.curX+P.cur.sc[2])-15),30*(P.curY+P.cur.sc[1])+15-300+(ENV.smooth and P.ghoY~=P.curY and(P.dropDelay/ENV.drop-1)*30 or 0)) end function update.dead(P,dt) @@ -387,7 +387,7 @@ function update.dead(P,dt) if P.b2b1>0 then P.b2b1=max(0,P.b2b1*.92-1) end - update_misc(P,dt) + _updateMisc(P,dt) end function update.remote_alive(P,dt) local frameRate=(P.stream[#P.stream-1]or 0)-P.frameRun diff --git a/parts/scenes/customGame.lua b/parts/scenes/customGame.lua index 9d3bf683..310ff32a 100644 --- a/parts/scenes/customGame.lua +++ b/parts/scenes/customGame.lua @@ -2,7 +2,7 @@ local gc,kb,sys=love.graphics,love.keyboard,love.system local int=math.floor local CUSTOMENV=CUSTOMENV -local function notAir(L) +local function _notAir(L) for i=1,10 do if L[i]>0 then return true @@ -29,10 +29,10 @@ local scene={} local sure local initField -local function freshMiniFieldVisible() +local function _freshMiniFieldVisible() initField=false for y=1,20 do - if notAir(FIELD[1][y])then + if _notAir(FIELD[1][y])then initField=true return end @@ -43,7 +43,7 @@ function scene.sceneInit() destroyPlayers() BG.set(CUSTOMENV.bg) BGM.play(CUSTOMENV.bgm) - freshMiniFieldVisible() + _freshMiniFieldVisible() end function scene.sceneBack() BGM.play() @@ -89,7 +89,7 @@ function scene.keyDown(key,isRep) if sure>.3 then TABLE.cut(FIELD)TABLE.cut(BAG)TABLE.cut(MISSION) FIELD[1]=DATA.newBoard() - freshMiniFieldVisible() + _freshMiniFieldVisible() TABLE.clear(CUSTOMENV) TABLE.complete(require"parts.customEnv0",CUSTOMENV) for _,W in next,scene.widgetList do W:reset()end @@ -127,7 +127,7 @@ function scene.keyDown(key,isRep) for i=4,#args do if args[i]:find("%S")and not DATA.pasteBoard(args[i],i-3)and i<#args then goto THROW_fail end end - freshMiniFieldVisible() + _freshMiniFieldVisible() MES.new('check',text.importSuccess) do return end ::THROW_fail::MES.new('error',text.dataCorrupted) diff --git a/parts/scenes/custom_field.lua b/parts/scenes/custom_field.lua index a5b65600..a9a26b19 100644 --- a/parts/scenes/custom_field.lua +++ b/parts/scenes/custom_field.lua @@ -53,7 +53,7 @@ local minoPosCode={ [3]=28,[33]=28,--I2 [1]=29,--O1 } -local function pTouch(x,y) +local function _pTouch(x,y) if not curPen then return end for i=1,#penPath do if x==penPath[i][1]and y==penPath[i][2]then @@ -69,7 +69,7 @@ local function pTouch(x,y) end ins(penPath,{x,y}) end -local function pDraw() +local function _pDraw() local l=#penPath if l==0 then return end @@ -125,7 +125,7 @@ function scene.mouseMove(x,y) local sx,sy=int((x-200)/30)+1,20-int((y-60)/30) if sx>=1 and sx<=10 and sy>=1 and sy<=20 then penX,penY=sx,sy - if curPen then pTouch(sx,sy)end + if curPen then _pTouch(sx,sy)end else penX,penY=nil end @@ -141,7 +141,7 @@ function scene.mouseDown(x,y,k) end function scene.mouseUp(_,_,k) if curPen==k then - pDraw() + _pDraw() curPen=false end end @@ -168,7 +168,7 @@ function scene.keyDown(key) elseif key=="space"then if penX and penY then curPen=1 - pTouch(penX,penY) + _pTouch(penX,penY) end elseif key=="delete"then if sure>.3 then @@ -250,7 +250,7 @@ function scene.keyDown(key) end function scene.keyUp(key) if key=="space"then - pDraw() + _pDraw() curPen=false end end @@ -439,41 +439,41 @@ function scene.draw() end end -local function setPen(i)return function(k)pens[k]=i end end +local function _setPen(i)return function(k)pens[k]=i end end scene.widgetList={ WIDGET.newText{name="title", x=1020,y=5,font=70,align='R'}, WIDGET.newText{name="subTitle", x=1030,y=50,font=35,align='L',color='H'}, - WIDGET.newButton{name="b1", x=580, y=130,w=75,fText="",color='R',code=setPen(1)},--B1 - WIDGET.newButton{name="b2", x=660, y=130,w=75,fText="",color='F',code=setPen(2)},--B2 - WIDGET.newButton{name="b3", x=740, y=130,w=75,fText="",color='O',code=setPen(3)},--B3 - WIDGET.newButton{name="b4", x=820, y=130,w=75,fText="",color='Y',code=setPen(4)},--B4 - WIDGET.newButton{name="b5", x=900, y=130,w=75,fText="",color='L',code=setPen(5)},--B5 - WIDGET.newButton{name="b6", x=980, y=130,w=75,fText="",color='J',code=setPen(6)},--B6 - WIDGET.newButton{name="b7", x=1060, y=130,w=75,fText="",color='G',code=setPen(7)},--B7 - WIDGET.newButton{name="b8", x=1140, y=130,w=75,fText="",color='A',code=setPen(8)},--B8 + WIDGET.newButton{name="b1", x=580, y=130,w=75,fText="",color='R',code=_setPen(1)},--B1 + WIDGET.newButton{name="b2", x=660, y=130,w=75,fText="",color='F',code=_setPen(2)},--B2 + WIDGET.newButton{name="b3", x=740, y=130,w=75,fText="",color='O',code=_setPen(3)},--B3 + WIDGET.newButton{name="b4", x=820, y=130,w=75,fText="",color='Y',code=_setPen(4)},--B4 + WIDGET.newButton{name="b5", x=900, y=130,w=75,fText="",color='L',code=_setPen(5)},--B5 + WIDGET.newButton{name="b6", x=980, y=130,w=75,fText="",color='J',code=_setPen(6)},--B6 + WIDGET.newButton{name="b7", x=1060, y=130,w=75,fText="",color='G',code=_setPen(7)},--B7 + WIDGET.newButton{name="b8", x=1140, y=130,w=75,fText="",color='A',code=_setPen(8)},--B8 - WIDGET.newButton{name="b9", x=580, y=210,w=75,fText="",color='C',code=setPen(9)},--B9 - WIDGET.newButton{name="b10", x=660, y=210,w=75,fText="",color='N',code=setPen(10)},--B10 - WIDGET.newButton{name="b11", x=740, y=210,w=75,fText="",color='S',code=setPen(11)},--B11 - WIDGET.newButton{name="b12", x=820, y=210,w=75,fText="",color='B',code=setPen(12)},--B12 - WIDGET.newButton{name="b13", x=900, y=210,w=75,fText="",color='V',code=setPen(13)},--B13 - WIDGET.newButton{name="b14", x=980, y=210,w=75,fText="",color='P',code=setPen(14)},--B14 - WIDGET.newButton{name="b15", x=1060, y=210,w=75,fText="",color='M',code=setPen(15)},--B15 - WIDGET.newButton{name="b16", x=1140, y=210,w=75,fText="",color='W',code=setPen(16)},--B16 + WIDGET.newButton{name="b9", x=580, y=210,w=75,fText="",color='C',code=_setPen(9)},--B9 + WIDGET.newButton{name="b10", x=660, y=210,w=75,fText="",color='N',code=_setPen(10)},--B10 + WIDGET.newButton{name="b11", x=740, y=210,w=75,fText="",color='S',code=_setPen(11)},--B11 + WIDGET.newButton{name="b12", x=820, y=210,w=75,fText="",color='B',code=_setPen(12)},--B12 + WIDGET.newButton{name="b13", x=900, y=210,w=75,fText="",color='V',code=_setPen(13)},--B13 + WIDGET.newButton{name="b14", x=980, y=210,w=75,fText="",color='P',code=_setPen(14)},--B14 + WIDGET.newButton{name="b15", x=1060, y=210,w=75,fText="",color='M',code=_setPen(15)},--B15 + WIDGET.newButton{name="b16", x=1140, y=210,w=75,fText="",color='W',code=_setPen(16)},--B16 - WIDGET.newButton{name="b17", x=580, y=290,w=75,fText="[ ]",color='dH', code=setPen(17)},--BONE - WIDGET.newButton{name="b18", x=660, y=290,w=75,fText="N", color='D', code=setPen(18)},--HIDE - WIDGET.newButton{name="b19", x=740, y=290,w=75,fText="B", color='lY', code=setPen(19)},--BOMB - WIDGET.newButton{name="b20", x=820, y=290,w=75,fText="_", color='H', code=setPen(20)},--GB1 - WIDGET.newButton{name="b21", x=900, y=290,w=75,fText="_", color='lH', code=setPen(21)},--GB2 - WIDGET.newButton{name="b22", x=980, y=290,w=75,fText="_", color='dV', code=setPen(22)},--GB3 - WIDGET.newButton{name="b23", x=1060, y=290,w=75,fText="_", color='dR', code=setPen(23)},--GB4 - WIDGET.newButton{name="b24", x=1140, y=290,w=75,fText="_", color='dG', code=setPen(24)},--GB5 + WIDGET.newButton{name="b17", x=580, y=290,w=75,fText="[ ]",color='dH', code=_setPen(17)},--BONE + WIDGET.newButton{name="b18", x=660, y=290,w=75,fText="N", color='D', code=_setPen(18)},--HIDE + WIDGET.newButton{name="b19", x=740, y=290,w=75,fText="B", color='lY', code=_setPen(19)},--BOMB + WIDGET.newButton{name="b20", x=820, y=290,w=75,fText="_", color='H', code=_setPen(20)},--GB1 + WIDGET.newButton{name="b21", x=900, y=290,w=75,fText="_", color='lH', code=_setPen(21)},--GB2 + WIDGET.newButton{name="b22", x=980, y=290,w=75,fText="_", color='dV', code=_setPen(22)},--GB3 + WIDGET.newButton{name="b23", x=1060, y=290,w=75,fText="_", color='dR', code=_setPen(23)},--GB4 + WIDGET.newButton{name="b24", x=1140, y=290,w=75,fText="_", color='dG', code=_setPen(24)},--GB5 - WIDGET.newButton{name="any", x=600, y=400,w=120,color='lH', font=40,code=setPen(0)}, - WIDGET.newButton{name="space", x=730, y=400,w=120,color='H', font=65,code=setPen(-1)}, - WIDGET.newButton{name="smart", x=860, y=400,w=120,color='lG', font=30,code=setPen(-2)}, + WIDGET.newButton{name="any", x=600, y=400,w=120,color='lH', font=40,code=_setPen(0)}, + WIDGET.newButton{name="space", x=730, y=400,w=120,color='H', font=65,code=_setPen(-1)}, + WIDGET.newButton{name="smart", x=860, y=400,w=120,color='lG', font=30,code=_setPen(-2)}, WIDGET.newButton{name="push", x=990, y=400,w=120,h=120,color='lY',font=20,code=pressKey"k"}, WIDGET.newButton{name="del", x=1120, y=400,w=120,h=120,color='lY',font=20,code=pressKey"l"}, diff --git a/parts/scenes/dict.lua b/parts/scenes/dict.lua index 0de88c01..95f59748 100644 --- a/parts/scenes/dict.lua +++ b/parts/scenes/dict.lua @@ -30,15 +30,15 @@ local typeColor={ english=COLOR.B, name=COLOR.lV, } -local function getList()return result[1]and result or dict end -local function clearResult() +local function _getList()return result[1]and result or dict end +local function _clearResult() TABLE.cut(result) selected,scrollPos=1,0 waiting,lastSearch=0,false end -local function search() +local function _search() local input=inputBox:getText():lower() - clearResult() + _clearResult() local first for i=1,#dict do local pos=find(dict[i][2],input,nil,true) @@ -52,7 +52,7 @@ local function search() if #result>0 then SFX.play('reach') end - url=getList()[selected][5] + url=_getList()[selected][5] lastSearch=input end @@ -84,7 +84,7 @@ function scene.keyDown(key) end end elseif key=="down"then - if selected and selected<#getList()then + if selected and selected<#_getList()then selected=selected+1 if selected>scrollPos+15 then scrollPos=selected-15 @@ -98,7 +98,7 @@ function scene.keyDown(key) love.system.openURL(url) elseif key=="delete"then if inputBox:hasText()then - clearResult() + _clearResult() inputBox:clear() SFX.play('hold') end @@ -113,14 +113,14 @@ function scene.keyDown(key) else return end - url=getList()[selected][5] + url=_getList()[selected][5] end function scene.update(dt) local input=inputBox:getText() if input~=lastTickInput then if #input==0 then - clearResult() + _clearResult() else waiting=.8 end @@ -130,14 +130,14 @@ function scene.update(dt) waiting=waiting-dt if waiting<=0 then if #input>0 and input~=lastSearch then - search() + _search() end end end end function scene.draw() - local list=getList() + local list=_getList() gc.setColor(COLOR.Z) local t=list[selected][4] setFont( diff --git a/parts/scenes/game.lua b/parts/scenes/game.lua index f5904a1a..0ae00632 100644 --- a/parts/scenes/game.lua +++ b/parts/scenes/game.lua @@ -14,7 +14,7 @@ local repRateStrings={[0]="pause",[.125]="0.125x",[.5]="0.5x",[1]="1x",[2]="2x", local scene={} -local function updateMenuButtons() +local function _updateMenuButtons() WIDGET.active.restart.hide=replaying local pos=(tasMode or replaying)and'right'or SETTING.menuPos @@ -32,7 +32,7 @@ local function updateMenuButtons() modeTextPos=1200-drawableText.modeName:getWidth() end end -local function updateRepButtons() +local function _updateRepButtons() local L=scene.widgetList if replaying or tasMode then for i=1,6 do L[i].hide=false end L[7].hide=true @@ -54,64 +54,64 @@ local function updateRepButtons() for i=1,7 do L[i].hide=true end end end -local function speedUp() +local function _speedUp() if gameRate==.125 then gameRate=.5 elseif gameRate==.5 then gameRate=1 elseif gameRate==1 then gameRate=2 elseif gameRate==2 then gameRate=5 end - updateRepButtons() + _updateRepButtons() end -local function speedDown() +local function _speedDown() if gameRate==.5 then gameRate=.125 elseif gameRate==1 then gameRate=.5 elseif gameRate==2 then gameRate=1 elseif gameRate==5 then gameRate=2 end - updateRepButtons() + _updateRepButtons() end local function _rep0() scene.widgetList[1].hide=true scene.widgetList[7].hide=false gameRate=0 - updateRepButtons() + _updateRepButtons() end local function _repP8() scene.widgetList[2].hide=true gameRate=.125 - updateRepButtons() + _updateRepButtons() end local function _repP2() scene.widgetList[3].hide=true gameRate=.5 - updateRepButtons() + _updateRepButtons() end local function _rep1() scene.widgetList[4].hide=true gameRate=1 - updateRepButtons() + _updateRepButtons() end local function _rep2() scene.widgetList[5].hide=true gameRate=2 - updateRepButtons() + _updateRepButtons() end local function _rep5() scene.widgetList[6].hide=true gameRate=5 - updateRepButtons() + _updateRepButtons() end local function _step()floatGameRate=floatGameRate+1 end -local function restart() +local function _restart() resetGameData(PLAYERS[1].frameRun<240 and'q') noKey=replaying noTouch=replaying tasMode=false floatGameRate,gameRate=0,1 - updateRepButtons() + _updateRepButtons() end -local function checkGameKeyDown(key) +local function _checkGameKeyDown(key) local k=keyMap.keyboard[key] if k then if k>0 then @@ -120,7 +120,7 @@ local function checkGameKeyDown(key) VK.press(k) return elseif not GAME.fromRepMenu then - restart() + _restart() return end end @@ -148,8 +148,8 @@ function scene.sceneInit(org) end end - updateRepButtons() - updateMenuButtons() + _updateRepButtons() + _updateMenuButtons() end scene.mouseDown=NULL @@ -198,16 +198,16 @@ function scene.keyDown(key,isRep) if replaying then if key=="space"then if not isRep then gameRate=gameRate==0 and 1 or 0 end - updateRepButtons() + _updateRepButtons() elseif key=="left"then if not isRep then - speedDown() + _speedDown() end elseif key=="right"then if gameRate==0 then _step() elseif not isRep then - speedUp() + _speedUp() end elseif key=="escape"then pauseGame() @@ -215,20 +215,20 @@ function scene.keyDown(key,isRep) else if isRep then return - elseif checkGameKeyDown(key)then + elseif _checkGameKeyDown(key)then if tasMode then if key=="f1"then if not isRep then gameRate=gameRate==0 and .125 or 0 end - updateRepButtons() + _updateRepButtons() elseif key=='f2'then if not isRep then - speedDown() + _speedDown() end elseif key=='f3'then if gameRate==0 then _step() elseif not isRep then - speedUp() + _speedUp() end end end @@ -256,7 +256,7 @@ function scene.gamepadDown(key) PLAYERS[1]:pressKey(k) VK.press(k) else - restart() + _restart() end elseif key=="back"then pauseGame() @@ -273,7 +273,7 @@ function scene.gamepadUp(key) end end -local function update_replay(repPtr) +local function _update_replay(repPtr) local P1=PLAYERS[1] local L=GAME.rep while P1.frameRun==L[repPtr]do @@ -290,7 +290,7 @@ local function update_replay(repPtr) end GAME.replaying=repPtr end -local function update_common(dt) +local function _update_common(dt) --Update control touchMoveLastFrame=false VK.update() @@ -310,13 +310,13 @@ function scene.update(dt) floatGameRate=floatGameRate+gameRate while floatGameRate>=1 do floatGameRate=floatGameRate-1 - if GAME.replaying then update_replay(GAME.replaying)end - update_common(dt) + if GAME.replaying then _update_replay(GAME.replaying)end + _update_common(dt) end end local tasText=gc.newText(getFont(100),"TAS") -local function drawAtkPointer(x,y) +local function _drawAtkPointer(x,y) local t=TIME() local a=t*3%1*.8 t=sin(t*20) @@ -358,12 +358,12 @@ function scene.draw() end if P.atkMode~=4 then if P.atking then - drawAtkPointer(P.atking.centerX,P.atking.centerY) + _drawAtkPointer(P.atking.centerX,P.atking.centerY) end else for i=1,#P.atker do local p=P.atker[i] - drawAtkPointer(p.centerX,p.centerY) + _drawAtkPointer(p.centerX,p.centerY) end end end @@ -393,7 +393,7 @@ scene.widgetList={ WIDGET.newKey{name="rep2", x=300,y=50,w=60,code=_rep2,fText=TEXTURE.rep.rep2}, WIDGET.newKey{name="rep5", x=365,y=50,w=60,code=_rep5,fText=TEXTURE.rep.rep5}, WIDGET.newKey{name="step", x=430,y=50,w=60,code=_step,fText=TEXTURE.rep.step}, - WIDGET.newKey{name="restart", x=0,y=45,w=60,code=restart,fText=TEXTURE.game.restart}, + WIDGET.newKey{name="restart", x=0,y=45,w=60,code=_restart,fText=TEXTURE.game.restart}, WIDGET.newKey{name="pause", x=0,y=45,w=60,code=pauseGame,fText=TEXTURE.game.pause}, } diff --git a/parts/scenes/login.lua b/parts/scenes/login.lua index 11c31de8..efc1a168 100644 --- a/parts/scenes/login.lua +++ b/parts/scenes/login.lua @@ -3,7 +3,7 @@ local passwordBox=WIDGET.newInputBox{name="password",x=380,y=300,w=620,h=60,secr local savePW=false -local function login() +local function _login() local email,password=emailBox:getText(),passwordBox:getText() if not STRING.simpEmailCheck(email)then MES.new('error',text.wrongEmail)return @@ -35,7 +35,7 @@ scene.widgetList={ emailBox, passwordBox, WIDGET.newSwitch{name="keepPW", x=900,y=420,disp=function()return savePW end,code=function()savePW=not savePW end}, - WIDGET.newKey{name="login", x=1140, y=540,w=170,h=80,font=40,code=login}, + WIDGET.newKey{name="login", x=1140, y=540,w=170,h=80,font=40,code=_login}, WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,fText=TEXTURE.back,code=backScene}, } diff --git a/parts/scenes/main.lua b/parts/scenes/main.lua index b1980e57..47067129 100644 --- a/parts/scenes/main.lua +++ b/parts/scenes/main.lua @@ -47,7 +47,7 @@ function scene.mouseDown(x,y) end end scene.touchDown=scene.mouseDown -local function testButton(n) +local function _testButton(n) if NET.getlock('access_and_login')then MES.new('warn',text.wsConnecting) else @@ -61,15 +61,15 @@ end function scene.keyDown(key,isRep) if isRep then return end if key=="1"then - if testButton(1)then + if _testButton(1)then SCN.go('mode') end elseif key=="q"then - if testButton(2)then + if _testButton(2)then loadGame(STAT.lastPlay,true) end elseif key=="a"then - if testButton(3)then + if _testButton(3)then if WS.status('app')=='running'then NET.tryLogin(false) elseif WS.status('app')=='dead'then @@ -79,39 +79,39 @@ function scene.keyDown(key,isRep) end end elseif key=="z"then - if testButton(4)then + if _testButton(4)then SCN.go('customGame') end elseif key=="-"then - if testButton(5)then + if _testButton(5)then SCN.go('setting_game') end elseif key=="p"then - if testButton(6)then + if _testButton(6)then SCN.go('stat') end elseif key=="l"then - if testButton(7)then + if _testButton(7)then SCN.go('dict') end elseif key==","then - if testButton(8)then + if _testButton(8)then SCN.go('replays') end elseif key=="2"then - if testButton(9)then + if _testButton(9)then SCN.go('music') end elseif key=="3"then - if testButton(10)then + if _testButton(10)then SCN.go('lang') end elseif key=="x"then - if testButton(11)then + if _testButton(11)then SCN.go('about') end elseif key=="m"then - if testButton(12)then + if _testButton(12)then SCN.go('manual') end elseif key=="c"then @@ -140,7 +140,7 @@ function scene.update(dt) end end -local function tipStencil() +local function _tipStencil() gc.rectangle('fill',0,0,tipLength,42) end function scene.draw() @@ -159,7 +159,7 @@ function scene.draw() gc.translate(260,650) gc.setLineWidth(2) gc.rectangle('line',0,0,tipLength,42,3) - gc.stencil(tipStencil) + gc.stencil(_tipStencil) gc.setStencilTest('equal',1) gc.draw(tip,0+scrollX,0) gc.setColor(1,1,1,.2) diff --git a/parts/scenes/mod.lua b/parts/scenes/mod.lua index bda31998..148ef20d 100644 --- a/parts/scenes/mod.lua +++ b/parts/scenes/mod.lua @@ -2,17 +2,17 @@ local gc=love.graphics local kb=love.keyboard local ins,rem=table.insert,table.remove -local function modComp(a,b) +local function _modComp(a,b) return a.no1300 and dx<0 or x<-1500 and dx>0 then dx=0 end if y>420 and dy<0 or y<-1900 and dy>0 then dy=0 end mapCam.xOy:translate(dx/k,dy/k) end function scene.wheelMoved(_,dy) mapCam.keyCtrl=false - local k=getK() + local k=_getK() k=min(max(k+dy*.1,.3),1.6)/k mapCam.xOy:scale(k) - local x,y=getPos() + local x,y=_getPos() mapCam.xOy:translate(x*(1-k),y*(1-k)) end function scene.mouseMove(_,_,dx,dy) if ms.isDown(1)then - moveMap(dx,dy) + _moveMap(dx,dy) end mapCam.keyCtrl=false end @@ -92,7 +92,7 @@ function scene.mouseClick(x,y) if not _ or x<920 then x,y=x-640,y-360 x,y=mapCam.xOy:inverseTransformPoint(x,y) - local SEL=onModeRaw(x,y) + local SEL=_onModeRaw(x,y) if _~=SEL then if SEL then mapCam.moving=true @@ -114,7 +114,7 @@ end function scene.touchMove(x,y,dx,dy) local L=tc.getTouches() if not L[2]then - moveMap(dx,dy) + _moveMap(dx,dy) elseif not L[3]then x,y=SCR.xOy:inverseTransformPoint(tc.getPosition(L[1])) dx,dy=SCR.xOy:inverseTransformPoint(tc.getPosition(L[2]))--Not delta!!! @@ -178,9 +178,9 @@ function scene.update() if kb.isDown("lctrl","rctrl","lalt","ralt")then scene.wheelMoved(nil,(dy-dx)*.026) else - moveMap(dx,dy) - local x,y=getPos() - local SEL=onModeRaw(x,y) + _moveMap(dx,dy) + local x,y=_getPos() + local SEL=_onModeRaw(x,y) if SEL and mapCam.sel~=SEL then mapCam.sel=SEL SFX.play('click') @@ -210,7 +210,7 @@ local baseRankColor={ {.85,.8,.3,.3}, } local rankColor=rankColor -local function drawModeShape(M,S,drawType) +local function _drawModeShape(M,S,drawType) if M.shape==1 then--Rectangle gc_rectangle(drawType,M.x-S,M.y-S,2*S,2*S) elseif M.shape==2 then--Diamond @@ -254,10 +254,10 @@ function scene.draw() --Draw shapes on map if unlocked==1 then gc_setColor(baseRankColor[rank]) - drawModeShape(M,S,'fill') + _drawModeShape(M,S,'fill') end gc_setColor(1,1,sel==name and 0 or 1,unlocked==1 and .8 or .3) - drawModeShape(M,S,'line') + _drawModeShape(M,S,'line') --Icon local icon=M.icon diff --git a/parts/scenes/net_game.lua b/parts/scenes/net_game.lua index 7a80e877..a70f81c9 100644 --- a/parts/scenes/net_game.lua +++ b/parts/scenes/net_game.lua @@ -21,7 +21,7 @@ local noTouch,noKey=false,false local touchMoveLastFrame=false local newMessageTimer -local function hideReadyUI() +local function _hideReadyUI() return playing or NET.roomState.start or @@ -150,7 +150,7 @@ function scene.keyDown(key,isRep) PLAYERS[1]:pressKey(k) VK.press(k) end - elseif not hideReadyUI()then + elseif not _hideReadyUI()then if key=="space"then if netPLY.getSelfJoinMode()==0 then (kb.isDown("lctrl","rctrl","lalt","ralt")and _setSpectate or _setReady)() @@ -328,15 +328,15 @@ function scene.draw() gc_print("M",430,10) end end -local function hideF_ingame()return hideReadyUI()or netPLY.getSelfReady()end -local function hideF_ingame2()return hideReadyUI()or not netPLY.getSelfReady()end +local function _hideF_ingame()return _hideReadyUI()or netPLY.getSelfReady()end +local function _hideF_ingame2()return _hideReadyUI()or not netPLY.getSelfReady()end scene.widgetList={ textBox, inputBox, - WIDGET.newKey{name="setting", x=1200,y=160,w=90,h=90, fText=TEXTURE.setting, code=_gotoSetting,hideF=hideF_ingame}, - WIDGET.newKey{name="ready", x=1060,y=510,w=360,h=90,color='lG',font=35, code=_setReady,hideF=hideF_ingame}, - WIDGET.newKey{name="spectate", x=1060,y=610,w=360,h=90,color='lO',font=35, code=_setSpectate,hideF=hideF_ingame}, - WIDGET.newKey{name="cancel", x=1060,y=560,w=360,h=120,color='lH',font=40, code=_setCancel,hideF=hideF_ingame2}, + WIDGET.newKey{name="setting", x=1200,y=160,w=90,h=90, fText=TEXTURE.setting, code=_gotoSetting,hideF=_hideF_ingame}, + WIDGET.newKey{name="ready", x=1060,y=510,w=360,h=90,color='lG',font=35, code=_setReady,hideF=_hideF_ingame}, + WIDGET.newKey{name="spectate", x=1060,y=610,w=360,h=90,color='lO',font=35, code=_setSpectate,hideF=_hideF_ingame}, + WIDGET.newKey{name="cancel", x=1060,y=560,w=360,h=120,color='lH',font=40, code=_setCancel,hideF=_hideF_ingame2}, WIDGET.newKey{name="chat", x=360,y=45,w=60,fText="...",font=35, code=_switchChat}, WIDGET.newKey{name="quit", x=860,y=45,w=60,fText=TEXTURE.quit_small, code=_quit}, } diff --git a/parts/scenes/net_newRoom.lua b/parts/scenes/net_newRoom.lua index cccd1b50..c792e94c 100644 --- a/parts/scenes/net_newRoom.lua +++ b/parts/scenes/net_newRoom.lua @@ -24,7 +24,7 @@ local sList={ local scene={} -local function createRoom() +local function _createRoom() local pw=passwordBox.value if pw==""then pw=nil end local roomname=STRING.trim(roomNameBox.value) @@ -51,7 +51,7 @@ end function scene.keyDown(key) if key=="return"then - createRoom() + _createRoom() elseif key=="escape"then SCN.back() else diff --git a/parts/scenes/net_rooms.lua b/parts/scenes/net_rooms.lua index 1474aba8..a67d39f1 100644 --- a/parts/scenes/net_rooms.lua +++ b/parts/scenes/net_rooms.lua @@ -29,11 +29,11 @@ local roomList=WIDGET.newListBox{name="roomList",x=50,y=50,w=800,h=440,lineH=40, end gc_print(item.roomInfo.name,200,-4) end} -local function hidePW() +local function _hidePW() local R=roomList:getSel() return not R or not R.private end -local passwordBox=WIDGET.newInputBox{name="password",x=350,y=505,w=500,h=50,secret=true,hideF=hidePW} +local passwordBox=WIDGET.newInputBox{name="password",x=350,y=505,w=500,h=50,secret=true,hideF=_hidePW} --[[roomList[n]={ rid="qwerty", @@ -47,7 +47,7 @@ local passwordBox=WIDGET.newInputBox{name="password",x=350,y=505,w=500,h=50,secr count=4, capacity=5, }]] -local function fetchRoom() +local function _fetchRoom() fetchTimer=10 NET.fetchRoom() end @@ -55,7 +55,7 @@ local scene={} function scene.sceneInit() BG.set() - fetchRoom() + _fetchRoom() end function scene.keyDown(key) @@ -63,7 +63,7 @@ function scene.keyDown(key) if WIDGET.sel~=passwordBox then if key=="r"then if fetchTimer<=7 then - fetchRoom() + _fetchRoom() end elseif key=="s"then SCN.go('setting_game') @@ -88,10 +88,10 @@ function scene.keyDown(key) end function scene.update(dt) - if not NET.getlock('fetchRoom')and hidePW()then + if not NET.getlock('fetchRoom')and _hidePW()then fetchTimer=fetchTimer-dt if fetchTimer<=0 then - fetchRoom() + _fetchRoom() end end end @@ -145,7 +145,7 @@ scene.widgetList={ WIDGET.newKey{name="setting",fText=TEXTURE.setting,x=1200,y=160,w=90,h=90,code=pressKey"s"}, WIDGET.newText{name="refreshing",x=450,y=240,font=45,hideF=function()return not NET.getlock('fetchRoom')end}, WIDGET.newText{name="noRoom", x=450,y=245,font=40,hideF=function()return roomList:getLen()>0 or NET.getlock('fetchRoom')end}, - WIDGET.newKey{name="refresh", x=250,y=630,w=140,h=120,code=fetchRoom,hideF=function()return fetchTimer>7 end}, + WIDGET.newKey{name="refresh", x=250,y=630,w=140,h=120,code=_fetchRoom,hideF=function()return fetchTimer>7 end}, WIDGET.newKey{name="new", x=510,y=630,w=260,h=120,code=pressKey"n"}, WIDGET.newKey{name="join", x=780,y=630,w=140,h=120,code=pressKey"return",hideF=function()return roomList:getLen()==0 or NET.getlock('enterRoom')end}, WIDGET.newButton{name="back", x=1140,y=640,w=170,h=80,fText=TEXTURE.back,code=pressKey"escape"}, diff --git a/parts/scenes/register.lua b/parts/scenes/register.lua index 9a32bbd7..ab600e8e 100644 --- a/parts/scenes/register.lua +++ b/parts/scenes/register.lua @@ -1,6 +1,6 @@ local scene={} -local function register() +local function _register() local username= WIDGET.active.username:getText() local email= WIDGET.active.email:getText() local password= WIDGET.active.password:getText() @@ -25,7 +25,7 @@ scene.widgetList={ WIDGET.newInputBox{name="password", x=380, y=400,w=626,h=60,secret=true,regex="[ -~]"}, WIDGET.newInputBox{name="password2",x=380, y=500,w=626,h=60,secret=true,regex="[ -~]"}, - WIDGET.newKey{name="register", x=640, y=640,w=300,h=80,font=40,code=register,hideF=function()return NET.getlock('register')end}, + WIDGET.newKey{name="register", x=640, y=640,w=300,h=80,font=40,code=_register,hideF=function()return NET.getlock('register')end}, WIDGET.newText{name="registering", x=640, y=605,font=50,hideF=function()return not NET.getlock('register')end}, WIDGET.newButton{name="back", x=1140, y=640,w=170,h=80,fText=TEXTURE.back,code=backScene}, diff --git a/parts/scenes/replays.lua b/parts/scenes/replays.lua index c4bba5c9..e7cd55ac 100644 --- a/parts/scenes/replays.lua +++ b/parts/scenes/replays.lua @@ -41,7 +41,7 @@ local scene={} local sure -local function playRep(fileName) +local function _playRep(fileName) local rep=DATA.parseReplay(fileName,true) if not rep.available then MES.new('error',text.replayBroken) @@ -82,7 +82,7 @@ function scene.keyDown(key) if key=="return"then local rep=listBox:getSel() if rep then - playRep(rep.fileName) + _playRep(rep.fileName) end elseif key=="c"and kb.isDown("lctrl","rctrl")or key=="cC"then local rep=listBox:getSel() diff --git a/parts/scenes/savedata.lua b/parts/scenes/savedata.lua index 5dffc8b7..1f6d616d 100644 --- a/parts/scenes/savedata.lua +++ b/parts/scenes/savedata.lua @@ -1,10 +1,10 @@ local scene={} -local function dumpCB(T) +local function _dumpCB(T) love.system.setClipboardText(STRING.packText(TABLE.dump(T))) MES.new('check',text.exportSuccess) end -local function parseCB() +local function _parseCB() local _ local s=love.system.getClipboardText() @@ -20,15 +20,15 @@ local function parseCB() end scene.widgetList={ WIDGET.newText{name="export", x=55,y=45,color='lY',align='L',font=50}, - WIDGET.newButton{name="unlock", x=190,y=170,w=280,h=100,color='lY',code=function()dumpCB(RANKS)end}, - WIDGET.newButton{name="data", x=490,y=170,w=280,h=100,color='lY',code=function()dumpCB(STAT)end}, - WIDGET.newButton{name="setting", x=790,y=170,w=280,h=100,color='lY',code=function()dumpCB(SETTING)end}, - WIDGET.newButton{name="vk", x=1090,y=170,w=280,h=100,color='lY',code=function()dumpCB(VK_org)end}, + WIDGET.newButton{name="unlock", x=190,y=170,w=280,h=100,color='lY',code=function()_dumpCB(RANKS)end}, + WIDGET.newButton{name="data", x=490,y=170,w=280,h=100,color='lY',code=function()_dumpCB(STAT)end}, + WIDGET.newButton{name="setting", x=790,y=170,w=280,h=100,color='lY',code=function()_dumpCB(SETTING)end}, + WIDGET.newButton{name="vk", x=1090,y=170,w=280,h=100,color='lY',code=function()_dumpCB(VK_org)end}, WIDGET.newText{name="import", x=55,y=265,color='lR',align='L',font=50}, WIDGET.newButton{name="unlock", x=190,y=390,w=280,h=100,color='lR', code=function() - local D=parseCB() + local D=_parseCB() if D then TABLE.cover(D,RANKS) for k,v in next,oldModeNameTable do @@ -45,7 +45,7 @@ scene.widgetList={ end}, WIDGET.newButton{name="data", x=490,y=390,w=280,h=100,color='lR', code=function() - local D=parseCB() + local D=_parseCB() if D and D.version==STAT.version then TABLE.update(D,STAT) saveStats() @@ -56,7 +56,7 @@ scene.widgetList={ end}, WIDGET.newButton{name="setting", x=790,y=390,w=280,h=100,color='lR', code=function() - local D=parseCB() + local D=_parseCB() if D then TABLE.update(D,SETTING) applySettings() @@ -68,7 +68,7 @@ scene.widgetList={ end}, WIDGET.newButton{name="vk", x=1090,y=390,w=280,h=100,color='lR', code=function() - local D=parseCB() + local D=_parseCB() if D then TABLE.update(D,VK_org) FILE.save(VK_org,'conf/virtualkey') diff --git a/parts/scenes/setting_control.lua b/parts/scenes/setting_control.lua index c0d9a831..48f94d8c 100644 --- a/parts/scenes/setting_control.lua +++ b/parts/scenes/setting_control.lua @@ -76,7 +76,7 @@ function scene.draw() gc.translate(-550,-600) end -local function sliderShow(S) +local function _sliderShow(S) S=S.disp() return S.."F "..math.floor(S*16.67).."ms" end @@ -84,12 +84,12 @@ scene.widgetList={ WIDGET.newText{name="title", x=80, y=50,font=70,align='L'}, WIDGET.newText{name="preview", x=520, y=610,font=40,align='R'}, - WIDGET.newSlider{name="das", x=250, y=190,w=600,unit=20,disp=SETval("das"), show=sliderShow,code=SETsto("das")}, - WIDGET.newSlider{name="arr", x=250, y=260,w=525,unit=15,disp=SETval("arr"), show=sliderShow,code=SETsto("arr")}, - WIDGET.newSlider{name="sddas", x=250, y=330,w=350,unit=10,disp=SETval("sddas"),show=sliderShow,code=SETsto("sddas")}, - WIDGET.newSlider{name="sdarr", x=250, y=400,w=140,unit=4, disp=SETval("sdarr"),show=sliderShow,code=SETsto("sdarr")}, - WIDGET.newSlider{name="dascut", x=250, y=470,w=600,unit=20,disp=SETval("dascut"),show=sliderShow,code=SETsto("dascut")}, - WIDGET.newSlider{name="dropcut",x=250, y=540,w=300,unit=10,disp=SETval("dropcut"),show=sliderShow,code=SETsto("dropcut")}, + WIDGET.newSlider{name="das", x=250, y=190,w=600,unit=20,disp=SETval("das"), show=_sliderShow,code=SETsto("das")}, + WIDGET.newSlider{name="arr", x=250, y=260,w=525,unit=15,disp=SETval("arr"), show=_sliderShow,code=SETsto("arr")}, + WIDGET.newSlider{name="sddas", x=250, y=330,w=350,unit=10,disp=SETval("sddas"),show=_sliderShow,code=SETsto("sddas")}, + WIDGET.newSlider{name="sdarr", x=250, y=400,w=140,unit=4, disp=SETval("sdarr"),show=_sliderShow,code=SETsto("sdarr")}, + WIDGET.newSlider{name="dascut", x=250, y=470,w=600,unit=20,disp=SETval("dascut"),show=_sliderShow,code=SETsto("dascut")}, + WIDGET.newSlider{name="dropcut",x=250, y=540,w=300,unit=10,disp=SETval("dropcut"),show=_sliderShow,code=SETsto("dropcut")}, WIDGET.newSwitch{name="ihs", x=1100, y=260, disp=SETval("ihs"), code=SETrev("ihs")}, WIDGET.newSwitch{name="irs", x=1100, y=330, disp=SETval("irs"), code=SETrev("irs")}, WIDGET.newSwitch{name="ims", x=1100, y=400, disp=SETval("ims"), code=SETrev("ims")}, diff --git a/parts/scenes/setting_key.lua b/parts/scenes/setting_key.lua index 268eb63f..b7551a8d 100644 --- a/parts/scenes/setting_key.lua +++ b/parts/scenes/setting_key.lua @@ -7,7 +7,7 @@ local scene={} local selected--if waiting for key local keyList -local function freshKeyList() +local function _freshKeyList() keyList={}for i=0,20 do keyList[i]={}end for k,v in next,keyMap.keyboard do ins(keyList[v],{COLOR.lB,k}) @@ -19,7 +19,7 @@ end function scene.sceneInit() selected=false - freshKeyList() + _freshKeyList() BG.set('none') end function scene.sceneBack() @@ -39,7 +39,7 @@ function scene.keyDown(key,isRep) keyMap.keyboard[k]=nil end end - freshKeyList() + _freshKeyList() selected=false SFX.play('finesseError',.5) else @@ -48,7 +48,7 @@ function scene.keyDown(key,isRep) elseif selected then if not forbbidenKeys[key]then keyMap.keyboard[key]=selected - freshKeyList() + _freshKeyList() selected=false SFX.play('reach',.5) end @@ -64,7 +64,7 @@ function scene.gamepadDown(key) keyMap.joystick[k]=nil end end - freshKeyList() + _freshKeyList() selected=false SFX.play('finesseError',.5) else @@ -72,7 +72,7 @@ function scene.gamepadDown(key) end elseif selected then keyMap.joystick[key]=selected - freshKeyList() + _freshKeyList() selected=false SFX.play('reach',.5) else @@ -106,7 +106,7 @@ function scene.draw() end end -local function setSel(i) +local function _setSel(i) if selected==i then selected=false SFX.play('rotate',.5) @@ -116,29 +116,29 @@ local function setSel(i) end end scene.widgetList={ - WIDGET.newKey{name="a1",x=160,y=40,w=200,h=60,code=function()setSel(1)end}, - WIDGET.newKey{name="a2",x=160,y=100,w=200,h=60,code=function()setSel(2)end}, - WIDGET.newKey{name="a3",x=160,y=160,w=200,h=60,code=function()setSel(3)end}, - WIDGET.newKey{name="a4",x=160,y=220,w=200,h=60,code=function()setSel(4)end}, - WIDGET.newKey{name="a5",x=160,y=280,w=200,h=60,code=function()setSel(5)end}, - WIDGET.newKey{name="a6",x=160,y=340,w=200,h=60,code=function()setSel(6)end}, - WIDGET.newKey{name="a7",x=160,y=400,w=200,h=60,code=function()setSel(7)end}, - WIDGET.newKey{name="a8",x=160,y=460,w=200,h=60,code=function()setSel(8)end}, - WIDGET.newKey{name="a9",x=160,y=520,w=200,h=60,code=function()setSel(9)end}, - WIDGET.newKey{name="a10",x=160,y=580,w=200,h=60,code=function()setSel(10)end}, + WIDGET.newKey{name="a1",x=160,y=40,w=200,h=60,code=function()_setSel(1)end}, + WIDGET.newKey{name="a2",x=160,y=100,w=200,h=60,code=function()_setSel(2)end}, + WIDGET.newKey{name="a3",x=160,y=160,w=200,h=60,code=function()_setSel(3)end}, + WIDGET.newKey{name="a4",x=160,y=220,w=200,h=60,code=function()_setSel(4)end}, + WIDGET.newKey{name="a5",x=160,y=280,w=200,h=60,code=function()_setSel(5)end}, + WIDGET.newKey{name="a6",x=160,y=340,w=200,h=60,code=function()_setSel(6)end}, + WIDGET.newKey{name="a7",x=160,y=400,w=200,h=60,code=function()_setSel(7)end}, + WIDGET.newKey{name="a8",x=160,y=460,w=200,h=60,code=function()_setSel(8)end}, + WIDGET.newKey{name="a9",x=160,y=520,w=200,h=60,code=function()_setSel(9)end}, + WIDGET.newKey{name="a10",x=160,y=580,w=200,h=60,code=function()_setSel(10)end}, - WIDGET.newKey{name="a11",x=800,y=40,w=200,h=60,code=function()setSel(11)end}, - WIDGET.newKey{name="a12",x=800,y=100,w=200,h=60,code=function()setSel(12)end}, - WIDGET.newKey{name="a13",x=800,y=160,w=200,h=60,code=function()setSel(13)end}, - WIDGET.newKey{name="a14",x=800,y=220,w=200,h=60,code=function()setSel(14)end}, - WIDGET.newKey{name="a15",x=800,y=280,w=200,h=60,code=function()setSel(15)end}, - WIDGET.newKey{name="a16",x=800,y=340,w=200,h=60,code=function()setSel(16)end}, - WIDGET.newKey{name="a17",x=800,y=400,w=200,h=60,code=function()setSel(17)end}, - WIDGET.newKey{name="a18",x=800,y=460,w=200,h=60,code=function()setSel(18)end}, - WIDGET.newKey{name="a19",x=800,y=520,w=200,h=60,code=function()setSel(19)end}, - WIDGET.newKey{name="a20",x=800,y=580,w=200,h=60,code=function()setSel(20)end}, + WIDGET.newKey{name="a11",x=800,y=40,w=200,h=60,code=function()_setSel(11)end}, + WIDGET.newKey{name="a12",x=800,y=100,w=200,h=60,code=function()_setSel(12)end}, + WIDGET.newKey{name="a13",x=800,y=160,w=200,h=60,code=function()_setSel(13)end}, + WIDGET.newKey{name="a14",x=800,y=220,w=200,h=60,code=function()_setSel(14)end}, + WIDGET.newKey{name="a15",x=800,y=280,w=200,h=60,code=function()_setSel(15)end}, + WIDGET.newKey{name="a16",x=800,y=340,w=200,h=60,code=function()_setSel(16)end}, + WIDGET.newKey{name="a17",x=800,y=400,w=200,h=60,code=function()_setSel(17)end}, + WIDGET.newKey{name="a18",x=800,y=460,w=200,h=60,code=function()_setSel(18)end}, + WIDGET.newKey{name="a19",x=800,y=520,w=200,h=60,code=function()_setSel(19)end}, + WIDGET.newKey{name="a20",x=800,y=580,w=200,h=60,code=function()_setSel(20)end}, - WIDGET.newKey{name="restart",x=160,y=670,w=200,h=60,code=function()setSel(0)end}, + WIDGET.newKey{name="restart",x=160,y=670,w=200,h=60,code=function()_setSel(0)end}, WIDGET.newButton{name="back",x=1140,y=640,w=190,h=80,fText=TEXTURE.back,code=backScene}, } diff --git a/parts/scenes/setting_skin.lua b/parts/scenes/setting_skin.lua index ae54e0b0..e04eb4fb 100644 --- a/parts/scenes/setting_skin.lua +++ b/parts/scenes/setting_skin.lua @@ -50,13 +50,13 @@ function scene.draw() gc.draw(texture[17],930,610+sin(2.6*t-6)*5,nil,2) end -local function prevSkin(i) +local function _prevSkin(i) SETTING.skin[i]=(SETTING.skin[i]-2)%16+1 end -local function nextSkin(i) +local function _nextSkin(i) SETTING.skin[i]=SETTING.skin[i]%16+1 end -local function nextDir(i) +local function _nextDir(i) SETTING.face[i]=(SETTING.face[i]+1)%4 minoRot0[i]=minoRot0[i]+1.5707963 if minoRot0[5]>62 and not GAME.playing then @@ -69,29 +69,29 @@ scene.widgetList={ WIDGET.newText{name="title", x=80,y=50,font=70,align='L'}, WIDGET.newSelector{name="skinSet",x=780,y=100,w=320,list=SKIN.getList(),disp=SETval('skinSet'),code=SETsto('skinSet')}, - WIDGET.newButton{name="prev1", x=130,y=220,w=80,h=65,fText="↑",code=function()prevSkin(1)end}, - WIDGET.newButton{name="prev2", x=270,y=220,w=80,h=65,fText="↑",code=function()prevSkin(2)end}, - WIDGET.newButton{name="prev3", x=410,y=220,w=80,h=65,fText="↑",code=function()prevSkin(3)end}, - WIDGET.newButton{name="prev4", x=550,y=220,w=80,h=65,fText="↑",code=function()prevSkin(4)end}, - WIDGET.newButton{name="prev5", x=690,y=220,w=80,h=65,fText="↑",code=function()prevSkin(5)end}, - WIDGET.newButton{name="prev6", x=830,y=220,w=80,h=65,fText="↑",code=function()prevSkin(6)end}, - WIDGET.newButton{name="prev7", x=970,y=220,w=80,h=65,fText="↑",code=function()prevSkin(7)end}, + WIDGET.newButton{name="prev1", x=130,y=220,w=80,h=65,fText="↑",code=function()_prevSkin(1)end}, + WIDGET.newButton{name="prev2", x=270,y=220,w=80,h=65,fText="↑",code=function()_prevSkin(2)end}, + WIDGET.newButton{name="prev3", x=410,y=220,w=80,h=65,fText="↑",code=function()_prevSkin(3)end}, + WIDGET.newButton{name="prev4", x=550,y=220,w=80,h=65,fText="↑",code=function()_prevSkin(4)end}, + WIDGET.newButton{name="prev5", x=690,y=220,w=80,h=65,fText="↑",code=function()_prevSkin(5)end}, + WIDGET.newButton{name="prev6", x=830,y=220,w=80,h=65,fText="↑",code=function()_prevSkin(6)end}, + WIDGET.newButton{name="prev7", x=970,y=220,w=80,h=65,fText="↑",code=function()_prevSkin(7)end}, - WIDGET.newButton{name="next1", x=130,y=440,w=80,h=65,fText="↓",code=function()nextSkin(1)end}, - WIDGET.newButton{name="next2", x=270,y=440,w=80,h=65,fText="↓",code=function()nextSkin(2)end}, - WIDGET.newButton{name="next3", x=410,y=440,w=80,h=65,fText="↓",code=function()nextSkin(3)end}, - WIDGET.newButton{name="next4", x=550,y=440,w=80,h=65,fText="↓",code=function()nextSkin(4)end}, - WIDGET.newButton{name="next5", x=690,y=440,w=80,h=65,fText="↓",code=function()nextSkin(5)end}, - WIDGET.newButton{name="next6", x=830,y=440,w=80,h=65,fText="↓",code=function()nextSkin(6)end}, - WIDGET.newButton{name="next7", x=970,y=440,w=80,h=65,fText="↓",code=function()nextSkin(7)end}, + WIDGET.newButton{name="next1", x=130,y=440,w=80,h=65,fText="↓",code=function()_nextSkin(1)end}, + WIDGET.newButton{name="next2", x=270,y=440,w=80,h=65,fText="↓",code=function()_nextSkin(2)end}, + WIDGET.newButton{name="next3", x=410,y=440,w=80,h=65,fText="↓",code=function()_nextSkin(3)end}, + WIDGET.newButton{name="next4", x=550,y=440,w=80,h=65,fText="↓",code=function()_nextSkin(4)end}, + WIDGET.newButton{name="next5", x=690,y=440,w=80,h=65,fText="↓",code=function()_nextSkin(5)end}, + WIDGET.newButton{name="next6", x=830,y=440,w=80,h=65,fText="↓",code=function()_nextSkin(6)end}, + WIDGET.newButton{name="next7", x=970,y=440,w=80,h=65,fText="↓",code=function()_nextSkin(7)end}, - WIDGET.newButton{name="spin1", x=130,y=540,w=80,h=65,code=function()nextDir(1)end}, - WIDGET.newButton{name="spin2", x=270,y=540,w=80,h=65,code=function()nextDir(2)end}, - WIDGET.newButton{name="spin3", x=410,y=540,w=80,h=65,code=function()nextDir(3)end}, - WIDGET.newButton{name="spin4", x=550,y=540,w=80,h=65,code=function()nextDir(4)end}, - WIDGET.newButton{name="spin5", x=690,y=540,w=80,h=65,code=function()nextDir(5)end}, - WIDGET.newButton{name="spin6", x=825,y=540,w=80,h=65,code=function()nextDir(6)end}, - WIDGET.newButton{name="spin7", x=970,y=540,w=80,h=65,code=function()nextDir(7)end}, + WIDGET.newButton{name="spin1", x=130,y=540,w=80,h=65,code=function()_nextDir(1)end}, + WIDGET.newButton{name="spin2", x=270,y=540,w=80,h=65,code=function()_nextDir(2)end}, + WIDGET.newButton{name="spin3", x=410,y=540,w=80,h=65,code=function()_nextDir(3)end}, + WIDGET.newButton{name="spin4", x=550,y=540,w=80,h=65,code=function()_nextDir(4)end}, + WIDGET.newButton{name="spin5", x=690,y=540,w=80,h=65,code=function()_nextDir(5)end}, + WIDGET.newButton{name="spin6", x=825,y=540,w=80,h=65,code=function()_nextDir(6)end}, + WIDGET.newButton{name="spin7", x=970,y=540,w=80,h=65,code=function()_nextDir(7)end}, WIDGET.newButton{name="skinR", x=200,y=640,w=220,h=80,color='lV',font=35, code=function() diff --git a/parts/scenes/setting_touch.lua b/parts/scenes/setting_touch.lua index 62bc3d68..7beeca11 100644 --- a/parts/scenes/setting_touch.lua +++ b/parts/scenes/setting_touch.lua @@ -8,10 +8,10 @@ local defaultSetSelect local snapUnit=1 local selected--Button selected -local function save1() +local function _save1() FILE.save(VK_org,'conf/vkSave1') end -local function load1() +local function _load1() local D=FILE.load('conf/vkSave1') if D then TABLE.update(D,VK_org) @@ -19,10 +19,10 @@ local function load1() MES.new('error',text.noFile) end end -local function save2() +local function _save2() FILE.save(VK_org,'conf/vkSave2') end -local function load2() +local function _load2() local D=FILE.load('conf/vkSave2') if D then TABLE.update(D,VK_org) @@ -40,7 +40,7 @@ function scene.sceneBack() FILE.save(VK_org,'conf/virtualkey') end -local function onVK_org(x,y) +local function _onVK_org(x,y) local dist,nearest=1e10 for K=1,#VK_org do local B=VK_org[K] @@ -67,7 +67,7 @@ function scene.mouseMove(_,_,dx,dy) end end function scene.touchDown(x,y) - selected=onVK_org(x,y)or selected + selected=_onVK_org(x,y)or selected end function scene.touchUp() if selected then @@ -114,10 +114,10 @@ scene.widgetList={ WIDGET.newSelector{name="snap", x=750,y=90,w=200,h=80,color='Y',list={1,10,20,40,60,80},disp=function()return snapUnit end,code=function(i)snapUnit=i end}, WIDGET.newButton{name="option", x=530,y=190,w=200,h=80,fText=TEXTURE.more,code=function()SCN.go('setting_touchSwitch')end}, WIDGET.newButton{name="back", x=750,y=190,w=200,h=80,fText=TEXTURE.back,code=backScene}, - WIDGET.newKey{name="save1", x=475,y=290,w=90,h=70,code=save1}, - WIDGET.newKey{name="load1", x=585,y=290,w=90,h=70,code=load1}, - WIDGET.newKey{name="save2", x=695,y=290,w=90,h=70,code=save2}, - WIDGET.newKey{name="load2", x=805,y=290,w=90,h=70,code=load2}, + WIDGET.newKey{name="save1", x=475,y=290,w=90,h=70,code=_save1}, + WIDGET.newKey{name="load1", x=585,y=290,w=90,h=70,code=_load1}, + WIDGET.newKey{name="save2", x=695,y=290,w=90,h=70,code=_save2}, + WIDGET.newKey{name="load2", x=805,y=290,w=90,h=70,code=_load2}, WIDGET.newSlider{name="size", x=440,y=370,w=460,unit=19,font=40,show="vkSize", disp=function() return VK_org[selected].r/10-1 diff --git a/parts/scenes/setting_touchSwitch.lua b/parts/scenes/setting_touchSwitch.lua index 7d55eaa8..49a38b76 100644 --- a/parts/scenes/setting_touchSwitch.lua +++ b/parts/scenes/setting_touchSwitch.lua @@ -14,46 +14,46 @@ function scene.draw() end end -local function VKAdisp(n)return function()return VK_org[n].ava end end -local function VKAcode(n)return function()VK_org[n].ava=not VK_org[n].ava end end -local function notShow()return not SETTING.VKSwitch end -local function notTrack()return not(SETTING.VKSwitch and SETTING.VKTrack)end +local function _VKAdisp(n)return function()return VK_org[n].ava end end +local function _VKAcode(n)return function()VK_org[n].ava=not VK_org[n].ava end end +local function _notShow()return not SETTING.VKSwitch end +local function _notTrack()return not(SETTING.VKSwitch and SETTING.VKTrack)end scene.widgetScrollHeight=340 scene.widgetList={ - WIDGET.newSwitch{name="b1", x=280, y=80, disp=VKAdisp(1),code=VKAcode(1)}, - WIDGET.newSwitch{name="b2", x=280, y=140, disp=VKAdisp(2),code=VKAcode(2)}, - WIDGET.newSwitch{name="b3", x=280, y=200, disp=VKAdisp(3),code=VKAcode(3)}, - WIDGET.newSwitch{name="b4", x=280, y=260, disp=VKAdisp(4),code=VKAcode(4)}, - WIDGET.newSwitch{name="b5", x=280, y=320, disp=VKAdisp(5),code=VKAcode(5)}, - WIDGET.newSwitch{name="b6", x=280, y=380, disp=VKAdisp(6),code=VKAcode(6)}, - WIDGET.newSwitch{name="b7", x=280, y=440, disp=VKAdisp(7),code=VKAcode(7)}, - WIDGET.newSwitch{name="b8", x=280, y=500, disp=VKAdisp(8),code=VKAcode(8)}, - WIDGET.newSwitch{name="b9", x=280, y=560, disp=VKAdisp(9),code=VKAcode(9)}, - WIDGET.newSwitch{name="b10", x=280, y=620, disp=VKAdisp(10),code=VKAcode(10)}, - WIDGET.newSwitch{name="b11", x=580, y=80, disp=VKAdisp(11),code=VKAcode(11)}, - WIDGET.newSwitch{name="b12", x=580, y=140, disp=VKAdisp(12),code=VKAcode(12)}, - WIDGET.newSwitch{name="b13", x=580, y=200, disp=VKAdisp(13),code=VKAcode(13)}, - WIDGET.newSwitch{name="b14", x=580, y=260, disp=VKAdisp(14),code=VKAcode(14)}, - WIDGET.newSwitch{name="b15", x=580, y=320, disp=VKAdisp(15),code=VKAcode(15)}, - WIDGET.newSwitch{name="b16", x=580, y=380, disp=VKAdisp(16),code=VKAcode(16)}, - WIDGET.newSwitch{name="b17", x=580, y=440, disp=VKAdisp(17),code=VKAcode(17)}, - WIDGET.newSwitch{name="b18", x=580, y=500, disp=VKAdisp(18),code=VKAcode(18)}, - WIDGET.newSwitch{name="b19", x=580, y=560, disp=VKAdisp(19),code=VKAcode(19)}, - WIDGET.newSwitch{name="b20", x=580, y=620, disp=VKAdisp(20),code=VKAcode(20)}, + WIDGET.newSwitch{name="b1", x=280, y=80, disp=_VKAdisp(1),code=_VKAcode(1)}, + WIDGET.newSwitch{name="b2", x=280, y=140, disp=_VKAdisp(2),code=_VKAcode(2)}, + WIDGET.newSwitch{name="b3", x=280, y=200, disp=_VKAdisp(3),code=_VKAcode(3)}, + WIDGET.newSwitch{name="b4", x=280, y=260, disp=_VKAdisp(4),code=_VKAcode(4)}, + WIDGET.newSwitch{name="b5", x=280, y=320, disp=_VKAdisp(5),code=_VKAcode(5)}, + WIDGET.newSwitch{name="b6", x=280, y=380, disp=_VKAdisp(6),code=_VKAcode(6)}, + WIDGET.newSwitch{name="b7", x=280, y=440, disp=_VKAdisp(7),code=_VKAcode(7)}, + WIDGET.newSwitch{name="b8", x=280, y=500, disp=_VKAdisp(8),code=_VKAcode(8)}, + WIDGET.newSwitch{name="b9", x=280, y=560, disp=_VKAdisp(9),code=_VKAcode(9)}, + WIDGET.newSwitch{name="b10", x=280, y=620, disp=_VKAdisp(10),code=_VKAcode(10)}, + WIDGET.newSwitch{name="b11", x=580, y=80, disp=_VKAdisp(11),code=_VKAcode(11)}, + WIDGET.newSwitch{name="b12", x=580, y=140, disp=_VKAdisp(12),code=_VKAcode(12)}, + WIDGET.newSwitch{name="b13", x=580, y=200, disp=_VKAdisp(13),code=_VKAcode(13)}, + WIDGET.newSwitch{name="b14", x=580, y=260, disp=_VKAdisp(14),code=_VKAcode(14)}, + WIDGET.newSwitch{name="b15", x=580, y=320, disp=_VKAdisp(15),code=_VKAcode(15)}, + WIDGET.newSwitch{name="b16", x=580, y=380, disp=_VKAdisp(16),code=_VKAcode(16)}, + WIDGET.newSwitch{name="b17", x=580, y=440, disp=_VKAdisp(17),code=_VKAcode(17)}, + WIDGET.newSwitch{name="b18", x=580, y=500, disp=_VKAdisp(18),code=_VKAcode(18)}, + WIDGET.newSwitch{name="b19", x=580, y=560, disp=_VKAdisp(19),code=_VKAcode(19)}, + WIDGET.newSwitch{name="b20", x=580, y=620, disp=_VKAdisp(20),code=_VKAcode(20)}, WIDGET.newButton{name="norm", x=840, y=80, w=240,h=80, font=35,code=function()for i=1,20 do VK_org[i].ava=i<11 end end}, WIDGET.newButton{name="pro", x=1120, y=80, w=240,h=80, font=35,code=function()for i=1,20 do VK_org[i].ava=true end end}, WIDGET.newSwitch{name="hide", x=1150, y=200, font=40,disp=SETval("VKSwitch"),code=SETrev("VKSwitch")}, - WIDGET.newSwitch{name="icon", x=1150, y=300, font=40,disp=SETval("VKIcon"),code=SETrev("VKIcon"),hideF=notShow}, - WIDGET.newSlider{name="sfx", x=830, y=380, w=400, font=35,change=function()SFX.play('virtualKey',SETTING.VKSFX)end,disp=SETval("VKSFX"),code=SETsto("VKSFX"),hideF=notShow}, - WIDGET.newSlider{name="vib", x=830, y=450, w=400,unit=6,font=35,change=function()VIB(SETTING.VKVIB)end,disp=SETval("VKVIB"),code=SETsto("VKVIB"),hideF=notShow}, - WIDGET.newSlider{name="alpha", x=830, y=520, w=400, font=40,disp=SETval("VKAlpha"),code=SETsto("VKAlpha"),hideF=notShow}, + WIDGET.newSwitch{name="icon", x=1150, y=300, font=40,disp=SETval("VKIcon"),code=SETrev("VKIcon"),hideF=_notShow}, + WIDGET.newSlider{name="sfx", x=830, y=380, w=400, font=35,change=function()SFX.play('virtualKey',SETTING.VKSFX)end,disp=SETval("VKSFX"),code=SETsto("VKSFX"),hideF=_notShow}, + WIDGET.newSlider{name="vib", x=830, y=450, w=400,unit=6,font=35,change=function()VIB(SETTING.VKVIB)end,disp=SETval("VKVIB"),code=SETsto("VKVIB"),hideF=_notShow}, + WIDGET.newSlider{name="alpha", x=830, y=520, w=400, font=40,disp=SETval("VKAlpha"),code=SETsto("VKAlpha"),hideF=_notShow}, - WIDGET.newSwitch{name="track", x=360, y=720, font=35,disp=SETval("VKTrack"),code=SETrev("VKTrack"),hideF=notShow}, - WIDGET.newSwitch{name="dodge", x=800, y=720, font=35,disp=SETval("VKDodge"),code=SETrev("VKDodge"),hideF=notTrack}, - WIDGET.newSlider{name="tchW", x=140, y=860, w=1000, font=35,disp=SETval("VKTchW"),code=function(i)SETTING.VKTchW=i SETTING.VKCurW=math.max(SETTING.VKCurW,i)end,hideF=notTrack}, - WIDGET.newSlider{name="curW", x=140, y=930, w=1000, font=35,disp=SETval("VKCurW"),code=function(i)SETTING.VKCurW=i SETTING.VKTchW=math.min(SETTING.VKTchW,i)end,hideF=notTrack}, + WIDGET.newSwitch{name="track", x=360, y=720, font=35,disp=SETval("VKTrack"),code=SETrev("VKTrack"),hideF=_notShow}, + WIDGET.newSwitch{name="dodge", x=800, y=720, font=35,disp=SETval("VKDodge"),code=SETrev("VKDodge"),hideF=_notTrack}, + WIDGET.newSlider{name="tchW", x=140, y=860, w=1000, font=35,disp=SETval("VKTchW"),code=function(i)SETTING.VKTchW=i SETTING.VKCurW=math.max(SETTING.VKCurW,i)end,hideF=_notTrack}, + WIDGET.newSlider{name="curW", x=140, y=930, w=1000, font=35,disp=SETval("VKCurW"),code=function(i)SETTING.VKCurW=i SETTING.VKTchW=math.min(SETTING.VKTchW,i)end,hideF=_notTrack}, WIDGET.newButton{name="back", x=1140, y=640, w=170,h=80,fText=TEXTURE.back,code=backScene}, } diff --git a/parts/scenes/test.lua b/parts/scenes/test.lua index 883928a1..1af16474 100644 --- a/parts/scenes/test.lua +++ b/parts/scenes/test.lua @@ -5,7 +5,7 @@ local scene={} local backCounter local list,timer -local function push(mes) +local function _push(mes) ins(list,{mes,120}) timer=1 end @@ -17,14 +17,14 @@ function scene.sceneInit() end function scene.gamepadDown(key) - push("[gamepadDown] <"..key..">") + _push("[gamepadDown] <"..key..">") end function scene.gamepadUp(key) - push{COLOR.H,"[gamepadUp] <"..key..">"} + _push{COLOR.H,"[gamepadUp] <"..key..">"} end function scene.keyDown(key,isRep) if isRep then return end - push("[keyDown] <"..key..">") + _push("[keyDown] <"..key..">") if key=="escape"then backCounter=backCounter-1 if backCounter==0 then @@ -35,46 +35,46 @@ function scene.keyDown(key,isRep) end end function scene.keyUp(key) - push{COLOR.H,"[keyUp] <"..key..">"} + _push{COLOR.H,"[keyUp] <"..key..">"} end function scene.mouseClick(x,y) SYSFX.newRipple(.5,x,y,50) - push("[mouseClick]") + _push("[mouseClick]") end function scene.mouseDown(x,y,k) SYSFX.newShade(.5,x-10,y-10,20,20) - push(("[mouseDown] <%d: %d, %d>"):format(k,x,y)) + _push(("[mouseDown] <%d: %d, %d>"):format(k,x,y)) end function scene.mouseMove(x,y) SYSFX.newShade(.5,x-3,y-3,6,6) end function scene.mouseUp(x,y,k) SYSFX.newRectRipple(1,x-10,y-10,20,20) - push{COLOR.H,"[mouseUp] <"..k..">"} + _push{COLOR.H,"[mouseUp] <"..k..">"} end function scene.touchClick(x,y) SYSFX.newRipple(.5,x,y,50) - push("[touchClick]") + _push("[touchClick]") end function scene.touchDown(x,y) SYSFX.newShade(.5,x-10,y-10,20,20) - push(("[touchDown] <%d, %d>"):format(x,y)) + _push(("[touchDown] <%d, %d>"):format(x,y)) end function scene.touchMove(x,y) SYSFX.newShade(.5,x-3,y-3,6,6) end function scene.touchUp(x,y) SYSFX.newRectRipple(1,x-10,y-10,20,20) - push{COLOR.H,"[touchUp]"} + _push{COLOR.H,"[touchUp]"} end function scene.wheelMoved(dx,dy) - push(("[wheelMoved] <%d, %d>"):format(dx,dy)) + _push(("[wheelMoved] <%d, %d>"):format(dx,dy)) end function scene.fileDropped(file) - push(("[fileDropped] <%s>"):format(file:getFilename())) + _push(("[fileDropped] <%s>"):format(file:getFilename())) end function scene.directoryDropped(path) - push(("[directoryDropped] <%s>"):format(path)) + _push(("[directoryDropped] <%s>"):format(path)) end function scene.update(dt) diff --git a/parts/updateLog.lua b/parts/updateLog.lua index ee4124ea..cb06b176 100644 --- a/parts/updateLog.lua +++ b/parts/updateLog.lua @@ -36,11 +36,14 @@ return[=[ 添加SRS_X旋转系统:基于SRS,I块和除了PQ的非四连块使用TRS的表 改动: 增大场地晃动的阻力,看起来更舒服 + 平滑下落的消行动画曲线稍微拉直一些 + 消除目标线高度会在消行时跟随平滑下落动画 #208 代码: 重做ai相关,新增BOT模块方便未来接入更多机器人 修改主循环帧率限制策略,尝试修复部分设备帧率不稳定(可能消耗更多性能) 大规模整理ai相关代码 方块对象内记录旋转系统 + 大规模整理玩家创建特效相关方法 调整loadLib加载安卓so库的策略 修复: master-ph模式录像回放时有不一致 #226 @@ -50,6 +53,7 @@ return[=[ 混战模式的被攻击线位置错误 小程序15p开盲打报错 f11开关全屏时不会自动保存 #230 + 非sudomode下控制台#print非字符串报错 #231 0.16.1: 深空 Deep space 新增: diff --git a/parts/users.lua b/parts/users.lua index 4ec6ee73..1f4a30b7 100644 --- a/parts/users.lua +++ b/parts/users.lua @@ -20,7 +20,7 @@ local errorAvatar=GC.DO{128,128, {'line',10,10,117,117}, {'line',10,117,117,10}, } -local function loadAvatar(path) +local function _loadAvatar(path) local success,img=pcall(gc.newImage,path) if success then local canvas=gc.newCanvas(128,128) @@ -45,7 +45,7 @@ local db=setmetatable({},{__index=function(self,uid) rawset(self,uid,d) db_img[uid]= type(d.hash)=='string'and #d.hash>0 and fs.getInfo("cache/"..d.hash)and - loadAvatar("cache/"..d.hash)or + _loadAvatar("cache/"..d.hash)or defaultAvatar[(uid-26)%29+1] return d end}) @@ -63,7 +63,7 @@ function USERS.updateUserData(data) }) if data.avatar then fs.write("cache/"..data.hash,love.data.decode('string','base64',data.avatar:sub(data.avatar:find(",")+1))) - db_img[uid]=loadAvatar("cache/"..data.hash) + db_img[uid]=_loadAvatar("cache/"..data.hash) db[uid].hash=type(data.hash)=='string'and #data.hash>0 and data.hash end end