a_pleasant_stroll/debug.lua

70 lines
1.4 KiB
Lua
Raw Normal View History

2019-12-11 05:31:12 +00:00
-- 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_mod_buffer = false
end
function debug_f(mode)
if (band(mode, 0x1)) debug_res = not debug_res
if (band(mode, 0x2)) debug_map = not debug_map
if (band(mode, 0x4)) debug_sfx = not debug_sfx
if (band(mode, 0x8)) debuf_mod_buffer = not debug_mod_buffer
end
function teleport(x, y)
player_x, player_y = x, y
2019-12-11 05:31:12 +00:00
end
function debug_print()
if debug_res then
debug_print_res()
end
if debug_map then
debug_print_map()
end
if debug_sfx then
debug_print_sfx()
end
if debug_mod_buffer then
debug_print_mod_buffer()
end
end
function debug_print_res()
clip(70, 0, 32, 24)
2019-12-11 05:31:12 +00:00
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(64, 0, 8, 8)
print(stat(24), 64, 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)
2019-12-11 05:31:12 +00:00
clip()
end
function debug_print_mod_buffer()
clip(0, 0, 16, 128)
rectfill(0,0,16,128,0)
2019-12-11 05:31:12 +00:00
for k,v in pairs(mod_buffer) do
print(k .. ": " .. tostr(v))
end
clip()
end