mirror of
https://github.com/cave-story-randomizer/cave-story-randomizer
synced 2025-03-22 01:49:20 +00:00
adds options for random and custom mychars
This commit is contained in:
parent
bbfa4e5661
commit
d76b811fda
BIN
src/assets/icon/Custom.png
Normal file
BIN
src/assets/icon/Custom.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 227 B |
BIN
src/assets/icon/Random.png
Normal file
BIN
src/assets/icon/Random.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 195 B |
|
@ -349,8 +349,12 @@ end
|
||||||
|
|
||||||
function C:_copyMyChar()
|
function C:_copyMyChar()
|
||||||
local path = self:_getWritePath() .. '/MyChar.bmp'
|
local path = self:_getWritePath() .. '/MyChar.bmp'
|
||||||
|
if self.mychar then
|
||||||
local data = lf.read(self.mychar)
|
local data = lf.read(self.mychar)
|
||||||
U.writeFile(path, data)
|
U.writeFile(path, data)
|
||||||
|
else
|
||||||
|
U.eraseFile(path)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function C:_generateHash()
|
function C:_generateHash()
|
||||||
|
|
|
@ -112,6 +112,21 @@ function C:loadMyChar(mychar)
|
||||||
mc.value = "override"
|
mc.value = "override"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function C.numToMyChar(num)
|
||||||
|
local mychars = {
|
||||||
|
"assets/myChar/Quote.bmp",
|
||||||
|
"assets/myChar/Curly.bmp",
|
||||||
|
"assets/myChar/Sue.bmp",
|
||||||
|
"assets/myChar/Toroko.bmp",
|
||||||
|
"assets/myChar/King.bmp",
|
||||||
|
"assets/myChar/Chaco.bmp",
|
||||||
|
"assets/myChar/Kanpachi.bmp",
|
||||||
|
"assets/myChar/Misery.bmp",
|
||||||
|
"assets/myChar/Frog.bmp",
|
||||||
|
}
|
||||||
|
return mychars[num]
|
||||||
|
end
|
||||||
|
|
||||||
function C:loadSpawn(spawn)
|
function C:loadSpawn(spawn)
|
||||||
if spawn == "Start Point" or spawn == 0 then
|
if spawn == "Start Point" or spawn == 0 then
|
||||||
settings.spawn.index = 1
|
settings.spawn.index = 1
|
||||||
|
@ -196,7 +211,11 @@ layout.go:onPress(function()
|
||||||
|
|
||||||
Randomizer.obj = settings.objective.value
|
Randomizer.obj = settings.objective.value
|
||||||
Randomizer.puppy = settings.puppy.value
|
Randomizer.puppy = settings.puppy.value
|
||||||
|
if music.mychar.value == "random" then
|
||||||
|
Randomizer.mychar = Screen.numToMyChar(love.math.random(9))
|
||||||
|
else
|
||||||
Randomizer.mychar = music.mychar.value
|
Randomizer.mychar = music.mychar.value
|
||||||
|
end
|
||||||
Randomizer.worldGraph.spawn = settings.spawn.value
|
Randomizer.worldGraph.spawn = settings.spawn.value
|
||||||
|
|
||||||
Randomizer.worldGraph.seqbreak = settings.seqbreak.value
|
Randomizer.worldGraph.seqbreak = settings.seqbreak.value
|
||||||
|
|
|
@ -50,7 +50,9 @@ return { style = 'dialog',
|
||||||
{ text = " Chaco", value = "assets/myChar/Chaco.bmp", icon = "assets/icon/Chaco.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 = " Kanpachi", value = "assets/myChar/Kanpachi.bmp", icon = "assets/icon/Kanpachi.png" },
|
||||||
{ text = " Misery", value = "assets/myChar/Misery.bmp", icon = "assets/icon/Misery.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" }
|
{ text = " Frog", value = "assets/myChar/Frog.bmp", icon = "assets/icon/Frog.png" },
|
||||||
|
{ text = " Random", value = "random", icon = "assets/icon/Random.png", status = "Choose a random sprite each time you randomize." },
|
||||||
|
{ text = " Custom", value = false, icon = "assets/icon/Custom.png", status = "Use your own mychar.bmp! Place it in the main data folder." },
|
||||||
},
|
},
|
||||||
{ type = 'sash' },
|
{ type = 'sash' },
|
||||||
{ type = 'status', wrap = true, height = false, },
|
{ type = 'status', wrap = true, height = false, },
|
||||||
|
|
10
src/util.lua
10
src/util.lua
|
@ -15,4 +15,14 @@ function U.writeFile(path, data)
|
||||||
file:close()
|
file:close()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function U.eraseFile(path)
|
||||||
|
logDebug('erasing file: ' .. path)
|
||||||
|
|
||||||
|
local file, err = io.open(path, 'r')
|
||||||
|
if file ~= nil then
|
||||||
|
io.close(file)
|
||||||
|
os.remove(path)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
return U
|
return U
|
||||||
|
|
Loading…
Reference in a new issue