@@ -328,9 +328,9 @@ do-- function DATA.saveReplay()
|
||||
local noRecList={"custom","solo","round","techmino"}
|
||||
local function _getModList()
|
||||
local res={}
|
||||
for _,v in next,GAME.mod do
|
||||
if v.sel>0 then
|
||||
ins(res,{v.no,v.sel})
|
||||
for number,sel in next,GAME.mod do
|
||||
if sel>0 then
|
||||
ins(res,{MODOPT[number].no,sel})
|
||||
end
|
||||
end
|
||||
return res
|
||||
|
||||
@@ -504,8 +504,8 @@ function mergeStat(stat,delta)-- Merge delta stat. to global stat.
|
||||
end
|
||||
end
|
||||
function scoreValid()-- Check if any unranked mods are activated
|
||||
for _,M in next,GAME.mod do
|
||||
if M.unranked then
|
||||
for number,sel in next,GAME.mod do
|
||||
if sel>0 and MODOPT[number].unranked then
|
||||
return false
|
||||
end
|
||||
end
|
||||
@@ -994,17 +994,23 @@ do-- function dumpBasicConfig()
|
||||
end
|
||||
end
|
||||
do-- function resetGameData(args)
|
||||
local function task_showMods()
|
||||
local time=0
|
||||
while true do
|
||||
coroutine.yield()
|
||||
if time%20==0 then
|
||||
local M=GAME.mod[time/20+1]
|
||||
if not M then return end
|
||||
local function task_showMods() -- TODO
|
||||
coroutine.yield()
|
||||
local counter=0
|
||||
for number,sel in next,GAME.mod do
|
||||
if sel>0 then
|
||||
if counter==0 then
|
||||
coroutine.yield()
|
||||
else
|
||||
for _=1,20 do
|
||||
coroutine.yield()
|
||||
end
|
||||
end
|
||||
local M=MODOPT[number]
|
||||
SFX.play('collect',.2)
|
||||
TEXT.show(M.id,640+(time/20%5-2)*80,26,45,'spin')
|
||||
TEXT.show(M.id,640+(counter%5-2)*80,26,45,'spin')
|
||||
counter=counter+1
|
||||
end
|
||||
time=time+1
|
||||
end
|
||||
end
|
||||
local gameSetting={
|
||||
@@ -1126,6 +1132,14 @@ do-- function checkWarning(P,dt)
|
||||
end
|
||||
end
|
||||
end
|
||||
function usingMod()
|
||||
for _,sel in next,GAME.mod do
|
||||
if sel>0 then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
|
||||
|
||||
@@ -1176,6 +1190,9 @@ function drawWarning()
|
||||
gc_pop()
|
||||
end
|
||||
end
|
||||
function setModBackgroundColor()
|
||||
gc_setColor(.42,.26,.62,.62+.26*math.sin(TIME()*12.6))
|
||||
end
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -496,7 +496,7 @@ do-- Mod data
|
||||
}
|
||||
for i=1,#MODOPT do
|
||||
local M=MODOPT[i]
|
||||
M.sel,M.time=0,0
|
||||
M.time=0
|
||||
M.color=COLOR[M.color]
|
||||
end
|
||||
end
|
||||
@@ -507,37 +507,37 @@ do-- Game data tables
|
||||
BAG={}-- Sequence for custom game
|
||||
MISSION={}-- Clearing mission for custom game
|
||||
GAME={-- Global game data
|
||||
playing=false, -- If in-game
|
||||
init=false, -- If need initializing game when enter scene-play
|
||||
net=false, -- If play net game
|
||||
playing=false, -- If in-game
|
||||
init=false, -- If need initializing game when enter scene-play
|
||||
net=false, -- If play net game
|
||||
|
||||
result=false, -- Game result (string)
|
||||
rank=0, -- Rank reached
|
||||
pauseTime=0, -- Time paused
|
||||
pauseCount=0, -- Pausing count
|
||||
warnLVL0=0, -- Warning level
|
||||
warnLVL=0, -- Warning level (show)
|
||||
result=false, -- Game result (string)
|
||||
rank=0, -- Rank reached
|
||||
pauseTime=0, -- Time paused
|
||||
pauseCount=0, -- Pausing count
|
||||
warnLVL0=0, -- Warning level
|
||||
warnLVL=0, -- Warning level (show)
|
||||
|
||||
seed=1046101471, -- Game seed
|
||||
curMode=false, -- Current gamemode object
|
||||
mod={}, -- List of loaded mods
|
||||
modeEnv=false, -- Current gamemode environment
|
||||
setting={}, -- Game settings
|
||||
rep={}, -- Recording list, key,time,key,time...
|
||||
statSaved=true, -- If recording saved
|
||||
recording=false, -- If recording
|
||||
replaying=false, -- If replaying
|
||||
saved=false, -- If recording saved
|
||||
tasUsed=false, -- If tasMode used
|
||||
seed=1046101471, -- Game seed
|
||||
curMode=false, -- Current gamemode object
|
||||
mod=TABLE.new(0,#MODOPT),-- List of loaded mods
|
||||
modeEnv=false, -- Current gamemode environment
|
||||
setting={}, -- Game settings
|
||||
rep={}, -- Recording list, key,time,key,time...
|
||||
statSaved=true, -- If recording saved
|
||||
recording=false, -- If recording
|
||||
replaying=false, -- If replaying
|
||||
saved=false, -- If recording saved
|
||||
tasUsed=false, -- If tasMode used
|
||||
|
||||
prevBG=false, -- Previous background, for restore BG when quit setting page
|
||||
prevBG=false, -- Previous background, for restore BG when quit setting page
|
||||
|
||||
-- Data for royale mode
|
||||
stage=false, -- Game stage
|
||||
mostBadge=false, -- Most badge owner
|
||||
secBadge=false, -- Second badge owner
|
||||
mostDangerous=false,-- Most dangerous player
|
||||
secDangerous=false, -- Second dangerous player
|
||||
stage=false, -- Game stage
|
||||
mostBadge=false, -- Most badge owner
|
||||
secBadge=false, -- Second badge owner
|
||||
mostDangerous=false, -- Most dangerous player
|
||||
secDangerous=false, -- Second dangerous player
|
||||
}
|
||||
ROYALEDATA={
|
||||
powerUp=false,
|
||||
|
||||
@@ -199,8 +199,11 @@ local function _loadGameEnv(P)-- Load gameEnv
|
||||
end
|
||||
end
|
||||
if ENV.allowMod then
|
||||
for _,M in next,GAME.mod do
|
||||
M.func(P,M.list and M.list[M.sel])
|
||||
for i=1,#GAME.mod do
|
||||
if GAME.mod[i]>0 then
|
||||
local M=MODOPT[i]
|
||||
M.func(P,M.list and M.list[GAME.mod[i]])
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -21,6 +21,7 @@ local sList={
|
||||
eventSet=EVENTSETS,
|
||||
holdMode={'hold','swap'},
|
||||
}
|
||||
local modUsed
|
||||
|
||||
local scene={}
|
||||
|
||||
@@ -28,6 +29,7 @@ function scene.enter()
|
||||
destroyPlayers()
|
||||
BG.set(CUSTOMENV.bg)
|
||||
BGM.play(CUSTOMENV.bgm)
|
||||
modUsed=usingMod()
|
||||
end
|
||||
function scene.leave()
|
||||
saveFile(CUSTOMENV,'conf/customEnv')
|
||||
@@ -171,8 +173,8 @@ function scene.draw()
|
||||
gc.print(CUSTOMENV.sequence,610,250)
|
||||
|
||||
-- Mod indicator
|
||||
if #GAME.mod>0 then
|
||||
gc.setColor(.42,.26,.62,.62+.26*math.sin(TIME()*12.6))
|
||||
if modUsed then
|
||||
setModBackgroundColor()
|
||||
gc.rectangle('fill',1110-230/2,200-90/2,230,90,5,5)
|
||||
end
|
||||
|
||||
|
||||
@@ -2,31 +2,17 @@ local scene={}
|
||||
|
||||
local selected-- Mod selected
|
||||
|
||||
local function _modComp(a,b)
|
||||
return a.no<b.no
|
||||
end
|
||||
local function _remMod(M)
|
||||
local i=TABLE.find(GAME.mod,M)
|
||||
if i then
|
||||
table.remove(GAME.mod,i)
|
||||
end
|
||||
end
|
||||
local function _toggleMod(M,back)
|
||||
if M.sel==0 then
|
||||
table.insert(GAME.mod,M)
|
||||
table.sort(GAME.mod,_modComp)
|
||||
end
|
||||
local number=M.no+1
|
||||
assert(MODOPT[number]==M)
|
||||
if M.list then
|
||||
if back then
|
||||
M.sel=(M.sel-1)%(#M.list+1)
|
||||
GAME.mod[number]=(GAME.mod[number]-1)%(#M.list+1)
|
||||
else
|
||||
M.sel=(M.sel+1)%(#M.list+1)
|
||||
GAME.mod[number]=(GAME.mod[number]+1)%(#M.list+1)
|
||||
end
|
||||
else
|
||||
M.sel=1-M.sel
|
||||
end
|
||||
if M.sel==0 then
|
||||
_remMod(M)
|
||||
GAME.mod[number]=1-GAME.mod[number]
|
||||
end
|
||||
if M.unranked then
|
||||
SFX.play('touch',.6)
|
||||
@@ -70,10 +56,14 @@ end
|
||||
|
||||
function scene.keyDown(key)
|
||||
if key=='tab' or key=='delete' then
|
||||
if GAME.mod[1] then
|
||||
while GAME.mod[1] do
|
||||
table.remove(GAME.mod).sel=0
|
||||
local modUsed=false
|
||||
for i=1,#GAME.mod do
|
||||
if GAME.mod[i]>0 then
|
||||
modUsed=true
|
||||
end
|
||||
GAME.mod[i]=0
|
||||
end
|
||||
if modUsed then
|
||||
scene.widgetList.unranked.hide=scoreValid()
|
||||
SFX.play('hold')
|
||||
end
|
||||
@@ -91,8 +81,9 @@ function scene.keyDown(key)
|
||||
end
|
||||
|
||||
function scene.update()
|
||||
for _,M in next,MODOPT do
|
||||
if M.sel==0 then
|
||||
for number,sel in next,GAME.mod do
|
||||
local M=MODOPT[number]
|
||||
if sel==0 then
|
||||
if M.time>0 then
|
||||
M.time=M.time-1
|
||||
end
|
||||
@@ -106,7 +97,8 @@ end
|
||||
function scene.draw()
|
||||
setFont(40)
|
||||
GC.setLineWidth(5)
|
||||
for _,M in next,MODOPT do
|
||||
for number,M in next,MODOPT do
|
||||
local sel=GAME.mod[number]
|
||||
GC.push('transform')
|
||||
GC.translate(M.x,M.y)
|
||||
local t=M.time*.01-- t range:0~0.1
|
||||
@@ -126,16 +118,16 @@ function scene.draw()
|
||||
GC.circle('line',0,0,rad,side)
|
||||
GC.setColor(COLOR.Z)
|
||||
GC.mStr(M.id,0,-27)
|
||||
if M.sel>0 and M.list then
|
||||
if sel>0 and M.list then
|
||||
setFont(25)
|
||||
GC.setColor(1,1,1,10*t)
|
||||
GC.mStr(M.list[M.sel],20,8)
|
||||
GC.mStr(M.list[sel],20,8)
|
||||
setFont(40)
|
||||
end
|
||||
|
||||
if M.list then
|
||||
GC.setColor(1,1,1,t*6)
|
||||
GC.arc('line','open',0,0,rad+6,0,(M.sel/#M.list)*6.2832)
|
||||
GC.arc('line','open',0,0,rad+6,0,(sel/#M.list)*6.2832)
|
||||
end
|
||||
GC.pop()
|
||||
end
|
||||
|
||||
@@ -24,6 +24,7 @@ local touchDist
|
||||
local grid
|
||||
local min_x,max_x=-1500,1350
|
||||
local min_y,max_y=-1900,660
|
||||
local modUsed
|
||||
|
||||
local scene={}
|
||||
|
||||
@@ -42,6 +43,7 @@ function scene.enter()
|
||||
end
|
||||
end
|
||||
end
|
||||
modUsed=usingMod()
|
||||
end
|
||||
|
||||
local function _getK()
|
||||
@@ -223,8 +225,8 @@ local function _drawModeShape(M,S,drawType)
|
||||
end
|
||||
function scene.draw()
|
||||
-- Mod indicator
|
||||
if #GAME.mod>0 then
|
||||
gc_setColor(.42,.26,.62,.62+.26*math.sin(TIME()*12.6))
|
||||
if modUsed then
|
||||
setModBackgroundColor()
|
||||
gc_rectangle('fill',140-220/2,655-80/2,220,80,5,5)
|
||||
end
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ local GC=GC
|
||||
|
||||
local scene={}
|
||||
|
||||
local modUsed
|
||||
local page
|
||||
local timer1,timer2-- Animation timer
|
||||
local form-- Form of clear & spins
|
||||
@@ -16,6 +17,7 @@ local trophy-- Current trophy
|
||||
local trophyColor-- Current trophy color
|
||||
|
||||
function scene.enter()
|
||||
modUsed=usingMod()
|
||||
page=0
|
||||
if type(SCN.prev)=='string' and SCN.prev:find("setting") then
|
||||
TEXT.show(text.needRestart,640,410,50,'fly',.6)
|
||||
@@ -316,7 +318,7 @@ function scene.draw()
|
||||
GC.push('transform')
|
||||
GC.translate(131,600)
|
||||
GC.scale(.65)
|
||||
if #GAME.mod>0 then
|
||||
if modUsed then
|
||||
GC.setLineWidth(2)
|
||||
if scoreValid() then
|
||||
GC.setColor(.7,.7,.7,timer1)
|
||||
@@ -330,8 +332,8 @@ function scene.draw()
|
||||
GC.rectangle('fill',-5,-5,500,150,8)
|
||||
end
|
||||
FONT.set(35)
|
||||
for _,M in next,MODOPT do
|
||||
if M.sel>0 then
|
||||
for number,M in next,MODOPT do
|
||||
if GAME.mod[number]>0 then
|
||||
_=M.color
|
||||
GC.setColor(_[1],_[2],_[3],timer1)
|
||||
GC.mStr(M.id,35+M.no%8*60,math.floor(M.no/8)*45)
|
||||
|
||||
@@ -32,6 +32,7 @@ local listBox=WIDGET.newListBox{name='list',x=50,y=50,w=1200,h=520,lineH=40,draw
|
||||
end}
|
||||
|
||||
local scene={}
|
||||
local mods={}
|
||||
|
||||
local function _playRep(fileName)
|
||||
local rep=DATA.parseReplay(fileName,true)
|
||||
@@ -40,11 +41,12 @@ local function _playRep(fileName)
|
||||
elseif MODES[rep.mode] then
|
||||
GAME.seed=rep.seed
|
||||
GAME.setting=rep.setting
|
||||
TABLE.cut(GAME.mod)
|
||||
for i=1,#MODOPT do MODOPT[i].sel=0 end
|
||||
if #mods==0 then
|
||||
mods=GAME.mod
|
||||
end
|
||||
GAME.mod=TABLE.new(0,#MODOPT)
|
||||
for _,m in next,rep.mod do
|
||||
MODOPT[m[1]+1].sel=m[2]
|
||||
table.insert(GAME.mod,MODOPT[m[1]+1])
|
||||
GAME.mod[m[1]+1]=m[2]
|
||||
end
|
||||
GAME.rep={}
|
||||
DATA.pumpRecording(rep.data,GAME.rep)
|
||||
@@ -74,8 +76,9 @@ function scene.enter()
|
||||
_updateButtonVisibility()
|
||||
end
|
||||
function scene.leave()
|
||||
for i=1,#MODOPT do MODOPT[i].sel=0 end
|
||||
TABLE.cut(GAME.mod)
|
||||
if #mods>0 then
|
||||
GAME.mod,mods=mods,{}
|
||||
end
|
||||
end
|
||||
|
||||
function scene.keyDown(key)
|
||||
|
||||
Reference in New Issue
Block a user