adds a button to randomize settings

This commit is contained in:
duncathan 2020-03-06 00:45:06 -06:00
parent 69d9afdd5e
commit 16f1172afc
2 changed files with 41 additions and 5 deletions

View file

@ -35,6 +35,27 @@ function C:setup()
layout:show() layout:show()
end end
settings.randoButton:onPress(function()
local function fifty() return love.math.random(2) == 2 end
Screen:loadPuppy(fifty())
Screen:loadObjective(love.math.random(4)-1)
settings.seedselect.value = false
settings.seedrandom.value = true
Screen:loadMyChar(love.math.random(7))
Screen:loadSpawn(love.math.random(3)-1)
Screen:loadSeqSettings(fifty(), {
cthulhu = fifty(),
chaco = fifty(),
paxChaco = fifty(),
flightlessHut = fifty(),
camp = fifty(),
sisters = fifty(),
plantation = fifty(),
rocket = fifty()
})
Screen:loadMusicSettings(fifty(), fifty(), love.math.random(3))
end)
function C:loadPuppy(puppy) function C:loadPuppy(puppy)
settings.puppy.value = puppy settings.puppy.value = puppy
end end
@ -61,7 +82,9 @@ function C:loadSeed(seed)
end end
function C:loadMyChar(mychar) function C:loadMyChar(mychar)
if mychar == "assets/myChar/Quote.bmp" then if type(mychar) == "number" then
settings.mychar.index = mychar
elseif mychar == "assets/myChar/Quote.bmp" then
settings.mychar.index = 1 settings.mychar.index = 1
elseif mychar == "assets/myChar/Curly.bmp" then elseif mychar == "assets/myChar/Curly.bmp" then
settings.mychar.index = 2 settings.mychar.index = 2
@ -91,7 +114,7 @@ function C:loadSpawn(spawn)
end end
function C:loadSeqSettings(breaks, seq) function C:loadSeqSettings(breaks, seq)
if breaks then settings.seqbreak.value = breaks end if breaks ~= nil then settings.seqbreak.value = breaks end
if breaks or breaks == nil then if breaks or breaks == nil then
sequence.cthulhu.value = seq.cthulhu sequence.cthulhu.value = seq.cthulhu
sequence.chaco.value = seq.chaco sequence.chaco.value = seq.chaco
@ -107,9 +130,21 @@ end
function C:loadMusicSettings(shuffle, beta, flavor) function C:loadMusicSettings(shuffle, beta, flavor)
settings.music.value = shuffle settings.music.value = shuffle
music.beta.value = beta music.beta.value = beta
if flavor == "Shuffle" then music.shuffle.value = true end if flavor == "Shuffle" or flavor == 1 then
if flavor == "Random" then music.random.value = true end music.shuffle.value = true
if flavor == "Chaos" then music.random.value = true end music.random.value = false
music.chaos.value = false
end
if flavor == "Random" or flavor == 2 then
music.shuffle.value = false
music.random.value = true
music.chaos.value = false
end
if flavor == "Chaos" or flavor == 3 then
music.shuffle.value = false
music.random.value = false
music.chaos.value = true
end
end end
layout.version.text = 'Cave Story Randomizer v' .. VERSION layout.version.text = 'Cave Story Randomizer v' .. VERSION

View file

@ -61,6 +61,7 @@ return { style = 'dialog',
}, },
{ style = 'dialogFoot', { style = 'dialogFoot',
{}, {},
{ style = 'dialogButton', id = 'randoButton', text = 'Random Settings', width = 120 },
{ style = 'dialogButton', id = 'closeButton', text = 'Close' } { style = 'dialogButton', id = 'closeButton', text = 'Close' }
} }
} }