diff --git a/Zframework b/Zframework index 5bd04c8c..d86dba11 160000 --- a/Zframework +++ b/Zframework @@ -1 +1 @@ -Subproject commit 5bd04c8ce2101eb6b31c27da1c9db41d66c9376f +Subproject commit d86dba11eabd3eb0c1cb23f5716ebc389f35e848 diff --git a/conf.lua b/conf.lua index 0cb09d85..ef1723c0 100644 --- a/conf.lua +++ b/conf.lua @@ -1,9 +1,9 @@ function love.conf(t) - t.identity='Techmino'--Saving folder + t.identity='Techmino'-- Saving folder t.version="11.1" t.gammacorrect=false - t.appendidentity=true--Search files in source then in save directory - t.accelerometerjoystick=false--Accelerometer=joystick on ios/android + t.appendidentity=true-- Search files in source then in save directory + t.accelerometerjoystick=false-- Accelerometer=joystick on ios/android if t.audio then t.audio.mic=false t.audio.mixwithsystem=true @@ -16,12 +16,12 @@ function love.conf(t) W.borderless=false W.resizable=true W.fullscreen=false - W.vsync=0--Unlimited FPS - W.msaa=0--Multi-sampled antialiasing - W.depth=0--Bits/samp of depth buffer - W.stencil=1--Bits/samp of stencil buffer - W.display=1--Monitor ID - W.highdpi=true--High-dpi mode for the window on a Retina display + W.vsync=0-- Unlimited FPS + W.msaa=0-- Multi-sampled antialiasing + W.depth=0-- Bits/samp of depth buffer + W.stencil=1-- Bits/samp of stencil buffer + W.display=1-- Monitor ID + W.highdpi=true-- High-dpi mode for the window on a Retina display W.x,W.y=nil local M=t.modules diff --git a/main.lua b/main.lua index a1728835..9e63dff7 100644 --- a/main.lua +++ b/main.lua @@ -15,26 +15,24 @@ ]]-- ---Var leak check --- setmetatable(_G,{__newindex=function(self,k,v)print('>>'..k)print(debug.traceback():match("\n.-\n\t(.-): "))rawset(self,k,v)end}) +-- Var leak check +-- setmetatable(_G,{__newindex=function(self,k,v) print('>>'..k..string.rep(" ",26-#k),debug.traceback():match("\n.-\n\t(.-): "))rawset(self,k,v) end}) ---System Global Vars Declaration +-- System Global Vars Declaration local fs=love.filesystem VERSION=require"version" TIME=love.timer.getTime -YIELD=coroutine.yield -SYSTEM=love.system.getOS()if SYSTEM=='OS X'then SYSTEM='macOS'end -FNNS=SYSTEM:find'\79\83'--What does FNSF stand for? IDK so don't ask me lol -MOBILE=SYSTEM=='Android'or SYSTEM=='iOS' -SAVEDIR=fs.getSaveDirectory() +SYSTEM=love.system.getOS() if SYSTEM=='OS X' then SYSTEM='macOS' end +FNNS=SYSTEM:find'\79\83'-- What does FNSF stand for? IDK so don't ask me lol +MOBILE=SYSTEM=='Android' or SYSTEM=='iOS' ---Global Vars & Settings +-- Global Vars & Settings SFXPACKS={'chiptune'} VOCPACKS={'miya','mono','xiaoya','miku'} FIRSTLAUNCH=false DAILYLAUNCH=false ---System setting +-- System setting math.randomseed(os.time()*626) love.setDeprecationOutput(false) love.keyboard.setKeyRepeat(true) @@ -48,7 +46,7 @@ end local _LOADTIMELIST_={} local _LOADTIME_=TIME() ---Load modules +-- Load modules Z=require'Zframework' FONT.load{ norm='parts/fonts/proportional.otf', @@ -57,12 +55,12 @@ FONT.load{ FONT.setDefault('norm') FONT.setFallback('norm') -SCR.setSize(1280,720)--Initialize Screen size +SCR.setSize(1280,720)-- Initialize Screen size BGM.setMaxSources(5) VOC.setDiversion(.62) WIDGET.setOnChange(function() - if SCN.cur~='custom_field'then + if SCN.cur~='custom_field' then local colorList=THEME.getThemeColor() if not colorList then return end local rnd=math.random @@ -76,7 +74,7 @@ end) table.insert(_LOADTIMELIST_,("Load Zframework: %.3fs"):format(TIME()-_LOADTIME_)) ---Create shortcuts +-- Create shortcuts setFont=FONT.set getFont=FONT.get mText=GC.simpX @@ -86,15 +84,15 @@ string.repD=STRING.repD string.sArg=STRING.sArg string.split=STRING.split ---Delete all naked files (from ancient versions) +-- Delete all naked files (from ancient versions) FILE.clear('') ---Create directories -for _,v in next,{'conf','record','replay','cache','lib'}do +-- Create directories +for _,v in next,{'conf','record','replay','cache','lib'} do local info=fs.getInfo(v) if not info then fs.createDirectory(v) - elseif info.type~='directory'then + elseif info.type~='directory' then fs.remove(v) fs.createDirectory(v) end @@ -104,10 +102,10 @@ CHAR=require'parts.char' require'parts.gameTables' require'parts.gameFuncs' ---Load shader files from SOURCE ONLY +-- Load shader files from SOURCE ONLY SHADER={} -for _,v in next,fs.getDirectoryItems('parts/shaders')do - if isSafeFile('parts/shaders/'..v)then +for _,v in next,fs.getDirectoryItems('parts/shaders') do + if FILE.isSafe('parts/shaders/'..v) then local name=v:sub(1,-6) SHADER[name]=love.graphics.newShader('parts/shaders/'..name..'.glsl') end @@ -136,8 +134,8 @@ end}) table.insert(_LOADTIMELIST_,("Load Parts: %.3fs"):format(TIME()-_LOADTIME_)) ---Init Zframework -do--Z.setCursor +-- Init Zframework +do-- Z.setCursor local normImg=GC.DO{16,16, {'fCirc',8,8,4}, {'setCL',1,1,1,.7}, @@ -148,6 +146,7 @@ do--Z.setCursor {'dCirc',8,8,7}, {'fCirc',8,8,3}, } + local _ Z.setCursor(function(time,x,y) if not SETTING.sysCursor then local R=math.floor((time+1)/2)%7+1 @@ -156,14 +155,14 @@ do--Z.setCursor _=DSCP[R][0] GC.draw(TEXTURE.miniBlock[R],x,y,time%math.pi*4,8,8,2*_[2]+1,2*(#BLOCKS[R][0]-_[1])-1) GC.setColor(1,1,1) - GC.draw(love.mouse.isDown(1)and holdImg or normImg,x,y,nil,nil,nil,8,8) + GC.draw(love.mouse.isDown(1) and holdImg or normImg,x,y,nil,nil,nil,8,8) end end) end Z.setOnFnKeys({ - function()MES.new('check',PROFILE.switch()and"profile start!"or"profile report copied!")end, - function()MES.new('info',("System:%s[%s]\nluaVer:%s\njitVer:%s\njitVerNum:%s"):format(SYSTEM,jit.arch,_VERSION,jit.version,jit.version_num))end, - function()MES.new('error',"挂了")end, + function() MES.new('check',PROFILE.switch() and "profile start!" or "profile report copied!") end, + function() MES.new('info',("System:%s[%s]\nluaVer:%s\njitVer:%s\njitVerNum:%s"):format(SYSTEM,jit.arch,_VERSION,jit.version,jit.version_num)) end, + function() MES.new('error',"挂了") end, function() if GAME.playing and not GAME.net then for _=1,8 do @@ -175,17 +174,23 @@ Z.setOnFnKeys({ end end end, - function()print(BG.locked)end, - function()for k,v in next,_G do print(k,v)end end, - function()if love['_openConsole']then love['_openConsole']()end end, + function() print(BG.locked) end, + function() for k,v in next,_G do print(k,v) end end, + function() if love['_openConsole'] then love['_openConsole']() end end, }) +Z.setOnGlobalKey('f11',function() + SETTING.fullscreen=not SETTING.fullscreen + applySettings() + saveSettings() +end) +Z.setVersionText(VERSION.string) Z.setDebugInfo{ {"Cache",gcinfo}, {"Tasks",TASK.getCount}, {"Voices",VOC.getQueueCount}, {"Audios",love.audio.getSourceCount}, } -do--Z.setOnFocus +do-- Z.setOnFocus local function task_autoSoundOff() while true do coroutine.yield() @@ -213,7 +218,7 @@ do--Z.setOnFocus TASK.new(task_autoSoundOn) end else - if SCN.cur=='game'and SETTING.autoPause then + if SCN.cur=='game' and SETTING.autoPause then pauseGame() end if SETTING.autoMute and SCN.cur~='music' then @@ -223,23 +228,32 @@ do--Z.setOnFocus end end) end -Z.setOnQuit(destroyPlayers) +Z.setOnBeforeQuit(function() + NET.ws_close() + TASK.new(function() + TEST.yieldT(.26) + love.event.quit() + end) +end) +Z.setOnQuit(function() + destroyPlayers() +end) ---Load settings and statistics +-- Load settings and statistics if - not( - pcall(TABLE.cover, loadFile('conf/user', '-json -canSkip')or loadFile('conf/user', '-luaon -canSkip')or{},USER) and - pcall(TABLE.cover, loadFile('conf/unlock', '-json -canSkip')or loadFile('conf/unlock', '-luaon -canSkip')or{},RANKS) and - pcall(TABLE.update,loadFile('conf/settings', '-json -canSkip')or loadFile('conf/settings', '-luaon -canSkip')or{},SETTING) and - pcall(TABLE.coverR,loadFile('conf/data', '-json -canSkip')or loadFile('conf/data', '-luaon -canSkip')or{},STAT) and - pcall(TABLE.cover, loadFile('conf/key', '-json -canSkip')or loadFile('conf/key', '-luaon -canSkip')or{},KEY_MAP) and - pcall(TABLE.cover, loadFile('conf/virtualkey','-json -canSkip')or loadFile('conf/virtualkey','-luaon -canSkip')or{},VK_ORG) + not ( + pcall(TABLE.cover, loadFile('conf/user', '-json -canSkip') or loadFile('conf/user', '-luaon -canSkip') or{},USER) and + pcall(TABLE.cover, loadFile('conf/unlock', '-json -canSkip') or loadFile('conf/unlock', '-luaon -canSkip') or{},RANKS) and + pcall(TABLE.update,loadFile('conf/settings', '-json -canSkip') or loadFile('conf/settings', '-luaon -canSkip') or{},SETTING) and + pcall(TABLE.coverR,loadFile('conf/data', '-json -canSkip') or loadFile('conf/data', '-luaon -canSkip') or{},STAT) and + pcall(TABLE.cover, loadFile('conf/key', '-json -canSkip') or loadFile('conf/key', '-luaon -canSkip') or{},KEY_MAP) and + pcall(TABLE.cover, loadFile('conf/virtualkey','-json -canSkip') or loadFile('conf/virtualkey','-luaon -canSkip') or{},VK_ORG) ) then MES.new('error',"An error occured during loading, and some data was lost.") end ---Initialize fields, sequence, missions, gameEnv for cutsom game +-- Initialize fields, sequence, missions, gameEnv for cutsom game local fieldData=loadFile('conf/customBoards','-string -canSkip') if fieldData then fieldData=STRING.split(fieldData,"!") @@ -264,7 +278,7 @@ end TABLE.complete(require"parts.customEnv0",CUSTOMENV) ---Initialize image libs +-- Initialize image libs IMG.init{ lock='media/image/mess/lock.png', dialCircle='media/image/mess/dialCircle.png', @@ -343,11 +357,11 @@ SKIN.load{ {name="wtf",path='media/image/skin/wtf_mrz.png'}, } ---Initialize sound libs +-- Initialize sound libs SFX.init((function()--[Warning] Not loading files here, just get the list of sound needed local L={} - for _,v in next,fs.getDirectoryItems('media/effect/chiptune/')do - if isSafeFile('media/effect/chiptune/'..v,"Dangerous file : %SAVE%/media/effect/chiptune/"..v)then + for _,v in next,fs.getDirectoryItems('media/effect/chiptune/') do + if FILE.isSafe('media/effect/chiptune/'..v,"Dangerous file : %SAVE%/media/effect/chiptune/"..v) then table.insert(L,v:sub(1,-5)) end end @@ -355,8 +369,8 @@ SFX.init((function()--[Warning] Not loading files here, just get the list of sou end)()) BGM.init((function() local L={} - for _,v in next,fs.getDirectoryItems('media/music')do - if isSafeFile('media/music/'..v,"Dangerous file : %SAVE%/media/music/"..v)then + for _,v in next,fs.getDirectoryItems('media/music') do + if FILE.isSafe('media/music/'..v,"Dangerous file : %SAVE%/media/music/"..v) then L[v:sub(1,-5)]='media/music/'..v end end @@ -372,7 +386,7 @@ VOC.init{ 'welcome', } ---Initialize language lib +-- Initialize language lib LANG.init('zh', { zh=require'parts.language.lang_zh', @@ -385,17 +399,17 @@ LANG.init('zh', ja=require'parts.language.lang_ja', symbol=require'parts.language.lang_symbol', zh_code=require'parts.language.lang_zh_code', - --1. Add language file to LANG folder; - --2. Require it; - --3. Add a button in parts/scenes/lang.lua; + -- 1. Add language file to LANG folder; + -- 2. Require it; + -- 3. Add a button in parts/scenes/lang.lua; }, { block=BLOCK_NAMES }, (function() - local tipMeta={__call=function(L)return L[math.random(#L)]end} + local tipMeta={__call=function(L) return L[math.random(#L)] end} return function(L) - if type(rawget(L,'getTip'))=='table'then setmetatable(L.getTip,tipMeta)end + if type(rawget(L,'getTip'))=='table' then setmetatable(L.getTip,tipMeta) end setmetatable(L,{__index=function(self,k) local mes="No Text ("..SETTING.locale.."): "..k LOG(mes) @@ -409,32 +423,32 @@ LANG.init('zh', table.insert(_LOADTIMELIST_,("Initialize Parts: %.3fs"):format(TIME()-_LOADTIME_)) ---Load background files from SOURCE ONLY -for _,v in next,fs.getDirectoryItems('parts/backgrounds')do - if isSafeFile('parts/backgrounds/'..v)and v:sub(-3)=='lua'then +-- Load background files from SOURCE ONLY +for _,v in next,fs.getDirectoryItems('parts/backgrounds') do + if FILE.isSafe('parts/backgrounds/'..v) and v:sub(-3)=='lua' then local name=v:sub(1,-5) BG.add(name,require('parts.backgrounds.'..name)) end end BG.remList('none')BG.remList('gray')BG.remList('custom') ---Load scene files from SOURCE ONLY -for _,v in next,fs.getDirectoryItems('parts/scenes')do - if isSafeFile('parts/scenes/'..v)then +-- Load scene files from SOURCE ONLY +for _,v in next,fs.getDirectoryItems('parts/scenes') do + if FILE.isSafe('parts/scenes/'..v) then local sceneName=v:sub(1,-5) SCN.add(sceneName,require('parts.scenes.'..sceneName)) LANG.addScene(sceneName) end end ---Load mode files +-- Load mode files for i=1,#MODES do - local m=MODES[i]--Mode template - if isSafeFile('parts/modes/'..m.name)then + local m=MODES[i]-- Mode template + if FILE.isSafe('parts/modes/'..m.name) then TABLE.complete(require('parts.modes.'..m.name),MODES[i]) MODES[m.name],MODES[i]=MODES[i] end end -for _,v in next,fs.getDirectoryItems('parts/modes')do - if isSafeFile('parts/modes/'..v)and not MODES[v:sub(1,-5)]then +for _,v in next,fs.getDirectoryItems('parts/modes') do + if FILE.isSafe('parts/modes/'..v) and not MODES[v:sub(1,-5)] then local M={name=v:sub(1,-5)} local modeData=require('parts.modes.'..M.name) if modeData.env then @@ -446,14 +460,14 @@ end table.insert(_LOADTIMELIST_,("Load Files: %.3fs"):format(TIME()-_LOADTIME_)) ---Update data +-- Update data do local needSave - if not fs.getInfo('conf/data')then + if not fs.getInfo('conf/data') then needSave=true end - if type(STAT.version)~='number'then + if type(STAT.version)~='number' then STAT.version=0 needSave=true end @@ -466,10 +480,10 @@ do end if STAT.version==1506 then local temp1,temp2 - if fs.getInfo('record/master_l.rec')then + if fs.getInfo('record/master_l.rec') then temp1=fs.read('record/master_l.rec') end - if fs.getInfo('record/master_u.rec')then + if fs.getInfo('record/master_u.rec') then temp2=fs.read('record/master_u.rec') end if temp1 then @@ -529,16 +543,16 @@ do end if STAT.version~=VERSION.code then for k,v in next,MODE_UPDATE_MAP do - if RANKS[k]then + if RANKS[k] then RANKS[v]=RANKS[k] RANKS[k]=nil end k='record/'..k - if fs.getInfo(k..'.dat')then + if fs.getInfo(k..'.dat') then fs.write('record/'..v..'.rec',fs.read(k..'.dat')) fs.remove(k..'.dat') end - if fs.getInfo(k..'.rec')then + if fs.getInfo(k..'.rec') then fs.write('record/'..v..'.rec',fs.read(k..'.rec')) fs.remove(k..'.rec') end @@ -546,15 +560,15 @@ do STAT.version=VERSION.code needSave=true end - SETTING.appLock,SETTING.dataSaving,SETTING.swap=nil + SETTING.appLock,SETTING.dataSaving,SETTING.swap,SETTING.autoLogin=nil if not SETTING.VKSkin then SETTING.VKSkin=1 end for _,v in next,SETTING.skin do if v<1 or v>17 then v=17 end end - if not RSlist[SETTING.RS]then SETTING.RS='TRS'end - if SETTING.ghostType=='greyCell'then SETTING.ghostType='grayCell'end - if type(SETTING.skinSet)=='number'then SETTING.skinSet='crystal_scf'end - if not TABLE.find({8,10,13,17,22,29,37,47,62,80,100},SETTING.frameMul)then SETTING.frameMul=100 end + if not RSlist[SETTING.RS] then SETTING.RS='TRS' end + if SETTING.ghostType=='greyCell' then SETTING.ghostType='grayCell' end + if type(SETTING.skinSet)=='number' then SETTING.skinSet='crystal_scf' end + if not TABLE.find({8,10,13,17,22,29,37,47,62,80,100},SETTING.frameMul) then SETTING.frameMul=100 end if SETTING.cv then SETTING.vocPack,SETTING.cv=SETTING.cv end - if type(SETTING.bg)~='string'then SETTING.bg='on'end + if type(SETTING.bg)~='string' then SETTING.bg='on' end if SETTING.skin[18]==10 then SETTING.skin[18]=4 end if SETTING.reTime>3 or SETTING.reTime<.5 then SETTING.reTime=2 end if SETTING.locale=='zh_full' then SETTING.locale='zh' end @@ -566,26 +580,26 @@ do if RANKS.master_u then RANKS.master_h,RANKS.master_u=RANKS.master_u needSave=true end for _,v in next,VK_ORG do v.color=nil end for name,rank in next,RANKS do - if type(name)=='number'or type(rank)~='number'then + if type(name)=='number' or type(rank)~='number' then RANKS[name]=nil needSave=true else local M=MODES[name] if M and M.unlock and rank>0 then for _,unlockName in next,M.unlock do - if not RANKS[unlockName]then + if not RANKS[unlockName] then RANKS[unlockName]=0 needSave=true end end end - if not(M and M.x)then + if not (M and M.x) then RANKS[name]=nil needSave=true end end end - if not MODES[STAT.lastPlay]then + if not MODES[STAT.lastPlay] then STAT.lastPlay='sprint_10l' needSave=true end @@ -598,7 +612,7 @@ do end end ---First start +-- First start FIRSTLAUNCH=STAT.run==0 if FIRSTLAUNCH and MOBILE then SETTING.VKSwitch=true @@ -606,18 +620,18 @@ if FIRSTLAUNCH and MOBILE then SETTING.cleanCanvas=true end ---Apply system setting +-- Apply system setting applySettings() ---Load replays -for _,fileName in next,fs.getDirectoryItems('replay')do - if fileName:sub(12,12):match("[a-zA-Z]")then +-- Load replays +for _,fileName in next,fs.getDirectoryItems('replay') do + if fileName:sub(12,12):match("[a-zA-Z]") then local date,mode,version,player,seed,setting,mod local fileData=fs.read('replay/'..fileName) date, fileData=STRING.readLine(fileData)date=date:gsub("[a-zA-Z]","") - mode, fileData=STRING.readLine(fileData)mode=MODE_UPDATE_MAP[mode]or mode + mode, fileData=STRING.readLine(fileData)mode=MODE_UPDATE_MAP[mode] or mode version,fileData=STRING.readLine(fileData) - player, fileData=STRING.readLine(fileData)if player=="Local Player"then player="Stacker"end + player, fileData=STRING.readLine(fileData) if player=="Local Player" then player="Stacker" end local success success,fileData=pcall(love.data.decompress,'string','zlib',fileData) if not success then goto BREAK_cannotParse end @@ -653,16 +667,16 @@ for _,fileName in next,fs.getDirectoryItems('replay')do local rep=DATA.parseReplay('replay/'..fileName) table.insert(REPLAY,rep) end -table.sort(REPLAY,function(a,b)return a.fileName>b.fileName end) +table.sort(REPLAY,function(a,b) return a.fileName>b.fileName end) table.insert(_LOADTIMELIST_,("Initialize Data: %.3fs"):format(TIME()-_LOADTIME_)) -for i=1,#_LOADTIMELIST_ do LOG(_LOADTIMELIST_[i])end +for i=1,#_LOADTIMELIST_ do LOG(_LOADTIMELIST_[i]) end ---Launch testing task if launch param received -if TABLE.find(arg,'--test')then +-- Launch testing task if launch param received +if TABLE.find(arg,'-- test') then TASK.new(function() - while not LOADED do YIELD()end + while not LOADED do coroutine.yield() end LOG("\27[92m\27[1mAutomatic Test Started\27[0m") BGM.setVol(0)SFX.setVol(0) @@ -670,7 +684,7 @@ if TABLE.find(arg,'--test')then TEST.yieldUntilNextScene() for k,mode in next,MODES do - if k~='netBattle'then + if k~='netBattle' then LOG("Scanning mode: "..mode.name) loadGame(mode.name,true) TEST.yieldUntilNextScene() @@ -684,12 +698,14 @@ if TABLE.find(arg,'--test')then end) TASK.new(function() while true do - YIELD() - if Z.getErr(1)then break end + coroutine.yield() + if Z.getErr(1) then break end end LOG("\27[91m\27[1mAutomatic Test Failed :(\27[0m\nThe error message is:\n"..table.concat(Z.getErr(1).mes,"\n").."\27[91m\nAborting\27[0m") TEST.yieldN(60) love.event.quit(1) end) end -WS.switchHost('101.43.110.22','10026','/tech/socket/v1') +WS.switchHost('cafuuchino1.3322.org','10026','/techmino/ws/v1') +HTTP.setHost("cafuuchino1.3322.org:10026") +HTTP.setThreadCount(1) diff --git a/parts/RSlist.lua b/parts/RSlist.lua index 69e9aec2..0fa118f6 100644 --- a/parts/RSlist.lua +++ b/parts/RSlist.lua @@ -1,43 +1,43 @@ -local defaultCenterTex=GC.DO{1,1}--No texture -local defaultCenterPos={--For SRS-like RSs - --Tetromino - {[0]={0,1},{1,0},{1,1},{1,1}},--Z - {[0]={0,1},{1,0},{1,1},{1,1}},--S - {[0]={0,1},{1,0},{1,1},{1,1}},--J - {[0]={0,1},{1,0},{1,1},{1,1}},--L - {[0]={0,1},{1,0},{1,1},{1,1}},--T - {[0]={.5,.5},{.5,.5},{.5,.5},{.5,.5}},--O - {[0]={-.5,1.5},{1.5,-.5},{.5,1.5},{1.5,.5}},--I +local defaultCenterTex=GC.DO{1,1}-- No texture +local defaultCenterPos={-- For SRS-like RSs + -- Tetromino + {[0]={0,1},{1,0},{1,1},{1,1}},-- Z + {[0]={0,1},{1,0},{1,1},{1,1}},-- S + {[0]={0,1},{1,0},{1,1},{1,1}},-- J + {[0]={0,1},{1,0},{1,1},{1,1}},-- L + {[0]={0,1},{1,0},{1,1},{1,1}},-- T + {[0]={.5,.5},{.5,.5},{.5,.5},{.5,.5}},-- O + {[0]={-.5,1.5},{1.5,-.5},{.5,1.5},{1.5,.5}},-- I - --Pentomino - {[0]={1,1},{1,1},{1,1},{1,1}},--Z5 - {[0]={1,1},{1,1},{1,1},{1,1}},--S5 - {[0]={0,1},{1,0},{1,1},{1,1}},--P - {[0]={0,1},{1,0},{1,1},{1,1}},--Q - {[0]={1,1},{1,1},{1,1},{1,1}},--F - {[0]={1,1},{1,1},{1,1},{1,1}},--E - {[0]={1,1},{1,1},{1,1},{1,1}},--T5 - {[0]={0,1},{1,0},{1,1},{1,1}},--U - {[0]={.5,1.5},{.5,.5},{1.5,.5},{1.5,1.5}},--V - {[0]={1,1},{1,1},{1,1},{1,1}},--W - {[0]={1,1},{1,1},{1,1},{1,1}},--X - {[0]={.5,1.5},{1.5,.5},{.5,1.5},{1.5,.5}},--J5 - {[0]={.5,1.5},{1.5,.5},{.5,1.5},{1.5,.5}},--L5 - {[0]={.5,1.5},{1.5,.5},{.5,1.5},{1.5,.5}},--R - {[0]={.5,1.5},{1.5,.5},{.5,1.5},{1.5,.5}},--Y - {[0]={.5,1.5},{1.5,.5},{.5,1.5},{1.5,.5}},--N - {[0]={.5,1.5},{1.5,.5},{.5,1.5},{1.5,.5}},--H - {[0]={0,2},{2,0},{0,2},{2,0}},--I5 + -- Pentomino + {[0]={1,1},{1,1},{1,1},{1,1}},-- Z5 + {[0]={1,1},{1,1},{1,1},{1,1}},-- S5 + {[0]={0,1},{1,0},{1,1},{1,1}},-- P + {[0]={0,1},{1,0},{1,1},{1,1}},-- Q + {[0]={1,1},{1,1},{1,1},{1,1}},-- F + {[0]={1,1},{1,1},{1,1},{1,1}},-- E + {[0]={1,1},{1,1},{1,1},{1,1}},-- T5 + {[0]={0,1},{1,0},{1,1},{1,1}},-- U + {[0]={.5,1.5},{.5,.5},{1.5,.5},{1.5,1.5}},-- V + {[0]={1,1},{1,1},{1,1},{1,1}},-- W + {[0]={1,1},{1,1},{1,1},{1,1}},-- X + {[0]={.5,1.5},{1.5,.5},{.5,1.5},{1.5,.5}},-- J5 + {[0]={.5,1.5},{1.5,.5},{.5,1.5},{1.5,.5}},-- L5 + {[0]={.5,1.5},{1.5,.5},{.5,1.5},{1.5,.5}},-- R + {[0]={.5,1.5},{1.5,.5},{.5,1.5},{1.5,.5}},-- Y + {[0]={.5,1.5},{1.5,.5},{.5,1.5},{1.5,.5}},-- N + {[0]={.5,1.5},{1.5,.5},{.5,1.5},{1.5,.5}},-- H + {[0]={0,2},{2,0},{0,2},{2,0}},-- I5 - --Trimino - {[0]={0,1},{1,0},{0,1},{1,0}},--I3 - {[0]={.5,.5},{.5,.5},{.5,.5},{.5,.5}},--C + -- Trimino + {[0]={0,1},{1,0},{0,1},{1,0}},-- I3 + {[0]={.5,.5},{.5,.5},{.5,.5},{.5,.5}},-- C - --Domino - {[0]={-.5,.5},{.5,-.5},{.5,.5},{.5,.5}},--I2 + -- Domino + {[0]={-.5,.5},{.5,-.5},{.5,.5},{.5,.5}},-- I2 - --Dot - {[0]={0,0},{0,0},{0,0},{0,0}},--O1 + -- Dot + {[0]={0,0},{0,0},{0,0},{0,0}},-- O1 } local noKickSet,noKickSet_180 do @@ -52,14 +52,14 @@ local function _strToVec(list) return list end ---Use this if the block is centrosymmetry, *PTR!!! +-- Use this if the block is centrosymmetry, *PTR!!! 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 +-- Use this to copy a symmetry set local function _flipList(O) if not O then return @@ -91,21 +91,21 @@ end local TRS do local OspinList={ - {111,5,2, 0,-1,0},{111,5,2,-1,-1,0},{111,5,0,-1, 0,0},--T - {333,5,2,-1,-1,0},{333,5,2, 0,-1,0},{333,5,0, 0, 0,0},--T - {313,1,2,-1, 0,0},{313,1,2, 0,-1,0},{313,1,2, 0, 0,0},--Z - {131,2,2, 0, 0,0},{131,2,2,-1,-1,0},{131,2,2,-1, 0,0},--S - {131,1,2,-1, 0,0},{131,1,2, 0,-1,0},{131,1,2, 0, 0,0},--Z(misOrder) - {313,2,2, 0, 0,0},{313,2,2,-1,-1,0},{313,2,2,-1, 0,0},--S(misOrder) - {331,3,2, 0,-1,0},--J(farDown) - {113,4,2,-1,-1,0},--L(farDown) - {113,3,2,-1,-1,0},{113,3,0, 0, 0,0},--J - {331,4,2, 0,-1,0},{331,4,0,-1, 0,0},--L - {222,7,0,-1, 1,1},{222,7,0,-2, 1,1},{222,7,0, 0, 1,1},--I(high) - {222,7,2,-1, 0,2},{222,7,2,-2, 0,2},{222,7,2, 0, 0,2},--I(low) - {121,6,0, 1,-1,2},{112,6,0, 2,-1,2},{122,6,0, 1,-2,2},--O - {323,6,0,-1,-1,2},{332,6,0,-2,-1,2},{322,6,0,-1,-2,2},--O - }--{keys, ID, dir, dx, dy, freeLevel (0=immovable, 1=U/D-immovable, 2=free)} + {111,5,2, 0,-1,0},{111,5,2,-1,-1,0},{111,5,0,-1, 0,0},-- T + {333,5,2,-1,-1,0},{333,5,2, 0,-1,0},{333,5,0, 0, 0,0},-- T + {313,1,2,-1, 0,0},{313,1,2, 0,-1,0},{313,1,2, 0, 0,0},-- Z + {131,2,2, 0, 0,0},{131,2,2,-1,-1,0},{131,2,2,-1, 0,0},-- S + {131,1,2,-1, 0,0},{131,1,2, 0,-1,0},{131,1,2, 0, 0,0},-- Z(misOrder) + {313,2,2, 0, 0,0},{313,2,2,-1,-1,0},{313,2,2,-1, 0,0},-- S(misOrder) + {331,3,2, 0,-1,0},-- J(farDown) + {113,4,2,-1,-1,0},-- L(farDown) + {113,3,2,-1,-1,0},{113,3,0, 0, 0,0},-- J + {331,4,2, 0,-1,0},{331,4,0,-1, 0,0},-- L + {222,7,0,-1, 1,1},{222,7,0,-2, 1,1},{222,7,0, 0, 1,1},-- I(high) + {222,7,2,-1, 0,2},{222,7,2,-2, 0,2},{222,7,2, 0, 0,2},-- I(low) + {121,6,0, 1,-1,2},{112,6,0, 2,-1,2},{122,6,0, 1,-2,2},-- O + {323,6,0,-1,-1,2},{332,6,0,-2,-1,2},{322,6,0,-1,-2,2},-- O + }-- {keys, ID, dir, dx, dy, freeLevel (0=immovable, 1=U/D-immovable, 2=free)} local XspinList={ {{ 1,-1},{ 1, 0},{ 1, 1},{ 1,-2},{ 1, 2}}, {{ 0,-1},{ 0,-2},{ 0, 1},{ 0,-2},{ 0, 2}}, @@ -137,8 +137,8 @@ do [20]={'+0+0','-1+0','+1+0','+0+1','+0-1'}, [13]={'+0+0','+0-1','+0+1','+0-2'}, [31]={'+0+0','+0+1','+0-1','+0+2'}, - },--Z - false,--S + },-- Z + false,-- S { [01]={'+0+0','-1+0','-1+1','+0-2','+1+1','+0+1','+0-1'}, [10]={'+0+0','+1+0','+1-1','+0+2','-1-1','+0-1','+0+1'}, @@ -152,8 +152,8 @@ do [20]={'+0+0','+1+0','-1+0','+0+1','+0-1'}, [13]={'+0+0','+0-1','+0+1','+1+0'}, [31]={'+0+0','+0+1','+0-1','-1+0'}, - },--J - false,--L + },-- J + false,-- L { [01]={'+0+0','-1+0','-1+1','+0-2','-1-2','+0+1'}, [10]={'+0+0','+1+0','+1-1','+0+2','+1+2','+0+1','+0-1'}, @@ -167,7 +167,7 @@ do [20]={'+0+0','+1+0','-1+0','+0-1'}, [13]={'+0+0','+0-1','+0+1','+1+0','+0-2','+0+2'}, [31]={'+0+0','+0-1','+0+1','-1+0','+0-2','+0+2'}, - },--T + },-- T function(P,d) if P.gameEnv.easyFresh then P:freshBlock('fresh') @@ -175,7 +175,7 @@ do if P.gameEnv.ospin then local x,y=P.curX,P.curY local C=P.cur - if y==P.ghoY and((P:solid(x-1,y)or P:solid(x-1,y+1)))and(P:solid(x+2,y)or P:solid(x+2,y+1))then + if y==P.ghoY and ((P:solid(x-1,y) or P:solid(x-1,y+1))) and (P:solid(x+2,y) or P:solid(x+2,y+1)) then if P.sound then SFX.play('rotatekick',nil,P:getCenterX()*.15) end @@ -186,15 +186,15 @@ do return end for i=1,#OspinList do local L=OspinList[i] - if C.spinSeq==L[1]then + if C.spinSeq==L[1] then local id,dir=L[2],L[3] local bk=BLOCKS[id][dir] x,y=P.curX+L[4],P.curY+L[5] if - not P:ifoverlap(bk,x,y)and( - L[6]>0 or(P:ifoverlap(bk,x-1,y)and P:ifoverlap(bk,x+1,y)) - )and( - L[6]==2 or(P:ifoverlap(bk,x,y-1)and P:ifoverlap(bk,x,y+1)) + not P:ifoverlap(bk,x,y) and ( + L[6]>0 or (P:ifoverlap(bk,x-1,y) and P:ifoverlap(bk,x+1,y)) + ) and ( + L[6]==2 or (P:ifoverlap(bk,x,y-1) and P:ifoverlap(bk,x,y+1)) ) then C.id=id @@ -220,7 +220,7 @@ do SFX.play('rotate',nil,P:getCenterX()*.15) end end - end,--O + end,-- O { [01]={'+0+0','+0+1','+1+0','-2+0','-2-1','+1+2'}, [10]={'+0+0','+2+0','-1+0','-1-2','+2+1','+0+1'}, @@ -234,14 +234,14 @@ do [20]={'+0+0','+1+0','-1+0','+0+1','+0-1'}, [13]={'+0+0','+0-1','-1+0','+1+0','+0+1'}, [31]={'+0+0','+0-1','+1+0','-1+0','+0+1'}, - },--I + },-- I { [01]={'+0+0','+0+1','+1+1','-1+0','+0-3','+0+2','+0-2','+0+3','-1+2'}, [10]={'+0+0','+0-1','-1-1','+1+0','+0-3','+0+2','+0-2','+0+3','+1-2'}, [03]={'+0+0','+1+0','+0-3','+0-1','+0+1','+0-2','+0+2','+0+3','+1+2'}, [30]={'+0+0','-1+0','+0-1','+0+1','+0-2','+0-3','+0+2','+0+3','-1-2'}, - },--Z5 - false,--S5 + },-- Z5 + false,-- S5 { [01]={'+0+0','-1+0','-1+1','+0-2','-1-2','-1-1','+0+1'}, [10]={'+0+0','+1+0','+1-1','+0+2','+1+2','+0-1','+1+1'}, @@ -255,8 +255,8 @@ do [20]={'+0+0','+1+0','+0+1','+0-1'}, [13]={'+0+0','+1+0','+0+1','-1+0'}, [31]={'+0+0','-1+0','+0-1','+1+0'}, - },--P - false,--Q + },-- P + false,-- Q { [01]={'+0+0','-1+0','+1+0','-1+1','+0-2','+0-3'}, [10]={'+0+0','+1+0','+1-1','-1+0','+0+2','+0+3'}, @@ -270,8 +270,8 @@ do [20]={'+0+0','-1+0','+1+0','+1+1'}, [13]={'+0+0','+0-1','-1+1','+0+1'}, [31]={'+0+0','+0-1','+1-1','+0+1'}, - },--F - false,--E + },-- F + false,-- E { [01]={'+0+0','+0-1','-1-1','+1+0','+1+1','+0-3','-1+0','+0+2','-1+2'}, [10]={'+0+0','+1+0','+0-1','-1-1','+0-2','-1+1','+0-3','+1-2','+0+1'}, @@ -285,7 +285,7 @@ do [20]={'+0+0','+0-1','+0+1','+0-2'}, [13]={'+0+0','+1+0','-1+1','-2+0'}, [31]={'+0+0','-1+0','+1+1','+2+0'}, - },--T5 + },-- T5 { [01]={'+0+0','-1+0','-1+1','+0-2','-1-2'}, [10]={'+0+0','+1+0','+1-1','+0+2','+1+2'}, @@ -299,7 +299,7 @@ do [20]={'+0+0','+0-1'}, [13]={'+0+0','+0-1','+0+1','+1+0'}, [31]={'+0+0','+0-1','+0+1','-1+0'}, - },--U + },-- U { [01]={'+0+0','+0+1','-1+0','+0-2','-1-2'}, [10]={'+0+0','+0+1','+1+0','+0-2','+1-2'}, @@ -313,7 +313,7 @@ do [20]={'+0+0','+1-1','-1+1'}, [13]={'+0+0','+1+1','-1-1'}, [31]={'+0+0','-1-1','+1+1'}, - },--V + },-- V { [01]={'+0+0','+0-1','-1+0','+1+0','+1-1','+0+2'}, [10]={'+0+0','+0-1','-1-1','+0+1','+0-2','+1-2','+0+2'}, @@ -327,15 +327,15 @@ do [20]={'+0+0','+0+1','+1+0'}, [13]={'+0+0','+0+1','-1+0'}, [31]={'+0+0','+0-1','+1+0'}, - },--W + },-- W function(P,d) - if P.type=='human'then + if P.type=='human' then SFX.play('rotate',nil,P:getCenterX()*.15) end local kickData=XspinList[d] for test=1,#kickData do local x,y=P.curX+kickData[test][1],P.curY+kickData[test][2] - if not P:ifoverlap(P.cur.bk,x,y)then + if not P:ifoverlap(P.cur.bk,x,y) then P.curX,P.curY=x,y P.spinLast=1 P:freshBlock('move') @@ -344,7 +344,7 @@ do end end P:freshBlock('fresh') - end,--X + end,-- X { [01]={'+0+0','-1+0','-1+1','+0-3','-1+1','-1+2','+0+1'}, [10]={'+0+0','-1+0','+1-1','+0+3','+1-1','+1-2','+0+1'}, @@ -358,8 +358,8 @@ do [20]={'+0+0','+0+1','+1+1','-1+1','+1+0','-2+1'}, [13]={'+0+0','-1+0','-1-1','+0+1','-1-2'}, [31]={'+0+0','+1+0','+1+1','+0-1','+1+2'}, - },--J5 - false,--L5 + },-- J5 + false,-- L5 { [01]={'+0+0','-1+0','-1+1','+1+0','-1+2','-1-1','+0-3','+0+1'}, [10]={'+0+0','-1+0','+1+0','+1-1','+1-2','+1+1','+0+3','+0+1'}, @@ -373,8 +373,8 @@ do [20]={'+0+0','+0+1','-1+1','+1+0','-2+1','+0-1'}, [13]={'+0+0','-1+0','-1-1','+0+1','-1-2'}, [31]={'+0+0','+1+0','+1+1','+0-1','+1+2'}, - },--R - false,--Y + },-- R + false,-- Y { [01]={'+0+0','-1+0','-1+1','+0+1','+1+0','+1+1','-1+2','-2+0','+0-2'}, [10]={'+0+0','+1+0','-1+0','+0-1','-1-1','+1-1','+1-2','+2+0','+0+2'}, @@ -388,20 +388,20 @@ do [20]={'+0+0','+1+0','+0-2','+0+1'}, [13]={'+0+0','-1+0','-1-1','+0+1','+1+2'}, [31]={'+0+0','+1+0','+1+1','+0-1','-1-2'}, - },--N - false,--H + },-- N + false,-- H { [01]={'+0+0','+1-1','+1+0','+1+1','+0+1','-1+1','-1+0','-1-1','+0-1','+0-2','-2-1','-2-2','+2+0','+2-1','+2-2','+1+2','+2+2','-1+2','-2+2'}, [10]={'+0+0','-1+0','-1-1','+0-1','+1-1','-2-2','-2-1','-2+0','-1-2','+0-2','+1-2','+2-2','-1+1','-2+1','-2+2','+1+0','+2+0','+2-1','+0+1','+1-1','+2-2'}, [03]={'+0+0','-1-1','-1+0','-1+1','+0+1','+1+1','+1+0','+1-1','+0-1','+0-2','+2-1','+2-2','-2+0','-2-1','-2-2','-1+2','-2+2','+1+2','+2+2'}, [30]={'+0+0','+1+0','+1-1','+0-1','-1-1','+2-2','+2-1','+2+0','+1-2','+0-2','-1-2','-2-2','+1+1','+2+1','+2+2','-1+0','-2+0','-2-1','+0+1','-1-1','-2-2'}, - },--I5 + },-- I5 { [01]={'+0+0','-1+0','-1-1','+1+1','-1+1'}, [10]={'+0+0','-1+0','+1+0','-1-1','+1+1'}, [03]={'+0+0','+1+0','+1-1','-1+1','+1+1'}, [30]={'+0+0','+1+0','-1+0','+1-1','-1+1'}, - },--I3 + },-- I3 { [01]={'+0+0','-1+0','+1+0'}, [10]={'+0+0','+1+0','-1+0'}, @@ -415,7 +415,7 @@ do [20]={'+0+0','+0+1','-1+1','+1+1'}, [13]={'+0+0','+0-1','-1-1','+1-1'}, [31]={'+0+0','+0+1','+1+1','-1+1'}, - },--C + },-- C { [01]={'+0+0','-1+0','+0+1'}, [10]={'+0+0','+1+0','+0+1'}, @@ -429,22 +429,22 @@ do [20]={'+0+0','+0+1','+0-1'}, [13]={'+0+0','-1+0','+1+0'}, [31]={'+0+0','+1+0','-1+0'}, - },--I2 - nil,--O1 + },-- I2 + nil,-- O1 } } 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 @@ -469,12 +469,12 @@ do [32]={'+0+0','-1+0','-1-1','+0+2','-1+2'}, [23]={'+0+0','+1+0','+1+1','+0-2','+1-2'}, [02]={'+0+0'},[20]={'+0+0'},[13]={'+0+0'},[31]={'+0+0'}, - },--Z - false,--S - false,--J - false,--L - false,--T - noKickSet,--O + },-- Z + false,-- S + false,-- J + false,-- L + false,-- T + noKickSet,-- O { [01]={'+0+0','-2+0','+1+0','-2-1','+1+2'}, [10]={'+0+0','+2+0','-1+0','+2+1','-1-2'}, @@ -485,11 +485,11 @@ do [30]={'+0+0','+1+0','-2+0','+1-2','-2+1'}, [03]={'+0+0','-1+0','+2+0','-1+2','+2-1'}, [02]={'+0+0'},[20]={'+0+0'},[13]={'+0+0'},[31]={'+0+0'}, - }--I + }-- I } } - for i=2,5 do SRS.kickTable[i]=SRS.kickTable[1]end - for i=8,29 do SRS.kickTable[i]=SRS.kickTable[1]end + for i=2,5 do SRS.kickTable[i]=SRS.kickTable[1] end + for i=8,29 do SRS.kickTable[i]=SRS.kickTable[1] end end local SRS_plus @@ -519,12 +519,12 @@ do [20]={'+0+0','+1+0','-1+0','+0-1','+0+1'}, [13]={'+0+0','+0-1','-1+0','+1+0','+0+1'}, [31]={'+0+0','+0-1','-1+0','+1+0','+0+1'}, - },--Z - false,--S - false,--J - false,--L - false,--T - noKickSet,--O + },-- Z + false,-- S + false,-- J + false,-- L + false,-- T + noKickSet,-- O { [01]={'+0+0','-2+0','+1+0','-2-1','+1+2'}, [10]={'+0+0','+2+0','-1+0','+2+1','-1-2'}, @@ -538,11 +538,11 @@ do [20]={'+0+0','+1+0','-1+0','+0+1','+0-1'}, [13]={'+0+0','+0-1','-1+0','+1+0','+0+1'}, [31]={'+0+0','+0-1','+1+0','-1+0','+0+1'}, - }--I + }-- I } } - for i=2,5 do SRS_plus.kickTable[i]=SRS_plus.kickTable[1]end - for i=8,29 do SRS_plus.kickTable[i]=SRS_plus.kickTable[1]end + for i=2,5 do SRS_plus.kickTable[i]=SRS_plus.kickTable[1] end + for i=8,29 do SRS_plus.kickTable[i]=SRS_plus.kickTable[1] end end local SRS_X @@ -570,19 +570,19 @@ do [20]={'+0+0','+1+0','-1+0','+0-1','+0+1'}, [13]={'+0+0','+0-1','-1+0','+1+0','+0+1'}, [31]={'+0+0','+0-1','-1+0','+1+0','+0+1'}, - },--Z - false,--S - false,--J - false,--L - false,--T - noKickSet,--O - false,--I + },-- Z + false,-- S + false,-- J + false,-- L + false,-- T + noKickSet,-- O + false,-- I } } - for i=2,5 do SRS_X.kickTable[i]=SRS_X.kickTable[1]end - for i=7,29 do SRS_X.kickTable[i]=TRS.kickTable[i]end - SRS_X.kickTable[10]=SRS_X.kickTable[1]--P - SRS_X.kickTable[11]=SRS_X.kickTable[1]--Q + for i=2,5 do SRS_X.kickTable[i]=SRS_X.kickTable[1] end + for i=7,29 do SRS_X.kickTable[i]=TRS.kickTable[i] end + SRS_X.kickTable[10]=SRS_X.kickTable[1]-- P + SRS_X.kickTable[11]=SRS_X.kickTable[1]-- Q end local BiRS @@ -591,45 +591,45 @@ do 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 - {[02]=L,[20]=R,[13]=L,[31]=R},--J - {[02]=R,[20]=L,[13]=L,[31]=R},--L - {[02]=F,[20]=F,[13]=L,[31]=R},--T - {[02]=F,[20]=F,[13]=F,[31]=F},--O - {[02]=F,[20]=F,[13]=R,[31]=L},--I + {[02]=L,[20]=R,[13]=R,[31]=L},-- Z + {[02]=R,[20]=L,[13]=L,[31]=R},-- S + {[02]=L,[20]=R,[13]=L,[31]=R},-- J + {[02]=R,[20]=L,[13]=L,[31]=R},-- L + {[02]=F,[20]=F,[13]=L,[31]=R},-- T + {[02]=F,[20]=F,[13]=F,[31]=F},-- O + {[02]=F,[20]=F,[13]=R,[31]=L},-- I - {[02]=L,[20]=L,[13]=R,[31]=R},--Z5 - {[02]=R,[20]=R,[13]=L,[31]=L},--S5 - {[02]=L,[20]=R,[13]=L,[31]=R},--P - {[02]=R,[20]=L,[13]=R,[31]=L},--Q - {[02]=R,[20]=L,[13]=L,[31]=R},--F - {[02]=L,[20]=R,[13]=R,[31]=L},--E - {[02]=F,[20]=F,[13]=L,[31]=R},--T5 - {[02]=F,[20]=F,[13]=L,[31]=R},--U - {[02]=R,[20]=L,[13]=L,[31]=R},--V - {[02]=R,[20]=L,[13]=L,[31]=R},--W - {[02]=F,[20]=F,[13]=F,[31]=F},--X - {[02]=L,[20]=R,[13]=R,[31]=L},--J5 - {[02]=R,[20]=L,[13]=L,[31]=R},--L5 - {[02]=L,[20]=R,[13]=R,[31]=L},--R - {[02]=R,[20]=L,[13]=L,[31]=R},--Y - {[02]=L,[20]=R,[13]=R,[31]=L},--N - {[02]=R,[20]=L,[13]=L,[31]=R},--H - {[02]=F,[20]=F,[13]=F,[31]=F},--I5 + {[02]=L,[20]=L,[13]=R,[31]=R},-- Z5 + {[02]=R,[20]=R,[13]=L,[31]=L},-- S5 + {[02]=L,[20]=R,[13]=L,[31]=R},-- P + {[02]=R,[20]=L,[13]=R,[31]=L},-- Q + {[02]=R,[20]=L,[13]=L,[31]=R},-- F + {[02]=L,[20]=R,[13]=R,[31]=L},-- E + {[02]=F,[20]=F,[13]=L,[31]=R},-- T5 + {[02]=F,[20]=F,[13]=L,[31]=R},-- U + {[02]=R,[20]=L,[13]=L,[31]=R},-- V + {[02]=R,[20]=L,[13]=L,[31]=R},-- W + {[02]=F,[20]=F,[13]=F,[31]=F},-- X + {[02]=L,[20]=R,[13]=R,[31]=L},-- J5 + {[02]=R,[20]=L,[13]=L,[31]=R},-- L5 + {[02]=L,[20]=R,[13]=R,[31]=L},-- R + {[02]=R,[20]=L,[13]=L,[31]=R},-- Y + {[02]=L,[20]=R,[13]=R,[31]=L},-- N + {[02]=R,[20]=L,[13]=L,[31]=R},-- H + {[02]=F,[20]=F,[13]=F,[31]=F},-- I5 - {[02]=F,[20]=F,[13]=F,[31]=F},--I3 - {[02]=R,[20]=L,[13]=L,[31]=R},--C - {[02]=F,[20]=F,[13]=R,[31]=L},--I2 - {[02]=F,[20]=F,[13]=F,[31]=F},--O1 + {[02]=F,[20]=F,[13]=F,[31]=F},-- I3 + {[02]=R,[20]=L,[13]=L,[31]=R},-- C + {[02]=F,[20]=F,[13]=R,[31]=L},-- I2 + {[02]=F,[20]=F,[13]=F,[31]=F},-- O1 } for i=1,29 do local a,b=R,L if i==6 or i==18 then a,b=b,a end - list[i][01]=a;list[i][10]=b;list[i][03]=b;list[i][30]=a - list[i][12]=a;list[i][21]=b;list[i][32]=b;list[i][23]=a + list[i][01]=a; list[i][10]=b; list[i][03]=b; list[i][30]=a + list[i][12]=a; list[i][21]=b; list[i][32]=b; list[i][23]=a end BiRS={ centerTex=GC.DO{10,10, @@ -653,9 +653,9 @@ do end local dx,dy=0,0 do local pressing=P.keyPressing - if pressing[1]and P:ifoverlap(C.bk,P.curX-1,P.curY)then dx=dx-1 end - if pressing[2]and P:ifoverlap(C.bk,P.curX+1,P.curY)then dx=dx+1 end - if pressing[7]and P:ifoverlap(C.bk,P.curX,P.curY-1)then dy= -1 end + if pressing[1] and P:ifoverlap(C.bk,P.curX-1,P.curY) then dx=dx-1 end + if pressing[2] and P:ifoverlap(C.bk,P.curX+1,P.curY) then dx=dx+1 end + if pressing[7] and P:ifoverlap(C.bk,P.curX,P.curY-1) then dy= -1 end end while true do for test=1,#kickList do @@ -666,7 +666,7 @@ do (P.freshTime>0 or fdy<=0) then local x,y=ix+fdx,iy+fdy - if not P:ifoverlap(icb,x,y)then + if not P:ifoverlap(icb,x,y) then if P.gameEnv.moveFX and P.gameEnv.block then P:createMoveFX() end @@ -685,7 +685,7 @@ do local sfx if ifpre then sfx='prerotate' - elseif P:ifoverlap(icb,x,y+1)and P:ifoverlap(icb,x-1,y)and P:ifoverlap(icb,x+1,y)then + elseif P:ifoverlap(icb,x,y+1) and P:ifoverlap(icb,x-1,y) and P:ifoverlap(icb,x+1,y) then sfx='rotatekick' P:_rotateField(d) else @@ -700,7 +700,7 @@ do end end - --Try release left/right, then softdrop, failed to rotate otherwise + -- Try release left/right, then softdrop, failed to rotate otherwise if dx~=0 then dx=0 elseif dy~=0 then @@ -728,24 +728,24 @@ do [02]=upOnly,[20]=upOnly,[13]=upOnly,[31]=upOnly, } local centerPos=TABLE.copy(defaultCenterPos) - centerPos[1]={[0]={1,1},{1,0},{1,1},{1,0}}--Z - centerPos[2]={[0]={1,1},{1,1},{1,1},{1,1}}--S - centerPos[3]={[0]={1,1},{1,0},{1,1},{1,1}}--L - centerPos[4]={[0]={1,1},{1,0},{1,1},{1,1}}--J - centerPos[5]={[0]={1,1},{1,0},{1,1},{1,1}}--T - centerPos[7]={[0]={0,2},{2,0},{0,2},{2,0}}--I - centerPos[10]={[0]={1,1},{1,0},{1,1},{1,0}}--P - centerPos[11]={[0]={1,1},{1,1},{1,1},{1,1}}--Q - centerPos[15]={[0]={1,1},{1,0},{1,1},{1,1}}--U - centerPos[16]={[0]={1,1},{1,1},{1,1},{1,1}}--V - centerPos[19]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}--J5 - centerPos[20]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}--L5 - centerPos[21]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}--R - centerPos[22]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}--Y - centerPos[23]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}--N - centerPos[24]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}--H - centerPos[26]={[0]={0,1},{0,0},{0,1},{0,0}}--I3 - centerPos[28]={[0]={0,1},{0,0},{0,1},{0,0}}--I2 + centerPos[1]={[0]={1,1},{1,0},{1,1},{1,0}}-- Z + centerPos[2]={[0]={1,1},{1,1},{1,1},{1,1}}-- S + centerPos[3]={[0]={1,1},{1,0},{1,1},{1,1}}-- L + centerPos[4]={[0]={1,1},{1,0},{1,1},{1,1}}-- J + centerPos[5]={[0]={1,1},{1,0},{1,1},{1,1}}-- T + centerPos[7]={[0]={0,2},{2,0},{0,2},{2,0}}-- I + centerPos[10]={[0]={1,1},{1,0},{1,1},{1,0}}-- P + centerPos[11]={[0]={1,1},{1,1},{1,1},{1,1}}-- Q + centerPos[15]={[0]={1,1},{1,0},{1,1},{1,1}}-- U + centerPos[16]={[0]={1,1},{1,1},{1,1},{1,1}}-- V + centerPos[19]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}-- J5 + centerPos[20]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}-- L5 + centerPos[21]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}-- R + centerPos[22]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}-- Y + centerPos[23]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}-- N + centerPos[24]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}-- H + centerPos[26]={[0]={0,1},{0,0},{0,1},{0,0}}-- I3 + centerPos[28]={[0]={0,1},{0,0},{0,1},{0,0}}-- I2 ARS_Z={ centerTex=GC.DO{10,10, @@ -765,24 +765,24 @@ end local DRS_weak do local centerPos=TABLE.copy(defaultCenterPos) - centerPos[1]={[0]={1,1},{1,0},{1,1},{1,1}}--Z - centerPos[2]={[0]={1,1},{1,0},{1,1},{1,1}}--S - centerPos[3]={[0]={1,1},{1,0},{1,1},{1,1}}--L - centerPos[4]={[0]={1,1},{1,0},{1,1},{1,1}}--J - centerPos[5]={[0]={1,1},{1,0},{1,1},{1,1}}--T - centerPos[7]={[0]={.5,1.5},{1.5,-.5},{.5,1.5},{1.5,.5}}--I - centerPos[10]={[0]={1,1},{1,0},{1,1},{1,0}}--P - centerPos[11]={[0]={1,1},{1,1},{1,1},{1,1}}--Q - centerPos[15]={[0]={1,1},{1,0},{1,1},{1,1}}--U - centerPos[16]={[0]={1,1},{1,1},{1,1},{1,1}}--V - centerPos[19]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}--J5 - centerPos[20]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}--L5 - centerPos[21]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}--R - centerPos[22]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}--Y - centerPos[23]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}--N - centerPos[24]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}--H - centerPos[26]={[0]={0,1},{0,0},{0,1},{0,0}}--I3 - centerPos[28]={[0]={0,1},{0,0},{0,1},{0,0}}--I2 + centerPos[1]={[0]={1,1},{1,0},{1,1},{1,1}}-- Z + centerPos[2]={[0]={1,1},{1,0},{1,1},{1,1}}-- S + centerPos[3]={[0]={1,1},{1,0},{1,1},{1,1}}-- L + centerPos[4]={[0]={1,1},{1,0},{1,1},{1,1}}-- J + centerPos[5]={[0]={1,1},{1,0},{1,1},{1,1}}-- T + centerPos[7]={[0]={.5,1.5},{1.5,-.5},{.5,1.5},{1.5,.5}}-- I + centerPos[10]={[0]={1,1},{1,0},{1,1},{1,0}}-- P + centerPos[11]={[0]={1,1},{1,1},{1,1},{1,1}}-- Q + centerPos[15]={[0]={1,1},{1,0},{1,1},{1,1}}-- U + centerPos[16]={[0]={1,1},{1,1},{1,1},{1,1}}-- V + centerPos[19]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}-- J5 + centerPos[20]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}-- L5 + centerPos[21]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}-- R + centerPos[22]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}-- Y + centerPos[23]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}-- N + centerPos[24]={[0]={1.5,1.5},{1.5,0.5},{1.5,1.5},{1.5,0.5}}-- H + centerPos[26]={[0]={0,1},{0,0},{0,1},{0,0}}-- I3 + centerPos[28]={[0]={0,1},{0,0},{0,1},{0,0}}-- I2 local L={'+0+0','-1+0','+1+0','+0-1','-1-1','+1-1'} local R={'+0+0','+1+0','-1+0','+0-1','+1-1','-1-1'} @@ -802,24 +802,24 @@ do }, centerPos=centerPos, kickTable={ - Z,S,--Z,S - Z,S,--J,L - Z,--T - noKickSet,--O - Z,--I + Z,S,-- Z,S + Z,S,-- J,L + Z,-- T + noKickSet,-- O + Z,-- I - Z,S,--Z5,S5 - Z,S,--P,Q - Z,S,--F,E - Z,Z,Z,Z,--T5,U,V,W - noKickSet,--X - Z,S,--J5,L5 - Z,S,--R,Y - Z,S,--N,H - Z,--I5 + Z,S,-- Z5,S5 + Z,S,-- P,Q + Z,S,-- F,E + Z,Z,Z,Z,-- T5,U,V,W + noKickSet,-- X + Z,S,-- J5,L5 + Z,S,-- R,Y + Z,S,-- N,H + Z,-- I5 - Z,Z,--I3,C - Z,Z,--I2,O1 + Z,Z,-- I3,C + Z,Z,-- I2,O1 } } end @@ -916,24 +916,24 @@ do {'fRect',3,3,4,4}, }, kickTable={ - Z,S,--Z,S - Z,S,--J,L - Z,--T - noKickSet,--O - Z,--I + Z,S,-- Z,S + Z,S,-- J,L + Z,-- T + noKickSet,-- O + Z,-- I - Z,S,--Z5,S5 - Z,S,--P,Q - Z,S,--F,E - Z,Z,Z,Z,--T5,U,V,W - noKickSet,--X - Z,S,--J5,L5 - Z,S,--R,Y - Z,S,--N,H - Z,--I5 + Z,S,-- Z5,S5 + Z,S,-- P,Q + Z,S,-- F,E + Z,Z,Z,Z,-- T5,U,V,W + noKickSet,-- X + Z,S,-- J5,L5 + Z,S,-- R,Y + Z,S,-- N,H + Z,-- I5 - Z,Z,--I3,C - Z,Z,--I2,O1 + Z,Z,-- I3,C + Z,Z,-- I2,O1 } } end @@ -1009,15 +1009,15 @@ local RSlist={ } for _,rs in next,RSlist do - if not rs.centerDisp then rs.centerDisp=TABLE.new(true,29)end + if not rs.centerDisp then rs.centerDisp=TABLE.new(true,29) end if not rs.centerPos then rs.centerPos=defaultCenterPos end if not rs.centerTex then rs.centerTex=defaultCenterTex end - --Make all string vec to the same table vec + -- Make all string vec to the same table vec for _,set in next,rs.kickTable do - if type(set)=='table'then + if type(set)=='table' then for _,list in next,set do - if type(list[1])=='string'then + if type(list[1])=='string' then _strToVec(list) end end diff --git a/parts/backgrounds/aura.lua b/parts/backgrounds/aura.lua index aad80a96..20debdaf 100644 --- a/parts/backgrounds/aura.lua +++ b/parts/backgrounds/aura.lua @@ -1,4 +1,4 @@ ---Cool liquid background +-- Cool liquid background local back={} local shader=SHADER.aura local t diff --git a/parts/backgrounds/bg1.lua b/parts/backgrounds/bg1.lua index 4d741e05..a5bb9f42 100644 --- a/parts/backgrounds/bg1.lua +++ b/parts/backgrounds/bg1.lua @@ -1,4 +1,4 @@ ---Horizonal red-blue gradient +-- Horizonal red-blue gradient local back={} local shader=SHADER.grad1 diff --git a/parts/backgrounds/bg2.lua b/parts/backgrounds/bg2.lua index 5953d32b..dc95ce82 100644 --- a/parts/backgrounds/bg2.lua +++ b/parts/backgrounds/bg2.lua @@ -1,4 +1,4 @@ ---Vertical red-green gradient +-- Vertical red-green gradient local back={} local shader=SHADER.grad2 diff --git a/parts/backgrounds/blockfall.lua b/parts/backgrounds/blockfall.lua index 4ecb0a74..bce4c32b 100644 --- a/parts/backgrounds/blockfall.lua +++ b/parts/backgrounds/blockfall.lua @@ -1,4 +1,4 @@ ---Large falling tetrominoes +-- Large falling tetrominoes local gc=love.graphics local gc_clear=gc.clear local gc_setColor,gc_draw=gc.setColor,gc.draw @@ -43,8 +43,8 @@ function back.draw() local M=mino[i] local b=M.block for y=1,#b do - for x=1,#b[1]do - if b[y][x]then + for x=1,#b[1] do + if b[y][x] then gc_draw(M.texture,M.x+(x-1)*30*M.k,M.y-y*30*M.k,nil,M.k) end end diff --git a/parts/backgrounds/blockhole.lua b/parts/backgrounds/blockhole.lua index 8f14f2ac..f759b518 100644 --- a/parts/backgrounds/blockhole.lua +++ b/parts/backgrounds/blockhole.lua @@ -1,4 +1,4 @@ ---blockhole +-- blockhole local gc=love.graphics local gc_clear,gc_replaceTransform=gc.clear,gc.replaceTransform local gc_setColor,gc_setLineWidth=gc.setColor,gc.setLineWidth @@ -44,14 +44,14 @@ function back.draw() gc_clear(.1,.1,.1) gc_replaceTransform(SCR.xOy_m) - --Squares + -- Squares gc_setColor(1,1,1,.2) for i=1,#squares do local S=squares[i] gc_draw(S.texture,S.d*cos(S.ang),S.d*sin(S.ang),S.rotate,S.size*.026,nil,15,15) end - --blockhole + -- blockhole gc_setColor(.07,.07,.07) gc_circle('fill',0,0,157) gc_setLineWidth(6) diff --git a/parts/backgrounds/blockrain.lua b/parts/backgrounds/blockrain.lua index c1a6b775..fc2eba5a 100644 --- a/parts/backgrounds/blockrain.lua +++ b/parts/backgrounds/blockrain.lua @@ -1,4 +1,4 @@ ---Block rain +-- Block rain local gc=love.graphics local rnd=math.random local ins,rem=table.insert,table.remove diff --git a/parts/backgrounds/blockspace.lua b/parts/backgrounds/blockspace.lua index 9011a98c..ff5ce285 100644 --- a/parts/backgrounds/blockspace.lua +++ b/parts/backgrounds/blockspace.lua @@ -1,4 +1,4 @@ ---Space but tetrominoes +-- Space but tetrominoes local gc=love.graphics local gc_clear,gc_translate=gc.clear,gc.translate local gc_setColor,gc_draw=gc.setColor,gc.draw diff --git a/parts/backgrounds/cubes.lua b/parts/backgrounds/cubes.lua index 84442a1f..bbf9724c 100644 --- a/parts/backgrounds/cubes.lua +++ b/parts/backgrounds/cubes.lua @@ -1,4 +1,4 @@ ---Flying cubes +-- Flying cubes local gc=love.graphics local gc_clear=gc.clear local gc_setColor,gc_setLineWidth=gc.setColor,gc.setLineWidth diff --git a/parts/backgrounds/custom.lua b/parts/backgrounds/custom.lua index a881b8e9..06afbe50 100644 --- a/parts/backgrounds/custom.lua +++ b/parts/backgrounds/custom.lua @@ -1,4 +1,4 @@ ---Custom background +-- Custom background local gc_clear,gc_setColor=love.graphics.clear,love.graphics.setColor local back={} diff --git a/parts/backgrounds/fan.lua b/parts/backgrounds/fan.lua index aaa46fc3..2938fe1a 100644 --- a/parts/backgrounds/fan.lua +++ b/parts/backgrounds/fan.lua @@ -1,4 +1,4 @@ ---Yuyuko's fan +-- Yuyuko's fan local gc=love.graphics local gc_clear,gc_origin,gc_replaceTransform=gc.clear,gc.origin,gc.replaceTransform local gc_translate=gc.translate @@ -61,7 +61,7 @@ function back.draw() gc_setLineWidth(6) gc_setColor(.8,.9,1,.3) - for i=1,#SVG_TITLE_FAN do gc_polygon('line',SVG_TITLE_FAN[i])end + for i=1,#SVG_TITLE_FAN do gc_polygon('line',SVG_TITLE_FAN[i]) end gc_setLineWidth(2) gc_setColor(1,.5,.7,.3) diff --git a/parts/backgrounds/firework.lua b/parts/backgrounds/firework.lua index 33c5ae70..0ba9be88 100644 --- a/parts/backgrounds/firework.lua +++ b/parts/backgrounds/firework.lua @@ -1,4 +1,4 @@ ---Firework +-- Firework local gc=love.graphics local gc_clear=gc.clear local gc_setColor,gc_setLineWidth=gc.setColor,gc.setLineWidth @@ -37,7 +37,7 @@ function back.update(dt) local x,y,color=F.x,F.y,F.color if F.big then SFX.play('fall',.5) - for _=1,rnd(62,126)do + for _=1,rnd(62,126) do ins(particle,{ x=x,y=y, color=color, @@ -48,7 +48,7 @@ function back.update(dt) end else SFX.play('clear_1',.4) - for _=1,rnd(16,26)do + for _=1,rnd(16,26) do ins(particle,{ x=x,y=y, color=color, diff --git a/parts/backgrounds/fixColor.lua b/parts/backgrounds/fixColor.lua index d4e6bfcc..7bc8b9aa 100644 --- a/parts/backgrounds/fixColor.lua +++ b/parts/backgrounds/fixColor.lua @@ -1,4 +1,4 @@ ---Customizable grey background +-- Customizable grey background local back={} local r,g,b=.26,.26,.26 function back.draw() diff --git a/parts/backgrounds/flink.lua b/parts/backgrounds/flink.lua index d69b6901..73112c25 100644 --- a/parts/backgrounds/flink.lua +++ b/parts/backgrounds/flink.lua @@ -1,4 +1,4 @@ ---Flash after random time +-- Flash after random time local back={} local t diff --git a/parts/backgrounds/glow.lua b/parts/backgrounds/glow.lua index b2d1e9b4..42e4a8ad 100644 --- a/parts/backgrounds/glow.lua +++ b/parts/backgrounds/glow.lua @@ -1,4 +1,4 @@ ---Light-dark +-- Light-dark local sin=math.sin local back={} diff --git a/parts/backgrounds/lanterns.lua b/parts/backgrounds/lanterns.lua index 27cd55bd..2a507f1d 100644 --- a/parts/backgrounds/lanterns.lua +++ b/parts/backgrounds/lanterns.lua @@ -1,4 +1,4 @@ ---A lantern background which is full of festive atmosphere. Lantern image by ScF +-- A lantern background which is full of festive atmosphere. Lantern image by ScF local int,rnd=math.floor,math.random local ins,rem=table.insert,table.remove local mDraw=mDraw diff --git a/parts/backgrounds/league.lua b/parts/backgrounds/league.lua index 7d7a29dc..26508233 100644 --- a/parts/backgrounds/league.lua +++ b/parts/backgrounds/league.lua @@ -1,4 +1,4 @@ ---Space with stars +-- Space with stars local back={} local upCover do diff --git a/parts/backgrounds/lightning.lua b/parts/backgrounds/lightning.lua index 32c7236e..0ae68584 100644 --- a/parts/backgrounds/lightning.lua +++ b/parts/backgrounds/lightning.lua @@ -1,4 +1,4 @@ ---Lightning +-- Lightning local back={} local t diff --git a/parts/backgrounds/lightning2.lua b/parts/backgrounds/lightning2.lua index 407bb743..1d8fd08b 100644 --- a/parts/backgrounds/lightning2.lua +++ b/parts/backgrounds/lightning2.lua @@ -1,4 +1,4 @@ ---Fast lightning + spining tetromino +-- Fast lightning + spining tetromino local int,rnd=math.floor,math.random local back={} diff --git a/parts/backgrounds/matrix.lua b/parts/backgrounds/matrix.lua index d487d801..e1d413d4 100644 --- a/parts/backgrounds/matrix.lua +++ b/parts/backgrounds/matrix.lua @@ -1,4 +1,4 @@ ---Black-White grid +-- Black-White grid local gc=love.graphics local gc_clear,gc_scale=gc.clear,gc.scale local gc_setColor=gc.setColor @@ -9,7 +9,7 @@ local ceil=math.ceil local back={} local t -local matrixT={}for i=1,50 do matrixT[i]={}for j=1,50 do matrixT[i][j]=love.math.noise(i,j)+2 end end +local matrixT={} for i=1,50 do matrixT[i]={} for j=1,50 do matrixT[i][j]=love.math.noise(i,j)+2 end end function back.init() t=math.random()*2600 end @@ -21,7 +21,7 @@ function back.draw() local k=SCR.k gc_scale(k) local Y=ceil(SCR.h/80/k) - for x=1,ceil(SCR.w/80/k)do + for x=1,ceil(SCR.w/80/k) do for y=1,Y do gc_setColor(1,1,1,sin(x+matrixT[x][y]*t)*.04+.04) gc_rectangle('fill',80*x,80*y,-80,-80) diff --git a/parts/backgrounds/rainbow.lua b/parts/backgrounds/rainbow.lua index a05d89ad..3c73f349 100644 --- a/parts/backgrounds/rainbow.lua +++ b/parts/backgrounds/rainbow.lua @@ -1,4 +1,4 @@ ---Colorful RGB +-- Colorful RGB local back={} local shader=SHADER.rgb1 diff --git a/parts/backgrounds/rainbow2.lua b/parts/backgrounds/rainbow2.lua index 58ee2366..da906a81 100644 --- a/parts/backgrounds/rainbow2.lua +++ b/parts/backgrounds/rainbow2.lua @@ -1,4 +1,4 @@ ---Blue RGB +-- Blue RGB local back={} local shader=SHADER.rgb2 diff --git a/parts/backgrounds/rgb.lua b/parts/backgrounds/rgb.lua index d0861905..2951e46c 100644 --- a/parts/backgrounds/rgb.lua +++ b/parts/backgrounds/rgb.lua @@ -1,4 +1,4 @@ ---Changing pure color +-- Changing pure color local sin=math.sin local back={} diff --git a/parts/backgrounds/snow.lua b/parts/backgrounds/snow.lua index d3a65803..d377a926 100644 --- a/parts/backgrounds/snow.lua +++ b/parts/backgrounds/snow.lua @@ -1,4 +1,4 @@ ---Snow +-- Snow local gc=love.graphics local ellipse=gc.ellipse local rnd=math.random diff --git a/parts/backgrounds/space.lua b/parts/backgrounds/space.lua index 48be71ad..4d2f32fe 100644 --- a/parts/backgrounds/space.lua +++ b/parts/backgrounds/space.lua @@ -1,4 +1,4 @@ ---Space with stars +-- Space with stars local gc=love.graphics local rectangle=gc.rectangle local rnd=math.random @@ -15,16 +15,16 @@ function back.resize(w,h) local S=stars for i=1,1260,5 do local s=rnd(26,40)*.1 - S[i]=s*SCR.k --Size - S[i+1]=rnd(W)-10 --X - S[i+2]=rnd(H)-10 --Y - S[i+3]=(rnd()-.5)*.01*s--Vx - S[i+4]=(rnd()-.5)*.01*s--Vy + S[i]=s*SCR.k -- Size + S[i+1]=rnd(W)-10 -- X + S[i+2]=rnd(H)-10 -- Y + S[i+3]=(rnd()-.5)*.01*s-- Vx + S[i+4]=(rnd()-.5)*.01*s-- Vy end end function back.update(dt) local S=stars - --Star moving + -- Star moving for i=1,1260,5 do S[i+1]=(S[i+1]+S[i+3]*dt*60)%W S[i+2]=(S[i+2]+S[i+4]*dt*60)%H @@ -32,7 +32,7 @@ function back.update(dt) end function back.draw() gc.clear(.08,.08,.084) - if not stars[1]then return end + if not stars[1] then return end gc.translate(-10,-10) gc.setColor(1,1,1,.6) for i=1,1260,5 do diff --git a/parts/backgrounds/tunnel.lua b/parts/backgrounds/tunnel.lua index 1ca68ebe..5391a25a 100644 --- a/parts/backgrounds/tunnel.lua +++ b/parts/backgrounds/tunnel.lua @@ -1,4 +1,4 @@ ---Cool Tunnel +-- Cool Tunnel local rnd=math.random local ins,rem=table.insert,table.remove local back={} diff --git a/parts/backgrounds/welcome.lua b/parts/backgrounds/welcome.lua index 2ee48884..09a95755 100644 --- a/parts/backgrounds/welcome.lua +++ b/parts/backgrounds/welcome.lua @@ -1,4 +1,4 @@ ---Welcome to Techmino +-- Welcome to Techmino local sin=math.sin local back={} diff --git a/parts/backgrounds/wing.lua b/parts/backgrounds/wing.lua index 4dfcb0da..822812fb 100644 --- a/parts/backgrounds/wing.lua +++ b/parts/backgrounds/wing.lua @@ -1,4 +1,4 @@ ---Flandre's wing +-- Flandre's wing local back={} local crystal_img,crystals local wingColor={ diff --git a/parts/bot/bot_9s.lua b/parts/bot/bot_9s.lua index b14b9b7d..ac13f8ba 100644 --- a/parts/bot/bot_9s.lua +++ b/parts/bot/bot_9s.lua @@ -38,8 +38,8 @@ local FCL={ local LclearScore={[0]=0,-200,-150,-100,200} local HclearScore={[0]=0,100,140,200,500} 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 + 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 @@ -74,7 +74,7 @@ local function _getScore(field,cb,cy) clear=clear+1 ::CONTINUE_notFull:: end - if #field==0 then--PC + if #field==0 then-- PC return 1e99 end for x=1,10 do @@ -116,10 +116,10 @@ local function _getScore(field,cb,cy) -#field*30 -#cb*15 +(#field>10 and - HclearScore[clear]--Clearing - -hole*70--Hole - -cy*50--Height - -sdh--Sum of DeltaH + HclearScore[clear]-- Clearing + -hole*70-- Hole + -cy*50-- Height + -sdh-- Sum of DeltaH or LclearScore[clear] -hole*100 @@ -139,10 +139,10 @@ local bot_9s={} function bot_9s.thread(bot) local P,data,keys=bot.P,bot.data,bot.keys while true do - --Thinking + -- Thinking yield() - local Tfield={}--Test field - local best={x=1,dir=0,hold=false,score=-1e99}--Best method + local Tfield={}-- Test field + local best={x=1,dir=0,hold=false,score=-1e99}-- Best method local field_org=P.field for i=1,#field_org do Tfield[i]=getRow(0) @@ -152,33 +152,33 @@ function bot_9s.thread(bot) end for ifhold=0,data.hold and P.gameEnv.holdCount>0 and 1 or 0 do - --Get block id + -- Get block id local bn if ifhold==0 then bn=P.cur and P.cur.id else - bn=P.holdQueue[1]and P.holdQueue[1].id or P.nextQueue[1]and P.nextQueue[1].id + bn=P.holdQueue[1] and P.holdQueue[1].id or P.nextQueue[1] and P.nextQueue[1].id end if bn then - for dir=0,dirCount[bn]do--Each dir + for dir=0,dirCount[bn] do-- Each dir local cb=BLOCKS[bn][dir] - for cx=1,11-#cb[1]do--Each pos + for cx=1,11-#cb[1] do-- Each pos local cy=#Tfield+1 - --Move to bottom - while cy>1 and not _ifoverlapAI(Tfield,cb,cx,cy-1)do + -- Move to bottom + while cy>1 and not _ifoverlapAI(Tfield,cb,cx,cy-1) do cy=cy-1 end - --Simulate lock + -- Simulate lock for i=1,#cb do local y=cy+i-1 - if not Tfield[y]then + if not Tfield[y] then Tfield[y]=getRow(0) end local L=Tfield[y] - for j=1,#cb[1]do - if cb[i][j]then + for j=1,#cb[1] do + if cb[i][j] then L[cx+j-1]=1 end end @@ -194,7 +194,7 @@ function bot_9s.thread(bot) end if not best.bn then return 1 end - --Release cache + -- Release cache while #Tfield>0 do discardRow(rem(Tfield,1)) end @@ -207,7 +207,7 @@ function bot_9s.thread(bot) end ins(keys,6) - --Check if time to change target + -- Check if time to change target yield() if P.aiRND:random()<.00126 then P:changeAtkMode(P.aiRND:random()<.85 and 1 or #P.atker>3 and 4 or P.aiRND:random()<.3 and 2 or 3) diff --git a/parts/bot/bot_cc.lua b/parts/bot/bot_cc.lua index 12ed4a7a..68655e30 100644 --- a/parts/bot/bot_cc.lua +++ b/parts/bot/bot_cc.lua @@ -21,7 +21,7 @@ function bot_cc:checkDest(b2b,atk,exblock,yomi) local CB=self.P.cur.bk for k=1,#dest,2 do local r=CB[dest[k+1]-self.P.curY+2] - if not r or not r[dest[k]-self.P.curX+2]then + if not r or not r[dest[k]-self.P.curX+2] then print('wrong place') self:lockWrongPlace() self.P.destFX=nil @@ -50,11 +50,11 @@ function bot_cc:thread() local P,keys=self.P,self.keys local ccBot=self.ccBot while true do - --Start thinking + -- Start thinking yield() ccBot:think() - --Poll keys + -- Poll keys local success,result,dest,hold,move,b2b,attack,extra,spawn repeat yield() @@ -73,10 +73,10 @@ function bot_cc:thread() dest.extra = extra dest.spawn = spawn P.destFX=dest - if hold then--Hold + if hold then-- Hold keys[1]=8 end - while move[1]do + while move[1] do local m=rem(move,1) if m<4 then ins(keys,m+1) @@ -89,7 +89,7 @@ function bot_cc:thread() ins(keys,6) end - --Check if time to change target + -- Check if time to change target yield() if P.aiRND:random()<.00126 then P:changeAtkMode(P.aiRND:random()<.85 and 1 or #P.atker>3 and 4 or P.aiRND:random()<.3 and 2 or 3) @@ -105,7 +105,7 @@ function bot_cc:updateField() end end while i<=400 do F[i],i=false,i+1 end local y = P:getNextSpawn()-1 - if not pcall(self.ccBot.reset,self.ccBot,F,P.b2b,P.combo,P.stat.pc,P.stat.row,y)then + if not pcall(self.ccBot.reset,self.ccBot,F,P.b2b,P.combo,P.stat.pc,P.stat.row,y) then print("CC is dead ("..P.id..")","error") for y=#F0,1,-1 do local s="" diff --git a/parts/bot/init.lua b/parts/bot/init.lua index 1910f336..24e42fab 100644 --- a/parts/bot/init.lua +++ b/parts/bot/init.lua @@ -14,9 +14,9 @@ function baseBot.update(bot) local keys=bot.keys if P.control and P.cur then bot.delay=bot.delay-1 - if not keys[1]then + if not keys[1] then if bot.runningThread then - if not pcall(bot.runningThread)then + if not pcall(bot.runningThread) then bot.runningThread=false end else @@ -61,17 +61,17 @@ local AISpeed={60,50,42,34,27,21,16,12,9,6} } ]] function BOT.template(arg) - if arg.type=='CC'then + if arg.type=='CC' then return{ type='CC', next=arg.next, hold=arg.hold, delay=AISpeed[arg.speedLV], node=arg.node, - bag=(arg.randomizer or'bag')=='bag', + bag=(arg.randomizer or 'bag')=='bag', _20G=arg._20G, } - elseif arg.type=='9S'then + elseif arg.type=='9S' then return{ type='9S', delay=math.floor(AISpeed[arg.speedLV]), @@ -82,7 +82,7 @@ end function BOT.new(P,data) local bot={P=P,data=data} - if data.type=="CC"then + if data.type=="CC" then P:setRS('TRS') bot.keys={} bot.bufferedNexts={} @@ -107,8 +107,8 @@ function BOT.new(P,data) local cc_lua=require"parts.bot.bot_cc" setmetatable(bot,{__index=function(self,k) return - self.ccBot[k]and function(_,...)self.ccBot[k](self.ccBot,...)end or - cc_lua[k]and function(_,...)cc_lua[k](self,...)end or + self.ccBot[k] and function(_,...)self.ccBot[k](self.ccBot,...) end or + cc_lua[k] and function(_,...)cc_lua[k](self,...) end or assert(baseBot[k],"No CC action called "..k) end}) @@ -127,7 +127,7 @@ function BOT.new(P,data) end bot.runningThread=coroutine.wrap(cc_lua.thread) bot.runningThread(bot) - else--if data.type=="9S"then--9s or else + else-- if data.type=="9S" then-- 9s or else TABLE.cover(baseBot,bot) TABLE.cover(require"parts.bot.bot_9s",bot) P:setRS('TRS') diff --git a/parts/char.lua b/parts/char.lua index dbefe33c..2ef81499 100644 --- a/parts/char.lua +++ b/parts/char.lua @@ -1,5 +1,5 @@ local L={ - zChan={--F0000~F003F + zChan={-- F0000~F003F none= 0xF0000, normal= 0xF0001, full= 0xF0002, @@ -24,7 +24,7 @@ local L={ thinking= 0xF0015, spark= 0xF0016, }, - mino={--F0040~F007F + mino={-- F0040~F007F Z=0xF0040, S=0xF0041, J=0xF0042, @@ -57,7 +57,7 @@ local L={ I2=0xF005B, O1=0xF005C, }, - icon={--F0080~F00FF + icon={-- F0080~F00FF menu= 0xF0080, music= 0xF0081, language= 0xF0082, @@ -131,7 +131,7 @@ local L={ garbage= 0xF00C6, copy= 0xF00C7, }, - key={--F0100~F017F + key={-- F0100~F017F macCmd= 0xF0100, macOpt= 0xF0101, macCtrl= 0xF0102, @@ -172,7 +172,7 @@ local L={ macPgdnAlt= 0xF0125, iecPower= 0xF0126, }, - controller={--F0180~F01FF + controller={-- F0180~F01FF xbox= 0xF0180, lt= 0xF0181, rt= 0xF0182, @@ -212,7 +212,7 @@ local L={ psCreate= 0xF01A4, psOption= 0xF01A5, }, - mahjong={--F0200~F027F + mahjong={-- F0200~F027F m1= 0xF0200, m2= 0xF0201, m3= 0xF0202, diff --git a/parts/customEnv0.lua b/parts/customEnv0.lua index 075304d0..9c7a6c2c 100644 --- a/parts/customEnv0.lua +++ b/parts/customEnv0.lua @@ -1,7 +1,7 @@ return{ version=VERSION.code, - --Basic + -- Basic drop=1e99, lock=1e99, wait=0, @@ -9,17 +9,17 @@ return{ hang=5, hurry=1e99, - --Control + -- Control nextCount=6, holdMode='hold', holdCount=1, infHold=true, phyHold=false, - --Visual + -- Visual bone=false, - --Rule + -- Rule sequence='bag', lockout=false, fieldH=20, @@ -40,7 +40,7 @@ return{ garbageSpeed=1, missionKill=false, - --Else + -- Else bg='blockrain', bgm='hang out', diff --git a/parts/data.lua b/parts/data.lua index 33c25864..74770ad9 100644 --- a/parts/data.lua +++ b/parts/data.lua @@ -5,8 +5,8 @@ local ins=table.insert local BAG,FIELD,MISSION,CUSTOMENV,GAME=BAG,FIELD,MISSION,CUSTOMENV,GAME local DATA={} ---Sep symbol: 33 (!) ---Safe char: 34~126 +-- Sep symbol: 33 (!) +-- Safe char: 34~126 --[[ Count: 34~96 Block: 97~125 @@ -18,7 +18,7 @@ function DATA.copySequence() local count=1 for i=1,#BAG+1 do - if BAG[i+1]~=BAG[i]or count==64 then + if BAG[i+1]~=BAG[i] or count==64 then str=str..char(96+BAG[i]) if count>1 then str=str..char(32+count) @@ -66,14 +66,14 @@ local fieldMeta={__index=function(self,h) end return self[h] end} -function DATA.newBoard(f)--Generate a new board - return setmetatable(f and TABLE.shift(f)or{},fieldMeta) +function DATA.newBoard(f)-- Generate a new board + return setmetatable(f and TABLE.shift(f) or{},fieldMeta) end -function DATA.copyBoard(page)--Copy the [page] board +function DATA.copyBoard(page)-- Copy the [page] board local F=FIELD[page or 1] local str="" - --Encode field + -- Encode field for y=1,#F do local S="" local L=F[y] @@ -91,25 +91,25 @@ function DATA.copyBoards() end return table.concat(out,"!") end -function DATA.pasteBoard(str,page)--Paste [str] data to [page] board +function DATA.pasteBoard(str,page)-- Paste [str] data to [page] board if not page then page=1 end - if not FIELD[page]then + if not FIELD[page] then FIELD[page]=DATA.newBoard() end local F=FIELD[page] - --Decode + -- Decode str=STRING.unpackBin(str) if not str then return end - local fX,fY=1,1--*ptr for Field(r*10+(c-1)) + local fX,fY=1,1-- *ptr for Field(r*10+(c-1)) local p=1 while true do - local b=byte(str,p)--1byte + local b=byte(str,p)-- 1byte - --Str end + -- Str end if not b then if fX~=1 then return @@ -118,9 +118,9 @@ function DATA.pasteBoard(str,page)--Paste [str] data to [page] board end end - local id=b%32-1--Block id - if id>26 then return end--Illegal blockid - b=int(b/32)--Mode id + local id=b%32-1-- Block id + if id>26 then return end-- Illegal blockid + b=int(b/32)-- Mode id F[fY][fX]=id if fX<10 then @@ -158,7 +158,7 @@ function DATA.copyMission() local count=1 for i=1,#MISSION+1 do - if MISSION[i+1]~=MISSION[i]or count==13 then + if MISSION[i+1]~=MISSION[i] or count==13 then _=33+MISSION[i] str=str..char(_) if count>1 then @@ -186,7 +186,7 @@ function DATA.pasteMission(str) end else if b>=34 and b<=114 then - if ENUM_MISSION[reg]then + if ENUM_MISSION[reg] then ins(MISSION,reg) reg=b-33 else @@ -211,8 +211,8 @@ function DATA.copyQuestArgs() local ENV=CUSTOMENV local str="".. ENV.holdCount.. - (ENV.ospin and"O"or"Z").. - (ENV.missionKill and"M"or"Z").. + (ENV.ospin and "O" or "Z").. + (ENV.missionKill and "M" or "Z").. ENV.sequence return str end @@ -252,15 +252,15 @@ function DATA.dumpRecording(list,ptr) local out="" local buffer,buffer2="" if not ptr then ptr=1 end - local prevFrm=list[ptr-2]or 0 - while list[ptr]do - --Flush buffer + local prevFrm=list[ptr-2] or 0 + while list[ptr] do + -- Flush buffer if #buffer>10 then out=out..buffer buffer="" end - --Encode time + -- Encode time local t=list[ptr]-prevFrm prevFrm=list[ptr] if t>=128 then @@ -275,7 +275,7 @@ function DATA.dumpRecording(list,ptr) buffer=buffer..char(t) end - --Encode event + -- Encode event t=list[ptr+1] if t>=128 then buffer2=char(t%128) @@ -289,7 +289,7 @@ function DATA.dumpRecording(list,ptr) buffer=buffer..char(t) end - --Step + -- Step ptr=ptr+2 end return out..buffer,ptr @@ -298,10 +298,10 @@ function DATA.pumpRecording(str,L) local len=#str local p=1 - local curFrm=L[#L-1]or 0 + local curFrm=L[#L-1] or 0 local code while p<=len do - --Read delta time + -- Read delta time code=0 local b=byte(str,p) while b>=128 do @@ -324,7 +324,7 @@ function DATA.pumpRecording(str,L) p=p+1 end end -do--function DATA.saveReplay() +do-- function DATA.saveReplay() local noRecList={"custom","solo","round","techmino"} local function _getModList() local res={} @@ -336,17 +336,17 @@ do--function DATA.saveReplay() return res end function DATA.saveReplay() - --Filtering modes that cannot be saved + -- Filtering modes that cannot be saved for _,v in next,noRecList do - if GAME.curModeName:find(v)then + if GAME.curModeName:find(v) then MES.new('error',"Cannot save recording of this mode now!") return end end - --Write file + -- Write file local fileName=os.date("replay/%Y_%m_%d_%H%M%S.rep") - if not love.filesystem.getInfo(fileName)then + if not love.filesystem.getInfo(fileName) then love.filesystem.write(fileName, love.data.compress('string','zlib', JSON.encode{ @@ -371,29 +371,29 @@ do--function DATA.saveReplay() end function DATA.parseReplay(fileName,ifFull) local fileData - --Read file + -- Read file fileData=love.filesystem.read(fileName) return DATA.parseReplayData(fileName,fileData,ifFull) end function DATA.parseReplayData(fileName,fileData,ifFull) local success,metaData,rep - if not(fileData and #fileData>0)then goto BREAK_cannotParse end + if not (fileData and #fileData>0) then goto BREAK_cannotParse end - --Decompress file + -- Decompress file success,fileData=pcall(love.data.decompress,'string','zlib',fileData) if not success then goto BREAK_cannotParse end - --Load metadata + -- Load metadata metaData,fileData=STRING.readLine(fileData) metaData=JSON.decode(metaData) if not metaData then goto BREAK_cannotParse end - --Convert ancient replays - metaData.mode=MODE_UPDATE_MAP[metaData.mode]or metaData.mode - if not MODES[metaData.mode]then goto BREAK_cannotParse end + -- Convert ancient replays + metaData.mode=MODE_UPDATE_MAP[metaData.mode] or metaData.mode + if not MODES[metaData.mode] then goto BREAK_cannotParse end - --Create replay object + -- Create replay object rep={ fileName=fileName, available=true, @@ -411,7 +411,7 @@ function DATA.parseReplayData(fileName,fileData,ifFull) if ifFull then rep.data=fileData end do return rep end - --Create unavailable replay object + -- Create unavailable replay object ::BREAK_cannotParse:: return{ fileName=fileName, diff --git a/parts/eventsets/attacker_h.lua b/parts/eventsets/attacker_h.lua index 5a66f6c0..ecd92c13 100644 --- a/parts/eventsets/attacker_h.lua +++ b/parts/eventsets/attacker_h.lua @@ -8,18 +8,18 @@ return{ end, task=function(P) while true do - YIELD() + coroutine.yield() if P.control and P.atkBufferSum==0 then local D=P.modeData if D.wave==50 then P:win('finish') else if D.wave<20 then - local t=1500-30*D.wave--1500~900 + local t=1500-30*D.wave-- 1500~900 table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(4,7)),amount=12,countdown=t,cd0=t,time=0,sent=false,lv=3}) table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(3,8)),amount=10,countdown=t,cd0=t,time=0,sent=false,lv=4}) else - local t=900-10*(D.wave-20)--900~600 + local t=900-10*(D.wave-20)-- 900~600 table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(10)),amount=14,countdown=t,cd0=t,time=0,sent=false,lv=4}) table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(4,7)),amount=8,countdown=t,cd0=t,time=0,sent=false,lv=5}) end diff --git a/parts/eventsets/attacker_u.lua b/parts/eventsets/attacker_u.lua index 67e6d1c9..27ccf2b4 100644 --- a/parts/eventsets/attacker_u.lua +++ b/parts/eventsets/attacker_u.lua @@ -8,14 +8,14 @@ return{ end, task=function(P) while true do - YIELD() + coroutine.yield() if P.control and P.atkBufferSum<4 then local D=P.modeData if D.wave==50 then P:win('finish') else local s - local t=800-10*D.wave--800~700~600~500 + local t=800-10*D.wave-- 800~700~600~500 if D.wave<10 then table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(5,6)),amount=9,countdown=t,cd0=t,time=0,sent=false,lv=3}) table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(4,7)),amount=11,countdown=t,cd0=t+62,time=0,sent=false,lv=4}) diff --git a/parts/eventsets/checkClearBoard.lua b/parts/eventsets/checkClearBoard.lua index ea51a2c9..21222f8f 100644 --- a/parts/eventsets/checkClearBoard.lua +++ b/parts/eventsets/checkClearBoard.lua @@ -3,7 +3,7 @@ return{ if P.garbageBeneath==0 then local D=P.modeData D.finished=D.finished+1 - if FIELD[D.finished+1]then + if FIELD[D.finished+1] then P.waiting=26 for i=#P.field,1,-1 do P.field[i],P.visTime[i]=nil diff --git a/parts/eventsets/checkTurn_1.lua b/parts/eventsets/checkTurn_1.lua index c0ca5c3f..2b5be985 100644 --- a/parts/eventsets/checkTurn_1.lua +++ b/parts/eventsets/checkTurn_1.lua @@ -13,7 +13,7 @@ return{ end end for i=1,#PLY_ALIVE do - if PLY_ALIVE[i].sid==(minMaxID==1e99 and minID or minMaxID)then + if PLY_ALIVE[i].sid==(minMaxID==1e99 and minID or minMaxID) then PLY_ALIVE[i].control=true return end diff --git a/parts/eventsets/checkTurn_7.lua b/parts/eventsets/checkTurn_7.lua index bf0ce2d7..5b7752f8 100644 --- a/parts/eventsets/checkTurn_7.lua +++ b/parts/eventsets/checkTurn_7.lua @@ -13,7 +13,7 @@ return{ end end for i=1,#PLY_ALIVE do - if PLY_ALIVE[i].sid==(minMaxID==1e99 and minID or minMaxID)then + if PLY_ALIVE[i].sid==(minMaxID==1e99 and minID or minMaxID) then PLY_ALIVE[i].control=true return end diff --git a/parts/eventsets/classic_l.lua b/parts/eventsets/classic_l.lua index 8ca43bd8..fae97d5c 100644 --- a/parts/eventsets/classic_l.lua +++ b/parts/eventsets/classic_l.lua @@ -62,9 +62,9 @@ return{ local D=P.modeData D.drought=P.lastPiece.id==7 and 0 or D.drought+1 if P.stat.row>=D.target then - --if D.target>=200 then + -- if D.target>=200 then D.lvl=D.lvl+1 - --end + -- end local dropSpd=GetGravity(D.lvl) if dropSpd~=P.gameEnv.drop then P.gameEnv.drop,P.gameEnv.lock=dropSpd,dropSpd diff --git a/parts/eventsets/defender_l.lua b/parts/eventsets/defender_l.lua index d059c529..90f3594b 100644 --- a/parts/eventsets/defender_l.lua +++ b/parts/eventsets/defender_l.lua @@ -10,14 +10,14 @@ return{ end, task=function(P) while true do - YIELD() + coroutine.yield() if P.control then local D=P.modeData D.counter=D.counter+1 local t= D.wave<=60 and 240-2*D.wave or - D.wave<=120 and 120-(D.wave-60)or - D.wave<=180 and math.floor(60-(D.wave-120)*.5)or + D.wave<=120 and 120-(D.wave-60) or + D.wave<=180 and math.floor(60-(D.wave-120)*.5) or 30 if D.counter>=t then D.counter=0 diff --git a/parts/eventsets/defender_n.lua b/parts/eventsets/defender_n.lua index c20c6917..0ab6a210 100644 --- a/parts/eventsets/defender_n.lua +++ b/parts/eventsets/defender_n.lua @@ -10,7 +10,7 @@ return{ end, task=function(P) while true do - YIELD() + coroutine.yield() if P.control then local D=P.modeData D.counter=D.counter+1 diff --git a/parts/eventsets/dig_h.lua b/parts/eventsets/dig_h.lua index 1a50c103..d5e5a3c1 100644 --- a/parts/eventsets/dig_h.lua +++ b/parts/eventsets/dig_h.lua @@ -6,11 +6,11 @@ return{ end, task=function(P) while true do - YIELD() + coroutine.yield() if P.control then local D=P.modeData D.timer=D.timer+1 - if D.timer>=math.max(90,180-D.wave)then + if D.timer>=math.max(90,180-D.wave) then P:garbageRise(21,1,P:getHolePos()) P.stat.recv=P.stat.recv+1 D.timer=0 diff --git a/parts/eventsets/dig_u.lua b/parts/eventsets/dig_u.lua index c98d6c36..ec6927d6 100644 --- a/parts/eventsets/dig_u.lua +++ b/parts/eventsets/dig_u.lua @@ -6,11 +6,11 @@ return{ end, task=function(P) while true do - YIELD() + coroutine.yield() if P.control then local D=P.modeData D.timer=D.timer+1 - if D.timer>=math.max(30,80-.3*D.wave)then + if D.timer>=math.max(30,80-.3*D.wave) then P:garbageRise(20+D.wave%5,1,P:getHolePos()) P.stat.recv=P.stat.recv+1 D.timer=0 diff --git a/parts/eventsets/marathon_bfmax.lua b/parts/eventsets/marathon_bfmax.lua index 078c5b3f..cec03b5e 100644 --- a/parts/eventsets/marathon_bfmax.lua +++ b/parts/eventsets/marathon_bfmax.lua @@ -14,11 +14,11 @@ return{ hook_drop=function(P) local flag local l=P.lastPiece - if P.combo>1 then flag=true;P:showText("2x",0,-220,40,'flicker',.3)end - if l.spin then flag=true;P:showText("spin",0,-180,40,'flicker',.3)end - if l.row>1 then flag=true;P:showText("1+",0,-140,40,'flicker',.3)end - if l.hpc then flag=true;P:showText("HPC",0,-100,40,'flicker',.3)end - if l.pc then P:showText("PC",0,-90,100,'beat',.5)end + if P.combo>1 then flag=true;P:showText("2x",0,-220,40,'flicker',.3) end + if l.spin then flag=true;P:showText("spin",0,-180,40,'flicker',.3) end + if l.row>1 then flag=true;P:showText("1+",0,-140,40,'flicker',.3) end + if l.hpc then flag=true;P:showText("HPC",0,-100,40,'flicker',.3) end + if l.pc then P:showText("PC",0,-90,100,'beat',.5) end if flag then P:lose() else diff --git a/parts/eventsets/marathon_inf.lua b/parts/eventsets/marathon_inf.lua index 80e8fa12..d9f88cfb 100644 --- a/parts/eventsets/marathon_inf.lua +++ b/parts/eventsets/marathon_inf.lua @@ -2,7 +2,7 @@ local dropSpeed={ 50,42,35,30,25,20,16,13,11,10, 9,8,7,6,5,5,4,4,3,3, 3,2,2,2,2,1,1,1,1,1, - .5,.5,.5,.5,.25,.25,.25,.125,.125,--Total 39 numbers, switch to 20G when reach 400 lines + .5,.5,.5,.5,.25,.25,.25,.125,.125,-- Total 39 numbers, switch to 20G when reach 400 lines } local lockDelay={ 57,54,51,48,46,44,42,40,38,36, @@ -17,7 +17,7 @@ local lockDelay={ 4,4,4,4,4,4,4,4,4,4, 3,3,3,3,3,3,3,3,3,3, 2,2,2,2,2,2,2,2,2,2, - 1,1,1,1,1,1,1,1,1,--Finish at 1700 + 1,1,1,1,1,1,1,1,1,-- Finish at 1700 } return diff --git a/parts/eventsets/master_ex.lua b/parts/eventsets/master_ex.lua index 5c6944cf..211a93f6 100644 --- a/parts/eventsets/master_ex.lua +++ b/parts/eventsets/master_ex.lua @@ -7,7 +7,7 @@ local function getRollGoal(P) if rem<=0 then return 0 end local goal=math.floor(rem)*4 rem=rem%1 - return goal + (rem>0.3 and 4 or rem*10) + return goal+(rem>0.3 and 4 or rem*10) end return{ @@ -40,10 +40,10 @@ return{ PLY.draw.drawTargetLine(P,getRollGoal(P)) end, hook_drop=function(P) - if P.modeData.rankPoint<140-passPoint then--If Less then X + if P.modeData.rankPoint<140-passPoint then-- If Less then X local R=#P.clearedRow if R>0 then - if R==4 then R=10 end--Techrash +10 + if R==4 then R=10 end-- Techrash +10 P.modeData.rankPoint=math.min(P.modeData.rankPoint+R,140-passPoint) P.modeData.rankName=sectionName[math.floor(P.modeData.rankPoint/10)+1] end @@ -53,7 +53,7 @@ return{ P.modeData.rankPoint=0 P.modeData.rankName=sectionName[1] while true do - YIELD() + coroutine.yield() if P.stat.frame>=3600 then P.modeData.rankPoint=math.min(P.modeData.rankPoint+passPoint,140) P.modeData.rankName=sectionName[math.floor(P.modeData.rankPoint/10)+1] diff --git a/parts/eventsets/master_final.lua b/parts/eventsets/master_final.lua index b6ad08a7..54b203cd 100644 --- a/parts/eventsets/master_final.lua +++ b/parts/eventsets/master_final.lua @@ -21,18 +21,18 @@ return{ if D.pt%100==99 then SFX.play('warn_1') - elseif D.pt>=D.target then--Level up! - s=D.target/100--range from 1 to 9 + elseif D.pt>=D.target then-- Level up! + s=D.target/100-- range from 1 to 9 local E=P.gameEnv if s<4 then P:stageComplete(s) - --First 300 + -- First 300 if s~=1 then E.lock=E.lock-1 end if s~=2 then E.wait=E.wait-1 end if s~=3 then E.fall=E.fall-1 end D.target=D.target+100 elseif s<10 then - if s==5 then BGM.play('distortion')end + if s==5 then BGM.play('distortion') end P:stageComplete(s) if s==4 or s==7 then E.das=E.das-1 end if s%3==0 then E.lock=E.lock-1 diff --git a/parts/eventsets/master_g.lua b/parts/eventsets/master_g.lua index b47bc548..875e592d 100644 --- a/parts/eventsets/master_g.lua +++ b/parts/eventsets/master_g.lua @@ -18,8 +18,8 @@ local isInRoll=false local rollGrades=0 local cool_time={3120,3120,2940,2700,2700,2520,2520,2280,2280,0} local reg_time= {5400,4500,4500,4080,3600,3600,3000,3000,3000,3000} -local prevDrop70=false --determines if previous piece has level less than __70 -local nextSpeedUp=false --determines if the next section speed should be boosted by 100 +local prevDrop70=false -- determines if previous piece has level less than __70 +local nextSpeedUp=false -- determines if the next section speed should be boosted by 100 local isInRollTrans=false local function getGrav(l) return @@ -111,11 +111,11 @@ local function getRollGoal() if cools>8 then goal=math.floor(rem)*4 rem=rem%1 - return goal + (rem>0.3 and 4 or rem*10) + return goal+(rem>0.3 and 4 or rem*10) else goal=math.floor(rem/0.26)*4 rem=rem%0.26 - return goal + (rem>0.12 and 4 or rem*25) + return goal+(rem>0.12 and 4 or rem*25) end end @@ -204,7 +204,7 @@ return{ P.gameEnv.drop=getGrav(spd_lvl) - if(P.gameEnv.drop==0) then + if (P.gameEnv.drop==0) then P:set20G(true) end @@ -220,7 +220,7 @@ return{ if D.pt+1==D.target then SFX.play('warn_1') - elseif D.pt>=D.target then--Level up! + elseif D.pt>=D.target then-- Level up! spd_lvl=nextSpeedUp and spd_lvl+100 or spd_lvl nextSpeedUp=false prevDrop70=false @@ -289,7 +289,7 @@ return{ local decayRate={125,80,80,50,45,45,45,40,40,40,40,40,30,30,30,20,20,20,20,20,15,15,15,15,15,15,15,15,15,15,10,10,10,9,9,9,8,8,8,7,7,7,6} local decayTimer=0 while true do - YIELD() + coroutine.yield() P.modeData.grade=getGrade() P.modeData.gradePts=math.max(math.min(math.floor(int_grade_boosts[math.min(int_grade+1,#int_grade_boosts)]+rollGrades+cools+1-regrets),#gradeList),1) if P.stat.frame-prevSectTime > reg_time[math.ceil(P.modeData.pt/100+0.01)] and not (isInRoll or isInRollTrans) then @@ -301,7 +301,7 @@ return{ end if isInRollTrans then if P.waiting>=220 then - --Make field invisible + -- Make field invisible for y=1,#P.field do for x=1,10 do P.visTime[y][x]=P.waiting-220 end end @@ -336,7 +336,7 @@ return{ rollGrades=rollGrades+(cools>8 and 1.6 or 0.5) P.modeData.grade=getGrade() P.modeData.gradePts=math.min(math.floor(int_grade_boosts[math.min(int_grade+1,#int_grade_boosts)]+rollGrades+cools+1-regrets),#gradeList) - YIELD() + coroutine.yield() P:win('finish') end end diff --git a/parts/eventsets/master_h.lua b/parts/eventsets/master_h.lua index 8934830a..3d9d7d86 100644 --- a/parts/eventsets/master_h.lua +++ b/parts/eventsets/master_h.lua @@ -25,7 +25,7 @@ return{ if D.pt%100==99 then SFX.play('warn_1') - elseif D.pt>=D.target then--Level up! + elseif D.pt>=D.target then-- Level up! s=D.target/100 local E=P.gameEnv E.lock=death_lock[s] diff --git a/parts/eventsets/master_instinct.lua b/parts/eventsets/master_instinct.lua index 5a42febb..ab97e083 100644 --- a/parts/eventsets/master_instinct.lua +++ b/parts/eventsets/master_instinct.lua @@ -23,7 +23,7 @@ return{ if c==0 and D.pt%100==99 then if D.pt<1000 then hidetimer=0-inv_wait[(P.modeData.pt/100-(P.modeData.pt%100)/100)+1] - if c>0 then hidetimer=hidetimer-inv_fall[(P.modeData.pt/100-(P.modeData.pt%100)/100)+1]end + if c>0 then hidetimer=hidetimer-inv_fall[(P.modeData.pt/100-(P.modeData.pt%100)/100)+1] end end return end @@ -35,12 +35,12 @@ return{ held=false if D.pt<1000 then hidetimer=0-inv_wait[(P.modeData.pt/100-(P.modeData.pt%100)/100)+1] - if c>0 then hidetimer=hidetimer-inv_fall[(P.modeData.pt/100-(P.modeData.pt%100)/100)+1]end + if c>0 then hidetimer=hidetimer-inv_fall[(P.modeData.pt/100-(P.modeData.pt%100)/100)+1] end end if D.pt%100==99 then SFX.play('warn_1') - elseif D.pt>=D.target then--Level up! + elseif D.pt>=D.target then-- Level up! s=D.target/100 local E=P.gameEnv E.lock=inv_lock[s] @@ -72,13 +72,13 @@ return{ P.modeData.pt=0 P.modeData.target=100 while true do - YIELD() + coroutine.yield() if P.holdTime==0 and P.waiting<=0 and not held then hidetimer=0 held=true end hidetimer=hidetimer+1 - if hidetimer>inv_hide[(P.modeData.pt/100-(P.modeData.pt%100)/100)+1]then + if hidetimer>inv_hide[(P.modeData.pt/100-(P.modeData.pt%100)/100)+1] then P.gameEnv.block=false else P.gameEnv.block=true diff --git a/parts/eventsets/master_n.lua b/parts/eventsets/master_n.lua index ef573852..9dd868b1 100644 --- a/parts/eventsets/master_n.lua +++ b/parts/eventsets/master_n.lua @@ -25,7 +25,7 @@ return{ if D.pt%100==99 then SFX.play('warn_1') - elseif D.pt>=D.target then--Level up! + elseif D.pt>=D.target then-- Level up! s=D.target/100 local E=P.gameEnv E.lock=rush_lock[s] diff --git a/parts/eventsets/master_ph.lua b/parts/eventsets/master_ph.lua index 91725929..2f072aec 100644 --- a/parts/eventsets/master_ph.lua +++ b/parts/eventsets/master_ph.lua @@ -18,8 +18,8 @@ return if p>=P.modeData.target then local ENV=P.gameEnv local T=P.modeData.target - --Stage 1: clear 3 techrash - if T==12 then--Stage 2: swap color of S/Z & J/L + -- Stage 1: clear 3 techrash + if T==12 then-- Stage 2: swap color of S/Z & J/L P:stageComplete(2) P.waiting=30 P.curMission=false @@ -34,9 +34,9 @@ return P.modeData.target=26 SFX.play('reach') - elseif T==26 then--Stage 3: dig to bottom + elseif T==26 then-- Stage 3: dig to bottom P:stageComplete(3) - if not P.holdQueue[1]then--1 up if ban hold + if not P.holdQueue[1] then-- 1 up if ban hold P.life=P.life+1 end P.waiting=45 @@ -44,7 +44,7 @@ return ENV.skin[3],ENV.skin[4]=ENV.skin[4],ENV.skin[3] for i=1,10 do - if P.field[i]then + if P.field[i] then for j=1,10 do if P.field[i][j]>0 then P.field[i][j]=17 @@ -79,7 +79,7 @@ return P.modeData.target=42 SFX.play('reach') - elseif T==42 then--Stage 4: survive in high speed + elseif T==42 then-- Stage 4: survive in high speed if P.garbageBeneath==0 then P:stageComplete(4) P.waiting=30 @@ -93,7 +93,7 @@ return else p=41 end - elseif T==62 then--Stage 5: survive without easy-fresh rule + elseif T==62 then-- Stage 5: survive without easy-fresh rule P:stageComplete(5) P.life=P.life+1 ENV.lock=13 @@ -104,7 +104,7 @@ return P.modeData.target=126 SFX.play('reach') - elseif T==126 then--Stage 6: speed up + elseif T==126 then-- Stage 6: speed up P:stageComplete(6) P.life=P.life+1 @@ -114,7 +114,7 @@ return P.modeData.target=162 SFX.play('reach') - elseif T==162 then--Stage 7: speed up+++ + elseif T==162 then-- Stage 7: speed up+++ P:stageComplete(7) P.life=P.life+1 @@ -125,7 +125,7 @@ return P.modeData.target=226 SFX.play('reach') - elseif T==226 then--Stage 8: final invisible + elseif T==226 then-- Stage 8: final invisible P:stageComplete(8) P.life=P.life+1 @@ -134,10 +134,10 @@ return P.modeData.target=259 SFX.play('reach') - elseif T==259 then--Stage 9: ending + elseif T==259 then-- Stage 9: ending P:stageComplete(9) P.life=P.life+1 - for i=1,7 do ENV.skin[i]=P.holeRND:random(16)end + for i=1,7 do ENV.skin[i]=P.holeRND:random(16) end P:setInvisible(40) ENV.lock=15 diff --git a/parts/eventsets/pctrain_l.lua b/parts/eventsets/pctrain_l.lua index 63be518f..11f015a3 100644 --- a/parts/eventsets/pctrain_l.lua +++ b/parts/eventsets/pctrain_l.lua @@ -11,7 +11,7 @@ local function task_PC(P) P:pushNextList(L,symmetry) P.control=false - if P.frameRun>180 then for _=1,26 do YIELD()end end + if P.frameRun>180 then for _=1,26 do coroutine.yield() end end P.control=true local base=PCbase[difficulty] @@ -31,9 +31,9 @@ local function _check(P) if P.stat.pc%4==0 and P.stat.pc>0 and P.stat.pc<=40 then local s=P.stat.pc/4 - P.gameEnv.drop=pc_drop[s]or 10 - P.gameEnv.lock=pc_lock[s]or 25 - P.gameEnv.fall=pc_fall[s]or 4 + P.gameEnv.drop=pc_drop[s] or 10 + P.gameEnv.lock=pc_lock[s] or 25 + P.gameEnv.fall=pc_fall[s] or 4 if s==10 then P:_showText(text.maxspeed,0,-140,100,'appear',.6) end @@ -50,5 +50,5 @@ return{ mText(TEXTOBJ.pc,63,330) end, hook_drop=_check, - task=_check,--Just run one time at first to start first level + task=_check,-- Just run one time at first to start first level } diff --git a/parts/eventsets/pctrain_n.lua b/parts/eventsets/pctrain_n.lua index d66bf546..dfaf7835 100644 --- a/parts/eventsets/pctrain_n.lua +++ b/parts/eventsets/pctrain_n.lua @@ -8,13 +8,13 @@ local PCtype={ 1,2,3, } local function task_PC(P) - local difficulty=PCtype[P.stat.pc+1]or 3 + local difficulty=PCtype[P.stat.pc+1] or 3 local L=PClist[difficulty][P.holeRND:random(#PClist[difficulty])] local symmetry=P.holeRND:random()>.5 P:pushNextList(L,symmetry) P.control=false - if P.frameRun>180 then for _=1,26 do YIELD()end end + if P.frameRun>180 then for _=1,26 do coroutine.yield() end end P.control=true local base=PCbase[difficulty] @@ -43,5 +43,5 @@ return{ mText(TEXTOBJ.pc,63,330) end, hook_drop=_check, - task=_check,--Just run one time at first to start first level + task=_check,-- Just run one time at first to start first level } diff --git a/parts/eventsets/secret_grade.lua b/parts/eventsets/secret_grade.lua index 6364d319..1fa2c5c4 100644 --- a/parts/eventsets/secret_grade.lua +++ b/parts/eventsets/secret_grade.lua @@ -6,7 +6,7 @@ end local F={} -- local ranks={"10","9","8","7","6","5","4","3","2","1","S1","S2","S3","S4","S5","S6","S7","S8","S9","GM","GM+","TM","TM+","TM+₂","TM+₃", "TM+₄","TM+₅"} --- lines: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 +-- lines: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 local function getSmallNum(num) local smalldigit={[0]="₀","₁","₂","₃","₄","₅","₆","₇","₈","₉"} @@ -46,7 +46,7 @@ local function generateGuide(num) end return{ - fkey1=function(P)P.modeData.showGuide=not P.modeData.showGuide end, + fkey1=function(P) P.modeData.showGuide=not P.modeData.showGuide end, mesDisp=function(P) mText(TEXTOBJ.grade,63,190) mText(TEXTOBJ.line,63,310) diff --git a/parts/eventsets/sprintMD.lua b/parts/eventsets/sprintMD.lua index be300c82..c4eed657 100644 --- a/parts/eventsets/sprintMD.lua +++ b/parts/eventsets/sprintMD.lua @@ -7,18 +7,18 @@ return{ PLY.draw.drawTargetLine(P,r) end, task=function(P) - YIELD() + coroutine.yield() while true do - for _=1,P.holeRND:random(40,200)do YIELD()end + for _=1,P.holeRND:random(40,200) do coroutine.yield() end local r=P.holeRND:random(7) if r==1 then - if P.cur and not P:ifoverlap(P.cur.bk,P.curX-1,P.curY)then + if P.cur and not P:ifoverlap(P.cur.bk,P.curX-1,P.curY) then P:createMoveFX('left') P.curX=P.curX-1 P:freshBlock('move') end elseif r==2 then - if P.cur and not P:ifoverlap(P.cur.bk,P.curX-1,P.curY)then + if P.cur and not P:ifoverlap(P.cur.bk,P.curX-1,P.curY) then P:createMoveFX('left') P.curX=P.curX-1 P:freshBlock('move') diff --git a/parts/eventsets/sprintSym.lua b/parts/eventsets/sprintSym.lua index 3481c94f..52eb91d3 100644 --- a/parts/eventsets/sprintSym.lua +++ b/parts/eventsets/sprintSym.lua @@ -19,7 +19,7 @@ return{ for y=1,#F do local l=F[y] for x=1,5 do - if l[x]>0 and l[11-x]>0 and oppo[l[x]]~=l[11-x]then + if l[x]>0 and l[11-x]>0 and oppo[l[x]]~=l[11-x] then P:lose() return end diff --git a/parts/eventsets/survivor_e.lua b/parts/eventsets/survivor_e.lua index d410008d..442e8c87 100644 --- a/parts/eventsets/survivor_e.lua +++ b/parts/eventsets/survivor_e.lua @@ -6,11 +6,11 @@ return{ end, task=function(P) while true do - YIELD() + coroutine.yield() if P.control then local D=P.modeData D.timer=D.timer+1 - if D.timer>=math.max(60,150-2*D.wave)and P.atkBufferSum<4 then + if D.timer>=math.max(60,150-2*D.wave) and P.atkBufferSum<4 then if D.wave==100 then P:win('finish') else diff --git a/parts/eventsets/survivor_h.lua b/parts/eventsets/survivor_h.lua index d24ac698..8f591cc6 100644 --- a/parts/eventsets/survivor_h.lua +++ b/parts/eventsets/survivor_h.lua @@ -6,11 +6,11 @@ return{ end, task=function(P) while true do - YIELD() + coroutine.yield() if P.control then local D=P.modeData D.timer=D.timer+1 - if D.timer>=math.max(60,180-2*D.wave)and P.atkBufferSum<15 then + if D.timer>=math.max(60,180-2*D.wave) and P.atkBufferSum<15 then if D.wave==90 then P:win('finish') else diff --git a/parts/eventsets/survivor_l.lua b/parts/eventsets/survivor_l.lua index 266e79a9..bf4ee313 100644 --- a/parts/eventsets/survivor_l.lua +++ b/parts/eventsets/survivor_l.lua @@ -6,11 +6,11 @@ return{ end, task=function(P) while true do - YIELD() + coroutine.yield() if P.control then local D=P.modeData D.timer=D.timer+1 - if D.timer>=math.max(60,150-D.wave)and P.atkBufferSum<20 then + if D.timer>=math.max(60,150-D.wave) and P.atkBufferSum<20 then if D.wave==110 then P:win('finish') else @@ -18,7 +18,7 @@ return{ table.insert(P.atkBuffer,{line=generateLine(P.holeRND:random(10)),amount=4,countdown=t,cd0=t,time=0,sent=false,lv=3}) P.atkBufferSum=P.atkBufferSum+4 P.stat.recv=P.stat.recv+4 - if D.wave==60 then + if D.wave==90 then P:_showText(text.maxspeed,0,-140,100,'appear',.6) end P:shakeField(3) diff --git a/parts/eventsets/survivor_n.lua b/parts/eventsets/survivor_n.lua index 2c6d0e33..10d57167 100644 --- a/parts/eventsets/survivor_n.lua +++ b/parts/eventsets/survivor_n.lua @@ -6,19 +6,19 @@ return{ end, task=function(P) while true do - YIELD() + coroutine.yield() if P.control then local D=P.modeData D.timer=D.timer+1 - if D.timer>=math.max(90,180-2*D.wave)and P.atkBufferSum<8 then + if D.timer>=math.max(90,180-2*D.wave) and P.atkBufferSum<8 then if D.wave==80 then P:win('finish') else local d=D.wave+1 table.insert(P.atkBuffer, - d%4==0 and{line=generateLine(P.holeRND:random(10)),amount=1,countdown=60,cd0=60,time=0,sent=false,lv=1}or - d%4==1 and{line=generateLine(P.holeRND:random(10)),amount=2,countdown=70,cd0=70,time=0,sent=false,lv=1}or - d%4==2 and{line=generateLine(P.holeRND:random(10)),amount=3,countdown=80,cd0=80,time=0,sent=false,lv=2}or + d%4==0 and{line=generateLine(P.holeRND:random(10)),amount=1,countdown=60,cd0=60,time=0,sent=false,lv=1} or + d%4==1 and{line=generateLine(P.holeRND:random(10)),amount=2,countdown=70,cd0=70,time=0,sent=false,lv=1} or + d%4==2 and{line=generateLine(P.holeRND:random(10)),amount=3,countdown=80,cd0=80,time=0,sent=false,lv=2} or d%4==3 and{line=generateLine(P.holeRND:random(10)),amount=4,countdown=90,cd0=90,time=0,sent=false,lv=3} ) P.atkBufferSum=P.atkBufferSum+d%4+1 diff --git a/parts/eventsets/survivor_u.lua b/parts/eventsets/survivor_u.lua index 34952f2d..23a80341 100644 --- a/parts/eventsets/survivor_u.lua +++ b/parts/eventsets/survivor_u.lua @@ -6,11 +6,11 @@ return{ end, task=function(P) while true do - YIELD() + coroutine.yield() if P.control then local D=P.modeData D.timer=D.timer+1 - if D.timer>=math.max(300,600-10*D.wave)and P.atkBufferSum<20 then + if D.timer>=math.max(300,600-10*D.wave) and P.atkBufferSum<20 then if D.wave==35 then P:win('finish') else diff --git a/parts/eventsets/techrash_u.lua b/parts/eventsets/techrash_u.lua index 396a65b2..e03628f8 100644 --- a/parts/eventsets/techrash_u.lua +++ b/parts/eventsets/techrash_u.lua @@ -15,7 +15,7 @@ return{ local C=P.lastPiece if C.row>0 then if C.row==4 then - if TABLE.find(P.modeData.history,C.curX)then + if TABLE.find(P.modeData.history,C.curX) then P:showText("STACK",0,-140,40,'flicker',.3) P:lose() else diff --git a/parts/eventsets/tsd_h.lua b/parts/eventsets/tsd_h.lua index cba39415..caaf38b8 100644 --- a/parts/eventsets/tsd_h.lua +++ b/parts/eventsets/tsd_h.lua @@ -4,7 +4,7 @@ return{ GC.mStr(P.modeData.tsd,63,250) mText(TEXTOBJ.tsd,63,315) local L=P.modeData.history - if L[1]and L[1]==L[2]and L[1]==L[3]then + if L[1] and L[1]==L[2] and L[1]==L[3] then PLY.draw.applyField(P) GC.setColor(1,.3,.3,.2) GC.rectangle('fill',30*L[1]-30,0,30,600) @@ -16,7 +16,7 @@ return{ if C.row>0 then if C.id==5 and C.row==2 and C.spin then local L=P.modeData.history - if L[1]==C.centX and L[1]==L[2]and L[1]==L[3]then + if L[1]==C.centX and L[1]==L[2] and L[1]==L[3] then P:showText("STACK",0,-140,40,'flicker',.3) P:lose() else diff --git a/parts/eventsets/tsd_u.lua b/parts/eventsets/tsd_u.lua index f02d9cf4..46942dec 100644 --- a/parts/eventsets/tsd_u.lua +++ b/parts/eventsets/tsd_u.lua @@ -15,7 +15,7 @@ return{ local C=P.lastPiece if C.row>0 then if C.id==5 and C.row==2 and C.spin then - if TABLE.find(P.modeData.history,C.centX)then + if TABLE.find(P.modeData.history,C.centX) then P:showText("STACK",0,-140,40,'flicker',.3) P:lose() else diff --git a/parts/eventsets/ultra.lua b/parts/eventsets/ultra.lua index bcfd61aa..c02efe42 100644 --- a/parts/eventsets/ultra.lua +++ b/parts/eventsets/ultra.lua @@ -21,8 +21,8 @@ return{ BGM.seek(0) P.modeData.section=1 while true do - YIELD() - while P.stat.frame>=warnTime[P.modeData.section]do + coroutine.yield() + while P.stat.frame>=warnTime[P.modeData.section] do if P.modeData.section<9 then P.modeData.section=P.modeData.section+1 playReadySFX(3,.7+P.modeData.section*.03) diff --git a/parts/gameFuncs.lua b/parts/gameFuncs.lua index 5bbf63a8..2b06de61 100644 --- a/parts/gameFuncs.lua +++ b/parts/gameFuncs.lua @@ -2,7 +2,7 @@ local gc_push,gc_pop=GC.push,GC.pop local gc_origin,gc_replaceTransform=GC.origin,GC.replaceTransform local gc_setLineWidth,gc_setColor=GC.setLineWidth,GC.setColor local gc_setShader=GC.setShader -local gc_draw,gc_rectangle,gc_line,gc_printf=GC.draw,GC.rectangle,GC.line,GC.printf +local gc_draw,gc_rectangle,gc_printf=GC.draw,GC.rectangle,GC.printf local ins,rem=table.insert,table.remove local int,rnd=math.floor,math.random @@ -10,12 +10,11 @@ local approach=MATH.expApproach local SETTING,GAME,SCR=SETTING,GAME,SCR local PLAYERS=PLAYERS -local playSFX=SFX.play ---System -do--function tryBack() +-- System +do-- function tryBack() local sureTime=-1e99 function tryBack() if TIME()-sureTime<1 then @@ -27,7 +26,7 @@ do--function tryBack() end end end -do--function tryReset() +do-- function tryReset() local sureTime=-1e99 function tryReset() if TIME()-sureTime<1 then @@ -39,7 +38,7 @@ do--function tryReset() end end end -do--function tryDelete() +do-- function tryDelete() local sureTime=-1e99 function tryDelete() if TIME()-sureTime<1 then @@ -51,21 +50,21 @@ do--function tryDelete() end end end -do--function loadFile(name,args), function saveFile(data,name,args) - local t=setmetatable({},{__index=function()return"'$1' loading failed: $2"end}) +do-- function loadFile(name,args), function saveFile(data,name,args) + local t=setmetatable({},{__index=function() return"'$1' loading failed: $2" end}) function loadFile(name,args) local text=text or t - if not args then args=''end + if not args then args='' end local res,mes=pcall(FILE.load,name,args) if res then return mes else - if mes:find'open error'then + if mes:find'open error' then MES.new('error',text.loadError_open:repD(name,"")) - elseif mes:find'unknown mode'then + elseif mes:find'unknown mode' then MES.new('error',text.loadError_errorMode:repD(name,args)) - elseif mes:find'no file'then - if not args:sArg'-canSkip'then + elseif mes:find'no file' then + if not args:sArg'-canSkip' then MES.new('error',text.loadError_noFile:repD(name,"")) end elseif mes then @@ -82,24 +81,17 @@ do--function loadFile(name,args), function saveFile(data,name,args) return true else MES.new('error', - mes:find'duplicate'and - text.saveError_duplicate:repD(name)or - mes:find'encode error'and - text.saveError_encode:repD(name)or + mes:find'duplicate' and + text.saveError_duplicate:repD(name) or + mes:find'encode error' and + text.saveError_encode:repD(name) or mes and - text.saveError_other:repD(name,mes)or + text.saveError_other:repD(name,mes) or text.saveError_unknown:repD(name) ) end end end -function isSafeFile(file,mes) - if love.filesystem.getRealDirectory(file)~=SAVEDIR then - return true - elseif mes then - MES.new('warn',mes) - end -end function saveStats() return saveFile(STAT,'conf/data') end @@ -107,9 +99,15 @@ function saveProgress() return saveFile(RANKS,'conf/unlock') end function saveSettings() + if WS.status('game')=='running' then + NET.player_updateConf() + end return saveFile(SETTING,'conf/settings') end -do--function applySettings() +function saveUser() + return saveFile(USER.__data,'conf/user') +end +do-- function applySettings() local saturateValues={ normal={0,1}, soft={.2,.7}, @@ -118,56 +116,56 @@ do--function applySettings() color={-.2,1.2}, } function applySettings() - --Apply language + -- Apply language text=LANG.get(SETTING.locale) WIDGET.setLang(text.WidgetText) for k,v in next,TEXTOBJ do - if rawget(text,k)then + if rawget(text,k) then v:set(text[k]) end end - --Apply cursor + -- Apply cursor love.mouse.setVisible(SETTING.sysCursor) - --Apply fullscreen + -- Apply fullscreen love.window.setFullscreen(SETTING.fullscreen) love.resize(GC.getWidth(),GC.getHeight()) - --Apply Zframework setting + -- Apply Zframework setting Z.setClickFX(SETTING.clickFX) Z.setFrameMul(SETTING.frameMul) Z.setPowerInfo(SETTING.powerInfo) Z.setCleanCanvas(SETTING.cleanCanvas) - --Apply VK shape + -- Apply VK shape VK.setShape(SETTING.VKSkin) - --Apply sound + -- Apply sound love.audio.setVolume(SETTING.mainVol) BGM.setVol(SETTING.bgm) SFX.setVol(SETTING.sfx) VOC.setVol(SETTING.voc) - --Apply saturs + -- Apply saturs local m - m=saturateValues[SETTING.blockSatur]or saturateValues.normal + m=saturateValues[SETTING.blockSatur] or saturateValues.normal SHADER.blockSatur:send('b',m[1]) SHADER.blockSatur:send('k',m[2]) - m=saturateValues[SETTING.fieldSatur]or saturateValues.normal + m=saturateValues[SETTING.fieldSatur] or saturateValues.normal SHADER.fieldSatur:send('b',m[1]) SHADER.fieldSatur:send('k',m[2]) - --Apply BG - if SETTING.bg=='on'then + -- Apply BG + if SETTING.bg=='on' then BG.unlock() BG.set() - elseif SETTING.bg=='off'then + elseif SETTING.bg=='off' then BG.unlock() BG.set('fixColor',SETTING.bgAlpha,SETTING.bgAlpha,SETTING.bgAlpha) BG.lock() - elseif SETTING.bg=='custom'then - if love.filesystem.getInfo('conf/customBG')then + elseif SETTING.bg=='custom' then + if love.filesystem.getInfo('conf/customBG') then local res,image=pcall(GC.newImage,love.filesystem.newFile('conf/customBG')) if res then BG.unlock() @@ -178,7 +176,7 @@ do--function applySettings() else MES.new('error',text.customBGloadFailed) end - else--Switch off when custom BG not found + else-- Switch off when custom BG not found SETTING.bg='off' BG.unlock() BG.set('fixColor',SETTING.bgAlpha,SETTING.bgAlpha,SETTING.bgAlpha) @@ -188,8 +186,8 @@ do--function applySettings() end end ---Royale mode -function randomTarget(P)--Return a random opponent for P +-- Royale mode +function randomTarget(P)-- Return a random opponent for P if #PLY_ALIVE>1 then local R repeat @@ -272,7 +270,7 @@ function royaleLevelup() for _,P in next,PLY_ALIVE do P.gameEnv.drop=spd end - if GAME.curMode.name:find("_u")then + if GAME.curMode.name:find("_u") then for i=1,#PLY_ALIVE do local P=PLY_ALIVE[i] P.gameEnv.drop=int(P.gameEnv.drop*.4) @@ -284,29 +282,29 @@ function royaleLevelup() end end ---Sound shortcuts +-- Sound shortcuts function playClearSFX(cc) if cc<=0 or cc%1~=0 then return end if cc<=4 then - playSFX('clear_'..cc) + SFX.play('clear_'..cc) elseif cc<=6 then - playSFX('clear_4') + SFX.play('clear_4') elseif cc<=12 then - playSFX('clear_4',.8) + SFX.play('clear_4',.8) if cc<=9 then Snd('bass','A3','E4') else Snd('bass','A3','E4','A4') end elseif cc<=16 then - playSFX('clear_5',.7) + SFX.play('clear_5',.7) if cc<=14 then Snd('bass',.8,'A3','E4')Snd('lead','A4','E5') else Snd('bass',.8,'A3','G4')Snd('lead','B4','G5') end else - playSFX('clear_6',.6) + SFX.play('clear_6',.6) if cc==17 then Snd('bass',.8,'A3','A4')Snd('lead','E5','G5') elseif cc==18 then Snd('bass',.7,'A4')Snd('lead',.8,'C4','G5')Snd('bell','D5') elseif cc==19 then Snd('bass',.7,'A4')Snd('lead',.8,'A4','E5')Snd('bell','B5') @@ -336,7 +334,7 @@ function playReadySFX(i,vol) end ---Game +-- Game function getItem(itemName,amount) STAT.item[itemName]=STAT.item[itemName]+(amount or 1) end @@ -354,7 +352,7 @@ function setField(P,page) local F=FIELD[page] local height=0 for y=#F,1,-1 do - if notEmptyLine(F[y])then + if notEmptyLine(F[y]) then height=y break end @@ -381,16 +379,16 @@ function freshDate(args) STAT.date=date STAT.todayTime=0 getItem('zTicket',1) - if not args:find'q'then + if not args:find'q' then MES.new('info',text.newDay) end saveStats() return true end end -function legalGameTime()--Check if today's playtime is legal +function legalGameTime()-- Check if today's playtime is legal if - SETTING.locale:find'zh'and + SETTING.locale:find'zh' and RANKS.sprint_10l<4 and (not RANKS.sprint_40l or RANKS.sprint_40l<3) then @@ -406,7 +404,7 @@ function legalGameTime()--Check if today's playtime is legal end return true end -do--function trySettingWarn() +do-- function trySettingWarn() local lastWarnTime=0 function trySettingWarn() if TIME()-lastWarnTime>2.6 then @@ -416,20 +414,20 @@ do--function trySettingWarn() end end -function mergeStat(stat,delta)--Merge delta stat. to global stat. +function mergeStat(stat,delta)-- Merge delta stat. to global stat. for k,v in next,delta do - if type(v)=='table'then - if type(stat[k])=='table'then + if type(v)=='table' then + if type(stat[k])=='table' then mergeStat(stat[k],v) end else - if stat[k]then + if stat[k] then stat[k]=stat[k]+v end end end end -function scoreValid()--Check if any unranked mods are activated +function scoreValid()-- Check if any unranked mods are activated for _,M in next,GAME.mod do if M.unranked then return false @@ -440,13 +438,13 @@ function scoreValid()--Check if any unranked mods are activated end return true end -function destroyPlayers()--Destroy all player objects, restore freerows and free CCs +function destroyPlayers()-- Destroy all player objects, restore freerows and free CCs for i=#PLAYERS,1,-1 do local P=PLAYERS[i] if P.canvas then P.canvas:release() end - while P.field[1]do + while P.field[1] do rem(P.field) rem(P.visTime) end @@ -460,7 +458,7 @@ function pauseGame() for i=1,#PLAYERS do local l=PLAYERS[i].keyPressing for j=1,#l do - if l[j]then + if l[j] then PLAYERS[i]:releaseKey(j) end end @@ -469,31 +467,31 @@ function pauseGame() for i=1,20 do VK.release(i) end - if not(GAME.result or GAME.replaying)then + if not (GAME.result or GAME.replaying) then GAME.pauseCount=GAME.pauseCount+1 end SCN.swapTo('pause','none') end end -function applyCustomGame()--Apply CUSTOMENV, BAG, MISSION +function applyCustomGame()-- Apply CUSTOMENV, BAG, MISSION for k,v in next,CUSTOMENV do GAME.modeEnv[k]=v end - if BAG[1]then + if BAG[1] then GAME.modeEnv.seqData=BAG else GAME.modeEnv.seqData=nil end - if MISSION[1]then + if MISSION[1] then GAME.modeEnv.mission=MISSION else GAME.modeEnv.mission=nil end end -function loadGame(mode,ifQuickPlay,ifNet)--Load a mode and go to game scene +function loadGame(mode,ifQuickPlay,ifNet)-- Load a mode and go to game scene freshDate() - if legalGameTime()then - if not MODES[mode]and love.filesystem.getRealDirectory('parts/modes/'..mode)~=SAVEDIR then + if legalGameTime() then + if not MODES[mode] and FILE.isSafe('parts/modes/'..mode) then MODES[mode]=require('parts.modes.'..mode) MODES[mode].name=mode end @@ -510,14 +508,14 @@ function loadGame(mode,ifQuickPlay,ifNet)--Load a mode and go to game scene if ifNet then SCN.go('net_game','swipeD') else - local modeText=text.modes[mode]or{"["..MODES[mode].name.."]",""} + local modeText=text.modes[mode] or{"["..MODES[mode].name.."]",""} TEXTOBJ.modeName:set(modeText[1].." "..modeText[2]) - SCN.go('game',ifQuickPlay and'swipeD'or'fade_togame') - playSFX('enter') + SCN.go('game',ifQuickPlay and 'swipeD' or 'fade_togame') + SFX.play('enter') end end end -function gameOver()--Save record +function gameOver()-- Save record if GAME.replaying then local R=GAME.curMode.getRank if R then @@ -533,15 +531,15 @@ function gameOver()--Save record local R=M.getRank if R then local P=PLAYERS[1] - R=R(P)--New rank + R=R(P)-- New rank if R then if R>0 then GAME.rank=R end - if not GAME.replaying and M.score and scoreValid()then - if RANKS[M.name]then--Old rank exist + if not GAME.replaying and M.score and scoreValid() then + if RANKS[M.name] then-- Old rank exist local needSave - if R>RANKS[M.name]then + if R>RANKS[M.name] then RANKS[M.name]=R needSave=true end @@ -550,7 +548,7 @@ function gameOver()--Save record for i=1,#M.unlock do local m=M.unlock[i] local n=MODES[m].name - if not RANKS[n]then + if not RANKS[n] then if MODES[m].x then RANKS[n]=0 end @@ -565,9 +563,9 @@ function gameOver()--Save record end local D=M.score(P) local L=M.records - local p=#L--Rank-1 + local p=#L-- Rank-1 if p>0 then - while M.comp(D,L[p])do--If higher rank + while M.comp(D,L[p]) do-- If higher rank p=p-1 if p==0 then break end end @@ -575,15 +573,15 @@ function gameOver()--Save record if p<10 then if p==0 then P:_showText(text.newRecord,0,-100,100,'beat',.5) - if SETTING.autoSave and DATA.saveReplay()then + if SETTING.autoSave and DATA.saveReplay() then GAME.saved=true - playSFX('connected') + SFX.play('connected') MES.new('check',text.saveDone) end end D.date=os.date("%Y/%m/%d %H:%M") ins(L,p+1,D) - if L[11]then L[11]=nil end + if L[11] then L[11]=nil end saveFile(L,('record/%s.rec'):format(M.name),'-luaon') end end @@ -591,7 +589,7 @@ function gameOver()--Save record end end function trySave() - if not GAME.statSaved and PLAYERS[1]and PLAYERS[1].type=='human'and(PLAYERS[1].frameRun>300 or GAME.result)then + if not GAME.statSaved and PLAYERS[1] and PLAYERS[1].type=='human' and (PLAYERS[1].frameRun>300 or GAME.result) then GAME.statSaved=true STAT.game=STAT.game+1 mergeStat(STAT,PLAYERS[1].stat) @@ -599,9 +597,9 @@ function trySave() saveStats() end end -do--function freshPlayerPosition(sudden) +do-- function freshPlayerPosition(sudden) local posLists={ - --1~5 + -- 1~5 { {340,75,1}, {965,390,.5}, @@ -609,42 +607,42 @@ do--function freshPlayerPosition(sudden) {20,390,.5}, {20,30,.5}, }, - --6~17 + -- 6~17 (function() local L={{340,75,1}} - for i=1,4 do ins(L,{15,-160+180*i,.25})end - for i=1,4 do ins(L,{180,-160+180*i,.25})end - for i=1,4 do ins(L,{950,-160+180*i,.25})end - for i=1,4 do ins(L,{1120,-160+180*i,.25})end + for i=1,4 do ins(L,{15,-160+180*i,.25}) end + for i=1,4 do ins(L,{180,-160+180*i,.25}) end + for i=1,4 do ins(L,{950,-160+180*i,.25}) end + for i=1,4 do ins(L,{1120,-160+180*i,.25}) end return L end)(), - --18~31 + -- 18~31 (function() local L={{340,75,1}} - for i=1,5 do ins(L,{10, -100+135*i,.18})end - for i=1,5 do ins(L,{120, -100+135*i,.18})end - for i=1,5 do ins(L,{230, -100+135*i,.18})end - for i=1,5 do ins(L,{940, -100+135*i,.18})end - for i=1,5 do ins(L,{1050,-100+135*i,.18})end - for i=1,5 do ins(L,{1160,-100+135*i,.18})end + for i=1,5 do ins(L,{10, -100+135*i,.18}) end + for i=1,5 do ins(L,{120, -100+135*i,.18}) end + for i=1,5 do ins(L,{230, -100+135*i,.18}) end + for i=1,5 do ins(L,{940, -100+135*i,.18}) end + for i=1,5 do ins(L,{1050,-100+135*i,.18}) end + for i=1,5 do ins(L,{1160,-100+135*i,.18}) end return L end)(), - --32~49 + -- 32~49 (function() local L={{340,75,1}} - for i=1,4 do for j=1,6 do ins(L,{78*i-54,115*j-98,.09})end end - for i=9,12 do for j=1,6 do ins(L,{78*i+267,115*j-98,.09})end end + for i=1,4 do for j=1,6 do ins(L,{78*i-54,115*j-98,.09}) end end + for i=9,12 do for j=1,6 do ins(L,{78*i+267,115*j-98,.09}) end end return L end)(), - --50~99 + -- 50~99 (function() local L={{340,75,1}} - for i=1,7 do for j=1,7 do ins(L,{46*i-36,97*j-72,.068})end end - for i=15,21 do for j=1,7 do ins(L,{46*i+264,97*j-72,.068})end end + for i=1,7 do for j=1,7 do ins(L,{46*i-36,97*j-72,.068}) end end + for i=15,21 do for j=1,7 do ins(L,{46*i+264,97*j-72,.068}) end end return L end)(), } - function freshPlayerPosition(sudden)--Set initial position for every player + function freshPlayerPosition(sudden)-- Set initial position for every player local L=PLY_ALIVE if not sudden then for i=1,#L do @@ -660,25 +658,25 @@ do--function freshPlayerPosition(sudden) elseif #L<=99 then posList=posLists[5] else error("TOO MANY PLAYERS!") end - local method=sudden and'setPosition'or'movePosition' - for i=1,#L do L[i][method](L[i],unpack(posList[i]))end + local method=sudden and 'setPosition' or 'movePosition' + for i=1,#L do L[i][method](L[i],unpack(posList[i])) end end end -do--function dumpBasicConfig() +do-- function dumpBasicConfig() local gameSetting={ - --Tuning + -- Tuning 'das','arr','dascut','dropcut','sddas','sdarr', 'ihs','irs','ims','RS', - --System + -- System 'skin','face', - --Graphic + -- Graphic 'ghostType','block','ghost','center','bagLine', 'dropFX','moveFX','shakeFX', 'text','highCam','nextPos', - --Unnecessary graphic + -- Unnecessary graphic -- 'grid','smooth', -- 'lockFX','clearFX','splashFX','atkFX', -- 'score', @@ -691,11 +689,11 @@ do--function dumpBasicConfig() return JSON.encode(S) end end -do--function resetGameData(args) +do-- function resetGameData(args) local function task_showMods() local time=0 while true do - YIELD() + coroutine.yield() time=time+1 if time%20==0 then local M=GAME.mod[time/20] @@ -708,14 +706,14 @@ do--function resetGameData(args) end end local gameSetting={ - --Tuning + -- Tuning 'das','arr','dascut','dropcut','sddas','sdarr', 'ihs','irs','ims','RS', - --System + -- System 'skin','face', - --Graphic + -- Graphic 'block','ghost','center','smooth','grid','bagLine', 'lockFX','dropFX','moveFX','clearFX','splashFX','shakeFX','atkFX', 'text','score','warn','highCam','nextPos', @@ -723,7 +721,7 @@ do--function resetGameData(args) local function _copyGameSetting() local S={} for _,key in next,gameSetting do - if type(SETTING[key])=='table'then + if type(SETTING[key])=='table' then S[key]=TABLE.shift(SETTING[key]) else S[key]=SETTING[key] @@ -732,19 +730,19 @@ do--function resetGameData(args) return S end function resetGameData(args,seed) - if not args then args=""end + if not args then args="" end trySave() GAME.result=false GAME.rank=0 GAME.warnLVL0=0 GAME.warnLVL=0 - if args:find'r'then + if args:find'r' then GAME.frameStart=0 GAME.recording=false GAME.replaying=true else - GAME.frameStart=args:find'n'and 0 or 180-SETTING.reTime*60 + GAME.frameStart=args:find'n' and 0 or 180-SETTING.reTime*60 GAME.seed=seed or math.random(1046101471,2662622626) GAME.pauseTime=0 GAME.pauseCount=0 @@ -768,12 +766,12 @@ do--function resetGameData(args) VK.restore() local bg=GAME.modeEnv.bg - BG.set(type(bg)=='string'and bg or type(bg)=='table'and bg[math.random(#bg)]) + BG.set(type(bg)=='string' and bg or type(bg)=='table' and bg[math.random(#bg)]) local bgm=GAME.modeEnv.bgm - BGM.play(type(bgm)=='string'and bgm or type(bgm)=='table'and bgm[math.random(#bgm)]) + BGM.play(type(bgm)=='string' and bgm or type(bgm)=='table' and bgm[math.random(#bgm)]) TEXT.clear() - if GAME.modeEnv.eventSet=='royale'then + if GAME.modeEnv.eventSet=='royale' then for i=1,#PLAYERS do PLAYERS[i]:changeAtk(randomTarget(PLAYERS[i])) end @@ -792,14 +790,14 @@ do--function resetGameData(args) collectgarbage() end end -do--function checkWarning() +do-- function checkWarning() local max=math.max function checkWarning(dt) local P1=PLAYERS[1] if P1.alive then if P1.frameRun%26==0 then local F=P1.field - local height=0--Max height of row 4~7 + local height=0-- Max height of row 4~7 for x=4,7 do for y=#F,1,-1 do if F[y][x]>0 then @@ -830,41 +828,23 @@ end ---Game draw -do--function drawSelfProfile() - local lvColor={COLOR.J,COLOR.A,COLOR.C,COLOR.N,COLOR.S,COLOR.V,COLOR.P,COLOR.M,COLOR.W,COLOR.R,COLOR.O,COLOR.Y} - local lvIcon=setmetatable({},{__index=function(self,lv) - local c=lvColor[int((lv-1)/26)+1]or COLOR.Z - - local img=GC.DO{25,25, - {"clear",0,0,0,0}, - {"setLW",2}, - {"setCL",c[1],c[2],c[3],.6}, - {"fRect",2,2,21,21,2}, - {"setCL",c}, - {"dRect",2,2,21,21,2}, - {"setCL",COLOR.Z}, - {"mText",(lv-1)%26+1,13,-1}, - } - rawset(self,lv,img) - return img - end}) +-- Game draw +do-- function drawSelfProfile() local name local textObj,scaleK,width,offY function drawSelfProfile() - local selfAvatar=USERS.getAvatar(USER.uid) gc_push('transform') gc_replaceTransform(SCR.xOy_ur) - --Draw avatar + -- Draw avatar gc_setLineWidth(2) gc_setColor(COLOR.X)gc_rectangle('fill',0,0,-300,80) gc_setColor(1,1,1)gc_rectangle('line',-300,0,300,80,5) gc_rectangle('line',-73,7,66,66,2) - gc_draw(selfAvatar,-72,8,nil,.5) + gc_draw(USERS.getAvatar(USER.uid),-72,8,nil,.5) - --Draw username - if name~=USERS.getUsername(USER.uid)then + -- Draw username + if name~=USERS.getUsername(USER.uid) then name=USERS.getUsername(USER.uid) textObj=GC.newText(getFont(30),name) width=textObj:getWidth() @@ -873,11 +853,6 @@ do--function drawSelfProfile() end gc_draw(textObj,-82,26,nil,scaleK,nil,width,offY) - --Draw lv. & xp. - gc_draw(lvIcon[USER.lv],-295,50) - gc_line(-270,55,-80,55,-80,70,-270,70) - gc_rectangle('fill',-210,55,150*USER.xp/USER.lv/USER.lv,15) - gc_pop() end end @@ -886,7 +861,7 @@ function drawOnlinePlayerCount() gc_setColor(1,1,1) gc_push('transform') gc_replaceTransform(SCR.xOy_ur) - gc_printf(("%s: %s/%s/%s"):format(text.onlinePlayerCount,NET.UserCount,NET.PlayCount,NET.StreamCount),-600,80,594,'right') + gc_printf(text.onlinePlayerCount:repD(NET.onlineCount),-600,80,594,'right') gc_pop() end function drawWarning() @@ -903,38 +878,38 @@ end ---Widget function shortcuts -function backScene()SCN.back()end -do--function goScene(name,style) +-- Widget function shortcuts +function backScene() SCN.back() end +do-- function goScene(name,style) local cache={} function goScene(name,style) local hash=style and name..style or name - if not cache[hash]then - cache[hash]=function()SCN.go(name,style)end + if not cache[hash] then + cache[hash]=function() SCN.go(name,style) end end return cache[hash] end end -do--function swapScene(name,style) +do-- function swapScene(name,style) local cache={} function swapScene(name,style) local hash=style and name..style or name - if not cache[hash]then - cache[hash]=function()SCN.swapTo(name,style)end + if not cache[hash] then + cache[hash]=function() SCN.swapTo(name,style) end end return cache[hash] end end -do--function pressKey(k) +do-- function pressKey(k) local cache={} function pressKey(k) - if not cache[k]then - cache[k]=function()love.keypressed(k)end + if not cache[k] then + cache[k]=function() love.keypressed(k) end end return cache[k] end end -do--CUS/SETXXX(k) +do-- CUS/SETXXX(k) local CUSTOMENV=CUSTOMENV local warnList={ 'das','arr','dascut','dropcut','sddas','sdarr', @@ -943,13 +918,13 @@ do--CUS/SETXXX(k) 'VKSwitch','VKIcon','VKTrack','VKDodge', 'simpMode', } - function CUSval(k)return function()return CUSTOMENV[k]end end - function ROOMval(k)return function()return ROOMENV[k]end end - function SETval(k)return function()return SETTING[k]end end - function CUSrev(k)return function()CUSTOMENV[k]=not CUSTOMENV[k]end end - function ROOMrev(k)return function()ROOMENV[k]=not ROOMENV[k]end end - function SETrev(k)return function()if TABLE.find(warnList,k)then trySettingWarn()end SETTING[k]=not SETTING[k]end end - function CUSsto(k)return function(i)CUSTOMENV[k]=i end end - function ROOMsto(k)return function(i)ROOMENV[k]=i end end - function SETsto(k)return function(i)if TABLE.find(warnList,k)then trySettingWarn()end SETTING[k]=i end end + function CUSval(k) return function() return CUSTOMENV[k] end end + function ROOMval(k) return function() return ROOMENV[k] end end + function SETval(k) return function() return SETTING[k] end end + function CUSrev(k) return function() CUSTOMENV[k]=not CUSTOMENV[k] end end + function ROOMrev(k) return function() ROOMENV[k]=not ROOMENV[k] end end + function SETrev(k) return function() if TABLE.find(warnList,k) then trySettingWarn() end SETTING[k]=not SETTING[k] end end + function CUSsto(k) return function(i) CUSTOMENV[k]=i end end + function ROOMsto(k) return function(i) ROOMENV[k]=i end end + function SETsto(k) return function(i) if TABLE.find(warnList,k) then trySettingWarn() end SETTING[k]=i end end end diff --git a/parts/gameTables.lua b/parts/gameTables.lua index 028ce1fa..42363db1 100644 --- a/parts/gameTables.lua +++ b/parts/gameTables.lua @@ -1,4 +1,4 @@ ---Static data tables +-- Static data tables BLOCK_NAMES={ 'Z','S','J','L','T','O','I', 'Z5','S5','P','Q','F','E', @@ -6,13 +6,13 @@ BLOCK_NAMES={ 'J5','L5','R','Y','N','H','I5', 'I3','C','I2','O1' } -BLOCK_CHARS={}for i=1,#BLOCK_NAMES do BLOCK_CHARS[i]=CHAR.mino[BLOCK_NAMES[i]]end +BLOCK_CHARS={} for i=1,#BLOCK_NAMES do BLOCK_CHARS[i]=CHAR.mino[BLOCK_NAMES[i]] end BLOCK_COLORS={ COLOR.R,COLOR.F,COLOR.O,COLOR.Y,COLOR.L,COLOR.J,COLOR.G,COLOR.A, COLOR.C,COLOR.N,COLOR.S,COLOR.B,COLOR.V,COLOR.P,COLOR.M,COLOR.W, COLOR.dH,COLOR.D,COLOR.lY,COLOR.H,COLOR.lH,COLOR.dV,COLOR.dR,COLOR.dG, } -RANK_CHARS={'B','A','S','U','X'}for i=1,#RANK_CHARS do RANK_CHARS[i]=CHAR.icon['rank'..RANK_CHARS[i]]end +RANK_CHARS={'B','A','S','U','X'} for i=1,#RANK_CHARS do RANK_CHARS[i]=CHAR.icon['rank'..RANK_CHARS[i]] end RANK_COLORS={ {.8,.86,.9}, {.6,.9,.7}, @@ -20,7 +20,7 @@ RANK_COLORS={ {1,.5,.4}, {.95,.5,.95}, } -do--SVG_TITLE_FILL, SVG_TITLE_LINE +do-- SVG_TITLE_FILL, SVG_TITLE_LINE SVG_TITLE_FILL={ { 0,0, @@ -131,24 +131,24 @@ do--SVG_TITLE_FILL, SVG_TITLE_LINE SVG_TITLE_LINE=TABLE.shift(SVG_TITLE_FILL) SVG_TITLE_LINE[8],SVG_TITLE_LINE[9]={},{} - for j=1,16 do SVG_TITLE_LINE[8][j]=SVG_TITLE_FILL[8][j]end - for j=19,#SVG_TITLE_FILL[8]-2 do SVG_TITLE_LINE[9][j-18]=SVG_TITLE_FILL[8][j]end + for j=1,16 do SVG_TITLE_LINE[8][j]=SVG_TITLE_FILL[8][j] end + for j=19,#SVG_TITLE_FILL[8]-2 do SVG_TITLE_LINE[9][j-18]=SVG_TITLE_FILL[8][j] end end -do--SVG_TITLE_FAN +do-- SVG_TITLE_FAN SVG_TITLE_FAN={} local sin,cos=math.sin,math.cos for i=1,9 do local L=TABLE.copy(SVG_TITLE_LINE[i]) SVG_TITLE_FAN[i]=L for j=1,#L,2 do - local x,y=L[j],L[j+1]--0