User:Monster Iestyn/Source Code Documentation/p_saveg.h

From SRB2 Wiki
Jump to navigation Jump to search
Online link GitHub entry
File type C header file
#include guard __P_SAVEG__

This header file provides the typedefs, variables and function prototypes for saving data to, or loading data from, save game files for Single Player mode, or the $$$.sav file for netgames.

Function prototypes

Function name Return type Params Defined in Description
P_SaveGame void none p_saveg.c Saves session data for a Single Player game to a save game file.
P_SaveNetGame void none p_saveg.c Saves session data for a netgame to $$$.sav.
P_LoadGame boolean INT16 mapoverride p_saveg.c Loads session data for a Single Player game from a save game file.
P_LoadNetGame boolean none p_saveg.c Loads session data for a netgame from $$$.sav.
P_FindNewPosition mobj_t * UINT32 oldposition p_saveg.c Finds and returns the pointer to the mobj belonging to the "old position" given.

Typedefs

Name Type Description
savedata_t struct The struct for data loaded from a Single Player save game file.

savedata_t

Data name Data type Description
skincolor UINT8 The player's skin color.
skin UINT8 The player's skin, as a number (0 = Sonic, 1 = Tails, 2 = Knuckles).
botskin UINT8 If the game was played with a bot, this is the bot player's skin number plus one (1 = Sonic, 2 = Tails, 3 = Knuckles). Otherwise, this will have a value of 0, which indicates to the game no bot was used.
botcolor UINT8 If the game was played with a bot, this is the bot player's skin color. Otherwise, this will have a value of 0.
score INT32 The player's saved score.
lives INT32 The player's saved number of lives.
continues INT32 The player's saved number of continues.
emeralds UINT16 The player's saved Chaos Emeralds.

Externs

Data name Data type Non-extern location(s) Description
savedata savedata_t p_saveg.c Stores the data for the most recently loaded SP save game file.
*save_p UINT8 p_saveg.c Pointer to the current position in the SP save game file, $$$.sav file or game data file currently being written to or read from by SRB2.