mirror of
https://github.com/cave-story-randomizer/cave-story-randomizer
synced 2024-11-12 18:02:52 +00:00
adds ui for music settings
This commit is contained in:
parent
46eb8dc016
commit
4426eb69ec
|
@ -178,6 +178,7 @@ function music:new()
|
||||||
self.betaEnabled = false
|
self.betaEnabled = false
|
||||||
self.songs = songs
|
self.songs = songs
|
||||||
self.cues = cues
|
self.cues = cues
|
||||||
|
self.flavor = "Shuffle"
|
||||||
end
|
end
|
||||||
|
|
||||||
local _isValid = function(key, song, self)
|
local _isValid = function(key, song, self)
|
||||||
|
@ -192,8 +193,14 @@ function music:getCues()
|
||||||
return self.cues
|
return self.cues
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function music:shuffleMusic(tscFiles)
|
||||||
|
if self.flavor == "Shuffle" then self:_shuffle(tscFiles) end
|
||||||
|
if self.flavor == "Random" then self:_random(tscFiles) end
|
||||||
|
if self.flavor == "Chaos" then self:_chaos(tscFiles) end
|
||||||
|
end
|
||||||
|
|
||||||
-- SHUFFLE songs: every cue with a given song becomes the same, new song
|
-- SHUFFLE songs: every cue with a given song becomes the same, new song
|
||||||
function music:shuffle(tscFiles)
|
function music:_shuffle(tscFiles)
|
||||||
local shuffled = self:getShuffledSongs()
|
local shuffled = self:getShuffledSongs()
|
||||||
|
|
||||||
local idmap = _.map(self.songs, function (k,v)
|
local idmap = _.map(self.songs, function (k,v)
|
||||||
|
@ -209,13 +216,22 @@ function music:shuffle(tscFiles)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- RANDOMIZE songs: any cue can play any song
|
-- RANDOMIZE songs: any cue can play any song
|
||||||
function music:randomize(tscFiles)
|
function music:_random(tscFiles)
|
||||||
for k,cue in pairs(self.cues) do
|
for k,cue in pairs(self.cues) do
|
||||||
cue.songid = self:getShuffledSongs()[1].id
|
cue.songid = self:getShuffledSongs()[1].id
|
||||||
end
|
end
|
||||||
self:writeCues(tscFiles)
|
self:writeCues(tscFiles)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- CHAOTICALLY RANDOMIZE songs: nearly any <CMU can play any song
|
||||||
|
function music:_chaos(tscFiles)
|
||||||
|
for k,cue in pairs(self.cues) do
|
||||||
|
for k,event in ipairs(cue.events) do
|
||||||
|
tscFiles[cue.map]:placeSongAtCue(self:getShuffledSongs()[1].id, event, cue.map, cue.default)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
function music:writeCues(tscFiles)
|
function music:writeCues(tscFiles)
|
||||||
for k,cue in pairs(self.cues) do
|
for k,cue in pairs(self.cues) do
|
||||||
for k,event in ipairs(cue.events) do
|
for k,event in ipairs(cue.events) do
|
||||||
|
|
|
@ -46,6 +46,7 @@ function C:new()
|
||||||
self.obj = ""
|
self.obj = ""
|
||||||
self.sharecode = ""
|
self.sharecode = ""
|
||||||
self.mychar = ""
|
self.mychar = ""
|
||||||
|
self.shuffleMusic = false
|
||||||
end
|
end
|
||||||
|
|
||||||
function C:setPath(path)
|
function C:setPath(path)
|
||||||
|
@ -70,9 +71,9 @@ function C:randomize()
|
||||||
self:_updateSharecode(seed)
|
self:_updateSharecode(seed)
|
||||||
|
|
||||||
local tscFiles = self:_createTscFiles(dirStage)
|
local tscFiles = self:_createTscFiles(dirStage)
|
||||||
|
|
||||||
self:_shuffleItems(tscFiles)
|
self:_shuffleItems(tscFiles)
|
||||||
self.music:randomize(tscFiles)
|
if self.shuffleMusic then self.music:shuffleMusic(tscFiles) end
|
||||||
|
|
||||||
self:_writeModifiedData(tscFiles)
|
self:_writeModifiedData(tscFiles)
|
||||||
self:_writePlaintext(tscFiles)
|
self:_writePlaintext(tscFiles)
|
||||||
|
|
|
@ -7,6 +7,7 @@ local C = Class:extend()
|
||||||
local layout = Luigi(require 'ui.main')
|
local layout = Luigi(require 'ui.main')
|
||||||
local settings = Luigi(require 'ui.settings')
|
local settings = Luigi(require 'ui.settings')
|
||||||
local sequence = Luigi(require 'ui.sequence')
|
local sequence = Luigi(require 'ui.sequence')
|
||||||
|
local music = Luigi(require 'ui.music')
|
||||||
|
|
||||||
local style = require 'ui.style'
|
local style = require 'ui.style'
|
||||||
local theme = require 'lib.luigi.theme.dark'
|
local theme = require 'lib.luigi.theme.dark'
|
||||||
|
@ -14,10 +15,12 @@ local theme = require 'lib.luigi.theme.dark'
|
||||||
layout:setStyle(style)
|
layout:setStyle(style)
|
||||||
settings:setStyle(style)
|
settings:setStyle(style)
|
||||||
sequence:setStyle(style)
|
sequence:setStyle(style)
|
||||||
|
music:setStyle(style)
|
||||||
|
|
||||||
layout:setTheme(theme)
|
layout:setTheme(theme)
|
||||||
settings:setTheme(theme)
|
settings:setTheme(theme)
|
||||||
sequence:setTheme(theme)
|
sequence:setTheme(theme)
|
||||||
|
music:setTheme(theme)
|
||||||
|
|
||||||
function C:setup()
|
function C:setup()
|
||||||
self:loadPuppy(Settings.settings.puppy)
|
self:loadPuppy(Settings.settings.puppy)
|
||||||
|
@ -106,6 +109,14 @@ layout.twitter.text = '(@shruuu and @duncathan_salt)'
|
||||||
|
|
||||||
layout.footer.text = 'Original randomizer:\r\nshru.itch.io/cave-story-randomizer'
|
layout.footer.text = 'Original randomizer:\r\nshru.itch.io/cave-story-randomizer'
|
||||||
|
|
||||||
|
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()
|
layout.go:onPress(function()
|
||||||
Randomizer:new()
|
Randomizer:new()
|
||||||
|
|
||||||
|
@ -129,6 +140,12 @@ layout.go:onPress(function()
|
||||||
Randomizer.worldGraph.dboosts.plantation.enabled = sequence.plantation.value
|
Randomizer.worldGraph.dboosts.plantation.enabled = sequence.plantation.value
|
||||||
Randomizer.worldGraph.dboosts.rocket.enabled = sequence.rocket.value
|
Randomizer.worldGraph.dboosts.rocket.enabled = sequence.rocket.value
|
||||||
|
|
||||||
|
Randomizer.shuffleMusic = settings.music.value
|
||||||
|
Randomizer.music.betaEnabled = music.beta.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
|
||||||
|
|
||||||
C:setStatus(Randomizer:randomize())
|
C:setStatus(Randomizer:randomize())
|
||||||
|
|
||||||
layout.sharecode.text = "Copy Sharecode"
|
layout.sharecode.text = "Copy Sharecode"
|
||||||
|
@ -153,6 +170,11 @@ settings.seqButton:onPress(function()
|
||||||
settings:hide()
|
settings:hide()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
settings.musicButton:onPress(function()
|
||||||
|
music:show()
|
||||||
|
settings:hide()
|
||||||
|
end)
|
||||||
|
|
||||||
sequence.allOn:onPress(function()
|
sequence.allOn:onPress(function()
|
||||||
Screen:loadSeqSettings(nil, _.map(Settings.settings.dboosts, function(k,v) return true end))
|
Screen:loadSeqSettings(nil, _.map(Settings.settings.dboosts, function(k,v) return true end))
|
||||||
end)
|
end)
|
||||||
|
@ -166,6 +188,11 @@ sequence.close:onPress(function()
|
||||||
settings:show()
|
settings:show()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
|
music.close:onPress(function()
|
||||||
|
music:hide()
|
||||||
|
settings:show()
|
||||||
|
end)
|
||||||
|
|
||||||
layout.sharecode:onPress(function()
|
layout.sharecode:onPress(function()
|
||||||
if Randomizer.sharecode ~= "" then
|
if Randomizer.sharecode ~= "" then
|
||||||
love.system.setClipboardText(Randomizer.sharecode)
|
love.system.setClipboardText(Randomizer.sharecode)
|
||||||
|
|
28
src/ui/music.lua
Normal file
28
src/ui/music.lua
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
return { style = 'dialog',
|
||||||
|
{ style = 'dialogHead', text = 'Music Settings' },
|
||||||
|
{ 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 = '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 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
{
|
||||||
|
align = 'top center',
|
||||||
|
wrap = true,
|
||||||
|
id = 'panel',
|
||||||
|
width = 275,
|
||||||
|
scroll = true
|
||||||
|
},
|
||||||
|
{ height = 10 },
|
||||||
|
{ type = 'label', text = '[scroll for more]', align = 'center', width = 275, minheight = 27 }
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ style = 'dialogFoot',
|
||||||
|
{},
|
||||||
|
{ style = 'dialogButton', id = 'close', text = 'Close' }
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,6 +21,11 @@ return { style = 'dialog',
|
||||||
{ type = 'button', style = 'dialogButton', text = "Modify", id = 'seqButton', width = 70, align = 'center' },
|
{ type = 'button', style = 'dialogButton', text = "Modify", id = 'seqButton', width = 70, align = 'center' },
|
||||||
{ width = false }
|
{ width = false }
|
||||||
},
|
},
|
||||||
|
{ flow = 'x',
|
||||||
|
{ 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' },
|
{ height = 'auto' },
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue