Save last played mode. Can start in mode selector.

This commit is contained in:
Kistaro Windrider 2023-07-23 17:15:19 -07:00
parent e5afd605c8
commit dee31bf52f
Signed by: kistaro
SSH Key Fingerprint: SHA256:TBE2ynfmJqsAf0CP6gsflA0q5X5wD5fVKWPsZ7eVUg8

View File

@ -107,8 +107,6 @@ function print3(s,y,w)
end end
function cyclenum(n,low,up) function cyclenum(n,low,up)
low=low or 1
up=up or low+1
return(n-low)%(up-low+1)+low return(n-low)%(up-low+1)+low
end end
@ -1263,7 +1261,8 @@ function init_menu()
bg.set("falling") bg.set("falling")
gstate=1 gstate=1
gamev,mode,slc={sprite={}},mode or 1,1 gamev,mode,slc={sprite={}},mode or dget(63),1
if (mode<1) mode=1
options=options or { options=options or {
gamev={}, gamev={},
@ -1365,21 +1364,22 @@ function update_menu()
sfx"12" sfx"12"
end end
--start game --start game
if 1==slc then if slc <= 2 then
if confirm()then if confirm()then
dset(63,mode)
cpt(modes[modes.list[mode]],gamev) cpt(modes[modes.list[mode]],gamev)
init_game(gamev) init_game(gamev)
end end
--mode selection if slc == 2 then
elseif 2==slc then if btnp"0"then
if btnp"0"then sfx"13"
sfx"13" mode-=1
mode-=1 if(0==mode)mode=#modes.list
if(0==mode)mode=#modes.list elseif btnp"1"then
elseif btnp"1"then sfx"13"
sfx"13" mode%=#modes.list
mode%=#modes.list mode+=1
mode+=1 end
end end
--option menu --option menu
elseif 3==slc and confirm()then elseif 3==slc and confirm()then