diff --git a/Zenitha b/Zenitha index 7fe8ba93..eadbb06b 160000 --- a/Zenitha +++ b/Zenitha @@ -1 +1 @@ -Subproject commit 7fe8ba93db734f84200ee6666a469a761e6c4887 +Subproject commit eadbb06b6fe913ac282cd2f1d79a49182ad8f531 diff --git a/assets/game/mode/mino/interior/marathon.lua b/assets/game/mode/mino/interior/marathon.lua index b1be9d4f..78d9a5e7 100644 --- a/assets/game/mode/mino/interior/marathon.lua +++ b/assets/game/mode/mino/interior/marathon.lua @@ -6,7 +6,7 @@ return { initialize=function() GAME.newPlayer(1,'mino') GAME.setMain(1) - playBgm('push',PROGRESS.getMain()==1 and 'simp' or 'base') + playBgm('push',PROGRESS.get('main')==1 and 'simp' or 'base') end, settings={mino={ skin='mino_interior', @@ -29,7 +29,7 @@ return { local md=P.modeData while md.stat.line>=md.lineTarget do if md.lineTarget<200 then - if PROGRESS.getMain()>=2 and md.lineTarget<=150 and P.isMain then + if PROGRESS.get('main')>=2 and md.lineTarget<=150 and P.isMain then BGM.set(bgmList['push'].add,'volume',(md.lineTarget/150)^2,2.6) end P.settings.dropDelay=dropSpeed[md.lineTarget/10+1] diff --git a/assets/game/mode/mino/interior/sprint.lua b/assets/game/mode/mino/interior/sprint.lua index 7933f4fa..08512306 100644 --- a/assets/game/mode/mino/interior/sprint.lua +++ b/assets/game/mode/mino/interior/sprint.lua @@ -3,7 +3,7 @@ return { initialize=function() GAME.newPlayer(1,'mino') GAME.setMain(1) - playBgm('race',PROGRESS.getMain()==1 and 'simp' or 'base') + playBgm('race',PROGRESS.get('main')==1 and 'simp' or 'base') BG.set('none') end, settings={mino={ @@ -17,7 +17,7 @@ return { afterClear={ mechLib.mino.sprint.event_afterClear[40], function(P) - if PROGRESS.getMain()>=2 and P.modeData.stat.line>10 and P.isMain then + if PROGRESS.get('main')>=2 and P.modeData.stat.line>10 and P.isMain then BGM.set(bgmList['race'].add,'volume',math.min((P.modeData.stat.line-10)/20,1),2.6) end end, diff --git a/assets/progress.lua b/assets/progress.lua index 4006db79..6199a7e3 100644 --- a/assets/progress.lua +++ b/assets/progress.lua @@ -5,7 +5,8 @@ local gc=love.graphics Sum>=100 → II Single>=200 or Sum>=350 → III ]] -local prgs={ +local prgs=setmetatable({ + firstLaunch=true, main=1, tutorial='000000', interiorScore={ @@ -23,7 +24,11 @@ local prgs={ dig_practice=0, }, }, -} +},{ + __index=function(_,k) + error("Attempt to read undefined progress data: "..tostring(k)) + end, +}) local function sysInfoFunc() if not SETTINGS.system.powerInfo then return end @@ -113,6 +118,7 @@ function PROGRESS.load() -- MSG.new('info',"Hash not match") -- end end + prgs.firstLaunch=false else MSG.new('info',"Load progress failed: "..res) end @@ -329,7 +335,7 @@ function PROGRESS.drawExteriorHeader(h) end -- Get -function PROGRESS.getMain() return prgs.main end +function PROGRESS.get(k) return prgs[k] end function PROGRESS.getBgmUnlocked(name) return prgs.bgmUnlocked[name] end function PROGRESS.getTutorialPassed(n) if n then diff --git a/assets/scene/hello.lua b/assets/scene/hello.lua index 51df4618..7601d9fc 100644 --- a/assets/scene/hello.lua +++ b/assets/scene/hello.lua @@ -7,7 +7,7 @@ function scene.enter() t=0 Zenitha.setClickFX(false) Zenitha.setDrawCursor(NULL) - if PROGRESS.getMain()>=3 then PROGRESS.applyCoolWaitTemplate() end + if PROGRESS.get('main')>=3 then PROGRESS.applyCoolWaitTemplate() end end function scene.update(dt) @@ -21,13 +21,13 @@ end function scene.draw() TASK.lock('drawBegin') - if PROGRESS.getMain()<=2 then + if PROGRESS.get('main')<=2 then GC.clear(0,0,0) if t<1 and t%.26>.13 then FONT.set(50) GC.print('_',40,20) end - elseif PROGRESS.getMain()<=4 then + elseif PROGRESS.get('main')<=4 then GC.replaceTransform(SCR.xOy_m) GC.scale(1.6,1) GC.setLineWidth(19.5) diff --git a/assets/scene/main_in.lua b/assets/scene/main_in.lua index 2e9bed46..8a2e34f9 100644 --- a/assets/scene/main_in.lua +++ b/assets/scene/main_in.lua @@ -4,24 +4,24 @@ local scene={} function scene.enter() consoleClickCount=0 PROGRESS.setEnv('interior') - local visibleButtonName=PROGRESS.getMain()==1 and '1' or '2' + local visibleButtonName=PROGRESS.get('main')==1 and '1' or '2' for _,v in next,scene.widgetList do if v.name=='1' or v.name=='2' then v:setVisible(v.name==visibleButtonName) elseif v.name=='GameSet' then - v.color=PROGRESS.getMain()<=2 and COLOR.L or COLOR.lD + v.color=PROGRESS.get('main')<=2 and COLOR.L or COLOR.lD end end - if PROGRESS.getMain()<=2 and (PROGRESS.getInteriorScore('sprint')>=200 or PROGRESS.getTotalInteriorScore()>=350) then + if PROGRESS.get('main')<=2 and (PROGRESS.getInteriorScore('sprint')>=200 or PROGRESS.getTotalInteriorScore()>=350) then PROGRESS.transcendTo(3) - elseif PROGRESS.getMain()==1 and (PROGRESS.getTotalInteriorScore()>=150 or PROGRESS.getTutorialPassed()) then + elseif PROGRESS.get('main')==1 and (PROGRESS.getTotalInteriorScore()>=150 or PROGRESS.getTutorialPassed()) then PROGRESS.transcendTo(2) end end local function sysAction(action) if action=='back' then - if PROGRESS.getMain()<=2 then + if PROGRESS.get('main')<=2 then if sureCheck('quit') then PROGRESS.quit() end else SCN.back('none') @@ -46,7 +46,7 @@ function scene.draw() GC.replaceTransform(SCR.xOy_m) -- Progress bar - if PROGRESS.getMain()>=2 then + if PROGRESS.get('main')>=2 then scoreColor(-520,PROGRESS.getInteriorScore('dig')) scoreColor(-160,PROGRESS.getInteriorScore('sprint')) scoreColor(200, PROGRESS.getInteriorScore('marathon')) @@ -78,7 +78,7 @@ scene.widgetList={ {name='LangSel',type='button', pos={.5,.5},x=-270,y=320,w=400,h=100,text=CHAR.icon.language, fontSize=70,lineWidth=4,cornerR=0,code=WIDGET.c_goScn('lang_in','none')}, {name='GameSet',type='button', pos={.5,.5},x=270, y=320,w=400,h=100,text=LANG'main_in_settings', fontSize=40,lineWidth=4,cornerR=0,sound_trigger=false,code=function() - if PROGRESS.getMain()<=2 or isCtrlPressed() then + if PROGRESS.get('main')<=2 or isCtrlPressed() then SFX.play('button_norm') SCN.go('setting_in','none') else diff --git a/assets/scene/pause_in.lua b/assets/scene/pause_in.lua index dc4740f9..0e4776bf 100644 --- a/assets/scene/pause_in.lua +++ b/assets/scene/pause_in.lua @@ -56,7 +56,7 @@ scene.widgetList={ {type='button',pos={.5,.5},x=300*0,y=-160,w=260,h=100,lineWidth=4,cornerR=0,fontSize=60,text=CHAR.icon.retry, code=function() sysAction('restart') end}, {type='button',pos={.5,.5},x=300*1,y=-160,w=260,h=100,lineWidth=4,cornerR=0,fontSize=60,text=CHAR.icon.settings, code=function() - if PROGRESS.getMain()<=2 or isCtrlPressed() then + if PROGRESS.get('main')<=2 or isCtrlPressed() then sysAction('setting') else SFX.play('move_failed') diff --git a/assets/scene/setting_in.lua b/assets/scene/setting_in.lua index 72225b97..5777d7f6 100644 --- a/assets/scene/setting_in.lua +++ b/assets/scene/setting_in.lua @@ -2,7 +2,7 @@ local scene={} function scene.enter() local L=scene.widgetList - if PROGRESS.getMain()==1 then + if PROGRESS.get('main')==1 then L.das.y=250 L.arr.y=350 L.sdarr:setVisible(false) diff --git a/assets/scene/tutorial_in.lua b/assets/scene/tutorial_in.lua index fcb885c0..15566209 100644 --- a/assets/scene/tutorial_in.lua +++ b/assets/scene/tutorial_in.lua @@ -48,7 +48,7 @@ function scene.keyDown(key) end function scene.draw() - if PROGRESS.getMain()>1 then + if PROGRESS.get('main')>1 then GC.replaceTransform(SCR.xOy_m) GC.setColor(1,1,1,.42) GC.rectangle('fill',-7,-250,4,540)