adds working mychar selection!

This commit is contained in:
duncathan 2020-02-28 07:48:45 -06:00
parent ff6701d60c
commit e8a8abbecd
11 changed files with 43 additions and 15 deletions

BIN
src/assets/myChar/Curly.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
src/assets/myChar/Frog.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
src/assets/myChar/King.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
src/assets/myChar/Quote.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

BIN
src/assets/myChar/Sue.bmp Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.4 KiB

View file

@ -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

View file

@ -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

View file

@ -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"

View file

@ -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" }
}
},
},