adds completable logic to UI, adjusts settings UI

This commit is contained in:
duncathan 2021-07-26 20:32:39 -06:00
parent 5f9d957c9c
commit d576f7e275
6 changed files with 95 additions and 60 deletions

View File

@ -179,7 +179,9 @@ local cues = {
local music = Class:extend()
function music:new()
self.vanillaEnabled = true
self.betaEnabled = false
self.secretEnabled = false
self.songs = songs
self.cues = cues
self.flavor = "Shuffle"

View File

@ -429,13 +429,14 @@ function C:_updateSettings()
end
function C:_updateSharecode(seed)
local settings = 0 -- 0b00000000
local settings = 0 -- 0b0000000000000000
-- P: single bit used for puppysanity
-- O: three bits used for objective
-- S: three bits used for spawn location
-- B: single bit used for sequence breaks
-- F: single bit used for falling blocks in Hell
-- 0bFBSSSOOOP
-- C: single bit used for completeable logic
-- 0b000000CFBSSSOOOP
-- bitshift intervals
local obj = 1
@ -443,6 +444,7 @@ function C:_updateSharecode(seed)
local spn = 4
local brk = 7
local nfb = 8
local cpl = 9
if self.obj == "objBadEnd" then
settings = bit.bor(settings, bit.blshift(1, obj))
@ -479,6 +481,9 @@ function C:_updateSharecode(seed)
if self.worldGraph.noFallingBlocks then
settings = bit.bor(settings, bit.blshift(1, nfb))
end
if self.completableLogic then
settings = bit.bor(settings, bit.blshift(1, cpl))
end
if #seed < 20 then
seed = seed .. (" "):rep(20-#seed)

View File

@ -37,10 +37,12 @@ function C:getDefaults()
rocket = true
},
musicShuffle = false,
musicVanilla = true,
musicBeta = false,
musicSecret = false,
musicFlavor = "Shuffle",
noFallingBlocks = false,
completableLogic = true, --TODO: MAKE FALSE BY DEFAULT AFTER TESTING
completableLogic = false,
csversion = 0
}
end
@ -69,7 +71,9 @@ function C:serialize()
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 .. ("musicVanilla = %s,\r\n"):format(self.settings.musicVanilla)
line = line .. tab .. ("musicBeta = %s,\r\n"):format(self.settings.musicBeta)
line = line .. tab .. ("musicSecret = %s,\r\n"):format(self.settings.musicSecret)
line = line .. tab .. ("musicFlavor = %q,\r\n"):format(self.settings.musicFlavor)
line = line .. tab .. ("noFallingBlocks = %s,\r\n"):format(self.settings.noFallingBlocks)
line = line .. tab .. ("completableLogic = %s,\r\n"):format(self.settings.completableLogic)

View File

