adds music settings to saved settings

This commit is contained in:
duncathan 2020-03-03 01:21:07 -06:00
parent 4426eb69ec
commit 5b172e650c
5 changed files with 32 additions and 15 deletions

View file

@ -323,6 +323,9 @@ function C:_updateSettings()
Settings.settings.spawn = self.worldGraph.spawn
Settings.settings.seqbreaks = self.worldGraph.seqbreak
Settings.settings.dboosts = _.map(self.worldGraph.dboosts, function(k,v) return v.enabled end)
Settings.settings.musicShuffle = self.shuffleMusic
Settings.settings.musicBeta = self.music.betaEnabled
Settings.settings.musicFlavor = self.music.flavor
Settings:update()
end

View file

@ -31,7 +31,10 @@ function C:getDefaults()
sisters = true,
plantation = true,
rocket = true
}
},
musicShuffle = false,
musicBeta = false,
musicFlavor = "Shuffle"
}
end
@ -48,18 +51,21 @@ function C:serialize()
return line .. "}"
end
local line = "return {\r\n "
line = line .. ("csdirectory = [[%s]],\r\n "):format(self.settings.csdirectory or "")
line = line .. ("puppy = %s,\r\n "):format(self.settings.puppy)
line = line .. ("obj = %q,\r\n "):format(self.settings.obj or "")
line = line .. ("mychar = %q,\r\n "):format(self.settings.mychar or "")
line = line .. ("spawn = %q,\r\n "):format(self.settings.spawn or "")
local line = "return {\r\n"
local tab = " "
line = line .. tab .. ("csdirectory = [[%s]],\r\n"):format(self.settings.csdirectory or "")
line = line .. tab .. ("puppy = %s,\r\n"):format(self.settings.puppy)
line = line .. tab .. ("obj = %q,\r\n"):format(self.settings.obj or "")
line = line .. tab .. ("mychar = %q,\r\n"):format(self.settings.mychar or "")
line = line .. tab .. ("spawn = %q,\r\n"):format(self.settings.spawn or "")
local dboost = dboosts()
line = line .. ("seqbreaks = %s,\r\n "):format(self.settings.seqbreaks)
line = line .. ("dboosts = %s,\r\n "):format(dboost)
line = line .. tab .. ("seqbreaks = %s,\r\n"):format(self.settings.seqbreaks)
line = line .. tab .. ("dboosts = %s,\r\n"):format(dboost)
line = line .. tab .. ("musicShuffle = %s,\r\n"):format(self.settings.musicShuffle)
line = line .. tab .. ("musicBeta = %s,\r\n"):format(self.settings.musicBeta)
line = line .. tab .. ("musicFlavor = %q\r\n"):format(self.settings.musicFlavor)
return line .. "\r\n}"
return line .. "}"
end
function C:getSettings()

View file

@ -28,6 +28,7 @@ function C:setup()
self:loadMyChar(Settings.settings.mychar)
self:loadSpawn(Settings.settings.spawn)
self:loadSeqSettings(Settings.settings.seqbreaks, Settings.settings.dboosts)
self:loadMusicSettings(Settings.settings.musicShuffle, Settings.settings.musicBeta, Settings.settings.musicFlavor)
background = lg.newImage('assets/background.png')
self:draw()
@ -103,6 +104,14 @@ function C:loadSeqSettings(breaks, seq)
end
end
function C:loadMusicSettings(shuffle, beta, flavor)
settings.music.value = shuffle
music.beta.value = beta
if flavor == "Shuffle" then music.shuffle.value = true end
if flavor == "Random" then music.random.value = true end
if flavor == "Chaos" then music.random.value = true end
end
layout.version.text = 'Cave Story Randomizer [Open Mode] v' .. VERSION
layout.author.text = 'by shru and duncathan'
layout.twitter.text = '(@shruuu and @duncathan_salt)'

View file

@ -3,7 +3,7 @@ return { style = 'dialog',
{ style = 'dialogBody', padding = 24, flow = 'x',
{
{ type = 'label', text = 'Type of randomization' },
{ type = 'radio', group = 'music', text = 'Shuffle', id = 'shuffle', value = true, minheight = 27 },
{ type = 'radio', group = 'music', text = 'Shuffle', id = 'shuffle', minheight = 27 },
{ type = 'radio', group = 'music', text = 'Random', id = 'random', minheight = 27 },
{ type = 'radio', group = 'music', text = 'Chaos', id = 'chaos', minheight = 27 },
{ type = 'label', text = 'Other settings' },

View file

@ -16,17 +16,16 @@ return { style = 'dialog',
},
{ type = 'label', text = 'Randomization Options', minheight = 32 },
{ type = 'check', value = false, id = 'puppy', text = "Puppysanity", minheight = 27 },
{ flow = 'x',
{ flow = 'x', height = 32,
{ type = 'check', value = false, id = 'seqbreak', text = "Sequence breaks", minheight = 32, width = 170},
{ type = 'button', style = 'dialogButton', text = "Modify", id = 'seqButton', width = 70, align = 'center' },
{ width = false }
},
{ flow = 'x',
{ flow = 'x', height = 32,
{ type = 'check', value = false, id = 'music', text = "Randomize music", minheight = 32, width = 170},
{ type = 'button', style = 'dialogButton', text = "Modify", id = 'musicButton', width = 70, align = 'center' },
{ width = false }
},
{ height = 'auto' },
},
{
{ type = 'label', text = 'Objective', minheight = 32 },