From 06f4bb4e1ad4ccea0602212016eb50639101eda8 Mon Sep 17 00:00:00 2001 From: MrZ_26 <1046101471@qq.com> Date: Sat, 1 Oct 2022 11:32:11 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=20=E7=90=86=20=E4=BB=A3=20=E7=A0=81?= =?UTF-8?q?=20=EF=BC=88=E5=BA=94=E8=AF=A5=E6=B2=A1=E6=9C=89=E6=94=B9?= =?UTF-8?q?=E5=88=B0=E5=AD=97=E7=AC=A6=E4=B8=B2=E9=87=8C=E9=9D=A2=E7=9A=84?= =?UTF-8?q?=E4=B8=9C=E8=A5=BF=E5=90=A7=E2=80=A6=EF=BC=89=E8=B5=B7=E7=A0=81?= =?UTF-8?q?=E4=B8=8D=E7=9B=B4=E6=8E=A5=E5=BD=B1=E5=93=8D=E8=BF=90=E8=A1=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Zframework | 2 +- main.lua | 124 +++++------ parts/RSlist.lua | 48 ++--- parts/backgrounds/blockfall.lua | 4 +- parts/backgrounds/fan.lua | 2 +- parts/backgrounds/firework.lua | 4 +- parts/backgrounds/matrix.lua | 4 +- parts/backgrounds/space.lua | 2 +- parts/bot/bot_9s.lua | 18 +- parts/bot/bot_cc.lua | 6 +- parts/bot/init.lua | 18 +- parts/data.lua | 30 +-- parts/eventsets/checkClearBoard.lua | 2 +- parts/eventsets/checkTurn_1.lua | 2 +- parts/eventsets/checkTurn_7.lua | 2 +- parts/eventsets/defender_l.lua | 4 +- parts/eventsets/dig_h.lua | 2 +- parts/eventsets/dig_u.lua | 2 +- parts/eventsets/marathon_bfmax.lua | 10 +- parts/eventsets/master_final.lua | 2 +- parts/eventsets/master_g.lua | 2 +- parts/eventsets/master_instinct.lua | 6 +- parts/eventsets/master_ph.lua | 6 +- parts/eventsets/pctrain_l.lua | 8 +- parts/eventsets/pctrain_n.lua | 4 +- parts/eventsets/secret_grade.lua | 2 +- parts/eventsets/sprintMD.lua | 6 +- parts/eventsets/sprintSym.lua | 2 +- parts/eventsets/survivor_e.lua | 2 +- parts/eventsets/survivor_h.lua | 2 +- parts/eventsets/survivor_l.lua | 2 +- parts/eventsets/survivor_n.lua | 8 +- parts/eventsets/survivor_u.lua | 2 +- parts/eventsets/techrash_u.lua | 2 +- parts/eventsets/tsd_h.lua | 4 +- parts/eventsets/tsd_u.lua | 2 +- parts/eventsets/ultra.lua | 2 +- parts/gameFuncs.lua | 181 ++++++++--------- parts/gameTables.lua | 52 ++--- parts/language/dict_en.lua | 6 +- parts/language/dict_ja.lua | 6 +- parts/language/dict_zh.lua | 4 +- parts/language/lang_en.lua | 8 +- parts/language/lang_es.lua | 4 +- parts/language/lang_fr.lua | 4 +- parts/language/lang_id.lua | 8 +- parts/language/lang_ja.lua | 6 +- parts/language/lang_pt.lua | 8 +- parts/language/lang_symbol.lua | 2 +- parts/language/lang_zh.lua | 8 +- parts/language/lang_zh_code.lua | 14 +- parts/language/lang_zh_trad.lua | 4 +- parts/modes/attacker_h.lua | 6 +- parts/modes/attacker_u.lua | 6 +- parts/modes/backfire_h.lua | 6 +- parts/modes/backfire_l.lua | 6 +- parts/modes/backfire_n.lua | 6 +- parts/modes/backfire_u.lua | 6 +- parts/modes/big_h.lua | 6 +- parts/modes/big_n.lua | 6 +- parts/modes/blind_e.lua | 6 +- parts/modes/blind_h.lua | 6 +- parts/modes/blind_l.lua | 6 +- parts/modes/blind_n.lua | 6 +- parts/modes/blind_u.lua | 6 +- parts/modes/blind_wtf.lua | 6 +- parts/modes/c4wtrain_l.lua | 6 +- parts/modes/c4wtrain_n.lua | 6 +- parts/modes/classic_e.lua | 6 +- parts/modes/classic_h.lua | 6 +- parts/modes/classic_l.lua | 6 +- parts/modes/classic_u.lua | 6 +- parts/modes/custom_clear.lua | 4 +- parts/modes/custom_puzzle.lua | 10 +- parts/modes/defender_l.lua | 6 +- parts/modes/defender_n.lua | 6 +- parts/modes/dig_100l.lua | 6 +- parts/modes/dig_10l.lua | 6 +- parts/modes/dig_400l.lua | 6 +- parts/modes/dig_40l.lua | 6 +- parts/modes/dig_eff_100l.lua | 6 +- parts/modes/dig_eff_10l.lua | 6 +- parts/modes/dig_eff_400l.lua | 6 +- parts/modes/dig_eff_40l.lua | 6 +- parts/modes/dig_h.lua | 6 +- parts/modes/dig_quad_10l.lua | 6 +- parts/modes/dig_u.lua | 6 +- parts/modes/drought_l.lua | 16 +- parts/modes/drought_n.lua | 6 +- parts/modes/infinite_dig.lua | 4 +- parts/modes/marathon_h.lua | 6 +- parts/modes/marathon_inf.lua | 6 +- parts/modes/marathon_n.lua | 6 +- parts/modes/master_ex.lua | 6 +- parts/modes/master_final.lua | 6 +- parts/modes/master_g.lua | 4 +- parts/modes/master_h.lua | 6 +- parts/modes/master_instinct.lua | 6 +- parts/modes/master_m.lua | 6 +- parts/modes/master_n.lua | 6 +- parts/modes/master_ph.lua | 8 +- parts/modes/netBattle.lua | 8 +- parts/modes/pc_h.lua | 6 +- parts/modes/pc_inf.lua | 6 +- parts/modes/pc_l.lua | 6 +- parts/modes/pc_n.lua | 6 +- parts/modes/pctrain_l.lua | 6 +- parts/modes/pctrain_n.lua | 6 +- parts/modes/round_e.lua | 8 +- parts/modes/round_h.lua | 8 +- parts/modes/round_l.lua | 8 +- parts/modes/round_n.lua | 8 +- parts/modes/round_u.lua | 8 +- parts/modes/secret_grade.lua | 6 +- parts/modes/solo_e.lua | 8 +- parts/modes/solo_h.lua | 8 +- parts/modes/solo_l.lua | 8 +- parts/modes/solo_n.lua | 8 +- parts/modes/solo_u.lua | 8 +- parts/modes/sprint123.lua | 6 +- parts/modes/sprintAtk.lua | 6 +- parts/modes/sprintEff.lua | 6 +- parts/modes/sprintMPH.lua | 6 +- parts/modes/sprintPenta.lua | 6 +- parts/modes/sprint_1000l.lua | 6 +- parts/modes/sprint_100l.lua | 6 +- parts/modes/sprint_10l.lua | 6 +- parts/modes/sprint_20l.lua | 6 +- parts/modes/sprint_400l.lua | 6 +- parts/modes/sprint_40l.lua | 6 +- parts/modes/strategy_e.lua | 6 +- parts/modes/strategy_e_plus.lua | 6 +- parts/modes/strategy_h.lua | 6 +- parts/modes/strategy_h_plus.lua | 6 +- parts/modes/strategy_u.lua | 6 +- parts/modes/strategy_u_plus.lua | 6 +- parts/modes/survivor_e.lua | 6 +- parts/modes/survivor_h.lua | 6 +- parts/modes/survivor_l.lua | 6 +- parts/modes/survivor_n.lua | 6 +- parts/modes/survivor_u.lua | 6 +- parts/modes/tech_finesse.lua | 6 +- parts/modes/tech_finesse_f.lua | 6 +- parts/modes/tech_h.lua | 6 +- parts/modes/tech_h_plus.lua | 8 +- parts/modes/tech_l.lua | 6 +- parts/modes/tech_l_plus.lua | 8 +- parts/modes/tech_n.lua | 6 +- parts/modes/tech_n_plus.lua | 8 +- parts/modes/techmino49_e.lua | 14 +- parts/modes/techmino49_h.lua | 14 +- parts/modes/techmino49_u.lua | 14 +- parts/modes/techmino99_e.lua | 14 +- parts/modes/techmino99_h.lua | 14 +- parts/modes/techmino99_u.lua | 14 +- parts/modes/tsd_e.lua | 6 +- parts/modes/tsd_h.lua | 6 +- parts/modes/tsd_u.lua | 6 +- parts/modes/ultra.lua | 6 +- parts/modes/zen.lua | 6 +- parts/net.lua | 58 +++--- parts/netPlayer.lua | 62 +++--- parts/player/draw.lua | 138 ++++++------- parts/player/init.lua | 48 ++--- parts/player/player.lua | 294 +++++++++++++-------------- parts/player/seqGenerators.lua | 30 +-- parts/scenes/about.lua | 2 +- parts/scenes/app_15p.lua | 40 ++-- parts/scenes/app_2048.lua | 92 ++++----- parts/scenes/app_AtoZ.lua | 16 +- parts/scenes/app_UTTT.lua | 22 +- parts/scenes/app_arithmetic.lua | 22 +- parts/scenes/app_calc.lua | 64 +++--- parts/scenes/app_cannon.lua | 8 +- parts/scenes/app_console.lua | 174 ++++++++-------- parts/scenes/app_cubefield.lua | 32 +-- parts/scenes/app_dropper.lua | 36 ++-- parts/scenes/app_dtw.lua | 86 ++++---- parts/scenes/app_link.lua | 66 +++--- parts/scenes/app_mahjong.lua | 28 +-- parts/scenes/app_memorize.lua | 14 +- parts/scenes/app_piano.lua | 14 +- parts/scenes/app_polyforge.lua | 10 +- parts/scenes/app_pong.lua | 16 +- parts/scenes/app_reflect.lua | 16 +- parts/scenes/app_schulteG.lua | 28 +-- parts/scenes/app_spin.lua | 6 +- parts/scenes/app_stopwatch.lua | 2 +- parts/scenes/app_tap.lua | 8 +- parts/scenes/app_ten.lua | 60 +++--- parts/scenes/app_triple.lua | 50 ++--- parts/scenes/customGame.lua | 64 +++--- parts/scenes/custom_field.lua | 72 +++---- parts/scenes/custom_mission.lua | 36 ++-- parts/scenes/custom_sequence.lua | 40 ++-- parts/scenes/depause.lua | 8 +- parts/scenes/dict.lua | 46 ++--- parts/scenes/error.lua | 4 +- parts/scenes/game.lua | 44 ++-- parts/scenes/history.lua | 10 +- parts/scenes/lang.lua | 24 +-- parts/scenes/launchpad.lua | 160 +++++++-------- parts/scenes/legals.lua | 10 +- parts/scenes/load.lua | 28 +-- parts/scenes/login.lua | 6 +- parts/scenes/main.lua | 62 +++--- parts/scenes/main_simple.lua | 6 +- parts/scenes/manual.lua | 12 +- parts/scenes/mod.lua | 12 +- parts/scenes/mode.lua | 40 ++-- parts/scenes/music.lua | 42 ++-- parts/scenes/net_game.lua | 50 ++--- parts/scenes/net_league.lua | 2 +- parts/scenes/net_menu.lua | 4 +- parts/scenes/net_newRoom.lua | 12 +- parts/scenes/net_rooms.lua | 34 ++-- parts/scenes/pause.lua | 72 +++---- parts/scenes/quit.lua | 2 +- parts/scenes/register.lua | 4 +- parts/scenes/replays.lua | 18 +- parts/scenes/savedata.lua | 16 +- parts/scenes/setting_game.lua | 10 +- parts/scenes/setting_key.lua | 64 +++--- parts/scenes/setting_skin.lua | 48 ++--- parts/scenes/setting_sound.lua | 40 ++-- parts/scenes/setting_touch.lua | 12 +- parts/scenes/setting_touchSwitch.lua | 16 +- parts/scenes/setting_video.lua | 24 +-- parts/scenes/staff.lua | 10 +- parts/scenes/stat.lua | 4 +- parts/scenes/test.lua | 2 +- parts/skin.lua | 4 +- parts/texture.lua | 8 +- parts/theme.lua | 58 +++--- parts/users.lua | 14 +- parts/virtualKey.lua | 6 +- 236 files changed, 2087 insertions(+), 2114 deletions(-) diff --git a/Zframework b/Zframework index b48282a5..779c841f 160000 --- a/Zframework +++ b/Zframework @@ -1 +1 @@ -Subproject commit b48282a5f410db0648376fa2b0ca9de842a8fdfa +Subproject commit 779c841f1a84aeb6490198e33c744780fad21c5e diff --git a/main.lua b/main.lua index a63a38a1..61b40a32 100644 --- a/main.lua +++ b/main.lua @@ -16,15 +16,15 @@ --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}) +-- 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 local fs=love.filesystem VERSION=require"version" TIME=love.timer.getTime -SYSTEM=love.system.getOS()if SYSTEM=='OS X'then SYSTEM='macOS'end +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' +MOBILE=SYSTEM=='Android' or SYSTEM=='iOS' --Global Vars & Settings SFXPACKS={'chiptune'} @@ -60,7 +60,7 @@ 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 @@ -88,11 +88,11 @@ string.split=STRING.split FILE.clear('') --Create directories -for _,v in next,{'conf','record','replay','cache','lib'}do +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,8 +104,8 @@ require'parts.gameFuncs' --Load shader files from SOURCE ONLY SHADER={} -for _,v in next,fs.getDirectoryItems('parts/shaders')do - if FILE.isSafe('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 @@ -155,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 @@ -174,9 +174,9 @@ 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 @@ -218,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 @@ -232,13 +232,13 @@ Z.setOnQuit(destroyPlayers) --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.") @@ -351,8 +351,8 @@ SKIN.load{ --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 FILE.isSafe('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 @@ -360,8 +360,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 FILE.isSafe('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 @@ -398,9 +398,9 @@ LANG.init('zh', 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) @@ -415,16 +415,16 @@ 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 FILE.isSafe('parts/backgrounds/'..v)and v:sub(-3)=='lua'then +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 FILE.isSafe('parts/scenes/'..v)then +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) @@ -433,13 +433,13 @@ end --Load mode files for i=1,#MODES do local m=MODES[i]--Mode template - if FILE.isSafe('parts/modes/'..m.name)then + 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 FILE.isSafe('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 @@ -455,10 +455,10 @@ table.insert(_LOADTIMELIST_,("Load Files: %.3fs"):format(TIME()-_LOADTIME_)) 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 @@ -471,10 +471,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 @@ -534,16 +534,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 @@ -554,12 +554,12 @@ do 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 @@ -571,26 +571,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 @@ -615,14 +615,14 @@ end applySettings() --Load replays -for _,fileName in next,fs.getDirectoryItems('replay')do - if fileName:sub(12,12):match("[a-zA-Z]")then +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 @@ -658,16 +658,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 +if TABLE.find(arg,'--test') then TASK.new(function() - while not LOADED do coroutine.yield()end + while not LOADED do coroutine.yield() end LOG("\27[92m\27[1mAutomatic Test Started\27[0m") BGM.setVol(0)SFX.setVol(0) @@ -675,7 +675,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() @@ -690,7 +690,7 @@ if TABLE.find(arg,'--test')then TASK.new(function() while true do coroutine.yield() - if Z.getErr(1)then break end + 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) diff --git a/parts/RSlist.lua b/parts/RSlist.lua index 69e9aec2..0f32e81d 100644 --- a/parts/RSlist.lua +++ b/parts/RSlist.lua @@ -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 @@ -329,13 +329,13 @@ do [31]={'+0+0','+0-1','+1+0'}, },--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') @@ -488,8 +488,8 @@ do }--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 @@ -541,8 +541,8 @@ do }--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 @@ -579,8 +579,8 @@ do 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 + 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 @@ -628,8 +628,8 @@ do 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 @@ -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 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/blockfall.lua b/parts/backgrounds/blockfall.lua index 4ecb0a74..04c6fd5a 100644 --- a/parts/backgrounds/blockfall.lua +++ b/parts/backgrounds/blockfall.lua @@ -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/fan.lua b/parts/backgrounds/fan.lua index aaa46fc3..3e931ede 100644 --- a/parts/backgrounds/fan.lua +++ b/parts/backgrounds/fan.lua @@ -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..f5ec21e1 100644 --- a/parts/backgrounds/firework.lua +++ b/parts/backgrounds/firework.lua @@ -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/matrix.lua b/parts/backgrounds/matrix.lua index d487d801..0dc8f646 100644 --- a/parts/backgrounds/matrix.lua +++ b/parts/backgrounds/matrix.lua @@ -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/space.lua b/parts/backgrounds/space.lua index 48be71ad..305024dd 100644 --- a/parts/backgrounds/space.lua +++ b/parts/backgrounds/space.lua @@ -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/bot/bot_9s.lua b/parts/bot/bot_9s.lua index b14b9b7d..5c63c4f3 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 @@ -157,28 +157,28 @@ function bot_9s.thread(bot) 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 + while cy>1 and not _ifoverlapAI(Tfield,cb,cx,cy-1) do cy=cy-1 end --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 diff --git a/parts/bot/bot_cc.lua b/parts/bot/bot_cc.lua index 12ed4a7a..4146812e 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 @@ -76,7 +76,7 @@ function bot_cc:thread() 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) @@ -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..ef3fd8f8 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/data.lua b/parts/data.lua index 33c25864..d4236e27 100644 --- a/parts/data.lua +++ b/parts/data.lua @@ -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) @@ -67,7 +67,7 @@ local fieldMeta={__index=function(self,h) return self[h] end} function DATA.newBoard(f)--Generate a new board - return setmetatable(f and TABLE.shift(f)or{},fieldMeta) + return setmetatable(f and TABLE.shift(f) or{},fieldMeta) end function DATA.copyBoard(page)--Copy the [page] board local F=FIELD[page or 1] @@ -95,7 +95,7 @@ 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] @@ -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,8 +252,8 @@ 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 + local prevFrm=list[ptr-2] or 0 + while list[ptr] do --Flush buffer if #buffer>10 then out=out..buffer @@ -298,7 +298,7 @@ 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 @@ -338,7 +338,7 @@ do--function DATA.saveReplay() function DATA.saveReplay() --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 @@ -346,7 +346,7 @@ do--function DATA.saveReplay() --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{ @@ -378,7 +378,7 @@ 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 success,fileData=pcall(love.data.decompress,'string','zlib',fileData) @@ -390,8 +390,8 @@ function DATA.parseReplayData(fileName,fileData,ifFull) 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 + metaData.mode=MODE_UPDATE_MAP[metaData.mode] or metaData.mode + if not MODES[metaData.mode] then goto BREAK_cannotParse end --Create replay object rep={ 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/defender_l.lua b/parts/eventsets/defender_l.lua index f2956688..90f3594b 100644 --- a/parts/eventsets/defender_l.lua +++ b/parts/eventsets/defender_l.lua @@ -16,8 +16,8 @@ return{ 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/dig_h.lua b/parts/eventsets/dig_h.lua index 11e8b657..d5e5a3c1 100644 --- a/parts/eventsets/dig_h.lua +++ b/parts/eventsets/dig_h.lua @@ -10,7 +10,7 @@ return{ 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 9bdfeb5c..ec6927d6 100644 --- a/parts/eventsets/dig_u.lua +++ b/parts/eventsets/dig_u.lua @@ -10,7 +10,7 @@ return{ 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/master_final.lua b/parts/eventsets/master_final.lua index b6ad08a7..0366e255 100644 --- a/parts/eventsets/master_final.lua +++ b/parts/eventsets/master_final.lua @@ -32,7 +32,7 @@ return{ 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 afdd6fc2..f1965fb2 100644 --- a/parts/eventsets/master_g.lua +++ b/parts/eventsets/master_g.lua @@ -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 diff --git a/parts/eventsets/master_instinct.lua b/parts/eventsets/master_instinct.lua index dcadf049..3f04e566 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,7 +35,7 @@ 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 @@ -78,7 +78,7 @@ return{ 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_ph.lua b/parts/eventsets/master_ph.lua index 91725929..ea095c9f 100644 --- a/parts/eventsets/master_ph.lua +++ b/parts/eventsets/master_ph.lua @@ -36,7 +36,7 @@ return SFX.play('reach') 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 @@ -137,7 +137,7 @@ return 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 c58e227b..6d8956bb 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 coroutine.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 diff --git a/parts/eventsets/pctrain_n.lua b/parts/eventsets/pctrain_n.lua index a5a74dff..030ed791 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 coroutine.yield()end end + if P.frameRun>180 then for _=1,26 do coroutine.yield() end end P.control=true local base=PCbase[difficulty] diff --git a/parts/eventsets/secret_grade.lua b/parts/eventsets/secret_grade.lua index 6364d319..2464381b 100644 --- a/parts/eventsets/secret_grade.lua +++ b/parts/eventsets/secret_grade.lua @@ -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 d4a1d384..c4eed657 100644 --- a/parts/eventsets/sprintMD.lua +++ b/parts/eventsets/sprintMD.lua @@ -9,16 +9,16 @@ return{ task=function(P) coroutine.yield() while true do - for _=1,P.holeRND:random(40,200)do coroutine.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 4d5c76a5..442e8c87 100644 --- a/parts/eventsets/survivor_e.lua +++ b/parts/eventsets/survivor_e.lua @@ -10,7 +10,7 @@ return{ 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 a04ff1a5..8f591cc6 100644 --- a/parts/eventsets/survivor_h.lua +++ b/parts/eventsets/survivor_h.lua @@ -10,7 +10,7 @@ return{ 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 9209ed40..bf4ee313 100644 --- a/parts/eventsets/survivor_l.lua +++ b/parts/eventsets/survivor_l.lua @@ -10,7 +10,7 @@ return{ 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 diff --git a/parts/eventsets/survivor_n.lua b/parts/eventsets/survivor_n.lua index ac5c66ec..10d57167 100644 --- a/parts/eventsets/survivor_n.lua +++ b/parts/eventsets/survivor_n.lua @@ -10,15 +10,15 @@ return{ 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 f92ee447..23a80341 100644 --- a/parts/eventsets/survivor_u.lua +++ b/parts/eventsets/survivor_u.lua @@ -10,7 +10,7 @@ return{ 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 e5c614ba..c02efe42 100644 --- a/parts/eventsets/ultra.lua +++ b/parts/eventsets/ultra.lua @@ -22,7 +22,7 @@ return{ P.modeData.section=1 while true do coroutine.yield() - while P.stat.frame>=warnTime[P.modeData.section]do + 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 412a8b3d..7fe6a957 100644 --- a/parts/gameFuncs.lua +++ b/parts/gameFuncs.lua @@ -52,20 +52,20 @@ do--function tryDelete() end end do--function loadFile(name,args), function saveFile(data,name,args) - local t=setmetatable({},{__index=function()return"'$1' loading failed: $2"end}) + 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,12 +82,12 @@ 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 @@ -115,7 +115,7 @@ do--function applySettings() 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 @@ -144,23 +144,23 @@ do--function applySettings() --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 + 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() @@ -265,7 +265,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) @@ -347,7 +347,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 @@ -374,7 +374,7 @@ 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() @@ -383,7 +383,7 @@ function freshDate(args) end 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 @@ -411,12 +411,12 @@ end 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 @@ -439,7 +439,7 @@ function destroyPlayers()--Destroy all player objects, restore freerows and free 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 @@ -453,7 +453,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 @@ -462,7 +462,7 @@ 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') @@ -472,12 +472,12 @@ 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 @@ -485,8 +485,8 @@ function applyCustomGame()--Apply CUSTOMENV, BAG, MISSION end function loadGame(mode,ifQuickPlay,ifNet)--Load a mode and go to game scene freshDate() - if legalGameTime()then - if not MODES[mode]and FILE.isSafe('parts/modes/'..mode) 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 @@ -503,9 +503,9 @@ 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') + SCN.go('game',ifQuickPlay and 'swipeD' or 'fade_togame') playSFX('enter') end end @@ -531,10 +531,10 @@ function gameOver()--Save record 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 @@ -543,7 +543,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 @@ -560,7 +560,7 @@ function gameOver()--Save record local L=M.records 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 @@ -568,7 +568,7 @@ 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') MES.new('check',text.saveDone) @@ -576,7 +576,7 @@ function gameOver()--Save record 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 @@ -584,7 +584,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) @@ -605,35 +605,35 @@ do--function freshPlayerPosition(sudden) --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 (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 (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 (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)(), } @@ -653,8 +653,8 @@ 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() @@ -716,7 +716,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] @@ -725,19 +725,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 @@ -761,12 +761,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 @@ -825,23 +825,6 @@ 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}) local name local textObj,scaleK,width,offY function drawSelfProfile() @@ -857,7 +840,7 @@ do--function drawSelfProfile() gc_draw(selfAvatar,-72,8,nil,.5) --Draw username - if name~=USERS.getUsername(USER.uid)then + if name~=USERS.getUsername(USER.uid) then name=USERS.getUsername(USER.uid) textObj=GC.newText(getFont(30),name) width=textObj:getWidth() @@ -892,13 +875,13 @@ end --Widget function shortcuts -function backScene()SCN.back()end +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 @@ -907,8 +890,8 @@ 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 @@ -916,8 +899,8 @@ end 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 @@ -931,13 +914,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 f7a62a04..f3b9b61a 100644 --- a/parts/gameTables.lua +++ b/parts/gameTables.lua @@ -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}, @@ -131,8 +131,8 @@ 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 SVG_TITLE_FAN={} @@ -166,7 +166,7 @@ do--MISSIONENUM for k,v in next,L do ENUM_MISSION[k]=v end end do--TEXTOBJ - local function T(s,t)return love.graphics.newText(getFont(s),t)end + local function T(s,t) return love.graphics.newText(getFont(s),t) end TEXTOBJ={ modeName=T(30), @@ -347,93 +347,93 @@ do--Mod data {no=0,id="NX",name="next", key="q",x=80,y=230,color='lO', list={0,1,2,3,4,5,6}, - func=function(P,O)P.gameEnv.nextCount=O end, + func=function(P,O) P.gameEnv.nextCount=O end, unranked=true, }, {no=1,id="HL",name="hold", key="w",x=200,y=230,color='lO', list={0,1,2,3,4,5,6}, - func=function(P,O)P.gameEnv.holdCount=O end, + func=function(P,O) P.gameEnv.holdCount=O end, unranked=true, }, {no=2,id="FL",name="hideNext", key="e",x=320,y=230,color='lA', list={1,2,3,4,5}, - func=function(P,O)P.gameEnv.nextStartPos=O+1 end, + func=function(P,O) P.gameEnv.nextStartPos=O+1 end, unranked=true, }, {no=3,id="IH",name="infHold", key="r",x=440,y=230,color='lA', - func=function(P)P.gameEnv.infHold=true end, + func=function(P) P.gameEnv.infHold=true end, unranked=true, }, {no=4,id="HB",name="hideBlock", key="y",x=680,y=230,color='lV', - func=function(P)P.gameEnv.block=false end, + func=function(P) P.gameEnv.block=false end, unranked=true, }, {no=5,id="HG",name="hideGhost", key="u",x=800,y=230,color='lV', - func=function(P)P.gameEnv.ghost=false end, + func=function(P) P.gameEnv.ghost=false end, unranked=true, }, {no=6,id="HD",name="hidden", key="i",x=920,y=230,color='lP', list={'easy','slow','medium','fast','none'}, - func=function(P,O)P.gameEnv.visible=O end, + func=function(P,O) P.gameEnv.visible=O end, unranked=true, }, {no=7,id="HB",name="hideBoard", key="o",x=1040,y=230,color='lP', list={'down','up','all'}, - func=function(P,O)P.gameEnv.hideBoard=O end, + func=function(P,O) P.gameEnv.hideBoard=O end, unranked=true, }, {no=8,id="FB",name="flipBoard", key="p",x=1160,y=230,color='lJ', list={'U-D','L-R','180'}, - func=function(P,O)P.gameEnv.flipBoard=O end, + func=function(P,O) P.gameEnv.flipBoard=O end, unranked=true, }, {no=9,id="DT",name="dropDelay", key="a",x=140,y=350,color='lR', list={0,.125,.25,.5,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,1e99}, - func=function(P,O)P.gameEnv.drop=O end, + func=function(P,O) P.gameEnv.drop=O end, unranked=true, }, {no=10,id="LT",name="lockDelay", key="s",x=260,y=350,color='lR', list={0,1,2,3,4,5,6,7,8,9,10,12,14,16,18,20,25,30,40,60,180,1e99}, - func=function(P,O)P.gameEnv.lock=O end, + func=function(P,O) P.gameEnv.lock=O end, unranked=true, }, {no=11,id="ST",name="waitDelay", key="d",x=380,y=350,color='lR', list={0,1,2,3,4,5,6,7,8,10,15,20,30,60}, - func=function(P,O)P.gameEnv.wait=O end, + func=function(P,O) P.gameEnv.wait=O end, unranked=true, }, {no=12,id="CT",name="fallDelay", key="f",x=500,y=350,color='lR', list={0,1,2,3,4,5,6,7,8,10,15,20,30,60}, - func=function(P,O)P.gameEnv.fall=O end, + func=function(P,O) P.gameEnv.fall=O end, unranked=true, }, {no=13,id="LF",name="life", key="j",x=860,y=350,color='lY', list={0,1,2,3,5,10,15,26,42,87,500}, - func=function(P,O)P.gameEnv.life=O end, + func=function(P,O) P.gameEnv.life=O end, unranked=true, }, {no=14,id="FB",name="forceB2B", key="k",x=980,y=350,color='lY', - func=function(P)P.gameEnv.b2bKill=true end, + func=function(P) P.gameEnv.b2bKill=true end, unranked=true, }, {no=15,id="PF",name="forceFinesse", key="l",x=1100,y=350,color='lY', - func=function(P)P.gameEnv.fineKill=true end, + func=function(P) P.gameEnv.fineKill=true end, unranked=true, }, @@ -467,19 +467,19 @@ do--Mod data {no=19,id="CS",name="customSeq", key="b",x=680,y=470,color='lB', list={'bag','bagES','his','hisPool','c2','rnd','mess','reverb'}, - func=function(P,O)P.gameEnv.sequence=O end, + func=function(P,O) P.gameEnv.sequence=O end, unranked=true, }, {no=20,id="PS",name="pushSpeed", key="n",x=800,y=470,color='lB', list={.5,1,2,3,5,15,1e99}, - func=function(P,O)P.gameEnv.pushSpeed=O end, + func=function(P,O) P.gameEnv.pushSpeed=O end, unranked=true, }, {no=21,id="BN",name="boneBlock", key="m",x=920,y=470,color='lB', list={'on','off'}, - func=function(P,O)P.gameEnv.bone=O=='on'end, + func=function(P,O) P.gameEnv.bone=O=='on' end, unranked=true, }, } @@ -719,8 +719,8 @@ do--Userdata tables piece=0,row=0,dig=0, atk=0,digatk=0, send=0,recv=0,pend=0,off=0, - clear=(function()local L={}for i=1,29 do L[i]={0,0,0,0,0,0}end return L end)(), - spin=(function()local L={}for i=1,29 do L[i]={0,0,0,0,0,0,0}end return L end)(), + clear=(function() local L={} for i=1,29 do L[i]={0,0,0,0,0,0} end return L end)(), + spin=(function() local L={} for i=1,29 do L[i]={0,0,0,0,0,0,0} end return L end)(), pc=0,hpc=0,b2b=0,b3b=0,score=0, lastPlay='sprint_10l',--Last played mode ID item=setmetatable({},{__index=function(self,k) diff --git a/parts/language/dict_en.lua b/parts/language/dict_en.lua index fd8bddd1..d0935363 100644 --- a/parts/language/dict_en.lua +++ b/parts/language/dict_en.lua @@ -125,13 +125,13 @@ return{ "support afdian aidadian", "org", FNNS and "The contents in this entry were hidden due to platform restrictions. Feel free to discuss these contents on our Discord server." or "To donate to Techmino via Aifadian, use the globe icon on the bottom right to open the URL. Aifadian charges a 6% transaction fee off your purchase.", - FNNS and"https://youtu.be/dQw4w9WgXcQ"or"https://afdian.net/@MrZ_26", + FNNS and "https://youtu.be/dQw4w9WgXcQ" or "https://afdian.net/@MrZ_26", }, {"Support 3", "support p\97\116\114\101\111\110", "org", FNNS and "The contents in this entry were hidden due to platform restrictions. Feel free to discuss these contents on our Discord server." or "To donate to Techmino via P\97\116\114\101\111\110, click on the globe icon on the bottom right to open the URL. Notice that P\97\116\114\101\111\110 may charge you a service fee for transactions over a certain amount.", - FNNS and"https://youtu.be/dQw4w9WgXcQ"or"https://www.p\97\116\114\101\111\110.com/techmino", + FNNS and "https://youtu.be/dQw4w9WgXcQ" or "https://www.p\97\116\114\101\111\110.com/techmino", }, --Games @@ -891,7 +891,7 @@ return{ {"Rolling", "rolling", "term", - "Another method of fast-tapping in high-gravity (around 1G) modes (with slow DAS/ARR setting).\nWhen you perform rolling, you fix the position of one hand and the controller, and then tap the back of the controller with fingers on your other hand repeatedly. This method allows even faster speeds than hypertapping (see “Hypertapping” for more)and requires much less effort.\nThis method was first discovered by Cheez-fish, and he has once achieved a tapping speed of more than 20 Hz.", + "Another method of fast-tapping in high-gravity (around 1G) modes (with slow DAS/ARR setting).\nWhen you perform rolling, you fix the position of one hand and the controller, and then tap the back of the controller with fingers on your other hand repeatedly. This method allows even faster speeds than hypertapping (see “Hypertapping” for more) and requires much less effort.\nThis method was first discovered by Cheez-fish, and he has once achieved a tapping speed of more than 20 Hz.", }, {"Passthrough", "pingthrough", diff --git a/parts/language/dict_ja.lua b/parts/language/dict_ja.lua index 61707b47..10f07498 100644 --- a/parts/language/dict_ja.lua +++ b/parts/language/dict_ja.lua @@ -89,13 +89,13 @@ return{ "support afdian サポート 寄付 支援", "org", FNNS and "この機能はプラットフォームのポリシー制限が原因で使えません。うちらのDiscordサーバーでこの機能に関して話してください。ちなみに、ここにあるURLはリックくんです。" or "AifadianでTechminoに寄付する場合、 右下の地球儀のアイコンからURLを開いてください。注意としてAifadianは支払いの際に6%の手数料が取られます。", - FNNS and"https://youtu.be/dQw4w9WgXcQ"or"https://afdian.net/@MrZ_26", + FNNS and "https://youtu.be/dQw4w9WgXcQ" or "https://afdian.net/@MrZ_26", }, {"サポート3", "support サポート 寄付 支援 p\97\116\114\101\111\110", "org", FNNS and "この機能はプラットフォームのポリシー制限が原因で使えません。うちらのDiscordサーバーでこの機能に関して話してください。ちなみに、ここにあるURLはリックくんです。" or "P\97\116\114\101\111\110でTechminoに寄付する場合、 右下の地球儀のアイコンからURLを開いてください。注意としてP\97\116\114\101\111\110は支払いの際に7.9%の手数料、さらに3ドル以上の支払いの際に0.30米ドル分の手数料が取られます。", - FNNS and"https://youtu.be/dQw4w9WgXcQ"or"https://www.p\97\116\114\101\111\110.com/techmino", + FNNS and "https://youtu.be/dQw4w9WgXcQ" or "https://www.p\97\116\114\101\111\110.com/techmino", }, --Games @@ -828,7 +828,7 @@ return{ {"Rolling", "rolling", "term", - "Another method of fast-tapping in high-gravity (around 1G) modes (with slow DAS/ARR setting).\nWhen you perform rolling, you fix the position of one hand and the controller, and then tap the back of the controller with fingers on your other hand repeatedly. This method allows even faster moving speeds than hypertapping (see \"Hypertapping\" for more)and requires much less effort.\nThis method was first discovered by Cheez-fish and he has once achieved a tapping speed of more than 20 Hz.", + "Another method of fast-tapping in high-gravity (around 1G) modes (with slow DAS/ARR setting).\nWhen you perform rolling, you fix the position of one hand and the controller, and then tap the back of the controller with fingers on your other hand repeatedly. This method allows even faster moving speeds than hypertapping (see \"Hypertapping\" for more) and requires much less effort.\nThis method was first discovered by Cheez-fish and he has once achieved a tapping speed of more than 20 Hz.", }, {"Passthrough", "pingthrough", diff --git a/parts/language/dict_zh.lua b/parts/language/dict_zh.lua index ed4f7091..bc87e801 100644 --- a/parts/language/dict_zh.lua +++ b/parts/language/dict_zh.lua @@ -117,13 +117,13 @@ return{ "support aifadian afdian zanzhu daqian", "org", "Afdian", - FNNS and"https://b23.tv/BV1uT4y1P7CX"or"https://afdian.net/@MrZ_26", + FNNS and "https://b23.tv/BV1uT4y1P7CX" or "https://afdian.net/@MrZ_26", }, {"赞助3", "support zanzhu daqian", "org", "P\97\116\114\101\111\110", - FNNS and"https://b23.tv/BV1uT4y1P7CX"or"https://www.p\97\116\114\101\111\110.com/techmino", + FNNS and "https://b23.tv/BV1uT4y1P7CX" or "https://www.p\97\116\114\101\111\110.com/techmino", }, --游戏(题库) diff --git a/parts/language/lang_en.lua b/parts/language/lang_en.lua index aae0abe2..e46809a2 100644 --- a/parts/language/lang_en.lua +++ b/parts/language/lang_en.lua @@ -205,8 +205,8 @@ return{ "Make sure to get the game only from official sources,", "as we can’t make sure you’re safe if you got it elsewhere.", "The author is not responsible for any modifications.", - FNNS and"/"or"While the game is free, donations are appreciated.", - FNNS and"/"or"Check Zictionary for more", + FNNS and "/" or "While the game is free, donations are appreciated.", + FNNS and "/" or "Check Zictionary for more", }, staff={ "ORIGINALLY BY MrZ", @@ -919,7 +919,7 @@ return{ "Headphones recommended for a better experience.", "Hello world!", "I3 and L3 are the only two unique triminoes.", - "if a==true", + " if a==true", "Increase your frame rate for a better experience.", "Initial [insert action] system can save you.", "Is B2B2B2B possible?", @@ -967,7 +967,7 @@ return{ "What about 23 PCs in 100 lines?", "What about 26 TSDs?", "What is this cheap UI & music smh", - "while(false)", + " while (false)", "You are a Grand Master!", "You are welcome to help us to make BGMs and SFXs!", "You can connect a keyboard to your phone or tablet (not functional on iOS though).", diff --git a/parts/language/lang_es.lua b/parts/language/lang_es.lua index 48efdc77..e1b605de 100644 --- a/parts/language/lang_es.lua +++ b/parts/language/lang_es.lua @@ -205,8 +205,8 @@ return{ "Por favor descarga el juego únicamente desde los sitios oficiales,", "ya que no podemos asegurar que sea seguro si proviene de otro lado.", "El autor no se responabiliza por daños ocasionados debido a modificaciones del juego.", - FNNS and"/"or"El juego es gratuito, pero se aprecian donaciones.", - FNNS and"/"or"Ve el Zictionary (en inglés) para más info.", + FNNS and "/" or "El juego es gratuito, pero se aprecian donaciones.", + FNNS and "/" or "Ve el Zictionary (en inglés) para más info.", }, staff={ "ORIGINAL DE MrZ", diff --git a/parts/language/lang_fr.lua b/parts/language/lang_fr.lua index 05d1d7c8..9661bc71 100644 --- a/parts/language/lang_fr.lua +++ b/parts/language/lang_fr.lua @@ -172,8 +172,8 @@ return{ "Ce jeu est gratuit et est uniquement disponible via discord.gg/f9pUvkh", "Ne téléchargez pas ce jeu depuis une autre source au risque d'avoir des virus,", "et vous n'avez besoin que des permissions de vibration et de communication réseau pour les versions mobiles !", - FNNS and"/"or"Le créateur n'est pas responsable pour n'importe quel type de perte de données suite à une modification du jeu.", - -- FNNS and"/"or"Check Zictionary for more", + FNNS and "/" or "Le créateur n'est pas responsable pour n'importe quel type de perte de données suite à une modification du jeu.", + -- FNNS and "/" or "Check Zictionary for more", }, staff={ "À L'ORIGINE PAR MrZ", diff --git a/parts/language/lang_id.lua b/parts/language/lang_id.lua index d0c22c2e..9fd72950 100644 --- a/parts/language/lang_id.lua +++ b/parts/language/lang_id.lua @@ -206,8 +206,8 @@ return{ "Pastikan untuk mendapat permainan ini hanya dari sumber resmi,", "karena kita tidak bisa meyakinkan Anda aman jika Anda mendapat permainan ini dari sumber lain.", "Penciptanya tidak bertanggung jawab untuk modifikasi.", - FNNS and"/"or"Permainan ini gratis, tetapi sumbangan sangat dihargai.", - -- FNNS and"/"or"Check Zictionary for more", + FNNS and "/" or "Permainan ini gratis, tetapi sumbangan sangat dihargai.", + -- FNNS and "/" or "Check Zictionary for more", }, staff={ "ASLI OLEH MrZ", @@ -911,7 +911,7 @@ return{ "Headphone direkomendasikan untuk pengalaman yang lebih baik.", "Hello world!", "Hanya ada 2 jenis trimino, yaitu I3 dan L3.", - "if a==true", + " if a==true", "Tingkatkan frekuensi gambar Anda untuk pengalaman yang lebih baik.", "Sistem [tindakan] awal dapat menyelamatkan Anda.", "Apakah B2B2B2B mungkin?", @@ -955,7 +955,7 @@ return{ "Bagaimana dengan 20 PCs?", "Bagaimana dengan 23 PCs dalam 100 baris?", "Bagaimana dengan 26 TSDs?", - "while(false)", + " while (false)", "Anda adalah seorang jago!", "Anda dipersilakan untuk membantu kami membuat musik dan efek suara!", "Anda dapat menghubungkan keyboard ke ponsel atau tablet Anda (tetapi tidak berfungsi di iOS).", diff --git a/parts/language/lang_ja.lua b/parts/language/lang_ja.lua index 7108e2ab..d3cd9de7 100644 --- a/parts/language/lang_ja.lua +++ b/parts/language/lang_ja.lua @@ -207,8 +207,8 @@ return{ "ゲームは、必ず公式から入手してください", "他から入手した場合は、安全性を保証しません", "同時に作者は、責任を負いません", - FNNS and"/"or"ゲーム自体は無料ですが、寄付できるならありがたいです。", - FNNS and"/"or"詳しくはZictionaryをご覧ください", + FNNS and "/" or "ゲーム自体は無料ですが、寄付できるならありがたいです。", + FNNS and "/" or "詳しくはZictionaryをご覧ください", }, staff={ "作者「MrZ」", @@ -952,7 +952,7 @@ getTip={refuseCopy=true, "Techminoは\"Technique\"と\"Tetromino\"を掛け合わせ造語です!", "Techminoプレイヤーの未来はあなた達のものです!", "TetroDictionary is now available in English.", - "while(false)", + " while (false)", "ZS JL T O I", "ゲーム内にはモード選択マップからじゃ入れない隠しモードがいくつかあります!", "このゲームでは全てのSpinに火力補正があります!", diff --git a/parts/language/lang_pt.lua b/parts/language/lang_pt.lua index 9ac7a642..21dbcbbf 100644 --- a/parts/language/lang_pt.lua +++ b/parts/language/lang_pt.lua @@ -194,8 +194,8 @@ return{ "certifique-se de pegar o jogo de fontes oficiais;", "binários obtidos em outros lugares pode conter malware.", "O autor não é responsável por qualquer binários modificados", - FNNS and"/"or"O jogo é gratis, mas doações são apreciadas.", - -- FNNS and"/"or"Check Zictionary for more", + FNNS and "/" or "O jogo é gratis, mas doações são apreciadas.", + -- FNNS and "/" or "Check Zictionary for more", }, staff={ "ORIGINALMENTE POR MrZ", @@ -890,7 +890,7 @@ return{ "Tem alguma sugestão? Posta elas em nosso Discord!", "Fones recomendados para uma melhor experiência.", "Olá mundo!", - "if a==true", + " if a==true", "Aumente sua frame rate para uma experiência melhor.", "O sistema de [ação] inicial pode salvar sua vida.", "Será B2B2B2B possível?", @@ -925,7 +925,7 @@ return{ "Que tal 20 PCs?", "Que tal 23 PCs em 100 linhas?", "Que tal 26 TSDs?", - "while(false)", + " while (false)", "Você e um Grand Master!", "Pode conectar um teclado ao seu celular!", "Você pode fazer spins com 28 de 29 minoes!", diff --git a/parts/language/lang_symbol.lua b/parts/language/lang_symbol.lua index e325b680..39e767c6 100644 --- a/parts/language/lang_symbol.lua +++ b/parts/language/lang_symbol.lua @@ -542,7 +542,7 @@ return{ getTip=function() local L="!@#$%^&*()-=_+[]{}\\|;:\'\",<.>/?" local s="" - for _=1,math.random(16,26)do + for _=1,math.random(16,26) do local p=math.random(#L) s=s..L:sub(p,p) end diff --git a/parts/language/lang_zh.lua b/parts/language/lang_zh.lua index 44835dcc..3f450ea5 100644 --- a/parts/language/lang_zh.lua +++ b/parts/language/lang_zh.lua @@ -206,8 +206,8 @@ return{ "仅通过官网 *暂无域名,见词典* 免费下载/更新", "其他渠道获得游戏皆有被修改/加广告/植入病毒的风险,程序只申请了振动&联网权限!", "若由于被修改的本游戏产生的各种损失作者不负责(怎么负责啊我又没法管)", - FNNS and"/"or"请从正规途径获得最新版,游戏现为免费,不过有打赏当然感谢啦~", - FNNS and"/"or"更多信息见小z词典", + FNNS and "/" or "请从正规途径获得最新版,游戏现为免费,不过有打赏当然感谢啦~", + FNNS and "/" or "更多信息见小z词典", }, staff={ "原作者 MrZ", @@ -1011,7 +1011,7 @@ return{ "git commit", "git push -f", "hello world", - "if a==true", + " if a==true", "l-=-1", "shutdown -h now", "sudo rm -rf /*", @@ -1021,7 +1021,7 @@ return{ "Techmino.exe 已停止工作", "TechminOS coming s∞n", "viod main[]", - "while(false)", + " while (false)", -- 其他乱七八糟梗 "啊哈哈哈哈哈,T块来咯", diff --git a/parts/language/lang_zh_code.lua b/parts/language/lang_zh_code.lua index 34b690e3..53cc594d 100644 --- a/parts/language/lang_zh_code.lua +++ b/parts/language/lang_zh_code.lua @@ -62,10 +62,10 @@ return{ page="Page=", - cc_fixed="if (AI==CC and Sequence==Fixed) then Error(); end", - cc_swap="if (AI==CC and Hold.Mode==Swap) then Error(); end", - ai_prebag="if (AI==true and Ctm.Seq~=Tetromino) then Error(); end", - ai_mission="if (AI==true and Ctm.Mission~=true) then Error(); end", + cc_fixed=" if (AI==CC and Sequence==Fixed) then Error(); end", + cc_swap=" if (AI==CC and Hold.Mode==Swap) then Error(); end", + ai_prebag=" if (AI==true and Ctm.Seq~=Tetromino) then Error(); end", + ai_mission=" if (AI==true and Ctm.Mission~=true) then Error(); end", switchSpawnSFX="SpawnSFX=false", needRestart="NeedRestart=true", @@ -96,7 +96,7 @@ return{ noScore="NoScore=true", modeLocked="Locked=true", - unlockHint="if (PreviousMode<=B) then Unlock();", + unlockHint=" if (PreviousMode<=B) then Unlock();", highScore="HighScore", newRecord="NewRecord=true", @@ -206,8 +206,8 @@ return{ "仅通过官网 *暂无域名,见词典* 免费下载/更新", "其他渠道获得游戏皆有被修改/加广告/植入病毒的风险,程序只申请了振动&联网权限!", "若由于被修改的本游戏产生的各种损失作者不负责(怎么负责啊我又没法管)", - FNNS and"/"or"请从正规途径获得最新版,游戏现为免费,不过有打赏当然感谢啦~", - FNNS and"/"or"更多信息见小z词典*/", + FNNS and "/" or "请从正规途径获得最新版,游戏现为免费,不过有打赏当然感谢啦~", + FNNS and "/" or "更多信息见小z词典*/", }, staff={ "原作者 MrZ", diff --git a/parts/language/lang_zh_trad.lua b/parts/language/lang_zh_trad.lua index 9e4997a1..01174e3b 100644 --- a/parts/language/lang_zh_trad.lua +++ b/parts/language/lang_zh_trad.lua @@ -206,8 +206,8 @@ return{ "僅透過內測QQ群/discord伺服器進行免費下載/更新", "從其他渠道獲得遊戲皆有被修改/加入廣告/植入病毒的風險,程序只申請了振動&網路權限!", "若由於被修改的本遊戲產生的各種損失作者概不負責(我怎麼負責啊跟我有什麼關係)", - FNNS and"/"or"請從正規途徑獲得最新版,遊戲現為免費,不過有打賞當然感謝啦~", - FNNS and"/"or"更多資訊見小z詞典" + FNNS and "/" or "請從正規途徑獲得最新版,遊戲現為免費,不過有打賞當然感謝啦~", + FNNS and "/" or "更多資訊見小z詞典" }, staff={ "原作者 MrZ", diff --git a/parts/modes/attacker_h.lua b/parts/modes/attacker_h.lua index f3a375c3..e203d0a7 100644 --- a/parts/modes/attacker_h.lua +++ b/parts/modes/attacker_h.lua @@ -7,9 +7,9 @@ return{ eventSet='attacker_h', bg='rainbow2',bgm='shining terminal', }, - score=function(P)return{P.modeData.wave,P.stat.time}end, - scoreDisp=function(D)return D[1].." Waves "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=100 then diff --git a/parts/modes/backfire_l.lua b/parts/modes/backfire_l.lua index 129ea635..ffa47b6b 100644 --- a/parts/modes/backfire_l.lua +++ b/parts/modes/backfire_l.lua @@ -13,9 +13,9 @@ return{ end, bg='blockhole',bgm='echo', }, - score=function(P)return{math.min(math.floor(P.stat.atk),100),P.stat.time}end, - scoreDisp=function(D)return D[1].." Attack "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=100 then diff --git a/parts/modes/backfire_n.lua b/parts/modes/backfire_n.lua index 5ee1f3f8..bff8ddf3 100644 --- a/parts/modes/backfire_n.lua +++ b/parts/modes/backfire_n.lua @@ -12,9 +12,9 @@ return{ end, bg='tunnel',bgm='echo', }, - score=function(P)return{math.min(math.floor(P.stat.atk),100),P.stat.time}end, - scoreDisp=function(D)return D[1].." Attack "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=100 then diff --git a/parts/modes/backfire_u.lua b/parts/modes/backfire_u.lua index 87368aef..359840ef 100644 --- a/parts/modes/backfire_u.lua +++ b/parts/modes/backfire_u.lua @@ -13,9 +13,9 @@ return{ end, bg='blockhole',bgm='echo', }, - score=function(P)return{math.min(math.floor(P.stat.atk),100),P.stat.time}end, - scoreDisp=function(D)return D[1].." Attack "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=100 then diff --git a/parts/modes/big_h.lua b/parts/modes/big_h.lua index 06a3a0cd..ae799ae5 100644 --- a/parts/modes/big_h.lua +++ b/parts/modes/big_h.lua @@ -7,9 +7,9 @@ return{ eventSet='big_h', bg='cubes',bgm='push', }, - score=function(P)return{math.min(P.stat.row,200),P.stat.time}end, - scoreDisp=function(D)return D[1].." Lines "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=200 then diff --git a/parts/modes/big_n.lua b/parts/modes/big_n.lua index 420c4379..cd055770 100644 --- a/parts/modes/big_n.lua +++ b/parts/modes/big_n.lua @@ -7,9 +7,9 @@ return{ eventSet='big_n', bg='bg2',bgm='push', }, - score=function(P)return{math.min(P.stat.row,200),P.stat.time}end, - scoreDisp=function(D)return D[1].." Lines "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=200 then diff --git a/parts/modes/blind_e.lua b/parts/modes/blind_e.lua index 69452108..65d5e3c9 100644 --- a/parts/modes/blind_e.lua +++ b/parts/modes/blind_e.lua @@ -7,9 +7,9 @@ return{ eventSet='checkLine_200', bg='glow',bgm='sugar fairy', }, - score=function(P)return{math.min(P.stat.row,200),P.stat.time}end, - scoreDisp=function(D)return D[1].." Lines "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=200 then diff --git a/parts/modes/blind_h.lua b/parts/modes/blind_h.lua index 46fb8ec1..da540c6a 100644 --- a/parts/modes/blind_h.lua +++ b/parts/modes/blind_h.lua @@ -10,9 +10,9 @@ return{ eventSet='checkLine_200', bg='rgb',bgm='sugar fairy', }, - score=function(P)return{math.min(P.stat.row,200),P.stat.time}end, - scoreDisp=function(D)return D[1].." Lines "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=200 then diff --git a/parts/modes/blind_l.lua b/parts/modes/blind_l.lua index 0f0e97b2..f5f385d4 100644 --- a/parts/modes/blind_l.lua +++ b/parts/modes/blind_l.lua @@ -11,9 +11,9 @@ return{ eventSet='checkLine_200', bg='rgb',bgm='sugar fairy', }, - score=function(P)return{math.min(P.stat.row,200),P.stat.time}end, - scoreDisp=function(D)return D[1].." Lines "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=200 then diff --git a/parts/modes/blind_n.lua b/parts/modes/blind_n.lua index 81a38011..46cefaa7 100644 --- a/parts/modes/blind_n.lua +++ b/parts/modes/blind_n.lua @@ -7,9 +7,9 @@ return{ eventSet='checkLine_200', bg='glow',bgm='sugar fairy', }, - score=function(P)return{math.min(P.stat.row,200),P.stat.time}end, - scoreDisp=function(D)return D[1].." Lines "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=200 then diff --git a/parts/modes/blind_u.lua b/parts/modes/blind_u.lua index dfe24628..8aadfd31 100644 --- a/parts/modes/blind_u.lua +++ b/parts/modes/blind_u.lua @@ -10,9 +10,9 @@ return{ eventSet='checkLine_100', bg='rgb',bgm='far', }, - score=function(P)return{math.min(P.stat.row,100),P.stat.time}end, - scoreDisp=function(D)return D[1].." Lines "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]0 then return end elseif a<12 then if a~=b then return end @@ -20,7 +20,7 @@ return{ end end D.finished=D.finished+1 - if FIELD[D.finished+1]then + if FIELD[D.finished+1] then P.waiting=26 for _=#P.field,1,-1 do P.field[_],P.visTime[_]=nil @@ -54,9 +54,9 @@ return{ local AItype=GAME.modeEnv.opponent:sub(1,2) local AIlevel=tonumber(GAME.modeEnv.opponent:sub(-1)) PLY.newPlayer(1) - if AItype=='9S'then + if AItype=='9S' then PLY.newAIPlayer(2,BOT.template{type='9S',speedLV=2*AIlevel,hold=true}) - elseif AItype=='CC'then + elseif AItype=='CC' then PLY.newAIPlayer(2,BOT.template{type='CC',speedLV=2*AIlevel-1,next=math.floor(AIlevel*.5+1),hold=true,node=20000+5000*AIlevel}) end end, diff --git a/parts/modes/defender_l.lua b/parts/modes/defender_l.lua index 318e6270..1924568f 100644 --- a/parts/modes/defender_l.lua +++ b/parts/modes/defender_l.lua @@ -6,9 +6,9 @@ return{ eventSet='defender_l', bg='rainbow2',bgm='storm', }, - score=function(P)return{P.modeData.wave,P.stat.time}end, - scoreDisp=function(D)return D[1].." Waves "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]0 then @@ -44,7 +44,7 @@ return{ if tempDeltaHei<-2 and deltaHei>2 then break elseif x==11 then - for _=1,3 do ins(wei,7)end + for _=1,3 do ins(wei,7) end else tempDeltaHei=deltaHei end @@ -62,10 +62,10 @@ return{ end end if flatCount<3 then - for _=1,3 do ins(wei,6)end + for _=1,3 do ins(wei,6) end end if stairCount<3 then - for _=1,4 do ins(wei,5)end + for _=1,4 do ins(wei,5) end end end P:getNext(wei[P.seqRND:random(#wei)]) @@ -78,9 +78,9 @@ return{ eventSet='checkLine_100', bg='blockfall',bgm='reason', }, - score=function(P)return{math.min(P.stat.row,100),P.stat.time}end, - scoreDisp=function(D)return D[1].." Lines "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=100 then diff --git a/parts/modes/drought_n.lua b/parts/modes/drought_n.lua index 9f3b4798..21895a49 100644 --- a/parts/modes/drought_n.lua +++ b/parts/modes/drought_n.lua @@ -9,9 +9,9 @@ return{ eventSet='checkLine_100', bg='blockfall',bgm='reason', }, - score=function(P)return{math.min(P.stat.row,100),P.stat.time}end, - scoreDisp=function(D)return D[1].." Lines "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=100 then diff --git a/parts/modes/infinite_dig.lua b/parts/modes/infinite_dig.lua index 9099966a..22e40d68 100644 --- a/parts/modes/infinite_dig.lua +++ b/parts/modes/infinite_dig.lua @@ -15,12 +15,12 @@ local function check_rise(P) if L==0 then P:_showText(text.awesome,0,-120,80,'beat',.6) SFX.play('pc') - if BG.cur=='wing'then BG.send(26)end + if BG.cur=='wing' then BG.send(26) end for _=1,8 do P:garbageRise(13,1,generateLine(P.holeRND:random(10))) end else - if BG.cur=='wing'then BG.send(#P.clearedRow)end + if BG.cur=='wing' then BG.send(#P.clearedRow) end end end end diff --git a/parts/modes/marathon_h.lua b/parts/modes/marathon_h.lua index 2d707a84..9cb729c9 100644 --- a/parts/modes/marathon_h.lua +++ b/parts/modes/marathon_h.lua @@ -7,9 +7,9 @@ return{ bg='cubes',bgm='push', }, slowMark=true, - score=function(P)return{math.min(P.stat.row,200),P.stat.time}end, - scoreDisp=function(D)return D[1].." Lines "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=200 then diff --git a/parts/modes/marathon_inf.lua b/parts/modes/marathon_inf.lua index 9f8ef667..954bd20b 100644 --- a/parts/modes/marathon_inf.lua +++ b/parts/modes/marathon_inf.lua @@ -7,9 +7,9 @@ return{ bg='bg2',bgm='push', }, slowMark=true, - score=function(P)return{P.stat.score,P.stat.row,P.stat.time}end, - scoreDisp=function(D)return D[1].."P "..D[2].."L "..STRING.time(D[3])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=26 and 0 end, diff --git a/parts/modes/marathon_n.lua b/parts/modes/marathon_n.lua index ee3d1009..6a8a0abe 100644 --- a/parts/modes/marathon_n.lua +++ b/parts/modes/marathon_n.lua @@ -7,9 +7,9 @@ return{ bg='bg2',bgm='push', }, slowMark=true, - score=function(P)return{math.min(P.stat.row,200),P.stat.time}end, - scoreDisp=function(D)return D[1].." Lines "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=200 then diff --git a/parts/modes/master_ex.lua b/parts/modes/master_ex.lua index c9055c4f..3393732d 100644 --- a/parts/modes/master_ex.lua +++ b/parts/modes/master_ex.lua @@ -6,9 +6,9 @@ return{ bg='blockspace',bgm='hope', }, slowMark=true, - score=function(P)return{P.modeData.rankPoint,P.stat.score}end, - scoreDisp=function(D)return sectionName[math.floor(D[1]/10)+1].." "..D[2]end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]>b[2]end, + score=function(P) return{P.modeData.rankPoint,P.stat.score} end, + scoreDisp=function(D) return sectionName[math.floor(D[1]/10)+1].." "..D[2] end, + comp=function(a,b) return a[1]>b[1] or a[1]==b[1] and a[2]>b[2] end, getRank=function(P) P=P.modeData.rankPoint return diff --git a/parts/modes/master_final.lua b/parts/modes/master_final.lua index d1608960..b02f820a 100644 --- a/parts/modes/master_final.lua +++ b/parts/modes/master_final.lua @@ -5,9 +5,9 @@ return{ bg='lightning',bgm='rectification', }, slowMark=true, - score=function(P)return{P.modeData.pt,P.stat.time}end, - scoreDisp=function(D)return D[1].."P "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or(a[1]==b[1]and a[2]b[1] or (a[1]==b[1] and a[2]b[1]or(a[1]==b[1]and a[2]b[1] or (a[1]==b[1] and a[2]b[1]or(a[1]==b[1]and a[2]b[1] or (a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or(a[1]==b[1]and a[2]b[1] or (a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=226 and 4 or p>=162 and 3 or p>=62 and 2 or diff --git a/parts/modes/netBattle.lua b/parts/modes/netBattle.lua index 11354ad3..2a965169 100644 --- a/parts/modes/netBattle.lua +++ b/parts/modes/netBattle.lua @@ -1,10 +1,10 @@ local yield=coroutine.yield local function marginTask(P) local S=P.stat - while true do yield()if S.frame>90*60 then P.strength=1;P:setFrameColor(1)break end end - while true do yield()if S.frame>135*60 then P.strength=2;P:setFrameColor(2)break end end - while true do yield()if S.frame>180*60 then P.strength=3;P:setFrameColor(3)break end end - while true do yield()if S.frame>260*60 then P.strength=4;P:setFrameColor(4)break end end + while true do yield() if S.frame>90*60 then P.strength=1;P:setFrameColor(1)break end end + while true do yield() if S.frame>135*60 then P.strength=2;P:setFrameColor(2)break end end + while true do yield() if S.frame>180*60 then P.strength=3;P:setFrameColor(3)break end end + while true do yield() if S.frame>260*60 then P.strength=4;P:setFrameColor(4)break end end end return{ env={ diff --git a/parts/modes/pc_h.lua b/parts/modes/pc_h.lua index edd86f98..980ff48f 100644 --- a/parts/modes/pc_h.lua +++ b/parts/modes/pc_h.lua @@ -12,9 +12,9 @@ return{ eventSet='checkLine_100', bg='rgb',bgm='truth', }, - score=function(P)return{P.stat.pc,P.stat.time}end, - scoreDisp=function(D)return D[1].." PCs "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=2 and 5 or diff --git a/parts/modes/solo_n.lua b/parts/modes/solo_n.lua index 06850874..b2dc2163 100644 --- a/parts/modes/solo_n.lua +++ b/parts/modes/solo_n.lua @@ -9,11 +9,11 @@ return{ PLY.newPlayer(1) PLY.newAIPlayer(2,BOT.template{type='9S',speedLV=5,hold=true}) end, - score=function(P)return{P.stat.time}end, - scoreDisp=function(D)return STRING.time(D[1])end, - comp=function(a,b)return a[1]=2 and 5 or diff --git a/parts/modes/sprint123.lua b/parts/modes/sprint123.lua index 5d553467..055c792e 100644 --- a/parts/modes/sprint123.lua +++ b/parts/modes/sprint123.lua @@ -5,9 +5,9 @@ return{ eventSet='checkLine_40', bg='bg2',bgm='race', }, - score=function(P)return{P.stat.time,P.stat.piece}end, - scoreDisp=function(D)return STRING.time(D[1]).." "..D[2].." Pieces"end, - comp=function(a,b)return a[1]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=100 then diff --git a/parts/modes/tech_finesse_f.lua b/parts/modes/tech_finesse_f.lua index 97848668..c956cbec 100644 --- a/parts/modes/tech_finesse_f.lua +++ b/parts/modes/tech_finesse_f.lua @@ -21,9 +21,9 @@ return{ bg='flink',bgm='infinite', }, slowMark=true, - score=function(P)return{P.stat.atk<=100 and math.floor(P.stat.atk)or 100,P.stat.time}end, - scoreDisp=function(D)return D[1].." Attack "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=100 then diff --git a/parts/modes/tech_h.lua b/parts/modes/tech_h.lua index 79f654a7..3aa6dc60 100644 --- a/parts/modes/tech_h.lua +++ b/parts/modes/tech_h.lua @@ -6,9 +6,9 @@ return{ eventSet='checkAttack_100', bg='matrix',bgm='down', }, - score=function(P)return{P.stat.atk<=100 and math.floor(P.stat.atk)or 100,P.stat.time}end, - scoreDisp=function(D)return D[1].." Attack "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=100 then diff --git a/parts/modes/tech_h_plus.lua b/parts/modes/tech_h_plus.lua index d67216bc..8cbc5bee 100644 --- a/parts/modes/tech_h_plus.lua +++ b/parts/modes/tech_h_plus.lua @@ -1,7 +1,7 @@ local function tech_check_hard(P) local C=P.lastPiece if C.row>0 then - if not(C.spin or C.pc)then + if not (C.spin or C.pc) then P:lose() return end @@ -19,9 +19,9 @@ return{ eventSet='checkAttack_100', bg='matrix',bgm='down', }, - score=function(P)return{P.stat.atk<=100 and math.floor(P.stat.atk)or 100,P.stat.time}end, - scoreDisp=function(D)return D[1].." Attack "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=100 then diff --git a/parts/modes/tech_l.lua b/parts/modes/tech_l.lua index 1b77fe02..17433c90 100644 --- a/parts/modes/tech_l.lua +++ b/parts/modes/tech_l.lua @@ -6,9 +6,9 @@ return{ eventSet='checkAttack_100', bg='matrix',bgm='warped', }, - score=function(P)return{P.stat.atk<=100 and math.floor(P.stat.atk)or 100,P.stat.time}end, - scoreDisp=function(D)return D[1].." Attack "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=100 then diff --git a/parts/modes/tech_l_plus.lua b/parts/modes/tech_l_plus.lua index cfe7b617..c2c313c7 100644 --- a/parts/modes/tech_l_plus.lua +++ b/parts/modes/tech_l_plus.lua @@ -1,7 +1,7 @@ local function tech_check_hard(P) local C=P.lastPiece if C.row>0 then - if not(C.spin or C.pc)then + if not (C.spin or C.pc) then P:lose() return end @@ -19,9 +19,9 @@ return{ eventSet='checkAttack_100', bg='matrix',bgm='warped', }, - score=function(P)return{P.stat.atk<=100 and math.floor(P.stat.atk)or 100,P.stat.time}end, - scoreDisp=function(D)return D[1].." Attack "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=100 then diff --git a/parts/modes/tech_n.lua b/parts/modes/tech_n.lua index 98cd79d3..4685105b 100644 --- a/parts/modes/tech_n.lua +++ b/parts/modes/tech_n.lua @@ -6,9 +6,9 @@ return{ eventSet='checkAttack_100', bg='matrix',bgm='new era', }, - score=function(P)return{P.stat.atk<=100 and math.floor(P.stat.atk)or 100,P.stat.time}end, - scoreDisp=function(D)return D[1].." Attack "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=100 then diff --git a/parts/modes/tech_n_plus.lua b/parts/modes/tech_n_plus.lua index 3be58912..9b68e423 100644 --- a/parts/modes/tech_n_plus.lua +++ b/parts/modes/tech_n_plus.lua @@ -1,7 +1,7 @@ local function tech_check_hard(P) local C=P.lastPiece if C.row>0 then - if not(C.spin or C.pc)then + if not (C.spin or C.pc) then P:lose() return end @@ -19,9 +19,9 @@ return{ eventSet='checkAttack_100', bg='matrix',bgm='new era', }, - score=function(P)return{P.stat.atk<=100 and math.floor(P.stat.atk)or 100,P.stat.time}end, - scoreDisp=function(D)return D[1].." Attack "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]=100 then diff --git a/parts/modes/techmino49_e.lua b/parts/modes/techmino49_e.lua index 4fd0c2b4..f0813ee9 100644 --- a/parts/modes/techmino49_e.lua +++ b/parts/modes/techmino49_e.lua @@ -12,18 +12,18 @@ return{ ROYALEDATA.powerUp={2,5,10,20} ROYALEDATA.stage={30,20,15,10,5} PLY.newPlayer(1) - local L={}for i=1,49 do L[i]=true end + local L={} for i=1,49 do L[i]=true end local t=2 while t>0 do local r=math.random(2,49) - if L[r]then + if L[r] then L[r]=false t=t-1 end end local n=2 for _=1,4 do for _=1,6 do - if L[n]then + if L[n] then PLY.newAIPlayer(n,BOT.template{type='9S',speedLV=math.random(4,6),hold=true},true) else PLY.newAIPlayer(n,BOT.template{type='CC',speedLV=math.random(2,4),next=2,hold=true,node=20000},true) @@ -31,7 +31,7 @@ return{ n=n+1 end end for _=9,12 do for _=1,6 do - if L[n]then + if L[n] then PLY.newAIPlayer(n,BOT.template{type='9S',speedLV=math.random(4,5),hold=true},true) else PLY.newAIPlayer(n,BOT.template{type='CC',speedLV=math.random(3,5),next=2,hold=true,node=20000},true) @@ -39,9 +39,9 @@ return{ n=n+1 end end end, - score=function(P)return{P.modeData.place,P.modeData.ko}end, - scoreDisp=function(D)return"NO."..D[1].." KO:"..D[2]end, - comp=function(a,b)return a[1]b[2]end, + score=function(P) return{P.modeData.place,P.modeData.ko} end, + scoreDisp=function(D) return"NO."..D[1].." KO:"..D[2] end, + comp=function(a,b) return a[1]b[2] end, getRank=function(P) local R=P.modeData.place return diff --git a/parts/modes/techmino49_h.lua b/parts/modes/techmino49_h.lua index 141e8b17..8607b889 100644 --- a/parts/modes/techmino49_h.lua +++ b/parts/modes/techmino49_h.lua @@ -12,18 +12,18 @@ return{ ROYALEDATA.powerUp={2,5,10,20} ROYALEDATA.stage={30,20,15,10,5} PLY.newPlayer(1) - local L={}for i=1,49 do L[i]=true end + local L={} for i=1,49 do L[i]=true end local t=4 while t>0 do local r=math.random(2,49) - if L[r]then + if L[r] then L[r]=false t=t-1 end end local n=2 for _=1,4 do for _=1,6 do - if L[n]then + if L[n] then PLY.newAIPlayer(n,BOT.template{type='9S',speedLV=math.random(4,8),hold=true},true) else PLY.newAIPlayer(n,BOT.template{type='CC',speedLV=math.random(3,6),next=3,hold=true,node=30000},true) @@ -31,7 +31,7 @@ return{ n=n+1 end end for _=9,12 do for _=1,6 do - if L[n]then + if L[n] then PLY.newAIPlayer(n,BOT.template{type='9S',speedLV=math.random(4,7),hold=true},true) else PLY.newAIPlayer(n,BOT.template{type='CC',speedLV=math.random(4,6),next=3,hold=true,node=30000},true) @@ -39,9 +39,9 @@ return{ n=n+1 end end end, - score=function(P)return{P.modeData.place,P.modeData.ko}end, - scoreDisp=function(D)return"NO."..D[1].." KO:"..D[2]end, - comp=function(a,b)return a[1]b[2]end, + score=function(P) return{P.modeData.place,P.modeData.ko} end, + scoreDisp=function(D) return"NO."..D[1].." KO:"..D[2] end, + comp=function(a,b) return a[1]b[2] end, getRank=function(P) local R=P.modeData.place return diff --git a/parts/modes/techmino49_u.lua b/parts/modes/techmino49_u.lua index 3c0cb7f2..e4653deb 100644 --- a/parts/modes/techmino49_u.lua +++ b/parts/modes/techmino49_u.lua @@ -12,18 +12,18 @@ return{ ROYALEDATA.powerUp={2,5,10,20} ROYALEDATA.stage={30,20,15,10,5} PLY.newPlayer(1) - local L={}for i=1,49 do L[i]=true end + local L={} for i=1,49 do L[i]=true end local t=6 while t>0 do local r=math.random(2,49) - if L[r]then + if L[r] then L[r]=false t=t-1 end end local n=2 for _=1,4 do for _=1,6 do - if L[n]then + if L[n] then PLY.newAIPlayer(n,BOT.template{type='9S',speedLV=math.random(8,10),hold=true},true) else PLY.newAIPlayer(n,BOT.template{type='CC',speedLV=math.random(4,7),next=3,hold=true,node=40000},true) @@ -31,7 +31,7 @@ return{ n=n+1 end end for _=9,12 do for _=1,6 do - if L[n]then + if L[n] then PLY.newAIPlayer(n,BOT.template{type='9S',speedLV=math.random(8,9),hold=true},true) else PLY.newAIPlayer(n,BOT.template{type='CC',speedLV=math.random(5,8),next=3,hold=true,node=40000},true) @@ -39,9 +39,9 @@ return{ n=n+1 end end end, - score=function(P)return{P.modeData.place,P.modeData.ko}end, - scoreDisp=function(D)return"NO."..D[1].." KO:"..D[2]end, - comp=function(a,b)return a[1]b[2]end, + score=function(P) return{P.modeData.place,P.modeData.ko} end, + scoreDisp=function(D) return"NO."..D[1].." KO:"..D[2] end, + comp=function(a,b) return a[1]b[2] end, getRank=function(P) local R=P.modeData.place return diff --git a/parts/modes/techmino99_e.lua b/parts/modes/techmino99_e.lua index 9525c196..9f7bf11f 100644 --- a/parts/modes/techmino99_e.lua +++ b/parts/modes/techmino99_e.lua @@ -12,18 +12,18 @@ return{ ROYALEDATA.powerUp={2,6,14,30} ROYALEDATA.stage={75,50,35,20,10} PLY.newPlayer(1) - local L={}for i=1,100 do L[i]=true end + local L={} for i=1,100 do L[i]=true end local t=4 while t>0 do local r=math.random(2,99) - if L[r]then + if L[r] then L[r]=false t=t-1 end end local n=2 for _=1,7 do for _=1,7 do - if L[n]then + if L[n] then PLY.newAIPlayer(n,BOT.template{type='9S',speedLV=math.random(4,6),hold=true},true) else PLY.newAIPlayer(n,BOT.template{type='CC',speedLV=math.random(2,4),next=2,hold=true,node=20000},true) @@ -31,7 +31,7 @@ return{ n=n+1 end end for _=15,21 do for _=1,7 do - if L[n]then + if L[n] then PLY.newAIPlayer(n,BOT.template{type='9S',speedLV=math.random(4,5),hold=true},true) else PLY.newAIPlayer(n,BOT.template{type='CC',speedLV=math.random(3,5),next=2,hold=true,node=20000},true) @@ -39,9 +39,9 @@ return{ n=n+1 end end end, - score=function(P)return{P.modeData.place,P.modeData.ko}end, - scoreDisp=function(D)return"NO."..D[1].." KO:"..D[2]end, - comp=function(a,b)return a[1]b[2]end, + score=function(P) return{P.modeData.place,P.modeData.ko} end, + scoreDisp=function(D) return"NO."..D[1].." KO:"..D[2] end, + comp=function(a,b) return a[1]b[2] end, getRank=function(P) local R=P.modeData.place return diff --git a/parts/modes/techmino99_h.lua b/parts/modes/techmino99_h.lua index bb91b0c2..671a2a1b 100644 --- a/parts/modes/techmino99_h.lua +++ b/parts/modes/techmino99_h.lua @@ -12,18 +12,18 @@ return{ ROYALEDATA.powerUp={2,6,14,30} ROYALEDATA.stage={75,50,35,20,10} PLY.newPlayer(1) - local L={}for i=1,100 do L[i]=true end + local L={} for i=1,100 do L[i]=true end local t=4 while t>0 do local r=math.random(2,99) - if L[r]then + if L[r] then L[r]=false t=t-1 end end local n=2 for _=1,7 do for _=1,7 do - if L[n]then + if L[n] then PLY.newAIPlayer(n,BOT.template{type='9S',speedLV=math.random(4,8),hold=true},true) else PLY.newAIPlayer(n,BOT.template{type='CC',speedLV=math.random(3,6),next=3,hold=true,node=30000},true) @@ -31,7 +31,7 @@ return{ n=n+1 end end for _=15,21 do for _=1,7 do - if L[n]then + if L[n] then PLY.newAIPlayer(n,BOT.template{type='9S',speedLV=math.random(4,7),hold=true},true) else PLY.newAIPlayer(n,BOT.template{type='CC',speedLV=math.random(4,6),next=3,hold=true,node=30000},true) @@ -39,9 +39,9 @@ return{ n=n+1 end end end, - score=function(P)return{P.modeData.place,P.modeData.ko}end, - scoreDisp=function(D)return"NO."..D[1].." KO:"..D[2]end, - comp=function(a,b)return a[1]b[2]end, + score=function(P) return{P.modeData.place,P.modeData.ko} end, + scoreDisp=function(D) return"NO."..D[1].." KO:"..D[2] end, + comp=function(a,b) return a[1]b[2] end, getRank=function(P) local R=P.modeData.place return diff --git a/parts/modes/techmino99_u.lua b/parts/modes/techmino99_u.lua index 73b0f7de..36c85f88 100644 --- a/parts/modes/techmino99_u.lua +++ b/parts/modes/techmino99_u.lua @@ -12,18 +12,18 @@ return{ ROYALEDATA.powerUp={2,6,14,30} ROYALEDATA.stage={75,50,35,20,10} PLY.newPlayer(1) - local L={}for i=1,100 do L[i]=true end + local L={} for i=1,100 do L[i]=true end local t=4 while t>0 do local r=math.random(2,99) - if L[r]then + if L[r] then L[r]=false t=t-1 end end local n=2 for _=1,7 do for _=1,7 do - if L[n]then + if L[n] then PLY.newAIPlayer(n,BOT.template{type='9S',speedLV=math.random(8,10),hold=true},true) else PLY.newAIPlayer(n,BOT.template{type='CC',speedLV=math.random(4,7),next=3,hold=true,node=40000},true) @@ -31,7 +31,7 @@ return{ n=n+1 end end for _=15,21 do for _=1,7 do - if L[n]then + if L[n] then PLY.newAIPlayer(n,BOT.template{type='9S',speedLV=math.random(8,9),hold=true},true) else PLY.newAIPlayer(n,BOT.template{type='CC',speedLV=math.random(5,8),next=3,hold=true,node=40000},true) @@ -39,9 +39,9 @@ return{ n=n+1 end end end, - score=function(P)return{P.modeData.place,P.modeData.ko}end, - scoreDisp=function(D)return"NO."..D[1].." KO:"..D[2]end, - comp=function(a,b)return a[1]b[2]end, + score=function(P) return{P.modeData.place,P.modeData.ko} end, + scoreDisp=function(D) return"NO."..D[1].." KO:"..D[2] end, + comp=function(a,b) return a[1]b[2] end, getRank=function(P) local R=P.modeData.place return diff --git a/parts/modes/tsd_e.lua b/parts/modes/tsd_e.lua index 2df5954e..f8c16301 100644 --- a/parts/modes/tsd_e.lua +++ b/parts/modes/tsd_e.lua @@ -7,9 +7,9 @@ return{ eventSet='tsd_e', bg='matrix',bgm='vapor', }, - score=function(P)return{P.modeData.tsd,P.stat.time}end, - scoreDisp=function(D)return D[1].."TSD "..STRING.time(D[2])end, - comp=function(a,b)return a[1]>b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]or a[1]==b[1]and a[2]b[1] or a[1]==b[1] and a[2]b[1]end, + score=function(P) return{P.stat.score} end, + scoreDisp=function(D) return tostring(D[1]) end, + comp=function(a,b) return a[1]>b[1] end, getRank=function(P) local T=P.stat.score return diff --git a/parts/modes/zen.lua b/parts/modes/zen.lua index 29004bd7..ebc8424f 100644 --- a/parts/modes/zen.lua +++ b/parts/modes/zen.lua @@ -5,9 +5,9 @@ return{ eventSet='checkLine_200', bg='bg2',bgm='venus', }, - score=function(P)return{P.stat.score}end, - scoreDisp=function(D)return tostring(D[1])end, - comp=function(a,b)return a[1]>b[1]end, + score=function(P) return{P.stat.score} end, + scoreDisp=function(D) return tostring(D[1]) end, + comp=function(a,b) return a[1]>b[1] end, getRank=function(P) local T=P.stat.score return diff --git a/parts/net.lua b/parts/net.lua index 9add2209..e8a4271b 100644 --- a/parts/net.lua +++ b/parts/net.lua @@ -1,5 +1,4 @@ local WS=WS -local PLAYERS=PLAYERS local NET={ allow_online=false, @@ -303,22 +302,21 @@ function NET.room.chat(mes,rid) }) end function NET.room.create(roomName,description,capacity,roomType,roomData,password) - if TASK.lock('enterRoom',2)then - NET.roomState.private=not not password - NET.roomState.capacity=capacity - wsSend(1301,{ - capacity=capacity, - info={ - name=roomName, - type=roomType, - version=VERSION.room, - description=description, - }, - data=roomData, + if not TASK.lock('enterRoom',2) then return end + NET.roomState.private=not not password + NET.roomState.capacity=capacity + wsSend(1301,{ + capacity=capacity, + info={ + name=roomName, + type=roomType, + version=VERSION.room, + description=description, + }, + data=roomData, - password=password, - }) - end + password=password, + }) end function NET.room.getData(rid) wsSend(1302,{ @@ -343,7 +341,7 @@ function NET.room.setInfo(info,rid) }) end function NET.room.enter(rid,password) - if TASK.lock('enterRoom',6)then + if TASK.lock('enterRoom',6) then SFX.play('reach',.6) wsSend(1306,{ data={ @@ -363,7 +361,7 @@ function NET.room.leave() wsSend(1308) end function NET.room.fetch() - if TASK.lock('fetchRoom',3)then + if TASK.lock('fetchRoom',3) then wsSend(1309,{ data={ pageIndex=0, @@ -373,7 +371,7 @@ function NET.room.fetch() end end function NET.room.setPW(pw,rid) - if TASK.lock('fetchRoom',3)then + if TASK.lock('fetchRoom',3) then wsSend(1310,{ data={ password=pw, @@ -420,7 +418,7 @@ end --WS function NET.connectWS() - if WS.status('game')=='dead'then + if WS.status('game')=='dead' then WS.connect('game','',{['x-access-token']=USER.aToken},6) TASK.new(NET.updateWS) end @@ -429,13 +427,13 @@ function NET.closeWS() WS.close('game') end function NET.updateWS() - while WS.status('game')~='dead'do + while WS.status('game')~='dead' do coroutine.yield() local message,op=WS.read('game') if message then - if op=='ping'then - elseif op=='pong'then - elseif op=='close'then + if op=='ping' then + elseif op=='pong' then + elseif op=='close' then local res=JSON.decode(message) MES.new('info',("$1 $2"):repD(text.wsClose,res and res.message or message)) if res and res.message then LOG(res.message) end @@ -494,21 +492,21 @@ end --Save function NET.uploadSave() - if TASK.lock('uploadSave',8)then + if TASK.lock('uploadSave',8) then wsSend({data={sections={ {section=1,data=STRING.packTable(STAT)}, {section=2,data=STRING.packTable(RANKS)}, {section=3,data=STRING.packTable(SETTING)}, {section=4,data=STRING.packTable(KEY_MAP)}, {section=5,data=STRING.packTable(VK_ORG)}, - {section=6,data=STRING.packTable(loadFile('conf/vkSave1','-canSkip')or{})}, - {section=7,data=STRING.packTable(loadFile('conf/vkSave2','-canSkip')or{})}, + {section=6,data=STRING.packTable(loadFile('conf/vkSave1','-canSkip') or{})}, + {section=7,data=STRING.packTable(loadFile('conf/vkSave2','-canSkip') or{})}, }}}) MES.new('info',"Uploading") end end function NET.downloadSave() - if TASK.lock('downloadSave',8)then + if TASK.lock('downloadSave',8) then wsSend({data={sections={1,2,3,4,5,6,7}}}) MES.new('info',"Downloading") end @@ -548,8 +546,8 @@ function NET.loadSavedData(sections) TABLE.cover(NET.cloudData.VK_org,VK_ORG) success=success and saveFile(VK_ORG,'conf/virtualkey') - if #NET.cloudData.vkSave1[1]then success=success and saveFile(NET.cloudData.vkSave1,'conf/vkSave1')end - if #NET.cloudData.vkSave2[1]then success=success and saveFile(NET.cloudData.vkSave2,'conf/vkSave2')end + if #NET.cloudData.vkSave1[1] then success=success and saveFile(NET.cloudData.vkSave1,'conf/vkSave1') end + if #NET.cloudData.vkSave2[1] then success=success and saveFile(NET.cloudData.vkSave2,'conf/vkSave2') end if success then MES.new('check',text.saveDone) else diff --git a/parts/netPlayer.lua b/parts/netPlayer.lua index 184f1a14..3e798d5a 100644 --- a/parts/netPlayer.lua +++ b/parts/netPlayer.lua @@ -29,39 +29,39 @@ local posLists={ --18~31 (function() local L={} - for i=1,11 do L[i]= {x=40,y=65+50*i,w=330,h=45}end - for i=1,11 do L[11+i]={x=400,y=65+50*i,w=330,h=45}end - for i=1,9 do L[22+i]= {x=760,y=65+50*i,w=330,h=45}end + for i=1,11 do L[i]= {x=40,y=65+50*i,w=330,h=45} end + for i=1,11 do L[11+i]={x=400,y=65+50*i,w=330,h=45} end + for i=1,9 do L[22+i]= {x=760,y=65+50*i,w=330,h=45} end return L end)(), --32~49 (function() local L={} - for i=1,10 do L[i]= {x=30,y=60+50*i,w=200,h=45}end - for i=1,10 do L[10+i]={x=240,y=60+50*i,w=200,h=45}end - for i=1,10 do L[20+i]={x=450,y=60+50*i,w=200,h=45}end - for i=1,10 do L[30+i]={x=660,y=60+50*i,w=200,h=45}end - for i=1,9 do L[40+i]= {x=870,y=60+50*i,w=200,h=45}end + for i=1,10 do L[i]= {x=30,y=60+50*i,w=200,h=45} end + for i=1,10 do L[10+i]={x=240,y=60+50*i,w=200,h=45} end + for i=1,10 do L[20+i]={x=450,y=60+50*i,w=200,h=45} end + for i=1,10 do L[30+i]={x=660,y=60+50*i,w=200,h=45} end + for i=1,9 do L[40+i]= {x=870,y=60+50*i,w=200,h=45} end return L end)(), --50~99 (function() local L={} - for i=1,11 do L[i]= {x=30,y=60+50*i,w=100,h=45}end - for i=1,11 do L[i+11]={x=135,y=60+50*i,w=100,h=45}end - for i=1,11 do L[i+22]={x=240,y=60+50*i,w=100,h=45}end - for i=1,11 do L[i+33]={x=345,y=60+50*i,w=100,h=45}end - for i=1,11 do L[i+44]={x=450,y=60+50*i,w=100,h=45}end - for i=1,11 do L[i+55]={x=555,y=60+50*i,w=100,h=45}end - for i=1,11 do L[i+66]={x=660,y=60+50*i,w=100,h=45}end - for i=1,11 do L[i+77]={x=765,y=60+50*i,w=100,h=45}end - for i=1,7 do L[i+88]= {x=870,y=60+50*i,w=100,h=45}end - for i=1,4 do L[i+95]= {x=975,y=60+50*i,w=100,h=45}end + for i=1,11 do L[i]= {x=30,y=60+50*i,w=100,h=45} end + for i=1,11 do L[i+11]={x=135,y=60+50*i,w=100,h=45} end + for i=1,11 do L[i+22]={x=240,y=60+50*i,w=100,h=45} end + for i=1,11 do L[i+33]={x=345,y=60+50*i,w=100,h=45} end + for i=1,11 do L[i+44]={x=450,y=60+50*i,w=100,h=45} end + for i=1,11 do L[i+55]={x=555,y=60+50*i,w=100,h=45} end + for i=1,11 do L[i+66]={x=660,y=60+50*i,w=100,h=45} end + for i=1,11 do L[i+77]={x=765,y=60+50*i,w=100,h=45} end + for i=1,7 do L[i+88]= {x=870,y=60+50*i,w=100,h=45} end + for i=1,4 do L[i+95]= {x=975,y=60+50*i,w=100,h=45} end return L end)(), } local posList -local function _placeSort(a,b)return a.place0 end +function NETPLY.getCount() return #PLYlist end +function NETPLY.getSID(uid) return PLYmap[uid].sid end +function NETPLY.getSelfJoinMode() return PLYmap[USER.uid].mode end +function NETPLY.getSelfReady() return PLYmap[USER.uid].mode>0 end -function NETPLY.setPlayerObj(ply,p)ply.p=p end -function NETPLY.setConf(uid,config)PLYmap[uid].config=config end +function NETPLY.setPlayerObj(ply,p) ply.p=p end +function NETPLY.setConf(uid,config) PLYmap[uid].config=config end function NETPLY.setJoinMode(uid,ready) for _,p in next,PLYlist do if p.uid==uid then @@ -162,8 +162,8 @@ function NETPLY.setJoinMode(uid,ready) end end end -function NETPLY.setConnect(uid)PLYmap[uid].connected=true end -function NETPLY.setPlace(uid,place)PLYmap[uid].place=place end +function NETPLY.setConnect(uid) PLYmap[uid].connected=true end +function NETPLY.setPlace(uid,place) PLYmap[uid].place=place end function NETPLY.setStat(uid,S) PLYmap[uid].stat={ lpm=("%.1f %s"):format(S.piece/S.time*24,text.radarData[5]), @@ -213,9 +213,9 @@ function NETPLY.draw() gc_translate(p.x,p.y) --Rectangle gc_setColor(COLOR[ - p.mode==0 and'lH'or - p.mode==1 and'N'or - p.mode==2 and'F' + p.mode==0 and 'lH' or + p.mode==1 and 'N' or + p.mode==2 and 'F' ]) gc_setLineWidth(2) gc_rectangle('line',0,0,p.w,p.h) @@ -249,7 +249,7 @@ function NETPLY.draw() --Stat local S=p.stat - if S and(p.h>=55 or p.w>=180)then + if S and (p.h>=55 or p.w>=180) then setFont(20) local x=p.w-155 if p.h>=55 then diff --git a/parts/player/draw.lua b/parts/player/draw.lua index 936d1f37..498e475c 100644 --- a/parts/player/draw.lua +++ b/parts/player/draw.lua @@ -26,9 +26,9 @@ local attackColor={ {COLOR.dG,COLOR.C}, } local hideBoardStencil={ - up=function()gc_rectangle('fill',0,-600,300,300,6)end, - down=function()gc_rectangle('fill',0,-300,300,300,6)end, - all=function()gc_rectangle('fill',0,-600,300,600,6)end, + up=function() gc_rectangle('fill',0,-600,300,300,6) end, + down=function() gc_rectangle('fill',0,-300,300,300,6) end, + all=function() gc_rectangle('fill',0,-600,300,600,6) end, } local dialFrame=TEXTURE.dial.frame local dialNeedle=TEXTURE.dial.needle @@ -98,23 +98,23 @@ local seqGenBanner=setmetatable({ end}) local LDmarks=gc.newSpriteBatch(GC.DO{14,5,{'fRect',0,0,14,5,3}},15,'static') -for i=0,14 do LDmarks:add(3+20*i,615)end +for i=0,14 do LDmarks:add(3+20*i,615) end local function _boardTransform(mode) if mode then - if mode=="U-D"then + if mode=="U-D" then gc_translate(0,590) gc_scale(1,-1) - elseif mode=="L-R"then + elseif mode=="L-R" then gc_translate(300,0) gc_scale(-1,1) - elseif mode=="180"then + elseif mode=="180" then gc_translate(300,590) gc_scale(-1,-1) end end end -local function _stencilBoard()gc_rectangle('fill',0,-10,300,610)end +local function _stencilBoard() gc_rectangle('fill',0,-10,300,610) end local function _applyField(P) gc_push('transform') @@ -175,7 +175,7 @@ local function _drawField(P,showInvis) gc_setShader(shader_lighter) gc_translate(0,-4) -- - for j=start,min(start+21,#F)do _drawRow(texture,j,V[j],F[j])end + for j=start,min(start+21,#F) do _drawRow(texture,j,V[j],F[j]) end -- gc_setShader(shader_fieldSatur) gc_translate(0,4) @@ -184,10 +184,10 @@ local function _drawField(P,showInvis) end -- - for j=start,min(start+21,#F)do _drawRow(texture,j,V[j],F[j],showInvis)end + for j=start,min(start+21,#F) do _drawRow(texture,j,V[j],F[j],showInvis) end -- else--With falling animation - local stepY=ENV.smooth and(P.falling/(ENV.fall+1))^1.6*30 or 30 + local stepY=ENV.smooth and (P.falling/(ENV.fall+1))^1.6*30 or 30 local alpha=P.falling/ENV.fall local h=1 if ENV.upEdge then @@ -195,8 +195,8 @@ local function _drawField(P,showInvis) gc_setShader(shader_lighter) gc_translate(0,-4) -- - for j=start,min(start+21,#F)do - while j==P.clearingRow[h]do + for j=start,min(start+21,#F) do + while j==P.clearingRow[h] do h=h+1 gc_translate(0,-stepY) end @@ -212,8 +212,8 @@ local function _drawField(P,showInvis) gc_push('transform') -- - for j=start,min(start+21,#F)do - while j==P.clearingRow[h]do + for j=start,min(start+21,#F) do + while j==P.clearingRow[h] do h=h+1 gc_translate(0,-stepY) gc_setColor(1,1,1,alpha) @@ -268,16 +268,16 @@ end local drawGhost={ color=function(CB,curX,ghoY,alpha,texture,clr) gc_setColor(1,1,1,alpha) - for i=1,#CB do for j=1,#CB[1]do - if CB[i][j]then + for i=1,#CB do for j=1,#CB[1] do + if CB[i][j] then gc_draw(texture[clr],30*(j+curX-1)-30,-30*(i+ghoY-1)) end end end end, gray=function(CB,curX,ghoY,alpha,texture,_) gc_setColor(1,1,1,alpha) - for i=1,#CB do for j=1,#CB[1]do - if CB[i][j]then + for i=1,#CB do for j=1,#CB[1] do + if CB[i][j] then gc_draw(texture[21],30*(j+curX-1)-30,-30*(i+ghoY-1)) end end end @@ -285,16 +285,16 @@ local drawGhost={ colorCell=function(CB,curX,ghoY,alpha,_,clr) clr=BLOCK_COLORS[clr] gc_setColor(clr[1],clr[2],clr[3],alpha) - for i=1,#CB do for j=1,#CB[1]do - if CB[i][j]then + for i=1,#CB do for j=1,#CB[1] do + if CB[i][j] then gc_rectangle('fill',30*(j+curX-1)-30,-30*(i+ghoY-1),30,30) end end end end, grayCell=function(CB,curX,ghoY,alpha,_,_) gc_setColor(1,1,1,alpha) - for i=1,#CB do for j=1,#CB[1]do - if CB[i][j]then + for i=1,#CB do for j=1,#CB[1] do + if CB[i][j] then gc_rectangle('fill',30*(j+curX-1)-30,-30*(i+ghoY-1),30,30) end end end @@ -303,8 +303,8 @@ local drawGhost={ clr=BLOCK_COLORS[clr] gc_setColor(clr[1],clr[2],clr[3],alpha) gc_setLineWidth(4) - for i=1,#CB do for j=1,#CB[1]do - if CB[i][j]then + for i=1,#CB do for j=1,#CB[1] do + if CB[i][j] then gc_rectangle('line',30*(j+curX-1)-30+4,-30*(i+ghoY-1)+4,22,22) end end end @@ -312,8 +312,8 @@ local drawGhost={ grayLine=function(CB,curX,ghoY,alpha,_,_) gc_setColor(1,1,1,alpha) gc_setLineWidth(4) - for i=1,#CB do for j=1,#CB[1]do - if CB[i][j]then + for i=1,#CB do for j=1,#CB[1] do + if CB[i][j] then gc_rectangle('line',30*(j+curX-1)-30+4,-30*(i+ghoY-1)+4,22,22) end end end @@ -322,8 +322,8 @@ local drawGhost={ local function _drawBlockOutline(CB,curX,curY,texture,trans) shader_alpha:send('a',trans) gc_setShader(shader_alpha) - for i=1,#CB do for j=1,#CB[1]do - if CB[i][j]then + for i=1,#CB do for j=1,#CB[1] do + if CB[i][j] then local x=30*(j+curX)-60-3 local y=30-30*(i+curY)-3 gc_draw(texture,x,y) @@ -336,8 +336,8 @@ local function _drawBlockOutline(CB,curX,curY,texture,trans) end local function _drawBlockShade(CB,curX,curY,alpha) gc_setColor(1,1,1,alpha) - for i=1,#CB do for j=1,#CB[1]do - if CB[i][j]then + for i=1,#CB do for j=1,#CB[1] do + if CB[i][j] then gc_rectangle('fill',30*(j+curX)-60,30-30*(i+curY),30,30) end end end @@ -345,8 +345,8 @@ end local function _drawBlock(CB,curX,curY,texture) gc_setColor(1,1,1) gc_setShader(shader_blockSatur) - for i=1,#CB do for j=1,#CB[1]do - if CB[i][j]then + for i=1,#CB do for j=1,#CB[1] do + if CB[i][j] then gc_draw(texture,30*(j+curX-1)-30,-30*(i+curY-1)) end end end @@ -358,8 +358,8 @@ local function _drawNextPreview(B,fieldH,fieldBeneath) B=B.bk local x=int(6-#B[1]*.5) local cross=TEXTURE.puzzleMark[-1] - for i=1,#B do for j=1,#B[1]do - if B[i][j]then + for i=1,#B do for j=1,#B[1] do + if B[i][j] then gc_draw(cross,30*(x+j-2),30*(1-y-i)) end end end @@ -370,8 +370,8 @@ local function _drawHoldPreview(B,fieldH,fieldBeneath) B=B.bk local x=int(6-#B[1]*.5) local cross=TEXTURE.puzzleMark[-1] - for i=1,#B do for j=1,#B[1]do - if B[i][j]then + for i=1,#B do for j=1,#B[1] do + if B[i][j] then gc_draw(cross,30*(x+j-2),30*(1-y-i)) end end end @@ -466,20 +466,20 @@ local function _drawHold(holdQueue,holdCount,holdTime,skinLib) gc_setLineWidth(2) gc_setColor(0,0,0,.4)gc_rectangle('fill',0,0,100,N+8,5) gc_setColor(.97,.97,.97)gc_rectangle('line',0,0,100,N+8,5) - N=#holdQueueENV.holdCount-P.holdTime then gc_setColor(1,1,1) hiding=false @@ -528,8 +528,8 @@ local function _drawNext(P,repMode) local bk,sprite=queue[N].bk,texture[queue[N].color] local k=min(2.3/#bk,3/#bk[1],.85) gc_scale(k) - for i=1,#bk do for j=1,#bk[1]do - if bk[i][j]then + for i=1,#bk do for j=1,#bk[1] do + if bk[i][j] then gc_draw(sprite,30*(j-#bk[1]*.5)-30,-30*(i-#bk*.5)) end end end @@ -545,7 +545,7 @@ local function _drawNext(P,repMode) gc_translate(50,-28) local blockImg=TEXTURE.miniBlock local n=N - while n<=10 and queue[n]do + while n<=10 and queue[n] do local id=queue[n].id local _=BLOCK_COLORS[queue[n].color] gc_setColor(_[1],_[2],_[3],.26) @@ -619,8 +619,8 @@ local function _drawLife(life) gc_draw(multiple,502,602) setFont(20)gc_print(life,517,595) else - if life>1 then gc_draw(IMG.lifeIcon,500,595,nil,.8)end - if life>2 then gc_draw(IMG.lifeIcon,525,595,nil,.8)end + if life>1 then gc_draw(IMG.lifeIcon,500,595,nil,.8) end + if life>2 then gc_draw(IMG.lifeIcon,525,595,nil,.8) end end end local function _drawMission(curMission,L,missionkill) @@ -654,13 +654,13 @@ local function _drawStartCounter(time) local d=time%60 if num==3 then r,g,b=.7,.8,.98 - if d>45 then gc_rotate((d-45)^2*.00355)end + if d>45 then gc_rotate((d-45)^2*.00355) end elseif num==2 then r,g,b=.98,.85,.75 - if d>45 then gc_scale(1+(d/15-3)^2,1)end + if d>45 then gc_scale(1+(d/15-3)^2,1) end elseif num==1 then r,g,b=1,.7,.7 - if d>45 then gc_scale(1,1+(d/15-3)^2)end + if d>45 then gc_scale(1,1+(d/15-3)^2) end end setFont(100) @@ -687,7 +687,7 @@ function draw.drawTargetLine(P,h) _applyField(P) h=600-30*h if P.falling~=-1 then - h=h-#P.clearingRow*(P.gameEnv.smooth and(P.falling/(P.gameEnv.fall+1))^1.6*30 or 30) + h=h-#P.clearingRow*(P.gameEnv.smooth and (P.falling/(P.gameEnv.fall+1))^1.6*30 or 30) end gc_line(0,h,300,h) _cancelField() @@ -725,11 +725,11 @@ function draw.norm(P,repMode) GC.mStr(P.username,300,-60) --Draw HUD - if ENV.nextCount>0 then _drawNext(P,repMode)end - if ENV.holdMode=='hold'and ENV.holdCount>0 then _drawHold(P.holdQueue,ENV.holdCount,P.holdTime,P.skinLib)end - if P.curMission then _drawMission(P.curMission,ENV.mission,ENV.missionKill)end + if ENV.nextCount>0 then _drawNext(P,repMode) end + if ENV.holdMode=='hold' and ENV.holdCount>0 then _drawHold(P.holdQueue,ENV.holdCount,P.holdTime,P.skinLib) end + if P.curMission then _drawMission(P.curMission,ENV.mission,ENV.missionKill) end _drawDial(499,505,P.dropSpeed) - if P.life>0 then _drawLife(P.life)end + if P.life>0 then _drawLife(P.life) end --Field-related things _applyField(P) @@ -805,7 +805,7 @@ function draw.norm(P,repMode) drawGhost.grayCell(P.cur.bk,P.curX,P.ghoY,.15,nil,nil) end - local dy=ENV.smooth and P.ghoY~=P.curY and(P.dropDelay/ENV.drop-1)*30 or 0 + local dy=ENV.smooth and P.ghoY~=P.curY and (P.dropDelay/ENV.drop-1)*30 or 0 gc_translate(0,-dy) --Draw block & rotation center if ENV.block then @@ -823,8 +823,8 @@ function draw.norm(P,repMode) --Draw next preview if ENV.nextPos then - if P.nextQueue[1]then _drawNextPreview(P.nextQueue[1],ENV.fieldH,P.fieldBeneath)end - if P.holdQueue[1]then _drawHoldPreview(P.holdQueue[1],ENV.fieldH,P.fieldBeneath)end + if P.nextQueue[1] then _drawNextPreview(P.nextQueue[1],ENV.fieldH,P.fieldBeneath) end + if P.holdQueue[1] then _drawHoldPreview(P.holdQueue[1],ENV.fieldH,P.fieldBeneath) end end --Draw AI's drop destination @@ -865,7 +865,7 @@ function draw.norm(P,repMode) _drawLDI(ENV.easyFresh,P.lockDelay/ENV.lock,P.freshTime) --Draw target selecting pad - if ENV.layout=='royale'then + if ENV.layout=='royale' then if P.atkMode then gc_setColor(1,.8,0,min(P.swappingAtkMode,30)*.02) gc_rectangle('fill',RCPB[2*P.atkMode-1],RCPB[2*P.atkMode],90,35,8,4) @@ -897,9 +897,9 @@ function draw.norm(P,repMode) --Display Ys -- gc_setLineWidth(6) - -- if P.curY then gc_setColor(COLOR.R)gc_line(0,611-P.curY*30,300,610-P.curY*30)end - -- if P.ghoY then gc_setColor(COLOR.G)gc_line(0,615-P.ghoY*30,300,615-P.ghoY*30)end - -- if P.minY then gc_setColor(COLOR.B)gc_line(0,619-P.minY*30,300,620-P.minY*30)end + -- if P.curY then gc_setColor(COLOR.R)gc_line(0,611-P.curY*30,300,610-P.curY*30) end + -- if P.ghoY then gc_setColor(COLOR.G)gc_line(0,615-P.ghoY*30,300,615-P.ghoY*30) end + -- if P.minY then gc_setColor(COLOR.B)gc_line(0,619-P.minY*30,300,620-P.minY*30) end -- gc_line(0,600-P.garbageBeneath*30,300,600-P.garbageBeneath*30) gc_pop() @@ -915,7 +915,7 @@ function draw.norm(P,repMode) gc_print(tm,20,540) --FinesseCombo - ;(P.type=='remote'and _drawFinesseCombo_remote or _drawFinesseCombo_norm)(P) + ;(P.type=='remote' and _drawFinesseCombo_remote or _drawFinesseCombo_norm)(P) --Mode informations for i=1,#ENV.mesDisp do @@ -956,7 +956,7 @@ function draw.small(P) end --Draw badge - if P.gameEnv.layout=='royale'then + if P.gameEnv.layout=='royale' then gc_setColor(1,1,1) for i=1,P.strength do gc_draw(IMG.badgeIcon,12*i-7,4,nil,.5) @@ -1005,7 +1005,7 @@ function draw.demo(P) drawGhost[ENV.ghostType](P.cur.bk,P.curX,P.ghoY,ENV.ghost,P.skinLib,curColor) end if ENV.block then - local dy=ENV.smooth and P.ghoY~=P.curY and(P.dropDelay/ENV.drop-1)*30 or 0 + local dy=ENV.smooth and P.ghoY~=P.curY and (P.dropDelay/ENV.drop-1)*30 or 0 gc_translate(0,-dy) _drawBlockOutline(P.cur.bk,P.curX,P.curY,P.skinLib[curColor],P.lockDelay/ENV.lock) _drawBlock(P.cur.bk,P.curX,P.curY,P.skinLib[curColor]) @@ -1019,7 +1019,7 @@ function draw.demo(P) --Draw hold local N=1 - while P.holdQueue[N]do + while P.holdQueue[N] do local id=P.holdQueue[N].id local _=BLOCK_COLORS[skinSet[id]] gc_setColor(_[1],_[2],_[3],.3) @@ -1030,7 +1030,7 @@ function draw.demo(P) --Draw next N=1 - while N<=ENV.nextCount and P.nextQueue[N]do + while N<=ENV.nextCount and P.nextQueue[N] do local id=P.nextQueue[N].id local _=BLOCK_COLORS[skinSet[id]] gc_setColor(_[1],_[2],_[3],.3) diff --git a/parts/player/init.lua b/parts/player/init.lua index d1de8d70..429bd585 100644 --- a/parts/player/init.lua +++ b/parts/player/init.lua @@ -12,8 +12,8 @@ local PLY={draw=ply_draw} local modeDataMeta do local rawset=rawset modeDataMeta={ - __index=function(self,k)rawset(self,k,0)return 0 end, - __newindex=function(self,k,v)rawset(self,k,v)end, + __index=function(self,k) rawset(self,k,0)return 0 end, + __newindex=function(self,k,v) rawset(self,k,v) end, } end local function _getNewStatTable() @@ -79,7 +79,7 @@ local function _newEmptyPlayer(id,mini) P.result=false--String: 'finish'|'win'|'lose' P.stat=_getNewStatTable() P.modeData=setmetatable({},modeDataMeta)--Data use by mode - P.keyPressing={}for i=1,12 do P.keyPressing[i]=false end + P.keyPressing={} for i=1,12 do P.keyPressing[i]=false end P.clearingRow,P.clearedRow={},{}--Clearing animation height,cleared row mark P.dropFX,P.moveFX,P.lockFX,P.clearFX={},{},{},{} -- P.destFX={}--Normally created by bot @@ -89,7 +89,7 @@ local function _newEmptyPlayer(id,mini) --Times P.frameRun=GAME.frameStart--Frame run, mainly for replay P.endCounter=0--Used after gameover - P.dropTime={}for i=1,10 do P.dropTime[i]=-1e99 end P.dropSpeed=0 + P.dropTime={} for i=1,10 do P.dropTime[i]=-1e99 end P.dropSpeed=0 P.stream={} P.streamProgress=false--1 to start play recording @@ -193,7 +193,7 @@ local function _loadGameEnv(P)--Load gameEnv -- else -- print("default-"..k..":"..tostring(v)) end - if type(v)~='table'then --Default setting + if type(v)~='table' then --Default setting ENV[k]=v else ENV[k]=TABLE.copy(v) @@ -224,7 +224,7 @@ local function _loadRemoteEnv(P,confStr)--Load gameEnv elseif SETTING[k]~=nil then v=SETTING[k] --Global setting end - if type(v)~='table'then--Default setting + if type(v)~='table' then--Default setting ENV[k]=v else ENV[k]=TABLE.copy(v) @@ -232,9 +232,9 @@ local function _loadRemoteEnv(P,confStr)--Load gameEnv end end local function _mergeFuncTable(f,L) - if type(f)=='function'then + if type(f)=='function' then ins(L,f) - elseif type(f)=='table'then + elseif type(f)=='table' then for i=1,#f do ins(L,f[i]) end @@ -251,19 +251,19 @@ local function _applyGameEnv(P)--Finish gameEnv processing ENV.task=_mergeFuncTable(ENV.task,{}) --Apply eventSet - if ENV.eventSet and ENV.eventSet~="X"then - if type(ENV.eventSet)=='string'then + if ENV.eventSet and ENV.eventSet~="X" then + if type(ENV.eventSet)=='string' then local eventSet=require('parts.eventsets.'..ENV.eventSet) if eventSet then for k,v in next,eventSet do if - k=='mesDisp'or - k=='hook_drop'or - k=='hook_die'or + k=='mesDisp' or + k=='hook_drop' or + k=='hook_die' or k=='task' then _mergeFuncTable(v,ENV[k]) - elseif type(v)=='table'then + elseif type(v)=='table' then ENV[k]=TABLE.copy(v) else ENV[k]=v @@ -301,19 +301,19 @@ local function _applyGameEnv(P)--Finish gameEnv processing P.skinLib=SKIN.lib[ENV.skinSet] P:setInvisible( - ENV.visible=='show'and -1 or - ENV.visible=='easy'and 300 or - ENV.visible=='slow'and 100 or - ENV.visible=='medium'and 60 or - ENV.visible=='fast'and 20 or - ENV.visible=='none'and 0 + ENV.visible=='show' and -1 or + ENV.visible=='easy' and 300 or + ENV.visible=='slow' and 100 or + ENV.visible=='medium' and 60 or + ENV.visible=='fast' and 20 or + ENV.visible=='none' and 0 ) P:set20G(P._20G) P:setHold(ENV.holdCount) P:setNext(ENV.nextCount) P:setRS(ENV.RS) - if type(ENV.mission)=='table'then + if type(ENV.mission)=='table' then P.curMission=1 end @@ -321,7 +321,7 @@ local function _applyGameEnv(P)--Finish gameEnv processing ENV.arr=max(ENV.arr,ENV.minarr) ENV.sdarr=max(ENV.sdarr,ENV.minsdarr) - ENV.bagLine=ENV.bagLine and(ENV.sequence=='bag'or ENV.sequence=='loop')and #ENV.seqData + ENV.bagLine=ENV.bagLine and (ENV.sequence=='bag' or ENV.sequence=='loop') and #ENV.seqData if ENV.nextCount==0 then ENV.nextPos=false @@ -332,7 +332,7 @@ local function _applyGameEnv(P)--Finish gameEnv processing if ENV.noInitSZO then for _=1,5 do local C=P.nextQueue[1] - if C and(C.id==1 or C.id==2 or C.id==6)then + if C and (C.id==1 or C.id==2 or C.id==6) then table.remove(P.nextQueue,1) else break @@ -363,7 +363,7 @@ local function _applyGameEnv(P)--Finish gameEnv processing if ENV.lineNum==0 then ENV.lineNum=false end --Load tasks - for i=1,#ENV.task do P:newTask(ENV.task[i])end + for i=1,#ENV.task do P:newTask(ENV.task[i]) end end ---------------------------------------------------- diff --git a/parts/player/player.lua b/parts/player/player.lua index 7d3e2d3e..4c9ee3b7 100644 --- a/parts/player/player.lua +++ b/parts/player/player.lua @@ -81,8 +81,8 @@ function Player:createLockFX() if L[j]==y then goto CONTINUE_skip end end y=-30*y - for j=1,#CB[1]do - if CB[i][j]then + for j=1,#CB[1] do + if CB[i][j] then ins(self.lockFX,{30*(self.curX+j-2),y,0,t}) end end @@ -112,28 +112,28 @@ function Player:createMoveFX(moveDir) local x=self.curX-1 local y=ENV.smooth and self.curY+self.dropDelay/ENV.drop-2 or self.curY-1 local L=self.moveFX - if moveDir=='left'then + if moveDir=='left' then for i=1,#CB do for j=#CB[1],1,-1 do - if CB[i][j]then + if CB[i][j] then ins(L,{C,x+j,y+i,0,spd}) break end end end - elseif moveDir=='right'then + elseif moveDir=='right' then for i=1,#CB do - for j=1,#CB[1]do - if CB[i][j]then + for j=1,#CB[1] do + if CB[i][j] then ins(L,{C,x+j,y+i,0,spd}) break end end end - elseif moveDir=='down'then - for j=1,#CB[1]do + elseif moveDir=='down' then + for j=1,#CB[1] do for i=#CB,1,-1 do - if CB[i][j]then + if CB[i][j] then ins(L,{C,x+j,y+i,0,spd}) break end @@ -141,8 +141,8 @@ function Player:createMoveFX(moveDir) end else for i=1,#CB do - for j=1,#CB[1]do - if CB[i][j]then + for j=1,#CB[1] do + if CB[i][j] then ins(L,{C,x+j,y+i,0,spd}) end end @@ -194,7 +194,7 @@ function Player:createBeam(R,send) local c=BLOCK_COLORS[C.color] local r,g,b=c[1]*2,c[2]*2,c[3]*2 local a=(power+2)*.0626 - if self.type~='human'and R.type~='human'then a=a*.2 end + if self.type~='human' and R.type~='human' then a=a*.2 end SYSFX.newAttack(1-power*.1,x1,y1,x2,y2,int(send^.7*(4+power)),r,g,b,a) end end @@ -204,7 +204,7 @@ end function Player:_deepDrop() local CB=self.cur.bk local y=self.curY-1 - while self:ifoverlap(CB,self.curX,y)and y>0 do + while self:ifoverlap(CB,self.curX,y) and y>0 do y=y-1 end if y>0 then @@ -222,7 +222,7 @@ function Player:act_moveLeft(auto) self.ctrlCount=self.ctrlCount+1 end if self.cur then - if self.cur and not self:ifoverlap(self.cur.bk,self.curX-1,self.curY)then + if self.cur and not self:ifoverlap(self.cur.bk,self.curX-1,self.curY) then self:createMoveFX('left') self.curX=self.curX-1 self:freshBlock('move') @@ -244,7 +244,7 @@ function Player:act_moveRight(auto) self.ctrlCount=self.ctrlCount+1 end if self.cur then - if self.cur and not self:ifoverlap(self.cur.bk,self.curX+1,self.curY)then + if self.cur and not self:ifoverlap(self.cur.bk,self.curX+1,self.curY) then self:createMoveFX('right') self.curX=self.curX+1 self:freshBlock('move') @@ -296,7 +296,7 @@ function Player:act_hardDrop() self.spinLast=false if self.sound then SFX.play('drop',nil,self:getCenterX()*.15) - if SETTING.vib>0 then VIB(SETTING.vib+1)end + if SETTING.vib>0 then VIB(SETTING.vib+1) end end end if ENV.shakeFX then @@ -333,7 +333,7 @@ end function Player:act_hold() if not self.control then return end if self.cur then - if self:hold()then + if self:hold() then self.keyPressing[8]=false end end @@ -353,7 +353,7 @@ function Player:act_insLeft(auto) return end local x0=self.curX - while not self:ifoverlap(self.cur.bk,self.curX-1,self.curY)do + while not self:ifoverlap(self.cur.bk,self.curX-1,self.curY) do self:createMoveFX('left') self.curX=self.curX-1 self:freshBlock('move',true) @@ -379,7 +379,7 @@ function Player:act_insRight(auto) return end local x0=self.curX - while not self:ifoverlap(self.cur.bk,self.curX+1,self.curY)do + while not self:ifoverlap(self.cur.bk,self.curX+1,self.curY) do self:createMoveFX('right') self.curX=self.curX+1 self:freshBlock('move',true) @@ -523,7 +523,7 @@ local playerActions={ VK.press(keyID) end end - if self.keyAvailable[keyID]and self.alive then + if self.keyAvailable[keyID] and self.alive then if self.waiting>self.gameEnv.hurry then self.waiting=self.gameEnv.hurry if self.waiting==0 and self.falling==0 then @@ -550,7 +550,7 @@ end function Player:newTask(code,...) local thread=coroutine.create(code) assert(resume(thread,self,...)) - if status(thread)~='dead'then + if status(thread)~='dead' then ins(self.tasks,{ thread=thread, code=code, @@ -610,7 +610,7 @@ function Player:switchKey(id,on) if not on then self:releaseKey(id) end - if self.type=='human'then + if self.type=='human' then VK.switchKey(id,on) end end @@ -633,7 +633,7 @@ function Player:setHold(count)--Set hold count (false/true as 0/1) self:switchKey(8,count>0) self.gameEnv.holdCount=count self.holdTime=count - while self.holdQueue[count+1]do rem(self.holdQueue)end + while self.holdQueue[count+1] do rem(self.holdQueue) end end function Player:setNext(next)--Set next count self.gameEnv.nextCount=next @@ -648,7 +648,7 @@ function Player:setInvisible(time)--Time in frames end end function Player:setRS(RSname) - local rs=RSlist[RSname]or RSlist.TRS + local rs=RSlist[RSname] or RSlist.TRS self.RS=rs --Reset all player's blocks' RSs @@ -661,7 +661,7 @@ end function Player:_triggerEvent(eventName) local L=self.gameEnv[eventName] - if L[1]then + if L[1] then for i=1,#L do L[i](self) end @@ -724,8 +724,8 @@ function Player:garbageRise(color,amount,line)--Release n-lines garbage to field _[3],_[5]=_[3]+amount,_[5]+amount end if - #self.field>self.gameEnv.heightLimit and( - not self:_triggerEvent('hook_die')or + #self.field>self.gameEnv.heightLimit and ( + not self:_triggerEvent('hook_die') or #self.field>self.gameEnv.heightLimit ) then @@ -741,11 +741,11 @@ function Player:pushLineList(L,mir)--Push some lines to field local r=FREEROW.new(0) if not mir then for j=1,10 do - r[j]=S[L[i][j]]or 0 + r[j]=S[L[i][j]] or 0 end else for j=1,10 do - r[j]=S[invList[L[i][11-j]]]or 0 + r[j]=S[invList[L[i][11-j]]] or 0 end end ins(self.field,1,r) @@ -760,7 +760,7 @@ function Player:pushLineList(L,mir)--Push some lines to field end function Player:pushNextList(L,mir)--Push some nexts to nextQueue for i=1,#L do - self:getNext(mir and invList[L[i]]or L[i]) + self:getNext(mir and invList[L[i]] or L[i]) end end @@ -791,9 +791,9 @@ function Player:ifoverlap(bk,x,y) return end for i=1,#bk do - if self.field[y+i-1]then + if self.field[y+i-1] then for j=1,C do - if bk[i][j]and self.field[y+i-1][x+j-1]>0 then + if bk[i][j] and self.field[y+i-1][x+j-1]>0 then return true end end @@ -802,7 +802,7 @@ function Player:ifoverlap(bk,x,y) end function Player:attack(R,send,time,line,fromStream) if GAME.net then - if self.type=='human'then--Local player attack others + if self.type=='human' then--Local player attack others ins(GAME.rep,self.frameRun) ins(GAME.rep, R.sid+ @@ -813,7 +813,7 @@ function Player:attack(R,send,time,line,fromStream) ) self:createBeam(R,send) end - if fromStream and R.type=='human'then--Local player receiving lines + if fromStream and R.type=='human' then--Local player receiving lines ins(GAME.rep,R.frameRun) ins(GAME.rep, self.sid+ @@ -850,7 +850,7 @@ function Player:receive(A,send,time,line) self.atkBufferSum=self.atkBufferSum+send self.stat.recv=self.stat.recv+send if self.sound then - SFX.play(send<4 and'warn_1'or'warn_2',min(send+1,5)*.1) + SFX.play(send<4 and 'warn_1' or 'warn_2',min(send+1,5)*.1) end if send>=2 then self:shakeField(send/2) @@ -899,7 +899,7 @@ function Player:changeAtkMode(m) end end function Player:changeAtk(R) - -- if self.type~='human'then R=PLAYERS[1]end--1vALL mode? + -- if self.type~='human' then R=PLAYERS[1] end--1vALL mode? if self.atking then local K=self.atking.atker local i=TABLE.find(K,self) @@ -917,14 +917,14 @@ end function Player:freshBlock(mode,ifTele)--string mode: push/move/fresh/newBlock local ENV=self.gameEnv --Fresh ghost - if(mode=='move'or mode=='newBlock'or mode=='push')and self.cur then + if (mode=='move' or mode=='newBlock' or mode=='push') and self.cur then local CB=self.cur.bk self.ghoY=min(#self.field+1,self.curY) - if self._20G or ENV.sdarr==0 and self.keyPressing[7]and self.downing>=ENV.sddas then + if self._20G or ENV.sdarr==0 and self.keyPressing[7] and self.downing>=ENV.sddas then local _=self.ghoY --Move ghost to bottom - while not self:ifoverlap(CB,self.curX,self.ghoY-1)do + while not self:ifoverlap(CB,self.curX,self.ghoY-1) do self.ghoY=self.ghoY-1 end @@ -942,20 +942,20 @@ function Player:freshBlock(mode,ifTele)--string mode: push/move/fresh/newBlock self.curY=self.ghoY end else - while not self:ifoverlap(CB,self.curX,self.ghoY-1)do + while not self:ifoverlap(CB,self.curX,self.ghoY-1) do self.ghoY=self.ghoY-1 end end end --Fresh delays - if mode=='move'or mode=='newBlock'or mode=='fresh'then + if mode=='move' or mode=='newBlock' or mode=='fresh' then local d0,l0=ENV.drop,ENV.lock local C=self.cur local sc=C.RS.centerPos[C.id][C.dir] if ENV.easyFresh then if self.lockDelay0 then - if mode~='newBlock'then + if mode~='newBlock' then self.freshTime=self.freshTime-1 end self.lockDelay=l0 @@ -979,7 +979,7 @@ function Player:freshBlock(mode,ifTele)--string mode: push/move/fresh/newBlock end --Play sound if touch ground - if mode=='move'and not ifTele then + if mode=='move' and not ifTele then self:checkTouchSound() end end @@ -987,12 +987,12 @@ function Player:lock() local CB=self.cur.bk for i=1,#CB do local y=self.curY+i-1 - if not self.field[y]then + if not self.field[y] then self.field[y]=FREEROW.new(0) self.visTime[y]=FREEROW.new(0) end - for j=1,#CB[1]do - if CB[i][j]then + for j=1,#CB[1] do + if CB[i][j] then self.field[y][self.curX+j-1]=self.cur.color self.visTime[y][self.curX+j-1]=self.showTime end @@ -1006,9 +1006,9 @@ function Player:_checkClear(field,start,height,CB,CX) local h=start+i-2 --Bomb trigger (optional, must with CB) - if CB and h>0 and field[h]and self.clearedRow[cc]~=h then - for x=1,#CB[1]do - if CB[i][x]and field[h][CX+x-1]==19 then + if CB and h>0 and field[h] and self.clearedRow[cc]~=h then + for x=1,#CB[1] do + if CB[i][x] and field[h][CX+x-1]==19 then cc=cc+1 self.clearingRow[cc]=h-cc+1 self.clearedRow[cc]=h @@ -1034,17 +1034,17 @@ function Player:_checkClear(field,start,height,CB,CX) end function Player:_roofCheck() local CB=self.cur.bk - for x=1,#CB[1]do + for x=1,#CB[1] do local y=#CB --Find the highest y of blocks' x-th column - while not CB[y][x]do y=y-1 end + while not CB[y][x] do y=y-1 end local testX=self.curX+x-1--Optimize --Test the whole column of field to find roof for testY=self.curY+y,#self.field do - if self:solid(testX,testY)then + if self:solid(testX,testY) then return true end end @@ -1065,7 +1065,7 @@ function Player:_updateFalling(val) self.falling=val if self.falling==0 then local L=#self.clearingRow - if self.sound and self.gameEnv.fall>0 and #self.field+L>self.clearingRow[L]then + if self.sound and self.gameEnv.fall>0 and #self.field+L>self.clearingRow[L] then SFX.play('fall') end TABLE.cut(self.clearingRow) @@ -1079,7 +1079,7 @@ function Player:removeTopClearingFX() break end end - if self.clearingRow[1]then + if self.clearingRow[1] then self:_updateFalling(self.gameEnv.fall) return false else @@ -1094,14 +1094,14 @@ function Player:_checkMission(piece,mission) elseif mission==9 then return piece.pc elseif mission<90 then - return piece.row==mission%10 and piece.name==int(mission/10)and piece.spin + return piece.row==mission%10 and piece.name==int(mission/10) and piece.spin end return false end function Player:_checkSuffocate() if - self:ifoverlap(self.cur.bk,self.curX,self.curY)and( - not self:_triggerEvent('hook_die')or + self:ifoverlap(self.cur.bk,self.curX,self.curY) and ( + not self:_triggerEvent('hook_die') or self:ifoverlap(self.cur.bk,self.curX,self.curY) ) then @@ -1122,24 +1122,24 @@ function Player:resetBlock()--Reset Block's position and execute I*S local pressing=self.keyPressing --IMS - if self.gameEnv.ims and(pressing[1]and self.movDir==-1 or pressing[2]and self.movDir==1)and self.moving>=self.gameEnv.das then + if self.gameEnv.ims and (pressing[1] and self.movDir==-1 or pressing[2] and self.movDir==1) and self.moving>=self.gameEnv.das then local x=self.curX+self.movDir - if not self:ifoverlap(C.bk,x,y)then + if not self:ifoverlap(C.bk,x,y) then self.curX=x end end --IRS if self.gameEnv.irs then - if pressing[5]then + if pressing[5] then self:spin(2,true) - elseif pressing[3]then - if pressing[4]then + elseif pressing[3] then + if pressing[4] then self:spin(2,true) else self:spin(1,true) end - elseif pressing[4]then + elseif pressing[4] then self:spin(3,true) end pressing[3],pressing[4],pressing[5]=false,false,false @@ -1165,12 +1165,12 @@ function Player:spin(d,ifpre) local C=self.cur local sc=C.RS.centerPos[C.id][C.dir] local kickData=C.RS.kickTable[C.id] - if type(kickData)=='table'then + if type(kickData)=='table' then local idir=(C.dir+d)%4 kickData=kickData[C.dir*10+idir] if not kickData then self:freshBlock('move') - SFX.play(ifpre and'prerotate'or'rotate',nil,self:getCenterX()*.15) + SFX.play(ifpre and 'prerotate' or 'rotate',nil,self:getCenterX()*.15) return end local icb=BLOCKS[C.id][idir] @@ -1178,7 +1178,7 @@ function Player:spin(d,ifpre) local baseX,baseY=self.curX+sc[2]-isc[2],self.curY+sc[1]-isc[1] for test=1,#kickData do local ix,iy=baseX+kickData[test][1],baseY+kickData[test][2] - if (self.freshTime>0 or kickData[test][2]<=0)and not self:ifoverlap(icb,ix,iy)then + if (self.freshTime>0 or kickData[test][2]<=0) and not self:ifoverlap(icb,ix,iy) then --Create moveFX at the original position self:createMoveFX() @@ -1200,7 +1200,7 @@ function Player:spin(d,ifpre) local sfx if ifpre then sfx='prerotate' - elseif self:ifoverlap(icb,ix,iy+1)and self:ifoverlap(icb,ix-1,iy)and self:ifoverlap(icb,ix+1,iy)then + elseif self:ifoverlap(icb,ix,iy+1) and self:ifoverlap(icb,ix-1,iy) and self:ifoverlap(icb,ix+1,iy) then sfx='rotatekick' self:_rotateField(d) else @@ -1217,7 +1217,7 @@ function Player:spin(d,ifpre) kickData(self,d) else self:freshBlock('move') - SFX.play(ifpre and'prerotate'or'rotate',nil,self:getCenterX()*.15) + SFX.play(ifpre and 'prerotate' or 'rotate',nil,self:getCenterX()*.15) end end local phyHoldKickX={ @@ -1226,7 +1226,7 @@ local phyHoldKickX={ } function Player:hold_norm(ifpre) local ENV=self.gameEnv - if #self.holdQueue0 and(self.cur or ifpre or force)then - if self.gameEnv.holdMode=='hold'then + if self.holdTime>0 and (self.cur or ifpre or force) then + if self.gameEnv.holdMode=='hold' then self:hold_norm(ifpre) - elseif self.gameEnv.holdMode=='swap'then + elseif self.gameEnv.holdMode=='swap' then self:hold_swap(ifpre) end return true @@ -1397,7 +1397,7 @@ function Player:popNext(ifhold)--Pop nextQueue to hand self.spinLast=false self.ctrlCount=0 - if self.nextQueue[1]then + if self.nextQueue[1] then self.cur=rem(self.nextQueue,1) self.newNext() self.pieceCount=self.pieceCount+1 @@ -1405,7 +1405,7 @@ function Player:popNext(ifhold)--Pop nextQueue to hand local pressing=self.keyPressing --IHS - if not ifhold and pressing[8]and ENV.ihs and self.holdTime>0 then + if not ifhold and pressing[8] and ENV.ihs and self.holdTime>0 then self:hold(true) pressing[8]=false else @@ -1422,11 +1422,11 @@ function Player:popNext(ifhold)--Pop nextQueue to hand end --IHdS - if pressing[6]and not ifhold then + if pressing[6] and not ifhold then self:act_hardDrop() pressing[6]=false end - elseif self.holdQueue[1]then--Force using hold + elseif self.holdQueue[1] then--Force using hold self:hold(true,true) else--Next queue is empty, force lose self:lose(true) @@ -1465,7 +1465,7 @@ do 3800,4200,4600,5000,5500,6000,--11~16 6500,7000,7500,8000,--17~20 10000,11500,13000,14500,16000--21~25 - },{__index=function(self,k)self[k]=20000 return 20000 end}) + },{__index=function(self,k) self[k]=20000 return 20000 end}) local spinSCR={ {200,750,1300,2000},--Z {200,750,1300,2000},--S @@ -1485,7 +1485,7 @@ do local spinVoice={'zspin','sspin','jspin','lspin','tspin','ospin','ispin','zspin','sspin','pspin','qspin','fspin','espin','tspin','uspin','vspin','wspin','xspin','jspin','lspin','rspin','yspin','nspin','hspin','ispin','ispin','cspin','ispin','ospin'} local clearVoice={'single','double','triple','techrash','pentacrash','hexacrash'} local spinSFX={[0]='spin_0','spin_1','spin_2'} - local renSFX={}for i=1,11 do renSFX[i]='ren_'..i end + local renSFX={} for i=1,11 do renSFX[i]='ren_'..i end local finesseList={ { {1,2,1,0,1,2,2,1}, @@ -1576,9 +1576,9 @@ do },--O1 } for k,v in next,finesseList do - if type(v)=='table'then + if type(v)=='table' then for d,l in next,v do - if type(l)=='number'then + if type(l)=='number' then v[d]=v[l] end end @@ -1616,11 +1616,11 @@ do if C.id<6 then local x,y=CX+sc[2],CY+sc[1] local c=0 - if self:solid(x-1,y+1)then c=c+1 end - if self:solid(x+1,y+1)then c=c+1 end + if self:solid(x-1,y+1) then c=c+1 end + if self:solid(x+1,y+1) then c=c+1 end if c~=0 then - if self:solid(x-1,y-1)then c=c+1 end - if self:solid(x+1,y-1)then c=c+1 end + if self:solid(x-1,y-1) then c=c+1 end + if self:solid(x+1,y-1) then c=c+1 end if c>2 then dospin=dospin+2 end @@ -1628,14 +1628,14 @@ do end end --Immovable spin check - if self:ifoverlap(CB,CX,CY+1)and self:ifoverlap(CB,CX-1,CY)and self:ifoverlap(CB,CX+1,CY)then + if self:ifoverlap(CB,CX,CY+1) and self:ifoverlap(CB,CX-1,CY) and self:ifoverlap(CB,CX+1,CY) then dospin=dospin+2 end self:lock() --Clear list of cleared-rows - if self.clearedRow[1]then + if self.clearedRow[1] then TABLE.cut(self.clearedRow) end @@ -1730,7 +1730,7 @@ do if cc>0 then--If lines cleared,about 200 lines of codes below cmb=cmb+1 if dospin then - cscore=(spinSCR[C.name]or spinSCR[8])[cc] + cscore=(spinSCR[C.name] or spinSCR[8])[cc] if self.b2b>800 then self:showText(text.b3b..text.block[C.name]..text.spin..text.clear[cc],0,-30,35,'stretch') yomi = yomi..text.b3b..text.block[C.name]..text.spin..text.clear[cc] @@ -1772,7 +1772,7 @@ do piece.mini=mini piece.special=true if self.sound then - SFX.play(spinSFX[cc]or'spin_3') + SFX.play(spinSFX[cc] or 'spin_3') VOC.play(spinVoice[C.name],CHN) end elseif cc>=4 then @@ -1815,7 +1815,7 @@ do piece.special=false end - if self.sound and(cc~=1 or dospin)then + if self.sound and (cc~=1 or dospin) then VOC.play(clearVoice[cc],CHN) end @@ -1826,7 +1826,7 @@ do if cmb>=3 then atk=atk+1 end - self:showText(text.cmb[min(cmb,21)],0,25,15+min(cmb,15)*5,cmb<10 and'appear'or'flicker') + self:showText(text.cmb[min(cmb,21)],0,25,15+min(cmb,15)*5,cmb<10 and 'appear' or 'flicker') yomi = yomi..' '..text.cmb[min(cmb,21)] cscore=cscore+min(50*cmb,500)*(2*cc-1) end @@ -1879,7 +1879,7 @@ do end --Bonus atk/def when focused - if ENV.layout=='royale'then + if ENV.layout=='royale' then local i=min(#self.atker,9) if i>1 then atk=atk+reAtk[i] @@ -1902,7 +1902,7 @@ do off=off+_ if send>0 then local T - if ENV.layout=='royale'then + if ENV.layout=='royale' then if self.atkMode==4 then local M=#self.atker if M>0 then @@ -1935,7 +1935,7 @@ do if cmb>14 then SFX.play('ren_mega',(cmb-10)*.1) end - if SETTING.vib>0 then VIB(SETTING.vib+cc+1)end + if SETTING.vib>0 then VIB(SETTING.vib+cc+1) end end else--No lines clear cmb=0 @@ -1990,7 +1990,7 @@ do --Check clearing task if cc>0 and self.curMission then - if self:_checkMission(piece,ENV.mission[self.curMission])then + if self:_checkMission(piece,ENV.mission[self.curMission]) then self.curMission=self.curMission+1 SFX.play('reach') if self.curMission>#ENV.mission then @@ -2010,9 +2010,9 @@ do self.waiting=ENV.wait --Prevent sudden death if hang>0 - if ENV.hang>ENV.wait and self.nextQueue[1]then + if ENV.hang>ENV.wait and self.nextQueue[1] then local B=self.nextQueue[1] - if self:ifoverlap(B.bk,int(6-#B.bk[1]*.5),int(ENV.fieldH+1-modf(B.RS.centerPos[B.id][B.dir][1]))+ceil(self.fieldBeneath/30))then + if self:ifoverlap(B.bk,int(6-#B.bk[1]*.5),int(ENV.fieldH+1-modf(B.RS.centerPos[B.id][B.dir][1]))+ceil(self.fieldBeneath/30)) then self.waiting=self.waiting+ENV.hang end end @@ -2025,7 +2025,7 @@ do end --Check height limit - if cc==0 and(#self.field>ENV.heightLimit or ENV.lockout and CY>ENV.fieldH)then + if cc==0 and (#self.field>ENV.heightLimit or ENV.lockout and CY>ENV.fieldH) then finish='lose' end @@ -2060,7 +2060,7 @@ do end if finish then - if finish=='lose'then + if finish=='lose' then self:lose() else self:_triggerEvent('hook_drop') @@ -2085,7 +2085,7 @@ do if _cc>0 then playClearSFX(_cc) self:showText(text.clear[min(_cc,21)],0,0,75,'beat',.4) - if _cc>6 then self:showText(text.cleared:gsub("$1",_cc),0,55,30,'zoomout',.4)end + if _cc>6 then self:showText(text.cleared:gsub("$1",_cc),0,55,30,'zoomout',.4) end self:_removeClearedLines() self:_updateFalling(self.gameEnv.fall) if _cc>=4 then @@ -2181,7 +2181,7 @@ local function task_lose(self) return end end - if not self.gameEnv.layout=='royale'and #PLAYERS>1 then + if not self.gameEnv.layout=='royale' and #PLAYERS>1 then self.y=self.y+self.endCounter*.26 self.absFieldY=self.absFieldY+self.endCounter*.26 end @@ -2192,7 +2192,7 @@ local function task_autoPause() while true do yield() time=time+1 - if SCN.cur~='game'or PLAYERS[1].frameRun<180 then + if SCN.cur~='game' or PLAYERS[1].frameRun<180 then return elseif time==120 then pauseGame() @@ -2253,7 +2253,7 @@ local function _updateMisc(P,dt) end local f=P.fieldUp if f~=y then - P.fieldUp=f>y and max(approach(f,y,dt*6)-2,y)or min(approach(f,y,dt*3)+1,y) + P.fieldUp=f>y and max(approach(f,y,dt*6)-2,y) or min(approach(f,y,dt*3)+1,y) end end @@ -2297,7 +2297,7 @@ local function _updateMisc(P,dt) for i=#L,1,-1 do local tr=L[i].thread assert(resume(tr)) - if status(tr)=='dead'then + if status(tr)=='dead' then rem(L,i) end end @@ -2345,11 +2345,11 @@ local function update_alive(P,dt) P.frameRun=P.frameRun+1 if P.frameRun<=180 then if P.frameRun==60 then - if P.id==1 then playReadySFX(2)end + if P.id==1 then playReadySFX(2) end elseif P.frameRun==120 then - if P.id==1 then playReadySFX(1)end + if P.id==1 then playReadySFX(1) end elseif P.frameRun==180 then - if P.id==1 then playReadySFX(0)end + if P.id==1 then playReadySFX(0) end P.control=true P.timing=true P:popNext() @@ -2372,11 +2372,11 @@ local function update_alive(P,dt) --Calculate drop speed do local v=0 - for i=2,10 do v=v+i*(i-1)*72/(P.frameRun-P.dropTime[i])end + for i=2,10 do v=v+i*(i-1)*72/(P.frameRun-P.dropTime[i]) end P.dropSpeed=approach(P.dropSpeed,v,dt) end - if P.gameEnv.layout=='royale'then + if P.gameEnv.layout=='royale' then local v=P.swappingAtkMode local tar=#P.field>15 and 4 or 8 if v~=tar then @@ -2403,10 +2403,10 @@ local function update_alive(P,dt) local mov=P.moving if P.cur then if P.movDir==1 then - if P.keyPressing[2]then + if P.keyPressing[2] then if arr>0 then if mov==das+arr or mov==das then - if not P.cur or P:ifoverlap(P.cur.bk,P.curX+1,P.curY)then + if not P.cur or P:ifoverlap(P.cur.bk,P.curX+1,P.curY) then mov=das+arr-1 else P:act_moveRight(true) @@ -2421,17 +2421,17 @@ local function update_alive(P,dt) mov=mov+1 end end - if mov>=das and ENV.shakeFX and P.cur and P:ifoverlap(P.cur.bk,P.curX+1,P.curY)then + if mov>=das and ENV.shakeFX and P.cur and P:ifoverlap(P.cur.bk,P.curX+1,P.curY) then P.swingOffset.vx=.5 end else P.movDir=0 end else - if P.keyPressing[1]then + if P.keyPressing[1] then if arr>0 then if mov==das+arr or mov==das then - if not P.cur or P:ifoverlap(P.cur.bk,P.curX-1,P.curY)then + if not P.cur or P:ifoverlap(P.cur.bk,P.curX-1,P.curY) then mov=das+arr-1 else P:act_moveLeft(true) @@ -2446,7 +2446,7 @@ local function update_alive(P,dt) mov=mov+1 end end - if mov>=das and ENV.shakeFX and P.cur and P:ifoverlap(P.cur.bk,P.curX-1,P.curY)then + if mov>=das and ENV.shakeFX and P.cur and P:ifoverlap(P.cur.bk,P.curX-1,P.curY) then P.swingOffset.vx=-.5 end else @@ -2457,16 +2457,16 @@ local function update_alive(P,dt) mov=mov+1 end P.moving=mov - elseif P.keyPressing[1]then + elseif P.keyPressing[1] then P.movDir=-1 P.moving=0 - elseif P.keyPressing[2]then + elseif P.keyPressing[2] then P.movDir=1 P.moving=0 end --Drop pressed - if P.keyPressing[7]then + if P.keyPressing[7] then P.downing=P.downing+1 if P.downing>=ENV.sddas then if ENV.sdarr==0 then @@ -2511,7 +2511,7 @@ local function update_alive(P,dt) local dist--Drop distance if D>1 then D=D-1 - if P.keyPressing[7]and P.downing>=ENV.sddas then + if P.keyPressing[7] and P.downing>=ENV.sddas then D=D-ceil(ENV.drop/ENV.sdarr) end if D<=0 then @@ -2522,7 +2522,7 @@ local function update_alive(P,dt) goto THROW_stop end elseif D==1 then--We don't know why dropDelay is 1, so checking ENV.drop>1 is neccessary - if ENV.drop>1 and P.downing>=ENV.sddas and(P.downing-ENV.sddas)%ENV.sdarr==0 then + if ENV.drop>1 and P.downing>=ENV.sddas and (P.downing-ENV.sddas)%ENV.sdarr==0 then dist=2 else dist=1 @@ -2531,7 +2531,7 @@ local function update_alive(P,dt) P.dropDelay=ENV.drop else--High gravity case (>1G) --Add extra 1 if time to auto softdrop - if P.downing>ENV.sddas and(P.downing-ENV.sddas)%ENV.sdarr==0 then + if P.downing>ENV.sddas and (P.downing-ENV.sddas)%ENV.sdarr==0 then dist=1/D+1 else dist=1/D @@ -2634,7 +2634,7 @@ local function update_dead(P,dt) --Final average speed P.dropSpeed=approach(P.dropSpeed,S.piece/S.frame*3600,dt) - if P.gameEnv.layout=='royale'then + if P.gameEnv.layout=='royale' then P.swappingAtkMode=min(P.swappingAtkMode+2,30) end @@ -2674,7 +2674,7 @@ function Player:update(dt) self.trigFrame=self.trigFrame+dt*60 if self.alive then local S=self.stat - if self.type=='computer'then self.bot:update(dt)end + if self.type=='computer' then self.bot:update(dt) end if self.trigFrame>=1 and self.alive then if self.streamProgress then S.time=self.stat.frame/60 @@ -2685,8 +2685,8 @@ function Player:update(dt) while self.trigFrame>=1 do if self.streamProgress then local frameDelta - if self.type=='remote'then - frameDelta=(self.stream[#self.stream-1]or 0)-self.frameRun + if self.type=='remote' then + frameDelta=(self.stream[#self.stream-1] or 0)-self.frameRun if frameDelta==0 then frameDelta=nil end else frameDelta=0 @@ -2751,31 +2751,31 @@ function Player:win(result) end self:_die() self.result='win' - if self.gameEnv.layout=='royale'then + if self.gameEnv.layout=='royale' then self.modeData.place=1 self:changeAtk() end - if result=='finish'then + if result=='finish' then for i=#PLY_ALIVE,1,-1 do if PLY_ALIVE[i]~=self then PLY_ALIVE[i]:lose(true) end end end - if self.type=='human'then - GAME.result=result or'gamewin' + if self.type=='human' then + GAME.result=result or 'gamewin' SFX.play('win') VOC.play('win') - if self.gameEnv.layout=='royale'then + if self.gameEnv.layout=='royale' then BGM.play('8-bit happiness') end end - if GAME.curMode.name=='custom_puzzle'then + if GAME.curMode.name=='custom_puzzle' then self:_showText(text.win,0,0,90,'beat',.4) else self:_showText(text.win,0,0,90,'beat',.5,.2) end - if self.type=='human'then + if self.type=='human' then gameOver() TASK.new(task_autoPause) end @@ -2789,15 +2789,15 @@ function Player:lose(force) if self.life>0 then self:revive() return - elseif self.type=='remote'then + elseif self.type=='remote' then self.waiting=1e99 return end end self:_die() self.result='lose' - do local p=TABLE.find(PLY_ALIVE,self)if p then rem(PLY_ALIVE,p)end end - if self.gameEnv.layout=='royale'then + do local p=TABLE.find(PLY_ALIVE,self) if p then rem(PLY_ALIVE,p) end end + if self.gameEnv.layout=='royale' then self:changeAtk() self.modeData.place=#PLY_ALIVE+1 self.strength=0 @@ -2812,7 +2812,7 @@ function Player:lose(force) end A.modeData.ko,A.badge=A.modeData.ko+1,A.badge+self.badge+1 for i=A.strength+1,4 do - if A.badge>=ROYALEDATA.powerUp[i]then + if A.badge>=ROYALEDATA.powerUp[i] then A.strength=i A:setFrameColor(i) end @@ -2828,19 +2828,19 @@ function Player:lose(force) freshMostBadge() freshMostDangerous() - if #PLY_ALIVE==ROYALEDATA.stage[GAME.stage]then + if #PLY_ALIVE==ROYALEDATA.stage[GAME.stage] then royaleLevelup() end self:_showText(self.modeData.place,0,120,60,'appear',.26,.9) end self.gameEnv.keepVisible=self.gameEnv.visible~='show' self:_showText(text.lose,0,0,90,'appear',.26,.9) - if self.type=='human'then + if self.type=='human' then GAME.result='gameover' SFX.play('fail') VOC.play('lose') - if self.gameEnv.layout=='royale'then - BGM.play('end') + if self.gameEnv.layout=='royale' then + BGM.play(' end') end gameOver() self:newTask(#PLAYERS>1 and task_lose or task_finish) diff --git a/parts/player/seqGenerators.lua b/parts/player/seqGenerators.lua index 2c6a86cb..dd6f81f6 100644 --- a/parts/player/seqGenerators.lua +++ b/parts/player/seqGenerators.lua @@ -2,7 +2,7 @@ local ins,rem=table.insert,table.remove local yield=coroutine.yield local seqGenerators={ - none=function()while true do yield()end end, + none=function() while true do yield() end end, bag=function(P,seq0) local rndGen=P.seqRND local len=#seq0 @@ -25,7 +25,7 @@ local seqGenerators={ local bag=TABLE.shift(seq0) do--Get a good first-bag --Shuffle - for i=1,len-1 do ins(bag,rem(bag,rndGen:random(len-i+1)))end + for i=1,len-1 do ins(bag,rem(bag,rndGen:random(len-i+1))) end --Skip Uncomfortable minoes for _=1,len-1 do if @@ -40,7 +40,7 @@ local seqGenerators={ end end --Finish - for i=1,len do P:getNext(bag[i])end + for i=1,len do P:getNext(bag[i]) end end bag={} while true do @@ -66,7 +66,7 @@ local seqGenerators={ for _=1,hisLen do--Reroll up to [hisLen] times r=rndGen:random(len) for i=1,hisLen do - if r==history[i]then + if r==history[i] then goto CONTINUE_rollAgain end end @@ -90,7 +90,7 @@ local seqGenerators={ local poolLen=5*len local droughtTimes=TABLE.new(len,len)--Drought times of seq0 - local pool={}for i=1,len do for _=1,5 do ins(pool,i)end end--5 times indexes of seq0 + local pool={} for i=1,len do for _=1,5 do ins(pool,i) end end--5 times indexes of seq0 local function _poolPick() local r=rndGen:random(poolLen) local res=pool[r] @@ -131,7 +131,7 @@ local seqGenerators={ ::REPEAT_pickAgain:: local r=_poolPick()--Random mino-index in pool for i=1,len do - if r==history[i]then + if r==history[i] then tryTime=tryTime+1 if tryTimeweight[maxK]then + if weight[i]>weight[maxK] then maxK=i end end @@ -178,7 +178,7 @@ local seqGenerators={ if #seq0==1 then local i=seq0[1] while true do - while #P.nextQueue<10 do P:getNext(i)end + while #P.nextQueue<10 do P:getNext(i) end yield() end else @@ -213,7 +213,7 @@ local seqGenerators={ while true do while #P.nextQueue<10 do if #bag==0 then - for i=1,#seq0 do bufferSeq[i]=seq0[i]end + for i=1,#seq0 do bufferSeq[i]=seq0[i] end repeat local r=rem(bufferSeq,rndGen:random(#bag)) local p=1 @@ -253,7 +253,7 @@ local seqGenerators={ end while true do while #P.nextQueue<10 do - if seq[1]then + if seq[1] then P:getNext(rem(seq)) else break @@ -265,13 +265,13 @@ local seqGenerators={ } return function(P)--Return a piece-generating function for player P local s=P.gameEnv.sequence - if type(s)=='function'then + if type(s)=='function' then return s - elseif type(s)=='string'and seqGenerators[s]then + elseif type(s)=='string' and seqGenerators[s] then return seqGenerators[s] else MES.new('warn', - type(s)=='string'and + type(s)=='string' and "No sequence mode called "..s or "Wrong sequence generator" ) diff --git a/parts/scenes/about.lua b/parts/scenes/about.lua index 16c83385..190109e9 100644 --- a/parts/scenes/about.lua +++ b/parts/scenes/about.lua @@ -16,7 +16,7 @@ end scene.touchDown=scene.mouseDown function scene.keyDown(key) - if key=='space'then + if key=='space' then loadGame('stack_e',true) else return true diff --git a/parts/scenes/app_15p.lua b/parts/scenes/app_15p.lua index 65a6dd5a..ed78300f 100644 --- a/parts/scenes/app_15p.lua +++ b/parts/scenes/app_15p.lua @@ -11,8 +11,8 @@ local move,push,state local color,invis='color1' local slide,pathVis,revKB -local function ifGaming()return state==1 end -local colorSelector=WIDGET.newSelector{name='color',x=150,y=240,w=200,list={'color1','rainbow','color2','gray','black'},color='lY',disp=function()return color end,code=function(v)if state~=1 then color=v end end,hideF=ifGaming} +local function ifGaming() return state==1 end +local colorSelector=WIDGET.newSelector{name='color',x=150,y=240,w=200,list={'color1','rainbow','color2','gray','black'},color='lY',disp=function() return color end,code=function(v) if state~=1 then color=v end end,hideF=ifGaming} function scene.sceneInit() BG.set('rainbow2') @@ -117,7 +117,7 @@ local function tapBoard(x,y,key) state=1 startTime=TIME() end - if checkBoard(b)then + if checkBoard(b) then state=2 time=TIME()-startTime SFX.play('win') @@ -129,43 +129,43 @@ local function tapBoard(x,y,key) end function scene.keyDown(key,isRep) if isRep then return end - if key=='up'then + if key=='up' then tapBoard(cx,cy-(revKB and 1 or -1),true) - elseif key=='down'then + elseif key=='down' then tapBoard(cx,cy+(revKB and 1 or -1),true) - elseif key=='left'then + elseif key=='left' then tapBoard(cx-(revKB and 1 or -1),cy,true) - elseif key=='right'then + elseif key=='right' then tapBoard(cx+(revKB and 1 or -1),cy,true) - elseif key=='space'then + elseif key=='space' then shuffleBoard() state=0 time=0 move,push=0,0 - elseif key=='q'then + elseif key=='q' then if state~=1 then - colorSelector:scroll(love.keyboard.isDown('lshift','rshift')and -1 or 1) + colorSelector:scroll(love.keyboard.isDown('lshift','rshift') and -1 or 1) end - elseif key=='w'then + elseif key=='w' then if state==0 then invis=not invis end - elseif key=='e'then + elseif key=='e' then if state==0 then slide=not slide if not slide then pathVis=false end end - elseif key=='r'then + elseif key=='r' then if state==0 and slide then pathVis=not pathVis end - elseif key=='t'then + elseif key=='t' then if state==0 then revKB=not revKB end - elseif key=='escape'then + elseif key=='escape' then SCN.back() end end @@ -286,7 +286,7 @@ function scene.draw() for j=1,4 do if cx~=j or cy~=i then local N=board[i][j] - local C=mono and'gray'or color + local C=mono and 'gray' or color gc.setColor(backColor[C][N]) gc.rectangle('fill',j*160+163,i*160-117,154,154,8) @@ -310,10 +310,10 @@ end scene.widgetList={ WIDGET.newButton{name='reset', x=160, y=100,w=180,h=100,color='lG',font=50,fText=CHAR.icon.retry_spin,code=pressKey'space'}, colorSelector, - WIDGET.newSwitch{name='invis', x=240, y=330,lim=200,font=40,disp=function()return invis end, code=pressKey'w',hideF=ifGaming}, - WIDGET.newSwitch{name='slide', x=240, y=420,lim=200,font=40,disp=function()return slide end, code=pressKey'e',hideF=ifGaming}, - WIDGET.newSwitch{name='pathVis',x=240, y=510,lim=200,font=40,disp=function()return pathVis end,code=pressKey'r',hideF=function()return state==1 or not slide end}, - WIDGET.newSwitch{name='revKB', x=240, y=600,lim=200,font=40,disp=function()return revKB end, code=pressKey't',hideF=ifGaming}, + WIDGET.newSwitch{name='invis', x=240, y=330,lim=200,font=40,disp=function() return invis end, code=pressKey'w',hideF=ifGaming}, + WIDGET.newSwitch{name='slide', x=240, y=420,lim=200,font=40,disp=function() return slide end, code=pressKey'e',hideF=ifGaming}, + WIDGET.newSwitch{name='pathVis',x=240, y=510,lim=200,font=40,disp=function() return pathVis end,code=pressKey'r',hideF=function() return state==1 or not slide end}, + WIDGET.newSwitch{name='revKB', x=240, y=600,lim=200,font=40,disp=function() return revKB end, code=pressKey't',hideF=ifGaming}, WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene}, } diff --git a/parts/scenes/app_2048.lua b/parts/scenes/app_2048.lua index 00964815..6066e175 100644 --- a/parts/scenes/app_2048.lua +++ b/parts/scenes/app_2048.lua @@ -65,7 +65,7 @@ local tileFont={ local tileName={[0]="X","2","4","8","16","32","64","128","256","512","1024","2048","4096","8192","16384","32768","65536","131072","262144","524288","2^20"} local function airExist() for i=1,16 do - if not board[i]then + if not board[i] then return true end end @@ -73,7 +73,7 @@ end local function newTile() --Select position & generate number nextPos=(nextPos+6)%16+1 - while board[nextPos]do + while board[nextPos] do nextPos=(nextPos-4)%16+1 end board[nextPos]=nextTile @@ -89,23 +89,23 @@ local function newTile() if nextCD>0 then nextTile=1 else - nextTile=MATH.roll(.9)and 2 or MATH.roll(.9)and 3 or 4 + nextTile=MATH.roll(.9) and 2 or MATH.roll(.9) and 3 or 4 nextCD=rnd(8,12) end --Check if board is full - if airExist()then return end + if airExist() then return end --Check if board is locked in all-directions for i=1,12 do - if board[i]==board[i+4]then + if board[i]==board[i+4] then return end end for i=1,13,4 do if - board[i+0]==board[i+1]or - board[i+1]==board[i+2]or + board[i+0]==board[i+1] or + board[i+1]==board[i+2] or board[i+2]==board[i+3] then return @@ -114,7 +114,7 @@ local function newTile() --Die. state=2 - SFX.play(maxTile>=10 and'win'or'fail') + SFX.play(maxTile>=10 and 'win' or 'fail') end local function freshMaxTile() maxTile=maxTile+1 @@ -129,7 +129,7 @@ local function squash(L) local moved=false while true do p2=p1+1 - while not L[p2]and p2<5 do + while not L[p2] and p2<5 do p2=p2+1 end if p2==5 then @@ -139,10 +139,10 @@ local function squash(L) p1=p1+1 end else - if not L[p1]then--air←2 + if not L[p1] then--air←2 L[p1],L[p2]=L[p2],false moved=true - elseif L[p1]==L[p2]then--2←2 + elseif L[p1]==L[p2] then--2←2 L[p1],L[p2]=L[p1]+1,false if L[p1]>maxTile then freshMaxTile() @@ -214,7 +214,7 @@ local function moveRight() end local function skip() if state==1 and skipper.cd==0 then - if airExist()then + if airExist() then skipper.cd=1024 skipper.used=true newTile() @@ -242,10 +242,10 @@ function scene.mouseDown(x,y,k) skip() else local dx,dy=x-640,y-360 - if abs(dx)<320 and abs(dy)<320 and(abs(dx)>60 or abs(dy)>60)then + if abs(dx)<320 and abs(dy)<320 and (abs(dx)>60 or abs(dy)>60) then scene.keyDown(abs(dx)-abs(dy)>0 and - (dx>0 and'right'or'left')or - (dy>0 and'down'or'up') + (dx>0 and 'right' or 'left') or + (dy>0 and 'down' or 'up') ) end end @@ -279,7 +279,7 @@ local function playRep(n) autoPressing=false end if move~=move0 then - if repeater.seq[n]~=repeater.last[n]then + if repeater.seq[n]~=repeater.last[n] then repeater.last[n]=repeater.seq[n] move=move0+#repeater.seq[n]/3+1 else @@ -290,14 +290,14 @@ local function playRep(n) end function scene.keyDown(key,isRep) if isRep then return end - if key=='up'or key=='down'or key=='left'or key=='right'then + if key=='up' or key=='down' or key=='left' or key=='right' then if repeater.focus then local f=repeater.focus if #repeater.seq[f]<24 then repeater.seq[f]=repeater.seq[f]..arrows[key] end else - if moveFunc[key]()then + if moveFunc[key]() then if state==0 then startTime=TIME() state=1 @@ -316,21 +316,21 @@ function scene.keyDown(key,isRep) end end end - elseif key=='space'then skip() - elseif key=='r'then reset() - elseif key=='q'then if state==0 then invis=not invis end - elseif key=='w'then if state==0 then tapControl=not tapControl end - elseif key=='1'or key=='2'then(kb.isDown('lshift','lctrl','lalt')and playRep or setFocus)(key=='1'and 1 or 2) - elseif key=='c1'then playRep(1) - elseif key=='c2'then playRep(2) - elseif key=='return'then + elseif key=='space' then skip() + elseif key=='r' then reset() + elseif key=='q' then if state==0 then invis=not invis end + elseif key=='w' then if state==0 then tapControl=not tapControl end + elseif key=='1' or key=='2' then (kb.isDown('lshift','lctrl','lalt') and playRep or setFocus)(key=='1' and 1 or 2) + elseif key=='c1' then playRep(1) + elseif key=='c2' then playRep(2) + elseif key=='return' then if repeater.focus then repeater.focus=false end - elseif key=='escape'then + elseif key=='escape' then if repeater.focus then repeater.focus=false - elseif tryBack()then + elseif tryBack() then SCN.back() end end @@ -363,13 +363,13 @@ function scene.draw() setFont(25) for i=1,2 do setColor(COLOR[ - repeater.focus==i and( + repeater.focus==i and ( TIME()%.5>.25 and - 'R'or + 'R' or 'Y' - )or( - repeater.seq[i]==repeater.last[i]and - 'H'or + ) or ( + repeater.seq[i]==repeater.last[i] and + 'H' or 'Z' ) ]) @@ -399,12 +399,12 @@ function scene.draw() --Board for i=1,16 do - if board[i]then + if board[i] then local x,y=1+(i-1)%4,int((i+3)/4) local N=board[i] if i~=prevPos or prevSpawnTime==1 then if not invis or i==prevPos then - setColor(tileColor[N]or COLOR.D) + setColor(tileColor[N] or COLOR.D) rectangle('fill',x*160+163,y*160-117,154,154,15) if N>=0 then setColor(N<3 and COLOR.D or COLOR.Z) @@ -480,18 +480,18 @@ end scene.widgetList={ WIDGET.newButton{name='reset', x=155, y=100,w=180,h=100,color='lG',font=50,fText=CHAR.icon.retry_spin,code=pressKey'r'}, - WIDGET.newSwitch{name='invis', x=240, y=300,lim=200,font=40,disp=function()return invis end,code=pressKey'q',hideF=function()return state==1 end}, - WIDGET.newSwitch{name='tapControl',x=240, y=370,lim=200,font=40,disp=function()return tapControl end,code=pressKey'w',hideF=function()return state==1 end}, + WIDGET.newSwitch{name='invis', x=240, y=300,lim=200,font=40,disp=function() return invis end,code=pressKey'q',hideF=function() return state==1 end}, + WIDGET.newSwitch{name='tapControl',x=240, y=370,lim=200,font=40,disp=function() return tapControl end,code=pressKey'w',hideF=function() return state==1 end}, - WIDGET.newKey{name='up', x=155, y=460,w=100,fText="↑",font=50, color='Y',code=pressKey'up', hideF=function()return tapControl end}, - WIDGET.newKey{name='down', x=155, y=660,w=100,fText="↓",font=50, color='Y',code=pressKey'down', hideF=function()return tapControl end}, - WIDGET.newKey{name='left', x=55, y=560,w=100,fText="←",font=50, color='Y',code=pressKey'left', hideF=function()return tapControl end}, - WIDGET.newKey{name='right', x=255, y=560,w=100,fText="→",font=50,color='Y',code=pressKey'right', hideF=function()return tapControl end}, - WIDGET.newKey{name='skip', x=155, y=400,w=100,font=20, color='Y',code=pressKey'space', hideF=function()return state~=1 or not skipper.cd or skipper.cd>0 end}, - WIDGET.newKey{name='record1', x=1100,y=390,w=220,h=50,fText="", color='H',code=pressKey'1', hideF=function()return state==2 end}, - WIDGET.newKey{name='record2', x=1100,y=450,w=220,h=50,fText="", color='H',code=pressKey'2', hideF=function()return state==2 end}, - WIDGET.newKey{name='replay1', x=1245,y=390,w=50,fText="!", color='G',code=pressKey'c1', hideF=function()return state==2 or #repeater.seq[1]==0 end}, - WIDGET.newKey{name='replay2', x=1245,y=450,w=50,fText="!", color='G',code=pressKey'c2', hideF=function()return state==2 or #repeater.seq[2]==0 end}, + WIDGET.newKey{name='up', x=155, y=460,w=100,fText="↑",font=50, color='Y',code=pressKey'up', hideF=function() return tapControl end}, + WIDGET.newKey{name='down', x=155, y=660,w=100,fText="↓",font=50, color='Y',code=pressKey'down', hideF=function() return tapControl end}, + WIDGET.newKey{name='left', x=55, y=560,w=100,fText="←",font=50, color='Y',code=pressKey'left', hideF=function() return tapControl end}, + WIDGET.newKey{name='right', x=255, y=560,w=100,fText="→",font=50,color='Y',code=pressKey'right', hideF=function() return tapControl end}, + WIDGET.newKey{name='skip', x=155, y=400,w=100,font=20, color='Y',code=pressKey'space', hideF=function() return state~=1 or not skipper.cd or skipper.cd>0 end}, + WIDGET.newKey{name='record1', x=1100,y=390,w=220,h=50,fText="", color='H',code=pressKey'1', hideF=function() return state==2 end}, + WIDGET.newKey{name='record2', x=1100,y=450,w=220,h=50,fText="", color='H',code=pressKey'2', hideF=function() return state==2 end}, + WIDGET.newKey{name='replay1', x=1245,y=390,w=50,fText="!", color='G',code=pressKey'c1', hideF=function() return state==2 or #repeater.seq[1]==0 end}, + WIDGET.newKey{name='replay2', x=1245,y=450,w=50,fText="!", color='G',code=pressKey'c2', hideF=function() return state==2 or #repeater.seq[2]==0 end}, WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene}, } diff --git a/parts/scenes/app_AtoZ.lua b/parts/scenes/app_AtoZ.lua index 6978a58b..90fbbbb5 100644 --- a/parts/scenes/app_AtoZ.lua +++ b/parts/scenes/app_AtoZ.lua @@ -46,7 +46,7 @@ function scene.keyDown(key,isRep) if isRep then return end if #key==1 then if state<2 and frameKeyCount<3 then - if key:upper():byte()==targetString:byte(progress)then + if key:upper():byte()==targetString:byte(progress) then progress=progress+1 frameKeyCount=frameKeyCount+1 TEXT.show(key:upper(),rnd(320,960),rnd(100,240),90,'score',2.6) @@ -64,16 +64,16 @@ function scene.keyDown(key,isRep) SFX.play('finesseError') end end - elseif key=='left'or key=='right'then + elseif key=='left' or key=='right' then if state==0 then - scene.widgetList.level:scroll(key=='left'and -1 or 1) + scene.widgetList.level:scroll(key=='left' and -1 or 1) end - elseif key=='space'then + elseif key=='space' then progress=1 mistake=0 time=0 state=0 - elseif key=='escape'then + elseif key=='escape' then SCN.back() end end @@ -104,7 +104,7 @@ function scene.draw() end FONT.set(100) - GC.mStr(state==1 and #targetString-progress+1 or state==0 and"Ready"or state==2 and"Win",640,200) + GC.mStr(state==1 and #targetString-progress+1 or state==0 and "Ready" or state==2 and "Win",640,200) gc.setColor(COLOR.Z) gc.print(targetString:sub(progress,progress),120,280,0,2) @@ -116,9 +116,9 @@ function scene.draw() end scene.widgetList={ - WIDGET.newSelector{name='level', x=640,y=640,w=200,list={'A_Z','Z_A','Tech1','Tech2','KeyTest1','KeyTest2','Hello','Roll1','Roll2','Roll3','ZZZ','ZXZX','ZMZM','Stair','Stair2','Stair3','BPW'},disp=function()return levelName end,code=function(i)levelName=i;targetString=levels[i]end,hideF=function()return state>0 end}, + WIDGET.newSelector{name='level', x=640,y=640,w=200,list={'A_Z','Z_A','Tech1','Tech2','KeyTest1','KeyTest2','Hello','Roll1','Roll2','Roll3','ZZZ','ZXZX','ZMZM','Stair','Stair2','Stair3','BPW'},disp=function() return levelName end,code=function(i) levelName=i; targetString=levels[i] end,hideF=function() return state>0 end}, WIDGET.newButton{name='reset', x=160,y=100,w=180,h=100,color='lG',font=50,fText=CHAR.icon.retry_spin,code=pressKey'space'}, - WIDGET.newButton{name='keyboard',x=160,y=210,w=180,h=100,code=function()love.keyboard.setTextInput(true,0,select(2,SCR.xOy:transformPoint(0,500)),1,1)end,hide=not MOBILE}, + WIDGET.newButton{name='keyboard',x=160,y=210,w=180,h=100,code=function() love.keyboard.setTextInput(true,0,select(2,SCR.xOy:transformPoint(0,500)),1,1) end,hide=not MOBILE}, WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene}, } diff --git a/parts/scenes/app_UTTT.lua b/parts/scenes/app_UTTT.lua index 8b84280d..db9f8e7c 100644 --- a/parts/scenes/app_UTTT.lua +++ b/parts/scenes/app_UTTT.lua @@ -49,7 +49,7 @@ local function checkBoard(b,p) end local function full(L) for i=1,9 do - if not L[i]then + if not L[i] then return false end end @@ -61,30 +61,30 @@ local function place(X,x) lastX,lastx=X,x curX,curx=nil placeTime=TIME() - if checkBoard(board[X],round)then + if checkBoard(board[X],round) then score[X]=round - if checkBoard(score,round)then + if checkBoard(score,round) then gameover=round SFX.play('win') return else - if full(score)then + if full(score) then gameover=true return end end SFX.play('reach') else - if full(board[X])then + if full(board[X]) then SFX.play('emit') score[X]=true - if full(score)then + if full(score) then gameover=true return end end end - if score[x]then + if score[x] then target=false else target=x @@ -108,9 +108,9 @@ function scene.mouseMove(x,y) y<0 or y>8 or curX<1 or curX>9 or curx<1 or curx>9 or - score[curX]or - not(target==curX or not target)or - board[curX][curx]or + score[curX] or + not (target==curX or not target) or + board[curX][curx] or gameover then curX,curx=nil @@ -154,7 +154,7 @@ function scene.draw() gc.setLineWidth(.8) for X=1,9 do - if score[X]then + if score[X] then if score[X]==0 then gc.setColor(.5,0,0) elseif score[X]==1 then diff --git a/parts/scenes/app_arithmetic.lua b/parts/scenes/app_arithmetic.lua index 77ccd1e4..a7e0b117 100644 --- a/parts/scenes/app_arithmetic.lua +++ b/parts/scenes/app_arithmetic.lua @@ -116,8 +116,8 @@ local levels={ local a=rnd(17,int(s/2)) return{COLOR.J,b16(a),COLOR.Z,"+",COLOR.J,b16(s-a)},s end,nil,nil, - function()timing=false return "Coming S∞n"..(rnd()<.5 and""or" "),1e99 end, -}setmetatable(levels,{__index=function(self,k)return self[k-1]end}) + function() timing=false return "Coming S∞n"..(rnd()<.5 and "" or " "),1e99 end, +}setmetatable(levels,{__index=function(self,k) return self[k-1] end}) local level @@ -160,17 +160,17 @@ end function scene.keyDown(key,isRep) if isRep then return end - if key:sub(1,2)=="kp"then key=key:sub(3)end - if #key==1 and("0123456789"):find(key,nil,true)then + if key:sub(1,2)=="kp" then key=key:sub(3) end + if #key==1 and ("0123456789"):find(key,nil,true) then if #input<8 then input=input..key inputTime=1 check(tonumber(input)) SFX.play('touch') end - elseif key=='-'then + elseif key=='-' then if #input<8 then - if input:find("-")then + if input:find("-") then input=input:sub(2) else input="-"..input @@ -179,13 +179,13 @@ function scene.keyDown(key,isRep) check(tonumber(input)) SFX.play('hold') end - elseif key=='backspace'then + elseif key=='backspace' then input="" inputTime=0 - elseif key=='r'then + elseif key=='r' then reset() - elseif key=='escape'then - if tryBack()then + elseif key=='escape' then + if tryBack() then SCN.back() end end @@ -209,7 +209,7 @@ function scene.draw() GC.mStr("["..level.."]",640,30) FONT.set(80) - if type(question)=='table'then gc.setColor(1,1,1)end + if type(question)=='table' then gc.setColor(1,1,1) end GC.mStr(question,640,60) FONT.set(80) diff --git a/parts/scenes/app_calc.lua b/parts/scenes/app_calc.lua index 427d4fdc..1a5cd949 100644 --- a/parts/scenes/app_calc.lua +++ b/parts/scenes/app_calc.lua @@ -35,26 +35,26 @@ end scene.mouseDown=NULL function scene.keyDown(key) - if kb.isDown('lshift','rshift')then - if key=='='then + if kb.isDown('lshift','rshift') then + if key=='=' then scene.keyDown('+') return - elseif kb.isDown('lshift','rshift')and key=='8'then + elseif kb.isDown('lshift','rshift') and key=='8' then scene.keyDown('*') return end - elseif key:sub(1,2)=='kp'then + elseif key:sub(1,2)=='kp' then scene.keyDown(key:sub(3)) return end - if keySounds[key]then + if keySounds[key] then Snd('bell',keySounds[key]) end - if key=='.'then - if sym=="="then + if key=='.' then + if sym=="=" then sym,reg=false,false val="0." - elseif not(val:find(".",nil,true)or val:find("e"))then + elseif not (val:find(".",nil,true) or val:find("e")) then if sym and not reg then reg=val val="0." @@ -62,38 +62,38 @@ function scene.keyDown(key) val=val.."." end end - elseif key=='e'then - if sym=="="then + elseif key=='e' then + if sym=="=" then sym,reg=false val="0e" - elseif not val:find("e")then + elseif not val:find("e") then val=val.."e" end - elseif key=='backspace'then - if sym=="="then + elseif key=='backspace' then + if sym=="=" then val="" elseif sym then sym=false else val=val:sub(1,-2) end - if val==""then + if val=="" then val="0" end - elseif key=='+'then + elseif key=='+' then _autoReturn() sym="+" - elseif key=='*'then + elseif key=='*' then _autoReturn() sym="*" - elseif key=='-'then + elseif key=='-' then _autoReturn() sym="-" - elseif key=='/'then + elseif key=='/' then _autoReturn() sym="/" elseif key:byte()>=48 and key:byte()<=57 then - if sym=="="then + if sym=="=" then val=key sym=false elseif sym and not reg then @@ -101,35 +101,35 @@ function scene.keyDown(key) val=key else if #val<14 then - if val=="0"then + if val=="0" then val="" end val=val..key end end - elseif key=='return'then + elseif key=='return' then scene.keyDown('calculate') - elseif key=='calculate'then + elseif key=='calculate' then val=val:gsub("e$","") if sym and reg then reg=reg:gsub("e$","") val= - sym=="+"and tostring((tonumber(reg)or 0)+tonumber(val))or - sym=="-"and tostring((tonumber(reg)or 0)-tonumber(val))or - sym=="*"and tostring((tonumber(reg)or 0)*tonumber(val))or - sym=="/"and tostring((tonumber(reg)or 0)/tonumber(val))or + sym=="+" and tostring((tonumber(reg) or 0)+tonumber(val)) or + sym=="-" and tostring((tonumber(reg) or 0)-tonumber(val)) or + sym=="*" and tostring((tonumber(reg) or 0)*tonumber(val)) or + sym=="/" and tostring((tonumber(reg) or 0)/tonumber(val)) or "-1" end sym="=" reg=false - elseif key=='escape'then - if val~="0"then + elseif key=='escape' then + if val~="0" then reg,sym=false,false val="0" else SCN.back() end - elseif key=='delete'then + elseif key=='delete' then val="0" end end @@ -141,9 +141,9 @@ function scene.draw() gc.setLineWidth(2) gc.rectangle('line',100,80,650,150,5) FONT.set(45) - if reg then gc.printf(reg,0,100,720,'right')end - if val then gc.printf(val,0,150,720,'right')end - if sym then FONT.set(50)gc.print(sym,126,150)end + if reg then gc.printf(reg,0,100,720,'right') end + if val then gc.printf(val,0,150,720,'right') end + if sym then FONT.set(50)gc.print(sym,126,150) end end scene.widgetList={ diff --git a/parts/scenes/app_cannon.lua b/parts/scenes/app_cannon.lua index 86a65ed1..a6fd855c 100644 --- a/parts/scenes/app_cannon.lua +++ b/parts/scenes/app_cannon.lua @@ -19,7 +19,7 @@ end function scene.keyDown(key,isRep) if isRep then return end - if key=='space'or key=='return'then + if key=='space' or key=='return' then if state==0 then state=1 elseif state==1 then @@ -27,8 +27,8 @@ function scene.keyDown(key,isRep) vx=pow*cos(ang)/2.6 vy=pow*sin(ang)/2.6 end - elseif key=='escape'then - if tryBack()then + elseif key=='escape' then + if tryBack() then SCN.back() end end @@ -110,7 +110,7 @@ function scene.draw() gc.setColor(1,1,.6) gc.print("x"..combo,300,80) end - gc.setColor(COLOR[scoreColor[int(score/20)+1]or'D']) + gc.setColor(COLOR[scoreColor[int(score/20)+1] or 'D']) gc.print(score,300,30) --Cannon ball diff --git a/parts/scenes/app_console.lua b/parts/scenes/app_console.lua index f6e94391..344b3872 100644 --- a/parts/scenes/app_console.lua +++ b/parts/scenes/app_console.lua @@ -6,7 +6,7 @@ local C=COLOR local inputBox=WIDGET.newInputBox{name='input',x=40,y=650,w=1200,h=50,fType='mono'} local outputBox=WIDGET.newTextBox{name='output',x=40,y=30,w=1200,h=610,font=25,fType='mono',lineH=25,fix=true} -local function log(str)outputBox:push(str)end +local function log(str) outputBox:push(str) end _SCLOG=log log{C.lP,"Techmino Console"} @@ -17,7 +17,7 @@ local history,hisPtr={"?"} local sumode=false local the_secret=(0xe^2*10)..(2*0xb) -local commands={}do +local commands={} do --[[ format of elements in table 'commands': key: the command name @@ -34,12 +34,12 @@ local commands={}do code=function(arg) if #arg>0 then --help [command] - if commands[arg]then + if commands[arg] then if commands[arg].description then log{C.H,("%s"):format(commands[arg].description)} end if commands[arg].details then - for _,v in ipairs(commands[arg].details)do log(v)end + for _,v in ipairs(commands[arg].details) do log(v) end else log{C.Y,("No details for command '%s'"):format(arg)} end @@ -93,7 +93,7 @@ local commands={}do }, }commands.quit="exit" commands.echo={ - code=function(str)if str~=""then log(str)end end, + code=function(str) if str~="" then log(str) end end, description="Print a message", details={ "Print a message to this window.", @@ -102,7 +102,7 @@ local commands={}do }, } commands.cls={ - code=function()outputBox:clear()end, + code=function() outputBox:clear() end, description="Clear the window", details={ "Clear the log output.", @@ -115,9 +115,9 @@ local commands={}do do--tree local function tree(path,name,depth) local info=love.filesystem.getInfo(path..name) - if info.type=='file'then + if info.type=='file' then log(("\t\t"):rep(depth)..name) - elseif info.type=='directory'then + elseif info.type=='directory' then log(("\t\t"):rep(depth)..name..">") local L=love.filesystem.getDirectoryItems(path..name) for _,subName in next,L do @@ -146,7 +146,7 @@ local commands={}do end do--del local function delFile(name) - if love.filesystem.remove(name)then + if love.filesystem.remove(name) then log{C.Y,("Deleted: '%s'"):format(name)} else log{C.R,("Failed to delete: '%s'"):format(name)} @@ -154,7 +154,7 @@ local commands={}do end local function delDir(name) if #love.filesystem.getDirectoryItems(name)==0 then - if love.filesystem.remove(name)then + if love.filesystem.remove(name) then log{C.Y,("Directory deleted: '%s'"):format(name)} else log{C.R,("Failed to delete directory '%s'"):format(name)} @@ -166,7 +166,7 @@ local commands={}do local function recursiveDelDir(dir) local containing=love.filesystem.getDirectoryItems(dir) if #containing==0 then - if love.filesystem.remove(dir)then + if love.filesystem.remove(dir) then log{C.Y,("Succesfully deleted directory '%s'"):format(dir)} else log{C.R,("Failed to delete directory '%s'"):format(dir)} @@ -176,9 +176,9 @@ local commands={}do local path=dir.."/"..name local info=love.filesystem.getInfo(path) if info then - if info.type=='file'then + if info.type=='file' then delFile(path) - elseif info.type=='directory'then + elseif info.type=='directory' then recursiveDelDir(path) else log("Unknown item type: %s (%s)"):format(name,info.type) @@ -195,16 +195,16 @@ local commands={}do name=name:sub(4) end - if name~=""then + if name~="" then local info=love.filesystem.getInfo(name) if info then - if info.type=='file'then + if info.type=='file' then if not recursive then delFile(name) else log{C.R,("'%s' is not a directory."):format(name)} end - elseif info.type=='directory'then + elseif info.type=='directory' then (recursive and recursiveDelDir or delDir)(name) else log("Unknown item type: %s (%s)"):format(name,info.type) @@ -244,7 +244,7 @@ local commands={}do --Check file exist local info info=love.filesystem.getInfo(arg[1]) - if not(info and info.type=='file')then + if not (info and info.type=='file') then log{C.R,("'%s' is not a file!"):format(arg[1])} return end @@ -257,19 +257,19 @@ local commands={}do --Read file local data,err1=love.filesystem.read('data',arg[1]) if not data then - log{C.R,("Failed to read file '%s': "):format(arg[1],err1 or"Unknown error")} + log{C.R,("Failed to read file '%s': "):format(arg[1],err1 or "Unknown error")} return end --Write file local res,err2=love.filesystem.write(arg[2],data) if not res then - log{C.R,("Failed to write file: "):format(err2 or"Unknown error")} + log{C.R,("Failed to write file: "):format(err2 or "Unknown error")} return end --Delete file - if not love.filesystem.remove(arg[1])then + if not love.filesystem.remove(arg[1]) then log{C.R,("Failed to delete old file ''"):format(arg[1])} return end @@ -288,12 +288,12 @@ local commands={}do }commands.ren="mv" commands.print={ code=function(name) - if name~=""then + if name~="" then local info=love.filesystem.getInfo(name) if info then - if info.type=='file'then + if info.type=='file' then log{COLOR.lC,"/* "..name.." */"} - for l in love.filesystem.lines(name)do + for l in love.filesystem.lines(name) do log(l) end log{COLOR.lC,"/* END */"} @@ -317,16 +317,16 @@ local commands={}do --System commands.crash={ - code=function()error("ERROR")end, + code=function() error("ERROR") end, description="Manually crash the game", } commands.mes={ code=function(arg) if - arg=='check'or - arg=='info'or - arg=='broadcast'or - arg=='warn'or + arg=='check' or + arg=='info' or + arg=='broadcast' or + arg=='warn' or arg=='error' then MES.new(arg,"Test message",6) @@ -359,7 +359,7 @@ local commands={}do } commands.openurl={ code=function(url) - if url~=""then + if url~="" then local res,err=pcall(love.system.openURL,url) if not res then log{C.R,"[ERR] ",C.Z,err} @@ -377,7 +377,7 @@ local commands={}do } commands.scrinfo={ code=function() - for _,v in next,SCR.info()do + for _,v in next,SCR.info() do log(v) end end, @@ -390,9 +390,9 @@ local commands={}do } commands.wireframe={ code=function(bool) - if bool=="on"or bool=="off"then + if bool=="on" or bool=="off" then gc.setWireframe(bool=="on") - log("Wireframe: "..(gc.isWireframe()and"on"or"off")) + log("Wireframe: "..(gc.isWireframe() and "on" or "off")) else log{C.A,"Usage: wireframe "} end @@ -406,9 +406,9 @@ local commands={}do } commands.gammacorrect={ code=function(bool) - if bool=="on"or bool=="off"then + if bool=="on" or bool=="off" then love._setGammaCorrect(bool=="on") - log("GammaCorrect: "..(gc.isGammaCorrect()and"on"or"off")) + log("GammaCorrect: "..(gc.isGammaCorrect() and "on" or "off")) else log{C.A,"Usage: gammacorrect "} end @@ -422,7 +422,7 @@ local commands={}do } commands.fn={ code=function(n) - if tonumber(n)then + if tonumber(n) then n=math.floor(tonumber(n)) if n>=1 and n<=12 then love.keypressed("f"..n) @@ -441,9 +441,9 @@ local commands={}do } commands.playbgm={ code=function(bgm) - if bgm~=""then + if bgm~="" then if bgm~=BGM.getPlaying()[1] then - if BGM.play(bgm)then + if BGM.play(bgm) then log("Now playing: "..bgm) else log("No BGM called "..bgm) @@ -475,9 +475,9 @@ local commands={}do } commands.setbg={ code=function(name) - if name~=""then + if name~="" then if name~=BG.cur then - if BG.set(name)then + if BG.set(name) then log(("Background set to '%s'"):format(name)) else log(("No background called '%s'"):format(name)) @@ -498,8 +498,8 @@ local commands={}do } commands.theme={ code=function(name) - if name~=""then - if THEME.set(name)then + if name~="" then + if THEME.set(name) then log("Theme set to: "..name) else log("No theme called "..name) @@ -529,7 +529,7 @@ local commands={}do commands.support={ code=function(arg) if FNNS then - if arg:find"pl"and arg:find"fk"then + if arg:find"pl" and arg:find"fk" then SCN.go('support','none') else love.system.openURL("https://www.bilibili.com/video/BV1uT4y1P7CX?secretcode=fkpl") @@ -665,11 +665,11 @@ local commands={}do } commands.app={ code=function(name) - if name=="-list"then + if name=="-list" then for i=1,#APPs do log(("$1 $2 $3"):repD(APPs[i].code,("·"):rep(10-#APPs[i].code),APPs[i].description)) end - elseif name~=""then + elseif name~="" then for i=1,#APPs do if APPs[i].code==name then SCN.go(APPs[i].scene) @@ -695,12 +695,12 @@ local commands={}do end commands.resetall={ code=function(arg) - if arg=="sure"then + if arg=="sure" then log"FINAL WARNING!" log"Please remember that resetting everything will delete all saved data. Delete the saved data anyway?" log"Once the data has been deleted, there is no way to recover it." log"Type: resetall really" - elseif arg=="really"then + elseif arg=="really" then WIDGET.unFocus(true)inputBox.hide=true BGM.stop() commands.cls.code() @@ -709,7 +709,7 @@ local commands={}do local button=WIDGET.newButton{name='bye',x=640,y=615,w=426,h=100,code=function() TASK.new(function() WIDGET.active.bye.hide=true - for _=1,30 do coroutine.yield()end + for _=1,30 do coroutine.yield() end log{C.R,"Deleting all data in 10..."}SFX.play('ready')SFX.play('clear_1')TEST.yieldN(60) log{C.R,"Deleting all data in 9..."}SFX.play('ready')SFX.play('clear_1')TEST.yieldN(60) log{C.R,"Deleting all data in 8..."}SFX.play('ready')SFX.play('clear_1')TEST.yieldN(60) @@ -742,7 +742,7 @@ local commands={}do if sumode then log{C.Y,"You are already in su mode. Use # to run any lua code"} log{C.Y,"已经进入最高权限模式了, 请使用 # 执行任意lua代码"} - elseif code=="7126"then + elseif code=="7126" then sumode=true log{C.Y,"* SU MODE ON - DO NOT RUN ANY CODES IF YOU DO NOT KNOW WHAT THEY DO *"} log{C.Y,"* Use the _SCLOG(message) function to print into this console *"} @@ -781,7 +781,7 @@ local commands={}do commands.rmrecord={ code=function(modeName) if #modeName>0 then - if MODES[modeName]then + if MODES[modeName] then MODES[modeName].records={} log{C.Y,("Succesfully erased records of "..modeName)} love.filesystem.remove("record/"..modeName..".rec") @@ -802,9 +802,9 @@ local commands={}do } commands.unlockall={ code=function(bool) - if bool=="sure"then + if bool=="sure" then for name,M in next,MODES do - if type(name)=='string'and not RANKS[name]and M.x then + if type(name)=='string' and not RANKS[name] and M.x then if M.x then RANKS[name]=0 end @@ -827,9 +827,9 @@ local commands={}do } commands.play={ code=function(m) - if MODES[m]then + if MODES[m] then loadGame(m,true) - elseif m~=""then + elseif m~="" then log{C.R,"No mode called "..m} else log{C.A,"Usage: play [modeName]"} @@ -844,7 +844,7 @@ local commands={}do } commands.tas={ code=function(bool) - if bool=="on"or bool=="off"then + if bool=="on" or bool=="off" then SETTING.allowTAS=bool=="on" saveSettings() log("Allow TAS: "..bool) @@ -873,7 +873,7 @@ local commands={}do commands.switchhost={ code=function(arg) arg=arg:split(" ") - if arg[1]and #arg<=3 then + if arg[1] and #arg<=3 then WS.switchHost(unpack(arg)) log{C.Y,"Host switched"} else @@ -912,15 +912,15 @@ local commands={}do log{C.R,"Format error"} end end - function commands.m_connInfo()WS.send('game',JSON.encode{action=10})end - function commands.m_playMgrInfo()WS.send('game',JSON.encode{action=11})end - function commands.m_streamMgrInfo()WS.send('game',JSON.encode{action=12})end + function commands.m_connInfo() WS.send('game',JSON.encode{action=10}) end + function commands.m_playMgrInfo() WS.send('game',JSON.encode{action=11}) end + function commands.m_streamMgrInfo() WS.send('game',JSON.encode{action=12}) end for cmd,body in next,commands do - if type(body)=='function'then + if type(body)=='function' then commands[cmd]={code=body} end - if type(body)~='string'then + if type(body)~='string' then ins(cmdList,cmd) end end @@ -967,11 +967,11 @@ local userG={ } function userG.print(...) local args,L={...},{} - for k,v in next,args do ins(L,{k,v})end - table.sort(L,function(a,b)return a[1]0 then @@ -1093,19 +1093,19 @@ function scene.keyDown(key) hisPtr=hisPtr-1 inputBox:setText(history[hisPtr]) end - elseif key=='down'then + elseif key=='down' then if hisPtr then hisPtr=hisPtr+1 - if history[hisPtr]then + if history[hisPtr] then inputBox:setText(history[hisPtr]) else hisPtr=nil inputBox:clear() end end - elseif key=='tab'then + elseif key=='tab' then local str=inputBox:getText() - if str~=""and not str:find("%s")then + if str~="" and not str:find("%s") then local res={} for c in next,commands do if c:find(str,nil,true)==1 then @@ -1116,26 +1116,26 @@ function scene.keyDown(key) if #res>1 then log(">Commands that start with '"..str.."' :") table.sort(res) - for i=1,#res do log{COLOR.lH,res[i]}end + for i=1,#res do log{COLOR.lH,res[i]} end elseif #res==1 then inputBox:setText(res[1]) end end - elseif key=='scrollup'then outputBox:scroll(-5) - elseif key=='scrolldown'then outputBox:scroll(5) - elseif key=='pageup'then outputBox:scroll(-25) - elseif key=='pagedown'then outputBox:scroll(25) - elseif key=='home'then outputBox:scroll(-1e99) - elseif key=='end'then outputBox:scroll(1e99) - elseif combKey[key]and kb.isDown('lctrl','rctrl')then combKey[key]() - elseif key=='escape'then - if not WIDGET.isFocus(inputBox)then + elseif key=='scrollup' then outputBox:scroll(-5) + elseif key=='scrolldown' then outputBox:scroll(5) + elseif key=='pageup' then outputBox:scroll(-25) + elseif key=='pagedown' then outputBox:scroll(25) + elseif key=='home' then outputBox:scroll(-1e99) + elseif key==' end' then outputBox:scroll(1e99) + elseif combKey[key] and kb.isDown('lctrl','rctrl') then combKey[key]() + elseif key=='escape' then + if not WIDGET.isFocus(inputBox) then WIDGET.focus(inputBox) else SCN.back() end else - if not WIDGET.isFocus(inputBox)then + if not WIDGET.isFocus(inputBox) then WIDGET.focus(inputBox) end return true diff --git a/parts/scenes/app_cubefield.lua b/parts/scenes/app_cubefield.lua index 29b5659e..25d8a73a 100644 --- a/parts/scenes/app_cubefield.lua +++ b/parts/scenes/app_cubefield.lua @@ -27,7 +27,7 @@ local score local sunH,color,rot local function near(o,t) - return o>t and max(o-.01,t)or ot and max(o-.01,t) or o0 then sunH=max(sunH*.85-1,0) @@ -204,11 +204,11 @@ function scene.update(dt) ct=ct-1 if ct==0 then local t=love.system.getClipboardText() - if type(t)=='string'then + if type(t)=='string' then t=t:lower():match("^s=(%d+)$") - t=t and tonumber(t)and tonumber(t)>0 and tonumber(t)<=8000 and int(tonumber(t)) + t=t and tonumber(t) and tonumber(t)>0 and tonumber(t)<=8000 and int(tonumber(t)) end - score=type(t)=='number'and t or 0 + score=type(t)=='number' and t or 0 life=1000 play,menu=true,false inv=90 @@ -312,7 +312,7 @@ function scene.draw() mStr("Score : "..score,0,-350) end - mStr(MOBILE and"Touch to Start"or"Press space to Start",0,-160) + mStr(MOBILE and "Touch to Start" or "Press space to Start",0,-160) end gc.pop() end diff --git a/parts/scenes/app_dropper.lua b/parts/scenes/app_dropper.lua index fbe0be46..3b51556a 100644 --- a/parts/scenes/app_dropper.lua +++ b/parts/scenes/app_dropper.lua @@ -42,8 +42,8 @@ end function scene.keyDown(key,isRep) if isRep then return end - if key=='space'or key=='return'then - if state=='move'then + if key=='space' or key=='return' then + if state=='move' then if floor>0 then if move.x0 and move.x+move.l>=1280 then SFX.play('lock') speed=-speed end - elseif state=='drop'then + elseif state=='drop' then move.y=move.y+18 if move.y>=660 then if move.x>base.x+base.l or move.x+move.lbase.x+base.l or move.x+move.l1000 then highScore=max(score,highScore) highFloor=max(floor,floor) state='dead' end - elseif state=='scroll'then + elseif state=='scroll' then camY=camY-floor/4 if camY<1000 then camY=camY-1 end if camY<500 then camY=camY-1 end @@ -177,16 +177,16 @@ setmetatable(backColor,backColor) function scene.draw() --Background local lv,height=int(camY/700),camY%700 - gc.setColor(backColor[lv+1]or COLOR.D) + gc.setColor(backColor[lv+1] or COLOR.D) gc.rectangle('fill',0,720,1280,height-700) - gc.setColor(backColor[lv+2]or COLOR.D) + gc.setColor(backColor[lv+2] or COLOR.D) gc.rectangle('fill',0,height+20,1280,-height-20) if height-680>0 then - gc.setColor(backColor[lv+3]or COLOR.D) + gc.setColor(backColor[lv+3] or COLOR.D) gc.rectangle('fill',0,height-680,1280,680-height) end - if state=='menu'or state=='dead'then + if state=='menu' or state=='dead' then setFont(100) gc.setColor(COLOR.rainbow_light(TIME()*2.6)) mStr("DROPPER",640,120) @@ -199,12 +199,12 @@ function scene.draw() gc.setColor(COLOR.D) setFont(35) - mStr(MOBILE and"Touch to Start"or"Press space to Start",640,570) + mStr(MOBILE and "Touch to Start" or "Press space to Start",640,570) setFont(20) gc.print("Original CX-CAS version by MrZ",740,235) gc.print("Ported / Rewritten / Balanced by MrZ",740,260) end - if state~='menu'then + if state~='menu' then --High floor gc.setColor(COLOR.Z) gc.setLineWidth(2) diff --git a/parts/scenes/app_dtw.lua b/parts/scenes/app_dtw.lua index 97f36d96..41644d92 100644 --- a/parts/scenes/app_dtw.lua +++ b/parts/scenes/app_dtw.lua @@ -39,14 +39,14 @@ local modeSelector=WIDGET.newSelector{name='mode',x=150,y=220,w=290, "Dense_Handstream", "Light_Quadstream", "Quadstream", - },disp=function()return mode end,code=function(m)mode=m reset()end + },disp=function() return mode end,code=function(m) mode=m reset() end } -local bgmSelector=WIDGET.newSelector{name='bgm',x=150,y=290,w=290,list=BGM.getList(),disp=function()return bgm end,code=function(i)bgm=i BGM.play(i)end} +local bgmSelector=WIDGET.newSelector{name='bgm',x=150,y=290,w=290,list=BGM.getList(),disp=function() return bgm end,code=function(i) bgm=i BGM.play(i) end} local colorSelector=WIDGET.newSelector{name='color',x=150,y=360,w=290, list={"black","dGray","gray","lGray","dRed","red","lRed","dFire","fire","lFire","dOrange","orange","lOrange","dYellow","yellow","lYellow","dLime","lime","lLime","dJade","jade","lJade","dGreen","green","lGreen","dAqua","aqua","lAqua","dCyan","cyan","lCyan","dNavy","navy","lNavy","dSea","sea","lSea","dBlue","blue","lBlue","dViolet","violet","lViolet","dPurple","purple","lPurple","dMagenta","magenta","lMagenta","dWine","wine","lWine"}, - disp=function()return tileColor end,code=function(m)tileColor=m end + disp=function() return tileColor end,code=function(m) tileColor=m end } -local arcadeSwitch=WIDGET.newSwitch{name='arcade',x=240,y=430,lim=200,font=40,disp=function()return arcade end,code=pressKey'e'} +local arcadeSwitch=WIDGET.newSwitch{name='arcade',x=240,y=430,lim=200,font=40,disp=function() return arcade end,code=pressKey'e'} local function freshSelectors() local f=state~=0 modeSelector.hide=f @@ -66,7 +66,7 @@ local function get1(prev) else while true do local r=rnd(4) - if not string.find(prev,r)then return r end + if not string.find(prev,r) then return r end end end end @@ -75,13 +75,13 @@ local function get2(prev) local i=rnd(4) local r=rnd(3) if r>=i then r=r+1 end - if not(string.find(prev,r)or string.find(prev,i))then + if not (string.find(prev,r) or string.find(prev,i)) then return 10*i+r end end end local function get3(prev) - if prev==0 then prev=rnd(4)end + if prev==0 then prev=rnd(4) end if prev==1 then return 234 elseif prev==2 then return 134 elseif prev==3 then return 124 @@ -95,22 +95,22 @@ local generator={ ins(pos,rnd(4)) end, Split=function() - if #pos==0 then ins(pos,rnd(4))end - ins(pos,pos[#pos]<=2 and rnd(3,4)or rnd(2)) + if #pos==0 then ins(pos,rnd(4)) end + ins(pos,pos[#pos]<=2 and rnd(3,4) or rnd(2)) end, Short=function() - if #pos<2 then ins(pos,rnd(4))ins(pos,rnd(4))end + if #pos<2 then ins(pos,rnd(4))ins(pos,rnd(4)) end local r - if pos[#pos]==pos[#pos-1]then + if pos[#pos]==pos[#pos-1] then r=rnd(3) - if r>=pos[#pos]then r=r+1 end + if r>=pos[#pos] then r=r+1 end ins(pos,r) else ins(pos,rnd(4)) end end, Stairs=function() - local r=get1(pos[#pos]or 0) + local r=get1(pos[#pos] or 0) local dir=r==1 and 1 or r==4 and -1 or rnd()<.5 and 1 or -1 local count=rnd(3,5) while count>0 do @@ -132,48 +132,48 @@ local generator={ ins(pos,r) end, Singlestream=function() - ins(pos,get1(pos[#pos]or 0)) + ins(pos,get1(pos[#pos] or 0)) end, Light_Jumpstream=function()--2111 - ins(pos,get2(pos[#pos]or 0)) + ins(pos,get2(pos[#pos] or 0)) ins(pos,get1(pos[#pos])) ins(pos,get1(pos[#pos])) ins(pos,get1(pos[#pos])) end, Dense_Jumpstream=function()--2121 - ins(pos,get2(pos[#pos]or 0)) + ins(pos,get2(pos[#pos] or 0)) ins(pos,get1(pos[#pos])) ins(pos,get2(pos[#pos])) ins(pos,get1(pos[#pos])) end, Light_Handstream=function()--3111 - ins(pos,get3(pos[#pos]or 0)) + ins(pos,get3(pos[#pos] or 0)) ins(pos,get1(pos[#pos])) ins(pos,get1(pos[#pos])) ins(pos,get1(pos[#pos])) end, Dense_Handstream=function()--3121 - ins(pos,get3(pos[#pos]or 0)) + ins(pos,get3(pos[#pos] or 0)) ins(pos,get1(pos[#pos])) ins(pos,get2(pos[#pos])) ins(pos,get1(pos[#pos])) end, Light_Quadstream=function()--4111 ins(pos,1234) - ins(pos,get1(pos[#pos-1]or 0)) + ins(pos,get1(pos[#pos-1] or 0)) ins(pos,get1(pos[#pos])) ins(pos,get1(pos[#pos])) end, Quadstream=function()--4121 ins(pos,1234) - ins(pos,get1(pos[#pos-1]or 0)) + ins(pos,get1(pos[#pos-1] or 0)) ins(pos,get2(pos[#pos])) ins(pos,get1(pos[#pos])) end, } function reset() - keyTime={}for i=1,40 do keyTime[i]=-1e99 end + keyTime={} for i=1,40 do keyTime[i]=-1e99 end speed,maxSpeed=0,0 progress={} state=0 @@ -182,15 +182,15 @@ function reset() score=0 local t=love.system.getClipboardText() - if type(t)=='string'then + if type(t)=='string' then t=t:lower():match("^s=(.+)") - t=t and tonumber(t)and tonumber(t)*2 + t=t and tonumber(t) and tonumber(t)*2 t=t and tonumber(t)>=0 and tonumber(t)<=60 and t end - rollSpeed=type(t)=='number'and t or 6.26 + rollSpeed=type(t)=='number' and t or 6.26 pos={} - while #pos<7 do generator[mode]()end + while #pos<7 do generator[mode]() end height=0 diePos=false end @@ -218,11 +218,11 @@ local function touch(n) SFX.play('lock') else rem(pos,1) - while #pos<7 do generator[mode]()end + while #pos<7 do generator[mode]() end ins(keyTime,1,TIME()) keyTime[21]=nil score=score+1 - if not arcade and targets[score]then + if not arcade and targets[score] then ins(progress,("%s - %.3fs"):format(score,TIME()-startTime)) if score==2600 then for i=1,#pos do @@ -247,23 +247,23 @@ local function touch(n) end function scene.keyDown(key,isRep) if isRep then return end - if key=='r'or key=='space'then reset() - elseif key=='escape'then SCN.back() + if key=='r' or key=='space' then reset() + elseif key=='escape' then SCN.back() elseif state~=2 then - if key=='d'or key=='c'then touch(1) - elseif key=='f'or key=='v'then touch(2) - elseif key=='j'or key=='n'then touch(3) - elseif key=='k'or key=='m'then touch(4) + if key=='d' or key=='c' then touch(1) + elseif key=='f' or key=='v' then touch(2) + elseif key=='j' or key=='n' then touch(3) + elseif key=='k' or key=='m' then touch(4) elseif state==0 then - if key=='tab'then + if key=='tab' then local mode1=mode - modeSelector:scroll(love.keyboard.isDown('lshift','rshift')and -1 or 1) - if mode1~=mode then reset()end - elseif key=='q'then - bgmSelector:scroll(love.keyboard.isDown('lshift','rshift')and -1 or 1) - elseif key=='w'then - colorSelector:scroll(love.keyboard.isDown('lshift','rshift')and -1 or 1) - elseif key=='e'then + modeSelector:scroll(love.keyboard.isDown('lshift','rshift') and -1 or 1) + if mode1~=mode then reset() end + elseif key=='q' then + bgmSelector:scroll(love.keyboard.isDown('lshift','rshift') and -1 or 1) + elseif key=='w' then + colorSelector:scroll(love.keyboard.isDown('lshift','rshift') and -1 or 1) + elseif key=='e' then arcade=not arcade end end @@ -285,7 +285,7 @@ function scene.update(dt) local t=TIME() time=t-startTime local v=0 - for i=2,20 do v=v+i*(i-1)*.3/(t-keyTime[i])end + for i=2,20 do v=v+i*(i-1)*.3/(t-keyTime[i]) end speed=MATH.expApproach(speed,v,dt) if speed>maxSpeed then maxSpeed=speed end @@ -302,7 +302,7 @@ function scene.update(dt) end end -local function boardStencil()gc.rectangle('fill',300,0,680,720)end +local function boardStencil() gc.rectangle('fill',300,0,680,720) end function scene.draw() setFont(50) if arcade then diff --git a/parts/scenes/app_link.lua b/parts/scenes/app_link.lua index 3332347f..ba8d5f7e 100644 --- a/parts/scenes/app_link.lua +++ b/parts/scenes/app_link.lua @@ -111,7 +111,7 @@ local function newGame() end local function addPoint(list,x,y) local l=#list - if x~=list[l-1]or y~=list[l]then + if x~=list[l-1] or y~=list[l] then list[l+1]=x list[l+2]=y end @@ -122,12 +122,12 @@ local function checkLink(x1,y1,x2,y2) do if x1>x2 then x1,y1,x2,y2=x2,y2,x1,y1 end local luy,ldy,ruy,rdy=y1,y1,y2,y2 - while luy>1 and not field[luy-1][x1]do luy=luy-1 end - while ldy1 and not field[ruy-1][x2]do ruy=ruy-1 end - while rdy1 and not field[luy-1][x1] do luy=luy-1 end + while ldy1 and not field[ruy-1][x2] do ruy=ruy-1 end + while rdyy2 then x1,y1,x2,y2=x2,y2,x1,y1 end local ulx,urx,dlx,drx=x1,x1,x2,x2 - while ulx>1 and not field[y1][ulx-1]do ulx=ulx-1 end - while urx1 and not field[y2][dlx-1]do dlx=dlx-1 end - while drx1 and not field[y1][ulx-1] do ulx=ulx-1 end + while urx1 and not field[y2][dlx-1] do dlx=dlx-1 end + while drx0 then @@ -397,8 +397,8 @@ function scene.draw() end scene.widgetList={ - WIDGET.newButton{name='reset',x=80,y=60,w=110,h=60,color='lG',fText=CHAR.icon.retry_spin,code=pressKey'r',hideF=function()return state==0 end}, - WIDGET.newSwitch{name='invis',x=100,y=140,lim=80,disp=function()return invis end,code=pressKey'q',hideF=function()return state==1 end}, + WIDGET.newButton{name='reset',x=80,y=60,w=110,h=60,color='lG',fText=CHAR.icon.retry_spin,code=pressKey'r',hideF=function() return state==0 end}, + WIDGET.newSwitch{name='invis',x=100,y=140,lim=80,disp=function() return invis end,code=pressKey'q',hideF=function() return state==1 end}, WIDGET.newButton{name='back',x=1200,y=660,w=110,font=45,sound='back',fText=CHAR.icon.back,code=pressKey'escape'}, } diff --git a/parts/scenes/app_mahjong.lua b/parts/scenes/app_mahjong.lua index 718e0dc5..427d1314 100644 --- a/parts/scenes/app_mahjong.lua +++ b/parts/scenes/app_mahjong.lua @@ -13,7 +13,7 @@ for i=1,9 do ins(deck0,'m'..i) ins(deck0,'p'..i) ins(deck0,'s'..i) - if i<=7 then ins(deck0,'z'..i)end + if i<=7 then ins(deck0,'z'..i) end end end -- deck0[TABLE.find(deck0,'m5')]='m0' @@ -58,7 +58,7 @@ local cardText={ z5={COLOR.D,CHAR.mahjong.haku}, z6={COLOR.G,CHAR.mahjong.hatsu}, z7={COLOR.R,CHAR.mahjong.chun}, -}for _,v in next,cardText do ins(v,COLOR.D)ins(v,CHAR.mahjong.frameComb) end +} for _,v in next,cardText do ins(v,COLOR.D)ins(v,CHAR.mahjong.frameComb) end local deck,hand,pool local selected @@ -81,7 +81,7 @@ local function _newGame() deck=TABLE.shift(deck0) hand={} pool={} - for _=1,14 do ins(hand,(TABLE.popRandom(deck)))end + for _=1,14 do ins(hand,(TABLE.popRandom(deck))) end table.sort(hand) end @@ -92,7 +92,7 @@ local function _checkWin() end local function _throwCard() - if hand[selected]and #pool<40 then + if hand[selected] and #pool<40 then ins(pool,rem(hand,selected)) table.sort(hand) SFX.play('hold') @@ -124,29 +124,29 @@ end function scene.mouseDown() _throwCard() end -function scene.touchMove(x,y)scene.mouseMove(x,y)end -function scene.touchDown(x,y)scene.mouseMove(x,y)end -function scene.touchClick(x,y)scene.mouseDown(x,y)end +function scene.touchMove(x,y) scene.mouseMove(x,y) end +function scene.touchDown(x,y) scene.mouseMove(x,y) end +function scene.touchClick(x,y) scene.mouseDown(x,y) end function scene.keyDown(key) - if key=='left'then + if key=='left' then if selected then selected=max(selected-1,1) else selected=1 end - elseif key=='right'then + elseif key=='right' then if selected then selected=min(selected+1,#hand) else selected=#hand end - elseif key=='space'then + elseif key=='space' then _throwCard() - elseif key=='r'then + elseif key=='r' then _newGame() - elseif key=='return'then + elseif key=='return' then _checkWin() - elseif key=='escape'then + elseif key=='escape' then SCN.back() end end @@ -172,7 +172,7 @@ function scene.draw() end gc_setColor(1,1,1) GC.mStr(cardText[c],x+w/2,y-17) - if i==selected then gc_translate(0,10)end + if i==selected then gc_translate(0,10) end end for i=1,#pool do local c=pool[i] diff --git a/parts/scenes/app_memorize.lua b/parts/scenes/app_memorize.lua index 0195c0f4..938d8f7f 100644 --- a/parts/scenes/app_memorize.lua +++ b/parts/scenes/app_memorize.lua @@ -12,7 +12,7 @@ local scene={} local function newNum(lv) local num="" - for _=1,4+lv^.66 do num=num..math.random(0,9)end + for _=1,4+lv^.66 do num=num..math.random(0,9) end return num end @@ -40,15 +40,15 @@ end function scene.keyDown(key,isRep) if isRep then return end - if key=='escape'then - if tryBack()then + if key=='escape' then + if tryBack() then SCN.back() end - elseif key=='r'then + elseif key=='r' then _reset() elseif state==0 then - if key:sub(1,2)=="kp"then key=key:sub(3)end - if #key==1 and("0123456789"):find(key,nil,true)then + if key:sub(1,2)=="kp" then key=key:sub(3) end + if #key==1 and ("0123456789"):find(key,nil,true) then input=input..key showTime=math.min(showTime,0) if input==showNum then @@ -56,7 +56,7 @@ function scene.keyDown(key,isRep) freshLevel() SFX.play('reach') end - elseif key=='space'or key=='backspace'then + elseif key=='space' or key=='backspace' then input="" end end diff --git a/parts/scenes/app_piano.lua b/parts/scenes/app_piano.lua index 008c4808..75af6866 100644 --- a/parts/scenes/app_piano.lua +++ b/parts/scenes/app_piano.lua @@ -24,19 +24,19 @@ end scene.mouseDown=scene.touchDown function scene.keyDown(key,isRep) - if not isRep and keys[key]then + if not isRep and keys[key] then local note=keys[key]+offset - if kb.isDown('lshift','rshift')then note=note+1 end - if kb.isDown('lctrl','rctrl')then note=note-1 end + if kb.isDown('lshift','rshift') then note=note+1 end + if kb.isDown('lctrl','rctrl') then note=note-1 end SFX.playSample(inst,note) TEXT.show(SFX.getNoteName(note),math.random(150,1130),math.random(140,500),60,'score',.8) - elseif key=='tab'then + elseif key=='tab' then inst=TABLE.next(instList,inst) - elseif key=='lalt'then + elseif key=='lalt' then offset=math.max(offset-1,-12) - elseif key=='ralt'then + elseif key=='ralt' then offset=math.min(offset+1,12) - elseif key=='escape'then + elseif key=='escape' then SCN.back() end end diff --git a/parts/scenes/app_polyforge.lua b/parts/scenes/app_polyforge.lua index 9e4e0208..ec6c9c25 100644 --- a/parts/scenes/app_polyforge.lua +++ b/parts/scenes/app_polyforge.lua @@ -44,11 +44,11 @@ end function scene.keyDown(key,isRep) if isRep then return end - if key=='escape'then - if tryBack()then + if key=='escape' then + if tryBack() then SCN.back() end - elseif key=='space'then + elseif key=='space' then if state==0 then--main if timer==0 then state=1 @@ -58,7 +58,7 @@ function scene.keyDown(key,isRep) if hit[c]==0 then hit[c]=1 count=count+1 - SFX.play(side<26 and'ren_'..rnd(5)or'ren_'..rnd(6,11)) + SFX.play(side<26 and 'ren_'..rnd(5) or 'ren_'..rnd(6,11)) if count>=12 then SFX.play('ren_mega',(count-11)/15) end @@ -154,7 +154,7 @@ function scene.draw() if state==0 then gc.setColor(0,0,0,1-timer/50) setFont(30) - mStr(MOBILE and"Touch to Start"or"Press space to Start",640,630) + mStr(MOBILE and "Touch to Start" or "Press space to Start",640,630) else gc.setColor(0,0,0,timer/50) gc.print("POLYFORGE",20,620) diff --git a/parts/scenes/app_pong.lua b/parts/scenes/app_pong.lua index a7a09462..a0531c0e 100644 --- a/parts/scenes/app_pong.lua +++ b/parts/scenes/app_pong.lua @@ -44,28 +44,28 @@ local function start() end function scene.keyDown(key,isRep) if isRep then return end - if key=='space'then + if key=='space' then if state==0 then start() end - elseif key=='r'then + elseif key=='r' then state=0 bx,by=640,360 vx,vy=0,0 ry=0 p1.score,p2.score=0,0 SFX.play('hold') - elseif key=='w'or key=='s'then + elseif key=='w' or key=='s' then p1.y0=false - elseif key=='up'or key=='down'then + elseif key=='up' or key=='down' then p2.y0=false - elseif key=='escape'then + elseif key=='escape' then SCN.back() end end function scene.touchDown(x,y) scene.touchMove(x,y) - if state==0 then start()end + if state==0 then start() end end function scene.touchMove(x,y)(x<640 and p1 or p2).y0=y end function scene.mouseMove(x,y)(x<640 and p1 or p2).y0=y end @@ -86,10 +86,10 @@ function scene.update() P.vy=P.vy*.5 end else - if kb.isDown(P==p1 and'w'or'up')then + if kb.isDown(P==p1 and 'w' or 'up') then P.vy=max(P.vy-1,-8) end - if kb.isDown(P==p1 and's'or'down')then + if kb.isDown(P==p1 and 's' or 'down') then P.vy=min(P.vy+1,8) end P.y=P.y+P.vy diff --git a/parts/scenes/app_reflect.lua b/parts/scenes/app_reflect.lua index a087a822..947ecb3e 100644 --- a/parts/scenes/app_reflect.lua +++ b/parts/scenes/app_reflect.lua @@ -23,7 +23,7 @@ end function scene.keyDown(key,isRep) if isRep then return end if state==0 then - if key=='space'then + if key=='space' then reset() state=1 ct=60 @@ -34,13 +34,13 @@ function scene.keyDown(key,isRep) --BEAUTIFUL LOGIC BELOW: --early = error, [UP-key]==[target is up] = correct sfx, else = wrong sfx - SFX.play(ct>6 and'finesseError'or key%2==1==up and'reach'or'fail') + SFX.play(ct>6 and 'finesseError' or key%2==1==up and 'reach' or 'fail') --(early && P2-key || not early && [P1-key]==[target is up]) = P1 win, else P2 win if ct>6 and key>2 or ct<=6 and key%4<2==up then - winner=1;s1=s1+1 + winner=1; s1=s1+1 else - winner=2;s2=s2+1 + winner=2; s2=s2+1 end state=3 ct=60 @@ -49,10 +49,10 @@ function scene.keyDown(key,isRep) end function scene.touchDown(x,y) scene.keyDown( - state==0 and"space"or + state==0 and "space" or x<640 and - (y<360 and"q"or"a")or - (y<360 and"p"or"l") + (y<360 and "q" or "a") or + (y<360 and "p" or "l") ) end function scene.update() @@ -106,7 +106,7 @@ function scene.draw() if state==0 then setFont(40) - mStr(MOBILE and"Touch to Start"or"Press space to Start",640,400) + mStr(MOBILE and "Touch to Start" or "Press space to Start",640,400) mStr("Press key on the same side when block appear!",640,500) if ct>0 then setFont(100) diff --git a/parts/scenes/app_schulteG.lua b/parts/scenes/app_schulteG.lua index fc381263..d2a4a716 100644 --- a/parts/scenes/app_schulteG.lua +++ b/parts/scenes/app_schulteG.lua @@ -79,9 +79,9 @@ function scene.touchDown(x,y) end function scene.keyDown(key,isRep) if isRep then return end - if key=='z'or key=='x'then + if key=='z' or key=='x' then love.mousepressed(ms.getPosition()) - elseif key=='space'then + elseif key=='space' then if state>0 then board={} time=0 @@ -89,23 +89,23 @@ function scene.keyDown(key,isRep) state=0 progress=0 end - elseif key=='q'then + elseif key=='q' then if state==0 then invis=not invis end - elseif key=='w'then + elseif key=='w' then if state==0 then disappear=not disappear end - elseif key=='e'then + elseif key=='e' then if state==0 then tapFX=not tapFX end - elseif key=='3'or key=='4'or key=='5'or key=='6'then + elseif key=='3' or key=='4' or key=='5' or key=='6' then if state==0 then rank=tonumber(key) end - elseif key=='escape'then + elseif key=='escape' then SCN.back() end end @@ -123,7 +123,7 @@ function scene.draw() gc.print(mistake,1026,150) setFont(70) - mStr(state==1 and progress or state==0 and"Ready"or state==2 and"Win",1130,300) + mStr(state==1 and progress or state==0 and "Ready" or state==2 and "Win",1130,300) gc.setColor(COLOR.dX) gc.rectangle('fill',310,30,660,660) @@ -151,7 +151,7 @@ function scene.draw() for i=1,rank do for j=1,rank do local N=board[rank*(i-1)+j] - if not(state==1 and disappear and N<=progress)then + if not (state==1 and disappear and N<=progress) then gc.setColor(.4,.5,.6) gc.rectangle('fill',320+(j-1)*width,(i-1)*width+40,width,width) gc.setColor(COLOR.Z) @@ -170,11 +170,11 @@ function scene.draw() end scene.widgetList={ - WIDGET.newButton{name='reset', x=160,y=100,w=180,h=100,color='lG',font=50,fText=CHAR.icon.retry_spin,code=pressKey'space',hideF=function()return state==0 end}, - WIDGET.newSlider{name='rank', x=130,y=250,lim=105,w=150,axis={3,6,1},show=false,font=40,disp=function()return rank end,code=function(v)rank=v end,hideF=function()return state>0 end}, - WIDGET.newSwitch{name='invis', x=240,y=330,lim=200,font=40,disp=function()return invis end,code=pressKey'q',hideF=function()return state==1 end}, - WIDGET.newSwitch{name='disappear',x=240,y=420,lim=200,font=40,disp=function()return disappear end,code=pressKey'w',hideF=function()return state==1 end}, - WIDGET.newSwitch{name='tapFX', x=240,y=510,lim=200,font=40,disp=function()return tapFX end,code=pressKey'e',hideF=function()return state==1 end}, + WIDGET.newButton{name='reset', x=160,y=100,w=180,h=100,color='lG',font=50,fText=CHAR.icon.retry_spin,code=pressKey'space',hideF=function() return state==0 end}, + WIDGET.newSlider{name='rank', x=130,y=250,lim=105,w=150,axis={3,6,1},show=false,font=40,disp=function() return rank end,code=function(v) rank=v end,hideF=function() return state>0 end}, + WIDGET.newSwitch{name='invis', x=240,y=330,lim=200,font=40,disp=function() return invis end,code=pressKey'q',hideF=function() return state==1 end}, + WIDGET.newSwitch{name='disappear',x=240,y=420,lim=200,font=40,disp=function() return disappear end,code=pressKey'w',hideF=function() return state==1 end}, + WIDGET.newSwitch{name='tapFX', x=240,y=510,lim=200,font=40,disp=function() return tapFX end,code=pressKey'e',hideF=function() return state==1 end}, WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene}, } diff --git a/parts/scenes/app_spin.lua b/parts/scenes/app_spin.lua index e0163632..a0a90fb8 100644 --- a/parts/scenes/app_spin.lua +++ b/parts/scenes/app_spin.lua @@ -17,16 +17,16 @@ local scene={} function scene.keyDown(key,isRep) if isRep then return end - if key=='space'or key=='return'then + if key=='space' or key=='return' then if STAT.item.zTicket>0 then - if spinner:start()then + if spinner:start() then STAT.item.zTicket=STAT.item.zTicket-1 saveStats() end else MES.new('info',"Not enough zTicket") end - elseif key=='escape'then + elseif key=='escape' then SCN.back() end end diff --git a/parts/scenes/app_stopwatch.lua b/parts/scenes/app_stopwatch.lua index 3044f9d6..c515b6fd 100644 --- a/parts/scenes/app_stopwatch.lua +++ b/parts/scenes/app_stopwatch.lua @@ -45,7 +45,7 @@ function scene.touchUp() end function scene.keyDown(key,isRep) if isRep then return end - if key=='escape'then + if key=='escape' then SCN.back() else press() diff --git a/parts/scenes/app_tap.lua b/parts/scenes/app_tap.lua index 81b0bcc1..b0ae7e7d 100644 --- a/parts/scenes/app_tap.lua +++ b/parts/scenes/app_tap.lua @@ -11,14 +11,14 @@ local speed,maxSpeed=0,260 function scene.sceneInit() lastKey=nil speed=0 - keyTime={}for i=1,40 do keyTime[i]=-1e99 end + keyTime={} for i=1,40 do keyTime[i]=-1e99 end BG.set('fixColor',.26,.26,.26) BGM.play('push') end function scene.keyDown(key,isRep) if isRep then return end - if key=='escape'then + if key=='escape' then SCN.back() else if lastKey~=key then @@ -34,7 +34,7 @@ end function scene.update(dt) local t=TIME() local v=0 - for i=2,40 do v=v+i*(i-1)*.075/(t-keyTime[i])end + for i=2,40 do v=v+i*(i-1)*.075/(t-keyTime[i]) end speed=MATH.expApproach(speed,v,dt) if speed>maxSpeed then maxSpeed=speed @@ -71,7 +71,7 @@ function scene.draw() end scene.widgetList={ - WIDGET.newKey{name='tap',x=640,y=540,w=626,h=260,sound='touch',fText="TAP",color='Z',font=100,code=function(i)love.keypressed('b'..i)end}, + WIDGET.newKey{name='tap',x=640,y=540,w=626,h=260,sound='touch',fText="TAP",color='Z',font=100,code=function(i) love.keypressed('b'..i) end}, WIDGET.newButton{name='back',x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene}, } diff --git a/parts/scenes/app_ten.lua b/parts/scenes/app_ten.lua index 4bb5eb5c..af17b033 100644 --- a/parts/scenes/app_ten.lua +++ b/parts/scenes/app_ten.lua @@ -109,10 +109,10 @@ local function merge() end if chosen>=5 then SFX.play( - chosen>=9 and'ren_mega'or - chosen>=8 and'spin_3'or - chosen>=7 and'spin_2'or - chosen>=6 and'spin_1'or + chosen>=9 and 'ren_mega' or + chosen>=8 and 'spin_3' or + chosen>=7 and 'spin_2' or + chosen>=6 and 'spin_1' or 'spin_0' ) end @@ -125,39 +125,39 @@ local function merge() end function scene.keyDown(key,isRep) if isRep then return end - if key=='up'or key=='down'or key=='left'or key=='right'then + if key=='up' or key=='down' or key=='left' or key=='right' then if state==2 then return end if not cx then cx,cy=3,3 else - if key=='up'then + if key=='up' then if cy>1 then cy=cy-1 end - elseif key=='down'then + elseif key=='down' then if cy<5 then cy=cy+1 end - elseif key=='left'then + elseif key=='left' then if cx>1 then cx=cx-1 end - elseif key=='right'then + elseif key=='right' then if cx<5 then cx=cx+1 end end end - elseif key=='z'or key=='space'then + elseif key=='z' or key=='space' then merge() - elseif key=='r'then + elseif key=='r' then reset() - elseif key=='q'then + elseif key=='q' then if state==0 then nexts=not nexts end - elseif key=='w'then + elseif key=='w' then if state==0 then invis=not invis end - elseif key=='e'then + elseif key=='e' then if state==0 then fast=not fast end - elseif key=='escape'then - if tryBack()then + elseif key=='escape' then + if tryBack() then SCN.back() end end @@ -198,17 +198,17 @@ function scene.update() if board[1][i]==0 then board[1][i]=rem(preview,1) preview[5]= - maxTile<=4 and rnd(2)or - maxTile<=8 and rnd(1+rnd(2))or - maxTile<=11 and rnd(2+rnd(2))or + maxTile<=4 and rnd(2) or + maxTile<=8 and rnd(1+rnd(2)) or + maxTile<=11 and rnd(2+rnd(2)) or rnd(2+rnd(3)) noNewTile=false end end if noNewTile then fallingTimer=false - for i=1,4 do for j=1,5 do if board[i][j]==board[i+1][j]then return end end end - for i=1,5 do for j=1,4 do if board[i][j]==board[i][j+1]then return end end end + for i=1,4 do for j=1,5 do if board[i][j]==board[i+1][j] then return end end end + for i=1,5 do for j=1,4 do if board[i][j]==board[i][j+1] then return end end end state=2 SFX.play('fail') else @@ -216,11 +216,11 @@ function scene.update() SFX.play('touch') end end - elseif fast and( - msIsDown(1)or + elseif fast and ( + msIsDown(1) or #tcTouches()>0 or kbIsDown('space') - )then + ) then merge() end end @@ -260,9 +260,9 @@ function scene.draw() end gc.setLineWidth(10) setColor(COLOR[ - state==1 and(fast and'R'or'W')or - state==0 and'G'or - state==2 and'Y' + state==1 and (fast and 'R' or 'W') or + state==0 and 'G' or + state==2 and 'Y' ]) rectangle('line',315,35,650,650) @@ -305,9 +305,9 @@ end scene.widgetList={ WIDGET.newButton{name='reset',x=160,y=100,w=180,h=100,color='lG',font=50,fText=CHAR.icon.retry_spin,code=pressKey'r'}, - WIDGET.newSwitch{name='next', x=240,y=235,lim=200,font=40,disp=function()return nexts end,code=pressKey'q',hideF=function()return state==1 end}, - WIDGET.newSwitch{name='invis',x=240,y=305,lim=200,font=40,disp=function()return invis end,code=pressKey'w',hideF=function()return state==1 end}, - WIDGET.newSwitch{name='fast', x=240,y=375,lim=200,font=30,disp=function()return fast end,code=pressKey'e',hideF=function()return state==1 end}, + WIDGET.newSwitch{name='next', x=240,y=235,lim=200,font=40,disp=function() return nexts end,code=pressKey'q',hideF=function() return state==1 end}, + WIDGET.newSwitch{name='invis',x=240,y=305,lim=200,font=40,disp=function() return invis end,code=pressKey'w',hideF=function() return state==1 end}, + WIDGET.newSwitch{name='fast', x=240,y=375,lim=200,font=30,disp=function() return fast end,code=pressKey'e',hideF=function() return state==1 end}, WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene}, } diff --git a/parts/scenes/app_triple.lua b/parts/scenes/app_triple.lua index cfa5ffc8..15b8e4f1 100644 --- a/parts/scenes/app_triple.lua +++ b/parts/scenes/app_triple.lua @@ -41,7 +41,7 @@ local textColor={ local tileTexts=setmetatable({ [-2]="B", [-1]="×", -},{__index=function(self,k)self[k]=k return k end}) +},{__index=function(self,k) self[k]=k return k end}) local player={x=340,y=90} @@ -88,17 +88,17 @@ function player:reset() end end self.board[1][1]=false - for _,n in next,{-1,-1,1,1,2,2,3,3}do + for _,n in next,{-1,-1,1,1,2,2,3,3} do local x,y repeat x,y=rnd(6),rnd(6) - until not(x==1 and y==1)and self.board[y][x]==0 + until not (x==1 and y==1) and self.board[y][x]==0 self.board[y][x]=n end end function player:merge(b,v,y,x) - if b[y]and v==b[y][x]then + if b[y] and v==b[y][x] then ins(self.mergedTiles,{y,x}) b[y][x]=0 return 1 @@ -130,13 +130,13 @@ function player:click(y,x) ins(self.nexts,self:newTile()) end elseif y~=self.selectY or x~=self.selectX then - if availablePos(self.board[y][x],self.nexts[1])then + if availablePos(self.board[y][x],self.nexts[1]) then self.selectX,self.selectY=x,y else self.selectX,self.selectY=false,false end elseif y==self.selectY and x==self.selectX then - if not availablePos(self.board[y][x],self.nexts[1])then return end + if not availablePos(self.board[y][x],self.nexts[1]) then return end if self.state==0 then self.state=1 self.startTime=TIME() @@ -188,16 +188,16 @@ function player:click(y,x) SFX.play('lock') if cur>=4 then SFX.play( - cur>=8 and'ren_mega'or - cur>=7 and'spin_3'or - cur>=6 and'spin_2'or - cur>=5 and'spin_1'or + cur>=8 and 'ren_mega' or + cur>=7 and 'spin_3' or + cur>=6 and 'spin_2' or + cur>=5 and 'spin_1' or 'spin_0' ) end else for i=1,6 do - if TABLE.find(self.board[i],0)then + if TABLE.find(self.board[i],0) then return end end @@ -247,8 +247,8 @@ function player:drawBoard() --Board lines setColor(COLOR.Z) gc.setLineWidth(2) - for x=1,5 do gc.line(x*100,0,x*100,600)end - for y=1,5 do gc.line(0,y*100,600,y*100)end + for x=1,5 do gc.line(x*100,0,x*100,600) end + for y=1,5 do gc.line(0,y*100,600,y*100) end gc.setLineWidth(6) rectangle("line",0,0,600,600) @@ -280,17 +280,17 @@ function scene.touchClick(x,y) end function scene.keyDown(key,isRep) if isRep then return end - if key=='up'or key=='down'or key=='left'or key=='right'then + if key=='up' or key=='down' or key=='left' or key=='right' then if not player.selectX then player.selectX,player.selectY=3,3 else - if key=='up'then player.selectY=math.max(player.selectY-1,1) - elseif key=='down'then player.selectY=math.min(player.selectY+1,6) - elseif key=='left'then player.selectX=math.max(player.selectX-1,1) - elseif key=='right'then player.selectX=math.min(player.selectX+1,6) + if key=='up' then player.selectY=math.max(player.selectY-1,1) + elseif key=='down' then player.selectY=math.min(player.selectY+1,6) + elseif key=='left' then player.selectX=math.max(player.selectX-1,1) + elseif key=='right' then player.selectX=math.min(player.selectX+1,6) end end - elseif key=='x'or key=='space'then + elseif key=='x' or key=='space' then if not player.selectX then player.selectX,player.selectY=3,3 else @@ -298,16 +298,16 @@ function scene.keyDown(key,isRep) player:click(player.selectY,player.selectX) player.selectY,player.selectX=y,x end - elseif key=='w'then + elseif key=='w' then love.mousepressed(love.mouse.getPosition()) - elseif key=='z'or key=='q'then + elseif key=='z' or key=='q' then player:click(1,1) - elseif key=='r'then - if player.state~=1 or tryReset()then + elseif key=='r' then + if player.state~=1 or tryReset() then player:reset() end - elseif key=='escape'then - if tryBack()then + elseif key=='escape' then + if tryBack() then SCN.back() end end diff --git a/parts/scenes/customGame.lua b/parts/scenes/customGame.lua index c7280e08..de9ba8e9 100644 --- a/parts/scenes/customGame.lua +++ b/parts/scenes/customGame.lua @@ -35,13 +35,13 @@ function scene.sceneBack() end local function _play(mode) - if CUSTOMENV.opponent~="X"then - if CUSTOMENV.opponent:sub(1,2)=='CC'then - if CUSTOMENV.sequence=='fixed'then + if CUSTOMENV.opponent~="X" then + if CUSTOMENV.opponent:sub(1,2)=='CC' then + if CUSTOMENV.sequence=='fixed' then MES.new('error',text.cc_fixed) return end - if CUSTOMENV.holdMode=='swap'then + if CUSTOMENV.holdMode=='swap' then MES.new('error',text.cc_swap) return end @@ -65,25 +65,25 @@ end function scene.keyDown(key,isRep) if isRep then return true end - if key=='return'and kb.isDown('lctrl','lalt')or key=='play1'or key=='play2'then - if(key=='play2'or kb.isDown('lalt'))and #FIELD[1]>0 then + if key=='return' and kb.isDown('lctrl','lalt') or key=='play1' or key=='play2' then + if (key=='play2' or kb.isDown('lalt')) and #FIELD[1]>0 then _play('puzzle') - elseif key=='play1'or kb.isDown('lctrl')then + elseif key=='play1' or kb.isDown('lctrl') then _play('clear') end - elseif key=='f'then + elseif key=='f' then SCN.go('custom_field','swipeD') - elseif key=='s'then + elseif key=='s' then SCN.go('custom_sequence','swipeD') - elseif key=='m'then + elseif key=='m' then SCN.go('custom_mission','swipeD') - elseif key=='delete'then - if tryReset()then + elseif key=='delete' then + if tryReset() then TABLE.cut(FIELD)TABLE.cut(BAG)TABLE.cut(MISSION) FIELD[1]=DATA.newBoard() TABLE.clear(CUSTOMENV) TABLE.complete(require"parts.customEnv0",CUSTOMENV) - for _,W in next,scene.widgetList do W:reset()end + for _,W in next,scene.widgetList do W:reset() end saveFile(DATA.copyMission(),'conf/customMissions') saveFile(DATA.copyBoards(),'conf/customBoards') saveFile(DATA.copySequence(),'conf/customSequence') @@ -92,28 +92,28 @@ function scene.keyDown(key,isRep) BG.set(CUSTOMENV.bg) BGM.play(CUSTOMENV.bgm) end - elseif key=='f1'then + elseif key=='f1' then SCN.go('mod','swipeD') - elseif key=='c'and kb.isDown('lctrl','rctrl')or key=='cC'then + elseif key=='c' and kb.isDown('lctrl','rctrl') or key=='cC' then local str="Techmino Quest:"..DATA.copyQuestArgs().."!" - if #BAG>0 then str=str..DATA.copySequence()end + if #BAG>0 then str=str..DATA.copySequence() end str=str.."!" - if #MISSION>0 then str=str..DATA.copyMission()end + if #MISSION>0 then str=str..DATA.copyMission() end sys.setClipboardText(str.."!"..DATA.copyBoards().."!") MES.new('check',text.exportSuccess) - elseif key=='v'and kb.isDown('lctrl','rctrl')or key=='cV'then + elseif key=='v' and kb.isDown('lctrl','rctrl') or key=='cV' then local str=sys.getClipboardText() - local args=str:sub((str:find(":")or 0)+1):split("!") + local args=str:sub((str:find(":") or 0)+1):split("!") if #args<4 then goto THROW_fail end - if not( - DATA.pasteQuestArgs(args[1])and - DATA.pasteSequence(args[2])and + if not ( + DATA.pasteQuestArgs(args[1]) and + DATA.pasteSequence(args[2]) and DATA.pasteMission(args[3]) - )then goto THROW_fail end + ) then goto THROW_fail end TABLE.cut(FIELD) FIELD[1]=DATA.newBoard() for i=4,#args do - if args[i]:find("%S")and not DATA.pasteBoard(args[i],i-3)and i<#args then goto THROW_fail end + if args[i]:find("%S") and not DATA.pasteBoard(args[i],i-3) and i<#args then goto THROW_fail end end MES.new('check',text.importSuccess) do return end @@ -183,8 +183,8 @@ scene.widgetList={ WIDGET.newKey{name='field', x=450,y=180,w=240,h=80,color='A',font=25,code=pressKey'f'}, WIDGET.newKey{name='sequence', x=730,y=180,w=240,h=80,color='W',font=25,code=pressKey's'}, - WIDGET.newText{name='noMsn', x=50, y=220,align='L',color='H',hideF=function()return MISSION[1]end}, - WIDGET.newText{name='defSeq', x=610,y=220,align='L',color='H',hideF=function()return BAG[1]end}, + WIDGET.newText{name='noMsn', x=50, y=220,align='L',color='H',hideF=function() return MISSION[1] end}, + WIDGET.newText{name='defSeq', x=610,y=220,align='L',color='H',hideF=function() return BAG[1] end}, --Selectors WIDGET.newSelector{name='opponent', x=170,y=330,w=260,color='R',list=sList.opponent, disp=CUSval('opponent'), code=CUSsto('opponent')}, @@ -209,7 +209,7 @@ scene.widgetList={ WIDGET.newButton{name='copy', x=1070,y=300,w=310,h=70,color='lR',font=25,code=pressKey'cC'}, WIDGET.newButton{name='paste', x=1070,y=380,w=310,h=70,color='lB',font=25,code=pressKey'cV'}, WIDGET.newButton{name='play_clear', x=1070,y=460,w=310,h=70,color='lY',font=35,code=pressKey'play1'}, - WIDGET.newButton{name='play_puzzle', x=1070,y=540,w=310,h=70,color='lM',font=35,code=pressKey'play2',hideF=function()return #FIELD[1]==0 end}, + WIDGET.newButton{name='play_puzzle', x=1070,y=540,w=310,h=70,color='lM',font=35,code=pressKey'play2',hideF=function() return #FIELD[1]==0 end}, WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=pressKey'escape'}, --Rule set @@ -225,15 +225,15 @@ scene.widgetList={ WIDGET.newSwitch{name='bone', x=1170,y=950, lim=250,disp=CUSval('bone'), code=CUSrev('bone')}, --Next & Hold - WIDGET.newSelector{name='holdMode', x=310, y=890, w=300,color='lY',list=sList.holdMode,disp=CUSval('holdMode'),code=CUSsto('holdMode'),hideF=function()return CUSTOMENV.holdCount==0 end}, + WIDGET.newSelector{name='holdMode', x=310, y=890, w=300,color='lY',list=sList.holdMode,disp=CUSval('holdMode'),code=CUSsto('holdMode'),hideF=function() return CUSTOMENV.holdCount==0 end}, WIDGET.newSlider{name='nextCount', x=140, y=960, lim=130,w=180,axis={0,6,1},disp=CUSval('nextCount'),code=CUSsto('nextCount')}, WIDGET.newSlider{name='holdCount', x=140, y=1030,lim=130,w=180,axis={0,6,1},disp=CUSval('holdCount'),code=CUSsto('holdCount')}, - WIDGET.newSwitch{name='infHold', x=560, y=960, lim=200, disp=CUSval('infHold'),code=CUSrev('infHold'),hideF=function()return CUSTOMENV.holdCount==0 end}, - WIDGET.newSwitch{name='phyHold', x=560, y=1030,lim=200, disp=CUSval('phyHold'),code=CUSrev('phyHold'),hideF=function()return CUSTOMENV.holdCount==0 end}, + WIDGET.newSwitch{name='infHold', x=560, y=960, lim=200, disp=CUSval('infHold'),code=CUSrev('infHold'),hideF=function() return CUSTOMENV.holdCount==0 end}, + WIDGET.newSwitch{name='phyHold', x=560, y=1030,lim=200, disp=CUSval('phyHold'),code=CUSrev('phyHold'),hideF=function() return CUSTOMENV.holdCount==0 end}, --BG & BGM - WIDGET.newSelector{name='bg', x=840, y=1090,w=250,color='Y',list=BG.getList(),disp=CUSval('bg'),code=function(i)CUSTOMENV.bg=i BG.set(i)end}, - WIDGET.newSelector{name='bgm', x=1120,y=1090,w=250,color='Y',list=BGM.getList(),disp=CUSval('bgm'),code=function(i)CUSTOMENV.bgm=i BGM.play(i)end}, + WIDGET.newSelector{name='bg', x=840, y=1090,w=250,color='Y',list=BG.getList(),disp=CUSval('bg'),code=function(i) CUSTOMENV.bg=i BG.set(i) end}, + WIDGET.newSelector{name='bgm', x=1120,y=1090,w=250,color='Y',list=BGM.getList(),disp=CUSval('bgm'),code=function(i) CUSTOMENV.bgm=i BGM.play(i) end}, } return scene diff --git a/parts/scenes/custom_field.lua b/parts/scenes/custom_field.lua index 252e0f00..f98b2b69 100644 --- a/parts/scenes/custom_field.lua +++ b/parts/scenes/custom_field.lua @@ -61,16 +61,16 @@ local minoPosCode={ local function _pTouch(x,y) if not curPen then return end for i=1,#penPath do - if x==penPath[i][1]and y==penPath[i][2]then + if x==penPath[i][1] and y==penPath[i][2] then return end end if #penPath==0 then penMode= - pens[curPen]>0 and(FIELD[page][y][x]~=pens[curPen]and 0 or 1)or + pens[curPen]>0 and (FIELD[page][y][x]~=pens[curPen] and 0 or 1) or pens[curPen]==0 and 1 or pens[curPen]==-1 and 0 or - pens[curPen]==-2 and(FIELD[page][y][x]<=0 and 0 or 1) + pens[curPen]==-2 and (FIELD[page][y][x]<=0 and 0 or 1) end ins(penPath,{x,y}) end @@ -92,7 +92,7 @@ local function _pDraw() for i=1,#y do sum=sum+2^((11-(y[i]-minY))*(y[i]-minY)/2+(x[i]-minX)) end - if minoPosCode[sum]then + if minoPosCode[sum] then C=SETTING.skin[minoPosCode[sum]] end else @@ -114,7 +114,7 @@ local function _pDraw() penPath={} penMode=0 - while #F>0 and isEmpty(F[#F])do rem(F)end + while #F>0 and isEmpty(F[#F]) do rem(F) end end function scene.sceneInit() @@ -157,41 +157,41 @@ function scene.mouseUp(_,_,k) end end -function scene.touchDown(x,y)scene.mouseDown(x,y,1)end -function scene.touchUp(x,y)scene.mouseUp(x,y,1)end +function scene.touchDown(x,y) scene.mouseDown(x,y,1) end +function scene.touchUp(x,y) scene.mouseUp(x,y,1) end scene.touchMove=scene.mouseMove function scene.keyDown(key) - if key=='up'or key=='down'or key=='left'or key=='right'then + if key=='up' or key=='down' or key=='left' or key=='right' then if not penX or not penY then penX,penY=1,1 end - if key=='up'then + if key=='up' then if penY<20 then penY=penY+1 end - elseif key=='down'then + elseif key=='down' then if penY>1 then penY=penY-1 end - elseif key=='left'then + elseif key=='left' then if penX>1 then penX=penX-1 end - elseif key=='right'then + elseif key=='right' then if penX<10 then penX=penX+1 end end - if kb.isDown('space')then + if kb.isDown('space') then scene.keyDown('space') end - elseif key=='space'then + elseif key=='space' then if penX and penY then curPen=1 _pTouch(penX,penY) end - elseif key=='delete'then - if tryReset()then + elseif key=='delete' then + if tryReset() then FIELD[page]=DATA.newBoard() SFX.play('finesseError',.7) end - elseif key=='j'then + elseif key=='j' then demo=not demo - elseif key=='k'then + elseif key=='k' then ins(FIELD[page],1,{21,21,21,21,21,21,21,21,21,21}) SFX.play('blip') - elseif key=='l'then + elseif key=='l' then local F=FIELD[page] local cleared=false for i=#F,1,-1 do @@ -208,42 +208,42 @@ function scene.keyDown(key) SFX.play('clear_3',.8) SFX.play('fall',.8) end - elseif key=='n'then + elseif key=='n' then ins(FIELD,page+1,DATA.newBoard(FIELD[page])) page=page+1 SFX.play('warn_1',.8) SYSFX.newShade(3,200,60,300,600,.5,1,.5) - elseif key=='m'then + elseif key=='m' then rem(FIELD,page) page=max(page-1,1) - if not FIELD[1]then + if not FIELD[1] then ins(FIELD,DATA.newBoard()) end SYSFX.newShade(3,200,60,300,600,1,.5,.5) SFX.play('clear_4',.8) SFX.play('fall',.8) - elseif key=='c'and kb.isDown('lctrl','rctrl')or key=='cC'then + elseif key=='c' and kb.isDown('lctrl','rctrl') or key=='cC' then sys.setClipboardText("Techmino Field:"..DATA.copyBoard(page)) MES.new('check',text.exportSuccess) - elseif key=='v'and kb.isDown('lctrl','rctrl')or key=='cV'then + elseif key=='v' and kb.isDown('lctrl','rctrl') or key=='cV' then local str=sys.getClipboardText() local p=str:find(":")--ptr* if p then - if not str:sub(1,p-1):find("Field")then + if not str:sub(1,p-1):find("Field") then MES.new('error',text.pasteWrongPlace) end str=str:sub(p+1) end - if DATA.pasteBoard(str,page)then + if DATA.pasteBoard(str,page) then MES.new('check',text.importSuccess) else MES.new('error',text.dataCorrupted) end - elseif key=='pageup'then + elseif key=='pageup' then page=max(page-1,1) - elseif key=='pagedown'then + elseif key=='pagedown' then page=min(page+1,#FIELD) - elseif key=='escape'then + elseif key=='escape' then if curPen then curPen=false penPath={} @@ -255,7 +255,7 @@ function scene.keyDown(key) end end function scene.keyUp(key) - if key=='space'then + if key=='space' then _pDraw() curPen=false end @@ -267,8 +267,8 @@ function scene.draw() --Draw grid gc.setColor(1,1,1,.2) gc.setLineWidth(1) - for x=1,9 do gc.line(30*x,0,30*x,600)end - for y=0,19 do gc.line(0,30*y,300,30*y)end + for x=1,9 do gc.line(30*x,0,30*x,600) end + for y=0,19 do gc.line(0,30*y,300,30*y) end --Draw field gc.setColor(COLOR.Z) @@ -435,7 +435,7 @@ function scene.draw() end end -local function _setPen(i)return function(k)pens[k]=i end end +local function _setPen(i) return function(k) pens[k]=i end end scene.widgetList={ WIDGET.newText{name='title', x=1020,y=5,lim=480,font=70,align='R'}, WIDGET.newText{name='subTitle', x=1030,y=50,lim=170,font=35,align='L',color='H'}, @@ -476,12 +476,12 @@ scene.widgetList={ WIDGET.newButton{name='copy', x=730, y=530,w=120,color='lR',font=60,fText=CHAR.icon.export,code=pressKey'cC'}, WIDGET.newButton{name='paste', x=860, y=530,w=120,color='lB',font=60,fText=CHAR.icon.import,code=pressKey'cV'}, WIDGET.newButton{name='clear', x=990, y=530,w=120,color='Z', font=70,fText=CHAR.icon.trash,code=pressKey'delete'}, - WIDGET.newSwitch{name='demo', x=755, y=640,lim=220,disp=function()return demo end,code=function()demo=not demo end}, + WIDGET.newSwitch{name='demo', x=755, y=640,lim=220,disp=function() return demo end,code=function() demo=not demo end}, WIDGET.newButton{name='newPg', x=100, y=110,w=160,h=110,color='N', font=20,code=pressKey'n'}, WIDGET.newButton{name='delPg', x=100, y=230,w=160,h=110,color='lR',font=20,code=pressKey'm'}, - WIDGET.newButton{name='prevPg', x=100, y=350,w=160,h=110,color='lG',font=20,code=pressKey'pageup',hideF=function()return page==1 end}, - WIDGET.newButton{name='nextPg', x=100, y=470,w=160,h=110,color='lG',font=20,code=pressKey'pagedown',hideF=function()return page==#FIELD end}, + WIDGET.newButton{name='prevPg', x=100, y=350,w=160,h=110,color='lG',font=20,code=pressKey'pageup',hideF=function() return page==1 end}, + WIDGET.newButton{name='nextPg', x=100, y=470,w=160,h=110,color='lG',font=20,code=pressKey'pagedown',hideF=function() return page==#FIELD end}, WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene}, } diff --git a/parts/scenes/custom_mission.lua b/parts/scenes/custom_mission.lua index 6fb58f07..cc23d0d0 100644 --- a/parts/scenes/custom_mission.lua +++ b/parts/scenes/custom_mission.lua @@ -20,7 +20,7 @@ end local ENUM_MISSION=ENUM_MISSION local legalInput={Z=true,S=true,J=true,L=true,T=true,O=true,I=true,A=true,_=true,P=true} function scene.keyDown(key) - if key=='left'then + if key=='left' then local p=cur if p==0 then cur=#MISSION @@ -30,7 +30,7 @@ function scene.keyDown(key) until MISSION[p]~=MISSION[cur] cur=p end - elseif key=='right'then + elseif key=='right' then local p=cur if p==#MISSION then cur=0 @@ -40,7 +40,7 @@ function scene.keyDown(key) until MISSION[p+1]~=MISSION[cur+1] cur=p end - elseif key=='ten'then + elseif key=='ten' then for _=1,10 do local p=cur if p==#MISSION then break end @@ -49,63 +49,63 @@ function scene.keyDown(key) until MISSION[p+1]~=MISSION[cur+1] cur=p end - elseif key=='backspace'then + elseif key=='backspace' then if #input>0 then input="" elseif cur>0 then rem(MISSION,cur) cur=cur-1 - if cur>0 and MISSION[cur]==MISSION[cur+1]then + if cur>0 and MISSION[cur]==MISSION[cur+1] then scene.keyDown('right') end end - elseif key=='delete'then - if tryReset()then + elseif key=='delete' then + if tryReset() then TABLE.cut(MISSION) cur=0 SFX.play('finesseError',.7) end - elseif key=='c'and kb.isDown('lctrl','rctrl')or key=='cC'then + elseif key=='c' and kb.isDown('lctrl','rctrl') or key=='cC' then if #MISSION>0 then sys.setClipboardText("Techmino Target:"..DATA.copyMission()) MES.new('check',text.exportSuccess) end - elseif key=='v'and kb.isDown('lctrl','rctrl')or key=='cV'then + elseif key=='v' and kb.isDown('lctrl','rctrl') or key=='cV' then local str=sys.getClipboardText() local p=str:find(":")--ptr* if p then - if not str:sub(1,p-1):find("Target")then + if not str:sub(1,p-1):find("Target") then MES.new('error',text.pasteWrongPlace) end str=str:sub(p+1) end - if DATA.pasteMission(str)then + if DATA.pasteMission(str) then MES.new('check',text.importSuccess) cur=#MISSION else MES.new('error',text.dataCorrupted) end - elseif key=='escape'then + elseif key=='escape' then SCN.back() - elseif type(key)=='number'then + elseif type(key)=='number' then local p=cur+1 while MISSION[p]==key do p=p+1 end ins(MISSION,p,key) cur=p else - if key=='space'then + if key=='space' then key="_" else key=string.upper(key) end input=input..key - if ENUM_MISSION[input]then + if ENUM_MISSION[input] then cur=cur+1 ins(MISSION,cur,ENUM_MISSION[input]) SFX.play('lock') input="" - elseif #input>1 or not legalInput[input]then + elseif #input>1 or not legalInput[input] then input="" end end @@ -131,7 +131,7 @@ function scene.draw() local i,j=1,#L local count=1 repeat - if L[i]==L[i-1]then + if L[i]==L[i-1] then count=count+1 else if count>1 then @@ -220,7 +220,7 @@ scene.widgetList={ WIDGET.newKey{name='ten', x=1000,y=440,w=90, color='lG',font=55,code=pressKey'ten', fText=CHAR.key.macTab}, WIDGET.newKey{name='backsp', x=1000,y=540,w=90, color='lY',font=55,code=pressKey'backspace',fText=CHAR.key.backspace}, WIDGET.newKey{name='reset', x=1000,y=640,w=90, color='lY',font=50,code=pressKey'delete', fText=CHAR.icon.trash}, - WIDGET.newButton{name='copy', x=1140,y=440,w=170,h=80,color='lR',font=50,code=pressKey'cC', fText=CHAR.icon.export,hideF=function()return #MISSION==0 end}, + WIDGET.newButton{name='copy', x=1140,y=440,w=170,h=80,color='lR',font=50,code=pressKey'cC', fText=CHAR.icon.export,hideF=function() return #MISSION==0 end}, WIDGET.newButton{name='paste', x=1140,y=540,w=170,h=80,color='lB',font=50,code=pressKey'cV', fText=CHAR.icon.import}, WIDGET.newSwitch{name='mission',x=1150,y=340,lim=280,disp=CUSval('missionKill'),code=CUSrev('missionKill')}, diff --git a/parts/scenes/custom_sequence.lua b/parts/scenes/custom_sequence.lua index 25b5eea4..5204aaba 100644 --- a/parts/scenes/custom_sequence.lua +++ b/parts/scenes/custom_sequence.lua @@ -28,7 +28,7 @@ local minoKey2={ z=8,s=9,t=14,j=19,l=20,i=25,['-']=26,o=29, } function scene.keyDown(key) - if key=='left'then + if key=='left' then local p=cur if p==0 then cur=#BAG @@ -38,7 +38,7 @@ function scene.keyDown(key) until BAG[p]~=BAG[cur] cur=p end - elseif key=='right'then + elseif key=='right' then local p=cur if p==#BAG then cur=0 @@ -48,7 +48,7 @@ function scene.keyDown(key) until BAG[p+1]~=BAG[cur+1] cur=p end - elseif key=='ten'then + elseif key=='ten' then for _=1,10 do local p=cur if p==#BAG then break end @@ -57,37 +57,37 @@ function scene.keyDown(key) until BAG[p+1]~=BAG[cur+1] cur=p end - elseif key=='backspace'then + elseif key=='backspace' then if cur>0 then rem(BAG,cur) cur=cur-1 end - elseif key=='delete'then - if tryReset()then + elseif key=='delete' then + if tryReset() then TABLE.cut(BAG) cur=0 SFX.play('finesseError',.7) end - elseif key=='='then + elseif key=='=' then local l={1,2,3,4,5,6,7} - repeat scene.keyDown(rem(l,math.random(#l)))until not l[1] - elseif key=='tab'then - WIDGET.active.sequence:scroll(kb.isDown('lshift','rshift')and -1 or 1) - elseif key=='c'and kb.isDown('lctrl','rctrl')or key=='cC'then + repeat scene.keyDown(rem(l,math.random(#l))) until not l[1] + elseif key=='tab' then + WIDGET.active.sequence:scroll(kb.isDown('lshift','rshift') and -1 or 1) + elseif key=='c' and kb.isDown('lctrl','rctrl') or key=='cC' then if #BAG>0 then sys.setClipboardText("Techmino SEQ:"..DATA.copySequence()) MES.new('check',text.exportSuccess) end - elseif key=='v'and kb.isDown('lctrl','rctrl')or key=='cV'then + elseif key=='v' and kb.isDown('lctrl','rctrl') or key=='cV' then local str=sys.getClipboardText() local p=str:find(":")--ptr* if p then - if not str:sub(1,p-1):find("SEQ")then + if not str:sub(1,p-1):find("SEQ") then MES.new('error',text.pasteWrongPlace) end str=str:sub(p+1) end - if DATA.pasteSequence(str)then + if DATA.pasteSequence(str) then MES.new('check',text.importSuccess) cur=#BAG else @@ -95,13 +95,13 @@ function scene.keyDown(key) cur=0 MES.new('error',text.dataCorrupted) end - elseif key=='escape'then + elseif key=='escape' then SCN.back() - elseif type(key)=='number'then + elseif type(key)=='number' then cur=cur+1 ins(BAG,cur,key) elseif #key==1 then - key=(kb.isDown('lshift','lalt','rshift','ralt')and minoKey2 or minoKey)[key] + key=(kb.isDown('lshift','lalt','rshift','ralt') and minoKey2 or minoKey)[key] if key then local p=cur+1 while BAG[p]==key do p=p+1 end @@ -112,7 +112,7 @@ function scene.keyDown(key) end end -local blockCharWidth={}for i=1,#BLOCK_CHARS do blockCharWidth[i]=gc.newText(FONT.get(60),BLOCK_CHARS[i]):getWidth()end +local blockCharWidth={} for i=1,#BLOCK_CHARS do blockCharWidth[i]=gc.newText(FONT.get(60),BLOCK_CHARS[i]):getWidth() end function scene.draw() --Draw frame gc_setColor(COLOR.Z) @@ -128,7 +128,7 @@ function scene.draw() local i,j=1,#BAG local count=1 repeat - if BAG[i]==BAG[i-1]and i-1~=cur then + if BAG[i]==BAG[i-1] and i-1~=cur then count=count+1 else if count>1 then @@ -217,7 +217,7 @@ scene.widgetList={ WIDGET.newKey{name='O1', x=920,y=640,w=80,color='dH',font=100,fText=CHAR.mino.O1, code=pressKey(29)}, - WIDGET.newButton{name='copy', x=1140,y=460,w=170,h=80,color='lR',font=50,fText=CHAR.icon.export,code=pressKey'cC',hideF=function()return #BAG==0 end}, + WIDGET.newButton{name='copy', x=1140,y=460,w=170,h=80,color='lR',font=50,fText=CHAR.icon.export,code=pressKey'cC',hideF=function() return #BAG==0 end}, WIDGET.newButton{name='paste',x=1140,y=550,w=170,h=80,color='lB',font=50,fText=CHAR.icon.import,code=pressKey'cV'}, WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene}, } diff --git a/parts/scenes/depause.lua b/parts/scenes/depause.lua index 851ecbb9..f815cf7d 100644 --- a/parts/scenes/depause.lua +++ b/parts/scenes/depause.lua @@ -7,13 +7,13 @@ local timer function scene.sceneInit() timer=1 scene.widgetList.pause.x= - SETTING.menuPos=='right'and 1195 or - SETTING.menuPos=='middle'and 860 or - SETTING.menuPos=='left'and 190 + SETTING.menuPos=='right' and 1195 or + SETTING.menuPos=='middle' and 860 or + SETTING.menuPos=='left' and 190 end function scene.keyDown(key) - if key=='escape'then + if key=='escape' then pauseGame() end end diff --git a/parts/scenes/dict.lua b/parts/scenes/dict.lua index 8f9c3521..ec5ea401 100644 --- a/parts/scenes/dict.lua +++ b/parts/scenes/dict.lua @@ -32,11 +32,11 @@ local typeColor={ local function _filter(word_org) local word=word_org word=word:gsub("[Tt]etris",CHAR.zChan.thinking) - if FNNS then word=word:gsub("[Pp]\97\116\114\101\111\110",CHAR.zChan.qualified)end + if FNNS then word=word:gsub("[Pp]\97\116\114\101\111\110",CHAR.zChan.qualified) end return word,word_org end local function _scanDict(D) - if not D[1][1]then return end + if not D[1][1] then return end local cut=TABLE.cut for i=1,#D do local O=D[i] @@ -48,7 +48,7 @@ local function _scanDict(D) cut(O) end end -local function _getList()return result[1]and result or dict end +local function _getList() return result[1] and result or dict end local function _clearResult() TABLE.cut(result) selected=1 @@ -61,7 +61,7 @@ local function _search() _clearResult() local first for i=1,#dict do - local pos=find(dict[i].title:lower(),input,nil,true)or find(dict[i].keywords,input,nil,true) + local pos=find(dict[i].title:lower(),input,nil,true) or find(dict[i].keywords,input,nil,true) if pos==1 and not first then ins(result,1,dict[i]) first=true @@ -76,7 +76,7 @@ local function _search() end function scene.sceneInit() - dict=require("parts.language.dict_"..(SETTING.locale:find'zh'and'zh'or SETTING.locale:find'ja'and'ja'or'en')) + dict=require("parts.language.dict_"..(SETTING.locale:find'zh' and 'zh' or SETTING.locale:find'ja' and 'ja' or 'en')) _scanDict(dict) inputBox:clear() @@ -95,7 +95,7 @@ function scene.wheelMoved(_,y) WHEELMOV(y) end function scene.keyDown(key) - if key=='up'then + if key=='up' then if selected and selected>1 then selected=selected-1 if selectedscrollPos+15 then scrollPos=selected-15 end scene.widgetList.copy.hide=false end - elseif key=='left'or key=='pageup'then - for _=1,12 do scene.keyDown('up')end - elseif key=='right'or key=='pagedown'then - for _=1,12 do scene.keyDown('down')end - elseif key=='application'then + elseif key=='left' or key=='pageup' then + for _=1,12 do scene.keyDown('up') end + elseif key=='right' or key=='pagedown' then + for _=1,12 do scene.keyDown('down') end + elseif key=='application' then local url=_getList()[selected].url - if url then love.system.openURL(url)end - elseif key=='delete'then - if inputBox:hasText()then + if url then love.system.openURL(url) end + elseif key=='delete' then + if inputBox:hasText() then _clearResult() inputBox:clear() SFX.play('hold') end - elseif key=='escape'then - if inputBox:hasText()then + elseif key=='escape' then + if inputBox:hasText() then scene.keyDown('delete') else SCN.back() end - elseif key=='c'and love.keyboard.isDown('lctrl','rctrl')or key=='cC'then + elseif key=='c' and love.keyboard.isDown('lctrl','rctrl') or key=='cC' then local t=_getList()[selected] - t=t.title_Org..":\n"..t.content_Org..(t.url and"\n[ "..t.url.." ]\n"or"\n")..text.dictNote + t=t.title_Org..":\n"..t.content_Org..(t.url and "\n[ "..t.url.." ]\n" or "\n")..text.dictNote love.system.setClipboardText(t) scene.widgetList.copy.hide=true MES.new('info',text.copyDone) return else - if not WIDGET.isFocus(inputBox)then + if not WIDGET.isFocus(inputBox) then WIDGET.focus(inputBox) end return true @@ -190,7 +190,7 @@ function scene.draw() gc.rectangle('fill',20,143+35*(selected-scrollPos),280,35) setFont(30) - for i=1,min(#list,15)do + for i=1,min(#list,15) do local y=142+35*i i=i+scrollPos local item=list[i] @@ -215,7 +215,7 @@ scene.widgetList={ WIDGET.newText{name='book', x=20,y=15,font=70,align='L',fText=CHAR.icon.zBook}, WIDGET.newText{name='title', x=100,y=15,font=70,align='L'}, inputBox, - WIDGET.newKey{name='link', x=1120,y=655,w=80,font=55,fText=CHAR.icon.globe, code=pressKey'application',hideF=function()return not _getList()[selected].url end}, + WIDGET.newKey{name='link', x=1120,y=655,w=80,font=55,fText=CHAR.icon.globe, code=pressKey'application',hideF=function() return not _getList()[selected].url end}, WIDGET.newKey{name='copy', x=1210,y=655,w=80,font=50,fText=CHAR.icon.copy, code=pressKey'cC'}, WIDGET.newKey{name='up', x=1120,y=475,w=80,font=50,fText=CHAR.key.up, code=pressKey'up',hide=not MOBILE}, WIDGET.newKey{name='down', x=1120,y=565,w=80,font=50,fText=CHAR.key.down, code=pressKey'down',hide=not MOBILE}, diff --git a/parts/scenes/error.lua b/parts/scenes/error.lua index dd2629d7..2272eddc 100644 --- a/parts/scenes/error.lua +++ b/parts/scenes/error.lua @@ -5,9 +5,9 @@ local errorShot,errorInfo local scene={} function scene.sceneInit() - BGcolor=math.random()>.026 and{.3,.5,.9}or{.62,.3,.926} + BGcolor=math.random()>.026 and{.3,.5,.9} or{.62,.3,.926} sysAndScn=SYSTEM.."-"..VERSION.string.." scene:"..Z.getErr('#').scene - errorText=LOADED and text.errorMsg or"An error has occurred while the game was loading.\nAn error log has been created so you can send it to the author." + errorText=LOADED and text.errorMsg or "An error has occurred while the game was loading.\nAn error log has been created so you can send it to the author." errorShot,errorInfo=Z.getErr('#').shot,Z.getErr('#').mes NET.closeWS() if SETTING then diff --git a/parts/scenes/game.lua b/parts/scenes/game.lua index 1e112880..ae51c02a 100644 --- a/parts/scenes/game.lua +++ b/parts/scenes/game.lua @@ -20,20 +20,20 @@ local scene={} local function _updateMenuButtons() WIDGET.active.restart.hide=replaying - local pos=(GAME.tasUsed or replaying)and'right'or SETTING.menuPos + local pos=(GAME.tasUsed or replaying) and 'right' or SETTING.menuPos modeTextWidK=math.min(280/TEXTOBJ.modeName:getWidth(),1) if GAME.replaying then WIDGET.active.pause.x=1195 modeTextPos=1185-TEXTOBJ.modeName:getWidth()*modeTextWidK - elseif pos=='right'then + elseif pos=='right' then WIDGET.active.restart.x=1125 WIDGET.active.pause.x=1195 modeTextPos=1115-TEXTOBJ.modeName:getWidth()*modeTextWidK - elseif pos=='middle'then + elseif pos=='middle' then WIDGET.active.restart.x=360 WIDGET.active.pause.x=860 modeTextPos=940 - elseif pos=='left'then + elseif pos=='left' then WIDGET.active.restart.x=120 WIDGET.active.pause.x=190 modeTextPos=1200-TEXTOBJ.modeName:getWidth()*modeTextWidK @@ -108,10 +108,10 @@ local function _rep5() gameRate=5 _updateRepButtons() end -local function _step()trigGameRate=trigGameRate+1 end +local function _step() trigGameRate=trigGameRate+1 end local function _restart() - resetGameData(PLAYERS[1].frameRun<240 and'q') + resetGameData(PLAYERS[1].frameRun<240 and 'q') noKey=replaying noTouch=replaying trigGameRate,gameRate=0,1 @@ -143,7 +143,7 @@ function scene.sceneInit() noKey=replaying noTouch=not SETTING.VKSwitch or replaying - if SCN.prev~='depause'and SCN.prev~='pause'then + if SCN.prev~='depause' and SCN.prev~='pause' then trigGameRate,gameRate=0,1 elseif not replaying then if GAME.tasUsed then @@ -189,7 +189,7 @@ function scene.touchMove() local B=keys[n] if B.ava then for i=1,#L,2 do - if(L[i]-B.x)^2+(L[i+1]-B.y)^2<=B.r^2 then + if (L[i]-B.x)^2+(L[i+1]-B.y)^2<=B.r^2 then goto CONTINUE_nextKey end end @@ -201,39 +201,39 @@ function scene.touchMove() end function scene.keyDown(key,isRep) if replaying then - if key=='space'then + if key=='space' then if not isRep then gameRate=gameRate==0 and 1 or 0 end _updateRepButtons() - elseif key=='left'then + elseif key=='left' then if not isRep then _speedDown() end - elseif key=='right'then + elseif key=='right' then if gameRate==0 then _step() elseif not isRep then _speedUp() end - elseif key=='escape'then + elseif key=='escape' then pauseGame() end else if isRep then return - elseif _checkGameKeyDown(key)then + elseif _checkGameKeyDown(key) then if GAME.tasUsed then - if key=='f1'then + if key=='f1' then if not isRep then gameRate=gameRate==0 and .125 or 0 end _updateRepButtons() - elseif key=='f2'then + elseif key=='f2' then if not isRep then _speedDown() end - elseif key=='f3'then + elseif key=='f3' then if gameRate==0 then _step() elseif not isRep then @@ -241,7 +241,7 @@ function scene.keyDown(key,isRep) end end end - if key=='escape'then + if key=='escape' then pauseGame() end end @@ -267,7 +267,7 @@ function scene.gamepadDown(key) else _restart() end - elseif key=='back'then + elseif key=='back' then pauseGame() end end @@ -288,10 +288,10 @@ local function _update_common(dt) VK.update(dt) --Update players - for p=1,#PLAYERS do PLAYERS[p]:update(dt)end + for p=1,#PLAYERS do PLAYERS[p]:update(dt) end --Fresh royale target - if PLAYERS[1].frameRun%120==0 and PLAYERS[1].gameEnv.layout=='royale'then + if PLAYERS[1].frameRun%120==0 and PLAYERS[1].gameEnv.layout=='royale' then freshMostDangerous() end @@ -337,7 +337,7 @@ function scene.draw() VK.draw() --Attacking & Being attacked - if PLAYERS[1].gameEnv.layout=='royale'then + if PLAYERS[1].gameEnv.layout=='royale' then local P=PLAYERS[1] gc_setLineWidth(5) gc_setColor(.8,1,0,.2) @@ -362,7 +362,7 @@ function scene.draw() gc_draw(TEXTOBJ.modeName,modeTextPos,10,0,modeTextWidK,1) local M=GAME.curMode if M then - if M.score and M.records[1]then + if M.score and M.records[1] then setFont(15) gc_setColor(1,1,1,.6) gc_print(M.scoreDisp(M.records[1]),modeTextPos,45) diff --git a/parts/scenes/history.lua b/parts/scenes/history.lua index 86b529f2..622343c0 100644 --- a/parts/scenes/history.lua +++ b/parts/scenes/history.lua @@ -9,15 +9,15 @@ function scene.wheelMoved(_,y) WHEELMOV(y) end function scene.keyDown(key) - if key=='up'then + if key=='up' then WIDGET.active.texts:scroll(-5) - elseif key=='down'then + elseif key=='down' then WIDGET.active.texts:scroll(5) - elseif key=='pageup'then + elseif key=='pageup' then WIDGET.active.texts:scroll(-20) - elseif key=='pagedown'then + elseif key=='pagedown' then WIDGET.active.texts:scroll(20) - elseif key=='escape'then + elseif key=='escape' then SCN.back() end end diff --git a/parts/scenes/lang.lua b/parts/scenes/lang.lua index e09734ef..a8232622 100644 --- a/parts/scenes/lang.lua +++ b/parts/scenes/lang.lua @@ -36,7 +36,7 @@ function scene.draw() love.graphics.setColor(1,1,1,1-curLang%1*2) GC.mStr(languages[curLang-curLang%1],640,20) love.graphics.setColor(1,1,1,curLang%1*2) - GC.mStr(languages[curLang-curLang%1+1]or languages[1],640,20) + GC.mStr(languages[curLang-curLang%1+1] or languages[1],640,20) end local function _setLang(lid) @@ -45,23 +45,23 @@ local function _setLang(lid) TEXT.clear() TEXT.show(langList[lid],640,360,100,'appear',.626) collectgarbage() - if FIRSTLAUNCH then SCN.back()end + if FIRSTLAUNCH then SCN.back() end end scene.widgetList={ - WIDGET.newButton{x=270,y=210,w=330,h=100,font=40, fText=langList.en, color='R',sound='click',code=function()_setLang('en')end}, - WIDGET.newButton{x=270,y=330,w=330,h=100,font=40, fText=langList.fr, color='F',sound='click',code=function()_setLang('fr')end}, - WIDGET.newButton{x=270,y=450,w=330,h=100,font=35, fText=langList.es, color='O',sound='click',code=function()_setLang('es')end}, - WIDGET.newButton{x=270,y=570,w=330,h=100,font=35, fText=langList.id, color='Y',sound='click',code=function()_setLang('id')end}, + WIDGET.newButton{x=270,y=210,w=330,h=100,font=40, fText=langList.en, color='R',sound='click',code=function()_setLang('en') end}, + WIDGET.newButton{x=270,y=330,w=330,h=100,font=40, fText=langList.fr, color='F',sound='click',code=function()_setLang('fr') end}, + WIDGET.newButton{x=270,y=450,w=330,h=100,font=35, fText=langList.es, color='O',sound='click',code=function()_setLang('es') end}, + WIDGET.newButton{x=270,y=570,w=330,h=100,font=35, fText=langList.id, color='Y',sound='click',code=function()_setLang('id') end}, - WIDGET.newButton{x=640,y=210,w=330,h=100,font=40, fText=langList.pt, color='A',sound='click',code=function()_setLang('pt')end}, - WIDGET.newButton{x=640,y=330,w=330,h=100,font=40, fText=langList.symbol, color='G',sound='click',code=function()_setLang('symbol')end}, - WIDGET.newButton{x=640,y=450,w=330,h=100,font=40, fText=langList.ja, color='J',sound='click',code=function()_setLang('ja')end}, + WIDGET.newButton{x=640,y=210,w=330,h=100,font=40, fText=langList.pt, color='A',sound='click',code=function()_setLang('pt') end}, + WIDGET.newButton{x=640,y=330,w=330,h=100,font=40, fText=langList.symbol, color='G',sound='click',code=function()_setLang('symbol') end}, + WIDGET.newButton{x=640,y=450,w=330,h=100,font=40, fText=langList.ja, color='J',sound='click',code=function()_setLang('ja') end}, WIDGET.newKey {x=640,y=570,w=330,h=100,font=40, fText='', color='L'}, - WIDGET.newButton{x=1000,y=210,w=330,h=100,font=40,fText=langList.zh, color='C',sound='click',code=function()_setLang('zh')end}, - WIDGET.newButton{x=1000,y=330,w=330,h=100,font=40,fText=langList.zh_trad, color='S',sound='click',code=function()_setLang('zh_trad')end}, - WIDGET.newButton{x=1000,y=450,w=330,h=100,font=40,fText=langList.zh_code, color='P',sound='click',code=function()_setLang('zh_code')end}, + WIDGET.newButton{x=1000,y=210,w=330,h=100,font=40,fText=langList.zh, color='C',sound='click',code=function()_setLang('zh') end}, + WIDGET.newButton{x=1000,y=330,w=330,h=100,font=40,fText=langList.zh_trad, color='S',sound='click',code=function()_setLang('zh_trad') end}, + WIDGET.newButton{x=1000,y=450,w=330,h=100,font=40,fText=langList.zh_code, color='P',sound='click',code=function()_setLang('zh_code') end}, WIDGET.newButton{name='back',x=1000,y=570,w=330,h=100,sound='back',font=60,fText=CHAR.icon.back,code=backScene}, } diff --git a/parts/scenes/launchpad.lua b/parts/scenes/launchpad.lua index d79c3f64..46eae20f 100644 --- a/parts/scenes/launchpad.lua +++ b/parts/scenes/launchpad.lua @@ -14,14 +14,14 @@ local scene={} local pad pad={x=140,y=65,page=1, func={ - function()pad.page=1 end, - function()pad.page=2 end, - function()pad.page=3 end, - function()pad.page=4 end, - function()pad.page=5 end, - function()pad.page=6 end, - function()BGM.set('all','seek',0)BGM.play()end, - function()BGM.stop()end, + function() pad.page=1 end, + function() pad.page=2 end, + function() pad.page=3 end, + function() pad.page=4 end, + function() pad.page=5 end, + function() pad.page=6 end, + function() BGM.set('all','seek',0)BGM.play() end, + function() BGM.stop() end, }, funcAlpha=TABLE.new(0,8), alpha={ @@ -37,20 +37,20 @@ pad={x=140,y=65,page=1, }, { { - {samp={tag='ready3',func=function()playReadySFX(3)end}}, - {samp={tag='ready2',func=function()playReadySFX(2)end}}, - {samp={tag='ready1',func=function()playReadySFX(1)end}}, - {samp={tag='start',func=function()playReadySFX(0)end}}, + {samp={tag='ready3',func=function() playReadySFX(3) end}}, + {samp={tag='ready2',func=function() playReadySFX(2) end}}, + {samp={tag='ready1',func=function() playReadySFX(1) end}}, + {samp={tag='start',func=function() playReadySFX(0) end}}, {sfx='touch'},{sfx='lock'},{sfx='drop'},{sfx='fall'}, }, { {sfx='hold'},{sfx='prehold'}, - {samp={tag='clear_1',func=function()playClearSFX(1)end}}, - {samp={tag='clear_2',func=function()playClearSFX(2)end}}, - {samp={tag='clear_3',func=function()playClearSFX(3)end}}, - {samp={tag='clear_4',func=function()playClearSFX(4)end}}, - {samp={tag='clear_7',func=function()playClearSFX(7)end}}, - {samp={tag='clear_10',func=function()playClearSFX(10)end}}, + {samp={tag='clear_1',func=function() playClearSFX(1) end}}, + {samp={tag='clear_2',func=function() playClearSFX(2) end}}, + {samp={tag='clear_3',func=function() playClearSFX(3) end}}, + {samp={tag='clear_4',func=function() playClearSFX(4) end}}, + {samp={tag='clear_7',func=function() playClearSFX(7) end}}, + {samp={tag='clear_10',func=function() playClearSFX(10) end}}, }, {{sfx='prerotate'}, {sfx='rotate'}, {sfx='rotatekick'}, {}, {voc='single'}, {voc='double'}, {voc='triple'}, {voc='techrash'}}, {{sfx='finesseError'},{sfx='finesseError_long'},{sfx='drop_cancel'},{}, {sfx='spin_0'}, {sfx='spin_1'}, {sfx='spin_2'}, {sfx='spin_3'}}, @@ -71,20 +71,20 @@ pad={x=140,y=65,page=1, }, { { - {samp={tag='ready3',func=function()playReadySFX(3)end}}, - {samp={tag='ready2',func=function()playReadySFX(2)end}}, - {samp={tag='ready1',func=function()playReadySFX(1)end}}, - {samp={tag='start',func=function()playReadySFX(0)end}}, + {samp={tag='ready3',func=function() playReadySFX(3) end}}, + {samp={tag='ready2',func=function() playReadySFX(2) end}}, + {samp={tag='ready1',func=function() playReadySFX(1) end}}, + {samp={tag='start',func=function() playReadySFX(0) end}}, {sfx='touch'},{sfx='lock'},{sfx='drop'},{sfx='fall'}, }, { {sfx='hold'},{sfx='prehold'}, - {samp={tag='clear_1',func=function()playClearSFX(1)end}}, - {samp={tag='clear_2',func=function()playClearSFX(2)end}}, - {samp={tag='clear_3',func=function()playClearSFX(3)end}}, - {samp={tag='clear_4',func=function()playClearSFX(4)end}}, - {samp={tag='clear_7',func=function()playClearSFX(7)end}}, - {samp={tag='clear_10',func=function()playClearSFX(10)end}}, + {samp={tag='clear_1',func=function() playClearSFX(1) end}}, + {samp={tag='clear_2',func=function() playClearSFX(2) end}}, + {samp={tag='clear_3',func=function() playClearSFX(3) end}}, + {samp={tag='clear_4',func=function() playClearSFX(4) end}}, + {samp={tag='clear_7',func=function() playClearSFX(7) end}}, + {samp={tag='clear_10',func=function() playClearSFX(10) end}}, }, {{voc='mini'}, {voc='b2b'}, {voc='b3b'}, {voc='perfect_clear'}, {voc='half_clear'}, {sfx='finesseError'}, {sfx='finesseError_long'}, {sfx='drop_cancel'},}, {{voc='zspin'}, {voc='sspin'}, {voc='jspin'}, {voc='lspin'}, {voc='tspin'}, {voc='ospin'}, {voc='ispin'}, {}}, @@ -95,31 +95,31 @@ pad={x=140,y=65,page=1, }, { { - {samp={tag='clear_1',func=function()playClearSFX(1)end}}, - {samp={tag='clear_2',func=function()playClearSFX(2)end}}, - {samp={tag='clear_3',func=function()playClearSFX(3)end}}, - {samp={tag='clear_4',func=function()playClearSFX(4)end}}, - {samp={tag='clear_5',func=function()playClearSFX(5)end}}, - {samp={tag='clear_6',func=function()playClearSFX(6)end}}, - {samp={tag='clear_7',func=function()playClearSFX(7)end}}, - {samp={tag='clear_8',func=function()playClearSFX(8)end}}, + {samp={tag='clear_1',func=function() playClearSFX(1) end}}, + {samp={tag='clear_2',func=function() playClearSFX(2) end}}, + {samp={tag='clear_3',func=function() playClearSFX(3) end}}, + {samp={tag='clear_4',func=function() playClearSFX(4) end}}, + {samp={tag='clear_5',func=function() playClearSFX(5) end}}, + {samp={tag='clear_6',func=function() playClearSFX(6) end}}, + {samp={tag='clear_7',func=function() playClearSFX(7) end}}, + {samp={tag='clear_8',func=function() playClearSFX(8) end}}, }, { - {samp={tag='clear_9',func=function()playClearSFX(9)end}}, - {samp={tag='clear_10',func=function()playClearSFX(10)end}}, - {samp={tag='clear_11',func=function()playClearSFX(11)end}}, - {samp={tag='clear_12',func=function()playClearSFX(12)end}}, - {samp={tag='clear_13',func=function()playClearSFX(13)end}}, - {samp={tag='clear_14',func=function()playClearSFX(14)end}}, - {samp={tag='clear_15',func=function()playClearSFX(15)end}}, - {samp={tag='clear_16',func=function()playClearSFX(16)end}}, + {samp={tag='clear_9',func=function() playClearSFX(9) end}}, + {samp={tag='clear_10',func=function() playClearSFX(10) end}}, + {samp={tag='clear_11',func=function() playClearSFX(11) end}}, + {samp={tag='clear_12',func=function() playClearSFX(12) end}}, + {samp={tag='clear_13',func=function() playClearSFX(13) end}}, + {samp={tag='clear_14',func=function() playClearSFX(14) end}}, + {samp={tag='clear_15',func=function() playClearSFX(15) end}}, + {samp={tag='clear_16',func=function() playClearSFX(16) end}}, }, { - {samp={tag='clear_17',func=function()playClearSFX(17)end}}, - {samp={tag='clear_18',func=function()playClearSFX(18)end}}, - {samp={tag='clear_19',func=function()playClearSFX(19)end}}, - {samp={tag='clear_20',func=function()playClearSFX(20)end}}, - {samp={tag='clear_20+',func=function()playClearSFX(21)end}}, + {samp={tag='clear_17',func=function() playClearSFX(17) end}}, + {samp={tag='clear_18',func=function() playClearSFX(18) end}}, + {samp={tag='clear_19',func=function() playClearSFX(19) end}}, + {samp={tag='clear_20',func=function() playClearSFX(20) end}}, + {samp={tag='clear_20+',func=function() playClearSFX(21) end}}, {},{},{} }, {{},{},{},{},{},{},{},{}}, @@ -145,7 +145,7 @@ pad={x=140,y=65,page=1, B[y]={} for x=1,8 do local i=8*(y-1)+x - B[y][x]=L[i]and{bgm=L[i]}or{} + B[y][x]=L[i] and{bgm=L[i]} or{} end end return B @@ -160,10 +160,10 @@ local function press(x,y) pad.funcAlpha[y]=1 else local k=pad[pad.page][y][x] - if k.samp then k.samp.func()end - if k.sfx then SFX.play(k.sfx,k.vol)end - if k.voc then VOC.play(k.voc)end - if k.bgm then BGM.play(k.bgm)end + if k.samp then k.samp.func() end + if k.sfx then SFX.play(k.sfx,k.vol) end + if k.voc then VOC.play(k.voc) end + if k.bgm then BGM.play(k.bgm) end pad.alpha[y][x]=1 end end @@ -178,29 +178,29 @@ scene.mouseDown=scene.touchDown function scene.keyDown(key,isRep) if isRep then return end - if key=='z'or key=='x'then + if key=='z' or key=='x' then love.mousepressed(love.mouse.getPosition()) elseif #key==1 then - if("12345678"):find(key,nil,true)then + if ("12345678"):find(key,nil,true) then press(0,tonumber(key)) else key=("hjkluiop"):find(key,nil,true) if key then - if isDown('q')then press(key,1)end - if isDown('w')then press(key,2)end - if isDown('e')then press(key,3)end - if isDown('r')then press(key,4)end - if isDown('a')then press(key,5)end - if isDown('s')then press(key,6)end - if isDown('d')then press(key,7)end - if isDown('f')then press(key,8)end + if isDown('q') then press(key,1) end + if isDown('w') then press(key,2) end + if isDown('e') then press(key,3) end + if isDown('r') then press(key,4) end + if isDown('a') then press(key,5) end + if isDown('s') then press(key,6) end + if isDown('d') then press(key,7) end + if isDown('f') then press(key,8) end end end - elseif key=='tab'then + elseif key=='tab' then SCN.swapTo('music','none') - elseif key=='space'then + elseif key=='space' then showLabel=not showLabel - elseif key=='escape'then + elseif key=='escape' then SCN.back() end end @@ -217,7 +217,7 @@ function scene.update(dt) end end end for i=1,8 do - if isDown(("qwerasdf"):sub(i,i))then + if isDown(("qwerasdf"):sub(i,i)) then local L=pad.alpha[i] for j=1,8 do pad.alpha[i][j]=min(L[j]+dt*10,max(L[j],.4)) @@ -260,15 +260,15 @@ function scene.draw() gc_rectangle('line',x*80+2,(y-1)*80+2,76,76,5) local k=pad[pad.page][y][x] if showLabel then - if k.sfx then mStr(k.sfx,x*80+40,y*80-30)gc_circle('line',x*80+40,(y-1)*80+40,5)end - if k.voc then mStr(k.voc,x*80+40,y*80-17)gc_rectangle('line',x*80+30,(y-1)*80+30,20,20,1)end - if k.samp then mStr(k.samp.tag,x*80+40,y*80-30)gc_rectangle('fill',x*80+10,(y-1)*80+35,60,5,1)end - if k.bgm then mStr(k.bgm,x*80+40,y*80-78)gc_rectangle('fill',x*80+20,(y-1)*80+15,40,5,2)end + if k.sfx then mStr(k.sfx,x*80+40,y*80-30)gc_circle('line',x*80+40,(y-1)*80+40,5) end + if k.voc then mStr(k.voc,x*80+40,y*80-17)gc_rectangle('line',x*80+30,(y-1)*80+30,20,20,1) end + if k.samp then mStr(k.samp.tag,x*80+40,y*80-30)gc_rectangle('fill',x*80+10,(y-1)*80+35,60,5,1) end + if k.bgm then mStr(k.bgm,x*80+40,y*80-78)gc_rectangle('fill',x*80+20,(y-1)*80+15,40,5,2) end else - if k.sfx then gc_circle('line',x*80+40,(y-1)*80+40,5)end - if k.voc then gc_rectangle('line',x*80+30,(y-1)*80+30,20,20,1)end - if k.samp then gc_rectangle('fill',x*80+10,(y-1)*80+35,60,5,1)end - if k.bgm then gc_rectangle('fill',x*80+20,(y-1)*80+15,40,5,2)end + if k.sfx then gc_circle('line',x*80+40,(y-1)*80+40,5) end + if k.voc then gc_rectangle('line',x*80+30,(y-1)*80+30,20,20,1) end + if k.samp then gc_rectangle('fill',x*80+10,(y-1)*80+35,60,5,1) end + if k.bgm then gc_rectangle('fill',x*80+20,(y-1)*80+15,40,5,2) end end if pad.alpha[y][x]>0 then gc_setColor(1,1,1,pad.alpha[y][x]*.7) @@ -281,10 +281,10 @@ end scene.widgetList={ WIDGET.newText{name='title', x=640, y=-5,font=50}, - WIDGET.newSlider{name='bgm', x=1000,y=80, lim=130,w=250,disp=SETval('bgm'),code=function(v)SETTING.bgm=v BGM.setVol(SETTING.bgm)end}, - WIDGET.newSlider{name='sfx', x=1000,y=150,lim=130,w=250,disp=SETval('sfx'),code=function(v)SETTING.sfx=v SFX.setVol(SETTING.sfx)end}, - WIDGET.newSlider{name='voc', x=1000,y=220,lim=130,w=250,disp=SETval('voc'),code=function(v)SETTING.voc=v VOC.setVol(SETTING.voc)end}, - WIDGET.newSwitch{name='label',x=1200,y=290,lim=160,disp=function()return showLabel end,code=pressKey'space',}, + WIDGET.newSlider{name='bgm', x=1000,y=80, lim=130,w=250,disp=SETval('bgm'),code=function(v) SETTING.bgm=v BGM.setVol(SETTING.bgm) end}, + WIDGET.newSlider{name='sfx', x=1000,y=150,lim=130,w=250,disp=SETval('sfx'),code=function(v) SETTING.sfx=v SFX.setVol(SETTING.sfx) end}, + WIDGET.newSlider{name='voc', x=1000,y=220,lim=130,w=250,disp=SETval('voc'),code=function(v) SETTING.voc=v VOC.setVol(SETTING.voc) end}, + WIDGET.newSwitch{name='label',x=1200,y=290,lim=160,disp=function() return showLabel end,code=pressKey'space',}, WIDGET.newButton{name='music',x=1140,y=540,w=170,h=80,font=40,code=pressKey'tab'}, WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene}, } diff --git a/parts/scenes/legals.lua b/parts/scenes/legals.lua index fec9a7cc..badc0922 100644 --- a/parts/scenes/legals.lua +++ b/parts/scenes/legals.lua @@ -13,15 +13,15 @@ function scene.wheelMoved(_,y) WHEELMOV(y) end function scene.keyDown(key) - if key=='up'then + if key=='up' then WIDGET.active.texts:scroll(-5) - elseif key=='down'then + elseif key=='down' then WIDGET.active.texts:scroll(5) - elseif key=='pageup'then + elseif key=='pageup' then WIDGET.active.texts:scroll(-20) - elseif key=='pagedown'then + elseif key=='pagedown' then WIDGET.active.texts:scroll(20) - elseif key=='escape'then + elseif key=='escape' then SCN.back() end end diff --git a/parts/scenes/load.lua b/parts/scenes/load.lua index 32f54c41..d1099116 100644 --- a/parts/scenes/load.lua +++ b/parts/scenes/load.lua @@ -9,11 +9,11 @@ local studioLogo--Studio logo text object local logoColor1,logoColor2 local titleTransform={ - function(t)GC.translate(0,max(50-t,0)^2/25)end, - function(t)GC.translate(0,-max(50-t,0)^2/25)end, - function(t,i)local d=max(50-t,0)GC.translate(sin(TIME()*3+626*i)*d,cos(TIME()*3+626*i)*d)end, - function(t,i)local d=max(50-t,0)GC.translate(sin(TIME()*3+626*i)*d,-cos(TIME()*3+626*i)*d)end, - function(t)GC.setColor(1,1,1,min(t*.02,1)+math.random()*.2)end, + function(t) GC.translate(0,max(50-t,0)^2/25) end, + function(t) GC.translate(0,-max(50-t,0)^2/25) end, + function(t,i) local d=max(50-t,0)GC.translate(sin(TIME()*3+626*i)*d,cos(TIME()*3+626*i)*d) end, + function(t,i) local d=max(50-t,0)GC.translate(sin(TIME()*3+626*i)*d,-cos(TIME()*3+626*i)*d) end, + function(t) GC.setColor(1,1,1,min(t*.02,1)+math.random()*.2) end, } local loadingThread=coroutine.wrap(function() @@ -32,7 +32,7 @@ local loadingThread=coroutine.wrap(function() coroutine.yield('loadSample')SFX.loadSample{name='lead',path='media/sample/lead',base='A3'}--A3~A5 coroutine.yield('loadSample')SFX.loadSample{name='bell',path='media/sample/bell',base='A4'}--A4~A6 coroutine.yield('loadVoice')VOC.load('media/vocal/'..SETTING.vocPack..'/') - coroutine.yield('loadFont')for i=1,17 do getFont(15+5*i)getFont(15+5*i,'mono')end + coroutine.yield('loadFont') for i=1,17 do getFont(15+5*i)getFont(15+5*i,'mono') end coroutine.yield('loadModeIcon') local modeIcons={} @@ -93,8 +93,8 @@ local loadingThread=coroutine.wrap(function() coroutine.yield('loadMode') for _,M in next,MODES do - M.records=loadFile("record/"..M.name..".rec",'-luaon -canSkip')or M.score and{} - M.icon=M.icon and(modeIcons[M.icon]or GC.newImage("media/image/modeicon/"..M.icon..".png")) + M.records=loadFile("record/"..M.name..".rec",'-luaon -canSkip') or M.score and{} + M.icon=M.icon and (modeIcons[M.icon] or GC.newImage("media/image/modeicon/"..M.icon..".png")) end coroutine.yield('loadOther') @@ -115,7 +115,7 @@ function scene.sceneInit() progress=0 maxProgress=10 t1,t2=0,0--Timer - animeType={}for i=1,#SVG_TITLE_FILL do animeType[i]=math.random(#titleTransform)end--Random animation type + animeType={} for i=1,#SVG_TITLE_FILL do animeType[i]=math.random(#titleTransform) end--Random animation type end function scene.sceneBack() love.event.quit() @@ -127,13 +127,13 @@ function scene.mouseDown() SCN.push('main') SCN.swapTo('lang') else - SCN.swapTo(SETTING.simpMode and'main_simple'or'main') + SCN.swapTo(SETTING.simpMode and 'main_simple' or 'main') end end end scene.touchDown=scene.mouseDown function scene.keyDown(key) - if key=='escape'then + if key=='escape' then love.event.quit() else scene.mouseDown() @@ -177,19 +177,19 @@ function scene.draw() end GC.setColor(1,1,1,min(t*.025,1)) GC.polygon('line',SVG_TITLE_LINE[i]) - if i==8 then GC.polygon('line',SVG_TITLE_LINE[9])end + if i==8 then GC.polygon('line',SVG_TITLE_LINE[9]) end GC.pop() end end GC.pop() GC.setColor(logoColor1[1],logoColor1[2],logoColor1[3],progress/maxProgress)mDraw(studioLogo,640,400) - GC.setColor(logoColor2[1],logoColor2[2],logoColor2[3],progress/maxProgress)for dx=-2,2,2 do for dy=-2,2,2 do mDraw(studioLogo,640+dx,400+dy)end end + GC.setColor(logoColor2[1],logoColor2[2],logoColor2[3],progress/maxProgress) for dx=-2,2,2 do for dy=-2,2,2 do mDraw(studioLogo,640+dx,400+dy) end end GC.setColor(.2,.2,.2,progress/maxProgress)mDraw(studioLogo,640,400) GC.setColor(COLOR.Z) setFont(30) - GC.mStr(text.loadText[loading]or"",640,530) + GC.mStr(text.loadText[loading] or "",640,530) end return scene diff --git a/parts/scenes/login.lua b/parts/scenes/login.lua index 7dc7b13b..5897701a 100644 --- a/parts/scenes/login.lua +++ b/parts/scenes/login.lua @@ -5,7 +5,7 @@ local showEmail=true local function _login() local email,password=emailBox:getText(),passwordBox:getText() - if not STRING.simpEmailCheck(email)then + if not STRING.simpEmailCheck(email) then MES.new('error',text.wrongEmail)return elseif #password==0 then MES.new('error',text.noPassword)return @@ -29,10 +29,10 @@ end scene.widgetList={ WIDGET.newText{name='title', x=80, y=50,font=70,align='L'}, - WIDGET.newButton{name='register', x=1140,y=100,w=170,h=80,color='lY',code=function()SCN.swapTo('register','swipeR')end}, + WIDGET.newButton{name='register', x=1140,y=100,w=170,h=80,color='lY',code=function() SCN.swapTo('register','swipeR') end}, emailBox, passwordBox, - WIDGET.newSwitch{name='showEmail',x=550, y=420,disp=function()return showEmail end,code=function()showEmail=not showEmail emailBox.secret=not showEmail end}, + WIDGET.newSwitch{name='showEmail',x=550, y=420,disp=function() return showEmail end,code=function() showEmail=not showEmail emailBox.secret=not showEmail end}, WIDGET.newKey{name='login', x=1140,y=540,w=170,h=80,font=40,code=pressKey'return'}, WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene}, } diff --git a/parts/scenes/main.lua b/parts/scenes/main.lua index 1030c618..02c95c25 100644 --- a/parts/scenes/main.lua +++ b/parts/scenes/main.lua @@ -36,7 +36,7 @@ function scene.sceneInit() end function scene.resize() - local qpModeName=text.modes[STAT.lastPlay]and text.modes[STAT.lastPlay][1]or"["..STAT.lastPlay.."]" + local qpModeName=text.modes[STAT.lastPlay] and text.modes[STAT.lastPlay][1] or "["..STAT.lastPlay.."]" scene.widgetList[2]:setObject(text.WidgetText.main.qplay..qpModeName) end @@ -47,7 +47,7 @@ function scene.mouseDown(x,y) end scene.touchDown=scene.mouseDown local function _testButton(n) - if WIDGET.isFocus(scene.widgetList[n])then + if WIDGET.isFocus(scene.widgetList[n]) then return true else WIDGET.focus(scene.widgetList[n]) @@ -55,58 +55,58 @@ local function _testButton(n) end function scene.keyDown(key,isRep) if isRep then return true end - if key=='1'then - if _testButton(1)then + if key=='1' then + if _testButton(1) then SCN.go('mode') end - elseif key=='q'then - if _testButton(2)then + elseif key=='q' then + if _testButton(2) then loadGame(STAT.lastPlay,true) end - elseif key=='a'then - if _testButton(3)then + elseif key=='a' then + if _testButton(3) then NET.autoLogin() end - elseif key=='z'then - if _testButton(4)then + elseif key=='z' then + if _testButton(4) then SCN.go('customGame') end - elseif key=='-'then - if _testButton(5)then + elseif key=='-' then + if _testButton(5) then SCN.go('setting_game') end - elseif key=='p'then - if _testButton(6)then + elseif key=='p' then + if _testButton(6) then SCN.go('stat') end - elseif key=='l'then - if _testButton(7)then + elseif key=='l' then + if _testButton(7) then SCN.go('dict') end - elseif key==','then - if _testButton(8)then + elseif key==',' then + if _testButton(8) then SCN.go('replays') end - elseif key=='2'then - if _testButton(9)then + elseif key=='2' then + if _testButton(9) then SCN.go('music') end - elseif key=='3'then - if _testButton(10)then + elseif key=='3' then + if _testButton(10) then SCN.go('lang') end - elseif key=='x'then - if _testButton(11)then + elseif key=='x' then + if _testButton(11) then SCN.go('about') end - elseif key=='m'then - if _testButton(12)then + elseif key=='m' then + if _testButton(12) then SCN.go('manual') end - elseif key=='c'then + elseif key=='c' then enterConsole() - elseif key=='escape'then - if tryBack()then + elseif key=='escape' then + if tryBack() then VOC.play('bye') SCN.swapTo('quit','slowFade') end @@ -119,13 +119,13 @@ function scene.update(dt) if dt>.26 then return end PLAYERS[1]:update(dt) scrollX=scrollX-162*dt - if scrollX<-tip:getWidth()then + if scrollX<-tip:getWidth() then scrollX=tipLength tip:set(text.getTip()) end local L=scene.widgetList for i=1,8 do - L[i].x=MATH.expApproach(L[i].x,(widgetX0[i]-400+(WIDGET.isFocus(L[i])and(i<5 and 100 or -100)or 0)),dt*9) + L[i].x=MATH.expApproach(L[i].x,(widgetX0[i]-400+(WIDGET.isFocus(L[i]) and (i<5 and 100 or -100) or 0)),dt*9) end end diff --git a/parts/scenes/main_simple.lua b/parts/scenes/main_simple.lua index ee1d9d3a..3f73f894 100644 --- a/parts/scenes/main_simple.lua +++ b/parts/scenes/main_simple.lua @@ -16,12 +16,12 @@ end scene.widgetList={ WIDGET.newText{name='system', x=750,y=280,color='Z',align='L',fText=SYSTEM}, WIDGET.newText{name='version', x=950,y=280,color='Z',align='L',fText=VERSION.string}, - WIDGET.newButton{name='sprint', x=260,y=480,w=260,font=50,code=function()loadGame('sprint_40l',true)end}, - WIDGET.newButton{name='marathon',x=640,y=480,w=260,font=50,code=function()loadGame('marathon_n',true)end}, + WIDGET.newButton{name='sprint', x=260,y=480,w=260,font=50,code=function() loadGame('sprint_40l',true) end}, + WIDGET.newButton{name='marathon',x=640,y=480,w=260,font=50,code=function() loadGame('marathon_n',true) end}, WIDGET.newButton{name='setting', x=1000,y=400,w=120,font=90,fText=CHAR.icon.settings,code=goScene'setting_game'}, WIDGET.newButton{name='lang', x=1000,y=560,w=120,font=90,fText=CHAR.icon.language,code=goScene'lang'}, WIDGET.newButton{name='dict', x=1160,y=400,w=120,font=90,fText=CHAR.icon.zBook,code=goScene'dict'}, - WIDGET.newButton{name='quit', x=1160,y=560,w=120,font=80,fText=CHAR.key.macEsc,code=function()VOC.play('bye')SCN.swapTo('quit','slowFade')end}, + WIDGET.newButton{name='quit', x=1160,y=560,w=120,font=80,fText=CHAR.key.macEsc,code=function() VOC.play('bye')SCN.swapTo('quit','slowFade') end}, } return scene diff --git a/parts/scenes/manual.lua b/parts/scenes/manual.lua index 0de10535..ac9e62a8 100644 --- a/parts/scenes/manual.lua +++ b/parts/scenes/manual.lua @@ -2,7 +2,7 @@ local scene={} function scene.sceneInit() BG.set('cubes') - local fileData=FILE.load('parts/language/manual_'..(SETTING.locale:find'zh'and'zh'or SETTING.locale:find'ja'and'ja'or'en')..'.txt','-string') + local fileData=FILE.load('parts/language/manual_'..(SETTING.locale:find'zh' and 'zh' or SETTING.locale:find'ja' and 'ja' or 'en')..'.txt','-string') if fileData then WIDGET.active.texts:setTexts(fileData:split('\n')) else @@ -15,15 +15,15 @@ function scene.wheelMoved(_,y) WHEELMOV(y) end function scene.keyDown(key) - if key=='up'then + if key=='up' then WIDGET.active.texts:scroll(-5) - elseif key=='down'then + elseif key=='down' then WIDGET.active.texts:scroll(5) - elseif key=='pageup'then + elseif key=='pageup' then WIDGET.active.texts:scroll(-20) - elseif key=='pagedown'then + elseif key=='pagedown' then WIDGET.active.texts:scroll(20) - elseif key=='escape'then + elseif key=='escape' then SCN.back() end end diff --git a/parts/scenes/mod.lua b/parts/scenes/mod.lua index 1a5c612f..50c9ca21 100644 --- a/parts/scenes/mod.lua +++ b/parts/scenes/mod.lua @@ -47,7 +47,7 @@ end function scene.mouseMove(x,y) selected=false for _,M in next,MODOPT do - if(x-M.x)^2+(y-M.y)^2<2000 then + if (x-M.x)^2+(y-M.y)^2<2000 then selected=M break end @@ -55,7 +55,7 @@ function scene.mouseMove(x,y) end function scene.mouseDown(x,y,k) for _,M in next,MODOPT do - if(x-M.x)^2+(y-M.y)^2<2000 then + if (x-M.x)^2+(y-M.y)^2<2000 then _toggleMod(M,k==2 or love.keyboard.isDown('lshift','rshift')) break end @@ -69,9 +69,9 @@ function scene.touchDown(x,y) end function scene.keyDown(key) - if key=='tab'or key=='delete'then - if GAME.mod[1]then - while GAME.mod[1]do + if key=='tab' or key=='delete' then + if GAME.mod[1] then + while GAME.mod[1] do table.remove(GAME.mod).sel=0 end scene.widgetList.unranked.hide=scoreValid() @@ -85,7 +85,7 @@ function scene.keyDown(key) break end end - elseif key=='escape'then + elseif key=='escape' then SCN.back() end end diff --git a/parts/scenes/mode.lua b/parts/scenes/mode.lua index f4604524..e249746b 100644 --- a/parts/scenes/mode.lua +++ b/parts/scenes/mode.lua @@ -26,14 +26,14 @@ local scene={} function scene.sceneInit() BG.set() - mapCam.zoomK=SCN.prev=='main'and 5 or 1 + mapCam.zoomK=SCN.prev=='main' and 5 or 1 visibleModes={}--1=unlocked, 2=locked but visible for name,M in next,MODES do - if RANKS[name]and M.x then + if RANKS[name] and M.x then visibleModes[name]=1 if M.unlock then for i=1,#M.unlock do - visibleModes[M.unlock[i]]=visibleModes[M.unlock[i]]or 2 + visibleModes[M.unlock[i]]=visibleModes[M.unlock[i]] or 2 end end end @@ -49,14 +49,14 @@ end local function _onModeRaw(x,y) for name,M in next,MODES do - if visibleModes[name]and M.x then + if visibleModes[name] and M.x then local s=M.size if M.shape==1 then if x>M.x-s and xM.y-s and y1 then selected=S-1 SFX.play('touch',.7) end elseif not isRep then - if key=='return'or key=='space'then + if key=='return' or key=='space' then playing=BGM.getPlaying()[1] - if playing~=bgmList[S]then + if playing~=bgmList[S] then BGM.play(bgmList[S]) SFX.play('click') else BGM.stop() SFX.play('click') end - elseif key=='tab'then + elseif key=='tab' then SCN.swapTo('launchpad','none') - elseif key=='escape'then + elseif key=='escape' then SCN.back() - elseif #key==1 and key:find'[0-9a-z]'then + elseif #key==1 and key:find'[0-9a-z]' then for _=1,#bgmList do selected=selected%#bgmList+1 if bgmList[selected]:sub(1,1)==key then break end @@ -91,11 +91,11 @@ function scene.draw() setFont(50) GC.print(bgmList[selected],320,355) setFont(35) - if selected>1 then GC.print(bgmList[selected-1],322,350-30)end - if selected<#bgmList then GC.print(bgmList[selected+1],322,350+65)end + if selected>1 then GC.print(bgmList[selected-1],322,350-30) end + if selected<#bgmList then GC.print(bgmList[selected+1],322,350+65) end setFont(20) - if selected>2 then GC.print(bgmList[selected-2],322,350-50)end - if selected<#bgmList-1 then GC.print(bgmList[selected+2],322,350+110)end + if selected>2 then GC.print(bgmList[selected-2],322,350-50) end + if selected<#bgmList-1 then GC.print(bgmList[selected+2],322,350+110) end --Title if playing then @@ -113,7 +113,7 @@ function scene.draw() GC.print(playing,710,508) setFont(35) GC.setColor(1,sin(t*2.6)*.5+.5,sin(t*2.6)*.5+.5) - GC.print(author[playing]or"MrZ",670,465) + GC.print(author[playing] or "MrZ",670,465) setFont(20) GC.setColor(COLOR.Z) @@ -126,17 +126,17 @@ end scene.widgetList={ WIDGET.newText{name='title', x=30,y=30,font=80,align='L'}, WIDGET.newText{name='arrow', x=270,y=360,font=45,align='L'}, - WIDGET.newText{name='now', x=700,y=500,font=50,align='R',hideF=function()return not playing end}, + WIDGET.newText{name='now', x=700,y=500,font=50,align='R',hideF=function() return not playing end}, WIDGET.newSlider{name='slide',x=480,y=600,w=400, - disp=function()return BGM.tell()/BGM.getDuration()%1 end, + disp=function() return BGM.tell()/BGM.getDuration()%1 end, show=false, - code=function(v)BGM.set('all','seek',v*BGM.getDuration())end, - hideF=function()return not playing end + code=function(v) BGM.set('all','seek',v*BGM.getDuration()) end, + hideF=function() return not playing end }, - WIDGET.newSlider{name='bgm', x=760,y=80,w=400,disp=SETval('bgm'),code=function(v)SETTING.bgm=v BGM.setVol(SETTING.bgm)end}, - WIDGET.newButton{name='up', x=200,y=250,w=120,sound=false,code=pressKey'up',hideF=function()return selected==1 end,font=60,fText=CHAR.key.up}, + WIDGET.newSlider{name='bgm', x=760,y=80,w=400,disp=SETval('bgm'),code=function(v) SETTING.bgm=v BGM.setVol(SETTING.bgm) end}, + WIDGET.newButton{name='up', x=200,y=250,w=120,sound=false,code=pressKey'up',hideF=function() return selected==1 end,font=60,fText=CHAR.key.up}, WIDGET.newButton{name='play', x=200,y=390,w=120,sound=false,font=65,fText=CHAR.icon.play_pause,code=pressKey'space'}, - WIDGET.newButton{name='down', x=200,y=530,w=120,sound=false,code=pressKey'down',hideF=function()return selected==#bgmList end,font=60,fText=CHAR.key.down}, + WIDGET.newButton{name='down', x=200,y=530,w=120,sound=false,code=pressKey'down',hideF=function() return selected==#bgmList end,font=60,fText=CHAR.key.down}, WIDGET.newButton{name='sound',x=1140,y=540,w=170,h=80,font=40,code=pressKey'tab'}, WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene}, } diff --git a/parts/scenes/net_game.lua b/parts/scenes/net_game.lua index 5a5c3ba8..94074fb5 100644 --- a/parts/scenes/net_game.lua +++ b/parts/scenes/net_game.lua @@ -43,9 +43,9 @@ local function _gotoSetting() SCN.go('setting_game') end local function _quit() - if tryBack()then + if tryBack() then NET.room.leave() - if SCN.stack[#SCN.stack-1]=='net_newRoom'then + if SCN.stack[#SCN.stack-1]=='net_newRoom' then SCN.pop() end SCN.back() @@ -76,7 +76,7 @@ function scene.sceneInit() upstreamProgress=1 newMessageTimer=0 - if SCN.prev=='setting_game'then + if SCN.prev=='setting_game' then NET.player.updateConf() end if GAME.prevBG then @@ -92,7 +92,7 @@ function scene.sceneBack() end scene.mouseDown=NULL -function scene.mouseMove(x,y)NETPLY.mouseMove(x,y)end +function scene.mouseMove(x,y) NETPLY.mouseMove(x,y) end function scene.touchDown(x,y) if not playing then NETPLY.mouseMove(x,y)return end if noTouch then return end @@ -124,7 +124,7 @@ function scene.touchMove() local B=keys[n] if B.ava then for i=1,#L,2 do - if(L[i]-B.x)^2+(L[i+1]-B.y)^2<=B.r^2 then + if (L[i]-B.x)^2+(L[i+1]-B.y)^2<=B.r^2 then goto CONTINUE_nextKey end end @@ -135,13 +135,13 @@ function scene.touchMove() end end function scene.keyDown(key,isRep) - if key=='escape'then + if key=='escape' then if not inputBox.hide then _switchChat() else _quit() end - elseif key=='return'then + elseif key=='return' then local mes=STRING.trim(inputBox:getText()) if not inputBox.hide and #mes>0 then NET.room.chat(mes) @@ -159,14 +159,14 @@ function scene.keyDown(key,isRep) PLAYERS[1]:pressKey(k) VK.press(k) end - elseif not _hideReadyUI()then - if key=='space'then + elseif not _hideReadyUI() then + if key=='space' then if NETPLY.getSelfJoinMode()==0 then - (kb.isDown('lctrl','rctrl','lalt','ralt')and _setSpectate or _setReady)() + (kb.isDown('lctrl','rctrl','lalt','ralt') and _setSpectate or _setReady)() else _setCancel() end - elseif key=='s'then + elseif key=='s' then _gotoSetting() end end @@ -180,7 +180,7 @@ function scene.keyUp(key) end end function scene.gamepadDown(key) - if key=='back'then + if key=='back' then scene.keyDown('escape') else if not playing then return end @@ -201,27 +201,27 @@ function scene.gamepadUp(key) end function scene.socketRead(cmd,d) - if cmd=='join'then + if cmd=='join' then textBox:push{ COLOR.lR,d.username, COLOR.dY,"#"..d.uid.." ", COLOR.Y,text.joinRoom, } SFX.play('warn_1') - elseif cmd=='leave'then + elseif cmd=='leave' then textBox:push{ COLOR.lR,d.username, COLOR.dY,"#"..d.uid.." ", COLOR.Y,text.leaveRoom, } - elseif cmd=='talk'then + elseif cmd=='talk' then newMessageTimer=80 textBox:push{ COLOR.Z,d.username, COLOR.dY,"#"..d.uid.." ", - COLOR.N,d.message or"[_]", + COLOR.N,d.message or "[_]", } - elseif cmd=='go'then + elseif cmd=='go' then if not playing then playing=true lastUpstreamTime=0 @@ -231,7 +231,7 @@ function scene.socketRead(cmd,d) else MES.new('warn',"Redundant [Go]") end - elseif cmd=='finish'then + elseif cmd=='finish' then playing=false BG.set() end @@ -250,7 +250,7 @@ function scene.update(dt) VK.update(dt) --Update players - for p=1,#PLAYERS do PLAYERS[p]:update(dt)end + for p=1,#PLAYERS do PLAYERS[p]:update(dt) end --Warning check checkWarning(dt) @@ -258,7 +258,7 @@ function scene.update(dt) --Upload stream if not NET.spectate and P1.frameRun-lastUpstreamTime>8 then local stream - if not GAME.rep[upstreamProgress]then + if not GAME.rep[upstreamProgress] then ins(GAME.rep,P1.frameRun) ins(GAME.rep,0) end @@ -303,13 +303,13 @@ function scene.draw() --Ready & Set mark setFont(50) - if NET.roomReadyState=='allReady'then + if NET.roomReadyState=='allReady' then gc_setColor(1,.85,.6,.9) mStr(text.ready,640,15) - elseif NET.roomReadyState=='connecting'then + elseif NET.roomReadyState=='connecting' then gc_setColor(.6,1,.9,.9) mStr(text.connStream,640,15) - elseif NET.roomReadyState=='waitConn'then + elseif NET.roomReadyState=='waitConn' then gc_setColor(.6,.95,1,.9) mStr(text.waitStream,640,15) end @@ -341,8 +341,8 @@ function scene.draw() gc_print("M",430,10) end end -local function _hideF_ingame()return _hideReadyUI()or NETPLY.getSelfReady()end -local function _hideF_ingame2()return _hideReadyUI()or not NETPLY.getSelfReady()end +local function _hideF_ingame() return _hideReadyUI() or NETPLY.getSelfReady() end +local function _hideF_ingame2() return _hideReadyUI() or not NETPLY.getSelfReady() end scene.widgetList={ textBox, inputBox, diff --git a/parts/scenes/net_league.lua b/parts/scenes/net_league.lua index 35005cef..a0a435ce 100644 --- a/parts/scenes/net_league.lua +++ b/parts/scenes/net_league.lua @@ -16,7 +16,7 @@ function scene.draw() end scene.widgetList={ WIDGET.newKey{name='setting',x=1200,y=160,w=90,h=90,font=60,fText=CHAR.icon.settings,code=goScene'setting_game'}, - WIDGET.newKey{name='match',x=640,y=500,w=760,h=140,font=60,code=function()MES.new('warn',text.notFinished)end}, + WIDGET.newKey{name='match',x=640,y=500,w=760,h=140,font=60,code=function() MES.new('warn',text.notFinished) end}, WIDGET.newButton{name='back',x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene}, } diff --git a/parts/scenes/net_menu.lua b/parts/scenes/net_menu.lua index 85c12efb..6d30f820 100644 --- a/parts/scenes/net_menu.lua +++ b/parts/scenes/net_menu.lua @@ -15,11 +15,11 @@ end scene.widgetList={ WIDGET.newKey{name='setting', x=1200,y=160,w=90, h=90,code=goScene'setting_game',font=60,fText=CHAR.icon.settings}, WIDGET.newButton{name='league',x=640, y=180,w=350,h=120,font=40,color='D',code=goScene'net_league'}, - WIDGET.newButton{name='ffa', x=640, y=360,w=350,h=120,font=40,color='D',code=function()MES.new('warn',text.notFinished)--[[NET.enterRoom({name='ffa'})]]end}, + WIDGET.newButton{name='ffa', x=640, y=360,w=350,h=120,font=40,color='D',code=function() MES.new('warn',text.notFinished)--[[NET.enterRoom({name='ffa'})]] end}, WIDGET.newButton{name='rooms', x=640, y=540,w=350,h=120,font=40,code=goScene'net_rooms'}, WIDGET.newButton{name='logout',x=880, y=40,w=180, h=60,color='dR', code=function() - if tryBack()then + if tryBack() then USER.__data.email=false USER.__data.password=false USER.__data.rToken=false diff --git a/parts/scenes/net_newRoom.lua b/parts/scenes/net_newRoom.lua index 45806ce3..636a28f9 100644 --- a/parts/scenes/net_newRoom.lua +++ b/parts/scenes/net_newRoom.lua @@ -29,12 +29,12 @@ local sList={ local scene={} local function _createRoom() - if legalGameTime()then + if legalGameTime() then local pw=passwordBox.value - if pw==""then pw=nil end + if pw=="" then pw=nil end local roomname=STRING.trim(roomNameBox.value) if #roomname==0 then - roomname=(USERS.getUsername(USER.uid)or"Anonymous").."'s room" + roomname=(USERS.getUsername(USER.uid) or "Anonymous").."'s room" end NET.room.create( roomname, @@ -103,11 +103,11 @@ scene.widgetList={ WIDGET.newSelector{name='eventSet', x=1050,y=760,w=340,color='H',list=sList.eventSet,disp=ROOMval('eventSet'),code=ROOMval('eventSet')}, --Next & Hold - WIDGET.newSelector{name='holdMode', x=310, y=890, w=300,color='lY',list=sList.holdMode,disp=ROOMval('holdMode'),code=ROOMval('holdMode'),hideF=function()return CUSTOMENV.holdCount==0 end}, + WIDGET.newSelector{name='holdMode', x=310, y=890, w=300,color='lY',list=sList.holdMode,disp=ROOMval('holdMode'),code=ROOMval('holdMode'),hideF=function() return CUSTOMENV.holdCount==0 end}, WIDGET.newSlider{name='nextCount', x=140, y=960, lim=130,w=200,axis={0,6,1},disp=ROOMval('nextCount'),code=ROOMsto('nextCount')}, WIDGET.newSlider{name='holdCount', x=140, y=1030,lim=130,w=200,axis={0,6,1},disp=ROOMval('holdCount'),code=ROOMsto('holdCount')}, - WIDGET.newSwitch{name='infHold', x=560, y=960, lim=200, disp=ROOMval('infHold'),code=ROOMrev('infHold'),hideF=function()return ROOMENV.holdCount==0 end}, - WIDGET.newSwitch{name='phyHold', x=560, y=1030,lim=200, disp=ROOMval('phyHold'),code=ROOMrev('phyHold'),hideF=function()return ROOMENV.holdCount==0 end}, + WIDGET.newSwitch{name='infHold', x=560, y=960, lim=200, disp=ROOMval('infHold'),code=ROOMrev('infHold'),hideF=function() return ROOMENV.holdCount==0 end}, + WIDGET.newSwitch{name='phyHold', x=560, y=1030,lim=200, disp=ROOMval('phyHold'),code=ROOMrev('phyHold'),hideF=function() return ROOMENV.holdCount==0 end}, } return scene diff --git a/parts/scenes/net_rooms.lua b/parts/scenes/net_rooms.lua index e5c66412..cdbf21a2 100644 --- a/parts/scenes/net_rooms.lua +++ b/parts/scenes/net_rooms.lua @@ -26,10 +26,10 @@ local roomList=WIDGET.newListBox{name='roomList',x=50,y=50,w=800,h=440,lineH=40, end if item.count then gc_printf( - type(item.count.Spectator)=='number'and item.count.Spectator>0 and - ("$1(+$2)/$3"):repD(item.count.Gamer or'?',item.count.Spectator or'?',item.capacity or'?') + type(item.count.Spectator)=='number' and item.count.Spectator>0 and + ("$1(+$2)/$3"):repD(item.count.Gamer or '?',item.count.Spectator or '?',item.capacity or '?') or - ("$1/$2"):repD(item.count.Gamer or'?',item.capacity or'?'),600,-4,180,'right') + ("$1/$2"):repD(item.count.Gamer or '?',item.capacity or '?'),600,-4,180,'right') end if item.info and item.state then @@ -77,14 +77,14 @@ function scene.sceneInit() end function scene.keyDown(key) - if TASK.getLock('enterRoom')then return true end - if key=='r'then + if TASK.getLock('enterRoom') then return true end + if key=='r' then if fetchTimer<=7 then _fetchRoom() end - elseif roomList:getLen()>0 and(key=='join'or key=='return'and love.keyboard.isDown('lctrl','rctrl'))then + elseif roomList:getLen()>0 and (key=='join' or key=='return' and love.keyboard.isDown('lctrl','rctrl')) then local R=roomList:getSel() - if TASK.getLock('fetchRoom')or not R then return end + if TASK.getLock('fetchRoom') or not R then return end if R.info.version==VERSION.room then NET.room.enter(R.roomId,passwordBox.value) else @@ -96,7 +96,7 @@ function scene.keyDown(key) end function scene.update(dt) - if not TASK.getLock('fetchRoom')and _hidePW()then + if not TASK.getLock('fetchRoom') and _hidePW() then fetchTimer=fetchTimer-dt if fetchTimer<=0 then _fetchRoom() @@ -109,14 +109,6 @@ function scene.draw() gc_setColor(1,1,1,.12) gc_arc('fill','pie',250,630,40,-1.5708,-1.5708-.6283*fetchTimer) - --Joining mark - if TASK.getLock('enterRoom')then - gc.setColor(COLOR.Z) - gc.setLineWidth(15) - local t=TIME()*6.26%6.2832 - gc.arc('line','open',640,360,80,t,t+4.26) - end - --Room list local R=roomList:getSel() if R then @@ -130,7 +122,7 @@ function scene.draw() gc_printf(R.info.name,10,0,365) setFont(20) gc_setColor(COLOR.lH) - gc_printf(R.info.description or"[No description]",10,55,365) + gc_printf(R.info.description or "[No description]",10,55,365) if R.start then gc_setColor(COLOR.lA) gc_print(text.started,10,300) @@ -151,11 +143,11 @@ scene.widgetList={ roomList, passwordBox, WIDGET.newKey{name='setting', x=1200,y=160,w=90,h=90,font=60,fText=CHAR.icon.settings,code=goScene'setting_game'}, - WIDGET.newText{name='refreshing',x=450,y=240,font=45,hideF=function()return not TASK.getLock('fetchRoom')end}, - WIDGET.newText{name='noRoom', x=450,y=245,font=40,hideF=function()return roomList:getLen()>0 or TASK.getLock('fetchRoom')end}, - WIDGET.newKey{name='refresh', x=250,y=630,w=140,h=120,code=_fetchRoom,hideF=function()return fetchTimer>7 end}, + WIDGET.newText{name='refreshing',x=450,y=240,font=45,hideF=function() return not TASK.getLock('fetchRoom') end}, + WIDGET.newText{name='noRoom', x=450,y=245,font=40,hideF=function() return roomList:getLen()>0 or TASK.getLock('fetchRoom') end}, + WIDGET.newKey{name='refresh', x=250,y=630,w=140,h=120,code=_fetchRoom,hideF=function() return fetchTimer>7 end}, WIDGET.newKey{name='new', x=510,y=630,w=260,h=120,code=goScene'net_newRoom'}, - WIDGET.newKey{name='join', x=780,y=630,w=140,h=120,code=pressKey'join',hideF=function()return roomList:getLen()==0 or TASK.getLock('enterRoom')end}, + WIDGET.newKey{name='join', x=780,y=630,w=140,h=120,code=pressKey'join',hideF=function() return roomList:getLen()==0 or TASK.getLock('enterRoom') end}, WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=pressKey'escape'}, } diff --git a/parts/scenes/pause.lua b/parts/scenes/pause.lua index dc64683b..627fce2d 100644 --- a/parts/scenes/pause.lua +++ b/parts/scenes/pause.lua @@ -19,13 +19,13 @@ local trophyColor--Current trophy color function scene.sceneInit() page=0 - if SCN.prev:find("setting")then + if SCN.prev:find("setting") then TEXT.show(text.needRestart,640,410,50,'fly',.6) end local P1=PLAYERS[1] local S=P1.stat - timer1=SCN.prev=='game'and 0 or 50 + timer1=SCN.prev=='game' and 0 or 50 timer2=timer1 local frameLostRate=(S.frame/S.time/60-1)*100 @@ -54,7 +54,7 @@ function scene.sceneInit() --Normalize Values for i=1,6 do - val[i]=val[i]*radar[i]if val[i]>1.26 then val[i]=1.26+log(val[i]-.26)end + val[i]=val[i]*radar[i] if val[i]>1.26 then val[i]=1.26+log(val[i]-.26) end end for i=1,6 do @@ -87,16 +87,16 @@ function scene.sceneInit() val[2*i-1],val[2*i]=val[i]*standard[2*i-1],val[i]*standard[2*i] end - if P1.result=='win'and P1.stat.piece>4 then + if P1.result=='win' and P1.stat.piece>4 then local acc=P1.stat.finesseRate*.2/P1.stat.piece rank=CHAR.icon['rank'..( - acc==1. and"Z"or - acc>.97 and"S"or - acc>.94 and"A"or - acc>.87 and"B"or - acc>.70 and"C"or - acc>.50 and"D"or - acc>.30 and"E"or + acc==1. and "Z" or + acc>.97 and "S" or + acc>.94 and "A" or + acc>.87 and "B" or + acc>.70 and "C" or + acc>.50 and "D" or + acc>.30 and "E" or "F" )] if acc==1 then @@ -122,43 +122,43 @@ end function scene.keyDown(key,isRep) if isRep then return true end - if key=='q'then + if key=='q' then SCN.back() GAME.playing=false - elseif key=='escape'then - SCN.swapTo(GAME.result and'game'or'depause','none') - elseif key=='s'then + elseif key=='escape' then + SCN.swapTo(GAME.result and 'game' or 'depause','none') + elseif key=='s' then if not GAME.fromRepMenu then GAME.prevBG=BG.cur SCN.go('setting_sound') end - elseif key=='r'then + elseif key=='r' then if not GAME.fromRepMenu then resetGameData() SCN.swapTo('game','none') end - elseif key=='p'then - if(GAME.result or GAME.replaying)and #PLAYERS==1 then + elseif key=='p' then + if (GAME.result or GAME.replaying) and #PLAYERS==1 then resetGameData('r') PLAYERS[1]:startStreaming(GAME.rep) SCN.swapTo('game','none') end - elseif key=='o'then - if(GAME.result or GAME.replaying)and #PLAYERS==1 and not GAME.saved then - if DATA.saveReplay()then + elseif key=='o' then + if (GAME.result or GAME.replaying) and #PLAYERS==1 and not GAME.saved then + if DATA.saveReplay() then GAME.saved=true SFX.play('connected') end end - elseif key=='tab'or key=='Stab'then - if love.keyboard.isDown('lshift','rshift')or key=='Stab'then + elseif key=='tab' or key=='Stab' then + if love.keyboard.isDown('lshift','rshift') or key=='Stab' then page=(page-1)%2 else page=(page+1)%2 end timer2=0 - elseif key=='t'then - if SETTING.allowTAS and not(GAME.result or GAME.replaying)then + elseif key=='t' then + if SETTING.allowTAS and not (GAME.result or GAME.replaying) then GAME.tasUsed=true SFX.play('ren_mega') SFX.play('clear_3') @@ -170,7 +170,7 @@ function scene.keyDown(key,isRep) end function scene.update(dt) - if not(GAME.result or GAME.replaying)then + if not (GAME.result or GAME.replaying) then GAME.pauseTime=GAME.pauseTime+dt end timer1=math.min(timer1+dt*60*.02,1) @@ -198,13 +198,13 @@ function scene.draw() gc.setColor(.97,.97,.97,timer1) --Result Text - mDraw(GAME.result and TEXTOBJ[GAME.result]or TEXTOBJ.pause,640,70-10*(5-timer1*5)^1.5) + mDraw(GAME.result and TEXTOBJ[GAME.result] or TEXTOBJ.pause,640,70-10*(5-timer1*5)^1.5) --Mode Info (outside) gc.draw(TEXTOBJ.modeName,745-TEXTOBJ.modeName:getWidth(),143) --Level rank - if RANK_CHARS[GAME.rank]then + if RANK_CHARS[GAME.rank] then gc.push('transform') gc.translate(1050,5) setFont(80) @@ -320,7 +320,7 @@ function scene.draw() gc.scale(.65) if #GAME.mod>0 then gc.setLineWidth(2) - if scoreValid()then + if scoreValid() then gc.setColor(.7,.7,.7,timer1) gc.rectangle('line',-5,-5,500,150,8) gc.setColor(.7,.7,.7,timer1*.05) @@ -345,22 +345,22 @@ end scene.widgetList={ WIDGET.newKey{name='resume', x=290,y=240,w=300,h=70,code=pressKey'escape'}, - WIDGET.newKey{name='restart', x=290,y=340,w=300,h=70,code=pressKey'r',hideF=function()return GAME.fromRepMenu end}, - WIDGET.newKey{name='setting', x=290,y=440,w=300,h=70,code=pressKey's',hideF=function()return GAME.fromRepMenu end}, + WIDGET.newKey{name='restart', x=290,y=340,w=300,h=70,code=pressKey'r',hideF=function() return GAME.fromRepMenu end}, + WIDGET.newKey{name='setting', x=290,y=440,w=300,h=70,code=pressKey's',hideF=function() return GAME.fromRepMenu end}, WIDGET.newKey{name='quit', x=290,y=540,w=300,h=70,code=pressKey'q'}, - WIDGET.newKey{name='tas', x=290,y=620,w=240,h=50,code=pressKey't',hideF=function()return not SETTING.allowTAS or GAME.tasUsed or GAME.result or GAME.replaying end}, + WIDGET.newKey{name='tas', x=290,y=620,w=240,h=50,code=pressKey't',hideF=function() return not SETTING.allowTAS or GAME.tasUsed or GAME.result or GAME.replaying end}, WIDGET.newKey{name='page_prev',x=500,y=390,w=70,code=pressKey'tab', fText=GC.DO{70,70,{'setLW',2}, {'dRRPol',33,35,32,3,6,3.142},{'dRRPol',45,35,32,3,6,3.142}}, fShade=GC.DO{70,70,{'setCL',1,1,1,.4},{'draw',GC.DO{70,70,{'setCL',1,1,1,1},{'fRRPol',33,35,32,3,6,3.142},{'fRRPol',45,35,32,3,6,3.142}}}}, - hideF=function()return PLAYERS[1].frameRun<=180 end, + hideF=function() return PLAYERS[1].frameRun<=180 end, }, WIDGET.newKey{name='page_next',x=1230,y=390,w=70,code=pressKey'Stab', fText=GC.DO{70,70,{'setLW',2}, {'dRRPol',37,35,32,3,6},{'dRRPol',25,35,32,3,6}}, fShade=GC.DO{70,70,{'setCL',1,1,1,.4},{'draw',GC.DO{70,70,{'setCL',1,1,1,1},{'fRRPol',37,35,32,3,6},{'fRRPol',25,35,32,3,6}}}}, - hideF=function()return PLAYERS[1].frameRun<=180 end, + hideF=function() return PLAYERS[1].frameRun<=180 end, }, - WIDGET.newKey{name='replay', x=865,y=165,w=200,h=40,font=25,code=pressKey'p',hideF=function()return not(GAME.result or GAME.replaying)or #PLAYERS>1 end}, - WIDGET.newKey{name='save', x=1075,y=165,w=200,h=40,font=25,code=pressKey'o',hideF=function()return not(GAME.result or GAME.replaying)or #PLAYERS>1 or GAME.saved end}, + WIDGET.newKey{name='replay', x=865,y=165,w=200,h=40,font=25,code=pressKey'p',hideF=function() return not (GAME.result or GAME.replaying) or #PLAYERS>1 end}, + WIDGET.newKey{name='save', x=1075,y=165,w=200,h=40,font=25,code=pressKey'o',hideF=function() return not (GAME.result or GAME.replaying) or #PLAYERS>1 or GAME.saved end}, } return scene diff --git a/parts/scenes/quit.lua b/parts/scenes/quit.lua index 89cebed3..c09d4ebe 100644 --- a/parts/scenes/quit.lua +++ b/parts/scenes/quit.lua @@ -1,7 +1,7 @@ local scene={} function scene.sceneInit() - if SYSTEM~="iOS"then + if SYSTEM~="iOS" then if math.random()>.0000626 then love.timer.sleep(.26) love.event.quit() diff --git a/parts/scenes/register.lua b/parts/scenes/register.lua index ced64d51..178b164e 100644 --- a/parts/scenes/register.lua +++ b/parts/scenes/register.lua @@ -5,7 +5,7 @@ local code local function _getCode() local email=WIDGET.active.email:getText() - if not STRING.simpEmailCheck(email)then + if not STRING.simpEmailCheck(email) then MES.new('error',text.wrongEmail) else NET.getCode(email) @@ -80,7 +80,7 @@ end scene.widgetList={ WIDGET.newText{name='title', x=80, y=50,font=70,align='L'}, - WIDGET.newButton{name='login', x=1140,y=100,w=170,h=80,color='lY',code=function()SCN.swapTo('login','swipeL')end}, + WIDGET.newButton{name='login', x=1140,y=100,w=170,h=80,color='lY',code=function() SCN.swapTo('login','swipeL') end}, WIDGET.newInputBox{name='email', x=380, y=300,w=626,h=60,limit=128}, WIDGET.newKey{name='send', x=640, y=430,w=250,h=80,font=40,code=_getCode}, diff --git a/parts/scenes/replays.lua b/parts/scenes/replays.lua index c74533ff..c8037912 100644 --- a/parts/scenes/replays.lua +++ b/parts/scenes/replays.lua @@ -17,7 +17,7 @@ local listBox=WIDGET.newListBox{name='list',x=50,y=50,w=1200,h=520,lineH=40,draw if rep.available then GC.setColor(.9,.9,1) local modeName=text.modes[rep.mode] - GC.print(modeName and modeName[1].." "..modeName[2]or rep.mode,310,0) + GC.print(modeName and modeName[1].." "..modeName[2] or rep.mode,310,0) setFont(20) GC.setColor(1,1,.8) GC.print(rep.date,80,6) @@ -37,7 +37,7 @@ local function _playRep(fileName) local rep=DATA.parseReplay(fileName,true) if not rep.available then MES.new('error',text.replayBroken) - elseif MODES[rep.mode]then + elseif MODES[rep.mode] then GAME.seed=rep.seed GAME.setting=rep.setting TABLE.cut(GAME.mod) @@ -72,12 +72,12 @@ function scene.sceneInit() end function scene.keyDown(key) - if key=='return'then + if key=='return' then local rep=listBox:getSel() if rep then _playRep(rep.fileName) end - elseif key=='c'and kb.isDown('lctrl','rctrl')or key=='cC'then + elseif key=='c' and kb.isDown('lctrl','rctrl') or key=='cC' then local rep=listBox:getSel() if rep then if rep.available and rep.fileName then @@ -92,14 +92,14 @@ function scene.keyDown(key) MES.new('error',text.replayBroken) end end - elseif key=='v'and kb.isDown('lctrl','rctrl')or key=='cV'then + elseif key=='v' and kb.isDown('lctrl','rctrl') or key=='cV' then local repStr=love.system.getClipboardText() local res,fileData=pcall(love.data.decode,'string','base64',repStr) if res then local fileName=os.date("replay/%Y_%m_%d_%H%M%S_import.rep") local rep=DATA.parseReplayData(fileName,fileData,false) if rep.available then - if saveFile(fileData,fileName,'-d')then + if saveFile(fileData,fileName,'-d') then table.insert(REPLAY,1,rep) MES.new('info',text.importSuccess) end @@ -109,10 +109,10 @@ function scene.keyDown(key) else MES.new('error',text.dataCorrupted) end - elseif key=='delete'then + elseif key=='delete' then local rep=listBox:getSel() if rep then - if tryDelete()then + if tryDelete() then listBox:remove() love.filesystem.remove(rep.fileName) for i=1,#REPLAY do @@ -124,7 +124,7 @@ function scene.keyDown(key) SFX.play('finesseError',.7) end end - elseif key=='up'or key=='down'then + elseif key=='up' or key=='down' then listBox:arrowKey(key) else return true diff --git a/parts/scenes/savedata.lua b/parts/scenes/savedata.lua index b0042453..864cce0e 100644 --- a/parts/scenes/savedata.lua +++ b/parts/scenes/savedata.lua @@ -20,10 +20,10 @@ local function _parseCB() end scene.widgetList={ WIDGET.newText{name='export', x=55,y=45,color='lY',align='L',font=50}, - WIDGET.newButton{name='unlock', x=190,y=170,w=280,h=100,color='lY',code=function()_dumpCB(RANKS)end}, - WIDGET.newButton{name='data', x=490,y=170,w=280,h=100,color='lY',code=function()_dumpCB(STAT)end}, - WIDGET.newButton{name='setting', x=790,y=170,w=280,h=100,color='lY',code=function()_dumpCB(SETTING)end}, - WIDGET.newButton{name='vk', x=1090,y=170,w=280,h=100,color='lY',code=function()_dumpCB(VK_ORG)end}, + WIDGET.newButton{name='unlock', x=190,y=170,w=280,h=100,color='lY',code=function()_dumpCB(RANKS) end}, + WIDGET.newButton{name='data', x=490,y=170,w=280,h=100,color='lY',code=function()_dumpCB(STAT) end}, + WIDGET.newButton{name='setting', x=790,y=170,w=280,h=100,color='lY',code=function()_dumpCB(SETTING) end}, + WIDGET.newButton{name='vk', x=1090,y=170,w=280,h=100,color='lY',code=function()_dumpCB(VK_ORG) end}, WIDGET.newText{name='import', x=55,y=265,color='lR',align='L',font=50}, WIDGET.newButton{name='unlock', x=190,y=390,w=280,h=100,color='lR', @@ -32,7 +32,7 @@ scene.widgetList={ if D then TABLE.cover(D,RANKS) 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 @@ -79,9 +79,9 @@ scene.widgetList={ end}, WIDGET.newText{name='couldSave', x=55,y=485,color='lB',align='L',font=50}, - WIDGET.newText{name='notLogin', x=55,y=550,color='dB',align='L',font=30,hideF=function()return WS.status('user')=='running'end}, - WIDGET.newButton{name='upload', x=190,y=610,w=280,h=90,color='lB',font=25,code=NET.uploadSave,hideF=function()return WS.status('user')~='running'end}, - WIDGET.newButton{name='download', x=490,y=610,w=280,h=90,color='lB',font=25,code=NET.downloadSave,hideF=function()return WS.status('user')~='running'end}, + WIDGET.newText{name='notLogin', x=55,y=550,color='dB',align='L',font=30,hideF=function() return WS.status('user')=='running' end}, + WIDGET.newButton{name='upload', x=190,y=610,w=280,h=90,color='lB',font=25,code=NET.uploadSave,hideF=function() return WS.status('user')~='running' end}, + WIDGET.newButton{name='download', x=490,y=610,w=280,h=90,color='lB',font=25,code=NET.downloadSave,hideF=function() return WS.status('user')~='running' end}, WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene}, } diff --git a/parts/scenes/setting_game.lua b/parts/scenes/setting_game.lua index 716df5cb..bfa318f4 100644 --- a/parts/scenes/setting_game.lua +++ b/parts/scenes/setting_game.lua @@ -39,21 +39,21 @@ scene.widgetList={ WIDGET.newButton{name='style', x=250, y=540, w=200,h=70,font=35,code=goScene'setting_skin'}, WIDGET.newButton{name='ctrl', x=290, y=220, w=320,h=80,font=35,code=goScene'setting_control'}, - WIDGET.newButton{name='key', x=640, y=220, w=320,h=80,color=MOBILE and'dH',font=35, code=goScene'setting_key'}, - WIDGET.newButton{name='touch', x=990, y=220, w=320,h=80,color=not MOBILE and'dH',font=35, code=goScene'setting_touch',hideF=function()return not SETTING.VKSwitch end}, + WIDGET.newButton{name='key', x=640, y=220, w=320,h=80,color=MOBILE and 'dH',font=35, code=goScene'setting_key'}, + WIDGET.newButton{name='touch', x=990, y=220, w=320,h=80,color=not MOBILE and 'dH',font=35, code=goScene'setting_touch',hideF=function() return not SETTING.VKSwitch end}, WIDGET.newSwitch{name='showVK', x=1100, y=150, lim=400, disp=SETval('VKSwitch'), code=SETrev('VKSwitch')}, WIDGET.newSlider{name='reTime', x=330, y=320, w=300,lim=180,axis={.5,3,.25},disp=SETval('reTime'), code=SETsto('reTime'),show=SETval('reTime')}, WIDGET.newSelector{name='RS', x=300, y=420, w=300,color='S', disp=SETval('RS'), code=SETsto('RS'),list={'TRS','SRS','SRS_plus','SRS_X','BiRS','ARS_Z','DRS_weak','ASC','ASC_plus','C2','C2_sym','Classic','Classic_plus','None','None_plus'}}, WIDGET.newSelector{name='menuPos',x=980, y=320, w=300,color='O', disp=SETval('menuPos'), code=SETsto('menuPos'),list={'left','middle','right'}}, - WIDGET.newSwitch{name='sysCursor',x=1060, y=400, lim=580, disp=SETval('sysCursor'),code=function()SETTING.sysCursor=not SETTING.sysCursor applySettings()end}, + WIDGET.newSwitch{name='sysCursor',x=1060, y=400, lim=580, disp=SETval('sysCursor'),code=function() SETTING.sysCursor=not SETTING.sysCursor applySettings() end}, WIDGET.newSwitch{name='autoPause',x=1060, y=470, lim=580, disp=SETval('autoPause'),code=SETrev('autoPause')}, WIDGET.newSwitch{name='autoSave', x=1060, y=540, lim=580, disp=SETval('autoSave'), code=SETrev('autoSave')}, WIDGET.newSwitch{name='simpMode', x=960, y=670, lim=480, disp=SETval('simpMode'), code=function() SETTING.simpMode=not SETTING.simpMode for i=1,#SCN.stack,2 do - if SCN.stack[i]=='main'or SCN.stack[i]=='main_simple'then - SCN.stack[i]=SETTING.simpMode and'main_simple'or'main' + if SCN.stack[i]=='main' or SCN.stack[i]=='main_simple' then + SCN.stack[i]=SETTING.simpMode and 'main_simple' or 'main' break end end diff --git a/parts/scenes/setting_key.lua b/parts/scenes/setting_key.lua index c38235f1..76f4f1dc 100644 --- a/parts/scenes/setting_key.lua +++ b/parts/scenes/setting_key.lua @@ -33,7 +33,7 @@ local keyNames={ pageup='PgUp', pagedown='PgDn', home='Home', - ['end']='End', + [' end']='End', insert='Ins', numlock='Numlock', menu=CHAR.key.winMenu, @@ -58,7 +58,7 @@ local keyNames={ pageup=CHAR.key.macPgup, pagedown=CHAR.key.macPgdn, home=CHAR.key.macHome, - ['end']=CHAR.key.macEnd, + [' end']=CHAR.key.macEnd, numlock=CHAR.key.clear, }, controller={ @@ -86,15 +86,15 @@ local keyNames={ }setmetatable(keyNames.apple,{__index=keyNames.normal}) local function _freshKeyList() - keyList={}for i=0,20 do keyList[i]={}end + keyList={} for i=0,20 do keyList[i]={} end - local keynames=SYSTEM:find'OS'and keyNames.apple or keyNames.normal + local keynames=SYSTEM:find'OS' and keyNames.apple or keyNames.normal for k,v in next,KEY_MAP.keyboard do - ins(keyList[v],{COLOR.lB,keynames[k]or k}) + ins(keyList[v],{COLOR.lB,keynames[k] or k}) end for b,v in next,KEY_MAP.joystick do - ins(keyList[v],{COLOR.lR,keyNames.controller[b]or b}) + ins(keyList[v],{COLOR.lR,keyNames.controller[b] or b}) end end @@ -113,13 +113,13 @@ local forbbidenKeys={ } function scene.keyDown(key,isRep) if isRep then return true end - if key=='escape'then + if key=='escape' then if selected then selected=false else SCN.back() end - elseif key=='backspace'then + elseif key=='backspace' then if selected then for k,v in next,KEY_MAP.keyboard do if v==selected then @@ -131,7 +131,7 @@ function scene.keyDown(key,isRep) SFX.play('finesseError',.5) end elseif selected then - if not forbbidenKeys[key]then + if not forbbidenKeys[key] then KEY_MAP.keyboard[key]=selected _freshKeyList() selected=false @@ -142,7 +142,7 @@ function scene.keyDown(key,isRep) end end function scene.gamepadDown(key) - if key=='back'then + if key=='back' then if selected then for k,v in next,KEY_MAP.joystick do if v==selected then @@ -171,7 +171,7 @@ function scene.draw() gc.printf(text.keySettingInstruction,526,620,500,'right') for i=0,20 do - for j=1,#keyList[i]do + for j=1,#keyList[i] do local key=keyList[i][j] local font=#key[2]<=4 and 35 or #key[2]<=7 and 25 or 15 setFont(font) @@ -207,29 +207,29 @@ local function _setSel(i) end end scene.widgetList={ - WIDGET.newKey{name='a1',x=150,y=40,w=180,h=60,font=25,code=function()_setSel(1)end}, - WIDGET.newKey{name='a2',x=150,y=100,w=180,h=60,font=25,code=function()_setSel(2)end}, - WIDGET.newKey{name='a3',x=150,y=160,w=180,h=60,font=25,code=function()_setSel(3)end}, - WIDGET.newKey{name='a4',x=150,y=220,w=180,h=60,font=25,code=function()_setSel(4)end}, - WIDGET.newKey{name='a5',x=150,y=280,w=180,h=60,font=25,code=function()_setSel(5)end}, - WIDGET.newKey{name='a6',x=150,y=340,w=180,h=60,font=25,code=function()_setSel(6)end}, - WIDGET.newKey{name='a7',x=150,y=400,w=180,h=60,font=25,code=function()_setSel(7)end}, - WIDGET.newKey{name='a8',x=150,y=460,w=180,h=60,font=25,code=function()_setSel(8)end}, - WIDGET.newKey{name='a9',x=150,y=520,w=180,h=60,font=25,code=function()_setSel(9)end}, - WIDGET.newKey{name='a10',x=150,y=580,w=180,h=60,font=25,code=function()_setSel(10)end}, + WIDGET.newKey{name='a1',x=150,y=40,w=180,h=60,font=25,code=function()_setSel(1) end}, + WIDGET.newKey{name='a2',x=150,y=100,w=180,h=60,font=25,code=function()_setSel(2) end}, + WIDGET.newKey{name='a3',x=150,y=160,w=180,h=60,font=25,code=function()_setSel(3) end}, + WIDGET.newKey{name='a4',x=150,y=220,w=180,h=60,font=25,code=function()_setSel(4) end}, + WIDGET.newKey{name='a5',x=150,y=280,w=180,h=60,font=25,code=function()_setSel(5) end}, + WIDGET.newKey{name='a6',x=150,y=340,w=180,h=60,font=25,code=function()_setSel(6) end}, + WIDGET.newKey{name='a7',x=150,y=400,w=180,h=60,font=25,code=function()_setSel(7) end}, + WIDGET.newKey{name='a8',x=150,y=460,w=180,h=60,font=25,code=function()_setSel(8) end}, + WIDGET.newKey{name='a9',x=150,y=520,w=180,h=60,font=25,code=function()_setSel(9) end}, + WIDGET.newKey{name='a10',x=150,y=580,w=180,h=60,font=25,code=function()_setSel(10) end}, - WIDGET.newKey{name='a11',x=770,y=40,w=180,h=60,font=25,code=function()_setSel(11)end}, - WIDGET.newKey{name='a12',x=770,y=100,w=180,h=60,font=25,code=function()_setSel(12)end}, - WIDGET.newKey{name='a13',x=770,y=160,w=180,h=60,font=25,code=function()_setSel(13)end}, - WIDGET.newKey{name='a14',x=770,y=220,w=180,h=60,font=25,code=function()_setSel(14)end}, - WIDGET.newKey{name='a15',x=770,y=280,w=180,h=60,font=25,code=function()_setSel(15)end}, - WIDGET.newKey{name='a16',x=770,y=340,w=180,h=60,font=25,code=function()_setSel(16)end}, - WIDGET.newKey{name='a17',x=770,y=400,w=180,h=60,font=25,code=function()_setSel(17)end}, - WIDGET.newKey{name='a18',x=770,y=460,w=180,h=60,font=25,code=function()_setSel(18)end}, - WIDGET.newKey{name='a19',x=770,y=520,w=180,h=60,font=25,code=function()_setSel(19)end}, - WIDGET.newKey{name='a20',x=770,y=580,w=180,h=60,font=25,code=function()_setSel(20)end}, + WIDGET.newKey{name='a11',x=770,y=40,w=180,h=60,font=25,code=function()_setSel(11) end}, + WIDGET.newKey{name='a12',x=770,y=100,w=180,h=60,font=25,code=function()_setSel(12) end}, + WIDGET.newKey{name='a13',x=770,y=160,w=180,h=60,font=25,code=function()_setSel(13) end}, + WIDGET.newKey{name='a14',x=770,y=220,w=180,h=60,font=25,code=function()_setSel(14) end}, + WIDGET.newKey{name='a15',x=770,y=280,w=180,h=60,font=25,code=function()_setSel(15) end}, + WIDGET.newKey{name='a16',x=770,y=340,w=180,h=60,font=25,code=function()_setSel(16) end}, + WIDGET.newKey{name='a17',x=770,y=400,w=180,h=60,font=25,code=function()_setSel(17) end}, + WIDGET.newKey{name='a18',x=770,y=460,w=180,h=60,font=25,code=function()_setSel(18) end}, + WIDGET.newKey{name='a19',x=770,y=520,w=180,h=60,font=25,code=function()_setSel(19) end}, + WIDGET.newKey{name='a20',x=770,y=580,w=180,h=60,font=25,code=function()_setSel(20) end}, - WIDGET.newKey{name='restart',x=150,y=670,w=180,h=60,code=function()_setSel(0)end}, + WIDGET.newKey{name='restart',x=150,y=670,w=180,h=60,code=function()_setSel(0) end}, WIDGET.newButton{name='back',x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene}, } diff --git a/parts/scenes/setting_skin.lua b/parts/scenes/setting_skin.lua index a83f7f29..b80c1443 100644 --- a/parts/scenes/setting_skin.lua +++ b/parts/scenes/setting_skin.lua @@ -7,7 +7,7 @@ local minoRot={0,0,0,0,0,0,0} local minoRot0={} local selEggMode -local playEgg=WIDGET.newButton{name='playEgg', x=1140,y=540,w=140,h=65,color='lP',font=60,fText=CHAR.icon.rankZ,code=function()loadGame(selEggMode,true)end} +local playEgg=WIDGET.newButton{name='playEgg', x=1140,y=540,w=140,h=65,color='lP',font=60,fText=CHAR.icon.rankZ,code=function() loadGame(selEggMode,true) end} local scene={} @@ -40,11 +40,11 @@ function scene.draw() local x,y=-45-selRS.centerPos[n][0][2]*30,15+selRS.centerPos[n][0][1]*30 local col=#B[1] for i=1,#B do for j=1,col do - if B[i][j]then + if B[i][j] then gc.draw(texture[color],x+30*j,y-30*i) end end end - if selRS.centerDisp[n]then + if selRS.centerDisp[n] then mDraw(selRS.centerTex) end gc.pop() @@ -84,29 +84,29 @@ scene.widgetList={ WIDGET.newText{name='title', x=80,y=50,lim=500,font=70,align='L'}, WIDGET.newSelector{name='skinSet',x=780,y=100,w=320,list=SKIN.getList(),disp=SETval('skinSet'),code=SETsto('skinSet')}, - WIDGET.newButton{name='prev1', x=130,y=220,w=80,h=65,sound='hold',font=40,fText="↑",code=function()_prevSkin(1)end}, - WIDGET.newButton{name='prev2', x=270,y=220,w=80,h=65,sound='hold',font=40,fText="↑",code=function()_prevSkin(2)end}, - WIDGET.newButton{name='prev3', x=410,y=220,w=80,h=65,sound='hold',font=40,fText="↑",code=function()_prevSkin(3)end}, - WIDGET.newButton{name='prev4', x=550,y=220,w=80,h=65,sound='hold',font=40,fText="↑",code=function()_prevSkin(4)end}, - WIDGET.newButton{name='prev5', x=690,y=220,w=80,h=65,sound='hold',font=40,fText="↑",code=function()_prevSkin(5)end}, - WIDGET.newButton{name='prev6', x=830,y=220,w=80,h=65,sound='hold',font=40,fText="↑",code=function()_prevSkin(6)end}, - WIDGET.newButton{name='prev7', x=970,y=220,w=80,h=65,sound='hold',font=40,fText="↑",code=function()_prevSkin(7)end}, + WIDGET.newButton{name='prev1', x=130,y=220,w=80,h=65,sound='hold',font=40,fText="↑",code=function()_prevSkin(1) end}, + WIDGET.newButton{name='prev2', x=270,y=220,w=80,h=65,sound='hold',font=40,fText="↑",code=function()_prevSkin(2) end}, + WIDGET.newButton{name='prev3', x=410,y=220,w=80,h=65,sound='hold',font=40,fText="↑",code=function()_prevSkin(3) end}, + WIDGET.newButton{name='prev4', x=550,y=220,w=80,h=65,sound='hold',font=40,fText="↑",code=function()_prevSkin(4) end}, + WIDGET.newButton{name='prev5', x=690,y=220,w=80,h=65,sound='hold',font=40,fText="↑",code=function()_prevSkin(5) end}, + WIDGET.newButton{name='prev6', x=830,y=220,w=80,h=65,sound='hold',font=40,fText="↑",code=function()_prevSkin(6) end}, + WIDGET.newButton{name='prev7', x=970,y=220,w=80,h=65,sound='hold',font=40,fText="↑",code=function()_prevSkin(7) end}, - WIDGET.newButton{name='next1', x=130,y=440,w=80,h=65,sound='hold',font=40,fText="↓",code=function()_nextSkin(1)end}, - WIDGET.newButton{name='next2', x=270,y=440,w=80,h=65,sound='hold',font=40,fText="↓",code=function()_nextSkin(2)end}, - WIDGET.newButton{name='next3', x=410,y=440,w=80,h=65,sound='hold',font=40,fText="↓",code=function()_nextSkin(3)end}, - WIDGET.newButton{name='next4', x=550,y=440,w=80,h=65,sound='hold',font=40,fText="↓",code=function()_nextSkin(4)end}, - WIDGET.newButton{name='next5', x=690,y=440,w=80,h=65,sound='hold',font=40,fText="↓",code=function()_nextSkin(5)end}, - WIDGET.newButton{name='next6', x=830,y=440,w=80,h=65,sound='hold',font=40,fText="↓",code=function()_nextSkin(6)end}, - WIDGET.newButton{name='next7', x=970,y=440,w=80,h=65,sound='hold',font=40,fText="↓",code=function()_nextSkin(7)end}, + WIDGET.newButton{name='next1', x=130,y=440,w=80,h=65,sound='hold',font=40,fText="↓",code=function()_nextSkin(1) end}, + WIDGET.newButton{name='next2', x=270,y=440,w=80,h=65,sound='hold',font=40,fText="↓",code=function()_nextSkin(2) end}, + WIDGET.newButton{name='next3', x=410,y=440,w=80,h=65,sound='hold',font=40,fText="↓",code=function()_nextSkin(3) end}, + WIDGET.newButton{name='next4', x=550,y=440,w=80,h=65,sound='hold',font=40,fText="↓",code=function()_nextSkin(4) end}, + WIDGET.newButton{name='next5', x=690,y=440,w=80,h=65,sound='hold',font=40,fText="↓",code=function()_nextSkin(5) end}, + WIDGET.newButton{name='next6', x=830,y=440,w=80,h=65,sound='hold',font=40,fText="↓",code=function()_nextSkin(6) end}, + WIDGET.newButton{name='next7', x=970,y=440,w=80,h=65,sound='hold',font=40,fText="↓",code=function()_nextSkin(7) end}, - WIDGET.newButton{name='spin1', x=130,y=540,w=80,h=65,sound='rotate',font=40,code=function()_nextDir(1)end,fText=CHAR.icon.retry_spin}, - WIDGET.newButton{name='spin2', x=270,y=540,w=80,h=65,sound='rotate',font=40,code=function()_nextDir(2)end,fText=CHAR.icon.retry_spin}, - WIDGET.newButton{name='spin3', x=410,y=540,w=80,h=65,sound='rotate',font=40,code=function()_nextDir(3)end,fText=CHAR.icon.retry_spin}, - WIDGET.newButton{name='spin4', x=550,y=540,w=80,h=65,sound='rotate',font=40,code=function()_nextDir(4)end,fText=CHAR.icon.retry_spin}, - WIDGET.newButton{name='spin5', x=690,y=540,w=80,h=65,sound='rotate',font=40,code=function()_nextDir(5)end,fText=CHAR.icon.retry_spin}, - WIDGET.newButton{name='spin6', x=825,y=540,w=80,h=65,sound='rotate',font=40,code=function()_nextDir(6)end,fText=CHAR.icon.retry_spin}, - WIDGET.newButton{name='spin7', x=970,y=540,w=80,h=65,sound='rotate',font=40,code=function()_nextDir(7)end,fText=CHAR.icon.retry_spin}, + WIDGET.newButton{name='spin1', x=130,y=540,w=80,h=65,sound='rotate',font=40,code=function()_nextDir(1) end,fText=CHAR.icon.retry_spin}, + WIDGET.newButton{name='spin2', x=270,y=540,w=80,h=65,sound='rotate',font=40,code=function()_nextDir(2) end,fText=CHAR.icon.retry_spin}, + WIDGET.newButton{name='spin3', x=410,y=540,w=80,h=65,sound='rotate',font=40,code=function()_nextDir(3) end,fText=CHAR.icon.retry_spin}, + WIDGET.newButton{name='spin4', x=550,y=540,w=80,h=65,sound='rotate',font=40,code=function()_nextDir(4) end,fText=CHAR.icon.retry_spin}, + WIDGET.newButton{name='spin5', x=690,y=540,w=80,h=65,sound='rotate',font=40,code=function()_nextDir(5) end,fText=CHAR.icon.retry_spin}, + WIDGET.newButton{name='spin6', x=825,y=540,w=80,h=65,sound='rotate',font=40,code=function()_nextDir(6) end,fText=CHAR.icon.retry_spin}, + WIDGET.newButton{name='spin7', x=970,y=540,w=80,h=65,sound='rotate',font=40,code=function()_nextDir(7) end,fText=CHAR.icon.retry_spin}, WIDGET.newButton{name='skinR', x=200,y=640,w=220,h=80,color='lV',font=35,sound='back', code=function() diff --git a/parts/scenes/setting_sound.lua b/parts/scenes/setting_sound.lua index 5cb1713d..9e765dce 100644 --- a/parts/scenes/setting_sound.lua +++ b/parts/scenes/setting_sound.lua @@ -28,7 +28,7 @@ function scene.mouseDown(x,y) if t2>2.6 and t2<3 and not GAME.playing then loadGame('sprintSmooth',true) elseif vocPack==SETTING.vocPack then - VOC.play((t2<1.26 or t2>6.26)and'doubt'or'happy') + VOC.play((t2<1.26 or t2>6.26) and 'doubt' or 'happy') last2=TIME() end end @@ -36,7 +36,7 @@ end scene.touchDown=scene.mouseDown function scene.keyDown(key) - if key=='space'then + if key=='space' then scene.mouseDown(942,626) else return true @@ -46,7 +46,7 @@ end function scene.draw() gc.setColor(1,1,1) gc.push('transform') - if vocPack=="miya"then + if vocPack=="miya" then gc.translate(780,340+6*sin(TIME()*.5)) gc.draw(IMG.miyaGlow,-4,-4) if TIME()-last1<1 then @@ -63,18 +63,18 @@ function scene.draw() gc.translate(0,-6*sin(TIME()*.5)) gc.setColor(1,1,1,1-(TIME()-last1)) gc.draw(IMG.miyaHeart,162,52,nil,.3) - elseif vocPack=="mono"then + elseif vocPack=="mono" then local jump=math.max(30-(TIME()-last1)*60,0)%10 gc.translate(730,340+6*sin(TIME()*.5)+(jump-10)*jump*.3) gc.draw(IMG.monoCH) - elseif vocPack=="xiaoya"then + elseif vocPack=="xiaoya" then gc.translate(770,340+4*sin(TIME()*.5)) gc.draw(IMG.xiaoyaCH) gc.draw(IMG.xiaoyaOmino,16,168,26/(1+TIME()-last1),.36,.36,33,37) - elseif vocPack=="miku"then + elseif vocPack=="miku" then gc.translate(700,320+12*sin(TIME()*.5)) gc.draw(IMG.mikuCH,nil,nil,nil,.8) - elseif vocPack=="rin"then + elseif vocPack=="rin" then gc.translate(820,280+12*sin(TIME()*.5)) gc.draw(IMG.rinCH,nil,nil,nil,.8) end @@ -87,22 +87,22 @@ scene.widgetList={ WIDGET.newButton{name='game', x=200, y=80,w=240,h=80,color='lC',font=35,code=swapScene('setting_game','swipeR')}, WIDGET.newButton{name='graphic', x=1080,y=80,w=240,h=80,color='lC',font=35,code=swapScene('setting_video','swipeL')}, - WIDGET.newSlider{name='mainVol', x=300, y=170,w=420,lim=220,color='lG',disp=SETval('mainVol'), code=function(v)SETTING.mainVol=v love.audio.setVolume(SETTING.mainVol)end}, - WIDGET.newSlider{name='bgm', x=300, y=240,w=420,lim=220,color='lG',disp=SETval('bgm'), code=function(v)SETTING.bgm=v BGM.setVol(SETTING.bgm)end}, - WIDGET.newSlider{name='sfx', x=300, y=310,w=420,lim=220,color='lC',disp=SETval('sfx'), code=function(v)SETTING.sfx=v SFX.setVol(SETTING.sfx)end, change=function()SFX.play('warn_1')end}, - WIDGET.newSlider{name='stereo', x=300, y=380,w=420,lim=220,color='lC',disp=SETval('stereo'), code=function(v)SETTING.stereo=v SFX.setStereo(SETTING.stereo)end,change=function()SFX.play('touch',1,-1)SFX.play('lock',1,1)end,hideF=function()return SETTING.sfx==0 end}, - WIDGET.newSlider{name='spawn', x=300, y=450,w=420,lim=220,color='lC',disp=SETval('sfx_spawn'), code=function(v)SETTING.sfx_spawn=v end, change=function()SFX.fplay('spawn_'..math.random(7),SETTING.sfx_spawn)end,}, - WIDGET.newSlider{name='warn', x=300, y=520,w=420,lim=220,color='lC',disp=SETval('sfx_warn'), code=function(v)SETTING.sfx_warn=v end, change=function()SFX.fplay('warn_beep',SETTING.sfx_warn)end}, - WIDGET.newSlider{name='vib', x=300, y=590,w=420,lim=220,color='lN',disp=SETval('vib'),axis={0,10,1},code=function(v)SETTING.vib=v end, change=function()if SETTING.vib>0 then VIB(SETTING.vib+2)end end}, - WIDGET.newSlider{name='voc', x=300, y=660,w=420,lim=220,color='lN',disp=SETval('voc'), code=function(v)SETTING.voc=v VOC.setVol(SETTING.voc)end, change=function()VOC.play('test')end}, + WIDGET.newSlider{name='mainVol', x=300, y=170,w=420,lim=220,color='lG',disp=SETval('mainVol'), code=function(v) SETTING.mainVol=v love.audio.setVolume(SETTING.mainVol) end}, + WIDGET.newSlider{name='bgm', x=300, y=240,w=420,lim=220,color='lG',disp=SETval('bgm'), code=function(v) SETTING.bgm=v BGM.setVol(SETTING.bgm) end}, + WIDGET.newSlider{name='sfx', x=300, y=310,w=420,lim=220,color='lC',disp=SETval('sfx'), code=function(v) SETTING.sfx=v SFX.setVol(SETTING.sfx) end, change=function() SFX.play('warn_1') end}, + WIDGET.newSlider{name='stereo', x=300, y=380,w=420,lim=220,color='lC',disp=SETval('stereo'), code=function(v) SETTING.stereo=v SFX.setStereo(SETTING.stereo) end,change=function() SFX.play('touch',1,-1)SFX.play('lock',1,1) end,hideF=function() return SETTING.sfx==0 end}, + WIDGET.newSlider{name='spawn', x=300, y=450,w=420,lim=220,color='lC',disp=SETval('sfx_spawn'), code=function(v) SETTING.sfx_spawn=v end, change=function() SFX.fplay('spawn_'..math.random(7),SETTING.sfx_spawn) end,}, + WIDGET.newSlider{name='warn', x=300, y=520,w=420,lim=220,color='lC',disp=SETval('sfx_warn'), code=function(v) SETTING.sfx_warn=v end, change=function() SFX.fplay('warn_beep',SETTING.sfx_warn) end}, + WIDGET.newSlider{name='vib', x=300, y=590,w=420,lim=220,color='lN',disp=SETval('vib'),axis={0,10,1},code=function(v) SETTING.vib=v end, change=function() if SETTING.vib>0 then VIB(SETTING.vib+2) end end}, + WIDGET.newSlider{name='voc', x=300, y=660,w=420,lim=220,color='lN',disp=SETval('voc'), code=function(v) SETTING.voc=v VOC.setVol(SETTING.voc) end, change=function() VOC.play('test') end}, WIDGET.newSwitch{name='autoMute', x=1150,y=180,lim=380,disp=SETval('autoMute'),code=SETrev('autoMute')}, - WIDGET.newSwitch{name='fine', x=1150,y=250,lim=380,disp=SETval('fine'),code=function()SETTING.fine=not SETTING.fine if SETTING.fine then SFX.play('finesseError',.6)end end}, + WIDGET.newSwitch{name='fine', x=1150,y=250,lim=380,disp=SETval('fine'),code=function() SETTING.fine=not SETTING.fine if SETTING.fine then SFX.play('finesseError',.6) end end}, - WIDGET.newSelector{name='sfxPack',x=1100,y=330,w=200,color='lV',list=SFXPACKS,disp=function()return sfxPack end,code=function(i)sfxPack=i end}, - WIDGET.newButton{name='apply', x=1100,y=400,w=180,h=60,code=function()SETTING.sfxPack=sfxPack SFX.load('media/effect/'..sfxPack..'/')end,hideF=function()return SETTING.sfxPack==sfxPack end}, - WIDGET.newSelector{name='vocPack',x=1100,y=470,w=200,color='lV',list=VOCPACKS,disp=function()return vocPack end,code=function(i)vocPack=i end}, - WIDGET.newButton{name='apply', x=1100,y=540,w=180,h=60,code=function()SETTING.vocPack=vocPack VOC.load('media/vocal/'..vocPack..'/')end,hideF=function()return SETTING.vocPack==vocPack end}, + WIDGET.newSelector{name='sfxPack',x=1100,y=330,w=200,color='lV',list=SFXPACKS,disp=function() return sfxPack end,code=function(i) sfxPack=i end}, + WIDGET.newButton{name='apply', x=1100,y=400,w=180,h=60,code=function() SETTING.sfxPack=sfxPack SFX.load('media/effect/'..sfxPack..'/') end,hideF=function() return SETTING.sfxPack==sfxPack end}, + WIDGET.newSelector{name='vocPack',x=1100,y=470,w=200,color='lV',list=VOCPACKS,disp=function() return vocPack end,code=function(i) vocPack=i end}, + WIDGET.newButton{name='apply', x=1100,y=540,w=180,h=60,code=function() SETTING.vocPack=vocPack VOC.load('media/vocal/'..vocPack..'/') end,hideF=function() return SETTING.vocPack==vocPack end}, WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene}, } diff --git a/parts/scenes/setting_touch.lua b/parts/scenes/setting_touch.lua index 3b38af15..e309a75d 100644 --- a/parts/scenes/setting_touch.lua +++ b/parts/scenes/setting_touch.lua @@ -64,12 +64,12 @@ function scene.mouseUp() scene.touchUp() end function scene.mouseMove(_,_,dx,dy) - if ms.isDown(1)then + if ms.isDown(1) then scene.touchMove(nil,nil,dx,dy) end end function scene.touchDown(x,y) - selected=_onVK_org(x,y)or selected + selected=_onVK_org(x,y) or selected end function scene.touchUp() if selected then @@ -78,7 +78,7 @@ function scene.touchUp() end end function scene.touchMove(_,_,dx,dy) - if selected and not WIDGET.isFocus()then + if selected and not WIDGET.isFocus() then local B=VK_ORG[selected] B.x,B.y=B.x+dx,B.y+dy end @@ -113,8 +113,8 @@ scene.widgetList={ defaultSetSelect=defaultSetSelect%5+1 selected=false end}, - WIDGET.newSelector{name='snap', x=750,y=90,w=200,h=80,color='Y',list={1,10,20,40,60,80},disp=function()return snapUnit end,code=function(i)snapUnit=i end}, - WIDGET.newButton{name='option', x=530,y=190,w=200,h=80,font=60,fText=CHAR.icon.menu,code=function()SCN.go('setting_touchSwitch')end}, + WIDGET.newSelector{name='snap', x=750,y=90,w=200,h=80,color='Y',list={1,10,20,40,60,80},disp=function() return snapUnit end,code=function(i) snapUnit=i end}, + WIDGET.newButton{name='option', x=530,y=190,w=200,h=80,font=60,fText=CHAR.icon.menu,code=function() SCN.go('setting_touchSwitch') end}, WIDGET.newButton{name='back', x=750,y=190,w=200,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene}, WIDGET.newKey{name='save1', x=475,y=290,w=90,h=70,code=_save1,font=45,fText=CHAR.icon.saveOne}, WIDGET.newKey{name='load1', x=585,y=290,w=90,h=70,code=_load1,font=45,fText=CHAR.icon.loadOne}, @@ -132,7 +132,7 @@ scene.widgetList={ hideF=function() return not selected end}, - WIDGET.newKey{name='shape', x=640,y=600,w=200,h=80,code=function()SETTING.VKSkin=VK.nextShape()end}, + WIDGET.newKey{name='shape', x=640,y=600,w=200,h=80,code=function() SETTING.VKSkin=VK.nextShape() end}, } return scene diff --git a/parts/scenes/setting_touchSwitch.lua b/parts/scenes/setting_touchSwitch.lua index 867e0e6a..51877140 100644 --- a/parts/scenes/setting_touchSwitch.lua +++ b/parts/scenes/setting_touchSwitch.lua @@ -14,7 +14,7 @@ function scene.draw() end end -local function _VKAdisp(n)return function()return VK_ORG[n].ava end end +local function _VKAdisp(n) return function() return VK_ORG[n].ava end end local function _VKAcode(n) return n<10 and function() @@ -25,7 +25,7 @@ local function _VKAcode(n) VK_ORG[n].ava=not VK_ORG[n].ava end end -local function _notTrack()return not SETTING.VKTrack end +local function _notTrack() return not SETTING.VKTrack end scene.widgetScrollHeight=340 scene.widgetList={ @@ -50,17 +50,17 @@ scene.widgetList={ WIDGET.newSwitch{name='b19', x=580, y=560, lim=230,disp=_VKAdisp(19),code=_VKAcode(19)}, WIDGET.newSwitch{name='b20', x=580, y=620, lim=230,disp=_VKAdisp(20),code=_VKAcode(20)}, - WIDGET.newButton{name='norm', x=840, y=80, w=240,h=80, font=35,code=function()for i=1,20 do VK_ORG[i].ava=i<11 end end}, - WIDGET.newButton{name='pro', x=1120, y=80, w=240,h=80, font=35,code=function()for i=1,20 do VK_ORG[i].ava=true end end}, + WIDGET.newButton{name='norm', x=840, y=80, w=240,h=80, font=35,code=function() for i=1,20 do VK_ORG[i].ava=i<11 end end}, + WIDGET.newButton{name='pro', x=1120, y=80, w=240,h=80, font=35,code=function() for i=1,20 do VK_ORG[i].ava=true end end}, WIDGET.newSwitch{name='icon', x=1150, y=240, lim=400, font=35,disp=SETval('VKIcon'),code=SETrev('VKIcon')}, - WIDGET.newSlider{name='sfx', x=830, y=320, lim=160,w=400, font=35,change=function()SFX.play('virtualKey',SETTING.VKSFX)end,disp=SETval('VKSFX'),code=SETsto('VKSFX')}, - WIDGET.newSlider{name='vib', x=830, y=390, lim=160,w=400,axis={0,6,1},font=35,change=function()if SETTING.vib>0 then VIB(SETTING.vib+SETTING.VKVIB)end end,disp=SETval('VKVIB'),code=SETsto('VKVIB')}, + WIDGET.newSlider{name='sfx', x=830, y=320, lim=160,w=400, font=35,change=function() SFX.play('virtualKey',SETTING.VKSFX) end,disp=SETval('VKSFX'),code=SETsto('VKSFX')}, + WIDGET.newSlider{name='vib', x=830, y=390, lim=160,w=400,axis={0,6,1},font=35,change=function() if SETTING.vib>0 then VIB(SETTING.vib+SETTING.VKVIB) end end,disp=SETval('VKVIB'),code=SETsto('VKVIB')}, WIDGET.newSlider{name='alpha', x=830, y=460, lim=160,w=400, font=35,disp=SETval('VKAlpha'),code=SETsto('VKAlpha')}, WIDGET.newSwitch{name='track', x=360, y=720, lim=250, font=35,disp=SETval('VKTrack'),code=SETrev('VKTrack')}, WIDGET.newSwitch{name='dodge', x=800, y=720, lim=250, font=35,disp=SETval('VKDodge'),code=SETrev('VKDodge'),hideF=_notTrack}, - WIDGET.newSlider{name='tchW', x=140, y=860, w=1000, font=35,disp=SETval('VKTchW'),code=function(i)SETTING.VKTchW=i SETTING.VKCurW=math.max(SETTING.VKCurW,i)end,hideF=_notTrack}, - WIDGET.newSlider{name='curW', x=140, y=930, w=1000, font=35,disp=SETval('VKCurW'),code=function(i)SETTING.VKCurW=i SETTING.VKTchW=math.min(SETTING.VKTchW,i)end,hideF=_notTrack}, + WIDGET.newSlider{name='tchW', x=140, y=860, w=1000, font=35,disp=SETval('VKTchW'),code=function(i) SETTING.VKTchW=i SETTING.VKCurW=math.max(SETTING.VKCurW,i) end,hideF=_notTrack}, + WIDGET.newSlider{name='curW', x=140, y=930, w=1000, font=35,disp=SETval('VKCurW'),code=function(i) SETTING.VKCurW=i SETTING.VKTchW=math.min(SETTING.VKTchW,i) end,hideF=_notTrack}, WIDGET.newButton{name='back', x=1140, y=640, w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene}, } diff --git a/parts/scenes/setting_video.lua b/parts/scenes/setting_video.lua index 5734c3f6..b744c4fc 100644 --- a/parts/scenes/setting_video.lua +++ b/parts/scenes/setting_video.lua @@ -8,7 +8,7 @@ end function scene.fileDropped(file) - if pcall(gc.newImage,file)then + if pcall(gc.newImage,file) then love.filesystem.write('conf/customBG',file:read('data')) SETTING.bg='custom' applySettings() @@ -68,7 +68,7 @@ scene.widgetList={ WIDGET.newSlider{name='shakeFX', x=330,y=760,lim=280,w=540,axis={0,5,1},disp=SETval('shakeFX'), code=SETsto('shakeFX')}, WIDGET.newSlider{name='atkFX', x=330,y=820,lim=280,w=540,axis={0,5,1},disp=SETval('atkFX'), code=SETsto('atkFX')}, - WIDGET.newSelector{name='frame', x=400,y=890,lim=280,w=460,list={8,10,13,17,22,29,37,47,62,80,100},disp=SETval('frameMul'),code=function(v)SETTING.frameMul=v;Z.setFrameMul(SETTING.frameMul)end}, + WIDGET.newSelector{name='frame', x=400,y=890,lim=280,w=460,list={8,10,13,17,22,29,37,47,62,80,100},disp=SETval('frameMul'),code=function(v) SETTING.frameMul=v;Z.setFrameMul(SETTING.frameMul) end}, WIDGET.newSwitch{name='text', x=450,y=980,lim=360,disp=SETval('text'), code=SETrev('text')}, WIDGET.newSwitch{name='score', x=450,y=1030,lim=360,disp=SETval('score'), code=SETrev('score')}, @@ -78,16 +78,16 @@ scene.widgetList={ WIDGET.newSwitch{name='highCam', x=450,y=1270,lim=360,disp=SETval('highCam'), code=SETrev('highCam')}, WIDGET.newSwitch{name='warn', x=450,y=1340,lim=360,disp=SETval('warn'), code=SETrev('warn')}, - WIDGET.newSwitch{name='clickFX', x=950,y=980,lim=360,disp=SETval('clickFX'), code=function()SETTING.clickFX=not SETTING.clickFX applySettings()end}, - WIDGET.newSwitch{name='power', x=950,y=1070,lim=360,disp=SETval('powerInfo'), code=function()SETTING.powerInfo=not SETTING.powerInfo applySettings()end}, - WIDGET.newSwitch{name='clean', x=950,y=1160,lim=360,disp=SETval('cleanCanvas'), code=function()SETTING.cleanCanvas=not SETTING.cleanCanvas applySettings()end}, - WIDGET.newSwitch{name='fullscreen', x=950,y=1250,lim=360,disp=SETval('fullscreen'), code=function()SETTING.fullscreen=not SETTING.fullscreen applySettings()end}, + WIDGET.newSwitch{name='clickFX', x=950,y=980,lim=360,disp=SETval('clickFX'), code=function() SETTING.clickFX=not SETTING.clickFX applySettings() end}, + WIDGET.newSwitch{name='power', x=950,y=1070,lim=360,disp=SETval('powerInfo'), code=function() SETTING.powerInfo=not SETTING.powerInfo applySettings() end}, + WIDGET.newSwitch{name='clean', x=950,y=1160,lim=360,disp=SETval('cleanCanvas'), code=function() SETTING.cleanCanvas=not SETTING.cleanCanvas applySettings() end}, + WIDGET.newSwitch{name='fullscreen', x=950,y=1250,lim=360,disp=SETval('fullscreen'), code=function() SETTING.fullscreen=not SETTING.fullscreen applySettings() end}, - WIDGET.newKey{name='bg_on', x=680,y=1340,w=200,h=80,code=function()SETTING.bg='on'applySettings()end}, - WIDGET.newKey{name='bg_off', x=900,y=1340,w=200,h=80,code=function()SETTING.bg='off'applySettings()end}, + WIDGET.newKey{name='bg_on', x=680,y=1340,w=200,h=80,code=function() SETTING.bg='on'applySettings() end}, + WIDGET.newKey{name='bg_off', x=900,y=1340,w=200,h=80,code=function() SETTING.bg='off'applySettings() end}, WIDGET.newKey{name='bg_custom', x=1120,y=1340,w=200,h=80, code=function() - if love.filesystem.getInfo('conf/customBG')then + if love.filesystem.getInfo('conf/customBG') then SETTING.bg='custom' applySettings() else @@ -105,18 +105,18 @@ scene.widgetList={ BG.send(v) end end, - hideF=function()return SETTING.bg=='on'end + hideF=function() return SETTING.bg=='on' end }, WIDGET.newSelector{name='blockSatur', x=800,y=1440,w=300,color='lN', list={'normal','soft','gray','light','color'}, disp=SETval('blockSatur'), - code=function(v)SETTING.blockSatur=v;applySettings(SETTING.blockSatur)end + code=function(v) SETTING.blockSatur=v; applySettings(SETTING.blockSatur) end }, WIDGET.newSelector{name='fieldSatur', x=800,y=1540,w=300,color='lN', list={'normal','soft','gray','light','color'}, disp=SETval('fieldSatur'), - code=function(v)SETTING.fieldSatur=v;applySettings(SETTING.fieldSatur)end + code=function(v) SETTING.fieldSatur=v; applySettings(SETTING.fieldSatur) end }, WIDGET.newButton{name='back', x=1140,y=640,w=170,h=80,sound='back',font=60,fText=CHAR.icon.back,code=backScene}, diff --git a/parts/scenes/staff.lua b/parts/scenes/staff.lua index f25667be..43f4687f 100644 --- a/parts/scenes/staff.lua +++ b/parts/scenes/staff.lua @@ -31,17 +31,17 @@ end scene.touchDown=scene.mouseDown function scene.keyDown(key) - if key=='l'then + if key=='l' then loadGame('sprintLock',true) - elseif key=='f'then + elseif key=='f' then loadGame('sprintFix',true) - elseif key=='escape'then + elseif key=='escape' then SCN.back() end end function scene.update(dt) - if(kb.isDown('space','return')or tc.getTouches()[1])and v<16.2 then + if (kb.isDown('space','return') or tc.getTouches()[1]) and v<16.2 then v=v+.42 elseif v>3.55 then v=v-.42 @@ -54,7 +54,7 @@ function scene.update(dt) local r=rnd()<.5 ins(names,{ text=T, - x=r and -T:getWidth()or SCR.w, + x=r and -T:getWidth() or SCR.w, y=rnd()*(SCR.h-T:getHeight()), w=T:getWidth(), vx=(r and 1 or -1)*(1.626+rnd())*(SCR.w+T:getWidth())/SCR.w, diff --git a/parts/scenes/stat.lua b/parts/scenes/stat.lua index eaf6a6a2..d2a7f6b1 100644 --- a/parts/scenes/stat.lua +++ b/parts/scenes/stat.lua @@ -46,7 +46,7 @@ function scene.mouseDown(x,y) end scene.touchDown=scene.mouseDown function scene.keyDown() - if love.keyboard.isDown('m')and love.keyboard.isDown('d')then + if love.keyboard.isDown('m') and love.keyboard.isDown('d') then loadGame('sprintMD',true) else return true @@ -114,7 +114,7 @@ end scene.widgetList={ WIDGET.newButton{name='path',x=820,y=540,w=250,h=80,font=25, code=function() - if SYSTEM=="Windows"or SYSTEM=="Linux"then + if SYSTEM=="Windows" or SYSTEM=="Linux" then love.system.openURL(love.filesystem.getSaveDirectory()) else MES.new('info',love.filesystem.getSaveDirectory()) diff --git a/parts/scenes/test.lua b/parts/scenes/test.lua index cfa46be3..de116b64 100644 --- a/parts/scenes/test.lua +++ b/parts/scenes/test.lua @@ -24,7 +24,7 @@ end function scene.keyDown(key,isRep) if isRep then return end _push("[keyDown] <"..key..">") - if key=='escape'then + if key=='escape' then backCounter=backCounter-1 if backCounter==0 then SCN.back() diff --git a/parts/skin.lua b/parts/skin.lua index 873e8d75..fcebc031 100644 --- a/parts/skin.lua +++ b/parts/skin.lua @@ -19,7 +19,7 @@ function SKIN.load(list) end end -function SKIN.getList()return skinList end +function SKIN.getList() return skinList end local skinMeta={__index=function(self,name) GC.push() @@ -27,7 +27,7 @@ local skinMeta={__index=function(self,name) GC.setDefaultFilter('nearest','nearest') local I local N=Skins[name] - if N and love.filesystem.getInfo(N)then + if N and love.filesystem.getInfo(N) then I=GC.newImage(N) else MES.new('warn',"[no skin] "..name) diff --git a/parts/texture.lua b/parts/texture.lua index 7d2184ea..b9db39aa 100644 --- a/parts/texture.lua +++ b/parts/texture.lua @@ -15,8 +15,8 @@ do for i=1,29 do local b=BLOCKS[i][0] TEXTURE.miniBlock[i]=NSC(#b[1]*2,#b*2) - for y=1,#b do for x=1,#b[1]do - if b[y][x]then + for y=1,#b do for x=1,#b[1] do + if b[y][x] then GC.rectangle('fill',2*(x-1),2*(#b-y),2,2) end end end @@ -127,8 +127,8 @@ TEXTURE.playerBorder=GC.DO{334,620, TEXTURE.gridLines=(function() local L={300,640,{'setLW',2}} - for x=1,9 do table.insert(L,{'line',30*x,0,30*x,640})end - for y=0,20 do table.insert(L,{'line',0,10+30*y,300,10+30*y})end + for x=1,9 do table.insert(L,{'line',30*x,0,30*x,640}) end + for y=0,20 do table.insert(L,{'line',0,10+30*y,300,10+30*y}) end return GC.DO(L) end)() diff --git a/parts/theme.lua b/parts/theme.lua index d243d29b..3fc2f167 100644 --- a/parts/theme.lua +++ b/parts/theme.lua @@ -13,15 +13,15 @@ function THEME.calculate(Y,M,D) --Festival calculate within one statement return --Christmas - M=='12'and math.abs(D-25)<4 and - 'xmas'or + M=='12' and math.abs(D-25)<4 and + 'xmas' or --Birthday - M=='06'and D=='06'and - 'birth'or + M=='06' and D=='06' and + 'birth' or --Spring festival - M<'03'and math.abs((({ + M<'03' and math.abs((({ --Festival days. Jan 26=26, Feb 1=32, etc. 24,43,32,22,40,29,49,38,26,45, 34,23,41,31,50,39,28,47,36,25, @@ -30,63 +30,63 @@ function THEME.calculate(Y,M,D) 32,22,41,30,48,37,26,45,33,23, 42,32,50,39,28,46,35,24,43,33, 21,40, - })[Y-2000]or -26)-((M-1)*31+D))<6 and - 'sprfes'or + })[Y-2000] or -26)-((M-1)*31+D))<6 and + 'sprfes' or --April fool's day - M=='04'and D=='01'and - 'fool'or + M=='04' and D=='01' and + 'fool' or --Z day - D=='26'and( - (M=='03'or M=='04'or M=='05'or M=='06')and'zday1'or - (M=='07'or M=='08'or M=='09'or M=='10')and'zday2'or - (M=='11'or M=='12'or M=='01'or M=='02')and'zday3' - )or + D=='26' and ( + (M=='03' or M=='04' or M=='05' or M=='06') and 'zday1' or + (M=='07' or M=='08' or M=='09' or M=='10') and 'zday2' or + (M=='11' or M=='12' or M=='01' or M=='02') and 'zday3' + ) or --Normal ( - (M=='02'or M=='03'or M=='04')and'season1'or - (M=='05'or M=='06'or M=='07')and'season2'or - (M=='08'or M=='09'or M=='10')and'season3'or - (M=='11'or M=='12'or M=='01')and'season4' + (M=='02' or M=='03' or M=='04') and 'season1' or + (M=='05' or M=='06' or M=='07') and 'season2' or + (M=='08' or M=='09' or M=='10') and 'season3' or + (M=='11' or M=='12' or M=='01') and 'season4' ) end function THEME.set(theme) - if theme=='xmas'then + if theme=='xmas' then BG.setDefault('snow') BGM.setDefault('xmas') MES.new('info',"==Merry Christmas==") - elseif theme=='birth'then + elseif theme=='birth' then BG.setDefault('firework') BGM.setDefault('magicblock') - elseif theme=='sprfes'then + elseif theme=='sprfes' then BG.setDefault('firework') BGM.setDefault('spring festival') MES.new('info',"★☆新年快乐☆★") - elseif theme=='zday1'then + elseif theme=='zday1' then BG.setDefault('lanterns') BGM.setDefault('overzero') - elseif theme=='zday2'then + elseif theme=='zday2' then BG.setDefault('lanterns') BGM.setDefault('jazz nihilism') - elseif theme=='zday3'then + elseif theme=='zday3' then BG.setDefault('lanterns') BGM.setDefault('empty') - elseif theme=='season1'then + elseif theme=='season1' then BG.setDefault('space') BGM.setDefault('null') - elseif theme=='season2'then + elseif theme=='season2' then BG.setDefault('space') BGM.setDefault('nil') - elseif theme=='season3'then + elseif theme=='season3' then BG.setDefault('space') BGM.setDefault('vacuum') - elseif theme=='season4'then + elseif theme=='season4' then BG.setDefault('space') BGM.setDefault('space') - elseif theme=='fool'then + elseif theme=='fool' then BG.setDefault('blockrain') BGM.setDefault('how feeling') else diff --git a/parts/users.lua b/parts/users.lua index e4462a08..14a915a1 100644 --- a/parts/users.lua +++ b/parts/users.lua @@ -41,11 +41,11 @@ local db_img={} local db=setmetatable({},{__index=function(self,uid) if not uid then return emptyUser end local file="cache/user"..uid..".dat" - local d=fs.getInfo(file)and JSON.decode(fs.read(file))or TABLE.copy(emptyUser) + local d=fs.getInfo(file) and JSON.decode(fs.read(file)) or TABLE.copy(emptyUser) rawset(self,uid,d) db_img[uid]= - type(d.hash)=='string'and #d.hash>0 and fs.getInfo("cache/"..d.hash)and - _loadAvatar("cache/"..d.hash)or + type(d.hash)=='string' and #d.hash>0 and fs.getInfo("cache/"..d.hash) and + _loadAvatar("cache/"..d.hash) or defaultAvatar[(uid-26)%29+1] return d end}) @@ -64,13 +64,13 @@ function USERS.updateUserData(data) if data.avatar then fs.write("cache/"..data.hash,love.data.decode('string','base64',data.avatar:sub(data.avatar:find(",")+1))) db_img[uid]=_loadAvatar("cache/"..data.hash) - db[uid].hash=type(data.hash)=='string'and #data.hash>0 and data.hash + db[uid].hash=type(data.hash)=='string' and #data.hash>0 and data.hash end end -function USERS.getUsername(uid)return db[uid].username end -function USERS.getMotto(uid)return db[uid].motto end -function USERS.getHash(uid)return db[uid].hash or""end +function USERS.getUsername(uid) return db[uid].username end +function USERS.getMotto(uid) return db[uid].motto end +function USERS.getHash(uid) return db[uid].hash or "" end function USERS.getAvatar(uid) if uid then if not db[uid].new then diff --git a/parts/virtualKey.lua b/parts/virtualKey.lua index cc549583..cb01ebd4 100644 --- a/parts/virtualKey.lua +++ b/parts/virtualKey.lua @@ -111,11 +111,11 @@ end --Virtualkey icons local VKIcon={} local VKI=gc.newImage("media/image/virtualkey.png") -for i=1,20 do VKIcon[i]=GC.DO{90,90,{'draw',VKI,(i-1)%5*-90,math.floor((i-1)*.2)*-90}}end +for i=1,20 do VKIcon[i]=GC.DO{90,90,{'draw',VKI,(i-1)%5*-90,math.floor((i-1)*.2)*-90}} end VKI:release() --In-game virtualkey layout data -local keys={}for i=1,#VK_ORG do keys[i]={}end +local keys={} for i=1,#VK_ORG do keys[i]={} end local VK={keys=keys} @@ -140,7 +140,7 @@ function VK.touch(id,x,y) B.isDown=true B.pressTime=10 SFX.play('virtualKey',SETTING.VKSFX) - if SETTING.vib>0 then VIB(SETTING.vib+SETTING.VKVIB)end + if SETTING.vib>0 then VIB(SETTING.vib+SETTING.VKVIB) end if SETTING.VKTrack then --Auto follow