Don't kill the run on the bonus intro screen
This commit is contained in:
parent
0a59ab8b21
commit
1c1307a0e2
4 changed files with 26 additions and 23 deletions
|
@ -24,9 +24,10 @@ _M.State = {
|
||||||
|
|
||||||
-- W1.2 Mainbrace Mayhem
|
-- W1.2 Mainbrace Mayhem
|
||||||
"MainbraceMayhem.lsmv", -- [4]
|
"MainbraceMayhem.lsmv", -- [4]
|
||||||
|
"MainbraceMayhemBonus.lsmv", -- [5]
|
||||||
}
|
}
|
||||||
|
|
||||||
_M.Filename = _M.PoolDir .. _M.State[4]
|
_M.Filename = _M.PoolDir .. _M.State[1]
|
||||||
|
|
||||||
--[[
|
--[[
|
||||||
Start game with specific powerup.
|
Start game with specific powerup.
|
||||||
|
|
11
game.lua
11
game.lua
|
@ -615,6 +615,17 @@ local function processMapLoad()
|
||||||
areaLoadedQueue = {} -- We clear this because it doesn't make any sense after the map screen loads
|
areaLoadedQueue = {} -- We clear this because it doesn't make any sense after the map screen loads
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function _M.bonusScreenDisplayed(inputs)
|
||||||
|
local count = 0
|
||||||
|
for i=1,#inputs,1 do
|
||||||
|
if inputs[i] ~= 0 then
|
||||||
|
count = count + 1
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return count < 10
|
||||||
|
end
|
||||||
|
|
||||||
local handlers = {}
|
local handlers = {}
|
||||||
local function registerHandler(space, regname, addr, callback)
|
local function registerHandler(space, regname, addr, callback)
|
||||||
table.insert(handlers, {
|
table.insert(handlers, {
|
||||||
|
|
27
runner.lua
27
runner.lua
|
@ -331,7 +331,6 @@ local function evaluateNetwork(_M, network, inputs, inputDeltas)
|
||||||
return {}
|
return {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
for i=1,Inputs do
|
for i=1,Inputs do
|
||||||
network.neurons[i].value = inputs[i] * inputDeltas[i]
|
network.neurons[i].value = inputs[i] * inputDeltas[i]
|
||||||
end
|
end
|
||||||
|
@ -382,12 +381,9 @@ end
|
||||||
local frame = 0
|
local frame = 0
|
||||||
local lastFrame = 0
|
local lastFrame = 0
|
||||||
|
|
||||||
local function evaluateCurrent(_M)
|
local function evaluateCurrent(_M, inputs, inputDeltas)
|
||||||
local genome = _M.currentSpecies.genomes[_M.currentGenomeIndex]
|
local genome = _M.currentSpecies.genomes[_M.currentGenomeIndex]
|
||||||
|
|
||||||
local inputDeltas = {}
|
|
||||||
local inputs, inputDeltas = game.getInputs()
|
|
||||||
|
|
||||||
controller = evaluateNetwork(_M, genome.network, inputs, inputDeltas)
|
controller = evaluateNetwork(_M, genome.network, inputs, inputDeltas)
|
||||||
|
|
||||||
if controller[6] and controller[7] then
|
if controller[6] and controller[7] then
|
||||||
|
@ -506,7 +502,9 @@ local function initializeRun(_M)
|
||||||
|
|
||||||
local genome = _M.currentSpecies.genomes[_M.currentGenomeIndex]
|
local genome = _M.currentSpecies.genomes[_M.currentGenomeIndex]
|
||||||
generateNetwork(genome)
|
generateNetwork(genome)
|
||||||
evaluateCurrent(_M)
|
|
||||||
|
local inputs, inputDeltas = game.getInputs()
|
||||||
|
evaluateCurrent(_M, inputs, inputDeltas)
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -524,6 +522,7 @@ local function mainLoop(_M, genome)
|
||||||
if nextArea ~= _M.lastArea then
|
if nextArea ~= _M.lastArea then
|
||||||
_M.lastArea = nextArea
|
_M.lastArea = nextArea
|
||||||
game.onceAreaLoaded(function()
|
game.onceAreaLoaded(function()
|
||||||
|
message(_M, 'Loaded area '..nextArea)
|
||||||
_M.timeout = _M.timeout + 60 * 5
|
_M.timeout = _M.timeout + 60 * 5
|
||||||
_M.currentArea = nextArea
|
_M.currentArea = nextArea
|
||||||
_M.lastArea = _M.currentArea
|
_M.lastArea = _M.currentArea
|
||||||
|
@ -555,10 +554,6 @@ local function mainLoop(_M, genome)
|
||||||
displayGenome(genome)
|
displayGenome(genome)
|
||||||
end
|
end
|
||||||
|
|
||||||
if _M.currentFrame%5 == 0 then
|
|
||||||
evaluateCurrent(_M)
|
|
||||||
end
|
|
||||||
|
|
||||||
game.getPositions()
|
game.getPositions()
|
||||||
local timeoutConst = 0
|
local timeoutConst = 0
|
||||||
if game.vertical then
|
if game.vertical then
|
||||||
|
@ -567,13 +562,13 @@ local function mainLoop(_M, genome)
|
||||||
timeoutConst = config.NeatConfig.TimeoutConstant
|
timeoutConst = config.NeatConfig.TimeoutConstant
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Don't punish being launched by barrels
|
if _M.currentFrame%5 == 0 then
|
||||||
-- FIXME Will this skew mine cart levels?
|
local inputs, inputDeltas = game.getInputs()
|
||||||
if game.getVelocityY() < -2104 then
|
if game.bonusScreenDisplayed(inputs) and _M.timeout < timeoutConst then
|
||||||
message(_M, "BARREL! ".._M.drawFrame, 0x00ffff00)
|
_M.timeout = timeoutConst
|
||||||
if _M.timeout < timeoutConst + 60 * 12 then
|
|
||||||
_M.timeout = _M.timeout + 60 * 12
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
evaluateCurrent(_M, inputs, inputDeltas)
|
||||||
end
|
end
|
||||||
|
|
||||||
local areaInfo = _M.areaInfo[_M.currentArea]
|
local areaInfo = _M.areaInfo[_M.currentArea]
|
||||||
|
|
|
@ -15,6 +15,8 @@ local config = dofile(base.."/config.lua")
|
||||||
spritelist.InitSpriteList()
|
spritelist.InitSpriteList()
|
||||||
spritelist.InitExtSpriteList()
|
spritelist.InitExtSpriteList()
|
||||||
|
|
||||||
|
game.registerHandlers()
|
||||||
|
|
||||||
local CAMERA_MODE = 0x7e054f
|
local CAMERA_MODE = 0x7e054f
|
||||||
local DIDDY_X_VELOCITY = 0x7e0e02
|
local DIDDY_X_VELOCITY = 0x7e0e02
|
||||||
local DIDDY_Y_VELOCITY = 0x7e0e06
|
local DIDDY_Y_VELOCITY = 0x7e0e06
|
||||||
|
@ -437,12 +439,6 @@ input.keyhook("0", true)
|
||||||
|
|
||||||
set_timer_timeout(100 * 1000)
|
set_timer_timeout(100 * 1000)
|
||||||
|
|
||||||
for i=0,22,1 do
|
|
||||||
memory2.BUS:registerwrite(mem.addr.spriteBase + mem.size.sprite * i + mem.offset.sprite.x, function(addr, val)
|
|
||||||
print(memory.getregister('pc'))
|
|
||||||
end)
|
|
||||||
end
|
|
||||||
|
|
||||||
-- fe0a58 crate: near bunch and klomp on barrels
|
-- fe0a58 crate: near bunch and klomp on barrels
|
||||||
-- fe0a58: Crate X position
|
-- fe0a58: Crate X position
|
||||||
-- fe0a60: Crate Y position
|
-- fe0a60: Crate Y position
|
||||||
|
|
Loading…
Add table
Reference in a new issue