diff --git a/src/assets/myChar/Curly.bmp b/src/assets/myChar/Curly.bmp new file mode 100644 index 0000000..842ee0e Binary files /dev/null and b/src/assets/myChar/Curly.bmp differ diff --git a/src/assets/myChar/Frog.bmp b/src/assets/myChar/Frog.bmp new file mode 100644 index 0000000..b3900af Binary files /dev/null and b/src/assets/myChar/Frog.bmp differ diff --git a/src/assets/myChar/Kanpachi.bmp b/src/assets/myChar/Kanpachi.bmp new file mode 100644 index 0000000..8421ef7 Binary files /dev/null and b/src/assets/myChar/Kanpachi.bmp differ diff --git a/src/assets/myChar/King.bmp b/src/assets/myChar/King.bmp new file mode 100644 index 0000000..8c8949f Binary files /dev/null and b/src/assets/myChar/King.bmp differ diff --git a/src/assets/myChar/Quote.bmp b/src/assets/myChar/Quote.bmp new file mode 100644 index 0000000..691694c Binary files /dev/null and b/src/assets/myChar/Quote.bmp differ diff --git a/src/assets/myChar/Sue.bmp b/src/assets/myChar/Sue.bmp new file mode 100644 index 0000000..d78a675 Binary files /dev/null and b/src/assets/myChar/Sue.bmp differ diff --git a/src/assets/myChar/Toroko.bmp b/src/assets/myChar/Toroko.bmp new file mode 100644 index 0000000..4a6b9bf Binary files /dev/null and b/src/assets/myChar/Toroko.bmp differ diff --git a/src/randomizer.lua b/src/randomizer.lua index 3ae5727..bf7aa4f 100644 --- a/src/randomizer.lua +++ b/src/randomizer.lua @@ -36,6 +36,7 @@ function C:new() self.puppy = false self.obj = "" self.sharecode = "" + self.mychar = "" end function C:setPath(path) @@ -65,6 +66,7 @@ function C:randomize() self:_writeModifiedData(tscFiles) self:_writePlaintext(tscFiles) self:_writeLog() + self:_copyMyChar() self:_unmountDirectory(csdirectory) self:_updateSettings() @@ -235,6 +237,12 @@ function C:_writeLog() U.writeFile(path, data) end +function C:_copyMyChar() + local path = self:_getWritePath() .. '/myChar.bmp' + local data = lf.read(self.mychar) + U.writeFile(path, data) +end + function C:_getWritePath() return select(1, self:_getWritePaths()) end @@ -277,6 +285,7 @@ end function C:_updateSettings() Settings.settings.puppy = self.puppy Settings.settings.obj = self.obj + Settings.settings.mychar = self.mychar Settings:update() end diff --git a/src/settings.lua b/src/settings.lua index 80a6ae2..971995c 100644 --- a/src/settings.lua +++ b/src/settings.lua @@ -20,13 +20,14 @@ function C:update() end function C:serialize() - local line = "return {" + 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 = \"%s\",\r\n"):format(self.settings.obj) + 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) + line = line .. ("mychar = %q,\r\n "):format(self.settings.mychar) - line = line .. "}" + line = line .. "\r\n}" return line end diff --git a/src/ui/draw.lua b/src/ui/draw.lua index b5910af..cb0e964 100644 --- a/src/ui/draw.lua +++ b/src/ui/draw.lua @@ -12,14 +12,14 @@ layout:setTheme(require 'lib.luigi.theme.dark') settings:setTheme(require 'lib.luigi.theme.dark') function C:setup() - self:loadSettings(Settings.settings.puppy, Settings.settings.obj) + self:loadSettings(Settings.settings.puppy, Settings.settings.obj, nil, Settings.settings.mychar) background = lg.newImage('assets/background.png') self:draw() layout:show() end -function C:loadSettings(puppy, obj, seed) +function C:loadSettings(puppy, obj, seed, mychar) settings.puppy.value = puppy if obj == "objBadEnd" or obj == 1 then @@ -38,6 +38,23 @@ function C:loadSettings(puppy, obj, seed) settings.seedselect.value = true settings.seedrandom.value = false end + + if mychar == "assets/myChar/Quote.bmp" then + settings.mychar.index = 1 + elseif mychar == "assets/myChar/Curly.bmp" then + settings.mychar.index = 2 + elseif mychar == "assets/myChar/Sue.bmp" then + settings.mychar.index = 3 + elseif mychar == "assets/myChar/Toroko.bmp" then + settings.mychar.index = 4 + elseif mychar == "assets/myChar/King.bmp" then + settings.mychar.index = 5 + elseif mychar == "assets/myChar/Kanpachi.bmp" then + settings.mychar.index = 6 + elseif mychar == "assets/myChar/Frog.bmp" then + settings.mychar.index = 7 + end + settings.mychar.value = "override" end layout.version.text = 'Cave Story Randomizer [Open Mode] v' .. VERSION @@ -55,8 +72,9 @@ layout.go:onPress(function() end Randomizer.obj = settings.objective.value - Randomizer.puppy = settings.puppy.value + Randomizer.mychar = settings.mychar.value + C:setStatus(Randomizer:randomize()) layout.sharecode.text = "Copy Sharecode" diff --git a/src/ui/settings.lua b/src/ui/settings.lua index 9182a0a..bd5d9d7 100644 --- a/src/ui/settings.lua +++ b/src/ui/settings.lua @@ -22,13 +22,13 @@ return { style = 'dialog', }, { type = 'label', text = 'Player Sprite', minheight = 32 }, { type = 'stepper', id = 'mychar', align = 'middle left', height = 48, width = 200, - { text = " Quote", value = "Quote.bmp", icon = "assets/icon/Quote.png" }, - { text = " Curly", value = "Curly.bmp", icon = "assets/icon/Curly.png" }, - { text = " Sue", value = "Sue.bmp", icon = "assets/icon/Sue.png" }, - { text = " Toroko", value = "Toroko.bmp", icon = "assets/icon/Toroko.png" }, - { text = " King", value = "King.bmp", icon = "assets/icon/King.png" }, - { text = " Kanpachi", value = "Kanpachi.bmp", icon = "assets/icon/Kanpachi.png" }, - { text = " Frog", value = "Frog.bmp", icon = "assets/icon/Frog.png" } + { 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 = " Kanpachi", value = "assets/myChar/Kanpachi.bmp", icon = "assets/icon/Kanpachi.png" }, + { text = " Frog", value = "assets/myChar/Frog.bmp", icon = "assets/icon/Frog.png" } } }, },