game_save(STRING* name,var number,var mode)

Saves the current state of the application in a .sav file the save_dir folder, for later resuming the game at the current position.


name Name of the file to be saved, without extension and path
num STRING* or char*, number of up to three digits which will be added to the file name. The extension ".sav " will be added automatically.

Save mode, can be combined by adding or subtracting the following flags:

SV_VARS saves all the global user defined variables except var_info and var_nsave variables (C-Script) resp. except variables that end with _i or _n (lite-C).
SV_INFO saves all global var_info variables (C-Script) resp. all global variables that end with _i (lite-C).
SV_SYS saves all predefined engine variables.
SV_STRINGS saves all modified strings.
SV_POINTERS saves all pointers (C-Script only). In lite-C, use handles for saving references to objects.
SV_BMAPS saves all bmaps modified by bmap_for_screen. Other bmap manipulations are not saved.
SV_KEYS saves all functions assigned to keyboard, mouse, joystick, or other events.
SV_FUNCTIONS saves the state of all currently running functions, and all local variables.
SV_PANELS saves all panels and texts.
SV_VIEWS saves all views.
SV_SKY saves all sky entities.
saves the current level and all dynamic level entities. The physics registrations and velocities, the orientations of model bones, and the deformation of entity and terrain meshes is not saved.
SV_MATERIAL saves all materials. Effect code is not saved.
SV_PATH saves all paths changed by path_setnode or path_setedge
SV_STRUCT saves all memory areas marked by add_struct.
SV_ALL saves everything.


> 0 - successfully saved, <= 0 - operation failed.





// Save everything except the var_info variables
// is doing the same as the save() instruction of older versions
result = game_save("test",7,SV_ALL-SV_INFO);
if (result <= 0) { error("Save Error!"); } 

// save var_info, strings and bitmap after"info0.sav"
// is doing the same as the save_info() instruction of older versions

See also:

game_load, save_dir, add_struct, freeze_mode

► latest version online