Ignore when the party x or y values are zero. This is likely wrong.

This commit is contained in:
Empathic Qubit 2021-05-03 04:39:15 -04:00
parent 52bdebfc81
commit 317578611d
3 changed files with 16 additions and 12 deletions

View file

@ -18,12 +18,15 @@ _M.ROM = _M.ScriptDir .. "/rom.sfc"
--]] --]]
_M.State = { _M.State = {
-- W1.1 Pirate Panic -- W1.1 Pirate Panic
"PiratePanic.lsmv", "PiratePanic.lsmv", -- [1]
"PiratePanicDitch.lsmv", "PiratePanicDitch.lsmv", -- [2]
"PiratePanicKremcoin.lsmv", "PiratePanicKremcoin.lsmv", --[3]
-- W1.2 Mainbrace Mayhem
"MainbraceMayhem.lsmv", -- [4]
} }
_M.Filename = _M.PoolDir .. _M.State[1] _M.Filename = _M.PoolDir .. _M.State[4]
--[[ --[[
Start game with specific powerup. Start game with specific powerup.
@ -37,7 +40,7 @@ _M.StartPowerup = 0
_M.NeatConfig = { _M.NeatConfig = {
DisableSound = false, DisableSound = false,
Threads = 7, Threads = 1,
--Filename = "DP1.state", --Filename = "DP1.state",
SaveFile = _M.Filename .. ".pool", SaveFile = _M.Filename .. ".pool",

View file

@ -584,6 +584,7 @@ local function processMapLoad()
for i=#mapLoadedQueue,1,-1 do for i=#mapLoadedQueue,1,-1 do
table.remove(mapLoadedQueue, i)() table.remove(mapLoadedQueue, i)()
end end
areaLoadedQueue = {} -- We clear this because it doesn't make any sense after the map screen loads
end end
local handlers = {} local handlers = {}
@ -622,7 +623,7 @@ function _M.registerHandlers()
setRewindHandler = callback.register('set_rewind', processSetRewind) setRewindHandler = callback.register('set_rewind', processSetRewind)
rewindHandler = callback.register('post_rewind', processRewind) rewindHandler = callback.register('post_rewind', processRewind)
registerHandler(memory2.BUS, 'registerwrite', 0xb517b2, processAreaLoad) registerHandler(memory2.BUS, 'registerwrite', 0xb517b2, processAreaLoad)
registerHandler(memory2.WRAM, 'registerread', 0x06b1, processMapLoad) registerHandler(memory2.WRAM, 'registerwrite', 0x069b, processMapLoad)
for i=2,22,1 do for i=2,22,1 do
registerHandler(memory2.WRAM, 'registerwrite', bit.band(mem.addr.spriteBase + mem.size.sprite * i, 0xffff), processEmptyHit) registerHandler(memory2.WRAM, 'registerwrite', bit.band(mem.addr.spriteBase + mem.size.sprite * i, 0xffff), processEmptyHit)
end end

View file

@ -576,7 +576,7 @@ local function mainLoop(_M, genome)
end end
local areaInfo = _M.areaInfo[_M.currentArea] local areaInfo = _M.areaInfo[_M.currentArea]
if areaInfo ~= nil then if areaInfo ~= nil and game.partyY ~= 0 and game.partyX ~= 0 then
local exitDist = math.floor(math.sqrt((areaInfo.preferredExit.y - game.partyY) ^ 2 + (areaInfo.preferredExit.x - game.partyX) ^ 2)) local exitDist = math.floor(math.sqrt((areaInfo.preferredExit.y - game.partyY) ^ 2 + (areaInfo.preferredExit.x - game.partyX) ^ 2))
if exitDist < areaInfo.shortest then if exitDist < areaInfo.shortest then
areaInfo.shortest = exitDist areaInfo.shortest = exitDist
@ -762,7 +762,7 @@ local function saveLoadInput(_M)
_M.saveLoadFile = config.NeatConfig.SaveFile _M.saveLoadFile = config.NeatConfig.SaveFile
return return
end end
if helddown == nil then if _M.helddown == nil then
local mapping = { local mapping = {
backslash = "\\", backslash = "\\",
colon = ":", colon = ":",
@ -800,7 +800,7 @@ local function saveLoadInput(_M)
end end
if k == "back" then if k == "back" then
config.NeatConfig.SaveFile = config.NeatConfig.SaveFile:sub(1, #config.NeatConfig.SaveFile-1) config.NeatConfig.SaveFile = config.NeatConfig.SaveFile:sub(1, #config.NeatConfig.SaveFile-1)
helddown = k _M.helddown = k
goto continue goto continue
end end
local m = k local m = k
@ -811,11 +811,11 @@ local function saveLoadInput(_M)
goto continue goto continue
end end
config.NeatConfig.SaveFile = config.NeatConfig.SaveFile..m config.NeatConfig.SaveFile = config.NeatConfig.SaveFile..m
helddown = k _M.helddown = k
::continue:: ::continue::
end end
elseif helddown ~= nil and inputs[helddown]["value"] ~= 1 then elseif _M.helddown ~= nil and inputs[_M.helddown]["value"] ~= 1 then
helddown = nil _M.helddown = nil
end end
end end