diff --git a/.gitignore b/.gitignore index a3cf145..e119654 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,5 @@ notes/* src/assets/pre-edited-cs/window\.rect src/assets/pre-edited-cs/Profile\.dat + +src/assets/pre-edited-cs/Doukutsu\.exe\.blbkp diff --git a/src/main.lua b/src/main.lua index c166667..6dfdb27 100644 --- a/src/main.lua +++ b/src/main.lua @@ -1,6 +1,6 @@ require 'lib.strict' -VERSION = '0.6' +VERSION = '0.8' Class = require 'lib.classic' _ = require 'lib.moses' @@ -76,8 +76,8 @@ end local function _draw() lg.draw(background, 0, 0) - _print('Cave Story Randomizer v' .. VERSION, 0, 10) - _print('by shru', 0, 22) + _print('Cave Story Randomizer [Open Mode] v' .. VERSION, 0, 10) + _print('by shru and duncathan', 0, 22) _print(status, 10, 65) _print('shru.itch.io', 10, 220, 'left') _print('@shruuu', 10, 220, 'right') diff --git a/src/randomizer.lua b/src/randomizer.lua index 1d27e6d..ac6a2a8 100644 --- a/src/randomizer.lua +++ b/src/randomizer.lua @@ -105,22 +105,32 @@ function C:_shuffleItems(tscFiles) -- first, place puppies in the sand zone for i=1, 5 do - local puppy = itemDeck:getAnyByAttributes({"puppy"}) + local puppy = itemDeck:placeAnyByAttributes({"puppy"}) local puppySpot = worldGraph:getAnyByRegion({"lowerSandZone", "upperSandZone"}) placeItem(puppySpot, puppy) end -- next, place weapon at hermit gunsmith and random item in first cave - placeItem(worldGraph:get("gunsmithChest"), itemDeck:getAnyByAttributes({"weaponSN"})) - placeItem(worldGraph:get("firstCapsule"), itemDeck:getAny()) + placeItem(worldGraph:get("gunsmithChest"), itemDeck:placeAnyByAttributes({"weaponSN"})) + placeItem(worldGraph:get("firstCapsule"), itemDeck:placeAny()) -- for now, just implementing a forward fill - will do a better fill later while itemDeck:remaining() > 0 do local location = worldGraph:getAnyAccessible(itemDeck:getPlacedItems()) - local item = itemDeck:getAny() + local item, itemIndex - tscFiles[location.map]:placeItem(location.event, item.script) + while ~location do + item, itemIndex = itemDeck:getAnyByAttributes({"progression"}) + location = worldGraph:getAnyAccessible(itemDeck:getPlacedItems(item)) + end + + if ~item then + item, itemIndex = itemDeck:getAny() + end + itemDeck:place(item, itemIndex) + + tscFiles[location.map]:placeItem(location.event, itemData.item.script) end end