Restoring Games

From AGI Wiki
Jump to: navigation, search

Restoring a game is accomplished by calling the restore.game command. The player is prompted to choose a directory, and one of the save games located in the directory. Unlike the save game list which shows all 12 slots, the restore games list only includes slots if a valid game file exists in the directory.

Restoring a game copies the game state, screen object table, inventory item data, script table and scan start list from the saved game file into AGI's memory. Reserved variables v20 (computer type), v26 (monitor type), v22 (sound channel count) and reserved flag f11 (noise channel available) are restored to match current hardware capabilities.

AGI then steps through the script table, and performs the resource actions (loading, drawing, unloading, etc.). At this point, the AGI interpreter memory heap is now completely restored.

Reserved flag f12 (game restored) is set to TRUE. All VOL files are closed (they will be re-opened as soon as the next resource is loaded).

All menu items are re-enabled (meaning you will need to re-disable any items that you want disabled), and AGI starts a new interpreter cycle.