Opens in Android Studio but haven't even tried to build it yet (it won't.. I know that much!)
2.2 KiB
Save Games
Save games are handled in code/server/sv_savegame.cpp
. A save game consists of blocks which start with their type (a 4 byte string) and length; in Jedi Academy they are as follows:
-
Save Game Version ("_VER" read in
SG_Open()
; must be iSAVEGAME_VERSION) -
Comment ("COMM" read in
SG_ReadSavegame()
) -
??? ignored ("CMTM" read in
SG_ReadSavegame()
) -
Map ("MPCM" read in
SG_ReadSavegame()
) -
CVars: Count ("CVCN" in
SG_ReadCvars()
) and each name and value ("CVAR" and "VALU") -
Whether it's an autosave ("GAME")
And if so, it reads various Cvars:
- "playersave" which contains the players' status ("CVSV")
- "playerammo" ("AMMO")
- "playerinv" ("IVTY")
- "playerfplvl" ("FPLV")
Else:
- server time ("TIME")
- server residual time ("TIMR")
- Portals ("PRTS")
- Server Config Strings: Count ("CSCN") and each index ("CSIN") and value ("CSDA")
-
At this point we enter game code; we are now in
ReadLevel()
incode/game/g_savegame.cpp
.There's some special case handling for autosaves and transitions (which I believe have to do with hub levels), but typically it then loads the client (
level.clients[0]
, "GCLI"). This is done usingEvaluateFields()
, which first reads the binary data, then possibly adjusts for differences between retail and patch (changedsaberInfo_t
) and finally fixes the pointers in the read data, e.g. strings. Half of thelevel_locals_t
data is loaded in the same way ("LVLC"). -
Objectives ("OBJT")
-
Effects ("FXLE", 32 * "FXFN")
-
Entities:
ReadGEntities()
- All the entities (count = "NMED", count * "EDNM", "GENT", "GNPC", "GCLI", "PARM", "VHIC", "GHL2")
- "GHL2" is handled by renderer, which has the G2 code.
- Timers
- Icarus
CIcarus::Load()
- Version ("ICAR", must match
CIcarus::ICARUS_VERSION
) - Buffer ("ISEQ") - flat buffer that is subsequently parsed to reconstruct the Icarus state
- Version ("ICAR", must match
- Icarus Endmarker ("ICOK")
g_entityInUseBits
("INUS")
- All the entities (count = "NMED", count * "EDNM", "GENT", "GNPC", "GCLI", "PARM", "VHIC", "GHL2")
-
Icarus Variables ("[FS]VAR", "[FS]IDL", "[FS]IDS", "[FS]VAL", "SVSZ")
-
player_locked
("LCKD") -
CG_ReadTheEvilCGHackStuff()
("FPSL", "IVSL") -
End marker ("DONE")