a_pleasant_stroll/debug.lua

73 lines
1.4 KiB
Lua

-- various functions to support printing debug info
-- debug functions toggle debug status displays along the
-- top of the screen
function init_debug()
debug_res = false
debug_map = false
debug_sfx = false
debug_savedata = false
end
function debug_f(mode)
if band(mode, 0x1) ~= 0 then
debug_res = true
else
debug_res = false
end
if band(mode, 0x2) ~= 0 then
debug_map = true
else
debug_map = false
end
if band(mode, 0x4) ~= 0 then
debug_sfx = true
else
debug_sfx = false
end
if band(mode, 0x8) ~= 0 then
debug_savedata = true
else
debug_savedata = false
end
end
function teleport(x, y)
player_x, player_y = x, y
end
function debug_print()
if (debug_res) debug_print_res()
if (debug_map) debug_print_map()
if (debug_sfx) debug_print_sfx()
if (debug_savedata) debug_print_savedata()
end
function debug_print_res()
clip(70, 0, 32, 24)
print(stat(0), 70, 0, 15)
print(stat(1), 70, 8, 15)
print(stat(9) .. " / " .. stat(8), 70, 16, 15)
clip()
end
function debug_print_sfx()
clip(120, 0, 8, 8)
print(stat(24), 120, 0, 15)
clip()
end
function debug_print_map()
clip(24, 0, 32, 16)
print(player_x .. " " .. player_y, 24, 0, 15)
print(get_biome_name(player_x, player_y), 24, 8, 15)
clip()
end
function debug_print_savedata()
print(tostr(dget(0), 1), 16, 122, 15)
end