Merge pull request #77 from duncathan/mychars

adds 6 new mychars to choose from!
This commit is contained in:
duncathan salt 2020-02-28 08:29:51 -06:00 committed by GitHub
commit a8eb4e12ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 65 additions and 38 deletions

BIN
src/assets/icon/Curly.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
src/assets/icon/Frog.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

BIN
src/assets/icon/King.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
src/assets/icon/Quote.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
src/assets/icon/Sue.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

BIN
src/assets/icon/Toroko.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

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

@ -102,5 +102,11 @@ Contains the index in `items` of the item being displayed.
if self.flow == 'x' then increment() else decrement() end
end)
self:onChange(function (event)
if self.value == "override" then
updateValue()
end
end)
updateValue()
end

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,43 +12,49 @@ 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
settings.bad.value = true
settings.norm.value = false
settings.boss.value = false
settings.best.value = false
settings.objective.index = 1
elseif obj == "objNormalEnd" or obj == 2 then
settings.bad.value = false
settings.norm.value = true
settings.boss.value = false
settings.best.value = false
settings.objective.index = 2
elseif obj == "objAllBosses" or obj == 3 then
settings.bad.value = false
settings.norm.value = false
settings.boss.value = true
settings.best.value = false
settings.objective.index = 4
else
settings.bad.value = false
settings.norm.value = false
settings.boss.value = false
settings.best.value = true
settings.objective.index = 3
end
settings.objective.value = "override"
if seed ~= nil then
settings.customseed.value = seed or ""
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
@ -65,17 +71,10 @@ layout.go:onPress(function()
Randomizer.customseed = settings.customseed.value:gsub("^%s*(.-)%s*$", "%1") -- trim any leading/trailing whitespace
end
if settings.bad.value then
Randomizer.obj = "objBadEnd"
elseif settings.norm.value then
Randomizer.obj = "objNormalEnd"
elseif settings.boss.value then
Randomizer.obj = "objAllBosses"
else
Randomizer.obj = "objBestEnd"
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

@ -14,16 +14,28 @@ return { style = 'dialog',
},
{
{ type = 'label', text = 'Objective', minheight = 32 },
{ type = 'radio', group = 'objective', text = 'Bad ending', id = 'bad', minheight = 27 },
{ type = 'radio', group = 'objective', text = 'Normal ending', id = 'norm', minheight = 27 },
{ type = 'radio', group = 'objective', text = 'Best ending', id = 'best', value = true, minheight = 27 },
{ type = 'radio', group = 'objective', text = 'All bosses', id = 'boss', minheight = 27 },
{ type = 'stepper', id = 'objective', align = 'center', width = 200,
{ text = "Bad ending", value = "objBadEnd" },
{ text = "Normal ending", value = "objNormalEnd" },
{ text = "Best ending", value = "objBestEnd" },
{ text = "All bosses", value = "objAllBosses"}
},
{ 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 = " Kanpachi", value = "assets/myChar/Kanpachi.bmp", icon = "assets/icon/Kanpachi.png" },
{ text = " Frog", value = "assets/myChar/Frog.bmp", icon = "assets/icon/Frog.png" }
}
},
},
{
flow = 'x',
{ type = 'text', id = 'sharecode', width = 350 },
{ type = 'button', style = 'dialogButton', text = "Import Sharecode", id = 'importshare', width = 180 }
{ type = 'button', style = 'dialogButton', text = "Import Sharecode", id = 'importshare', width = 180, align = 'center' }
}
},
{ style = 'dialogFoot',