26 lines
518 B
Lua
26 lines
518 B
Lua
-- functions to save and restore cartdata
|
|
|
|
function init_savegame()
|
|
cartdata"annabunches_a_pleasant_stroll_e25d3e5c"
|
|
end
|
|
|
|
function load_game()
|
|
local pos = dget"0"
|
|
player_x = flr(pos)
|
|
player_y = shl(pos, 16)
|
|
end
|
|
|
|
function save_game()
|
|
-- store location in 1 byte by packing Y position into the nominal
|
|
-- fraction section.
|
|
local pos = bor(player_x, lshr(player_y, 16))
|
|
dset(0, pos)
|
|
end
|
|
|
|
-- delete the save data
|
|
function clear_save()
|
|
memset(0x5e00, 0, 256)
|
|
init_world""
|
|
init_player""
|
|
end
|