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 = {
-- W1.1 Pirate Panic
"PiratePanic.lsmv",
"PiratePanicDitch.lsmv",
"PiratePanicKremcoin.lsmv",
"PiratePanic.lsmv", -- [1]
"PiratePanicDitch.lsmv", -- [2]
"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.
@ -37,7 +40,7 @@ _M.StartPowerup = 0
_M.NeatConfig = {
DisableSound = false,
Threads = 7,
Threads = 1,
--Filename = "DP1.state",
SaveFile = _M.Filename .. ".pool",

View file

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

View file

@ -576,7 +576,7 @@ local function mainLoop(_M, genome)
end
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))
if exitDist < areaInfo.shortest then
areaInfo.shortest = exitDist
@ -762,7 +762,7 @@ local function saveLoadInput(_M)
_M.saveLoadFile = config.NeatConfig.SaveFile
return
end
if helddown == nil then
if _M.helddown == nil then
local mapping = {
backslash = "\\",
colon = ":",
@ -800,7 +800,7 @@ local function saveLoadInput(_M)
end
if k == "back" then
config.NeatConfig.SaveFile = config.NeatConfig.SaveFile:sub(1, #config.NeatConfig.SaveFile-1)
helddown = k
_M.helddown = k
goto continue
end
local m = k
@ -811,11 +811,11 @@ local function saveLoadInput(_M)
goto continue
end
config.NeatConfig.SaveFile = config.NeatConfig.SaveFile..m
helddown = k
_M.helddown = k
::continue::
end
elseif helddown ~= nil and inputs[helddown]["value"] ~= 1 then
helddown = nil
elseif _M.helddown ~= nil and inputs[_M.helddown]["value"] ~= 1 then
_M.helddown = nil
end
end