Add climbing. Fix sprite list regression
This commit is contained in:
parent
123d7508d1
commit
1cd3618b6f
6 changed files with 27 additions and 9 deletions
|
@ -39,7 +39,7 @@ _M.Filename = _M.PoolDir .. _M.State[4]
|
|||
_M.StartPowerup = 0
|
||||
|
||||
_M.NeatConfig = {
|
||||
DisableSound = false,
|
||||
DisableSound = true,
|
||||
Threads = 7,
|
||||
--Filename = "DP1.state",
|
||||
SaveFile = _M.Filename .. ".pool",
|
||||
|
|
17
game.lua
17
game.lua
|
@ -396,6 +396,7 @@ function _M.getSprite(idx)
|
|||
style = util.regionToWord(spriteData, offsets.style),
|
||||
velocityX = util.regionToWord(spriteData, offsets.velocityX),
|
||||
velocityY = util.regionToWord(spriteData, offsets.velocityY),
|
||||
motion = util.regionToWord(spriteData, offsets.motion),
|
||||
x = x,
|
||||
y = y,
|
||||
good = spritelist.Sprites[control]
|
||||
|
@ -523,10 +524,26 @@ function _M.getInputs()
|
|||
end
|
||||
end
|
||||
end
|
||||
|
||||
-- XXX Will this work? Stay tuned
|
||||
if _M.getClimbing() then
|
||||
table.insert(inputs, 1)
|
||||
else
|
||||
table.insert(inputs, 0)
|
||||
end
|
||||
table.insert(inputDeltaDistance, 99)
|
||||
|
||||
return inputs, inputDeltaDistance
|
||||
end
|
||||
|
||||
function _M.getClimbing()
|
||||
local sprite = _M.getSprite(_M.leader)
|
||||
if sprite == nil then
|
||||
return false
|
||||
end
|
||||
return sprite.motion >= 0x35 and sprite.motion <= 0x39
|
||||
end
|
||||
|
||||
function _M.clearJoypad()
|
||||
for b = 1,#config.ButtonNames do
|
||||
input.set(0, b - 1, 0)
|
||||
|
|
1
mem.lua
1
mem.lua
|
@ -48,6 +48,7 @@ local _M = {
|
|||
style = 0x12,
|
||||
velocityX = 0x20,
|
||||
velocityY = 0x24,
|
||||
motion = 0x2e,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@ local game = nil
|
|||
local mathFunctions = dofile(base.."/mathFunctions.lua")
|
||||
local util = dofile(base.."/util.lua")()
|
||||
|
||||
local Inputs = config.InputSize+1
|
||||
local Inputs = config.InputSize+2
|
||||
local Outputs = #config.ButtonNames
|
||||
|
||||
local guiWidth = 0
|
||||
|
@ -471,7 +471,7 @@ local function initializeRun(_M)
|
|||
exec('enable-sound '..enableSound)
|
||||
gui.subframe_update(false)
|
||||
|
||||
return rewind():next(function(preferredExit)
|
||||
return rewind():next(function()
|
||||
if config.StartPowerup ~= nil then
|
||||
game.writePowerup(config.StartPowerup)
|
||||
end
|
||||
|
@ -500,7 +500,7 @@ local function initializeRun(_M)
|
|||
_M.currentArea = game.getCurrentArea()
|
||||
_M.lastArea = _M.currentArea
|
||||
|
||||
for areaId,areaInfo in pairs(_M.areaInfo) do
|
||||
for _,areaInfo in pairs(_M.areaInfo) do
|
||||
areaInfo.shortest = areaInfo.startDistance
|
||||
end
|
||||
|
||||
|
@ -512,7 +512,7 @@ end
|
|||
|
||||
local function getDistanceTraversed(areaInfo)
|
||||
local distanceTraversed = 0
|
||||
for areaId,areaInfo in pairs(areaInfo) do
|
||||
for _,areaInfo in pairs(areaInfo) do
|
||||
distanceTraversed = areaInfo.startDistance - areaInfo.shortest
|
||||
end
|
||||
return distanceTraversed
|
||||
|
|
|
@ -105,13 +105,13 @@ end
|
|||
|
||||
function _M.InitSpriteList()
|
||||
for k,v in pairs(_M.GoodSprites) do
|
||||
_M.extSprites[v] = 1
|
||||
_M.Sprites[v] = 1
|
||||
end
|
||||
for k,v in pairs(_M.BadSprites) do
|
||||
_M.extSprites[v] = -1
|
||||
_M.Sprites[v] = -1
|
||||
end
|
||||
for k,v in pairs(_M.NeutralSprites) do
|
||||
_M.extSprites[v] = 0
|
||||
_M.Sprites[v] = 0
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -153,7 +153,7 @@ local function get_sprite(base_addr)
|
|||
velocityY = memory.readsword(base_addr + offsets.velocityY),
|
||||
velomaxx = memory.readsword(base_addr + 0x26),
|
||||
velomaxy = memory.readsword(base_addr + 0x2a),
|
||||
motion = memory.readword(base_addr + 0x2e),
|
||||
motion = memory.readword(base_addr + offsets.motion),
|
||||
attr = memory.readword(base_addr + 0x30),
|
||||
animnum = memory.readword(base_addr + 0x36),
|
||||
remainingframe = memory.readword(base_addr + 0x38),
|
||||
|
|
Loading…
Add table
Reference in a new issue