From 317578611dba85d1cf0de5e80ebd22e0145f0c10 Mon Sep 17 00:00:00 2001 From: empathicqubit Date: Mon, 3 May 2021 04:39:15 -0400 Subject: [PATCH] Ignore when the party x or y values are zero. This is likely wrong. --- config.lua | 13 ++++++++----- game.lua | 3 ++- runner.lua | 12 ++++++------ 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/config.lua b/config.lua index 2b49a6c..89246a7 100644 --- a/config.lua +++ b/config.lua @@ -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", diff --git a/game.lua b/game.lua index 0f06dc4..c78a9fb 100644 --- a/game.lua +++ b/game.lua @@ -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 diff --git a/runner.lua b/runner.lua index 4034ad5..4ea3d87 100644 --- a/runner.lua +++ b/runner.lua @@ -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