2019-12-11 20:27:50 +00:00
|
|
|
-- functions to save and restore cartdata
|
|
|
|
|
|
|
|
function init_savegame()
|
|
|
|
cartdata"annabunches_a_pleasant_stroll_e25d3e5c"
|
|
|
|
end
|
|
|
|
|
|
|
|
function load_game()
|
2019-12-12 00:23:28 +00:00
|
|
|
local pos = dget"0"
|
|
|
|
player_x = flr(pos)
|
|
|
|
player_y = shl(pos, 16)
|
2019-12-11 20:27:50 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function save_game()
|
2019-12-12 00:23:28 +00:00
|
|
|
-- 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)
|
2019-12-11 20:27:50 +00:00
|
|
|
end
|
2019-12-11 23:20:13 +00:00
|
|
|
|
|
|
|
-- delete the save data
|
|
|
|
function clear_save()
|
|
|
|
memset(0x5e00, 0, 256)
|
2019-12-12 00:23:28 +00:00
|
|
|
init_world""
|
|
|
|
init_player""
|
2019-12-11 23:20:13 +00:00
|
|
|
end
|