2018-04-02 07:29:12 -07:00
|
|
|
-- "gameconfig" is kind of a misnomer, to be honest.
|
|
|
|
-- it's more like things the end user shouldn't have to change.
|
|
|
|
|
2018-06-08 14:59:55 -07:00
|
|
|
local function jp_buttons(s)
|
|
|
|
s = string.lower(s or "")
|
|
|
|
local t = {
|
|
|
|
up = false, down = false, left = false, right = false,
|
|
|
|
select = false, start = false, B = false, A = false,
|
|
|
|
}
|
|
|
|
for w in s:gmatch("%a+") do
|
|
|
|
if w == 'up' then t.up = true
|
|
|
|
elseif w == 'down' then t.down = true
|
|
|
|
elseif w == 'left' then t.left = true
|
|
|
|
elseif w == 'right' then t.right = true
|
|
|
|
elseif w == 'select' then t.select = true
|
|
|
|
elseif w == 'start' then t.start = true
|
|
|
|
elseif w == 'a' then t.A = true
|
|
|
|
elseif w == 'b' then t.B = true
|
|
|
|
else error(("unknown button: %s"):format(w)) end
|
|
|
|
end
|
|
|
|
return t
|
|
|
|
end
|
|
|
|
|
2018-04-02 06:21:55 -07:00
|
|
|
local gcfg = {
|
2018-06-10 07:41:07 -07:00
|
|
|
input_size = 60 + 4 - 19, -- TODO: let the script figure this out for us.
|
2018-04-02 06:21:55 -07:00
|
|
|
tile_count = 17 * 13,
|
|
|
|
|
|
|
|
ok_routines = {
|
|
|
|
[0x4] = true, -- sliding down flagpole
|
|
|
|
[0x5] = true, -- end of level auto-walk
|
|
|
|
[0x7] = true, -- start of level auto-walk
|
|
|
|
[0x8] = true, -- normal (in control)
|
|
|
|
[0x9] = true, -- acquiring mushroom
|
|
|
|
[0xA] = true, -- losing big mario
|
|
|
|
[0xB] = true, -- uhh
|
|
|
|
[0xC] = true, -- acquiring fireflower
|
|
|
|
},
|
|
|
|
|
|
|
|
bad_states = {
|
|
|
|
power = true,
|
|
|
|
waiting_demo = true,
|
|
|
|
playing_demo = true,
|
|
|
|
unknown = true,
|
|
|
|
lose = true,
|
|
|
|
},
|
|
|
|
|
|
|
|
jp_lut = {
|
2018-06-08 14:59:55 -07:00
|
|
|
jp_buttons(),
|
|
|
|
jp_buttons("a"),
|
|
|
|
jp_buttons("left"),
|
|
|
|
jp_buttons("right"),
|
|
|
|
jp_buttons("b left"),
|
|
|
|
jp_buttons("b right"),
|
|
|
|
jp_buttons("a left"),
|
|
|
|
jp_buttons("a right"),
|
|
|
|
jp_buttons("b a left"),
|
|
|
|
jp_buttons("b a right"),
|
|
|
|
jp_buttons("down"),
|
|
|
|
jp_buttons("a down"),
|
|
|
|
jp_buttons("up"),
|
2018-04-02 06:21:55 -07:00
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
return setmetatable(gcfg, {
|
|
|
|
__index = function(t, n)
|
|
|
|
error("cannot use undeclared gameconfig '" .. tostring(n) .. "'", 2)
|
|
|
|
end
|
|
|
|
})
|