mirror of
https://github.com/cave-story-randomizer/cave-story-randomizer
synced 2024-12-22 21:26:45 +00:00
Generate correct folder structure for Cave Story+.
This commit is contained in:
parent
7decb15fb2
commit
43b22b315a
|
@ -4,7 +4,6 @@ Cave Story Randomizer
|
||||||
Todo
|
Todo
|
||||||
----
|
----
|
||||||
|
|
||||||
- Generate correct directory structure for Cave Story+.
|
|
||||||
- Remove Love files... lovec.exe, readme, etc.
|
- Remove Love files... lovec.exe, readme, etc.
|
||||||
- Trade Sequence Step B: Require random obtainable weapon, instead of always polar star and fireball.
|
- Trade Sequence Step B: Require random obtainable weapon, instead of always polar star and fireball.
|
||||||
- Randomize Booster v0.8 / v2.0
|
- Randomize Booster v0.8 / v2.0
|
||||||
|
|
|
@ -72,6 +72,7 @@ function item(t)
|
||||||
table.insert(getText, ".....") -- Chako's Rouge
|
table.insert(getText, ".....") -- Chako's Rouge
|
||||||
-- Cave Story+
|
-- Cave Story+
|
||||||
table.insert(getText, ("Found %s.<NOD"):format(name)) -- Curly's Panties
|
table.insert(getText, ("Found %s.<NOD"):format(name)) -- Curly's Panties
|
||||||
|
table.insert(getText, ("Obtained a %s.<WAI0160<NOD"):format(name)) -- Life Po
|
||||||
table.insert(getText, ("Obtained the %s.<WAI0160<NOD"):format(name)) -- Clay Figure Medal
|
table.insert(getText, ("Obtained the %s.<WAI0160<NOD"):format(name)) -- Clay Figure Medal
|
||||||
end
|
end
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -38,7 +38,7 @@ function resetLog()
|
||||||
end
|
end
|
||||||
resetLog()
|
resetLog()
|
||||||
|
|
||||||
local randomizer = require 'randomizer'()
|
local Randomizer = require 'randomizer'
|
||||||
local background
|
local background
|
||||||
local font
|
local font
|
||||||
local screen
|
local screen
|
||||||
|
@ -54,6 +54,7 @@ function love.load()
|
||||||
end
|
end
|
||||||
|
|
||||||
function love.directorydropped(path)
|
function love.directorydropped(path)
|
||||||
|
local randomizer = Randomizer()
|
||||||
status = randomizer:randomize(path)
|
status = randomizer:randomize(path)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -20,6 +20,10 @@ local WEAPONS_WHICH_CAN_NOT_BREAK_BLOCKS = {
|
||||||
'wSnake',
|
'wSnake',
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function C:new()
|
||||||
|
self._isCaveStoryPlus = false
|
||||||
|
end
|
||||||
|
|
||||||
function C:randomize(path)
|
function C:randomize(path)
|
||||||
resetLog()
|
resetLog()
|
||||||
logNotice('=== Cave Story Randomizer v' .. VERSION .. ' ===')
|
logNotice('=== Cave Story Randomizer v' .. VERSION .. ' ===')
|
||||||
|
@ -57,6 +61,7 @@ function C:_mountDirectory(path)
|
||||||
local containsBase = _.contains(items, 'base')
|
local containsBase = _.contains(items, 'base')
|
||||||
if containsBase then
|
if containsBase then
|
||||||
dirStage = dirStage .. '/base'
|
dirStage = dirStage .. '/base'
|
||||||
|
self._isCaveStoryPlus = true
|
||||||
end
|
end
|
||||||
|
|
||||||
local items = lf.getDirectoryItems(dirStage)
|
local items = lf.getDirectoryItems(dirStage)
|
||||||
|
@ -147,33 +152,49 @@ function C:_shuffleItems(tscFiles)
|
||||||
end
|
end
|
||||||
|
|
||||||
function C:_writeModifiedData(tscFiles)
|
function C:_writeModifiedData(tscFiles)
|
||||||
local sourcePath = lf.getSourceBaseDirectory()
|
local basePath = self:_getWritePathStage()
|
||||||
|
|
||||||
-- Create /data/Stage if it doesn't already exist.
|
|
||||||
local command = ('mkdir "%s"'):format(sourcePath .. '/data/Stage')
|
|
||||||
os.execute(command) -- HERE BE DRAGONS!!!
|
|
||||||
|
|
||||||
-- Write modified files.
|
|
||||||
for filename, tscFile in pairs(tscFiles) do
|
for filename, tscFile in pairs(tscFiles) do
|
||||||
local path = sourcePath .. '/data/Stage/' .. filename
|
local path = basePath .. '/' .. filename
|
||||||
tscFile:writeTo(path)
|
tscFile:writeTo(path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function C:_copyModifiedFirstCave()
|
function C:_copyModifiedFirstCave()
|
||||||
local cavePxmPath = lf.getSourceBaseDirectory() .. '/data/Stage/Cave.pxm'
|
local cavePxmPath = self:_getWritePathStage() .. '/Cave.pxm'
|
||||||
local data = lf.read('database/Cave.pxm')
|
local data = lf.read('database/Cave.pxm')
|
||||||
assert(data)
|
assert(data)
|
||||||
U.writeFile(cavePxmPath, data)
|
U.writeFile(cavePxmPath, data)
|
||||||
end
|
end
|
||||||
|
|
||||||
function C:_writeLog()
|
function C:_writeLog()
|
||||||
local path = lf.getSourceBaseDirectory() .. '/data/log.txt'
|
local path = self:_getWritePath() .. '/log.txt'
|
||||||
local data = getLogText()
|
local data = getLogText()
|
||||||
U.writeFile(path, data)
|
U.writeFile(path, data)
|
||||||
print("\n")
|
print("\n")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function C:_getWritePath()
|
||||||
|
return select(1, self:_getWritePaths())
|
||||||
|
end
|
||||||
|
|
||||||
|
function C:_getWritePathStage()
|
||||||
|
return select(2, self:_getWritePaths())
|
||||||
|
end
|
||||||
|
|
||||||
|
function C:_getWritePaths()
|
||||||
|
if self._writePath == nil then
|
||||||
|
local sourcePath = lf.getSourceBaseDirectory()
|
||||||
|
self._writePath = sourcePath .. '/data'
|
||||||
|
self._writePathStage = (self._isCaveStoryPlus)
|
||||||
|
and (self._writePath .. '/base/Stage')
|
||||||
|
or (self._writePath .. '/Stage')
|
||||||
|
-- Create /data(/base)/Stage if it doesn't already exist.
|
||||||
|
local command = ('mkdir "%s"'):format(self._writePathStage)
|
||||||
|
os.execute(command) -- HERE BE DRAGONS!!!
|
||||||
|
end
|
||||||
|
return self._writePath, self._writePathStage
|
||||||
|
end
|
||||||
|
|
||||||
function C:_unmountDirectory(path)
|
function C:_unmountDirectory(path)
|
||||||
assert(lf.unmount(path))
|
assert(lf.unmount(path))
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue