add option to remove falling blocks in Hell B2

thank god
This commit is contained in:
HapaxL 2020-07-16 22:39:32 +02:00
parent 2c5ad7dafb
commit 900992db5f
6 changed files with 30 additions and 8 deletions

Binary file not shown.

View file

@ -510,6 +510,8 @@ function worldGraph:new(items)
} }
self.hintregion = hintRegion(self) self.hintregion = hintRegion(self)
self.noFallingBlocks = false
end end
function worldGraph:_dboost(items, key) function worldGraph:_dboost(items, key)

View file

@ -169,6 +169,7 @@ function C:_shuffleItems(tscFiles)
obj.name = obj.name .. (", %s"):format(self.worldGraph.spawn) obj.name = obj.name .. (", %s"):format(self.worldGraph.spawn)
obj.script = obj.script .. self.worldGraph:getSpawnScript() obj.script = obj.script .. self.worldGraph:getSpawnScript()
if self.worldGraph.seqbreak and self.worldGraph.dboosts.rocket.enabled then obj.script = "<FL+6400" .. obj.script end if self.worldGraph.seqbreak and self.worldGraph.dboosts.rocket.enabled then obj.script = "<FL+6400" .. obj.script end
if self.worldGraph.noFallingBlocks then obj.script = "<FL+1351" .. obj.script end
-- place the objective scripts in Start Point -- place the objective scripts in Start Point
self:_fastFillItems({obj}, self.worldGraph:getObjectiveSpot()) self:_fastFillItems({obj}, self.worldGraph:getObjectiveSpot())
@ -349,6 +350,7 @@ function C:_updateSettings()
Settings.settings.musicShuffle = self.shuffleMusic Settings.settings.musicShuffle = self.shuffleMusic
Settings.settings.musicBeta = self.music.betaEnabled Settings.settings.musicBeta = self.music.betaEnabled
Settings.settings.musicFlavor = self.music.flavor Settings.settings.musicFlavor = self.music.flavor
Settings.settings.noFallingBlocks = self.worldGraph.noFallingBlocks
Settings:update() Settings:update()
end end
@ -358,13 +360,15 @@ function C:_updateSharecode(seed)
-- O: three bits used for objective -- O: three bits used for objective
-- S: three bits used for spawn location -- S: three bits used for spawn location
-- B: single bit used for sequence breaks -- B: single bit used for sequence breaks
-- 0bBSSSOOOP -- F: single bit used for falling blocks in Hell
-- 0bFBSSSOOOP
-- bitshift intervals -- bitshift intervals
local obj = 1 local obj = 1
local pup = 0 local pup = 0
local spn = 4 local spn = 4
local brk = 7 local brk = 7
local nfb = 8
if self.obj == "objBadEnd" then if self.obj == "objBadEnd" then
settings = bit.bor(settings, bit.blshift(1, obj)) settings = bit.bor(settings, bit.blshift(1, obj))
@ -398,11 +402,15 @@ function C:_updateSharecode(seed)
if self.worldGraph.dboosts.rocket.enabled then seq = bit.bor(seq, 128) end if self.worldGraph.dboosts.rocket.enabled then seq = bit.bor(seq, 128) end
end end
if self.worldGraph.noFallingBlocks then
settings = bit.bor(settings, bit.blshift(1, nfb))
end
if #seed < 20 then if #seed < 20 then
seed = seed .. (" "):rep(20-#seed) seed = seed .. (" "):rep(20-#seed)
end end
local packed = love.data.pack("data", "<s1BB", seed, settings, seq) local packed = love.data.pack("data", "<s1I2B", seed, settings, seq)
self.sharecode = love.data.encode("string", "base64", packed) self.sharecode = love.data.encode("string", "base64", packed)
logNotice(("Sharecode: %s"):format(self.sharecode)) logNotice(("Sharecode: %s"):format(self.sharecode))

View file

@ -39,6 +39,7 @@ function C:getDefaults()
musicShuffle = false, musicShuffle = false,
musicBeta = false, musicBeta = false,
musicFlavor = "Shuffle", musicFlavor = "Shuffle",
noFallingBlocks = false,
csversion = 0 csversion = 0
} }
end end
@ -69,6 +70,7 @@ function C:serialize()
line = line .. tab .. ("musicShuffle = %s,\r\n"):format(self.settings.musicShuffle) line = line .. tab .. ("musicShuffle = %s,\r\n"):format(self.settings.musicShuffle)
line = line .. tab .. ("musicBeta = %s,\r\n"):format(self.settings.musicBeta) line = line .. tab .. ("musicBeta = %s,\r\n"):format(self.settings.musicBeta)
line = line .. tab .. ("musicFlavor = %q,\r\n"):format(self.settings.musicFlavor) line = line .. tab .. ("musicFlavor = %q,\r\n"):format(self.settings.musicFlavor)
line = line .. tab .. ("noFallingBlocks = %s,\r\n"):format(self.settings.noFallingBlocks)
line = line .. tab .. ("csversion = %s,\r\n"):format(self.settings.csversion) line = line .. tab .. ("csversion = %s,\r\n"):format(self.settings.csversion)
return line .. "}" return line .. "}"

View file

@ -29,6 +29,7 @@ function C:setup()
self:loadSpawn(Settings.settings.spawn) self:loadSpawn(Settings.settings.spawn)
self:loadSeqSettings(Settings.settings.seqbreaks, Settings.settings.dboosts) self:loadSeqSettings(Settings.settings.seqbreaks, Settings.settings.dboosts)
self:loadMusicSettings(Settings.settings.musicShuffle, Settings.settings.musicBeta, Settings.settings.musicFlavor) self:loadMusicSettings(Settings.settings.musicShuffle, Settings.settings.musicBeta, Settings.settings.musicFlavor)
self:loadNoFallingBlocks(Settings.settings.noFallingBlocks)
background = lg.newImage('assets/background.png') background = lg.newImage('assets/background.png')
self:draw() self:draw()
@ -54,6 +55,7 @@ settings.randoButton:onPress(function()
rocket = fifty() rocket = fifty()
}) })
Screen:loadMusicSettings(fifty(), fifty(), love.math.random(3)) Screen:loadMusicSettings(fifty(), fifty(), love.math.random(3))
Screen:loadNoFallingBlocks(fifty())
end) end)
function C:loadPuppy(puppy) function C:loadPuppy(puppy)
@ -151,6 +153,10 @@ function C:loadMusicSettings(shuffle, beta, flavor)
end end
end end
function C:loadNoFallingBlocks(noFallingBlocks)
settings.noFallingBlocks.value = noFallingBlocks
end
layout.version.text = 'Cave Story Randomizer v' .. VERSION layout.version.text = 'Cave Story Randomizer v' .. VERSION
layout.author.text = 'by duncathan' layout.author.text = 'by duncathan'
layout.twitter.text = '(@duncathan_salt)' layout.twitter.text = '(@duncathan_salt)'
@ -207,6 +213,8 @@ layout.go:onPress(function()
if music.random.value then Randomizer.music.flavor = "Random" end if music.random.value then Randomizer.music.flavor = "Random" end
if music.chaos.value then Randomizer.music.flavor = "Chaos" end if music.chaos.value then Randomizer.music.flavor = "Chaos" end
Randomizer.worldGraph.noFallingBlocks = settings.noFallingBlocks.value
C:setStatus(Randomizer:randomize()) C:setStatus(Randomizer:randomize())
layout.sharecode.text = "Copy Sharecode" layout.sharecode.text = "Copy Sharecode"
@ -271,18 +279,18 @@ end)
settings.importshare:onPress(function() settings.importshare:onPress(function()
local success, seed, sharesettings, seq = pcall(function() local success, seed, sharesettings, seq = pcall(function()
local packed = love.data.decode("data", "base64", settings.sharecode.value) local packed = love.data.decode("data", "base64", settings.sharecode.value)
local seed, settings, seq = love.data.unpack("<s1BB", packed) local seed, settings, seq = love.data.unpack("<s1I2B", packed)
assert(#seed == 20) assert(#seed == 20)
return seed, settings, seq return seed, settings, seq
end) end)
if success then if success then
settings.importshare.text = "Sharecode Imported" settings.importshare.text = "Sharecode Imported"
Screen:loadPuppy(bit.band(sharesettings, 1) ~= 0) -- settings & 0b00000001 Screen:loadPuppy(bit.band(sharesettings, 1) ~= 0) -- settings & 0b000000001
Screen:loadObjective(bit.brshift(bit.band(sharesettings, 14), 1)) -- (settings & 0b00001110) >> 1 Screen:loadObjective(bit.brshift(bit.band(sharesettings, 14), 1)) -- (settings & 0b000001110) >> 1
Screen:loadSpawn(bit.brshift(bit.band(sharesettings, 112), 4)) -- (settings & 0b01110000) >> 4 Screen:loadSpawn(bit.brshift(bit.band(sharesettings, 112), 4)) -- (settings & 0b001110000) >> 4
Screen:loadSeed(seed:gsub("^%s*(.-)%s*$", "%1")) -- trim any leading or trailing whitespace Screen:loadSeed(seed:gsub("^%s*(.-)%s*$", "%1")) -- trim any leading or trailing whitespace
Screen:loadSeqSettings(bit.band(sharesettings, 128) ~= 0, { -- (settings & 0b10000000) Screen:loadSeqSettings(bit.band(sharesettings, 128) ~= 0, { -- (settings & 0b010000000)
cthulhu = bit.band(seq, 1) ~= 0, cthulhu = bit.band(seq, 1) ~= 0,
chaco = bit.band(seq, 2) ~= 0, chaco = bit.band(seq, 2) ~= 0,
paxChaco = bit.band(seq, 4) ~= 0, paxChaco = bit.band(seq, 4) ~= 0,
@ -292,6 +300,7 @@ settings.importshare:onPress(function()
plantation = bit.band(seq, 64) ~= 0, plantation = bit.band(seq, 64) ~= 0,
rocket = bit.band(seq, 128) ~= 0 rocket = bit.band(seq, 128) ~= 0
}) })
Screen:loadNoFallingBlocks(bit.band(sharesettings, 256) ~= 0) -- (settings & 0b100000000)
else else
settings.importshare.text = "Invalid Sharecode!" settings.importshare.text = "Invalid Sharecode!"
end end

View file

@ -52,7 +52,8 @@ return { style = 'dialog',
{ text = " Start\r\n Point", value = "Start Point", icon = "assets/icon/StartPoint2.png" }, { text = " Start\r\n Point", value = "Start Point", icon = "assets/icon/StartPoint2.png" },
{ text = " Arthur's\r\n House", value = "Arthur's House", icon = "assets/icon/Arthur2.png" }, { text = " Arthur's\r\n House", value = "Arthur's House", icon = "assets/icon/Arthur2.png" },
{ text = " Camp", value = "Camp", icon = "assets/icon/Camp.png" } { text = " Camp", value = "Camp", icon = "assets/icon/Camp.png" }
} },
{ type = 'check', value = false, id = 'noFallingBlocks', text = "No Falling Blocks in Hell", minheight = 27 }
}, },
}, },
{ {