@ -28,8 +28,9 @@ 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)
self:loadMusicSettings(Settings.settings.musicShuffle, Settings.settings.musicFlavor, Settings.settings.musicVanilla, Settings.settings.musicBeta, Settings.settings.musicSecret)
self:loadNoFallingBlocks(Settings.settings.noFallingBlocks)
self:loadCompleteableLogic(Settings.settings.completableLogic)
background = lg.newImage('assets/background.png')
self:draw()
@ -86,28 +87,29 @@ function C:loadSeed(seed)
end
function C:loadMyChar(mychar)
local mc = music.mychar
if type(mychar) == "number" then
settings.mychar.index = mychar
mc.index = mychar
elseif mychar == "assets/myChar/Quote.bmp" then
settings.mychar.index = 1
mc.index = 1
elseif mychar == "assets/myChar/Curly.bmp" then
settings.mychar.index = 2
mc.index = 2
elseif mychar == "assets/myChar/Sue.bmp" then
settings.mychar.index = 3
mc.index = 3
elseif mychar == "assets/myChar/Toroko.bmp" then
settings.mychar.index = 4
mc.index = 4
elseif mychar == "assets/myChar/King.bmp" then
settings.mychar.index = 5
mc.index = 5
elseif mychar == "assets/myChar/Chaco.bmp" then
settings.mychar.index = 6
mc.index = 6
elseif mychar == "assets/myChar/Kanpachi.bmp" then
settings.mychar.index = 7
mc.index = 7
elseif mychar == "assets/myChar/Misery.bmp" then
settings.mychar.index = 8
mc.index = 8
elseif mychar == "assets/myChar/Frog.bmp" then
settings.mychar.index = 9
mc.index = 9
end
settings.mychar.value = "override"
mc.value = "override"
end
function C:loadSpawn(spawn)
@ -135,9 +137,11 @@ function C:loadSeqSettings(breaks, seq)
end
end
function C:loadMusicSettings(shuffle, beta, flavor)
settings.music.value = shuffle
function C:loadMusicSettings(shuffle, flavor, cs, beta, secret)
music.music.value = shuffle
music.cavestory.value = cs
music.beta.value = beta
--music.secret.value = secret
if flavor == "Shuffle" or flavor == 1 then
music.shuffle.value = true
music.random.value = false
@ -159,6 +163,10 @@ function C:loadNoFallingBlocks(noFallingBlocks)
settings.noFallingBlocks.value = noFallingBlocks
end
function C:loadCompleteableLogic(completableLogic)
settings.completable.value = not completableLogic
end
layout.version.text = 'Cave Story Randomizer v' .. VERSION
layout.author.text = 'by duncathan'
layout.twitter.text = '(@duncathan_salt)'
@ -178,14 +186,6 @@ end)
layout.footershru.text = 'Original randomizer by @shruuu'
music.panel.text = [[Shuffle: remap every song to a new song. For example, all instances of Mischievous Robot become Pulse. Songs may remap to themselves.
Random: remap every cue to a new song. For example, entering the Egg Corridor by any means plays Meltdown 2.
Chaos: remap every <CMU to a new song. For example, teleporting to the Egg Corridor plays Charge, but entering Egg Corridor from Cthulhu's Abode plays Run!
Beta music: include Wind Fortress, Halloween 2, People of the Root, Pier Walk, and Snoopy Cake in the potential songs. Only compatible with the included Doukutsu.exe - no other platforms.]]
layout.go:onPress(function()
Randomizer:new()
@ -196,7 +196,7 @@ layout.go:onPress(function()
Randomizer.obj = settings.objective.value
Randomizer.puppy = settings.puppy.value
Randomizer.mychar = settings.mychar.value
Randomizer.mychar = music.mychar.value
Randomizer.worldGraph.spawn = settings.spawn.value
Randomizer.worldGraph.seqbreak = settings.seqbreak.value
@ -209,13 +209,16 @@ layout.go:onPress(function()
Randomizer.worldGraph.dboosts.plantation.enabled = sequence.plantation.value
Randomizer.worldGraph.dboosts.rocket.enabled = sequence.rocket.value
Randomizer.shuffleMusic = settings.music.value
Randomizer.shuffleMusic = music.music.value
Randomizer.music.vanillaEnabled = music.cavestory.value
Randomizer.music.betaEnabled = music.beta.value
-- Randomizer.music.secretEnabled = music.secret.value
if music.shuffle.value then Randomizer.music.flavor = "Shuffle" end
if music.random.value then Randomizer.music.flavor = "Random" end
if music.chaos.value then Randomizer.music.flavor = "Chaos" end
Randomizer.worldGraph.noFallingBlocks = settings.noFallingBlocks.value
Randomizer.completableLogic = not settings.completable.value
C:setStatus(Randomizer:randomize())
@ -303,6 +306,7 @@ settings.importshare:onPress(function()
rocket = bit.band(seq, 128) ~= 0
})
Screen:loadNoFallingBlocks(bit.band(sharesettings, 256) ~= 0) -- (settings & 0b100000000)
Screen:loadCompleteableLogic(bit.band(sharesettings, 512) ~= 0) -- (settings & 0b1000000000)
else
settings.importshare.text = "Invalid Sharecode!"
end

View File

@ -1,25 +1,60 @@
return { style = 'dialog',
{ style = 'dialogHead', text = 'Music Settings' },
{ style = 'dialogHead', text = 'Personal Settings' },
{ style = 'dialogBody', padding = 24, flow = 'x',
{
{ type = 'check', value = false, id = 'music', text = "Randomize music", minheight = 32, width = 170},
{ type = 'label', text = 'Type of randomization' },
{ 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' },
{ type = 'check', id = 'beta', value = false, text = 'Enable beta music', minheight = 27 },
{ type = 'radio', group = 'flavor', text = 'Shuffle', id = 'shuffle', minheight = 27, status = "Remap every song to a new song. For example, all instances of Mischievous Robot become Pulse. Songs may remap to themselves." },
{ type = 'radio', group = 'flavor', text = 'Random', id = 'random', minheight = 27, status = "Remap every cue to a new song. For example, entering the Egg Corridor by any means plays Meltdown 2." },
{ type = 'radio', group = 'flavor', text = 'Chaos', id = 'chaos', minheight = 27, status = "Remap every <CMU to a new song. For example, teleporting to the Egg Corridor plays Charge, but entering Egg Corridor from Cthulhu's Abode plays Run!" },
{ type = 'label', text = 'Enabled music' },
--[[ individual toggles is a lot of work actually
{ type = 'panel', id = 'musicToggles', scroll = true,
{ type = 'check', id = 'mischievousRobot', value = true, text = 'Mischievous Robot', minheight = 27},
{ type = 'check', id = 'safety', value = true, text = 'Safety', minheight = 27},
{ type = 'check', id = 'gravity', value = true, text = 'Gravity', minheight = 27},
{ type = 'check', id = 'onToGrasstown', value = true, text = 'On to Grasstown', minheight = 27},
{ type = 'check', id = 'meltdown', value = true, text = 'Meltdown 2', minheight = 27},
{ type = 'check', id = 'eyesOfFlame', value = true, text = 'Eyes of Flame', minheight = 27},
{ type = 'check', id = 'gestation', value = true, text = 'Gestation', minheight = 27},
{ type = 'check', id = 'mimigaTown', value = true, text = 'Mimiga Town', minheight = 27},
{ type = 'check', id = 'balrogsTheme', value = true, text = "Balrog's Theme", minheight = 27},
{ type = 'check', id = 'cemetary', value = true, text = 'Cemetary', minheight = 27},
{ type = 'check', id = 'plant', value = true, text = 'Plant', minheight = 27},
{ type = 'check', id = 'pulse', value = true, text = 'Pulse', minheight = 27},
{ type = 'check', id = 'tyrant', value = true, text = 'Tyrant', minheight = 27},
{ type = 'check', id = 'run', value = true, text = 'Run!', minheight = 27},
{ type = 'check', id = 'jenka1', value = true, text = 'Jenka 1', minheight = 27},
{ type = 'check', id = 'labyrinthFight', value = true, text = 'Labyrinth Fight', minheight = 27},
{ type = 'check', id = 'access', value = true, text = 'Access', minheight = 27},
{ type = 'check', id = 'oppression', value = true, text = 'Oppression', minheight = 27},
{ type = 'check', id = 'geothermal', value = true, text = 'Geothermal', minheight = 27},
{ type = 'check', id = 'caveStory', value = true, text = 'Cave Story', minheight = 27},
{ type = 'check', id = 'moonsong', value = true, text = 'Moonsong', minheight = 27},
}
]]
{ type = 'check', id = 'cavestory', value = true, text = 'Enable Cave Story music', minheight = 27 },
{ type = 'check', id = 'beta', value = false, text = 'Enable beta music', minheight = 27, status = "Only compatible with the included Doukutsu.exe - no other platforms." },
--{ type = 'check', id = 'secret', value = false, text = 'Enable [redacted] music', minheight = 27, status = "Only compatible with the included Doukutsu.exe - no other platforms." },
},
{ type = 'sash' },
{
{
align = 'top center',
wrap = true,
id = 'panel',
width = 275,
scroll = true
width = 275,
{ type = 'label', text = 'Player Sprite', minheight = 32 },
{ type = 'stepper', id = 'mychar', align = 'middle left', height = 48, width = 200,
{ text = " Quote", value = "assets/myChar/Quote.bmp", icon = "assets/icon/Quote.png" },
{ text = " Curly", value = "assets/myChar/Curly.bmp", icon = "assets/icon/Curly.png" },
{ text = " Sue", value = "assets/myChar/Sue.bmp", icon = "assets/icon/Sue.png" },
{ text = " Toroko", value = "assets/myChar/Toroko.bmp", icon = "assets/icon/Toroko.png" },
{ text = " King", value = "assets/myChar/King.bmp", icon = "assets/icon/King.png" },
{ text = " Chaco", value = "assets/myChar/Chaco.bmp", icon = "assets/icon/Chaco.png" },
{ text = " Kanpachi", value = "assets/myChar/Kanpachi.bmp", icon = "assets/icon/Kanpachi.png" },
{ text = " Misery", value = "assets/myChar/Misery.bmp", icon = "assets/icon/Misery.png" },
{ text = " Frog", value = "assets/myChar/Frog.bmp", icon = "assets/icon/Frog.png" }
},
{ height = 10 },
{ type = 'label', text = '[scroll for more]', align = 'center', width = 275, minheight = 27 }
}
{ type = 'sash' },
{ type = 'status', wrap = true, height = false, },
},
},
{ style = 'dialogFoot',
{},

View File

@ -16,16 +16,12 @@ return { style = 'dialog',
},
{ type = 'label', text = 'Randomization Options', minheight = 32 },
{ type = 'check', value = false, id = 'puppy', text = "Puppies outside Sand Zone", minheight = 27 },
{ type = 'check', value = true, id = 'completable', text = "Guarantee access to all locations", minheight = 54},
{ 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', 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 }
},
},
{
{ type = 'label', text = 'Objective', minheight = 32 },
@ -36,25 +32,14 @@ return { style = 'dialog',
{ text = "All bosses", value = "objAllBosses" },
{ text = "100%", value = "obj100Percent" }
},
{ type = 'label', text = 'Player Sprite', minheight = 32 },
{ type = 'stepper', id = 'mychar', align = 'middle left', height = 48, width = 200,
{ text = " Quote", value = "assets/myChar/Quote.bmp", icon = "assets/icon/Quote.png" },
{ text = " Curly", value = "assets/myChar/Curly.bmp", icon = "assets/icon/Curly.png" },
{ text = " Sue", value = "assets/myChar/Sue.bmp", icon = "assets/icon/Sue.png" },
{ text = " Toroko", value = "assets/myChar/Toroko.bmp", icon = "assets/icon/Toroko.png" },
{ text = " King", value = "assets/myChar/King.bmp", icon = "assets/icon/King.png" },
{ text = " Chaco", value = "assets/myChar/Chaco.bmp", icon = "assets/icon/Chaco.png" },
{ text = " Kanpachi", value = "assets/myChar/Kanpachi.bmp", icon = "assets/icon/Kanpachi.png" },
{ text = " Misery", value = "assets/myChar/Misery.bmp", icon = "assets/icon/Misery.png" },
{ text = " Frog", value = "assets/myChar/Frog.bmp", icon = "assets/icon/Frog.png" }
},
{ type = 'label', text = 'Spawn Location', minheight = 32 },
{ type = 'stepper', id = 'spawn', align = 'middle left', height = 48, width = 200,
{ text = " Start\r\n Point", value = "Start Point", icon = "assets/icon/StartPoint2.png" },
{ text = " Arthur's\r\n House", value = "Arthur's House", icon = "assets/icon/Arthur2.png" },
{ text = " Camp", value = "Camp", icon = "assets/icon/Camp.png" }
},
{ type = 'check', value = false, id = 'noFallingBlocks', text = "No Falling Blocks in Hell", minheight = 27 }
{ type = 'button', style = 'dialogButton', text = "Personal Settings", id = 'musicButton', width = 200, height = 48, align = 'center' },
{ type = 'check', value = false, id = 'noFallingBlocks', text = "No Falling Blocks in Hell", minheight = 32 },
},
},
{