68 lines
2 KiB
Lua
68 lines
2 KiB
Lua
-- "gameconfig" is kind of a misnomer, to be honest.
|
|
-- it's more like things the end user shouldn't have to change.
|
|
|
|
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
|
|
|
|
local gcfg = {
|
|
input_size = 60 + 4, -- TODO: let the script figure this out for us.
|
|
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 = {
|
|
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"),
|
|
},
|
|
}
|
|
|
|
return setmetatable(gcfg, {
|
|
__index = function(t, n)
|
|
error("cannot use undeclared gameconfig '" .. tostring(n) .. "'", 2)
|
|
end
|
|
})
|